@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,4 +1,4 @@
|
|
|
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");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");function a({data:e,minWidthPercentage:t=20}){let[r,i]=n.useState(null),[a,o]=n.useState(null),s=n.useMemo(()=>{if(e.length===0)return[];let n=e[0].value,r=Math.max(...e.map(e=>e.value));return e.map((i,a)=>{let o=a>0?e[a-1]:null,s=o&&o.value>0?i.value/o.value*100:null,c=o?o.value-i.value:null,l=o&&o.value>0?(o.value-i.value)/o.value*100:null,u=r>0?i.value/r*100:0,d=Math.max(u,t);return{...i,percentageOfTotal:n>0?i.value/n*100:0,conversionRate:s,dropOff:c,dropOffPercentage:l,widthPercentage:d}})},[e,t]),c=e.length>0?e[0].value:0,l=e.length>0?e[e.length-1].value:0;return{stages:s,totalValue:c,overallConversionRate:c>0?l/c*100:0,totalDropOff:c-l,hoveredStage:r,setHoveredStage:i,activeStage:a,setActiveStage:o}}function o(e,t,n=`$`,r=`en-US`){switch(t){case`percentage`:return`${e.toFixed(1)}%`;case`currency`:return`${n}${e.toLocaleString(r,{minimumFractionDigits:0,maximumFractionDigits:0})}`;default:return e.toLocaleString(r)}}var s=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`,`hsl(var(--primary))`,`hsl(var(--info))`,`hsl(var(--destructive))`];function c(e,t){return t.color||s[e%s.length]}function l({stage:e,index:n,totalStages:r,width:a,stageHeight:o,gap:s,isHovered:l,isAnimated:u,animationDelay:d,animationDuration:f}){let p=n<r-1?e:null,m=c(n,e),h=e.widthPercentage/100*a,g=(a-h)/2,_=g+h,v=p?e.widthPercentage/100*a*.85:h*.7,y=(a-v)/2,b=`
|
|
2
2
|
M ${g} 0
|
|
3
3
|
L ${_} 0
|
|
4
4
|
L ${y+v} ${o}
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
L ${a} ${v+_}
|
|
11
11
|
L 0 ${g}
|
|
12
12
|
Z
|
|
13
|
-
`;return(0,i.jsxs)(`g`,{style:{transform:`translateX(${n*(a+s)}px)`},children:[(0,i.jsx)(`path`,{d:y,fill:p,className:t.cn(`transition-all duration-300`,l&&`brightness-110`),style:{opacity:+!!u,transform:u?`scaleX(1)`:`scaleX(0)`,transformOrigin:`left`,transition:`opacity ${f}ms ease-out ${d}ms, transform ${f}ms ease-out ${d}ms`}}),l&&(0,i.jsx)(`path`,{d:y,fill:`none`,stroke:`white`,strokeWidth:`2`,className:`opacity-50`})]})}function d({stage:e,index:n,position:a,valueFormat:s,currencySymbol:c,locale:l,showConversionRates:u,showDropOff:d}){return(0,i.jsxs)(`div`,{className:t.cn(`absolute z-50 px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`animate-in fade-in-0 zoom-in-95 duration-150`,`pointer-events-none min-w-[180px]`),style:{left:a.x,top:a.y,transform:`translate(-50%, -100%) translateY(-12px)`},children:[(0,i.jsx)(`div`,{className:`font-semibold mb-1`,children:e.label}),(0,i.jsxs)(`div`,{className:`space-y-1 text-xs opacity-90`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Value:`}),(0,i.jsx)(`span`,{className:`font-medium`,children:o(e.value,s,c,l)})]}),(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`% of Total:`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[e.percentageOfTotal.toFixed(1),`%`]})]}),u&&e.conversionRate!==null&&(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Conversion:`}),(0,i.jsxs)(`span`,{className:`font-medium text-green-400`,children:[e.conversionRate.toFixed(1),`%`]})]}),d&&e.dropOff!==null&&(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Drop-off:`}),(0,i.jsxs)(`span`,{className:`font-medium text-red-400`,children:[`-`,o(e.dropOff,s,c,l),` (`,e.dropOffPercentage?.toFixed(1),`%)`]})]}),e.details&&(0,i.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-background/20 flex items-start gap-1`,children:[(0,i.jsx)(r.Info,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,i.jsx)(`span`,{children:e.details})]})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2 -bottom-1.5 w-3 h-3 rotate-45 bg-foreground`})]})}function f({conversionRate:e,dropOffPercentage:n,orientation:a,showDropOff:o}){let s=a===`vertical`?r.ArrowDown:r.ArrowRight;return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 text-xs text-muted-foreground`,a===`vertical`?`justify-center py-1`:`flex-col justify-center px-1`),children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(s,{className:`w-3 h-3`}),(0,i.jsxs)(`span`,{className:`font-medium text-green-600 dark:text-green-400`,children:[e.toFixed(1),`%`]})]}),o&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,i.jsx)(r.TrendingDown,{className:`w-3 h-3`}),(0,i.jsxs)(`span`,{children:[`-`,n.toFixed(1),`%`]})]})]})}function p({data:e,orientation:r=`vertical`,width:s=400,height:c=300,showConversionRates:p=!0,showDropOff:m=!0,showValues:h=!0,showPercentages:g=!0,valueFormat:_=`number`,currencySymbol:v=`$`,locale:y=`en-US`,animated:b=!0,animationDuration:x=500,staggerDelay:S=100,showTooltips:C=!0,minWidthPercentage:w=20,gap:T=4,className:E,onStageClick:D,onStageHover:O}){let[k,A]=n.useState(!b),[j,M]=n.useState(null),N=n.useRef(null),{stages:P,hoveredStage:F,setHoveredStage:I,overallConversionRate:L}=a({data:e,minWidthPercentage:w});n.useEffect(()=>{if(b){let e=setTimeout(()=>{A(!0)},50);return()=>clearTimeout(e)}},[b]);let R=(e,t)=>{if(N.current&&C){let t=N.current.getBoundingClientRect();M({x:e.clientX-t.left,y:e.clientY-t.top})}},z=(e,t,n)=>{I(t.id),O?.(t,n),R(e,t)},B=()=>{I(null),M(null),O?.(null,null)},V=(e,t)=>{D?.(e,t)},H=P.find(e=>e.id===F),U=P.findIndex(e=>e.id===F),W=r===`vertical`,G=P.length,K=T*(G-1),q=p?(G-1)*32:0,J=W?(c-K-q)/G:c,Y=W?s:(s-K-q)/G;return W&&G*J+K,!W&&G*Y+K,(0,i.jsxs)(`div`,{ref:N,className:t.cn(`relative inline-flex flex-col`,E),children:[(0,i.jsxs)(`div`,{className:`mb-4 flex items-center justify-between text-sm`,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[P.length,` stages`]}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[`Overall: `,L.toFixed(1),`% conversion`]})]}),(0,i.jsx)(`div`,{className:t.cn(`flex`,W?`flex-col`:`flex-row items-center`),children:P.map((e,a)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`div`,{className:t.cn(`relative cursor-pointer group`,W?`w-full`:`h-full`),onMouseEnter:t=>z(t,e,a),onMouseMove:t=>R(t,e),onMouseLeave:B,onClick:()=>V(e,a),children:[(0,i.jsx)(`svg`,{width:W?s:Y,height:W?J:c,className:`overflow-visible`,"aria-hidden":`true`,focusable:`false`,children:W?(0,i.jsx)(l,{stage:e,index:0,totalStages:G,width:s,stageHeight:J,gap:T,isHovered:F===e.id,isAnimated:k,animationDelay:a*S,animationDuration:x}):(0,i.jsx)(u,{stage:e,index:0,totalStages:G,stageWidth:Y,height:c,gap:T,isHovered:F===e.id,isAnimated:k,animationDelay:a*S,animationDuration:x})}),(0,i.jsxs)(`div`,{className:t.cn(`absolute inset-0 flex items-center justify-center`,`text-white pointer-events-none`,`flex-col gap-0.5`),style:{opacity:+!!k,transition:`opacity ${x}ms ease-out ${a*S+x/2}ms`},children:[(0,i.jsx)(`span`,{className:`font-semibold text-sm drop-shadow-md`,children:e.label}),h&&(0,i.jsx)(`span`,{className:`text-xs opacity-90 drop-shadow-md`,children:o(e.value,_,v,y)}),g&&(0,i.jsxs)(`span`,{className:`text-xs opacity-75 drop-shadow-md`,children:[e.percentageOfTotal.toFixed(1),`%`]})]})]}),p&&a<P.length-1&&P[a+1].conversionRate!==null&&(0,i.jsx)(`div`,{className:t.cn(W?`py-1`:`px-1`,`opacity-0 transition-opacity duration-300`,k&&`opacity-100`),style:{transitionDelay:`${(a+1)*S+x}ms`},children:(0,i.jsx)(f,{conversionRate:P[a+1].conversionRate,dropOffPercentage:P[a+1].dropOffPercentage,orientation:r,showDropOff:m})})]},e.id))}),C&&F&&j&&H&&(0,i.jsx)(d,{stage:H,index:U,position:j,valueFormat:_,currencySymbol:v,locale:y,showConversionRates:p,showDropOff:m})]})}function m({labels:e,values:t,colors:n,...r}){return(0,i.jsx)(p,{data:e.map((e,r)=>({id:`stage-${r}`,label:e,value:t[r]??0,color:n?.[r]})),...r})}function h({minimal:e=!0,width:t=200,height:n=150,gap:r=2,...a}){return(0,i.jsx)(p,{width:t,height:n,gap:r,showConversionRates:!e,showDropOff:!1,showPercentages:!e,...a})}exports.WakaFunnelChartCompact=h,exports.WakaFunnelChartSimple=m,exports.
|
|
13
|
+
`;return(0,i.jsxs)(`g`,{style:{transform:`translateX(${n*(a+s)}px)`},children:[(0,i.jsx)(`path`,{d:y,fill:p,className:t.cn(`transition-all duration-300`,l&&`brightness-110`),style:{opacity:+!!u,transform:u?`scaleX(1)`:`scaleX(0)`,transformOrigin:`left`,transition:`opacity ${f}ms ease-out ${d}ms, transform ${f}ms ease-out ${d}ms`}}),l&&(0,i.jsx)(`path`,{d:y,fill:`none`,stroke:`white`,strokeWidth:`2`,className:`opacity-50`})]})}function d({stage:e,index:n,position:a,valueFormat:s,currencySymbol:c,locale:l,showConversionRates:u,showDropOff:d}){return(0,i.jsxs)(`div`,{className:t.cn(`absolute z-50 px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`animate-in fade-in-0 zoom-in-95 duration-150`,`pointer-events-none min-w-[180px]`),style:{left:a.x,top:a.y,transform:`translate(-50%, -100%) translateY(-12px)`},children:[(0,i.jsx)(`div`,{className:`font-semibold mb-1`,children:e.label}),(0,i.jsxs)(`div`,{className:`space-y-1 text-xs opacity-90`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Value:`}),(0,i.jsx)(`span`,{className:`font-medium`,children:o(e.value,s,c,l)})]}),(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`% of Total:`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[e.percentageOfTotal.toFixed(1),`%`]})]}),u&&e.conversionRate!==null&&(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Conversion:`}),(0,i.jsxs)(`span`,{className:`font-medium text-green-400`,children:[e.conversionRate.toFixed(1),`%`]})]}),d&&e.dropOff!==null&&(0,i.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,i.jsx)(`span`,{children:`Drop-off:`}),(0,i.jsxs)(`span`,{className:`font-medium text-red-400`,children:[`-`,o(e.dropOff,s,c,l),` (`,e.dropOffPercentage?.toFixed(1),`%)`]})]}),e.details&&(0,i.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-background/20 flex items-start gap-1`,children:[(0,i.jsx)(r.Info,{className:`w-3 h-3 mt-0.5 flex-shrink-0`}),(0,i.jsx)(`span`,{children:e.details})]})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2 -bottom-1.5 w-3 h-3 rotate-45 bg-foreground`})]})}function f({conversionRate:e,dropOffPercentage:n,orientation:a,showDropOff:o}){let s=a===`vertical`?r.ArrowDown:r.ArrowRight;return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 text-xs text-muted-foreground`,a===`vertical`?`justify-center py-1`:`flex-col justify-center px-1`),children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(s,{className:`w-3 h-3`}),(0,i.jsxs)(`span`,{className:`font-medium text-green-600 dark:text-green-400`,children:[e.toFixed(1),`%`]})]}),o&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,i.jsx)(r.TrendingDown,{className:`w-3 h-3`}),(0,i.jsxs)(`span`,{children:[`-`,n.toFixed(1),`%`]})]})]})}function p({data:e,orientation:r=`vertical`,width:s=400,height:c=300,showConversionRates:p=!0,showDropOff:m=!0,showValues:h=!0,showPercentages:g=!0,valueFormat:_=`number`,currencySymbol:v=`$`,locale:y=`en-US`,animated:b=!0,animationDuration:x=500,staggerDelay:S=100,showTooltips:C=!0,minWidthPercentage:w=20,gap:T=4,className:E,onStageClick:D,onStageHover:O}){let[k,A]=n.useState(!b),[j,M]=n.useState(null),N=n.useRef(null),{stages:P,hoveredStage:F,setHoveredStage:I,overallConversionRate:L}=a({data:e,minWidthPercentage:w});n.useEffect(()=>{if(b){let e=setTimeout(()=>{A(!0)},50);return()=>clearTimeout(e)}},[b]);let R=(e,t)=>{if(N.current&&C){let t=N.current.getBoundingClientRect();M({x:e.clientX-t.left,y:e.clientY-t.top})}},z=(e,t,n)=>{I(t.id),O?.(t,n),R(e,t)},B=()=>{I(null),M(null),O?.(null,null)},V=(e,t)=>{D?.(e,t)},H=P.find(e=>e.id===F),U=P.findIndex(e=>e.id===F),W=r===`vertical`,G=P.length,K=T*(G-1),q=p?(G-1)*32:0,J=W?(c-K-q)/G:c,Y=W?s:(s-K-q)/G;return W&&G*J+K,!W&&G*Y+K,(0,i.jsxs)(`div`,{ref:N,className:t.cn(`relative inline-flex flex-col`,E),children:[(0,i.jsxs)(`div`,{className:`mb-4 flex items-center justify-between text-sm`,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[P.length,` stages`]}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[`Overall: `,L.toFixed(1),`% conversion`]})]}),(0,i.jsx)(`div`,{className:t.cn(`flex`,W?`flex-col`:`flex-row items-center`),children:P.map((e,a)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`div`,{className:t.cn(`relative cursor-pointer group`,W?`w-full`:`h-full`),onMouseEnter:t=>z(t,e,a),onMouseMove:t=>R(t,e),onMouseLeave:B,onClick:()=>V(e,a),children:[(0,i.jsx)(`svg`,{width:W?s:Y,height:W?J:c,className:`overflow-visible`,"aria-hidden":`true`,focusable:`false`,children:W?(0,i.jsx)(l,{stage:e,index:0,totalStages:G,width:s,stageHeight:J,gap:T,isHovered:F===e.id,isAnimated:k,animationDelay:a*S,animationDuration:x}):(0,i.jsx)(u,{stage:e,index:0,totalStages:G,stageWidth:Y,height:c,gap:T,isHovered:F===e.id,isAnimated:k,animationDelay:a*S,animationDuration:x})}),(0,i.jsxs)(`div`,{className:t.cn(`absolute inset-0 flex items-center justify-center`,`text-white pointer-events-none`,`flex-col gap-0.5`),style:{opacity:+!!k,transition:`opacity ${x}ms ease-out ${a*S+x/2}ms`},children:[(0,i.jsx)(`span`,{className:`font-semibold text-sm drop-shadow-md`,children:e.label}),h&&(0,i.jsx)(`span`,{className:`text-xs opacity-90 drop-shadow-md`,children:o(e.value,_,v,y)}),g&&(0,i.jsxs)(`span`,{className:`text-xs opacity-75 drop-shadow-md`,children:[e.percentageOfTotal.toFixed(1),`%`]})]})]}),p&&a<P.length-1&&P[a+1].conversionRate!==null&&(0,i.jsx)(`div`,{className:t.cn(W?`py-1`:`px-1`,`opacity-0 transition-opacity duration-300`,k&&`opacity-100`),style:{transitionDelay:`${(a+1)*S+x}ms`},children:(0,i.jsx)(f,{conversionRate:P[a+1].conversionRate,dropOffPercentage:P[a+1].dropOffPercentage,orientation:r,showDropOff:m})})]},e.id))}),C&&F&&j&&H&&(0,i.jsx)(d,{stage:H,index:U,position:j,valueFormat:_,currencySymbol:v,locale:y,showConversionRates:p,showDropOff:m})]})}function m({labels:e,values:t,colors:n,...r}){return(0,i.jsx)(p,{data:e.map((e,r)=>({id:`stage-${r}`,label:e,value:t[r]??0,color:n?.[r]})),...r})}function h({minimal:e=!0,width:t=200,height:n=150,gap:r=2,...a}){return(0,i.jsx)(p,{width:t,height:n,gap:r,showConversionRates:!e,showDropOff:!1,showPercentages:!e,...a})}exports.WakaFunnelChart=p,exports.default=p,exports.WakaFunnelChartCompact=h,exports.WakaFunnelChartSimple=m,exports.useFunnelChart=a;
|
|
@@ -344,4 +344,4 @@ function v({ minimal: e = !0, width: t = 200, height: n = 150, gap: r = 2, ...i
|
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
//#endregion
|
|
347
|
-
export {
|
|
347
|
+
export { g as WakaFunnelChart, g as default, v as WakaFunnelChartCompact, _ as WakaFunnelChartSimple, c as useFunnelChart };
|
|
@@ -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");let n=require("react");n=e.__toESM(n);let r=require("react/jsx-runtime");function i({glowColor:e=`hsl(var(--primary))`,glowIntensity:i=.15,glowSize:a=400,borderGlow:o=!0,followCursor:s=!0,hoverEffect:c=`lift`,gradient:l=!1,className:u,children:d,...f}){let p=n.useRef(null),[m,h]=n.useState({x:0,y:0}),[g,_]=n.useState(!1),v=n.useCallback(e=>{if(!p.current||!s)return;let t=p.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;h({x:n,y:r})},[s]),y={lift:`hover:-translate-y-1 hover:shadow-xl`,scale:`hover:scale-[1.02]`,tilt:``,none:``},b=n.useCallback(()=>{if(c!==`tilt`||!g||!p.current)return{};let e=p.current.getBoundingClientRect(),t=e.width/2,n=e.height/2;return{transform:`perspective(1000px) rotateX(${(m.y-n)/n*-5}deg) rotateY(${(m.x-t)/t*5}deg)`}},[c,g,m]);return(0,r.jsxs)(`div`,{ref:p,onMouseMove:v,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),className:t.cn(`relative overflow-hidden rounded-xl border bg-card transition-all duration-300`,y[c],u),style:b(),...f,children:[s&&(0,r.jsx)(`div`,{className:`pointer-events-none absolute transition-opacity duration-300`,style:{left:m.x-a/2,top:m.y-a/2,width:a,height:a,background:`radial-gradient(circle, ${e} 0%, transparent 70%)`,opacity:g?i:0,filter:`blur(40px)`}}),o&&(0,r.jsx)(`div`,{className:`pointer-events-none absolute inset-0 rounded-xl transition-opacity duration-300`,style:{background:s?`radial-gradient(circle at ${m.x}px ${m.y}px, ${e} 0%, transparent 50%)`:`radial-gradient(circle at 50% 50%, ${e} 0%, transparent 50%)`,opacity:g?i*.5:0,mask:`linear-gradient(black, black) content-box, linear-gradient(black, black)`,maskComposite:`xor`,WebkitMaskComposite:`xor`,padding:`1px`}}),l&&(0,r.jsx)(`div`,{className:`pointer-events-none absolute inset-0 transition-opacity duration-500`,style:{background:`linear-gradient(135deg, ${e}10 0%, transparent 50%, ${e}05 100%)`,opacity:g?1:.5}}),(0,r.jsx)(`div`,{className:`relative z-10`,children:d}),(0,r.jsx)(`div`,{className:`pointer-events-none absolute inset-0 transition-opacity duration-500`,style:{background:s?`linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.03) 45%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.03) 55%, transparent 60%)`:`none`,transform:`translateX(${g?`0%`:`-100%`})`,opacity:+!!g}})]})}function a(e){return(0,r.jsx)(i,{glowColor:`hsl(var(--primary))`,...e})}function o(e){return(0,r.jsx)(i,{glowColor:`hsl(142.1 76.2% 36.3%)`,...e})}function s(e){return(0,r.jsx)(i,{glowColor:`hsl(47.9 95.8% 53.1%)`,...e})}function c(e){return(0,r.jsx)(i,{glowColor:`hsl(var(--destructive))`,...e})}function l(e){let t=n.useRef(null),[a,o]=n.useState(0);return n.useEffect(()=>{let e=setInterval(()=>{o(e=>(e+1)%360)},20);return()=>clearInterval(e)},[]),(0,r.jsxs)(`div`,{ref:t,className:`relative`,children:[(0,r.jsx)(`div`,{className:`absolute -inset-[1px] rounded-xl opacity-75 blur-sm`,style:{background:`conic-gradient(from ${a}deg, #ff0000, #ff8000, #ffff00, #00ff00, #0080ff, #8000ff, #ff0080, #ff0000)`}}),(0,r.jsx)(i,{borderGlow:!1,className:`relative`,...e})]})}function u({children:e,columns:n=3,gap:i=`md`,className:a}){return(0,r.jsx)(`div`,{className:t.cn(`grid`,{1:`grid-cols-1`,2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`}[n],{sm:`gap-3`,md:`gap-6`,lg:`gap-8`}[i],a),children:e})}exports.WakaGlowCard=i,exports.WakaGlowCardDanger=c,exports.WakaGlowCardPrimary=a,exports.WakaGlowCardRainbow=l,exports.WakaGlowCardSuccess=o,exports.WakaGlowCardWarning=s,exports.WakaGlowGrid=u;
|
|
@@ -10,10 +10,10 @@ function i({ glowColor: i = "hsl(var(--primary))", glowIntensity: a = .15, glowS
|
|
|
10
10
|
y: 0
|
|
11
11
|
}), [_, v] = t.useState(!1), y = t.useCallback((e) => {
|
|
12
12
|
if (!m.current || !c) return;
|
|
13
|
-
let t = m.current.getBoundingClientRect();
|
|
13
|
+
let t = m.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
14
14
|
g({
|
|
15
|
-
x:
|
|
16
|
-
y:
|
|
15
|
+
x: n,
|
|
16
|
+
y: r
|
|
17
17
|
});
|
|
18
18
|
}, [c]), b = {
|
|
19
19
|
lift: "hover:-translate-y-1 hover:shadow-xl",
|
|
@@ -1,4 +1,4 @@
|
|
|
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");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={default:{gradient:`from-blue-500 to-cyan-500`,bgGradient:`from-blue-500/20 to-cyan-500/20`,text:`text-blue-600`,glow:`#3b82f6`,border:`border-blue-500/30`,fill:`#3b82f6`},success:{gradient:`from-green-500 to-emerald-500`,bgGradient:`from-green-500/20 to-emerald-500/20`,text:`text-green-600`,glow:`#22c55e`,border:`border-green-500/30`,fill:`#22c55e`},warning:{gradient:`from-yellow-500 to-orange-500`,bgGradient:`from-yellow-500/20 to-orange-500/20`,text:`text-yellow-600`,glow:`#f59e0b`,border:`border-yellow-500/30`,fill:`#f59e0b`},danger:{gradient:`from-red-500 to-rose-500`,bgGradient:`from-red-500/20 to-rose-500/20`,text:`text-red-600`,glow:`#ef4444`,border:`border-red-500/30`,fill:`#ef4444`},purple:{gradient:`from-purple-500 to-pink-500`,bgGradient:`from-purple-500/20 to-pink-500/20`,text:`text-purple-600`,glow:`#a855f7`,border:`border-purple-500/30`,fill:`#a855f7`},blue:{gradient:`from-indigo-500 to-blue-600`,bgGradient:`from-indigo-500/20 to-blue-600/20`,text:`text-indigo-600`,glow:`#6366f1`,border:`border-indigo-500/30`,fill:`#6366f1`}},o={ahead:{color:`text-green-600`,bgColor:`bg-green-100`,icon:r.TrendingUp,label:`Ahead of schedule`},"on-track":{color:`text-blue-600`,bgColor:`bg-blue-100`,icon:r.Minus,label:`On track`},behind:{color:`text-red-600`,bgColor:`bg-red-100`,icon:r.TrendingDown,label:`Behind schedule`}},s={sm:{container:`gap-2`,bar:`h-2`,text:`text-xs`,title:`text-sm`,icon:`h-3.5 w-3.5`,milestone:`h-3 w-3`,trendHeight:40},default:{container:`gap-3`,bar:`h-3`,text:`text-sm`,title:`text-base`,icon:`h-4 w-4`,milestone:`h-4 w-4`,trendHeight:60},lg:{container:`gap-4`,bar:`h-4`,text:`text-base`,title:`text-lg`,icon:`h-5 w-5`,milestone:`h-5 w-5`,trendHeight:80}};function c(e,t=`custom`,n,r=`suffix`){let i;return t===`revenue`?(i=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toFixed(0),n?r===`prefix`?`${n}${i}`:`${i}${n}`:`$${i}`):t===`users`||t===`sales`?(i=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toFixed(0),n?r===`prefix`?`${n}${i}`:`${i} ${n}`:i):t===`engagement`?(i=`${e.toFixed(1)}%`,i):(i=e.toLocaleString(),n?r===`prefix`?`${n}${i}`:`${i} ${n}`:i)}function l(e){let t=new Date,n=e.getTime()-t.getTime();return Math.ceil(n/(1e3*60*60*24))}function u(e){let t=l(e);if(t<0)return`Overdue`;if(t===0)return`Due today`;if(t===1)return`1 day left`;if(t<7)return`${t} days left`;if(t<30){let e=Math.floor(t/7);return e===1?`1 week left`:`${e} weeks left`}if(t<365){let e=Math.floor(t/30);return e===1?`1 month left`:`${e} months left`}let n=Math.floor(t/365);return n===1?`1 year left`:`${n} years left`}function d({currentValue:e,targetValue:t,startValue:r=0,startDate:i,endDate:a,historicalData:o=[]}){let s=n.useMemo(()=>{let n=t-r;if(n<=0)return 100;let i=(e-r)/n*100;return Math.min(100,Math.max(0,i))},[e,t,r]),c=n.useMemo(()=>Math.max(0,t-e),[t,e]),d=e>=t,f=n.useMemo(()=>a?l(a):null,[a]),p=n.useMemo(()=>a?u(a):null,[a]),m=n.useMemo(()=>{if(o.length<2)return null;let e=[...o].sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime()),t=e[0],n=e[e.length-1],r=Math.max(1,(new Date(n.date).getTime()-new Date(t.date).getTime())/(1e3*60*60*24));return(n.value-t.value)/r},[o]),h=n.useMemo(()=>f===null||f<=0?null:c/f,[c,f]);return{progressPercent:s,remainingValue:c,paceStatus:n.useMemo(()=>{if(!i||!a)return s>=100?`ahead`:`on-track`;let e=new Date,t=a.getTime()-i.getTime(),n=(e.getTime()-i.getTime())/t*100;return s>=n+10?`ahead`:s<=n-10?`behind`:`on-track`},[i,a,s]),projectedCompletionDate:n.useMemo(()=>{if(!m||m<=0||d)return null;let e=c/m,t=new Date;return t.setDate(t.getDate()+Math.ceil(e)),t},[m,c,d]),daysRemaining:f,timeRemainingFormatted:p,isCompleted:d,requiredDailyRate:h,currentDailyRate:m,trendDirection:n.useMemo(()=>{if(o.length<2)return`stable`;let e=o.slice(-5);if(e.length<2)return`stable`;let t=e[0].value,n=(e[e.length-1].value-t)/t*100;return n>5?`up`:n<-5?`down`:`stable`},[o])}}function f({data:e,targetValue:t,height:r,color:a,animated:o=!0}){let[s,c]=n.useState(0),l=n.useRef(null);if(n.useEffect(()=>{l.current&&c(l.current.getTotalLength())},[e]),e.length<2)return null;let u=[...e].sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime()),d=Math.max(t,...u.map(e=>e.value)),f=Math.min(0,...u.map(e=>e.value)),p=d-f,m=u.map((e,t)=>({x:t/(u.length-1)*100,y:r-(e.value-f)/p*r})),h=m.map((e,t)=>{if(t===0)return`M ${e.x} ${e.y}`;let n=m[t-1],r=n.x+(e.x-n.x)/3,i=n.x+(e.x-n.x)*2/3;return`C ${r} ${n.y}, ${i} ${e.y}, ${e.x} ${e.y}`}).join(` `),g=r-(t-f)/p*r;return(0,i.jsxs)(`svg`,{className:`w-full overflow-visible`,viewBox:`0 0 100 ${r}`,preserveAspectRatio:`none`,children:[(0,i.jsx)(`line`,{x1:`0`,y1:g,x2:`100`,y2:g,stroke:`currentColor`,strokeOpacity:`0.2`,strokeDasharray:`2 2`,className:`text-muted-foreground`}),(0,i.jsx)(`defs`,{children:(0,i.jsxs)(`linearGradient`,{id:`trendGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:a,stopOpacity:`0.3`}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:a,stopOpacity:`0`})]})}),(0,i.jsx)(`path`,{d:`${h} L 100 ${r} L 0 ${r} Z`,fill:`url(#trendGradient)`}),(0,i.jsx)(`path`,{ref:l,d:h,fill:`none`,stroke:a,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:o?`animate-trend-line`:``,style:o&&s?{strokeDasharray:s,strokeDashoffset:s,animationDuration:`1.5s`}:{}}),m.map((e,t)=>(0,i.jsx)(`circle`,{cx:e.x,cy:e.y,r:`2.5`,fill:a,className:o?`animate-trend-dot`:``,style:o?{animationDelay:`${t*.1+.5}s`}:{}},t)),(0,i.jsx)(`text`,{x:`100`,y:g-4,textAnchor:`end`,className:`fill-muted-foreground text-[6px]`,children:`Target`}),(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes trend-line {
|
|
3
3
|
to {
|
|
4
4
|
stroke-dashoffset: 0;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
opacity: 0;
|
|
16
16
|
animation: trend-dot 0.3s ease-out forwards;
|
|
17
17
|
}
|
|
18
|
-
`})]})}function p({status:e,size:n}){let r=o[e],a=s[n],c=r.icon;return(0,i.jsxs)(`div`,{className:t.cn(`inline-flex items-center gap-1 rounded-full px-2 py-0.5`,r.bgColor),children:[(0,i.jsx)(c,{className:t.cn(a.icon,r.color)}),(0,i.jsx)(`span`,{className:t.cn(a.text,r.color,`font-medium`),children:r.label})]})}function m({milestone:e,position:n,reached:a,size:o,color:c}){let l=s[o];return(0,i.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-10`,style:{left:`${n}%`},children:(0,i.jsxs)(`div`,{className:`group relative`,children:[(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-center rounded-full border-2 border-background transition-all duration-300`,l.milestone,a?`text-white`:`bg-muted text-muted-foreground`),style:a?{backgroundColor:c}:{},children:e.icon||(0,i.jsx)(r.Flag,{className:`h-2 w-2`})}),e.label&&(0,i.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20`,children:(0,i.jsx)(`div`,{className:`whitespace-nowrap rounded bg-popover px-2 py-1 text-xs shadow-lg border`,children:e.label})})]})})}function h({currentValue:e,targetValue:o,startValue:l=0,goalType:u=`custom`,unit:h,unitPosition:g=`suffix`,title:_,description:v,startDate:y,endDate:b,milestones:x=[],historicalData:S=[],showTrendLine:C=!1,paceStatus:w,projection:T,showTimeRemaining:E=!0,showPercentage:D=!0,showValues:O=!0,animated:k=!0,size:A=`default`,theme:j=`default`,className:M,onGoalReached:N}){let[P,F]=n.useState(0),[I,L]=n.useState(!1),R=n.useRef(e),z=a[j],B=s[A],{progressPercent:V,remainingValue:H,paceStatus:U,projectedCompletionDate:W,timeRemainingFormatted:G,isCompleted:K}=d({currentValue:e,targetValue:o,startValue:l,startDate:y,endDate:b,historicalData:S}),q=w??U;n.useEffect(()=>{if(!k){F(V);return}let e=P,t=V-e,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/1e3,1)
|
|
18
|
+
`})]})}function p({status:e,size:n}){let r=o[e],a=s[n],c=r.icon;return(0,i.jsxs)(`div`,{className:t.cn(`inline-flex items-center gap-1 rounded-full px-2 py-0.5`,r.bgColor),children:[(0,i.jsx)(c,{className:t.cn(a.icon,r.color)}),(0,i.jsx)(`span`,{className:t.cn(a.text,r.color,`font-medium`),children:r.label})]})}function m({milestone:e,position:n,reached:a,size:o,color:c}){let l=s[o];return(0,i.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-10`,style:{left:`${n}%`},children:(0,i.jsxs)(`div`,{className:`group relative`,children:[(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-center rounded-full border-2 border-background transition-all duration-300`,l.milestone,a?`text-white`:`bg-muted text-muted-foreground`),style:a?{backgroundColor:c}:{},children:e.icon||(0,i.jsx)(r.Flag,{className:`h-2 w-2`})}),e.label&&(0,i.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20`,children:(0,i.jsx)(`div`,{className:`whitespace-nowrap rounded bg-popover px-2 py-1 text-xs shadow-lg border`,children:e.label})})]})})}function h({currentValue:e,targetValue:o,startValue:l=0,goalType:u=`custom`,unit:h,unitPosition:g=`suffix`,title:_,description:v,startDate:y,endDate:b,milestones:x=[],historicalData:S=[],showTrendLine:C=!1,paceStatus:w,projection:T,showTimeRemaining:E=!0,showPercentage:D=!0,showValues:O=!0,animated:k=!0,size:A=`default`,theme:j=`default`,className:M,onGoalReached:N}){let[P,F]=n.useState(0),[I,L]=n.useState(!1),R=n.useRef(e),z=a[j],B=s[A],{progressPercent:V,remainingValue:H,paceStatus:U,projectedCompletionDate:W,timeRemainingFormatted:G,isCompleted:K}=d({currentValue:e,targetValue:o,startValue:l,startDate:y,endDate:b,historicalData:S}),q=w??U;n.useEffect(()=>{if(!k){F(V);return}let e=P,t=V-e,n=Date.now(),r=()=>{let i=Date.now()-n,a=Math.min(i/1e3,1),o=1-(1-a)**3;F(e+t*o),a<1&&requestAnimationFrame(r)};requestAnimationFrame(r)},[V,k]),n.useEffect(()=>{K&&!I&&e>R.current&&(L(!0),N?.()),R.current=e},[K,I,e,N]);let J=T??{completionDate:W??void 0};return(0,i.jsxs)(`div`,{className:t.cn(`relative`,M),children:[(_||D)&&(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,i.jsxs)(`div`,{className:`flex-1`,children:[_&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.Target,{className:t.cn(B.icon,z.text)}),(0,i.jsx)(`h3`,{className:t.cn(`font-semibold`,B.title),children:_})]}),v&&(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground mt-0.5`,B.text),children:v})]}),D&&(0,i.jsxs)(`div`,{className:t.cn(`font-bold tabular-nums`,B.title,z.text),children:[Math.round(V),`%`]})]}),O&&(0,i.jsxs)(`div`,{className:t.cn(`flex items-baseline justify-between mb-2`,B.text),children:[(0,i.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,i.jsx)(`span`,{className:`font-semibold tabular-nums`,children:c(e,u,h,g)}),(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),(0,i.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:c(o,u,h,g)})]}),(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[(0,i.jsx)(`span`,{className:`tabular-nums`,children:c(H,u,h,g)}),` remaining`]})]}),(0,i.jsx)(`div`,{className:`relative`,children:(0,i.jsxs)(`div`,{className:t.cn(`relative w-full overflow-hidden rounded-full bg-muted`,B.bar),children:[(0,i.jsx)(`div`,{className:t.cn(`absolute inset-0 rounded-full opacity-30 blur-sm bg-gradient-to-r`,z.gradient),style:{width:`${P}%`}}),(0,i.jsx)(`div`,{className:t.cn(`relative h-full rounded-full bg-gradient-to-r transition-all duration-300`,z.gradient,k&&`animate-progress-glow`),style:{width:`${P}%`,"--glow-color":z.glow},children:k&&(0,i.jsx)(`div`,{className:`absolute inset-0 overflow-hidden rounded-full`,children:(0,i.jsx)(`div`,{className:`absolute inset-0 animate-goal-shine`})})}),x.map((t,n)=>{let r=o-l,a=(t.value-l)/r*100;return a<=0||a>=100?null:(0,i.jsx)(m,{milestone:t,position:a,reached:e>=t.value,size:A,color:z.fill},n)})]})}),C&&S.length>=2&&(0,i.jsx)(`div`,{className:`mt-4`,children:(0,i.jsx)(f,{data:S,targetValue:o,height:B.trendHeight,color:z.fill,animated:k})}),(0,i.jsxs)(`div`,{className:t.cn(`flex flex-wrap items-center gap-3 mt-3`,B.text),children:[(0,i.jsx)(p,{status:q,size:A}),E&&b&&G&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,i.jsx)(r.Clock,{className:B.icon}),(0,i.jsx)(`span`,{children:G})]}),J.completionDate&&!K&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,i.jsx)(r.Calendar,{className:B.icon}),(0,i.jsxs)(`span`,{children:[`Projected: `,J.completionDate.toLocaleDateString()]})]}),J.projectedValue!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,i.jsx)(r.Zap,{className:B.icon}),(0,i.jsxs)(`span`,{children:[`Projected: `,c(J.projectedValue,u,h,g)]})]}),K&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-green-600`,children:[(0,i.jsx)(r.ChevronRight,{className:B.icon}),(0,i.jsx)(`span`,{className:`font-medium`,children:`Goal Reached!`})]})]}),(0,i.jsx)(`style`,{children:`
|
|
19
19
|
@keyframes goal-shine {
|
|
20
20
|
0% { transform: translateX(-100%); opacity: 0; }
|
|
21
21
|
50% { opacity: 0.3; }
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
.animate-progress-glow {
|
|
33
33
|
animation: progress-glow 2s ease-in-out infinite;
|
|
34
34
|
}
|
|
35
|
-
`})]})}h.displayName=`WakaGoalProgress`;function g({currentValue:e,targetValue:n,goalType:r=`custom`,unit:o,unitPosition:s=`suffix`,theme:c=`default`,showPercentage:l=!0,className:u}){let d=a[c],f=n>0?Math.max(0,Math.min(100,e/n*100)):0;return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2`,u),children:[(0,i.jsx)(`div`,{className:`flex-1`,children:(0,i.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full bg-gradient-to-r transition-all duration-300`,d.gradient),style:{width:`${f}%`}})})}),l&&(0,i.jsxs)(`span`,{className:t.cn(`text-xs font-medium tabular-nums`,d.text),children:[Math.round(f),`%`]})]})}g.displayName=`WakaCompactGoalProgress`;function _({bordered:e=!0,className:n,...r}){return(0,i.jsx)(`div`,{className:t.cn(`rounded-lg bg-card p-4`,e&&`border shadow-sm`,n),children:(0,i.jsx)(h,{...r})})}_.displayName=`WakaGoalCard`,exports.WakaCompactGoalProgress=g,exports.WakaGoalCard=_,exports.default=h,exports.useGoalProgress=d;
|
|
35
|
+
`})]})}h.displayName=`WakaGoalProgress`;function g({currentValue:e,targetValue:n,goalType:r=`custom`,unit:o,unitPosition:s=`suffix`,theme:c=`default`,showPercentage:l=!0,className:u}){let d=a[c],f=n>0?Math.max(0,Math.min(100,e/n*100)):0;return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2`,u),children:[(0,i.jsx)(`div`,{className:`flex-1`,children:(0,i.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full bg-gradient-to-r transition-all duration-300`,d.gradient),style:{width:`${f}%`}})})}),l&&(0,i.jsxs)(`span`,{className:t.cn(`text-xs font-medium tabular-nums`,d.text),children:[Math.round(f),`%`]})]})}g.displayName=`WakaCompactGoalProgress`;function _({bordered:e=!0,className:n,...r}){return(0,i.jsx)(`div`,{className:t.cn(`rounded-lg bg-card p-4`,e&&`border shadow-sm`,n),children:(0,i.jsx)(h,{...r})})}_.displayName=`WakaGoalCard`,exports.WakaCompactGoalProgress=g,exports.WakaGoalCard=_,exports.WakaGoalProgress=h,exports.default=h,exports.useGoalProgress=d;
|
|
@@ -305,8 +305,8 @@ function C({ currentValue: a, targetValue: o, startValue: c = 0, goalType: l = "
|
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
let e = z, t = K - e, n = Date.now(), r = () => {
|
|
308
|
-
let i = Date.now() - n, a = Math.min(i / 1e3, 1);
|
|
309
|
-
B(e + t *
|
|
308
|
+
let i = Date.now() - n, a = Math.min(i / 1e3, 1), o = 1 - (1 - a) ** 3;
|
|
309
|
+
B(e + t * o), a < 1 && requestAnimationFrame(r);
|
|
310
310
|
};
|
|
311
311
|
requestAnimationFrame(r);
|
|
312
312
|
}, [K, P]), t.useEffect(() => {
|
|
@@ -470,4 +470,4 @@ function T({ bordered: t = !0, className: n, ...r }) {
|
|
|
470
470
|
}
|
|
471
471
|
T.displayName = "WakaGoalCard";
|
|
472
472
|
//#endregion
|
|
473
|
-
export { w as WakaCompactGoalProgress, T as WakaGoalCard, C as default, y as useGoalProgress };
|
|
473
|
+
export { w as WakaCompactGoalProgress, T as WakaGoalCard, C as WakaGoalProgress, C as default, y as useGoalProgress };
|
|
@@ -1,4 +1,4 @@
|
|
|
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");let n=require("react");n=e.__toESM(n);let r=require("class-variance-authority"),i=require("react/jsx-runtime"),a=require("@radix-ui/react-slot");var o=(0,r.cva)(`relative inline-flex items-center justify-center gap-2 overflow-hidden whitespace-nowrap rounded-xl font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow-md hover:shadow-lg active:shadow-sm`,secondary:`bg-secondary text-secondary-foreground shadow hover:shadow-md`,destructive:`bg-destructive text-destructive-foreground shadow-md hover:shadow-lg`,outline:`border-2 border-input bg-background hover:bg-accent hover:text-accent-foreground`,ghost:`hover:bg-accent hover:text-accent-foreground`,glass:`bg-white/10 backdrop-blur-md border border-white/20 text-white shadow-lg hover:bg-white/20`,gradient:`bg-gradient-to-r from-primary to-primary/70 text-primary-foreground shadow-lg hover:shadow-xl`,neon:`bg-primary/10 text-primary border-2 border-primary shadow-[0_0_15px_rgba(var(--primary),0.3)] hover:shadow-[0_0_25px_rgba(var(--primary),0.5)]`},size:{sm:`h-9 px-4 text-sm`,default:`h-11 px-6 text-base`,lg:`h-14 px-8 text-lg`,xl:`h-16 px-10 text-xl`,icon:`h-11 w-11`,"icon-sm":`h-9 w-9`,"icon-lg":`h-14 w-14`},rounded:{default:`rounded-xl`,sm:`rounded-lg`,lg:`rounded-2xl`,full:`rounded-full`}},defaultVariants:{variant:`default`,size:`default`,rounded:`default`}});function s(e){typeof window>`u`||!(`vibrate`in navigator)||(Array.isArray(e)?navigator.vibrate(e):navigator.vibrate({light:[10],medium:[20],heavy:[30],success:[10,50,10],warning:[20,50,20],error:[30,50,30,50,30],selection:[5]}[e]??[10]))}function c({x:e,y:t,size:r,color:a,duration:o,onComplete:s}){return n.useEffect(()=>{let e=setTimeout(s,o);return()=>clearTimeout(e)},[o,s]),(0,i.jsx)(`span`,{className:`absolute rounded-full pointer-events-none animate-ripple`,style:{left:e-r/2,top:t-r/2,width:r,height:r,backgroundColor:a,animationDuration:`${o}ms`}})}function l({className:e}){return(0,i.jsxs)(`svg`,{className:t.cn(`animate-spin`,e),width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,i.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`}),(0,i.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}var u=n.forwardRef(({className:e,variant:r,size:u,rounded:d,asChild:f=!1,hapticPattern:p=`medium`,hapticEnabled:m=!0,ripple:h=!0,rippleColor:g=`rgba(255, 255, 255, 0.35)`,rippleDuration:_=600,pressScale:v=!0,pressScaleFactor:y=.97,glowOnPress:b=!1,glowColor:x,loading:S=!1,leftIcon:C,rightIcon:w,children:T,onClick:E,onPointerDown:D,disabled:O,...k},A)=>{let j=n.useRef(null),[M,N]=n.useState([]),[P,F]=n.useState(!1),I=n.useRef(0);n.useImperativeHandle(A,()=>j.current);let L=n.useCallback(e=>{if(!(O||S)){if(F(!0),m&&s(p),h&&j.current){let t=j.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=Math.max(t.width,t.height)*2,a=I.current++;N(e=>[...e,{id:a,x:n,y:r,size:i}])}D?.(e)}},[O,S,m,p,h,D]),R=n.useCallback(()=>{F(!1)},[]),z=n.useCallback(e=>{O||S||E?.(e)},[O,S,E]),B=n.useCallback(e=>{N(t=>t.filter(t=>t.id!==e))},[]),V=v&&P?{transform:`scale(${y})`}:{},H=b&&P?{boxShadow:`0 0 20px ${x??(r===`destructive`?`rgba(239, 68, 68, 0.5)`:`rgba(var(--primary), 0.5)`)}`}:{};return(0,i.jsxs)(f?a.Slot:`button`,{ref:j,className:t.cn(o({variant:r,size:u,rounded:d,className:e})),style:{...V,...H,transition:`transform 0.1s ease-out, box-shadow 0.2s ease-out`},disabled:O||S,onClick:z,onPointerDown:L,onPointerUp:R,onPointerLeave:R,onPointerCancel:R,...k,children:[M.map(({id:e,x:t,y:n,size:r})=>(0,i.jsx)(c,{x:t,y:n,size:r,color:g,duration:_,onComplete:()=>B(e)},e)),S?(0,i.jsx)(l,{className:`mr-2`}):C?(0,i.jsx)(`span`,{className:`flex-shrink-0`,children:C}):null,(0,i.jsx)(`span`,{className:t.cn(S&&`opacity-0`),children:T}),!S&&w&&(0,i.jsx)(`span`,{className:`flex-shrink-0`,children:w})]})});if(u.displayName=`WakaHapticButton`,typeof document<`u`){let e=`waka-haptic-button-styles`;if(!document.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.textContent=`
|
|
2
2
|
@keyframes ripple {
|
|
3
3
|
0% {
|
|
4
4
|
transform: scale(0);
|
|
@@ -1,4 +1,4 @@
|
|
|
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");let n=require("react");n=e.__toESM(n);let r=require("react/jsx-runtime");var i={healthy:`hsl(var(--success))`,warning:`hsl(var(--warning))`,critical:`hsl(var(--destructive))`,down:`hsl(var(--muted-foreground))`,unknown:`hsl(var(--chart-3))`},a={sm:{width:160,height:48,strokeWidth:1.5,fontSize:`text-xs`,labelSize:`text-[10px]`,dotSize:6,padding:`p-2`},md:{width:240,height:64,strokeWidth:2,fontSize:`text-sm`,labelSize:`text-xs`,dotSize:8,padding:`p-3`},lg:{width:320,height:80,strokeWidth:2.5,fontSize:`text-base`,labelSize:`text-sm`,dotSize:10,padding:`p-4`}};function o(e,t,n){let r=n/2,i=n*.35,a=r;switch(e){case`healthy`:return`
|
|
2
2
|
M 0,${a}
|
|
3
3
|
L ${t*.15},${a}
|
|
4
4
|
Q ${t*.18},${a-i*.2} ${t*.2},${a}
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
opacity: 0;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
`}})]}),c>0&&(0,r.jsx)(`div`,{className:t.cn(`flex items-center justify-end mt-1.5`,_.labelSize),children:(0,r.jsxs)(`span`,{className:`text-muted-foreground`,children:[c,` BPM`]})})]})}c.displayName=`WakaHealthPulse`,exports.default=c;
|
|
84
|
+
`}})]}),c>0&&(0,r.jsx)(`div`,{className:t.cn(`flex items-center justify-end mt-1.5`,_.labelSize),children:(0,r.jsxs)(`span`,{className:`text-muted-foreground`,children:[c,` BPM`]})})]})}c.displayName=`WakaHealthPulse`,exports.WakaHealthPulse=c,exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={blues:{type:`sequential`,colors:[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`]},greens:{type:`sequential`,colors:[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`]},reds:{type:`sequential`,colors:[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`]},viridis:{type:`sequential`,colors:[`#440154`,`#482878`,`#3e4989`,`#31688e`,`#26828e`,`#1f9e89`,`#35b779`,`#6ece58`,`#fde725`]},plasma:{type:`sequential`,colors:[`#0d0887`,`#46039f`,`#7201a8`,`#9c179e`,`#bd3786`,`#d8576b`,`#ed7953`,`#fb9f3a`,`#fdca26`]},coolwarm:{type:`diverging`,colors:[`#3b4cc0`,`#5977e3`,`#7b9ff9`,`#9ebeff`,`#c0d4f5`,`#f7f7f7`,`#f4c5ad`,`#f19072`,`#d95f47`,`#b40426`]},rdylgn:{type:`diverging`,colors:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`]}};function o(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),r=Math.floor(n),i=Math.ceil(n);if(r===i)return e[r];let a=n-r,o=e[r],s=e[i],c=parseInt(o.slice(1,3),16),l=parseInt(o.slice(3,5),16),u=parseInt(o.slice(5,7),16),d=parseInt(s.slice(1,3),16),f=parseInt(s.slice(3,5),16),p=parseInt(s.slice(5,7),16),m=Math.round(c+(d-c)*a),h=Math.round(l+(f-l)*a),g=Math.round(u+(p-u)*a);return`#${m.toString(16).padStart(2,`0`)}${h.toString(16).padStart(2,`0`)}${g.toString(16).padStart(2,`0`)}`}function s(e,t,n,r){if(r.type===`diverging`){let i=Math.max(Math.abs(t),Math.abs(n));if(e===0)return r.colors[Math.floor(r.colors.length/2)];let a=(e+i)/(2*i);return o(r.colors,a)}if(n===t)return r.colors[Math.floor(r.colors.length/2)];let i=(e-t)/(n-t);return o(r.colors,i)}function c(e={}){let{initialZoom:t=1,minZoom:r=.5,maxZoom:i=4,initialPan:a={x:0,y:0},onSelectionChange:o}=e,[s,c]=n.useState(t),[l,u]=n.useState(a),[d,f]=n.useState(null),[p,m]=n.useState(!1);return{zoom:s,pan:l,selectedCell:d,isPanning:p,zoomIn:n.useCallback(()=>{c(e=>Math.min(e*1.2,i))},[i]),zoomOut:n.useCallback(()=>{c(e=>Math.max(e/1.2,r))},[r]),resetZoom:n.useCallback(()=>{c(t)},[t]),setPan:u,resetPan:n.useCallback(()=>{u(a)},[a]),selectCell:n.useCallback(e=>{f(e),o?.(e)},[o]),startPanning:n.useCallback(()=>{m(!0)},[]),stopPanning:n.useCallback(()=>{m(!1)},[]),handlePanMove:n.useCallback((e,t)=>{u(n=>({x:n.x+e,y:n.y+t}))},[])}}function l({value:e,row:t,col:n,rowLabel:r,colLabel:a,x:o,y:s,valueFormatter:c}){let l=c?c(e):e.toFixed(2);return(0,i.jsxs)(`div`,{className:`absolute z-50 px-3 py-2 text-xs font-medium text-white bg-gray-900 rounded-lg shadow-lg pointer-events-none whitespace-nowrap`,style:{left:o,top:s,transform:`translate(-50%, -100%)`,marginTop:-10},children:[(0,i.jsx)(`div`,{className:`font-semibold text-sm`,children:l}),(r||a)&&(0,i.jsxs)(`div`,{className:`text-gray-300 mt-1`,children:[r&&(0,i.jsxs)(`span`,{children:[`Row: `,r]}),r&&a&&(0,i.jsx)(`span`,{className:`mx-1`,children:`|`}),a&&(0,i.jsxs)(`span`,{children:[`Col: `,a]})]}),!r&&!a&&(0,i.jsxs)(`div`,{className:`text-gray-300 mt-1`,children:[`[`,t,`, `,n,`]`]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2.5 h-2.5 bg-gray-900 transform -translate-x-1/2 translate-y-1/2 rotate-45`})]})}function u({colorScheme:e,minValue:r,maxValue:a,valueFormatter:o,className:s}){let c=n.useId(),l=e=>o?o(e):e.toFixed(1);return(0,i.jsx)(`div`,{className:t.cn(`flex flex-col gap-1`,s),children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground min-w-12 text-right`,children:l(r)}),(0,i.jsx)(`div`,{className:`relative h-3 w-32 rounded overflow-hidden`,children:(0,i.jsxs)(`svg`,{width:`100%`,height:`100%`,"aria-hidden":`true`,focusable:`false`,children:[(0,i.jsx)(`defs`,{children:(0,i.jsx)(`linearGradient`,{id:c,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,children:e.colors.map((t,n)=>(0,i.jsx)(`stop`,{offset:`${n/(e.colors.length-1)*100}%`,stopColor:t},n))})}),(0,i.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`url(#${c})`})]})}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground min-w-12`,children:l(a)})]})})}function d({minValue:e,maxValue:t,minPosition:n,maxPosition:r,valueFormatter:a}){let o=e=>a?a(e):e.toFixed(2);return(0,i.jsxs)(`div`,{className:`flex gap-4 text-xs text-muted-foreground`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Min:`}),(0,i.jsx)(`span`,{className:`text-foreground font-semibold`,children:o(e)}),(0,i.jsxs)(`span`,{className:`text-gray-400`,children:[`[`,n.row,`, `,n.col,`]`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Max:`}),(0,i.jsx)(`span`,{className:`text-foreground font-semibold`,children:o(t)}),(0,i.jsxs)(`span`,{className:`text-gray-400`,children:[`[`,r.row,`, `,r.col,`]`]})]})]})}function f({enableZoom:e,enablePan:n,enableExport:a,zoom:o,isPanning:s,onZoomIn:c,onZoomOut:l,onResetZoom:u,onTogglePan:d,onExport:f}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 rounded-lg p-1`,children:[e&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onClick:l,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Zoom out`,title:`Zoom out`,children:(0,i.jsx)(r.ZoomOut,{className:`w-4 h-4`})}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground px-2 min-w-12 text-center`,children:[Math.round(o*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,onClick:c,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Zoom in`,title:`Zoom in`,children:(0,i.jsx)(r.ZoomIn,{className:`w-4 h-4`})}),(0,i.jsx)(`button`,{type:`button`,onClick:u,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Reset zoom`,title:`Reset zoom`,children:(0,i.jsx)(r.Maximize2,{className:`w-4 h-4`})}),(0,i.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`})]}),n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onClick:d,className:t.cn(`p-1.5 rounded transition-colors`,s?`bg-primary text-primary-foreground`:`hover:bg-muted text-muted-foreground hover:text-foreground`),"aria-label":`Toggle pan mode`,title:`Toggle pan mode`,children:(0,i.jsx)(r.Move,{className:`w-4 h-4`})}),(0,i.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`})]}),a&&(0,i.jsx)(`button`,{type:`button`,onClick:f,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Export as image`,title:`Export as image`,children:(0,i.jsx)(r.Download,{className:`w-4 h-4`})})]})}function p({data:e,width:r=600,height:o=400,cellSize:p=24,cellGap:m=2,colorScheme:h,colorSchemeName:g=`blues`,showRowLabels:_=!0,showColumnLabels:v=!0,showLegend:y=!0,showMinMax:b=!0,showTooltip:x=!0,enableSelection:S=!0,enableZoom:C=!0,enablePan:w=!0,enableExport:T=!0,initialZoom:E=1,minZoom:D=.5,maxZoom:O=4,valueFormatter:k,onCellClick:A,onSelectionChange:j,className:M,title:N}){let P=n.useRef(null),F=n.useRef(null),I=n.useRef(null),[L,R]=n.useState(null),[z,B]=n.useState(!1),V=c({initialZoom:E,minZoom:D,maxZoom:O,onSelectionChange:j}),H=n.useMemo(()=>h||a[g]||a.blues,[h,g]),{minValue:U,maxValue:W,minPosition:G,maxPosition:K}=n.useMemo(()=>{let t=1/0,n=-1/0,r={row:0,col:0},i={row:0,col:0};return e.values.forEach((e,a)=>{e.forEach((e,o)=>{e<t&&(t=e,r={row:a,col:o}),e>n&&(n=e,i={row:a,col:o})})}),{minValue:t===1/0?0:t,maxValue:n===-1/0?0:n,minPosition:r,maxPosition:i}},[e.values]),q=e.values.length,J=e.values[0]?.length||0,Y=_?80:0;J*(p+m)-m,q*(p+m)-m;let X=n.useCallback((t,n,r,i)=>{if(!x)return;let a=t.currentTarget.getBoundingClientRect(),o=P.current?.getBoundingClientRect();o&&R({value:i,row:n,col:r,rowLabel:e.rowLabels?.[n],colLabel:e.columnLabels?.[r],x:a.left-o.left+a.width/2,y:a.top-o.top,valueFormatter:k})},[x,e.rowLabels,e.columnLabels,k]),Z=n.useCallback((e,t,n)=>{if(!S)return;let r={row:e,col:t,value:n};V.selectedCell?.row===e&&V.selectedCell?.col===t?V.selectCell(null):(V.selectCell(r),A?.(r))},[S,V,A]),Q=n.useCallback(()=>{let t=document.createElement(`canvas`),n=t.getContext(`2d`);if(!n)return;let r=p*2,i=m*2,a=_?160:0,o=v?60:0,c=J*(r+i)-i,l=q*(r+i)-i;t.width=c+a+80,t.height=l+o+80,n.fillStyle=`#ffffff`,n.fillRect(0,0,t.width,t.height),N&&(n.fillStyle=`#1f2937`,n.font=`bold 24px sans-serif`,n.textAlign=`center`,n.fillText(N,t.width/2,30)),v&&e.columnLabels&&(n.fillStyle=`#6b7280`,n.font=`12px sans-serif`,n.textAlign=`center`,e.columnLabels.forEach((e,t)=>{let s=40+a+t*(r+i)+r/2;n.fillText(e,s,40+o-10)})),_&&e.rowLabels&&(n.fillStyle=`#6b7280`,n.font=`12px sans-serif`,n.textAlign=`right`,n.textBaseline=`middle`,e.rowLabels.forEach((e,t)=>{let s=40+o+t*(r+i)+r/2;n.fillText(e,40+a-10,s)})),e.values.forEach((e,t)=>{e.forEach((e,c)=>{let l=40+a+c*(r+i),u=40+o+t*(r+i);n.fillStyle=s(e,U,W,H),n.fillRect(l,u,r,r)})});let u=document.createElement(`a`);u.download=`heatmap-${Date.now()}.png`,u.href=t.toDataURL(`image/png`),u.click()},[p,m,J,q,_,v,e.columnLabels,e.rowLabels,e.values,U,W,H,N]),ee=n.useCallback(e=>{!w||!z||(V.startPanning(),I.current={x:e.clientX,y:e.clientY})},[w,z,V]),te=n.useCallback(e=>{if(!V.isPanning||!I.current)return;let t=e.clientX-I.current.x,n=e.clientY-I.current.y;V.handlePanMove(t,n),I.current={x:e.clientX,y:e.clientY}},[V]),$=n.useCallback(()=>{V.stopPanning(),I.current=null},[V]),ne=n.useCallback(e=>{C&&(e.preventDefault(),e.deltaY<0?V.zoomIn():V.zoomOut())},[C,V]),re=n.useCallback(()=>{B(e=>!e)},[]);return(0,i.jsxs)(`div`,{ref:P,className:t.cn(`flex flex-col gap-3`,M),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[N&&(0,i.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:N}),(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-4`,!N&&`ml-auto`),children:[b&&(0,i.jsx)(d,{minValue:U,maxValue:W,minPosition:G,maxPosition:K,valueFormatter:k}),(C||w||T)&&(0,i.jsx)(f,{enableZoom:C,enablePan:w,enableExport:T,zoom:V.zoom,isPanning:z,onZoomIn:V.zoomIn,onZoomOut:V.zoomOut,onResetZoom:()=>{V.resetZoom(),V.resetPan()},onTogglePan:re,onExport:Q})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`relative overflow-hidden rounded-lg border bg-background`,z&&`cursor-grab`,V.isPanning&&`cursor-grabbing`),style:{width:r,height:o},onMouseDown:ee,onMouseMove:te,onMouseUp:$,onMouseLeave:()=>{$(),R(null)},onWheel:ne,children:[(0,i.jsxs)(`div`,{className:`relative transition-transform duration-150`,style:{transform:`scale(${V.zoom}) translate(${V.pan.x/V.zoom}px, ${V.pan.y/V.zoom}px)`,transformOrigin:`top left`,padding:16},children:[v&&e.columnLabels&&(0,i.jsx)(`div`,{className:`flex`,style:{marginLeft:Y,marginBottom:8},children:e.columnLabels.map((e,t)=>(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground truncate text-center`,style:{width:p,marginRight:m},title:e,children:e},t))}),(0,i.jsxs)(`div`,{className:`flex`,children:[_&&e.rowLabels&&(0,i.jsx)(`div`,{className:`flex flex-col`,style:{width:Y,marginRight:8},children:e.rowLabels.map((e,t)=>(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground truncate text-right flex items-center justify-end`,style:{height:p,marginBottom:m},title:e,children:e},t))}),(0,i.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(${J}, ${p}px)`,gridTemplateRows:`repeat(${q}, ${p}px)`,gap:m},role:`grid`,"aria-label":`Heatmap grid`,children:e.values.flatMap((e,n)=>e.map((e,r)=>{let a=s(e,U,W,H),o=V.selectedCell?.row===n&&V.selectedCell?.col===r,c=b&&G.row===n&&G.col===r,l=b&&K.row===n&&K.col===r;return(0,i.jsx)(`div`,{className:t.cn(`rounded-sm transition-all duration-150`,S&&!z&&`cursor-pointer hover:ring-2 hover:ring-primary/50`,o&&`ring-2 ring-primary ring-offset-1`,(c||l)&&`ring-1 ring-offset-1`,c&&`ring-blue-500`,l&&`ring-red-500`),style:{backgroundColor:a,width:p,height:p},role:`gridcell`,"aria-label":`Value ${e} at row ${n}, column ${r}`,onMouseEnter:t=>!z&&X(t,n,r,e),onMouseLeave:()=>R(null),onClick:()=>!z&&Z(n,r,e)},`${n}-${r}`)}))})]})]}),L&&!z&&(0,i.jsx)(l,{...L}),(0,i.jsx)(`canvas`,{ref:F,className:`hidden`})]}),y&&(0,i.jsx)(`div`,{className:`flex justify-center`,children:(0,i.jsx)(u,{colorScheme:H,minValue:U,maxValue:W,valueFormatter:k})})]})}exports.default=p,exports.useHeatmap=c;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={blues:{type:`sequential`,colors:[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`]},greens:{type:`sequential`,colors:[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`]},reds:{type:`sequential`,colors:[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`]},viridis:{type:`sequential`,colors:[`#440154`,`#482878`,`#3e4989`,`#31688e`,`#26828e`,`#1f9e89`,`#35b779`,`#6ece58`,`#fde725`]},plasma:{type:`sequential`,colors:[`#0d0887`,`#46039f`,`#7201a8`,`#9c179e`,`#bd3786`,`#d8576b`,`#ed7953`,`#fb9f3a`,`#fdca26`]},coolwarm:{type:`diverging`,colors:[`#3b4cc0`,`#5977e3`,`#7b9ff9`,`#9ebeff`,`#c0d4f5`,`#f7f7f7`,`#f4c5ad`,`#f19072`,`#d95f47`,`#b40426`]},rdylgn:{type:`diverging`,colors:[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`]}};function o(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),r=Math.floor(n),i=Math.ceil(n);if(r===i)return e[r];let a=n-r,o=e[r],s=e[i],c=parseInt(o.slice(1,3),16),l=parseInt(o.slice(3,5),16),u=parseInt(o.slice(5,7),16),d=parseInt(s.slice(1,3),16),f=parseInt(s.slice(3,5),16),p=parseInt(s.slice(5,7),16),m=Math.round(c+(d-c)*a),h=Math.round(l+(f-l)*a),g=Math.round(u+(p-u)*a);return`#${m.toString(16).padStart(2,`0`)}${h.toString(16).padStart(2,`0`)}${g.toString(16).padStart(2,`0`)}`}function s(e,t,n,r){if(r.type===`diverging`){let i=Math.max(Math.abs(t),Math.abs(n));if(e===0)return r.colors[Math.floor(r.colors.length/2)];let a=(e+i)/(2*i);return o(r.colors,a)}if(n===t)return r.colors[Math.floor(r.colors.length/2)];let i=(e-t)/(n-t);return o(r.colors,i)}function c(e={}){let{initialZoom:t=1,minZoom:r=.5,maxZoom:i=4,initialPan:a={x:0,y:0},onSelectionChange:o}=e,[s,c]=n.useState(t),[l,u]=n.useState(a),[d,f]=n.useState(null),[p,m]=n.useState(!1);return{zoom:s,pan:l,selectedCell:d,isPanning:p,zoomIn:n.useCallback(()=>{c(e=>Math.min(e*1.2,i))},[i]),zoomOut:n.useCallback(()=>{c(e=>Math.max(e/1.2,r))},[r]),resetZoom:n.useCallback(()=>{c(t)},[t]),setPan:u,resetPan:n.useCallback(()=>{u(a)},[a]),selectCell:n.useCallback(e=>{f(e),o?.(e)},[o]),startPanning:n.useCallback(()=>{m(!0)},[]),stopPanning:n.useCallback(()=>{m(!1)},[]),handlePanMove:n.useCallback((e,t)=>{u(n=>({x:n.x+e,y:n.y+t}))},[])}}function l({value:e,row:t,col:n,rowLabel:r,colLabel:a,x:o,y:s,valueFormatter:c}){let l=c?c(e):e.toFixed(2);return(0,i.jsxs)(`div`,{className:`absolute z-50 px-3 py-2 text-xs font-medium text-white bg-gray-900 rounded-lg shadow-lg pointer-events-none whitespace-nowrap`,style:{left:o,top:s,transform:`translate(-50%, -100%)`,marginTop:-10},children:[(0,i.jsx)(`div`,{className:`font-semibold text-sm`,children:l}),(r||a)&&(0,i.jsxs)(`div`,{className:`text-gray-300 mt-1`,children:[r&&(0,i.jsxs)(`span`,{children:[`Row: `,r]}),r&&a&&(0,i.jsx)(`span`,{className:`mx-1`,children:`|`}),a&&(0,i.jsxs)(`span`,{children:[`Col: `,a]})]}),!r&&!a&&(0,i.jsxs)(`div`,{className:`text-gray-300 mt-1`,children:[`[`,t,`, `,n,`]`]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2.5 h-2.5 bg-gray-900 transform -translate-x-1/2 translate-y-1/2 rotate-45`})]})}function u({colorScheme:e,minValue:r,maxValue:a,valueFormatter:o,className:s}){let c=n.useId(),l=e=>o?o(e):e.toFixed(1);return(0,i.jsx)(`div`,{className:t.cn(`flex flex-col gap-1`,s),children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground min-w-12 text-right`,children:l(r)}),(0,i.jsx)(`div`,{className:`relative h-3 w-32 rounded overflow-hidden`,children:(0,i.jsxs)(`svg`,{width:`100%`,height:`100%`,"aria-hidden":`true`,focusable:`false`,children:[(0,i.jsx)(`defs`,{children:(0,i.jsx)(`linearGradient`,{id:c,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,children:e.colors.map((t,n)=>(0,i.jsx)(`stop`,{offset:`${n/(e.colors.length-1)*100}%`,stopColor:t},n))})}),(0,i.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`url(#${c})`})]})}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground min-w-12`,children:l(a)})]})})}function d({minValue:e,maxValue:t,minPosition:n,maxPosition:r,valueFormatter:a}){let o=e=>a?a(e):e.toFixed(2);return(0,i.jsxs)(`div`,{className:`flex gap-4 text-xs text-muted-foreground`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Min:`}),(0,i.jsx)(`span`,{className:`text-foreground font-semibold`,children:o(e)}),(0,i.jsxs)(`span`,{className:`text-gray-400`,children:[`[`,n.row,`, `,n.col,`]`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Max:`}),(0,i.jsx)(`span`,{className:`text-foreground font-semibold`,children:o(t)}),(0,i.jsxs)(`span`,{className:`text-gray-400`,children:[`[`,r.row,`, `,r.col,`]`]})]})]})}function f({enableZoom:e,enablePan:n,enableExport:a,zoom:o,isPanning:s,onZoomIn:c,onZoomOut:l,onResetZoom:u,onTogglePan:d,onExport:f}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 rounded-lg p-1`,children:[e&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onClick:l,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Zoom out`,title:`Zoom out`,children:(0,i.jsx)(r.ZoomOut,{className:`w-4 h-4`})}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground px-2 min-w-12 text-center`,children:[Math.round(o*100),`%`]}),(0,i.jsx)(`button`,{type:`button`,onClick:c,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Zoom in`,title:`Zoom in`,children:(0,i.jsx)(r.ZoomIn,{className:`w-4 h-4`})}),(0,i.jsx)(`button`,{type:`button`,onClick:u,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Reset zoom`,title:`Reset zoom`,children:(0,i.jsx)(r.Maximize2,{className:`w-4 h-4`})}),(0,i.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`})]}),n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onClick:d,className:t.cn(`p-1.5 rounded transition-colors`,s?`bg-primary text-primary-foreground`:`hover:bg-muted text-muted-foreground hover:text-foreground`),"aria-label":`Toggle pan mode`,title:`Toggle pan mode`,children:(0,i.jsx)(r.Move,{className:`w-4 h-4`})}),(0,i.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`})]}),a&&(0,i.jsx)(`button`,{type:`button`,onClick:f,className:`p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,"aria-label":`Export as image`,title:`Export as image`,children:(0,i.jsx)(r.Download,{className:`w-4 h-4`})})]})}function p({data:e,width:r=600,height:o=400,cellSize:p=24,cellGap:m=2,colorScheme:h,colorSchemeName:g=`blues`,showRowLabels:_=!0,showColumnLabels:v=!0,showLegend:y=!0,showMinMax:b=!0,showTooltip:x=!0,enableSelection:S=!0,enableZoom:C=!0,enablePan:w=!0,enableExport:T=!0,initialZoom:E=1,minZoom:D=.5,maxZoom:O=4,valueFormatter:k,onCellClick:A,onSelectionChange:j,className:M,title:N}){let P=n.useRef(null),F=n.useRef(null),I=n.useRef(null),[L,R]=n.useState(null),[z,B]=n.useState(!1),V=c({initialZoom:E,minZoom:D,maxZoom:O,onSelectionChange:j}),H=n.useMemo(()=>h||a[g]||a.blues,[h,g]),{minValue:U,maxValue:W,minPosition:G,maxPosition:K}=n.useMemo(()=>{let t=1/0,n=-1/0,r={row:0,col:0},i={row:0,col:0};return e.values.forEach((e,a)=>{e.forEach((e,o)=>{e<t&&(t=e,r={row:a,col:o}),e>n&&(n=e,i={row:a,col:o})})}),{minValue:t===1/0?0:t,maxValue:n===-1/0?0:n,minPosition:r,maxPosition:i}},[e.values]),q=e.values.length,J=e.values[0]?.length||0,Y=_?80:0;J*(p+m)-m,q*(p+m)-m;let X=n.useCallback((t,n,r,i)=>{if(!x)return;let a=t.currentTarget.getBoundingClientRect(),o=P.current?.getBoundingClientRect();o&&R({value:i,row:n,col:r,rowLabel:e.rowLabels?.[n],colLabel:e.columnLabels?.[r],x:a.left-o.left+a.width/2,y:a.top-o.top,valueFormatter:k})},[x,e.rowLabels,e.columnLabels,k]),Z=n.useCallback((e,t,n)=>{if(!S)return;let r={row:e,col:t,value:n};V.selectedCell?.row===e&&V.selectedCell?.col===t?V.selectCell(null):(V.selectCell(r),A?.(r))},[S,V,A]),Q=n.useCallback(()=>{let t=document.createElement(`canvas`),n=t.getContext(`2d`);if(!n)return;let r=p*2,i=m*2,a=_?160:0,o=v?60:0,c=J*(r+i)-i,l=q*(r+i)-i;t.width=c+a+80,t.height=l+o+80,n.fillStyle=`#ffffff`,n.fillRect(0,0,t.width,t.height),N&&(n.fillStyle=`#1f2937`,n.font=`bold 24px sans-serif`,n.textAlign=`center`,n.fillText(N,t.width/2,30)),v&&e.columnLabels&&(n.fillStyle=`#6b7280`,n.font=`12px sans-serif`,n.textAlign=`center`,e.columnLabels.forEach((e,t)=>{let s=40+a+t*(r+i)+r/2;n.fillText(e,s,40+o-10)})),_&&e.rowLabels&&(n.fillStyle=`#6b7280`,n.font=`12px sans-serif`,n.textAlign=`right`,n.textBaseline=`middle`,e.rowLabels.forEach((e,t)=>{let s=40+o+t*(r+i)+r/2;n.fillText(e,40+a-10,s)})),e.values.forEach((e,t)=>{e.forEach((e,c)=>{let l=40+a+c*(r+i),u=40+o+t*(r+i),d=s(e,U,W,H);n.fillStyle=d,n.fillRect(l,u,r,r)})});let u=document.createElement(`a`);u.download=`heatmap-${Date.now()}.png`,u.href=t.toDataURL(`image/png`),u.click()},[p,m,J,q,_,v,e.columnLabels,e.rowLabels,e.values,U,W,H,N]),ee=n.useCallback(e=>{!w||!z||(V.startPanning(),I.current={x:e.clientX,y:e.clientY})},[w,z,V]),te=n.useCallback(e=>{if(!V.isPanning||!I.current)return;let t=e.clientX-I.current.x,n=e.clientY-I.current.y;V.handlePanMove(t,n),I.current={x:e.clientX,y:e.clientY}},[V]),$=n.useCallback(()=>{V.stopPanning(),I.current=null},[V]),ne=n.useCallback(e=>{C&&(e.preventDefault(),e.deltaY<0?V.zoomIn():V.zoomOut())},[C,V]),re=n.useCallback(()=>{B(e=>!e)},[]);return(0,i.jsxs)(`div`,{ref:P,className:t.cn(`flex flex-col gap-3`,M),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[N&&(0,i.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:N}),(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-4`,!N&&`ml-auto`),children:[b&&(0,i.jsx)(d,{minValue:U,maxValue:W,minPosition:G,maxPosition:K,valueFormatter:k}),(C||w||T)&&(0,i.jsx)(f,{enableZoom:C,enablePan:w,enableExport:T,zoom:V.zoom,isPanning:z,onZoomIn:V.zoomIn,onZoomOut:V.zoomOut,onResetZoom:()=>{V.resetZoom(),V.resetPan()},onTogglePan:re,onExport:Q})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`relative overflow-hidden rounded-lg border bg-background`,z&&`cursor-grab`,V.isPanning&&`cursor-grabbing`),style:{width:r,height:o},onMouseDown:ee,onMouseMove:te,onMouseUp:$,onMouseLeave:()=>{$(),R(null)},onWheel:ne,children:[(0,i.jsxs)(`div`,{className:`relative transition-transform duration-150`,style:{transform:`scale(${V.zoom}) translate(${V.pan.x/V.zoom}px, ${V.pan.y/V.zoom}px)`,transformOrigin:`top left`,padding:16},children:[v&&e.columnLabels&&(0,i.jsx)(`div`,{className:`flex`,style:{marginLeft:Y,marginBottom:8},children:e.columnLabels.map((e,t)=>(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground truncate text-center`,style:{width:p,marginRight:m},title:e,children:e},t))}),(0,i.jsxs)(`div`,{className:`flex`,children:[_&&e.rowLabels&&(0,i.jsx)(`div`,{className:`flex flex-col`,style:{width:Y,marginRight:8},children:e.rowLabels.map((e,t)=>(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground truncate text-right flex items-center justify-end`,style:{height:p,marginBottom:m},title:e,children:e},t))}),(0,i.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(${J}, ${p}px)`,gridTemplateRows:`repeat(${q}, ${p}px)`,gap:m},role:`grid`,"aria-label":`Heatmap grid`,children:e.values.flatMap((e,n)=>e.map((e,r)=>{let a=s(e,U,W,H),o=V.selectedCell?.row===n&&V.selectedCell?.col===r,c=b&&G.row===n&&G.col===r,l=b&&K.row===n&&K.col===r;return(0,i.jsx)(`div`,{className:t.cn(`rounded-sm transition-all duration-150`,S&&!z&&`cursor-pointer hover:ring-2 hover:ring-primary/50`,o&&`ring-2 ring-primary ring-offset-1`,(c||l)&&`ring-1 ring-offset-1`,c&&`ring-blue-500`,l&&`ring-red-500`),style:{backgroundColor:a,width:p,height:p},role:`gridcell`,"aria-label":`Value ${e} at row ${n}, column ${r}`,onMouseEnter:t=>!z&&X(t,n,r,e),onMouseLeave:()=>R(null),onClick:()=>!z&&Z(n,r,e)},`${n}-${r}`)}))})]})]}),L&&!z&&(0,i.jsx)(l,{...L}),(0,i.jsx)(`canvas`,{ref:F,className:`hidden`})]}),y&&(0,i.jsx)(`div`,{className:`flex justify-center`,children:(0,i.jsx)(u,{colorScheme:H,minValue:U,maxValue:W,valueFormatter:k})})]})}exports.WakaHeatmap=p,exports.default=p,exports.useHeatmap=c;
|
|
@@ -427,8 +427,8 @@ function v({ data: n, width: r = 600, height: i = 400, cellSize: a = 24, cellGap
|
|
|
427
427
|
t.fillText(e, 40 + s - 10, a);
|
|
428
428
|
})), n.values.forEach((e, n) => {
|
|
429
429
|
e.forEach((e, a) => {
|
|
430
|
-
let o = 40 + s + a * (r + i), l = 40 + c + n * (r + i);
|
|
431
|
-
t.fillStyle =
|
|
430
|
+
let o = 40 + s + a * (r + i), l = 40 + c + n * (r + i), u = f(e, W, G, U);
|
|
431
|
+
t.fillStyle = u, t.fillRect(o, l, r, r);
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
434
|
let d = document.createElement("a");
|
|
@@ -604,4 +604,4 @@ function v({ data: n, width: r = 600, height: i = 400, cellSize: a = 24, cellGap
|
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
607
|
-
export { v as default, p as useHeatmap };
|
|
607
|
+
export { v as WakaHeatmap, v as default, p as useHeatmap };
|
|
@@ -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");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={help:r.HelpCircle,info:r.Info,lightbulb:r.Lightbulb,star:r.Star,zap:r.Zap,alert:r.AlertCircle},o={primary:{bg:`bg-primary`,text:`text-primary-foreground`,ring:`ring-primary/30`,pulse:`bg-primary/40`},secondary:{bg:`bg-secondary`,text:`text-secondary-foreground`,ring:`ring-secondary/30`,pulse:`bg-secondary/40`},destructive:{bg:`bg-destructive`,text:`text-destructive-foreground`,ring:`ring-destructive/30`,pulse:`bg-destructive/40`},warning:{bg:`bg-amber-500`,text:`text-white`,ring:`ring-amber-500/30`,pulse:`bg-amber-500/40`},success:{bg:`bg-emerald-500`,text:`text-white`,ring:`ring-emerald-500/30`,pulse:`bg-emerald-500/40`},info:{bg:`bg-sky-500`,text:`text-white`,ring:`ring-sky-500/30`,pulse:`bg-sky-500/40`}},s={sm:{dot:`h-2 w-2`,icon:`h-5 w-5`,badge:`h-5 min-w-5 px-1.5 text-xs`,iconSize:`h-3 w-3`,tooltip:`max-w-56 p-2.5 text-xs`},default:{dot:`h-3 w-3`,icon:`h-7 w-7`,badge:`h-6 min-w-6 px-2 text-xs`,iconSize:`h-4 w-4`,tooltip:`max-w-72 p-3 text-sm`},lg:{dot:`h-4 w-4`,icon:`h-9 w-9`,badge:`h-7 min-w-7 px-2.5 text-sm`,iconSize:`h-5 w-5`,tooltip:`max-w-80 p-4 text-sm`}},c={top:`bottom-full left-1/2 -translate-x-1/2 mb-2`,bottom:`top-full left-1/2 -translate-x-1/2 mt-2`,left:`right-full top-1/2 -translate-y-1/2 mr-2`,right:`left-full top-1/2 -translate-y-1/2 ml-2`,"top-left":`bottom-full right-0 mb-2`,"top-right":`bottom-full left-0 mb-2`,"bottom-left":`top-full right-0 mt-2`,"bottom-right":`top-full left-0 mt-2`},l={top:`top-full left-1/2 -translate-x-1/2 border-t-popover border-x-transparent border-b-transparent`,bottom:`bottom-full left-1/2 -translate-x-1/2 border-b-popover border-x-transparent border-t-transparent`,left:`left-full top-1/2 -translate-y-1/2 border-l-popover border-y-transparent border-r-transparent`,right:`right-full top-1/2 -translate-y-1/2 border-r-popover border-y-transparent border-l-transparent`,"top-left":`top-full right-3 border-t-popover border-x-transparent border-b-transparent`,"top-right":`top-full left-3 border-t-popover border-x-transparent border-b-transparent`,"bottom-left":`bottom-full right-3 border-b-popover border-x-transparent border-t-transparent`,"bottom-right":`bottom-full left-3 border-b-popover border-x-transparent border-t-transparent`};function u({id:e,content:u,title:d,variant:f=`dot`,iconType:p=`help`,customIcon:m,size:h=`default`,position:g=`top`,trigger:_=`click`,autoDismissMs:v=0,showOnce:y=!1,storageKeyPrefix:b=`waka-hotspot-seen`,color:x=`primary`,customColor:S,zIndex:C=50,disablePulse:w=!1,disableAppearAnimation:T=!1,onShow:E,onHide:D,onDismiss:O,onFirstSeen:k,className:A,tooltipClassName:j,badgeText:M,children:N}){let[P,F]=n.useState(!1),[ee,I]=n.useState(!1),[L,R]=n.useState(!1),[z,B]=n.useState(!1),V=n.useRef(null),H=n.useRef(void 0),U=`${b}-${e}`;n.useEffect(()=>{y&&typeof window<`u`&&localStorage.getItem(U)===`true`&&(I(!0),R(!0));let e=setTimeout(()=>B(!0),50);return()=>clearTimeout(e)},[y,U]),n.useEffect(()=>(P&&v>0&&(H.current=setTimeout(()=>{G()},v)),()=>{H.current&&clearTimeout(H.current)}),[P,v]),n.useEffect(()=>{if(!P)return;let e=e=>{V.current&&!V.current.contains(e.target)&&G()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[P]);let W=()=>{L||(F(!0),E?.())},G=()=>{F(!1),D?.()},K=()=>{G(),y&&typeof window<`u`&&(localStorage.setItem(U,`true`),I(!0),R(!0),k?.()),O?.()},q=()=>{(_===`click`||_===`both`)&&(P?G():W())},J=()=>{(_===`hover`||_===`both`)&&W()},Y=()=>{_===`hover`&&G()};if(L)return N?(0,i.jsx)(i.Fragment,{children:N}):null;let X=o[x],Z=s[h],Q=a[p],$=(0,i.jsxs)(`div`,{ref:V,className:`relative inline-flex`,style:{zIndex:C},onClick:q,onMouseEnter:J,onMouseLeave:Y,children:[(()=>{let e=t.cn(`relative cursor-pointer transition-all duration-200`,!T&&!z&&`scale-0 opacity-0`,!T&&z&&`scale-100 opacity-100`),n=S?{backgroundColor:S}:void 0,r=S?{backgroundColor:`${S}40`}:void 0;switch(f){case`dot`:return(0,i.jsxs)(`div`,{className:t.cn(e,`relative`,A),children:[!w&&(0,i.jsx)(`span`,{className:t.cn(`absolute inset-0 rounded-full animate-ping`,!S&&X.pulse),style:r}),(0,i.jsx)(`span`,{className:t.cn(`relative block rounded-full ring-2`,Z.dot,!S&&X.bg,!S&&X.ring),style:n})]});case`icon`:return(0,i.jsxs)(`div`,{className:t.cn(e,`flex items-center justify-center rounded-full shadow-md`,Z.icon,!S&&X.bg,!S&&X.text,A),style:n,children:[!w&&(0,i.jsx)(`span`,{className:t.cn(`absolute inset-0 rounded-full animate-ping`,!S&&X.pulse),style:r}),m||(0,i.jsx)(Q,{className:Z.iconSize})]});case`badge`:return(0,i.jsxs)(`div`,{className:t.cn(e,`flex items-center justify-center rounded-full font-medium shadow-md`,Z.badge,!S&&X.bg,!S&&X.text,A),style:n,children:[!w&&(0,i.jsx)(`span`,{className:t.cn(`absolute inset-0 rounded-full animate-ping`,!S&&X.pulse),style:r}),M||m||(0,i.jsx)(Q,{className:Z.iconSize})]})}})(),P&&(0,i.jsx)(`div`,{className:t.cn(`absolute`,c[g],`animate-in fade-in-0 zoom-in-95 duration-200`),style:{zIndex:C+1},children:(0,i.jsxs)(`div`,{className:t.cn(`relative rounded-lg border bg-popover text-popover-foreground shadow-lg`,Z.tooltip,j),children:[(0,i.jsx)(`span`,{className:t.cn(`absolute border-4`,l[g])}),(0,i.jsx)(`button`,{onClick:e=>{e.stopPropagation(),K()},className:`absolute right-1.5 top-1.5 rounded-md p-0.5 hover:bg-accent transition-colors`,"aria-label":`Close`,children:(0,i.jsx)(r.X,{className:`h-3 w-3 text-muted-foreground`})}),(0,i.jsxs)(`div`,{className:`pr-5`,children:[d&&(0,i.jsx)(`div`,{className:`font-semibold mb-1`,children:d}),(0,i.jsx)(`div`,{className:`text-muted-foreground`,children:u})]})]})})]});return N?(0,i.jsxs)(`div`,{className:`relative inline-block`,children:[N,(0,i.jsx)(`div`,{className:`absolute -top-1 -right-1`,children:$})]}):$}function d({id:e,showOnce:t=!1,storageKeyPrefix:r=`waka-hotspot-seen`,autoShow:i=!1,autoShowDelay:a=500}){let[o,s]=n.useState(!1),[c,l]=n.useState(!1),u=`${r}-${e}`;return n.useEffect(()=>{if(!(typeof window>`u`)){if(t&&localStorage.getItem(u)===`true`){l(!0);return}if(i){let e=setTimeout(()=>{s(!0)},a);return()=>clearTimeout(e)}}},[t,u,i,a]),{isVisible:o,hasSeen:c,show:n.useCallback(()=>{(!c||!t)&&s(!0)},[c,t]),hide:n.useCallback(()=>{s(!1)},[]),dismiss:n.useCallback(()=>{s(!1),t&&typeof window<`u`&&(localStorage.setItem(u,`true`),l(!0))},[t,u]),reset:n.useCallback(()=>{typeof window<`u`&&localStorage.removeItem(u),l(!1),s(!1)},[u])}}function f({steps:e,active:t,currentStep:r,onStepChange:a,onComplete:o,onSkip:s,showStepIndicator:c=!0,hotspotProps:l}){let[d,f]=n.useState(0),p=r??d,m=t=>{if(t>=e.length){o?.();return}f(t),a?.(t)},h=()=>{m(p+1)},g=()=>{s?.()};if(!t||e.length===0)return null;let _=e[p];return _?(0,i.jsx)(u,{...l,id:_.id,content:(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{children:_.content}),c&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between mt-3 pt-2 border-t`,children:[(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[p+1,` of `,e.length]}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[p<e.length-1&&(0,i.jsx)(`button`,{onClick:g,className:`text-xs text-muted-foreground hover:text-foreground`,children:`Skip`}),(0,i.jsx)(`button`,{onClick:h,className:`text-xs font-medium text-primary hover:underline`,children:p===e.length-1?`Done`:`Next`})]})]})]}),title:_.title,position:_.position,trigger:`click`,showOnce:!1}):null}exports.WakaHotspot=u,exports.WakaHotspotGroup=f,exports.useHotspot=d;
|
|
@@ -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("../button/index.cjs.js"),r=require("../dialog/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");function s({src:e,alt:s,width:c,height:l,placeholder:u,placeholderColor:d=`bg-muted`,lazy:f=!0,zoomable:p=!1,maxZoom:m=3,objectFit:h=`cover`,objectPosition:g=`center`,rounded:_=`md`,showLoader:v=!0,onLoad:y,onError:b,onZoomChange:x,className:S,containerClassName:C,aspectRatio:w}){let[T,E]=i.useState(!1),[D,O]=i.useState(!1),[k,A]=i.useState(!1),[j,M]=i.useState(1),[N,P]=i.useState({x:0,y:0}),[F,I]=i.useState(!1),[L,R]=i.useState({x:0,y:0}),z=i.useRef(null),B={none:`rounded-none`,sm:`rounded-sm`,md:`rounded-md`,lg:`rounded-lg`,xl:`rounded-xl`,full:`rounded-full`},V=()=>{E(!0),y?.()},H=()=>{O(!0),b?.()},U=()=>{p&&(A(!0),M(1),P({x:0,y:0}))},W=()=>{let e=Math.min(j+.5,m);M(e),x?.(e)},G=()=>{let e=Math.max(j-.5,1);M(e),e===1&&P({x:0,y:0}),x?.(e)},K=e=>{e.preventDefault(),e.deltaY<0?W():G()},q=e=>{j>1&&(I(!0),R({x:e.clientX-N.x,y:e.clientY-N.y}))},J=e=>{F&&j>1&&P({x:e.clientX-L.x,y:e.clientY-L.y})},Y=()=>{I(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`div`,{className:t.cn(`relative overflow-hidden`,B[_],C),style:{width:c,height:l,aspectRatio:w},children:[(!T||D)&&(0,o.jsx)(`div`,{className:t.cn(`absolute inset-0 flex items-center justify-center`,d,B[_]),children:u?(0,o.jsx)(`img`,{src:u,alt:``,className:t.cn(`w-full h-full`,`object-${h}`),style:{objectPosition:g}}):D?(0,o.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-muted-foreground`,children:[(0,o.jsx)(a.ImageIcon,{className:`h-8 w-8`}),(0,o.jsx)(`span`,{className:`text-xs`,children:`Erreur de chargement`})]}):v?(0,o.jsx)(`div`,{className:`animate-pulse`,children:(0,o.jsx)(a.ImageIcon,{className:`h-8 w-8 text-muted-foreground`})}):null}),!D&&(0,o.jsx)(`img`,{ref:z,src:e,alt:s,loading:f?`lazy`:`eager`,onLoad:V,onError:H,onClick:U,className:t.cn(`w-full h-full transition-opacity duration-300`,`object-${h}`,T?`opacity-100`:`opacity-0`,p&&`cursor-zoom-in`,B[_],S),style:{objectPosition:g}}),p&&T&&!D&&(0,o.jsx)(`div`,{className:`absolute bottom-2 right-2 p-1 bg-black/50 rounded text-white`,children:(0,o.jsx)(a.Maximize2,{className:`h-4 w-4`})})]}),p&&(0,o.jsx)(r.Dialog,{open:k,onOpenChange:A,children:(0,o.jsxs)(r.DialogContent,{className:`max-w-[95vw] max-h-[95vh] p-0 overflow-hidden bg-black/95`,onWheel:K,children:[(0,o.jsxs)(`div`,{className:`absolute top-4 right-4 z-50 flex gap-2`,children:[(0,o.jsx)(n.Button,{variant:`secondary`,size:`icon`,onClick:G,disabled:j<=1,children:(0,o.jsx)(a.ZoomOut,{className:`h-4 w-4`})}),(0,o.jsx)(n.Button,{variant:`secondary`,size:`icon`,onClick:W,disabled:j>=m,children:(0,o.jsx)(a.ZoomIn,{className:`h-4 w-4`})}),(0,o.jsx)(n.Button,{variant:`secondary`,size:`icon`,onClick:async()=>{try{let t=await(await fetch(e)).blob(),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=s||`image`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n)}catch(e){console.error(`Failed to download image:`,e)}},children:(0,o.jsx)(a.Download,{className:`h-4 w-4`})}),(0,o.jsx)(r.DialogClose,{asChild:!0,children:(0,o.jsx)(n.Button,{variant:`secondary`,size:`icon`,children:(0,o.jsx)(a.X,{className:`h-4 w-4`})})})]}),(0,o.jsxs)(`div`,{className:`absolute bottom-4 left-4 z-50 text-white text-sm bg-black/50 px-2 py-1 rounded`,children:[Math.round(j*100),`%`]}),(0,o.jsx)(`div`,{className:t.cn(`w-full h-full flex items-center justify-center overflow-hidden`,j>1?`cursor-grab`:`cursor-default`,F&&`cursor-grabbing`),onMouseDown:q,onMouseMove:J,onMouseUp:Y,onMouseLeave:Y,children:(0,o.jsx)(`img`,{src:e,alt:s,className:`max-w-none select-none`,style:{transform:`scale(${j}) translate(${N.x/j}px, ${N.y/j}px)`,transition:F?`none`:`transform 0.2s ease-out`},draggable:!1})})]})})]})}function c({images:e,columns:n=3,gap:r=4,aspectRatio:i=`1/1`,className:a}){return(0,o.jsx)(`div`,{className:t.cn(`grid`,a),style:{gridTemplateColumns:`repeat(${n}, 1fr)`,gap:`${r*4}px`},children:e.map((e,t)=>(0,o.jsx)(s,{src:e.thumbnail||e.src,alt:e.alt,zoomable:!0,objectFit:`cover`,containerClassName:`w-full`,aspectRatio:i},t))})}exports.WakaImage=s,exports.default=s,exports.WakaImageGallery=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={critical:{icon:r.AlertTriangle,color:`text-red-600 dark:text-red-400`,bgColor:`bg-red-100 dark:bg-red-900/30`,borderColor:`border-red-500`,label:`Critical`},major:{icon:r.AlertCircle,color:`text-orange-600 dark:text-orange-400`,bgColor:`bg-orange-100 dark:bg-orange-900/30`,borderColor:`border-orange-500`,label:`Major`},minor:{icon:r.AlertCircle,color:`text-yellow-600 dark:text-yellow-400`,bgColor:`bg-yellow-100 dark:bg-yellow-900/30`,borderColor:`border-yellow-500`,label:`Minor`},info:{icon:r.Info,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,borderColor:`border-blue-500`,label:`Info`}},o={investigating:{icon:r.Search,color:`text-purple-600 dark:text-purple-400`,bgColor:`bg-purple-100 dark:bg-purple-900/30`,label:`Investigating`},identified:{icon:r.Eye,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,label:`Identified`},monitoring:{icon:r.Clock,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-100 dark:bg-amber-900/30`,label:`Monitoring`},resolved:{icon:r.CheckCircle2,color:`text-green-600 dark:text-green-400`,bgColor:`bg-green-100 dark:bg-green-900/30`,label:`Resolved`}};function s(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<1?`Just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:e.toLocaleDateString()}function c(e,t){let n=(t||new Date).getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),a=Math.floor(n/864e5);return r<60?`${r}m`:i<24?`${i}h ${r%60}m`:`${a}d ${i%24}h`}function l(e,t,n=864e5){let r=(t||new Date).getTime()-e.getTime();return Math.min(r/n*100,100)}function u(e){return e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function d({status:e,className:n}){let r=o[e],a=r.icon;return(0,i.jsxs)(`span`,{className:t.cn(`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium`,r.bgColor,r.color,n),children:[(0,i.jsx)(a,{className:`h-3 w-3`}),r.label]})}function f({severity:e,size:n=`md`}){let r=a[e],o=r.icon;return(0,i.jsx)(`div`,{className:t.cn(`rounded-full flex items-center justify-center flex-shrink-0 border-2 border-background shadow-sm`,{sm:`h-6 w-6`,md:`h-8 w-8`,lg:`h-10 w-10`}[n],r.bgColor),children:(0,i.jsx)(o,{className:t.cn({sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`}[n],r.color)})})}function p({startedAt:e,resolvedAt:n,severity:r}){let o=l(e,n),s=a[r];return(0,i.jsxs)(`div`,{className:`w-full`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground mb-1`,children:[(0,i.jsxs)(`span`,{children:[`Duration: `,c(e,n)]}),!n&&(0,i.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`Ongoing`})]}),(0,i.jsx)(`div`,{className:`h-1.5 bg-muted rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-500`,s.borderColor.replace(`border-`,`bg-`)),style:{width:`${o}%`}})})]})}function m({impact:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.services!==void 0&&(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.Server,{className:`h-3 w-3`}),e.services,` service`,e.services===1?``:`s`]}),e.users!==void 0&&(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.Users,{className:`h-3 w-3`}),e.users.toLocaleString(),` user`,e.users===1?``:`s`]})]})}function h({update:e}){return(0,i.jsx)(`div`,{className:`flex gap-3 py-2 border-l-2 border-muted pl-3`,children:(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,i.jsx)(`span`,{children:u(e.timestamp)}),(0,i.jsx)(`span`,{className:`font-medium text-foreground`,children:e.status})]}),(0,i.jsx)(`p`,{className:`text-sm`,children:e.message})]})})}function g({incident:e,onIncidentClick:o,showImpact:c,isNew:l}){let[u,f]=n.useState(!1),g=a[e.severity],_=e.updates&&e.updates.length>0;return(0,i.jsxs)(`div`,{className:t.cn(`relative p-4 rounded-lg border bg-card transition-all duration-300`,g.borderColor,`border-l-4`,o&&`cursor-pointer hover:shadow-md`,l&&`animate-in slide-in-from-left-5 fade-in duration-500`),onClick:()=>o?.(e.id),children:[(0,i.jsxs)(`div`,{className:`flex items-start gap-3 mb-3`,children:[(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,i.jsx)(`h4`,{className:`font-semibold text-sm`,children:e.title}),(0,i.jsx)(d,{status:e.status})]}),e.description&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:e.description})]}),(0,i.jsxs)(`div`,{className:`text-xs text-muted-foreground text-right`,children:[(0,i.jsx)(`div`,{children:s(e.startedAt)}),(0,i.jsx)(`div`,{className:`mt-0.5`,children:(0,i.jsx)(`span`,{className:t.cn(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium`,g.bgColor,g.color),children:g.label})})]})]}),(0,i.jsx)(`div`,{className:`mb-3`,children:(0,i.jsx)(p,{startedAt:e.startedAt,resolvedAt:e.resolvedAt,severity:e.severity})}),c&&e.impact&&(0,i.jsx)(`div`,{className:`mb-3`,children:(0,i.jsx)(m,{impact:e.impact})}),_&&(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`button`,{className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,onClick:e=>{e.stopPropagation(),f(!u)},children:[u?(0,i.jsx)(r.ChevronUp,{className:`h-3 w-3`}):(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`}),e.updates.length,` update`,e.updates.length===1?``:`s`]}),u&&(0,i.jsx)(`div`,{className:`mt-3 space-y-1 animate-in slide-in-from-top-2 fade-in duration-200`,children:e.updates.map((e,t)=>(0,i.jsx)(h,{update:e},t))})]})]})}function _({date:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,i.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,i.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-2`,children:(e=>{let t=new Date,n=new Date(t);return n.setDate(n.getDate()-1),e.toDateString()===t.toDateString()?`Today`:e.toDateString()===n.toDateString()?`Yesterday`:e.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})})(e)}),(0,i.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function v({severityFilter:e,statusFilter:n,onSeverityChange:s,onStatusChange:c}){return(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-3 bg-muted/50 rounded-lg mb-4`,children:[(0,i.jsx)(r.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground mr-2`,children:`Filter:`}),(0,i.jsx)(`div`,{className:`flex items-center gap-1`,children:Object.keys(a).map(n=>{let r=a[n],o=e===n;return(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded text-xs font-medium transition-all`,o?t.cn(r.bgColor,r.color):`bg-background hover:bg-muted text-muted-foreground`),onClick:()=>s(o?null:n),children:r.label},n)})}),(0,i.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,i.jsx)(`div`,{className:`flex items-center gap-1`,children:Object.keys(o).map(e=>{let r=o[e],a=n===e;return(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded text-xs font-medium transition-all`,a?t.cn(r.bgColor,r.color):`bg-background hover:bg-muted text-muted-foreground`),onClick:()=>c(a?null:e),children:r.label},e)})}),(e||n)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,i.jsxs)(`button`,{className:`px-2 py-1 rounded text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-all flex items-center gap-1`,onClick:()=>{s(null),c(null)},children:[(0,i.jsx)(r.X,{className:`h-3 w-3`}),`Clear`]})]})]})}function y({incidents:e,onIncidentClick:a,showFilters:o=!0,showImpact:s=!0,maxItems:c,className:l}){let[u,d]=n.useState(null),[p,m]=n.useState(null),[h,y]=n.useState(new Set);n.useEffect(()=>{y(new Set(e.map(e=>e.id)))},[e]);let b=n.useMemo(()=>{let t=e;return u&&(t=t.filter(e=>e.severity===u)),p&&(t=t.filter(e=>e.status===p)),c&&c>0&&(t=t.slice(0,c)),t},[e,u,p,c]),x=n.useMemo(()=>{let e=[],t=null;return b.forEach(n=>{let r=new Date(n.startedAt).toDateString();r===t?e[e.length-1].incidents.push(n):(t=r,e.push({date:new Date(n.startedAt),incidents:[n]}))}),e},[b]),S=e=>!h.has(e);return e.length===0?(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col items-center justify-center py-12 text-center`,l),children:[(0,i.jsx)(r.CheckCircle2,{className:`h-12 w-12 text-green-500 mb-4`}),(0,i.jsx)(`h3`,{className:`font-semibold text-lg mb-1`,children:`All Systems Operational`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No incidents to display`})]}):(0,i.jsxs)(`div`,{className:t.cn(`w-full`,l),children:[o&&(0,i.jsx)(v,{severityFilter:u,statusFilter:p,onSeverityChange:d,onStatusChange:m}),(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`div`,{className:`absolute left-4 top-0 bottom-0 w-0.5 bg-border`}),(0,i.jsx)(`div`,{className:`space-y-4`,children:x.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`relative pl-10 mb-3`,children:[(0,i.jsx)(`div`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 rounded-full bg-background border-2 border-muted`}),(0,i.jsx)(_,{date:e.date})]}),(0,i.jsx)(`div`,{className:`space-y-3`,children:e.incidents.map(e=>(0,i.jsxs)(`div`,{className:`relative flex items-start gap-4 pl-10`,children:[(0,i.jsx)(`div`,{className:`absolute left-0`,children:(0,i.jsx)(f,{severity:e.severity,size:`md`})}),(0,i.jsx)(`div`,{className:`flex-1`,children:(0,i.jsx)(g,{incident:e,onIncidentClick:a,showImpact:s,isNew:S(e.id)})})]},e.id))})]},t))}),b.length===0&&e.length>0&&(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,i.jsx)(r.Filter,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No incidents match the current filters`})]})]})]})}exports.default=y;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={critical:{icon:r.AlertTriangle,color:`text-red-600 dark:text-red-400`,bgColor:`bg-red-100 dark:bg-red-900/30`,borderColor:`border-red-500`,label:`Critical`},major:{icon:r.AlertCircle,color:`text-orange-600 dark:text-orange-400`,bgColor:`bg-orange-100 dark:bg-orange-900/30`,borderColor:`border-orange-500`,label:`Major`},minor:{icon:r.AlertCircle,color:`text-yellow-600 dark:text-yellow-400`,bgColor:`bg-yellow-100 dark:bg-yellow-900/30`,borderColor:`border-yellow-500`,label:`Minor`},info:{icon:r.Info,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,borderColor:`border-blue-500`,label:`Info`}},o={investigating:{icon:r.Search,color:`text-purple-600 dark:text-purple-400`,bgColor:`bg-purple-100 dark:bg-purple-900/30`,label:`Investigating`},identified:{icon:r.Eye,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,label:`Identified`},monitoring:{icon:r.Clock,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-100 dark:bg-amber-900/30`,label:`Monitoring`},resolved:{icon:r.CheckCircle2,color:`text-green-600 dark:text-green-400`,bgColor:`bg-green-100 dark:bg-green-900/30`,label:`Resolved`}};function s(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<1?`Just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:e.toLocaleDateString()}function c(e,t){let n=(t||new Date).getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),a=Math.floor(n/864e5);return r<60?`${r}m`:i<24?`${i}h ${r%60}m`:`${a}d ${i%24}h`}function l(e,t,n=864e5){let r=(t||new Date).getTime()-e.getTime();return Math.min(r/n*100,100)}function u(e){return e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function d({status:e,className:n}){let r=o[e],a=r.icon;return(0,i.jsxs)(`span`,{className:t.cn(`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium`,r.bgColor,r.color,n),children:[(0,i.jsx)(a,{className:`h-3 w-3`}),r.label]})}function f({severity:e,size:n=`md`}){let r=a[e],o=r.icon;return(0,i.jsx)(`div`,{className:t.cn(`rounded-full flex items-center justify-center flex-shrink-0 border-2 border-background shadow-sm`,{sm:`h-6 w-6`,md:`h-8 w-8`,lg:`h-10 w-10`}[n],r.bgColor),children:(0,i.jsx)(o,{className:t.cn({sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`}[n],r.color)})})}function p({startedAt:e,resolvedAt:n,severity:r}){let o=l(e,n),s=a[r];return(0,i.jsxs)(`div`,{className:`w-full`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground mb-1`,children:[(0,i.jsxs)(`span`,{children:[`Duration: `,c(e,n)]}),!n&&(0,i.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`Ongoing`})]}),(0,i.jsx)(`div`,{className:`h-1.5 bg-muted rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-500`,s.borderColor.replace(`border-`,`bg-`)),style:{width:`${o}%`}})})]})}function m({impact:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.services!==void 0&&(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.Server,{className:`h-3 w-3`}),e.services,` service`,e.services===1?``:`s`]}),e.users!==void 0&&(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.Users,{className:`h-3 w-3`}),e.users.toLocaleString(),` user`,e.users===1?``:`s`]})]})}function h({update:e}){return(0,i.jsx)(`div`,{className:`flex gap-3 py-2 border-l-2 border-muted pl-3`,children:(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,i.jsx)(`span`,{children:u(e.timestamp)}),(0,i.jsx)(`span`,{className:`font-medium text-foreground`,children:e.status})]}),(0,i.jsx)(`p`,{className:`text-sm`,children:e.message})]})})}function g({incident:e,onIncidentClick:o,showImpact:c,isNew:l}){let[u,f]=n.useState(!1),g=a[e.severity],_=e.updates&&e.updates.length>0;return(0,i.jsxs)(`div`,{className:t.cn(`relative p-4 rounded-lg border bg-card transition-all duration-300`,g.borderColor,`border-l-4`,o&&`cursor-pointer hover:shadow-md`,l&&`animate-in slide-in-from-left-5 fade-in duration-500`),onClick:()=>o?.(e.id),children:[(0,i.jsxs)(`div`,{className:`flex items-start gap-3 mb-3`,children:[(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,i.jsx)(`h4`,{className:`font-semibold text-sm`,children:e.title}),(0,i.jsx)(d,{status:e.status})]}),e.description&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:e.description})]}),(0,i.jsxs)(`div`,{className:`text-xs text-muted-foreground text-right`,children:[(0,i.jsx)(`div`,{children:s(e.startedAt)}),(0,i.jsx)(`div`,{className:`mt-0.5`,children:(0,i.jsx)(`span`,{className:t.cn(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium`,g.bgColor,g.color),children:g.label})})]})]}),(0,i.jsx)(`div`,{className:`mb-3`,children:(0,i.jsx)(p,{startedAt:e.startedAt,resolvedAt:e.resolvedAt,severity:e.severity})}),c&&e.impact&&(0,i.jsx)(`div`,{className:`mb-3`,children:(0,i.jsx)(m,{impact:e.impact})}),_&&(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`button`,{className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,onClick:e=>{e.stopPropagation(),f(!u)},children:[u?(0,i.jsx)(r.ChevronUp,{className:`h-3 w-3`}):(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`}),e.updates.length,` update`,e.updates.length===1?``:`s`]}),u&&(0,i.jsx)(`div`,{className:`mt-3 space-y-1 animate-in slide-in-from-top-2 fade-in duration-200`,children:e.updates.map((e,t)=>(0,i.jsx)(h,{update:e},t))})]})]})}function _({date:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,i.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,i.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-2`,children:(e=>{let t=new Date,n=new Date(t);return n.setDate(n.getDate()-1),e.toDateString()===t.toDateString()?`Today`:e.toDateString()===n.toDateString()?`Yesterday`:e.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})})(e)}),(0,i.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function v({severityFilter:e,statusFilter:n,onSeverityChange:s,onStatusChange:c}){return(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-3 bg-muted/50 rounded-lg mb-4`,children:[(0,i.jsx)(r.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground mr-2`,children:`Filter:`}),(0,i.jsx)(`div`,{className:`flex items-center gap-1`,children:Object.keys(a).map(n=>{let r=a[n],o=e===n;return(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded text-xs font-medium transition-all`,o?t.cn(r.bgColor,r.color):`bg-background hover:bg-muted text-muted-foreground`),onClick:()=>s(o?null:n),children:r.label},n)})}),(0,i.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,i.jsx)(`div`,{className:`flex items-center gap-1`,children:Object.keys(o).map(e=>{let r=o[e],a=n===e;return(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded text-xs font-medium transition-all`,a?t.cn(r.bgColor,r.color):`bg-background hover:bg-muted text-muted-foreground`),onClick:()=>c(a?null:e),children:r.label},e)})}),(e||n)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`h-4 w-px bg-border mx-1`}),(0,i.jsxs)(`button`,{className:`px-2 py-1 rounded text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-all flex items-center gap-1`,onClick:()=>{s(null),c(null)},children:[(0,i.jsx)(r.X,{className:`h-3 w-3`}),`Clear`]})]})]})}function y({incidents:e,onIncidentClick:a,showFilters:o=!0,showImpact:s=!0,maxItems:c,className:l}){let[u,d]=n.useState(null),[p,m]=n.useState(null),[h,y]=n.useState(new Set);n.useEffect(()=>{let t=new Set(e.map(e=>e.id));y(t)},[e]);let b=n.useMemo(()=>{let t=e;return u&&(t=t.filter(e=>e.severity===u)),p&&(t=t.filter(e=>e.status===p)),c&&c>0&&(t=t.slice(0,c)),t},[e,u,p,c]),x=n.useMemo(()=>{let e=[],t=null;return b.forEach(n=>{let r=new Date(n.startedAt).toDateString();r===t?e[e.length-1].incidents.push(n):(t=r,e.push({date:new Date(n.startedAt),incidents:[n]}))}),e},[b]),S=e=>!h.has(e);return e.length===0?(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col items-center justify-center py-12 text-center`,l),children:[(0,i.jsx)(r.CheckCircle2,{className:`h-12 w-12 text-green-500 mb-4`}),(0,i.jsx)(`h3`,{className:`font-semibold text-lg mb-1`,children:`All Systems Operational`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No incidents to display`})]}):(0,i.jsxs)(`div`,{className:t.cn(`w-full`,l),children:[o&&(0,i.jsx)(v,{severityFilter:u,statusFilter:p,onSeverityChange:d,onStatusChange:m}),(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`div`,{className:`absolute left-4 top-0 bottom-0 w-0.5 bg-border`}),(0,i.jsx)(`div`,{className:`space-y-4`,children:x.map((e,t)=>(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`relative pl-10 mb-3`,children:[(0,i.jsx)(`div`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 rounded-full bg-background border-2 border-muted`}),(0,i.jsx)(_,{date:e.date})]}),(0,i.jsx)(`div`,{className:`space-y-3`,children:e.incidents.map(e=>(0,i.jsxs)(`div`,{className:`relative flex items-start gap-4 pl-10`,children:[(0,i.jsx)(`div`,{className:`absolute left-0`,children:(0,i.jsx)(f,{severity:e.severity,size:`md`})}),(0,i.jsx)(`div`,{className:`flex-1`,children:(0,i.jsx)(g,{incident:e,onIncidentClick:a,showImpact:s,isNew:S(e.id)})})]},e.id))})]},t))}),b.length===0&&e.length>0&&(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,i.jsx)(r.Filter,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No incidents match the current filters`})]})]})]})}exports.WakaIncidentTimeline=y,exports.default=y;
|
|
@@ -285,7 +285,8 @@ function j({ severityFilter: t, statusFilter: n, onSeverityChange: r, onStatusCh
|
|
|
285
285
|
function M({ incidents: n, onIncidentClick: r, showFilters: a = !0, showImpact: o = !0, maxItems: s, className: c }) {
|
|
286
286
|
let [u, d] = t.useState(null), [f, p] = t.useState(null), [m, h] = t.useState(/* @__PURE__ */ new Set());
|
|
287
287
|
t.useEffect(() => {
|
|
288
|
-
|
|
288
|
+
let e = new Set(n.map((e) => e.id));
|
|
289
|
+
h(e);
|
|
289
290
|
}, [n]);
|
|
290
291
|
let v = t.useMemo(() => {
|
|
291
292
|
let e = n;
|
|
@@ -368,4 +369,4 @@ function M({ incidents: n, onIncidentClick: r, showFilters: a = !0, showImpact:
|
|
|
368
369
|
});
|
|
369
370
|
}
|
|
370
371
|
//#endregion
|
|
371
|
-
export { M as default };
|
|
372
|
+
export { M as WakaIncidentTimeline, M as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={USD:{symbol:`$`,position:`before`,decimals:2,locale:`en-US`},EUR:{symbol:`€`,position:`after`,decimals:2,locale:`de-DE`},GBP:{symbol:`£`,position:`before`,decimals:2,locale:`en-GB`},JPY:{symbol:`¥`,position:`before`,decimals:0,locale:`ja-JP`},CAD:{symbol:`C$`,position:`before`,decimals:2,locale:`en-CA`},AUD:{symbol:`A$`,position:`before`,decimals:2,locale:`en-AU`},CHF:{symbol:`CHF`,position:`before`,decimals:2,locale:`de-CH`},CNY:{symbol:`¥`,position:`before`,decimals:2,locale:`zh-CN`},INR:{symbol:`₹`,position:`before`,decimals:2,locale:`en-IN`},BRL:{symbol:`R$`,position:`before`,decimals:2,locale:`pt-BR`}},o={paid:{label:`Paid`,icon:r.CheckCircle2,className:`bg-green-100 text-green-800 border-green-200 print:bg-green-50`},pending:{label:`Pending`,icon:r.Clock,className:`bg-yellow-100 text-yellow-800 border-yellow-200 print:bg-yellow-50`},overdue:{label:`Overdue`,icon:r.AlertTriangle,className:`bg-red-100 text-red-800 border-red-200 print:bg-red-50`},draft:{label:`Draft`,icon:r.FileText,className:`bg-gray-100 text-gray-800 border-gray-200 print:bg-gray-50`}};function s(e,t){let n=a[t],r=new Intl.NumberFormat(n.locale,{minimumFractionDigits:n.decimals,maximumFractionDigits:n.decimals}).format(e);return n.position===`before`?`${n.symbol}${r}`:`${r} ${n.symbol}`}function c(e,t=`en-US`){let n=typeof e==`string`?new Date(e):e;return new Intl.DateTimeFormat(t,{year:`numeric`,month:`long`,day:`numeric`}).format(n)}function l(e){let t=e.quantity*e.unitPrice;return t-(e.discount?t*e.discount:0)}function u(e){return e.reduce((e,t)=>e+l(t),0)}function d(e){return e.taxRate?l(e)*e.taxRate:0}function f(e,t){return e.some(e=>e.taxRate!==void 0)?e.reduce((e,t)=>e+d(t),0):t?u(e)*t:0}function p({title:e,address:n,compact:r}){return(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,r?`gap-0.5`:`gap-1`),children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide`,r?`text-[10px]`:`text-xs`),children:e}),(0,i.jsx)(`div`,{className:t.cn(`font-medium`,r?`text-sm`:`text-base`),children:n.name}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground`,r?`text-xs`:`text-sm`),children:[(0,i.jsx)(`p`,{children:n.street1}),n.street2&&(0,i.jsx)(`p`,{children:n.street2}),(0,i.jsxs)(`p`,{children:[n.city,n.state&&`, ${n.state}`,` `,n.postalCode]}),(0,i.jsx)(`p`,{children:n.country})]})]})}function m({status:e,compact:n}){let r=o[e],a=r.icon;return(0,i.jsxs)(`div`,{className:t.cn(`inline-flex items-center gap-1.5 border rounded-full font-medium`,n?`px-2 py-0.5 text-xs`:`px-3 py-1 text-sm`,r.className),children:[(0,i.jsx)(a,{className:t.cn(n?`h-3 w-3`:`h-4 w-4`)}),r.label]})}function h({items:e,currency:n,compact:r}){return(0,i.jsx)(`div`,{className:`overflow-x-auto`,children:(0,i.jsxs)(`table`,{className:`w-full`,children:[(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{className:t.cn(`border-b-2 border-foreground/20 text-left`,r?`text-xs`:`text-sm`),children:[(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide`,r?`py-2`:`py-3`),children:`Description`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-center`,r?`py-2`:`py-3`),children:`Qty`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-right`,r?`py-2`:`py-3`),children:`Unit Price`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-right`,r?`py-2`:`py-3`),children:`Amount`})]})}),(0,i.jsx)(`tbody`,{children:e.map((a,o)=>{let c=l(a);return(0,i.jsxs)(`tr`,{className:t.cn(o!==e.length-1&&`border-b border-muted`,r?`text-sm`:`text-base`),children:[(0,i.jsxs)(`td`,{className:t.cn(r?`py-2`:`py-3`),children:[(0,i.jsx)(`div`,{children:a.description}),a.discount&&(0,i.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Discount: `,(a.discount*100).toFixed(0),`%`]})]}),(0,i.jsxs)(`td`,{className:t.cn(`text-center`,r?`py-2`:`py-3`),children:[a.quantity,a.unit&&(0,i.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:a.unit})]}),(0,i.jsx)(`td`,{className:t.cn(`text-right`,r?`py-2`:`py-3`),children:s(a.unitPrice,n)}),(0,i.jsx)(`td`,{className:t.cn(`text-right font-medium`,r?`py-2`:`py-3`),children:s(c,n)})]},a.id)})})]})})}function g({invoice:e,compact:n}){let r=u(e.items),a=e.items.some(e=>e.taxRate!==void 0),o=f(e.items,e.taxRate),c=e.discountAmount||(e.discountPercentage?r*e.discountPercentage:0),l=e.shippingCost||0,d=r+o-c+l,p=t.cn(`flex justify-between`,n?`py-1 text-sm`:`py-1.5`);return(0,i.jsx)(`div`,{className:t.cn(`border-t-2 border-foreground/20`,n?`pt-3 mt-3`:`pt-4 mt-4`),children:(0,i.jsx)(`div`,{className:`flex flex-col items-end`,children:(0,i.jsxs)(`div`,{className:t.cn(`w-full max-w-xs`,n&&`max-w-[200px]`),children:[(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,i.jsx)(`span`,{children:s(r,e.currency)})]}),c>0&&(0,i.jsxs)(`div`,{className:t.cn(p,`text-green-600`),children:[(0,i.jsxs)(`span`,{children:[`Discount`,e.discountPercentage&&` (${(e.discountPercentage*100).toFixed(0)}%)`]}),(0,i.jsxs)(`span`,{children:[`-`,s(c,e.currency)]})]}),o>0&&(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax`,!a&&e.taxRate?` (${(e.taxRate*100).toFixed(0)}%)`:``]}),(0,i.jsx)(`span`,{children:s(o,e.currency)})]}),l>0&&(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,i.jsx)(`span`,{children:s(l,e.currency)})]}),(0,i.jsxs)(`div`,{className:t.cn(`flex justify-between border-t-2 border-foreground font-bold`,n?`py-2 mt-2 text-lg`:`py-3 mt-3 text-xl`),children:[(0,i.jsx)(`span`,{children:`Total`}),(0,i.jsx)(`span`,{children:s(d,e.currency)})]}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground text-right`,n?`text-xs`:`text-sm`),children:[`Amount due in `,e.currency]})]})})})}function _({bankDetails:e,compact:n}){return(0,i.jsxs)(`div`,{className:t.cn(`border rounded-lg bg-muted/30 print:bg-gray-50`,n?`p-3`:`p-4`),children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,i.jsx)(r.CreditCard,{className:t.cn(`text-muted-foreground`,n?`h-4 w-4`:`h-5 w-5`)}),(0,i.jsx)(`h3`,{className:t.cn(`font-semibold`,n?`text-sm`:`text-base`),children:`Payment Details`})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-2`,n?`grid-cols-1 text-xs`:`grid-cols-2 text-sm`),children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Bank Name: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.bankName})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Account Name: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.accountName})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Account Number: `}),(0,i.jsx)(`span`,{className:`font-medium font-mono`,children:e.accountNumber})]}),e.routingNumber&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Routing/SWIFT: `}),(0,i.jsx)(`span`,{className:`font-medium font-mono`,children:e.routingNumber})]}),e.reference&&(0,i.jsxs)(`div`,{className:`col-span-full`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Reference: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.reference})]})]})]})}function v({invoice:e,showPrintButton:o=!0,showDownloadButton:s=!0,onPrint:l,onDownload:u,compact:d=!1,showBankDetails:f=!0,className:v}){let y=a[e.currency].locale,b=n.useCallback(()=>{l?l():window.print()},[l]),x=n.useCallback(()=>{u?u():console.log(`Download PDF placeholder - integrate with a PDF library like jspdf or react-pdf`)},[u]);return(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,v),children:[(o||s)&&(0,i.jsxs)(`div`,{className:`flex gap-2 mb-4 print:hidden`,children:[o&&(0,i.jsxs)(`button`,{onClick:b,className:t.cn(`inline-flex items-center gap-2 rounded-md border bg-background`,`hover:bg-muted transition-colors`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,d?`px-3 py-1.5 text-sm`:`px-4 py-2`),children:[(0,i.jsx)(r.Printer,{className:t.cn(d?`h-4 w-4`:`h-5 w-5`)}),`Print`]}),s&&(0,i.jsxs)(`button`,{onClick:x,className:t.cn(`inline-flex items-center gap-2 rounded-md bg-primary text-primary-foreground`,`hover:bg-primary/90 transition-colors`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,d?`px-3 py-1.5 text-sm`:`px-4 py-2`),children:[(0,i.jsx)(r.Download,{className:t.cn(d?`h-4 w-4`:`h-5 w-5`)}),`Download PDF`]})]}),(0,i.jsxs)(`div`,{className:t.cn(`bg-background border rounded-lg shadow-sm`,`print:shadow-none print:border-none print:rounded-none`,d?`p-6`:`p-8 md:p-12`),children:[(0,i.jsxs)(`header`,{className:t.cn(`flex flex-col md:flex-row md:justify-between gap-6`,d?`mb-6`:`mb-8`),children:[(0,i.jsxs)(`div`,{className:`flex-1`,children:[e.company.logo?(0,i.jsx)(`img`,{src:e.company.logo,alt:e.company.name,className:t.cn(`object-contain mb-3`,d?`h-8 max-w-[120px]`:`h-12 max-w-[180px]`)}):(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,i.jsx)(r.Building2,{className:t.cn(`text-primary`,d?`h-6 w-6`:`h-8 w-8`)}),(0,i.jsx)(`span`,{className:t.cn(`font-bold`,d?`text-xl`:`text-2xl`),children:e.company.name})]}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:[(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.MapPin,{className:`h-3 w-3 flex-shrink-0`}),e.company.address.street1,`, `,e.company.address.city]}),e.company.email&&(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.Mail,{className:`h-3 w-3 flex-shrink-0`}),e.company.email]}),e.company.phone&&(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.Phone,{className:`h-3 w-3 flex-shrink-0`}),e.company.phone]}),e.company.taxId&&(0,i.jsxs)(`p`,{className:`mt-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Tax ID:`}),` `,e.company.taxId]})]})]}),(0,i.jsxs)(`div`,{className:`flex flex-col items-start md:items-end gap-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(r.FileText,{className:t.cn(`text-primary`,d?`h-6 w-6`:`h-8 w-8`)}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:t.cn(`font-bold uppercase tracking-wide`,d?`text-2xl`:`text-3xl`),children:`Invoice`}),(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground font-mono`,d?`text-sm`:`text-base`),children:[`#`,e.invoiceNumber]})]})]}),(0,i.jsx)(m,{status:e.status,compact:d})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-4 border-y py-4`,d?`grid-cols-2 md:grid-cols-4 text-xs`:`grid-cols-2 md:grid-cols-4 text-sm`,d?`mb-6`:`mb-8`),children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Calendar,{className:`h-3.5 w-3.5`}),`Invoice Date`]}),(0,i.jsx)(`div`,{className:`font-medium`,children:c(e.invoiceDate,y)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Calendar,{className:`h-3.5 w-3.5`}),`Due Date`]}),(0,i.jsx)(`div`,{className:t.cn(`font-medium`,e.status===`overdue`&&`text-red-600`),children:c(e.dueDate,y)})]}),e.poNumber&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-muted-foreground mb-1`,children:`PO Number`}),(0,i.jsx)(`div`,{className:`font-medium font-mono`,children:e.poNumber})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-muted-foreground mb-1`,children:`Currency`}),(0,i.jsx)(`div`,{className:`font-medium`,children:e.currency})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-6`,(e.shipTo,`md:grid-cols-2`),d?`mb-6`:`mb-8`),children:[(0,i.jsx)(p,{title:`Bill To`,address:e.billTo,compact:d}),e.shipTo&&(0,i.jsx)(p,{title:`Ship To`,address:e.shipTo,compact:d})]}),(0,i.jsx)(h,{items:e.items,currency:e.currency,compact:d}),(0,i.jsx)(g,{invoice:e,compact:d}),(e.paymentTerms||e.notes)&&(0,i.jsxs)(`div`,{className:t.cn(`grid gap-6 md:grid-cols-2 border-t`,d?`mt-6 pt-4`:`mt-8 pt-6`),children:[e.paymentTerms&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide mb-2`,d?`text-[10px]`:`text-xs`),children:`Payment Terms`}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:e.paymentTerms})]}),e.notes&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide mb-2`,d?`text-[10px]`:`text-xs`),children:`Notes`}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:e.notes})]})]}),f&&e.bankDetails&&(0,i.jsx)(`div`,{className:t.cn(d?`mt-6`:`mt-8`),children:(0,i.jsx)(_,{bankDetails:e.bankDetails,compact:d})}),(0,i.jsxs)(`footer`,{className:t.cn(`border-t text-center text-muted-foreground`,d?`mt-6 pt-4 text-xs`:`mt-8 pt-6 text-sm`),children:[(0,i.jsx)(`p`,{children:`Thank you for your business!`}),e.company.website&&(0,i.jsx)(`p`,{className:`mt-1`,children:e.company.website})]})]})]})}function y({items:e,taxRate:t,discountAmount:r,discountPercentage:i,shippingCost:a=0}){let o=n.useMemo(()=>u(e),[e]),s=n.useMemo(()=>f(e,t),[e,t]),c=n.useMemo(()=>r||(i?o*i:0),[r,i,o]);return{subtotal:o,taxAmount:s,discount:c,shippingCost:a,total:n.useMemo(()=>o+s-c+a,[o,s,c,a]),itemCount:e.length,totalQuantity:e.reduce((e,t)=>e+t.quantity,0)}}exports.default=v,exports.formatCurrency=s,exports.formatDate=c,exports.useInvoice=y;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={USD:{symbol:`$`,position:`before`,decimals:2,locale:`en-US`},EUR:{symbol:`€`,position:`after`,decimals:2,locale:`de-DE`},GBP:{symbol:`£`,position:`before`,decimals:2,locale:`en-GB`},JPY:{symbol:`¥`,position:`before`,decimals:0,locale:`ja-JP`},CAD:{symbol:`C$`,position:`before`,decimals:2,locale:`en-CA`},AUD:{symbol:`A$`,position:`before`,decimals:2,locale:`en-AU`},CHF:{symbol:`CHF`,position:`before`,decimals:2,locale:`de-CH`},CNY:{symbol:`¥`,position:`before`,decimals:2,locale:`zh-CN`},INR:{symbol:`₹`,position:`before`,decimals:2,locale:`en-IN`},BRL:{symbol:`R$`,position:`before`,decimals:2,locale:`pt-BR`}},o={paid:{label:`Paid`,icon:r.CheckCircle2,className:`bg-green-100 text-green-800 border-green-200 print:bg-green-50`},pending:{label:`Pending`,icon:r.Clock,className:`bg-yellow-100 text-yellow-800 border-yellow-200 print:bg-yellow-50`},overdue:{label:`Overdue`,icon:r.AlertTriangle,className:`bg-red-100 text-red-800 border-red-200 print:bg-red-50`},draft:{label:`Draft`,icon:r.FileText,className:`bg-gray-100 text-gray-800 border-gray-200 print:bg-gray-50`}};function s(e,t){let n=a[t],r=new Intl.NumberFormat(n.locale,{minimumFractionDigits:n.decimals,maximumFractionDigits:n.decimals}).format(e);return n.position===`before`?`${n.symbol}${r}`:`${r} ${n.symbol}`}function c(e,t=`en-US`){let n=typeof e==`string`?new Date(e):e;return new Intl.DateTimeFormat(t,{year:`numeric`,month:`long`,day:`numeric`}).format(n)}function l(e){let t=e.quantity*e.unitPrice;return t-(e.discount?t*e.discount:0)}function u(e){return e.reduce((e,t)=>e+l(t),0)}function d(e){return e.taxRate?l(e)*e.taxRate:0}function f(e,t){return e.some(e=>e.taxRate!==void 0)?e.reduce((e,t)=>e+d(t),0):t?u(e)*t:0}function p({title:e,address:n,compact:r}){return(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,r?`gap-0.5`:`gap-1`),children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide`,r?`text-[10px]`:`text-xs`),children:e}),(0,i.jsx)(`div`,{className:t.cn(`font-medium`,r?`text-sm`:`text-base`),children:n.name}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground`,r?`text-xs`:`text-sm`),children:[(0,i.jsx)(`p`,{children:n.street1}),n.street2&&(0,i.jsx)(`p`,{children:n.street2}),(0,i.jsxs)(`p`,{children:[n.city,n.state&&`, ${n.state}`,` `,n.postalCode]}),(0,i.jsx)(`p`,{children:n.country})]})]})}function m({status:e,compact:n}){let r=o[e],a=r.icon;return(0,i.jsxs)(`div`,{className:t.cn(`inline-flex items-center gap-1.5 border rounded-full font-medium`,n?`px-2 py-0.5 text-xs`:`px-3 py-1 text-sm`,r.className),children:[(0,i.jsx)(a,{className:t.cn(n?`h-3 w-3`:`h-4 w-4`)}),r.label]})}function h({items:e,currency:n,compact:r}){return(0,i.jsx)(`div`,{className:`overflow-x-auto`,children:(0,i.jsxs)(`table`,{className:`w-full`,children:[(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{className:t.cn(`border-b-2 border-foreground/20 text-left`,r?`text-xs`:`text-sm`),children:[(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide`,r?`py-2`:`py-3`),children:`Description`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-center`,r?`py-2`:`py-3`),children:`Qty`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-right`,r?`py-2`:`py-3`),children:`Unit Price`}),(0,i.jsx)(`th`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide text-right`,r?`py-2`:`py-3`),children:`Amount`})]})}),(0,i.jsx)(`tbody`,{children:e.map((a,o)=>{let c=l(a);return(0,i.jsxs)(`tr`,{className:t.cn(o!==e.length-1&&`border-b border-muted`,r?`text-sm`:`text-base`),children:[(0,i.jsxs)(`td`,{className:t.cn(r?`py-2`:`py-3`),children:[(0,i.jsx)(`div`,{children:a.description}),a.discount&&(0,i.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Discount: `,(a.discount*100).toFixed(0),`%`]})]}),(0,i.jsxs)(`td`,{className:t.cn(`text-center`,r?`py-2`:`py-3`),children:[a.quantity,a.unit&&(0,i.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:a.unit})]}),(0,i.jsx)(`td`,{className:t.cn(`text-right`,r?`py-2`:`py-3`),children:s(a.unitPrice,n)}),(0,i.jsx)(`td`,{className:t.cn(`text-right font-medium`,r?`py-2`:`py-3`),children:s(c,n)})]},a.id)})})]})})}function g({invoice:e,compact:n}){let r=u(e.items),a=e.items.some(e=>e.taxRate!==void 0),o=f(e.items,e.taxRate),c=e.discountAmount||(e.discountPercentage?r*e.discountPercentage:0),l=e.shippingCost||0,d=r+o-c+l,p=t.cn(`flex justify-between`,n?`py-1 text-sm`:`py-1.5`);return(0,i.jsx)(`div`,{className:t.cn(`border-t-2 border-foreground/20`,n?`pt-3 mt-3`:`pt-4 mt-4`),children:(0,i.jsx)(`div`,{className:`flex flex-col items-end`,children:(0,i.jsxs)(`div`,{className:t.cn(`w-full max-w-xs`,n&&`max-w-[200px]`),children:[(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,i.jsx)(`span`,{children:s(r,e.currency)})]}),c>0&&(0,i.jsxs)(`div`,{className:t.cn(p,`text-green-600`),children:[(0,i.jsxs)(`span`,{children:[`Discount`,e.discountPercentage&&` (${(e.discountPercentage*100).toFixed(0)}%)`]}),(0,i.jsxs)(`span`,{children:[`-`,s(c,e.currency)]})]}),o>0&&(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax`,!a&&e.taxRate?` (${(e.taxRate*100).toFixed(0)}%)`:``]}),(0,i.jsx)(`span`,{children:s(o,e.currency)})]}),l>0&&(0,i.jsxs)(`div`,{className:p,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,i.jsx)(`span`,{children:s(l,e.currency)})]}),(0,i.jsxs)(`div`,{className:t.cn(`flex justify-between border-t-2 border-foreground font-bold`,n?`py-2 mt-2 text-lg`:`py-3 mt-3 text-xl`),children:[(0,i.jsx)(`span`,{children:`Total`}),(0,i.jsx)(`span`,{children:s(d,e.currency)})]}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground text-right`,n?`text-xs`:`text-sm`),children:[`Amount due in `,e.currency]})]})})})}function _({bankDetails:e,compact:n}){return(0,i.jsxs)(`div`,{className:t.cn(`border rounded-lg bg-muted/30 print:bg-gray-50`,n?`p-3`:`p-4`),children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,i.jsx)(r.CreditCard,{className:t.cn(`text-muted-foreground`,n?`h-4 w-4`:`h-5 w-5`)}),(0,i.jsx)(`h3`,{className:t.cn(`font-semibold`,n?`text-sm`:`text-base`),children:`Payment Details`})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-2`,n?`grid-cols-1 text-xs`:`grid-cols-2 text-sm`),children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Bank Name: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.bankName})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Account Name: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.accountName})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Account Number: `}),(0,i.jsx)(`span`,{className:`font-medium font-mono`,children:e.accountNumber})]}),e.routingNumber&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Routing/SWIFT: `}),(0,i.jsx)(`span`,{className:`font-medium font-mono`,children:e.routingNumber})]}),e.reference&&(0,i.jsxs)(`div`,{className:`col-span-full`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Reference: `}),(0,i.jsx)(`span`,{className:`font-medium`,children:e.reference})]})]})]})}function v({invoice:e,showPrintButton:o=!0,showDownloadButton:s=!0,onPrint:l,onDownload:u,compact:d=!1,showBankDetails:f=!0,className:v}){let y=a[e.currency].locale,b=n.useCallback(()=>{l?l():window.print()},[l]),x=n.useCallback(()=>{u?u():console.log(`Download PDF placeholder - integrate with a PDF library like jspdf or react-pdf`)},[u]);return(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,v),children:[(o||s)&&(0,i.jsxs)(`div`,{className:`flex gap-2 mb-4 print:hidden`,children:[o&&(0,i.jsxs)(`button`,{onClick:b,className:t.cn(`inline-flex items-center gap-2 rounded-md border bg-background`,`hover:bg-muted transition-colors`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,d?`px-3 py-1.5 text-sm`:`px-4 py-2`),children:[(0,i.jsx)(r.Printer,{className:t.cn(d?`h-4 w-4`:`h-5 w-5`)}),`Print`]}),s&&(0,i.jsxs)(`button`,{onClick:x,className:t.cn(`inline-flex items-center gap-2 rounded-md bg-primary text-primary-foreground`,`hover:bg-primary/90 transition-colors`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,d?`px-3 py-1.5 text-sm`:`px-4 py-2`),children:[(0,i.jsx)(r.Download,{className:t.cn(d?`h-4 w-4`:`h-5 w-5`)}),`Download PDF`]})]}),(0,i.jsxs)(`div`,{className:t.cn(`bg-background border rounded-lg shadow-sm`,`print:shadow-none print:border-none print:rounded-none`,d?`p-6`:`p-8 md:p-12`),children:[(0,i.jsxs)(`header`,{className:t.cn(`flex flex-col md:flex-row md:justify-between gap-6`,d?`mb-6`:`mb-8`),children:[(0,i.jsxs)(`div`,{className:`flex-1`,children:[e.company.logo?(0,i.jsx)(`img`,{src:e.company.logo,alt:e.company.name,className:t.cn(`object-contain mb-3`,d?`h-8 max-w-[120px]`:`h-12 max-w-[180px]`)}):(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,i.jsx)(r.Building2,{className:t.cn(`text-primary`,d?`h-6 w-6`:`h-8 w-8`)}),(0,i.jsx)(`span`,{className:t.cn(`font-bold`,d?`text-xl`:`text-2xl`),children:e.company.name})]}),(0,i.jsxs)(`div`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:[(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.MapPin,{className:`h-3 w-3 flex-shrink-0`}),e.company.address.street1,`, `,e.company.address.city]}),e.company.email&&(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.Mail,{className:`h-3 w-3 flex-shrink-0`}),e.company.email]}),e.company.phone&&(0,i.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(r.Phone,{className:`h-3 w-3 flex-shrink-0`}),e.company.phone]}),e.company.taxId&&(0,i.jsxs)(`p`,{className:`mt-1`,children:[(0,i.jsx)(`span`,{className:`font-medium`,children:`Tax ID:`}),` `,e.company.taxId]})]})]}),(0,i.jsxs)(`div`,{className:`flex flex-col items-start md:items-end gap-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(r.FileText,{className:t.cn(`text-primary`,d?`h-6 w-6`:`h-8 w-8`)}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:t.cn(`font-bold uppercase tracking-wide`,d?`text-2xl`:`text-3xl`),children:`Invoice`}),(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground font-mono`,d?`text-sm`:`text-base`),children:[`#`,e.invoiceNumber]})]})]}),(0,i.jsx)(m,{status:e.status,compact:d})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-4 border-y py-4`,d?`grid-cols-2 md:grid-cols-4 text-xs`:`grid-cols-2 md:grid-cols-4 text-sm`,d?`mb-6`:`mb-8`),children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Calendar,{className:`h-3.5 w-3.5`}),`Invoice Date`]}),(0,i.jsx)(`div`,{className:`font-medium`,children:c(e.invoiceDate,y)})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Calendar,{className:`h-3.5 w-3.5`}),`Due Date`]}),(0,i.jsx)(`div`,{className:t.cn(`font-medium`,e.status===`overdue`&&`text-red-600`),children:c(e.dueDate,y)})]}),e.poNumber&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-muted-foreground mb-1`,children:`PO Number`}),(0,i.jsx)(`div`,{className:`font-medium font-mono`,children:e.poNumber})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-muted-foreground mb-1`,children:`Currency`}),(0,i.jsx)(`div`,{className:`font-medium`,children:e.currency})]})]}),(0,i.jsxs)(`div`,{className:t.cn(`grid gap-6`,(e.shipTo,`md:grid-cols-2`),d?`mb-6`:`mb-8`),children:[(0,i.jsx)(p,{title:`Bill To`,address:e.billTo,compact:d}),e.shipTo&&(0,i.jsx)(p,{title:`Ship To`,address:e.shipTo,compact:d})]}),(0,i.jsx)(h,{items:e.items,currency:e.currency,compact:d}),(0,i.jsx)(g,{invoice:e,compact:d}),(e.paymentTerms||e.notes)&&(0,i.jsxs)(`div`,{className:t.cn(`grid gap-6 md:grid-cols-2 border-t`,d?`mt-6 pt-4`:`mt-8 pt-6`),children:[e.paymentTerms&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide mb-2`,d?`text-[10px]`:`text-xs`),children:`Payment Terms`}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:e.paymentTerms})]}),e.notes&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:t.cn(`font-semibold text-muted-foreground uppercase tracking-wide mb-2`,d?`text-[10px]`:`text-xs`),children:`Notes`}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,d?`text-xs`:`text-sm`),children:e.notes})]})]}),f&&e.bankDetails&&(0,i.jsx)(`div`,{className:t.cn(d?`mt-6`:`mt-8`),children:(0,i.jsx)(_,{bankDetails:e.bankDetails,compact:d})}),(0,i.jsxs)(`footer`,{className:t.cn(`border-t text-center text-muted-foreground`,d?`mt-6 pt-4 text-xs`:`mt-8 pt-6 text-sm`),children:[(0,i.jsx)(`p`,{children:`Thank you for your business!`}),e.company.website&&(0,i.jsx)(`p`,{className:`mt-1`,children:e.company.website})]})]})]})}function y({items:e,taxRate:t,discountAmount:r,discountPercentage:i,shippingCost:a=0}){let o=n.useMemo(()=>u(e),[e]),s=n.useMemo(()=>f(e,t),[e,t]),c=n.useMemo(()=>r||(i?o*i:0),[r,i,o]);return{subtotal:o,taxAmount:s,discount:c,shippingCost:a,total:n.useMemo(()=>o+s-c+a,[o,s,c,a]),itemCount:e.length,totalQuantity:e.reduce((e,t)=>e+t.quantity,0)}}exports.WakaInvoicePreview=v,exports.default=v,exports.formatCurrency=s,exports.formatDate=c,exports.useInvoice=y;
|
|
@@ -511,4 +511,4 @@ function A({ items: e, taxRate: n, discountAmount: r, discountPercentage: i, shi
|
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
513
|
//#endregion
|
|
514
|
-
export { k as default, v as formatCurrency, y as formatDate, A as useInvoice };
|
|
514
|
+
export { k as WakaInvoicePreview, k as default, v as formatCurrency, y as formatDate, A as useInvoice };
|
|
@@ -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("../button/index.cjs.js"),r=require("../dropdown-menu/index.cjs.js"),i=require("../input/index.cjs.js"),a=require("../scroll-area/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");var l={low:`bg-gray-100 text-gray-700 border-gray-200`,medium:`bg-blue-100 text-blue-700 border-blue-200`,high:`bg-orange-100 text-orange-700 border-orange-200`,urgent:`bg-red-100 text-red-700 border-red-200`};function u({card:e,columnId:r,onCardClick:i,onCardDelete:a,renderCard:o,onDragStart:u}){return o?(0,c.jsx)(`div`,{draggable:!0,onDragStart:t=>u(t,e.id,r),className:`cursor-grab active:cursor-grabbing`,children:o(e,r)}):(0,c.jsxs)(`div`,{draggable:!0,onDragStart:t=>u(t,e.id,r),onClick:()=>i?.(e,r),className:t.cn(`group bg-card border rounded-lg p-3 shadow-sm cursor-grab active:cursor-grabbing`,`hover:border-primary/50 hover:shadow-md transition-all duration-200`),children:[(0,c.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[e.labels&&e.labels.length>0&&(0,c.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:e.labels.map(e=>(0,c.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] font-medium rounded`,style:{backgroundColor:e.color+`20`,color:e.color},children:e.name},e.id))}),(0,c.jsx)(`h4`,{className:`font-medium text-sm truncate`,children:e.title}),e.description&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]}),(0,c.jsx)(s.GripVertical,{className:`h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0`})]}),(e.priority||e.assignee||e.dueDate)&&(0,c.jsxs)(`div`,{className:`flex items-center justify-between mt-3 pt-2 border-t`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.priority&&(0,c.jsx)(`span`,{className:t.cn(`px-1.5 py-0.5 text-[10px] font-medium rounded border`,l[e.priority]),children:e.priority}),e.dueDate&&(0,c.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.dueDate.toLocaleDateString()})]}),e.assignee&&(0,c.jsx)(`div`,{className:`h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-medium`,title:e.assignee.name,children:e.assignee.avatar?(0,c.jsx)(`img`,{src:e.assignee.avatar,alt:e.assignee.name,className:`h-full w-full rounded-full object-cover`}):e.assignee.name.charAt(0).toUpperCase()})]}),a&&(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`absolute top-1 right-1 h-6 w-6 opacity-0 group-hover:opacity-100`,onClick:t=>{t.stopPropagation(),a(e.id,r)},children:(0,c.jsx)(s.X,{className:`h-3 w-3`})})]})}function d({column:e,onCardMove:l,onCardAdd:d,onCardDelete:f,onCardClick:p,onColumnDelete:m,allowAddCard:h,allowColumnDrag:g,renderCard:_,draggedCard:v,setDraggedCard:y,onColumnDragStart:b}){let[x,S]=o.useState(!1),[C,w]=o.useState(``),[T,E]=o.useState(null),D=(e,t,n)=>{y({id:t,fromColumnId:n}),e.dataTransfer.effectAllowed=`move`},O=(e,t)=>{e.preventDefault(),v&&E(t)},k=()=>{E(null)},A=(t,n)=>{t.preventDefault(),v&&l&&l(v.id,v.fromColumnId,e.id,n),y(null),E(null)},j=t=>{t.preventDefault(),v&&l&&l(v.id,v.fromColumnId,e.id,e.cards.length),y(null),E(null)},M=()=>{C.trim()&&d&&(d(e.id,{title:C.trim()}),w(``),S(!1))},N=e.limit!==void 0&&e.cards.length>=e.limit;return(0,c.jsxs)(`div`,{className:`flex flex-col bg-muted/50 rounded-lg min-w-[280px] max-w-[320px] h-full`,onDragOver:e=>e.preventDefault(),onDrop:j,children:[(0,c.jsxs)(`div`,{className:t.cn(`flex items-center justify-between p-3 border-b`,g&&`cursor-grab active:cursor-grabbing`),draggable:g,onDragStart:t=>b(t,e.id),children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.color&&(0,c.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{backgroundColor:e.color}}),(0,c.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.title}),(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground bg-background px-1.5 py-0.5 rounded`,children:[e.cards.length,e.limit&&`/${e.limit}`]})]}),m&&(0,c.jsxs)(r.DropdownMenu,{children:[(0,c.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,c.jsx)(n.Button,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,children:(0,c.jsx)(s.MoreHorizontal,{className:`h-4 w-4`})})}),(0,c.jsx)(r.DropdownMenuContent,{align:`end`,children:(0,c.jsx)(r.DropdownMenuItem,{className:`text-destructive`,onClick:()=>m(e.id),children:`Supprimer la colonne`})})]})]}),(0,c.jsx)(a.ScrollArea,{className:`flex-1 p-2`,children:(0,c.jsxs)(`div`,{className:`space-y-2`,children:[e.cards.map((t,n)=>(0,c.jsxs)(`div`,{onDragOver:e=>O(e,n),onDragLeave:k,onDrop:e=>A(e,n),children:[T===n&&v&&(0,c.jsx)(`div`,{className:`h-1 bg-primary rounded mb-2`}),(0,c.jsx)(u,{card:t,columnId:e.id,onCardClick:p,onCardDelete:f,renderCard:_,onDragStart:D})]},t.id)),v&&T===null&&(0,c.jsx)(`div`,{className:`h-20 border-2 border-dashed border-primary/30 rounded-lg`,onDragOver:t=>{t.preventDefault(),E(e.cards.length)}})]})}),h&&(0,c.jsx)(`div`,{className:`p-2 border-t`,children:x?(0,c.jsxs)(`div`,{className:`space-y-2`,children:[(0,c.jsx)(i.Input,{value:C,onChange:e=>w(e.target.value),placeholder:`Titre de la carte...`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&M(),e.key===`Escape`&&S(!1)}}),(0,c.jsxs)(`div`,{className:`flex gap-2`,children:[(0,c.jsx)(n.Button,{size:`sm`,onClick:M,disabled:!C.trim(),children:`Ajouter`}),(0,c.jsx)(n.Button,{size:`sm`,variant:`ghost`,onClick:()=>S(!1),children:`Annuler`})]})]}):(0,c.jsxs)(n.Button,{variant:`ghost`,className:`w-full justify-start text-muted-foreground`,onClick:()=>S(!0),disabled:N,children:[(0,c.jsx)(s.Plus,{className:`h-4 w-4 mr-1`}),`Ajouter une carte`]})})]})}function f({columns:e,onCardMove:r,onColumnMove:a,onCardAdd:l,onCardDelete:u,onCardClick:f,onColumnAdd:p,onColumnDelete:m,allowAddCard:h=!0,allowAddColumn:g=!1,allowColumnDrag:_=!1,renderCard:v,height:y=`100%`,className:b}){let[x,S]=o.useState(null),[C,w]=o.useState(null),[T,E]=o.useState(!1),[D,O]=o.useState(``),k=(e,t)=>{_&&(w(t),e.dataTransfer.effectAllowed=`move`)},A=(e,t)=>{e.preventDefault(),C&&a&&a(C,t),w(null)},j=()=>{D.trim()&&p&&(p({title:D.trim()}),O(``),E(!1))};return(0,c.jsxs)(`div`,{className:t.cn(`flex gap-4 overflow-x-auto p-4`,b),style:{height:y},children:[e.map((e,t)=>(0,c.jsx)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>A(e,t),children:(0,c.jsx)(d,{column:e,onCardMove:r,onCardAdd:l,onCardDelete:u,onCardClick:f,onColumnDelete:m,allowAddCard:h,allowColumnDrag:_,renderCard:v,draggedCard:x,setDraggedCard:S,onColumnDragStart:k})},e.id)),g&&(0,c.jsx)(`div`,{className:`min-w-[280px]`,children:T?(0,c.jsxs)(`div`,{className:`bg-muted/50 rounded-lg p-3 space-y-2`,children:[(0,c.jsx)(i.Input,{value:D,onChange:e=>O(e.target.value),placeholder:`Titre de la colonne...`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&j(),e.key===`Escape`&&E(!1)}}),(0,c.jsxs)(`div`,{className:`flex gap-2`,children:[(0,c.jsx)(n.Button,{size:`sm`,onClick:j,disabled:!D.trim(),children:`Ajouter`}),(0,c.jsx)(n.Button,{size:`sm`,variant:`ghost`,onClick:()=>E(!1),children:`Annuler`})]})]}):(0,c.jsxs)(n.Button,{variant:`outline`,className:`w-full h-auto py-8 border-dashed`,onClick:()=>E(!0),children:[(0,c.jsx)(s.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une colonne`]})})]})}function p(e){let[t,n]=o.useState(e);return{columns:t,setColumns:n,moveCard:(e,t,r,i)=>{n(n=>{let a=[...n],o=a.find(e=>e.id===t);if(!o)return n;let s=o.cards.findIndex(t=>t.id===e);if(s===-1)return n;let[c]=o.cards.splice(s,1),l=a.find(e=>e.id===r);return l?(l.cards.splice(i,0,c),a):n})},moveColumn:(e,t)=>{n(n=>{let r=[...n],i=r.findIndex(t=>t.id===e);if(i===-1)return n;let[a]=r.splice(i,1);return r.splice(t,0,a),r})},addCard:(e,t)=>{n(n=>n.map(n=>n.id===e?{...n,cards:[...n.cards,{id:`card-${Date.now()}`,title:t.title||`Nouvelle carte`,...t}]}:n))},deleteCard:(e,t)=>{n(n=>n.map(n=>n.id===t?{...n,cards:n.cards.filter(t=>t.id!==e)}:n))},addColumn:e=>{n(t=>[...t,{id:`column-${Date.now()}`,title:e.title||`Nouvelle colonne`,cards:[],...e}])},deleteColumn:e=>{n(t=>t.filter(t=>t.id!==e))}}}exports.WakaKanban=f,exports.default=f,exports.useKanban=p;
|