@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("../../utils/cn.cjs.js"),n=require("../../components/badge/index.cjs.js"),r=require("./index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");var s=`waka-chat-widget-position`,c=e=>{if(typeof window>`u`)return null;try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null},l=(e,t)=>{if(!(typeof window>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch{}};function u({defaultPosition:e,position:u,onPositionChange:d,persistPosition:f=!0,positionStorageKey:p=s,defaultOpen:m=!1,open:h,onOpenChange:g,bubbleSize:_=`md`,bubbleColor:v=`primary`,bubbleIcon:y,bubbleText:b,showUnreadBadge:x=!0,bubbleAnimation:S=`none`,widgetPosition:C=`top-left`,widgetSize:w=`md`,bubbleClassName:T,widgetClassName:E,draggable:D=!0,constrainToViewport:O=!0,edgeOffset:k=16,onWidgetClose:A,onWidgetMinimize:j,zIndex:M=9999,conversations:N=[],...P}){let[F,I]=i.useState(m),[ee,L]=i.useState(()=>{if(e)return e;if(f){let e=c(p);if(e)return e}return{x:typeof window<`u`?window.innerWidth-80:0,y:typeof window<`u`?window.innerHeight-80:0}}),[R,z]=i.useState(!1),[B,V]=i.useState({x:0,y:0}),H=i.useRef(null),U=h===void 0?F:h,W=u===void 0?ee:u;i.useEffect(()=>{if(!(typeof window>`u`)&&!u&&!e){let e=f?c(p):null;L(e||{x:window.innerWidth-80,y:window.innerHeight-80})}},[u,e,f,p]);let G=e=>{h===void 0&&I(e),g?.(e)},K=e=>{u===void 0&&L(e),d?.(e),f&&l(p,e)},q=e=>{if(!O||typeof window>`u`)return e;let t=H.current?.offsetWidth||60,n=H.current?.offsetHeight||60;return{x:Math.max(k,Math.min(e.x,window.innerWidth-t-k)),y:Math.max(k,Math.min(e.y,window.innerHeight-n-k))}},J=e=>{!D||U||(z(!0),V({x:e.clientX-W.x,y:e.clientY-W.y}))},Y=e=>{if(!D||U)return;let t=e.touches[0];z(!0),V({x:t.clientX-W.x,y:t.clientY-W.y})};i.useEffect(()=>{if(!R)return;let e=e=>{let t=q({x:e.clientX-B.x,y:e.clientY-B.y});K(t)},t=e=>{let t=e.touches[0],n=q({x:t.clientX-B.x,y:t.clientY-B.y});K(n)},n=()=>{z(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t),document.addEventListener(`touchend`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n)}},[R,B]);let X=()=>{R||G(!U)},Z=N.reduce((e,t)=>e+(t.unreadCount||0),0),Q={sm:`h-12 w-12`,md:`h-14 w-14`,lg:`h-16 w-16`},te={sm:`h-5 w-5`,md:`h-6 w-6`,lg:`h-7 w-7`},ne={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/90`,success:`bg-green-500 text-white hover:bg-green-600`,warning:`bg-yellow-500 text-white hover:bg-yellow-600`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`},re={none:``,pulse:`animate-pulse`,bounce:`animate-bounce`},$={sm:`h-[400px] w-[300px]`,md:`h-[500px] w-[380px]`,lg:`h-[600px] w-[420px]`};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{ref:H,onClick:X,onMouseDown:J,onTouchStart:Y,className:t.cn(`fixed rounded-full shadow-lg transition-all duration-200`,`flex items-center justify-center gap-2`,Q[_],ne[v],re[S],R&&`cursor-grabbing scale-110`,D&&!R&&!U&&`cursor-grab`,U&&`opacity-0 pointer-events-none scale-75`,b&&`px-4 w-auto`,T),style:{left:W.x,top:W.y,zIndex:M,touchAction:`none`},"aria-label":`Ouvrir le chat`,children:[y||(0,o.jsx)(a.MessageCircle,{className:te[_]}),b&&(0,o.jsx)(`span`,{className:`font-medium text-sm`,children:b}),x&&Z>0&&(0,o.jsx)(n.Badge,{className:t.cn(`absolute -top-1 -right-1 h-5 min-w-[20px] px-1.5`,`bg-destructive text-destructive-foreground`,`flex items-center justify-center text-xs font-bold`),children:Z>99?`99+`:Z})]}),U&&(0,o.jsx)(`div`,{className:t.cn(`fixed rounded-xl shadow-2xl border bg-background overflow-hidden`,`animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2`,`duration-200`,$[w],E),style:(()=>{let e=H.current?.offsetWidth||60,t=H.current?.offsetHeight||60,n=$[w].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),r=n?parseInt(n[1]):500,i=n?parseInt(n[2]):380,a=W.x,o=W.y;switch(C){case`top-left`:a=W.x-i+e,o=W.y-r-12;break;case`top-right`:o=W.y-r-12;break;case`bottom-left`:a=W.x-i+e,o=W.y+t+12;break;case`bottom-right`:o=W.y+t+12;break}return typeof window<`u`&&(a=Math.max(k,Math.min(a,window.innerWidth-i-k)),o=Math.max(k,Math.min(o,window.innerHeight-r-k))),{position:`fixed`,left:a,top:o,zIndex:M+1}})(),children:(0,o.jsx)(r.WakaChat,{...P,conversations:N,layout:`widget`,onClose:()=>{G(!1),A?.()},onMinimize:()=>{G(!1),j?.()},showCloseButton:!0,className:`h-full`})}),U&&(0,o.jsx)(`div`,{className:`fixed inset-0 bg-black/20 sm:hidden`,style:{zIndex:M-1},onClick:()=>G(!1)})]})}function d(e={}){let{defaultOpen:t=!1,defaultPosition:n,persistPosition:r=!0,positionStorageKey:a=s}=e,[o,u]=i.useState(t),[d,f]=i.useState(()=>{if(n)return n;if(typeof window>`u`)return{x:0,y:0};if(r){let e=c(a);if(e)return e}return{x:window.innerWidth-80,y:window.innerHeight-80}}),p=()=>u(!0),m=()=>u(!1),h=()=>u(e=>!e),g=e=>{f(e),r&&l(a,e)};return{isOpen:o,position:d,open:p,close:m,toggle:h,setIsOpen:u,updatePosition:g,resetPosition:()=>{if(typeof window>`u`)return;let e=n||{x:window.innerWidth-80,y:window.innerHeight-80};g(e)},widgetProps:{open:o,onOpenChange:u,position:d,onPositionChange:g}}}exports.WakaChatWidget=u,exports.default=u,exports.useChatWidget=d;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn as e } from "../../utils/cn.es.js";
|
|
4
4
|
import { Badge as t } from "../../components/badge/index.es.js";
|
|
5
|
-
import n from "./index.es.js";
|
|
5
|
+
import { WakaChat as n } from "./index.es.js";
|
|
6
6
|
import * as r from "react";
|
|
7
7
|
import { MessageCircle as i } from "lucide-react";
|
|
8
8
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
@@ -35,10 +35,13 @@ function d({ defaultPosition: d, position: f, onPositionChange: p, persistPositi
|
|
|
35
35
|
y: 0
|
|
36
36
|
}), W = r.useRef(null), G = _ === void 0 ? I : _, K = f === void 0 ? R : f;
|
|
37
37
|
r.useEffect(() => {
|
|
38
|
-
!(typeof window > "u") && !f && !d
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (!(typeof window > "u") && !f && !d) {
|
|
39
|
+
let e = m ? l(h) : null;
|
|
40
|
+
z(e || {
|
|
41
|
+
x: window.innerWidth - 80,
|
|
42
|
+
y: window.innerHeight - 80
|
|
43
|
+
});
|
|
44
|
+
}
|
|
42
45
|
}, [
|
|
43
46
|
f,
|
|
44
47
|
d,
|
|
@@ -72,16 +75,17 @@ function d({ defaultPosition: d, position: f, onPositionChange: p, persistPositi
|
|
|
72
75
|
r.useEffect(() => {
|
|
73
76
|
if (!B) return;
|
|
74
77
|
let e = (e) => {
|
|
75
|
-
|
|
78
|
+
let t = Y({
|
|
76
79
|
x: e.clientX - H.x,
|
|
77
80
|
y: e.clientY - H.y
|
|
78
|
-
})
|
|
81
|
+
});
|
|
82
|
+
J(t);
|
|
79
83
|
}, t = (e) => {
|
|
80
|
-
let t = e.touches[0]
|
|
81
|
-
J(Y({
|
|
84
|
+
let t = e.touches[0], n = Y({
|
|
82
85
|
x: t.clientX - H.x,
|
|
83
86
|
y: t.clientY - H.y
|
|
84
|
-
})
|
|
87
|
+
});
|
|
88
|
+
J(n);
|
|
85
89
|
}, n = () => {
|
|
86
90
|
V(!1);
|
|
87
91
|
};
|
|
@@ -213,10 +217,12 @@ function f(e = {}) {
|
|
|
213
217
|
setIsOpen: s,
|
|
214
218
|
updatePosition: g,
|
|
215
219
|
resetPosition: () => {
|
|
216
|
-
typeof window > "u"
|
|
220
|
+
if (typeof window > "u") return;
|
|
221
|
+
let e = n || {
|
|
217
222
|
x: window.innerWidth - 80,
|
|
218
223
|
y: window.innerHeight - 80
|
|
219
|
-
}
|
|
224
|
+
};
|
|
225
|
+
g(e);
|
|
220
226
|
},
|
|
221
227
|
widgetProps: {
|
|
222
228
|
open: o,
|
|
@@ -227,4 +233,4 @@ function f(e = {}) {
|
|
|
227
233
|
};
|
|
228
234
|
}
|
|
229
235
|
//#endregion
|
|
230
|
-
export { d as default, f as useChatWidget };
|
|
236
|
+
export { d as WakaChatWidget, d as default, f as useChatWidget };
|
|
@@ -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/input/index.cjs.js`),o=require(`../../components/scroll-area/index.cjs.js`);let s=require(`react`);s=e.__toESM(s);let c=require(`lucide-react`),l=require(`react/jsx-runtime`);var u={online:`bg-green-500`,offline:`bg-gray-400`,away:`bg-yellow-500`,busy:`bg-red-500`};function d({user:e,size:r=`md`}){return(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(n.Avatar,{className:{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[r],children:[(0,l.jsx)(n.AvatarImage,{src:e.avatar,alt:e.name}),(0,l.jsx)(n.AvatarFallback,{children:e.name.slice(0,2).toUpperCase()})]}),e.status&&(0,l.jsx)(`div`,{className:t.cn(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,u[e.status])})]})}function f({conversation:e,currentUserId:i,isSelected:a,onClick:o}){let s=e.participants.find(e=>e.id!==i),d=e.isGroup?e.groupName:s?.name,f=e.isGroup?e.groupAvatar:s?.avatar;return(0,l.jsxs)(`button`,{onClick:o,className:t.cn(`w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left`,a?`bg-primary/10`:`hover:bg-muted/50`),children:[(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(n.Avatar,{children:[(0,l.jsx)(n.AvatarImage,{src:f}),(0,l.jsx)(n.AvatarFallback,{children:d?.slice(0,2).toUpperCase()})]}),!e.isGroup&&s?.status&&(0,l.jsx)(`div`,{className:t.cn(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,u[s.status])})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`font-medium truncate`,children:d}),e.lastMessage&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.lastMessage.timestamp==`string`?e.lastMessage.timestamp:h(e.lastMessage.timestamp)})]}),e.lastMessage&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:e.lastMessage.content})]}),e.unreadCount&&e.unreadCount>0&&(0,l.jsx)(r.Badge,{className:`h-5 w-5 p-0 flex items-center justify-center rounded-full`,children:e.unreadCount}),e.isPinned&&(0,l.jsx)(c.Pin,{className:`h-3 w-3 text-muted-foreground`})]})}function p({message:e,isOwn:n,sender:r,showAvatar:i}){let a={sending:(0,l.jsx)(c.Clock,{className:`h-3 w-3`}),sent:(0,l.jsx)(c.Check,{className:`h-3 w-3`}),delivered:(0,l.jsx)(c.CheckCheck,{className:`h-3 w-3`}),read:(0,l.jsx)(c.CheckCheck,{className:`h-3 w-3 text-blue-500`})};return(0,l.jsxs)(`div`,{className:t.cn(`flex gap-2 max-w-[80%]`,n?`ml-auto flex-row-reverse`:``),children:[i&&r&&!n&&(0,l.jsx)(d,{user:r,size:`sm`}),!i&&!n&&(0,l.jsx)(`div`,{className:`w-8`}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[!n&&i&&r&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:r.name}),(0,l.jsxs)(`div`,{className:t.cn(`rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-br-md`:`bg-muted rounded-bl-md`),children:[e.replyTo&&(0,l.jsxs)(`div`,{className:t.cn(`text-xs mb-1 pb-1 border-b`,n?`border-primary-foreground/20`:`border-border`),children:[(0,l.jsx)(c.Reply,{className:`h-3 w-3 inline mr-1`}),`Reply to message`]}),(0,l.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),e.attachments&&e.attachments.length>0&&(0,l.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.attachments.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`image`?(0,l.jsx)(c.Image,{className:`h-4 w-4`}):(0,l.jsx)(c.File,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{className:`text-xs truncate`,children:e.name})]},e.id))})]}),(0,l.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 text-xs text-muted-foreground`,n?`justify-end`:``),children:[(0,l.jsx)(`span`,{children:typeof e.timestamp==`string`?e.timestamp:h(e.timestamp)}),n&&e.status&&a[e.status]]}),e.reactions&&e.reactions.length>0&&(0,l.jsx)(`div`,{className:`flex gap-1 mt-1`,children:Array.from(new Set(e.reactions.map(e=>e.emoji))).map(t=>(0,l.jsxs)(`span`,{className:`text-xs bg-muted rounded-full px-2 py-0.5`,children:[t,` `,e.reactions.filter(e=>e.emoji===t).length]},t))})]})]})}function m({users:e}){if(e.length===0)return null;let t=e.map(e=>e.name).join(`, `);return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,l.jsxs)(`div`,{className:`flex gap-1`,children:[(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`0ms`}}),(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`150ms`}}),(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`300ms`}})]}),(0,l.jsxs)(`span`,{children:[t,` `,e.length===1?`is`:`are`,` typing...`]})]})}function h(e){return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function g({currentUser:e,conversations:n=[],selectedConversation:r,messages:u=[],onSendMessage:h,onSelectConversation:g,onTyping:_,typingUsers:v=[],showSidebar:y=!0,className:b}){let[x,S]=s.useState(``),[C,w]=s.useState(``),T=s.useRef(null),E=()=>{T.current?.scrollIntoView({behavior:`smooth`})};s.useEffect(()=>{E()},[u]);let D=()=>{!x.trim()||!h||(h(x.trim()),S(``))},O=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},k=n.filter(t=>{if(!C)return!0;let n=t.participants.find(t=>t.id!==e.id);return(t.isGroup?t.groupName:n?.name)?.toLowerCase().includes(C.toLowerCase())}),A=r?.participants.find(t=>t.id!==e.id),j=r?.isGroup?r.groupName:A?.name,M=u.reduce((e,t,n)=>{let r=u[n-1],i=!r||r.senderId!==t.senderId;return e.push({message:t,showAvatar:i}),e},[]);return(0,l.jsxs)(`div`,{className:t.cn(`flex h-[600px] rounded-lg border overflow-hidden`,b),children:[y&&(0,l.jsxs)(`div`,{className:`w-80 border-r flex flex-col bg-card`,children:[(0,l.jsxs)(`div`,{className:`p-4 border-b`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,l.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Messages`}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.MoreVertical,{className:`h-4 w-4`})})]}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(c.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,l.jsx)(a.Input,{placeholder:`Search conversations...`,value:C,onChange:e=>w(e.target.value),className:`pl-9`})]})]}),(0,l.jsx)(o.ScrollArea,{className:`flex-1`,children:(0,l.jsx)(`div`,{className:`p-2 space-y-1`,children:k.map(t=>(0,l.jsx)(f,{conversation:t,currentUserId:e.id,isSelected:r?.id===t.id,onClick:()=>g?.(t)},t.id))})})]}),(0,l.jsx)(`div`,{className:`flex-1 flex flex-col`,children:r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`h-16 border-b flex items-center justify-between px-4 bg-card`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3`,children:[A&&(0,l.jsx)(d,{user:A}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-medium`,children:j}),A?.status&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:A.status===`online`?`Online`:`Last seen ${A.lastSeen||`recently`}`})]})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Phone,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Video,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.MoreVertical,{className:`h-4 w-4`})})]})]}),(0,l.jsxs)(o.ScrollArea,{className:`flex-1 p-4`,children:[(0,l.jsxs)(`div`,{className:`space-y-4`,children:[M.map(({message:t,showAvatar:n})=>(0,l.jsx)(p,{message:t,isOwn:t.senderId===e.id,sender:r.participants.find(e=>e.id===t.senderId),showAvatar:n},t.id)),(0,l.jsx)(`div`,{ref:T})]}),v.length>0&&(0,l.jsx)(`div`,{className:`mt-4`,children:(0,l.jsx)(m,{users:v})})]}),(0,l.jsx)(`div`,{className:`p-4 border-t bg-card`,children:(0,l.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Paperclip,{className:`h-4 w-4`})}),(0,l.jsx)(`div`,{className:`flex-1`,children:(0,l.jsx)(a.Input,{placeholder:`Type a message...`,value:x,onChange:e=>{S(e.target.value),_?.()},onKeyDown:O,className:`rounded-full`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Smile,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{size:`icon`,onClick:D,disabled:!x.trim(),children:(0,l.jsx)(c.Send,{className:`h-4 w-4`})})]})})]}):(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,l.jsxs)(`div`,{className:`text-center`,children:[(0,l.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4`,children:(0,l.jsx)(c.Send,{className:`h-8 w-8 text-muted-foreground`})}),(0,l.jsx)(`h3`,{className:`font-medium text-lg`,children:`Your Messages`}),(0,l.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Select a conversation to start chatting`})]})})})]})}var _=[{id:`1`,name:`John Doe`,avatar:``,status:`online`},{id:`2`,name:`Jane Smith`,avatar:``,status:`away`,lastSeen:`2 hours ago`},{id:`3`,name:`Bob Wilson`,avatar:``,status:`offline`,lastSeen:`yesterday`},{id:`4`,name:`Alice Brown`,avatar:``,status:`busy`}],v=[{id:`conv1`,participants:[_[0],_[1]],lastMessage:{id:`m1`,content:`Hey, how's the project going?`,senderId:`2`,timestamp:new Date,status:`read`},unreadCount:2,isPinned:!0},{id:`conv2`,participants:[_[0],_[2]],lastMessage:{id:`m2`,content:`See you tomorrow!`,senderId:`1`,timestamp:new Date(Date.now()-36e5),status:`delivered`}},{id:`conv3`,isGroup:!0,groupName:`Project Team`,participants:[_[0],_[1],_[2],_[3]],lastMessage:{id:`m3`,content:`Meeting at 3pm`,senderId:`4`,timestamp:new Date(Date.now()-72e5),status:`read`},unreadCount:5}],y=[{id:`msg1`,content:`Hey! How are you doing?`,senderId:`2`,timestamp:new Date(Date.now()-36e5),status:`read`},{id:`msg2`,content:`I'm doing great, thanks for asking! Just finished the new feature.`,senderId:`1`,timestamp:new Date(Date.now()-35e5),status:`read`},{id:`msg3`,content:`That's awesome! Can you show me a demo?`,senderId:`2`,timestamp:new Date(Date.now()-34e5),status:`read`},{id:`msg4`,content:`Sure! Let me schedule a call for tomorrow. Does 2pm work for you?`,senderId:`1`,timestamp:new Date(Date.now()-33e5),status:`delivered`},{id:`msg5`,content:`Perfect, 2pm works great!`,senderId:`2`,timestamp:new Date(Date.now()-32e5),status:`read`}];exports.default=g,exports.defaultConversations=v,exports.defaultMessages=y,exports.defaultUsers=_;
|
|
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/input/index.cjs.js"),o=require("../../components/scroll-area/index.cjs.js");let s=require("react");s=e.__toESM(s);let c=require("lucide-react"),l=require("react/jsx-runtime");var u={online:`bg-green-500`,offline:`bg-gray-400`,away:`bg-yellow-500`,busy:`bg-red-500`};function d({user:e,size:r=`md`}){return(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(n.Avatar,{className:{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[r],children:[(0,l.jsx)(n.AvatarImage,{src:e.avatar,alt:e.name}),(0,l.jsx)(n.AvatarFallback,{children:e.name.slice(0,2).toUpperCase()})]}),e.status&&(0,l.jsx)(`div`,{className:t.cn(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,u[e.status])})]})}function f({conversation:e,currentUserId:i,isSelected:a,onClick:o}){let s=e.participants.find(e=>e.id!==i),d=e.isGroup?e.groupName:s?.name,f=e.isGroup?e.groupAvatar:s?.avatar;return(0,l.jsxs)(`button`,{onClick:o,className:t.cn(`w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left`,a?`bg-primary/10`:`hover:bg-muted/50`),children:[(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsxs)(n.Avatar,{children:[(0,l.jsx)(n.AvatarImage,{src:f}),(0,l.jsx)(n.AvatarFallback,{children:d?.slice(0,2).toUpperCase()})]}),!e.isGroup&&s?.status&&(0,l.jsx)(`div`,{className:t.cn(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,u[s.status])})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`font-medium truncate`,children:d}),e.lastMessage&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.lastMessage.timestamp==`string`?e.lastMessage.timestamp:h(e.lastMessage.timestamp)})]}),e.lastMessage&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:e.lastMessage.content})]}),e.unreadCount&&e.unreadCount>0&&(0,l.jsx)(r.Badge,{className:`h-5 w-5 p-0 flex items-center justify-center rounded-full`,children:e.unreadCount}),e.isPinned&&(0,l.jsx)(c.Pin,{className:`h-3 w-3 text-muted-foreground`})]})}function p({message:e,isOwn:n,sender:r,showAvatar:i}){let a={sending:(0,l.jsx)(c.Clock,{className:`h-3 w-3`}),sent:(0,l.jsx)(c.Check,{className:`h-3 w-3`}),delivered:(0,l.jsx)(c.CheckCheck,{className:`h-3 w-3`}),read:(0,l.jsx)(c.CheckCheck,{className:`h-3 w-3 text-blue-500`})};return(0,l.jsxs)(`div`,{className:t.cn(`flex gap-2 max-w-[80%]`,n?`ml-auto flex-row-reverse`:``),children:[i&&r&&!n&&(0,l.jsx)(d,{user:r,size:`sm`}),!i&&!n&&(0,l.jsx)(`div`,{className:`w-8`}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[!n&&i&&r&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:r.name}),(0,l.jsxs)(`div`,{className:t.cn(`rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-br-md`:`bg-muted rounded-bl-md`),children:[e.replyTo&&(0,l.jsxs)(`div`,{className:t.cn(`text-xs mb-1 pb-1 border-b`,n?`border-primary-foreground/20`:`border-border`),children:[(0,l.jsx)(c.Reply,{className:`h-3 w-3 inline mr-1`}),`Reply to message`]}),(0,l.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),e.attachments&&e.attachments.length>0&&(0,l.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.attachments.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`image`?(0,l.jsx)(c.Image,{className:`h-4 w-4`}):(0,l.jsx)(c.File,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{className:`text-xs truncate`,children:e.name})]},e.id))})]}),(0,l.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 text-xs text-muted-foreground`,n?`justify-end`:``),children:[(0,l.jsx)(`span`,{children:typeof e.timestamp==`string`?e.timestamp:h(e.timestamp)}),n&&e.status&&a[e.status]]}),e.reactions&&e.reactions.length>0&&(0,l.jsx)(`div`,{className:`flex gap-1 mt-1`,children:Array.from(new Set(e.reactions.map(e=>e.emoji))).map(t=>(0,l.jsxs)(`span`,{className:`text-xs bg-muted rounded-full px-2 py-0.5`,children:[t,` `,e.reactions.filter(e=>e.emoji===t).length]},t))})]})]})}function m({users:e}){if(e.length===0)return null;let t=e.map(e=>e.name).join(`, `);return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,l.jsxs)(`div`,{className:`flex gap-1`,children:[(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`0ms`}}),(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`150ms`}}),(0,l.jsx)(c.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`300ms`}})]}),(0,l.jsxs)(`span`,{children:[t,` `,e.length===1?`is`:`are`,` typing...`]})]})}function h(e){return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function g({currentUser:e,conversations:n=[],selectedConversation:r,messages:u=[],onSendMessage:h,onSelectConversation:g,onTyping:_,typingUsers:v=[],showSidebar:y=!0,className:b}){let[x,S]=s.useState(``),[C,w]=s.useState(``),T=s.useRef(null),E=()=>{T.current?.scrollIntoView({behavior:`smooth`})};s.useEffect(()=>{E()},[u]);let D=()=>{!x.trim()||!h||(h(x.trim()),S(``))},O=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},k=n.filter(t=>{if(!C)return!0;let n=t.participants.find(t=>t.id!==e.id);return(t.isGroup?t.groupName:n?.name)?.toLowerCase().includes(C.toLowerCase())}),A=r?.participants.find(t=>t.id!==e.id),j=r?.isGroup?r.groupName:A?.name,M=u.reduce((e,t,n)=>{let r=u[n-1],i=!r||r.senderId!==t.senderId;return e.push({message:t,showAvatar:i}),e},[]);return(0,l.jsxs)(`div`,{className:t.cn(`flex h-[600px] rounded-lg border overflow-hidden`,b),children:[y&&(0,l.jsxs)(`div`,{className:`w-80 border-r flex flex-col bg-card`,children:[(0,l.jsxs)(`div`,{className:`p-4 border-b`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,l.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Messages`}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.MoreVertical,{className:`h-4 w-4`})})]}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(c.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,l.jsx)(a.Input,{placeholder:`Search conversations...`,value:C,onChange:e=>w(e.target.value),className:`pl-9`})]})]}),(0,l.jsx)(o.ScrollArea,{className:`flex-1`,children:(0,l.jsx)(`div`,{className:`p-2 space-y-1`,children:k.map(t=>(0,l.jsx)(f,{conversation:t,currentUserId:e.id,isSelected:r?.id===t.id,onClick:()=>g?.(t)},t.id))})})]}),(0,l.jsx)(`div`,{className:`flex-1 flex flex-col`,children:r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`h-16 border-b flex items-center justify-between px-4 bg-card`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3`,children:[A&&(0,l.jsx)(d,{user:A}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-medium`,children:j}),A?.status&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:A.status===`online`?`Online`:`Last seen ${A.lastSeen||`recently`}`})]})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Phone,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Video,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.MoreVertical,{className:`h-4 w-4`})})]})]}),(0,l.jsxs)(o.ScrollArea,{className:`flex-1 p-4`,children:[(0,l.jsxs)(`div`,{className:`space-y-4`,children:[M.map(({message:t,showAvatar:n})=>(0,l.jsx)(p,{message:t,isOwn:t.senderId===e.id,sender:r.participants.find(e=>e.id===t.senderId),showAvatar:n},t.id)),(0,l.jsx)(`div`,{ref:T})]}),v.length>0&&(0,l.jsx)(`div`,{className:`mt-4`,children:(0,l.jsx)(m,{users:v})})]}),(0,l.jsx)(`div`,{className:`p-4 border-t bg-card`,children:(0,l.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Paperclip,{className:`h-4 w-4`})}),(0,l.jsx)(`div`,{className:`flex-1`,children:(0,l.jsx)(a.Input,{placeholder:`Type a message...`,value:x,onChange:e=>{S(e.target.value),_?.()},onKeyDown:O,className:`rounded-full`})}),(0,l.jsx)(i.Button,{variant:`ghost`,size:`icon`,children:(0,l.jsx)(c.Smile,{className:`h-4 w-4`})}),(0,l.jsx)(i.Button,{size:`icon`,onClick:D,disabled:!x.trim(),children:(0,l.jsx)(c.Send,{className:`h-4 w-4`})})]})})]}):(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,l.jsxs)(`div`,{className:`text-center`,children:[(0,l.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4`,children:(0,l.jsx)(c.Send,{className:`h-8 w-8 text-muted-foreground`})}),(0,l.jsx)(`h3`,{className:`font-medium text-lg`,children:`Your Messages`}),(0,l.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Select a conversation to start chatting`})]})})})]})}var _=[{id:`1`,name:`John Doe`,avatar:``,status:`online`},{id:`2`,name:`Jane Smith`,avatar:``,status:`away`,lastSeen:`2 hours ago`},{id:`3`,name:`Bob Wilson`,avatar:``,status:`offline`,lastSeen:`yesterday`},{id:`4`,name:`Alice Brown`,avatar:``,status:`busy`}],v=[{id:`conv1`,participants:[_[0],_[1]],lastMessage:{id:`m1`,content:`Hey, how's the project going?`,senderId:`2`,timestamp:new Date,status:`read`},unreadCount:2,isPinned:!0},{id:`conv2`,participants:[_[0],_[2]],lastMessage:{id:`m2`,content:`See you tomorrow!`,senderId:`1`,timestamp:new Date(Date.now()-36e5),status:`delivered`}},{id:`conv3`,isGroup:!0,groupName:`Project Team`,participants:[_[0],_[1],_[2],_[3]],lastMessage:{id:`m3`,content:`Meeting at 3pm`,senderId:`4`,timestamp:new Date(Date.now()-72e5),status:`read`},unreadCount:5}],y=[{id:`msg1`,content:`Hey! How are you doing?`,senderId:`2`,timestamp:new Date(Date.now()-36e5),status:`read`},{id:`msg2`,content:`I'm doing great, thanks for asking! Just finished the new feature.`,senderId:`1`,timestamp:new Date(Date.now()-35e5),status:`read`},{id:`msg3`,content:`That's awesome! Can you show me a demo?`,senderId:`2`,timestamp:new Date(Date.now()-34e5),status:`read`},{id:`msg4`,content:`Sure! Let me schedule a call for tomorrow. Does 2pm work for you?`,senderId:`1`,timestamp:new Date(Date.now()-33e5),status:`delivered`},{id:`msg5`,content:`Perfect, 2pm works great!`,senderId:`2`,timestamp:new Date(Date.now()-32e5),status:`read`}];exports.ChatInterface=g,exports.default=g,exports.defaultConversations=v,exports.defaultMessages=y,exports.defaultUsers=_;
|
|
@@ -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/checkbox/index.cjs.js`),o=require(`../../components/label/index.cjs.js`),s=require(`../../components/input/index.cjs.js`),c=require(`../../components/radio-group/index.cjs.js`),l=require(`../../components/separator/index.cjs.js`);let u=require(`react`);u=e.__toESM(u);let d=require(`lucide-react`),f=require(`react/jsx-runtime`);function p({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,f.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,f.jsxs)(u.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:t.cn(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,f.jsx)(d.Check,{className:`h-4 w-4`}):i+1}),(0,f.jsx)(`span`,{className:t.cn(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,f.jsx)(`div`,{className:t.cn(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function m({items:e,currency:t=`$`,discount:n,couponCode:a,setCouponCode:o,onApplyCoupon:c,onRemoveDiscount:u,isApplyingCoupon:p,shippingPrice:m=0,taxRate:h=0}){let g=e.reduce((e,t)=>e+t.price*t.quantity,0),_=n?n.type===`percent`?g*n.amount/100:n.amount:0,v=g-_,y=v*h/100,b=v+y+m;return(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,f.jsxs)(i.CardContent,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,f.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,f.jsx)(l.Separator,{}),n?(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Percent,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:u,children:(0,f.jsx)(d.X,{className:`h-4 w-4`})})]}):(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(s.Input,{placeholder:`Coupon code`,value:a,onChange:e=>o(e.target.value),className:`flex-1`}),(0,f.jsx)(r.Button,{variant:`outline`,onClick:c,disabled:!a||p,children:p?(0,f.jsx)(d.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,f.jsx)(l.Separator,{}),(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,f.jsxs)(`span`,{children:[t,g.toFixed(2)]})]}),_>0&&(0,f.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,f.jsx)(`span`,{children:`Discount`}),(0,f.jsxs)(`span`,{children:[`-`,t,_.toFixed(2)]})]}),m>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,f.jsxs)(`span`,{children:[t,m.toFixed(2)]})]}),y>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,h,`%)`]}),(0,f.jsxs)(`span`,{children:[t,y.toFixed(2)]})]}),(0,f.jsx)(l.Separator,{}),(0,f.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsxs)(`span`,{children:[t,b.toFixed(2)]})]})]})]})]})}function h({items:e,shippingMethods:h=g,paymentMethods:v=_,onApplyCoupon:y,discount:b,onRemoveDiscount:x,onSubmitOrder:S,currency:C=`$`,taxRate:w=8.5,className:T}){let[E,D]=u.useState(`cart`),[O,k]=u.useState(``),[A,j]=u.useState(!1),[M,N]=u.useState(!1),[P,F]=u.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[I,L]=u.useState(h[0]?.id||``),[R,z]=u.useState(v[0]?.id||``),[B,V]=u.useState(!1),H=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],U=h.find(e=>e.id===I),W=async()=>{!y||!O||(j(!0),await y(O),j(!1))},G=async()=>{if(S){N(!0);try{await S({address:P,shippingMethod:I,paymentMethod:R,saveInfo:B})}finally{N(!1)}}},K=()=>{let e=H.findIndex(e=>e.id===E);e<H.length-1&&D(H[e+1].id)},q=()=>{let e=H.findIndex(e=>e.id===E);e>0&&D(H[e-1].id)};return(0,f.jsxs)(`div`,{className:t.cn(`max-w-6xl mx-auto`,T),children:[(0,f.jsx)(p,{steps:H,currentStep:E}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[E===`cart`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.CardHeader,{children:[(0,f.jsx)(i.CardTitle,{children:`Shopping Cart`}),(0,f.jsxs)(i.CardDescription,{children:[e.length,` items in your cart`]})]}),(0,f.jsx)(i.CardContent,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,f.jsx)(n.Badge,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,f.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,f.jsxs)(`span`,{className:`font-bold`,children:[C,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,f.jsx)(i.CardFooter,{children:(0,f.jsxs)(r.Button,{className:`w-full`,onClick:K,children:[`Continue to Shipping`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),E===`shipping`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,f.jsxs)(i.CardContent,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`First Name`}),(0,f.jsx)(s.Input,{value:P.firstName,onChange:e=>F({...P,firstName:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Last Name`}),(0,f.jsx)(s.Input,{value:P.lastName,onChange:e=>F({...P,lastName:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Email`}),(0,f.jsx)(s.Input,{type:`email`,value:P.email,onChange:e=>F({...P,email:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Phone`}),(0,f.jsx)(s.Input,{type:`tel`,value:P.phone,onChange:e=>F({...P,phone:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Address`}),(0,f.jsx)(s.Input,{value:P.address,onChange:e=>F({...P,address:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Apartment, suite, etc. (optional)`}),(0,f.jsx)(s.Input,{value:P.apartment,onChange:e=>F({...P,apartment:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`City`}),(0,f.jsx)(s.Input,{value:P.city,onChange:e=>F({...P,city:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`State`}),(0,f.jsx)(s.Input,{value:P.state,onChange:e=>F({...P,state:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Postal Code`}),(0,f.jsx)(s.Input,{value:P.postalCode,onChange:e=>F({...P,postalCode:e.target.value})})]})]}),(0,f.jsx)(l.Separator,{className:`my-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,f.jsx)(d.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,f.jsx)(c.RadioGroup,{value:I,onValueChange:L,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,f.jsxs)(o.Label,{className:t.cn(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,I===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)(c.RadioGroupItem,{value:e.id}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${C}${e.price.toFixed(2)}`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.Button,{className:`flex-1`,onClick:K,children:[`Continue to Payment`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),E===`payment`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,f.jsxs)(i.CardContent,{children:[(0,f.jsx)(c.RadioGroup,{value:R,onValueChange:z,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:v.map(e=>(0,f.jsxs)(o.Label,{className:t.cn(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,R===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)(c.RadioGroupItem,{value:e.id}),e.icon,(0,f.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,f.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,f.jsx)(a.Checkbox,{id:`save-info`,checked:B,onCheckedChange:e=>V(e)}),(0,f.jsx)(o.Label,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,f.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,f.jsx)(d.Shield,{className:`h-5 w-5 text-green-500`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.Button,{className:`flex-1`,onClick:K,children:[`Review Order`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),E===`review`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.CardHeader,{children:[(0,f.jsx)(i.CardTitle,{children:`Review Your Order`}),(0,f.jsx)(i.CardDescription,{children:`Please verify all information before placing your order`})]}),(0,f.jsxs)(i.CardContent,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[P.firstName,` `,P.lastName]}),(0,f.jsxs)(`p`,{children:[P.address,P.apartment&&`, ${P.apartment}`]}),(0,f.jsxs)(`p`,{children:[P.city,`, `,P.state,` `,P.postalCode]}),(0,f.jsx)(`p`,{children:P.email}),(0,f.jsx)(`p`,{children:P.phone})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:U?.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:U?.estimatedDays})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,f.jsx)(`p`,{className:`font-medium`,children:v.find(e=>e.id===R)?.label})})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsx)(r.Button,{className:`flex-1`,onClick:G,disabled:M,children:M?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,f.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,f.jsx)(m,{items:e,currency:C,discount:b,couponCode:O,setCouponCode:k,onApplyCoupon:W,onRemoveDiscount:x,isApplyingCoupon:A,shippingPrice:U?.price||0,taxRate:w})})]})]})}var g=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,f.jsx)(d.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,f.jsx)(d.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,f.jsx)(d.Truck,{className:`h-5 w-5`})}],_=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,f.jsx)(d.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,f.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],v=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}];exports.default=h,exports.defaultCartItems=v,exports.defaultPaymentMethods=_,exports.defaultShippingMethods=g;
|
|
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/checkbox/index.cjs.js"),o=require("../../components/label/index.cjs.js"),s=require("../../components/input/index.cjs.js"),c=require("../../components/radio-group/index.cjs.js"),l=require("../../components/separator/index.cjs.js");let u=require("react");u=e.__toESM(u);let d=require("lucide-react"),f=require("react/jsx-runtime");function p({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,f.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,f.jsxs)(u.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center`,children:[(0,f.jsx)(`div`,{className:t.cn(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,f.jsx)(d.Check,{className:`h-4 w-4`}):i+1}),(0,f.jsx)(`span`,{className:t.cn(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,f.jsx)(`div`,{className:t.cn(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function m({items:e,currency:t=`$`,discount:n,couponCode:a,setCouponCode:o,onApplyCoupon:c,onRemoveDiscount:u,isApplyingCoupon:p,shippingPrice:m=0,taxRate:h=0}){let g=e.reduce((e,t)=>e+t.price*t.quantity,0),_=n?n.type===`percent`?g*n.amount/100:n.amount:0,v=g-_,y=v*h/100,b=v+y+m;return(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,f.jsxs)(i.CardContent,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,f.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,f.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,f.jsx)(l.Separator,{}),n?(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Percent,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,f.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:u,children:(0,f.jsx)(d.X,{className:`h-4 w-4`})})]}):(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(s.Input,{placeholder:`Coupon code`,value:a,onChange:e=>o(e.target.value),className:`flex-1`}),(0,f.jsx)(r.Button,{variant:`outline`,onClick:c,disabled:!a||p,children:p?(0,f.jsx)(d.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,f.jsx)(l.Separator,{}),(0,f.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,f.jsxs)(`span`,{children:[t,g.toFixed(2)]})]}),_>0&&(0,f.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,f.jsx)(`span`,{children:`Discount`}),(0,f.jsxs)(`span`,{children:[`-`,t,_.toFixed(2)]})]}),m>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,f.jsxs)(`span`,{children:[t,m.toFixed(2)]})]}),y>0&&(0,f.jsxs)(`div`,{className:`flex justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,h,`%)`]}),(0,f.jsxs)(`span`,{children:[t,y.toFixed(2)]})]}),(0,f.jsx)(l.Separator,{}),(0,f.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsxs)(`span`,{children:[t,b.toFixed(2)]})]})]})]})]})}function h({items:e,shippingMethods:h=g,paymentMethods:v=_,onApplyCoupon:y,discount:b,onRemoveDiscount:x,onSubmitOrder:S,currency:C=`$`,taxRate:w=8.5,className:T}){let[E,D]=u.useState(`cart`),[O,k]=u.useState(``),[A,j]=u.useState(!1),[M,N]=u.useState(!1),[P,F]=u.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[I,L]=u.useState(h[0]?.id||``),[R,z]=u.useState(v[0]?.id||``),[B,V]=u.useState(!1),H=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],U=h.find(e=>e.id===I),W=async()=>{!y||!O||(j(!0),await y(O),j(!1))},G=async()=>{if(S){N(!0);try{await S({address:P,shippingMethod:I,paymentMethod:R,saveInfo:B})}finally{N(!1)}}},K=()=>{let e=H.findIndex(e=>e.id===E);e<H.length-1&&D(H[e+1].id)},q=()=>{let e=H.findIndex(e=>e.id===E);e>0&&D(H[e-1].id)};return(0,f.jsxs)(`div`,{className:t.cn(`max-w-6xl mx-auto`,T),children:[(0,f.jsx)(p,{steps:H,currentStep:E}),(0,f.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[E===`cart`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.CardHeader,{children:[(0,f.jsx)(i.CardTitle,{children:`Shopping Cart`}),(0,f.jsxs)(i.CardDescription,{children:[e.length,` items in your cart`]})]}),(0,f.jsx)(i.CardContent,{className:`space-y-4`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,f.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,f.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,f.jsx)(n.Badge,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,f.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,f.jsxs)(`span`,{className:`font-bold`,children:[C,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,f.jsx)(i.CardFooter,{children:(0,f.jsxs)(r.Button,{className:`w-full`,onClick:K,children:[`Continue to Shipping`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),E===`shipping`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,f.jsxs)(i.CardContent,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`First Name`}),(0,f.jsx)(s.Input,{value:P.firstName,onChange:e=>F({...P,firstName:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Last Name`}),(0,f.jsx)(s.Input,{value:P.lastName,onChange:e=>F({...P,lastName:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Email`}),(0,f.jsx)(s.Input,{type:`email`,value:P.email,onChange:e=>F({...P,email:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Phone`}),(0,f.jsx)(s.Input,{type:`tel`,value:P.phone,onChange:e=>F({...P,phone:e.target.value})})]})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Address`}),(0,f.jsx)(s.Input,{value:P.address,onChange:e=>F({...P,address:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Apartment, suite, etc. (optional)`}),(0,f.jsx)(s.Input,{value:P.apartment,onChange:e=>F({...P,apartment:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`City`}),(0,f.jsx)(s.Input,{value:P.city,onChange:e=>F({...P,city:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`State`}),(0,f.jsx)(s.Input,{value:P.state,onChange:e=>F({...P,state:e.target.value})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(o.Label,{children:`Postal Code`}),(0,f.jsx)(s.Input,{value:P.postalCode,onChange:e=>F({...P,postalCode:e.target.value})})]})]}),(0,f.jsx)(l.Separator,{className:`my-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,f.jsx)(d.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,f.jsx)(c.RadioGroup,{value:I,onValueChange:L,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,f.jsxs)(o.Label,{className:t.cn(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,I===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)(c.RadioGroupItem,{value:e.id}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${C}${e.price.toFixed(2)}`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.Button,{className:`flex-1`,onClick:K,children:[`Continue to Payment`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),E===`payment`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(i.CardTitle,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,f.jsxs)(i.CardContent,{children:[(0,f.jsx)(c.RadioGroup,{value:R,onValueChange:z,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:v.map(e=>(0,f.jsxs)(o.Label,{className:t.cn(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,R===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,f.jsx)(c.RadioGroupItem,{value:e.id}),e.icon,(0,f.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,f.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,f.jsx)(a.Checkbox,{id:`save-info`,checked:B,onCheckedChange:e=>V(e)}),(0,f.jsx)(o.Label,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,f.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,f.jsx)(d.Shield,{className:`h-5 w-5 text-green-500`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsxs)(r.Button,{className:`flex-1`,onClick:K,children:[`Review Order`,(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),E===`review`&&(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.CardHeader,{children:[(0,f.jsx)(i.CardTitle,{children:`Review Your Order`}),(0,f.jsx)(i.CardDescription,{children:`Please verify all information before placing your order`})]}),(0,f.jsxs)(i.CardContent,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsxs)(`p`,{className:`font-medium`,children:[P.firstName,` `,P.lastName]}),(0,f.jsxs)(`p`,{children:[P.address,P.apartment&&`, ${P.apartment}`]}),(0,f.jsxs)(`p`,{children:[P.city,`, `,P.state,` `,P.postalCode]}),(0,f.jsx)(`p`,{children:P.email}),(0,f.jsx)(`p`,{children:P.phone})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,f.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,f.jsx)(`p`,{className:`font-medium`,children:U?.name}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:U?.estimatedDays})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,f.jsx)(d.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,f.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,f.jsx)(`p`,{className:`font-medium`,children:v.find(e=>e.id===R)?.label})})]})]}),(0,f.jsxs)(i.CardFooter,{className:`flex gap-4`,children:[(0,f.jsxs)(r.Button,{variant:`outline`,onClick:q,children:[(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,f.jsx)(r.Button,{className:`flex-1`,onClick:G,disabled:M,children:M?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,f.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,f.jsx)(m,{items:e,currency:C,discount:b,couponCode:O,setCouponCode:k,onApplyCoupon:W,onRemoveDiscount:x,isApplyingCoupon:A,shippingPrice:U?.price||0,taxRate:w})})]})]})}var g=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,f.jsx)(d.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,f.jsx)(d.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,f.jsx)(d.Truck,{className:`h-5 w-5`})}],_=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,f.jsx)(d.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,f.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],v=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}];exports.CheckoutFlow=h,exports.default=h,exports.defaultCartItems=v,exports.defaultPaymentMethods=_,exports.defaultShippingMethods=g;
|
|
@@ -637,4 +637,4 @@ var P = [
|
|
|
637
637
|
variant: "2m"
|
|
638
638
|
}];
|
|
639
639
|
//#endregion
|
|
640
|
-
export { N as default, I as defaultCartItems, F as defaultPaymentMethods, P as defaultShippingMethods };
|
|
640
|
+
export { N as CheckoutFlow, N as default, I as defaultCartItems, F as defaultPaymentMethods, P as defaultShippingMethods };
|
|
@@ -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/dropdown-menu/index.cjs.js`),o=require(`../../components/input/index.cjs.js`),s=require(`../../components/select/index.cjs.js`),c=require(`../../components/scroll-area/index.cjs.js`);let l=require(`react`);l=e.__toESM(l);let u=require(`lucide-react`),d=require(`react/jsx-runtime`);var f={build:{icon:u.Box,color:`text-blue-500`,label:`Build`},test:{icon:u.TestTube,color:`text-purple-500`,label:`Test`},deploy:{icon:u.Rocket,color:`text-green-500`,label:`Deploy`},script:{icon:u.Terminal,color:`text-gray-500`,label:`Script`},docker:{icon:u.Container,color:`text-cyan-500`,label:`Docker`},notify:{icon:u.Bell,color:`text-yellow-500`,label:`Notify`},approval:{icon:u.Shield,color:`text-orange-500`,label:`Approval`},artifact:{icon:u.Upload,color:`text-indigo-500`,label:`Artifact`},cache:{icon:u.Database,color:`text-pink-500`,label:`Cache`},parallel:{icon:u.Zap,color:`text-amber-500`,label:`Parallel`}},p={pending:{color:`text-muted-foreground`,bgColor:`bg-muted`,icon:u.Clock},running:{color:`text-blue-500`,bgColor:`bg-blue-500`,icon:u.Play},success:{color:`text-green-500`,bgColor:`bg-green-500`,icon:u.CheckCircle2},failed:{color:`text-red-500`,bgColor:`bg-red-500`,icon:u.XCircle},skipped:{color:`text-gray-400`,bgColor:`bg-gray-400`,icon:u.ChevronRight},waiting:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,icon:u.Clock}};function m({step:e,onUpdate:i,onDelete:c,readOnly:m}){let[h,g]=l.useState(!1),_=f[e.type],v=_.icon,y=e.status?p[e.status]:null,b=y?.icon;return(0,d.jsxs)(`div`,{className:t.cn(`border rounded-lg transition-all`,e.status===`failed`&&`border-red-500/50`,e.status===`running`&&`border-blue-500/50 bg-blue-500/5`),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 p-3 cursor-pointer`,onClick:()=>g(!h),children:[!m&&(0,d.jsx)(u.GripVertical,{className:`h-4 w-4 text-muted-foreground cursor-grab`}),(0,d.jsx)(`div`,{className:t.cn(`p-1.5 rounded`,`${_.color.replace(`text-`,`bg-`)}/10`),children:(0,d.jsx)(v,{className:t.cn(`h-4 w-4`,_.color)})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,d.jsx)(n.Badge,{variant:`outline`,className:`text-xs`,children:_.label})]}),e.command&&(0,d.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono truncate block mt-0.5`,children:e.command})]}),b&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`text-xs`,y?.color),children:[(0,d.jsx)(b,{className:`h-3 w-3 mr-1`}),e.status]}),!m&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsxs)(a.DropdownMenuContent,{align:`end`,children:[(0,d.jsxs)(a.DropdownMenuItem,{onClick:()=>g(!0),children:[(0,d.jsx)(u.Settings,{className:`h-4 w-4 mr-2`}),`Configure`]}),(0,d.jsxs)(a.DropdownMenuItem,{children:[(0,d.jsx)(u.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate`]}),(0,d.jsx)(a.DropdownMenuSeparator,{}),(0,d.jsxs)(a.DropdownMenuItem,{className:`text-destructive`,onClick:c,children:[(0,d.jsx)(u.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,d.jsx)(u.ChevronRight,{className:t.cn(`h-4 w-4 transition-transform`,h&&`rotate-90`)})]}),h&&(0,d.jsxs)(`div`,{className:`px-3 pb-3 pt-0 space-y-3 border-t mt-2`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Step Name`}),(0,d.jsx)(o.Input,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 mt-1`,disabled:m})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Type`}),(0,d.jsxs)(s.Select,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:m,children:[(0,d.jsx)(s.SelectTrigger,{className:`h-8 mt-1`,children:(0,d.jsx)(s.SelectValue,{})}),(0,d.jsx)(s.SelectContent,{children:Object.entries(f).map(([e,n])=>(0,d.jsx)(s.SelectItem,{value:e,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(n.icon,{className:t.cn(`h-4 w-4`,n.color)}),n.label]})},e))})]})]})]}),(e.type===`script`||e.type===`build`||e.type===`test`)&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,d.jsx)(o.Input,{value:e.command||``,onChange:t=>i({...e,command:t.target.value}),placeholder:`npm run build`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]}),e.type===`docker`&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Docker Image`}),(0,d.jsx)(o.Input,{value:e.image||``,onChange:t=>i({...e,image:t.target.value}),placeholder:`node:18-alpine`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Timeout (seconds)`}),(0,d.jsx)(o.Input,{type:`number`,value:e.timeout||``,onChange:t=>i({...e,timeout:parseInt(t.target.value)||void 0}),placeholder:`300`,className:`h-8 mt-1`,disabled:m})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Retries`}),(0,d.jsx)(o.Input,{type:`number`,value:e.retries||``,onChange:t=>i({...e,retries:parseInt(t.target.value)||void 0}),placeholder:`0`,className:`h-8 mt-1`,disabled:m})]})]}),e.condition!==void 0&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Condition`}),(0,d.jsx)(o.Input,{value:e.condition,onChange:t=>i({...e,condition:t.target.value}),placeholder:`$CI_COMMIT_BRANCH == 'main'`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]})]})]})}function h({stage:e,onUpdate:s,onDelete:c,onAddStep:h,readOnly:g}){let[_,v]=l.useState(!1),y=e.status?p[e.status]:null,b=y?.icon,x=(t,n)=>{s({...e,steps:e.steps.map(e=>e.id===t?n:e)})},S=t=>{s({...e,steps:e.steps.filter(e=>e.id!==t)})};return(0,d.jsxs)(i.Card,{className:t.cn(e.status===`failed`&&`border-red-500/30`,e.status===`running`&&`border-blue-500/30`),children:[(0,d.jsx)(i.CardHeader,{className:`pb-2`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`button`,{onClick:()=>v(!_),children:(0,d.jsx)(u.ChevronDown,{className:t.cn(`h-4 w-4 transition-transform`,_&&`-rotate-90`)})}),(0,d.jsx)(o.Input,{value:e.name,onChange:t=>s({...e,name:t.target.value}),className:`h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:g}),b&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`text-xs ml-auto`,y?.color),children:[(0,d.jsx)(b,{className:`h-3 w-3 mr-1`}),e.status]}),(0,d.jsxs)(n.Badge,{variant:`secondary`,className:`text-xs`,children:[e.steps.length,` steps`]}),!g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsxs)(a.DropdownMenuContent,{align:`end`,children:[(0,d.jsxs)(a.DropdownMenuItem,{children:[(0,d.jsx)(u.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate Stage`]}),(0,d.jsx)(a.DropdownMenuSeparator,{}),(0,d.jsxs)(a.DropdownMenuItem,{className:`text-destructive`,onClick:c,children:[(0,d.jsx)(u.Trash2,{className:`h-4 w-4 mr-2`}),`Delete Stage`]})]})]})]})}),!_&&(0,d.jsxs)(i.CardContent,{className:`space-y-2`,children:[e.steps.map(e=>(0,d.jsx)(m,{step:e,onUpdate:t=>x(e.id,t),onDelete:()=>S(e.id),readOnly:g},e.id)),!g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,d.jsx)(u.Plus,{className:`h-4 w-4 mr-1`}),`Add Step`]})}),(0,d.jsx)(a.DropdownMenuContent,{className:`w-48`,children:Object.entries(f).map(([e,n])=>(0,d.jsxs)(a.DropdownMenuItem,{onClick:()=>h(e),children:[(0,d.jsx)(n.icon,{className:t.cn(`h-4 w-4 mr-2`,n.color)}),n.label]},e))})]})]})]})}function g({pipeline:e,onPipelineChange:s,onRun:p,onSave:m,onExport:g,readOnly:_=!1,className:v}){let[y,b]=l.useState(e),x=e=>{let t={...y,...e};b(t),s?.(t)},S=()=>{let e={id:`stage-${Date.now()}`,name:`Stage ${y.stages.length+1}`,steps:[]};x({stages:[...y.stages,e]})},C=(e,t)=>{x({stages:y.stages.map(n=>n.id===e?t:n)})},w=e=>{x({stages:y.stages.filter(t=>t.id!==e)})},T=(e,t)=>{let n=y.stages.find(t=>t.id===e);if(!n)return;let r={id:`step-${Date.now()}`,name:`${f[t].label} Step`,type:t};C(e,{...n,steps:[...n.steps,r]})};return(0,d.jsxs)(`div`,{className:t.cn(`flex flex-col gap-6`,v),children:[(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{className:`pb-3`,children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(u.GitBranch,{className:`h-5 w-5`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(o.Input,{value:y.name,onChange:e=>x({name:e.target.value}),className:`h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:_}),y.description&&(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.description})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,children:[(0,d.jsx)(u.Download,{className:`h-4 w-4 mr-1`}),`Export`]})}),(0,d.jsxs)(a.DropdownMenuContent,{children:[(0,d.jsx)(a.DropdownMenuItem,{onClick:()=>g(`yaml`),children:`Export as YAML`}),(0,d.jsx)(a.DropdownMenuItem,{onClick:()=>g(`json`),children:`Export as JSON`})]})]}),m&&!_&&(0,d.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:m,children:`Save`}),p&&(0,d.jsxs)(r.Button,{size:`sm`,onClick:p,children:[(0,d.jsx)(u.Play,{className:`h-4 w-4 mr-1`}),`Run Pipeline`]})]})]})}),y.trigger&&(0,d.jsx)(i.CardContent,{className:`pt-0`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Triggers:`}),y.trigger.events?.map(e=>(0,d.jsx)(n.Badge,{variant:`outline`,className:`text-xs`,children:e},e)),y.trigger.branches?.map(e=>(0,d.jsxs)(n.Badge,{variant:`secondary`,className:`text-xs`,children:[(0,d.jsx)(u.GitBranch,{className:`h-3 w-3 mr-1`}),e]},e)),y.trigger.schedule&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[(0,d.jsx)(u.Clock,{className:`h-3 w-3 mr-1`}),y.trigger.schedule]})]})})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto pb-2`,children:y.stages.map((e,n)=>(0,d.jsxs)(l.Fragment,{children:[(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,d.jsx)(`div`,{className:t.cn(`w-4 h-4 rounded-full border-2`,e.status===`success`&&`bg-green-500 border-green-500`,e.status===`failed`&&`bg-red-500 border-red-500`,e.status===`running`&&`bg-blue-500 border-blue-500 animate-pulse`,!e.status&&`bg-muted border-muted-foreground`)}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e.name})]}),n<y.stages.length-1&&(0,d.jsx)(u.ArrowRight,{className:`h-4 w-4 text-muted-foreground shrink-0`})]},e.id))}),(0,d.jsx)(c.ScrollArea,{className:`h-[500px]`,children:(0,d.jsxs)(`div`,{className:`space-y-4 pr-4`,children:[y.stages.map(e=>(0,d.jsx)(h,{stage:e,onUpdate:t=>C(e.id,t),onDelete:()=>w(e.id),onAddStep:t=>T(e.id,t),readOnly:_},e.id)),!_&&(0,d.jsxs)(r.Button,{variant:`outline`,className:`w-full`,onClick:S,children:[(0,d.jsx)(u.Plus,{className:`h-4 w-4 mr-1`}),`Add Stage`]})]})})]})}var _={id:`1`,name:`Production Deploy`,description:`Build, test, and deploy to production`,trigger:{branches:[`main`,`release/*`],events:[`push`,`pull_request`]},stages:[{id:`build`,name:`Build`,status:`success`,steps:[{id:`install`,name:`Install Dependencies`,type:`script`,command:`npm ci`,status:`success`},{id:`build`,name:`Build Application`,type:`build`,command:`npm run build`,status:`success`},{id:`artifact`,name:`Upload Build Artifacts`,type:`artifact`,artifacts:[`dist/**`,`build/**`],status:`success`}]},{id:`test`,name:`Test`,status:`running`,steps:[{id:`unit`,name:`Unit Tests`,type:`test`,command:`npm run test:unit`,status:`success`},{id:`integration`,name:`Integration Tests`,type:`test`,command:`npm run test:integration`,status:`running`},{id:`e2e`,name:`E2E Tests`,type:`test`,command:`npm run test:e2e`,status:`pending`}]},{id:`security`,name:`Security`,status:`pending`,steps:[{id:`sast`,name:`SAST Scan`,type:`script`,command:`npm run security:sast`},{id:`deps`,name:`Dependency Check`,type:`script`,command:`npm audit`}]},{id:`deploy`,name:`Deploy`,status:`pending`,steps:[{id:`approval`,name:`Production Approval`,type:`approval`,condition:`$CI_COMMIT_BRANCH == 'main'`},{id:`docker`,name:`Build Docker Image`,type:`docker`,image:`app:$CI_COMMIT_SHA`},{id:`deploy-prod`,name:`Deploy to Production`,type:`deploy`,command:`kubectl apply -f k8s/`},{id:`notify`,name:`Notify Team`,type:`notify`}]}],variables:{NODE_ENV:`production`,REGISTRY:`gcr.io/my-project`}};exports.CICDBuilder=g,exports.defaultPipeline=_;
|
|
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/dropdown-menu/index.cjs.js"),o=require("../../components/input/index.cjs.js"),s=require("../../components/select/index.cjs.js"),c=require("../../components/scroll-area/index.cjs.js");let l=require("react");l=e.__toESM(l);let u=require("lucide-react"),d=require("react/jsx-runtime");var f={build:{icon:u.Box,color:`text-blue-500`,label:`Build`},test:{icon:u.TestTube,color:`text-purple-500`,label:`Test`},deploy:{icon:u.Rocket,color:`text-green-500`,label:`Deploy`},script:{icon:u.Terminal,color:`text-gray-500`,label:`Script`},docker:{icon:u.Container,color:`text-cyan-500`,label:`Docker`},notify:{icon:u.Bell,color:`text-yellow-500`,label:`Notify`},approval:{icon:u.Shield,color:`text-orange-500`,label:`Approval`},artifact:{icon:u.Upload,color:`text-indigo-500`,label:`Artifact`},cache:{icon:u.Database,color:`text-pink-500`,label:`Cache`},parallel:{icon:u.Zap,color:`text-amber-500`,label:`Parallel`}},p={pending:{color:`text-muted-foreground`,bgColor:`bg-muted`,icon:u.Clock},running:{color:`text-blue-500`,bgColor:`bg-blue-500`,icon:u.Play},success:{color:`text-green-500`,bgColor:`bg-green-500`,icon:u.CheckCircle2},failed:{color:`text-red-500`,bgColor:`bg-red-500`,icon:u.XCircle},skipped:{color:`text-gray-400`,bgColor:`bg-gray-400`,icon:u.ChevronRight},waiting:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,icon:u.Clock}};function m({step:e,onUpdate:i,onDelete:c,readOnly:m}){let[h,g]=l.useState(!1),_=f[e.type],v=_.icon,y=e.status?p[e.status]:null,b=y?.icon;return(0,d.jsxs)(`div`,{className:t.cn(`border rounded-lg transition-all`,e.status===`failed`&&`border-red-500/50`,e.status===`running`&&`border-blue-500/50 bg-blue-500/5`),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 p-3 cursor-pointer`,onClick:()=>g(!h),children:[!m&&(0,d.jsx)(u.GripVertical,{className:`h-4 w-4 text-muted-foreground cursor-grab`}),(0,d.jsx)(`div`,{className:t.cn(`p-1.5 rounded`,`${_.color.replace(`text-`,`bg-`)}/10`),children:(0,d.jsx)(v,{className:t.cn(`h-4 w-4`,_.color)})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,d.jsx)(n.Badge,{variant:`outline`,className:`text-xs`,children:_.label})]}),e.command&&(0,d.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono truncate block mt-0.5`,children:e.command})]}),b&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`text-xs`,y?.color),children:[(0,d.jsx)(b,{className:`h-3 w-3 mr-1`}),e.status]}),!m&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsxs)(a.DropdownMenuContent,{align:`end`,children:[(0,d.jsxs)(a.DropdownMenuItem,{onClick:()=>g(!0),children:[(0,d.jsx)(u.Settings,{className:`h-4 w-4 mr-2`}),`Configure`]}),(0,d.jsxs)(a.DropdownMenuItem,{children:[(0,d.jsx)(u.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate`]}),(0,d.jsx)(a.DropdownMenuSeparator,{}),(0,d.jsxs)(a.DropdownMenuItem,{className:`text-destructive`,onClick:c,children:[(0,d.jsx)(u.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,d.jsx)(u.ChevronRight,{className:t.cn(`h-4 w-4 transition-transform`,h&&`rotate-90`)})]}),h&&(0,d.jsxs)(`div`,{className:`px-3 pb-3 pt-0 space-y-3 border-t mt-2`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Step Name`}),(0,d.jsx)(o.Input,{value:e.name,onChange:t=>i({...e,name:t.target.value}),className:`h-8 mt-1`,disabled:m})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Type`}),(0,d.jsxs)(s.Select,{value:e.type,onValueChange:t=>i({...e,type:t}),disabled:m,children:[(0,d.jsx)(s.SelectTrigger,{className:`h-8 mt-1`,children:(0,d.jsx)(s.SelectValue,{})}),(0,d.jsx)(s.SelectContent,{children:Object.entries(f).map(([e,n])=>(0,d.jsx)(s.SelectItem,{value:e,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(n.icon,{className:t.cn(`h-4 w-4`,n.color)}),n.label]})},e))})]})]})]}),(e.type===`script`||e.type===`build`||e.type===`test`)&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,d.jsx)(o.Input,{value:e.command||``,onChange:t=>i({...e,command:t.target.value}),placeholder:`npm run build`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]}),e.type===`docker`&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Docker Image`}),(0,d.jsx)(o.Input,{value:e.image||``,onChange:t=>i({...e,image:t.target.value}),placeholder:`node:18-alpine`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Timeout (seconds)`}),(0,d.jsx)(o.Input,{type:`number`,value:e.timeout||``,onChange:t=>i({...e,timeout:parseInt(t.target.value)||void 0}),placeholder:`300`,className:`h-8 mt-1`,disabled:m})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Retries`}),(0,d.jsx)(o.Input,{type:`number`,value:e.retries||``,onChange:t=>i({...e,retries:parseInt(t.target.value)||void 0}),placeholder:`0`,className:`h-8 mt-1`,disabled:m})]})]}),e.condition!==void 0&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Condition`}),(0,d.jsx)(o.Input,{value:e.condition,onChange:t=>i({...e,condition:t.target.value}),placeholder:`$CI_COMMIT_BRANCH == 'main'`,className:`h-8 mt-1 font-mono text-sm`,disabled:m})]})]})]})}function h({stage:e,onUpdate:s,onDelete:c,onAddStep:h,readOnly:g}){let[_,v]=l.useState(!1),y=e.status?p[e.status]:null,b=y?.icon,x=(t,n)=>{s({...e,steps:e.steps.map(e=>e.id===t?n:e)})},S=t=>{s({...e,steps:e.steps.filter(e=>e.id!==t)})};return(0,d.jsxs)(i.Card,{className:t.cn(e.status===`failed`&&`border-red-500/30`,e.status===`running`&&`border-blue-500/30`),children:[(0,d.jsx)(i.CardHeader,{className:`pb-2`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`button`,{onClick:()=>v(!_),children:(0,d.jsx)(u.ChevronDown,{className:t.cn(`h-4 w-4 transition-transform`,_&&`-rotate-90`)})}),(0,d.jsx)(o.Input,{value:e.name,onChange:t=>s({...e,name:t.target.value}),className:`h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:g}),b&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:t.cn(`text-xs ml-auto`,y?.color),children:[(0,d.jsx)(b,{className:`h-3 w-3 mr-1`}),e.status]}),(0,d.jsxs)(n.Badge,{variant:`secondary`,className:`text-xs`,children:[e.steps.length,` steps`]}),!g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsxs)(a.DropdownMenuContent,{align:`end`,children:[(0,d.jsxs)(a.DropdownMenuItem,{children:[(0,d.jsx)(u.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate Stage`]}),(0,d.jsx)(a.DropdownMenuSeparator,{}),(0,d.jsxs)(a.DropdownMenuItem,{className:`text-destructive`,onClick:c,children:[(0,d.jsx)(u.Trash2,{className:`h-4 w-4 mr-2`}),`Delete Stage`]})]})]})]})}),!_&&(0,d.jsxs)(i.CardContent,{className:`space-y-2`,children:[e.steps.map(e=>(0,d.jsx)(m,{step:e,onUpdate:t=>x(e.id,t),onDelete:()=>S(e.id),readOnly:g},e.id)),!g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,d.jsx)(u.Plus,{className:`h-4 w-4 mr-1`}),`Add Step`]})}),(0,d.jsx)(a.DropdownMenuContent,{className:`w-48`,children:Object.entries(f).map(([e,n])=>(0,d.jsxs)(a.DropdownMenuItem,{onClick:()=>h(e),children:[(0,d.jsx)(n.icon,{className:t.cn(`h-4 w-4 mr-2`,n.color)}),n.label]},e))})]})]})]})}function g({pipeline:e,onPipelineChange:s,onRun:p,onSave:m,onExport:g,readOnly:_=!1,className:v}){let[y,b]=l.useState(e),x=e=>{let t={...y,...e};b(t),s?.(t)},S=()=>{let e={id:`stage-${Date.now()}`,name:`Stage ${y.stages.length+1}`,steps:[]};x({stages:[...y.stages,e]})},C=(e,t)=>{x({stages:y.stages.map(n=>n.id===e?t:n)})},w=e=>{x({stages:y.stages.filter(t=>t.id!==e)})},T=(e,t)=>{let n=y.stages.find(t=>t.id===e);if(!n)return;let r={id:`step-${Date.now()}`,name:`${f[t].label} Step`,type:t};C(e,{...n,steps:[...n.steps,r]})};return(0,d.jsxs)(`div`,{className:t.cn(`flex flex-col gap-6`,v),children:[(0,d.jsxs)(i.Card,{children:[(0,d.jsx)(i.CardHeader,{className:`pb-3`,children:(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(u.GitBranch,{className:`h-5 w-5`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(o.Input,{value:y.name,onChange:e=>x({name:e.target.value}),className:`h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:_}),y.description&&(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.description})]})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g&&(0,d.jsxs)(a.DropdownMenu,{children:[(0,d.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsxs)(r.Button,{variant:`outline`,size:`sm`,children:[(0,d.jsx)(u.Download,{className:`h-4 w-4 mr-1`}),`Export`]})}),(0,d.jsxs)(a.DropdownMenuContent,{children:[(0,d.jsx)(a.DropdownMenuItem,{onClick:()=>g(`yaml`),children:`Export as YAML`}),(0,d.jsx)(a.DropdownMenuItem,{onClick:()=>g(`json`),children:`Export as JSON`})]})]}),m&&!_&&(0,d.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:m,children:`Save`}),p&&(0,d.jsxs)(r.Button,{size:`sm`,onClick:p,children:[(0,d.jsx)(u.Play,{className:`h-4 w-4 mr-1`}),`Run Pipeline`]})]})]})}),y.trigger&&(0,d.jsx)(i.CardContent,{className:`pt-0`,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Triggers:`}),y.trigger.events?.map(e=>(0,d.jsx)(n.Badge,{variant:`outline`,className:`text-xs`,children:e},e)),y.trigger.branches?.map(e=>(0,d.jsxs)(n.Badge,{variant:`secondary`,className:`text-xs`,children:[(0,d.jsx)(u.GitBranch,{className:`h-3 w-3 mr-1`}),e]},e)),y.trigger.schedule&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[(0,d.jsx)(u.Clock,{className:`h-3 w-3 mr-1`}),y.trigger.schedule]})]})})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto pb-2`,children:y.stages.map((e,n)=>(0,d.jsxs)(l.Fragment,{children:[(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,d.jsx)(`div`,{className:t.cn(`w-4 h-4 rounded-full border-2`,e.status===`success`&&`bg-green-500 border-green-500`,e.status===`failed`&&`bg-red-500 border-red-500`,e.status===`running`&&`bg-blue-500 border-blue-500 animate-pulse`,!e.status&&`bg-muted border-muted-foreground`)}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e.name})]}),n<y.stages.length-1&&(0,d.jsx)(u.ArrowRight,{className:`h-4 w-4 text-muted-foreground shrink-0`})]},e.id))}),(0,d.jsx)(c.ScrollArea,{className:`h-[500px]`,children:(0,d.jsxs)(`div`,{className:`space-y-4 pr-4`,children:[y.stages.map(e=>(0,d.jsx)(h,{stage:e,onUpdate:t=>C(e.id,t),onDelete:()=>w(e.id),onAddStep:t=>T(e.id,t),readOnly:_},e.id)),!_&&(0,d.jsxs)(r.Button,{variant:`outline`,className:`w-full`,onClick:S,children:[(0,d.jsx)(u.Plus,{className:`h-4 w-4 mr-1`}),`Add Stage`]})]})})]})}var _={id:`1`,name:`Production Deploy`,description:`Build, test, and deploy to production`,trigger:{branches:[`main`,`release/*`],events:[`push`,`pull_request`]},stages:[{id:`build`,name:`Build`,status:`success`,steps:[{id:`install`,name:`Install Dependencies`,type:`script`,command:`npm ci`,status:`success`},{id:`build`,name:`Build Application`,type:`build`,command:`npm run build`,status:`success`},{id:`artifact`,name:`Upload Build Artifacts`,type:`artifact`,artifacts:[`dist/**`,`build/**`],status:`success`}]},{id:`test`,name:`Test`,status:`running`,steps:[{id:`unit`,name:`Unit Tests`,type:`test`,command:`npm run test:unit`,status:`success`},{id:`integration`,name:`Integration Tests`,type:`test`,command:`npm run test:integration`,status:`running`},{id:`e2e`,name:`E2E Tests`,type:`test`,command:`npm run test:e2e`,status:`pending`}]},{id:`security`,name:`Security`,status:`pending`,steps:[{id:`sast`,name:`SAST Scan`,type:`script`,command:`npm run security:sast`},{id:`deps`,name:`Dependency Check`,type:`script`,command:`npm audit`}]},{id:`deploy`,name:`Deploy`,status:`pending`,steps:[{id:`approval`,name:`Production Approval`,type:`approval`,condition:`$CI_COMMIT_BRANCH == 'main'`},{id:`docker`,name:`Build Docker Image`,type:`docker`,image:`app:$CI_COMMIT_SHA`},{id:`deploy-prod`,name:`Deploy to Production`,type:`deploy`,command:`kubectl apply -f k8s/`},{id:`notify`,name:`Notify Team`,type:`notify`}]}],variables:{NODE_ENV:`production`,REGISTRY:`gcr.io/my-project`}};exports.CICDBuilder=g,exports.defaultPipeline=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs.js`);const e=require(`../../utils/cn.cjs.js`),t=require(`../../components/badge/index.cjs.js`),n=require(`../../components/button/index.cjs.js`),r=require(`../../components/card/index.cjs.js`),i=require(`../../components/progress/index.cjs.js`);let a=require(`lucide-react`),o=require(`react/jsx-runtime`);var s=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},c=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5),i=Math.floor(t/864e5);return n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`},l={running:{color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/20`,icon:a.CheckCircle,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/20`,icon:a.Activity,label:`Stopped`},error:{color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/20`,icon:a.AlertTriangle,label:`Error`},restarting:{color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,borderColor:`border-yellow-500/20`,icon:a.Loader2,label:`Restarting`}},u={running:{color:`text-green-500`,label:`Running`},stopped:{color:`text-gray-500`,label:`Stopped`},error:{color:`text-red-500`,label:`Error`},updating:{color:`text-blue-500`,label:`Updating`}},d={up:`bg-green-500`,degraded:`bg-yellow-500`,down:`bg-red-500`},f=({status:f=`running`,version:p=`1.0.3`,uptime:m=259200,metrics:h={cpuUsage:2.5,memoryUsage:512,threads:4,scanQueue:0,activeConnections:3},signatures:g={version:`27456`,count:8764532,lastUpdate:new Date(Date.now()-36e5),freshclamStatus:`running`,nextScheduledUpdate:new Date(Date.now()+36e5)},socketType:_=`tcp`,socketPath:v=`3310`,uptimeHistory:y=[],onRestart:b,onUpdateSignatures:x,onViewLogs:S,className:C})=>{let w=l[f],T=w.icon;return(0,o.jsxs)(`div`,{className:e.cn(`space-y-4`,C),children:[(0,o.jsx)(r.Card,{className:e.cn(`p-6 border-2`,w.borderColor,w.bgColor),children:(0,o.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,o.jsx)(`div`,{className:e.cn(`p-3 rounded-xl`,w.bgColor),children:(0,o.jsx)(T,{className:e.cn(`w-8 h-8`,w.color,f===`restarting`&&`animate-spin`)})}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`h3`,{className:`text-2xl font-semibold`,children:`ClamAV Daemon`}),(0,o.jsx)(t.Badge,{variant:f===`error`?`destructive`:`secondary`,className:f===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:w.label})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,o.jsxs)(`span`,{children:[`Version `,p]}),(0,o.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(a.Clock,{className:`w-3.5 h-3.5`}),`Uptime: `,s(m)]})]})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:S,children:[(0,o.jsx)(a.Terminal,{className:`w-4 h-4 mr-2`}),`Logs`]}),(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:b,disabled:f===`restarting`,children:[(0,o.jsx)(a.RefreshCw,{className:e.cn(`w-4 h-4 mr-2`,f===`restarting`&&`animate-spin`)}),`Restart`]})]})]})}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.Activity,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`System Metrics`})]}),(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`CPU Usage`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[h.cpuUsage.toFixed(1),`%`]})]}),(0,o.jsx)(i.Progress,{value:h.cpuUsage,className:e.cn(`h-2`,h.cpuUsage>80&&`bg-red-500/20`,h.cpuUsage>50&&h.cpuUsage<=80&&`bg-yellow-500/20`)})]}),(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Memory Usage`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[h.memoryUsage,` MB`]})]}),(0,o.jsx)(i.Progress,{value:h.memoryUsage/1024*100,className:e.cn(`h-2`,h.memoryUsage>800&&`bg-red-500/20`,h.memoryUsage>600&&h.memoryUsage<=800&&`bg-yellow-500/20`)})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 pt-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Threads`}),(0,o.jsx)(`div`,{className:`text-2xl font-semibold`,children:h.threads})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Scan Queue`}),(0,o.jsx)(`div`,{className:`text-2xl font-semibold`,children:h.scanQueue})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Connections`}),(0,o.jsxs)(`div`,{className:`text-2xl font-semibold flex items-center gap-1`,children:[h.activeConnections,(0,o.jsx)(a.Wifi,{className:`w-4 h-4 text-muted-foreground`})]})]})]})]})]}),(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(a.Database,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Signature Database`})]}),(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:x,children:[(0,o.jsx)(a.RefreshCw,{className:`w-4 h-4 mr-2`}),`Update`]})]}),(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Version`}),(0,o.jsx)(`div`,{className:`text-lg font-semibold`,children:g.version})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Signatures`}),(0,o.jsx)(`div`,{className:`text-lg font-semibold`,children:g.count.toLocaleString()})]})]}),(0,o.jsxs)(`div`,{className:`space-y-2 pt-2 border-t`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Updated`}),(0,o.jsx)(`span`,{className:`font-medium`,children:c(g.lastUpdate)})]}),g.nextScheduledUpdate&&(0,o.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Next Update`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[`in `,c(new Date(Date.now()-(Date.now()-g.nextScheduledUpdate.getTime())))]})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Freshclam Status`}),(0,o.jsx)(t.Badge,{variant:g.freshclamStatus===`error`?`destructive`:g.freshclamStatus===`updating`?`default`:`secondary`,className:g.freshclamStatus===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:(0,o.jsx)(`span`,{className:e.cn(u[g.freshclamStatus].color),children:u[g.freshclamStatus].label})})]})]})]})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.Wifi,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Connection`})]}),(0,o.jsxs)(`div`,{className:`space-y-3`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Socket Type`}),(0,o.jsx)(t.Badge,{variant:`outline`,children:_.toUpperCase()})]}),(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_===`tcp`?`Port`:`Path`}),(0,o.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:v})]}),(0,o.jsxs)(`div`,{className:`flex justify-between pt-2 border-t`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,o.jsx)(`span`,{className:`text-lg font-semibold`,children:h.activeConnections})]})]})]}),(0,o.jsxs)(r.Card,{className:`p-6 lg:col-span-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.HardDrive,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Uptime History (Last 7 Days)`})]}),y.length>0?(0,o.jsx)(`div`,{className:`flex items-end justify-between gap-1 h-20`,children:y.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1`,children:[(0,o.jsx)(`div`,{className:e.cn(`w-full rounded-t transition-all`,d[t.status],t.status===`up`&&`h-full`,t.status===`degraded`&&`h-3/4`,t.status===`down`&&`h-1/4`)}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:t.hour})]},n))}):(0,o.jsx)(`div`,{className:`h-20 flex items-center justify-center text-sm text-muted-foreground`,children:`No uptime history available`}),(0,o.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mt-4 pt-4 border-t`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-green-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up`})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-yellow-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Degraded`})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-red-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Down`})]})]})]})]})]})};exports.ClamAVServiceStatus=f;
|
|
1
|
+
"use client";"use client";const e=require("../../utils/cn.cjs.js"),t=require("../../components/badge/index.cjs.js"),n=require("../../components/button/index.cjs.js"),r=require("../../components/card/index.cjs.js"),i=require("../../components/progress/index.cjs.js");let a=require("lucide-react"),o=require("react/jsx-runtime");var s=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},c=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5),i=Math.floor(t/864e5);return n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`},l={running:{color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/20`,icon:a.CheckCircle,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/20`,icon:a.Activity,label:`Stopped`},error:{color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/20`,icon:a.AlertTriangle,label:`Error`},restarting:{color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,borderColor:`border-yellow-500/20`,icon:a.Loader2,label:`Restarting`}},u={running:{color:`text-green-500`,label:`Running`},stopped:{color:`text-gray-500`,label:`Stopped`},error:{color:`text-red-500`,label:`Error`},updating:{color:`text-blue-500`,label:`Updating`}},d={up:`bg-green-500`,degraded:`bg-yellow-500`,down:`bg-red-500`},f=({status:f=`running`,version:p=`1.0.3`,uptime:m=259200,metrics:h={cpuUsage:2.5,memoryUsage:512,threads:4,scanQueue:0,activeConnections:3},signatures:g={version:`27456`,count:8764532,lastUpdate:new Date(Date.now()-36e5),freshclamStatus:`running`,nextScheduledUpdate:new Date(Date.now()+36e5)},socketType:_=`tcp`,socketPath:v=`3310`,uptimeHistory:y=[],onRestart:b,onUpdateSignatures:x,onViewLogs:S,className:C})=>{let w=l[f],T=w.icon;return(0,o.jsxs)(`div`,{className:e.cn(`space-y-4`,C),children:[(0,o.jsx)(r.Card,{className:e.cn(`p-6 border-2`,w.borderColor,w.bgColor),children:(0,o.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,o.jsx)(`div`,{className:e.cn(`p-3 rounded-xl`,w.bgColor),children:(0,o.jsx)(T,{className:e.cn(`w-8 h-8`,w.color,f===`restarting`&&`animate-spin`)})}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`h3`,{className:`text-2xl font-semibold`,children:`ClamAV Daemon`}),(0,o.jsx)(t.Badge,{variant:f===`error`?`destructive`:`secondary`,className:f===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:w.label})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,o.jsxs)(`span`,{children:[`Version `,p]}),(0,o.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(a.Clock,{className:`w-3.5 h-3.5`}),`Uptime: `,s(m)]})]})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:S,children:[(0,o.jsx)(a.Terminal,{className:`w-4 h-4 mr-2`}),`Logs`]}),(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:b,disabled:f===`restarting`,children:[(0,o.jsx)(a.RefreshCw,{className:e.cn(`w-4 h-4 mr-2`,f===`restarting`&&`animate-spin`)}),`Restart`]})]})]})}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.Activity,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`System Metrics`})]}),(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`CPU Usage`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[h.cpuUsage.toFixed(1),`%`]})]}),(0,o.jsx)(i.Progress,{value:h.cpuUsage,className:e.cn(`h-2`,h.cpuUsage>80&&`bg-red-500/20`,h.cpuUsage>50&&h.cpuUsage<=80&&`bg-yellow-500/20`)})]}),(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Memory Usage`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[h.memoryUsage,` MB`]})]}),(0,o.jsx)(i.Progress,{value:h.memoryUsage/1024*100,className:e.cn(`h-2`,h.memoryUsage>800&&`bg-red-500/20`,h.memoryUsage>600&&h.memoryUsage<=800&&`bg-yellow-500/20`)})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 pt-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Threads`}),(0,o.jsx)(`div`,{className:`text-2xl font-semibold`,children:h.threads})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Scan Queue`}),(0,o.jsx)(`div`,{className:`text-2xl font-semibold`,children:h.scanQueue})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Connections`}),(0,o.jsxs)(`div`,{className:`text-2xl font-semibold flex items-center gap-1`,children:[h.activeConnections,(0,o.jsx)(a.Wifi,{className:`w-4 h-4 text-muted-foreground`})]})]})]})]})]}),(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(a.Database,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Signature Database`})]}),(0,o.jsxs)(n.Button,{variant:`outline`,size:`sm`,onClick:x,children:[(0,o.jsx)(a.RefreshCw,{className:`w-4 h-4 mr-2`}),`Update`]})]}),(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Version`}),(0,o.jsx)(`div`,{className:`text-lg font-semibold`,children:g.version})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Signatures`}),(0,o.jsx)(`div`,{className:`text-lg font-semibold`,children:g.count.toLocaleString()})]})]}),(0,o.jsxs)(`div`,{className:`space-y-2 pt-2 border-t`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Updated`}),(0,o.jsx)(`span`,{className:`font-medium`,children:c(g.lastUpdate)})]}),g.nextScheduledUpdate&&(0,o.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:`Next Update`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[`in `,c(new Date(Date.now()-(Date.now()-g.nextScheduledUpdate.getTime())))]})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Freshclam Status`}),(0,o.jsx)(t.Badge,{variant:g.freshclamStatus===`error`?`destructive`:g.freshclamStatus===`updating`?`default`:`secondary`,className:g.freshclamStatus===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:(0,o.jsx)(`span`,{className:e.cn(u[g.freshclamStatus].color),children:u[g.freshclamStatus].label})})]})]})]})]}),(0,o.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,o.jsxs)(r.Card,{className:`p-6`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.Wifi,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Connection`})]}),(0,o.jsxs)(`div`,{className:`space-y-3`,children:[(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Socket Type`}),(0,o.jsx)(t.Badge,{variant:`outline`,children:_.toUpperCase()})]}),(0,o.jsxs)(`div`,{className:`flex justify-between`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_===`tcp`?`Port`:`Path`}),(0,o.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:v})]}),(0,o.jsxs)(`div`,{className:`flex justify-between pt-2 border-t`,children:[(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,o.jsx)(`span`,{className:`text-lg font-semibold`,children:h.activeConnections})]})]})]}),(0,o.jsxs)(r.Card,{className:`p-6 lg:col-span-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,o.jsx)(a.HardDrive,{className:`w-5 h-5 text-primary`}),(0,o.jsx)(`h4`,{className:`font-semibold`,children:`Uptime History (Last 7 Days)`})]}),y.length>0?(0,o.jsx)(`div`,{className:`flex items-end justify-between gap-1 h-20`,children:y.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1`,children:[(0,o.jsx)(`div`,{className:e.cn(`w-full rounded-t transition-all`,d[t.status],t.status===`up`&&`h-full`,t.status===`degraded`&&`h-3/4`,t.status===`down`&&`h-1/4`)}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:t.hour})]},n))}):(0,o.jsx)(`div`,{className:`h-20 flex items-center justify-center text-sm text-muted-foreground`,children:`No uptime history available`}),(0,o.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mt-4 pt-4 border-t`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-green-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up`})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-yellow-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Degraded`})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`div`,{className:`w-3 h-3 rounded bg-red-500`}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Down`})]})]})]})]})]})};exports.ClamAVServiceStatus=f;
|
|
@@ -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={compute:{icon:l.Cpu,color:`text-blue-500`,label:`Compute`},storage:{icon:l.HardDrive,color:`text-green-500`,label:`Storage`},database:{icon:l.Database,color:`text-purple-500`,label:`Database`},network:{icon:l.Network,color:`text-cyan-500`,label:`Network`},security:{icon:l.Shield,color:`text-red-500`,label:`Security`},other:{icon:l.Cloud,color:`text-gray-500`,label:`Other`}},f={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},all:{label:`All Providers`,color:`text-gray-500`}};function p(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function m(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function h({title:e,value:r,previousValue:a,icon:s,trend:c,budget:d,forecast:f}){let h=a===void 0?c:(r-a)/a*100,g=d!==void 0&&r>d,_=d===void 0?void 0:r/d*100;return(0,u.jsx)(i.Card,{className:t.cn(g&&`border-red-500/50`),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-5 w-5 text-muted-foreground`})}),h!==void 0&&(0,u.jsxs)(n.Badge,{variant:`outline`,className:t.cn(h>0?`text-red-500`:`text-green-500`),children:[h>0?(0,u.jsx)(l.ArrowUpRight,{className:`h-3 w-3 mr-1`}):(0,u.jsx)(l.ArrowDownRight,{className:`h-3 w-3 mr-1`}),m(Math.abs(h))]})]}),(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsx)(`div`,{className:`text-2xl font-bold`,children:p(r)}),(0,u.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e})]}),_!==void 0&&(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Budget`}),(0,u.jsxs)(`span`,{className:t.cn(g&&`text-red-500`),children:[p(r),` / `,p(d)]})]}),(0,u.jsx)(o.Progress,{value:Math.min(_,100),className:t.cn(`h-2`,_>100&&`[&>div]:bg-red-500`,_>80&&_<=100&&`[&>div]:bg-yellow-500`)})]}),f!==void 0&&(0,u.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Forecast: `,p(f)]})]})})}function g({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);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.PieChart,{className:`h-4 w-4`}),`Cost by Category`]})}),(0,u.jsx)(i.CardContent,{className:`space-y-3`,children:r.map(([e,r])=>{let i=d[e],a=i.icon,s=r/n*100;return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(a,{className:t.cn(`h-4 w-4`,i.color)}),(0,u.jsx)(`span`,{className:`text-sm`,children:i.label})]}),(0,u.jsxs)(`div`,{className:`text-sm font-medium`,children:[p(r),(0,u.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,s.toFixed(0),`%)`]})]})]}),(0,u.jsx)(o.Progress,{value:s,className:`h-2`})]},e)})})]})}function _({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).filter(([e])=>e!==`all`).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);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.Cloud,{className:`h-4 w-4`}),`Cost by Provider`]})}),(0,u.jsx)(i.CardContent,{className:`space-y-3`,children:r.map(([e,r])=>{let i=f[e],a=r/n*100;return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,u.jsx)(`span`,{className:t.cn(`text-sm font-medium`,i.color),children:i.label}),(0,u.jsxs)(`div`,{className:`text-sm font-medium`,children:[p(r),(0,u.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,a.toFixed(0),`%)`]})]})]}),(0,u.jsx)(o.Progress,{value:a,className:`h-2`})]},e)})})]})}function v({items:e}){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.BarChart3,{className:`h-4 w-4`}),`Top Services by Cost`]})}),(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,n)=>{let r=d[e.category],i=r.icon,a=f[e.provider],o=e.previousCost===void 0?e.trend:(e.cost-e.previousCost)/e.previousCost*100;return(0,u.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors`,children:[(0,u.jsx)(`div`,{className:`text-lg font-bold text-muted-foreground w-6 text-center`,children:n+1}),(0,u.jsx)(`div`,{className:t.cn(`p-1.5 rounded`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,u.jsx)(i,{className:t.cn(`h-4 w-4`,r.color)})}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:a.color,children:a.label}),(0,u.jsx)(`span`,{children:`•`}),(0,u.jsx)(`span`,{children:r.label}),e.usage!==void 0&&e.unit&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{children:`•`}),(0,u.jsxs)(`span`,{children:[e.usage,` `,e.unit]})]})]})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,u.jsx)(`div`,{className:`font-semibold`,children:p(e.cost)}),o!==void 0&&(0,u.jsxs)(`div`,{className:t.cn(`text-xs flex items-center justify-end gap-0.5`,o>0?`text-red-500`:`text-green-500`),children:[o>0?(0,u.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,u.jsx)(l.TrendingDown,{className:`h-3 w-3`}),m(Math.abs(o))]})]})]},e.id)})})})})]})}function y({anomalies:e,onAcknowledge:r}){let a=e.filter(e=>e.status===`new`);return(0,u.jsxs)(i.Card,{className:t.cn(a.length>0&&`border-yellow-500/50`),children:[(0,u.jsx)(i.CardHeader,{className:`pb-2`,children:(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,u.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Cost Anomalies`]}),a.length>0&&(0,u.jsxs)(n.Badge,{className:`bg-yellow-500`,children:[a.length,` new`]})]})}),(0,u.jsx)(i.CardContent,{children:e.length===0?(0,u.jsxs)(`div`,{className:`text-center text-muted-foreground py-4`,children:[(0,u.jsx)(l.Zap,{className:`h-8 w-8 mx-auto mb-2 text-green-500`}),(0,u.jsx)(`p`,{children:`No anomalies detected`})]}):(0,u.jsx)(`div`,{className:`space-y-2`,children:e.slice(0,5).map(e=>(0,u.jsxs)(`div`,{className:t.cn(`flex items-center gap-3 p-2 rounded-lg`,e.status===`new`&&`bg-yellow-500/10`),children:[(0,u.jsx)(l.AlertTriangle,{className:t.cn(`h-4 w-4 shrink-0`,e.deviation>100?`text-red-500`:`text-yellow-500`)}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium truncate`,children:e.service}),(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expected `,p(e.expectedCost),` • Actual `,p(e.actualCost)]})]}),(0,u.jsxs)(n.Badge,{variant:`outline`,className:`text-red-500 shrink-0`,children:[`+`,e.deviation.toFixed(0),`%`]})]},e.id))})})]})}function b({summary:e,items:n,anomalies:o=[],timeRange:s=`month`,onTimeRangeChange:d,onProviderFilter:f,onExport:p,onRefresh:m,className:b}){let[x,S]=c.useState(`all`),C=e=>{S(e),f?.(e)},w=c.useMemo(()=>x===`all`?n:n.filter(e=>e.provider===x),[n,x]);return e.previousTotalCost!==void 0&&(e.totalCost-e.previousTotalCost)/e.previousTotalCost*100,(0,u.jsxs)(`div`,{className:t.cn(`space-y-6`,b),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.DollarSign,{className:`h-6 w-6`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(i.CardTitle,{children:`Cloud Cost Dashboard`}),(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor and optimize your cloud spending`})]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsxs)(a.Select,{value:s,onValueChange:e=>d?.(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-32`,children:[(0,u.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`day`,children:`Today`}),(0,u.jsx)(a.SelectItem,{value:`week`,children:`This Week`}),(0,u.jsx)(a.SelectItem,{value:`month`,children:`This Month`}),(0,u.jsx)(a.SelectItem,{value:`quarter`,children:`This Quarter`}),(0,u.jsx)(a.SelectItem,{value:`year`,children:`This Year`})]})]}),(0,u.jsxs)(a.Select,{value:x,onValueChange:e=>C(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-32`,children:[(0,u.jsx)(l.Cloud,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`all`,children:`All Providers`}),(0,u.jsx)(a.SelectItem,{value:`aws`,children:`AWS`}),(0,u.jsx)(a.SelectItem,{value:`gcp`,children:`GCP`}),(0,u.jsx)(a.SelectItem,{value:`azure`,children:`Azure`})]})]}),m&&(0,u.jsx)(r.Button,{variant:`outline`,size:`icon`,onClick:m,children:(0,u.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),p&&(0,u.jsxs)(r.Button,{variant:`outline`,onClick:p,children:[(0,u.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})]})]})})}),(0,u.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,u.jsx)(h,{title:`Total Cost`,value:e.totalCost,previousValue:e.previousTotalCost,icon:l.DollarSign,budget:e.budget}),(0,u.jsx)(h,{title:`Compute`,value:e.byCategory.compute,icon:l.Cpu,trend:-5.2}),(0,u.jsx)(h,{title:`Storage`,value:e.byCategory.storage,icon:l.HardDrive,trend:12.3}),(0,u.jsx)(h,{title:`Forecast (EOM)`,value:e.forecast||e.totalCost*1.1,icon:l.TrendingUp,budget:e.budget})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,u.jsx)(`div`,{className:`col-span-2 space-y-6`,children:(0,u.jsx)(v,{items:w.slice(0,10)})}),(0,u.jsxs)(`div`,{className:`space-y-6`,children:[(0,u.jsx)(g,{data:e.byCategory}),(0,u.jsx)(_,{data:e.byProvider}),(0,u.jsx)(y,{anomalies:o})]})]})]})}var x={totalCost:45230,previousTotalCost:42100,budget:5e4,forecast:48500,byProvider:{aws:28500,gcp:12300,azure:4430,all:45230},byCategory:{compute:22e3,storage:8500,database:7200,network:4100,security:1800,other:1630},topServices:[]},S=[{id:`1`,name:`EC2 Instances`,category:`compute`,provider:`aws`,cost:12500,previousCost:11800,usage:450,unit:`hours`},{id:`2`,name:`RDS PostgreSQL`,category:`database`,provider:`aws`,cost:4200,previousCost:4e3},{id:`3`,name:`S3 Storage`,category:`storage`,provider:`aws`,cost:3800,previousCost:3200,usage:12,unit:`TB`},{id:`4`,name:`GKE Clusters`,category:`compute`,provider:`gcp`,cost:6500,previousCost:6800},{id:`5`,name:`Cloud SQL`,category:`database`,provider:`gcp`,cost:2800,previousCost:2600},{id:`6`,name:`BigQuery`,category:`database`,provider:`gcp`,cost:1800,previousCost:1500,usage:45,unit:`TB scanned`},{id:`7`,name:`Azure VMs`,category:`compute`,provider:`azure`,cost:2400,previousCost:2200},{id:`8`,name:`Blob Storage`,category:`storage`,provider:`azure`,cost:1200,previousCost:1100},{id:`9`,name:`CloudFront CDN`,category:`network`,provider:`aws`,cost:2100,previousCost:1900,usage:85,unit:`TB`},{id:`10`,name:`Lambda Functions`,category:`compute`,provider:`aws`,cost:850,previousCost:720,usage:12e6,unit:`invocations`}],C=[{id:`1`,service:`EC2 Spot Instances`,expectedCost:500,actualCost:1250,deviation:150,timestamp:new Date,status:`new`},{id:`2`,service:`Data Transfer`,expectedCost:800,actualCost:1400,deviation:75,timestamp:new Date(Date.now()-36e5),status:`new`},{id:`3`,service:`Lambda`,expectedCost:200,actualCost:320,deviation:60,timestamp:new Date(Date.now()-72e5),status:`acknowledged`}];exports.CloudCostDashboard=b,exports.defaultCloudCostItems=S,exports.defaultCloudCostSummary=x,exports.defaultCostAnomalies=C;
|
|
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={compute:{icon:l.Cpu,color:`text-blue-500`,label:`Compute`},storage:{icon:l.HardDrive,color:`text-green-500`,label:`Storage`},database:{icon:l.Database,color:`text-purple-500`,label:`Database`},network:{icon:l.Network,color:`text-cyan-500`,label:`Network`},security:{icon:l.Shield,color:`text-red-500`,label:`Security`},other:{icon:l.Cloud,color:`text-gray-500`,label:`Other`}},f={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},all:{label:`All Providers`,color:`text-gray-500`}};function p(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function m(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function h({title:e,value:r,previousValue:a,icon:s,trend:c,budget:d,forecast:f}){let h=a===void 0?c:(r-a)/a*100,g=d!==void 0&&r>d,_=d===void 0?void 0:r/d*100;return(0,u.jsx)(i.Card,{className:t.cn(g&&`border-red-500/50`),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-5 w-5 text-muted-foreground`})}),h!==void 0&&(0,u.jsxs)(n.Badge,{variant:`outline`,className:t.cn(h>0?`text-red-500`:`text-green-500`),children:[h>0?(0,u.jsx)(l.ArrowUpRight,{className:`h-3 w-3 mr-1`}):(0,u.jsx)(l.ArrowDownRight,{className:`h-3 w-3 mr-1`}),m(Math.abs(h))]})]}),(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsx)(`div`,{className:`text-2xl font-bold`,children:p(r)}),(0,u.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e})]}),_!==void 0&&(0,u.jsxs)(`div`,{className:`mt-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Budget`}),(0,u.jsxs)(`span`,{className:t.cn(g&&`text-red-500`),children:[p(r),` / `,p(d)]})]}),(0,u.jsx)(o.Progress,{value:Math.min(_,100),className:t.cn(`h-2`,_>100&&`[&>div]:bg-red-500`,_>80&&_<=100&&`[&>div]:bg-yellow-500`)})]}),f!==void 0&&(0,u.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Forecast: `,p(f)]})]})})}function g({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);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.PieChart,{className:`h-4 w-4`}),`Cost by Category`]})}),(0,u.jsx)(i.CardContent,{className:`space-y-3`,children:r.map(([e,r])=>{let i=d[e],a=i.icon,s=r/n*100;return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(a,{className:t.cn(`h-4 w-4`,i.color)}),(0,u.jsx)(`span`,{className:`text-sm`,children:i.label})]}),(0,u.jsxs)(`div`,{className:`text-sm font-medium`,children:[p(r),(0,u.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,s.toFixed(0),`%)`]})]})]}),(0,u.jsx)(o.Progress,{value:s,className:`h-2`})]},e)})})]})}function _({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).filter(([e])=>e!==`all`).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);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.Cloud,{className:`h-4 w-4`}),`Cost by Provider`]})}),(0,u.jsx)(i.CardContent,{className:`space-y-3`,children:r.map(([e,r])=>{let i=f[e],a=r/n*100;return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,u.jsx)(`span`,{className:t.cn(`text-sm font-medium`,i.color),children:i.label}),(0,u.jsxs)(`div`,{className:`text-sm font-medium`,children:[p(r),(0,u.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,a.toFixed(0),`%)`]})]})]}),(0,u.jsx)(o.Progress,{value:a,className:`h-2`})]},e)})})]})}function v({items:e}){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.BarChart3,{className:`h-4 w-4`}),`Top Services by Cost`]})}),(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,n)=>{let r=d[e.category],i=r.icon,a=f[e.provider],o=e.previousCost===void 0?e.trend:(e.cost-e.previousCost)/e.previousCost*100;return(0,u.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors`,children:[(0,u.jsx)(`div`,{className:`text-lg font-bold text-muted-foreground w-6 text-center`,children:n+1}),(0,u.jsx)(`div`,{className:t.cn(`p-1.5 rounded`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,u.jsx)(i,{className:t.cn(`h-4 w-4`,r.color)})}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[(0,u.jsx)(`span`,{className:a.color,children:a.label}),(0,u.jsx)(`span`,{children:`•`}),(0,u.jsx)(`span`,{children:r.label}),e.usage!==void 0&&e.unit&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{children:`•`}),(0,u.jsxs)(`span`,{children:[e.usage,` `,e.unit]})]})]})]}),(0,u.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,u.jsx)(`div`,{className:`font-semibold`,children:p(e.cost)}),o!==void 0&&(0,u.jsxs)(`div`,{className:t.cn(`text-xs flex items-center justify-end gap-0.5`,o>0?`text-red-500`:`text-green-500`),children:[o>0?(0,u.jsx)(l.TrendingUp,{className:`h-3 w-3`}):(0,u.jsx)(l.TrendingDown,{className:`h-3 w-3`}),m(Math.abs(o))]})]})]},e.id)})})})})]})}function y({anomalies:e,onAcknowledge:r}){let a=e.filter(e=>e.status===`new`);return(0,u.jsxs)(i.Card,{className:t.cn(a.length>0&&`border-yellow-500/50`),children:[(0,u.jsx)(i.CardHeader,{className:`pb-2`,children:(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,u.jsxs)(i.CardTitle,{className:`text-base flex items-center gap-2`,children:[(0,u.jsx)(l.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Cost Anomalies`]}),a.length>0&&(0,u.jsxs)(n.Badge,{className:`bg-yellow-500`,children:[a.length,` new`]})]})}),(0,u.jsx)(i.CardContent,{children:e.length===0?(0,u.jsxs)(`div`,{className:`text-center text-muted-foreground py-4`,children:[(0,u.jsx)(l.Zap,{className:`h-8 w-8 mx-auto mb-2 text-green-500`}),(0,u.jsx)(`p`,{children:`No anomalies detected`})]}):(0,u.jsx)(`div`,{className:`space-y-2`,children:e.slice(0,5).map(e=>(0,u.jsxs)(`div`,{className:t.cn(`flex items-center gap-3 p-2 rounded-lg`,e.status===`new`&&`bg-yellow-500/10`),children:[(0,u.jsx)(l.AlertTriangle,{className:t.cn(`h-4 w-4 shrink-0`,e.deviation>100?`text-red-500`:`text-yellow-500`)}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,u.jsx)(`div`,{className:`font-medium truncate`,children:e.service}),(0,u.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expected `,p(e.expectedCost),` • Actual `,p(e.actualCost)]})]}),(0,u.jsxs)(n.Badge,{variant:`outline`,className:`text-red-500 shrink-0`,children:[`+`,e.deviation.toFixed(0),`%`]})]},e.id))})})]})}function b({summary:e,items:n,anomalies:o=[],timeRange:s=`month`,onTimeRangeChange:d,onProviderFilter:f,onExport:p,onRefresh:m,className:b}){let[x,S]=c.useState(`all`),C=e=>{S(e),f?.(e)},w=c.useMemo(()=>x===`all`?n:n.filter(e=>e.provider===x),[n,x]);return e.previousTotalCost!==void 0&&(e.totalCost-e.previousTotalCost)/e.previousTotalCost*100,(0,u.jsxs)(`div`,{className:t.cn(`space-y-6`,b),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.DollarSign,{className:`h-6 w-6`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(i.CardTitle,{children:`Cloud Cost Dashboard`}),(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor and optimize your cloud spending`})]})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsxs)(a.Select,{value:s,onValueChange:e=>d?.(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-32`,children:[(0,u.jsx)(l.Calendar,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`day`,children:`Today`}),(0,u.jsx)(a.SelectItem,{value:`week`,children:`This Week`}),(0,u.jsx)(a.SelectItem,{value:`month`,children:`This Month`}),(0,u.jsx)(a.SelectItem,{value:`quarter`,children:`This Quarter`}),(0,u.jsx)(a.SelectItem,{value:`year`,children:`This Year`})]})]}),(0,u.jsxs)(a.Select,{value:x,onValueChange:e=>C(e),children:[(0,u.jsxs)(a.SelectTrigger,{className:`w-32`,children:[(0,u.jsx)(l.Cloud,{className:`h-4 w-4 mr-2`}),(0,u.jsx)(a.SelectValue,{})]}),(0,u.jsxs)(a.SelectContent,{children:[(0,u.jsx)(a.SelectItem,{value:`all`,children:`All Providers`}),(0,u.jsx)(a.SelectItem,{value:`aws`,children:`AWS`}),(0,u.jsx)(a.SelectItem,{value:`gcp`,children:`GCP`}),(0,u.jsx)(a.SelectItem,{value:`azure`,children:`Azure`})]})]}),m&&(0,u.jsx)(r.Button,{variant:`outline`,size:`icon`,onClick:m,children:(0,u.jsx)(l.RefreshCw,{className:`h-4 w-4`})}),p&&(0,u.jsxs)(r.Button,{variant:`outline`,onClick:p,children:[(0,u.jsx)(l.Download,{className:`h-4 w-4 mr-1`}),`Export`]})]})]})})}),(0,u.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,u.jsx)(h,{title:`Total Cost`,value:e.totalCost,previousValue:e.previousTotalCost,icon:l.DollarSign,budget:e.budget}),(0,u.jsx)(h,{title:`Compute`,value:e.byCategory.compute,icon:l.Cpu,trend:-5.2}),(0,u.jsx)(h,{title:`Storage`,value:e.byCategory.storage,icon:l.HardDrive,trend:12.3}),(0,u.jsx)(h,{title:`Forecast (EOM)`,value:e.forecast||e.totalCost*1.1,icon:l.TrendingUp,budget:e.budget})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,u.jsx)(`div`,{className:`col-span-2 space-y-6`,children:(0,u.jsx)(v,{items:w.slice(0,10)})}),(0,u.jsxs)(`div`,{className:`space-y-6`,children:[(0,u.jsx)(g,{data:e.byCategory}),(0,u.jsx)(_,{data:e.byProvider}),(0,u.jsx)(y,{anomalies:o})]})]})]})}var x={totalCost:45230,previousTotalCost:42100,budget:5e4,forecast:48500,byProvider:{aws:28500,gcp:12300,azure:4430,all:45230},byCategory:{compute:22e3,storage:8500,database:7200,network:4100,security:1800,other:1630},topServices:[]},S=[{id:`1`,name:`EC2 Instances`,category:`compute`,provider:`aws`,cost:12500,previousCost:11800,usage:450,unit:`hours`},{id:`2`,name:`RDS PostgreSQL`,category:`database`,provider:`aws`,cost:4200,previousCost:4e3},{id:`3`,name:`S3 Storage`,category:`storage`,provider:`aws`,cost:3800,previousCost:3200,usage:12,unit:`TB`},{id:`4`,name:`GKE Clusters`,category:`compute`,provider:`gcp`,cost:6500,previousCost:6800},{id:`5`,name:`Cloud SQL`,category:`database`,provider:`gcp`,cost:2800,previousCost:2600},{id:`6`,name:`BigQuery`,category:`database`,provider:`gcp`,cost:1800,previousCost:1500,usage:45,unit:`TB scanned`},{id:`7`,name:`Azure VMs`,category:`compute`,provider:`azure`,cost:2400,previousCost:2200},{id:`8`,name:`Blob Storage`,category:`storage`,provider:`azure`,cost:1200,previousCost:1100},{id:`9`,name:`CloudFront CDN`,category:`network`,provider:`aws`,cost:2100,previousCost:1900,usage:85,unit:`TB`},{id:`10`,name:`Lambda Functions`,category:`compute`,provider:`aws`,cost:850,previousCost:720,usage:12e6,unit:`invocations`}],C=[{id:`1`,service:`EC2 Spot Instances`,expectedCost:500,actualCost:1250,deviation:150,timestamp:new Date,status:`new`},{id:`2`,service:`Data Transfer`,expectedCost:800,actualCost:1400,deviation:75,timestamp:new Date(Date.now()-36e5),status:`new`},{id:`3`,service:`Lambda`,expectedCost:200,actualCost:320,deviation:60,timestamp:new Date(Date.now()-72e5),status:`acknowledged`}];exports.CloudCostDashboard=b,exports.defaultCloudCostItems=S,exports.defaultCloudCostSummary=x,exports.defaultCostAnomalies=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/badge/index.cjs.js`),r=require(`../../components/button/index.cjs.js`),i=require(`../../components/card/index.cjs.js`),a=require(`../../components/dropdown-menu/index.cjs.js`),o=require(`../../components/input/index.cjs.js`),s=require(`../../components/select/index.cjs.js`),c=require(`../../components/progress/index.cjs.js`),l=require(`../../components/scroll-area/index.cjs.js`);let u=require(`react`);u=e.__toESM(u);let d=require(`lucide-react`),f=require(`react/jsx-runtime`);var p={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Stopped`},paused:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Paused`},restarting:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Restarting`},creating:{color:`text-blue-400`,bgColor:`bg-blue-400`,label:`Creating`},removing:{color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Removing`},exited:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Exited`},dead:{color:`text-red-600`,bgColor:`bg-red-600`,label:`Dead`}},m={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},updating:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Updating`},scaled:{color:`text-purple-500`,bgColor:`bg-purple-500`,label:`Scaling`},failed:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},pending:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Pending`}};function h(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function g(e){if(!e)return`N/A`;let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function _({container:e,onViewLogs:i,onExecShell:o}){let s=p[e.status],l=e.resources.memory/e.resources.memoryLimit*100;return(0,f.jsx)(`div`,{className:t.cn(`border rounded-lg p-3 transition-all hover:bg-muted/30`,e.status===`exited`&&`border-red-500/30 bg-red-500/5`,e.healthCheck===`unhealthy`&&`border-yellow-500/30`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(d.Container,{className:t.cn(`h-5 w-5`,s.color)}),e.healthCheck&&e.healthCheck!==`none`&&(0,f.jsx)(`div`,{className:t.cn(`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background`,e.healthCheck===`healthy`&&`bg-green-500`,e.healthCheck===`unhealthy`&&`bg-red-500`,e.healthCheck===`starting`&&`bg-yellow-500`)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.name}),(0,f.jsx)(n.Badge,{variant:`outline`,className:t.cn(`text-xs`,s.color),children:s.label})]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 truncate`,children:e.image}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mt-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(d.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,f.jsx)(c.Progress,{value:e.resources.cpu,className:t.cn(`h-1`,e.resources.cpu>80&&`[&>div]:bg-red-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(d.MemoryStick,{className:`h-3 w-3`}),` MEM`]}),(0,f.jsxs)(`span`,{children:[e.resources.memory,`MB`]})]}),(0,f.jsx)(c.Progress,{value:l,className:t.cn(`h-1`,l>80&&`[&>div]:bg-red-500`)})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.Clock,{className:`h-3 w-3`}),g(e.startedAt)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.ArrowDown,{className:`h-3 w-3`}),h(e.resources.networkRx),`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.ArrowUp,{className:`h-3 w-3`}),h(e.resources.networkTx),`/s`]}),e.restartCount!==void 0&&e.restartCount>0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-500`,children:[(0,f.jsx)(d.RefreshCw,{className:`h-3 w-3`}),e.restartCount,` restarts`]})]})]}),(0,f.jsxs)(a.DropdownMenu,{children:[(0,f.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(d.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(a.DropdownMenuContent,{align:`end`,children:[i&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:i,children:[(0,f.jsx)(d.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),o&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:o,children:[(0,f.jsx)(d.Terminal,{className:`h-4 w-4 mr-2`}),`Shell`]})]})]})]})})}function v({service:e,onScale:s,onRestart:l,onStop:p,onDelete:h,onViewLogs:g,onExecShell:v}){let[y,b]=u.useState(!1),[x,S]=u.useState(e.replicas.desired),C=m[e.status],w=e.containers.every(e=>e.status===`running`),T=e.replicas.running/e.replicas.desired*100;return(0,f.jsx)(i.Card,{className:t.cn(e.status===`failed`&&`border-red-500/50`,!w&&`border-yellow-500/30`),children:(0,f.jsxs)(i.CardContent,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.cn(`p-2 rounded-lg`,`${C.bgColor}/10`),children:(0,f.jsx)(d.Layers,{className:t.cn(`h-5 w-5`,C.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.Badge,{className:t.cn(`text-white text-xs`,C.bgColor),children:C.label})]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-1`,children:e.image}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Replicas`}),(0,f.jsxs)(`span`,{className:t.cn(e.replicas.running<e.replicas.desired&&`text-yellow-500`),children:[e.replicas.running,`/`,e.replicas.desired,` running`,e.replicas.ready<e.replicas.running&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.replicas.ready,` ready)`]})]})]}),(0,f.jsx)(c.Progress,{value:T,className:t.cn(`h-2`,T<100&&`[&>div]:bg-yellow-500`,e.status===`failed`&&`[&>div]:bg-red-500`)})]}),e.updateStatus&&(0,f.jsxs)(`div`,{className:`mt-3 p-2 bg-muted/50 rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500`,children:[(0,f.jsx)(d.RefreshCw,{className:`h-3 w-3 animate-spin`}),e.updateStatus.state]}),(0,f.jsxs)(`span`,{children:[e.updateStatus.progress,`%`]})]}),e.updateStatus.message&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.updateStatus.message}),(0,f.jsx)(c.Progress,{value:e.updateStatus.progress,className:`h-1 mt-2`})]}),e.ports&&e.ports.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(d.Network,{className:`h-3 w-3`}),e.ports.map((t,n)=>(0,f.jsxs)(`span`,{children:[t.published,`:`,t.target,n<e.ports.length-1&&`,`]},n))]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 border rounded`,children:[(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=Math.max(0,x-1);S(e),s?.(e)},children:(0,f.jsx)(d.Minus,{className:`h-4 w-4`})}),(0,f.jsx)(o.Input,{type:`number`,value:x,onChange:e=>{S(parseInt(e.target.value)||0)},onBlur:()=>s?.(x),className:`w-12 h-8 text-center border-0 p-0`,min:0}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=x+1;S(e),s?.(e)},children:(0,f.jsx)(d.Plus,{className:`h-4 w-4`})})]}),(0,f.jsxs)(a.DropdownMenu,{children:[(0,f.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,f.jsx)(r.Button,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(d.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(a.DropdownMenuContent,{align:`end`,children:[l&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:l,children:[(0,f.jsx)(d.RefreshCw,{className:`h-4 w-4 mr-2`}),`Restart`]}),p&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:p,children:[(0,f.jsx)(d.Square,{className:`h-4 w-4 mr-2`}),`Stop`]}),(0,f.jsx)(a.DropdownMenuSeparator,{}),h&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:h,className:`text-destructive`,children:[(0,f.jsx)(d.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>b(!y),children:[(0,f.jsx)(d.Eye,{className:`h-4 w-4 mr-1`}),y?`Hide`:`Show`,` Containers`]})]})]}),y&&(0,f.jsx)(`div`,{className:`mt-4 pt-4 border-t space-y-2`,children:e.containers.length===0?(0,f.jsx)(`div`,{className:`text-center text-muted-foreground py-4`,children:`No containers running`}):e.containers.map(e=>(0,f.jsx)(_,{container:e,onViewLogs:g?()=>g(e):void 0,onExecShell:v?()=>v(e):void 0},e.id))})]})})}function y({services:e}){let t=u.useMemo(()=>{let t=e.length,n=e.reduce((e,t)=>e+t.containers.length,0),r=e.reduce((e,t)=>e+t.containers.filter(e=>e.status===`running`).length,0),i=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.cpu,0),0),a=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.memory,0),0);return{totalServices:t,totalContainers:n,runningContainers:r,avgCpu:i/n,totalMemory:a}},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-5 gap-4`,children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalServices}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Services`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Containers`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.runningContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Running`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[t.avgCpu.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg CPU`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(t.totalMemory/1024).toFixed(1),`GB`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Memory`})]})})]})}function b({services:e,onScaleService:n,onRestartService:a,onStopService:c,onDeleteService:p,onViewLogs:m,onExecShell:h,onRefresh:g,className:_}){let[b,x]=u.useState(``),[S,C]=u.useState(`all`),w=u.useMemo(()=>e.filter(e=>!(b&&!e.name.toLowerCase().includes(b.toLowerCase())||S!==`all`&&e.status!==S)),[e,b,S]);return(0,f.jsxs)(`div`,{className:t.cn(`space-y-6`,_),children:[(0,f.jsx)(i.Card,{children:(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(d.Container,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(i.CardTitle,{children:`Container Orchestrator`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage and monitor containerized services`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,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:`Search services...`,value:b,onChange:e=>x(e.target.value),className:`pl-9 w-64`})]}),(0,f.jsxs)(s.Select,{value:S,onValueChange:e=>C(e),children:[(0,f.jsx)(s.SelectTrigger,{className:`w-32`,children:(0,f.jsx)(s.SelectValue,{placeholder:`Status`})}),(0,f.jsxs)(s.SelectContent,{children:[(0,f.jsx)(s.SelectItem,{value:`all`,children:`All Status`}),(0,f.jsx)(s.SelectItem,{value:`running`,children:`Running`}),(0,f.jsx)(s.SelectItem,{value:`updating`,children:`Updating`}),(0,f.jsx)(s.SelectItem,{value:`failed`,children:`Failed`}),(0,f.jsx)(s.SelectItem,{value:`pending`,children:`Pending`})]})]}),g&&(0,f.jsx)(r.Button,{variant:`outline`,onClick:g,children:(0,f.jsx)(d.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(y,{services:e}),(0,f.jsx)(l.ScrollArea,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:w.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(d.Container,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No services found`})]}):w.map(e=>(0,f.jsx)(v,{service:e,onScale:n?t=>n(e,t):void 0,onRestart:a?()=>a(e):void 0,onStop:c?()=>c(e):void 0,onDelete:p?()=>p(e):void 0,onViewLogs:m,onExecShell:h},e.id))})})]})}function x(e,t){return Array.from({length:t},(t,n)=>({id:`${e}-${n+1}`,name:`${e}-${n+1}`,image:`myregistry/${e}:latest`,status:`running`,createdAt:new Date(Date.now()-(n+1)*36e5),startedAt:new Date(Date.now()-n*36e5),healthCheck:`healthy`,restartCount:Math.floor(Math.random()*3),node:`node-${Math.floor(Math.random()*3)+1}`,resources:{cpu:Math.random()*50+10,memory:Math.floor(Math.random()*500+200),memoryLimit:1024,networkRx:Math.floor(Math.random()*1e6),networkTx:Math.floor(Math.random()*5e5)}}))}var S=[{id:`1`,name:`api-gateway`,image:`myregistry/api-gateway:v2.4.1`,status:`running`,replicas:{desired:3,running:3,ready:3},containers:x(`api-gateway`,3),ports:[{published:80,target:8080},{published:443,target:8443}],createdAt:new Date(Date.now()-168*36e5),updatedAt:new Date(Date.now()-48*36e5)},{id:`2`,name:`user-service`,image:`myregistry/user-service:v1.8.0`,status:`updating`,replicas:{desired:2,running:2,ready:1},containers:x(`user-service`,2),updateStatus:{state:`updating`,progress:50,message:`Updating replica 1 of 2`},ports:[{published:8081,target:8080}],createdAt:new Date(Date.now()-336*36e5),updatedAt:new Date},{id:`3`,name:`payment-service`,image:`myregistry/payment-service:v3.1.0`,status:`running`,replicas:{desired:2,running:2,ready:2},containers:x(`payment-service`,2),ports:[{published:8082,target:8080}],createdAt:new Date(Date.now()-720*36e5),updatedAt:new Date(Date.now()-120*36e5)},{id:`4`,name:`notification-worker`,image:`myregistry/notification-worker:v2.0.0`,status:`running`,replicas:{desired:5,running:5,ready:5},containers:x(`notification-worker`,5),createdAt:new Date(Date.now()-504*36e5),updatedAt:new Date(Date.now()-168*36e5)},{id:`5`,name:`analytics-pipeline`,image:`myregistry/analytics:v1.2.0`,status:`failed`,replicas:{desired:3,running:1,ready:1},containers:[...x(`analytics-pipeline`,1),{id:`analytics-pipeline-2`,name:`analytics-pipeline-2`,image:`myregistry/analytics:v1.2.0`,status:`exited`,createdAt:new Date(Date.now()-2*36e5),healthCheck:`unhealthy`,restartCount:5,node:`node-2`,resources:{cpu:0,memory:0,memoryLimit:1024,networkRx:0,networkTx:0}}],createdAt:new Date(Date.now()-240*36e5),updatedAt:new Date(Date.now()-24*36e5)}];exports.ContainerOrchestrator=b,exports.defaultOrchestratorServices=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"),a=require("../../components/dropdown-menu/index.cjs.js"),o=require("../../components/input/index.cjs.js"),s=require("../../components/select/index.cjs.js"),c=require("../../components/progress/index.cjs.js"),l=require("../../components/scroll-area/index.cjs.js");let u=require("react");u=e.__toESM(u);let d=require("lucide-react"),f=require("react/jsx-runtime");var p={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Stopped`},paused:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Paused`},restarting:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Restarting`},creating:{color:`text-blue-400`,bgColor:`bg-blue-400`,label:`Creating`},removing:{color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Removing`},exited:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Exited`},dead:{color:`text-red-600`,bgColor:`bg-red-600`,label:`Dead`}},m={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},updating:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Updating`},scaled:{color:`text-purple-500`,bgColor:`bg-purple-500`,label:`Scaling`},failed:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},pending:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Pending`}};function h(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function g(e){if(!e)return`N/A`;let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function _({container:e,onViewLogs:i,onExecShell:o}){let s=p[e.status],l=e.resources.memory/e.resources.memoryLimit*100;return(0,f.jsx)(`div`,{className:t.cn(`border rounded-lg p-3 transition-all hover:bg-muted/30`,e.status===`exited`&&`border-red-500/30 bg-red-500/5`,e.healthCheck===`unhealthy`&&`border-yellow-500/30`),children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(d.Container,{className:t.cn(`h-5 w-5`,s.color)}),e.healthCheck&&e.healthCheck!==`none`&&(0,f.jsx)(`div`,{className:t.cn(`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background`,e.healthCheck===`healthy`&&`bg-green-500`,e.healthCheck===`unhealthy`&&`bg-red-500`,e.healthCheck===`starting`&&`bg-yellow-500`)})]}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.name}),(0,f.jsx)(n.Badge,{variant:`outline`,className:t.cn(`text-xs`,s.color),children:s.label})]}),(0,f.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 truncate`,children:e.image}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mt-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(d.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,f.jsxs)(`span`,{children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,f.jsx)(c.Progress,{value:e.resources.cpu,className:t.cn(`h-1`,e.resources.cpu>80&&`[&>div]:bg-red-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,f.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,f.jsx)(d.MemoryStick,{className:`h-3 w-3`}),` MEM`]}),(0,f.jsxs)(`span`,{children:[e.resources.memory,`MB`]})]}),(0,f.jsx)(c.Progress,{value:l,className:t.cn(`h-1`,l>80&&`[&>div]:bg-red-500`)})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.Clock,{className:`h-3 w-3`}),g(e.startedAt)]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.ArrowDown,{className:`h-3 w-3`}),h(e.resources.networkRx),`/s`]}),(0,f.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(d.ArrowUp,{className:`h-3 w-3`}),h(e.resources.networkTx),`/s`]}),e.restartCount!==void 0&&e.restartCount>0&&(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-500`,children:[(0,f.jsx)(d.RefreshCw,{className:`h-3 w-3`}),e.restartCount,` restarts`]})]})]}),(0,f.jsxs)(a.DropdownMenu,{children:[(0,f.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(d.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(a.DropdownMenuContent,{align:`end`,children:[i&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:i,children:[(0,f.jsx)(d.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),o&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:o,children:[(0,f.jsx)(d.Terminal,{className:`h-4 w-4 mr-2`}),`Shell`]})]})]})]})})}function v({service:e,onScale:s,onRestart:l,onStop:p,onDelete:h,onViewLogs:g,onExecShell:v}){let[y,b]=u.useState(!1),[x,S]=u.useState(e.replicas.desired),C=m[e.status],w=e.containers.every(e=>e.status===`running`),T=e.replicas.running/e.replicas.desired*100;return(0,f.jsx)(i.Card,{className:t.cn(e.status===`failed`&&`border-red-500/50`,!w&&`border-yellow-500/30`),children:(0,f.jsxs)(i.CardContent,{className:`p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsx)(`div`,{className:t.cn(`p-2 rounded-lg`,`${C.bgColor}/10`),children:(0,f.jsx)(d.Layers,{className:t.cn(`h-5 w-5`,C.color)})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`h4`,{className:`font-semibold`,children:e.name}),(0,f.jsx)(n.Badge,{className:t.cn(`text-white text-xs`,C.bgColor),children:C.label})]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground mt-1`,children:e.image}),(0,f.jsxs)(`div`,{className:`mt-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`Replicas`}),(0,f.jsxs)(`span`,{className:t.cn(e.replicas.running<e.replicas.desired&&`text-yellow-500`),children:[e.replicas.running,`/`,e.replicas.desired,` running`,e.replicas.ready<e.replicas.running&&(0,f.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.replicas.ready,` ready)`]})]})]}),(0,f.jsx)(c.Progress,{value:T,className:t.cn(`h-2`,T<100&&`[&>div]:bg-yellow-500`,e.status===`failed`&&`[&>div]:bg-red-500`)})]}),e.updateStatus&&(0,f.jsxs)(`div`,{className:`mt-3 p-2 bg-muted/50 rounded text-sm`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500`,children:[(0,f.jsx)(d.RefreshCw,{className:`h-3 w-3 animate-spin`}),e.updateStatus.state]}),(0,f.jsxs)(`span`,{children:[e.updateStatus.progress,`%`]})]}),e.updateStatus.message&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.updateStatus.message}),(0,f.jsx)(c.Progress,{value:e.updateStatus.progress,className:`h-1 mt-2`})]}),e.ports&&e.ports.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(d.Network,{className:`h-3 w-3`}),e.ports.map((t,n)=>(0,f.jsxs)(`span`,{children:[t.published,`:`,t.target,n<e.ports.length-1&&`,`]},n))]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1 border rounded`,children:[(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=Math.max(0,x-1);S(e),s?.(e)},children:(0,f.jsx)(d.Minus,{className:`h-4 w-4`})}),(0,f.jsx)(o.Input,{type:`number`,value:x,onChange:e=>{let t=parseInt(e.target.value)||0;S(t)},onBlur:()=>s?.(x),className:`w-12 h-8 text-center border-0 p-0`,min:0}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=x+1;S(e),s?.(e)},children:(0,f.jsx)(d.Plus,{className:`h-4 w-4`})})]}),(0,f.jsxs)(a.DropdownMenu,{children:[(0,f.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,f.jsx)(r.Button,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,f.jsx)(d.MoreVertical,{className:`h-4 w-4`})})}),(0,f.jsxs)(a.DropdownMenuContent,{align:`end`,children:[l&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:l,children:[(0,f.jsx)(d.RefreshCw,{className:`h-4 w-4 mr-2`}),`Restart`]}),p&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:p,children:[(0,f.jsx)(d.Square,{className:`h-4 w-4 mr-2`}),`Stop`]}),(0,f.jsx)(a.DropdownMenuSeparator,{}),h&&(0,f.jsxs)(a.DropdownMenuItem,{onClick:h,className:`text-destructive`,children:[(0,f.jsx)(d.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,f.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>b(!y),children:[(0,f.jsx)(d.Eye,{className:`h-4 w-4 mr-1`}),y?`Hide`:`Show`,` Containers`]})]})]}),y&&(0,f.jsx)(`div`,{className:`mt-4 pt-4 border-t space-y-2`,children:e.containers.length===0?(0,f.jsx)(`div`,{className:`text-center text-muted-foreground py-4`,children:`No containers running`}):e.containers.map(e=>(0,f.jsx)(_,{container:e,onViewLogs:g?()=>g(e):void 0,onExecShell:v?()=>v(e):void 0},e.id))})]})})}function y({services:e}){let t=u.useMemo(()=>{let t=e.length,n=e.reduce((e,t)=>e+t.containers.length,0),r=e.reduce((e,t)=>e+t.containers.filter(e=>e.status===`running`).length,0),i=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.cpu,0),0),a=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.memory,0),0);return{totalServices:t,totalContainers:n,runningContainers:r,avgCpu:i/n,totalMemory:a}},[e]);return(0,f.jsxs)(`div`,{className:`grid grid-cols-5 gap-4`,children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalServices}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Services`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Containers`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.runningContainers}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Running`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[t.avgCpu.toFixed(1),`%`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg CPU`})]})}),(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.CardContent,{className:`p-4 text-center`,children:[(0,f.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(t.totalMemory/1024).toFixed(1),`GB`]}),(0,f.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Memory`})]})})]})}function b({services:e,onScaleService:n,onRestartService:a,onStopService:c,onDeleteService:p,onViewLogs:m,onExecShell:h,onRefresh:g,className:_}){let[b,x]=u.useState(``),[S,C]=u.useState(`all`),w=u.useMemo(()=>e.filter(e=>!(b&&!e.name.toLowerCase().includes(b.toLowerCase())||S!==`all`&&e.status!==S)),[e,b,S]);return(0,f.jsxs)(`div`,{className:t.cn(`space-y-6`,_),children:[(0,f.jsx)(i.Card,{children:(0,f.jsx)(i.CardHeader,{children:(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(d.Container,{className:`h-6 w-6`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(i.CardTitle,{children:`Container Orchestrator`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage and monitor containerized services`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,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:`Search services...`,value:b,onChange:e=>x(e.target.value),className:`pl-9 w-64`})]}),(0,f.jsxs)(s.Select,{value:S,onValueChange:e=>C(e),children:[(0,f.jsx)(s.SelectTrigger,{className:`w-32`,children:(0,f.jsx)(s.SelectValue,{placeholder:`Status`})}),(0,f.jsxs)(s.SelectContent,{children:[(0,f.jsx)(s.SelectItem,{value:`all`,children:`All Status`}),(0,f.jsx)(s.SelectItem,{value:`running`,children:`Running`}),(0,f.jsx)(s.SelectItem,{value:`updating`,children:`Updating`}),(0,f.jsx)(s.SelectItem,{value:`failed`,children:`Failed`}),(0,f.jsx)(s.SelectItem,{value:`pending`,children:`Pending`})]})]}),g&&(0,f.jsx)(r.Button,{variant:`outline`,onClick:g,children:(0,f.jsx)(d.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,f.jsx)(y,{services:e}),(0,f.jsx)(l.ScrollArea,{className:`h-[500px]`,children:(0,f.jsx)(`div`,{className:`space-y-4 pr-4`,children:w.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,f.jsx)(d.Container,{className:`h-12 w-12 mb-4`}),(0,f.jsx)(`p`,{className:`text-lg font-medium`,children:`No services found`})]}):w.map(e=>(0,f.jsx)(v,{service:e,onScale:n?t=>n(e,t):void 0,onRestart:a?()=>a(e):void 0,onStop:c?()=>c(e):void 0,onDelete:p?()=>p(e):void 0,onViewLogs:m,onExecShell:h},e.id))})})]})}function x(e,t){return Array.from({length:t},(t,n)=>({id:`${e}-${n+1}`,name:`${e}-${n+1}`,image:`myregistry/${e}:latest`,status:`running`,createdAt:new Date(Date.now()-(n+1)*36e5),startedAt:new Date(Date.now()-n*36e5),healthCheck:`healthy`,restartCount:Math.floor(Math.random()*3),node:`node-${Math.floor(Math.random()*3)+1}`,resources:{cpu:Math.random()*50+10,memory:Math.floor(Math.random()*500+200),memoryLimit:1024,networkRx:Math.floor(Math.random()*1e6),networkTx:Math.floor(Math.random()*5e5)}}))}var S=[{id:`1`,name:`api-gateway`,image:`myregistry/api-gateway:v2.4.1`,status:`running`,replicas:{desired:3,running:3,ready:3},containers:x(`api-gateway`,3),ports:[{published:80,target:8080},{published:443,target:8443}],createdAt:new Date(Date.now()-168*36e5),updatedAt:new Date(Date.now()-48*36e5)},{id:`2`,name:`user-service`,image:`myregistry/user-service:v1.8.0`,status:`updating`,replicas:{desired:2,running:2,ready:1},containers:x(`user-service`,2),updateStatus:{state:`updating`,progress:50,message:`Updating replica 1 of 2`},ports:[{published:8081,target:8080}],createdAt:new Date(Date.now()-336*36e5),updatedAt:new Date},{id:`3`,name:`payment-service`,image:`myregistry/payment-service:v3.1.0`,status:`running`,replicas:{desired:2,running:2,ready:2},containers:x(`payment-service`,2),ports:[{published:8082,target:8080}],createdAt:new Date(Date.now()-720*36e5),updatedAt:new Date(Date.now()-120*36e5)},{id:`4`,name:`notification-worker`,image:`myregistry/notification-worker:v2.0.0`,status:`running`,replicas:{desired:5,running:5,ready:5},containers:x(`notification-worker`,5),createdAt:new Date(Date.now()-504*36e5),updatedAt:new Date(Date.now()-168*36e5)},{id:`5`,name:`analytics-pipeline`,image:`myregistry/analytics:v1.2.0`,status:`failed`,replicas:{desired:3,running:1,ready:1},containers:[...x(`analytics-pipeline`,1),{id:`analytics-pipeline-2`,name:`analytics-pipeline-2`,image:`myregistry/analytics:v1.2.0`,status:`exited`,createdAt:new Date(Date.now()-2*36e5),healthCheck:`unhealthy`,restartCount:5,node:`node-2`,resources:{cpu:0,memory:0,memoryLimit:1024,networkRx:0,networkTx:0}}],createdAt:new Date(Date.now()-240*36e5),updatedAt:new Date(Date.now()-24*36e5)}];exports.ContainerOrchestrator=b,exports.defaultOrchestratorServices=S;
|
|
@@ -311,7 +311,8 @@ function K({ service: a, onScale: o, onRestart: p, onStop: m, onDelete: h, onVie
|
|
|
311
311
|
type: "number",
|
|
312
312
|
value: S,
|
|
313
313
|
onChange: (e) => {
|
|
314
|
-
|
|
314
|
+
let t = parseInt(e.target.value) || 0;
|
|
315
|
+
C(t);
|
|
315
316
|
},
|
|
316
317
|
onBlur: () => o?.(S),
|
|
317
318
|
className: "w-12 h-8 text-center border-0 p-0",
|
|
@@ -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/card/index.cjs.js"),i=require("../../components/dropdown-menu/index.cjs.js"),a=require("../../components/waka-stat/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");var l=o.createContext({});function u(){return o.useContext(l)}function d({title:e=`Tableau de bord`,description:r,period:a,onPeriodChange:o,periods:l=[{value:`today`,label:`Aujourd'hui`},{value:`week`,label:`Cette semaine`},{value:`month`,label:`Ce mois`},{value:`year`,label:`Cette année`}],onRefresh:d,loading:f,quickActions:p}){return(0,c.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),r&&(0,c.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:r})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[o&&(0,c.jsxs)(i.DropdownMenu,{children:[(0,c.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,c.jsxs)(n.Button,{variant:`outline`,size:`sm`,children:[(0,c.jsx)(s.Calendar,{className:`mr-2 h-4 w-4`}),l.find(e=>e.value===a)?.label||`Période`]})}),(0,c.jsx)(i.DropdownMenuContent,{align:`end`,children:l.map(e=>(0,c.jsx)(i.DropdownMenuItem,{onClick:()=>o(e.value),className:t.cn(a===e.value&&`bg-muted`),children:e.label},e.value))})]}),d&&(0,c.jsx)(n.Button,{variant:`outline`,size:`sm`,onClick:d,disabled:f,children:(0,c.jsx)(s.RefreshCw,{className:t.cn(`h-4 w-4`,f&&`animate-spin`)})}),p?.map(e=>{let{LinkComponent:t}=u();return(0,c.jsx)(n.Button,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,c.jsxs)(t,{href:e.href,children:[e.icon&&(0,c.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,c.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,c.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,c.jsxs)(c.Fragment,{children:[e.icon&&(0,c.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},e.id)})]})]})}function f({stats:e,layout:t=`grid`,columns:n=4,loading:r}){return(0,c.jsx)(a.WakaStatGroup,{layout:t,columns:n,gap:`md`,children:e.map(e=>(0,c.jsx)(a.WakaStat,{label:e.label,value:e.value,trend:e.trend,trendValue:e.trendValue,trendText:e.trendText,icon:e.icon,color:e.color,variant:`card`,loading:r},e.id))})}function p({config:e}){return(0,c.jsxs)(r.Card,{children:[(0,c.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.CardTitle,{className:`text-base`,children:e.title}),e.description&&(0,c.jsx)(r.CardDescription,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,c.jsxs)(i.DropdownMenu,{children:[(0,c.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,c.jsx)(s.MoreHorizontal,{className:`h-4 w-4`})})}),(0,c.jsx)(i.DropdownMenuContent,{align:`end`,children:e.actions.map((e,t)=>(0,c.jsx)(i.DropdownMenuItem,{onClick:e.onClick,children:e.label},t))})]})]}),(0,c.jsx)(r.CardContent,{children:e.chart})]})}function m({config:e}){let{LinkComponent:t}=u();return(0,c.jsxs)(r.Card,{children:[(0,c.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.CardTitle,{className:`text-base`,children:e.title}),e.description&&(0,c.jsx)(r.CardDescription,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,c.jsx)(`div`,{className:`flex gap-2`,children:e.actions.map((e,r)=>(0,c.jsx)(n.Button,{variant:`outline`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,c.jsxs)(t,{href:e.href,children:[e.label,(0,c.jsx)(s.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):(0,c.jsxs)(`a`,{href:e.href,children:[e.label,(0,c.jsx)(s.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):e.label},r))})]}),(0,c.jsx)(r.CardContent,{children:e.table})]})}function h({activities:e}){let n=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<1?`À l'instant`:r<60?`Il y a ${r} min`:i<24?`Il y a ${i}h`:a<7?`Il y a ${a}j`:t.toLocaleDateString(`fr-FR`)},i={info:`bg-blue-500`,success:`bg-green-500`,warning:`bg-yellow-500`,error:`bg-red-500`};return(0,c.jsxs)(r.Card,{children:[(0,c.jsx)(r.CardHeader,{children:(0,c.jsx)(r.CardTitle,{className:`text-base`,children:`Activité récente`})}),(0,c.jsx)(r.CardContent,{children:(0,c.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,c.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,c.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full mt-2 flex-shrink-0`,i[e.type||`info`])}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:n(e.timestamp)})]},e.id))})})]})}function g({title:e=`Tableau de bord`,description:n,stats:r,charts:i,tables:a,activities:s,quickActions:u,showHeader:g=!0,onRefresh:_,loading:v=!1,period:y=`month`,onPeriodChange:b,periods:x,statsLayout:S=`grid`,statsColumns:C=4,className:w,LinkComponent:T}){let E=o.useMemo(()=>({LinkComponent:T}),[T]);return(0,c.jsx)(l.Provider,{value:E,children:(0,c.jsxs)(`div`,{className:t.cn(`space-y-6`,w),children:[g&&(0,c.jsx)(d,{title:e,description:n,period:y,onPeriodChange:b,periods:x,onRefresh:_,loading:v,quickActions:u}),r&&r.length>0&&(0,c.jsx)(f,{stats:r,layout:S,columns:C,loading:v}),i&&i.length>0&&(0,c.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:i.map(e=>(0,c.jsx)(p,{config:e},e.id))}),(0,c.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[a&&a.length>0&&(0,c.jsx)(`div`,{className:t.cn(`space-y-6`,s?`lg:col-span-2`:`lg:col-span-3`),children:a.map(e=>(0,c.jsx)(m,{config:e},e.id))}),s&&s.length>0&&(0,c.jsx)(`div`,{className:t.cn(!a||a.length===0?`lg:col-span-3`:``),children:(0,c.jsx)(h,{activities:s})})]})]})})}var _=[{id:`revenue`,label:`Revenus`,value:`€45,231.89`,trend:`up`,trendValue:`+20.1%`,trendText:`vs mois dernier`,icon:(0,c.jsx)(s.DollarSign,{className:`h-5 w-5`}),color:`success`},{id:`users`,label:`Utilisateurs`,value:`2,350`,trend:`up`,trendValue:`+180`,trendText:`cette semaine`,icon:(0,c.jsx)(s.Users,{className:`h-5 w-5`}),color:`blue`},{id:`orders`,label:`Commandes`,value:`12,234`,trend:`down`,trendValue:`-4.3%`,trendText:`vs mois dernier`,icon:(0,c.jsx)(s.ShoppingCart,{className:`h-5 w-5`}),color:`purple`},{id:`performance`,label:`Performance`,value:`94.2%`,trend:`up`,trendValue:`+2.4%`,icon:(0,c.jsx)(s.Activity,{className:`h-5 w-5`}),color:`primary`}];exports.WakaDashboard=g,exports.default=g,exports.defaultDashboardStats=_;
|
|
@@ -4,7 +4,7 @@ import { cn as e } from "../../utils/cn.es.js";
|
|
|
4
4
|
import { Button as t } from "../../components/button/index.es.js";
|
|
5
5
|
import { Card as n, CardContent as r, CardDescription as i, CardHeader as a, CardTitle as o } from "../../components/card/index.es.js";
|
|
6
6
|
import { DropdownMenu as s, DropdownMenuContent as c, DropdownMenuItem as l, DropdownMenuTrigger as u } from "../../components/dropdown-menu/index.es.js";
|
|
7
|
-
import d,
|
|
7
|
+
import { WakaStat as d, WakaStatGroup as f } from "../../components/waka-stat/index.es.js";
|
|
8
8
|
import * as p from "react";
|
|
9
9
|
import { Activity as m, ArrowUpRight as h, Calendar as g, DollarSign as _, MoreHorizontal as v, RefreshCw as y, ShoppingCart as b, Users as x } from "lucide-react";
|
|
10
10
|
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
@@ -270,4 +270,4 @@ var N = [
|
|
|
270
270
|
}
|
|
271
271
|
];
|
|
272
272
|
//#endregion
|
|
273
|
-
export { M as default, N as defaultDashboardStats };
|
|
273
|
+
export { M as WakaDashboard, M as default, N as defaultDashboardStats };
|