indas-ui 0.0.1 → 0.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/cjs/components/auth/ProtectedRoute.js +48 -0
- package/dist/cjs/components/auth/UnauthorizedPage.js +19 -0
- package/dist/cjs/components/auth/index.js +9 -0
- package/dist/cjs/components/chat/ai-messages.js +271 -0
- package/dist/cjs/components/chat/chat-prompt-navigator.js +110 -0
- package/dist/cjs/components/chat/chat.js +1032 -0
- package/dist/cjs/components/chat/index.js +19 -0
- package/dist/cjs/components/chat/multimodal-input.js +119 -0
- package/dist/cjs/components/dashboard/DrillDownModal.js +36 -0
- package/dist/cjs/components/dashboard/FilterBar.js +434 -0
- package/dist/cjs/components/dashboard/Tooltip.js +86 -0
- package/dist/cjs/components/dashboard/charts/Area.js +127 -0
- package/dist/cjs/components/dashboard/charts/Bar.js +111 -0
- package/dist/cjs/components/dashboard/charts/BoxPlot.js +118 -0
- package/dist/cjs/components/dashboard/charts/Bubble.js +102 -0
- package/dist/cjs/components/dashboard/charts/DashboardCard.js +12 -0
- package/dist/cjs/components/dashboard/charts/Donut.js +130 -0
- package/dist/cjs/components/dashboard/charts/FlowMap.js +238 -0
- package/dist/cjs/components/dashboard/charts/Funnel.js +38 -0
- package/dist/cjs/components/dashboard/charts/Gantt.js +271 -0
- package/dist/cjs/components/dashboard/charts/Gauge.js +143 -0
- package/dist/cjs/components/dashboard/charts/GeoMap.js +164 -0
- package/dist/cjs/components/dashboard/charts/Heatmap.js +116 -0
- package/dist/cjs/components/dashboard/charts/Line.js +75 -0
- package/dist/cjs/components/dashboard/charts/Pareto.js +110 -0
- package/dist/cjs/components/dashboard/charts/Radar.js +94 -0
- package/dist/cjs/components/dashboard/charts/Sankey.js +92 -0
- package/dist/cjs/components/dashboard/charts/Scatter.js +128 -0
- package/dist/cjs/components/dashboard/charts/Sparkline.js +134 -0
- package/dist/cjs/components/dashboard/charts/Treemap.js +104 -0
- package/dist/cjs/components/dashboard/charts/index.js +45 -0
- package/dist/cjs/components/dashboard/charts/india-map.js +464 -0
- package/dist/cjs/components/dashboard/charts/theme.js +132 -0
- package/dist/cjs/components/dashboard/config.js +118 -0
- package/dist/cjs/components/dashboard/index.js +39 -0
- package/dist/cjs/components/dashboard/kpi/KpiBeforeAfter.js +16 -0
- package/dist/cjs/components/dashboard/kpi/KpiBreakdown.js +42 -0
- package/dist/cjs/components/dashboard/kpi/KpiComparison.js +41 -0
- package/dist/cjs/components/dashboard/kpi/KpiQuickStats.js +41 -0
- package/dist/cjs/components/dashboard/kpi/KpiRating.js +38 -0
- package/dist/cjs/components/dashboard/kpi/KpiScroll.js +83 -0
- package/dist/cjs/components/dashboard/kpi/KpiTrend.js +37 -0
- package/dist/cjs/components/dashboard/kpi/index.js +22 -0
- package/dist/cjs/components/dashboard/kpi/kpi-shell.js +113 -0
- package/dist/cjs/components/dashboard/time-range.js +126 -0
- package/dist/cjs/components/datagrid/DataGrid.js +1613 -0
- package/dist/cjs/components/datagrid/cells/BooleanCell.js +42 -0
- package/dist/cjs/components/datagrid/cells/CellRenderer.js +142 -0
- package/dist/cjs/components/datagrid/cells/EditableCell.js +217 -0
- package/dist/cjs/components/datagrid/cells/SelectionCell.js +60 -0
- package/dist/cjs/components/datagrid/cells/index.js +6 -0
- package/dist/cjs/components/datagrid/columns/ActionsColumn.js +485 -0
- package/dist/cjs/components/datagrid/columns/ColumnContextMenu.js +341 -0
- package/dist/cjs/components/datagrid/columns/DraggableColumnHeader.js +150 -0
- package/dist/cjs/components/datagrid/controls/AutoResizeButton.js +10 -0
- package/dist/cjs/components/datagrid/controls/PaginationControls.js +38 -0
- package/dist/cjs/components/datagrid/controls/SummaryControls.js +30 -0
- package/dist/cjs/components/datagrid/controls/menu/ActionsMenu.js +16 -0
- package/dist/cjs/components/datagrid/controls/menu/column/ColumnChooserModal.js +25 -0
- package/dist/cjs/components/datagrid/controls/menu/column/ColumnSection.js +10 -0
- package/dist/cjs/components/datagrid/controls/menu/export/ExportSection.js +19 -0
- package/dist/cjs/components/datagrid/controls/menu/export/export.js +227 -0
- package/dist/cjs/components/datagrid/controls/menu/filter/AdvancedFilterModal.js +405 -0
- package/dist/cjs/components/datagrid/controls/menu/filter/FilterSection.js +9 -0
- package/dist/cjs/components/datagrid/controls/menu/grouping/GroupingSection.js +23 -0
- package/dist/cjs/components/datagrid/controls/menu/grouping/index.js +6 -0
- package/dist/cjs/components/datagrid/controls/menu/import/ImportSection.js +75 -0
- package/dist/cjs/components/datagrid/controls/menu/import/import.js +232 -0
- package/dist/cjs/components/datagrid/controls/menu/index.js +24 -0
- package/dist/cjs/components/datagrid/controls/menu/view/CardView.js +176 -0
- package/dist/cjs/components/datagrid/controls/menu/view/ChartView.js +401 -0
- package/dist/cjs/components/datagrid/controls/menu/view/ViewSection.js +12 -0
- package/dist/cjs/components/datagrid/hooks/useCellRangeSelection.js +127 -0
- package/dist/cjs/components/datagrid/hooks/useClipboard.js +154 -0
- package/dist/cjs/components/datagrid/hooks/useDataGridState.js +115 -0
- package/dist/cjs/components/datagrid/hooks/useKeyboardNavigation.js +120 -0
- package/dist/cjs/components/datagrid/index.js +90 -0
- package/dist/cjs/components/datagrid/rows/DraggableRow.js +34 -0
- package/dist/cjs/components/datagrid/rows/ExpandableRow.js +184 -0
- package/dist/cjs/components/datagrid/rows/FilterRow.js +188 -0
- package/dist/cjs/components/datagrid/rows/SelectColumn.js +34 -0
- package/dist/cjs/components/datagrid/rows/SummaryRow.js +34 -0
- package/dist/cjs/components/datagrid/rows/summary.js +67 -0
- package/dist/cjs/components/datagrid/search/InlineSearchCell.js +99 -0
- package/dist/cjs/components/datagrid/search/SearchHighlighter.js +133 -0
- package/dist/cjs/components/datagrid/search/SearchNavigator.js +185 -0
- package/dist/cjs/components/datagrid/search/SearchNewModal.js +238 -0
- package/dist/cjs/components/datagrid/search/advancedSearch.js +112 -0
- package/dist/cjs/components/datagrid/utils/grid-helpers.js +102 -0
- package/dist/cjs/components/datagrid/utils/grid-types.js +3 -0
- package/dist/cjs/components/draft/AutoSaveIndicator.js +70 -0
- package/dist/cjs/components/draft/DraftModal.js +220 -0
- package/dist/cjs/components/forms/date-picker/CalendarView.js +82 -0
- package/dist/cjs/components/forms/date-picker/DatePicker.js +748 -0
- package/dist/cjs/components/forms/date-picker/DateTimePicker.js +174 -0
- package/dist/cjs/components/forms/date-picker/index.js +21 -0
- package/dist/cjs/components/forms/date-picker/shared-utils.js +24 -0
- package/dist/cjs/components/forms/dropdown/Dropdown.js +427 -0
- package/dist/cjs/components/forms/dropdown/MultiSelect.js +136 -0
- package/dist/cjs/components/forms/dropdown/SingleSelect.js +254 -0
- package/dist/cjs/components/forms/dropdown/hooks/useDropdownCreate.js +88 -0
- package/dist/cjs/components/forms/dropdown/hooks/useDropdownFiltering.js +87 -0
- package/dist/cjs/components/forms/dropdown/hooks/useDropdownState.js +63 -0
- package/dist/cjs/components/forms/dropdown/index.js +6 -0
- package/dist/cjs/components/forms/dropdown/types.js +3 -0
- package/dist/cjs/components/forms/file-attachment/EmailPreview.js +419 -0
- package/dist/cjs/components/forms/file-attachment/FileAttachment.js +966 -0
- package/dist/cjs/components/forms/file-attachment/index.js +6 -0
- package/dist/cjs/components/forms/index.js +16 -0
- package/dist/cjs/components/forms/quantity-input-popup.js +135 -0
- package/dist/cjs/components/forms/remark-input/RemarkInput.js +263 -0
- package/dist/cjs/components/forms/remark-input/index.js +8 -0
- package/dist/cjs/components/forms/unified-currency-dropdown.js +202 -0
- package/dist/cjs/components/index.js +41 -0
- package/dist/cjs/components/layout/SidebarContextMenu.js +179 -0
- package/dist/cjs/components/layout/app-shell.js +81 -0
- package/dist/cjs/components/layout/bottom-nav.js +262 -0
- package/dist/cjs/components/layout/floating-action-button.js +77 -0
- package/dist/cjs/components/layout/footer.js +60 -0
- package/dist/cjs/components/layout/index.js +18 -0
- package/dist/cjs/components/layout/mobile-menu-sheet.js +195 -0
- package/dist/cjs/components/layout/side-panel.js +118 -0
- package/dist/cjs/components/layout/sidebar.js +581 -0
- package/dist/cjs/components/layout/top-header.js +270 -0
- package/dist/cjs/components/layout/userprofile-dropdown.js +100 -0
- package/dist/cjs/components/master/editable-cells/EditableCell.js +106 -0
- package/dist/cjs/components/master/editable-cells/index.js +17 -0
- package/dist/cjs/components/master/index.js +9 -0
- package/dist/cjs/components/messaging/conversation-list.js +109 -0
- package/dist/cjs/components/messaging/create-conversation-modal.js +112 -0
- package/dist/cjs/components/messaging/message-bubble.js +69 -0
- package/dist/cjs/components/messaging/message-input.js +154 -0
- package/dist/cjs/components/messaging/message-thread.js +124 -0
- package/dist/cjs/components/messaging/messaging-panel-content.js +69 -0
- package/dist/cjs/components/messaging/thread-panel.js +50 -0
- package/dist/cjs/components/modals/3DModal.js +35 -0
- package/dist/cjs/components/modals/ImageModal.js +587 -0
- package/dist/cjs/components/modals/Modal.js +311 -0
- package/dist/cjs/components/modals/StandardModal.js +28 -0
- package/dist/cjs/components/modals/api-config-modal.js +120 -0
- package/dist/cjs/components/modals/global-api-config-modal.js +127 -0
- package/dist/cjs/components/modals/index.js +17 -0
- package/dist/cjs/components/modals/logout-modal.js +45 -0
- package/dist/cjs/components/modals/modal-alert.js +295 -0
- package/dist/cjs/components/modals/password-reset-modal.js +112 -0
- package/dist/cjs/components/modals/session-expiry-warning.js +18 -0
- package/dist/cjs/components/providers/api-provider.js +19 -0
- package/dist/cjs/components/providers/query-provider.js +29 -0
- package/dist/cjs/components/providers/session-provider.js +119 -0
- package/dist/cjs/components/theme/ThemeCustomizer.js +184 -0
- package/dist/cjs/components/ui/buttons/button.js +264 -0
- package/dist/cjs/components/ui/card.js +58 -0
- package/dist/cjs/components/ui/chart.js +160 -0
- package/dist/cjs/components/ui/display/boolean-badge.js +29 -0
- package/dist/cjs/components/ui/display/card.js +20 -0
- package/dist/cjs/components/ui/display/collapsible.js +44 -0
- package/dist/cjs/components/ui/display/separator.js +44 -0
- package/dist/cjs/components/ui/display/stats-card.js +29 -0
- package/dist/cjs/components/ui/display/text.js +94 -0
- package/dist/cjs/components/ui/feedback/alert.js +61 -0
- package/dist/cjs/components/ui/feedback/badge.js +93 -0
- package/dist/cjs/components/ui/feedback/progress.js +44 -0
- package/dist/cjs/components/ui/feedback/reminder-button.js +111 -0
- package/dist/cjs/components/ui/feedback/skeleton-table.js +20 -0
- package/dist/cjs/components/ui/feedback/skeleton.js +53 -0
- package/dist/cjs/components/ui/feedback/tooltip.js +54 -0
- package/dist/cjs/components/ui/form-toggle.js +47 -0
- package/dist/cjs/components/ui/forms/checkbox.js +24 -0
- package/dist/cjs/components/ui/forms/input.js +111 -0
- package/dist/cjs/components/ui/forms/label.js +10 -0
- package/dist/cjs/components/ui/forms/switch.js +58 -0
- package/dist/cjs/components/ui/forms/textarea.js +49 -0
- package/dist/cjs/components/ui/index.js +157 -0
- package/dist/cjs/components/ui/navigation/dropdown-menu.js +84 -0
- package/dist/cjs/components/ui/navigation/header-steps.js +51 -0
- package/dist/cjs/components/ui/navigation/tabs.js +97 -0
- package/dist/cjs/components/ui/overlays/loading.js +169 -0
- package/dist/cjs/components/ui/select.js +72 -0
- package/dist/cjs/config/api.js +65 -0
- package/dist/cjs/contexts/AppConfigContext.js +37 -0
- package/dist/cjs/contexts/CurrencyContext.js +336 -0
- package/dist/cjs/contexts/DeviceContext.js +106 -0
- package/dist/cjs/contexts/EmailContext.js +727 -0
- package/dist/cjs/contexts/GlobalAlertContext.js +232 -0
- package/dist/cjs/contexts/ImpactAnalysisContext.js +60 -0
- package/dist/cjs/contexts/LanguageContext.js +104 -0
- package/dist/cjs/contexts/MessagingContext.js +726 -0
- package/dist/cjs/contexts/ModuleAuthContext.js +316 -0
- package/dist/cjs/contexts/NavigationContext.js +182 -0
- package/dist/cjs/contexts/NetworkStatusContext.js +95 -0
- package/dist/cjs/contexts/NotificationContext.js +169 -0
- package/dist/cjs/contexts/PageTitleContext.js +28 -0
- package/dist/cjs/contexts/SearchPreferencesContext.js +42 -0
- package/dist/cjs/contexts/SessionAdapterContext.js +24 -0
- package/dist/cjs/contexts/SidebarPreferencesContext.js +116 -0
- package/dist/cjs/contexts/ThemeContext.js +193 -0
- package/dist/cjs/hooks/index.js +50 -0
- package/dist/cjs/hooks/useApproval.js +250 -0
- package/dist/cjs/hooks/useBacchaSearch.js +257 -0
- package/dist/cjs/hooks/useBusinessAudit.js +54 -0
- package/dist/cjs/hooks/useColumnFreezing.js +204 -0
- package/dist/cjs/hooks/useColumnMetadata.js +48 -0
- package/dist/cjs/hooks/useConditionalFormatting.js +197 -0
- package/dist/cjs/hooks/useDebounce.js +49 -0
- package/dist/cjs/hooks/useDraft.js +181 -0
- package/dist/cjs/hooks/useFormValidation.js +68 -0
- package/dist/cjs/hooks/useGridSettings.js +85 -0
- package/dist/cjs/hooks/useGridTheme.js +204 -0
- package/dist/cjs/hooks/useId.js +21 -0
- package/dist/cjs/hooks/useIntelligentColumnSizing.js +315 -0
- package/dist/cjs/hooks/useKeyboardNavigation.js +192 -0
- package/dist/cjs/hooks/useNotifications.js +63 -0
- package/dist/cjs/hooks/usePrevious.js +20 -0
- package/dist/cjs/hooks/useRowSelection.js +150 -0
- package/dist/cjs/hooks/useSignalR.js +53 -0
- package/dist/cjs/hooks/useTheme.js +268 -0
- package/dist/cjs/hooks/useTranslation.js +20 -0
- package/dist/cjs/hooks/useUnsavedChanges.js +88 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/lib/api/activity/audit/audit.js +51 -0
- package/dist/cjs/lib/api/activity/audit/index.js +29 -0
- package/dist/cjs/lib/api/activity/audit/send.js +434 -0
- package/dist/cjs/lib/api/activity/email/client.js +467 -0
- package/dist/cjs/lib/api/activity/email/index.js +31 -0
- package/dist/cjs/lib/api/activity/email/password-reset.js +58 -0
- package/dist/cjs/lib/api/activity/email/templates.js +537 -0
- package/dist/cjs/lib/api/activity/email/types.js +24 -0
- package/dist/cjs/lib/api/activity/index.js +48 -0
- package/dist/cjs/lib/api/activity/messaging/messaging.js +254 -0
- package/dist/cjs/lib/api/activity/notifications/index.js +43 -0
- package/dist/cjs/lib/api/activity/notifications/notifications.js +224 -0
- package/dist/cjs/lib/api/activity/notifications/reminders.js +30 -0
- package/dist/cjs/lib/api/activity/notifications/send.js +267 -0
- package/dist/cjs/lib/api/activity/notifications/types.js +66 -0
- package/dist/cjs/lib/api/activity/notify-and-log.js +63 -0
- package/dist/cjs/lib/api/activity/remarks/index.js +6 -0
- package/dist/cjs/lib/api/activity/remarks/remarks.js +186 -0
- package/dist/cjs/lib/api/activity/storage.js +83 -0
- package/dist/cjs/lib/api/ai/chat.js +227 -0
- package/dist/cjs/lib/api/ai/types.js +6 -0
- package/dist/cjs/lib/api/approval/approvals.js +210 -0
- package/dist/cjs/lib/api/approval/index.js +13 -0
- package/dist/cjs/lib/api/auth/auth.js +154 -0
- package/dist/cjs/lib/api/auth/index.js +11 -0
- package/dist/cjs/lib/api/auth/password-reset-otp.js +192 -0
- package/dist/cjs/lib/api/auth/two-factor-auth.js +94 -0
- package/dist/cjs/lib/api/auth/two-factor.js +186 -0
- package/dist/cjs/lib/api/core/auth-helpers.js +141 -0
- package/dist/cjs/lib/api/core/client.js +305 -0
- package/dist/cjs/lib/api/core/config.js +248 -0
- package/dist/cjs/lib/api/core/index.js +43 -0
- package/dist/cjs/lib/api/core/session-validator.js +98 -0
- package/dist/cjs/lib/api/core/types.js +4 -0
- package/dist/cjs/lib/api/core/utils.js +70 -0
- package/dist/cjs/lib/api/dashboard/costing.js +15 -0
- package/dist/cjs/lib/api/dashboard/management.js +11 -0
- package/dist/cjs/lib/api/dashboard/sales.js +11 -0
- package/dist/cjs/lib/api/draft/drafts.js +279 -0
- package/dist/cjs/lib/api/draft/index.js +13 -0
- package/dist/cjs/lib/api/enquiry/enquiry.js +624 -0
- package/dist/cjs/lib/api/enquiry/index.js +20 -0
- package/dist/cjs/lib/api/enquiry/rate-enquiry.js +78 -0
- package/dist/cjs/lib/api/estimation/categories.js +113 -0
- package/dist/cjs/lib/api/estimation/category-defaults.js +47 -0
- package/dist/cjs/lib/api/estimation/company-config.js +26 -0
- package/dist/cjs/lib/api/estimation/content.js +210 -0
- package/dist/cjs/lib/api/estimation/freight.js +25 -0
- package/dist/cjs/lib/api/estimation/grid-costing-drafts.js +30 -0
- package/dist/cjs/lib/api/estimation/grid-costing.js +176 -0
- package/dist/cjs/lib/api/estimation/index.js +58 -0
- package/dist/cjs/lib/api/estimation/legacy-costing.js +51 -0
- package/dist/cjs/lib/api/estimation/machines.js +74 -0
- package/dist/cjs/lib/api/estimation/planning.js +403 -0
- package/dist/cjs/lib/api/estimation/qualities.js +245 -0
- package/dist/cjs/lib/api/estimation/quotation-load.js +52 -0
- package/dist/cjs/lib/api/estimation/quotation-save.js +109 -0
- package/dist/cjs/lib/api/estimation/quote-check.js +34 -0
- package/dist/cjs/lib/api/estimation/quotepanel.js +496 -0
- package/dist/cjs/lib/api/estimation/shipper-planning.js +220 -0
- package/dist/cjs/lib/api/estimation/wastage.js +47 -0
- package/dist/cjs/lib/api/index.js +33 -0
- package/dist/cjs/lib/api/integration/proxy.js +40 -0
- package/dist/cjs/lib/api/master/category.js +215 -0
- package/dist/cjs/lib/api/master/company.js +389 -0
- package/dist/cjs/lib/api/master/hsn.js +61 -0
- package/dist/cjs/lib/api/master/index.js +47 -0
- package/dist/cjs/lib/api/master/item.js +142 -0
- package/dist/cjs/lib/api/master/ledger.js +398 -0
- package/dist/cjs/lib/api/master/logistics.js +119 -0
- package/dist/cjs/lib/api/master/machine.js +579 -0
- package/dist/cjs/lib/api/master/material-group.js +103 -0
- package/dist/cjs/lib/api/master/other.js +63 -0
- package/dist/cjs/lib/api/master/process-types.js +5 -0
- package/dist/cjs/lib/api/master/process.js +131 -0
- package/dist/cjs/lib/api/master/production-units.js +22 -0
- package/dist/cjs/lib/api/master/rate.js +203 -0
- package/dist/cjs/lib/api/master/tool.js +88 -0
- package/dist/cjs/lib/api/master/user.js +154 -0
- package/dist/cjs/lib/api/settings/erp-parameters.js +69 -0
- package/dist/cjs/lib/api/utility/index.js +11 -0
- package/dist/cjs/lib/api/utility/menu.js +136 -0
- package/dist/cjs/lib/auth.js +10 -0
- package/dist/cjs/lib/pwa.js +59 -0
- package/dist/cjs/lib/react-query-config.js +134 -0
- package/dist/cjs/lib/security/audit-logger.js +177 -0
- package/dist/cjs/lib/security/rate-limiter.js +122 -0
- package/dist/cjs/lib/server-url.js +76 -0
- package/dist/cjs/lib/svg-utils.js +213 -0
- package/dist/cjs/lib/theme/types.js +235 -0
- package/dist/cjs/lib/theme/utils.js +363 -0
- package/dist/cjs/lib/types/index.js +3 -0
- package/dist/cjs/lib/utils/attachment-loader.js +82 -0
- package/dist/cjs/lib/utils/client-lead-utils.js +61 -0
- package/dist/cjs/lib/utils/device-detection.js +110 -0
- package/dist/cjs/lib/utils/logout-cleanup.js +312 -0
- package/dist/cjs/lib/utils/planning-prefs.js +31 -0
- package/dist/cjs/lib/utils.js +70 -0
- package/dist/cjs/lib/vision/dieline-extractor.js +321 -0
- package/dist/cjs/lib/vision/reference-grid.js +245 -0
- package/dist/cjs/locales/de.json +79 -0
- package/dist/cjs/locales/en.json +2217 -0
- package/dist/cjs/locales/es.json +79 -0
- package/dist/cjs/locales/fr.json +78 -0
- package/dist/cjs/locales/hi.json +1599 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/providers.js +43 -0
- package/dist/cjs/services/GlobalLoadingService.js +220 -0
- package/{src → dist/cjs}/styles/grid-themes.css +345 -345
- package/{src → dist/cjs}/styles/sidebar-scrollbar.css +45 -45
- package/{src → dist/cjs}/styles/tokens.css +712 -711
- package/dist/cjs/types/approval.js +22 -0
- package/dist/cjs/types/audit.js +50 -0
- package/dist/cjs/types/draft.js +22 -0
- package/dist/cjs/types/master.js +4 -0
- package/dist/cjs/types/shipper-planning.js +7 -0
- package/dist/components/auth/ProtectedRoute.d.ts +6 -0
- package/dist/components/auth/ProtectedRoute.js +45 -0
- package/dist/components/auth/UnauthorizedPage.d.ts +6 -0
- package/dist/components/auth/UnauthorizedPage.js +15 -0
- package/dist/components/auth/index.d.ts +2 -0
- package/dist/components/auth/index.js +3 -0
- package/dist/components/chat/ai-messages.d.ts +32 -0
- package/dist/components/chat/ai-messages.js +265 -0
- package/dist/components/chat/chat-prompt-navigator.d.ts +9 -0
- package/dist/components/chat/chat-prompt-navigator.js +107 -0
- package/dist/components/chat/chat.d.ts +46 -0
- package/dist/components/chat/chat.js +1029 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/index.js +13 -0
- package/dist/components/chat/multimodal-input.d.ts +12 -0
- package/dist/components/chat/multimodal-input.js +116 -0
- package/dist/components/dashboard/DrillDownModal.d.ts +15 -0
- package/dist/components/dashboard/DrillDownModal.js +33 -0
- package/dist/components/dashboard/FilterBar.d.ts +108 -0
- package/dist/components/dashboard/FilterBar.js +428 -0
- package/dist/components/dashboard/Tooltip.d.ts +24 -0
- package/dist/components/dashboard/Tooltip.js +50 -0
- package/dist/components/dashboard/charts/Area.d.ts +28 -0
- package/dist/components/dashboard/charts/Area.js +121 -0
- package/dist/components/dashboard/charts/Bar.d.ts +27 -0
- package/dist/components/dashboard/charts/Bar.js +105 -0
- package/dist/components/dashboard/charts/BoxPlot.d.ts +23 -0
- package/dist/components/dashboard/charts/BoxPlot.js +112 -0
- package/dist/components/dashboard/charts/Bubble.d.ts +36 -0
- package/dist/components/dashboard/charts/Bubble.js +96 -0
- package/dist/components/dashboard/charts/DashboardCard.d.ts +12 -0
- package/dist/components/dashboard/charts/DashboardCard.js +9 -0
- package/dist/components/dashboard/charts/Donut.d.ts +23 -0
- package/dist/components/dashboard/charts/Donut.js +124 -0
- package/dist/components/dashboard/charts/FlowMap.d.ts +38 -0
- package/dist/components/dashboard/charts/FlowMap.js +199 -0
- package/dist/components/dashboard/charts/Funnel.d.ts +30 -0
- package/dist/components/dashboard/charts/Funnel.js +35 -0
- package/dist/components/dashboard/charts/Gantt.d.ts +26 -0
- package/dist/components/dashboard/charts/Gantt.js +265 -0
- package/dist/components/dashboard/charts/Gauge.d.ts +25 -0
- package/dist/components/dashboard/charts/Gauge.js +137 -0
- package/dist/components/dashboard/charts/GeoMap.d.ts +38 -0
- package/dist/components/dashboard/charts/GeoMap.js +125 -0
- package/dist/components/dashboard/charts/Heatmap.d.ts +31 -0
- package/dist/components/dashboard/charts/Heatmap.js +110 -0
- package/dist/components/dashboard/charts/Line.d.ts +33 -0
- package/dist/components/dashboard/charts/Line.js +69 -0
- package/dist/components/dashboard/charts/Pareto.d.ts +21 -0
- package/dist/components/dashboard/charts/Pareto.js +104 -0
- package/dist/components/dashboard/charts/Radar.d.ts +32 -0
- package/dist/components/dashboard/charts/Radar.js +88 -0
- package/dist/components/dashboard/charts/Sankey.d.ts +43 -0
- package/dist/components/dashboard/charts/Sankey.js +86 -0
- package/dist/components/dashboard/charts/Scatter.d.ts +38 -0
- package/dist/components/dashboard/charts/Scatter.js +122 -0
- package/dist/components/dashboard/charts/Sparkline.d.ts +37 -0
- package/dist/components/dashboard/charts/Sparkline.js +128 -0
- package/dist/components/dashboard/charts/Treemap.d.ts +30 -0
- package/dist/components/dashboard/charts/Treemap.js +98 -0
- package/dist/components/dashboard/charts/index.d.ts +38 -0
- package/dist/components/dashboard/charts/index.js +23 -0
- package/dist/components/dashboard/charts/india-map.d.ts +22 -0
- package/dist/components/dashboard/charts/india-map.js +461 -0
- package/dist/components/dashboard/charts/theme.d.ts +107 -0
- package/dist/components/dashboard/charts/theme.js +124 -0
- package/dist/components/dashboard/config.d.ts +96 -0
- package/dist/components/dashboard/config.js +113 -0
- package/dist/components/dashboard/index.d.ts +10 -0
- package/dist/components/dashboard/index.js +13 -0
- package/dist/components/dashboard/kpi/KpiBeforeAfter.d.ts +31 -0
- package/dist/components/dashboard/kpi/KpiBeforeAfter.js +13 -0
- package/dist/components/dashboard/kpi/KpiBreakdown.d.ts +31 -0
- package/dist/components/dashboard/kpi/KpiBreakdown.js +39 -0
- package/dist/components/dashboard/kpi/KpiComparison.d.ts +36 -0
- package/dist/components/dashboard/kpi/KpiComparison.js +38 -0
- package/dist/components/dashboard/kpi/KpiQuickStats.d.ts +30 -0
- package/dist/components/dashboard/kpi/KpiQuickStats.js +38 -0
- package/dist/components/dashboard/kpi/KpiRating.d.ts +46 -0
- package/dist/components/dashboard/kpi/KpiRating.js +35 -0
- package/dist/components/dashboard/kpi/KpiScroll.d.ts +63 -0
- package/dist/components/dashboard/kpi/KpiScroll.js +80 -0
- package/dist/components/dashboard/kpi/KpiTrend.d.ts +28 -0
- package/dist/components/dashboard/kpi/KpiTrend.js +34 -0
- package/dist/components/dashboard/kpi/index.d.ts +16 -0
- package/dist/components/dashboard/kpi/index.js +10 -0
- package/dist/components/dashboard/kpi/kpi-shell.d.ts +44 -0
- package/dist/components/dashboard/kpi/kpi-shell.js +108 -0
- package/dist/components/dashboard/time-range.d.ts +12 -0
- package/dist/components/dashboard/time-range.js +118 -0
- package/dist/components/datagrid/DataGrid.d.ts +126 -0
- package/dist/components/datagrid/DataGrid.js +1577 -0
- package/dist/components/datagrid/cells/BooleanCell.d.ts +15 -0
- package/dist/components/datagrid/cells/BooleanCell.js +39 -0
- package/dist/components/datagrid/cells/CellRenderer.d.ts +25 -0
- package/dist/components/datagrid/cells/CellRenderer.js +139 -0
- package/dist/components/datagrid/cells/EditableCell.d.ts +35 -0
- package/dist/components/datagrid/cells/EditableCell.js +179 -0
- package/dist/components/datagrid/cells/SelectionCell.d.ts +11 -0
- package/dist/components/datagrid/cells/SelectionCell.js +58 -0
- package/dist/components/datagrid/cells/index.d.ts +1 -0
- package/dist/components/datagrid/cells/index.js +2 -0
- package/dist/components/datagrid/columns/ActionsColumn.d.ts +174 -0
- package/dist/components/datagrid/columns/ActionsColumn.js +448 -0
- package/dist/components/datagrid/columns/ColumnContextMenu.d.ts +16 -0
- package/dist/components/datagrid/columns/ColumnContextMenu.js +338 -0
- package/dist/components/datagrid/columns/DraggableColumnHeader.d.ts +19 -0
- package/dist/components/datagrid/columns/DraggableColumnHeader.js +147 -0
- package/dist/components/datagrid/controls/AutoResizeButton.d.ts +8 -0
- package/dist/components/datagrid/controls/AutoResizeButton.js +7 -0
- package/dist/components/datagrid/controls/PaginationControls.d.ts +13 -0
- package/dist/components/datagrid/controls/PaginationControls.js +34 -0
- package/dist/components/datagrid/controls/SummaryControls.d.ts +10 -0
- package/dist/components/datagrid/controls/SummaryControls.js +27 -0
- package/dist/components/datagrid/controls/menu/ActionsMenu.d.ts +31 -0
- package/dist/components/datagrid/controls/menu/ActionsMenu.js +13 -0
- package/dist/components/datagrid/controls/menu/column/ColumnChooserModal.d.ts +13 -0
- package/dist/components/datagrid/controls/menu/column/ColumnChooserModal.js +22 -0
- package/dist/components/datagrid/controls/menu/column/ColumnSection.d.ts +9 -0
- package/dist/components/datagrid/controls/menu/column/ColumnSection.js +7 -0
- package/dist/components/datagrid/controls/menu/export/ExportSection.d.ts +7 -0
- package/dist/components/datagrid/controls/menu/export/ExportSection.js +16 -0
- package/dist/components/datagrid/controls/menu/export/export.d.ts +21 -0
- package/dist/components/datagrid/controls/menu/export/export.js +187 -0
- package/dist/components/datagrid/controls/menu/filter/AdvancedFilterModal.d.ts +29 -0
- package/dist/components/datagrid/controls/menu/filter/AdvancedFilterModal.js +369 -0
- package/dist/components/datagrid/controls/menu/filter/FilterSection.d.ts +12 -0
- package/dist/components/datagrid/controls/menu/filter/FilterSection.js +6 -0
- package/dist/components/datagrid/controls/menu/grouping/GroupingSection.d.ts +10 -0
- package/dist/components/datagrid/controls/menu/grouping/GroupingSection.js +20 -0
- package/dist/components/datagrid/controls/menu/grouping/index.d.ts +1 -0
- package/dist/components/datagrid/controls/menu/grouping/index.js +2 -0
- package/dist/components/datagrid/controls/menu/import/ImportSection.d.ts +6 -0
- package/dist/components/datagrid/controls/menu/import/ImportSection.js +72 -0
- package/dist/components/datagrid/controls/menu/import/import.d.ts +27 -0
- package/dist/components/datagrid/controls/menu/import/import.js +193 -0
- package/dist/components/datagrid/controls/menu/index.d.ts +10 -0
- package/dist/components/datagrid/controls/menu/index.js +11 -0
- package/dist/components/datagrid/controls/menu/view/CardView.d.ts +17 -0
- package/dist/components/datagrid/controls/menu/view/CardView.js +173 -0
- package/dist/components/datagrid/controls/menu/view/ChartView.d.ts +9 -0
- package/dist/components/datagrid/controls/menu/view/ChartView.js +363 -0
- package/dist/components/datagrid/controls/menu/view/ViewSection.d.ts +7 -0
- package/dist/components/datagrid/controls/menu/view/ViewSection.js +9 -0
- package/dist/components/datagrid/hooks/useCellRangeSelection.d.ts +20 -0
- package/dist/components/datagrid/hooks/useCellRangeSelection.js +124 -0
- package/dist/components/datagrid/hooks/useClipboard.d.ts +15 -0
- package/dist/components/datagrid/hooks/useClipboard.js +151 -0
- package/dist/components/datagrid/hooks/useDataGridState.d.ts +46 -0
- package/dist/components/datagrid/hooks/useDataGridState.js +112 -0
- package/dist/components/datagrid/hooks/useKeyboardNavigation.d.ts +18 -0
- package/dist/components/datagrid/hooks/useKeyboardNavigation.js +117 -0
- package/dist/components/datagrid/index.d.ts +34 -0
- package/dist/components/datagrid/index.js +41 -0
- package/dist/components/datagrid/rows/DraggableRow.d.ts +33 -0
- package/dist/components/datagrid/rows/DraggableRow.js +31 -0
- package/dist/components/datagrid/rows/ExpandableRow.d.ts +48 -0
- package/dist/components/datagrid/rows/ExpandableRow.js +178 -0
- package/dist/components/datagrid/rows/FilterRow.d.ts +10 -0
- package/dist/components/datagrid/rows/FilterRow.js +185 -0
- package/dist/components/datagrid/rows/SelectColumn.d.ts +2 -0
- package/dist/components/datagrid/rows/SelectColumn.js +31 -0
- package/dist/components/datagrid/rows/SummaryRow.d.ts +12 -0
- package/dist/components/datagrid/rows/SummaryRow.js +31 -0
- package/dist/components/datagrid/rows/summary.d.ts +9 -0
- package/dist/components/datagrid/rows/summary.js +63 -0
- package/dist/components/datagrid/search/InlineSearchCell.d.ts +13 -0
- package/dist/components/datagrid/search/InlineSearchCell.js +96 -0
- package/dist/components/datagrid/search/SearchHighlighter.d.ts +16 -0
- package/dist/components/datagrid/search/SearchHighlighter.js +124 -0
- package/dist/components/datagrid/search/SearchNavigator.d.ts +24 -0
- package/dist/components/datagrid/search/SearchNavigator.js +148 -0
- package/dist/components/datagrid/search/SearchNewModal.d.ts +12 -0
- package/dist/components/datagrid/search/SearchNewModal.js +202 -0
- package/dist/components/datagrid/search/advancedSearch.d.ts +23 -0
- package/dist/components/datagrid/search/advancedSearch.js +109 -0
- package/dist/components/datagrid/utils/grid-helpers.d.ts +34 -0
- package/dist/components/datagrid/utils/grid-helpers.js +94 -0
- package/dist/components/datagrid/utils/grid-types.d.ts +157 -0
- package/dist/components/datagrid/utils/grid-types.js +2 -0
- package/dist/components/draft/AutoSaveIndicator.d.ts +28 -0
- package/dist/components/draft/AutoSaveIndicator.js +67 -0
- package/dist/components/draft/DraftModal.d.ts +27 -0
- package/dist/components/draft/DraftModal.js +184 -0
- package/dist/components/forms/date-picker/CalendarView.d.ts +17 -0
- package/dist/components/forms/date-picker/CalendarView.js +46 -0
- package/dist/components/forms/date-picker/DatePicker.d.ts +35 -0
- package/dist/components/forms/date-picker/DatePicker.js +712 -0
- package/dist/components/forms/date-picker/DateTimePicker.d.ts +15 -0
- package/dist/components/forms/date-picker/DateTimePicker.js +138 -0
- package/dist/components/forms/date-picker/index.d.ts +7 -0
- package/dist/components/forms/date-picker/index.js +9 -0
- package/dist/components/forms/date-picker/shared-utils.d.ts +6 -0
- package/dist/components/forms/date-picker/shared-utils.js +19 -0
- package/dist/components/forms/dropdown/Dropdown.d.ts +144 -0
- package/dist/components/forms/dropdown/Dropdown.js +384 -0
- package/dist/components/forms/dropdown/MultiSelect.d.ts +29 -0
- package/dist/components/forms/dropdown/MultiSelect.js +100 -0
- package/dist/components/forms/dropdown/SingleSelect.d.ts +39 -0
- package/dist/components/forms/dropdown/SingleSelect.js +218 -0
- package/dist/components/forms/dropdown/hooks/useDropdownCreate.d.ts +8 -0
- package/dist/components/forms/dropdown/hooks/useDropdownCreate.js +52 -0
- package/dist/components/forms/dropdown/hooks/useDropdownFiltering.d.ts +5 -0
- package/dist/components/forms/dropdown/hooks/useDropdownFiltering.js +51 -0
- package/dist/components/forms/dropdown/hooks/useDropdownState.d.ts +7 -0
- package/dist/components/forms/dropdown/hooks/useDropdownState.js +27 -0
- package/dist/components/forms/dropdown/index.d.ts +2 -0
- package/dist/components/forms/dropdown/index.js +2 -0
- package/dist/components/forms/dropdown/types.d.ts +67 -0
- package/dist/components/forms/dropdown/types.js +2 -0
- package/dist/components/forms/file-attachment/EmailPreview.d.ts +5 -0
- package/dist/components/forms/file-attachment/EmailPreview.js +383 -0
- package/dist/components/forms/file-attachment/FileAttachment.d.ts +30 -0
- package/dist/components/forms/file-attachment/FileAttachment.js +930 -0
- package/dist/components/forms/file-attachment/index.d.ts +2 -0
- package/dist/components/forms/file-attachment/index.js +2 -0
- package/dist/components/forms/index.d.ts +9 -0
- package/dist/components/forms/index.js +7 -0
- package/dist/components/forms/quantity-input-popup.d.ts +10 -0
- package/dist/components/forms/quantity-input-popup.js +99 -0
- package/dist/components/forms/remark-input/RemarkInput.d.ts +58 -0
- package/dist/components/forms/remark-input/RemarkInput.js +258 -0
- package/dist/components/forms/remark-input/index.d.ts +1 -0
- package/dist/components/forms/remark-input/index.js +2 -0
- package/dist/components/forms/unified-currency-dropdown.d.ts +26 -0
- package/dist/components/forms/unified-currency-dropdown.js +166 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.js +15 -0
- package/dist/components/layout/SidebarContextMenu.d.ts +18 -0
- package/dist/components/layout/SidebarContextMenu.js +142 -0
- package/dist/components/layout/app-shell.d.ts +32 -0
- package/dist/components/layout/app-shell.js +43 -0
- package/dist/components/layout/bottom-nav.d.ts +28 -0
- package/dist/components/layout/bottom-nav.js +219 -0
- package/dist/components/layout/floating-action-button.d.ts +10 -0
- package/dist/components/layout/floating-action-button.js +74 -0
- package/dist/components/layout/footer.d.ts +37 -0
- package/dist/components/layout/footer.js +56 -0
- package/dist/components/layout/index.d.ts +10 -0
- package/dist/components/layout/index.js +7 -0
- package/dist/components/layout/mobile-menu-sheet.d.ts +7 -0
- package/dist/components/layout/mobile-menu-sheet.js +159 -0
- package/dist/components/layout/side-panel.d.ts +50 -0
- package/dist/components/layout/side-panel.js +115 -0
- package/dist/components/layout/sidebar.d.ts +12 -0
- package/dist/components/layout/sidebar.js +542 -0
- package/dist/components/layout/top-header.d.ts +8 -0
- package/dist/components/layout/top-header.js +234 -0
- package/dist/components/layout/userprofile-dropdown.d.ts +1 -0
- package/dist/components/layout/userprofile-dropdown.js +97 -0
- package/dist/components/master/editable-cells/EditableCell.d.ts +43 -0
- package/dist/components/master/editable-cells/EditableCell.js +66 -0
- package/dist/components/master/editable-cells/index.d.ts +9 -0
- package/dist/components/master/editable-cells/index.js +10 -0
- package/dist/components/master/index.d.ts +1 -0
- package/dist/components/master/index.js +3 -0
- package/dist/components/messaging/conversation-list.d.ts +13 -0
- package/dist/components/messaging/conversation-list.js +103 -0
- package/dist/components/messaging/create-conversation-modal.d.ts +9 -0
- package/dist/components/messaging/create-conversation-modal.js +109 -0
- package/dist/components/messaging/message-bubble.d.ts +15 -0
- package/dist/components/messaging/message-bubble.js +66 -0
- package/dist/components/messaging/message-input.d.ts +17 -0
- package/dist/components/messaging/message-input.js +151 -0
- package/dist/components/messaging/message-thread.d.ts +10 -0
- package/dist/components/messaging/message-thread.js +121 -0
- package/dist/components/messaging/messaging-panel-content.d.ts +5 -0
- package/dist/components/messaging/messaging-panel-content.js +66 -0
- package/dist/components/messaging/thread-panel.d.ts +10 -0
- package/dist/components/messaging/thread-panel.js +47 -0
- package/dist/components/modals/3DModal.d.ts +39 -0
- package/dist/components/modals/3DModal.js +32 -0
- package/dist/components/modals/ImageModal.d.ts +28 -0
- package/dist/components/modals/ImageModal.js +551 -0
- package/dist/components/modals/Modal.d.ts +92 -0
- package/dist/components/modals/Modal.js +264 -0
- package/dist/components/modals/StandardModal.d.ts +27 -0
- package/dist/components/modals/StandardModal.js +25 -0
- package/dist/components/modals/api-config-modal.d.ts +7 -0
- package/dist/components/modals/api-config-modal.js +117 -0
- package/dist/components/modals/global-api-config-modal.d.ts +7 -0
- package/dist/components/modals/global-api-config-modal.js +124 -0
- package/dist/components/modals/index.d.ts +7 -0
- package/dist/components/modals/index.js +8 -0
- package/dist/components/modals/logout-modal.d.ts +32 -0
- package/dist/components/modals/logout-modal.js +42 -0
- package/dist/components/modals/modal-alert.d.ts +139 -0
- package/dist/components/modals/modal-alert.js +250 -0
- package/dist/components/modals/password-reset-modal.d.ts +11 -0
- package/dist/components/modals/password-reset-modal.js +109 -0
- package/dist/components/modals/session-expiry-warning.d.ts +12 -0
- package/dist/components/modals/session-expiry-warning.js +15 -0
- package/dist/components/providers/api-provider.d.ts +10 -0
- package/dist/components/providers/api-provider.js +15 -0
- package/dist/components/providers/query-provider.d.ts +3 -0
- package/dist/components/providers/query-provider.js +26 -0
- package/dist/components/providers/session-provider.d.ts +7 -0
- package/dist/components/providers/session-provider.js +116 -0
- package/dist/components/theme/ThemeCustomizer.d.ts +37 -0
- package/dist/components/theme/ThemeCustomizer.js +178 -0
- package/dist/components/ui/buttons/button.d.ts +59 -0
- package/dist/components/ui/buttons/button.js +228 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/chart.d.ts +83 -0
- package/dist/components/ui/chart.js +113 -0
- package/dist/components/ui/display/boolean-badge.d.ts +7 -0
- package/dist/components/ui/display/boolean-badge.js +23 -0
- package/dist/components/ui/display/card.d.ts +10 -0
- package/dist/components/ui/display/card.js +11 -0
- package/dist/components/ui/display/collapsible.d.ts +6 -0
- package/dist/components/ui/display/collapsible.js +6 -0
- package/dist/components/ui/display/separator.d.ts +4 -0
- package/dist/components/ui/display/separator.js +8 -0
- package/dist/components/ui/display/stats-card.d.ts +22 -0
- package/dist/components/ui/display/stats-card.js +25 -0
- package/dist/components/ui/display/text.d.ts +14 -0
- package/dist/components/ui/display/text.js +57 -0
- package/dist/components/ui/feedback/alert.d.ts +8 -0
- package/dist/components/ui/feedback/alert.js +23 -0
- package/dist/components/ui/feedback/badge.d.ts +49 -0
- package/dist/components/ui/feedback/badge.js +87 -0
- package/dist/components/ui/feedback/progress.d.ts +4 -0
- package/dist/components/ui/feedback/progress.js +8 -0
- package/dist/components/ui/feedback/reminder-button.d.ts +22 -0
- package/dist/components/ui/feedback/reminder-button.js +75 -0
- package/dist/components/ui/feedback/skeleton-table.d.ts +18 -0
- package/dist/components/ui/feedback/skeleton-table.js +17 -0
- package/dist/components/ui/feedback/skeleton.d.ts +53 -0
- package/dist/components/ui/feedback/skeleton.js +48 -0
- package/dist/components/ui/feedback/tooltip.d.ts +15 -0
- package/dist/components/ui/feedback/tooltip.js +14 -0
- package/dist/components/ui/form-toggle.d.ts +57 -0
- package/dist/components/ui/form-toggle.js +44 -0
- package/dist/components/ui/forms/checkbox.d.ts +6 -0
- package/dist/components/ui/forms/checkbox.js +17 -0
- package/dist/components/ui/forms/input.d.ts +18 -0
- package/dist/components/ui/forms/input.js +75 -0
- package/dist/components/ui/forms/label.d.ts +5 -0
- package/dist/components/ui/forms/label.js +6 -0
- package/dist/components/ui/forms/switch.d.ts +10 -0
- package/dist/components/ui/forms/switch.js +22 -0
- package/dist/components/ui/forms/textarea.d.ts +8 -0
- package/dist/components/ui/forms/textarea.js +13 -0
- package/dist/components/ui/index.d.ts +49 -0
- package/dist/components/ui/index.js +62 -0
- package/dist/components/ui/navigation/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/navigation/dropdown-menu.js +34 -0
- package/dist/components/ui/navigation/header-steps.d.ts +16 -0
- package/dist/components/ui/navigation/header-steps.js +15 -0
- package/dist/components/ui/navigation/tabs.d.ts +40 -0
- package/dist/components/ui/navigation/tabs.js +59 -0
- package/dist/components/ui/overlays/loading.d.ts +47 -0
- package/dist/components/ui/overlays/loading.js +131 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/select.js +27 -0
- package/dist/config/api.d.ts +30 -0
- package/dist/config/api.js +58 -0
- package/dist/contexts/AppConfigContext.d.ts +13 -0
- package/dist/contexts/AppConfigContext.js +33 -0
- package/dist/contexts/CurrencyContext.d.ts +43 -0
- package/dist/contexts/CurrencyContext.js +331 -0
- package/dist/contexts/DeviceContext.d.ts +12 -0
- package/dist/contexts/DeviceContext.js +69 -0
- package/dist/contexts/EmailContext.d.ts +112 -0
- package/dist/contexts/EmailContext.js +720 -0
- package/dist/contexts/GlobalAlertContext.d.ts +67 -0
- package/dist/contexts/GlobalAlertContext.js +192 -0
- package/dist/contexts/ImpactAnalysisContext.d.ts +11 -0
- package/dist/contexts/ImpactAnalysisContext.js +23 -0
- package/dist/contexts/LanguageContext.d.ts +21 -0
- package/dist/contexts/LanguageContext.js +66 -0
- package/dist/contexts/MessagingContext.d.ts +70 -0
- package/dist/contexts/MessagingContext.js +722 -0
- package/dist/contexts/ModuleAuthContext.d.ts +42 -0
- package/dist/contexts/ModuleAuthContext.js +278 -0
- package/dist/contexts/NavigationContext.d.ts +26 -0
- package/dist/contexts/NavigationContext.js +143 -0
- package/dist/contexts/NetworkStatusContext.d.ts +18 -0
- package/dist/contexts/NetworkStatusContext.js +87 -0
- package/dist/contexts/NotificationContext.d.ts +47 -0
- package/dist/contexts/NotificationContext.js +165 -0
- package/dist/contexts/PageTitleContext.d.ts +11 -0
- package/dist/contexts/PageTitleContext.js +23 -0
- package/dist/contexts/SearchPreferencesContext.d.ts +11 -0
- package/dist/contexts/SearchPreferencesContext.js +38 -0
- package/dist/contexts/SessionAdapterContext.d.ts +39 -0
- package/dist/contexts/SessionAdapterContext.js +20 -0
- package/dist/contexts/SidebarPreferencesContext.d.ts +19 -0
- package/dist/contexts/SidebarPreferencesContext.js +112 -0
- package/dist/contexts/ThemeContext.d.ts +63 -0
- package/dist/contexts/ThemeContext.js +153 -0
- package/dist/hooks/index.d.ts +23 -0
- package/dist/hooks/index.js +18 -0
- package/dist/hooks/useApproval.d.ts +47 -0
- package/dist/hooks/useApproval.js +247 -0
- package/dist/hooks/useBacchaSearch.d.ts +57 -0
- package/dist/hooks/useBacchaSearch.js +254 -0
- package/dist/hooks/useBusinessAudit.d.ts +24 -0
- package/dist/hooks/useBusinessAudit.js +51 -0
- package/dist/hooks/useColumnFreezing.d.ts +85 -0
- package/dist/hooks/useColumnFreezing.js +201 -0
- package/dist/hooks/useColumnMetadata.d.ts +20 -0
- package/dist/hooks/useColumnMetadata.js +44 -0
- package/dist/hooks/useConditionalFormatting.d.ts +43 -0
- package/dist/hooks/useConditionalFormatting.js +193 -0
- package/dist/hooks/useDebounce.d.ts +14 -0
- package/dist/hooks/useDebounce.js +45 -0
- package/dist/hooks/useDraft.d.ts +46 -0
- package/dist/hooks/useDraft.js +178 -0
- package/dist/hooks/useFormValidation.d.ts +37 -0
- package/dist/hooks/useFormValidation.js +65 -0
- package/dist/hooks/useGridSettings.d.ts +26 -0
- package/dist/hooks/useGridSettings.js +82 -0
- package/dist/hooks/useGridTheme.d.ts +59 -0
- package/dist/hooks/useGridTheme.js +199 -0
- package/dist/hooks/useId.d.ts +2 -0
- package/dist/hooks/useId.js +17 -0
- package/dist/hooks/useIntelligentColumnSizing.d.ts +71 -0
- package/dist/hooks/useIntelligentColumnSizing.js +310 -0
- package/dist/hooks/useKeyboardNavigation.d.ts +33 -0
- package/dist/hooks/useKeyboardNavigation.js +189 -0
- package/dist/hooks/useNotifications.d.ts +7 -0
- package/dist/hooks/useNotifications.js +56 -0
- package/dist/hooks/usePrevious.d.ts +9 -0
- package/dist/hooks/usePrevious.js +17 -0
- package/dist/hooks/useRowSelection.d.ts +45 -0
- package/dist/hooks/useRowSelection.js +147 -0
- package/dist/hooks/useSignalR.d.ts +13 -0
- package/dist/hooks/useSignalR.js +50 -0
- package/dist/hooks/useTheme.d.ts +59 -0
- package/dist/hooks/useTheme.js +261 -0
- package/dist/hooks/useTranslation.d.ts +5 -0
- package/dist/hooks/useTranslation.js +17 -0
- package/dist/hooks/useUnsavedChanges.d.ts +40 -0
- package/dist/hooks/useUnsavedChanges.js +83 -0
- package/dist/index.d.ts +2 -3173
- package/dist/index.js +4 -25937
- package/dist/lib/api/activity/audit/audit.d.ts +34 -0
- package/dist/lib/api/activity/audit/audit.js +44 -0
- package/dist/lib/api/activity/audit/index.d.ts +6 -0
- package/dist/lib/api/activity/audit/index.js +7 -0
- package/dist/lib/api/activity/audit/send.d.ts +152 -0
- package/dist/lib/api/activity/audit/send.js +403 -0
- package/dist/lib/api/activity/email/client.d.ts +167 -0
- package/dist/lib/api/activity/email/client.js +455 -0
- package/dist/lib/api/activity/email/index.d.ts +7 -0
- package/dist/lib/api/activity/email/index.js +10 -0
- package/dist/lib/api/activity/email/password-reset.d.ts +8 -0
- package/dist/lib/api/activity/email/password-reset.js +55 -0
- package/dist/lib/api/activity/email/templates.d.ts +10 -0
- package/dist/lib/api/activity/email/templates.js +531 -0
- package/dist/lib/api/activity/email/types.d.ts +237 -0
- package/dist/lib/api/activity/email/types.js +21 -0
- package/dist/lib/api/activity/index.d.ts +12 -0
- package/dist/lib/api/activity/index.js +15 -0
- package/dist/lib/api/activity/messaging/messaging.d.ts +149 -0
- package/dist/lib/api/activity/messaging/messaging.js +245 -0
- package/dist/lib/api/activity/notifications/index.d.ts +9 -0
- package/dist/lib/api/activity/notifications/index.js +9 -0
- package/dist/lib/api/activity/notifications/notifications.d.ts +59 -0
- package/dist/lib/api/activity/notifications/notifications.js +218 -0
- package/dist/lib/api/activity/notifications/reminders.d.ts +35 -0
- package/dist/lib/api/activity/notifications/reminders.js +25 -0
- package/dist/lib/api/activity/notifications/send.d.ts +122 -0
- package/dist/lib/api/activity/notifications/send.js +252 -0
- package/dist/lib/api/activity/notifications/types.d.ts +119 -0
- package/dist/lib/api/activity/notifications/types.js +62 -0
- package/dist/lib/api/activity/notify-and-log.d.ts +50 -0
- package/dist/lib/api/activity/notify-and-log.js +60 -0
- package/dist/lib/api/activity/remarks/index.d.ts +2 -0
- package/dist/lib/api/activity/remarks/index.js +2 -0
- package/dist/lib/api/activity/remarks/remarks.d.ts +83 -0
- package/dist/lib/api/activity/remarks/remarks.js +179 -0
- package/dist/lib/api/activity/storage.d.ts +28 -0
- package/dist/lib/api/activity/storage.js +79 -0
- package/dist/lib/api/ai/chat.d.ts +67 -0
- package/dist/lib/api/ai/chat.js +212 -0
- package/dist/lib/api/ai/types.d.ts +69 -0
- package/dist/lib/api/ai/types.js +5 -0
- package/dist/lib/api/approval/approvals.d.ts +66 -0
- package/dist/lib/api/approval/approvals.js +205 -0
- package/dist/lib/api/approval/index.d.ts +5 -0
- package/dist/lib/api/approval/index.js +6 -0
- package/dist/lib/api/auth/auth.d.ts +12 -0
- package/dist/lib/api/auth/auth.js +148 -0
- package/dist/lib/api/auth/index.d.ts +1 -0
- package/dist/lib/api/auth/index.js +4 -0
- package/dist/lib/api/auth/password-reset-otp.d.ts +49 -0
- package/dist/lib/api/auth/password-reset-otp.js +185 -0
- package/dist/lib/api/auth/two-factor-auth.d.ts +55 -0
- package/dist/lib/api/auth/two-factor-auth.js +84 -0
- package/dist/lib/api/auth/two-factor.d.ts +41 -0
- package/dist/lib/api/auth/two-factor.js +180 -0
- package/dist/lib/api/core/auth-helpers.d.ts +13 -0
- package/dist/lib/api/core/auth-helpers.js +137 -0
- package/dist/lib/api/core/client.d.ts +37 -0
- package/dist/lib/api/core/client.js +301 -0
- package/dist/lib/api/core/config.d.ts +46 -0
- package/dist/lib/api/core/config.js +238 -0
- package/dist/lib/api/core/index.d.ts +6 -0
- package/dist/lib/api/core/index.js +11 -0
- package/dist/lib/api/core/session-validator.d.ts +55 -0
- package/dist/lib/api/core/session-validator.js +94 -0
- package/dist/lib/api/core/types.d.ts +192 -0
- package/dist/lib/api/core/types.js +3 -0
- package/dist/lib/api/core/utils.d.ts +15 -0
- package/dist/lib/api/core/utils.js +64 -0
- package/dist/lib/api/dashboard/costing.d.ts +129 -0
- package/dist/lib/api/dashboard/costing.js +8 -0
- package/dist/lib/api/dashboard/management.d.ts +91 -0
- package/dist/lib/api/dashboard/management.js +5 -0
- package/dist/lib/api/dashboard/sales.d.ts +87 -0
- package/dist/lib/api/dashboard/sales.js +5 -0
- package/dist/lib/api/draft/drafts.d.ts +49 -0
- package/dist/lib/api/draft/drafts.js +274 -0
- package/dist/lib/api/draft/index.d.ts +5 -0
- package/dist/lib/api/draft/index.js +6 -0
- package/dist/lib/api/enquiry/enquiry.d.ts +324 -0
- package/dist/lib/api/enquiry/enquiry.js +617 -0
- package/dist/lib/api/enquiry/index.d.ts +2 -0
- package/dist/lib/api/enquiry/index.js +4 -0
- package/dist/lib/api/enquiry/rate-enquiry.d.ts +97 -0
- package/dist/lib/api/enquiry/rate-enquiry.js +69 -0
- package/dist/lib/api/estimation/categories.d.ts +28 -0
- package/dist/lib/api/estimation/categories.js +104 -0
- package/dist/lib/api/estimation/category-defaults.d.ts +56 -0
- package/dist/lib/api/estimation/category-defaults.js +41 -0
- package/dist/lib/api/estimation/company-config.d.ts +59 -0
- package/dist/lib/api/estimation/company-config.js +19 -0
- package/dist/lib/api/estimation/content.d.ts +103 -0
- package/dist/lib/api/estimation/content.js +203 -0
- package/dist/lib/api/estimation/freight.d.ts +34 -0
- package/dist/lib/api/estimation/freight.js +18 -0
- package/dist/lib/api/estimation/grid-costing-drafts.d.ts +38 -0
- package/dist/lib/api/estimation/grid-costing-drafts.js +21 -0
- package/dist/lib/api/estimation/grid-costing.d.ts +353 -0
- package/dist/lib/api/estimation/grid-costing.js +126 -0
- package/dist/lib/api/estimation/index.d.ts +10 -0
- package/dist/lib/api/estimation/index.js +22 -0
- package/dist/lib/api/estimation/legacy-costing.d.ts +42 -0
- package/dist/lib/api/estimation/legacy-costing.js +46 -0
- package/dist/lib/api/estimation/machines.d.ts +32 -0
- package/dist/lib/api/estimation/machines.js +67 -0
- package/dist/lib/api/estimation/planning.d.ts +479 -0
- package/dist/lib/api/estimation/planning.js +385 -0
- package/dist/lib/api/estimation/qualities.d.ts +128 -0
- package/dist/lib/api/estimation/qualities.js +229 -0
- package/dist/lib/api/estimation/quotation-load.d.ts +30 -0
- package/dist/lib/api/estimation/quotation-load.js +46 -0
- package/dist/lib/api/estimation/quotation-save.d.ts +88 -0
- package/dist/lib/api/estimation/quotation-save.js +101 -0
- package/dist/lib/api/estimation/quote-check.d.ts +19 -0
- package/dist/lib/api/estimation/quote-check.js +28 -0
- package/dist/lib/api/estimation/quotepanel.d.ts +304 -0
- package/dist/lib/api/estimation/quotepanel.js +489 -0
- package/dist/lib/api/estimation/shipper-planning.d.ts +71 -0
- package/dist/lib/api/estimation/shipper-planning.js +208 -0
- package/dist/lib/api/estimation/wastage.d.ts +40 -0
- package/dist/lib/api/estimation/wastage.js +40 -0
- package/dist/lib/api/index.d.ts +7 -0
- package/dist/lib/api/index.js +17 -0
- package/dist/lib/api/integration/proxy.d.ts +7 -0
- package/dist/lib/api/integration/proxy.js +34 -0
- package/dist/lib/api/master/category.d.ts +126 -0
- package/dist/lib/api/master/category.js +208 -0
- package/dist/lib/api/master/company.d.ts +167 -0
- package/dist/lib/api/master/company.js +368 -0
- package/dist/lib/api/master/hsn.d.ts +36 -0
- package/dist/lib/api/master/hsn.js +54 -0
- package/dist/lib/api/master/index.d.ts +12 -0
- package/dist/lib/api/master/index.js +27 -0
- package/dist/lib/api/master/item.d.ts +158 -0
- package/dist/lib/api/master/item.js +135 -0
- package/dist/lib/api/master/ledger.d.ts +173 -0
- package/dist/lib/api/master/ledger.js +391 -0
- package/dist/lib/api/master/logistics.d.ts +117 -0
- package/dist/lib/api/master/logistics.js +107 -0
- package/dist/lib/api/master/machine.d.ts +406 -0
- package/dist/lib/api/master/machine.js +570 -0
- package/dist/lib/api/master/material-group.d.ts +97 -0
- package/dist/lib/api/master/material-group.js +96 -0
- package/dist/lib/api/master/other.d.ts +65 -0
- package/dist/lib/api/master/other.js +56 -0
- package/dist/lib/api/master/process-types.d.ts +178 -0
- package/dist/lib/api/master/process-types.js +4 -0
- package/dist/lib/api/master/process.d.ts +94 -0
- package/dist/lib/api/master/process.js +124 -0
- package/dist/lib/api/master/production-units.d.ts +10 -0
- package/dist/lib/api/master/production-units.js +15 -0
- package/dist/lib/api/master/rate.d.ts +174 -0
- package/dist/lib/api/master/rate.js +196 -0
- package/dist/lib/api/master/tool.d.ts +48 -0
- package/dist/lib/api/master/tool.js +80 -0
- package/dist/lib/api/master/user.d.ts +473 -0
- package/dist/lib/api/master/user.js +147 -0
- package/dist/lib/api/settings/erp-parameters.d.ts +33 -0
- package/dist/lib/api/settings/erp-parameters.js +61 -0
- package/dist/lib/api/utility/index.d.ts +1 -0
- package/dist/lib/api/utility/index.js +5 -0
- package/dist/lib/api/utility/menu.d.ts +32 -0
- package/dist/lib/api/utility/menu.js +128 -0
- package/dist/lib/auth.d.ts +3 -0
- package/dist/lib/auth.js +7 -0
- package/dist/lib/pwa.d.ts +8 -0
- package/dist/lib/pwa.js +53 -0
- package/dist/lib/react-query-config.d.ts +140 -0
- package/dist/lib/react-query-config.js +131 -0
- package/dist/lib/security/audit-logger.d.ts +71 -0
- package/dist/lib/security/audit-logger.js +173 -0
- package/dist/lib/security/rate-limiter.d.ts +28 -0
- package/dist/lib/security/rate-limiter.js +118 -0
- package/dist/lib/server-url.d.ts +18 -0
- package/dist/lib/server-url.js +70 -0
- package/dist/lib/svg-utils.d.ts +62 -0
- package/dist/lib/svg-utils.js +206 -0
- package/dist/lib/theme/types.d.ts +109 -0
- package/dist/lib/theme/types.js +231 -0
- package/dist/lib/theme/utils.d.ts +73 -0
- package/dist/lib/theme/utils.js +343 -0
- package/dist/lib/types/index.d.ts +58 -0
- package/dist/lib/types/index.js +2 -0
- package/dist/lib/utils/attachment-loader.d.ts +27 -0
- package/dist/lib/utils/attachment-loader.js +79 -0
- package/dist/lib/utils/client-lead-utils.d.ts +24 -0
- package/dist/lib/utils/client-lead-utils.js +56 -0
- package/dist/lib/utils/device-detection.d.ts +19 -0
- package/dist/lib/utils/device-detection.js +105 -0
- package/dist/lib/utils/logout-cleanup.d.ts +63 -0
- package/dist/lib/utils/logout-cleanup.js +297 -0
- package/dist/lib/utils/planning-prefs.d.ts +10 -0
- package/dist/lib/utils/planning-prefs.js +27 -0
- package/dist/lib/utils.d.ts +20 -0
- package/dist/lib/utils.js +60 -0
- package/dist/lib/vision/dieline-extractor.d.ts +38 -0
- package/dist/lib/vision/dieline-extractor.js +313 -0
- package/dist/lib/vision/reference-grid.d.ts +52 -0
- package/dist/lib/vision/reference-grid.js +241 -0
- package/dist/locales/de.json +79 -0
- package/dist/locales/en.json +2217 -0
- package/dist/locales/es.json +79 -0
- package/dist/locales/fr.json +78 -0
- package/dist/locales/hi.json +1599 -0
- package/dist/providers.d.ts +14 -0
- package/dist/providers.js +15 -0
- package/dist/services/GlobalLoadingService.d.ts +216 -0
- package/dist/services/GlobalLoadingService.js +216 -0
- package/dist/styles/grid-themes.css +346 -0
- package/dist/styles/index.css +5 -0
- package/dist/{sidebar-scrollbar-NBCB2OO2.css → styles/sidebar-scrollbar.css} +45 -45
- package/dist/styles/tokens.css +713 -0
- package/dist/types/approval.d.ts +201 -0
- package/dist/types/approval.js +19 -0
- package/dist/types/audit.d.ts +87 -0
- package/dist/types/audit.js +47 -0
- package/dist/types/draft.d.ts +142 -0
- package/dist/types/draft.js +19 -0
- package/dist/types/master.d.ts +154 -0
- package/dist/types/master.js +3 -0
- package/dist/types/shipper-planning.d.ts +277 -0
- package/dist/types/shipper-planning.js +6 -0
- package/package.json +187 -119
- package/dist/chunk-4PEFU7N7.js +0 -16
- package/dist/chunk-4PEFU7N7.js.map +0 -1
- package/dist/de-EKT7SUK5.js +0 -106
- package/dist/de-EKT7SUK5.js.map +0 -1
- package/dist/en-QRFSIEHD.js +0 -1685
- package/dist/en-QRFSIEHD.js.map +0 -1
- package/dist/es-KHZMWGUI.js +0 -106
- package/dist/es-KHZMWGUI.js.map +0 -1
- package/dist/fr-X2XUXSHK.js +0 -105
- package/dist/fr-X2XUXSHK.js.map +0 -1
- package/dist/hi-YRATOE5Q.js +0 -415
- package/dist/hi-YRATOE5Q.js.map +0 -1
- package/dist/index.cjs +0 -28216
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -3173
- package/dist/index.js.map +0 -1
- /package/{src → dist/cjs}/styles/index.css +0 -0
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.FileAttachment = FileAttachment;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const react_dom_1 = require("react-dom");
|
|
41
|
+
const framer_motion_1 = require("framer-motion");
|
|
42
|
+
const react_image_crop_1 = __importStar(require("react-image-crop"));
|
|
43
|
+
|
|
44
|
+
const lucide_react_1 = require("lucide-react");
|
|
45
|
+
const utils_1 = require("../../../lib/utils.js");
|
|
46
|
+
const ui_1 = require("../../ui/index.js");
|
|
47
|
+
const layout_1 = require("../../layout/index.js");
|
|
48
|
+
const Modal_1 = require("../../modals/Modal.js");
|
|
49
|
+
const EmailPreview_1 = require("./EmailPreview.js");
|
|
50
|
+
const EmailContext_1 = require("../../../contexts/EmailContext.js");
|
|
51
|
+
// Helper function to get cropped image as blob
|
|
52
|
+
async function getCroppedImg(image, crop, mimeType = 'image/jpeg', quality = 0.92) {
|
|
53
|
+
const canvas = document.createElement('canvas');
|
|
54
|
+
const ctx = canvas.getContext('2d');
|
|
55
|
+
if (!ctx) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// Calculate scale factors
|
|
59
|
+
const scaleX = image.naturalWidth / image.width;
|
|
60
|
+
const scaleY = image.naturalHeight / image.height;
|
|
61
|
+
// Set canvas size to the crop size (in natural pixels for best quality)
|
|
62
|
+
const pixelRatio = window.devicePixelRatio || 1;
|
|
63
|
+
canvas.width = Math.floor(crop.width * scaleX * pixelRatio);
|
|
64
|
+
canvas.height = Math.floor(crop.height * scaleY * pixelRatio);
|
|
65
|
+
// Scale context for high DPI displays
|
|
66
|
+
ctx.scale(pixelRatio, pixelRatio);
|
|
67
|
+
ctx.imageSmoothingQuality = 'high';
|
|
68
|
+
// Calculate crop coordinates in natural image pixels
|
|
69
|
+
const cropX = crop.x * scaleX;
|
|
70
|
+
const cropY = crop.y * scaleY;
|
|
71
|
+
const cropWidth = crop.width * scaleX;
|
|
72
|
+
const cropHeight = crop.height * scaleY;
|
|
73
|
+
// Draw the cropped image
|
|
74
|
+
ctx.drawImage(image, cropX, cropY, cropWidth, cropHeight, 0, 0, crop.width * scaleX, crop.height * scaleY);
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
// Use lossless quality for PNG/BMP/GIF (quality param is ignored for these)
|
|
77
|
+
canvas.toBlob((blob) => {
|
|
78
|
+
if (blob) {
|
|
79
|
+
resolve({
|
|
80
|
+
blob,
|
|
81
|
+
url: URL.createObjectURL(blob)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
resolve(null);
|
|
86
|
+
}
|
|
87
|
+
}, mimeType, quality);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Helper to create centered aspect ratio crop
|
|
91
|
+
function centerAspectCrop(mediaWidth, mediaHeight, aspect) {
|
|
92
|
+
if (aspect) {
|
|
93
|
+
return (0, react_image_crop_1.centerCrop)((0, react_image_crop_1.makeAspectCrop)({
|
|
94
|
+
unit: '%',
|
|
95
|
+
width: 90,
|
|
96
|
+
}, aspect, mediaWidth, mediaHeight), mediaWidth, mediaHeight);
|
|
97
|
+
}
|
|
98
|
+
// No aspect ratio - use 90% of image
|
|
99
|
+
return {
|
|
100
|
+
unit: '%',
|
|
101
|
+
x: 5,
|
|
102
|
+
y: 5,
|
|
103
|
+
width: 90,
|
|
104
|
+
height: 90
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const formatFileSize = (bytes) => {
|
|
108
|
+
if (bytes === 0)
|
|
109
|
+
return '0 Bytes';
|
|
110
|
+
const k = 1024;
|
|
111
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
112
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
113
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
114
|
+
};
|
|
115
|
+
// Allowed filename characters: letters, digits, space, and a small set of safe
|
|
116
|
+
// punctuation. Rejects emojis and other characters that break the S3 object key.
|
|
117
|
+
const VALID_FILENAME = /^[A-Za-z0-9 ._\-()[\]&+#]+$/;
|
|
118
|
+
// Returns an error string if the filename is invalid, else null.
|
|
119
|
+
const validateFileName = (name) => {
|
|
120
|
+
const base = (name || '').trim();
|
|
121
|
+
if (!base)
|
|
122
|
+
return 'File name is empty';
|
|
123
|
+
if (!VALID_FILENAME.test(base)) {
|
|
124
|
+
const bad = Array.from(base).filter(c => !VALID_FILENAME.test(c));
|
|
125
|
+
const shown = Array.from(new Set(bad)).slice(0, 5).join(' ');
|
|
126
|
+
return `File name "${base}" has invalid characters (${shown}). Use only letters, numbers, spaces and . _ - ( ) [ ] & + #`;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
};
|
|
130
|
+
// Check if file is an email type (.eml, .msg, or imported email)
|
|
131
|
+
const isEmailFile = (type, name) => {
|
|
132
|
+
return type.includes('message/') ||
|
|
133
|
+
type.includes('rfc822') ||
|
|
134
|
+
type.includes('ms-outlook') ||
|
|
135
|
+
type === 'message/email' ||
|
|
136
|
+
name?.endsWith('.eml') ||
|
|
137
|
+
name?.endsWith('.msg');
|
|
138
|
+
};
|
|
139
|
+
// Check if file is an Excel type
|
|
140
|
+
const isExcelFile = (type, name) => {
|
|
141
|
+
return type.includes('spreadsheet') ||
|
|
142
|
+
type.includes('excel') ||
|
|
143
|
+
type === 'application/vnd.ms-excel' ||
|
|
144
|
+
type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
|
145
|
+
name?.endsWith('.xlsx') ||
|
|
146
|
+
name?.endsWith('.xls') ||
|
|
147
|
+
name?.endsWith('.csv');
|
|
148
|
+
};
|
|
149
|
+
const getFileIcon = (type, name) => {
|
|
150
|
+
if (type.startsWith('image/'))
|
|
151
|
+
return lucide_react_1.Image;
|
|
152
|
+
if (type.startsWith('video/'))
|
|
153
|
+
return lucide_react_1.FileVideo;
|
|
154
|
+
if (type.startsWith('audio/'))
|
|
155
|
+
return lucide_react_1.FileAudio;
|
|
156
|
+
if (isEmailFile(type, name))
|
|
157
|
+
return lucide_react_1.Mail;
|
|
158
|
+
if (type.includes('pdf') || type.includes('text/'))
|
|
159
|
+
return lucide_react_1.FileText;
|
|
160
|
+
if (type.includes('zip') || type.includes('rar') || type.includes('7z'))
|
|
161
|
+
return lucide_react_1.FileArchive;
|
|
162
|
+
return lucide_react_1.File;
|
|
163
|
+
};
|
|
164
|
+
const getFileTypeColor = (type, name) => {
|
|
165
|
+
if (type.startsWith('image/'))
|
|
166
|
+
return 'text-[rgb(var(--color-success))] bg-[rgb(var(--color-success)/0.1)]';
|
|
167
|
+
if (type.startsWith('video/'))
|
|
168
|
+
return 'text-[rgb(var(--color-primary))] bg-[rgb(var(--color-primary)/0.1)]';
|
|
169
|
+
if (type.startsWith('audio/'))
|
|
170
|
+
return 'text-[rgb(var(--color-info))] bg-[rgb(var(--color-info)/0.1)]';
|
|
171
|
+
if (isEmailFile(type, name))
|
|
172
|
+
return 'text-[rgb(var(--color-info))] bg-[rgb(var(--color-info)/0.1)]';
|
|
173
|
+
if (type.includes('pdf'))
|
|
174
|
+
return 'text-[rgb(var(--color-error))] bg-[rgb(var(--color-error)/0.1)]';
|
|
175
|
+
if (type.includes('text/'))
|
|
176
|
+
return 'text-[rgb(var(--fg-muted))] bg-[rgb(var(--bg-muted))]';
|
|
177
|
+
if (type.includes('zip') || type.includes('rar') || type.includes('7z'))
|
|
178
|
+
return 'text-[rgb(var(--color-warning))] bg-[rgb(var(--color-warning)/0.1)]';
|
|
179
|
+
return 'text-[rgb(var(--fg-muted))] bg-[rgb(var(--bg-muted))]';
|
|
180
|
+
};
|
|
181
|
+
// Image Preview Component with loading and error states
|
|
182
|
+
function ImagePreviewContent({ file }) {
|
|
183
|
+
const [imageLoading, setImageLoading] = React.useState(true);
|
|
184
|
+
const [imageError, setImageError] = React.useState(false);
|
|
185
|
+
const [imageSrc, setImageSrc] = React.useState(null);
|
|
186
|
+
React.useEffect(() => {
|
|
187
|
+
let blobUrl = null;
|
|
188
|
+
let isCancelled = false;
|
|
189
|
+
setImageLoading(true);
|
|
190
|
+
setImageError(false);
|
|
191
|
+
// Priority 1: If we have a File object, create a fresh blob URL from it
|
|
192
|
+
if (file.file && typeof file.file === 'object' && 'size' in file.file) {
|
|
193
|
+
try {
|
|
194
|
+
blobUrl = URL.createObjectURL(file.file);
|
|
195
|
+
if (!isCancelled) {
|
|
196
|
+
setImageSrc(blobUrl);
|
|
197
|
+
}
|
|
198
|
+
return () => {
|
|
199
|
+
isCancelled = true;
|
|
200
|
+
if (blobUrl) {
|
|
201
|
+
URL.revokeObjectURL(blobUrl);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
// Failed to create blob URL, continue to other options
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Priority 2: If we have a data URL, use it directly (always works)
|
|
210
|
+
if (file.url?.startsWith('data:')) {
|
|
211
|
+
if (!isCancelled)
|
|
212
|
+
setImageSrc(file.url);
|
|
213
|
+
return () => { isCancelled = true; };
|
|
214
|
+
}
|
|
215
|
+
// Priority 3: If we have a blob URL, use it (might be stale but try)
|
|
216
|
+
if (file.url?.startsWith('blob:')) {
|
|
217
|
+
if (!isCancelled)
|
|
218
|
+
setImageSrc(file.url);
|
|
219
|
+
return () => { isCancelled = true; };
|
|
220
|
+
}
|
|
221
|
+
// Priority 4: Server URL - use directly
|
|
222
|
+
if (file.url) {
|
|
223
|
+
if (!isCancelled)
|
|
224
|
+
setImageSrc(file.url);
|
|
225
|
+
return () => { isCancelled = true; };
|
|
226
|
+
}
|
|
227
|
+
// No valid source found
|
|
228
|
+
if (!isCancelled) {
|
|
229
|
+
setImageError(true);
|
|
230
|
+
setImageLoading(false);
|
|
231
|
+
}
|
|
232
|
+
return () => { isCancelled = true; };
|
|
233
|
+
}, [file]);
|
|
234
|
+
if (imageError) {
|
|
235
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center text-[rgb(var(--fg-muted))]", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Image, { className: "h-16 w-16 mb-4 opacity-50" }), (0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-medium mb-2 text-[rgb(var(--fg-default))]", children: "Unable to load image" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-center mb-4", children: ["The image could not be displayed.", (0, jsx_runtime_1.jsx)("br", {}), "Try downloading the file instead."] })] }));
|
|
236
|
+
}
|
|
237
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative w-full h-full flex items-center justify-center", children: [imageLoading && ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-[rgb(var(--bg-muted))]", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-8 h-8 border-2 border-[rgb(var(--color-primary))] border-t-transparent rounded-full animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-[rgb(var(--fg-muted))]", children: "Loading image..." })] }) })), imageSrc && ((0, jsx_runtime_1.jsx)("img", { src: imageSrc, alt: file.name, className: (0, utils_1.cn)("max-w-full max-h-full object-contain rounded-lg shadow-lg transition-opacity duration-300", imageLoading ? "opacity-0" : "opacity-100"), onLoad: () => setImageLoading(false), onError: () => {
|
|
238
|
+
setImageLoading(false);
|
|
239
|
+
setImageError(true);
|
|
240
|
+
} }))] }));
|
|
241
|
+
}
|
|
242
|
+
// ExcelJS ARGB ("FF1E3A5F") → CSS "#1E3A5F". Skips fully transparent / absent.
|
|
243
|
+
function argbToCss(argb) {
|
|
244
|
+
if (!argb || argb.length < 6)
|
|
245
|
+
return undefined;
|
|
246
|
+
const hex = argb.length === 8 ? argb.slice(2) : argb;
|
|
247
|
+
if (argb.length === 8 && argb.slice(0, 2) === '00')
|
|
248
|
+
return undefined; // transparent
|
|
249
|
+
return `#${hex}`;
|
|
250
|
+
}
|
|
251
|
+
function ExcelPreviewContent({ file }) {
|
|
252
|
+
const [loading, setLoading] = React.useState(true);
|
|
253
|
+
const [error, setError] = React.useState(false);
|
|
254
|
+
const [sheetData, setSheetData] = React.useState([]);
|
|
255
|
+
const [activeSheet, setActiveSheet] = React.useState(0);
|
|
256
|
+
React.useEffect(() => {
|
|
257
|
+
let isCancelled = false;
|
|
258
|
+
setLoading(true);
|
|
259
|
+
setError(false);
|
|
260
|
+
const loadExcel = async () => {
|
|
261
|
+
try {
|
|
262
|
+
let arrayBuffer;
|
|
263
|
+
// Get file data
|
|
264
|
+
if (file.file instanceof File) {
|
|
265
|
+
arrayBuffer = await file.file.arrayBuffer();
|
|
266
|
+
}
|
|
267
|
+
else if (file.url) {
|
|
268
|
+
const response = await fetch(file.url);
|
|
269
|
+
arrayBuffer = await response.arrayBuffer();
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
throw new Error('No file data available');
|
|
273
|
+
}
|
|
274
|
+
// Parse with ExcelJS (not SheetJS) — the community xlsx build strips cell
|
|
275
|
+
// fills/fonts, but ExcelJS preserves them, so the preview can show the
|
|
276
|
+
// real colors + merges of the sheet.
|
|
277
|
+
const { Workbook } = await Promise.resolve().then(() => __importStar(require('exceljs')));
|
|
278
|
+
const workbook = new Workbook();
|
|
279
|
+
await workbook.xlsx.load(arrayBuffer);
|
|
280
|
+
const sheets = workbook.worksheets.map(ws => {
|
|
281
|
+
const merges = Object.values(ws._merges ?? {}).map((m) => ({
|
|
282
|
+
r1: m.top - 1, c1: m.left - 1, r2: m.bottom - 1, c2: m.right - 1,
|
|
283
|
+
}));
|
|
284
|
+
const colCount = Math.max(ws.columnCount, ...merges.map(m => m.c2 + 1), 0);
|
|
285
|
+
const rows = [];
|
|
286
|
+
for (let r = 1; r <= ws.rowCount; r++) {
|
|
287
|
+
const row = ws.getRow(r);
|
|
288
|
+
const cells = [];
|
|
289
|
+
for (let c = 1; c <= colCount; c++) {
|
|
290
|
+
const cell = row.getCell(c);
|
|
291
|
+
const v = cell.value;
|
|
292
|
+
let text = '';
|
|
293
|
+
if (v != null) {
|
|
294
|
+
if (typeof v === 'object' && 'richText' in v) {
|
|
295
|
+
text = v.richText.map((t) => t.text).join('');
|
|
296
|
+
}
|
|
297
|
+
else if (typeof v === 'object' && 'text' in v) {
|
|
298
|
+
text = String(v.text);
|
|
299
|
+
}
|
|
300
|
+
else if (typeof v === 'object' && 'result' in v) {
|
|
301
|
+
text = String(v.result ?? '');
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
text = String(v);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const fill = cell.fill;
|
|
308
|
+
const bg = fill?.type === 'pattern' ? argbToCss(fill.fgColor?.argb) : undefined;
|
|
309
|
+
const fg = argbToCss(cell.font?.color?.argb);
|
|
310
|
+
cells.push({ text, bg, fg, bold: cell.font?.bold });
|
|
311
|
+
}
|
|
312
|
+
rows.push(cells);
|
|
313
|
+
}
|
|
314
|
+
return { name: ws.name, rows, merges };
|
|
315
|
+
});
|
|
316
|
+
if (!isCancelled) {
|
|
317
|
+
setSheetData(sheets);
|
|
318
|
+
setLoading(false);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
catch (e) {
|
|
322
|
+
if (!isCancelled) {
|
|
323
|
+
setError(true);
|
|
324
|
+
setLoading(false);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
loadExcel();
|
|
329
|
+
return () => { isCancelled = true; };
|
|
330
|
+
}, [file]);
|
|
331
|
+
if (loading) {
|
|
332
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "w-full h-full flex items-center justify-center bg-[rgb(var(--bg-muted))]", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-8 h-8 border-2 border-[rgb(var(--color-primary))] border-t-transparent rounded-full animate-spin" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-[rgb(var(--fg-muted))]", children: "Loading spreadsheet..." })] }) }));
|
|
333
|
+
}
|
|
334
|
+
if (error || sheetData.length === 0) {
|
|
335
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "w-full h-full flex flex-col items-center justify-center text-[rgb(var(--fg-muted))]", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.FileText, { className: "h-16 w-16 mb-4 opacity-50" }), (0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-medium mb-2 text-[rgb(var(--fg-default))]", children: "Unable to load spreadsheet" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-center mb-4", children: "The file could not be parsed." })] }));
|
|
336
|
+
}
|
|
337
|
+
const currentSheet = sheetData[activeSheet];
|
|
338
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "w-full h-full flex flex-col bg-white", children: [sheetData.length > 1 && ((0, jsx_runtime_1.jsx)("div", { className: "flex-shrink-0 flex gap-1 px-4 pt-3 pb-2 border-b border-[rgb(var(--bd-default))] bg-[rgb(var(--bg-surface))] overflow-x-auto", children: sheetData.map((sheet, index) => ((0, jsx_runtime_1.jsx)("button", { onClick: () => setActiveSheet(index), className: (0, utils_1.cn)("px-3 py-1.5 text-xs font-medium rounded-t transition-colors whitespace-nowrap", activeSheet === index
|
|
339
|
+
? "bg-white text-[rgb(var(--fg-default))] border border-b-0 border-[rgb(var(--bd-default))]"
|
|
340
|
+
: "text-[rgb(var(--fg-muted))] hover:text-[rgb(var(--fg-default))] hover:bg-[rgb(var(--bg-hover))]"), children: sheet.name }, sheet.name))) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 overflow-auto p-4", children: [currentSheet.rows.length > 0 ? ((() => {
|
|
341
|
+
// Merge lookups: origin cell "r:c" → span; covered cell "r:c" → skip.
|
|
342
|
+
// Row spans are clamped to the 100-row render window so a merge that
|
|
343
|
+
// extends past it doesn't reference unrendered rows.
|
|
344
|
+
const ROW_LIMIT = 100;
|
|
345
|
+
const spanByOrigin = new Map();
|
|
346
|
+
const covered = new Set();
|
|
347
|
+
for (const m of currentSheet.merges) {
|
|
348
|
+
if (m.r1 >= ROW_LIMIT)
|
|
349
|
+
continue;
|
|
350
|
+
const r2 = Math.min(m.r2, ROW_LIMIT - 1);
|
|
351
|
+
spanByOrigin.set(`${m.r1}:${m.c1}`, { rowSpan: r2 - m.r1 + 1, colSpan: m.c2 - m.c1 + 1 });
|
|
352
|
+
for (let r = m.r1; r <= r2; r++) {
|
|
353
|
+
for (let c = m.c1; c <= m.c2; c++) {
|
|
354
|
+
if (r !== m.r1 || c !== m.c1)
|
|
355
|
+
covered.add(`${r}:${c}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return ((0, jsx_runtime_1.jsx)("table", { className: "border-collapse text-sm whitespace-nowrap", children: (0, jsx_runtime_1.jsx)("tbody", { children: currentSheet.rows.slice(0, 100).map((row, rowIndex) => ((0, jsx_runtime_1.jsx)("tr", { children: row.map((cell, cellIndex) => {
|
|
360
|
+
if (covered.has(`${rowIndex}:${cellIndex}`))
|
|
361
|
+
return null;
|
|
362
|
+
const span = spanByOrigin.get(`${rowIndex}:${cellIndex}`);
|
|
363
|
+
return ((0, jsx_runtime_1.jsx)("td", { rowSpan: span?.rowSpan, colSpan: span?.colSpan, className: (0, utils_1.cn)("border border-[rgb(var(--bd-default))] px-2 py-1.5 align-top", span && "text-center", cell.bold && "font-semibold"), style: {
|
|
364
|
+
backgroundColor: cell.bg,
|
|
365
|
+
color: cell.fg,
|
|
366
|
+
}, children: cell.text }, cellIndex));
|
|
367
|
+
}) }, rowIndex))) }) }));
|
|
368
|
+
})()) : ((0, jsx_runtime_1.jsx)("div", { className: "text-center text-[rgb(var(--fg-muted))] py-8", children: "This sheet is empty" })), currentSheet.rows.length > 100 && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center text-[rgb(var(--fg-muted))] text-xs mt-4", children: ["Showing first 100 rows of ", currentSheet.rows.length, " total"] }))] })] }));
|
|
369
|
+
}
|
|
370
|
+
function FileAttachment({ value = [], onChange, maxFiles = 10, maxFileSize = 10 * 1024 * 1024, // 10MB
|
|
371
|
+
acceptedFileTypes = [], label = "File Attachment", className, disabled = false, showInlinePreview = false, previewShape = 'rectangular', previewSize = 'md', hideInstructions = false, hideDropzone = false, onFileClick, selectedFileId, enableEmailImport = false }) {
|
|
372
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
373
|
+
const [previewFile, setPreviewFile] = React.useState(null);
|
|
374
|
+
// Blob URL created for the currently-previewed server file. Revoked when the
|
|
375
|
+
// preview closes or switches to another file so we don't leak it (a PDF/image
|
|
376
|
+
// blob can be several MB, and every preview open created a fresh one).
|
|
377
|
+
const previewBlobUrlRef = React.useRef(null);
|
|
378
|
+
React.useEffect(() => {
|
|
379
|
+
const url = previewFile?.url;
|
|
380
|
+
const isBlob = !!url && url.startsWith('blob:');
|
|
381
|
+
if (isBlob && url !== previewBlobUrlRef.current) {
|
|
382
|
+
if (previewBlobUrlRef.current)
|
|
383
|
+
URL.revokeObjectURL(previewBlobUrlRef.current);
|
|
384
|
+
previewBlobUrlRef.current = url;
|
|
385
|
+
}
|
|
386
|
+
else if (!previewFile && previewBlobUrlRef.current) {
|
|
387
|
+
URL.revokeObjectURL(previewBlobUrlRef.current);
|
|
388
|
+
previewBlobUrlRef.current = null;
|
|
389
|
+
}
|
|
390
|
+
}, [previewFile]);
|
|
391
|
+
React.useEffect(() => () => {
|
|
392
|
+
if (previewBlobUrlRef.current)
|
|
393
|
+
URL.revokeObjectURL(previewBlobUrlRef.current);
|
|
394
|
+
}, []);
|
|
395
|
+
const [imageZoom, setImageZoom] = React.useState(1);
|
|
396
|
+
const [imageRotation, setImageRotation] = React.useState(0);
|
|
397
|
+
const [showCameraModal, setShowCameraModal] = React.useState(false);
|
|
398
|
+
const [cameraStream, setCameraStream] = React.useState(null);
|
|
399
|
+
const [capturedImage, setCapturedImage] = React.useState(null);
|
|
400
|
+
const [showCropModal, setShowCropModal] = React.useState(false);
|
|
401
|
+
const [imageToCrop, setImageToCrop] = React.useState(null);
|
|
402
|
+
const [originalFileInfo, setOriginalFileInfo] = React.useState(null);
|
|
403
|
+
const [crop, setCrop] = React.useState();
|
|
404
|
+
const [completedCrop, setCompletedCrop] = React.useState();
|
|
405
|
+
const cropImageRef = React.useRef(null);
|
|
406
|
+
// Email import state
|
|
407
|
+
const [showEmailImportModal, setShowEmailImportModal] = React.useState(false);
|
|
408
|
+
const [selectedEmail, setSelectedEmail] = React.useState(null);
|
|
409
|
+
const [emailSearchQuery, setEmailSearchQuery] = React.useState('');
|
|
410
|
+
const fileInputRef = React.useRef(null);
|
|
411
|
+
// Get emails from EmailContext
|
|
412
|
+
const { state: emailState, actions: emailActions } = (0, EmailContext_1.useEmail)();
|
|
413
|
+
const imageInputRef = React.useRef(null);
|
|
414
|
+
const videoRef = React.useRef(null);
|
|
415
|
+
const canvasRef = React.useRef(null);
|
|
416
|
+
const handleFileSelect = (files) => {
|
|
417
|
+
if (!files || disabled || files.length === 0)
|
|
418
|
+
return;
|
|
419
|
+
const currentFiles = value || [];
|
|
420
|
+
const filesArray = Array.from(files);
|
|
421
|
+
// Check if we have room for all files
|
|
422
|
+
const availableSlots = maxFiles - currentFiles.length;
|
|
423
|
+
if (availableSlots <= 0) {
|
|
424
|
+
alert(`Maximum ${maxFiles} files allowed`);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// If multiple files selected, skip cropping and add them directly
|
|
428
|
+
if (filesArray.length > 1) {
|
|
429
|
+
const newFiles = [];
|
|
430
|
+
const filesToProcess = filesArray.slice(0, availableSlots);
|
|
431
|
+
for (const file of filesToProcess) {
|
|
432
|
+
// Check file size - 10MB limit for images
|
|
433
|
+
const sizeLimit = file.type.startsWith('image/') ? 10 * 1024 * 1024 : maxFileSize;
|
|
434
|
+
if (file.size > sizeLimit) {
|
|
435
|
+
alert(`File "${file.name}" is too large. Maximum size is ${formatFileSize(sizeLimit)}`);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
// Check file type - also allow .eml and .msg files by extension
|
|
439
|
+
const isAllowedEmailFile = file.name.endsWith('.eml') || file.name.endsWith('.msg');
|
|
440
|
+
if (acceptedFileTypes.length > 0 && !isAllowedEmailFile && !acceptedFileTypes.some(type => file.type.includes(type))) {
|
|
441
|
+
alert(`File type "${file.type}" is not accepted`);
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
const nameError = validateFileName(file.name);
|
|
445
|
+
if (nameError) {
|
|
446
|
+
alert(nameError);
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
newFiles.push({
|
|
450
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
451
|
+
name: file.name,
|
|
452
|
+
size: file.size,
|
|
453
|
+
type: file.type,
|
|
454
|
+
file,
|
|
455
|
+
url: URL.createObjectURL(file)
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (newFiles.length > 0) {
|
|
459
|
+
onChange?.([...currentFiles, ...newFiles]);
|
|
460
|
+
}
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
// Single file - check for cropping
|
|
464
|
+
const file = filesArray[0];
|
|
465
|
+
// Check file size - 10MB limit for images
|
|
466
|
+
const sizeLimit = file.type.startsWith('image/') ? 10 * 1024 * 1024 : maxFileSize;
|
|
467
|
+
if (file.size > sizeLimit) {
|
|
468
|
+
alert(`File "${file.name}" is too large. Maximum size is ${formatFileSize(sizeLimit)}`);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
// Check file type - also allow .eml and .msg files by extension
|
|
472
|
+
const isAllowedEmailFile = file.name.endsWith('.eml') || file.name.endsWith('.msg');
|
|
473
|
+
if (acceptedFileTypes.length > 0 && !isAllowedEmailFile && !acceptedFileTypes.some(type => file.type.includes(type))) {
|
|
474
|
+
alert(`File type "${file.type}" is not accepted`);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const nameError = validateFileName(file.name);
|
|
478
|
+
if (nameError) {
|
|
479
|
+
alert(nameError);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
// For single image, show cropper
|
|
483
|
+
if (file.type.startsWith('image/')) {
|
|
484
|
+
setOriginalFileInfo({ name: file.name, type: file.type });
|
|
485
|
+
const reader = new FileReader();
|
|
486
|
+
reader.onloadend = () => {
|
|
487
|
+
setImageToCrop(reader.result);
|
|
488
|
+
setShowCropModal(true);
|
|
489
|
+
};
|
|
490
|
+
reader.readAsDataURL(file);
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
// Non-image file, add directly
|
|
494
|
+
const attachedFile = {
|
|
495
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
496
|
+
name: file.name,
|
|
497
|
+
size: file.size,
|
|
498
|
+
type: file.type,
|
|
499
|
+
file,
|
|
500
|
+
url: URL.createObjectURL(file)
|
|
501
|
+
};
|
|
502
|
+
onChange?.([...currentFiles, attachedFile]);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
const handleDragOver = (e) => {
|
|
506
|
+
e.preventDefault();
|
|
507
|
+
if (!disabled) {
|
|
508
|
+
setIsDragging(true);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
const handleDragLeave = (e) => {
|
|
512
|
+
e.preventDefault();
|
|
513
|
+
setIsDragging(false);
|
|
514
|
+
};
|
|
515
|
+
const handleDrop = (e) => {
|
|
516
|
+
e.preventDefault();
|
|
517
|
+
setIsDragging(false);
|
|
518
|
+
if (disabled)
|
|
519
|
+
return;
|
|
520
|
+
const files = e.dataTransfer.files;
|
|
521
|
+
handleFileSelect(files);
|
|
522
|
+
};
|
|
523
|
+
// Fetch emails using EmailContext
|
|
524
|
+
const handleOpenEmailModal = () => {
|
|
525
|
+
setShowEmailImportModal(true);
|
|
526
|
+
// Refresh emails if needed
|
|
527
|
+
if (emailState.emails.length === 0 && emailActions?.fetchEmails) {
|
|
528
|
+
emailActions.fetchEmails();
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
// Handle email selection and import
|
|
532
|
+
// State for import loading
|
|
533
|
+
const [importingEmail, setImportingEmail] = React.useState(false);
|
|
534
|
+
const handleEmailImport = async (email) => {
|
|
535
|
+
const currentFiles = value || [];
|
|
536
|
+
setImportingEmail(true);
|
|
537
|
+
try {
|
|
538
|
+
// Download the actual .eml file from the API
|
|
539
|
+
// Pass folder hint for faster fetching (skips searching all folders)
|
|
540
|
+
const folderParam = email.folder ? `&folder=${encodeURIComponent(email.folder)}` : '';
|
|
541
|
+
const response = await fetch(`/api/emails/${email.id}?format=eml${folderParam}`, {
|
|
542
|
+
method: 'GET',
|
|
543
|
+
credentials: 'include'
|
|
544
|
+
});
|
|
545
|
+
if (!response.ok) {
|
|
546
|
+
let errorMsg = `HTTP ${response.status}`;
|
|
547
|
+
try {
|
|
548
|
+
const text = await response.text();
|
|
549
|
+
try {
|
|
550
|
+
const errData = JSON.parse(text);
|
|
551
|
+
errorMsg = errData.error || errorMsg;
|
|
552
|
+
}
|
|
553
|
+
catch {
|
|
554
|
+
errorMsg = text.substring(0, 200) || errorMsg;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
catch { /* couldn't read body */ }
|
|
558
|
+
throw new Error(errorMsg);
|
|
559
|
+
}
|
|
560
|
+
// Get the raw email content
|
|
561
|
+
const emlContent = await response.blob();
|
|
562
|
+
// Create filename from subject
|
|
563
|
+
const safeSubject = email.subject.replace(/[<>:"/\\|?*]/g, '_').substring(0, 50);
|
|
564
|
+
const filename = `${safeSubject}.eml`;
|
|
565
|
+
// Create File object
|
|
566
|
+
const file = new File([emlContent], filename, { type: 'message/rfc822' });
|
|
567
|
+
const attachedFile = {
|
|
568
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
569
|
+
name: filename,
|
|
570
|
+
size: file.size,
|
|
571
|
+
type: 'message/rfc822',
|
|
572
|
+
file,
|
|
573
|
+
url: URL.createObjectURL(emlContent)
|
|
574
|
+
};
|
|
575
|
+
onChange?.([...currentFiles, attachedFile]);
|
|
576
|
+
setShowEmailImportModal(false);
|
|
577
|
+
setSelectedEmail(null);
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
console.error('Failed to import email:', error);
|
|
581
|
+
const msg = error instanceof Error ? error.message : 'Unknown error';
|
|
582
|
+
alert(`Failed to import email: ${msg}`);
|
|
583
|
+
}
|
|
584
|
+
finally {
|
|
585
|
+
setImportingEmail(false);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const removeFile = (fileId) => {
|
|
589
|
+
if (disabled)
|
|
590
|
+
return;
|
|
591
|
+
const updatedFiles = value.filter(file => file.id !== fileId);
|
|
592
|
+
onChange?.(updatedFiles);
|
|
593
|
+
};
|
|
594
|
+
const openFileDialog = () => {
|
|
595
|
+
if (disabled)
|
|
596
|
+
return;
|
|
597
|
+
fileInputRef.current?.click();
|
|
598
|
+
};
|
|
599
|
+
const openImageDialog = () => {
|
|
600
|
+
if (disabled)
|
|
601
|
+
return;
|
|
602
|
+
imageInputRef.current?.click();
|
|
603
|
+
};
|
|
604
|
+
const openCamera = async () => {
|
|
605
|
+
if (disabled)
|
|
606
|
+
return;
|
|
607
|
+
try {
|
|
608
|
+
// Check if mediaDevices is supported
|
|
609
|
+
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
|
610
|
+
alert('Camera access is not supported in this browser. Please use a modern browser like Chrome, Firefox, or Safari.');
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
// Check camera permission status if available
|
|
614
|
+
if (navigator.permissions && navigator.permissions.query) {
|
|
615
|
+
try {
|
|
616
|
+
const permissionStatus = await navigator.permissions.query({ name: 'camera' });
|
|
617
|
+
if (permissionStatus.state === 'denied') {
|
|
618
|
+
alert('Camera access has been blocked.\n\n' +
|
|
619
|
+
'To enable camera access:\n' +
|
|
620
|
+
'1. Click the camera/lock icon in your browser\'s address bar\n' +
|
|
621
|
+
'2. Change camera permission to "Allow"\n' +
|
|
622
|
+
'3. Refresh the page and try again');
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
catch (permError) {
|
|
627
|
+
// Permission API might not support camera, continue anyway
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
let stream = null;
|
|
631
|
+
try {
|
|
632
|
+
// Try with default camera first (more compatible)
|
|
633
|
+
stream = await navigator.mediaDevices.getUserMedia({
|
|
634
|
+
video: {
|
|
635
|
+
width: { ideal: 1920 },
|
|
636
|
+
height: { ideal: 1080 }
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
catch (firstError) {
|
|
641
|
+
// Fallback: Try with minimal constraints
|
|
642
|
+
try {
|
|
643
|
+
stream = await navigator.mediaDevices.getUserMedia({
|
|
644
|
+
video: true
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
catch (secondError) {
|
|
648
|
+
// If both attempts fail, throw the second error
|
|
649
|
+
throw secondError;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (stream) {
|
|
653
|
+
setCameraStream(stream);
|
|
654
|
+
setShowCameraModal(true);
|
|
655
|
+
// Wait for modal to render then set video source
|
|
656
|
+
setTimeout(() => {
|
|
657
|
+
if (videoRef.current) {
|
|
658
|
+
videoRef.current.srcObject = stream;
|
|
659
|
+
videoRef.current.play().catch(() => {
|
|
660
|
+
// Video play error - silently handled
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
}, 100);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
catch (err) {
|
|
667
|
+
// Provide specific error messages based on error type
|
|
668
|
+
let errorMessage = 'Unable to access camera. ';
|
|
669
|
+
if (err.name === 'NotAllowedError' || err.name === 'PermissionDeniedError') {
|
|
670
|
+
errorMessage += 'Camera permission was denied.\n\n';
|
|
671
|
+
errorMessage += 'To fix this:\n';
|
|
672
|
+
errorMessage += '1. Click the camera/lock icon in your browser\'s address bar\n';
|
|
673
|
+
errorMessage += '2. Allow camera access for this site\n';
|
|
674
|
+
errorMessage += '3. Refresh the page and try again\n\n';
|
|
675
|
+
errorMessage += 'Note: Camera access requires HTTPS (secure connection).';
|
|
676
|
+
}
|
|
677
|
+
else if (err.name === 'NotFoundError' || err.name === 'DevicesNotFoundError') {
|
|
678
|
+
errorMessage += 'No camera found on this device.';
|
|
679
|
+
}
|
|
680
|
+
else if (err.name === 'NotReadableError' || err.name === 'TrackStartError') {
|
|
681
|
+
errorMessage += 'Camera is already in use by another application. Please close other apps using the camera and try again.';
|
|
682
|
+
}
|
|
683
|
+
else if (err.name === 'OverconstrainedError') {
|
|
684
|
+
errorMessage += 'Camera does not support the requested settings. Trying with default settings...';
|
|
685
|
+
}
|
|
686
|
+
else if (err.name === 'SecurityError') {
|
|
687
|
+
errorMessage += 'Camera access is blocked due to security restrictions.\n\n';
|
|
688
|
+
errorMessage += 'This usually happens when:\n';
|
|
689
|
+
errorMessage += '- The site is not served over HTTPS\n';
|
|
690
|
+
errorMessage += '- Browser security settings block camera access\n';
|
|
691
|
+
errorMessage += '- You\'re using an incognito/private window';
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
errorMessage += `Error: ${err.message || 'Unknown error'}\n\n`;
|
|
695
|
+
errorMessage += 'Please check your browser permissions and try again.';
|
|
696
|
+
}
|
|
697
|
+
alert(errorMessage);
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
const capturePhoto = () => {
|
|
701
|
+
if (!videoRef.current || !canvasRef.current)
|
|
702
|
+
return;
|
|
703
|
+
const video = videoRef.current;
|
|
704
|
+
const canvas = canvasRef.current;
|
|
705
|
+
const ctx = canvas.getContext('2d');
|
|
706
|
+
canvas.width = video.videoWidth;
|
|
707
|
+
canvas.height = video.videoHeight;
|
|
708
|
+
ctx?.drawImage(video, 0, 0);
|
|
709
|
+
const imageDataUrl = canvas.toDataURL('image/jpeg');
|
|
710
|
+
setCapturedImage(imageDataUrl);
|
|
711
|
+
};
|
|
712
|
+
const retakePhoto = () => {
|
|
713
|
+
setCapturedImage(null);
|
|
714
|
+
};
|
|
715
|
+
const confirmPhoto = () => {
|
|
716
|
+
if (!capturedImage)
|
|
717
|
+
return;
|
|
718
|
+
// Convert data URL to blob
|
|
719
|
+
fetch(capturedImage)
|
|
720
|
+
.then(res => res.blob())
|
|
721
|
+
.then(blob => {
|
|
722
|
+
const fileName = `camera-${Date.now()}.jpg`;
|
|
723
|
+
let file;
|
|
724
|
+
try {
|
|
725
|
+
file = new File([blob], fileName, { type: 'image/jpeg' });
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
// Fallback for older browsers
|
|
729
|
+
const fileBlob = blob;
|
|
730
|
+
fileBlob.name = fileName;
|
|
731
|
+
fileBlob.lastModified = Date.now();
|
|
732
|
+
file = fileBlob;
|
|
733
|
+
}
|
|
734
|
+
const fileList = {
|
|
735
|
+
0: file,
|
|
736
|
+
length: 1,
|
|
737
|
+
item: (index) => index === 0 ? file : null,
|
|
738
|
+
[Symbol.iterator]: function* () {
|
|
739
|
+
yield file;
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
handleFileSelect(fileList);
|
|
743
|
+
closeCameraModal();
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
const closeCameraModal = () => {
|
|
747
|
+
if (cameraStream) {
|
|
748
|
+
cameraStream.getTracks().forEach(track => track.stop());
|
|
749
|
+
setCameraStream(null);
|
|
750
|
+
}
|
|
751
|
+
setCapturedImage(null);
|
|
752
|
+
setShowCameraModal(false);
|
|
753
|
+
};
|
|
754
|
+
const downloadFile = (file) => {
|
|
755
|
+
if (file.url) {
|
|
756
|
+
const link = document.createElement('a');
|
|
757
|
+
link.href = file.url;
|
|
758
|
+
link.download = file.name;
|
|
759
|
+
link.click();
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
const handlePreviewFile = async (file) => {
|
|
763
|
+
// For server URLs (not blob/data URLs and no local file), fetch and create blob
|
|
764
|
+
const isServerUrl = file.url && !file.url.startsWith('blob:') && !file.url.startsWith('data:') && !file.file;
|
|
765
|
+
if (isServerUrl && file.url) {
|
|
766
|
+
try {
|
|
767
|
+
const response = await fetch(file.url);
|
|
768
|
+
const blob = await response.blob();
|
|
769
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
770
|
+
// Create updated file with blob URL and size
|
|
771
|
+
const updatedFile = {
|
|
772
|
+
...file,
|
|
773
|
+
url: blobUrl,
|
|
774
|
+
size: blob.size,
|
|
775
|
+
file: new File([blob], file.name, { type: blob.type || file.type })
|
|
776
|
+
};
|
|
777
|
+
setPreviewFile(updatedFile);
|
|
778
|
+
setImageZoom(1);
|
|
779
|
+
setImageRotation(0);
|
|
780
|
+
}
|
|
781
|
+
catch (error) {
|
|
782
|
+
// If fetch fails, open in new tab as fallback
|
|
783
|
+
window.open(file.url, '_blank');
|
|
784
|
+
}
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
setPreviewFile(file);
|
|
788
|
+
setImageZoom(1);
|
|
789
|
+
setImageRotation(0);
|
|
790
|
+
};
|
|
791
|
+
const hasFile = value.length > 0;
|
|
792
|
+
const singleFile = value.length === 1 ? value[0] : null;
|
|
793
|
+
const isImage = singleFile?.type.startsWith('image/');
|
|
794
|
+
// Preview size classes
|
|
795
|
+
const previewSizeClasses = {
|
|
796
|
+
sm: previewShape === 'circular' ? 'w-24 h-24' : 'w-32 h-20',
|
|
797
|
+
md: previewShape === 'circular' ? 'w-32 h-32' : 'w-48 h-28',
|
|
798
|
+
lg: previewShape === 'circular' ? 'w-40 h-40' : 'w-64 h-36',
|
|
799
|
+
};
|
|
800
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('w-full', className), children: [showInlinePreview && hasFile && singleFile && isImage ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [(0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", multiple: maxFiles > 1, accept: "image/*", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), (0, jsx_runtime_1.jsx)("input", { ref: imageInputRef, type: "file", multiple: maxFiles > 1, accept: "image/*", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), (0, jsx_runtime_1.jsxs)("div", { className: "relative group flex-shrink-0", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)(previewSizeClasses[previewSize], previewShape === 'circular' && 'rounded-full', previewShape === 'rectangular' && 'rounded-lg', 'border-2 border-[rgb(var(--bd-default))] overflow-hidden bg-gray-50 cursor-pointer transition-all hover:shadow-lg relative'), children: singleFile.url ? ((0, jsx_runtime_1.jsx)("img", { src: singleFile.url, alt: singleFile.name, className: (0, utils_1.cn)('w-full h-full object-cover absolute inset-0', previewShape === 'circular' && 'object-center'), onError: () => {
|
|
801
|
+
// Image load error - silently handled
|
|
802
|
+
} })) : ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-xs text-gray-400", children: "No preview" })) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2 cursor-pointer', previewShape === 'circular' && 'rounded-full', previewShape === 'rectangular' && 'rounded-lg'), children: [(0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
803
|
+
e.stopPropagation();
|
|
804
|
+
handlePreviewFile(singleFile);
|
|
805
|
+
}, disabled: disabled, className: "h-8 bg-white/90 hover:bg-white border-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-3 w-3 mr-1" }), "Preview"] }), (0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
806
|
+
e.stopPropagation();
|
|
807
|
+
openFileDialog();
|
|
808
|
+
}, disabled: disabled, className: "h-8 bg-white/90 hover:bg-white border-white", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "h-3 w-3 mr-1" }), "Change"] })] })] }), label && ((0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mt-3 text-center", children: label }))] })) : showInlinePreview ? (
|
|
809
|
+
/* Empty state for inline preview - matches final shape */
|
|
810
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center", children: [(0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", multiple: maxFiles > 1, accept: "image/*", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), (0, jsx_runtime_1.jsx)("input", { ref: imageInputRef, type: "file", multiple: maxFiles > 1, accept: "image/*", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), (0, jsx_runtime_1.jsxs)("div", { className: "relative group", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)(previewSizeClasses[previewSize], previewShape === 'circular' && 'rounded-full', previewShape === 'rectangular' && 'rounded-lg', 'border-2 border-dashed border-[rgb(var(--bd-default))] bg-[rgb(var(--bg-surface))] cursor-pointer transition-all hover:border-gray-400 flex items-center justify-center'), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "h-8 w-8 text-gray-400 group-hover:text-gray-600 transition-colors" }) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('absolute inset-0 bg-white/95 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2', previewShape === 'circular' && 'rounded-full', previewShape === 'rectangular' && 'rounded-lg'), children: [(0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
811
|
+
e.stopPropagation();
|
|
812
|
+
openFileDialog();
|
|
813
|
+
}, disabled: disabled || value.length >= maxFiles, className: "h-8 bg-white border-gray-300 hover:border-gray-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "h-3 w-3 mr-1" }), "Upload"] }), enableEmailImport && ((0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
814
|
+
e.stopPropagation();
|
|
815
|
+
handleOpenEmailModal();
|
|
816
|
+
}, disabled: disabled || value.length >= maxFiles, className: "h-8 bg-white border-gray-300 hover:border-gray-400", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Mail, { className: "h-3 w-3 mr-1" }), "Email"] }))] })] }), label && ((0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mt-3 text-center", children: label }))] })) : (
|
|
817
|
+
/* Regular Upload Area - Non-inline preview mode */
|
|
818
|
+
(0, jsx_runtime_1.jsxs)("div", { children: [label && ((0, jsx_runtime_1.jsx)("label", { className: "block text-xs font-medium text-gray-700 mb-1", children: label })), !hideDropzone && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('group border-2 border-dashed rounded-lg transition-all duration-200 px-3 py-2 h-10', isDragging && !disabled && 'border-blue-400 bg-blue-50', !isDragging && !disabled && 'border-gray-300 hover:border-gray-400', disabled && 'border-gray-200 bg-gray-50 cursor-not-allowed', 'cursor-pointer flex flex-col items-center justify-center relative'), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: openFileDialog, children: [(0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", multiple: true, accept: ".pdf,.xlsx,.xls,.png,.jpg,.jpeg,.gif,.bmp,.webp,.eml,.msg", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), (0, jsx_runtime_1.jsx)("input", { ref: imageInputRef, type: "file", multiple: true, accept: "image/*", onChange: (e) => handleFileSelect(e.target.files), className: "hidden", disabled: disabled }), !hideInstructions && ((0, jsx_runtime_1.jsx)("p", { className: "text-xs text-[rgb(var(--fg-muted))]", children: "Hover to upload or drag and drop (PDF, XLSX, PNG, JPG, EML)" })), (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 bg-white/95 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-3 rounded-lg", children: [(0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
819
|
+
e.stopPropagation();
|
|
820
|
+
openFileDialog();
|
|
821
|
+
}, disabled: disabled || value.length >= maxFiles, className: "h-8 text-xs", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Upload, { className: "h-3 w-3 mr-1" }), "Upload Files"] }), enableEmailImport && ((0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", size: "sm", onClick: (e) => {
|
|
822
|
+
e.stopPropagation();
|
|
823
|
+
handleOpenEmailModal();
|
|
824
|
+
}, disabled: disabled || value.length >= maxFiles, className: "h-8 text-xs", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Mail, { className: "h-3 w-3 mr-1" }), "Import from Email"] }))] })] }))] })), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: value.length > 0 && !(showInlinePreview && singleFile && isImage) && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: { opacity: 0, height: 0 }, animate: { opacity: 1, height: 'auto' }, exit: { opacity: 0, height: 0 }, transition: { duration: 0.3 }, className: "mt-2", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-wrap gap-2", children: value.map((file, index) => {
|
|
825
|
+
const FileIcon = getFileIcon(file.type, file.name);
|
|
826
|
+
const colorClasses = getFileTypeColor(file.type, file.name);
|
|
827
|
+
return ((0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2, delay: index * 0.03 }, className: "relative group", children: [(0, jsx_runtime_1.jsxs)("div", { title: file.name, className: (0, utils_1.cn)('flex flex-col items-center justify-center p-1.5 bg-[rgb(var(--bg-surface))] border rounded hover:shadow-sm transition-all duration-200 cursor-pointer w-14 h-14 relative', onFileClick && selectedFileId === file.id
|
|
828
|
+
? 'border-[rgb(var(--color-primary))] ring-2 ring-[rgb(var(--color-primary))]/40'
|
|
829
|
+
: 'border-[rgb(var(--bd-default))]'), onClick: () => onFileClick ? onFileClick(file) : handlePreviewFile(file), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)('p-1 rounded mb-0.5', colorClasses), children: (0, jsx_runtime_1.jsx)(FileIcon, { className: "h-3.5 w-3.5" }) }), (0, jsx_runtime_1.jsx)("div", { className: "text-[9px] text-[rgb(var(--fg-muted))] truncate w-full text-center leading-tight", children: formatFileSize(file.size) }), (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 bg-black/40 rounded flex items-center justify-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200", children: [(0, jsx_runtime_1.jsx)("button", { className: "p-1 rounded-full bg-white/20 hover:bg-white/40 transition-colors", onClick: (e) => {
|
|
830
|
+
e.stopPropagation();
|
|
831
|
+
handlePreviewFile(file);
|
|
832
|
+
}, title: "Preview", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Eye, { className: "h-3 w-3 text-white" }) }), (0, jsx_runtime_1.jsx)("button", { className: "p-1 rounded-full bg-white/20 hover:bg-white/40 transition-colors", onClick: (e) => {
|
|
833
|
+
e.stopPropagation();
|
|
834
|
+
downloadFile(file);
|
|
835
|
+
}, title: "Download", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { className: "h-3 w-3 text-white" }) })] })] }), (0, jsx_runtime_1.jsx)("button", { className: "absolute -top-1.5 -right-1.5 h-4 w-4 p-0 bg-red-500 hover:bg-red-600 text-white rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center", onClick: (e) => {
|
|
836
|
+
e.stopPropagation();
|
|
837
|
+
removeFile(file.id);
|
|
838
|
+
}, disabled: disabled, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-2.5 w-2.5" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "absolute bottom-full left-0 mb-1 px-2 py-1 bg-gray-900 text-white text-[10px] rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none max-w-[12rem] truncate z-[120]", children: [file.name, (0, jsx_runtime_1.jsx)("div", { className: "absolute top-full left-3 border-4 border-transparent border-t-gray-900" })] })] }, file.id));
|
|
839
|
+
}) }) })) }), typeof document !== 'undefined' && (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: previewFile && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, className: "fixed inset-0 bg-black/95 z-[200] flex flex-col", onClick: () => setPreviewFile(null), children: (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { scale: 0.98, opacity: 0, y: 20 }, animate: { scale: 1, opacity: 1, y: 0 }, exit: { scale: 0.98, opacity: 0, y: 20 }, transition: { duration: 0.25, ease: "easeOut" }, className: "bg-white w-full h-full flex flex-col", onClick: (e) => e.stopPropagation(), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 border-b border-[rgb(var(--bd-default))] bg-[rgb(var(--bg-surface))]", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-3", children: [(() => {
|
|
840
|
+
const FileIconComponent = getFileIcon(previewFile.type, previewFile.name);
|
|
841
|
+
const colorClasses = getFileTypeColor(previewFile.type, previewFile.name);
|
|
842
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)('p-2 rounded-lg', colorClasses), children: (0, jsx_runtime_1.jsx)(FileIconComponent, { className: "h-5 w-5" }) }));
|
|
843
|
+
})(), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "font-semibold text-[rgb(var(--fg-default))]", children: previewFile.name }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-[rgb(var(--fg-muted))]", children: formatFileSize(previewFile.size) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-2", children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "action-download", onClick: () => downloadFile(previewFile), icon: lucide_react_1.Download, children: "Download" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setPreviewFile(null), className: "close-btn-md", "aria-label": "Close preview modal", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex-1 overflow-hidden", (isEmailFile(previewFile.type, previewFile.name) || isExcelFile(previewFile.type, previewFile.name)) ? "min-h-0" : "bg-[rgb(var(--bg-muted))]"), children: previewFile.type.startsWith('image/') && previewFile.url ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full h-full flex items-center justify-center p-4 bg-[rgb(var(--bg-muted))]", children: (0, jsx_runtime_1.jsx)(ImagePreviewContent, { file: previewFile }) })) : previewFile.type === 'application/pdf' && previewFile.url ? (
|
|
844
|
+
/* PDF Preview - Using browser's built-in viewer */
|
|
845
|
+
(0, jsx_runtime_1.jsx)("div", { className: "w-full h-full", children: (0, jsx_runtime_1.jsx)("iframe", { src: previewFile.url, className: "w-full h-full border-0", title: previewFile.name }) })) : previewFile.type.startsWith('text/') && previewFile.url ? ((0, jsx_runtime_1.jsx)("div", { className: "w-full h-full p-4", children: (0, jsx_runtime_1.jsx)("iframe", { src: previewFile.url, className: "w-full h-full rounded-lg border border-[rgb(var(--bd-default))] bg-white", title: previewFile.name }) })) : isEmailFile(previewFile.type, previewFile.name) ? ((0, jsx_runtime_1.jsx)(EmailPreview_1.EmailPreview, { file: previewFile })) : isExcelFile(previewFile.type, previewFile.name) ? ((0, jsx_runtime_1.jsx)(ExcelPreviewContent, { file: previewFile })) : ((0, jsx_runtime_1.jsxs)("div", { className: "w-full h-full flex flex-col items-center justify-center py-12 text-[rgb(var(--fg-muted))]", children: [(() => {
|
|
846
|
+
const FileIconComponent = getFileIcon(previewFile.type, previewFile.name);
|
|
847
|
+
return (0, jsx_runtime_1.jsx)(FileIconComponent, { className: "h-16 w-16 mb-4" });
|
|
848
|
+
})(), (0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-medium mb-2 text-[rgb(var(--fg-default))]", children: "Preview not available" }), (0, jsx_runtime_1.jsxs)("p", { className: "text-sm text-center mb-4", children: ["This file type cannot be previewed directly.", (0, jsx_runtime_1.jsx)("br", {}), "Click download to view the file."] }), (0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "outline", onClick: () => downloadFile(previewFile), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Download, { className: "h-4 w-4 mr-2" }), "Download File"] })] })) })] }) })) }), document.body), (0, jsx_runtime_1.jsx)(Modal_1.Modal, { open: showCropModal && !!imageToCrop, onOpenChange: (open) => {
|
|
849
|
+
if (!open) {
|
|
850
|
+
setShowCropModal(false);
|
|
851
|
+
setImageToCrop(null);
|
|
852
|
+
setOriginalFileInfo(null);
|
|
853
|
+
setCrop(undefined);
|
|
854
|
+
setCompletedCrop(undefined);
|
|
855
|
+
}
|
|
856
|
+
}, children: (0, jsx_runtime_1.jsxs)(Modal_1.ModalContent, { size: "lg", hideCloseButton: true, disableOutsideClick: true, className: "p-0 flex flex-col overflow-hidden max-w-3xl w-[90vw] h-[80vh] max-h-[700px]", children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { className: "px-6 py-4 border-b border-[rgb(var(--bd-default))] flex-shrink-0", children: (0, jsx_runtime_1.jsx)(Modal_1.ModalTitle, { children: "Crop Image" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 flex items-center justify-center bg-[rgb(var(--bg-muted))] overflow-auto p-4", style: { minHeight: 0 }, children: imageToCrop && ((0, jsx_runtime_1.jsx)(react_image_crop_1.default, { crop: crop, onChange: (_, percentCrop) => setCrop(percentCrop), onComplete: (c) => setCompletedCrop(c), aspect: previewShape === 'circular' ? 1 : undefined, circularCrop: previewShape === 'circular', className: "max-h-full", ruleOfThirds: true, children: (0, jsx_runtime_1.jsx)("img", { ref: cropImageRef, src: imageToCrop, alt: "Crop preview", style: { maxHeight: '55vh', maxWidth: '100%' }, onLoad: (e) => {
|
|
857
|
+
const { width, height } = e.currentTarget;
|
|
858
|
+
const initialCrop = centerAspectCrop(width, height, previewShape === 'circular' ? 1 : undefined);
|
|
859
|
+
setCrop(initialCrop);
|
|
860
|
+
} }) })) }), (0, jsx_runtime_1.jsx)(layout_1.Footer, { variant: "modal", gradient: true, actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "action-cancel", onClick: () => {
|
|
861
|
+
setShowCropModal(false);
|
|
862
|
+
setImageToCrop(null);
|
|
863
|
+
setOriginalFileInfo(null);
|
|
864
|
+
setCrop(undefined);
|
|
865
|
+
setCompletedCrop(undefined);
|
|
866
|
+
}, icon: lucide_react_1.XCircle, children: "Cancel" }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "action-save", disabled: !completedCrop, onClick: async () => {
|
|
867
|
+
if (!cropImageRef.current || !completedCrop)
|
|
868
|
+
return;
|
|
869
|
+
// Preserve original file format and build cropped filename
|
|
870
|
+
const origType = originalFileInfo?.type || 'image/jpeg';
|
|
871
|
+
const origName = originalFileInfo?.name || 'image.jpg';
|
|
872
|
+
const lastDot = origName.lastIndexOf('.');
|
|
873
|
+
const baseName = lastDot > 0 ? origName.substring(0, lastDot) : origName;
|
|
874
|
+
const extension = lastDot > 0 ? origName.substring(lastDot) : '.jpg';
|
|
875
|
+
const croppedName = `${baseName}_cropped${extension}`;
|
|
876
|
+
const result = await getCroppedImg(cropImageRef.current, completedCrop, origType);
|
|
877
|
+
if (result) {
|
|
878
|
+
const { blob, url } = result;
|
|
879
|
+
if (blob.size > 10 * 1024 * 1024) {
|
|
880
|
+
alert('Cropped image is too large (max 10MB). Please crop a smaller area.');
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const reader = new FileReader();
|
|
884
|
+
reader.onloadend = () => {
|
|
885
|
+
const attachedFile = {
|
|
886
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
887
|
+
name: croppedName,
|
|
888
|
+
size: blob.size,
|
|
889
|
+
type: origType,
|
|
890
|
+
file: new File([blob], croppedName, { type: origType }),
|
|
891
|
+
url: reader.result
|
|
892
|
+
};
|
|
893
|
+
// Append to existing files instead of replacing
|
|
894
|
+
const currentFiles = value || [];
|
|
895
|
+
onChange?.([...currentFiles, attachedFile]);
|
|
896
|
+
setShowCropModal(false);
|
|
897
|
+
setImageToCrop(null);
|
|
898
|
+
setOriginalFileInfo(null);
|
|
899
|
+
setCrop(undefined);
|
|
900
|
+
setCompletedCrop(undefined);
|
|
901
|
+
};
|
|
902
|
+
reader.readAsDataURL(blob);
|
|
903
|
+
URL.revokeObjectURL(url);
|
|
904
|
+
}
|
|
905
|
+
}, icon: lucide_react_1.Save, children: "Crop & Upload" })] }) })] }) }), (0, jsx_runtime_1.jsx)(Modal_1.Modal, { open: showEmailImportModal, onOpenChange: (open) => {
|
|
906
|
+
if (!open) {
|
|
907
|
+
setShowEmailImportModal(false);
|
|
908
|
+
setSelectedEmail(null);
|
|
909
|
+
setEmailSearchQuery('');
|
|
910
|
+
}
|
|
911
|
+
}, children: (0, jsx_runtime_1.jsxs)(Modal_1.ModalContent, { size: "lg", hideCloseButton: true, disableOutsideClick: true, className: "p-0 flex flex-col overflow-hidden max-w-2xl w-[90vw] h-[75vh] max-h-[650px]", children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalHeader, { className: "px-5 py-3 border-b border-[rgb(var(--bd-default))] flex-shrink-0 bg-[rgb(var(--bg-surface))]", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between w-full gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 flex-shrink-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-9 h-9 rounded-lg bg-[rgba(var(--color-primary),0.1)] flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Mail, { className: "h-4.5 w-4.5 text-[rgb(var(--color-primary))]" }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(Modal_1.ModalTitle, { className: "text-sm", children: "Import from Email" }), emailState.emails.length > 0 && ((0, jsx_runtime_1.jsxs)("p", { className: "text-xs text-[rgb(var(--fg-muted))] mt-0.5", children: [emailState.emails.length, " emails"] }))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0 relative", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-[rgb(var(--fg-muted))]" }), (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "Search by subject, sender, or content...", value: emailSearchQuery, onChange: (e) => setEmailSearchQuery(e.target.value), className: "w-full pl-9 pr-8 py-1.5 rounded-md border border-[rgb(var(--bd-default))] bg-[rgb(var(--bg-default))] text-xs text-[rgb(var(--fg-default))] placeholder:text-[rgb(var(--fg-muted))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--color-primary))] focus:border-transparent" }), emailSearchQuery && ((0, jsx_runtime_1.jsx)("button", { onClick: () => setEmailSearchQuery(''), className: "absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-[rgb(var(--bg-hover))]", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-3.5 w-3.5 text-[rgb(var(--fg-muted))]" }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0", children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => emailActions?.fetchEmails?.(), disabled: emailState.loading, className: "p-1.5 rounded-md hover:bg-[rgb(var(--bg-hover))] text-[rgb(var(--fg-muted))] hover:text-[rgb(var(--fg-default))] transition-colors disabled:opacity-50", "aria-label": "Refresh emails", children: (0, jsx_runtime_1.jsx)(lucide_react_1.RefreshCw, { className: (0, utils_1.cn)("h-4 w-4", emailState.loading && "animate-spin") }) }), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
912
|
+
setShowEmailImportModal(false);
|
|
913
|
+
setSelectedEmail(null);
|
|
914
|
+
setEmailSearchQuery('');
|
|
915
|
+
}, className: "close-btn-md", "aria-label": "Close modal", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-5 w-5" }) })] })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 overflow-auto", style: { minHeight: 0 }, children: emailState.loading && emailState.emails.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center h-full gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-8 h-8 border-2 border-[rgb(var(--color-primary))] border-t-transparent rounded-full animate-spin" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-[rgb(var(--fg-muted))]", children: "Loading emails..." })] })) : emailState.emails.length === 0 ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center h-full gap-3 p-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-16 h-16 rounded-full bg-[rgb(var(--bg-muted))] flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Mail, { className: "h-8 w-8 text-[rgb(var(--fg-muted))]" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-base font-medium text-[rgb(var(--fg-default))] mb-1", children: "No emails found" }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm text-[rgb(var(--fg-muted))]", children: "Check your email configuration in User Master" })] })] })) : ((0, jsx_runtime_1.jsx)("div", { className: "divide-y divide-[rgb(var(--bd-subtle))]", children: emailState.emails
|
|
916
|
+
.filter((email) => {
|
|
917
|
+
if (!emailSearchQuery.trim())
|
|
918
|
+
return true;
|
|
919
|
+
const query = emailSearchQuery.toLowerCase();
|
|
920
|
+
const subject = (email.subject || '').toLowerCase();
|
|
921
|
+
const fromObj = email.from;
|
|
922
|
+
const fromName = (typeof fromObj === 'string' ? fromObj : (fromObj?.name || fromObj?.email || '')).toLowerCase();
|
|
923
|
+
const fromEmailAddr = (typeof fromObj === 'string' ? '' : (fromObj?.email || '')).toLowerCase();
|
|
924
|
+
const body = (email.body || email.snippet || '').toLowerCase();
|
|
925
|
+
return subject.includes(query) || fromName.includes(query) || fromEmailAddr.includes(query) || body.includes(query);
|
|
926
|
+
})
|
|
927
|
+
.map((email) => {
|
|
928
|
+
const fromName = typeof email.from === 'string' ? email.from : email.from?.name || email.from?.email || 'Unknown';
|
|
929
|
+
const fromEmail = typeof email.from === 'string' ? email.from : email.from?.email || '';
|
|
930
|
+
const emailDate = email.receivedAt || email.sentAt;
|
|
931
|
+
const formattedDate = emailDate ? new Date(emailDate).toLocaleDateString('en-US', {
|
|
932
|
+
month: 'short',
|
|
933
|
+
day: 'numeric',
|
|
934
|
+
year: new Date(emailDate).getFullYear() !== new Date().getFullYear() ? 'numeric' : undefined
|
|
935
|
+
}) : '';
|
|
936
|
+
const formattedTime = emailDate ? new Date(emailDate).toLocaleTimeString('en-US', {
|
|
937
|
+
hour: 'numeric',
|
|
938
|
+
minute: '2-digit'
|
|
939
|
+
}) : '';
|
|
940
|
+
const snippet = email.snippet || email.body?.substring(0, 120) || '';
|
|
941
|
+
const isSelected = selectedEmail?.id === email.id;
|
|
942
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: () => setSelectedEmail({
|
|
943
|
+
id: email.id,
|
|
944
|
+
subject: email.subject || '(No Subject)',
|
|
945
|
+
from: fromEmail,
|
|
946
|
+
date: emailDate || new Date().toISOString(),
|
|
947
|
+
body: email.body || email.snippet || '',
|
|
948
|
+
attachments: email.attachments?.map(a => ({ name: a.filename, size: a.size || 0, type: a.contentType || '' })) || [],
|
|
949
|
+
folder: email.folder
|
|
950
|
+
}), className: (0, utils_1.cn)('px-4 py-3 cursor-pointer transition-all', isSelected
|
|
951
|
+
? 'bg-[rgba(var(--color-primary),0.08)] border-l-2 border-l-[rgb(var(--color-primary))]'
|
|
952
|
+
: 'hover:bg-[rgb(var(--bg-hover))] border-l-2 border-l-transparent', !email.isRead && 'bg-[rgb(var(--bg-subtle))]'), children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative flex-shrink-0", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("w-10 h-10 rounded-full flex items-center justify-center text-white text-sm font-medium", isSelected ? "bg-[rgb(var(--color-primary))]" : "bg-[rgb(var(--color-info))]"), children: isSelected ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) })) : (fromName.charAt(0).toUpperCase()) }), !email.isRead && !isSelected && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full bg-[rgb(var(--color-primary))] border-2 border-white" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-2 mb-0.5", children: [(0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("text-sm truncate", !email.isRead ? "font-semibold text-[rgb(var(--fg-default))]" : "font-medium text-[rgb(var(--fg-default))]"), children: fromName }), (0, jsx_runtime_1.jsxs)("span", { className: "text-xs text-[rgb(var(--fg-muted))] flex-shrink-0 whitespace-nowrap", children: [formattedDate, " ", formattedTime] })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("text-sm truncate mb-1", !email.isRead ? "font-medium text-[rgb(var(--fg-default))]" : "text-[rgb(var(--fg-muted))]"), children: email.subject || '(No Subject)' }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[rgb(var(--fg-muted))] truncate flex-1", children: snippet.length > 100 ? snippet.substring(0, 100) + '...' : snippet }), email.attachments && email.attachments.length > 0 && ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center gap-1 text-xs text-[rgb(var(--fg-muted))] flex-shrink-0 bg-[rgb(var(--bg-muted))] px-1.5 py-0.5 rounded", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Paperclip, { className: "h-3 w-3" }), email.attachments.length] }))] })] })] }) }, email.id));
|
|
953
|
+
}) })) }), (0, jsx_runtime_1.jsx)(layout_1.Footer, { variant: "modal", gradient: true, actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "action-cancel", onClick: () => {
|
|
954
|
+
setShowEmailImportModal(false);
|
|
955
|
+
setSelectedEmail(null);
|
|
956
|
+
setEmailSearchQuery('');
|
|
957
|
+
}, icon: lucide_react_1.XCircle, children: "Cancel" }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "action-save", disabled: !selectedEmail || importingEmail, onClick: () => {
|
|
958
|
+
if (selectedEmail) {
|
|
959
|
+
handleEmailImport(selectedEmail);
|
|
960
|
+
}
|
|
961
|
+
}, icon: lucide_react_1.Mail, loading: importingEmail, children: importingEmail ? 'Importing...' : 'Import Email' })] }) })] }) }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: showCameraModal && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2, ease: "easeOut" }, className: "fixed inset-0 bg-black/95 z-50 flex flex-col", onClick: closeCameraModal, children: (0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, { initial: { scale: 0.98, opacity: 0, y: 20 }, animate: { scale: 1, opacity: 1, y: 0 }, exit: { scale: 0.98, opacity: 0, y: 20 }, transition: { duration: 0.25, ease: "easeOut" }, className: "bg-white w-full h-full flex flex-col", onClick: (e) => e.stopPropagation(), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between p-4 border-b", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: capturedImage ? 'Review Photo' : 'Take Photo' }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "ghost", size: "sm", onClick: closeCameraModal, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 flex items-center justify-center p-4 bg-black", children: !capturedImage ? (
|
|
962
|
+
/* Live Camera View */
|
|
963
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "relative w-full max-w-2xl aspect-video bg-gray-900 rounded-lg overflow-hidden", children: [(0, jsx_runtime_1.jsx)("video", { ref: videoRef, className: "w-full h-full object-cover", playsInline: true, muted: true }), (0, jsx_runtime_1.jsx)("canvas", { ref: canvasRef, className: "hidden" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute bottom-4 left-1/2 transform -translate-x-1/2", children: (0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: capturePhoto, className: "w-16 h-16 rounded-full bg-white text-gray-900 hover:bg-gray-100 border-4 border-white", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Camera, { className: "h-6 w-6" }) }) })] })) : (
|
|
964
|
+
/* Captured Image Preview */
|
|
965
|
+
(0, jsx_runtime_1.jsxs)("div", { className: "relative w-full max-w-2xl", children: [(0, jsx_runtime_1.jsx)("img", { src: capturedImage, alt: "Captured", className: "w-full h-auto rounded-lg" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-4 right-4 flex gap-2", children: (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "outline", size: "sm", onClick: retakePhoto, className: "bg-white/90 hover:bg-white", children: "Retake" }) })] })) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center p-4 border-t bg-white", children: capturedImage ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3", children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "outline", onClick: retakePhoto, children: "Retake Photo" }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "primary", onClick: confirmPhoto, children: "Use Photo" })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "text-sm text-gray-500 text-center", children: [(0, jsx_runtime_1.jsx)("p", { children: "Position your camera and tap the capture button" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs mt-1", children: "Make sure the image is clear and well-lit" })] })) })] }) })) })] }));
|
|
966
|
+
}
|