@wakastellar/ui 4.0.1 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/_shared/identity/InviteUserPanel.cjs.js +1 -1
- package/dist/blocks/_shared/identity/RoleSelect.cjs.js +1 -1
- package/dist/blocks/_shared/identity/SidePushLayout.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.es.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.cjs.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.es.js +1 -1
- package/dist/blocks/api-keys-manager/index.cjs.js +1 -1
- package/dist/blocks/apm-overview/index.cjs.js +1 -1
- package/dist/blocks/auth-2fa/index.cjs.js +2 -2
- package/dist/blocks/auth-2fa/index.es.js +1 -1
- package/dist/blocks/avatar-upload/index.cjs.js +1 -1
- package/dist/blocks/avatar-upload/index.es.js +13 -13
- package/dist/blocks/calendar-view/index.cjs.js +1 -1
- package/dist/blocks/calendar-view/index.es.js +1 -1
- package/dist/blocks/chat/index.cjs.js +1 -1
- package/dist/blocks/chat/index.es.js +162 -162
- package/dist/blocks/chat/widget.cjs.js +1 -1
- package/dist/blocks/chat/widget.es.js +19 -13
- package/dist/blocks/chat-interface/index.cjs.js +1 -1
- package/dist/blocks/chat-interface/index.es.js +1 -1
- package/dist/blocks/checkout-flow/index.cjs.js +1 -1
- package/dist/blocks/checkout-flow/index.es.js +1 -1
- package/dist/blocks/cicd-builder/index.cjs.js +1 -1
- package/dist/blocks/clamav-service-status/index.cjs.js +1 -1
- package/dist/blocks/cloud-cost-dashboard/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.es.js +2 -1
- package/dist/blocks/dashboard/index.cjs.js +1 -1
- package/dist/blocks/dashboard/index.es.js +2 -2
- package/dist/blocks/dashboard-kpi/index.cjs.js +1 -1
- package/dist/blocks/dashboard-kpi/index.es.js +1 -1
- package/dist/blocks/database-admin/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.es.js +1 -1
- package/dist/blocks/empty-states/index.cjs.js +1 -1
- package/dist/blocks/empty-states/index.es.js +1 -1
- package/dist/blocks/error-pages/index.cjs.js +1 -1
- package/dist/blocks/error-pages/index.es.js +1 -1
- package/dist/blocks/faq/index.cjs.js +1 -1
- package/dist/blocks/faq/index.es.js +1 -1
- package/dist/blocks/file-manager/index.cjs.js +1 -1
- package/dist/blocks/file-manager/index.es.js +1 -1
- package/dist/blocks/file-scan-uploader/index.cjs.js +1 -1
- package/dist/blocks/file-scan-uploader/index.es.js +2 -2
- package/dist/blocks/footer/index.cjs.js +1 -1
- package/dist/blocks/gitops-sync-status/index.cjs.js +1 -1
- package/dist/blocks/header/index.cjs.js +1 -1
- package/dist/blocks/header/index.es.js +1 -1
- package/dist/blocks/headtab/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.es.js +127 -127
- package/dist/blocks/incident-manager/index.cjs.js +1 -1
- package/dist/blocks/infrastructure-map/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.es.js +1 -1
- package/dist/blocks/landing/index.cjs.js +1 -1
- package/dist/blocks/landing/index.es.js +1 -1
- package/dist/blocks/language-selector/index.cjs.js +1 -1
- package/dist/blocks/layout/index.cjs.js +1 -1
- package/dist/blocks/login/index.cjs.js +1 -1
- package/dist/blocks/on-call-schedule/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.es.js +1 -1
- package/dist/blocks/pricing/index.cjs.js +1 -1
- package/dist/blocks/pricing/index.es.js +1 -1
- package/dist/blocks/profile/index.cjs.js +1 -1
- package/dist/blocks/profile/index.es.js +1 -1
- package/dist/blocks/profile-list/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.es.js +1 -1
- package/dist/blocks/release-notes/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.es.js +1 -1
- package/dist/blocks/scan-policy-editor/index.cjs.js +1 -1
- package/dist/blocks/scan-report-generator/index.cjs.js +1 -1
- package/dist/blocks/settings/index.cjs.js +1 -1
- package/dist/blocks/settings/index.es.js +1 -1
- package/dist/blocks/sidebar/index.cjs.js +1 -1
- package/dist/blocks/sidebar/index.es.js +1 -1
- package/dist/blocks/signature-database-manager/index.cjs.js +1 -1
- package/dist/blocks/team-form/index.cjs.js +1 -1
- package/dist/blocks/threat-alert-banner/index.cjs.js +1 -1
- package/dist/blocks/user-management/index.cjs.js +1 -1
- package/dist/blocks/waka-doc-shell/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.es.js +37 -37
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +8 -8
- package/dist/cli/index.cjs +5 -1
- package/dist/components/DataTable/DataTable.cjs.js +1 -1
- package/dist/components/DataTable/DataTable.es.js +68 -66
- package/dist/components/DataTable/DataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/DataTableColumnResizer.cjs.js +1 -1
- package/dist/components/DataTable/DataTableContextMenu.cjs.js +1 -1
- package/dist/components/DataTable/DataTableEditCell.cjs.js +1 -1
- package/dist/components/DataTable/DataTableFilters.cjs.js +1 -1
- package/dist/components/DataTable/DataTableGrouping.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.d.ts +3 -1
- package/dist/components/DataTable/DataTablePagination.es.js +38 -27
- package/dist/components/DataTable/DataTableSelection.cjs.js +1 -1
- package/dist/components/DataTable/DataTableToolbar.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.es.js +5 -1
- package/dist/components/DataTable/hooks/useDataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableEdit.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableExport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.es.js +2 -1
- package/dist/components/DataTable/hooks/useDataTableTheme.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableVirtualization.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useTableLayout.cjs.js +1 -1
- package/dist/components/DataTable/utils.cjs.js +1 -1
- package/dist/components/accordion/index.cjs.js +1 -1
- package/dist/components/alert/index.cjs.js +1 -1
- package/dist/components/alert-dialog/index.cjs.js +1 -1
- package/dist/components/aspect-ratio/index.cjs.js +1 -1
- package/dist/components/avatar/index.cjs.js +1 -1
- package/dist/components/badge/index.cjs.js +1 -1
- package/dist/components/button/index.cjs.js +1 -1
- package/dist/components/calendar/index.cjs.js +1 -1
- package/dist/components/card/index.cjs.js +1 -1
- package/dist/components/checkbox/index.cjs.js +1 -1
- package/dist/components/code/index.cjs.js +2 -2
- package/dist/components/code/index.es.js +3 -2
- package/dist/components/collapsible/index.cjs.js +1 -1
- package/dist/components/command/index.cjs.js +1 -1
- package/dist/components/context-menu/index.cjs.js +1 -1
- package/dist/components/dialog/index.cjs.js +1 -1
- package/dist/components/dropdown-menu/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.es.js +12 -12
- package/dist/components/editor/blocks/waka-acceptance-criteria-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-ai-assist-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-api-endpoint-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-code-playground-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-comment-thread-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-diagram-block.cjs.js +3 -3
- package/dist/components/editor/blocks/waka-diagram-block.es.js +21 -40
- package/dist/components/editor/blocks/waka-embed-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-slash-menu-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-user-story-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-version-diff-block.cjs.js +1 -1
- package/dist/components/editor/waka-ai-writer.cjs.js +1 -1
- package/dist/components/editor/waka-collaborative-editor.cjs.js +1 -1
- package/dist/components/editor/waka-diff-viewer.cjs.js +1 -1
- package/dist/components/editor/waka-dnd-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.es.js +1 -1
- package/dist/components/editor/waka-editor-elements.cjs.js +1 -1
- package/dist/components/editor/waka-editor-leaves.cjs.js +1 -1
- package/dist/components/editor/waka-editor-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-editor.cjs.js +1 -1
- package/dist/components/editor/waka-floating-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-markdown-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.es.js +2 -2
- package/dist/components/editor/waka-slash-menu.cjs.js +1 -1
- package/dist/components/editor/waka-spec-editor.cjs.js +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/hover-card/index.cjs.js +1 -1
- package/dist/components/input/index.cjs.js +1 -1
- package/dist/components/input-otp/index.cjs.js +1 -1
- package/dist/components/input-otp/index.es.js +2 -1
- package/dist/components/label/index.cjs.js +1 -1
- package/dist/components/language-selector/index.cjs.js +1 -1
- package/dist/components/menubar/index.cjs.js +1 -1
- package/dist/components/navigation-menu/index.cjs.js +1 -1
- package/dist/components/popover/index.cjs.js +1 -1
- package/dist/components/progress/index.cjs.js +1 -1
- package/dist/components/radio-group/index.cjs.js +1 -1
- package/dist/components/resizable/index.cjs.js +1 -1
- package/dist/components/resizable/index.es.js +9 -9
- package/dist/components/scroll-area/index.cjs.js +1 -1
- package/dist/components/select/index.cjs.js +1 -1
- package/dist/components/separator/index.cjs.js +1 -1
- package/dist/components/sheet/index.cjs.js +1 -1
- package/dist/components/skeleton/index.cjs.js +1 -1
- package/dist/components/slider/index.cjs.js +1 -1
- package/dist/components/switch/index.cjs.js +1 -1
- package/dist/components/table/index.cjs.js +1 -1
- package/dist/components/tabs/index.cjs.js +1 -1
- package/dist/components/textarea/index.cjs.js +1 -1
- package/dist/components/theme-selector/index.cjs.js +1 -1
- package/dist/components/toast/index.cjs.js +1 -1
- package/dist/components/toaster/index.cjs.js +1 -1
- package/dist/components/toggle/index.cjs.js +1 -1
- package/dist/components/toggle-group/index.cjs.js +1 -1
- package/dist/components/tooltip/index.cjs.js +1 -1
- package/dist/components/typography/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.es.js +1 -1
- package/dist/components/waka-achievement-unlock/index.cjs.js +1 -1
- package/dist/components/waka-achievement-unlock/index.es.js +1 -1
- package/dist/components/waka-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-activity-feed/index.es.js +1 -1
- package/dist/components/waka-ad-banner/index.cjs.js +1 -1
- package/dist/components/waka-ad-banner/index.es.js +18 -15
- package/dist/components/waka-ad-fallback/index.cjs.js +1 -1
- package/dist/components/waka-ad-fallback/index.es.js +1 -1
- package/dist/components/waka-ad-inline/index.cjs.js +1 -1
- package/dist/components/waka-ad-inline/index.es.js +2 -2
- package/dist/components/waka-ad-interstitial/index.cjs.js +1 -1
- package/dist/components/waka-ad-interstitial/index.es.js +3 -3
- package/dist/components/waka-ad-placeholder/index.cjs.js +2 -2
- package/dist/components/waka-ad-placeholder/index.es.js +1 -1
- package/dist/components/waka-ad-provider/index.cjs.js +1 -1
- package/dist/components/waka-ad-provider/index.es.js +1 -1
- package/dist/components/waka-ad-sidebar/index.cjs.js +1 -1
- package/dist/components/waka-ad-sidebar/index.es.js +2 -2
- package/dist/components/waka-ad-sticky-footer/index.cjs.js +1 -1
- package/dist/components/waka-ad-sticky-footer/index.es.js +2 -2
- package/dist/components/waka-address-autocomplete/index.cjs.js +2 -2
- package/dist/components/waka-address-autocomplete/index.es.js +10 -6
- package/dist/components/waka-admincrumb/index.cjs.js +1 -1
- package/dist/components/waka-alert-panel/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.es.js +1 -1
- package/dist/components/waka-allocation-matrix/index.cjs.js +2 -2
- package/dist/components/waka-allocation-matrix/index.es.js +1 -1
- package/dist/components/waka-approval-chain/index.cjs.js +1 -1
- package/dist/components/waka-approval-chain/index.es.js +1 -1
- package/dist/components/waka-artifact-list/index.cjs.js +1 -1
- package/dist/components/waka-artifact-list/index.es.js +1 -1
- package/dist/components/waka-audit-log/index.cjs.js +2 -2
- package/dist/components/waka-audit-log/index.es.js +1 -1
- package/dist/components/waka-autocomplete/index.cjs.js +1 -1
- package/dist/components/waka-autocomplete/index.es.js +3 -2
- package/dist/components/waka-badge-showcase/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.es.js +1 -1
- package/dist/components/waka-biometric-prompt/index.cjs.js +2 -2
- package/dist/components/waka-biometric-prompt/index.es.js +1 -1
- package/dist/components/waka-bottom-sheet/index.cjs.js +1 -1
- package/dist/components/waka-bottom-sheet/index.es.js +12 -7
- package/dist/components/waka-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb/index.es.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.es.js +1 -1
- package/dist/components/waka-budget-burn/index.cjs.js +2 -2
- package/dist/components/waka-budget-burn/index.es.js +3 -3
- package/dist/components/waka-build-matrix/index.cjs.js +1 -1
- package/dist/components/waka-capacity-planner/index.cjs.js +2 -2
- package/dist/components/waka-capacity-planner/index.es.js +1 -1
- package/dist/components/waka-carousel/index.cjs.js +1 -1
- package/dist/components/waka-carousel/index.es.js +2 -2
- package/dist/components/waka-cart-summary/index.cjs.js +1 -1
- package/dist/components/waka-cart-summary/index.es.js +2 -2
- package/dist/components/waka-challenge-timer/index.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.es.js +2 -2
- package/dist/components/waka-charts/WakaBarChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaBarChart.es.js +2 -2
- package/dist/components/waka-charts/WakaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaChart.es.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.es.js +2 -2
- package/dist/components/waka-charts/WakaMiniChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaMiniChart.es.js +2 -2
- package/dist/components/waka-charts/WakaPieChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaPieChart.es.js +2 -2
- package/dist/components/waka-charts/WakaSparkline.cjs.js +1 -1
- package/dist/components/waka-charts/WakaSparkline.es.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.cjs.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.es.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.es.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.es.js +1 -1
- package/dist/components/waka-chat-bubble/index.cjs.js +1 -1
- package/dist/components/waka-checklist/index.cjs.js +2 -2
- package/dist/components/waka-checklist/index.es.js +1 -1
- package/dist/components/waka-checkout-stepper/index.cjs.js +1 -1
- package/dist/components/waka-checkout-stepper/index.es.js +1 -1
- package/dist/components/waka-cohort-table/index.cjs.js +2 -2
- package/dist/components/waka-cohort-table/index.es.js +1 -1
- package/dist/components/waka-color-picker/index.cjs.js +2 -2
- package/dist/components/waka-color-picker/index.es.js +1 -1
- package/dist/components/waka-combo-counter/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.es.js +3 -2
- package/dist/components/waka-command-bar/index.cjs.js +1 -1
- package/dist/components/waka-compare-period/index.cjs.js +2 -2
- package/dist/components/waka-compare-period/index.es.js +7 -5
- package/dist/components/waka-config-comparator/index.cjs.js +1 -1
- package/dist/components/waka-config-comparator/index.es.js +1 -1
- package/dist/components/waka-connection-matrix/index.cjs.js +1 -1
- package/dist/components/waka-connection-matrix/index.es.js +1 -1
- package/dist/components/waka-container-list/index.cjs.js +1 -1
- package/dist/components/waka-container-list/index.es.js +1 -1
- package/dist/components/waka-content-recommendation/index.cjs.js +1 -1
- package/dist/components/waka-content-recommendation/index.es.js +2 -2
- package/dist/components/waka-contribution-graph/index.cjs.js +1 -1
- package/dist/components/waka-contribution-graph/index.es.js +4 -4
- package/dist/components/waka-cost-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-cost-breakdown/index.es.js +7 -7
- package/dist/components/waka-coupon-input/index.cjs.js +2 -2
- package/dist/components/waka-coupon-input/index.es.js +1 -1
- package/dist/components/waka-credit-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-credit-activity-feed/index.es.js +1 -1
- package/dist/components/waka-credit-alert/index.cjs.js +1 -1
- package/dist/components/waka-credit-alert/index.es.js +1 -1
- package/dist/components/waka-credit-balance/index.cjs.js +1 -1
- package/dist/components/waka-credit-balance/index.es.js +3 -3
- package/dist/components/waka-credit-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-credit-breakdown/index.es.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.cjs.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.es.js +1 -1
- package/dist/components/waka-credit-card-input/index.cjs.js +1 -1
- package/dist/components/waka-credit-card-input/index.es.js +1 -1
- package/dist/components/waka-credit-history/index.cjs.js +1 -1
- package/dist/components/waka-credit-history/index.es.js +1 -1
- package/dist/components/waka-credit-meter/index.cjs.js +2 -2
- package/dist/components/waka-credit-meter/index.es.js +3 -3
- package/dist/components/waka-credit-pricing-pack/index.cjs.js +1 -1
- package/dist/components/waka-credit-pricing-pack/index.es.js +1 -1
- package/dist/components/waka-credit-projection/index.cjs.js +1 -1
- package/dist/components/waka-credit-projection/index.es.js +1 -1
- package/dist/components/waka-credit-quota/index.cjs.js +1 -1
- package/dist/components/waka-credit-quota/index.es.js +3 -3
- package/dist/components/waka-credit-receipt/index.cjs.js +1 -1
- package/dist/components/waka-credit-receipt/index.es.js +1 -1
- package/dist/components/waka-credit-top-up/index.cjs.js +1 -1
- package/dist/components/waka-credit-top-up/index.es.js +1 -1
- package/dist/components/waka-credit-transaction/index.cjs.js +1 -1
- package/dist/components/waka-credit-transaction/index.es.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.cjs.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.es.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.cjs.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.es.js +1 -1
- package/dist/components/waka-daily-reward/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.es.js +1 -1
- package/dist/components/waka-date-range-picker/index.cjs.js +1 -1
- package/dist/components/waka-date-range-picker/index.es.js +3 -2
- package/dist/components/waka-datetime-picker/index.cjs.js +1 -1
- package/dist/components/waka-datetime-picker/index.es.js +4 -1
- package/dist/components/waka-datetime-picker.form-integration/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.es.js +1 -1
- package/dist/components/waka-deployment-lane/index.cjs.js +1 -1
- package/dist/components/waka-deployment-lane/index.es.js +1 -1
- package/dist/components/waka-device-trust/index.cjs.js +2 -2
- package/dist/components/waka-device-trust/index.es.js +1 -1
- package/dist/components/waka-doc-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-doc-callout/index.cjs.js +1 -1
- package/dist/components/waka-doc-code-block/index.cjs.js +1 -1
- package/dist/components/waka-doc-nav/index.cjs.js +1 -1
- package/dist/components/waka-doc-renderer/index.cjs.js +1 -1
- package/dist/components/waka-doc-search/index.cjs.js +1 -1
- package/dist/components/waka-doc-table/index.cjs.js +1 -1
- package/dist/components/waka-doc-toc/index.cjs.js +1 -1
- package/dist/components/waka-doc-toolbar/index.cjs.js +1 -1
- package/dist/components/waka-doc-version/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.es.js +2 -2
- package/dist/components/waka-drawer/index.cjs.js +1 -1
- package/dist/components/waka-drawer/index.es.js +1 -1
- package/dist/components/waka-empty-state/index.cjs.js +1 -1
- package/dist/components/waka-env-var-editor/index.cjs.js +1 -1
- package/dist/components/waka-error-shake/index.cjs.js +1 -1
- package/dist/components/waka-feature-announcement/index.cjs.js +2 -2
- package/dist/components/waka-feature-announcement/index.es.js +1 -1
- package/dist/components/waka-feature-flag-row/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.es.js +2 -2
- package/dist/components/waka-floating-nav/index.cjs.js +1 -1
- package/dist/components/waka-floating-nav/index.es.js +1 -1
- package/dist/components/waka-flow-diagram/index.cjs.js +1 -1
- package/dist/components/waka-funnel-chart/index.cjs.js +2 -2
- package/dist/components/waka-funnel-chart/index.es.js +1 -1
- package/dist/components/waka-glow-card/index.cjs.js +1 -1
- package/dist/components/waka-glow-card/index.es.js +3 -3
- package/dist/components/waka-goal-progress/index.cjs.js +3 -3
- package/dist/components/waka-goal-progress/index.es.js +3 -3
- package/dist/components/waka-haptic-button/index.cjs.js +1 -1
- package/dist/components/waka-health-pulse/index.cjs.js +2 -2
- package/dist/components/waka-health-pulse/index.es.js +1 -1
- package/dist/components/waka-heatmap/index.cjs.js +1 -1
- package/dist/components/waka-heatmap/index.es.js +3 -3
- package/dist/components/waka-hotspot/index.cjs.js +1 -1
- package/dist/components/waka-image/index.cjs.js +1 -1
- package/dist/components/waka-image/index.es.js +1 -1
- package/dist/components/waka-incident-timeline/index.cjs.js +1 -1
- package/dist/components/waka-incident-timeline/index.es.js +3 -2
- package/dist/components/waka-invoice-preview/index.cjs.js +1 -1
- package/dist/components/waka-invoice-preview/index.es.js +1 -1
- package/dist/components/waka-kanban/index.cjs.js +1 -1
- package/dist/components/waka-kanban/index.es.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.cjs.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.es.js +6 -4
- package/dist/components/waka-kubernetes-overview/index.cjs.js +1 -1
- package/dist/components/waka-kubernetes-overview/index.es.js +1 -1
- package/dist/components/waka-leaderboard/index.cjs.js +1 -1
- package/dist/components/waka-level-progress/index.cjs.js +2 -2
- package/dist/components/waka-level-progress/index.es.js +2 -2
- package/dist/components/waka-liquid-button/index.cjs.js +1 -1
- package/dist/components/waka-loading-orbit/index.cjs.js +1 -1
- package/dist/components/waka-log-viewer/index.cjs.js +1 -1
- package/dist/components/waka-loot-box/index.cjs.js +2 -2
- package/dist/components/waka-loot-box/index.es.js +1 -1
- package/dist/components/waka-magic-link/index.cjs.js +2 -2
- package/dist/components/waka-magnetic-button/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.es.js +52 -40
- package/dist/components/waka-metric-sparkline/index.cjs.js +1 -1
- package/dist/components/waka-metric-sparkline/index.es.js +1 -1
- package/dist/components/waka-migration-list/index.cjs.js +1 -1
- package/dist/components/waka-milestone-road/index.cjs.js +2 -2
- package/dist/components/waka-milestone-road/index.es.js +5 -5
- package/dist/components/waka-modal/index.cjs.js +1 -1
- package/dist/components/waka-modal/index.es.js +1 -1
- package/dist/components/waka-morph-button/index.cjs.js +2 -2
- package/dist/components/waka-morph-button/index.es.js +6 -2
- package/dist/components/waka-network-topology/index.cjs.js +1 -1
- package/dist/components/waka-network-topology/index.es.js +4 -2
- package/dist/components/waka-notifications/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.es.js +1 -1
- package/dist/components/waka-orbital-menu/index.cjs.js +1 -1
- package/dist/components/waka-orbital-menu/index.es.js +1 -1
- package/dist/components/waka-order-tracker/index.cjs.js +1 -1
- package/dist/components/waka-order-tracker/index.es.js +3 -2
- package/dist/components/waka-outstream-video/index.cjs.js +1 -1
- package/dist/components/waka-outstream-video/index.es.js +2 -2
- package/dist/components/waka-pagination/index.cjs.js +1 -1
- package/dist/components/waka-pagination/index.es.js +1 -1
- package/dist/components/waka-password-strength/index.cjs.js +2 -2
- package/dist/components/waka-password-strength/index.es.js +3 -3
- package/dist/components/waka-payment-method-picker/index.cjs.js +1 -1
- package/dist/components/waka-payment-method-picker/index.es.js +1 -1
- package/dist/components/waka-permission-matrix/index.cjs.js +2 -2
- package/dist/components/waka-permission-matrix/index.es.js +3 -2
- package/dist/components/waka-phone-input/index.cjs.js +1 -1
- package/dist/components/waka-phone-input/index.es.js +5 -3
- package/dist/components/waka-pipeline-view/index.cjs.js +2 -2
- package/dist/components/waka-pipeline-view/index.es.js +1 -1
- package/dist/components/waka-player-card/index.cjs.js +2 -2
- package/dist/components/waka-player-card/index.es.js +4 -4
- package/dist/components/waka-pod-card/index.cjs.js +1 -1
- package/dist/components/waka-pod-card/index.es.js +1 -1
- package/dist/components/waka-points-popup/index.cjs.js +1 -1
- package/dist/components/waka-points-popup/index.es.js +5 -1
- package/dist/components/waka-power-up/index.cjs.js +1 -1
- package/dist/components/waka-presence-indicator/index.cjs.js +2 -2
- package/dist/components/waka-presence-indicator/index.es.js +1 -1
- package/dist/components/waka-pricing-table/index.cjs.js +2 -2
- package/dist/components/waka-pricing-table/index.es.js +1 -1
- package/dist/components/waka-product-card/index.cjs.js +1 -1
- package/dist/components/waka-progress-onboarding/index.cjs.js +3 -3
- package/dist/components/waka-progress-onboarding/index.es.js +1 -1
- package/dist/components/waka-pull-to-refresh/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.es.js +1 -1
- package/dist/components/waka-query-explain/index.cjs.js +1 -1
- package/dist/components/waka-quest-card/index.cjs.js +2 -2
- package/dist/components/waka-quest-card/index.es.js +4 -1
- package/dist/components/waka-quota-bar/index.cjs.js +2 -2
- package/dist/components/waka-quota-bar/index.es.js +11 -4
- package/dist/components/waka-radar-score/index.cjs.js +1 -1
- package/dist/components/waka-radar-score/index.es.js +6 -6
- package/dist/components/waka-rank-badge/index.cjs.js +2 -2
- package/dist/components/waka-rank-badge/index.es.js +1 -1
- package/dist/components/waka-rating-input/index.cjs.js +2 -2
- package/dist/components/waka-rating-input/index.es.js +1 -1
- package/dist/components/waka-reaction-picker/index.cjs.js +1 -1
- package/dist/components/waka-reaction-picker/index.es.js +7 -4
- package/dist/components/waka-region-map/index.cjs.js +1 -1
- package/dist/components/waka-region-map/index.es.js +1 -1
- package/dist/components/waka-resource-gauge/index.cjs.js +2 -2
- package/dist/components/waka-resource-gauge/index.es.js +3 -3
- package/dist/components/waka-resource-pool/index.cjs.js +2 -2
- package/dist/components/waka-resource-pool/index.es.js +1 -1
- package/dist/components/waka-rich-text-editor/index.cjs.js +1 -1
- package/dist/components/waka-rich-text-editor/index.es.js +1 -1
- package/dist/components/waka-rollback-slider/index.cjs.js +2 -2
- package/dist/components/waka-rollback-slider/index.es.js +5 -3
- package/dist/components/waka-sankey-diagram/index.cjs.js +2 -2
- package/dist/components/waka-sankey-diagram/index.es.js +5 -5
- package/dist/components/waka-schedule-picker/index.cjs.js +1 -1
- package/dist/components/waka-schedule-picker/index.es.js +3 -2
- package/dist/components/waka-scratch-card/index.cjs.js +2 -2
- package/dist/components/waka-scratch-card/index.es.js +1 -1
- package/dist/components/waka-season-pass/index.cjs.js +1 -1
- package/dist/components/waka-secret-card/index.cjs.js +1 -1
- package/dist/components/waka-security-scan-result/index.cjs.js +1 -1
- package/dist/components/waka-security-score/index.cjs.js +2 -2
- package/dist/components/waka-security-score/index.es.js +5 -5
- package/dist/components/waka-segmented-control/index.cjs.js +1 -1
- package/dist/components/waka-segmented-control/index.es.js +1 -1
- package/dist/components/waka-server-rack/index.cjs.js +1 -1
- package/dist/components/waka-service-graph/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.es.js +3 -2
- package/dist/components/waka-signature-pad/index.cjs.js +1 -1
- package/dist/components/waka-signature-pad/index.es.js +1 -1
- package/dist/components/waka-skeleton-wave/index.cjs.js +1 -1
- package/dist/components/waka-skill-tree/index.cjs.js +2 -2
- package/dist/components/waka-skill-tree/index.es.js +32 -32
- package/dist/components/waka-sla-tracker/index.cjs.js +1 -1
- package/dist/components/waka-sla-tracker/index.es.js +1 -1
- package/dist/components/waka-slider-range/index.cjs.js +1 -1
- package/dist/components/waka-slider-range/index.es.js +3 -3
- package/dist/components/waka-spin-wheel/index.cjs.js +2 -2
- package/dist/components/waka-spin-wheel/index.es.js +6 -6
- package/dist/components/waka-spinner/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.es.js +1 -1
- package/dist/components/waka-sponsored-card/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-card/index.es.js +2 -2
- package/dist/components/waka-sponsored-feed/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-feed/index.es.js +2 -2
- package/dist/components/waka-spotlight/index.cjs.js +1 -1
- package/dist/components/waka-spotlight/index.es.js +2 -1
- package/dist/components/waka-stat/index.cjs.js +1 -1
- package/dist/components/waka-stat/index.es.js +1 -1
- package/dist/components/waka-stats-hexagon/index.cjs.js +1 -1
- package/dist/components/waka-stats-hexagon/index.es.js +9 -9
- package/dist/components/waka-status-matrix/index.cjs.js +1 -1
- package/dist/components/waka-status-matrix/index.es.js +1 -1
- package/dist/components/waka-stepper/index.cjs.js +1 -1
- package/dist/components/waka-stepper/index.es.js +1 -1
- package/dist/components/waka-streak-counter/index.cjs.js +1 -1
- package/dist/components/waka-success-explosion/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.es.js +2 -2
- package/dist/components/waka-tabs-morph/index.cjs.js +1 -1
- package/dist/components/waka-tabs-morph/index.es.js +1 -1
- package/dist/components/waka-tag-input/index.cjs.js +1 -1
- package/dist/components/waka-tag-input/index.es.js +3 -2
- package/dist/components/waka-team-banner/index.cjs.js +2 -2
- package/dist/components/waka-team-banner/index.es.js +1 -1
- package/dist/components/waka-terminal-output/index.cjs.js +2 -2
- package/dist/components/waka-terminal-output/index.es.js +5 -3
- package/dist/components/waka-test-report/index.cjs.js +1 -1
- package/dist/components/waka-theme-creator/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.es.js +5 -2
- package/dist/components/waka-thread-view/index.cjs.js +2 -2
- package/dist/components/waka-thread-view/index.es.js +1 -1
- package/dist/components/waka-tilt-card/index.cjs.js +1 -1
- package/dist/components/waka-tilt-card/index.es.js +8 -6
- package/dist/components/waka-time-picker/index.cjs.js +1 -1
- package/dist/components/waka-time-picker/index.es.js +10 -6
- package/dist/components/waka-timeline/index.cjs.js +1 -1
- package/dist/components/waka-timeline/index.es.js +1 -1
- package/dist/components/waka-tooltip-tour/index.cjs.js +3 -3
- package/dist/components/waka-tooltip-tour/index.es.js +53 -51
- package/dist/components/waka-tour-guide/index.cjs.js +2 -2
- package/dist/components/waka-tour-guide/index.es.js +1 -1
- package/dist/components/waka-tournament-bracket/index.cjs.js +2 -2
- package/dist/components/waka-tournament-bracket/index.es.js +1 -1
- package/dist/components/waka-trace-viewer/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.es.js +1 -1
- package/dist/components/waka-treemap-chart/index.cjs.js +1 -1
- package/dist/components/waka-treemap-chart/index.es.js +1 -1
- package/dist/components/waka-two-factor-setup/index.cjs.js +2 -2
- package/dist/components/waka-two-factor-setup/index.es.js +5 -4
- package/dist/components/waka-typewriter/index.cjs.js +1 -1
- package/dist/components/waka-typewriter/index.es.js +7 -2
- package/dist/components/waka-typing-indicator/index.cjs.js +2 -2
- package/dist/components/waka-typing-indicator/index.es.js +1 -1
- package/dist/components/waka-versus-card/index.cjs.js +3 -3
- package/dist/components/waka-versus-card/index.es.js +5 -4
- package/dist/components/waka-video/index.cjs.js +1 -1
- package/dist/components/waka-video/index.es.js +1 -1
- package/dist/components/waka-video-ad/index.cjs.js +1 -1
- package/dist/components/waka-video-ad/index.es.js +3 -3
- package/dist/components/waka-video-call/index.cjs.js +2 -2
- package/dist/components/waka-video-call/index.es.js +1 -1
- package/dist/components/waka-video-overlay/index.cjs.js +1 -1
- package/dist/components/waka-video-overlay/index.es.js +2 -2
- package/dist/components/waka-virtual-list/index.cjs.js +1 -1
- package/dist/components/waka-virtual-list/index.es.js +1 -1
- package/dist/components/waka-voice-message/index.cjs.js +1 -1
- package/dist/components/waka-voice-message/index.es.js +6 -5
- package/dist/components/waka-welcome-modal/index.cjs.js +2 -2
- package/dist/components/waka-welcome-modal/index.es.js +1 -1
- package/dist/components/waka-xp-bar/index.cjs.js +1 -1
- package/dist/components/waka-xp-bar/index.es.js +2 -2
- package/dist/context/admincrumb-context.cjs.js +1 -1
- package/dist/context/language-context.cjs.js +1 -1
- package/dist/context/language-context.es.js +2 -2
- package/dist/context/theme-context.cjs.js +1 -1
- package/dist/context/theme-provider.cjs.js +1 -1
- package/dist/context/theme-provider.es.js +9 -6
- package/dist/context/waka-provider.cjs.js +1 -1
- package/dist/context/waka-provider.es.js +57 -53
- package/dist/doc.cjs.js +1 -1
- package/dist/editor.cjs.js +1 -1
- package/dist/export.cjs.js +1 -1
- package/dist/hooks/use-toast.cjs.js +1 -1
- package/dist/hooks/use-translation.cjs.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +279 -278
- package/dist/lib/i18n.cjs.js +1 -1
- package/dist/lib/i18n.es.js +11 -9
- package/dist/locales/default-resources.cjs.js +1 -0
- package/dist/locales/default-resources.d.ts +155 -0
- package/dist/locales/default-resources.es.js +150 -0
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.cjs.js +13 -13
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.es.js +13 -13
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.es.js +19 -19
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.es.js +24 -25
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.es.js +26 -23
- package/dist/rich-text.cjs.js +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils/cn.cjs.js +1 -1
- package/dist/utils/datetime-helpers.cjs.js +1 -1
- package/dist/utils/theme-loader.cjs.js +1 -1
- package/dist/utils/tweak.cjs.js +1 -1
- package/package.json +28 -27
- package/src/components/DataTable/DataTable.tsx +2 -0
- package/src/components/DataTable/DataTablePagination.tsx +28 -8
- package/src/components/DataTable/hooks/useDataTable.ts +13 -0
- package/src/components/editor/blocks/waka-diagram-block.tsx +7 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../../components/button/index.cjs.js"),n=require("../../../components/label/index.cjs.js"),r=require("../../../components/textarea/index.cjs.js"),i=require("./RoleSelect.cjs.js");let a=require("react");a=e.__toESM(a);let o=require("react/jsx-runtime");function s(e){return Array.from(new Set(e.split(/[\s,;\n]+/).map(e=>e.trim().toLowerCase()).filter(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))))}function c({roles:e,defaultRoleId:c,onSubmit:l,onCancel:u,isSubmitting:d}){let[f,p]=a.useState(``),[m,h]=a.useState(c??e[0]?.id),[g,_]=a.useState(``),v=a.useMemo(()=>s(f),[f]),y=v.length>0&&!!m&&!d;return(0,o.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),!(!m||v.length===0)&&await l({emails:v,roleId:m,message:g||void 0})},className:`flex flex-col gap-4 p-4`,children:[(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(n.Label,{htmlFor:`invite-emails`,children:`Adresses email`}),(0,o.jsx)(r.Textarea,{id:`invite-emails`,value:f,onChange:e=>p(e.target.value),placeholder:`alice@example.com, bob@example.com`,rows:3}),(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[v.length,` adresse`,v.length>1?`s`:``,` détectée`,v.length>1?`s`:``]})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(n.Label,{htmlFor:`invite-role`,children:`Rôle`}),(0,o.jsx)(i.RoleSelect,{id:`invite-role`,value:m,onChange:h,roles:e})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(n.Label,{htmlFor:`invite-message`,children:`Message (optionnel)`}),(0,o.jsx)(r.Textarea,{id:`invite-message`,value:g,onChange:e=>_(e.target.value),rows:3})]}),(0,o.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 pt-4 border-t`,children:[u&&(0,o.jsx)(t.Button,{type:`button`,variant:`ghost`,onClick:u,disabled:d,children:`Annuler`}),(0,o.jsx)(t.Button,{type:`submit`,disabled:!y,children:d?`Envoi…`:`Envoyer l'invitation`})]})]})}exports.InviteUserPanel=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../../components/select/index.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("react/jsx-runtime");function i({value:e,onChange:i,roles:a,disabled:o,placeholder:s=`Rôle`,triggerClassName:c,id:l,triggerId:u}){let d=n.useId();return(0,r.jsxs)(t.Select,{value:e,onValueChange:i,disabled:o,children:[(0,r.jsx)(t.SelectTrigger,{id:l??u??d,className:c,children:(0,r.jsx)(t.SelectValue,{placeholder:s})}),(0,r.jsx)(t.SelectContent,{children:a.map(e=>(0,r.jsx)(t.SelectItem,{value:e.id,children:e.label},e.id))})]})}exports.RoleSelect=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../../utils/cn.cjs.js"),n=require("../../../components/button/index.cjs.js"),r=require("../../../components/sheet/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");var s=`(max-width: 767px)`;function c(){let[e,t]=i.useState(!1);return i.useEffect(()=>{if(typeof window>`u`)return;let e=window.matchMedia(s),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function l({children:e,panel:s,panelWidth:l=520,panelTitle:u,onClose:d,className:f}){let p=c(),m=s!==null,h=i.useRef(null),g=i.useRef(null),_=i.useId();return i.useEffect(()=>{if(!m)return;let e=e=>{e.key===`Escape`&&d?.()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[m,d]),i.useEffect(()=>{if(m)return g.current=document.activeElement,h.current&&h.current.querySelector(`button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])`)?.focus(),()=>{g.current?.focus?.()}},[m]),p?(0,o.jsxs)(`div`,{className:t.cn(`flex w-full h-full`,f),children:[(0,o.jsx)(`div`,{className:`flex-1 min-w-0`,children:e}),(0,o.jsx)(r.Sheet,{open:m,onOpenChange:e=>{e||d?.()},children:(0,o.jsxs)(r.SheetContent,{side:`right`,className:`w-full p-0`,style:{maxWidth:`${l}px`},children:[u&&(0,o.jsxs)(r.SheetHeader,{className:`px-4 py-3 border-b`,children:[(0,o.jsx)(r.SheetTitle,{children:u}),(0,o.jsx)(r.SheetDescription,{className:`sr-only`,children:u})]}),(0,o.jsx)(`div`,{className:`overflow-y-auto h-full`,children:s})]})})]}):(0,o.jsxs)(`div`,{className:t.cn(`flex w-full h-full`,f),children:[(0,o.jsx)(`div`,{className:`flex-1 min-w-0`,children:e}),(0,o.jsx)(`aside`,{ref:h,"aria-hidden":!m,"aria-labelledby":u?_:void 0,style:{width:m?l:0},className:t.cn(`shrink-0 overflow-hidden border-l bg-card transition-[width] duration-200 ease-out`,m?`opacity-100`:`opacity-0 pointer-events-none`),children:m&&(0,o.jsxs)(`div`,{className:`flex h-full flex-col`,style:{width:l},children:[(0,o.jsxs)(`header`,{className:`sticky top-0 z-10 flex items-center justify-between border-b bg-card px-4 py-3`,children:[(0,o.jsx)(`h2`,{id:_,className:`text-base font-semibold`,children:u}),(0,o.jsx)(n.Button,{variant:`ghost`,size:`icon`,onClick:d,"aria-label":`Fermer`,children:(0,o.jsx)(a.X,{className:`size-4`})})]}),(0,o.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:s})]})})]})}exports.SidePushLayout=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/avatar/index.cjs.js"),r=require("../../components/badge/index.cjs.js"),i=require("../../components/button/index.cjs.js"),a=require("../../components/card/index.cjs.js"),o=require("../../components/input/index.cjs.js"),s=require("../../components/select/index.cjs.js");let c=require("react");c=e.__toESM(c);let l=require("lucide-react"),u=require("react/jsx-runtime");var d={created:{icon:l.Plus,color:`text-green-500`,label:`créé`},updated:{icon:l.Edit,color:`text-blue-500`,label:`modifié`},deleted:{icon:l.Trash2,color:`text-red-500`,label:`supprimé`},commented:{icon:l.MessageSquare,color:`text-purple-500`,label:`commenté`},uploaded:{icon:l.Upload,color:`text-cyan-500`,label:`uploadé`},downloaded:{icon:l.Download,color:`text-gray-500`,label:`téléchargé`},shared:{icon:l.User,color:`text-orange-500`,label:`partagé`},approved:{icon:l.Check,color:`text-green-500`,label:`approuvé`},rejected:{icon:l.X,color:`text-red-500`,label:`rejeté`},mentioned:{icon:l.Bell,color:`text-yellow-500`,label:`mentionné`},assigned:{icon:l.User,color:`text-indigo-500`,label:`assigné`},completed:{icon:l.Check,color:`text-green-500`,label:`terminé`},custom:{icon:l.AlertCircle,color:`text-gray-500`,label:``}};function f({user:e,size:t=`sm`}){let r={sm:`h-8 w-8`,md:`h-10 w-10`},i=e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,u.jsxs)(n.Avatar,{className:r[t],children:[(0,u.jsx)(n.AvatarImage,{src:e.avatar,alt:e.name}),(0,u.jsx)(n.AvatarFallback,{className:`text-xs`,children:i})]})}function p({type:e,customIcon:n,customColor:r}){let i=d[e],a=i.icon;return(0,u.jsx)(`div`,{className:t.cn(`flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm`,r||i.color),children:n||(0,u.jsx)(a,{className:`h-4 w-4`})})}function m({activity:e,showAvatar:t,relativeTime:n,layout:i,isLast:o}){let s=e=>{let t=typeof e==`string`?new Date(e):e;if(n){let e=new Date().getTime()-t.getTime(),n=Math.floor(e/6e4),r=Math.floor(n/60),i=Math.floor(r/24);if(n<1)return`À l'instant`;if(n<60)return`Il y a ${n} min`;if(r<24)return`Il y a ${r}h`;if(i<7)return`Il y a ${i}j`}return t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})},c=d[e.type];return i===`compact`?(0,u.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,u.jsx)(p,{type:e.type,customIcon:e.icon,customColor:e.color}),(0,u.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,u.jsxs)(`p`,{className:`text-sm truncate`,children:[(0,u.jsx)(`span`,{className:`font-medium`,children:e.user.name}),` `,(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]})}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:s(e.timestamp)})]}):i===`feed`?(0,u.jsx)(a.Card,{className:`mb-4`,children:(0,u.jsx)(a.CardContent,{className:`pt-4`,children:(0,u.jsxs)(`div`,{className:`flex gap-3`,children:[t&&(0,u.jsx)(f,{user:e.user,size:`md`}),(0,u.jsxs)(`div`,{className:`flex-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,u.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,u.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:c.label||e.type}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(e.timestamp)})]}),(0,u.jsx)(`p`,{className:`text-sm`,children:e.title}),e.description&&(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,u.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment})]})]})})}):(0,u.jsxs)(`div`,{className:`flex gap-4`,children:[(0,u.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,u.jsx)(p,{type:e.type,customIcon:e.icon,customColor:e.color}),!o&&(0,u.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-2`})]}),(0,u.jsx)(`div`,{className:`flex-1 pb-8`,children:(0,u.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t&&(0,u.jsx)(f,{user:e.user}),(0,u.jsxs)(`div`,{className:`flex-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,u.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]}),e.description&&(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,u.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground mt-2 block`,children:s(e.timestamp)})]})]})})]})}function h({activities:e,title:n=`Activité`,showSearch:r=!0,showFilters:a=!0,filters:d=[],activeFilter:f,onFilterChange:p,showRefresh:h=!0,onRefresh:g,loading:_=!1,groupByDay:v=!0,showLoadMore:y=!1,onLoadMore:b,loadingMore:x=!1,showAvatars:S=!0,relativeTime:C=!0,layout:w=`timeline`,className:T}){let[E,D]=c.useState(``),[O,k]=c.useState(null),A=f??O,j=e=>{p?p(e):k(e)},M=c.useMemo(()=>{let t=e;if(E){let e=E.toLowerCase();t=t.filter(t=>t.title.toLowerCase().includes(e)||t.user.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))}if(A){let e=d.find(e=>e.id===A);e&&(t=t.filter(t=>e.types.includes(t.type)))}return t},[e,E,A,d]),N=c.useMemo(()=>{if(!v)return null;let e={};return M.forEach(t=>{let n=(typeof t.timestamp==`string`?new Date(t.timestamp):t.timestamp).toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});e[n]||(e[n]=[]),e[n].push(t)}),e},[M,v]),P=e=>(0,u.jsx)(`div`,{children:e.map((t,n)=>(0,u.jsx)(m,{activity:t,showAvatar:S,relativeTime:C,layout:w,isLast:n===e.length-1},t.id))});return(0,u.jsxs)(`div`,{className:t.cn(`space-y-4`,T),children:[(0,u.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,u.jsx)(`h2`,{className:`text-xl font-semibold`,children:n}),(0,u.jsx)(`div`,{className:`flex items-center gap-2`,children:h&&g&&(0,u.jsx)(i.Button,{variant:`outline`,size:`sm`,onClick:g,disabled:_,children:(0,u.jsx)(l.RefreshCw,{className:t.cn(`h-4 w-4`,_&&`animate-spin`)})})})]}),(r||a)&&(0,u.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[r&&(0,u.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,u.jsx)(l.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,u.jsx)(o.Input,{placeholder:`Rechercher...`,value:E,onChange:e=>D(e.target.value),className:`pl-9`})]}),a&&d.length>0&&(0,u.jsxs)(s.Select,{value:A||`all`,onValueChange:e=>j(e===`all`?null:e),children:[(0,u.jsxs)(s.SelectTrigger,{className:`w-[180px]`,children:[(0,u.jsx)(l.Filter,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(s.SelectValue,{placeholder:`Filtrer`})]}),(0,u.jsxs)(s.SelectContent,{children:[(0,u.jsx)(s.SelectItem,{value:`all`,children:`Toutes les activités`}),d.map(e=>(0,u.jsx)(s.SelectItem,{value:e.id,children:e.label},e.id))]})]})]}),_?(0,u.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,u.jsx)(l.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):M.length===0?(0,u.jsxs)(`div`,{className:`text-center py-12`,children:[(0,u.jsx)(l.Clock,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,u.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune activité`})]}):v&&N?(0,u.jsx)(`div`,{className:`space-y-6`,children:Object.entries(N).map(([e,t])=>(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-4 capitalize`,children:e}),P(t)]},e))}):P(M),y&&b&&(0,u.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,u.jsxs)(i.Button,{variant:`outline`,onClick:b,disabled:x,children:[x?(0,u.jsx)(l.RefreshCw,{className:`h-4 w-4 animate-spin mr-2`}):(0,u.jsx)(l.ChevronDown,{className:`h-4 w-4 mr-2`}),`Charger plus`]})})]})}var g=[{id:`edits`,label:`Modifications`,types:[`created`,`updated`,`deleted`]},{id:`comments`,label:`Commentaires`,types:[`commented`,`mentioned`]},{id:`files`,label:`Fichiers`,types:[`uploaded`,`downloaded`,`shared`]},{id:`approvals`,label:`Approbations`,types:[`approved`,`rejected`,`completed`]}],_=[{id:`1`,type:`created`,title:`a créé le document 'Rapport Q4'`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5)},{id:`2`,type:`commented`,title:`a commenté sur 'Projet Alpha'`,user:{id:`2`,name:`Pierre Martin`},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:`Super travail sur cette partie !`}},{id:`3`,type:`uploaded`,title:`a uploadé 3 fichiers`,user:{id:`3`,name:`Sophie Bernard`},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:`4`,type:`approved`,title:`a approuvé la demande de congés`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*60*24)}];exports.WakaActivityTimeline=h,exports.default=h,exports.defaultActivities=_,exports.defaultActivityFilters=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../../components/badge/index.cjs.js`),r=require(`../../components/button/index.cjs.js`),i=require(`../../components/card/index.cjs.js`);let a=require(`react`);a=e.__toESM(a);let o=require(`lucide-react`),s=require(`react/jsx-runtime`);var c={healthy:{color:`text-green-500 bg-green-500/10`,icon:(0,s.jsx)(o.ShieldCheck,{className:`h-4 w-4`}),label:`Healthy`},degraded:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,s.jsx)(o.ShieldAlert,{className:`h-4 w-4`}),label:`Degraded`},down:{color:`text-red-500 bg-red-500/10`,icon:(0,s.jsx)(o.ShieldX,{className:`h-4 w-4`}),label:`Down`}},l={clean:{color:`text-green-500`,icon:(0,s.jsx)(o.CheckCircle,{className:`h-4 w-4`}),label:`Clean`,bgColor:`bg-green-500`},infected:{color:`text-red-500`,icon:(0,s.jsx)(o.XCircle,{className:`h-4 w-4`}),label:`Infected`,bgColor:`bg-red-500`},error:{color:`text-orange-500`,icon:(0,s.jsx)(o.AlertCircle,{className:`h-4 w-4`}),label:`Error`,bgColor:`bg-orange-500`}},u={critical:{color:`text-red-500`,bgColor:`bg-red-500`},high:{color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{color:`text-blue-500`,bgColor:`bg-blue-500`}};function d(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function f(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function p(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function m({health:e}){let r=c[e];return(0,s.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`gap-1`,r.color),children:[r.icon,r.label]})}function h({result:e}){let r=l[e];return(0,s.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`gap-1`,r.color),children:[r.icon,r.label]})}function g({title:e,value:n,icon:r,trend:a,color:o=`text-primary`}){return(0,s.jsx)(i.Card,{children:(0,s.jsx)(i.CardContent,{className:`p-6`,children:(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground mb-1`,children:e}),(0,s.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,s.jsx)(`p`,{className:t.cn(`text-3xl font-bold`,o),children:n}),a&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a})]})]}),(0,s.jsx)(`div`,{className:t.cn(`p-3 rounded-lg`,`${o.replace(`text-`,`bg-`)}/10`),children:r})]})})})}function _({stats:e}){let t=Math.max(...e.map(e=>Math.max(e.scans,e.threats)),1);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.TrendingUp,{className:`h-4 w-4`}),`Weekly Activity`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{let r=e.scans/t*100,i=e.threats/t*100;return(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,s.jsx)(`span`,{className:`text-muted-foreground min-w-12`,children:e.day}),(0,s.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),e.scans,` scans`]}),(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-red-500`}),e.threats,` threats`]})]})]}),(0,s.jsxs)(`div`,{className:`space-y-1`,children:[(0,s.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:`h-full bg-blue-500 rounded-full transition-all`,style:{width:`${r}%`}})}),e.threats>0&&(0,s.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:`h-full bg-red-500 rounded-full transition-all`,style:{width:`${i}%`}})})]})]},e.day)})})})]})}function v({scans:e}){return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.Activity,{className:`h-4 w-4`}),`Recent Scans`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,s.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,s.jsx)(o.Shield,{className:`h-12 w-12 mx-auto mb-3 opacity-50`}),(0,s.jsx)(`p`,{className:`text-sm`,children:`No scans yet`})]}):e.map(e=>(0,s.jsx)(`div`,{className:t.cn(`flex items-center justify-between p-3 rounded-lg border transition-colors`,e.result===`infected`&&`border-red-500/50 bg-red-500/5`),children:(0,s.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[(0,s.jsx)(`div`,{className:t.cn(`p-2 rounded-lg shrink-0`,l[e.result].color.replace(`text-`,`bg-`)+`/10`),children:l[e.result].icon}),(0,s.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,s.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,s.jsx)(h,{result:e.result})]}),e.threatName&&(0,s.jsxs)(`p`,{className:`text-xs text-red-500 mt-1 flex items-center gap-1`,children:[(0,s.jsx)(o.AlertTriangle,{className:`h-3 w-3`}),e.threatName]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(o.Clock,{className:`h-3 w-3`}),p(e.scanDate)]}),(0,s.jsx)(`span`,{children:f(e.duration)}),(0,s.jsx)(`span`,{children:d(e.fileSize)})]})]})]})},e.id))})})]})}function y({threats:e}){return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.AlertTriangle,{className:`h-4 w-4`}),`Top Threats`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,s.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,s.jsx)(o.ShieldCheck,{className:`h-12 w-12 mx-auto mb-3 text-green-500 opacity-50`}),(0,s.jsx)(`p`,{className:`text-sm`,children:`No threats detected`})]}):e.map((r,i)=>{let a=u[r.severity];return(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-full bg-muted text-sm font-medium`,children:i+1}),(0,s.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(`p`,{className:`text-sm font-medium truncate`,children:r.name}),(0,s.jsx)(n.Badge,{variant:`outline`,className:t.cn(`text-xs capitalize`,a.color),children:r.severity})]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,s.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:t.cn(`h-full rounded-full`,a.bgColor),style:{width:`${Math.min(r.count/Math.max(...e.map(e=>e.count))*100,100)}%`}})}),(0,s.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium min-w-12 text-right`,children:[r.count,` `,r.count===1?`time`:`times`]})]})]})]},r.name)})})})]})}function b({serviceHealth:e=`healthy`,clamavVersion:n=`1.0.3`,signatureCount:i=8642758,lastSignatureUpdate:a,scansToday:c=0,threatsDetected:l=0,quarantinedFiles:u=0,detectionRate:d=0,recentScans:f=[],weeklyStats:h=[],topThreats:b=[],onStartScan:x,onViewQuarantine:S,className:C}){return(0,s.jsxs)(`div`,{className:t.cn(`space-y-6`,C),children:[(0,s.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between items-start`,children:[(0,s.jsx)(`div`,{children:(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10`,children:(0,s.jsx)(o.Shield,{className:`h-6 w-6 text-primary`})}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Antivirus ClamAV`}),(0,s.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` • `,i.toLocaleString(),` signatures`,a&&(0,s.jsxs)(s.Fragment,{children:[` • Updated `,p(a)]})]})]})]})}),(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(m,{health:e}),S&&(0,s.jsxs)(r.Button,{variant:`outline`,onClick:S,children:[(0,s.jsx)(o.Archive,{className:`h-4 w-4 mr-2`}),`Quarantine`]}),x&&(0,s.jsxs)(r.Button,{onClick:x,children:[(0,s.jsx)(o.PlayCircle,{className:`h-4 w-4 mr-2`}),`Start Scan`]})]})]}),(0,s.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,s.jsx)(g,{title:`Scans Today`,value:c.toLocaleString(),icon:(0,s.jsx)(o.Activity,{className:`h-6 w-6`}),color:`text-blue-500`}),(0,s.jsx)(g,{title:`Threats Detected`,value:l.toLocaleString(),icon:(0,s.jsx)(o.AlertTriangle,{className:`h-6 w-6`}),color:`text-red-500`}),(0,s.jsx)(g,{title:`Quarantined Files`,value:u.toLocaleString(),icon:(0,s.jsx)(o.Archive,{className:`h-6 w-6`}),color:`text-orange-500`}),(0,s.jsx)(g,{title:`Detection Rate`,value:`${d.toFixed(1)}%`,icon:(0,s.jsx)(o.ShieldCheck,{className:`h-6 w-6`}),color:`text-green-500`})]}),(0,s.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,s.jsx)(_,{stats:h}),(0,s.jsx)(y,{threats:b})]}),(0,s.jsx)(v,{scans:f})]})}var x=[{id:`scan1`,filename:`document.pdf`,result:`clean`,scanDate:new Date(Date.now()-5*6e4),duration:234,fileSize:2048576,userId:`user123`},{id:`scan2`,filename:`malicious_script.js`,result:`infected`,threatName:`Trojan.GenericKD.67890123`,scanDate:new Date(Date.now()-15*6e4),duration:156,fileSize:45678,userId:`user456`},{id:`scan3`,filename:`eicar_test.txt`,result:`infected`,threatName:`Eicar-Test-Signature`,scanDate:new Date(Date.now()-30*6e4),duration:89,fileSize:68,userId:`admin`},{id:`scan4`,filename:`report_2024.xlsx`,result:`clean`,scanDate:new Date(Date.now()-45*6e4),duration:567,fileSize:5242880,userId:`user789`},{id:`scan5`,filename:`suspicious_archive.zip`,result:`infected`,threatName:`Win.Trojan.Genome-9999999`,scanDate:new Date(Date.now()-60*6e4),duration:1234,fileSize:10485760,userId:`user321`}],S=[{day:`Mon`,scans:145,threats:3},{day:`Tue`,scans:198,threats:5},{day:`Wed`,scans:167,threats:2},{day:`Thu`,scans:223,threats:8},{day:`Fri`,scans:189,threats:4},{day:`Sat`,scans:98,threats:1},{day:`Sun`,scans:76,threats:0}],C=[{name:`Eicar-Test-Signature`,count:12,severity:`low`},{name:`Trojan.GenericKD.67890123`,count:8,severity:`high`},{name:`Win.Trojan.Genome-9999999`,count:5,severity:`critical`},{name:`JS.Downloader.Nemucod`,count:4,severity:`medium`},{name:`PHP.Webshell.Generic`,count:3,severity:`high`}];exports.default=b,exports.defaultRecentScans=x,exports.defaultTopThreats=C,exports.defaultWeeklyStats=S;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/badge/index.cjs.js"),r=require("../../components/button/index.cjs.js"),i=require("../../components/card/index.cjs.js");let a=require("react");a=e.__toESM(a);let o=require("lucide-react"),s=require("react/jsx-runtime");var c={healthy:{color:`text-green-500 bg-green-500/10`,icon:(0,s.jsx)(o.ShieldCheck,{className:`h-4 w-4`}),label:`Healthy`},degraded:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,s.jsx)(o.ShieldAlert,{className:`h-4 w-4`}),label:`Degraded`},down:{color:`text-red-500 bg-red-500/10`,icon:(0,s.jsx)(o.ShieldX,{className:`h-4 w-4`}),label:`Down`}},l={clean:{color:`text-green-500`,icon:(0,s.jsx)(o.CheckCircle,{className:`h-4 w-4`}),label:`Clean`,bgColor:`bg-green-500`},infected:{color:`text-red-500`,icon:(0,s.jsx)(o.XCircle,{className:`h-4 w-4`}),label:`Infected`,bgColor:`bg-red-500`},error:{color:`text-orange-500`,icon:(0,s.jsx)(o.AlertCircle,{className:`h-4 w-4`}),label:`Error`,bgColor:`bg-orange-500`}},u={critical:{color:`text-red-500`,bgColor:`bg-red-500`},high:{color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{color:`text-blue-500`,bgColor:`bg-blue-500`}};function d(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function f(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function p(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function m({health:e}){let r=c[e];return(0,s.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`gap-1`,r.color),children:[r.icon,r.label]})}function h({result:e}){let r=l[e];return(0,s.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`gap-1`,r.color),children:[r.icon,r.label]})}function g({title:e,value:n,icon:r,trend:a,color:o=`text-primary`}){return(0,s.jsx)(i.Card,{children:(0,s.jsx)(i.CardContent,{className:`p-6`,children:(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`p`,{className:`text-sm text-muted-foreground mb-1`,children:e}),(0,s.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,s.jsx)(`p`,{className:t.cn(`text-3xl font-bold`,o),children:n}),a&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a})]})]}),(0,s.jsx)(`div`,{className:t.cn(`p-3 rounded-lg`,`${o.replace(`text-`,`bg-`)}/10`),children:r})]})})})}function _({stats:e}){let t=Math.max(...e.map(e=>Math.max(e.scans,e.threats)),1);return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.TrendingUp,{className:`h-4 w-4`}),`Weekly Activity`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{let r=e.scans/t*100,i=e.threats/t*100;return(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,s.jsx)(`span`,{className:`text-muted-foreground min-w-12`,children:e.day}),(0,s.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),e.scans,` scans`]}),(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-red-500`}),e.threats,` threats`]})]})]}),(0,s.jsxs)(`div`,{className:`space-y-1`,children:[(0,s.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:`h-full bg-blue-500 rounded-full transition-all`,style:{width:`${r}%`}})}),e.threats>0&&(0,s.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:`h-full bg-red-500 rounded-full transition-all`,style:{width:`${i}%`}})})]})]},e.day)})})})]})}function v({scans:e}){return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.Activity,{className:`h-4 w-4`}),`Recent Scans`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,s.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,s.jsx)(o.Shield,{className:`h-12 w-12 mx-auto mb-3 opacity-50`}),(0,s.jsx)(`p`,{className:`text-sm`,children:`No scans yet`})]}):e.map(e=>(0,s.jsx)(`div`,{className:t.cn(`flex items-center justify-between p-3 rounded-lg border transition-colors`,e.result===`infected`&&`border-red-500/50 bg-red-500/5`),children:(0,s.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[(0,s.jsx)(`div`,{className:t.cn(`p-2 rounded-lg shrink-0`,l[e.result].color.replace(`text-`,`bg-`)+`/10`),children:l[e.result].icon}),(0,s.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,s.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,s.jsx)(h,{result:e.result})]}),e.threatName&&(0,s.jsxs)(`p`,{className:`text-xs text-red-500 mt-1 flex items-center gap-1`,children:[(0,s.jsx)(o.AlertTriangle,{className:`h-3 w-3`}),e.threatName]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[(0,s.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,s.jsx)(o.Clock,{className:`h-3 w-3`}),p(e.scanDate)]}),(0,s.jsx)(`span`,{children:f(e.duration)}),(0,s.jsx)(`span`,{children:d(e.fileSize)})]})]})]})},e.id))})})]})}function y({threats:e}){return(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(i.CardHeader,{children:(0,s.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,s.jsx)(o.AlertTriangle,{className:`h-4 w-4`}),`Top Threats`]})}),(0,s.jsx)(i.CardContent,{children:(0,s.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,s.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,s.jsx)(o.ShieldCheck,{className:`h-12 w-12 mx-auto mb-3 text-green-500 opacity-50`}),(0,s.jsx)(`p`,{className:`text-sm`,children:`No threats detected`})]}):e.map((r,i)=>{let a=u[r.severity];return(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-full bg-muted text-sm font-medium`,children:i+1}),(0,s.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(`p`,{className:`text-sm font-medium truncate`,children:r.name}),(0,s.jsx)(n.Badge,{variant:`outline`,className:t.cn(`text-xs capitalize`,a.color),children:r.severity})]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,s.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,s.jsx)(`div`,{className:t.cn(`h-full rounded-full`,a.bgColor),style:{width:`${Math.min(r.count/Math.max(...e.map(e=>e.count))*100,100)}%`}})}),(0,s.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium min-w-12 text-right`,children:[r.count,` `,r.count===1?`time`:`times`]})]})]})]},r.name)})})})]})}function b({serviceHealth:e=`healthy`,clamavVersion:n=`1.0.3`,signatureCount:i=8642758,lastSignatureUpdate:a,scansToday:c=0,threatsDetected:l=0,quarantinedFiles:u=0,detectionRate:d=0,recentScans:f=[],weeklyStats:h=[],topThreats:b=[],onStartScan:x,onViewQuarantine:S,className:C}){return(0,s.jsxs)(`div`,{className:t.cn(`space-y-6`,C),children:[(0,s.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between items-start`,children:[(0,s.jsx)(`div`,{children:(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10`,children:(0,s.jsx)(o.Shield,{className:`h-6 w-6 text-primary`})}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Antivirus ClamAV`}),(0,s.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` • `,i.toLocaleString(),` signatures`,a&&(0,s.jsxs)(s.Fragment,{children:[` • Updated `,p(a)]})]})]})]})}),(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(m,{health:e}),S&&(0,s.jsxs)(r.Button,{variant:`outline`,onClick:S,children:[(0,s.jsx)(o.Archive,{className:`h-4 w-4 mr-2`}),`Quarantine`]}),x&&(0,s.jsxs)(r.Button,{onClick:x,children:[(0,s.jsx)(o.PlayCircle,{className:`h-4 w-4 mr-2`}),`Start Scan`]})]})]}),(0,s.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,s.jsx)(g,{title:`Scans Today`,value:c.toLocaleString(),icon:(0,s.jsx)(o.Activity,{className:`h-6 w-6`}),color:`text-blue-500`}),(0,s.jsx)(g,{title:`Threats Detected`,value:l.toLocaleString(),icon:(0,s.jsx)(o.AlertTriangle,{className:`h-6 w-6`}),color:`text-red-500`}),(0,s.jsx)(g,{title:`Quarantined Files`,value:u.toLocaleString(),icon:(0,s.jsx)(o.Archive,{className:`h-6 w-6`}),color:`text-orange-500`}),(0,s.jsx)(g,{title:`Detection Rate`,value:`${d.toFixed(1)}%`,icon:(0,s.jsx)(o.ShieldCheck,{className:`h-6 w-6`}),color:`text-green-500`})]}),(0,s.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,s.jsx)(_,{stats:h}),(0,s.jsx)(y,{threats:b})]}),(0,s.jsx)(v,{scans:f})]})}var x=[{id:`scan1`,filename:`document.pdf`,result:`clean`,scanDate:new Date(Date.now()-5*6e4),duration:234,fileSize:2048576,userId:`user123`},{id:`scan2`,filename:`malicious_script.js`,result:`infected`,threatName:`Trojan.GenericKD.67890123`,scanDate:new Date(Date.now()-15*6e4),duration:156,fileSize:45678,userId:`user456`},{id:`scan3`,filename:`eicar_test.txt`,result:`infected`,threatName:`Eicar-Test-Signature`,scanDate:new Date(Date.now()-30*6e4),duration:89,fileSize:68,userId:`admin`},{id:`scan4`,filename:`report_2024.xlsx`,result:`clean`,scanDate:new Date(Date.now()-45*6e4),duration:567,fileSize:5242880,userId:`user789`},{id:`scan5`,filename:`suspicious_archive.zip`,result:`infected`,threatName:`Win.Trojan.Genome-9999999`,scanDate:new Date(Date.now()-60*6e4),duration:1234,fileSize:10485760,userId:`user321`}],S=[{day:`Mon`,scans:145,threats:3},{day:`Tue`,scans:198,threats:5},{day:`Wed`,scans:167,threats:2},{day:`Thu`,scans:223,threats:8},{day:`Fri`,scans:189,threats:4},{day:`Sat`,scans:98,threats:1},{day:`Sun`,scans:76,threats:0}],C=[{name:`Eicar-Test-Signature`,count:12,severity:`low`},{name:`Trojan.GenericKD.67890123`,count:8,severity:`high`},{name:`Win.Trojan.Genome-9999999`,count:5,severity:`critical`},{name:`JS.Downloader.Nemucod`,count:4,severity:`medium`},{name:`PHP.Webshell.Generic`,count:3,severity:`high`}];exports.AntivirusDashboard=b,exports.default=b,exports.defaultRecentScans=x,exports.defaultTopThreats=C,exports.defaultWeeklyStats=S;
|
|
@@ -459,4 +459,4 @@ var I = [
|
|
|
459
459
|
}
|
|
460
460
|
];
|
|
461
461
|
//#endregion
|
|
462
|
-
export { F as default, I as defaultRecentScans, R as defaultTopThreats, L as defaultWeeklyStats };
|
|
462
|
+
export { F as AntivirusDashboard, F as default, I as defaultRecentScans, R as defaultTopThreats, L as defaultWeeklyStats };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/alert-dialog/index.cjs.js"),r=require("../../components/badge/index.cjs.js"),i=require("../../components/button/index.cjs.js"),a=require("../../components/checkbox/index.cjs.js"),o=require("../../components/dialog/index.cjs.js"),s=require("../../components/dropdown-menu/index.cjs.js"),c=require("../../components/label/index.cjs.js"),l=require("../../components/input/index.cjs.js"),u=require("../../components/select/index.cjs.js"),d=require("../../components/table/index.cjs.js");let f=require("react");f=e.__toESM(f);let p=require("lucide-react"),m=require("react/jsx-runtime");function h({keys:e,scopes:a,onCreate:o,onRevoke:c,onRotate:l,graceDaysOptions:u=[0,7,30],isLoading:h,className:y}){let[b,x]=f.useState({kind:`closed`}),S=()=>x({kind:`closed`});return(0,m.jsxs)(`div`,{className:t.cn(`flex flex-col gap-4`,y),children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,m.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,m.jsx)(p.KeyRound,{className:`size-5`}),` Clés API`]}),(0,m.jsxs)(i.Button,{onClick:()=>x({kind:`create`}),children:[(0,m.jsx)(p.Plus,{className:`size-4 mr-2`}),` Créer une clé`]})]}),h?(0,m.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Chargement…`}):e.length===0?(0,m.jsx)(`div`,{className:`border rounded-md p-12 text-center text-sm text-muted-foreground`,children:`Aucune clé API. Créez votre première clé pour démarrer.`}):(0,m.jsx)(`div`,{className:`border rounded-md overflow-hidden`,children:(0,m.jsxs)(d.Table,{children:[(0,m.jsx)(d.TableHeader,{children:(0,m.jsxs)(d.TableRow,{children:[(0,m.jsx)(d.TableHead,{children:`Nom`}),(0,m.jsx)(d.TableHead,{children:`Préfixe`}),(0,m.jsx)(d.TableHead,{children:`Scopes`}),(0,m.jsx)(d.TableHead,{children:`Dernière utilisation`}),(0,m.jsx)(d.TableHead,{children:`Expiration`}),(0,m.jsx)(d.TableHead,{children:`Statut`}),(0,m.jsx)(d.TableHead,{className:`w-12`})]})}),(0,m.jsx)(d.TableBody,{children:e.map(e=>(0,m.jsxs)(d.TableRow,{children:[(0,m.jsx)(d.TableCell,{className:`font-medium`,children:e.name}),(0,m.jsxs)(d.TableCell,{className:`font-mono text-xs`,children:[e.prefix,`…`]}),(0,m.jsx)(d.TableCell,{children:(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.scopes.map(e=>(0,m.jsx)(r.Badge,{variant:`secondary`,children:a.find(t=>t.id===e)?.label??e},e))})}),(0,m.jsx)(d.TableCell,{className:`text-sm text-muted-foreground`,children:e.lastUsedAt?e.lastUsedAt.toLocaleDateString():`—`}),(0,m.jsx)(d.TableCell,{className:`text-sm text-muted-foreground`,children:e.expiresAt?e.expiresAt.toLocaleDateString():`—`}),(0,m.jsx)(d.TableCell,{children:(0,m.jsx)(r.Badge,{variant:e.status===`active`?`default`:e.status===`rotating`?`secondary`:`destructive`,children:e.status===`active`?`Actif`:e.status===`rotating`?`En rotation`:`Révoqué`})}),(0,m.jsx)(d.TableCell,{children:(0,m.jsxs)(s.DropdownMenu,{children:[(0,m.jsx)(s.DropdownMenuTrigger,{asChild:!0,children:(0,m.jsx)(i.Button,{variant:`ghost`,size:`icon`,"aria-label":`Actions`,children:(0,m.jsx)(p.MoreHorizontal,{className:`size-4`})})}),(0,m.jsxs)(s.DropdownMenuContent,{align:`end`,children:[(0,m.jsxs)(s.DropdownMenuItem,{onClick:()=>x({kind:`rotate`,key:e}),disabled:e.status===`revoked`,children:[(0,m.jsx)(p.RefreshCw,{className:`size-4 mr-2`}),` Rotation`]}),(0,m.jsx)(s.DropdownMenuSeparator,{}),(0,m.jsxs)(s.DropdownMenuItem,{onClick:()=>x({kind:`revoke`,key:e}),disabled:e.status===`revoked`,className:`text-destructive focus:text-destructive`,children:[(0,m.jsx)(p.Trash2,{className:`size-4 mr-2`}),` Révoquer`]})]})]})})]},e.id))})]})}),b.kind===`create`&&(0,m.jsx)(g,{scopes:a,onCancel:S,onSubmit:async e=>{let{token:t}=await o(e);x({kind:`one-time`,token:t,keyName:e.name})}}),b.kind===`rotate`&&(0,m.jsx)(_,{keyRecord:b.key,graceDaysOptions:u,onCancel:S,onSubmit:async e=>{let t=b.kind===`rotate`?b.key:null;if(!t)return;let{newToken:n}=await l(t.id,e);x({kind:`one-time`,token:n,keyName:t.name})}}),b.kind===`revoke`&&(0,m.jsx)(n.AlertDialog,{open:!0,onOpenChange:e=>!e&&S(),children:(0,m.jsxs)(n.AlertDialogContent,{children:[(0,m.jsxs)(n.AlertDialogHeader,{children:[(0,m.jsx)(n.AlertDialogTitle,{children:`Révoquer cette clé ?`}),(0,m.jsxs)(n.AlertDialogDescription,{children:[`La clé "`,b.key.name,`" sera immédiatement invalidée. Cette action est irréversible.`]})]}),(0,m.jsxs)(n.AlertDialogFooter,{children:[(0,m.jsx)(n.AlertDialogCancel,{children:`Annuler`}),(0,m.jsx)(n.AlertDialogAction,{onClick:async()=>{await c(b.key.id),S()},children:`Révoquer`})]})]})}),b.kind===`one-time`&&(0,m.jsx)(v,{token:b.token,keyName:b.keyName,onClose:S})]})}function g({scopes:e,onCancel:t,onSubmit:n}){let[r,s]=f.useState(``),[d,p]=f.useState(new Set),[h,g]=f.useState(`never`),[_,v]=f.useState(!1),y=e=>p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,m.jsx)(o.Dialog,{open:!0,onOpenChange:e=>!e&&t(),children:(0,m.jsxs)(o.DialogContent,{children:[(0,m.jsxs)(o.DialogHeader,{children:[(0,m.jsx)(o.DialogTitle,{children:`Créer une clé API`}),(0,m.jsx)(o.DialogDescription,{className:`sr-only`,children:`Formulaire de création d'une clé API`})]}),(0,m.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!(!r||d.size===0)){v(!0);try{let e=h===`never`?void 0:new Date(Date.now()+parseInt(h,10)*864e5);await n({name:r,scopes:Array.from(d),expiresAt:e})}finally{v(!1)}}},className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(c.Label,{htmlFor:`key-name`,children:`Nom`}),(0,m.jsx)(l.Input,{id:`key-name`,value:r,onChange:e=>s(e.target.value),required:!0})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(c.Label,{children:`Scopes`}),(0,m.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>(0,m.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,m.jsx)(a.Checkbox,{id:`scope-${e.id}`,checked:d.has(e.id),onCheckedChange:()=>y(e.id),"aria-label":e.label}),(0,m.jsx)(`span`,{children:e.label}),e.description&&(0,m.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`— `,e.description]})]},e.id))})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(c.Label,{htmlFor:`key-exp`,children:`Expiration`}),(0,m.jsxs)(u.Select,{value:h,onValueChange:g,children:[(0,m.jsx)(u.SelectTrigger,{id:`key-exp`,children:(0,m.jsx)(u.SelectValue,{})}),(0,m.jsxs)(u.SelectContent,{children:[(0,m.jsx)(u.SelectItem,{value:`never`,children:`Jamais`}),(0,m.jsx)(u.SelectItem,{value:`30`,children:`30 jours`}),(0,m.jsx)(u.SelectItem,{value:`90`,children:`90 jours`}),(0,m.jsx)(u.SelectItem,{value:`365`,children:`1 an`})]})]})]}),(0,m.jsxs)(o.DialogFooter,{children:[(0,m.jsx)(i.Button,{type:`button`,variant:`ghost`,onClick:t,children:`Annuler`}),(0,m.jsx)(i.Button,{type:`submit`,disabled:_||!r||d.size===0,children:_?`Génération…`:`Générer la clé`})]})]})]})})}function _({keyRecord:e,graceDaysOptions:t,onCancel:n,onSubmit:r}){let[a,s]=f.useState(String(t[0]??0)),[l,d]=f.useState(!1);return(0,m.jsx)(o.Dialog,{open:!0,onOpenChange:e=>!e&&n(),children:(0,m.jsxs)(o.DialogContent,{children:[(0,m.jsxs)(o.DialogHeader,{children:[(0,m.jsxs)(o.DialogTitle,{children:[`Rotation de "`,e.name,`"`]}),(0,m.jsx)(o.DialogDescription,{children:`Une nouvelle clé sera générée. Vous pouvez choisir une période de grâce durant laquelle l'ancienne clé reste valide.`})]}),(0,m.jsxs)(`div`,{className:`space-y-2 py-2`,children:[(0,m.jsx)(c.Label,{htmlFor:`grace`,children:`Période de grâce`}),(0,m.jsxs)(u.Select,{value:a,onValueChange:s,children:[(0,m.jsx)(u.SelectTrigger,{id:`grace`,children:(0,m.jsx)(u.SelectValue,{})}),(0,m.jsx)(u.SelectContent,{children:t.map(e=>(0,m.jsx)(u.SelectItem,{value:String(e),children:e===0?`Immédiat`:`${e} jour${e>1?`s`:``}`},e))})]})]}),(0,m.jsxs)(o.DialogFooter,{children:[(0,m.jsx)(i.Button,{type:`button`,variant:`ghost`,onClick:n,disabled:l,children:`Annuler`}),(0,m.jsx)(i.Button,{type:`button`,onClick:async()=>{d(!0);try{await r(parseInt(a,10))}finally{d(!1)}},disabled:l,children:l?`Rotation…`:`Lancer la rotation`})]})]})})}function v({token:e,keyName:t,onClose:n}){let[r,a]=f.useState(!1),s=f.useRef(e);return f.useEffect(()=>()=>{s.current=``},[]),(0,m.jsx)(o.Dialog,{open:!0,onOpenChange:e=>!e&&n(),children:(0,m.jsxs)(o.DialogContent,{children:[(0,m.jsxs)(o.DialogHeader,{children:[(0,m.jsxs)(o.DialogTitle,{children:[`Token de "`,t,`"`]}),(0,m.jsxs)(o.DialogDescription,{className:`flex items-start gap-2 text-destructive`,children:[(0,m.jsx)(p.AlertTriangle,{className:`size-4 mt-0.5 shrink-0`}),(0,m.jsx)(`span`,{children:`Ce token ne sera plus affiché. Copiez-le maintenant et stockez-le dans un coffre-fort.`})]})]}),(0,m.jsx)(`div`,{"aria-live":`polite`,className:`font-mono text-sm break-all rounded bg-muted p-3 select-all`,children:e}),(0,m.jsxs)(o.DialogFooter,{className:`gap-2`,children:[(0,m.jsxs)(i.Button,{type:`button`,variant:`outline`,onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0)}catch{}},children:[(0,m.jsx)(p.Copy,{className:`size-4 mr-2`}),` `,r?`Copié !`:`Copier`]}),(0,m.jsx)(i.Button,{type:`button`,onClick:n,children:`J'ai copié le token`})]})]})})}exports.WakaApiKeysManager=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../../components/badge/index.cjs.js`),r=require(`../../components/button/index.cjs.js`),i=require(`../../components/card/index.cjs.js`),a=require(`../../components/select/index.cjs.js`),o=require(`../../components/progress/index.cjs.js`),s=require(`../../components/scroll-area/index.cjs.js`);let c=require(`react`);c=e.__toESM(c);let l=require(`lucide-react`),u=require(`react/jsx-runtime`);var d={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}},f={api:{icon:l.Globe,color:`text-blue-500`},web:{icon:l.Globe,color:`text-purple-500`},worker:{icon:l.Cpu,color:`text-orange-500`},database:{icon:l.Database,color:`text-green-500`},cache:{icon:l.HardDrive,color:`text-red-500`},queue:{icon:l.Activity,color:`text-cyan-500`}};function p(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function m(e){return e<1e3?e.toFixed(0):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function h({current:e,previous:n}){if(n===void 0)return null;let r=(e-n)/n*100,i=r>0;return(0,u.jsxs)(`span`,{className:t.cn(`text-xs flex items-center gap-0.5`,i?`text-red-500`:`text-green-500`),children:[i?(0,u.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,u.jsx)(l.TrendingDown,{className:`h-3 w-3`}),Math.abs(r).toFixed(1),`%`]})}function g({title:e,value:n,unit:r,previousValue:a,status:o,icon:s}){let c=o?d[o]:null;return(0,u.jsx)(i.Card,{children:(0,u.jsxs)(i.CardContent,{className:`p-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,u.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,u.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})}),c&&(0,u.jsx)(`div`,{className:t.cn(`w-2 h-2 rounded-full`,c.bgColor)})]}),(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,u.jsx)(`span`,{className:`text-2xl font-bold`,children:m(n)}),r&&(0,u.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:r})]}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,u.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e}),(0,u.jsx)(h,{current:n,previous:a})]})]})]})})}function _({service:e,onClick:r}){let a=d[e.status],s=f[e.type],c=s.icon,{metrics:m,previousMetrics:h}=e;return m.successRate/100*(1-m.p95ResponseTime/3e3),(0,u.jsx)(i.Card,{className:t.cn(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/30`),onClick:r,children:(0,u.jsxs)(i.CardContent,{className:`p-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,u.jsx)(`div`,{className:t.cn(`p-2 rounded-lg`,`${s.color.replace(`text-`,`bg-`)}/10`),children:(0,u.jsx)(c,{className:t.cn(`h-5 w-5`,s.color)})}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`h4`,{className:`font-semibold truncate`,children:e.name}),(0,u.jsx)(`div`,{className:t.cn(`w-2 h-2 rounded-full shrink-0`,a.bgColor)}),e.version&&(0,u.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[`v`,e.version]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-sm`,children:[(0,u.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(l.Zap,{className:`h-3 w-3 text-muted-foreground`}),m.requestsPerSecond,`/s`]}),(0,u.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(l.Clock,{className:`h-3 w-3 text-muted-foreground`}),p(m.avgResponseTime)]}),(0,u.jsxs)(`span`,{className:t.cn(`flex items-center gap-1`,m.errorRate>5&&`text-red-500`,m.errorRate>1&&m.errorRate<=5&&`text-yellow-500`),children:[(0,u.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),m.errorRate.toFixed(2),`%`]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,u.jsxs)(`span`,{children:[`p50: `,p(m.p50ResponseTime)]}),(0,u.jsxs)(`span`,{children:[`p95: `,p(m.p95ResponseTime)]}),(0,u.jsxs)(`span`,{children:[`p99: `,p(m.p99ResponseTime)]})]}),e.tags&&e.tags.length>0&&(0,u.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[e.tags.slice(0,3).map(e=>(0,u.jsx)(n.Badge,{variant:`secondary`,className:`text-xs`,children:e},e)),e.tags.length>3&&(0,u.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,e.tags.length-3]})]})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,u.jsxs)(`div`,{className:`text-lg font-bold text-green-500`,children:[m.successRate.toFixed(1),`%`]}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Success`}),e.instances&&(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.instances,` instances`]})]})]}),(m.cpuUsage!==void 0||m.memoryUsage!==void 0)&&(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-4 pt-3 border-t`,children:[m.cpuUsage!==void 0&&(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,u.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,u.jsxs)(`span`,{className:t.cn(m.cpuUsage>80&&`text-red-500`),children:[m.cpuUsage,`%`]})]}),(0,u.jsx)(o.Progress,{value:m.cpuUsage,className:t.cn(`h-1.5`,m.cpuUsage>80&&`[&>div]:bg-red-500`)})]}),m.memoryUsage!==void 0&&(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,u.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` Memory`]}),(0,u.jsxs)(`span`,{className:t.cn(m.memoryUsage>80&&`text-red-500`),children:[m.memoryUsage,`%`]})]}),(0,u.jsx)(o.Progress,{value:m.memoryUsage,className:t.cn(`h-1.5`,m.memoryUsage>80&&`[&>div]:bg-red-500`)})]})]})]})})}function v({transactions:e,onClick:n}){return(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.CardHeader,{className:`pb-2`,children:(0,u.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,u.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Transactions`]})}),(0,u.jsx)(i.CardContent,{children:(0,u.jsx)(s.ScrollArea,{className:`h-[300px]`,children:(0,u.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors`,onClick:()=>n?.(e),children:[e.status===`success`?(0,u.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):(0,u.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.name}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.service})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,u.jsx)(`div`,{className:t.cn(`text-sm font-medium`,e.duration>1e3&&`text-yellow-500`,e.duration>3e3&&`text-red-500`),children:p(e.duration)}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.timestamp.toLocaleTimeString()})]})]},e.id))})})})]})}function y({services:e,recentTransactions:n=[],timeRange:o=`1h`,onTimeRangeChange:f,onServiceClick:p,onTransactionClick:m,onRefresh:h,className:y}){let[b,x]=c.useState(`all`),S=c.useMemo(()=>({totalRequests:e.reduce((e,t)=>e+t.metrics.requestsPerSecond,0),avgResponseTime:e.reduce((e,t)=>e+t.metrics.avgResponseTime,0)/e.length,avgErrorRate:e.reduce((e,t)=>e+t.metrics.errorRate,0)/e.length,healthyCount:e.filter(e=>e.status===`healthy`).length,totalServices:e.length}),[e]),C=c.useMemo(()=>b===`all`?e:e.filter(e=>e.status===b),[e,b]);return(0,u.jsxs)(`div`,{className:t.cn(`space-y-6`,y),children:[(0,u.jsx)(i.Card,{children:(0,u.jsx)(i.CardHeader,{children:(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(l.Activity,{className:`h-6 w-6`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(i.CardTitle,{children:`Application Performance`}),(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor service health and performance metrics`})]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsxs)(a.Select,{value:o,onValueChange:e=>f?.(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-28`,children:[(0,u.jsx)(l.Clock,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`1h`,children:`Last 1h`}),(0,u.jsx)(a.SelectItem,{value:`6h`,children:`Last 6h`}),(0,u.jsx)(a.SelectItem,{value:`24h`,children:`Last 24h`}),(0,u.jsx)(a.SelectItem,{value:`7d`,children:`Last 7d`}),(0,u.jsx)(a.SelectItem,{value:`30d`,children:`Last 30d`})]})]}),h&&(0,u.jsx)(r.Button,{variant:`outline`,onClick:h,children:(0,u.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,u.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,u.jsx)(g,{title:`Total Requests`,value:S.totalRequests,unit:`/s`,icon:l.Zap}),(0,u.jsx)(g,{title:`Avg Response Time`,value:S.avgResponseTime,unit:`ms`,icon:l.Clock,status:S.avgResponseTime>500?`warning`:`healthy`}),(0,u.jsx)(g,{title:`Error Rate`,value:S.avgErrorRate,unit:`%`,icon:l.AlertTriangle,status:S.avgErrorRate>5?`critical`:S.avgErrorRate>1?`warning`:`healthy`}),(0,u.jsx)(g,{title:`Services Healthy`,value:S.healthyCount,unit:`/ ${S.totalServices}`,icon:l.CheckCircle2,status:S.healthyCount===S.totalServices?`healthy`:`warning`})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,u.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsx)(`h3`,{className:`font-semibold`,children:`Services`}),(0,u.jsx)(`div`,{className:`flex items-center gap-2`,children:[`all`,`healthy`,`warning`,`critical`].map(e=>(0,u.jsx)(r.Button,{variant:b===e?`default`:`ghost`,size:`sm`,onClick:()=>x(e),children:e===`all`?`All`:d[e].label},e))})]}),(0,u.jsx)(s.ScrollArea,{className:`h-[500px]`,children:(0,u.jsx)(`div`,{className:`space-y-4 pr-4`,children:C.map(e=>(0,u.jsx)(_,{service:e,onClick:()=>p?.(e)},e.id))})})]}),(0,u.jsx)(`div`,{children:(0,u.jsx)(v,{transactions:n,onClick:m})})]})]})}var b=[{id:`1`,name:`api-gateway`,type:`api`,status:`healthy`,version:`2.4.1`,instances:3,metrics:{requestsPerSecond:1250,avgResponseTime:45,p50ResponseTime:32,p95ResponseTime:120,p99ResponseTime:250,errorRate:.12,successRate:99.88,activeConnections:450,cpuUsage:45,memoryUsage:62},tags:[`production`,`critical`]},{id:`2`,name:`user-service`,type:`api`,status:`healthy`,version:`1.8.0`,instances:2,metrics:{requestsPerSecond:350,avgResponseTime:85,p50ResponseTime:65,p95ResponseTime:180,p99ResponseTime:450,errorRate:.5,successRate:99.5,activeConnections:120,cpuUsage:35,memoryUsage:55},tags:[`production`]},{id:`3`,name:`payment-service`,type:`api`,status:`warning`,version:`3.1.0`,instances:2,metrics:{requestsPerSecond:150,avgResponseTime:520,p50ResponseTime:280,p95ResponseTime:1200,p99ResponseTime:2500,errorRate:2.5,successRate:97.5,activeConnections:85,cpuUsage:78,memoryUsage:82},tags:[`production`,`payment`]},{id:`4`,name:`notification-worker`,type:`worker`,status:`healthy`,instances:5,metrics:{requestsPerSecond:500,avgResponseTime:25,p50ResponseTime:18,p95ResponseTime:55,p99ResponseTime:120,errorRate:.05,successRate:99.95,activeConnections:0,cpuUsage:25,memoryUsage:40}},{id:`5`,name:`postgres-primary`,type:`database`,status:`healthy`,instances:1,metrics:{requestsPerSecond:2500,avgResponseTime:8,p50ResponseTime:5,p95ResponseTime:25,p99ResponseTime:80,errorRate:.01,successRate:99.99,activeConnections:120,cpuUsage:55,memoryUsage:72}},{id:`6`,name:`redis-cache`,type:`cache`,status:`healthy`,instances:3,metrics:{requestsPerSecond:15e3,avgResponseTime:.5,p50ResponseTime:.3,p95ResponseTime:1.2,p99ResponseTime:3,errorRate:.001,successRate:99.999,activeConnections:500,memoryUsage:45}}],x=[{id:`1`,name:`POST /api/users`,service:`user-service`,duration:85,timestamp:new Date(Date.now()-5e3),status:`success`},{id:`2`,name:`GET /api/products`,service:`api-gateway`,duration:42,timestamp:new Date(Date.now()-12e3),status:`success`},{id:`3`,name:`POST /api/payments`,service:`payment-service`,duration:1250,timestamp:new Date(Date.now()-25e3),status:`error`},{id:`4`,name:`GET /api/orders/:id`,service:`api-gateway`,duration:65,timestamp:new Date(Date.now()-45e3),status:`success`},{id:`5`,name:`POST /api/notifications`,service:`notification-worker`,duration:22,timestamp:new Date(Date.now()-6e4),status:`success`},{id:`6`,name:`GET /api/users/:id`,service:`user-service`,duration:95,timestamp:new Date(Date.now()-9e4),status:`success`},{id:`7`,name:`PUT /api/cart`,service:`api-gateway`,duration:180,timestamp:new Date(Date.now()-12e4),status:`success`},{id:`8`,name:`POST /api/checkout`,service:`payment-service`,duration:3200,timestamp:new Date(Date.now()-18e4),status:`error`}];exports.APMOverview=y,exports.defaultAPMServices=b,exports.defaultAPMTransactions=x;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/badge/index.cjs.js"),r=require("../../components/button/index.cjs.js"),i=require("../../components/card/index.cjs.js"),a=require("../../components/select/index.cjs.js"),o=require("../../components/progress/index.cjs.js"),s=require("../../components/scroll-area/index.cjs.js");let c=require("react");c=e.__toESM(c);let l=require("lucide-react"),u=require("react/jsx-runtime");var d={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}},f={api:{icon:l.Globe,color:`text-blue-500`},web:{icon:l.Globe,color:`text-purple-500`},worker:{icon:l.Cpu,color:`text-orange-500`},database:{icon:l.Database,color:`text-green-500`},cache:{icon:l.HardDrive,color:`text-red-500`},queue:{icon:l.Activity,color:`text-cyan-500`}};function p(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function m(e){return e<1e3?e.toFixed(0):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function h({current:e,previous:n}){if(n===void 0)return null;let r=(e-n)/n*100,i=r>0;return(0,u.jsxs)(`span`,{className:t.cn(`text-xs flex items-center gap-0.5`,i?`text-red-500`:`text-green-500`),children:[i?(0,u.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,u.jsx)(l.TrendingDown,{className:`h-3 w-3`}),Math.abs(r).toFixed(1),`%`]})}function g({title:e,value:n,unit:r,previousValue:a,status:o,icon:s}){let c=o?d[o]:null;return(0,u.jsx)(i.Card,{children:(0,u.jsxs)(i.CardContent,{className:`p-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,u.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,u.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})}),c&&(0,u.jsx)(`div`,{className:t.cn(`w-2 h-2 rounded-full`,c.bgColor)})]}),(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,u.jsx)(`span`,{className:`text-2xl font-bold`,children:m(n)}),r&&(0,u.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:r})]}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,u.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e}),(0,u.jsx)(h,{current:n,previous:a})]})]})]})})}function _({service:e,onClick:r}){let a=d[e.status],s=f[e.type],c=s.icon,{metrics:m,previousMetrics:h}=e;return m.successRate/100*(1-m.p95ResponseTime/3e3),(0,u.jsx)(i.Card,{className:t.cn(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/30`),onClick:r,children:(0,u.jsxs)(i.CardContent,{className:`p-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,u.jsx)(`div`,{className:t.cn(`p-2 rounded-lg`,`${s.color.replace(`text-`,`bg-`)}/10`),children:(0,u.jsx)(c,{className:t.cn(`h-5 w-5`,s.color)})}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`h4`,{className:`font-semibold truncate`,children:e.name}),(0,u.jsx)(`div`,{className:t.cn(`w-2 h-2 rounded-full shrink-0`,a.bgColor)}),e.version&&(0,u.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[`v`,e.version]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-sm`,children:[(0,u.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(l.Zap,{className:`h-3 w-3 text-muted-foreground`}),m.requestsPerSecond,`/s`]}),(0,u.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(l.Clock,{className:`h-3 w-3 text-muted-foreground`}),p(m.avgResponseTime)]}),(0,u.jsxs)(`span`,{className:t.cn(`flex items-center gap-1`,m.errorRate>5&&`text-red-500`,m.errorRate>1&&m.errorRate<=5&&`text-yellow-500`),children:[(0,u.jsx)(l.AlertTriangle,{className:`h-3 w-3`}),m.errorRate.toFixed(2),`%`]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,u.jsxs)(`span`,{children:[`p50: `,p(m.p50ResponseTime)]}),(0,u.jsxs)(`span`,{children:[`p95: `,p(m.p95ResponseTime)]}),(0,u.jsxs)(`span`,{children:[`p99: `,p(m.p99ResponseTime)]})]}),e.tags&&e.tags.length>0&&(0,u.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[e.tags.slice(0,3).map(e=>(0,u.jsx)(n.Badge,{variant:`secondary`,className:`text-xs`,children:e},e)),e.tags.length>3&&(0,u.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,e.tags.length-3]})]})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,u.jsxs)(`div`,{className:`text-lg font-bold text-green-500`,children:[m.successRate.toFixed(1),`%`]}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Success`}),e.instances&&(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.instances,` instances`]})]})]}),(m.cpuUsage!==void 0||m.memoryUsage!==void 0)&&(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-4 pt-3 border-t`,children:[m.cpuUsage!==void 0&&(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,u.jsx)(l.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,u.jsxs)(`span`,{className:t.cn(m.cpuUsage>80&&`text-red-500`),children:[m.cpuUsage,`%`]})]}),(0,u.jsx)(o.Progress,{value:m.cpuUsage,className:t.cn(`h-1.5`,m.cpuUsage>80&&`[&>div]:bg-red-500`)})]}),m.memoryUsage!==void 0&&(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,u.jsx)(l.MemoryStick,{className:`h-3 w-3`}),` Memory`]}),(0,u.jsxs)(`span`,{className:t.cn(m.memoryUsage>80&&`text-red-500`),children:[m.memoryUsage,`%`]})]}),(0,u.jsx)(o.Progress,{value:m.memoryUsage,className:t.cn(`h-1.5`,m.memoryUsage>80&&`[&>div]:bg-red-500`)})]})]})]})})}function v({transactions:e,onClick:n}){return(0,u.jsxs)(i.Card,{children:[(0,u.jsx)(i.CardHeader,{className:`pb-2`,children:(0,u.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,u.jsx)(l.Activity,{className:`h-4 w-4`}),`Recent Transactions`]})}),(0,u.jsx)(i.CardContent,{children:(0,u.jsx)(s.ScrollArea,{className:`h-[300px]`,children:(0,u.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,u.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors`,onClick:()=>n?.(e),children:[e.status===`success`?(0,u.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):(0,u.jsx)(l.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.name}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.service})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,u.jsx)(`div`,{className:t.cn(`text-sm font-medium`,e.duration>1e3&&`text-yellow-500`,e.duration>3e3&&`text-red-500`),children:p(e.duration)}),(0,u.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.timestamp.toLocaleTimeString()})]})]},e.id))})})})]})}function y({services:e,recentTransactions:n=[],timeRange:o=`1h`,onTimeRangeChange:f,onServiceClick:p,onTransactionClick:m,onRefresh:h,className:y}){let[b,x]=c.useState(`all`),S=c.useMemo(()=>({totalRequests:e.reduce((e,t)=>e+t.metrics.requestsPerSecond,0),avgResponseTime:e.reduce((e,t)=>e+t.metrics.avgResponseTime,0)/e.length,avgErrorRate:e.reduce((e,t)=>e+t.metrics.errorRate,0)/e.length,healthyCount:e.filter(e=>e.status===`healthy`).length,totalServices:e.length}),[e]),C=c.useMemo(()=>b===`all`?e:e.filter(e=>e.status===b),[e,b]);return(0,u.jsxs)(`div`,{className:t.cn(`space-y-6`,y),children:[(0,u.jsx)(i.Card,{children:(0,u.jsx)(i.CardHeader,{children:(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(l.Activity,{className:`h-6 w-6`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(i.CardTitle,{children:`Application Performance`}),(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor service health and performance metrics`})]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsxs)(a.Select,{value:o,onValueChange:e=>f?.(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-28`,children:[(0,u.jsx)(l.Clock,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`1h`,children:`Last 1h`}),(0,u.jsx)(a.SelectItem,{value:`6h`,children:`Last 6h`}),(0,u.jsx)(a.SelectItem,{value:`24h`,children:`Last 24h`}),(0,u.jsx)(a.SelectItem,{value:`7d`,children:`Last 7d`}),(0,u.jsx)(a.SelectItem,{value:`30d`,children:`Last 30d`})]})]}),h&&(0,u.jsx)(r.Button,{variant:`outline`,onClick:h,children:(0,u.jsx)(l.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,u.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,u.jsx)(g,{title:`Total Requests`,value:S.totalRequests,unit:`/s`,icon:l.Zap}),(0,u.jsx)(g,{title:`Avg Response Time`,value:S.avgResponseTime,unit:`ms`,icon:l.Clock,status:S.avgResponseTime>500?`warning`:`healthy`}),(0,u.jsx)(g,{title:`Error Rate`,value:S.avgErrorRate,unit:`%`,icon:l.AlertTriangle,status:S.avgErrorRate>5?`critical`:S.avgErrorRate>1?`warning`:`healthy`}),(0,u.jsx)(g,{title:`Services Healthy`,value:S.healthyCount,unit:`/ ${S.totalServices}`,icon:l.CheckCircle2,status:S.healthyCount===S.totalServices?`healthy`:`warning`})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,u.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsx)(`h3`,{className:`font-semibold`,children:`Services`}),(0,u.jsx)(`div`,{className:`flex items-center gap-2`,children:[`all`,`healthy`,`warning`,`critical`].map(e=>(0,u.jsx)(r.Button,{variant:b===e?`default`:`ghost`,size:`sm`,onClick:()=>x(e),children:e===`all`?`All`:d[e].label},e))})]}),(0,u.jsx)(s.ScrollArea,{className:`h-[500px]`,children:(0,u.jsx)(`div`,{className:`space-y-4 pr-4`,children:C.map(e=>(0,u.jsx)(_,{service:e,onClick:()=>p?.(e)},e.id))})})]}),(0,u.jsx)(`div`,{children:(0,u.jsx)(v,{transactions:n,onClick:m})})]})]})}var b=[{id:`1`,name:`api-gateway`,type:`api`,status:`healthy`,version:`2.4.1`,instances:3,metrics:{requestsPerSecond:1250,avgResponseTime:45,p50ResponseTime:32,p95ResponseTime:120,p99ResponseTime:250,errorRate:.12,successRate:99.88,activeConnections:450,cpuUsage:45,memoryUsage:62},tags:[`production`,`critical`]},{id:`2`,name:`user-service`,type:`api`,status:`healthy`,version:`1.8.0`,instances:2,metrics:{requestsPerSecond:350,avgResponseTime:85,p50ResponseTime:65,p95ResponseTime:180,p99ResponseTime:450,errorRate:.5,successRate:99.5,activeConnections:120,cpuUsage:35,memoryUsage:55},tags:[`production`]},{id:`3`,name:`payment-service`,type:`api`,status:`warning`,version:`3.1.0`,instances:2,metrics:{requestsPerSecond:150,avgResponseTime:520,p50ResponseTime:280,p95ResponseTime:1200,p99ResponseTime:2500,errorRate:2.5,successRate:97.5,activeConnections:85,cpuUsage:78,memoryUsage:82},tags:[`production`,`payment`]},{id:`4`,name:`notification-worker`,type:`worker`,status:`healthy`,instances:5,metrics:{requestsPerSecond:500,avgResponseTime:25,p50ResponseTime:18,p95ResponseTime:55,p99ResponseTime:120,errorRate:.05,successRate:99.95,activeConnections:0,cpuUsage:25,memoryUsage:40}},{id:`5`,name:`postgres-primary`,type:`database`,status:`healthy`,instances:1,metrics:{requestsPerSecond:2500,avgResponseTime:8,p50ResponseTime:5,p95ResponseTime:25,p99ResponseTime:80,errorRate:.01,successRate:99.99,activeConnections:120,cpuUsage:55,memoryUsage:72}},{id:`6`,name:`redis-cache`,type:`cache`,status:`healthy`,instances:3,metrics:{requestsPerSecond:15e3,avgResponseTime:.5,p50ResponseTime:.3,p95ResponseTime:1.2,p99ResponseTime:3,errorRate:.001,successRate:99.999,activeConnections:500,memoryUsage:45}}],x=[{id:`1`,name:`POST /api/users`,service:`user-service`,duration:85,timestamp:new Date(Date.now()-5e3),status:`success`},{id:`2`,name:`GET /api/products`,service:`api-gateway`,duration:42,timestamp:new Date(Date.now()-12e3),status:`success`},{id:`3`,name:`POST /api/payments`,service:`payment-service`,duration:1250,timestamp:new Date(Date.now()-25e3),status:`error`},{id:`4`,name:`GET /api/orders/:id`,service:`api-gateway`,duration:65,timestamp:new Date(Date.now()-45e3),status:`success`},{id:`5`,name:`POST /api/notifications`,service:`notification-worker`,duration:22,timestamp:new Date(Date.now()-6e4),status:`success`},{id:`6`,name:`GET /api/users/:id`,service:`user-service`,duration:95,timestamp:new Date(Date.now()-9e4),status:`success`},{id:`7`,name:`PUT /api/cart`,service:`api-gateway`,duration:180,timestamp:new Date(Date.now()-12e4),status:`success`},{id:`8`,name:`POST /api/checkout`,service:`payment-service`,duration:3200,timestamp:new Date(Date.now()-18e4),status:`error`}];exports.APMOverview=y,exports.defaultAPMServices=b,exports.defaultAPMTransactions=x;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/badge/index.cjs.js"),r=require("../../components/button/index.cjs.js"),i=require("../../components/card/index.cjs.js"),a=require("../../components/label/index.cjs.js"),o=require("../../components/input/index.cjs.js"),s=require("../../components/radio-group/index.cjs.js"),c=require("../../components/separator/index.cjs.js");let l=require("react");l=e.__toESM(l);let u=require("lucide-react"),d=require("react/jsx-runtime");var f={authenticator:{icon:(0,d.jsx)(u.Smartphone,{className:`h-5 w-5`}),title:`Authenticator App`,description:`Use an app like Google Authenticator or Authy`,recommended:!0},sms:{icon:(0,d.jsx)(u.MessageSquare,{className:`h-5 w-5`}),title:`SMS`,description:`Receive codes via text message`,recommended:!1},email:{icon:(0,d.jsx)(u.Mail,{className:`h-5 w-5`}),title:`Email`,description:`Receive codes via email`,recommended:!1},hardware:{icon:(0,d.jsx)(u.Key,{className:`h-5 w-5`}),title:`Hardware Key`,description:`Use a physical security key (YubiKey, etc.)`,recommended:!0}};function p({methods:e,selected:r,onSelect:i}){return(0,d.jsx)(s.RadioGroup,{value:r,onValueChange:e=>i(e),children:(0,d.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let i=f[e];return(0,d.jsxs)(a.Label,{className:t.cn(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,r===e?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,d.jsx)(s.RadioGroupItem,{value:e}),(0,d.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-muted flex items-center justify-center`,children:i.icon}),(0,d.jsxs)(`div`,{className:`flex-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`font-medium`,children:i.title}),i.recommended&&(0,d.jsx)(n.Badge,{variant:`secondary`,className:`text-xs`,children:`Recommended`})]}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.description})]})]},e)})})})}function m({length:e=6,value:t,onChange:n}){let r=l.useRef([]),i=t.padEnd(e,``).split(``).slice(0,e),a=(t,a)=>{if(!/^\d*$/.test(a))return;let o=[...i];o[t]=a.slice(-1),n(o.join(``)),a&&t<e-1&&r.current[t+1]?.focus()},s=(e,t)=>{t.key===`Backspace`&&!i[e]&&e>0&&r.current[e-1]?.focus()},c=t=>{t.preventDefault(),n(t.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,e))};return(0,d.jsx)(`div`,{className:`flex gap-2 justify-center`,children:i.map((e,t)=>(0,d.jsx)(o.Input,{ref:e=>{r.current[t]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>a(t,e.target.value),onKeyDown:e=>s(t,e),onPaste:c,className:`w-12 h-14 text-center text-2xl font-mono`},t))})}function h({codes:e,onRegenerate:n,onDownload:a}){let[o,s]=l.useState(!1),[c,f]=l.useState(!1),p=()=>{let t=e.map(e=>e.code).join(`
|
|
2
2
|
`);navigator.clipboard.writeText(t),s(!0),setTimeout(()=>s(!1),2e3)},m=e.filter(e=>!e.used);return(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,d.jsx)(u.Key,{className:`h-5 w-5`}),`Backup Codes`]}),(0,d.jsxs)(i.CardDescription,{children:[m.length,` of `,e.length,` codes remaining`]})]}),(0,d.jsx)(r.Button,{variant:`ghost`,size:`icon`,onClick:()=>f(!c),children:c?(0,d.jsx)(u.EyeOff,{className:`h-4 w-4`}):(0,d.jsx)(u.Eye,{className:`h-4 w-4`})})]})}),(0,d.jsxs)(i.CardContent,{children:[(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,n)=>(0,d.jsx)(`div`,{className:t.cn(`font-mono text-sm p-2 rounded border text-center`,e.used?`bg-muted text-muted-foreground line-through`:`bg-card`),children:c?e.code:`••••••••`},n))}),m.length<3&&(0,d.jsxs)(`div`,{className:`mt-4 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 flex items-center gap-3`,children:[(0,d.jsx)(u.AlertTriangle,{className:`h-5 w-5 text-yellow-500`}),(0,d.jsx)(`p`,{className:`text-sm`,children:`You're running low on backup codes. Consider regenerating them.`})]})]}),(0,d.jsxs)(i.CardFooter,{className:`flex gap-2`,children:[(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:p,children:[o?(0,d.jsx)(u.Check,{className:`h-4 w-4 mr-2`}):(0,d.jsx)(u.Copy,{className:`h-4 w-4 mr-2`}),o?`Copied`:`Copy All`]}),a&&(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:a,children:[(0,d.jsx)(u.Download,{className:`h-4 w-4 mr-2`}),`Download`]}),n&&(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:n,children:[(0,d.jsx)(u.RefreshCw,{className:`h-4 w-4 mr-2`}),`Regenerate`]})]})]})}function g({status:e={enabled:!1},availableMethods:s=[`authenticator`,`sms`,`email`],qrCodeUrl:g,secretKey:_,backupCodes:v,onEnable:y,onDisable:b,onRegenerateBackupCodes:x,onSendCode:S,className:C}){let[w,T]=l.useState(`overview`),[E,D]=l.useState(s[0]),[O,k]=l.useState(``),[A,j]=l.useState(!1),[M,N]=l.useState(null),[P,F]=l.useState(!1),[I,L]=l.useState(!1);return(0,d.jsxs)(`div`,{className:t.cn(`space-y-6 max-w-2xl`,C),children:[(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.enabled?(0,d.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-green-500/10 flex items-center justify-center`,children:(0,d.jsx)(u.ShieldCheck,{className:`h-6 w-6 text-green-500`})}):(0,d.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-yellow-500/10 flex items-center justify-center`,children:(0,d.jsx)(u.ShieldAlert,{className:`h-6 w-6 text-yellow-500`})}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(i.CardTitle,{children:`Two-Factor Authentication`}),(0,d.jsx)(i.CardDescription,{children:e.enabled?`Enabled via ${f[e.method]?.title}`:`Add an extra layer of security to your account`})]})]}),(0,d.jsx)(n.Badge,{variant:e.enabled?`default`:`secondary`,children:e.enabled?`Enabled`:`Disabled`})]})}),w===`overview`&&(0,d.jsx)(i.CardFooter,{children:e.enabled?(0,d.jsxs)(`div`,{className:`flex gap-2 w-full`,children:[(0,d.jsx)(r.Button,{variant:`outline`,className:`flex-1`,onClick:()=>T(`setup`),children:`Change Method`}),(0,d.jsx)(r.Button,{variant:`destructive`,className:`flex-1`,onClick:()=>T(`disable`),children:`Disable 2FA`})]}):(0,d.jsxs)(r.Button,{className:`w-full`,onClick:()=>T(`setup`),children:[(0,d.jsx)(u.Shield,{className:`h-4 w-4 mr-2`}),`Enable Two-Factor Authentication`]})})]}),w===`setup`&&(0,d.jsxs)(i.Card,{children:[(0,d.jsxs)(i.CardHeader,{children:[(0,d.jsx)(i.CardTitle,{children:`Choose Authentication Method`}),(0,d.jsx)(i.CardDescription,{children:`Select how you want to receive verification codes`})]}),(0,d.jsx)(i.CardContent,{children:(0,d.jsx)(p,{methods:s,selected:E,onSelect:D})}),(0,d.jsxs)(i.CardFooter,{className:`flex gap-2`,children:[(0,d.jsx)(r.Button,{variant:`outline`,onClick:()=>T(`overview`),children:`Cancel`}),(0,d.jsxs)(r.Button,{className:`flex-1`,onClick:()=>T(`verify`),children:[`Continue`,(0,d.jsx)(u.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),w===`verify`&&(0,d.jsxs)(i.Card,{children:[(0,d.jsxs)(i.CardHeader,{children:[(0,d.jsx)(i.CardTitle,{children:E===`authenticator`?`Set Up Authenticator`:`Verify Your Identity`}),(0,d.jsx)(i.CardDescription,{children:E===`authenticator`?`Scan the QR code with your authenticator app`:`Enter the code sent to your ${E}`})]}),(0,d.jsxs)(i.CardContent,{className:`space-y-6`,children:[E===`authenticator`&&(0,d.jsxs)(d.Fragment,{children:[g&&(0,d.jsx)(`div`,{className:`flex justify-center`,children:(0,d.jsx)(`div`,{className:`p-4 bg-white rounded-lg`,children:(0,d.jsx)(`img`,{src:g,alt:`QR Code`,className:`h-48 w-48`})})}),_&&(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(a.Label,{children:`Or enter this code manually:`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(o.Input,{value:_,readOnly:!0,className:`font-mono`}),(0,d.jsx)(r.Button,{variant:`outline`,size:`icon`,onClick:()=>{_&&(navigator.clipboard.writeText(_),F(!0),setTimeout(()=>F(!1),2e3))},children:P?(0,d.jsx)(u.Check,{className:`h-4 w-4`}):(0,d.jsx)(u.Copy,{className:`h-4 w-4`})})]})]}),(0,d.jsx)(c.Separator,{})]}),(E===`sms`||E===`email`)&&!I&&(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`We'll send a verification code to your `,E===`sms`?`phone`:`email`]}),(0,d.jsxs)(r.Button,{onClick:async()=>{if(S){j(!0);try{await S(E),L(!0)}finally{j(!1)}}},disabled:A,children:[A?(0,d.jsx)(u.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):E===`sms`?(0,d.jsx)(u.MessageSquare,{className:`h-4 w-4 mr-2`}):(0,d.jsx)(u.Mail,{className:`h-4 w-4 mr-2`}),`Send Code`]})]}),(E===`authenticator`||I)&&(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(a.Label,{className:`text-center block`,children:`Enter the 6-digit code`}),(0,d.jsx)(m,{value:O,onChange:k}),M&&(0,d.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:M})]})]}),(0,d.jsxs)(i.CardFooter,{className:`flex gap-2`,children:[(0,d.jsx)(r.Button,{variant:`outline`,onClick:()=>T(`setup`),children:`Back`}),(0,d.jsxs)(r.Button,{className:`flex-1`,onClick:async()=>{if(y){j(!0),N(null);try{await y(E,O)?(T(`overview`),k(``)):N(`Invalid verification code. Please try again.`)}finally{j(!1)}}},disabled:O.length!==6||A,children:[A?(0,d.jsx)(u.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,d.jsx)(u.Lock,{className:`h-4 w-4 mr-2`}),`Verify & Enable`]})]})]}),w===`disable`&&(0,d.jsxs)(i.Card,{children:[(0,d.jsxs)(i.CardHeader,{children:[(0,d.jsx)(i.CardTitle,{className:`text-destructive`,children:`Disable Two-Factor Authentication`}),(0,d.jsx)(i.CardDescription,{children:`Enter your verification code to confirm. This will make your account less secure.`})]}),(0,d.jsxs)(i.CardContent,{className:`space-y-4`,children:[(0,d.jsx)(`div`,{className:`p-4 rounded-lg bg-destructive/10 border border-destructive/20`,children:(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.AlertTriangle,{className:`h-5 w-5 text-destructive mt-0.5`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`font-medium text-destructive`,children:`Warning`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Disabling 2FA will remove an important layer of security from your account. Anyone with your password will be able to access your account.`})]})]})}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(a.Label,{children:`Enter your verification code`}),(0,d.jsx)(m,{value:O,onChange:k}),M&&(0,d.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:M})]})]}),(0,d.jsxs)(i.CardFooter,{className:`flex gap-2`,children:[(0,d.jsx)(r.Button,{variant:`outline`,onClick:()=>T(`overview`),children:`Cancel`}),(0,d.jsxs)(r.Button,{variant:`destructive`,className:`flex-1`,onClick:async()=>{if(b){j(!0),N(null);try{await b(O)?(T(`overview`),k(``)):N(`Invalid verification code. Please try again.`)}finally{j(!1)}}},disabled:O.length!==6||A,children:[A?(0,d.jsx)(u.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,d.jsx)(u.ShieldAlert,{className:`h-4 w-4 mr-2`}),`Disable 2FA`]})]})]}),e.enabled&&v&&v.length>0&&w===`overview`&&(0,d.jsx)(h,{codes:v,onRegenerate:x,onDownload:()=>{let e=v.map(e=>e.code).join(`
|
|
3
|
-
`),t=new Blob([e],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`backup-codes.txt`,r.click()}}),(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{children:(0,d.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,d.jsx)(u.Fingerprint,{className:`h-5 w-5`}),`Security Tips`]})}),(0,d.jsxs)(i.CardContent,{className:`space-y-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Use an authenticator app for the most secure experience`})]}),(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Store your backup codes in a safe place (password manager, safe deposit box)`})]}),(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Never share your verification codes with anyone`})]})]})]})]})}var _=[{code:`ABCD-1234`,used:!1},{code:`EFGH-5678`,used:!1},{code:`IJKL-9012`,used:!0},{code:`MNOP-3456`,used:!1},{code:`QRST-7890`,used:!1},{code:`UVWX-1234`,used:!0},{code:`YZAB-5678`,used:!1},{code:`CDEF-9012`,used:!1}],v={enabled:!0,method:`authenticator`,lastVerified:new Date(`2024-03-01`)};exports.default=g,exports.defaultBackupCodes=_,exports.defaultStatus=v;
|
|
3
|
+
`),t=new Blob([e],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`backup-codes.txt`,r.click()}}),(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{children:(0,d.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,d.jsx)(u.Fingerprint,{className:`h-5 w-5`}),`Security Tips`]})}),(0,d.jsxs)(i.CardContent,{className:`space-y-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Use an authenticator app for the most secure experience`})]}),(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Store your backup codes in a safe place (password manager, safe deposit box)`})]}),(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsx)(u.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Never share your verification codes with anyone`})]})]})]})]})}var _=[{code:`ABCD-1234`,used:!1},{code:`EFGH-5678`,used:!1},{code:`IJKL-9012`,used:!0},{code:`MNOP-3456`,used:!1},{code:`QRST-7890`,used:!1},{code:`UVWX-1234`,used:!0},{code:`YZAB-5678`,used:!1},{code:`CDEF-9012`,used:!1}],v={enabled:!0,method:`authenticator`,lastVerified:new Date(`2024-03-01`)};exports.Auth2FA=g,exports.default=g,exports.defaultBackupCodes=_,exports.defaultStatus=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/avatar/index.cjs.js"),r=require("../../components/button/index.cjs.js"),i=require("../../components/slider/index.cjs.js");let a=require("react");a=e.__toESM(a);let o=require("lucide-react"),s=require("react/jsx-runtime"),c=require("react-easy-crop");c=e.__toESM(c);var l={size:256,outputFormat:`image/webp`,outputQuality:.85,maxSourceSizeMB:8,shape:`circle`};function u(e,t,n){let r=n*Math.PI/180;return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}async function d(e,t,n,r,i,a){let o=await f(e),s=n*Math.PI/180,{width:c,height:l}=u(o.width,o.height,n),d=document.createElement(`canvas`);d.width=c,d.height=l;let p=d.getContext(`2d`);if(!p)throw Error(`Canvas 2D context not available`);p.translate(c/2,l/2),p.rotate(s),p.translate(-o.width/2,-o.height/2),p.drawImage(o,0,0);let m=document.createElement(`canvas`);m.width=r,m.height=r;let h=m.getContext(`2d`);if(!h)throw Error(`Canvas 2D context not available`);h.drawImage(d,t.x,t.y,t.width,t.height,0,0,r,r);let g=m.toDataURL(i,a);return{blob:await new Promise((e,t)=>m.toBlob(n=>n?e(n):t(Error(`toBlob failed`)),i,a)),dataUrl:g}}function f(e){return new Promise((t,n)=>{let r=new Image;r.crossOrigin=`anonymous`,r.onload=()=>t(r),r.onerror=n,r.src=e})}function p({value:e,onChange:u,size:f=l.size,outputFormat:p=l.outputFormat,outputQuality:m=l.outputQuality,maxSourceSizeMB:h=l.maxSourceSizeMB,shape:g=l.shape,labels:_,className:v}){let[y,b]=a.useState(null),[x,S]=a.useState({x:0,y:0}),[C,w]=a.useState(1),[T,E]=a.useState(0),[D,O]=a.useState(null),[k,A]=a.useState(null),[j,M]=a.useState(!1),N=a.useRef(null),P=()=>N.current?.click(),F=e=>{if(A(null),!e)return;if(!e.type.startsWith(`image/`)){A(`Format invalide : seules les images sont acceptées`);return}if(e.size>h*1024*1024){A(`Fichier trop volumineux (max ${h} Mo)`);return}let t=URL.createObjectURL(e);b(t),S({x:0,y:0}),w(1),E(0)};return y?(0,s.jsxs)(`div`,{className:t.cn(`flex flex-col gap-4`,v),children:[(0,s.jsx)(`div`,{className:`relative w-full h-64 bg-muted rounded-md overflow-hidden`,children:(0,s.jsx)(c.default,{image:y,crop:x,zoom:C,rotation:T,aspect:1,cropShape:g===`circle`?`round`:`rect`,onCropChange:S,onZoomChange:w,onRotationChange:E,onCropComplete:(e,t)=>O(t)})}),(0,s.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,s.jsx)(o.ZoomIn,{className:`size-3`}),` `,_?.zoom??`Zoom`]}),(0,s.jsx)(i.Slider,{min:1,max:3,step:.05,value:[C],onValueChange:e=>w(e[0])})]}),(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,s.jsx)(o.RotateCw,{className:`size-3`}),` `,_?.rotate??`Rotation`]}),(0,s.jsx)(i.Slider,{min:0,max:360,step:1,value:[T],onValueChange:e=>E(e[0])})]})]}),k&&(0,s.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k}),(0,s.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,s.jsx)(r.Button,{type:`button`,variant:`ghost`,onClick:()=>{y&&URL.revokeObjectURL(y),b(null),A(null)},disabled:j,children:_?.cancel??`Annuler`}),(0,s.jsx)(r.Button,{type:`button`,onClick:async()=>{if(!(!y||!D)){M(!0);try{let{blob:e,dataUrl:t}=await d(y,D,T,f,p,m);await Promise.resolve(u(e,t)),URL.revokeObjectURL(y),b(null)}catch(e){A(e instanceof Error?e.message:`Échec du traitement de l'image`)}finally{M(!1)}}},disabled:j||!D,children:j?`Traitement…`:_?.save??`Enregistrer`})]})]}):(0,s.jsxs)(`div`,{className:t.cn(`flex flex-col items-center gap-3`,v),children:[(0,s.jsxs)(n.Avatar,{className:t.cn(`size-24`,g===`square`&&`rounded-md`),children:[e&&(0,s.jsx)(n.AvatarImage,{src:e,alt:``}),(0,s.jsx)(n.AvatarFallback,{children:(0,s.jsx)(o.Upload,{className:`size-6`})})]}),(0,s.jsx)(`input`,{ref:N,type:`file`,accept:`image/*`,"aria-label":`Sélectionner un avatar`,className:`sr-only`,onChange:e=>F(e.target.files?.[0])}),(0,s.jsx)(r.Button,{type:`button`,variant:`outline`,onClick:P,children:_?.dropzone??`Sélectionner une image`}),k&&(0,s.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k})]})}exports.WakaAvatarUpload=p;
|
|
@@ -51,20 +51,20 @@ function _({ value: m, onChange: g, size: _ = p.size, outputFormat: v = p.output
|
|
|
51
51
|
x: 0,
|
|
52
52
|
y: 0
|
|
53
53
|
}), [O, k] = o.useState(1), [A, j] = o.useState(0), [M, N] = o.useState(null), [P, F] = o.useState(null), [I, L] = o.useState(!1), R = o.useRef(null), z = () => R.current?.click(), B = (e) => {
|
|
54
|
-
if (F(null), e)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
if (e.size > b * 1024 * 1024) {
|
|
60
|
-
F(`Fichier trop volumineux (max ${b} Mo)`);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
T(URL.createObjectURL(e)), D({
|
|
64
|
-
x: 0,
|
|
65
|
-
y: 0
|
|
66
|
-
}), k(1), j(0);
|
|
54
|
+
if (F(null), !e) return;
|
|
55
|
+
if (!e.type.startsWith("image/")) {
|
|
56
|
+
F("Format invalide : seules les images sont acceptées");
|
|
57
|
+
return;
|
|
67
58
|
}
|
|
59
|
+
if (e.size > b * 1024 * 1024) {
|
|
60
|
+
F(`Fichier trop volumineux (max ${b} Mo)`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let t = URL.createObjectURL(e);
|
|
64
|
+
T(t), D({
|
|
65
|
+
x: 0,
|
|
66
|
+
y: 0
|
|
67
|
+
}), k(1), j(0);
|
|
68
68
|
};
|
|
69
69
|
return w ? /* @__PURE__ */ d("div", {
|
|
70
70
|
className: e("flex flex-col gap-4", C),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../../components/button/index.cjs.js`),r=require(`../../components/card/index.cjs.js`),i=require(`../../components/select/index.cjs.js`),a=require(`../../components/popover/index.cjs.js`);let o=require(`react`);o=e.__toESM(o);let s=require(`lucide-react`),c=require(`react/jsx-runtime`);var l={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function u(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function d(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function f(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?d(n,t)||t>=n&&t<=r:d(n,t)})}function p({currentDate:e,viewMode:t,onPrevious:r,onNext:a,onToday:o,onViewModeChange:l,onAddClick:u,showViewSelector:d,showAddButton:f,locale:p}){return(0,c.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(n.Button,{variant:`outline`,size:`icon`,onClick:r,children:(0,c.jsx)(s.ChevronLeft,{className:`h-4 w-4`})}),(0,c.jsx)(n.Button,{variant:`outline`,size:`icon`,onClick:a,children:(0,c.jsx)(s.ChevronRight,{className:`h-4 w-4`})}),(0,c.jsx)(n.Button,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,c.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(p,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(p,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(p,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&l&&(0,c.jsxs)(i.Select,{value:t,onValueChange:e=>l(e),children:[(0,c.jsx)(i.SelectTrigger,{className:`w-[120px]`,children:(0,c.jsx)(i.SelectValue,{})}),(0,c.jsxs)(i.SelectContent,{children:[(0,c.jsx)(i.SelectItem,{value:`month`,children:`Mois`}),(0,c.jsx)(i.SelectItem,{value:`week`,children:`Semaine`}),(0,c.jsx)(i.SelectItem,{value:`day`,children:`Jour`}),(0,c.jsx)(i.SelectItem,{value:`agenda`,children:`Agenda`})]})]}),f&&u&&(0,c.jsxs)(n.Button,{onClick:u,children:[(0,c.jsx)(s.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function m({event:e,onClick:n,compact:r=!1}){let i=l[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,c.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.cn(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,c.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function h({event:e,onEdit:r,onDelete:i}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,u=l[e.color||`blue`];return(0,c.jsxs)(`div`,{className:`w-72`,children:[(0,c.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,c.jsx)(`div`,{className:t.cn(`w-3 h-3 rounded-full mt-1`,u.bg.replace(`100`,`500`))}),(0,c.jsxs)(`div`,{className:`flex gap-1`,children:[r&&(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:r,children:(0,c.jsx)(s.Edit,{className:`h-3 w-3`})}),i&&(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,children:(0,c.jsx)(s.Trash2,{className:`h-3 w-3`})})]})]}),(0,c.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,c.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Clock,{className:`h-4 w-4`}),e.allDay?(0,c.jsx)(`span`,{children:`Toute la journée`}):(0,c.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.MapPin,{className:`h-4 w-4`}),(0,c.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Users,{className:`h-4 w-4`}),(0,c.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,c.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function g({currentDate:e,events:n,weekStartsOn:r,locale:i,onDayClick:o,onEventClick:s,onEventEdit:l,onEventDelete:p}){let g=e.getFullYear(),_=e.getMonth(),v=u(g,_),y=new Date,b=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(i,{weekday:`short`})),x=(new Date(g,_,1).getDay()-r+7)%7,S=[];for(let e=0;e<x;e++)S.push(null);for(S.push(...v);S.length%7!=0;)S.push(null);return(0,c.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:b.map(e=>(0,c.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,c.jsx)(`div`,{className:`grid grid-cols-7`,children:S.map((e,r)=>{let i=e?f(n,e):[],u=e&&d(e,y);return(0,c.jsx)(`div`,{className:t.cn(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===_)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&o?.(e),children:e&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`div`,{className:t.cn(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,c.jsxs)(`div`,{className:`space-y-1`,children:[i.slice(0,3).map(e=>(0,c.jsxs)(a.Popover,{children:[(0,c.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,c.jsx)(`div`,{children:(0,c.jsx)(m,{event:e,onClick:()=>s?.(e),compact:!0})})}),(0,c.jsx)(a.PopoverContent,{children:(0,c.jsx)(h,{event:e,onEdit:()=>l?.(e.id,{}),onDelete:()=>p?.(e.id)})})]},e.id)),i.length>3&&(0,c.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,i.length-3,` autres`]})]})]})},r)})})]})}function _({currentDate:e,events:n,locale:i,onEventClick:a}){let o=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),u={};return o.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();u[t]||(u[t]=[]),u[t].push(e)}),(0,c.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(u).map(([e,n])=>(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(i,{weekday:`long`,day:`numeric`,month:`long`})}),(0,c.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=l[e.color||`blue`],o=typeof e.start==`string`?new Date(e.start):e.start,u=typeof e.end==`string`?new Date(e.end):e.end;return(0,c.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>a?.(e),children:(0,c.jsxs)(r.CardContent,{className:`p-3 flex gap-3`,children:[(0,c.jsx)(`div`,{className:t.cn(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,c.jsxs)(`div`,{className:`flex-1`,children:[(0,c.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,c.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${o.toLocaleTimeString(i,{hour:`2-digit`,minute:`2-digit`})} - ${u.toLocaleTimeString(i,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,c.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,c.jsx)(s.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(u).length===0&&(0,c.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function v({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:s,onEventCreate:l,onEventEdit:u,onEventDelete:d,onDayClick:f,showHeader:m=!0,showViewSelector:h=!0,showAddButton:v=!0,weekStartsOn:y=1,locale:b=`fr-FR`,className:x}){let[S,C]=o.useState(new Date),[w,T]=o.useState(`month`),[E,D]=o.useState(!1),O=n??S,k=i??w,A=e=>{r?r(e):C(e)};return(0,c.jsxs)(`div`,{className:t.cn(`space-y-4`,x),children:[m&&(0,c.jsx)(p,{currentDate:O,viewMode:k,onPrevious:()=>{let e=new Date(O);switch(k){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}A(e)},onNext:()=>{let e=new Date(O);switch(k){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}A(e)},onToday:()=>{A(new Date)},onViewModeChange:e=>{a?a(e):T(e)},onAddClick:()=>D(!0),showViewSelector:h,showAddButton:v,locale:b}),k===`month`&&(0,c.jsx)(g,{currentDate:O,events:e,weekStartsOn:y,locale:b,onDayClick:f,onEventClick:s,onEventEdit:u,onEventDelete:d}),k===`agenda`&&(0,c.jsx)(_,{currentDate:O,events:e,locale:b,onEventClick:s}),(k===`week`||k===`day`)&&(0,c.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,k===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var y=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}];exports.default=v,exports.defaultCalendarEvents=y;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/button/index.cjs.js"),r=require("../../components/card/index.cjs.js"),i=require("../../components/select/index.cjs.js"),a=require("../../components/popover/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");var l={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function u(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function d(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function f(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?d(n,t)||t>=n&&t<=r:d(n,t)})}function p({currentDate:e,viewMode:t,onPrevious:r,onNext:a,onToday:o,onViewModeChange:l,onAddClick:u,showViewSelector:d,showAddButton:f,locale:p}){return(0,c.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(n.Button,{variant:`outline`,size:`icon`,onClick:r,children:(0,c.jsx)(s.ChevronLeft,{className:`h-4 w-4`})}),(0,c.jsx)(n.Button,{variant:`outline`,size:`icon`,onClick:a,children:(0,c.jsx)(s.ChevronRight,{className:`h-4 w-4`})}),(0,c.jsx)(n.Button,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,c.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(p,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(p,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(p,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&l&&(0,c.jsxs)(i.Select,{value:t,onValueChange:e=>l(e),children:[(0,c.jsx)(i.SelectTrigger,{className:`w-[120px]`,children:(0,c.jsx)(i.SelectValue,{})}),(0,c.jsxs)(i.SelectContent,{children:[(0,c.jsx)(i.SelectItem,{value:`month`,children:`Mois`}),(0,c.jsx)(i.SelectItem,{value:`week`,children:`Semaine`}),(0,c.jsx)(i.SelectItem,{value:`day`,children:`Jour`}),(0,c.jsx)(i.SelectItem,{value:`agenda`,children:`Agenda`})]})]}),f&&u&&(0,c.jsxs)(n.Button,{onClick:u,children:[(0,c.jsx)(s.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function m({event:e,onClick:n,compact:r=!1}){let i=l[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,c.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.cn(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,c.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function h({event:e,onEdit:r,onDelete:i}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,u=l[e.color||`blue`];return(0,c.jsxs)(`div`,{className:`w-72`,children:[(0,c.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,c.jsx)(`div`,{className:t.cn(`w-3 h-3 rounded-full mt-1`,u.bg.replace(`100`,`500`))}),(0,c.jsxs)(`div`,{className:`flex gap-1`,children:[r&&(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:r,children:(0,c.jsx)(s.Edit,{className:`h-3 w-3`})}),i&&(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:i,children:(0,c.jsx)(s.Trash2,{className:`h-3 w-3`})})]})]}),(0,c.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,c.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Clock,{className:`h-4 w-4`}),e.allDay?(0,c.jsx)(`span`,{children:`Toute la journée`}):(0,c.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.MapPin,{className:`h-4 w-4`}),(0,c.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Users,{className:`h-4 w-4`}),(0,c.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,c.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function g({currentDate:e,events:n,weekStartsOn:r,locale:i,onDayClick:o,onEventClick:s,onEventEdit:l,onEventDelete:p}){let g=e.getFullYear(),_=e.getMonth(),v=u(g,_),y=new Date,b=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(i,{weekday:`short`})),x=(new Date(g,_,1).getDay()-r+7)%7,S=[];for(let e=0;e<x;e++)S.push(null);for(S.push(...v);S.length%7!=0;)S.push(null);return(0,c.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,c.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:b.map(e=>(0,c.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,c.jsx)(`div`,{className:`grid grid-cols-7`,children:S.map((e,r)=>{let i=e?f(n,e):[],u=e&&d(e,y);return(0,c.jsx)(`div`,{className:t.cn(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===_)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&o?.(e),children:e&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`div`,{className:t.cn(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,c.jsxs)(`div`,{className:`space-y-1`,children:[i.slice(0,3).map(e=>(0,c.jsxs)(a.Popover,{children:[(0,c.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,c.jsx)(`div`,{children:(0,c.jsx)(m,{event:e,onClick:()=>s?.(e),compact:!0})})}),(0,c.jsx)(a.PopoverContent,{children:(0,c.jsx)(h,{event:e,onEdit:()=>l?.(e.id,{}),onDelete:()=>p?.(e.id)})})]},e.id)),i.length>3&&(0,c.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,i.length-3,` autres`]})]})]})},r)})})]})}function _({currentDate:e,events:n,locale:i,onEventClick:a}){let o=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),u={};return o.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();u[t]||(u[t]=[]),u[t].push(e)}),(0,c.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(u).map(([e,n])=>(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(i,{weekday:`long`,day:`numeric`,month:`long`})}),(0,c.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=l[e.color||`blue`],o=typeof e.start==`string`?new Date(e.start):e.start,u=typeof e.end==`string`?new Date(e.end):e.end;return(0,c.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>a?.(e),children:(0,c.jsxs)(r.CardContent,{className:`p-3 flex gap-3`,children:[(0,c.jsx)(`div`,{className:t.cn(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,c.jsxs)(`div`,{className:`flex-1`,children:[(0,c.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,c.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${o.toLocaleTimeString(i,{hour:`2-digit`,minute:`2-digit`})} - ${u.toLocaleTimeString(i,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,c.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,c.jsx)(s.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(u).length===0&&(0,c.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function v({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:s,onEventCreate:l,onEventEdit:u,onEventDelete:d,onDayClick:f,showHeader:m=!0,showViewSelector:h=!0,showAddButton:v=!0,weekStartsOn:y=1,locale:b=`fr-FR`,className:x}){let[S,C]=o.useState(new Date),[w,T]=o.useState(`month`),[E,D]=o.useState(!1),O=n??S,k=i??w,A=e=>{r?r(e):C(e)};return(0,c.jsxs)(`div`,{className:t.cn(`space-y-4`,x),children:[m&&(0,c.jsx)(p,{currentDate:O,viewMode:k,onPrevious:()=>{let e=new Date(O);switch(k){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}A(e)},onNext:()=>{let e=new Date(O);switch(k){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}A(e)},onToday:()=>{A(new Date)},onViewModeChange:e=>{a?a(e):T(e)},onAddClick:()=>D(!0),showViewSelector:h,showAddButton:v,locale:b}),k===`month`&&(0,c.jsx)(g,{currentDate:O,events:e,weekStartsOn:y,locale:b,onDayClick:f,onEventClick:s,onEventEdit:u,onEventDelete:d}),k===`agenda`&&(0,c.jsx)(_,{currentDate:O,events:e,locale:b,onEventClick:s}),(k===`week`||k===`day`)&&(0,c.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,k===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var y=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}];exports.WakaCalendarView=v,exports.default=v,exports.defaultCalendarEvents=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../../components/avatar/index.cjs.js`),r=require(`../../components/badge/index.cjs.js`),i=require(`../../components/button/index.cjs.js`),a=require(`../../components/dropdown-menu/index.cjs.js`),o=require(`../../components/input/index.cjs.js`),s=require(`../../components/scroll-area/index.cjs.js`),c=require(`../../components/textarea/index.cjs.js`);require(`./widget.cjs.js`);let l=require(`react`);l=e.__toESM(l);let u=require(`lucide-react`),d=require(`react/jsx-runtime`);var f=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},p=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},m=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function h({date:e}){return(0,d.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,d.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:f(e)})})}function g({conversations:e,activeId:i,currentUser:a,onSelect:c,onSearch:f}){let[p,h]=l.useState(``),g=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),_=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:m(t||{id:``,name:`?`})}},v=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},y=e.filter(e=>p?g(e).toLowerCase().includes(p.toLowerCase()):!0);return(0,d.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,d.jsx)(`div`,{className:`p-3 border-b`,children:(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(u.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,d.jsx)(o.Input,{placeholder:`Rechercher...`,value:p,onChange:e=>{h(e.target.value),f?.(e.target.value)},className:`pl-9`})]})}),(0,d.jsx)(s.ScrollArea,{className:`flex-1`,children:y.map(e=>{let o=_(e),s=g(e),l=e.participants.find(e=>e.id!==a.id);return(0,d.jsxs)(`button`,{onClick:()=>c(e),className:t.cn(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsxs)(n.Avatar,{children:[(0,d.jsx)(n.AvatarImage,{src:o.url}),(0,d.jsx)(n.AvatarFallback,{children:o.fallback})]}),l?.status===`online`&&(0,d.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`span`,{className:`font-medium text-sm truncate`,children:s}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v(e.lastMessage?.timestamp)})]}),(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,d.jsx)(r.Badge,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function _({conversation:e,currentUser:r,title:o,statusText:s,showStatus:c=!0,showCloseButton:l,onAudioCall:f,onVideoCall:p,onClose:h,onCloseConversation:g,onMinimize:_,layout:v}){let y=e?.participants.find(e=>e.id!==r.id),b=o||e?.name||y?.name||`Messages`,x=()=>s||(e?e.isGroup?`${e.participants.length} participants`:y?.status===`online`?`En ligne`:y?.lastSeen?`Vu ${(typeof y.lastSeen==`string`?new Date(y.lastSeen):y.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),S=v===`floating`||v===`widget`;return(0,d.jsxs)(`div`,{className:t.cn(`flex items-center justify-between p-3 border-b`,S&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,d.jsxs)(n.Avatar,{className:t.cn(S&&`border-2 border-primary-foreground/20`),children:[(0,d.jsx)(n.AvatarImage,{src:e.avatar||y?.avatar}),(0,d.jsx)(n.AvatarFallback,{className:t.cn(S&&`bg-primary-foreground/20 text-primary-foreground`),children:m(y||{id:``,name:b})})]}),!e&&(0,d.jsx)(u.MessageCircle,{className:`h-5 w-5`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h3`,{className:`font-semibold text-sm`,children:b}),c&&(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[y?.status===`online`&&(0,d.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,S?`bg-green-400`:`bg-green-500`)}),y?.status===`offline`&&(0,d.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,S?`bg-gray-400`:`bg-gray-500`)}),(0,d.jsx)(`p`,{className:t.cn(`text-xs`,S?`text-primary-foreground/80`:`text-muted-foreground`),children:x()})]})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f&&!S&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:f,children:(0,d.jsx)(u.Phone,{className:`h-4 w-4`})}),p&&!S&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:p,children:(0,d.jsx)(u.Video,{className:`h-4 w-4`})}),l&&g&&(0,d.jsxs)(i.Button,{variant:S?`ghost`:`outline`,size:`sm`,onClick:g,className:t.cn(S&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,d.jsx)(u.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),_&&S&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:_,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,d.jsx)(u.Minimize2,{className:`h-4 w-4`})}),h&&S&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:h,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,d.jsx)(u.X,{className:`h-4 w-4`})}),!S&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsx)(a.DropdownMenuContent,{align:`end`,children:(0,d.jsxs)(a.DropdownMenuItem,{children:[(0,d.jsx)(u.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function v({message:e,isOwn:r,showStatus:a,showTimestamp:o,onDelete:s,onReply:c}){return(0,d.jsxs)(`div`,{className:t.cn(`flex gap-2 group`,r?`flex-row-reverse`:`flex-row`),children:[!r&&(0,d.jsxs)(n.Avatar,{className:`h-8 w-8`,children:[(0,d.jsx)(n.AvatarImage,{src:e.sender.avatar}),(0,d.jsx)(n.AvatarFallback,{className:`text-xs`,children:m(e.sender)})]}),(0,d.jsxs)(`div`,{className:t.cn(`max-w-[70%]`,r&&`items-end`),children:[e.replyTo&&(0,d.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,d.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,d.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,d.jsxs)(`div`,{className:t.cn(`relative rounded-2xl px-4 py-2`,r?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,d.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,d.jsx)(`div`,{children:e.type===`image`?(0,d.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,d.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,d.jsx)(u.File,{className:`h-4 w-4`}),(0,d.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,d.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,d.jsxs)(`div`,{className:t.cn(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,r?`-left-20`:`-right-20`),children:[(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>c?.(e),children:(0,d.jsx)(u.Reply,{className:`h-3 w-3`})}),r&&s&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s(e.id),children:(0,d.jsx)(u.Trash2,{className:`h-3 w-3`})})]})]}),(0,d.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,r&&`justify-end`),children:[o&&(0,d.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,d.jsx)(`span`,{children:`(modifié)`}),r&&a&&(()=>{switch(e.status){case`sending`:return(0,d.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,d.jsx)(u.Check,{className:`h-3 w-3`});case`delivered`:return(0,d.jsx)(u.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,d.jsx)(u.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,d.jsx)(u.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function y({onSend:e,replyTo:t,onCancelReply:n,showAttachments:r,showEmoji:a,placeholder:o,sending:s,showHint:f=!0,hintText:p=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[m,h]=l.useState(``),g=l.useRef(null),_=()=>{m.trim()&&!s&&(e(m.trim()),h(``))};return l.useEffect(()=>{g.current&&(g.current.style.height=`auto`,g.current.style.height=Math.min(g.current.scrollHeight,120)+`px`)},[m]),(0,d.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,d.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(u.Reply,{className:`h-4 w-4 text-primary`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,d.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,d.jsx)(u.X,{className:`h-4 w-4`})})]}),(0,d.jsxs)(`div`,{className:`flex items-end gap-2`,children:[r&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,d.jsx)(u.Paperclip,{className:`h-4 w-4`})}),(0,d.jsx)(c.Textarea,{ref:g,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:o,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:s,rows:1}),a&&(0,d.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,d.jsx)(u.Smile,{className:`h-4 w-4`})}),(0,d.jsx)(i.Button,{onClick:_,disabled:!m.trim()||s,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,d.jsx)(u.Send,{className:`h-4 w-4`})})]}),f&&(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:p})]})}function b({conversations:e=[],activeConversation:n,messages:i,currentUser:a,onSendMessage:o,onConversationSelect:c,onMessageDelete:f,onMessageReply:m,onSearch:b,onAudioCall:x,onVideoCall:S,onClose:C,onCloseConversation:w,onMinimize:T,showConversationList:E=!0,showHeader:D=!0,showMessageStatus:O=!0,showTimestamps:k=!0,showAttachments:A=!0,showEmoji:j=!0,showDateSeparators:M=!0,showInputHint:N=!0,showCloseButton:P=!1,inputPlaceholder:F,inputHintText:I,sending:L=!1,loading:R=!1,layout:z=`full`,headerTitle:B,showHeaderStatus:V=!0,statusText:H,minimized:U=!1,className:W}){let[G,K]=l.useState(null),q=l.useRef(null);l.useEffect(()=>{q.current?.scrollIntoView({behavior:`smooth`})},[i]);let J=(e,t)=>{o?.(e,t),K(null)},Y=e=>{K(e),m?.(e)};return(z===`floating`||z===`widget`)&&U?(0,d.jsxs)(`button`,{onClick:T,className:t.cn(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,W),children:[(0,d.jsx)(u.MessageCircle,{className:`h-5 w-5`}),(0,d.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,d.jsx)(r.Badge,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,d.jsxs)(`div`,{className:t.cn(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[z],W),children:[E&&z!==`widget`&&z!==`floating`&&(0,d.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,d.jsx)(g,{conversations:e,activeId:n?.id,currentUser:a,onSelect:e=>c?.(e),onSearch:b})}),(0,d.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:n||z===`widget`||z===`floating`?(0,d.jsxs)(d.Fragment,{children:[D&&(0,d.jsx)(_,{conversation:n,currentUser:a,title:B,statusText:H,showStatus:V,showCloseButton:P,onAudioCall:x,onVideoCall:S,onClose:C,onCloseConversation:w,onMinimize:T,layout:z}),(0,d.jsx)(s.ScrollArea,{className:`flex-1 p-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4`,children:[R?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return i.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;M&&(!t||!p(t,i))&&(e.push((0,d.jsx)(h,{date:i},`separator-${r}`)),t=i),e.push((0,d.jsx)(v,{message:n,isOwn:n.sender.id===a.id,showStatus:O,showTimestamp:k,onDelete:f,onReply:Y},n.id))}),e})(),(0,d.jsx)(`div`,{ref:q})]})}),(0,d.jsx)(y,{onSend:J,replyTo:G,onCancelReply:()=>K(null),showAttachments:A,showEmoji:j,placeholder:(()=>{if(F)return F;if(n){let e=n.participants.find(e=>e.id!==a.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:L,showHint:N,hintText:I})]}):(0,d.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(u.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,d.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var x={id:`current`,name:`Moi`,status:`online`},S=[{id:`1`,participants:[x,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[x,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:x,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],C=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:x,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}];exports.default=b,exports.defaultChatConversations=S,exports.defaultChatMessages=C,exports.defaultChatUser=x;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../components/avatar/index.cjs.js"),r=require("../../components/badge/index.cjs.js"),i=require("../../components/button/index.cjs.js"),a=require("../../components/dropdown-menu/index.cjs.js"),o=require("../../components/input/index.cjs.js"),s=require("../../components/scroll-area/index.cjs.js"),c=require("../../components/textarea/index.cjs.js"),l=require("./widget.cjs.js");let u=require("react");u=e.__toESM(u);let d=require("lucide-react"),f=require("react/jsx-runtime");var p=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},m=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},h=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function g({date:e}){return(0,f.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,f.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:p(e)})})}function _({conversations:e,activeId:i,currentUser:a,onSelect:c,onSearch:l}){let[p,m]=u.useState(``),g=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),_=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:h(t||{id:``,name:`?`})}},v=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},y=e.filter(e=>p?g(e).toLowerCase().includes(p.toLowerCase()):!0);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,f.jsx)(`div`,{className:`p-3 border-b`,children:(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(d.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,f.jsx)(o.Input,{placeholder:`Rechercher...`,value:p,onChange:e=>{m(e.target.value),l?.(e.target.value)},className:`pl-9`})]})}),(0,f.jsx)(s.ScrollArea,{className:`flex-1`,children:y.map(e=>{let o=_(e),s=g(e),l=e.participants.find(e=>e.id!==a.id);return(0,f.jsxs)(`button`,{onClick:()=>c(e),className:t.cn(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsxs)(n.Avatar,{children:[(0,f.jsx)(n.AvatarImage,{src:o.url}),(0,f.jsx)(n.AvatarFallback,{children:o.fallback})]}),l?.status===`online`&&(0,f.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`font-medium text-sm truncate`,children:s}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v(e.lastMessage?.timestamp)})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,f.jsx)(r.Badge,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function v({conversation:e,currentUser:r,title:o,statusText:s,showStatus:c=!0,showCloseButton:l,onAudioCall:u,onVideoCall:p,onClose:m,onCloseConversation:g,onMinimize:_,layout:v}){let y=e?.participants.find(e=>e.id!==r.id),b=o||e?.name||y?.name||`Messages`,x=()=>s||(e?e.isGroup?`${e.participants.length} participants`:y?.status===`online`?`En ligne`:y?.lastSeen?`Vu ${(typeof y.lastSeen==`string`?new Date(y.lastSeen):y.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),S=v===`floating`||v===`widget`;return(0,f.jsxs)(`div`,{className:t.cn(`flex items-center justify-between p-3 border-b`,S&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,f.jsxs)(n.Avatar,{className:t.cn(S&&`border-2 border-primary-foreground/20`),children:[(0,f.jsx)(n.AvatarImage,{src:e.avatar||y?.avatar}),(0,f.jsx)(n.AvatarFallback,{className:t.cn(S&&`bg-primary-foreground/20 text-primary-foreground`),children:h(y||{id:``,name:b})})]}),!e&&(0,f.jsx)(d.MessageCircle,{className:`h-5 w-5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`font-semibold text-sm`,children:b}),c&&(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[y?.status===`online`&&(0,f.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,S?`bg-green-400`:`bg-green-500`)}),y?.status===`offline`&&(0,f.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,S?`bg-gray-400`:`bg-gray-500`)}),(0,f.jsx)(`p`,{className:t.cn(`text-xs`,S?`text-primary-foreground/80`:`text-muted-foreground`),children:x()})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u&&!S&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:u,children:(0,f.jsx)(d.Phone,{className:`h-4 w-4`})}),p&&!S&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:p,children:(0,f.jsx)(d.Video,{className:`h-4 w-4`})}),l&&g&&(0,f.jsxs)(i.Button,{variant:S?`ghost`:`outline`,size:`sm`,onClick:g,className:t.cn(S&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,f.jsx)(d.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),_&&S&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:_,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(d.Minimize2,{className:`h-4 w-4`})}),m&&S&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,onClick:m,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,f.jsx)(d.X,{className:`h-4 w-4`})}),!S&&(0,f.jsxs)(a.DropdownMenu,{children:[(0,f.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,f.jsx)(d.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsx)(a.DropdownMenuContent,{align:`end`,children:(0,f.jsxs)(a.DropdownMenuItem,{children:[(0,f.jsx)(d.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function y({message:e,isOwn:r,showStatus:a,showTimestamp:o,onDelete:s,onReply:c}){return(0,f.jsxs)(`div`,{className:t.cn(`flex gap-2 group`,r?`flex-row-reverse`:`flex-row`),children:[!r&&(0,f.jsxs)(n.Avatar,{className:`h-8 w-8`,children:[(0,f.jsx)(n.AvatarImage,{src:e.sender.avatar}),(0,f.jsx)(n.AvatarFallback,{className:`text-xs`,children:h(e.sender)})]}),(0,f.jsxs)(`div`,{className:t.cn(`max-w-[70%]`,r&&`items-end`),children:[e.replyTo&&(0,f.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,f.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,f.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,f.jsxs)(`div`,{className:t.cn(`relative rounded-2xl px-4 py-2`,r?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,f.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,f.jsx)(`div`,{children:e.type===`image`?(0,f.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,f.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,f.jsx)(d.File,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,f.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,f.jsxs)(`div`,{className:t.cn(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,r?`-left-20`:`-right-20`),children:[(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>c?.(e),children:(0,f.jsx)(d.Reply,{className:`h-3 w-3`})}),r&&s&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s(e.id),children:(0,f.jsx)(d.Trash2,{className:`h-3 w-3`})})]})]}),(0,f.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,r&&`justify-end`),children:[o&&(0,f.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,f.jsx)(`span`,{children:`(modifié)`}),r&&a&&(()=>{switch(e.status){case`sending`:return(0,f.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,f.jsx)(d.Check,{className:`h-3 w-3`});case`delivered`:return(0,f.jsx)(d.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,f.jsx)(d.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,f.jsx)(d.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function b({onSend:e,replyTo:t,onCancelReply:n,showAttachments:r,showEmoji:a,placeholder:o,sending:s,showHint:l=!0,hintText:p=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[m,h]=u.useState(``),g=u.useRef(null),_=()=>{m.trim()&&!s&&(e(m.trim()),h(``))};return u.useEffect(()=>{g.current&&(g.current.style.height=`auto`,g.current.style.height=Math.min(g.current.scrollHeight,120)+`px`)},[m]),(0,f.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Reply,{className:`h-4 w-4 text-primary`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,f.jsx)(d.X,{className:`h-4 w-4`})})]}),(0,f.jsxs)(`div`,{className:`flex items-end gap-2`,children:[r&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(d.Paperclip,{className:`h-4 w-4`})}),(0,f.jsx)(c.Textarea,{ref:g,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:o,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:s,rows:1}),a&&(0,f.jsx)(i.Button,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,f.jsx)(d.Smile,{className:`h-4 w-4`})}),(0,f.jsx)(i.Button,{onClick:_,disabled:!m.trim()||s,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,f.jsx)(d.Send,{className:`h-4 w-4`})})]}),l&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:p})]})}function x({conversations:e=[],activeConversation:n,messages:i,currentUser:a,onSendMessage:o,onConversationSelect:c,onMessageDelete:l,onMessageReply:p,onSearch:h,onAudioCall:x,onVideoCall:S,onClose:C,onCloseConversation:w,onMinimize:T,showConversationList:E=!0,showHeader:D=!0,showMessageStatus:O=!0,showTimestamps:k=!0,showAttachments:A=!0,showEmoji:j=!0,showDateSeparators:M=!0,showInputHint:N=!0,showCloseButton:P=!1,inputPlaceholder:F,inputHintText:I,sending:L=!1,loading:R=!1,layout:z=`full`,headerTitle:B,showHeaderStatus:V=!0,statusText:H,minimized:U=!1,className:W}){let[G,K]=u.useState(null),q=u.useRef(null);u.useEffect(()=>{q.current?.scrollIntoView({behavior:`smooth`})},[i]);let J=(e,t)=>{o?.(e,t),K(null)},Y=e=>{K(e),p?.(e)};return(z===`floating`||z===`widget`)&&U?(0,f.jsxs)(`button`,{onClick:T,className:t.cn(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,W),children:[(0,f.jsx)(d.MessageCircle,{className:`h-5 w-5`}),(0,f.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,f.jsx)(r.Badge,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,f.jsxs)(`div`,{className:t.cn(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[z],W),children:[E&&z!==`widget`&&z!==`floating`&&(0,f.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,f.jsx)(_,{conversations:e,activeId:n?.id,currentUser:a,onSelect:e=>c?.(e),onSearch:h})}),(0,f.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:n||z===`widget`||z===`floating`?(0,f.jsxs)(f.Fragment,{children:[D&&(0,f.jsx)(v,{conversation:n,currentUser:a,title:B,statusText:H,showStatus:V,showCloseButton:P,onAudioCall:x,onVideoCall:S,onClose:C,onCloseConversation:w,onMinimize:T,layout:z}),(0,f.jsx)(s.ScrollArea,{className:`flex-1 p-4`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[R?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return i.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;M&&(!t||!m(t,i))&&(e.push((0,f.jsx)(g,{date:i},`separator-${r}`)),t=i),e.push((0,f.jsx)(y,{message:n,isOwn:n.sender.id===a.id,showStatus:O,showTimestamp:k,onDelete:l,onReply:Y},n.id))}),e})(),(0,f.jsx)(`div`,{ref:q})]})}),(0,f.jsx)(b,{onSend:J,replyTo:G,onCancelReply:()=>K(null),showAttachments:A,showEmoji:j,placeholder:(()=>{if(F)return F;if(n){let e=n.participants.find(e=>e.id!==a.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:L,showHint:N,hintText:I})]}):(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(d.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,f.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var S={id:`current`,name:`Moi`,status:`online`},C=[{id:`1`,participants:[S,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[S,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:S,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],w=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:S,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}];exports.WakaChat=x,exports.default=x,exports.WakaChatWidget=l.WakaChatWidget,exports.defaultChatConversations=C,exports.defaultChatMessages=w,exports.defaultChatUser=S,exports.useChatWidget=l.useChatWidget;
|