@vamos-ui/react 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/blocks/block-heading.d.ts +29 -0
- package/dist/blocks/block-heading.js +39 -0
- package/dist/blocks/block-image.d.ts +52 -0
- package/dist/blocks/block-image.js +48 -0
- package/dist/blocks/block-link.d.ts +30 -0
- package/dist/blocks/block-link.js +36 -0
- package/dist/blocks/create-blocks.d.ts +54 -0
- package/dist/blocks/create-blocks.js +52 -0
- package/dist/blocks/index.d.ts +55 -0
- package/dist/blocks/index.js +59 -0
- package/dist/blocks/json-ld.d.ts +18 -0
- package/dist/blocks/json-ld.js +44 -0
- package/dist/blocks/labels.d.ts +20 -0
- package/dist/blocks/labels.js +43 -0
- package/dist/blocks/rich-text.d.ts +36 -0
- package/dist/blocks/rich-text.js +106 -0
- package/dist/blocks/schema/define-block.d.ts +151 -0
- package/dist/blocks/schema/define-block.js +120 -0
- package/dist/blocks/schema/emphasis.d.ts +17 -0
- package/dist/blocks/schema/emphasis.js +69 -0
- package/dist/blocks/schema/fields.d.ts +497 -0
- package/dist/blocks/schema/fields.js +240 -0
- package/dist/blocks/schema/icons.d.ts +2 -0
- package/dist/blocks/schema/icons.js +26 -0
- package/dist/blocks/schema/index.d.ts +18 -0
- package/dist/blocks/schema/index.js +21 -0
- package/dist/blocks/schema/lint-types.d.ts +16 -0
- package/dist/blocks/schema/lint-types.js +2 -0
- package/dist/blocks/schema/lint.d.ts +32 -0
- package/dist/blocks/schema/lint.js +164 -0
- package/dist/blocks/schema/localize.d.ts +20 -0
- package/dist/blocks/schema/localize.js +29 -0
- package/dist/blocks/schema/localized.d.ts +25 -0
- package/dist/blocks/schema/localized.js +53 -0
- package/dist/blocks/schema/migrate.d.ts +24 -0
- package/dist/blocks/schema/migrate.js +75 -0
- package/dist/blocks/schema/nodes.d.ts +196 -0
- package/dist/blocks/schema/nodes.js +78 -0
- package/dist/blocks/schema/rich-doc-schema.d.ts +32 -0
- package/dist/blocks/schema/rich-doc-schema.js +66 -0
- package/dist/blocks/schema/rich-doc.d.ts +90 -0
- package/dist/blocks/schema/rich-doc.js +62 -0
- package/dist/blocks/schema/safety.d.ts +20 -0
- package/dist/blocks/schema/safety.js +49 -0
- package/dist/blocks/schema/types.d.ts +172 -0
- package/dist/blocks/schema/types.js +3 -0
- package/dist/blocks/schema/validate.d.ts +17 -0
- package/dist/blocks/schema/validate.js +32 -0
- package/dist/blocks/schema/walk.d.ts +22 -0
- package/dist/blocks/schema/walk.js +60 -0
- package/dist/blocks/section-header.d.ts +38 -0
- package/dist/blocks/section-header.js +22 -0
- package/dist/blocks/section.d.ts +59 -0
- package/dist/blocks/section.js +66 -0
- package/dist/blocks/site/_kit-1.d.ts +100 -0
- package/dist/blocks/site/_kit-1.js +135 -0
- package/dist/blocks/site/_site-icon-1.d.ts +6 -0
- package/dist/blocks/site/_site-icon-1.js +15 -0
- package/dist/blocks/site/announcement-bar.d.ts +42 -0
- package/dist/blocks/site/announcement-bar.js +38 -0
- package/dist/blocks/site/announcement-dismiss.d.ts +18 -0
- package/dist/blocks/site/announcement-dismiss.js +28 -0
- package/dist/blocks/site/article-layout.d.ts +65 -0
- package/dist/blocks/site/article-layout.js +88 -0
- package/dist/blocks/site/blog-list.d.ts +79 -0
- package/dist/blocks/site/blog-list.js +78 -0
- package/dist/blocks/site/comparison-table.d.ts +54 -0
- package/dist/blocks/site/comparison-table.js +38 -0
- package/dist/blocks/site/consent-banner.d.ts +52 -0
- package/dist/blocks/site/consent-banner.js +33 -0
- package/dist/blocks/site/contact-dock.d.ts +52 -0
- package/dist/blocks/site/contact-dock.js +55 -0
- package/dist/blocks/site/contact-form.d.ts +60 -0
- package/dist/blocks/site/contact-form.js +45 -0
- package/dist/blocks/site/cta-booking.d.ts +43 -0
- package/dist/blocks/site/cta-booking.js +69 -0
- package/dist/blocks/site/cta.d.ts +74 -0
- package/dist/blocks/site/cta.js +112 -0
- package/dist/blocks/site/embed-facade.d.ts +20 -0
- package/dist/blocks/site/embed-facade.js +21 -0
- package/dist/blocks/site/faq.d.ts +48 -0
- package/dist/blocks/site/faq.js +51 -0
- package/dist/blocks/site/feature-grid.d.ts +46 -0
- package/dist/blocks/site/feature-grid.js +49 -0
- package/dist/blocks/site/feature-tabs.d.ts +22 -0
- package/dist/blocks/site/feature-tabs.js +11 -0
- package/dist/blocks/site/footer.d.ts +68 -0
- package/dist/blocks/site/footer.js +61 -0
- package/dist/blocks/site/gallery-section.d.ts +42 -0
- package/dist/blocks/site/gallery-section.js +47 -0
- package/dist/blocks/site/hero-video.d.ts +15 -0
- package/dist/blocks/site/hero-video.js +31 -0
- package/dist/blocks/site/hero.d.ts +64 -0
- package/dist/blocks/site/hero.js +67 -0
- package/dist/blocks/site/logo-strip.d.ts +42 -0
- package/dist/blocks/site/logo-strip.js +26 -0
- package/dist/blocks/site/map-hours.d.ts +83 -0
- package/dist/blocks/site/map-hours.js +125 -0
- package/dist/blocks/site/media-text.d.ts +45 -0
- package/dist/blocks/site/media-text.js +55 -0
- package/dist/blocks/site/menu-list.d.ts +74 -0
- package/dist/blocks/site/menu-list.js +84 -0
- package/dist/blocks/site/navbar-submenu.d.ts +18 -0
- package/dist/blocks/site/navbar-submenu.js +51 -0
- package/dist/blocks/site/navbar.d.ts +67 -0
- package/dist/blocks/site/navbar.js +64 -0
- package/dist/blocks/site/not-found.d.ts +40 -0
- package/dist/blocks/site/not-found.js +38 -0
- package/dist/blocks/site/page-intro.d.ts +46 -0
- package/dist/blocks/site/page-intro.js +44 -0
- package/dist/blocks/site/pricing-table.d.ts +67 -0
- package/dist/blocks/site/pricing-table.js +82 -0
- package/dist/blocks/site/process.d.ts +36 -0
- package/dist/blocks/site/process.js +41 -0
- package/dist/blocks/site/registry-1.d.ts +720 -0
- package/dist/blocks/site/registry-1.js +783 -0
- package/dist/blocks/site/registry-2.d.ts +914 -0
- package/dist/blocks/site/registry-2.js +563 -0
- package/dist/blocks/site/rich-text-section.d.ts +34 -0
- package/dist/blocks/site/rich-text-section.js +32 -0
- package/dist/blocks/site/shared/brand-icons.d.ts +21 -0
- package/dist/blocks/site/shared/brand-icons.js +56 -0
- package/dist/blocks/site/shared/consent-gate.d.ts +41 -0
- package/dist/blocks/site/shared/consent-gate.js +43 -0
- package/dist/blocks/site/shared/consent-island.d.ts +38 -0
- package/dist/blocks/site/shared/consent-island.js +63 -0
- package/dist/blocks/site/shared/consent.d.ts +49 -0
- package/dist/blocks/site/shared/consent.js +130 -0
- package/dist/blocks/site/shared/contact-form-island.d.ts +41 -0
- package/dist/blocks/site/shared/contact-form-island.js +100 -0
- package/dist/blocks/site/shared/copy-link.d.ts +10 -0
- package/dist/blocks/site/shared/copy-link.js +25 -0
- package/dist/blocks/site/shared/dock-avoid.d.ts +15 -0
- package/dist/blocks/site/shared/dock-avoid.js +107 -0
- package/dist/blocks/site/shared/dock-hours.d.ts +13 -0
- package/dist/blocks/site/shared/dock-hours.js +25 -0
- package/dist/blocks/site/shared/gallery-lightbox.d.ts +12 -0
- package/dist/blocks/site/shared/gallery-lightbox.js +10 -0
- package/dist/blocks/site/shared/island-keys.d.ts +10 -0
- package/dist/blocks/site/shared/island-keys.js +44 -0
- package/dist/blocks/site/shared/kit-2.d.ts +55 -0
- package/dist/blocks/site/shared/kit-2.js +84 -0
- package/dist/blocks/site/shared/labels-2.d.ts +209 -0
- package/dist/blocks/site/shared/labels-2.js +427 -0
- package/dist/blocks/site/shared/open-now.d.ts +22 -0
- package/dist/blocks/site/shared/open-now.js +27 -0
- package/dist/blocks/site/shared/opening-hours.d.ts +117 -0
- package/dist/blocks/site/shared/opening-hours.js +245 -0
- package/dist/blocks/site/shared/site-accent.d.ts +48 -0
- package/dist/blocks/site/shared/site-accent.js +249 -0
- package/dist/blocks/site/shared/site-form.d.ts +79 -0
- package/dist/blocks/site/shared/site-form.js +111 -0
- package/dist/blocks/site/shared/site-routing.d.ts +54 -0
- package/dist/blocks/site/shared/site-routing.js +86 -0
- package/dist/blocks/site/shared/testimonials-carousel.d.ts +17 -0
- package/dist/blocks/site/shared/testimonials-carousel.js +64 -0
- package/dist/blocks/site/site-shell.d.ts +97 -0
- package/dist/blocks/site/site-shell.js +227 -0
- package/dist/blocks/site/stats-band.d.ts +40 -0
- package/dist/blocks/site/stats-band.js +41 -0
- package/dist/blocks/site/team.d.ts +44 -0
- package/dist/blocks/site/team.js +48 -0
- package/dist/blocks/site/testimonials.d.ts +68 -0
- package/dist/blocks/site/testimonials.js +65 -0
- package/dist/blocks/types.d.ts +63 -0
- package/dist/blocks/types.js +2 -0
- package/dist/business/approval-flow.d.ts +152 -0
- package/dist/business/approval-flow.js +221 -0
- package/dist/business/export-core.d.ts +55 -0
- package/dist/business/export-core.js +101 -0
- package/dist/business/export.d.ts +148 -0
- package/dist/business/export.js +264 -0
- package/dist/business/import-core.d.ts +104 -0
- package/dist/business/import-core.js +281 -0
- package/dist/business/import-wizard.d.ts +186 -0
- package/dist/business/import-wizard.js +401 -0
- package/dist/business/index.d.ts +11 -0
- package/dist/business/index.js +20 -0
- package/dist/business/line-items-core.d.ts +129 -0
- package/dist/business/line-items-core.js +183 -0
- package/dist/business/line-items.d.ts +119 -0
- package/dist/business/line-items.js +299 -0
- package/dist/business/multi-step-form.d.ts +131 -0
- package/dist/business/multi-step-form.js +337 -0
- package/dist/business/permission-core.d.ts +59 -0
- package/dist/business/permission-core.js +99 -0
- package/dist/business/permission-matrix.d.ts +158 -0
- package/dist/business/permission-matrix.js +341 -0
- package/dist/business/setup-checklist.d.ts +80 -0
- package/dist/business/setup-checklist.js +92 -0
- package/dist/charts/area-chart.d.ts +35 -0
- package/dist/charts/area-chart.js +33 -0
- package/dist/charts/bar-chart.d.ts +27 -0
- package/dist/charts/bar-chart.js +42 -0
- package/dist/charts/bar-list.d.ts +47 -0
- package/dist/charts/bar-list.js +60 -0
- package/dist/charts/chart-shell.d.ts +173 -0
- package/dist/charts/chart-shell.js +205 -0
- package/dist/charts/chart.d.ts +73 -0
- package/dist/charts/chart.js +106 -0
- package/dist/charts/combo-chart.d.ts +29 -0
- package/dist/charts/combo-chart.js +47 -0
- package/dist/charts/donut-chart.d.ts +33 -0
- package/dist/charts/donut-chart.js +113 -0
- package/dist/charts/funnel.d.ts +51 -0
- package/dist/charts/funnel.js +69 -0
- package/dist/charts/gauge.d.ts +62 -0
- package/dist/charts/gauge.js +104 -0
- package/dist/charts/heatmap.d.ts +81 -0
- package/dist/charts/heatmap.js +338 -0
- package/dist/charts/index.d.ts +12 -0
- package/dist/charts/index.js +14 -0
- package/dist/charts/line-chart.d.ts +21 -0
- package/dist/charts/line-chart.js +36 -0
- package/dist/charts/test-utils.d.ts +2 -0
- package/dist/charts/test-utils.js +38 -0
- package/dist/charts/utils.d.ts +130 -0
- package/dist/charts/utils.js +262 -0
- package/dist/components/accordion.d.ts +47 -0
- package/dist/components/accordion.js +70 -0
- package/dist/components/activity-timeline.d.ts +149 -0
- package/dist/components/activity-timeline.js +122 -0
- package/dist/components/address-field.d.ts +116 -0
- package/dist/components/address-field.js +219 -0
- package/dist/components/alert-dialog.d.ts +99 -0
- package/dist/components/alert-dialog.js +192 -0
- package/dist/components/alert.d.ts +42 -0
- package/dist/components/alert.js +82 -0
- package/dist/components/app-shell.d.ts +159 -0
- package/dist/components/app-shell.js +289 -0
- package/dist/components/attachment-list.d.ts +96 -0
- package/dist/components/attachment-list.js +196 -0
- package/dist/components/audit-log.d.ts +150 -0
- package/dist/components/audit-log.js +205 -0
- package/dist/components/avatar.d.ts +87 -0
- package/dist/components/avatar.js +126 -0
- package/dist/components/badge.d.ts +41 -0
- package/dist/components/badge.js +68 -0
- package/dist/components/breadcrumb.d.ts +78 -0
- package/dist/components/breadcrumb.js +106 -0
- package/dist/components/button-group.d.ts +52 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button.d.ts +58 -0
- package/dist/components/button.js +107 -0
- package/dist/components/calendar.d.ts +240 -0
- package/dist/components/calendar.js +483 -0
- package/dist/components/card.d.ts +66 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +170 -0
- package/dist/components/carousel.js +348 -0
- package/dist/components/checkbox.d.ts +78 -0
- package/dist/components/checkbox.js +138 -0
- package/dist/components/color-picker.d.ts +112 -0
- package/dist/components/color-picker.js +235 -0
- package/dist/components/combobox.d.ts +136 -0
- package/dist/components/combobox.js +294 -0
- package/dist/components/command.d.ts +275 -0
- package/dist/components/command.js +493 -0
- package/dist/components/comment-thread.d.ts +252 -0
- package/dist/components/comment-thread.js +449 -0
- package/dist/components/context-menu.d.ts +77 -0
- package/dist/components/context-menu.js +82 -0
- package/dist/components/currency-input.d.ts +43 -0
- package/dist/components/currency-input.js +85 -0
- package/dist/components/date-picker.d.ts +141 -0
- package/dist/components/date-picker.js +241 -0
- package/dist/components/date-range-picker.d.ts +91 -0
- package/dist/components/date-range-picker.js +251 -0
- package/dist/components/description-list.d.ts +92 -0
- package/dist/components/description-list.js +42 -0
- package/dist/components/dialog.d.ts +139 -0
- package/dist/components/dialog.js +185 -0
- package/dist/components/dropdown-menu.d.ts +100 -0
- package/dist/components/dropdown-menu.js +102 -0
- package/dist/components/editor-layout.d.ts +166 -0
- package/dist/components/editor-layout.js +237 -0
- package/dist/components/empty-state.d.ts +49 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/entity-card.d.ts +83 -0
- package/dist/components/entity-card.js +92 -0
- package/dist/components/file-upload.d.ts +256 -0
- package/dist/components/file-upload.js +490 -0
- package/dist/components/formatted-input.d.ts +177 -0
- package/dist/components/formatted-input.js +399 -0
- package/dist/components/hierarchy-chart.d.ts +190 -0
- package/dist/components/hierarchy-chart.js +890 -0
- package/dist/components/hover-card.d.ts +21 -0
- package/dist/components/hover-card.js +32 -0
- package/dist/components/iban-input.d.ts +38 -0
- package/dist/components/iban-input.js +112 -0
- package/dist/components/id-input.d.ts +65 -0
- package/dist/components/id-input.js +130 -0
- package/dist/components/image.d.ts +130 -0
- package/dist/components/image.js +168 -0
- package/dist/components/input-otp.d.ts +62 -0
- package/dist/components/input-otp.js +73 -0
- package/dist/components/input.d.ts +141 -0
- package/dist/components/input.js +187 -0
- package/dist/components/item.d.ts +96 -0
- package/dist/components/item.js +113 -0
- package/dist/components/kbd.d.ts +64 -0
- package/dist/components/kbd.js +119 -0
- package/dist/components/list-layout.d.ts +144 -0
- package/dist/components/list-layout.js +210 -0
- package/dist/components/native-select.d.ts +33 -0
- package/dist/components/native-select.js +48 -0
- package/dist/components/navigation-menu.d.ts +127 -0
- package/dist/components/navigation-menu.js +129 -0
- package/dist/components/notification-center.d.ts +164 -0
- package/dist/components/notification-center.js +399 -0
- package/dist/components/page-header.d.ts +60 -0
- package/dist/components/page-header.js +60 -0
- package/dist/components/pagination.d.ts +121 -0
- package/dist/components/pagination.js +174 -0
- package/dist/components/phone-input.d.ts +49 -0
- package/dist/components/phone-input.js +266 -0
- package/dist/components/popover.d.ts +38 -0
- package/dist/components/popover.js +69 -0
- package/dist/components/progress.d.ts +79 -0
- package/dist/components/progress.js +97 -0
- package/dist/components/radio-group.d.ts +43 -0
- package/dist/components/radio-group.js +81 -0
- package/dist/components/record-detail-layout.d.ts +167 -0
- package/dist/components/record-detail-layout.js +233 -0
- package/dist/components/record-picker.d.ts +199 -0
- package/dist/components/record-picker.js +650 -0
- package/dist/components/resizable.d.ts +50 -0
- package/dist/components/resizable.js +88 -0
- package/dist/components/scroll-area.d.ts +40 -0
- package/dist/components/scroll-area.js +56 -0
- package/dist/components/select.d.ts +126 -0
- package/dist/components/select.js +137 -0
- package/dist/components/separator.d.ts +31 -0
- package/dist/components/separator.js +41 -0
- package/dist/components/settings-layout.d.ts +134 -0
- package/dist/components/settings-layout.js +180 -0
- package/dist/components/sheet.d.ts +103 -0
- package/dist/components/sheet.js +165 -0
- package/dist/components/sidebar.d.ts +171 -0
- package/dist/components/sidebar.js +421 -0
- package/dist/components/signature-pad.d.ts +85 -0
- package/dist/components/signature-pad.js +283 -0
- package/dist/components/skeleton.d.ts +64 -0
- package/dist/components/skeleton.js +53 -0
- package/dist/components/slider.d.ts +57 -0
- package/dist/components/slider.js +133 -0
- package/dist/components/slug-input.d.ts +69 -0
- package/dist/components/slug-input.js +201 -0
- package/dist/components/sparkline.d.ts +54 -0
- package/dist/components/sparkline.js +122 -0
- package/dist/components/spinner.d.ts +34 -0
- package/dist/components/spinner.js +34 -0
- package/dist/components/stat.d.ts +135 -0
- package/dist/components/stat.js +130 -0
- package/dist/components/status-picker.d.ts +107 -0
- package/dist/components/status-picker.js +175 -0
- package/dist/components/stepper.d.ts +86 -0
- package/dist/components/stepper.js +103 -0
- package/dist/components/switch.d.ts +34 -0
- package/dist/components/switch.js +70 -0
- package/dist/components/table.d.ts +101 -0
- package/dist/components/table.js +72 -0
- package/dist/components/tabs.d.ts +103 -0
- package/dist/components/tabs.js +173 -0
- package/dist/components/tag-input.d.ts +77 -0
- package/dist/components/tag-input.js +305 -0
- package/dist/components/task-list.d.ts +89 -0
- package/dist/components/task-list.js +238 -0
- package/dist/components/time-picker.d.ts +119 -0
- package/dist/components/time-picker.js +399 -0
- package/dist/components/toast.d.ts +87 -0
- package/dist/components/toast.js +142 -0
- package/dist/components/toggle.d.ts +77 -0
- package/dist/components/toggle.js +109 -0
- package/dist/components/tooltip.d.ts +69 -0
- package/dist/components/tooltip.js +105 -0
- package/dist/components/top-bar.d.ts +87 -0
- package/dist/components/top-bar.js +99 -0
- package/dist/components/tree-select.d.ts +89 -0
- package/dist/components/tree-select.js +243 -0
- package/dist/components/tree-view.d.ts +109 -0
- package/dist/components/tree-view.js +170 -0
- package/dist/components/typography.d.ts +107 -0
- package/dist/components/typography.js +128 -0
- package/dist/components/user-picker.d.ts +89 -0
- package/dist/components/user-picker.js +162 -0
- package/dist/components/version-history.d.ts +191 -0
- package/dist/components/version-history.js +431 -0
- package/dist/data-table/csv.d.ts +27 -0
- package/dist/data-table/csv.js +68 -0
- package/dist/data-table/data-table.d.ts +423 -0
- package/dist/data-table/data-table.js +1259 -0
- package/dist/data-table/filter-bar.d.ts +146 -0
- package/dist/data-table/filter-bar.js +569 -0
- package/dist/data-table/filter-fns.d.ts +65 -0
- package/dist/data-table/filter-fns.js +382 -0
- package/dist/data-table/index.d.ts +8 -0
- package/dist/data-table/index.js +9 -0
- package/dist/data-table/saved-views.d.ts +100 -0
- package/dist/data-table/saved-views.js +251 -0
- package/dist/data-table/types.d.ts +168 -0
- package/dist/data-table/types.js +87 -0
- package/dist/data-table/url-state.d.ts +94 -0
- package/dist/data-table/url-state.js +303 -0
- package/dist/data-table/view-state.d.ts +16 -0
- package/dist/data-table/view-state.js +81 -0
- package/dist/editor/_test-setup.d.ts +1 -0
- package/dist/editor/_test-setup.js +33 -0
- package/dist/editor/block-editor.d.ts +137 -0
- package/dist/editor/block-editor.js +280 -0
- package/dist/editor/commands.d.ts +31 -0
- package/dist/editor/commands.js +150 -0
- package/dist/editor/context.d.ts +108 -0
- package/dist/editor/context.js +30 -0
- package/dist/editor/convert.d.ts +66 -0
- package/dist/editor/convert.js +567 -0
- package/dist/editor/drag-handle.d.ts +10 -0
- package/dist/editor/drag-handle.js +69 -0
- package/dist/editor/extensions.d.ts +34 -0
- package/dist/editor/extensions.js +239 -0
- package/dist/editor/index.d.ts +14 -0
- package/dist/editor/index.js +17 -0
- package/dist/editor/inserter.d.ts +12 -0
- package/dist/editor/inserter.js +88 -0
- package/dist/editor/inspector.d.ts +17 -0
- package/dist/editor/inspector.js +65 -0
- package/dist/editor/items.d.ts +62 -0
- package/dist/editor/items.js +195 -0
- package/dist/editor/labels.d.ts +119 -0
- package/dist/editor/labels.js +130 -0
- package/dist/editor/markdown.d.ts +14 -0
- package/dist/editor/markdown.js +209 -0
- package/dist/editor/menus.d.ts +20 -0
- package/dist/editor/menus.js +236 -0
- package/dist/editor/nodes.d.ts +14 -0
- package/dist/editor/nodes.js +201 -0
- package/dist/editor/outline.d.ts +11 -0
- package/dist/editor/outline.js +52 -0
- package/dist/editor/schema-form.d.ts +64 -0
- package/dist/editor/schema-form.js +290 -0
- package/dist/editor/slash-menu.d.ts +15 -0
- package/dist/editor/slash-menu.js +119 -0
- package/dist/fonts/catalog.d.ts +53 -0
- package/dist/fonts/catalog.js +121 -0
- package/dist/fonts/font-picker.d.ts +70 -0
- package/dist/fonts/font-picker.js +225 -0
- package/dist/fonts/index.d.ts +6 -0
- package/dist/fonts/index.js +7 -0
- package/dist/fonts/loader.d.ts +66 -0
- package/dist/fonts/loader.js +161 -0
- package/dist/fonts/pairing-picker.d.ts +31 -0
- package/dist/fonts/pairing-picker.js +81 -0
- package/dist/fonts/pairings.d.ts +84 -0
- package/dist/fonts/pairings.js +149 -0
- package/dist/fonts/provider.d.ts +34 -0
- package/dist/fonts/provider.js +51 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.js +1 -0
- package/dist/format/core.d.ts +149 -0
- package/dist/format/core.js +357 -0
- package/dist/format/index.d.ts +4 -0
- package/dist/format/index.js +5 -0
- package/dist/format/use-format.d.ts +1 -0
- package/dist/format/use-format.js +3 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +87 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +16 -0
- package/dist/lib/color.d.ts +64 -0
- package/dist/lib/color.js +177 -0
- package/dist/lib/compose-refs.d.ts +24 -0
- package/dist/lib/compose-refs.js +45 -0
- package/dist/lib/data-islands.d.ts +194 -0
- package/dist/lib/data-islands.js +368 -0
- package/dist/lib/date.d.ts +129 -0
- package/dist/lib/date.js +386 -0
- package/dist/lib/field-context.d.ts +64 -0
- package/dist/lib/field-context.js +62 -0
- package/dist/lib/floating-arrow.d.ts +18 -0
- package/dist/lib/floating-arrow.js +15 -0
- package/dist/lib/islands.d.ts +38 -0
- package/dist/lib/islands.js +40 -0
- package/dist/lib/labels.d.ts +51 -0
- package/dist/lib/labels.js +56 -0
- package/dist/lib/layer.d.ts +36 -0
- package/dist/lib/layer.js +42 -0
- package/dist/lib/locale.d.ts +85 -0
- package/dist/lib/locale.js +105 -0
- package/dist/lib/menu.d.ts +58 -0
- package/dist/lib/menu.js +99 -0
- package/dist/lib/message-format.d.ts +20 -0
- package/dist/lib/message-format.js +116 -0
- package/dist/lib/nav.d.ts +132 -0
- package/dist/lib/nav.js +178 -0
- package/dist/lib/provider.d.ts +100 -0
- package/dist/lib/provider.js +105 -0
- package/dist/lib/public.d.ts +22 -0
- package/dist/lib/public.js +33 -0
- package/dist/lib/sr-name.d.ts +18 -0
- package/dist/lib/sr-name.js +17 -0
- package/dist/lib/text.d.ts +100 -0
- package/dist/lib/text.js +233 -0
- package/dist/lib/theme-scope.d.ts +58 -0
- package/dist/lib/theme-scope.js +59 -0
- package/dist/lib/use-async-list.d.ts +60 -0
- package/dist/lib/use-async-list.js +119 -0
- package/dist/lib/use-container-width.d.ts +19 -0
- package/dist/lib/use-container-width.js +39 -0
- package/dist/lib/use-controllable-state.d.ts +33 -0
- package/dist/lib/use-controllable-state.js +56 -0
- package/dist/lib/use-edge-fade.d.ts +13 -0
- package/dist/lib/use-edge-fade.js +43 -0
- package/dist/lib/use-formatted-input.d.ts +69 -0
- package/dist/lib/use-formatted-input.js +152 -0
- package/dist/lib/use-hotkeys.d.ts +80 -0
- package/dist/lib/use-hotkeys.js +221 -0
- package/dist/lib/use-hover-intent.d.ts +44 -0
- package/dist/lib/use-hover-intent.js +119 -0
- package/dist/lib/use-media-query.d.ts +21 -0
- package/dist/lib/use-media-query.js +28 -0
- package/dist/lib/use-reduced-motion.d.ts +8 -0
- package/dist/lib/use-reduced-motion.js +13 -0
- package/dist/lib/use-tree.d.ts +153 -0
- package/dist/lib/use-tree.js +534 -0
- package/dist/lib/value-format.d.ts +25 -0
- package/dist/lib/value-format.js +56 -0
- package/dist/lib/variants.d.ts +131 -0
- package/dist/lib/variants.js +109 -0
- package/dist/locale-data/core/date.d.ts +24 -0
- package/dist/locale-data/core/date.js +68 -0
- package/dist/locale-data/core/decimal.d.ts +19 -0
- package/dist/locale-data/core/decimal.js +79 -0
- package/dist/locale-data/core/holidays.d.ts +30 -0
- package/dist/locale-data/core/holidays.js +79 -0
- package/dist/locale-data/core/iban.d.ts +29 -0
- package/dist/locale-data/core/iban.js +74 -0
- package/dist/locale-data/core/index.d.ts +7 -0
- package/dist/locale-data/core/index.js +6 -0
- package/dist/locale-data/core/types.d.ts +173 -0
- package/dist/locale-data/core/types.js +6 -0
- package/dist/locale-data/core/week-info.d.ts +23 -0
- package/dist/locale-data/core/week-info.js +85 -0
- package/dist/locale-data/core/working-days.d.ts +27 -0
- package/dist/locale-data/core/working-days.js +133 -0
- package/dist/locale-data/index.d.ts +2 -0
- package/dist/locale-data/index.js +4 -0
- package/dist/locale-data/tr/address-tr.json +1 -0
- package/dist/locale-data/tr/address.d.ts +23 -0
- package/dist/locale-data/tr/address.js +52 -0
- package/dist/locale-data/tr/holidays.d.ts +31 -0
- package/dist/locale-data/tr/holidays.js +81 -0
- package/dist/locale-data/tr/iban.d.ts +21 -0
- package/dist/locale-data/tr/iban.js +45 -0
- package/dist/locale-data/tr/id.d.ts +36 -0
- package/dist/locale-data/tr/id.js +120 -0
- package/dist/locale-data/tr/index.d.ts +12 -0
- package/dist/locale-data/tr/index.js +33 -0
- package/dist/locale-data/tr/kdv.d.ts +91 -0
- package/dist/locale-data/tr/kdv.js +222 -0
- package/dist/locales/en.d.ts +2102 -0
- package/dist/locales/en.js +2088 -0
- package/dist/locales/tr.d.ts +2086 -0
- package/dist/locales/tr.js +2087 -0
- package/dist/media/focal-point.d.ts +42 -0
- package/dist/media/focal-point.js +96 -0
- package/dist/media/gallery-layout.d.ts +19 -0
- package/dist/media/gallery-layout.js +61 -0
- package/dist/media/gallery.d.ts +64 -0
- package/dist/media/gallery.js +138 -0
- package/dist/media/image-cropper.d.ts +86 -0
- package/dist/media/image-cropper.js +170 -0
- package/dist/media/image-field.d.ts +115 -0
- package/dist/media/image-field.js +212 -0
- package/dist/media/index.d.ts +19 -0
- package/dist/media/index.js +23 -0
- package/dist/media/lightbox.d.ts +82 -0
- package/dist/media/lightbox.js +171 -0
- package/dist/media/link-preview.d.ts +97 -0
- package/dist/media/link-preview.js +177 -0
- package/dist/media/media-library.d.ts +244 -0
- package/dist/media/media-library.js +776 -0
- package/dist/media/media-picker.d.ts +96 -0
- package/dist/media/media-picker.js +209 -0
- package/dist/media/media-provider.d.ts +23 -0
- package/dist/media/media-provider.js +44 -0
- package/dist/media/media-utils.d.ts +39 -0
- package/dist/media/media-utils.js +145 -0
- package/dist/media/memory-adapter.d.ts +22 -0
- package/dist/media/memory-adapter.js +162 -0
- package/dist/media/rest-adapter.d.ts +90 -0
- package/dist/media/rest-adapter.js +208 -0
- package/dist/media/serp.d.ts +62 -0
- package/dist/media/serp.js +108 -0
- package/dist/media/test-fixtures.d.ts +3 -0
- package/dist/media/test-fixtures.js +37 -0
- package/dist/media/types.d.ts +183 -0
- package/dist/media/types.js +3 -0
- package/dist/media/use-pan-zoom.d.ts +51 -0
- package/dist/media/use-pan-zoom.js +156 -0
- package/dist/media/use-upload-queue.d.ts +64 -0
- package/dist/media/use-upload-queue.js +115 -0
- package/dist/media/video-player.d.ts +135 -0
- package/dist/media/video-player.js +319 -0
- package/dist/next/index.d.ts +42 -0
- package/dist/next/index.js +36 -0
- package/dist/render/block-renderer.d.ts +56 -0
- package/dist/render/block-renderer.js +137 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.js +7 -0
- package/dist/render/prepare.d.ts +61 -0
- package/dist/render/prepare.js +119 -0
- package/dist/scheduler/core/duration.d.ts +83 -0
- package/dist/scheduler/core/duration.js +174 -0
- package/dist/scheduler/core/gantt.d.ts +63 -0
- package/dist/scheduler/core/gantt.js +226 -0
- package/dist/scheduler/core/index.d.ts +6 -0
- package/dist/scheduler/core/index.js +7 -0
- package/dist/scheduler/core/layout.d.ts +97 -0
- package/dist/scheduler/core/layout.js +249 -0
- package/dist/scheduler/core/time-scale.d.ts +89 -0
- package/dist/scheduler/core/time-scale.js +173 -0
- package/dist/scheduler/gantt.d.ts +125 -0
- package/dist/scheduler/gantt.js +532 -0
- package/dist/scheduler/index.d.ts +6 -0
- package/dist/scheduler/index.js +7 -0
- package/dist/scheduler/resource-calendar.d.ts +218 -0
- package/dist/scheduler/resource-calendar.js +661 -0
- package/dist/scheduler/scheduler.d.ts +168 -0
- package/dist/scheduler/scheduler.js +768 -0
- package/dist/scheduler/shared.d.ts +63 -0
- package/dist/scheduler/shared.js +145 -0
- package/dist/scheduler/time-tracker.d.ts +138 -0
- package/dist/scheduler/time-tracker.js +403 -0
- package/dist/sortable/core.d.ts +67 -0
- package/dist/sortable/core.js +167 -0
- package/dist/sortable/index.d.ts +8 -0
- package/dist/sortable/index.js +10 -0
- package/dist/sortable/kanban-core.d.ts +70 -0
- package/dist/sortable/kanban-core.js +67 -0
- package/dist/sortable/kanban.d.ts +147 -0
- package/dist/sortable/kanban.js +472 -0
- package/dist/sortable/sortable-list.d.ts +71 -0
- package/dist/sortable/sortable-list.js +76 -0
- package/dist/sortable/sortable-tree.d.ts +101 -0
- package/dist/sortable/sortable-tree.js +450 -0
- package/dist/sortable/sortable.d.ts +188 -0
- package/dist/sortable/sortable.js +485 -0
- package/dist/sortable/use-pointer-drag.d.ts +75 -0
- package/dist/sortable/use-pointer-drag.js +173 -0
- package/dist/sortable/use-time-scale.d.ts +11 -0
- package/dist/sortable/use-time-scale.js +19 -0
- package/dist/styles/base.css +51 -0
- package/dist/styles/blocks.css +949 -0
- package/dist/styles/calendar.css +642 -0
- package/dist/styles/charts.css +264 -0
- package/dist/styles/data.css +474 -0
- package/dist/styles/editors.css +1022 -0
- package/dist/styles/forms.css +406 -0
- package/dist/styles/media.css +515 -0
- package/dist/styles/navigation.css +293 -0
- package/dist/styles/overlays.css +244 -0
- package/dist/styles.css +742 -0
- package/package.json +156 -4
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type LabelFn } from "../lib/labels.js";
|
|
3
|
+
import { importCellMessages, type ImportField, type ImportRowResult, type MappingTemplate } from "./import-core.js";
|
|
4
|
+
export declare const importWizardLabels: {
|
|
5
|
+
stepUpload: string;
|
|
6
|
+
stepUploadHint: string;
|
|
7
|
+
stepMap: string;
|
|
8
|
+
stepMapHint: string;
|
|
9
|
+
stepReview: string;
|
|
10
|
+
stepReviewHint: string;
|
|
11
|
+
stepImport: string;
|
|
12
|
+
stepImportHint: string;
|
|
13
|
+
sample: string;
|
|
14
|
+
parsing: string;
|
|
15
|
+
parseFailed: string;
|
|
16
|
+
noFile: string;
|
|
17
|
+
noRows: string;
|
|
18
|
+
tooMany: string;
|
|
19
|
+
fileSummary: string;
|
|
20
|
+
encoding: string;
|
|
21
|
+
delimiter: string;
|
|
22
|
+
sheet: string;
|
|
23
|
+
header: string;
|
|
24
|
+
fileLocale: string;
|
|
25
|
+
fileLocaleHint: string;
|
|
26
|
+
garbled: string;
|
|
27
|
+
garbledBody: string;
|
|
28
|
+
tryEncoding: string;
|
|
29
|
+
column: string;
|
|
30
|
+
sampleValue: string;
|
|
31
|
+
field: string;
|
|
32
|
+
mapsTo: string;
|
|
33
|
+
ignore: string;
|
|
34
|
+
required: string;
|
|
35
|
+
unmapped: string;
|
|
36
|
+
mappedCount: string;
|
|
37
|
+
template: string;
|
|
38
|
+
applyTemplate: string;
|
|
39
|
+
saveTemplate: string;
|
|
40
|
+
templateName: string;
|
|
41
|
+
templateSaved: string;
|
|
42
|
+
templatePlaceholder: string;
|
|
43
|
+
encUtf8: string;
|
|
44
|
+
enc1254: string;
|
|
45
|
+
enc1252: string;
|
|
46
|
+
delimComma: string;
|
|
47
|
+
delimSemicolon: string;
|
|
48
|
+
delimTab: string;
|
|
49
|
+
counts: string;
|
|
50
|
+
onlyErrors: string;
|
|
51
|
+
nextError: string;
|
|
52
|
+
showing: string;
|
|
53
|
+
row: string;
|
|
54
|
+
fix: string;
|
|
55
|
+
allInvalid: string;
|
|
56
|
+
strategy: string;
|
|
57
|
+
skip: string;
|
|
58
|
+
skipHint: string;
|
|
59
|
+
update: string;
|
|
60
|
+
updateHint: string;
|
|
61
|
+
create: string;
|
|
62
|
+
createHint: string;
|
|
63
|
+
dryRun: string;
|
|
64
|
+
dryRunHint: string;
|
|
65
|
+
willImport: string;
|
|
66
|
+
start: string;
|
|
67
|
+
startDry: string;
|
|
68
|
+
importing: string;
|
|
69
|
+
cancel: string;
|
|
70
|
+
cancelled: string;
|
|
71
|
+
leave: string;
|
|
72
|
+
reportTitle: string;
|
|
73
|
+
reportDry: string;
|
|
74
|
+
reportPartial: string;
|
|
75
|
+
reportSummary: string;
|
|
76
|
+
failedRows: string;
|
|
77
|
+
error: string;
|
|
78
|
+
downloadFailed: string;
|
|
79
|
+
again: string;
|
|
80
|
+
done: string;
|
|
81
|
+
};
|
|
82
|
+
export type ImportWizardLabels = typeof importWizardLabels;
|
|
83
|
+
export type ImportStrategy = "skip" | "update" | "create";
|
|
84
|
+
export interface ImportContext {
|
|
85
|
+
signal: AbortSignal;
|
|
86
|
+
/** Report rows written so far within this chunk. */
|
|
87
|
+
onProgress: (done: number) => void;
|
|
88
|
+
strategy: ImportStrategy;
|
|
89
|
+
dryRun: boolean;
|
|
90
|
+
/** Index of the chunk's first row among all valid rows. */
|
|
91
|
+
offset: number;
|
|
92
|
+
}
|
|
93
|
+
export interface ImportResult {
|
|
94
|
+
ok: number;
|
|
95
|
+
/** `row` = 0-based index within the rows passed in. */
|
|
96
|
+
failed: {
|
|
97
|
+
row: number;
|
|
98
|
+
error: string;
|
|
99
|
+
}[];
|
|
100
|
+
}
|
|
101
|
+
export interface ImportWizardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
102
|
+
fields: ImportField[];
|
|
103
|
+
/** Fields that identify an existing record (enables the duplicate strategy). */
|
|
104
|
+
dedupeKeys?: string[];
|
|
105
|
+
/** Default 50,000. */
|
|
106
|
+
maxRows?: number;
|
|
107
|
+
/** Bytes. Default 20 MB. */
|
|
108
|
+
maxSize?: number;
|
|
109
|
+
/** Rows per `onImport` call. Default 200. */
|
|
110
|
+
chunkSize?: number;
|
|
111
|
+
/** Called per chunk with typed values. */
|
|
112
|
+
onImport: (rows: Record<string, unknown>[], ctx: ImportContext) => Promise<ImportResult>;
|
|
113
|
+
templates?: {
|
|
114
|
+
list: () => Promise<MappingTemplate[]>;
|
|
115
|
+
save: (t: MappingTemplate) => Promise<void>;
|
|
116
|
+
};
|
|
117
|
+
sampleFile?: {
|
|
118
|
+
name: string;
|
|
119
|
+
href: string;
|
|
120
|
+
};
|
|
121
|
+
/** Locales offered for number / date parsing. Default: UI locale, en-US, en-GB, tr-TR, de-DE. */
|
|
122
|
+
fileLocales?: {
|
|
123
|
+
value: string;
|
|
124
|
+
label: string;
|
|
125
|
+
}[];
|
|
126
|
+
/** After the report: "Done". */
|
|
127
|
+
onDone?: (report: ImportReport) => void;
|
|
128
|
+
/** Rows shown in the review table. Default 200. */
|
|
129
|
+
previewLimit?: number;
|
|
130
|
+
labels?: Partial<ImportWizardLabels>;
|
|
131
|
+
}
|
|
132
|
+
export interface ImportReport {
|
|
133
|
+
ok: number;
|
|
134
|
+
failed: {
|
|
135
|
+
row: number;
|
|
136
|
+
error: string;
|
|
137
|
+
raw: Record<string, string>;
|
|
138
|
+
}[];
|
|
139
|
+
skipped: number;
|
|
140
|
+
dryRun: boolean;
|
|
141
|
+
cancelled: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Imports CSV / XLSX into any collection: upload (encoding, delimiter, sheet, header) → column
|
|
145
|
+
* mapping (auto + templates) → review with inline fixes → duplicate strategy, dry run and a
|
|
146
|
+
* chunked, cancellable import → report with a failed-rows download. Built on Multi-step form.
|
|
147
|
+
*
|
|
148
|
+
* ```tsx
|
|
149
|
+
* <ImportWizard fields={contactFields} dedupeKeys={["email"]} onImport={(rows, { signal }) => api.contacts.bulk(rows, { signal })} />
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare const ImportWizard: React.ForwardRefExoticComponent<ImportWizardProps & React.RefAttributes<HTMLDivElement>>;
|
|
153
|
+
export interface ImportMappingProps {
|
|
154
|
+
headers: string[];
|
|
155
|
+
/** First data row, shown as a sample. */
|
|
156
|
+
sample?: string[];
|
|
157
|
+
fields: ImportField[];
|
|
158
|
+
mapping: Record<number, string | null>;
|
|
159
|
+
onMappingChange: (m: Record<number, string | null>) => void;
|
|
160
|
+
toolbar?: React.ReactNode;
|
|
161
|
+
labels?: Partial<ImportWizardLabels>;
|
|
162
|
+
}
|
|
163
|
+
/** Column → field mapping: one labelled Select per file column. Usable alone. */
|
|
164
|
+
export declare function ImportMapping({ headers, sample, fields, mapping, onMappingChange, toolbar, labels, t: tProp }: ImportMappingProps & {
|
|
165
|
+
t?: LabelFn<ImportWizardLabels>;
|
|
166
|
+
}): React.JSX.Element;
|
|
167
|
+
export interface ImportReviewProps {
|
|
168
|
+
results: ImportRowResult[];
|
|
169
|
+
/** Mapped fields, as table columns. */
|
|
170
|
+
fields: ImportField[];
|
|
171
|
+
onlyErrors: boolean;
|
|
172
|
+
onOnlyErrorsChange: (v: boolean) => void;
|
|
173
|
+
errorCount: number;
|
|
174
|
+
warningCount: number;
|
|
175
|
+
errorRowCount: number;
|
|
176
|
+
/** Inline fix: index into `results`. */
|
|
177
|
+
onFix?: (index: number, field: string, value: string) => void;
|
|
178
|
+
onNextError?: () => void;
|
|
179
|
+
limit?: number;
|
|
180
|
+
labels?: Partial<ImportWizardLabels>;
|
|
181
|
+
}
|
|
182
|
+
/** Validation preview: counts, an "only problems" filter and editable error cells (F8 = next error). */
|
|
183
|
+
export declare function ImportReview({ results, fields, onlyErrors, onOnlyErrorsChange, errorCount, warningCount, errorRowCount, onFix, onNextError, limit, labels, t: tProp }: ImportReviewProps & {
|
|
184
|
+
t?: LabelFn<ImportWizardLabels>;
|
|
185
|
+
}): React.JSX.Element;
|
|
186
|
+
export { importCellMessages };
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ArrowRight, Download, FileSpreadsheet, RotateCcw, Save, X, CircleAlert, CircleCheck } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { useLabels } from "../lib/labels.js";
|
|
7
|
+
import { useLocale } from "../lib/locale.js";
|
|
8
|
+
import { Button } from "../components/button.js";
|
|
9
|
+
import { Alert } from "../components/alert.js";
|
|
10
|
+
import { Badge } from "../components/badge.js";
|
|
11
|
+
import { Checkbox } from "../components/checkbox.js";
|
|
12
|
+
import { Input, Field } from "../components/input.js";
|
|
13
|
+
import { Select } from "../components/select.js";
|
|
14
|
+
import { RadioGroup } from "../components/radio-group.js";
|
|
15
|
+
import { Progress } from "../components/progress.js";
|
|
16
|
+
import { FileUpload } from "../components/file-upload.js";
|
|
17
|
+
import { toCsv } from "../data-table/csv.js";
|
|
18
|
+
import { downloadBlob } from "./export-core.js";
|
|
19
|
+
import { MultiStepForm, MultiStepFormFooter, MultiStepFormStep, MultiStepFormStepper } from "./multi-step-form.js";
|
|
20
|
+
import { applyTemplate, autoMap, decodeText, importCellMessages, looksGarbled, mappingToTemplate, parseCsv, readXlsx, sniffCsv, validateImport, validateImportRow, } from "./import-core.js";
|
|
21
|
+
export const importWizardLabels = {
|
|
22
|
+
stepUpload: "Upload",
|
|
23
|
+
stepUploadHint: "CSV or Excel. The first row should hold column names.",
|
|
24
|
+
stepMap: "Map columns",
|
|
25
|
+
stepMapHint: "Match each column in your file to a field. Unmapped columns are ignored.",
|
|
26
|
+
stepReview: "Review",
|
|
27
|
+
stepReviewHint: "Fix problems inline or leave them out — rows with errors are skipped.",
|
|
28
|
+
stepImport: "Import",
|
|
29
|
+
stepImportHint: "Choose how duplicates are handled, then start.",
|
|
30
|
+
sample: "Download a sample file",
|
|
31
|
+
parsing: "Reading file…",
|
|
32
|
+
parseFailed: "Couldn't read this file",
|
|
33
|
+
noFile: "Choose a file to continue",
|
|
34
|
+
noRows: "The file has no data rows",
|
|
35
|
+
tooMany: "This file has {count} rows; the limit is {max}.",
|
|
36
|
+
fileSummary: "{rows} rows · {columns} columns",
|
|
37
|
+
encoding: "Encoding",
|
|
38
|
+
delimiter: "Delimiter",
|
|
39
|
+
sheet: "Sheet",
|
|
40
|
+
header: "First row is a header",
|
|
41
|
+
fileLocale: "Number and date format",
|
|
42
|
+
fileLocaleHint: "How the file writes 1,234.50 and dates.",
|
|
43
|
+
garbled: "Characters look wrong?",
|
|
44
|
+
garbledBody: "This file may use a Turkish Windows encoding.",
|
|
45
|
+
tryEncoding: "Try Turkish (Windows-1254)",
|
|
46
|
+
column: "Column",
|
|
47
|
+
sampleValue: "Sample",
|
|
48
|
+
field: "Field",
|
|
49
|
+
mapsTo: "Column “{column}” maps to",
|
|
50
|
+
ignore: "Don't import",
|
|
51
|
+
required: "Required",
|
|
52
|
+
unmapped: "Map the required fields: {fields}",
|
|
53
|
+
mappedCount: "{mapped} of {total} columns mapped",
|
|
54
|
+
template: "Mapping template",
|
|
55
|
+
applyTemplate: "Apply a template",
|
|
56
|
+
saveTemplate: "Save mapping",
|
|
57
|
+
templateName: "Template name",
|
|
58
|
+
templateSaved: "Template saved",
|
|
59
|
+
templatePlaceholder: "e.g. Legacy CRM export",
|
|
60
|
+
encUtf8: "UTF-8",
|
|
61
|
+
enc1254: "Turkish (Windows-1254)",
|
|
62
|
+
enc1252: "Western (Windows-1252)",
|
|
63
|
+
delimComma: "Comma ( , )",
|
|
64
|
+
delimSemicolon: "Semicolon ( ; )",
|
|
65
|
+
delimTab: "Tab",
|
|
66
|
+
counts: "{rows} rows · {errors} errors · {warnings} warnings",
|
|
67
|
+
onlyErrors: "Only rows with problems",
|
|
68
|
+
nextError: "Next error",
|
|
69
|
+
showing: "Showing {shown} of {total}",
|
|
70
|
+
row: "Row",
|
|
71
|
+
fix: "{field}, row {row}",
|
|
72
|
+
allInvalid: "Every row has errors. Fix them or go back to the mapping.",
|
|
73
|
+
strategy: "When a record already exists",
|
|
74
|
+
skip: "Skip it",
|
|
75
|
+
skipHint: "Keep what's there; import only new records.",
|
|
76
|
+
update: "Update it",
|
|
77
|
+
updateHint: "Overwrite matching records with the file's values.",
|
|
78
|
+
create: "Create a copy",
|
|
79
|
+
createHint: "Import every row as a new record.",
|
|
80
|
+
dryRun: "Dry run",
|
|
81
|
+
dryRunHint: "Validate against the server without writing anything.",
|
|
82
|
+
willImport: "{valid} rows will be imported · {skipped} skipped for errors",
|
|
83
|
+
start: "Import {count} rows",
|
|
84
|
+
startDry: "Run a dry run",
|
|
85
|
+
importing: "Importing {done} of {total}…",
|
|
86
|
+
cancel: "Cancel import",
|
|
87
|
+
cancelled: "Import cancelled after {done} rows",
|
|
88
|
+
leave: "An import is running. Leave anyway?",
|
|
89
|
+
reportTitle: "Import finished",
|
|
90
|
+
reportDry: "Dry run finished — nothing was written",
|
|
91
|
+
reportPartial: "Import finished with problems",
|
|
92
|
+
reportSummary: "{ok} imported · {failed} failed · {skipped} skipped",
|
|
93
|
+
failedRows: "Failed rows",
|
|
94
|
+
error: "Error",
|
|
95
|
+
downloadFailed: "Download failed rows",
|
|
96
|
+
again: "Import another file",
|
|
97
|
+
done: "Done",
|
|
98
|
+
};
|
|
99
|
+
const DEFAULT_LOCALES = [
|
|
100
|
+
{ value: "en-US", label: "English (US) · 1,234.50 · 11/10/2026" },
|
|
101
|
+
{ value: "en-GB", label: "English (UK) · 1,234.50 · 10/11/2026" },
|
|
102
|
+
{ value: "tr-TR", label: "Türkçe · 1.234,50 · 10.11.2026" },
|
|
103
|
+
{ value: "de-DE", label: "Deutsch · 1.234,50 · 10.11.2026" },
|
|
104
|
+
];
|
|
105
|
+
/**
|
|
106
|
+
* Imports CSV / XLSX into any collection: upload (encoding, delimiter, sheet, header) → column
|
|
107
|
+
* mapping (auto + templates) → review with inline fixes → duplicate strategy, dry run and a
|
|
108
|
+
* chunked, cancellable import → report with a failed-rows download. Built on Multi-step form.
|
|
109
|
+
*
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <ImportWizard fields={contactFields} dedupeKeys={["email"]} onImport={(rows, { signal }) => api.contacts.bulk(rows, { signal })} />
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export const ImportWizard = React.forwardRef(function ImportWizard({ fields, dedupeKeys, maxRows = 50_000, maxSize = 20 * 1024 * 1024, chunkSize = 200, onImport, templates, sampleFile, fileLocales, onDone, previewLimit = 200, labels, className, ...props }, ref) {
|
|
115
|
+
const t = useLabels("importWizard", importWizardLabels, labels);
|
|
116
|
+
const { locale, format } = useLocale();
|
|
117
|
+
const [step, setStep] = React.useState("upload");
|
|
118
|
+
const [uploads, setUploads] = React.useState([]);
|
|
119
|
+
const [file, setFile] = React.useState(null);
|
|
120
|
+
const [parsing, setParsing] = React.useState(false);
|
|
121
|
+
const [parseError, setParseError] = React.useState(null);
|
|
122
|
+
const [encoding, setEncoding] = React.useState("utf-8");
|
|
123
|
+
const [delimiter, setDelimiter] = React.useState(",");
|
|
124
|
+
const [sheet, setSheet] = React.useState(0);
|
|
125
|
+
const [hasHeader, setHasHeader] = React.useState(true);
|
|
126
|
+
const [fileLocale, setFileLocale] = React.useState(locale);
|
|
127
|
+
const [table, setTable] = React.useState([]);
|
|
128
|
+
const [garbled, setGarbled] = React.useState(false);
|
|
129
|
+
const [mapping, setMapping] = React.useState({});
|
|
130
|
+
const [edits, setEdits] = React.useState({});
|
|
131
|
+
const [onlyErrors, setOnlyErrors] = React.useState(false);
|
|
132
|
+
const [strategy, setStrategy] = React.useState("skip");
|
|
133
|
+
const [dryRun, setDryRun] = React.useState(false);
|
|
134
|
+
const [progress, setProgress] = React.useState(null);
|
|
135
|
+
const [report, setReport] = React.useState(null);
|
|
136
|
+
const [tplList, setTplList] = React.useState([]);
|
|
137
|
+
const [tplName, setTplName] = React.useState("");
|
|
138
|
+
const [tplNote, setTplNote] = React.useState("");
|
|
139
|
+
const abortRef = React.useRef(null);
|
|
140
|
+
const reviewRef = React.useRef(null);
|
|
141
|
+
const localeItems = React.useMemo(() => {
|
|
142
|
+
const list = fileLocales ?? DEFAULT_LOCALES;
|
|
143
|
+
return list.some((l) => l.value === locale) ? list : [{ value: locale, label: locale }, ...list];
|
|
144
|
+
}, [fileLocales, locale]);
|
|
145
|
+
React.useEffect(() => {
|
|
146
|
+
if (templates)
|
|
147
|
+
void templates.list().then(setTplList).catch(() => setTplList([]));
|
|
148
|
+
}, [templates]);
|
|
149
|
+
const headers = React.useMemo(() => (hasHeader ? (table[0] ?? []) : (table[0] ?? []).map((_, i) => `${t("column")} ${i + 1}`)), [table, hasHeader, t]);
|
|
150
|
+
const body = React.useMemo(() => (hasHeader ? table.slice(1) : table), [table, hasHeader]);
|
|
151
|
+
// Re-parse when the CSV options or sheet change.
|
|
152
|
+
const load = React.useCallback(async (f, enc, delim, sheetIndex) => {
|
|
153
|
+
setParsing(true);
|
|
154
|
+
setParseError(null);
|
|
155
|
+
try {
|
|
156
|
+
let rows;
|
|
157
|
+
if (f.kind === "csv") {
|
|
158
|
+
const text = decodeText(f.bytes, enc);
|
|
159
|
+
setGarbled(enc === "utf-8" ? looksGarbled(text) : false);
|
|
160
|
+
rows = await parseCsv(text, delim);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
rows = f.sheets?.[sheetIndex]?.rows ?? [];
|
|
164
|
+
setGarbled(false);
|
|
165
|
+
}
|
|
166
|
+
setTable(rows);
|
|
167
|
+
setEdits({});
|
|
168
|
+
const hdr = rows[0] ?? [];
|
|
169
|
+
setMapping(autoMap(hdr, fields, locale));
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
setParseError(e instanceof Error ? e.message : String(e));
|
|
173
|
+
setTable([]);
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
setParsing(false);
|
|
177
|
+
}
|
|
178
|
+
}, [fields, locale]);
|
|
179
|
+
const onFiles = async (files) => {
|
|
180
|
+
setUploads(files);
|
|
181
|
+
const raw = files[0]?.file;
|
|
182
|
+
if (!raw) {
|
|
183
|
+
setFile(null);
|
|
184
|
+
setTable([]);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
setParsing(true);
|
|
188
|
+
setParseError(null);
|
|
189
|
+
try {
|
|
190
|
+
const isXlsx = /\.xlsx$/i.test(raw.name) || raw.type.includes("spreadsheetml");
|
|
191
|
+
if (isXlsx) {
|
|
192
|
+
const sheets = await readXlsx(raw);
|
|
193
|
+
const f = { name: raw.name, kind: "xlsx", sheets };
|
|
194
|
+
setFile(f);
|
|
195
|
+
setSheet(0);
|
|
196
|
+
await load(f, encoding, delimiter, 0);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const bytes = new Uint8Array(await raw.arrayBuffer());
|
|
200
|
+
const sniff = sniffCsv(bytes);
|
|
201
|
+
const f = { name: raw.name, kind: "csv", bytes };
|
|
202
|
+
setFile(f);
|
|
203
|
+
setEncoding(sniff.encoding);
|
|
204
|
+
setDelimiter(sniff.delimiter);
|
|
205
|
+
if (sniff.encoding === "windows-1254" || sniff.delimiter === ";")
|
|
206
|
+
setFileLocale(localeItems.find((l) => l.value.startsWith("tr"))?.value ?? fileLocale);
|
|
207
|
+
await load(f, sniff.encoding, sniff.delimiter, 0);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
setParseError(e instanceof Error ? e.message : String(e));
|
|
212
|
+
setParsing(false);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const results = React.useMemo(() => {
|
|
216
|
+
const base = validateImport(body, mapping, fields, { locale: fileLocale, dedupeKeys });
|
|
217
|
+
if (!Object.keys(edits).length)
|
|
218
|
+
return base;
|
|
219
|
+
const byId = new Map(fields.map((f) => [f.id, f]));
|
|
220
|
+
return base.map((r, i) => (edits[i] ? validateImportRow({ ...r.raw, ...edits[i] }, r.row, byId, { locale: fileLocale }) : r));
|
|
221
|
+
}, [body, mapping, fields, fileLocale, dedupeKeys, edits]);
|
|
222
|
+
const errorRows = results.filter((r) => Object.keys(r.errors).length);
|
|
223
|
+
const errorCount = results.reduce((n, r) => n + Object.keys(r.errors).length, 0);
|
|
224
|
+
const warningCount = results.reduce((n, r) => n + Object.keys(r.warnings).length, 0);
|
|
225
|
+
const validRows = results.filter((r) => !Object.keys(r.errors).length);
|
|
226
|
+
const mappedFields = fields.filter((f) => Object.values(mapping).includes(f.id));
|
|
227
|
+
const missingRequired = fields.filter((f) => f.required && !Object.values(mapping).includes(f.id));
|
|
228
|
+
const steps = [
|
|
229
|
+
{
|
|
230
|
+
id: "upload",
|
|
231
|
+
title: t("stepUpload"),
|
|
232
|
+
description: t("stepUploadHint"),
|
|
233
|
+
validate: () => {
|
|
234
|
+
if (parseError)
|
|
235
|
+
return parseError;
|
|
236
|
+
if (!file)
|
|
237
|
+
return t("noFile");
|
|
238
|
+
if (!body.length)
|
|
239
|
+
return t("noRows");
|
|
240
|
+
if (body.length > maxRows)
|
|
241
|
+
return t("tooMany", { count: format.number(body.length), max: format.number(maxRows) });
|
|
242
|
+
return true;
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "map",
|
|
247
|
+
title: t("stepMap"),
|
|
248
|
+
description: t("stepMapHint"),
|
|
249
|
+
validate: () => (missingRequired.length ? t("unmapped", { fields: format.list(missingRequired.map((f) => f.label)) }) : true),
|
|
250
|
+
},
|
|
251
|
+
{ id: "review", title: t("stepReview"), description: t("stepReviewHint"), validate: () => (validRows.length ? true : t("allInvalid")) },
|
|
252
|
+
{ id: "import", title: t("stepImport"), description: t("stepImportHint") },
|
|
253
|
+
];
|
|
254
|
+
const runImport = async () => {
|
|
255
|
+
const ctrl = new AbortController();
|
|
256
|
+
abortRef.current = ctrl;
|
|
257
|
+
const total = validRows.length;
|
|
258
|
+
let ok = 0;
|
|
259
|
+
const failed = [];
|
|
260
|
+
setProgress({ done: 0, total });
|
|
261
|
+
let cancelled = false;
|
|
262
|
+
try {
|
|
263
|
+
for (let offset = 0; offset < total; offset += chunkSize) {
|
|
264
|
+
if (ctrl.signal.aborted) {
|
|
265
|
+
cancelled = true;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
const chunk = validRows.slice(offset, offset + chunkSize);
|
|
269
|
+
const res = await onImport(chunk.map((r) => r.values), { signal: ctrl.signal, strategy, dryRun, offset, onProgress: (d) => setProgress({ done: offset + d, total }) });
|
|
270
|
+
ok += res.ok;
|
|
271
|
+
for (const f of res.failed) {
|
|
272
|
+
const src = chunk[f.row];
|
|
273
|
+
if (src)
|
|
274
|
+
failed.push({ row: src.row, error: f.error, raw: src.raw });
|
|
275
|
+
}
|
|
276
|
+
setProgress({ done: Math.min(total, offset + chunk.length), total });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (e) {
|
|
280
|
+
if (ctrl.signal.aborted)
|
|
281
|
+
cancelled = true;
|
|
282
|
+
else
|
|
283
|
+
throw e;
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
abortRef.current = null;
|
|
287
|
+
}
|
|
288
|
+
setReport({ ok, failed, skipped: results.length - validRows.length, dryRun, cancelled });
|
|
289
|
+
setProgress(null);
|
|
290
|
+
};
|
|
291
|
+
const reset = () => {
|
|
292
|
+
setUploads([]);
|
|
293
|
+
setFile(null);
|
|
294
|
+
setTable([]);
|
|
295
|
+
setMapping({});
|
|
296
|
+
setEdits({});
|
|
297
|
+
setReport(null);
|
|
298
|
+
setStep("upload");
|
|
299
|
+
};
|
|
300
|
+
const downloadFailed = () => {
|
|
301
|
+
if (!report)
|
|
302
|
+
return;
|
|
303
|
+
const cols = fields.filter((f) => mappedFields.includes(f));
|
|
304
|
+
const csv = toCsv([[t("row"), ...cols.map((c) => c.label), t("error")], ...report.failed.map((f) => [f.row, ...cols.map((c) => f.raw[c.id] ?? ""), f.error])], { locale: fileLocale });
|
|
305
|
+
downloadBlob(new Blob([csv], { type: "text/csv;charset=utf-8" }), `${(file?.name ?? "import").replace(/\.[^.]+$/, "")}-failed.csv`);
|
|
306
|
+
};
|
|
307
|
+
// F8 → next error cell in the review table.
|
|
308
|
+
const nextError = () => {
|
|
309
|
+
const cells = Array.from(reviewRef.current?.querySelectorAll('input[aria-invalid="true"]') ?? []);
|
|
310
|
+
if (!cells.length)
|
|
311
|
+
return;
|
|
312
|
+
const i = cells.indexOf(document.activeElement);
|
|
313
|
+
cells[(i + 1) % cells.length].focus();
|
|
314
|
+
};
|
|
315
|
+
const importing = progress !== null;
|
|
316
|
+
return (_jsx("div", { ref: ref, "data-slot": "import-wizard", className: cn("vui-import min-w-0", className), ...props, children: _jsxs(MultiStepForm, { steps: steps, value: step, onValueChange: setStep, onComplete: runImport, confirmLeave: importing, labels: { leave: t("leave") }, children: [_jsx(MultiStepFormStepper, {}), _jsx(MultiStepFormStep, { id: "upload", children: _jsxs("div", { className: "flex flex-col gap-5", children: [_jsx(FileUpload, { accept: [".csv", ".tsv", ".txt", ".xlsx", "text/csv"], maxFiles: 1, maxSize: maxSize, value: uploads, onValueChange: (f) => void onFiles(f), invalid: !!parseError }), sampleFile ? (_jsxs("a", { href: sampleFile.href, download: sampleFile.name, className: "focus-ring inline-flex w-fit items-center gap-1.5 rounded-ui-sm text-[13px] text-accent-ink underline-offset-4 hover:underline", children: [_jsx(Download, { "aria-hidden": true, className: "size-3.5" }), " ", t("sample")] })) : null, parsing ? (_jsx("p", { className: "text-sm text-fg-muted", role: "status", children: t("parsing") })) : null, parseError ? (_jsx(Alert, { tone: "danger", title: t("parseFailed"), live: "assertive", children: parseError })) : null, garbled && file?.kind === "csv" ? (_jsx(Alert, { tone: "warning", title: t("garbled"), live: "polite", actions: _jsx(Button, { size: "sm", variant: "secondary", onClick: () => { setEncoding("windows-1254"); void load(file, "windows-1254", delimiter, sheet); }, children: t("tryEncoding") }), children: t("garbledBody") })) : null, file && table.length ? (_jsxs("div", { className: "rounded-ui-lg surface-2 p-4", children: [_jsxs("p", { className: "mb-4 flex items-center gap-2 text-sm text-fg", children: [_jsx(FileSpreadsheet, { "aria-hidden": true, className: "size-4 text-fg-muted" }), _jsx("span", { className: "font-medium", children: file.name }), _jsxs("span", { className: "text-fg-muted tabular", children: ["\u00B7 ", t("fileSummary", { rows: format.number(body.length), columns: headers.length })] })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [file.kind === "csv" ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t("encoding"), children: _jsx(Select, { value: encoding, onValueChange: (v) => {
|
|
317
|
+
if (!v)
|
|
318
|
+
return;
|
|
319
|
+
setEncoding(v);
|
|
320
|
+
void load(file, v, delimiter, sheet);
|
|
321
|
+
}, items: [
|
|
322
|
+
{ value: "utf-8", label: t("encUtf8") },
|
|
323
|
+
{ value: "windows-1254", label: t("enc1254") },
|
|
324
|
+
{ value: "windows-1252", label: t("enc1252") },
|
|
325
|
+
] }) }), _jsx(Field, { label: t("delimiter"), children: _jsx(Select, { value: delimiter, onValueChange: (v) => {
|
|
326
|
+
if (!v)
|
|
327
|
+
return;
|
|
328
|
+
const d = v;
|
|
329
|
+
setDelimiter(d);
|
|
330
|
+
void load(file, encoding, d, sheet);
|
|
331
|
+
}, items: [
|
|
332
|
+
{ value: ",", label: t("delimComma") },
|
|
333
|
+
{ value: ";", label: t("delimSemicolon") },
|
|
334
|
+
{ value: "\t", label: t("delimTab") },
|
|
335
|
+
] }) })] })) : (file.sheets?.length ?? 0) > 1 ? (_jsx(Field, { label: t("sheet"), children: _jsx(Select, { value: String(sheet), onValueChange: (v) => {
|
|
336
|
+
const i = Number(v ?? 0);
|
|
337
|
+
setSheet(i);
|
|
338
|
+
void load(file, encoding, delimiter, i);
|
|
339
|
+
}, items: (file.sheets ?? []).map((s, i) => ({ value: String(i), label: `${s.name} · ${format.number(Math.max(0, s.rows.length - 1))}` })) }) })) : null, _jsx(Field, { label: t("fileLocale"), hint: t("fileLocaleHint"), children: _jsx(Select, { value: fileLocale, onValueChange: (v) => v && setFileLocale(v), items: localeItems }) }), _jsx("div", { className: "flex items-end pb-2", children: _jsx(Checkbox, { checked: hasHeader, onCheckedChange: (c) => { setHasHeader(c === true); setMapping(autoMap(c === true ? (table[0] ?? []) : [], fields, locale)); }, label: t("header") }) })] })] })) : null] }) }), _jsx(MultiStepFormStep, { id: "map", children: _jsx(ImportMapping, { headers: headers, sample: body[0] ?? [], fields: fields, mapping: mapping, onMappingChange: setMapping, t: t, toolbar: templates ? (_jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [tplList.length ? (_jsx(Field, { label: t("template"), className: "min-w-48", children: _jsx(Select, { placeholder: t("applyTemplate"), value: null, onValueChange: (id) => {
|
|
340
|
+
const tpl = tplList.find((x) => x.id === id);
|
|
341
|
+
if (tpl)
|
|
342
|
+
setMapping(applyTemplate(headers, tpl, locale));
|
|
343
|
+
}, items: tplList.map((x) => ({ value: x.id, label: x.name })) }) })) : null, _jsx(Field, { label: t("templateName"), className: "min-w-40", children: _jsx(Input, { value: tplName, onChange: (e) => setTplName(e.target.value), placeholder: t("templatePlaceholder") }) }), _jsxs(Button, { variant: "secondary", disabled: !tplName.trim(), onClick: async () => {
|
|
344
|
+
const tpl = { id: `tpl-${Date.now().toString(36)}`, name: tplName.trim(), mapping: mappingToTemplate(headers, mapping, locale) };
|
|
345
|
+
await templates.save(tpl);
|
|
346
|
+
setTplList((l) => [...l, tpl]);
|
|
347
|
+
setTplName("");
|
|
348
|
+
setTplNote(t("templateSaved"));
|
|
349
|
+
}, children: [_jsx(Save, {}), " ", t("saveTemplate")] }), _jsx("span", { className: "text-xs text-fg-muted", "aria-live": "polite", children: tplNote })] })) : null }) }), _jsx(MultiStepFormStep, { id: "review", children: _jsx("div", { ref: reviewRef, onKeyDown: (e) => {
|
|
350
|
+
if (e.key === "F8") {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
nextError();
|
|
353
|
+
}
|
|
354
|
+
}, children: _jsx(ImportReview, { results: results, fields: mappedFields, onlyErrors: onlyErrors, onOnlyErrorsChange: setOnlyErrors, errorCount: errorCount, warningCount: warningCount, errorRowCount: errorRows.length, onFix: (index, field, v) => setEdits((e) => ({ ...e, [index]: { ...e[index], [field]: v } })), onNextError: nextError, limit: previewLimit, t: t }) }) }), _jsx(MultiStepFormStep, { id: "import", children: report ? (_jsx(ImportReportView, { report: report, fields: mappedFields, t: t, onDownload: downloadFailed, onAgain: reset, onDone: onDone ? () => onDone(report) : undefined })) : (_jsxs("div", { className: "flex flex-col gap-5", children: [_jsx("p", { className: "text-sm text-fg tabular", "aria-live": "polite", children: t("willImport", { valid: format.number(validRows.length), skipped: format.number(results.length - validRows.length) }) }), dedupeKeys?.length ? (_jsxs("fieldset", { className: "m-0 border-0 p-0", children: [_jsx("legend", { className: "mb-2 text-[13px] font-medium text-fg", children: t("strategy") }), _jsx(RadioGroup, { value: strategy, onValueChange: setStrategy, variant: "card", size: "sm", "aria-label": t("strategy"), className: "grid gap-2 sm:grid-cols-3", disabled: importing, items: [
|
|
355
|
+
{ value: "skip", label: t("skip"), description: t("skipHint") },
|
|
356
|
+
{ value: "update", label: t("update"), description: t("updateHint") },
|
|
357
|
+
{ value: "create", label: t("create"), description: t("createHint") },
|
|
358
|
+
] })] })) : null, _jsx(Checkbox, { checked: dryRun, onCheckedChange: (c) => setDryRun(c === true), label: t("dryRun"), description: t("dryRunHint"), disabled: importing }), progress ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-ui-lg surface-2 p-4", children: [_jsx(Progress, { value: progress.total ? (progress.done / progress.total) * 100 : null, "aria-label": t("importing", { done: progress.done, total: progress.total }) }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-[13px] text-fg-muted tabular", "aria-live": "polite", children: t("importing", { done: format.number(progress.done), total: format.number(progress.total) }) }), _jsxs(Button, { size: "sm", variant: "ghost", onClick: () => abortRef.current?.abort(), children: [_jsx(X, {}), " ", t("cancel")] })] })] })) : null] })) }), report ? null : _jsx(MultiStepFormFooter, { submitLabel: dryRun ? t("startDry") : t("start", { count: format.number(validRows.length) }) })] }) }));
|
|
359
|
+
});
|
|
360
|
+
/** Column → field mapping: one labelled Select per file column. Usable alone. */
|
|
361
|
+
export function ImportMapping({ headers, sample = [], fields, mapping, onMappingChange, toolbar, labels, t: tProp }) {
|
|
362
|
+
const own = useLabels("importWizard", importWizardLabels, labels);
|
|
363
|
+
const t = tProp ?? own;
|
|
364
|
+
const used = new Set(Object.values(mapping).filter(Boolean));
|
|
365
|
+
const mapped = Object.values(mapping).filter(Boolean).length;
|
|
366
|
+
const missing = fields.filter((f) => f.required && !used.has(f.id));
|
|
367
|
+
return (_jsxs("div", { "data-slot": "import-mapping", className: "flex flex-col gap-4", children: [toolbar, _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-[13px] text-fg-muted tabular", children: [t("mappedCount", { mapped, total: headers.length }), missing.map((f) => (_jsxs(Badge, { tone: "danger", size: "sm", children: [f.label, " \u00B7 ", t("required")] }, f.id)))] }), _jsx("ul", { className: "m-0 flex list-none flex-col divide-y divide-line rounded-ui-lg border border-line p-0", children: headers.map((h, i) => {
|
|
368
|
+
const id = `import-map-${i}`;
|
|
369
|
+
const value = mapping[i] ?? "__ignore";
|
|
370
|
+
return (_jsxs("li", { className: "grid grid-cols-1 items-center gap-x-4 gap-y-1.5 px-3.5 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,15rem)]", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("label", { htmlFor: id, className: "block truncate text-[13px] font-medium text-fg", children: [h || `${t("column")} ${i + 1}`, _jsxs("span", { className: "sr-only", children: [" \u2192 ", t("field")] })] }), _jsx("p", { className: "truncate font-mono text-[11px] text-fg-subtle", children: sample[i] || "—" })] }), _jsx(ArrowRight, { "aria-hidden": true, className: "hidden size-4 text-fg-subtle sm:block rtl:rotate-180" }), _jsx(Select, { id: id, size: "sm", value: value, "aria-label": t("mapsTo", { column: h }), onValueChange: (v) => onMappingChange({ ...mapping, [i]: !v || v === "__ignore" ? null : v }), items: [
|
|
371
|
+
{ value: "__ignore", label: t("ignore") },
|
|
372
|
+
...fields.map((f) => ({ value: f.id, label: f.required ? `${f.label} *` : f.label, disabled: used.has(f.id) && mapping[i] !== f.id })),
|
|
373
|
+
] })] }, i));
|
|
374
|
+
}) })] }));
|
|
375
|
+
}
|
|
376
|
+
/** Validation preview: counts, an "only problems" filter and editable error cells (F8 = next error). */
|
|
377
|
+
export function ImportReview({ results, fields, onlyErrors, onOnlyErrorsChange, errorCount, warningCount, errorRowCount, onFix, onNextError, limit = 200, labels, t: tProp }) {
|
|
378
|
+
const own = useLabels("importWizard", importWizardLabels, labels);
|
|
379
|
+
const t = tProp ?? own;
|
|
380
|
+
const { format } = useLocale();
|
|
381
|
+
const indexed = results.map((r, i) => ({ r, i }));
|
|
382
|
+
const filtered = onlyErrors ? indexed.filter(({ r }) => Object.keys(r.errors).length || Object.keys(r.warnings).length) : indexed;
|
|
383
|
+
const shown = filtered.slice(0, limit);
|
|
384
|
+
return (_jsxs("div", { "data-slot": "import-review", className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsxs("p", { className: "me-auto flex items-center gap-2 text-sm text-fg tabular", "aria-live": "polite", children: [errorCount ? _jsx(CircleAlert, { "aria-hidden": true, className: "size-4 text-danger" }) : _jsx(CircleCheck, { "aria-hidden": true, className: "size-4 text-success" }), t("counts", { rows: format.number(results.length), errors: format.number(errorCount), warnings: format.number(warningCount) })] }), _jsx(Checkbox, { size: "sm", checked: onlyErrors, onCheckedChange: (c) => onOnlyErrorsChange(c === true), label: _jsx("span", { className: "text-[13px]", children: t("onlyErrors") }), disabled: !errorRowCount && !warningCount }), onNextError ? (_jsxs(Button, { size: "sm", variant: "secondary", onClick: onNextError, disabled: !errorCount, children: [t("nextError"), " ", _jsx("kbd", { className: "ms-1 font-mono text-[10px] text-fg-subtle", children: "F8" })] })) : null] }), _jsx("div", { className: "max-h-[26rem] overflow-auto rounded-ui-lg border border-line bg-surface", children: _jsxs("table", { className: "w-full border-separate border-spacing-0 text-[13px]", children: [_jsx("caption", { className: "sr-only", children: t("stepReview") }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "vui-pm-sticky sticky top-0 z-10 w-14 border-b border-line px-3 py-2 text-start text-[11px] font-medium text-fg-subtle", children: t("row") }), fields.map((f) => (_jsx("th", { scope: "col", className: "vui-pm-sticky sticky top-0 z-10 min-w-36 border-b border-line px-3 py-2 text-start text-[11px] font-medium tracking-[0.04em] text-fg-subtle uppercase", children: f.label }, f.id)))] }) }), _jsx("tbody", { children: shown.map(({ r, i }) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", className: "border-b border-line px-3 py-1.5 text-start font-mono text-[11px] font-normal text-fg-subtle tabular", children: r.row }), fields.map((f) => {
|
|
385
|
+
const err = r.errors[f.id];
|
|
386
|
+
const warn = r.warnings[f.id];
|
|
387
|
+
const v = r.raw[f.id] ?? "";
|
|
388
|
+
return (_jsx("td", { "data-error": err ? "" : undefined, "data-warning": warn && !err ? "" : undefined, className: "vui-import-cell border-b border-line px-1.5 py-1 align-top", children: err && onFix ? (_jsxs(_Fragment, { children: [_jsx(Input, { size: "sm", variant: "ghost", defaultValue: v, invalid: true, "aria-label": t("fix", { field: f.label, row: r.row }), "aria-describedby": `ie-${r.row}-${f.id}`, onBlur: (e) => e.target.value !== v && onFix(i, f.id, e.target.value), onKeyDown: (e) => e.key === "Enter" && e.target.blur() }), _jsx("p", { id: `ie-${r.row}-${f.id}`, className: "px-1.5 pt-0.5 text-[11px] text-danger", children: err })] })) : (_jsxs("span", { className: "block px-1.5 py-1 text-fg [overflow-wrap:anywhere]", children: [v || _jsx("span", { className: "text-fg-subtle", children: "\u2014" }), err ? _jsx("span", { className: "block text-[11px] text-danger", children: err }) : null, warn ? _jsx("span", { className: "block text-[11px] text-warning", children: warn }) : null] })) }, f.id));
|
|
389
|
+
})] }, r.row))) })] }) }), filtered.length > shown.length ? _jsx("p", { className: "text-xs text-fg-subtle tabular", children: t("showing", { shown: format.number(shown.length), total: format.number(filtered.length) }) }) : null] }));
|
|
390
|
+
}
|
|
391
|
+
/* ------------------------------------------------------------------ */
|
|
392
|
+
/* Report */
|
|
393
|
+
/* ------------------------------------------------------------------ */
|
|
394
|
+
function ImportReportView({ report, fields, t, onDownload, onAgain, onDone }) {
|
|
395
|
+
const { format } = useLocale();
|
|
396
|
+
const headingRef = React.useRef(null);
|
|
397
|
+
React.useEffect(() => headingRef.current?.focus(), []);
|
|
398
|
+
const title = report.cancelled ? t("cancelled", { done: format.number(report.ok + report.failed.length) }) : report.dryRun ? t("reportDry") : report.failed.length ? t("reportPartial") : t("reportTitle");
|
|
399
|
+
return (_jsxs("div", { "data-slot": "import-report", className: "flex flex-col gap-4", children: [_jsxs("div", { className: cn("flex items-start gap-3 rounded-ui-lg p-4", report.failed.length ? "tone-warning tone-soft" : "tone-success tone-soft"), children: [report.failed.length ? _jsx(CircleAlert, { "aria-hidden": true, className: "mt-0.5 size-5 shrink-0" }) : _jsx(CircleCheck, { "aria-hidden": true, className: "mt-0.5 size-5 shrink-0" }), _jsxs("div", { children: [_jsx("h3", { ref: headingRef, tabIndex: -1, className: "text-[15px] font-semibold text-fg outline-none", children: title }), _jsx("p", { className: "mt-0.5 text-sm text-fg tabular", children: t("reportSummary", { ok: format.number(report.ok), failed: format.number(report.failed.length), skipped: format.number(report.skipped) }) })] })] }), report.failed.length ? (_jsx("div", { className: "overflow-auto rounded-ui-lg border border-line", children: _jsxs("table", { className: "w-full text-[13px]", children: [_jsx("caption", { className: "px-3 py-2 text-start text-[13px] font-medium text-fg", children: t("failedRows") }), _jsx("thead", { children: _jsxs("tr", { className: "border-y border-line text-[11px] text-fg-subtle", children: [_jsx("th", { scope: "col", className: "px-3 py-1.5 text-start font-medium", children: t("row") }), fields.slice(0, 3).map((f) => (_jsx("th", { scope: "col", className: "px-3 py-1.5 text-start font-medium", children: f.label }, f.id))), _jsx("th", { scope: "col", className: "px-3 py-1.5 text-start font-medium", children: t("error") })] }) }), _jsx("tbody", { children: report.failed.slice(0, 50).map((f) => (_jsxs("tr", { className: "border-b border-line last:border-0", children: [_jsx("td", { className: "px-3 py-1.5 font-mono text-[11px] text-fg-subtle tabular", children: f.row }), fields.slice(0, 3).map((c) => (_jsx("td", { className: "px-3 py-1.5 text-fg", children: f.raw[c.id] }, c.id))), _jsx("td", { className: "px-3 py-1.5 text-danger", children: f.error })] }, f.row))) })] }) })) : null, _jsxs("div", { className: "flex flex-wrap gap-2", children: [report.failed.length ? (_jsxs(Button, { variant: "secondary", onClick: onDownload, children: [_jsx(Download, {}), " ", t("downloadFailed")] })) : null, _jsxs(Button, { variant: "ghost", onClick: onAgain, children: [_jsx(RotateCcw, {}), " ", t("again")] }), onDone ? (_jsx(Button, { variant: "primary", className: "ms-auto", onClick: onDone, children: t("done") })) : null] })] }));
|
|
400
|
+
}
|
|
401
|
+
export { importCellMessages };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { LineItems, LineItemsSummary, lineItemsLabels, type LineItemsProps, type LineItemsSummaryProps, type LineItemsLabels, type LineItemColumn, } from "./line-items.js";
|
|
2
|
+
export { computeLineTotals, createLineItem, createLineId, isLineValid, trLineTaxPack, vatLineTaxPack, type LineItem, type LineDiscount, type LineDiscountType, type LineTaxPack, type LineTaxRate, type LineWithholding, type LineResult, type LineTotals, type ComputeLineTotalsOptions, } from "./line-items-core.js";
|
|
3
|
+
export { MultiStepForm, MultiStepFormStepper, MultiStepFormStep, MultiStepFormReview, MultiStepFormFooter, useMultiStepForm, multiStepFormLabels, type MultiStepFormProps, type MultiStepFormStepperProps, type MultiStepFormStepProps, type MultiStepFormReviewProps, type MultiStepFormReviewSection, type MultiStepFormFooterProps, type MultiStepFormLabels, type MultiStepStatus, type StepDef, } from "./multi-step-form.js";
|
|
4
|
+
export { ApprovalFlow, ApprovalStage, ApprovalSummary, ApprovalActions, approvalFlowLabels, type ApprovalFlowProps, type ApprovalStageProps, type ApprovalSummaryProps, type ApprovalActionsProps, type ApprovalFlowLabels, type ApprovalStageData, type ApprovalStageStatus, type ApprovalApprover, type ApprovalDecision, type ApprovalDecisionValue, } from "./approval-flow.js";
|
|
5
|
+
export { ImportWizard, ImportMapping, ImportReview, importWizardLabels, type ImportWizardProps, type ImportMappingProps, type ImportReviewProps, type ImportWizardLabels, type ImportContext, type ImportResult, type ImportReport, type ImportStrategy, } from "./import-wizard.js";
|
|
6
|
+
export { sniffCsv, sniffDelimiter, decodeText, looksGarbled, parseCsv, readXlsx, autoMap, parseCell, parseDateCell, validateImport, validateImportRow, applyTemplate, mappingToTemplate, importCellMessages, type ImportField, type ImportFieldType, type ImportSheet, type ImportRowResult, type ImportCellMessages, type CsvEncoding, type CsvSniff, type ParsedCell, type MappingTemplate, type ValidateImportOptions, } from "./import-core.js";
|
|
7
|
+
export { ExportDialog, ExportJobStatus, QuickExportButton, exportLabels, type ExportDialogProps, type ExportJobStatusProps, type QuickExportButtonProps, type ExportLabels, type ExportRequest, type ExportResult, type ExportJobState, type ExportScope, } from "./export.js";
|
|
8
|
+
export { exportToBlob, toExportMatrix, exportFilename, downloadBlob, maskValue, type ExportColumn, type ExportFormat, type CsvExportOptions, type ExportToBlobOptions, } from "./export-core.js";
|
|
9
|
+
export { SetupChecklist, SetupChecklistLauncher, setupChecklistLabels, type SetupChecklistProps, type SetupChecklistLauncherProps, type SetupChecklistLabels, type SetupItem, type SetupItemStatus, } from "./setup-checklist.js";
|
|
10
|
+
export { PermissionMatrix, PermissionMatrixCell, PermissionDiff, PermissionCompare, permissionMatrixLabels, type PermissionMatrixProps, type PermissionMatrixCellProps, type PermissionDiffProps, type PermissionCompareProps, type PermissionMatrixLabels, type PermissionResource, type PermissionAction, } from "./permission-matrix.js";
|
|
11
|
+
export { diffPermissions, applyDependencies, effectiveLevel, scopeRank, isGranted, setMany, setPermission, SCOPE_ORDER, type PermissionScope, type PermissionLevel, type PermissionValue, type PermissionDependency, type PermissionChange, } from "./permission-core.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Public API of @vamos-ui/react/business — line items, flows & wizards, permission matrix.
|
|
2
|
+
// Heavy parsers (papaparse, read-excel-file, write-excel-file) load lazily on first use.
|
|
3
|
+
// Line items
|
|
4
|
+
export { LineItems, LineItemsSummary, lineItemsLabels, } from "./line-items.js";
|
|
5
|
+
export { computeLineTotals, createLineItem, createLineId, isLineValid, trLineTaxPack, vatLineTaxPack, } from "./line-items-core.js";
|
|
6
|
+
// Multi-step form
|
|
7
|
+
export { MultiStepForm, MultiStepFormStepper, MultiStepFormStep, MultiStepFormReview, MultiStepFormFooter, useMultiStepForm, multiStepFormLabels, } from "./multi-step-form.js";
|
|
8
|
+
// Approval flow
|
|
9
|
+
export { ApprovalFlow, ApprovalStage, ApprovalSummary, ApprovalActions, approvalFlowLabels, } from "./approval-flow.js";
|
|
10
|
+
// Import wizard
|
|
11
|
+
export { ImportWizard, ImportMapping, ImportReview, importWizardLabels, } from "./import-wizard.js";
|
|
12
|
+
export { sniffCsv, sniffDelimiter, decodeText, looksGarbled, parseCsv, readXlsx, autoMap, parseCell, parseDateCell, validateImport, validateImportRow, applyTemplate, mappingToTemplate, importCellMessages, } from "./import-core.js";
|
|
13
|
+
// Export
|
|
14
|
+
export { ExportDialog, ExportJobStatus, QuickExportButton, exportLabels, } from "./export.js";
|
|
15
|
+
export { exportToBlob, toExportMatrix, exportFilename, downloadBlob, maskValue, } from "./export-core.js";
|
|
16
|
+
// Setup checklist
|
|
17
|
+
export { SetupChecklist, SetupChecklistLauncher, setupChecklistLabels, } from "./setup-checklist.js";
|
|
18
|
+
// Permission matrix
|
|
19
|
+
export { PermissionMatrix, PermissionMatrixCell, PermissionDiff, PermissionCompare, permissionMatrixLabels, } from "./permission-matrix.js";
|
|
20
|
+
export { diffPermissions, applyDependencies, effectiveLevel, scopeRank, isGranted, setMany, setPermission, SCOPE_ORDER, } from "./permission-core.js";
|