@vamos-ui/react 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +101 -0
- package/dist/blocks/site/_kit-1.js +137 -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 +113 -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 +52 -0
- package/dist/blocks/site/feature-grid.d.ts +46 -0
- package/dist/blocks/site/feature-grid.js +50 -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 +48 -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 +73 -0
- package/dist/blocks/site/logo-strip.d.ts +44 -0
- package/dist/blocks/site/logo-strip.js +27 -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 +56 -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 +83 -0
- package/dist/blocks/site/process.d.ts +36 -0
- package/dist/blocks/site/process.js +42 -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 +108 -0
- package/dist/blocks/site/site-shell.js +254 -0
- package/dist/blocks/site/stats-band.d.ts +42 -0
- package/dist/blocks/site/stats-band.js +45 -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 +66 -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 +12 -0
- package/dist/business/index.js +22 -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/business/signer-status.d.ts +53 -0
- package/dist/business/signer-status.js +76 -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 +46 -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/_qr-core.d.ts +26 -0
- package/dist/components/_qr-core.js +376 -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/backup-codes.d.ts +42 -0
- package/dist/components/backup-codes.js +67 -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 +281 -0
- package/dist/components/command.js +498 -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/pin-map.d.ts +58 -0
- package/dist/components/pin-map.js +167 -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/qr-code.d.ts +36 -0
- package/dist/components/qr-code.js +27 -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/sla-timer.d.ts +75 -0
- package/dist/components/sla-timer.js +142 -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/tour.d.ts +60 -0
- package/dist/components/tour.js +139 -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 +91 -0
- package/dist/index.js +92 -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 +23 -0
- package/dist/lib/public.js +34 -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 +140 -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/motion/core.d.ts +32 -0
- package/dist/motion/core.js +77 -0
- package/dist/motion/count-up.d.ts +29 -0
- package/dist/motion/count-up.js +92 -0
- package/dist/motion/index.d.ts +11 -0
- package/dist/motion/index.js +13 -0
- package/dist/motion/motion-scope.d.ts +17 -0
- package/dist/motion/motion-scope.js +16 -0
- package/dist/motion/page-transition.d.ts +33 -0
- package/dist/motion/page-transition.js +61 -0
- package/dist/motion/parallax.d.ts +37 -0
- package/dist/motion/parallax.js +90 -0
- package/dist/motion/pointer.d.ts +38 -0
- package/dist/motion/pointer.js +117 -0
- package/dist/motion/reveal.d.ts +72 -0
- package/dist/motion/reveal.js +133 -0
- package/dist/motion/scroll-shrink.d.ts +18 -0
- package/dist/motion/scroll-shrink.js +47 -0
- package/dist/motion/skeleton-swap.d.ts +17 -0
- package/dist/motion/skeleton-swap.js +43 -0
- package/dist/motion/text-reveal.d.ts +30 -0
- package/dist/motion/text-reveal.js +29 -0
- package/dist/motion/ticker.d.ts +35 -0
- package/dist/motion/ticker.js +16 -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 +105 -0
- package/dist/sortable/sortable-tree.js +462 -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/motion.css +389 -0
- package/dist/styles/navigation.css +293 -0
- package/dist/styles/overlays.css +244 -0
- package/dist/styles.css +743 -0
- package/package.json +160 -4
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Gantt: a WBS treegrid (the accessible source of truth: dates, duration, progress,
|
|
5
|
+
* predecessors, all editable inline) beside a time axis with bars, summaries, milestones,
|
|
6
|
+
* finish-to-start links, a today marker and non-working days. Drag to move / resize, drag the
|
|
7
|
+
* end handle onto another bar to link. Zoom: day · week · month · quarter.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
12
|
+
import { getWeek } from "date-fns";
|
|
13
|
+
import { ChevronRight, Diamond, GanttChartSquare } from "lucide-react";
|
|
14
|
+
import { cn } from "../lib/cn.js";
|
|
15
|
+
import { useLocale } from "../lib/locale.js";
|
|
16
|
+
import { useLabels } from "../lib/labels.js";
|
|
17
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
18
|
+
import { Button } from "../components/button.js";
|
|
19
|
+
import { ToggleGroup, ToggleGroupItem } from "../components/toggle.js";
|
|
20
|
+
import { AvatarGroup, Avatar } from "../components/avatar.js";
|
|
21
|
+
import { EmptyState } from "../components/empty-state.js";
|
|
22
|
+
import { toast } from "../components/toast.js";
|
|
23
|
+
import { usePointerDrag } from "../sortable/use-pointer-drag.js";
|
|
24
|
+
import { useTimeScale } from "../sortable/use-time-scale.js";
|
|
25
|
+
import { addDays, compareIsoDate, diffDays } from "../locale-data/core/date.js";
|
|
26
|
+
import { addWorkingDays } from "../locale-data/core/working-days.js";
|
|
27
|
+
import { getWeekInfo } from "../locale-data/core/week-info.js";
|
|
28
|
+
import { TIME_SCALE_PRESETS } from "./core/time-scale.js";
|
|
29
|
+
import { createsCycle, flattenTasks, linkViolations, moveTaskTo, rollupSummaries, scheduleForward, taskDuration, visibleTasks } from "./core/gantt.js";
|
|
30
|
+
import { clamp, fmtDay, fmtDayRange, resolveWorkCalendar, todayIn, toneColor, useAnnouncer } from "./shared.js";
|
|
31
|
+
/* ------------------------------------------------------------------ */
|
|
32
|
+
/* Types & labels */
|
|
33
|
+
/* ------------------------------------------------------------------ */
|
|
34
|
+
export const ganttLabels = {
|
|
35
|
+
plan: "Project plan",
|
|
36
|
+
task: "Task",
|
|
37
|
+
assignees: "Owner",
|
|
38
|
+
start: "Start",
|
|
39
|
+
end: "End",
|
|
40
|
+
duration: "Duration",
|
|
41
|
+
progress: "Progress",
|
|
42
|
+
predecessors: "Predecessors",
|
|
43
|
+
zoom: "Zoom",
|
|
44
|
+
day: "Day",
|
|
45
|
+
week: "Week",
|
|
46
|
+
month: "Month",
|
|
47
|
+
quarter: "Quarter",
|
|
48
|
+
today: "Today",
|
|
49
|
+
resize: "Resize task list",
|
|
50
|
+
workingDays: "{count, plural, one {# working day} other {# working days}}",
|
|
51
|
+
days: "{count, plural, one {# day} other {# days}}",
|
|
52
|
+
milestone: "Milestone",
|
|
53
|
+
summary: "Summary",
|
|
54
|
+
overdue: "overdue",
|
|
55
|
+
done: "done",
|
|
56
|
+
cycle: "That link would create a loop. It wasn't added.",
|
|
57
|
+
saveFailed: "Couldn't save the plan. Your change was undone.",
|
|
58
|
+
empty: "No tasks yet",
|
|
59
|
+
emptyHint: "Add the first task to start the plan.",
|
|
60
|
+
editHint: "Enter edits the cell, Escape cancels",
|
|
61
|
+
invalid: "Not a valid value",
|
|
62
|
+
unknownTask: "No task {wbs}",
|
|
63
|
+
moved: "{title}: {range}",
|
|
64
|
+
linked: "{from} now comes before {to}",
|
|
65
|
+
unlinked: "Link from {from} to {to} removed",
|
|
66
|
+
undo: "Undo",
|
|
67
|
+
weekShort: "W{week}",
|
|
68
|
+
quarterShort: "Q{quarter}",
|
|
69
|
+
noOwner: "Unassigned",
|
|
70
|
+
};
|
|
71
|
+
export const ganttVariants = cva("ui-gantt relative flex min-w-0 flex-col", {
|
|
72
|
+
variants: { framed: { true: "surface rounded-ui-lg", false: "" } },
|
|
73
|
+
defaultVariants: { framed: true },
|
|
74
|
+
});
|
|
75
|
+
const PAD = { day: 4, week: 14, month: 45, quarter: 90 };
|
|
76
|
+
const COL_W = { assignees: 76, start: 84, end: 84, duration: 128, progress: 76, predecessors: 104 };
|
|
77
|
+
/* ------------------------------------------------------------------ */
|
|
78
|
+
/* Component */
|
|
79
|
+
/* ------------------------------------------------------------------ */
|
|
80
|
+
/**
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <Gantt
|
|
83
|
+
* tasks={plan}
|
|
84
|
+
* links={[{ id: "l1", from: "design", to: "build", type: "FS" }]}
|
|
85
|
+
* defaultScale="week"
|
|
86
|
+
* workCalendar={trWorkCalendar}
|
|
87
|
+
* onTaskChange={(batch) => api.tasks.updateMany(batch)}
|
|
88
|
+
* />
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export const Gantt = React.forwardRef(function Gantt({ tasks, links = [], scale: scaleProp, defaultScale = "week", onScaleChange, scales = ["day", "week", "month", "quarter"], workCalendar, durationUnit = "workdays", onTaskChange, onLinkCreate, onLinkDelete, autoSchedule = true, readOnly = false, columns = ["title", "start", "end", "duration", "progress"], gridWidth: gridWidthProp, defaultGridWidth, onGridWidthChange, collapsed: collapsedProp, defaultCollapsed = [], onCollapsedChange, height = "32rem", rowHeight: rowHeightProp, virtualizeAt = 150, toolbar, today: todayProp, labels, className, ...props }, ref) {
|
|
92
|
+
const { locale, timeZone, dir } = useLocale();
|
|
93
|
+
const rtl = dir === "rtl";
|
|
94
|
+
const t = useLabels("gantt", ganttLabels, labels);
|
|
95
|
+
const [scale, setScale] = useControllableState({ value: scaleProp, defaultValue: defaultScale, onChange: onScaleChange });
|
|
96
|
+
const [collapsedList, setCollapsed] = useControllableState({ value: collapsedProp, defaultValue: defaultCollapsed, onChange: onCollapsedChange });
|
|
97
|
+
const collapsed = React.useMemo(() => new Set(collapsedList), [collapsedList]);
|
|
98
|
+
const fixedCols = columns.filter((c) => c !== "title");
|
|
99
|
+
const minGrid = 220;
|
|
100
|
+
const [gridWidth, setGridWidth] = useControllableState({ value: gridWidthProp, defaultValue: defaultGridWidth ?? Math.min(800, 232 + fixedCols.reduce((s, c) => s + COL_W[c], 0)), onChange: onGridWidthChange });
|
|
101
|
+
const cal = React.useMemo(() => resolveWorkCalendar(workCalendar, locale), [workCalendar, locale]);
|
|
102
|
+
const today = todayProp ?? todayIn(timeZone);
|
|
103
|
+
const { message, announce } = useAnnouncer();
|
|
104
|
+
const canEdit = !readOnly && Boolean(onTaskChange);
|
|
105
|
+
const canLink = !readOnly && Boolean(onLinkCreate);
|
|
106
|
+
// Optimistic task patches
|
|
107
|
+
const [patches, setPatches] = React.useState({});
|
|
108
|
+
React.useEffect(() => setPatches({}), [tasks]);
|
|
109
|
+
const patched = React.useMemo(() => (Object.keys(patches).length ? tasks.map((x) => (patches[x.id] ? { ...x, ...patches[x.id] } : x)) : tasks), [tasks, patches]);
|
|
110
|
+
const rolled = React.useMemo(() => rollupSummaries(patched), [patched]);
|
|
111
|
+
const flat = React.useMemo(() => flattenTasks(rolled), [rolled]);
|
|
112
|
+
const rows = React.useMemo(() => visibleTasks(flat, collapsed), [flat, collapsed]);
|
|
113
|
+
const byId = React.useMemo(() => new Map(flat.map((r) => [r.task.id, r])), [flat]);
|
|
114
|
+
const rowIndex = React.useMemo(() => new Map(rows.map((r, i) => [r.task.id, i])), [rows]);
|
|
115
|
+
const badLinks = React.useMemo(() => linkViolations(rolled, links), [rolled, links]);
|
|
116
|
+
// Time axis
|
|
117
|
+
const bounds = React.useMemo(() => {
|
|
118
|
+
let s;
|
|
119
|
+
let e;
|
|
120
|
+
for (const x of rolled) {
|
|
121
|
+
if (!s || compareIsoDate(x.start, s) < 0)
|
|
122
|
+
s = x.start;
|
|
123
|
+
if (!e || compareIsoDate(x.end, e) > 0)
|
|
124
|
+
e = x.end;
|
|
125
|
+
}
|
|
126
|
+
s ??= today;
|
|
127
|
+
e ??= addDays(today, 30);
|
|
128
|
+
if (compareIsoDate(today, s) < 0)
|
|
129
|
+
s = today;
|
|
130
|
+
if (compareIsoDate(today, e) > 0)
|
|
131
|
+
e = today;
|
|
132
|
+
return { start: addDays(s, -PAD[scale]), end: addDays(e, PAD[scale] + 1) };
|
|
133
|
+
}, [rolled, today, scale]);
|
|
134
|
+
const ts = useTimeScale({ start: bounds.start, end: bounds.end, scale, timeZone: "UTC", locale, workCalendar: scale === "day" ? cal : undefined });
|
|
135
|
+
const preset = TIME_SCALE_PRESETS[scale];
|
|
136
|
+
const xOf = (d) => ts.toPx(d);
|
|
137
|
+
const wOf = (s, e) => Math.max(ts.pxPerDay, ts.toPx(addDays(e, 1)) - ts.toPx(s));
|
|
138
|
+
// Row height (density aware)
|
|
139
|
+
const probe = React.useRef(null);
|
|
140
|
+
const [measuredRow, setMeasuredRow] = React.useState(36);
|
|
141
|
+
React.useLayoutEffect(() => {
|
|
142
|
+
const h = probe.current?.offsetHeight;
|
|
143
|
+
if (h && h > 10)
|
|
144
|
+
setMeasuredRow(h);
|
|
145
|
+
}, []);
|
|
146
|
+
const rowH = rowHeightProp ?? measuredRow;
|
|
147
|
+
const scrollRef = React.useRef(null);
|
|
148
|
+
const virtual = rows.length >= virtualizeAt;
|
|
149
|
+
const virtualizer = useVirtualizer({ count: rows.length, getScrollElement: () => scrollRef.current, estimateSize: () => rowH, overscan: 10, enabled: virtual });
|
|
150
|
+
const items = virtual ? virtualizer.getVirtualItems().map((v) => v.index) : rows.map((_, i) => i);
|
|
151
|
+
const bodyH = rows.length * rowH;
|
|
152
|
+
/* -------- changes -------- */
|
|
153
|
+
const commitTask = React.useCallback((id, next) => {
|
|
154
|
+
if (!onTaskChange)
|
|
155
|
+
return;
|
|
156
|
+
const base = tasks.map((x) => (patches[x.id] ? { ...x, ...patches[x.id] } : x));
|
|
157
|
+
const edited = base.map((x) => (x.id === id ? { ...x, ...next } : x));
|
|
158
|
+
const scheduled = autoSchedule ? scheduleForward(edited, links, cal, durationUnit) : edited;
|
|
159
|
+
const changes = [];
|
|
160
|
+
scheduled.forEach((x, i) => {
|
|
161
|
+
const before = base[i];
|
|
162
|
+
if (x.start !== before.start || x.end !== before.end || x.progress !== before.progress)
|
|
163
|
+
changes.push({ id: x.id, start: x.start, end: x.end, ...(x.progress !== undefined ? { progress: x.progress } : null) });
|
|
164
|
+
});
|
|
165
|
+
if (!changes.length)
|
|
166
|
+
return;
|
|
167
|
+
setPatches((p) => ({ ...p, ...Object.fromEntries(changes.map((c) => [c.id, c])) }));
|
|
168
|
+
const title = byId.get(id)?.task.title ?? "";
|
|
169
|
+
announce(t("moved", { title, range: fmtDayRange(locale, next.start, next.end, { day: "numeric", month: "short" }) }));
|
|
170
|
+
Promise.resolve()
|
|
171
|
+
.then(() => onTaskChange(changes))
|
|
172
|
+
.catch(() => {
|
|
173
|
+
setPatches({});
|
|
174
|
+
toast.danger(t("saveFailed"));
|
|
175
|
+
});
|
|
176
|
+
}, [onTaskChange, tasks, patches, autoSchedule, links, cal, durationUnit, byId, announce, t, locale]);
|
|
177
|
+
const addLink = React.useCallback((from, to) => {
|
|
178
|
+
if (!onLinkCreate || from === to || links.some((l) => l.from === from && l.to === to))
|
|
179
|
+
return;
|
|
180
|
+
if (createsCycle(links, from, to)) {
|
|
181
|
+
toast.danger(t("cycle"));
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
Promise.resolve(onLinkCreate({ from, to, type: "FS" })).catch(() => toast.danger(t("saveFailed")));
|
|
185
|
+
announce(t("linked", { from: byId.get(from)?.task.title ?? from, to: byId.get(to)?.task.title ?? to }));
|
|
186
|
+
}, [onLinkCreate, links, t, announce, byId]);
|
|
187
|
+
const removeLink = React.useCallback((id) => {
|
|
188
|
+
const l = links.find((x) => x.id === id);
|
|
189
|
+
if (!onLinkDelete || !l)
|
|
190
|
+
return;
|
|
191
|
+
Promise.resolve(onLinkDelete(id)).then(() => {
|
|
192
|
+
const msg = t("unlinked", { from: byId.get(l.from)?.task.title ?? l.from, to: byId.get(l.to)?.task.title ?? l.to });
|
|
193
|
+
if (onLinkCreate)
|
|
194
|
+
toast(msg, { action: { label: t("undo"), onClick: () => void onLinkCreate({ from: l.from, to: l.to, type: l.type ?? "FS", lagDays: l.lagDays }) } });
|
|
195
|
+
announce(msg);
|
|
196
|
+
}, () => toast.danger(t("saveFailed")));
|
|
197
|
+
}, [onLinkDelete, onLinkCreate, links, t, announce, byId]);
|
|
198
|
+
/* -------- formatting -------- */
|
|
199
|
+
const fmtDate = (d) => fmtDay(locale, d, { day: "numeric", month: "short" });
|
|
200
|
+
const durationText = (x) => {
|
|
201
|
+
if (x.type === "milestone")
|
|
202
|
+
return t("milestone");
|
|
203
|
+
const n = taskDuration(x, cal, durationUnit);
|
|
204
|
+
return durationUnit === "workdays" ? t("workingDays", { count: n }) : t("days", { count: n });
|
|
205
|
+
};
|
|
206
|
+
const pctFmt = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 });
|
|
207
|
+
const pct = { format: (v) => pctFmt.format(v).replace(/[\u202f\u00a0]/g, " ") };
|
|
208
|
+
const predecessorText = (id) => links
|
|
209
|
+
.filter((l) => l.to === id)
|
|
210
|
+
.map((l) => byId.get(l.from)?.wbs)
|
|
211
|
+
.filter(Boolean)
|
|
212
|
+
.join(", ");
|
|
213
|
+
/* -------- treegrid focus / editing -------- */
|
|
214
|
+
const colKeys = columns;
|
|
215
|
+
const [active, setActive] = React.useState({ row: 0, col: 0 });
|
|
216
|
+
const [edit, setEdit] = React.useState(null);
|
|
217
|
+
const gridRef = React.useRef(null);
|
|
218
|
+
const ar = clamp(active.row, 0, Math.max(0, rows.length - 1));
|
|
219
|
+
const ac = clamp(active.col, 0, colKeys.length - 1);
|
|
220
|
+
const focusCell = (row, col) => {
|
|
221
|
+
setActive({ row, col });
|
|
222
|
+
if (virtual)
|
|
223
|
+
virtualizer.scrollToIndex(row, { align: "auto" });
|
|
224
|
+
requestAnimationFrame(() => gridRef.current?.querySelector(`[data-gantt-cell="${row}:${col}"]`)?.focus());
|
|
225
|
+
};
|
|
226
|
+
const toggle = (id, open) => {
|
|
227
|
+
const isOpen = !collapsed.has(id);
|
|
228
|
+
const want = open ?? !isOpen;
|
|
229
|
+
if (want === isOpen)
|
|
230
|
+
return;
|
|
231
|
+
setCollapsed((list) => (want ? list.filter((x) => x !== id) : [...list, id]));
|
|
232
|
+
};
|
|
233
|
+
const isEditable = (key, task) => {
|
|
234
|
+
if (key === "predecessors")
|
|
235
|
+
return canLink || Boolean(onLinkDelete);
|
|
236
|
+
if (!canEdit || task.editable === false || task.type === "summary" || byId.get(task.id)?.hasChildren)
|
|
237
|
+
return false;
|
|
238
|
+
if (key === "duration" && task.type === "milestone")
|
|
239
|
+
return false;
|
|
240
|
+
return key === "start" || key === "end" || key === "duration" || key === "progress";
|
|
241
|
+
};
|
|
242
|
+
const startEdit = (row, col) => {
|
|
243
|
+
const r = rows[row];
|
|
244
|
+
const key = colKeys[col];
|
|
245
|
+
if (!r || !isEditable(key, r.task))
|
|
246
|
+
return false;
|
|
247
|
+
const x = r.task;
|
|
248
|
+
const value = key === "start" ? x.start : key === "end" ? x.end : key === "duration" ? String(taskDuration(x, cal, durationUnit)) : key === "progress" ? String(Math.round((x.progress ?? 0) * 100)) : predecessorText(x.id);
|
|
249
|
+
setEdit({ row, col, value });
|
|
250
|
+
return true;
|
|
251
|
+
};
|
|
252
|
+
const commitEdit = () => {
|
|
253
|
+
if (!edit)
|
|
254
|
+
return;
|
|
255
|
+
const r = rows[edit.row];
|
|
256
|
+
const x = r.task;
|
|
257
|
+
const key = colKeys[edit.col];
|
|
258
|
+
const v = edit.value.trim();
|
|
259
|
+
const fail = (msg = t("invalid")) => setEdit({ ...edit, error: msg });
|
|
260
|
+
if (key === "start") {
|
|
261
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(v))
|
|
262
|
+
return fail();
|
|
263
|
+
const moved = moveTaskTo(x, v, durationUnit === "workdays" ? cal : undefined, durationUnit);
|
|
264
|
+
commitTask(x.id, { start: moved.start, end: moved.end });
|
|
265
|
+
}
|
|
266
|
+
else if (key === "end") {
|
|
267
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(v) || compareIsoDate(v, x.start) < 0)
|
|
268
|
+
return fail();
|
|
269
|
+
commitTask(x.id, x.type === "milestone" ? { start: v, end: v } : { start: x.start, end: v });
|
|
270
|
+
}
|
|
271
|
+
else if (key === "duration") {
|
|
272
|
+
const n = Number(v);
|
|
273
|
+
if (!Number.isInteger(n) || n < 1)
|
|
274
|
+
return fail();
|
|
275
|
+
commitTask(x.id, { start: x.start, end: durationUnit === "workdays" ? addWorkingDays(x.start, n - 1, cal) : addDays(x.start, n - 1) });
|
|
276
|
+
}
|
|
277
|
+
else if (key === "progress") {
|
|
278
|
+
const n = Number(v.replace("%", "").replace(",", "."));
|
|
279
|
+
if (!Number.isFinite(n) || n < 0 || n > 100)
|
|
280
|
+
return fail();
|
|
281
|
+
commitTask(x.id, { start: x.start, end: x.end, progress: n / 100 });
|
|
282
|
+
}
|
|
283
|
+
else if (key === "predecessors") {
|
|
284
|
+
const wbsList = v ? v.split(/[\s,;]+/).filter(Boolean) : [];
|
|
285
|
+
const ids = [];
|
|
286
|
+
for (const w of wbsList) {
|
|
287
|
+
const found = flat.find((f) => f.wbs === w);
|
|
288
|
+
if (!found)
|
|
289
|
+
return fail(t("unknownTask", { wbs: w }));
|
|
290
|
+
ids.push(found.task.id);
|
|
291
|
+
}
|
|
292
|
+
const current = links.filter((l) => l.to === x.id);
|
|
293
|
+
for (const l of current)
|
|
294
|
+
if (!ids.includes(l.from))
|
|
295
|
+
removeLink(l.id);
|
|
296
|
+
for (const id of ids)
|
|
297
|
+
if (!current.some((l) => l.from === id))
|
|
298
|
+
addLink(id, x.id);
|
|
299
|
+
}
|
|
300
|
+
setEdit(null);
|
|
301
|
+
focusCell(edit.row, edit.col);
|
|
302
|
+
};
|
|
303
|
+
const onGridKeyDown = (k) => {
|
|
304
|
+
if (edit)
|
|
305
|
+
return;
|
|
306
|
+
const el = k.target;
|
|
307
|
+
if (!el.dataset.ganttCell)
|
|
308
|
+
return;
|
|
309
|
+
const row = rows[ar];
|
|
310
|
+
const h = rtl ? -1 : 1;
|
|
311
|
+
const key = k.key === "ArrowRight" && h < 0 ? "ArrowLeft" : k.key === "ArrowLeft" && h < 0 ? "ArrowRight" : k.key;
|
|
312
|
+
switch (key) {
|
|
313
|
+
case "ArrowDown":
|
|
314
|
+
k.preventDefault();
|
|
315
|
+
return focusCell(Math.min(rows.length - 1, ar + 1), ac);
|
|
316
|
+
case "ArrowUp":
|
|
317
|
+
k.preventDefault();
|
|
318
|
+
return focusCell(Math.max(0, ar - 1), ac);
|
|
319
|
+
case "ArrowRight":
|
|
320
|
+
k.preventDefault();
|
|
321
|
+
if (ac === 0 && row?.hasChildren && collapsed.has(row.task.id))
|
|
322
|
+
return toggle(row.task.id, true);
|
|
323
|
+
return focusCell(ar, Math.min(colKeys.length - 1, ac + 1));
|
|
324
|
+
case "ArrowLeft":
|
|
325
|
+
k.preventDefault();
|
|
326
|
+
if (ac === 0 && row?.hasChildren && !collapsed.has(row.task.id))
|
|
327
|
+
return toggle(row.task.id, false);
|
|
328
|
+
if (ac === 0 && row?.parentId)
|
|
329
|
+
return focusCell(rowIndex.get(row.parentId) ?? ar, 0);
|
|
330
|
+
return focusCell(ar, Math.max(0, ac - 1));
|
|
331
|
+
case "Home":
|
|
332
|
+
k.preventDefault();
|
|
333
|
+
return focusCell(k.ctrlKey ? 0 : ar, 0);
|
|
334
|
+
case "End":
|
|
335
|
+
k.preventDefault();
|
|
336
|
+
return focusCell(k.ctrlKey ? rows.length - 1 : ar, colKeys.length - 1);
|
|
337
|
+
case "Enter":
|
|
338
|
+
case "F2":
|
|
339
|
+
k.preventDefault();
|
|
340
|
+
if (!startEdit(ar, ac) && row?.hasChildren && colKeys[ac] === "title")
|
|
341
|
+
toggle(row.task.id);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
/* -------- splitter -------- */
|
|
346
|
+
const splitStart = React.useRef(gridWidth);
|
|
347
|
+
const split = usePointerDrag({
|
|
348
|
+
axis: "x",
|
|
349
|
+
onStart: () => {
|
|
350
|
+
splitStart.current = gridWidth;
|
|
351
|
+
},
|
|
352
|
+
onMove: (s) => setGridWidth(clamp(splitStart.current + s.rawDelta.x * (rtl ? -1 : 1), minGrid, 1200)),
|
|
353
|
+
});
|
|
354
|
+
/* -------- render -------- */
|
|
355
|
+
const scaleLabel = { day: t("day"), week: t("week"), month: t("month"), quarter: t("quarter") };
|
|
356
|
+
const majorTicks = ts.ticks(preset.major);
|
|
357
|
+
const minorTicks = ts.ticks(preset.minor);
|
|
358
|
+
const todayX = compareIsoDate(today, bounds.start) >= 0 && compareIsoDate(today, bounds.end) < 0 ? xOf(today) + ts.pxPerDay / 2 : null;
|
|
359
|
+
const weekOpts = React.useMemo(() => {
|
|
360
|
+
const wi = getWeekInfo(locale);
|
|
361
|
+
return { weekStartsOn: (wi.firstDay % 7), firstWeekContainsDate: (wi.minimalDays >= 4 ? 4 : 1) };
|
|
362
|
+
}, [locale]);
|
|
363
|
+
const tickLabel = (unit, date, width) => {
|
|
364
|
+
const [y, m, d] = date.split("-").map(Number);
|
|
365
|
+
switch (unit) {
|
|
366
|
+
case "day":
|
|
367
|
+
return width >= 30 ? fmtDay(locale, date, { day: "numeric" }) : "";
|
|
368
|
+
case "week":
|
|
369
|
+
return t("weekShort", { week: getWeek(new Date(y, m - 1, d), weekOpts) });
|
|
370
|
+
case "month":
|
|
371
|
+
return fmtDay(locale, date, width > 90 ? { month: "long", year: scale === "week" || scale === "day" ? "numeric" : undefined } : { month: "short" });
|
|
372
|
+
case "quarter":
|
|
373
|
+
return t("quarterShort", { quarter: Math.floor((m - 1) / 3) + 1 });
|
|
374
|
+
case "year":
|
|
375
|
+
return String(y);
|
|
376
|
+
default:
|
|
377
|
+
return "";
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
const gridTemplate = `minmax(12rem, 1fr) ${fixedCols.map((c) => `${COL_W[c]}px`).join(" ")}`;
|
|
381
|
+
const totalWidth = gridWidth + ts.width;
|
|
382
|
+
if (!rows.length) {
|
|
383
|
+
return (_jsx("div", { ref: ref, "data-slot": "gantt", className: cn(ganttVariants(), "p-6", className), ...props, children: _jsx(EmptyState, { size: "sm", icon: _jsx(GanttChartSquare, {}), title: t("empty"), description: t("emptyHint") }) }));
|
|
384
|
+
}
|
|
385
|
+
return (_jsxs("div", { ref: ref, "data-slot": "gantt", "data-scale": scale, "data-readonly": readOnly ? "" : undefined, className: cn(ganttVariants(), className), style: { ["--gantt-row"]: `${rowH}px` }, ...props, children: [_jsx("span", { ref: probe, "aria-hidden": true, className: "ui-gantt-probe" }), (scales.length > 1 || toolbar) ? (_jsxs("div", { "data-slot": "gantt-toolbar", className: "flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-line px-3 py-2.5 sm:px-4", children: [_jsx(Button, { size: "sm", onClick: () => { if (scrollRef.current && todayX !== null)
|
|
386
|
+
scrollRef.current.scrollLeft = Math.max(0, todayX - (scrollRef.current.clientWidth - gridWidth) / 2); }, children: t("today") }), _jsx("div", { className: "me-auto" }), toolbar, scales.length > 1 ? (_jsx(ToggleGroup, { size: "sm", "aria-label": t("zoom"), value: scale, onValueChange: (v) => v && setScale(v), children: scales.map((s) => _jsx(ToggleGroupItem, { value: s, children: scaleLabel[s] }, s)) })) : null] })) : null, _jsx("div", { ref: scrollRef, "data-slot": "gantt-scroll", className: "ui-gantt-scroll relative min-h-0 overflow-auto overscroll-contain", style: { maxHeight: typeof height === "number" ? `${height}px` : height }, children: _jsxs("div", { className: "relative flex", style: { width: totalWidth }, children: [_jsxs("div", { className: "ui-gantt-gridpane sticky z-[4] shrink-0", style: { width: gridWidth, insetInlineStart: 0 }, children: [_jsxs("div", { ref: gridRef, role: "treegrid", "aria-label": t("plan"), "aria-rowcount": flat.length + 1, "aria-colcount": colKeys.length, "aria-readonly": !canEdit || undefined, onKeyDown: onGridKeyDown, className: "ui-gantt-grid", children: [_jsx("div", { role: "row", "aria-rowindex": 1, className: "ui-gantt-ghead sticky top-0 z-[2] grid", style: { gridTemplateColumns: gridTemplate }, children: colKeys.map((k) => (_jsx("div", { role: "columnheader", className: cn("ui-gantt-gh", k !== "title" && "justify-end text-end"), children: t(k === "title" ? "task" : k) }, k))) }), _jsx("div", { className: "relative", style: { height: bodyH }, children: items.map((i) => {
|
|
387
|
+
const r = rows[i];
|
|
388
|
+
const x = r.task;
|
|
389
|
+
const isSummary = x.type === "summary" || r.hasChildren;
|
|
390
|
+
const overdue = x.type !== "milestone" && !isSummary && (x.progress ?? 0) < 1 && compareIsoDate(x.end, today) < 0;
|
|
391
|
+
return (_jsx("div", { role: "row", "aria-rowindex": r.index + 1, "aria-level": r.depth + 1, "aria-expanded": r.hasChildren ? !collapsed.has(x.id) : undefined, "aria-selected": i === ar, "data-slot": "gantt-row", "data-summary": isSummary ? "" : undefined, "data-active": i === ar ? "" : undefined, className: "ui-gantt-row absolute inset-x-0 grid", style: { top: i * rowH, height: rowH, gridTemplateColumns: gridTemplate }, children: colKeys.map((k, ci) => {
|
|
392
|
+
const editing = edit && edit.row === i && edit.col === ci ? edit : null;
|
|
393
|
+
const cellProps = {
|
|
394
|
+
role: "gridcell",
|
|
395
|
+
"data-gantt-cell": `${i}:${ci}`,
|
|
396
|
+
tabIndex: i === ar && ci === ac ? 0 : -1,
|
|
397
|
+
onFocus: () => (i !== ar || ci !== ac) && setActive({ row: i, col: ci }),
|
|
398
|
+
onDoubleClick: () => startEdit(i, ci),
|
|
399
|
+
"aria-readonly": !isEditable(k, x) || undefined,
|
|
400
|
+
};
|
|
401
|
+
if (editing) {
|
|
402
|
+
return (_jsx("div", { ...cellProps, className: "ui-gantt-cell ui-gantt-editing", children: _jsx("input", { autoFocus: true, "aria-label": `${t(k === "title" ? "task" : k)}, ${x.title}`, "aria-invalid": editing.error ? true : undefined, title: editing.error, type: k === "start" || k === "end" ? "date" : k === "duration" || k === "progress" ? "number" : "text", min: k === "duration" ? 1 : k === "progress" ? 0 : undefined, max: k === "progress" ? 100 : undefined, className: "ui-gantt-input", value: editing.value, onChange: (e) => setEdit({ ...editing, value: e.target.value, error: undefined }), onKeyDown: (e) => {
|
|
403
|
+
e.stopPropagation();
|
|
404
|
+
if (e.key === "Enter") {
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
commitEdit();
|
|
407
|
+
}
|
|
408
|
+
else if (e.key === "Escape") {
|
|
409
|
+
e.preventDefault();
|
|
410
|
+
setEdit(null);
|
|
411
|
+
focusCell(i, ci);
|
|
412
|
+
}
|
|
413
|
+
}, onBlur: () => setEdit(null) }) }, k));
|
|
414
|
+
}
|
|
415
|
+
if (k === "title") {
|
|
416
|
+
return (_jsxs("div", { ...cellProps, className: "ui-gantt-cell ui-gantt-title", style: { paddingInlineStart: `calc(0.5rem + ${r.depth} * 1.125rem)` }, children: [r.hasChildren ? (_jsx("button", { type: "button", tabIndex: -1, "aria-hidden": true, className: "ui-gantt-twisty", "data-open": !collapsed.has(x.id) ? "" : undefined, onClick: () => toggle(x.id), children: _jsx(ChevronRight, { className: "rtl:-scale-x-100" }) })) : (_jsx("span", { className: "ui-gantt-twisty", "aria-hidden": true, children: x.type === "milestone" ? _jsx(Diamond, { className: "ui-gantt-mico" }) : null })), _jsx("span", { className: "ui-gantt-wbs tabular", "aria-hidden": true, children: r.wbs }), _jsx("span", { className: "truncate", children: x.title }), overdue ? _jsxs("span", { className: "sr-only", children: [", ", t("overdue")] }) : null] }, k));
|
|
417
|
+
}
|
|
418
|
+
let content = null;
|
|
419
|
+
if (k === "start")
|
|
420
|
+
content = fmtDate(x.start);
|
|
421
|
+
else if (k === "end")
|
|
422
|
+
content = fmtDate(x.end);
|
|
423
|
+
else if (k === "duration")
|
|
424
|
+
content = durationText(x);
|
|
425
|
+
else if (k === "progress")
|
|
426
|
+
content = x.type === "milestone" ? ((x.progress ?? 0) >= 1 ? t("done") : "–") : pct.format(x.progress ?? 0);
|
|
427
|
+
else if (k === "predecessors")
|
|
428
|
+
content = predecessorText(x.id) || "–";
|
|
429
|
+
else if (k === "assignees")
|
|
430
|
+
content = x.assignees?.length ? (_jsx(AvatarGroup, { size: "xs", max: 3, children: x.assignees.map((a) => _jsx(Avatar, { name: a.name, src: a.avatarUrl ?? undefined }, a.id)) })) : isSummary ? null : _jsxs("span", { className: "text-fg-subtle", children: [_jsx("span", { "aria-hidden": true, children: "\u2013" }), _jsx("span", { className: "sr-only", children: t("noOwner") })] });
|
|
431
|
+
return (_jsx("div", { ...cellProps, "data-overdue": overdue && k === "end" ? "" : undefined, className: "ui-gantt-cell justify-end text-end tabular", children: content }, k));
|
|
432
|
+
}) }, x.id));
|
|
433
|
+
}) })] }), _jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": t("resize"), "aria-valuenow": Math.round(gridWidth), "aria-valuemin": minGrid, "aria-valuemax": 1200, tabIndex: 0, "data-slot": "gantt-splitter", className: "ui-gantt-split focus-ring", style: split.bind.style, onPointerDown: split.bind.onPointerDown, onKeyDown: (k) => {
|
|
434
|
+
const d = k.key === "ArrowRight" ? 24 : k.key === "ArrowLeft" ? -24 : 0;
|
|
435
|
+
if (!d)
|
|
436
|
+
return;
|
|
437
|
+
k.preventDefault();
|
|
438
|
+
setGridWidth(clamp(gridWidth + d * (rtl ? -1 : 1), minGrid, 1200));
|
|
439
|
+
} })] }), _jsxs("div", { "aria-hidden": true, "data-slot": "gantt-timeline", className: "ui-gantt-timeline relative shrink-0", style: { width: ts.width }, children: [_jsxs("div", { className: "ui-gantt-thead sticky top-0 z-[3]", children: [_jsx("div", { className: "relative h-1/2", children: majorTicks.map((tk) => (_jsx("div", { className: "ui-gantt-major", style: { insetInlineStart: tk.x, width: tk.width }, children: _jsx("span", { className: "sticky truncate", style: { insetInlineStart: gridWidth + 8 }, children: tickLabel(preset.major, tk.date, tk.width) }) }, tk.start))) }), _jsx("div", { className: "relative h-1/2", children: minorTicks.map((tk) => (_jsx("div", { className: "ui-gantt-minor tabular", "data-off": tk.working === 0 ? "" : undefined, "data-today": scale === "day" && tk.date === today ? "" : undefined, style: { insetInlineStart: tk.x, width: tk.width }, children: tickLabel(preset.minor, tk.date, tk.width) }, tk.start))) })] }), _jsxs("div", { className: "relative", style: { height: bodyH }, children: [minorTicks.map((tk) => (_jsx("div", { className: "ui-gantt-vline", "data-off": tk.working === 0 ? "" : tk.working === 0.5 ? "half" : undefined, style: { insetInlineStart: tk.x, width: tk.width } }, tk.start))), items.map((i) => (_jsx("div", { className: "ui-gantt-band", "data-active": i === ar ? "" : undefined, style: { top: i * rowH, height: rowH } }, `band-${i}`))), todayX !== null ? _jsx("div", { className: "ui-gantt-today", style: { insetInlineStart: todayX } }) : null, _jsx(GanttLinks, { links: links, rows: rows, rowIndex: rowIndex, rowH: rowH, xOf: xOf, wOf: wOf, pxPerDay: ts.pxPerDay, bad: badLinks, width: ts.width, height: bodyH, onDelete: onLinkDelete && !readOnly ? removeLink : undefined, rtl: rtl }), items.map((i) => {
|
|
440
|
+
const r = rows[i];
|
|
441
|
+
return (_jsx(GanttBarRow, { task: r.task, summary: r.task.type === "summary" || r.hasChildren, top: i * rowH, rowH: rowH, x: xOf(r.task.start), w: wOf(r.task.start, r.task.end), pxPerDay: ts.pxPerDay, today: today, editable: canEdit && r.task.editable !== false && !(r.task.type === "summary" || r.hasChildren), linkable: canLink, rtl: rtl, label: (s, e) => {
|
|
442
|
+
const n = durationUnit === "workdays" ? taskDuration({ start: s, end: e }, cal, "workdays") : diffDays(s, e) + 1;
|
|
443
|
+
return `${fmtDayRange(locale, s, e, { day: "numeric", month: "short" })} · ${durationUnit === "workdays" ? t("workingDays", { count: n }) : t("days", { count: n })}`;
|
|
444
|
+
}, onCommit: (s, e) => commitTask(r.task.id, { start: s, end: e }), onLink: (to) => addLink(r.task.id, to) }, r.task.id));
|
|
445
|
+
})] })] })] }) }), _jsx("span", { className: "sr-only", "aria-live": "polite", children: message })] }));
|
|
446
|
+
});
|
|
447
|
+
function GanttBarRow({ task, summary, top, rowH, x, w, pxPerDay, today, editable, linkable, rtl, label, onCommit, onLink }) {
|
|
448
|
+
const [preview, setPreview] = React.useState(null);
|
|
449
|
+
const [linkTo, setLinkTo] = React.useState(null);
|
|
450
|
+
const sign = rtl ? -1 : 1;
|
|
451
|
+
const daysOf = (dx) => Math.round((dx * sign) / pxPerDay);
|
|
452
|
+
const move = usePointerDrag({
|
|
453
|
+
axis: "x",
|
|
454
|
+
disabled: !editable,
|
|
455
|
+
onMove: (s) => {
|
|
456
|
+
const d = daysOf(s.rawDelta.x);
|
|
457
|
+
setPreview({ start: addDays(task.start, d), end: addDays(task.end, d) });
|
|
458
|
+
},
|
|
459
|
+
onEnd: () => {
|
|
460
|
+
if (preview && preview.start !== task.start)
|
|
461
|
+
onCommit(preview.start, preview.end);
|
|
462
|
+
setPreview(null);
|
|
463
|
+
},
|
|
464
|
+
onCancel: () => setPreview(null),
|
|
465
|
+
});
|
|
466
|
+
const resize = usePointerDrag({
|
|
467
|
+
axis: "x",
|
|
468
|
+
disabled: !editable || task.type === "milestone",
|
|
469
|
+
onMove: (s) => {
|
|
470
|
+
const end = addDays(task.end, daysOf(s.rawDelta.x));
|
|
471
|
+
setPreview({ start: task.start, end: compareIsoDate(end, task.start) < 0 ? task.start : end });
|
|
472
|
+
},
|
|
473
|
+
onEnd: () => {
|
|
474
|
+
if (preview && preview.end !== task.end)
|
|
475
|
+
onCommit(preview.start, preview.end);
|
|
476
|
+
setPreview(null);
|
|
477
|
+
},
|
|
478
|
+
onCancel: () => setPreview(null),
|
|
479
|
+
});
|
|
480
|
+
const link = usePointerDrag({
|
|
481
|
+
disabled: !linkable,
|
|
482
|
+
onMove: (s) => setLinkTo({ dx: s.rawDelta.x, dy: s.rawDelta.y }),
|
|
483
|
+
onEnd: (s) => {
|
|
484
|
+
setLinkTo(null);
|
|
485
|
+
const el = document.elementFromPoint(s.origin.x + s.rawDelta.x, s.origin.y + s.rawDelta.y)?.closest("[data-gantt-bar]");
|
|
486
|
+
const to = el?.dataset.ganttBar;
|
|
487
|
+
if (to && to !== task.id)
|
|
488
|
+
onLink(to);
|
|
489
|
+
},
|
|
490
|
+
onCancel: () => setLinkTo(null),
|
|
491
|
+
});
|
|
492
|
+
const cur = preview ?? { start: task.start, end: task.end };
|
|
493
|
+
const shift = preview ? (Math.round((Date.parse(preview.start) - Date.parse(task.start)) / 86_400_000) * pxPerDay) : 0;
|
|
494
|
+
const width = preview ? Math.max(pxPerDay, (diffDays(cur.start, cur.end) + 1) * pxPerDay) : w;
|
|
495
|
+
const left = x + shift;
|
|
496
|
+
const overdue = task.type !== "milestone" && !summary && (task.progress ?? 0) < 1 && compareIsoDate(task.end, today) < 0;
|
|
497
|
+
const style = { ["--ev"]: toneColor(task.tone), top: top + rowH / 2, insetInlineStart: left };
|
|
498
|
+
if (task.type === "milestone") {
|
|
499
|
+
return (_jsxs("div", { "data-gantt-bar": task.id, className: "ui-gantt-milestone", "data-done": (task.progress ?? 0) >= 1 ? "" : undefined, style: { ...style, insetInlineStart: left + pxPerDay / 2, ...move.bind.style }, onPointerDown: move.bind.onPointerDown, children: [_jsx("span", { className: "ui-gantt-mlabel", children: task.title }), preview ? _jsx("span", { className: "ui-gantt-tip", children: label(cur.start, cur.end) }) : null] }));
|
|
500
|
+
}
|
|
501
|
+
return (_jsxs("div", { "data-gantt-bar": task.id, "data-summary": summary ? "" : undefined, "data-overdue": overdue ? "" : undefined, "data-dragging": preview ? "" : undefined, className: "ui-gantt-bar", style: { ...style, width, ...(editable ? move.bind.style : null) }, onPointerDown: editable ? move.bind.onPointerDown : undefined, children: [!summary ? _jsx("span", { className: "ui-gantt-progress", style: { width: `${clamp(task.progress ?? 0, 0, 1) * 100}%` } }) : null, _jsx("span", { className: "ui-gantt-barlabel", children: task.title }), editable ? (_jsx("span", { className: "ui-gantt-handle", style: resize.bind.style, onPointerDown: (e) => {
|
|
502
|
+
e.stopPropagation();
|
|
503
|
+
resize.bind.onPointerDown(e);
|
|
504
|
+
} })) : null, linkable && !summary ? (_jsx("span", { className: "ui-gantt-connect", style: link.bind.style, onPointerDown: (e) => {
|
|
505
|
+
e.stopPropagation();
|
|
506
|
+
link.bind.onPointerDown(e);
|
|
507
|
+
} })) : null, linkTo ? (_jsx("svg", { className: "ui-gantt-linkdraft", width: "1", height: "1", style: { insetInlineStart: "100%" }, children: _jsx("line", { x1: 0, y1: 0, x2: linkTo.dx * (rtl ? -1 : 1), y2: linkTo.dy }) })) : null, preview ? _jsx("span", { className: "ui-gantt-tip", children: label(cur.start, cur.end) }) : null] }));
|
|
508
|
+
}
|
|
509
|
+
/* ------------------------------------------------------------------ */
|
|
510
|
+
/* Links */
|
|
511
|
+
/* ------------------------------------------------------------------ */
|
|
512
|
+
function GanttLinks({ links, rows, rowIndex, rowH, xOf, wOf, pxPerDay, bad, width, height, onDelete, rtl, }) {
|
|
513
|
+
const [hot, setHot] = React.useState(null);
|
|
514
|
+
const X = (v) => (rtl ? width - v : v);
|
|
515
|
+
return (_jsxs("svg", { className: "ui-gantt-links", width: width, height: height, viewBox: `0 0 ${width} ${height}`, children: [_jsx("defs", { children: _jsx("marker", { id: "ui-gantt-arrow", viewBox: "0 0 8 8", refX: "7", refY: "4", markerWidth: "7", markerHeight: "7", orient: "auto-start-reverse", children: _jsx("path", { d: "M0,0 L8,4 L0,8 z", fill: "context-stroke" }) }) }), links.map((l) => {
|
|
516
|
+
const a = rowIndex.get(l.from);
|
|
517
|
+
const b = rowIndex.get(l.to);
|
|
518
|
+
if (a === undefined || b === undefined)
|
|
519
|
+
return null;
|
|
520
|
+
const ta = rows[a].task;
|
|
521
|
+
const tb = rows[b].task;
|
|
522
|
+
const ax = ta.type === "milestone" ? xOf(ta.start) + pxPerDay / 2 + 7 : xOf(ta.start) + wOf(ta.start, ta.end);
|
|
523
|
+
const bx = tb.type === "milestone" ? xOf(tb.start) + pxPerDay / 2 - 7 : xOf(tb.start);
|
|
524
|
+
const ay = a * rowH + rowH / 2;
|
|
525
|
+
const by = b * rowH + rowH / 2;
|
|
526
|
+
const gap = 8;
|
|
527
|
+
const d = bx - gap >= ax + gap
|
|
528
|
+
? `M${X(ax)},${ay} H${X(ax + gap)} V${by} H${X(bx)}`
|
|
529
|
+
: `M${X(ax)},${ay} H${X(ax + gap)} V${ay + (by > ay ? rowH / 2 : -rowH / 2)} H${X(bx - gap)} V${by} H${X(bx)}`;
|
|
530
|
+
return (_jsxs("g", { "data-bad": bad.has(l.id) ? "" : undefined, "data-hot": hot === l.id ? "" : undefined, className: "ui-gantt-link", children: [_jsx("path", { d: d, markerEnd: "url(#ui-gantt-arrow)" }), onDelete ? (_jsx("path", { d: d, className: "ui-gantt-linkhit", onPointerEnter: () => setHot(l.id), onPointerLeave: () => setHot(null), onClick: () => onDelete(l.id) })) : null] }, l.id));
|
|
531
|
+
})] }));
|
|
532
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Scheduler, schedulerVariants, schedulerLabels, schedulerEventDays, type SchedulerProps, type SchedulerEvent, type SchedulerEventChange, type SchedulerCreateRange, type SchedulerRenderState, type SchedulerView, type SchedulerLabels, } from "./scheduler.js";
|
|
2
|
+
export { ResourceCalendar, resourceCalendarVariants, resourceCalendarLabels, minRestRule, maxHoursRule, maxConcurrentRule, type ResourceCalendarProps, type Resource, type ResourceBlock, type ResourceBlockStatus, type ResourceTemplate, type ResourceRule, type ResourceRuleContext, type ResourceRuleViolation, type ResourceBlocksChange, type ResourceCellRef, type ResourceCellAction, type ResourceCalendarLabels, } from "./resource-calendar.js";
|
|
3
|
+
export { Gantt, ganttVariants, ganttLabels, type GanttProps, type GanttTask, type GanttLink, type GanttAssignee, type GanttScale, type GanttColumnKey, type GanttTaskChange, type GanttLabels, } from "./gantt.js";
|
|
4
|
+
export { TimerButton, Timesheet, TimeEntryList, timesheetVariants, timeTrackerLabels, createMemoryTimerAdapter, createLocalTimerAdapter, type TimerAdapter, type TimerButtonProps, type TimerProject, type TimesheetProps, type TimesheetRow, type TimeEntryListProps, type TimeTrackerLabels, } from "./time-tracker.js";
|
|
5
|
+
export type { ScheduleTone } from "./shared.js";
|
|
6
|
+
export * from "./core/index.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Public API of @vamos-ui/react/scheduler: Agenda / scheduler, Resource calendar, Gantt, Time tracker.
|
|
2
|
+
// The React-free engine (layout, scheduling, durations, time scale) is also at ./core.
|
|
3
|
+
export { Scheduler, schedulerVariants, schedulerLabels, schedulerEventDays, } from "./scheduler.js";
|
|
4
|
+
export { ResourceCalendar, resourceCalendarVariants, resourceCalendarLabels, minRestRule, maxHoursRule, maxConcurrentRule, } from "./resource-calendar.js";
|
|
5
|
+
export { Gantt, ganttVariants, ganttLabels, } from "./gantt.js";
|
|
6
|
+
export { TimerButton, Timesheet, TimeEntryList, timesheetVariants, timeTrackerLabels, createMemoryTimerAdapter, createLocalTimerAdapter, } from "./time-tracker.js";
|
|
7
|
+
export * from "./core/index.js";
|