@spaceinvoices/react-ui 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/LICENSE +21 -0
- package/README.md +340 -0
- package/cli/dist/index.js +922 -0
- package/package.json +87 -0
- package/registry.json +600 -0
- package/spaceinvoices.schema.json +47 -0
- package/src/app.tsx +25 -0
- package/src/common/autocomplete.tsx +135 -0
- package/src/components/activities/activity-timeline.tsx +160 -0
- package/src/components/activities/index.ts +1 -0
- package/src/components/activities/locales/de.ts +30 -0
- package/src/components/activities/locales/sl.ts +30 -0
- package/src/components/advance-invoices/advance-invoices.hooks.ts +75 -0
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +702 -0
- package/src/components/advance-invoices/create/locales/de.ts +29 -0
- package/src/components/advance-invoices/create/locales/sl.ts +25 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +74 -0
- package/src/components/advance-invoices/index.ts +5 -0
- package/src/components/advance-invoices/list/index.ts +3 -0
- package/src/components/advance-invoices/list/list-row-actions.tsx +119 -0
- package/src/components/advance-invoices/list/list-table.tsx +178 -0
- package/src/components/advance-invoices/list/locales/de.ts +32 -0
- package/src/components/advance-invoices/list/locales/sl.ts +32 -0
- package/src/components/advance-invoices/list/use-advance-invoice-download.ts +63 -0
- package/src/components/button-loader.tsx +11 -0
- package/src/components/combobox.tsx +96 -0
- package/src/components/company-registry/company-registry-autocomplete.tsx +151 -0
- package/src/components/company-registry/company-registry.hooks.ts +67 -0
- package/src/components/company-registry/index.ts +7 -0
- package/src/components/credit-notes/create/create-credit-note-form.tsx +332 -0
- package/src/components/credit-notes/create/index.ts +1 -0
- package/src/components/credit-notes/create/locales/de.ts +69 -0
- package/src/components/credit-notes/create/locales/sl.ts +67 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +22 -0
- package/src/components/credit-notes/index.ts +10 -0
- package/src/components/credit-notes/list/index.ts +3 -0
- package/src/components/credit-notes/list/list-row-actions.tsx +116 -0
- package/src/components/credit-notes/list/list-table.tsx +183 -0
- package/src/components/credit-notes/list/locales/de.ts +33 -0
- package/src/components/credit-notes/list/locales/sl.ts +33 -0
- package/src/components/credit-notes/list/use-credit-note-download.ts +65 -0
- package/src/components/customers/create-customer-form/create-customer-form.tsx +134 -0
- package/src/components/customers/create-customer-form/locales/de.ts +20 -0
- package/src/components/customers/create-customer-form/locales/sl.ts +20 -0
- package/src/components/customers/customer-autocomplete.tsx +173 -0
- package/src/components/customers/customer-combobox.tsx +130 -0
- package/src/components/customers/customer-list-table/customer-list-row-actions.tsx +48 -0
- package/src/components/customers/customer-list-table/customer-list-table.tsx +124 -0
- package/src/components/customers/customer-list-table/index.ts +2 -0
- package/src/components/customers/customer-list-table/locales/de.ts +16 -0
- package/src/components/customers/customer-list-table/locales/sl.ts +16 -0
- package/src/components/customers/customers.hooks.test.ts +348 -0
- package/src/components/customers/customers.hooks.ts +57 -0
- package/src/components/customers/index.ts +5 -0
- package/src/components/dashboard/chart-empty-state.tsx +29 -0
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +80 -0
- package/src/components/dashboard/collection-rate-card/index.ts +4 -0
- package/src/components/dashboard/collection-rate-card/locales/sl.ts +3 -0
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +74 -0
- package/src/components/dashboard/index.ts +54 -0
- package/src/components/dashboard/invoice-status-chart/index.ts +4 -0
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +130 -0
- package/src/components/dashboard/invoice-status-chart/locales/sl.ts +9 -0
- package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +105 -0
- package/src/components/dashboard/loading-card.tsx +19 -0
- package/src/components/dashboard/payment-methods-chart/index.ts +4 -0
- package/src/components/dashboard/payment-methods-chart/locales/sl.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +152 -0
- package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +50 -0
- package/src/components/dashboard/payment-trend-chart/index.ts +4 -0
- package/src/components/dashboard/payment-trend-chart/locales/sl.ts +5 -0
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +137 -0
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +92 -0
- package/src/components/dashboard/revenue-card.tsx +49 -0
- package/src/components/dashboard/revenue-trend-chart/index.ts +4 -0
- package/src/components/dashboard/revenue-trend-chart/locales/sl.ts +5 -0
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +137 -0
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +93 -0
- package/src/components/dashboard/shared/index.ts +5 -0
- package/src/components/dashboard/shared/use-revenue-data.ts +160 -0
- package/src/components/dashboard/shared/use-stats-counts.ts +89 -0
- package/src/components/dashboard/shared/use-stats-query.ts +38 -0
- package/src/components/dashboard/stat-card.tsx +41 -0
- package/src/components/dashboard/tax-collected-card/index.ts +2 -0
- package/src/components/dashboard/tax-collected-card/tax-collected-card.tsx +77 -0
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +145 -0
- package/src/components/dashboard/top-customers-chart/index.ts +4 -0
- package/src/components/dashboard/top-customers-chart/locales/sl.ts +5 -0
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +130 -0
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +72 -0
- package/src/components/documents/create/document-add-item-form.tsx +379 -0
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +120 -0
- package/src/components/documents/create/document-details-section.tsx +597 -0
- package/src/components/documents/create/document-items-section.tsx +133 -0
- package/src/components/documents/create/document-recipient-section.tsx +101 -0
- package/src/components/documents/create/form-types.ts +36 -0
- package/src/components/documents/create/index.ts +9 -0
- package/src/components/documents/create/live-preview.tsx +235 -0
- package/src/components/documents/create/mark-as-paid-section.tsx +82 -0
- package/src/components/documents/create/prepare-document-submission.test.ts +132 -0
- package/src/components/documents/create/prepare-document-submission.ts +187 -0
- package/src/components/documents/create/prepare-preview-data.test.ts +155 -0
- package/src/components/documents/create/prepare-preview-data.ts +16 -0
- package/src/components/documents/create/smart-code-insert-button.tsx +139 -0
- package/src/components/documents/create/use-document-customer-form.ts +161 -0
- package/src/components/documents/document-preview.tsx +13 -0
- package/src/components/documents/documents.hooks.ts +146 -0
- package/src/components/documents/index.ts +23 -0
- package/src/components/documents/shared/document-preview-display.tsx +172 -0
- package/src/components/documents/shared/index.ts +3 -0
- package/src/components/documents/shared/scaled-document-preview.tsx +70 -0
- package/src/components/documents/shared/use-a4-scaling.ts +62 -0
- package/src/components/documents/types.ts +61 -0
- package/src/components/documents/view/document-actions-bar.tsx +328 -0
- package/src/components/documents/view/document-details-card.tsx +179 -0
- package/src/components/documents/view/document-payments-list.tsx +256 -0
- package/src/components/documents/view/index.ts +4 -0
- package/src/components/documents/view/locales/de.ts +85 -0
- package/src/components/documents/view/locales/sl.ts +84 -0
- package/src/components/documents/view/use-document-download.ts +125 -0
- package/src/components/entities/create-entity-form.tsx +105 -0
- package/src/components/entities/entities.hooks.ts +50 -0
- package/src/components/entities/entity-settings-form/email-template-variables-info.tsx +103 -0
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +1326 -0
- package/src/components/entities/entity-settings-form/image-upload-with-crop.tsx +222 -0
- package/src/components/entities/entity-settings-form/index.ts +2 -0
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +190 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +192 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +188 -0
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +410 -0
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +320 -0
- package/src/components/entities/furs-settings-form/index.ts +3 -0
- package/src/components/entities/furs-settings-form/locales/de.ts +233 -0
- package/src/components/entities/furs-settings-form/locales/en.ts +194 -0
- package/src/components/entities/furs-settings-form/locales/sl.ts +196 -0
- package/src/components/entities/furs-settings-form/sections/certificate-settings-section.tsx +242 -0
- package/src/components/entities/furs-settings-form/sections/enable-fiscalization-section.tsx +139 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +252 -0
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +370 -0
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +420 -0
- package/src/components/entities/keys.ts +2 -0
- package/src/components/entities/settings/branding-settings-form.tsx +274 -0
- package/src/components/entities/settings/company-settings-form.tsx +256 -0
- package/src/components/entities/settings/defaults-settings-form.tsx +501 -0
- package/src/components/entities/settings/email-settings-form.tsx +288 -0
- package/src/components/entities/settings/eslog-settings-form.tsx +113 -0
- package/src/components/entities/settings/index.ts +8 -0
- package/src/components/entities/settings/number-format-settings-form.tsx +244 -0
- package/src/components/entities/settings/pdf-template-selector/demo-invoice-data.ts +164 -0
- package/src/components/entities/settings/pdf-template-selector/index.ts +2 -0
- package/src/components/entities/settings/pdf-template-selector/locales/de.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/locales/sl.ts +18 -0
- package/src/components/entities/settings/pdf-template-selector/pdf-template-cards.tsx +49 -0
- package/src/components/entities/settings/settings-footer.tsx +16 -0
- package/src/components/entities/settings/tax-rules-settings-form.tsx +346 -0
- package/src/components/estimates/create/create-estimate-form.tsx +384 -0
- package/src/components/estimates/create/locales/de.ts +64 -0
- package/src/components/estimates/create/locales/sl.ts +63 -0
- package/src/components/estimates/create/prepare-estimate-submission.ts +39 -0
- package/src/components/estimates/create/use-estimate-customer-form.ts +5 -0
- package/src/components/estimates/estimates.hooks.ts +15 -0
- package/src/components/estimates/index.ts +6 -0
- package/src/components/estimates/list/index.ts +3 -0
- package/src/components/estimates/list/list-row-actions.tsx +103 -0
- package/src/components/estimates/list/list-table.tsx +171 -0
- package/src/components/estimates/list/locales/de.ts +26 -0
- package/src/components/estimates/list/locales/sl.ts +26 -0
- package/src/components/estimates/list/use-estimate-download.ts +63 -0
- package/src/components/export/document-export-form.tsx +288 -0
- package/src/components/export/index.ts +2 -0
- package/src/components/form/form-input.tsx +89 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/invoices/create/create-invoice-form.tsx +852 -0
- package/src/components/invoices/create/eslog-validation.test.ts +242 -0
- package/src/components/invoices/create/eslog-validation.ts +208 -0
- package/src/components/invoices/create/locales/de.ts +118 -0
- package/src/components/invoices/create/locales/sl.ts +114 -0
- package/src/components/invoices/create/prepare-invoice-submission.test.ts +777 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +79 -0
- package/src/components/invoices/create/use-invoice-customer-form.ts +5 -0
- package/src/components/invoices/index.ts +9 -0
- package/src/components/invoices/invoices-furs.hooks.ts +28 -0
- package/src/components/invoices/invoices.hooks.ts +110 -0
- package/src/components/invoices/list/index.ts +3 -0
- package/src/components/invoices/list/list-row-actions.tsx +132 -0
- package/src/components/invoices/list/list-table.tsx +165 -0
- package/src/components/invoices/list/locales/de.ts +33 -0
- package/src/components/invoices/list/locales/sl.ts +33 -0
- package/src/components/invoices/list/use-invoice-download.ts +62 -0
- package/src/components/invoices/send-email-dialog/index.ts +1 -0
- package/src/components/invoices/send-email-dialog/locales/de.ts +18 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +17 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +289 -0
- package/src/components/invoices/send-email-dialog.tsx +2 -0
- package/src/components/invoices/shared/index.ts +2 -0
- package/src/components/invoices/shared/scaled-document-preview.tsx +32 -0
- package/src/components/invoices/shared/use-a4-scaling.tsx +39 -0
- package/src/components/invoices/view/eslog-info-display.tsx +160 -0
- package/src/components/invoices/view/furs-info-display.tsx +213 -0
- package/src/components/items/create-item-form/create-item-form.tsx +155 -0
- package/src/components/items/create-item-form/locales/de.ts +14 -0
- package/src/components/items/create-item-form/locales/en.ts +9 -0
- package/src/components/items/create-item-form/locales/sl.ts +14 -0
- package/src/components/items/item-combobox.tsx +147 -0
- package/src/components/items/item-list-table/item-list-header.tsx +33 -0
- package/src/components/items/item-list-table/item-list-row-actions.tsx +48 -0
- package/src/components/items/item-list-table/item-list-row.tsx +32 -0
- package/src/components/items/item-list-table/item-list-table.tsx +76 -0
- package/src/components/items/item-list-table/locales/de.ts +10 -0
- package/src/components/items/item-list-table/locales/en.ts +10 -0
- package/src/components/items/item-list-table/locales/sl.ts +10 -0
- package/src/components/items/items.hooks.ts +63 -0
- package/src/components/loading-spinner.tsx +24 -0
- package/src/components/payments/create-payment-form/create-payment-form.tsx +222 -0
- package/src/components/payments/create-payment-form/locales/de.ts +20 -0
- package/src/components/payments/create-payment-form/locales/sl.ts +20 -0
- package/src/components/payments/edit-payment-form/edit-payment-form.tsx +230 -0
- package/src/components/payments/edit-payment-form/index.ts +1 -0
- package/src/components/payments/edit-payment-form/locales/de.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/sl.ts +20 -0
- package/src/components/payments/index.ts +4 -0
- package/src/components/payments/list/index.ts +2 -0
- package/src/components/payments/list/list-row-actions.tsx +98 -0
- package/src/components/payments/list/list-table.tsx +186 -0
- package/src/components/payments/list/locales/de.ts +19 -0
- package/src/components/payments/list/locales/sl.ts +19 -0
- package/src/components/payments/payments.hooks.ts +15 -0
- package/src/components/request-logs/index.ts +3 -0
- package/src/components/request-logs/request-log-detail.tsx +242 -0
- package/src/components/request-logs/request-log-list-table.tsx +266 -0
- package/src/components/request-logs/request-logs-page.tsx +10 -0
- package/src/components/table/README.md +410 -0
- package/src/components/table/data-table.tsx +251 -0
- package/src/components/table/date-cell.tsx +35 -0
- package/src/components/table/filter-bar.tsx +114 -0
- package/src/components/table/filter-panel.tsx +407 -0
- package/src/components/table/hooks/use-table-fetch.ts +17 -0
- package/src/components/table/hooks/use-table-query.ts +36 -0
- package/src/components/table/hooks/use-table-state.ts +293 -0
- package/src/components/table/index.ts +35 -0
- package/src/components/table/search-input.tsx +85 -0
- package/src/components/table/sortable-header.tsx +56 -0
- package/src/components/table/table-empty-state.tsx +40 -0
- package/src/components/table/table-no-results.tsx +41 -0
- package/src/components/table/table-pagination.tsx +42 -0
- package/src/components/table/table-skeleton.tsx +54 -0
- package/src/components/table/types.ts +136 -0
- package/src/components/tax-reports/index.ts +1 -0
- package/src/components/tax-reports/kir-export-form.tsx +172 -0
- package/src/components/taxes/create-tax-form/create-tax-form.tsx +112 -0
- package/src/components/taxes/create-tax-form/locales/de.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/en.ts +7 -0
- package/src/components/taxes/create-tax-form/locales/sl.ts +8 -0
- package/src/components/taxes/tax-list-table/locales/de.ts +11 -0
- package/src/components/taxes/tax-list-table/locales/en.ts +10 -0
- package/src/components/taxes/tax-list-table/locales/sl.ts +11 -0
- package/src/components/taxes/tax-list-table/tax-list-header.tsx +29 -0
- package/src/components/taxes/tax-list-table/tax-list-row-actions.tsx +43 -0
- package/src/components/taxes/tax-list-table/tax-list-row.tsx +46 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +59 -0
- package/src/components/taxes/taxes.hooks.ts +35 -0
- package/src/components/ui/alert-dialog.tsx +61 -0
- package/src/components/ui/alert.tsx +72 -0
- package/src/components/ui/badge.tsx +48 -0
- package/src/components/ui/breadcrumb.tsx +132 -0
- package/src/components/ui/button.tsx +61 -0
- package/src/components/ui/calendar.tsx +213 -0
- package/src/components/ui/card.tsx +94 -0
- package/src/components/ui/chart.tsx +380 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +56 -0
- package/src/components/ui/command.tsx +187 -0
- package/src/components/ui/dialog.tsx +187 -0
- package/src/components/ui/drawer.tsx +123 -0
- package/src/components/ui/dropdown-menu.tsx +291 -0
- package/src/components/ui/form.tsx +166 -0
- package/src/components/ui/input-group.tsx +149 -0
- package/src/components/ui/input.tsx +20 -0
- package/src/components/ui/label.tsx +18 -0
- package/src/components/ui/loading-spinner.tsx +16 -0
- package/src/components/ui/popover.tsx +108 -0
- package/src/components/ui/radio-group.tsx +37 -0
- package/src/components/ui/select.tsx +200 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +145 -0
- package/src/components/ui/sidebar.tsx +771 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +60 -0
- package/src/components/ui/spinner.tsx +10 -0
- package/src/components/ui/sticky-form-footer.tsx +55 -0
- package/src/components/ui/switch.tsx +30 -0
- package/src/components/ui/table.tsx +101 -0
- package/src/components/ui/tabs.tsx +80 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/tooltip.tsx +89 -0
- package/src/components/wl-subscription/index.ts +2 -0
- package/src/components/wl-subscription/locked-feature.tsx +173 -0
- package/src/components/wl-subscription/upgrade-modal.tsx +209 -0
- package/src/frontend.tsx +28 -0
- package/src/generate-schemas.ts +265 -0
- package/src/generated/schemas/advanceinvoice.ts +177 -0
- package/src/generated/schemas/creditnote.ts +187 -0
- package/src/generated/schemas/customer.ts +29 -0
- package/src/generated/schemas/entity.ts +252 -0
- package/src/generated/schemas/estimate.ts +159 -0
- package/src/generated/schemas/furssettings.ts +25 -0
- package/src/generated/schemas/index.ts +24 -0
- package/src/generated/schemas/invoice.ts +167 -0
- package/src/generated/schemas/item.ts +38 -0
- package/src/generated/schemas/payment.ts +44 -0
- package/src/generated/schemas/previewadvanceinvoice_body.ts +354 -0
- package/src/generated/schemas/previewestimate_body.ts +309 -0
- package/src/generated/schemas/registerfursmovablepremise_body.ts +22 -0
- package/src/generated/schemas/registerfursrealestatepremise_body.ts +32 -0
- package/src/generated/schemas/renderdocument_body.ts +594 -0
- package/src/generated/schemas/sendemail_body.ts +26 -0
- package/src/generated/schemas/startpdfexport_body.ts +20 -0
- package/src/generated/schemas/tax.ts +48 -0
- package/src/generated/schemas/uploadfile_body.ts +23 -0
- package/src/generated/schemas/uploadfurscertificate_body.ts +20 -0
- package/src/generated/schemas/userfurssettings.ts +19 -0
- package/src/hooks/create-resource-hooks.test.ts +483 -0
- package/src/hooks/create-resource-hooks.ts +300 -0
- package/src/hooks/use-debounce.ts +12 -0
- package/src/hooks/use-duplicate-document.ts +185 -0
- package/src/hooks/use-media-query.tsx +19 -0
- package/src/hooks/use-mobile.ts +39 -0
- package/src/hooks/use-next-document-number.ts +57 -0
- package/src/hooks/use-resource-mutation.ts +118 -0
- package/src/hooks/use-vies-check.ts +130 -0
- package/src/index.css +11 -0
- package/src/index.html +13 -0
- package/src/index.tsx +12 -0
- package/src/lib/auth.ts +4 -0
- package/src/lib/browser-cookies.ts +70 -0
- package/src/lib/constants.ts +287 -0
- package/src/lib/cookies.ts +36 -0
- package/src/lib/schemas/advance-invoice.ts +43 -0
- package/src/lib/schemas/credit-note.ts +32 -0
- package/src/lib/schemas/estimate.ts +31 -0
- package/src/lib/schemas/index.ts +18 -0
- package/src/lib/schemas/invoice.ts +43 -0
- package/src/lib/schemas/shared.ts +79 -0
- package/src/lib/translation.ts +38 -0
- package/src/lib/utils.ts +6 -0
- package/src/providers/entities-context.tsx +41 -0
- package/src/providers/entities-provider.tsx +201 -0
- package/src/providers/form-footer-context.tsx +72 -0
- package/src/providers/sdk-provider.tsx +164 -0
- package/src/providers/white-label-provider.tsx +91 -0
- package/src/providers/wl-subscription-provider.tsx +277 -0
- package/src/utils/string-helpers.ts +111 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Space Invoices
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# @spaceinvoices/react-ui - Space Invoices Component Library
|
|
2
|
+
|
|
3
|
+
> **Pre-built React components for the Space Invoices API**
|
|
4
|
+
|
|
5
|
+
70+ components for building invoicing applications with the Space Invoices API. Includes forms, tables, dashboard charts, and more - all designed to be copied into your project for full customization.
|
|
6
|
+
|
|
7
|
+
## Philosophy
|
|
8
|
+
|
|
9
|
+
These components are **designed to be copied**, not installed as a package:
|
|
10
|
+
|
|
11
|
+
- **Full ownership** - Modify freely without breaking changes
|
|
12
|
+
- **Complete customization** - Change behavior and structure
|
|
13
|
+
- **No version conflicts** - You control when to update
|
|
14
|
+
- **Zero lock-in** - Components work standalone in your codebase
|
|
15
|
+
|
|
16
|
+
**Note**: Components are built on **shadcn/ui primitives**. Bring your own shadcn/ui components or use any alternative. The `components/ui/` folder is included as reference only.
|
|
17
|
+
|
|
18
|
+
## Quick Start (CLI - Recommended)
|
|
19
|
+
|
|
20
|
+
The easiest way to get started is using the CLI:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Initialize in your project
|
|
24
|
+
npx @spaceinvoices/react-ui init
|
|
25
|
+
|
|
26
|
+
# Add components as needed
|
|
27
|
+
npx @spaceinvoices/react-ui add customers/create-customer-form
|
|
28
|
+
npx @spaceinvoices/react-ui add invoices/create-invoice-form
|
|
29
|
+
npx @spaceinvoices/react-ui add table/data-table
|
|
30
|
+
|
|
31
|
+
# See all available components
|
|
32
|
+
npx @spaceinvoices/react-ui list
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The CLI will:
|
|
36
|
+
- Create `spaceinvoices.json` config with your preferred paths
|
|
37
|
+
- Install required dependencies (`@spaceinvoices/js-sdk`, `@tanstack/react-query`)
|
|
38
|
+
- Copy essential files (SDK provider, utilities)
|
|
39
|
+
- Transform import paths to match your project structure
|
|
40
|
+
- Install npm dependencies for each component
|
|
41
|
+
|
|
42
|
+
### CLI Commands
|
|
43
|
+
|
|
44
|
+
| Command | Description |
|
|
45
|
+
|---------|-------------|
|
|
46
|
+
| `init` | Initialize Space Invoices UI in your project |
|
|
47
|
+
| `add <component...>` | Add one or more components |
|
|
48
|
+
| `add --all` | Add all available components |
|
|
49
|
+
| `list` | List all available components |
|
|
50
|
+
|
|
51
|
+
### CLI Options
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Skip prompts and use defaults
|
|
55
|
+
npx @spaceinvoices/react-ui init --yes
|
|
56
|
+
|
|
57
|
+
# Overwrite existing files
|
|
58
|
+
npx @spaceinvoices/react-ui add customers --overwrite
|
|
59
|
+
|
|
60
|
+
# Specify working directory
|
|
61
|
+
npx @spaceinvoices/react-ui add invoices --cwd ./my-app
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Manual Setup (Alternative)
|
|
65
|
+
|
|
66
|
+
If you prefer manual control:
|
|
67
|
+
|
|
68
|
+
### 1. Install Dependencies
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Core requirements
|
|
72
|
+
npm install @spaceinvoices/js-sdk @tanstack/react-query
|
|
73
|
+
|
|
74
|
+
# For forms
|
|
75
|
+
npm install react-hook-form @hookform/resolvers zod
|
|
76
|
+
|
|
77
|
+
# UI components (choose one):
|
|
78
|
+
# Option A: Use shadcn/ui (recommended)
|
|
79
|
+
npx shadcn@latest init
|
|
80
|
+
|
|
81
|
+
# Option B: Use your existing component library
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2. Clone This Repository
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git clone https://github.com/space-invoices/react-ui.git
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Copy What You Need
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Required: Core utilities and providers
|
|
94
|
+
cp -r react-ui/src/lib/ your-project/src/lib/
|
|
95
|
+
cp -r react-ui/src/providers/ your-project/src/providers/
|
|
96
|
+
cp -r react-ui/src/hooks/ your-project/src/hooks/
|
|
97
|
+
|
|
98
|
+
# Copy the components you need
|
|
99
|
+
cp -r react-ui/src/components/invoices/ your-project/src/components/space-invoices/
|
|
100
|
+
cp -r react-ui/src/components/customers/ your-project/src/components/space-invoices/
|
|
101
|
+
cp -r react-ui/src/components/table/ your-project/src/components/space-invoices/
|
|
102
|
+
# ... add more as needed
|
|
103
|
+
|
|
104
|
+
# DON'T copy components/ui/ - use shadcn/ui instead
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 4. Update Import Paths
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Replace @/ui/ imports with your path alias
|
|
111
|
+
find your-project/src/components/space-invoices -type f -name "*.tsx" \
|
|
112
|
+
-exec sed -i '' 's/@\/ui\//@\//g' {} +
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. Setup Providers
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
// app.tsx
|
|
119
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
120
|
+
import { SDKProvider } from "./providers/sdk-provider";
|
|
121
|
+
import { EntitiesProvider } from "./providers/entities-provider";
|
|
122
|
+
|
|
123
|
+
const queryClient = new QueryClient();
|
|
124
|
+
|
|
125
|
+
export function App() {
|
|
126
|
+
return (
|
|
127
|
+
<QueryClientProvider client={queryClient}>
|
|
128
|
+
<SDKProvider
|
|
129
|
+
apiUrl="https://eu.spaceinvoices.com"
|
|
130
|
+
getAccessToken={() => localStorage.getItem("si_token")}
|
|
131
|
+
>
|
|
132
|
+
<EntitiesProvider>
|
|
133
|
+
{/* Your app */}
|
|
134
|
+
</EntitiesProvider>
|
|
135
|
+
</SDKProvider>
|
|
136
|
+
</QueryClientProvider>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## What's Included
|
|
142
|
+
|
|
143
|
+
### Business Components (Copy These)
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
src/components/
|
|
147
|
+
├── invoices/ # Create, list, view invoices
|
|
148
|
+
├── customers/ # Customer management
|
|
149
|
+
├── items/ # Products/services catalog
|
|
150
|
+
├── payments/ # Payment tracking
|
|
151
|
+
├── taxes/ # Tax rate management
|
|
152
|
+
├── estimates/ # Quotes and estimates
|
|
153
|
+
├── credit-notes/ # Credit note handling
|
|
154
|
+
├── advance-invoices/ # Advance invoice handling
|
|
155
|
+
├── dashboard/ # Analytics charts
|
|
156
|
+
├── entities/ # Company/organization settings
|
|
157
|
+
├── documents/ # Shared document components
|
|
158
|
+
└── table/ # Generic data table infrastructure
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### UI Primitives (Reference Only)
|
|
162
|
+
|
|
163
|
+
The `components/ui/` folder contains shadcn/ui-style components. **Don't copy these** - use shadcn/ui directly:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npx shadcn@latest add button input form table dialog select
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Or use your own component library and update imports in the copied components.
|
|
170
|
+
|
|
171
|
+
### Required Utilities
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
src/
|
|
175
|
+
├── providers/
|
|
176
|
+
│ ├── sdk-provider.tsx # SDK context (required)
|
|
177
|
+
│ └── entities-provider.tsx # Active entity context (required)
|
|
178
|
+
├── hooks/
|
|
179
|
+
│ └── *.ts # Shared hooks
|
|
180
|
+
└── lib/
|
|
181
|
+
├── utils.ts # cn() utility
|
|
182
|
+
└── translation.ts # i18n helper
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Usage Examples
|
|
186
|
+
|
|
187
|
+
### Customer List
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import { CustomerListTable } from "@/components/space-invoices/customers/customer-list-table";
|
|
191
|
+
import { useEntities } from "@/providers/entities-provider";
|
|
192
|
+
|
|
193
|
+
export function CustomersPage() {
|
|
194
|
+
const { activeEntity } = useEntities();
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<CustomerListTable
|
|
198
|
+
entityId={activeEntity.id}
|
|
199
|
+
onRowClick={(customer) => console.log("Selected:", customer)}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Create Invoice Form
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { CreateInvoiceForm } from "@/components/space-invoices/invoices/create";
|
|
209
|
+
import { useEntities } from "@/providers/entities-provider";
|
|
210
|
+
|
|
211
|
+
export function NewInvoicePage() {
|
|
212
|
+
const { activeEntity } = useEntities();
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<CreateInvoiceForm
|
|
216
|
+
entityId={activeEntity.id}
|
|
217
|
+
onSuccess={(invoice) => {
|
|
218
|
+
console.log("Created invoice:", invoice.number);
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Dashboard Charts
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { RevenueTrendChart } from "@/components/space-invoices/dashboard/revenue-trend-chart";
|
|
229
|
+
import { InvoiceStatusChart } from "@/components/space-invoices/dashboard/invoice-status-chart";
|
|
230
|
+
|
|
231
|
+
export function DashboardPage() {
|
|
232
|
+
return (
|
|
233
|
+
<div className="grid grid-cols-2 gap-4">
|
|
234
|
+
<RevenueTrendChart entityId={activeEntity.id} />
|
|
235
|
+
<InvoiceStatusChart entityId={activeEntity.id} />
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Customization
|
|
242
|
+
|
|
243
|
+
Since you own the code, customize freely:
|
|
244
|
+
|
|
245
|
+
### Modify Styles
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
// In your copied component
|
|
249
|
+
<FormItem className="bg-gray-50 p-4 rounded-lg">
|
|
250
|
+
<FormLabel className="text-blue-600 font-semibold">Customer Name</FormLabel>
|
|
251
|
+
...
|
|
252
|
+
</FormItem>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Add Fields
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
// Extend the schema
|
|
259
|
+
const createCustomerSchema = z.object({
|
|
260
|
+
name: z.string().min(1),
|
|
261
|
+
customField: z.string().optional(), // Your addition
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Add to the form
|
|
265
|
+
<FormField name="customField" ... />
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Add Translations
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
// components/space-invoices/customers/locales/fr.ts
|
|
272
|
+
export default {
|
|
273
|
+
"customer.name": "Nom du client",
|
|
274
|
+
"customer.email": "Adresse e-mail",
|
|
275
|
+
};
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Architecture
|
|
279
|
+
|
|
280
|
+
### SDK Integration
|
|
281
|
+
|
|
282
|
+
Components use TanStack Query hooks wrapping the SDK:
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
// customers.hooks.ts
|
|
286
|
+
export function useCreateCustomer() {
|
|
287
|
+
const { sdk } = useSDK();
|
|
288
|
+
return useMutation({
|
|
289
|
+
mutationFn: (data) => sdk.customers.createCustomer({ data }),
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Type Safety
|
|
295
|
+
|
|
296
|
+
All types come from `@spaceinvoices/js-sdk`:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
import type { Customer, Invoice } from "@spaceinvoices/js-sdk";
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Dependencies
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"dependencies": {
|
|
307
|
+
"@spaceinvoices/js-sdk": "^2.0.0",
|
|
308
|
+
"@tanstack/react-query": "^5.0.0",
|
|
309
|
+
"react": "^19.0.0",
|
|
310
|
+
"react-hook-form": "^7.0.0",
|
|
311
|
+
"@hookform/resolvers": "^5.0.0",
|
|
312
|
+
"zod": "^3.0.0"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Documentation
|
|
318
|
+
|
|
319
|
+
- **[CONVENTIONS.md](./CONVENTIONS.md)** - Component patterns and architecture
|
|
320
|
+
- **[registry.json](./registry.json)** - Component registry with dependencies
|
|
321
|
+
- **[Space Invoices API Docs](https://docs.spaceinvoices.com)**
|
|
322
|
+
- **[shadcn/ui](https://ui.shadcn.com)**
|
|
323
|
+
|
|
324
|
+
## FAQ
|
|
325
|
+
|
|
326
|
+
**Q: Why copy-paste instead of npm install?**
|
|
327
|
+
A: Full ownership. Modify components freely without version conflicts or breaking changes.
|
|
328
|
+
|
|
329
|
+
**Q: Can I use Material UI / Chakra / other libraries?**
|
|
330
|
+
A: Yes. Update the imports in copied components to use your UI library instead of shadcn/ui.
|
|
331
|
+
|
|
332
|
+
**Q: Do I need the Space Invoices API?**
|
|
333
|
+
A: Yes. These components are built specifically for Space Invoices and won't work with other APIs.
|
|
334
|
+
|
|
335
|
+
**Q: How do I get updates?**
|
|
336
|
+
A: Check this repo for changes and manually merge what you need into your customized versions.
|
|
337
|
+
|
|
338
|
+
## License
|
|
339
|
+
|
|
340
|
+
MIT License - see [LICENSE](./LICENSE)
|