@hub-kit/core 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -0
- package/cli/hub-kit.mjs +112 -0
- package/dist/adapters/bank-reconciliation.d.ts +100 -0
- package/dist/adapters/bank-reconciliation.js +1 -0
- package/dist/adapters/bank-sync-log.d.ts +46 -0
- package/dist/adapters/bank-sync-log.js +1 -0
- package/dist/adapters/category-rules.d.ts +94 -0
- package/dist/adapters/category-rules.js +1 -0
- package/dist/adapters/companies.d.ts +85 -0
- package/dist/adapters/companies.js +3 -0
- package/dist/adapters/customers.d.ts +71 -0
- package/dist/adapters/customers.js +1 -0
- package/dist/adapters/exclusion-rules.d.ts +34 -0
- package/dist/adapters/exclusion-rules.js +15 -0
- package/dist/adapters/file-naming.d.ts +36 -0
- package/dist/adapters/file-naming.js +1 -0
- package/dist/adapters/index.d.ts +24 -0
- package/dist/adapters/index.js +1 -0
- package/dist/adapters/invoice-detail.d.ts +126 -0
- package/dist/adapters/invoice-detail.js +1 -0
- package/dist/adapters/invoice-list.d.ts +63 -0
- package/dist/adapters/invoice-list.js +1 -0
- package/dist/adapters/invoice-upload.d.ts +26 -0
- package/dist/adapters/invoice-upload.js +1 -0
- package/dist/adapters/manual-bookings.d.ts +56 -0
- package/dist/adapters/manual-bookings.js +1 -0
- package/dist/adapters/notifications.d.ts +31 -0
- package/dist/adapters/notifications.js +1 -0
- package/dist/adapters/open-items.d.ts +42 -0
- package/dist/adapters/open-items.js +1 -0
- package/dist/adapters/opos-whitelist.d.ts +38 -0
- package/dist/adapters/opos-whitelist.js +1 -0
- package/dist/adapters/outgoing-invoices.d.ts +32 -0
- package/dist/adapters/outgoing-invoices.js +1 -0
- package/dist/adapters/overview.d.ts +68 -0
- package/dist/adapters/overview.js +1 -0
- package/dist/adapters/processing-log.d.ts +48 -0
- package/dist/adapters/processing-log.js +1 -0
- package/dist/adapters/properties.d.ts +87 -0
- package/dist/adapters/properties.js +1 -0
- package/dist/adapters/supplier-detail.d.ts +64 -0
- package/dist/adapters/supplier-detail.js +1 -0
- package/dist/adapters/supplier-list.d.ts +21 -0
- package/dist/adapters/supplier-list.js +1 -0
- package/dist/adapters/team.d.ts +79 -0
- package/dist/adapters/team.js +1 -0
- package/dist/adapters/trash.d.ts +26 -0
- package/dist/adapters/trash.js +1 -0
- package/dist/adapters/vat-rules.d.ts +83 -0
- package/dist/adapters/vat-rules.js +1 -0
- package/dist/components/access/index.d.ts +3 -0
- package/dist/components/access/index.js +3 -0
- package/dist/components/access/permission-checklist.d.ts +13 -0
- package/dist/components/access/permission-checklist.js +19 -0
- package/dist/components/access/permission-matrix.d.ts +12 -0
- package/dist/components/access/permission-matrix.js +18 -0
- package/dist/components/access/types.d.ts +15 -0
- package/dist/components/access/types.js +1 -0
- package/dist/components/dashboard/date-range-calendar.d.ts +19 -0
- package/dist/components/dashboard/date-range-calendar.js +97 -0
- package/dist/components/dashboard/index.d.ts +23 -0
- package/dist/components/dashboard/index.js +14 -0
- package/dist/components/dashboard/kpi-card.d.ts +13 -0
- package/dist/components/dashboard/kpi-card.js +7 -0
- package/dist/components/dashboard/money-cards-row.d.ts +29 -0
- package/dist/components/dashboard/money-cards-row.js +28 -0
- package/dist/components/dashboard/money-trend-chart.d.ts +13 -0
- package/dist/components/dashboard/money-trend-chart.js +16 -0
- package/dist/components/dashboard/panel.d.ts +9 -0
- package/dist/components/dashboard/panel.js +5 -0
- package/dist/components/dashboard/period-picker.d.ts +25 -0
- package/dist/components/dashboard/period-picker.js +82 -0
- package/dist/components/dashboard/periods.d.ts +13 -0
- package/dist/components/dashboard/periods.js +63 -0
- package/dist/components/dashboard/pipeline-stages-panel.d.ts +14 -0
- package/dist/components/dashboard/pipeline-stages-panel.js +12 -0
- package/dist/components/dashboard/processing-summary-panel.d.ts +34 -0
- package/dist/components/dashboard/processing-summary-panel.js +11 -0
- package/dist/components/dashboard/ranked-bars.d.ts +15 -0
- package/dist/components/dashboard/ranked-bars.js +16 -0
- package/dist/components/dashboard/ranked-list-panel.d.ts +14 -0
- package/dist/components/dashboard/ranked-list-panel.js +9 -0
- package/dist/components/dashboard/stage-tiles.d.ts +15 -0
- package/dist/components/dashboard/stage-tiles.js +6 -0
- package/dist/components/dashboard/stat-rows-panel.d.ts +25 -0
- package/dist/components/dashboard/stat-rows-panel.js +7 -0
- package/dist/components/dashboard/stat-tile.d.ts +20 -0
- package/dist/components/dashboard/stat-tile.js +9 -0
- package/dist/components/feedback/index.d.ts +4 -0
- package/dist/components/feedback/index.js +2 -0
- package/dist/components/feedback/query-states.d.ts +27 -0
- package/dist/components/feedback/query-states.js +38 -0
- package/dist/components/feedback/table-pagination.d.ts +20 -0
- package/dist/components/feedback/table-pagination.js +15 -0
- package/dist/components/invoice-queue/index.d.ts +5 -0
- package/dist/components/invoice-queue/index.js +3 -0
- package/dist/components/invoice-queue/next-action-cell.d.ts +5 -0
- package/dist/components/invoice-queue/next-action-cell.js +9 -0
- package/dist/components/invoice-queue/queue-kpi-card.d.ts +19 -0
- package/dist/components/invoice-queue/queue-kpi-card.js +31 -0
- package/dist/components/invoice-queue/queue-kpi-row.d.ts +22 -0
- package/dist/components/invoice-queue/queue-kpi-row.js +12 -0
- package/dist/components/notifications/alerts.d.ts +25 -0
- package/dist/components/notifications/alerts.js +66 -0
- package/dist/components/notifications/bell.d.ts +14 -0
- package/dist/components/notifications/bell.js +17 -0
- package/dist/components/notifications/highlight.d.ts +4 -0
- package/dist/components/notifications/highlight.js +7 -0
- package/dist/components/notifications/index.d.ts +7 -0
- package/dist/components/notifications/index.js +6 -0
- package/dist/components/notifications/reminder-dialog.d.ts +24 -0
- package/dist/components/notifications/reminder-dialog.js +54 -0
- package/dist/components/notifications/types.d.ts +27 -0
- package/dist/components/notifications/types.js +1 -0
- package/dist/components/notifications/use-notification-acks.d.ts +7 -0
- package/dist/components/notifications/use-notification-acks.js +37 -0
- package/dist/components/shell/breadcrumbs.d.ts +7 -0
- package/dist/components/shell/breadcrumbs.js +38 -0
- package/dist/components/shell/index.d.ts +3 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/components/shell/shell.d.ts +30 -0
- package/dist/components/shell/shell.js +110 -0
- package/dist/components/shell/types.d.ts +23 -0
- package/dist/components/shell/types.js +3 -0
- package/dist/components/tour/find-target.d.ts +1 -0
- package/dist/components/tour/find-target.js +3 -0
- package/dist/components/tour/index.d.ts +14 -0
- package/dist/components/tour/index.js +8 -0
- package/dist/components/tour/labels.d.ts +10 -0
- package/dist/components/tour/labels.js +9 -0
- package/dist/components/tour/seen-store.d.ts +3 -0
- package/dist/components/tour/seen-store.js +34 -0
- package/dist/components/tour/tour-blocks.d.ts +4 -0
- package/dist/components/tour/tour-blocks.js +27 -0
- package/dist/components/tour/tour-button.d.ts +4 -0
- package/dist/components/tour/tour-button.js +12 -0
- package/dist/components/tour/tour-card.d.ts +11 -0
- package/dist/components/tour/tour-card.js +7 -0
- package/dist/components/tour/tour-context.d.ts +16 -0
- package/dist/components/tour/tour-context.js +2 -0
- package/dist/components/tour/tour-overlay.d.ts +1 -0
- package/dist/components/tour/tour-overlay.js +165 -0
- package/dist/components/tour/tour-provider.d.ts +9 -0
- package/dist/components/tour/tour-provider.js +80 -0
- package/dist/components/tour/types.d.ts +44 -0
- package/dist/components/tour/types.js +1 -0
- package/dist/components/tour/use-tour.d.ts +3 -0
- package/dist/components/tour/use-tour.js +9 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/i18n/index.d.ts +15 -0
- package/dist/i18n/index.js +15 -0
- package/dist/lib/bank-import/classify.d.ts +8 -0
- package/dist/lib/bank-import/classify.js +89 -0
- package/dist/lib/bank-import/column-guess.d.ts +2 -0
- package/dist/lib/bank-import/column-guess.js +40 -0
- package/dist/lib/bank-import/csv.d.ts +3 -0
- package/dist/lib/bank-import/csv.js +20 -0
- package/dist/lib/bank-import/duplicates.d.ts +2 -0
- package/dist/lib/bank-import/duplicates.js +21 -0
- package/dist/lib/bank-import/index.d.ts +12 -0
- package/dist/lib/bank-import/index.js +9 -0
- package/dist/lib/bank-import/mapping-storage.d.ts +3 -0
- package/dist/lib/bank-import/mapping-storage.js +29 -0
- package/dist/lib/bank-import/normalize.d.ts +4 -0
- package/dist/lib/bank-import/normalize.js +82 -0
- package/dist/lib/bank-import/parse-file.d.ts +7 -0
- package/dist/lib/bank-import/parse-file.js +23 -0
- package/dist/lib/bank-import/types.d.ts +31 -0
- package/dist/lib/bank-import/types.js +1 -0
- package/dist/lib/bank-import/xlsx.d.ts +2 -0
- package/dist/lib/bank-import/xlsx.js +25 -0
- package/dist/lib/class-names.d.ts +2 -0
- package/dist/lib/class-names.js +5 -0
- package/dist/lib/download.d.ts +2 -0
- package/dist/lib/download.js +14 -0
- package/dist/lib/formatters.d.ts +6 -0
- package/dist/lib/formatters.js +24 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/opos-whitelist/index.d.ts +2 -0
- package/dist/lib/opos-whitelist/index.js +1 -0
- package/dist/lib/opos-whitelist/opos.d.ts +14 -0
- package/dist/lib/opos-whitelist/opos.js +49 -0
- package/dist/lib/query-result.d.ts +12 -0
- package/dist/lib/query-result.js +1 -0
- package/dist/lib/tour-placeholders/index.d.ts +2 -0
- package/dist/lib/tour-placeholders/index.js +1 -0
- package/dist/lib/tour-placeholders/overview.d.ts +12 -0
- package/dist/lib/tour-placeholders/overview.js +139 -0
- package/dist/pages/bank-accounts/BankAccountsPage.d.ts +7 -0
- package/dist/pages/bank-accounts/BankAccountsPage.js +21 -0
- package/dist/pages/bank-accounts/index.d.ts +4 -0
- package/dist/pages/bank-accounts/index.js +2 -0
- package/dist/pages/bank-accounts/labels.d.ts +15 -0
- package/dist/pages/bank-accounts/labels.js +14 -0
- package/dist/pages/bank-import/BankImportWizard.d.ts +9 -0
- package/dist/pages/bank-import/BankImportWizard.js +158 -0
- package/dist/pages/bank-import/index.d.ts +4 -0
- package/dist/pages/bank-import/index.js +2 -0
- package/dist/pages/bank-import/labels.d.ts +44 -0
- package/dist/pages/bank-import/labels.js +43 -0
- package/dist/pages/bank-sync-log/BankSyncLogPage.d.ts +7 -0
- package/dist/pages/bank-sync-log/BankSyncLogPage.js +77 -0
- package/dist/pages/bank-sync-log/index.d.ts +4 -0
- package/dist/pages/bank-sync-log/index.js +2 -0
- package/dist/pages/bank-sync-log/labels.d.ts +21 -0
- package/dist/pages/bank-sync-log/labels.js +20 -0
- package/dist/pages/bank-transactions/BankMatchPanel.d.ts +8 -0
- package/dist/pages/bank-transactions/BankMatchPanel.js +75 -0
- package/dist/pages/bank-transactions/BankTransactionsPage.d.ts +7 -0
- package/dist/pages/bank-transactions/BankTransactionsPage.js +59 -0
- package/dist/pages/bank-transactions/badges.d.ts +8 -0
- package/dist/pages/bank-transactions/badges.js +24 -0
- package/dist/pages/bank-transactions/index.d.ts +6 -0
- package/dist/pages/bank-transactions/index.js +4 -0
- package/dist/pages/bank-transactions/labels.d.ts +41 -0
- package/dist/pages/bank-transactions/labels.js +40 -0
- package/dist/pages/bank-transactions/sort-control.d.ts +17 -0
- package/dist/pages/bank-transactions/sort-control.js +8 -0
- package/dist/pages/bank-transactions/use-table-view.d.ts +23 -0
- package/dist/pages/bank-transactions/use-table-view.js +54 -0
- package/dist/pages/category-rules/CategoryRulesPage.d.ts +7 -0
- package/dist/pages/category-rules/CategoryRulesPage.js +160 -0
- package/dist/pages/category-rules/index.d.ts +4 -0
- package/dist/pages/category-rules/index.js +2 -0
- package/dist/pages/category-rules/labels.d.ts +66 -0
- package/dist/pages/category-rules/labels.js +72 -0
- package/dist/pages/companies/company-detail-page.d.ts +10 -0
- package/dist/pages/companies/company-detail-page.js +184 -0
- package/dist/pages/companies/company-form.d.ts +20 -0
- package/dist/pages/companies/company-form.js +23 -0
- package/dist/pages/companies/company-list-page.d.ts +9 -0
- package/dist/pages/companies/company-list-page.js +109 -0
- package/dist/pages/companies/known-spellings-card.d.ts +8 -0
- package/dist/pages/companies/known-spellings-card.js +65 -0
- package/dist/pages/companies/labels.d.ts +105 -0
- package/dist/pages/companies/labels.js +104 -0
- package/dist/pages/companies/sort-control.d.ts +17 -0
- package/dist/pages/companies/sort-control.js +8 -0
- package/dist/pages/companies/use-infinite-rows.d.ts +6 -0
- package/dist/pages/companies/use-infinite-rows.js +24 -0
- package/dist/pages/companies/use-table-view.d.ts +23 -0
- package/dist/pages/companies/use-table-view.js +56 -0
- package/dist/pages/customers/company-chip.d.ts +6 -0
- package/dist/pages/customers/company-chip.js +9 -0
- package/dist/pages/customers/copy-button.d.ts +6 -0
- package/dist/pages/customers/copy-button.js +31 -0
- package/dist/pages/customers/customer-detail-page.d.ts +10 -0
- package/dist/pages/customers/customer-detail-page.js +83 -0
- package/dist/pages/customers/customer-list-page.d.ts +9 -0
- package/dist/pages/customers/customer-list-page.js +65 -0
- package/dist/pages/customers/edit-customer-dialog.d.ts +9 -0
- package/dist/pages/customers/edit-customer-dialog.js +72 -0
- package/dist/pages/customers/form-hints.d.ts +6 -0
- package/dist/pages/customers/form-hints.js +9 -0
- package/dist/pages/customers/invoice-status-badge.d.ts +10 -0
- package/dist/pages/customers/invoice-status-badge.js +22 -0
- package/dist/pages/customers/labels.d.ts +116 -0
- package/dist/pages/customers/labels.js +117 -0
- package/dist/pages/customers/new-customer-dialog.d.ts +6 -0
- package/dist/pages/customers/new-customer-dialog.js +93 -0
- package/dist/pages/customers/sort-control.d.ts +14 -0
- package/dist/pages/customers/sort-control.js +9 -0
- package/dist/pages/customers/use-table-view.d.ts +23 -0
- package/dist/pages/customers/use-table-view.js +56 -0
- package/dist/pages/exclusion-rules/exclusion-rules-page.d.ts +7 -0
- package/dist/pages/exclusion-rules/exclusion-rules-page.js +114 -0
- package/dist/pages/exclusion-rules/labels.d.ts +53 -0
- package/dist/pages/exclusion-rules/labels.js +61 -0
- package/dist/pages/file-naming/build-filename.d.ts +3 -0
- package/dist/pages/file-naming/build-filename.js +82 -0
- package/dist/pages/file-naming/file-naming-page.d.ts +10 -0
- package/dist/pages/file-naming/file-naming-page.js +120 -0
- package/dist/pages/file-naming/labels.d.ts +44 -0
- package/dist/pages/file-naming/labels.js +44 -0
- package/dist/pages/index.d.ts +63 -0
- package/dist/pages/index.js +48 -0
- package/dist/pages/invoice-detail/InvoiceDetailPage.d.ts +11 -0
- package/dist/pages/invoice-detail/InvoiceDetailPage.js +292 -0
- package/dist/pages/invoice-detail/OutgoingInvoiceFlag.d.ts +26 -0
- package/dist/pages/invoice-detail/OutgoingInvoiceFlag.js +16 -0
- package/dist/pages/invoice-detail/ReviewBadge.d.ts +15 -0
- package/dist/pages/invoice-detail/ReviewBadge.js +23 -0
- package/dist/pages/invoice-detail/ReviewCard.d.ts +17 -0
- package/dist/pages/invoice-detail/ReviewCard.js +12 -0
- package/dist/pages/invoice-detail/SideBySide.d.ts +5 -0
- package/dist/pages/invoice-detail/SideBySide.js +5 -0
- package/dist/pages/invoice-detail/WorkflowHistoryList.d.ts +23 -0
- package/dist/pages/invoice-detail/WorkflowHistoryList.js +32 -0
- package/dist/pages/invoice-detail/WorkflowLadder.d.ts +20 -0
- package/dist/pages/invoice-detail/WorkflowLadder.js +16 -0
- package/dist/pages/invoice-detail/history.d.ts +23 -0
- package/dist/pages/invoice-detail/history.js +76 -0
- package/dist/pages/invoice-detail/index.d.ts +21 -0
- package/dist/pages/invoice-detail/index.js +11 -0
- package/dist/pages/invoice-detail/labels.d.ts +79 -0
- package/dist/pages/invoice-detail/labels.js +139 -0
- package/dist/pages/invoice-detail/pipeline-types.d.ts +58 -0
- package/dist/pages/invoice-detail/pipeline-types.js +1 -0
- package/dist/pages/invoice-detail/review-recheck.d.ts +8 -0
- package/dist/pages/invoice-detail/review-recheck.js +103 -0
- package/dist/pages/invoice-detail/review.d.ts +91 -0
- package/dist/pages/invoice-detail/review.js +310 -0
- package/dist/pages/invoice-list/badges.d.ts +23 -0
- package/dist/pages/invoice-list/badges.js +26 -0
- package/dist/pages/invoice-list/index.d.ts +5 -0
- package/dist/pages/invoice-list/index.js +3 -0
- package/dist/pages/invoice-list/invoice-list-page.d.ts +13 -0
- package/dist/pages/invoice-list/invoice-list-page.js +114 -0
- package/dist/pages/invoice-list/labels.d.ts +36 -0
- package/dist/pages/invoice-list/labels.js +29 -0
- package/dist/pages/invoice-list/sort-control.d.ts +17 -0
- package/dist/pages/invoice-list/sort-control.js +8 -0
- package/dist/pages/invoice-list/use-table-view.d.ts +23 -0
- package/dist/pages/invoice-list/use-table-view.js +54 -0
- package/dist/pages/invoice-upload/InvoiceUploadPage.d.ts +7 -0
- package/dist/pages/invoice-upload/InvoiceUploadPage.js +115 -0
- package/dist/pages/invoice-upload/index.d.ts +4 -0
- package/dist/pages/invoice-upload/index.js +2 -0
- package/dist/pages/invoice-upload/labels.d.ts +29 -0
- package/dist/pages/invoice-upload/labels.js +28 -0
- package/dist/pages/manual-bookings/ManualBookingsPage.d.ts +7 -0
- package/dist/pages/manual-bookings/ManualBookingsPage.js +161 -0
- package/dist/pages/manual-bookings/index.d.ts +4 -0
- package/dist/pages/manual-bookings/index.js +2 -0
- package/dist/pages/manual-bookings/labels.d.ts +53 -0
- package/dist/pages/manual-bookings/labels.js +52 -0
- package/dist/pages/notifications/labels.d.ts +22 -0
- package/dist/pages/notifications/labels.js +21 -0
- package/dist/pages/notifications/notifications-page.d.ts +14 -0
- package/dist/pages/notifications/notifications-page.js +81 -0
- package/dist/pages/open-items/OpenItemsPage.d.ts +11 -0
- package/dist/pages/open-items/OpenItemsPage.js +110 -0
- package/dist/pages/open-items/index.d.ts +6 -0
- package/dist/pages/open-items/index.js +3 -0
- package/dist/pages/open-items/labels.d.ts +37 -0
- package/dist/pages/open-items/labels.js +36 -0
- package/dist/pages/open-items/urgency.d.ts +8 -0
- package/dist/pages/open-items/urgency.js +27 -0
- package/dist/pages/opos-whitelist/OposWhitelistPage.d.ts +7 -0
- package/dist/pages/opos-whitelist/OposWhitelistPage.js +165 -0
- package/dist/pages/opos-whitelist/index.d.ts +4 -0
- package/dist/pages/opos-whitelist/index.js +2 -0
- package/dist/pages/opos-whitelist/labels.d.ts +56 -0
- package/dist/pages/opos-whitelist/labels.js +70 -0
- package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.d.ts +7 -0
- package/dist/pages/outgoing-invoices/OutgoingInvoicesPage.js +169 -0
- package/dist/pages/outgoing-invoices/index.d.ts +4 -0
- package/dist/pages/outgoing-invoices/index.js +2 -0
- package/dist/pages/outgoing-invoices/labels.d.ts +43 -0
- package/dist/pages/outgoing-invoices/labels.js +42 -0
- package/dist/pages/outgoing-invoices/sort-control.d.ts +17 -0
- package/dist/pages/outgoing-invoices/sort-control.js +8 -0
- package/dist/pages/outgoing-invoices/use-table-view.d.ts +23 -0
- package/dist/pages/outgoing-invoices/use-table-view.js +54 -0
- package/dist/pages/overview/labels.d.ts +35 -0
- package/dist/pages/overview/labels.js +34 -0
- package/dist/pages/overview/overview-page.d.ts +22 -0
- package/dist/pages/overview/overview-page.js +127 -0
- package/dist/pages/processing-log/labels.d.ts +54 -0
- package/dist/pages/processing-log/labels.js +53 -0
- package/dist/pages/processing-log/mail-parsing.d.ts +21 -0
- package/dist/pages/processing-log/mail-parsing.js +52 -0
- package/dist/pages/processing-log/processing-log-page.d.ts +9 -0
- package/dist/pages/processing-log/processing-log-page.js +206 -0
- package/dist/pages/properties/badges.d.ts +20 -0
- package/dist/pages/properties/badges.js +45 -0
- package/dist/pages/properties/company-assignment-field.d.ts +11 -0
- package/dist/pages/properties/company-assignment-field.js +13 -0
- package/dist/pages/properties/form-field.d.ts +6 -0
- package/dist/pages/properties/form-field.js +9 -0
- package/dist/pages/properties/labels.d.ts +124 -0
- package/dist/pages/properties/labels.js +128 -0
- package/dist/pages/properties/name-variants-card.d.ts +7 -0
- package/dist/pages/properties/name-variants-card.js +60 -0
- package/dist/pages/properties/property-detail-page.d.ts +10 -0
- package/dist/pages/properties/property-detail-page.js +150 -0
- package/dist/pages/properties/property-list-page.d.ts +13 -0
- package/dist/pages/properties/property-list-page.js +201 -0
- package/dist/pages/properties/sort-control.d.ts +14 -0
- package/dist/pages/properties/sort-control.js +9 -0
- package/dist/pages/properties/use-infinite-rows.d.ts +6 -0
- package/dist/pages/properties/use-infinite-rows.js +26 -0
- package/dist/pages/properties/use-table-view.d.ts +23 -0
- package/dist/pages/properties/use-table-view.js +56 -0
- package/dist/pages/supplier-detail/SupplierDetailPage.d.ts +10 -0
- package/dist/pages/supplier-detail/SupplierDetailPage.js +157 -0
- package/dist/pages/supplier-detail/index.d.ts +4 -0
- package/dist/pages/supplier-detail/index.js +2 -0
- package/dist/pages/supplier-detail/labels.d.ts +46 -0
- package/dist/pages/supplier-detail/labels.js +45 -0
- package/dist/pages/supplier-list/SupplierListPage.d.ts +9 -0
- package/dist/pages/supplier-list/SupplierListPage.js +102 -0
- package/dist/pages/supplier-list/index.d.ts +4 -0
- package/dist/pages/supplier-list/index.js +2 -0
- package/dist/pages/supplier-list/labels.d.ts +33 -0
- package/dist/pages/supplier-list/labels.js +32 -0
- package/dist/pages/supplier-list/sort-control.d.ts +17 -0
- package/dist/pages/supplier-list/sort-control.js +8 -0
- package/dist/pages/supplier-list/use-table-view.d.ts +23 -0
- package/dist/pages/supplier-list/use-table-view.js +54 -0
- package/dist/pages/team/account-dialogs.d.ts +12 -0
- package/dist/pages/team/account-dialogs.js +49 -0
- package/dist/pages/team/employee-editor.d.ts +19 -0
- package/dist/pages/team/employee-editor.js +124 -0
- package/dist/pages/team/labels.d.ts +99 -0
- package/dist/pages/team/labels.js +98 -0
- package/dist/pages/team/new-employee.d.ts +8 -0
- package/dist/pages/team/new-employee.js +103 -0
- package/dist/pages/team/roles-tab.d.ts +6 -0
- package/dist/pages/team/roles-tab.js +46 -0
- package/dist/pages/team/team-page.d.ts +7 -0
- package/dist/pages/team/team-page.js +81 -0
- package/dist/pages/team/temp-password-dialog.d.ts +11 -0
- package/dist/pages/team/temp-password-dialog.js +23 -0
- package/dist/pages/trash/labels.d.ts +68 -0
- package/dist/pages/trash/labels.js +69 -0
- package/dist/pages/trash/trash-page.d.ts +9 -0
- package/dist/pages/trash/trash-page.js +259 -0
- package/dist/pages/vat-rules/labels.d.ts +110 -0
- package/dist/pages/vat-rules/labels.js +109 -0
- package/dist/pages/vat-rules/new-rule-dialog.d.ts +7 -0
- package/dist/pages/vat-rules/new-rule-dialog.js +134 -0
- package/dist/pages/vat-rules/rule-row.d.ts +20 -0
- package/dist/pages/vat-rules/rule-row.js +120 -0
- package/dist/pages/vat-rules/vat-rules-page.d.ts +9 -0
- package/dist/pages/vat-rules/vat-rules-page.js +61 -0
- package/dist/ui/alert-dialog.d.ts +20 -0
- package/dist/ui/alert-dialog.js +41 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/badge.js +20 -0
- package/dist/ui/breadcrumb.d.ts +19 -0
- package/dist/ui/breadcrumb.js +23 -0
- package/dist/ui/button.d.ts +11 -0
- package/dist/ui/button.js +33 -0
- package/dist/ui/calendar.d.ts +8 -0
- package/dist/ui/calendar.js +75 -0
- package/dist/ui/card.d.ts +8 -0
- package/dist/ui/card.js +16 -0
- package/dist/ui/chart.d.ts +62 -0
- package/dist/ui/chart.js +118 -0
- package/dist/ui/checkbox.d.ts +4 -0
- package/dist/ui/checkbox.js +11 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/collapsible.js +5 -0
- package/dist/ui/combobox.d.ts +24 -0
- package/dist/ui/combobox.js +55 -0
- package/dist/ui/command.d.ts +80 -0
- package/dist/ui/command.js +29 -0
- package/dist/ui/dialog.d.ts +19 -0
- package/dist/ui/dialog.js +58 -0
- package/dist/ui/dropdown-menu.d.ts +27 -0
- package/dist/ui/dropdown-menu.js +33 -0
- package/dist/ui/field-context.d.ts +4 -0
- package/dist/ui/field-context.js +6 -0
- package/dist/ui/field.d.ts +3 -0
- package/dist/ui/field.js +8 -0
- package/dist/ui/icon-action.d.ts +3 -0
- package/dist/ui/icon-action.js +8 -0
- package/dist/ui/index.d.ts +32 -0
- package/dist/ui/index.js +32 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +11 -0
- package/dist/ui/label.d.ts +5 -0
- package/dist/ui/label.js +15 -0
- package/dist/ui/multi-combobox.d.ts +18 -0
- package/dist/ui/multi-combobox.js +40 -0
- package/dist/ui/popover.d.ts +9 -0
- package/dist/ui/popover.js +12 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/scroll-area.js +9 -0
- package/dist/ui/scroll-shadow.d.ts +8 -0
- package/dist/ui/scroll-shadow.js +57 -0
- package/dist/ui/select.d.ts +13 -0
- package/dist/ui/select.js +31 -0
- package/dist/ui/separator.d.ts +4 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/sheet.d.ts +25 -0
- package/dist/ui/sheet.js +40 -0
- package/dist/ui/sidebar.d.ts +65 -0
- package/dist/ui/sidebar.js +207 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/sonner.d.ts +5 -0
- package/dist/ui/sonner.js +13 -0
- package/dist/ui/switch.d.ts +4 -0
- package/dist/ui/switch.js +7 -0
- package/dist/ui/table.d.ts +12 -0
- package/dist/ui/table.js +24 -0
- package/dist/ui/tabs.d.ts +7 -0
- package/dist/ui/tabs.js +12 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +11 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +11 -0
- package/package.json +80 -0
- package/themes/TOKENS.md +57 -0
- package/themes/default.css +60 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Plus, Search } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { Button } from "../../ui/button.js";
|
|
6
|
+
import { Input } from "../../ui/input.js";
|
|
7
|
+
import { Label } from "../../ui/label.js";
|
|
8
|
+
import { Skeleton } from "../../ui/skeleton.js";
|
|
9
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../../ui/dialog.js";
|
|
10
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../ui/table.js";
|
|
11
|
+
import { ErrorState, TableSkeleton, readableErrorMessage } from "../../components/feedback/query-states.js";
|
|
12
|
+
import { TablePagination } from "../../components/feedback/table-pagination.js";
|
|
13
|
+
import { cn } from "../../lib/class-names.js";
|
|
14
|
+
import { englishFormatters } from "../../lib/formatters.js";
|
|
15
|
+
import { FieldErrorText, RequiredMark, validateCompanyForm } from "./company-form.js";
|
|
16
|
+
import { SortControl } from "./sort-control.js";
|
|
17
|
+
import { useTableView } from "./use-table-view.js";
|
|
18
|
+
import { englishCompaniesLabels } from "./labels.js";
|
|
19
|
+
const EMPTY_TOTALS = { totalAmount: 0, invoiceCount: 0 };
|
|
20
|
+
export function CompanyListPage({ adapter, labels = englishCompaniesLabels, formatters = englishFormatters, }) {
|
|
21
|
+
const [search, setSearch] = useState("");
|
|
22
|
+
const [showArchived, setShowArchived] = useState(false);
|
|
23
|
+
const companiesQuery = adapter.useCompanies({ includeArchived: showArchived });
|
|
24
|
+
const totalsQuery = adapter.useCompanyInvoiceTotals();
|
|
25
|
+
const companies = useMemo(() => companiesQuery.data ?? [], [companiesQuery.data]);
|
|
26
|
+
// Totals load separately from the list, so a row can render before its numbers are known.
|
|
27
|
+
const totalsReady = totalsQuery.data !== undefined;
|
|
28
|
+
const totals = totalsQuery.data ?? new Map();
|
|
29
|
+
const filteredCompanies = useMemo(() => {
|
|
30
|
+
const term = search.trim().toLowerCase();
|
|
31
|
+
return companies.filter((company) => !term || `${company.code} ${company.name}`.toLowerCase().includes(term));
|
|
32
|
+
}, [companies, search]);
|
|
33
|
+
const view = useTableView(filteredCompanies, {
|
|
34
|
+
initialSort: "updatedAt",
|
|
35
|
+
initialDirection: "desc",
|
|
36
|
+
resetKey: `${search}|${showArchived}`,
|
|
37
|
+
sortValue: (company, key) => {
|
|
38
|
+
const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
|
|
39
|
+
switch (key) {
|
|
40
|
+
case "name":
|
|
41
|
+
return company.name ?? "";
|
|
42
|
+
case "bookedTotal":
|
|
43
|
+
return companyTotals.totalAmount;
|
|
44
|
+
case "createdAt":
|
|
45
|
+
return company.createdAt ?? "";
|
|
46
|
+
case "updatedAt":
|
|
47
|
+
return company.updatedAt ?? company.createdAt ?? "";
|
|
48
|
+
default:
|
|
49
|
+
return company.code ?? "";
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const sortColumns = [
|
|
54
|
+
{ value: "code", label: labels.list.columnCode },
|
|
55
|
+
{ value: "name", label: labels.list.columnName },
|
|
56
|
+
{ value: "bookedTotal", label: labels.list.columnBookedTotal },
|
|
57
|
+
{ value: "createdAt", label: labels.list.columnCreatedAt },
|
|
58
|
+
{ value: "updatedAt", label: labels.list.columnUpdatedAt },
|
|
59
|
+
];
|
|
60
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: labels.list.title }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: labels.list.subtitle })] }), _jsx(NewCompanyDialog, { adapter: adapter, labels: labels })] }), _jsxs("div", { className: "mt-6 flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "relative w-full max-w-sm", children: [_jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { value: search, onChange: (event) => setSearch(event.target.value), placeholder: labels.list.searchPlaceholder, className: "pl-9" })] }), _jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-muted-foreground", children: [_jsx("input", { type: "checkbox", checked: showArchived, onChange: (event) => setShowArchived(event.target.checked), className: "size-4" }), labels.list.showArchived] }), _jsx(SortControl, { columns: sortColumns, sort: view.sort, direction: view.direction, onSort: view.setSort, onDirection: view.setDirection, labels: labels })] }), companiesQuery.isError ? (_jsx("div", { className: "mt-4", children: _jsx(ErrorState, { error: companiesQuery.error, onRetry: () => companiesQuery.refetch() }) })) : companiesQuery.isLoading ? (_jsx("div", { className: "mt-4", children: _jsx(TableSkeleton, { rows: 6, columns: 3 }) })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-4 hidden overflow-hidden rounded-xl border border-border bg-card sm:block", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { className: "bg-muted/40", children: [_jsx(TableHead, { children: labels.list.columnCode }), _jsx(TableHead, { children: labels.list.columnName }), _jsx(TableHead, { className: "text-right", children: labels.list.columnBookedTotal }), _jsx(TableHead, { children: labels.list.columnCreatedAt }), _jsx(TableHead, { children: labels.list.columnUpdatedAt })] }) }), _jsxs(TableBody, { children: [view.pageRows.map((company) => {
|
|
61
|
+
const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
|
|
62
|
+
return (_jsxs(TableRow, { className: cn("cursor-pointer", company.archivedAt && "opacity-60"), onClick: () => adapter.openCompany(company.id), children: [_jsx(TableCell, { className: "font-mono font-medium text-foreground", children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [company.code, company.archivedAt && (_jsx("span", { className: "inline-flex items-center rounded-md bg-muted px-1.5 py-0.5 font-sans text-xs font-medium text-muted-foreground", children: labels.list.archivedBadge }))] }) }), _jsx(TableCell, { className: "text-foreground", children: company.name }), _jsx(TableCell, { className: "text-right tabular-nums", children: totalsReady ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-medium text-foreground", children: formatters.formatMoney(companyTotals.totalAmount) }), _jsx("div", { className: "text-xs text-muted-foreground", children: labels.list.invoiceCount(companyTotals.invoiceCount) })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "ml-auto h-4 w-24" }), _jsx(Skeleton, { className: "ml-auto mt-1.5 h-3 w-16" })] })) }), _jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatters.formatDate(company.createdAt) }), _jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatters.formatDate(company.updatedAt ?? company.createdAt) })] }, company.id));
|
|
63
|
+
}), view.total === 0 && (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 5, className: "py-12 text-center text-muted-foreground", children: labels.list.empty }) }))] })] }) }), _jsx("div", { className: "mt-4 space-y-3 sm:hidden", children: view.total === 0 ? (_jsx("p", { className: "rounded-xl border border-border bg-card px-4 py-12 text-center text-sm text-muted-foreground", children: labels.list.empty })) : (view.pageRows.map((company) => {
|
|
64
|
+
const companyTotals = totals.get(company.id) ?? EMPTY_TOTALS;
|
|
65
|
+
return (_jsxs("div", { className: "cursor-pointer rounded-xl border border-border bg-card p-4", onClick: () => adapter.openCompany(company.id), children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "font-mono font-medium text-foreground", children: company.code }), _jsx("div", { className: "mt-0.5 text-sm text-muted-foreground", children: company.name })] }), _jsx("div", { className: "shrink-0 text-right", children: totalsReady ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-medium tabular-nums text-foreground", children: formatters.formatMoney(companyTotals.totalAmount) }), _jsx("div", { className: "text-xs text-muted-foreground", children: labels.list.invoiceCount(companyTotals.invoiceCount) })] })) : (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "ml-auto h-4 w-24" }), _jsx(Skeleton, { className: "ml-auto mt-1.5 h-3 w-16" })] })) })] }), _jsxs("div", { className: "mt-3 flex items-center justify-between border-t border-border pt-2 text-xs text-muted-foreground", children: [_jsxs("span", { children: [labels.list.columnCreatedAt, ": ", formatters.formatDate(company.createdAt)] }), _jsxs("span", { children: [labels.list.columnUpdatedAt, ":", " ", formatters.formatDate(company.updatedAt ?? company.createdAt)] })] })] }, company.id));
|
|
66
|
+
})) })] })), !companiesQuery.isError && !companiesQuery.isLoading && view.total > 0 && (_jsx(TablePagination, { page: view.page, totalPages: view.totalPages, pageSize: view.pageSize, total: view.total, from: view.from, to: view.to, onPage: view.setPage, onPageSize: view.setPageSize }))] }));
|
|
67
|
+
}
|
|
68
|
+
function NewCompanyDialog({ adapter, labels, }) {
|
|
69
|
+
const [open, setOpen] = useState(false);
|
|
70
|
+
const [code, setCode] = useState("");
|
|
71
|
+
const [name, setName] = useState("");
|
|
72
|
+
const [errors, setErrors] = useState({});
|
|
73
|
+
const [isCreating, setIsCreating] = useState(false);
|
|
74
|
+
// Clear a field's error as soon as it is touched, not only on the next submit.
|
|
75
|
+
const clearError = (field) => setErrors((previous) => (previous[field] ? { ...previous, [field]: "" } : previous));
|
|
76
|
+
async function create() {
|
|
77
|
+
const validated = validateCompanyForm({ code, name }, labels.validation);
|
|
78
|
+
if (Object.keys(validated.errors).length > 0) {
|
|
79
|
+
setErrors(validated.errors);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setErrors({});
|
|
83
|
+
setIsCreating(true);
|
|
84
|
+
try {
|
|
85
|
+
await adapter.createCompany({ code: validated.code, name: validated.name });
|
|
86
|
+
toast.success(labels.list.createdToast);
|
|
87
|
+
setCode("");
|
|
88
|
+
setName("");
|
|
89
|
+
setOpen(false);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
toast.error(labels.list.createFailedToast(readableErrorMessage(error, "")));
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
setIsCreating(false);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: (next) => {
|
|
99
|
+
setOpen(next);
|
|
100
|
+
if (next)
|
|
101
|
+
setErrors({});
|
|
102
|
+
}, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { className: "gap-2", children: [_jsx(Plus, { className: "size-4" }), " ", labels.list.newCompanyButton] }) }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: labels.list.newCompanyTitle }), _jsx(DialogDescription, { children: labels.list.newCompanyDescription })] }), _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.list.codeFieldLabel, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: code, onChange: (event) => {
|
|
103
|
+
setCode(event.target.value);
|
|
104
|
+
clearError("code");
|
|
105
|
+
}, placeholder: labels.list.codeFieldPlaceholder, "aria-invalid": !!errors.code }), _jsx(FieldErrorText, { text: errors.code })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs(Label, { className: "text-xs text-muted-foreground", children: [labels.list.nameFieldLabel, " ", _jsx(RequiredMark, { title: labels.requiredFieldTitle })] }), _jsx(Input, { value: name, onChange: (event) => {
|
|
106
|
+
setName(event.target.value);
|
|
107
|
+
clearError("name");
|
|
108
|
+
}, placeholder: labels.list.nameFieldPlaceholder, "aria-invalid": !!errors.name }), _jsx(FieldErrorText, { text: errors.name })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: labels.list.cancel }), _jsx(Button, { onClick: create, disabled: isCreating, children: isCreating ? labels.list.creating : labels.list.create })] })] })] }));
|
|
109
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CompaniesAdapter } from "../../adapters/companies";
|
|
2
|
+
import type { CompaniesLabels } from "./labels";
|
|
3
|
+
export declare function KnownSpellingsCard({ adapter, companyCode, labels, className, }: {
|
|
4
|
+
adapter: CompaniesAdapter;
|
|
5
|
+
companyCode: string;
|
|
6
|
+
labels: CompaniesLabels["aliases"];
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Plus, X } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../ui/alert-dialog.js";
|
|
6
|
+
import { Button } from "../../ui/button.js";
|
|
7
|
+
import { Input } from "../../ui/input.js";
|
|
8
|
+
import { readableErrorMessage } from "../../components/feedback/query-states.js";
|
|
9
|
+
import { aliasAlreadyExistsError, aliasClaimedByAnotherEntityError, } from "../../adapters/companies.js";
|
|
10
|
+
// The same fold the backend's uniqueness check uses, so both agree on what a duplicate is.
|
|
11
|
+
function foldedSpelling(value) {
|
|
12
|
+
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
13
|
+
}
|
|
14
|
+
export function KnownSpellingsCard({ adapter, companyCode, labels, className, }) {
|
|
15
|
+
const aliasesQuery = adapter.useCompanyAliases(companyCode);
|
|
16
|
+
const [newAlias, setNewAlias] = useState("");
|
|
17
|
+
const [isAdding, setIsAdding] = useState(false);
|
|
18
|
+
const [removingAliasId, setRemovingAliasId] = useState(null);
|
|
19
|
+
const activeAliases = useMemo(() => (aliasesQuery.data ?? []).filter((alias) => alias.isActive), [aliasesQuery.data]);
|
|
20
|
+
async function addAlias() {
|
|
21
|
+
const value = newAlias.trim();
|
|
22
|
+
if (activeAliases.some((alias) => foldedSpelling(alias.alias) === foldedSpelling(value))) {
|
|
23
|
+
toast.error(labels.alreadyExistsToast);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setIsAdding(true);
|
|
27
|
+
try {
|
|
28
|
+
await adapter.addCompanyAlias({ companyCode, alias: value });
|
|
29
|
+
setNewAlias("");
|
|
30
|
+
toast.success(labels.addedToast(value));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const reason = readableErrorMessage(error, "");
|
|
34
|
+
if (reason === aliasClaimedByAnotherEntityError) {
|
|
35
|
+
toast.error(labels.claimedByOtherToast(value));
|
|
36
|
+
}
|
|
37
|
+
else if (reason === aliasAlreadyExistsError) {
|
|
38
|
+
toast.error(labels.alreadyExistsToast);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
toast.error(labels.addFailedToast(reason));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
setIsAdding(false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function removeAlias(alias) {
|
|
49
|
+
setRemovingAliasId(alias.id);
|
|
50
|
+
try {
|
|
51
|
+
await adapter.removeCompanyAlias({ aliasId: alias.id });
|
|
52
|
+
toast.success(labels.removedToast(alias.alias));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
toast.error(labels.addFailedToast(readableErrorMessage(error, "")));
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
setRemovingAliasId(null);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return (_jsxs("section", { className: `rounded-xl border border-border bg-card p-5 ${className ?? ""}`, children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [_jsx("h2", { className: "text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: labels.title }), activeAliases.length > 0 && (_jsx("span", { className: "text-xs tabular-nums text-muted-foreground", children: labels.count(activeAliases.length) }))] }), _jsx("p", { className: "mb-4 text-xs text-muted-foreground", children: labels.hint }), _jsxs("div", { className: "mb-3 flex items-center gap-2", children: [_jsx(Input, { value: newAlias, onChange: (event) => setNewAlias(event.target.value), placeholder: labels.placeholder, className: "text-sm", onKeyDown: (event) => {
|
|
62
|
+
if (event.key === "Enter" && newAlias.trim())
|
|
63
|
+
event.currentTarget.blur();
|
|
64
|
+
} }), _jsxs(Button, { size: "sm", variant: "outline", className: "shrink-0 gap-1.5", disabled: !newAlias.trim() || isAdding, onClick: addAlias, children: [_jsx(Plus, { className: "size-3.5" }), " ", labels.add] })] }), _jsxs("ul", { className: "max-h-[18rem] space-y-1.5 overflow-y-auto pr-1", children: [activeAliases.map((alias) => (_jsxs("li", { className: "flex items-center justify-between gap-2 rounded-md bg-muted/40 px-3 py-2 text-xs", children: [_jsx("span", { className: "min-w-0 truncate text-foreground", children: alias.alias }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx("button", { className: "flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-destructive", "aria-label": labels.remove, children: _jsx(X, { className: "size-3.5" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: labels.confirmTitle }), _jsx(AlertDialogDescription, { children: labels.confirmDescription(alias.alias) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: labels.confirmCancel }), _jsx(AlertDialogAction, { disabled: removingAliasId === alias.id, onClick: () => removeAlias(alias), className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: labels.confirmRemove })] })] })] })] }, alias.id))), activeAliases.length === 0 && (_jsx("li", { className: "rounded-md border border-dashed border-border py-6 text-center text-xs text-muted-foreground", children: labels.empty }))] })] }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export interface CompaniesLabels {
|
|
2
|
+
requiredFieldTitle: string;
|
|
3
|
+
sortLabel: string;
|
|
4
|
+
sortAscending: string;
|
|
5
|
+
sortDescending: string;
|
|
6
|
+
validation: {
|
|
7
|
+
codeRequired: string;
|
|
8
|
+
codeTooLong: string;
|
|
9
|
+
codeInvalidCharacters: string;
|
|
10
|
+
nameRequired: string;
|
|
11
|
+
};
|
|
12
|
+
list: {
|
|
13
|
+
title: string;
|
|
14
|
+
subtitle: string;
|
|
15
|
+
searchPlaceholder: string;
|
|
16
|
+
showArchived: string;
|
|
17
|
+
archivedBadge: string;
|
|
18
|
+
columnCode: string;
|
|
19
|
+
columnName: string;
|
|
20
|
+
columnBookedTotal: string;
|
|
21
|
+
columnCreatedAt: string;
|
|
22
|
+
columnUpdatedAt: string;
|
|
23
|
+
invoiceCount: (count: number) => string;
|
|
24
|
+
empty: string;
|
|
25
|
+
newCompanyButton: string;
|
|
26
|
+
newCompanyTitle: string;
|
|
27
|
+
newCompanyDescription: string;
|
|
28
|
+
codeFieldLabel: string;
|
|
29
|
+
codeFieldPlaceholder: string;
|
|
30
|
+
nameFieldLabel: string;
|
|
31
|
+
nameFieldPlaceholder: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
create: string;
|
|
34
|
+
creating: string;
|
|
35
|
+
createdToast: string;
|
|
36
|
+
createFailedToast: (error: string) => string;
|
|
37
|
+
};
|
|
38
|
+
detail: {
|
|
39
|
+
backToList: string;
|
|
40
|
+
notFoundTitle: string;
|
|
41
|
+
goToList: string;
|
|
42
|
+
edit: string;
|
|
43
|
+
restore: string;
|
|
44
|
+
archive: string;
|
|
45
|
+
archiveDialogTitle: string;
|
|
46
|
+
archiveDialogDescription: string;
|
|
47
|
+
archiveDialogInvoiceNote: (count: number) => string;
|
|
48
|
+
archiveReasonPlaceholder: string;
|
|
49
|
+
archiveCancel: string;
|
|
50
|
+
archiveConfirm: string;
|
|
51
|
+
archivedToast: string;
|
|
52
|
+
archiveFailedToast: (error: string) => string;
|
|
53
|
+
restoredToast: string;
|
|
54
|
+
restoreFailedToast: (error: string) => string;
|
|
55
|
+
archivedBanner: (date: string, reason: string) => string;
|
|
56
|
+
archivedWithoutReason: string;
|
|
57
|
+
masterDataSection: string;
|
|
58
|
+
bookedSection: string;
|
|
59
|
+
codeField: string;
|
|
60
|
+
nameField: string;
|
|
61
|
+
areaField: string;
|
|
62
|
+
areaNone: string;
|
|
63
|
+
areaLabel: (area: string) => string;
|
|
64
|
+
propertiesHeading: string;
|
|
65
|
+
invoiceTotalCaption: (count: number) => string;
|
|
66
|
+
foreignPropertiesWarning: (count: number, totalAmount: string) => string;
|
|
67
|
+
foreignPropertyHint: (propertyCode: string, companyCodes: string) => string;
|
|
68
|
+
columnInvoice: string;
|
|
69
|
+
columnProperty: string;
|
|
70
|
+
columnDate: string;
|
|
71
|
+
columnAmount: string;
|
|
72
|
+
columnStatus: string;
|
|
73
|
+
withoutInvoiceNumber: string;
|
|
74
|
+
invoicesEmpty: string;
|
|
75
|
+
loadMoreRemaining: (count: number) => string;
|
|
76
|
+
invoiceStatusLabel: (status: string) => string;
|
|
77
|
+
editDialogTitle: string;
|
|
78
|
+
editDialogDescription: string;
|
|
79
|
+
cancel: string;
|
|
80
|
+
save: string;
|
|
81
|
+
saving: string;
|
|
82
|
+
savedToast: string;
|
|
83
|
+
noChangesToast: string;
|
|
84
|
+
saveFailedToast: (error: string) => string;
|
|
85
|
+
};
|
|
86
|
+
aliases: {
|
|
87
|
+
title: string;
|
|
88
|
+
count: (count: number) => string;
|
|
89
|
+
hint: string;
|
|
90
|
+
placeholder: string;
|
|
91
|
+
add: string;
|
|
92
|
+
addedToast: (alias: string) => string;
|
|
93
|
+
alreadyExistsToast: string;
|
|
94
|
+
claimedByOtherToast: (alias: string) => string;
|
|
95
|
+
addFailedToast: (error: string) => string;
|
|
96
|
+
removedToast: (alias: string) => string;
|
|
97
|
+
remove: string;
|
|
98
|
+
confirmTitle: string;
|
|
99
|
+
confirmDescription: (alias: string) => string;
|
|
100
|
+
confirmCancel: string;
|
|
101
|
+
confirmRemove: string;
|
|
102
|
+
empty: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export declare const englishCompaniesLabels: CompaniesLabels;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const englishCompaniesLabels = {
|
|
2
|
+
requiredFieldTitle: "Required field",
|
|
3
|
+
sortLabel: "Sort by",
|
|
4
|
+
sortAscending: "Ascending",
|
|
5
|
+
sortDescending: "Descending",
|
|
6
|
+
validation: {
|
|
7
|
+
codeRequired: "Please enter a code.",
|
|
8
|
+
codeTooLong: "The code may be at most 16 characters long.",
|
|
9
|
+
codeInvalidCharacters: "The code may only contain letters and digits.",
|
|
10
|
+
nameRequired: "Please enter a name.",
|
|
11
|
+
},
|
|
12
|
+
list: {
|
|
13
|
+
title: "Companies",
|
|
14
|
+
subtitle: "All companies invoices are booked against.",
|
|
15
|
+
searchPlaceholder: "Search code or name …",
|
|
16
|
+
showArchived: "Show archived",
|
|
17
|
+
archivedBadge: "Archived",
|
|
18
|
+
columnCode: "Code",
|
|
19
|
+
columnName: "Name",
|
|
20
|
+
columnBookedTotal: "Booked",
|
|
21
|
+
columnCreatedAt: "Created",
|
|
22
|
+
columnUpdatedAt: "Updated",
|
|
23
|
+
invoiceCount: (count) => `${count} ${count === 1 ? "invoice" : "invoices"}`,
|
|
24
|
+
empty: "No companies found.",
|
|
25
|
+
newCompanyButton: "New company",
|
|
26
|
+
newCompanyTitle: "Create company",
|
|
27
|
+
newCompanyDescription: "Code and name of the new company.",
|
|
28
|
+
codeFieldLabel: "Code",
|
|
29
|
+
codeFieldPlaceholder: "e.g. ACME",
|
|
30
|
+
nameFieldLabel: "Name",
|
|
31
|
+
nameFieldPlaceholder: "e.g. Acme GmbH",
|
|
32
|
+
cancel: "Cancel",
|
|
33
|
+
create: "Create",
|
|
34
|
+
creating: "Creating …",
|
|
35
|
+
createdToast: "Company created.",
|
|
36
|
+
createFailedToast: (error) => `Creating the company failed: ${error}`,
|
|
37
|
+
},
|
|
38
|
+
detail: {
|
|
39
|
+
backToList: "Back to companies",
|
|
40
|
+
notFoundTitle: "Company not found.",
|
|
41
|
+
goToList: "Go to the company list",
|
|
42
|
+
edit: "Edit",
|
|
43
|
+
restore: "Restore",
|
|
44
|
+
archive: "Archive",
|
|
45
|
+
archiveDialogTitle: "Archive this company?",
|
|
46
|
+
archiveDialogDescription: "The company is hidden from the list but nothing is deleted. It can be restored at any time.",
|
|
47
|
+
archiveDialogInvoiceNote: (count) => `${count} ${count === 1 ? "invoice is" : "invoices are"} booked against it.`,
|
|
48
|
+
archiveReasonPlaceholder: "Reason for archiving …",
|
|
49
|
+
archiveCancel: "Cancel",
|
|
50
|
+
archiveConfirm: "Archive",
|
|
51
|
+
archivedToast: "Company archived.",
|
|
52
|
+
archiveFailedToast: (error) => `Archiving failed: ${error}`,
|
|
53
|
+
restoredToast: "Company restored.",
|
|
54
|
+
restoreFailedToast: (error) => `Restoring failed: ${error}`,
|
|
55
|
+
archivedBanner: (date, reason) => `Archived on ${date} — ${reason}`,
|
|
56
|
+
archivedWithoutReason: "no reason given",
|
|
57
|
+
masterDataSection: "Master data",
|
|
58
|
+
bookedSection: "Booked invoices",
|
|
59
|
+
codeField: "Code",
|
|
60
|
+
nameField: "Name",
|
|
61
|
+
areaField: "Area of responsibility",
|
|
62
|
+
areaNone: "None",
|
|
63
|
+
areaLabel: (area) => area,
|
|
64
|
+
propertiesHeading: "Properties",
|
|
65
|
+
invoiceTotalCaption: (count) => `Total (${count} ${count === 1 ? "invoice" : "invoices"})`,
|
|
66
|
+
foreignPropertiesWarning: (count, totalAmount) => `${count} ${count === 1 ? "invoice is" : "invoices are"} booked against properties that belong to a different company (${totalAmount}).`,
|
|
67
|
+
foreignPropertyHint: (propertyCode, companyCodes) => `Property ${propertyCode} belongs to: ${companyCodes}`,
|
|
68
|
+
columnInvoice: "Invoice",
|
|
69
|
+
columnProperty: "Property",
|
|
70
|
+
columnDate: "Date",
|
|
71
|
+
columnAmount: "Amount",
|
|
72
|
+
columnStatus: "Status",
|
|
73
|
+
withoutInvoiceNumber: "No number",
|
|
74
|
+
invoicesEmpty: "No invoices yet.",
|
|
75
|
+
loadMoreRemaining: (count) => `${count} more — keep scrolling to load`,
|
|
76
|
+
invoiceStatusLabel: (status) => status,
|
|
77
|
+
editDialogTitle: "Edit company",
|
|
78
|
+
editDialogDescription: "Change the code, name or area of this company.",
|
|
79
|
+
cancel: "Cancel",
|
|
80
|
+
save: "Save",
|
|
81
|
+
saving: "Saving …",
|
|
82
|
+
savedToast: "Changes saved.",
|
|
83
|
+
noChangesToast: "Nothing was changed.",
|
|
84
|
+
saveFailedToast: (error) => `Saving failed: ${error}`,
|
|
85
|
+
},
|
|
86
|
+
aliases: {
|
|
87
|
+
title: "Known spellings",
|
|
88
|
+
count: (count) => `${count} ${count === 1 ? "entry" : "entries"}`,
|
|
89
|
+
hint: "Names on documents that should be recognized as this company.",
|
|
90
|
+
placeholder: "Add a spelling …",
|
|
91
|
+
add: "Add",
|
|
92
|
+
addedToast: (alias) => `"${alias}" added.`,
|
|
93
|
+
alreadyExistsToast: "This spelling already exists.",
|
|
94
|
+
claimedByOtherToast: (alias) => `"${alias}" is already used by another entry.`,
|
|
95
|
+
addFailedToast: (error) => `Adding the spelling failed: ${error}`,
|
|
96
|
+
removedToast: (alias) => `"${alias}" removed.`,
|
|
97
|
+
remove: "Remove spelling",
|
|
98
|
+
confirmTitle: "Remove this spelling?",
|
|
99
|
+
confirmDescription: (alias) => `"${alias}" will no longer be matched to this company.`,
|
|
100
|
+
confirmCancel: "Cancel",
|
|
101
|
+
confirmRemove: "Remove",
|
|
102
|
+
empty: "No spellings recorded yet.",
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SortDirection } from "./use-table-view";
|
|
2
|
+
export interface SortColumn {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function SortControl({ columns, sort, direction, onSort, onDirection, labels, }: {
|
|
7
|
+
columns: SortColumn[];
|
|
8
|
+
sort: string;
|
|
9
|
+
direction: SortDirection;
|
|
10
|
+
onSort: (key: string) => void;
|
|
11
|
+
onDirection: (direction: SortDirection) => void;
|
|
12
|
+
labels: {
|
|
13
|
+
sortLabel: string;
|
|
14
|
+
sortAscending: string;
|
|
15
|
+
sortDescending: string;
|
|
16
|
+
};
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox } from "../../ui/combobox.js";
|
|
3
|
+
export function SortControl({ columns, sort, direction, onSort, onDirection, labels, }) {
|
|
4
|
+
return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [_jsx("span", { className: "hidden shrink-0 text-sm text-muted-foreground sm:inline", children: labels.sortLabel }), _jsx(Combobox, { value: sort, onValueChange: onSort, className: "w-full sm:w-48", options: columns }), _jsx(Combobox, { value: direction, onValueChange: (value) => onDirection(value), className: "w-full sm:w-40", options: [
|
|
5
|
+
{ value: "asc", label: labels.sortAscending },
|
|
6
|
+
{ value: "desc", label: labels.sortDescending },
|
|
7
|
+
] })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
// Reveals a long list one page at a time as the reader scrolls; windows rendering, not fetching.
|
|
3
|
+
export function useInfiniteRows(rows, pageSize = 25) {
|
|
4
|
+
const [visibleCount, setVisibleCount] = useState(pageSize);
|
|
5
|
+
const observerRef = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setVisibleCount(pageSize);
|
|
8
|
+
}, [rows, pageSize]);
|
|
9
|
+
const hasMore = visibleCount < rows.length;
|
|
10
|
+
// Callback ref because the sentinel row mounts and unmounts as the list grows.
|
|
11
|
+
const sentinelRef = useCallback((node) => {
|
|
12
|
+
observerRef.current?.disconnect();
|
|
13
|
+
if (!node || !hasMore)
|
|
14
|
+
return;
|
|
15
|
+
observerRef.current = new IntersectionObserver((entries) => {
|
|
16
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
17
|
+
setVisibleCount((count) => Math.min(count + pageSize, rows.length));
|
|
18
|
+
}
|
|
19
|
+
}, { rootMargin: "120px" });
|
|
20
|
+
observerRef.current.observe(node);
|
|
21
|
+
}, [hasMore, pageSize, rows.length]);
|
|
22
|
+
useEffect(() => () => observerRef.current?.disconnect(), []);
|
|
23
|
+
return { visible: rows.slice(0, visibleCount), hasMore, sentinelRef, total: rows.length };
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SortDirection = "asc" | "desc";
|
|
2
|
+
export interface TableView<Row> {
|
|
3
|
+
pageRows: Row[];
|
|
4
|
+
sort: string;
|
|
5
|
+
direction: SortDirection;
|
|
6
|
+
setSort: (key: string) => void;
|
|
7
|
+
setDirection: (direction: SortDirection) => void;
|
|
8
|
+
page: number;
|
|
9
|
+
setPage: (page: number) => void;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
setPageSize: (size: number) => void;
|
|
12
|
+
total: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function useTableView<Row>(rows: Row[], options: {
|
|
18
|
+
sortValue: (row: Row, key: string) => string | number;
|
|
19
|
+
initialSort: string;
|
|
20
|
+
initialDirection?: SortDirection;
|
|
21
|
+
initialPageSize?: number;
|
|
22
|
+
resetKey?: string;
|
|
23
|
+
}): TableView<Row>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
// Client-side sort and pagination for small lists; resetKey returns to page 1 when it changes.
|
|
3
|
+
export function useTableView(rows, options) {
|
|
4
|
+
const { sortValue, initialSort, initialDirection = "asc", initialPageSize = 25, resetKey, } = options;
|
|
5
|
+
const [sort, setSortState] = useState(initialSort);
|
|
6
|
+
const [direction, setDirectionState] = useState(initialDirection);
|
|
7
|
+
const [page, setPage] = useState(1);
|
|
8
|
+
const [pageSize, setPageSize] = useState(initialPageSize);
|
|
9
|
+
// Adjust state during render so a filter change lands on page 1 without an extra paint.
|
|
10
|
+
const [seenResetKey, setSeenResetKey] = useState(resetKey);
|
|
11
|
+
if (resetKey !== seenResetKey) {
|
|
12
|
+
setSeenResetKey(resetKey);
|
|
13
|
+
setPage(1);
|
|
14
|
+
}
|
|
15
|
+
const sortedRows = useMemo(() => {
|
|
16
|
+
const copy = [...rows];
|
|
17
|
+
copy.sort((first, second) => {
|
|
18
|
+
const firstValue = sortValue(first, sort);
|
|
19
|
+
const secondValue = sortValue(second, sort);
|
|
20
|
+
const comparison = typeof firstValue === "number" && typeof secondValue === "number"
|
|
21
|
+
? firstValue - secondValue
|
|
22
|
+
: String(firstValue).localeCompare(String(secondValue));
|
|
23
|
+
return direction === "asc" ? comparison : -comparison;
|
|
24
|
+
});
|
|
25
|
+
return copy;
|
|
26
|
+
}, [rows, sort, direction, sortValue]);
|
|
27
|
+
const total = sortedRows.length;
|
|
28
|
+
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
29
|
+
const safePage = Math.min(page, totalPages);
|
|
30
|
+
const from = total === 0 ? 0 : (safePage - 1) * pageSize + 1;
|
|
31
|
+
const to = Math.min(safePage * pageSize, total);
|
|
32
|
+
const pageRows = sortedRows.slice((safePage - 1) * pageSize, safePage * pageSize);
|
|
33
|
+
function setSort(key) {
|
|
34
|
+
setSortState(key);
|
|
35
|
+
setPage(1);
|
|
36
|
+
}
|
|
37
|
+
function setDirection(next) {
|
|
38
|
+
setDirectionState(next);
|
|
39
|
+
setPage(1);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
pageRows,
|
|
43
|
+
sort,
|
|
44
|
+
direction,
|
|
45
|
+
setSort,
|
|
46
|
+
setDirection,
|
|
47
|
+
page: safePage,
|
|
48
|
+
setPage,
|
|
49
|
+
pageSize,
|
|
50
|
+
setPageSize,
|
|
51
|
+
total,
|
|
52
|
+
totalPages,
|
|
53
|
+
from,
|
|
54
|
+
to,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/class-names.js";
|
|
3
|
+
// Company code chip; a missing company renders as a warning because invoices need one.
|
|
4
|
+
export function CompanyChip({ code, labels, className, }) {
|
|
5
|
+
if (!code) {
|
|
6
|
+
return (_jsx("span", { className: cn("inline-flex items-center whitespace-nowrap rounded-md bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning", className), title: labels.missingTitle, children: labels.missing }));
|
|
7
|
+
}
|
|
8
|
+
return (_jsx("span", { className: cn("inline-flex items-center rounded-md bg-brand-tint px-2 py-0.5 font-mono text-xs font-medium text-brand-dark", className), children: code }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Check, Copy } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { IconAction } from "../../ui/icon-action.js";
|
|
6
|
+
async function writeClipboard(text) {
|
|
7
|
+
try {
|
|
8
|
+
if (typeof navigator !== "undefined" && navigator.clipboard) {
|
|
9
|
+
await navigator.clipboard.writeText(text);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
export function CopyButton({ value, fieldLabel, labels, }) {
|
|
19
|
+
const [copied, setCopied] = useState(false);
|
|
20
|
+
async function copyValue() {
|
|
21
|
+
if (await writeClipboard(value)) {
|
|
22
|
+
setCopied(true);
|
|
23
|
+
toast.success(labels.copied(fieldLabel));
|
|
24
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
toast.error(labels.failed);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return (_jsx(IconAction, { label: labels.action(fieldLabel), className: "size-7 shrink-0", onClick: copyValue, children: copied ? _jsx(Check, { className: "size-3.5 text-brand" }) : _jsx(Copy, { className: "size-3.5" }) }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Formatters } from "../../lib/formatters";
|
|
2
|
+
import type { CustomersAdapter } from "../../adapters/customers";
|
|
3
|
+
import { type CustomersLabels } from "./labels";
|
|
4
|
+
export interface CustomerDetailPageProps {
|
|
5
|
+
adapter: CustomersAdapter;
|
|
6
|
+
customerId: string;
|
|
7
|
+
labels?: CustomersLabels;
|
|
8
|
+
formatters?: Formatters;
|
|
9
|
+
}
|
|
10
|
+
export declare function CustomerDetailPage({ adapter, customerId, labels, formatters, }: CustomerDetailPageProps): import("react").JSX.Element;
|