@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,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { MediaAsset } from "./types.js";
|
|
3
|
+
declare const focalLabels: {
|
|
4
|
+
label: string;
|
|
5
|
+
roledescription: string;
|
|
6
|
+
valuetext: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
previews: string;
|
|
9
|
+
reset: string;
|
|
10
|
+
};
|
|
11
|
+
export type FocalPointLabels = typeof focalLabels;
|
|
12
|
+
export type FocalPoint = {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
export interface FocalPointPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
17
|
+
src: string | MediaAsset;
|
|
18
|
+
/** 0..1 in image space (not mirrored in RTL). */
|
|
19
|
+
value?: FocalPoint;
|
|
20
|
+
defaultValue?: FocalPoint;
|
|
21
|
+
/** Fires while dragging and on every key press. */
|
|
22
|
+
onValueChange?: (value: FocalPoint) => void;
|
|
23
|
+
/** Fires once when a drag or key press ends (autosave here). */
|
|
24
|
+
onValueCommit?: (value: FocalPoint) => void;
|
|
25
|
+
/** Live crop previews next to the image. Default `["1/1", "16/9", "4/5"]`; `false` hides them. */
|
|
26
|
+
previews?: false | ("1/1" | "16/9" | "4/5" | "4/3" | "1.91/1" | "3/2")[];
|
|
27
|
+
/** Max height of the image stage. Default 20rem. */
|
|
28
|
+
maxHeight?: number | string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
labels?: Partial<FocalPointLabels>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Marks the part of an image that must stay in view when layouts crop it. A draggable marker over
|
|
34
|
+
* the image plus live previews in common ratios. The marker is a focusable 2-D control:
|
|
35
|
+
* arrows step 1%, Shift + arrows 10%, Home centres it.
|
|
36
|
+
*
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <FocalPointPicker src={asset} defaultValue={asset.focalPoint} onValueCommit={(focalPoint) => adapter.update(asset.id, { focalPoint })} />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const FocalPointPicker: React.ForwardRefExoticComponent<FocalPointPickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { useLabels } from "../lib/labels.js";
|
|
6
|
+
import { useLocale } from "../lib/locale.js";
|
|
7
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
8
|
+
import { Image } from "../components/image.js";
|
|
9
|
+
import { isMediaAsset } from "./media-provider.js";
|
|
10
|
+
const focalLabels = {
|
|
11
|
+
label: "Focal point",
|
|
12
|
+
roledescription: "focal point",
|
|
13
|
+
valuetext: "horizontal {x}, vertical {y}",
|
|
14
|
+
instructions: "Click or drag on the image, or use the arrow keys (Shift for bigger steps), to mark the part that must stay in view when the image is cropped.",
|
|
15
|
+
previews: "Crop previews",
|
|
16
|
+
reset: "Center",
|
|
17
|
+
};
|
|
18
|
+
const clamp = (n) => Math.min(1, Math.max(0, n));
|
|
19
|
+
const round = (n) => Math.round(n * 1000) / 1000;
|
|
20
|
+
/**
|
|
21
|
+
* Marks the part of an image that must stay in view when layouts crop it. A draggable marker over
|
|
22
|
+
* the image plus live previews in common ratios. The marker is a focusable 2-D control:
|
|
23
|
+
* arrows step 1%, Shift + arrows 10%, Home centres it.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <FocalPointPicker src={asset} defaultValue={asset.focalPoint} onValueCommit={(focalPoint) => adapter.update(asset.id, { focalPoint })} />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const FocalPointPicker = React.forwardRef(function FocalPointPicker({ src, value, defaultValue, onValueChange, onValueCommit, previews = ["1/1", "16/9", "4/5"], maxHeight = "20rem", disabled, labels, className, ...props }, ref) {
|
|
30
|
+
const t = useLabels("focalPoint", focalLabels, labels);
|
|
31
|
+
const { locale } = useLocale();
|
|
32
|
+
const [point, setPoint] = useControllableState({ value, defaultValue: defaultValue ?? (isMediaAsset(src) ? src.focalPoint : undefined) ?? { x: 0.5, y: 0.5 }, onChange: onValueChange, name: "FocalPointPicker" });
|
|
33
|
+
const stage = React.useRef(null);
|
|
34
|
+
const dragging = React.useRef(false);
|
|
35
|
+
const latest = React.useRef(point);
|
|
36
|
+
latest.current = point;
|
|
37
|
+
const instructionsId = React.useId();
|
|
38
|
+
const url = isMediaAsset(src) ? src.url : src;
|
|
39
|
+
const pct = React.useMemo(() => new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }), [locale]);
|
|
40
|
+
const fromPointer = (e) => {
|
|
41
|
+
const r = stage.current?.getBoundingClientRect();
|
|
42
|
+
if (!r || !r.width || !r.height)
|
|
43
|
+
return latest.current;
|
|
44
|
+
return { x: round(clamp((e.clientX - r.left) / r.width)), y: round(clamp((e.clientY - r.top) / r.height)) };
|
|
45
|
+
};
|
|
46
|
+
const onPointerDown = (e) => {
|
|
47
|
+
if (disabled || e.button !== 0)
|
|
48
|
+
return;
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
dragging.current = true;
|
|
51
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
52
|
+
const next = fromPointer(e);
|
|
53
|
+
setPoint(next);
|
|
54
|
+
latest.current = next;
|
|
55
|
+
stage.current?.querySelector("[data-slot=focal-point-marker]")?.focus({ preventScroll: true });
|
|
56
|
+
};
|
|
57
|
+
const onPointerMove = (e) => {
|
|
58
|
+
if (!dragging.current)
|
|
59
|
+
return;
|
|
60
|
+
const next = fromPointer(e);
|
|
61
|
+
setPoint(next);
|
|
62
|
+
latest.current = next;
|
|
63
|
+
};
|
|
64
|
+
const onPointerUp = () => {
|
|
65
|
+
if (!dragging.current)
|
|
66
|
+
return;
|
|
67
|
+
dragging.current = false;
|
|
68
|
+
onValueCommit?.(latest.current);
|
|
69
|
+
};
|
|
70
|
+
const onKeyDown = (e) => {
|
|
71
|
+
if (disabled)
|
|
72
|
+
return;
|
|
73
|
+
const step = e.shiftKey ? 0.1 : 0.01;
|
|
74
|
+
const p = latest.current;
|
|
75
|
+
let next = null;
|
|
76
|
+
if (e.key === "ArrowLeft")
|
|
77
|
+
next = { x: clamp(p.x - step), y: p.y };
|
|
78
|
+
else if (e.key === "ArrowRight")
|
|
79
|
+
next = { x: clamp(p.x + step), y: p.y };
|
|
80
|
+
else if (e.key === "ArrowUp")
|
|
81
|
+
next = { x: p.x, y: clamp(p.y - step) };
|
|
82
|
+
else if (e.key === "ArrowDown")
|
|
83
|
+
next = { x: p.x, y: clamp(p.y + step) };
|
|
84
|
+
else if (e.key === "Home")
|
|
85
|
+
next = { x: 0.5, y: 0.5 };
|
|
86
|
+
if (!next)
|
|
87
|
+
return;
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
next = { x: round(next.x), y: round(next.y) };
|
|
90
|
+
setPoint(next);
|
|
91
|
+
latest.current = next;
|
|
92
|
+
onValueCommit?.(next);
|
|
93
|
+
};
|
|
94
|
+
const ratio = isMediaAsset(src) && src.width && src.height ? src.width / src.height : undefined;
|
|
95
|
+
return (_jsx("div", { ref: ref, "data-slot": "focal-point", "data-disabled": disabled ? "" : undefined, className: cn("vui-focal @container", className), ...props, children: _jsxs("div", { className: cn("grid gap-4", previews && "@md:grid-cols-[minmax(0,1fr)_9.5rem]"), children: [_jsxs("div", { className: "flex min-w-0 items-center justify-center rounded-ui bg-scene p-2", children: [_jsxs("div", { ref: stage, "data-slot": "focal-point-stage", className: cn("vui-focal-stage relative inline-block max-w-full touch-none select-none", disabled ? "cursor-not-allowed opacity-60" : "cursor-crosshair"), onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, children: [_jsx("img", { src: url, alt: "", draggable: false, className: "block h-auto max-w-full rounded-ui-sm object-contain", style: { maxHeight, aspectRatio: ratio ? String(ratio) : undefined } }), _jsx("span", { "aria-hidden": true, className: "vui-focal-guides pointer-events-none absolute inset-0", style: { "--fx": `${point.x * 100}%`, "--fy": `${point.y * 100}%` } }), _jsx("div", { role: "slider", tabIndex: disabled ? -1 : 0, "aria-label": t("label"), "aria-roledescription": t("roledescription"), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(point.x * 100), "aria-valuetext": t("valuetext", { x: pct.format(point.x), y: pct.format(point.y) }), "aria-describedby": instructionsId, "aria-disabled": disabled || undefined, "data-slot": "focal-point-marker", onKeyDown: onKeyDown, className: "vui-focal-marker focus-ring absolute", style: { left: `${point.x * 100}%`, top: `${point.y * 100}%` } })] }), _jsx("p", { id: instructionsId, className: "sr-only", children: t("instructions") })] }), previews ? (_jsx("div", { role: "group", "aria-label": t("previews"), className: "grid grid-cols-3 content-start gap-2 @md:grid-cols-1", children: previews.map((r) => (_jsxs("figure", { className: "m-0 grid gap-1", children: [_jsx(Image, { src: url, alt: "", aspect: r, focal: point, rounded: "ui", placeholder: "none", className: "rounded-ui-sm bg-surface-2" }), _jsx("figcaption", { "aria-hidden": true, className: "tabular text-[11px] text-fg-subtle", children: r.replace("/", ":") })] }, r))) })) : null] }) }));
|
|
96
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Distributes items into `columns` by known aspect ratios (w/h), shortest column first. */
|
|
2
|
+
export declare function masonryColumns(ratios: number[], columns: number): number[][];
|
|
3
|
+
export interface JustifiedRow {
|
|
4
|
+
/** Item indexes in this row. */
|
|
5
|
+
items: number[];
|
|
6
|
+
/** Row height in px. */
|
|
7
|
+
height: number;
|
|
8
|
+
/** `false` for an unfilled last row (kept at the target height). */
|
|
9
|
+
justified: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Flickr-style justified rows: fills each row with items at `rowHeight` until it overflows the
|
|
13
|
+
* container width, then scales the row so it fits exactly. The last row keeps `rowHeight`.
|
|
14
|
+
* A row never grows taller than `rowHeight * maxScale`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function justifyRows(ratios: number[], width: number, rowHeight: number, gap?: number, maxScale?: number): JustifiedRow[];
|
|
17
|
+
export type Responsive<T> = T | Partial<Record<"base" | "sm" | "md" | "lg", T>>;
|
|
18
|
+
/** Picks the value for a container width (falls back to `base`, then `fallback`). */
|
|
19
|
+
export declare function responsiveValue<T>(value: Responsive<T> | undefined, width: number | undefined, fallback: T): T;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Pure, deterministic layout math for Gallery (SSR-safe; no DOM).
|
|
2
|
+
/** Distributes items into `columns` by known aspect ratios (w/h), shortest column first. */
|
|
3
|
+
export function masonryColumns(ratios, columns) {
|
|
4
|
+
const n = Math.max(1, Math.floor(columns));
|
|
5
|
+
const cols = Array.from({ length: n }, () => []);
|
|
6
|
+
const heights = new Array(n).fill(0);
|
|
7
|
+
ratios.forEach((r, i) => {
|
|
8
|
+
let target = 0;
|
|
9
|
+
for (let c = 1; c < n; c++)
|
|
10
|
+
if (heights[c] < heights[target] - 1e-6)
|
|
11
|
+
target = c;
|
|
12
|
+
cols[target].push(i);
|
|
13
|
+
heights[target] += 1 / (r > 0 ? r : 1);
|
|
14
|
+
});
|
|
15
|
+
return cols;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Flickr-style justified rows: fills each row with items at `rowHeight` until it overflows the
|
|
19
|
+
* container width, then scales the row so it fits exactly. The last row keeps `rowHeight`.
|
|
20
|
+
* A row never grows taller than `rowHeight * maxScale`.
|
|
21
|
+
*/
|
|
22
|
+
export function justifyRows(ratios, width, rowHeight, gap = 0, maxScale = 1.6) {
|
|
23
|
+
const rows = [];
|
|
24
|
+
if (width <= 0)
|
|
25
|
+
return rows;
|
|
26
|
+
let row = [];
|
|
27
|
+
let sum = 0;
|
|
28
|
+
ratios.forEach((raw, i) => {
|
|
29
|
+
const r = raw > 0 ? raw : 1;
|
|
30
|
+
row.push(i);
|
|
31
|
+
sum += r;
|
|
32
|
+
const natural = sum * rowHeight + gap * (row.length - 1);
|
|
33
|
+
if (natural >= width) {
|
|
34
|
+
const height = Math.min((width - gap * (row.length - 1)) / sum, rowHeight * maxScale);
|
|
35
|
+
rows.push({ items: row, height, justified: true });
|
|
36
|
+
row = [];
|
|
37
|
+
sum = 0;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (row.length) {
|
|
41
|
+
const fit = (width - gap * (row.length - 1)) / sum;
|
|
42
|
+
rows.push({ items: row, height: Math.min(rowHeight, fit), justified: false });
|
|
43
|
+
}
|
|
44
|
+
return rows;
|
|
45
|
+
}
|
|
46
|
+
const BP = { sm: 640, md: 768, lg: 1024 };
|
|
47
|
+
/** Picks the value for a container width (falls back to `base`, then `fallback`). */
|
|
48
|
+
export function responsiveValue(value, width, fallback) {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return fallback;
|
|
51
|
+
if (typeof value !== "object" || value === null)
|
|
52
|
+
return value;
|
|
53
|
+
const v = value;
|
|
54
|
+
let out = v.base ?? fallback;
|
|
55
|
+
if (width === undefined)
|
|
56
|
+
return out;
|
|
57
|
+
for (const bp of ["sm", "md", "lg"])
|
|
58
|
+
if (width >= BP[bp] && v[bp] !== undefined)
|
|
59
|
+
out = v[bp];
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ImageAspect } from "../components/image.js";
|
|
3
|
+
import { type LightboxProps } from "./lightbox.js";
|
|
4
|
+
import { type Responsive } from "./gallery-layout.js";
|
|
5
|
+
import type { MediaItem } from "./types.js";
|
|
6
|
+
declare const galleryLabels: {
|
|
7
|
+
list: string;
|
|
8
|
+
enlarge: string;
|
|
9
|
+
enlargeUntitled: string;
|
|
10
|
+
remove: string;
|
|
11
|
+
caption: string;
|
|
12
|
+
captionPlaceholder: string;
|
|
13
|
+
add: string;
|
|
14
|
+
addHint: string;
|
|
15
|
+
loading: string;
|
|
16
|
+
video: string;
|
|
17
|
+
};
|
|
18
|
+
export type GalleryLabels = typeof galleryLabels;
|
|
19
|
+
export declare const galleryVariants: (props?: ({
|
|
20
|
+
gap?: "sm" | "md" | "lg" | null | undefined;
|
|
21
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
|
+
export interface GalleryProps<T extends MediaItem = MediaItem> extends Omit<React.HTMLAttributes<HTMLDivElement>, "onAdd"> {
|
|
23
|
+
items: T[];
|
|
24
|
+
/** `grid` equal tiles · `masonry` columns by ratio · `justified` equal-height rows. */
|
|
25
|
+
layout?: "grid" | "masonry" | "justified";
|
|
26
|
+
/** Columns (grid, masonry), per container width: `{ base: 2, md: 3, lg: 4 }`. */
|
|
27
|
+
columns?: Responsive<number>;
|
|
28
|
+
/** Tile ratio (grid). Default `"1/1"`. */
|
|
29
|
+
aspect?: ImageAspect;
|
|
30
|
+
/** Target row height in px (justified). Default 220. */
|
|
31
|
+
rowHeight?: number;
|
|
32
|
+
captions?: "none" | "below" | "overlay";
|
|
33
|
+
gap?: "sm" | "md" | "lg";
|
|
34
|
+
rounded?: "none" | "ui" | "ui-lg";
|
|
35
|
+
/** Open items in a Lightbox. Pass an object for Lightbox options (`download`, `info`…). */
|
|
36
|
+
lightbox?: boolean | Omit<LightboxProps, "items" | "children">;
|
|
37
|
+
/** `sizes` for each image. Default derived from the column count. */
|
|
38
|
+
sizes?: string;
|
|
39
|
+
/** Skeleton tiles that keep their ratio. */
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
skeletonCount?: number;
|
|
42
|
+
/** Edit mode: drag / keyboard reorder (+ Move menu), remove, caption. Uses the grid layout. */
|
|
43
|
+
editable?: boolean;
|
|
44
|
+
onReorder?: (ids: string[]) => void;
|
|
45
|
+
onRemove?: (id: string) => void;
|
|
46
|
+
onCaptionChange?: (id: string, caption: string) => void;
|
|
47
|
+
/** "Add images" tile (e.g. opens the Media picker). */
|
|
48
|
+
onAdd?: () => void;
|
|
49
|
+
/** Accessible name of the list. */
|
|
50
|
+
label?: string;
|
|
51
|
+
labels?: Partial<GalleryLabels>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Lays out an image collection as an even grid, masonry columns or justified rows, with an
|
|
55
|
+
* optional Lightbox and an edit mode (reorder by drag or keyboard, a Move menu as the
|
|
56
|
+
* non-drag alternative, remove, caption, add). Masonry and justified layouts are computed from
|
|
57
|
+
* known ratios, so they are deterministic and SSR-safe.
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Gallery items={photos} layout="masonry" columns={{ base: 2, md: 3 }} lightbox />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function Gallery<T extends MediaItem = MediaItem>({ items, layout, columns, aspect, rowHeight, captions, gap, rounded, lightbox, sizes, loading, skeletonCount, editable, onReorder, onRemove, onCaptionChange, onAdd, label, labels, className, style, ...props }: GalleryProps<T>): React.JSX.Element | null;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { ImagePlus, Play, Trash2 } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useLabels } from "../lib/labels.js";
|
|
8
|
+
import { useLocale } from "../lib/locale.js";
|
|
9
|
+
import { useContainerWidth } from "../lib/use-container-width.js";
|
|
10
|
+
import { IconButton } from "../components/button.js";
|
|
11
|
+
import { Image, aspectRatioOf } from "../components/image.js";
|
|
12
|
+
import { SortableGrid } from "../sortable/index.js";
|
|
13
|
+
import { Lightbox, LightboxTrigger } from "./lightbox.js";
|
|
14
|
+
import { toMediaSource } from "./media-provider.js";
|
|
15
|
+
import { justifyRows, masonryColumns, responsiveValue } from "./gallery-layout.js";
|
|
16
|
+
const galleryLabels = {
|
|
17
|
+
list: "Gallery",
|
|
18
|
+
enlarge: "Enlarge image: {alt}",
|
|
19
|
+
enlargeUntitled: "Enlarge image {index}",
|
|
20
|
+
remove: "Remove {name}",
|
|
21
|
+
caption: "Caption for {name}",
|
|
22
|
+
captionPlaceholder: "Add a caption",
|
|
23
|
+
add: "Add images",
|
|
24
|
+
addHint: "Pick from the library or drop files",
|
|
25
|
+
loading: "Loading images",
|
|
26
|
+
video: "Video",
|
|
27
|
+
};
|
|
28
|
+
export const galleryVariants = cva("vui-gallery @container/gallery min-w-0", {
|
|
29
|
+
variants: {
|
|
30
|
+
gap: { sm: "[--gallery-gap:0.375rem]", md: "[--gallery-gap:0.75rem]", lg: "[--gallery-gap:1.25rem]" },
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: { gap: "md" },
|
|
33
|
+
});
|
|
34
|
+
const DEFAULT_COLUMNS = { base: 2, sm: 3, lg: 4 };
|
|
35
|
+
/**
|
|
36
|
+
* Lays out an image collection as an even grid, masonry columns or justified rows, with an
|
|
37
|
+
* optional Lightbox and an edit mode (reorder by drag or keyboard, a Move menu as the
|
|
38
|
+
* non-drag alternative, remove, caption, add). Masonry and justified layouts are computed from
|
|
39
|
+
* known ratios, so they are deterministic and SSR-safe.
|
|
40
|
+
*
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Gallery items={photos} layout="masonry" columns={{ base: 2, md: 3 }} lightbox />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export function Gallery({ items, layout = "grid", columns = DEFAULT_COLUMNS, aspect = "1/1", rowHeight = 220, captions = "none", gap = "md", rounded = "ui", lightbox = false, sizes, loading = false, skeletonCount = 6, editable = false, onReorder, onRemove, onCaptionChange, onAdd, label, labels, className, style, ...props }) {
|
|
46
|
+
const t = useLabels("gallery", galleryLabels, labels);
|
|
47
|
+
const { locale } = useLocale();
|
|
48
|
+
const nf = React.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
49
|
+
const { ref, width } = useContainerWidth();
|
|
50
|
+
const sources = React.useMemo(() => items.map((it, i) => toMediaSource(it, i)), [items]);
|
|
51
|
+
const ratios = sources.map((s) => (s.width && s.height ? s.width / s.height : 4 / 3));
|
|
52
|
+
const cols = responsiveValue(columns, width, 3);
|
|
53
|
+
const gapPx = gap === "sm" ? 6 : gap === "lg" ? 20 : 12;
|
|
54
|
+
const autoSizes = sizes ?? `(min-width: 1024px) ${Math.round(100 / Math.max(1, cols))}vw, ${Math.round(100 / Math.min(2, cols))}vw`;
|
|
55
|
+
const listLabel = label ?? t("list");
|
|
56
|
+
const rad = rounded === "none" ? undefined : rounded;
|
|
57
|
+
const colVars = {};
|
|
58
|
+
const colAttrs = {};
|
|
59
|
+
if (typeof columns === "number")
|
|
60
|
+
colVars["--cols-base"] = String(columns);
|
|
61
|
+
else
|
|
62
|
+
for (const [bp, n] of Object.entries(columns)) {
|
|
63
|
+
colVars[`--cols-${bp}`] = String(n);
|
|
64
|
+
if (bp !== "base")
|
|
65
|
+
colAttrs[`data-cols-${bp}`] = "";
|
|
66
|
+
}
|
|
67
|
+
const rootProps = {
|
|
68
|
+
ref,
|
|
69
|
+
"data-slot": "gallery",
|
|
70
|
+
"data-layout": editable ? "grid" : layout,
|
|
71
|
+
className: cn(galleryVariants({ gap }), className),
|
|
72
|
+
style: { ...colVars, ...style },
|
|
73
|
+
...colAttrs,
|
|
74
|
+
...props,
|
|
75
|
+
};
|
|
76
|
+
/* --- loading ------------------------------------------------------ */
|
|
77
|
+
if (loading) {
|
|
78
|
+
const r = aspectRatioOf(aspect) ?? 1;
|
|
79
|
+
return (_jsx("div", { ...rootProps, "aria-busy": "true", "aria-label": t("loading"), role: "status", children: _jsx("div", { className: "vui-gallery-grid grid", children: Array.from({ length: skeletonCount }, (_, i) => (_jsx("span", { "aria-hidden": true, className: cn("ui-shimmer block bg-skeleton", rad === "ui" ? "rounded-ui" : rad === "ui-lg" ? "rounded-ui-lg" : ""), style: { aspectRatio: String(layout === "grid" ? r : ratios[i % Math.max(1, ratios.length)] ?? [1, 0.75, 1.33][i % 3]) } }, i))) }) }));
|
|
80
|
+
}
|
|
81
|
+
/* --- edit mode ---------------------------------------------------- */
|
|
82
|
+
if (editable) {
|
|
83
|
+
const addTile = onAdd ? (_jsxs("button", { type: "button", "data-slot": "gallery-add", onClick: onAdd, className: cn("vui-gallery-add focus-ring group/add flex w-full flex-col items-center justify-center gap-1.5 border border-dashed border-field-border bg-surface-2 text-center transition-colors hover:border-field-border-hover hover:bg-hover", items.length === 0 ? "min-h-56 rounded-ui-lg p-8" : "mt-(--gallery-gap) min-h-14 rounded-ui px-4 py-3 sm:flex-row sm:gap-2.5"), children: [_jsx(ImagePlus, { "aria-hidden": true, className: cn("text-fg-muted transition-colors group-hover/add:text-fg", items.length === 0 ? "size-7" : "size-[18px]"), strokeWidth: 1.6 }), _jsx("span", { className: "text-sm font-medium text-fg", children: t("add") }), items.length === 0 ? _jsx("span", { className: "text-[13px] text-fg-muted", children: t("addHint") }) : null] })) : null;
|
|
84
|
+
return (_jsxs("div", { ...rootProps, children: [items.length ? (_jsx(SortableGrid, { "aria-label": listLabel, items: sources, getId: (s) => s.id, getLabel: (s) => s.alt || s.caption || filenameOf(items, s.id) || s.id, onReorder: (next) => onReorder?.(next.map((s) => s.id)), disabled: !onReorder, handle: true, minItemWidth: "10rem", className: "gap-(--gallery-gap)", itemClassName: "overflow-hidden", renderActions: onRemove
|
|
85
|
+
? (s) => (_jsx(IconButton, { label: t("remove", { name: s.alt || filenameOf(items, s.id) || s.id }), size: "xs", variant: "ghost", className: "bg-popover text-fg-muted shadow-sm hover:text-danger", onClick: () => onRemove(s.id), children: _jsx(Trash2, {}) }))
|
|
86
|
+
: undefined, renderItem: (s) => (_jsxs("div", { className: "flex flex-col", children: [_jsx(Image, { src: assetOf(items, s.id) ?? s.src, alt: s.alt, aspect: aspect, sizes: "12rem", widths: [320, 480] }), onCaptionChange ? (_jsx("input", { type: "text", defaultValue: s.caption ?? "", "aria-label": t("caption", { name: s.alt || filenameOf(items, s.id) || s.id }), placeholder: t("captionPlaceholder"), onPointerDown: (e) => e.stopPropagation(), onKeyDown: (e) => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
if (e.key === "Enter")
|
|
89
|
+
e.currentTarget.blur();
|
|
90
|
+
}, onBlur: (e) => {
|
|
91
|
+
if (e.currentTarget.value !== (s.caption ?? ""))
|
|
92
|
+
onCaptionChange(s.id, e.currentTarget.value);
|
|
93
|
+
}, className: "focus-ring w-full border-t border-line bg-transparent px-2.5 py-2 text-[13px] text-fg placeholder:text-fg-subtle focus-visible:outline-offset-[-2px]" })) : null] })) })) : null, addTile] }));
|
|
94
|
+
}
|
|
95
|
+
if (items.length === 0)
|
|
96
|
+
return null;
|
|
97
|
+
/* --- view mode ---------------------------------------------------- */
|
|
98
|
+
const tile = (i, box = {}) => {
|
|
99
|
+
const s = sources[i];
|
|
100
|
+
// Video tiles show their poster (an <img> can't render the video file) with a play mark.
|
|
101
|
+
const isVideo = s.kind === "video";
|
|
102
|
+
const media = (_jsx(Image, { src: isVideo ? (s.poster ?? "") : (assetOf(items, s.id) ?? s.src), alt: lightbox ? "" : s.alt, width: s.width, height: s.height, aspect: box.aspect ?? (layout === "grid" ? aspect : "auto"), focal: s.focalPoint, blurDataURL: s.placeholder, sizes: autoSizes, rounded: rad, className: "vui-gallery-media w-full" }));
|
|
103
|
+
const playMark = isVideo ? (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 z-10 grid place-items-center", children: _jsx("span", { className: "dark grid size-11 place-items-center rounded-full bg-[color-mix(in_oklch,var(--scene)_62%,transparent)] text-fg backdrop-blur-sm", children: _jsx(Play, { className: "ms-0.5 size-4 fill-current" }) }) })) : null;
|
|
104
|
+
const overlay = captions === "overlay" && s.caption ? (_jsx("span", { "aria-hidden": lightbox ? true : undefined, className: "vui-gallery-overlay dark pointer-events-none absolute inset-x-0 bottom-0 z-10 rounded-b-[inherit] px-3 pt-8 pb-2.5 text-start text-[13px] leading-snug text-fg", children: s.caption })) : null;
|
|
105
|
+
const figureBody = lightbox ? (_jsxs(LightboxTrigger, { index: i, className: cn("vui-gallery-trigger group/tile relative block w-full overflow-hidden", rad === "ui" ? "rounded-ui" : rad === "ui-lg" ? "rounded-ui-lg" : ""), children: [_jsx("span", { className: "sr-only", children: s.alt ? t("enlarge", { alt: s.alt }) : t("enlargeUntitled", { index: nf.format(i + 1) }) }), media, playMark, overlay] })) : (_jsxs("div", { className: cn("relative overflow-hidden", rad === "ui" ? "rounded-ui" : rad === "ui-lg" ? "rounded-ui-lg" : ""), children: [media, playMark, overlay] }));
|
|
106
|
+
return (_jsx("li", { "data-slot": "gallery-item", className: cn("min-w-0", box.className), style: box.style, children: _jsxs("figure", { className: "m-0", children: [figureBody, captions === "below" && s.caption ? _jsx("figcaption", { className: "mt-2 text-[13px] leading-snug text-pretty text-fg-muted", children: s.caption }) : null, captions === "overlay" && s.caption && !lightbox ? _jsx("figcaption", { className: "sr-only", children: s.caption }) : null] }) }, s.id));
|
|
107
|
+
};
|
|
108
|
+
let body;
|
|
109
|
+
if (layout === "masonry") {
|
|
110
|
+
const groups = masonryColumns(ratios, cols);
|
|
111
|
+
body = (_jsx("div", { className: "vui-gallery-masonry flex items-start gap-(--gallery-gap)", "data-columns": cols, children: groups.map((g, c) => (_jsx("ul", { role: "list", "aria-label": c === 0 ? listLabel : undefined, className: "flex min-w-0 flex-1 flex-col gap-(--gallery-gap)", children: g.map((i) => tile(i)) }, c))) }));
|
|
112
|
+
}
|
|
113
|
+
else if (layout === "justified") {
|
|
114
|
+
if (width) {
|
|
115
|
+
const rows = justifyRows(ratios, width, rowHeight, gapPx);
|
|
116
|
+
body = (_jsx("ul", { role: "list", "aria-label": listLabel, className: "vui-gallery-justified flex flex-wrap gap-(--gallery-gap)", children: rows.flatMap((row) => row.items.map((i) => tile(i, { aspect: ratios[i], style: { width: Math.floor(ratios[i] * row.height * 100) / 100, flex: "none" } }))) }));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Before measuring (SSR): proportional flex rows — same look, no JS.
|
|
120
|
+
body = (_jsx("ul", { role: "list", "aria-label": listLabel, className: "vui-gallery-justified-css flex flex-wrap gap-(--gallery-gap)", children: sources.map((_, i) => tile(i, { aspect: ratios[i], style: { flex: `${ratios[i]} 1 ${ratios[i] * rowHeight}px` } })) }));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
body = (_jsx("ul", { role: "list", "aria-label": listLabel, className: "vui-gallery-grid grid", children: sources.map((_, i) => tile(i)) }));
|
|
125
|
+
}
|
|
126
|
+
const content = _jsx("div", { ...rootProps, children: body });
|
|
127
|
+
if (!lightbox)
|
|
128
|
+
return content;
|
|
129
|
+
const lbProps = typeof lightbox === "object" ? lightbox : {};
|
|
130
|
+
return (_jsx(Lightbox, { items: items, ...lbProps, children: content }));
|
|
131
|
+
}
|
|
132
|
+
function assetOf(items, id) {
|
|
133
|
+
const it = items.find((x) => "mime" in x && x.id === id);
|
|
134
|
+
return it;
|
|
135
|
+
}
|
|
136
|
+
function filenameOf(items, id) {
|
|
137
|
+
return assetOf(items, id)?.filename;
|
|
138
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { CropRect, MediaAsset } from "./types.js";
|
|
3
|
+
declare const cropperLabels: {
|
|
4
|
+
cropper: string;
|
|
5
|
+
toolbar: string;
|
|
6
|
+
instructions: string;
|
|
7
|
+
aspect: string;
|
|
8
|
+
zoom: string;
|
|
9
|
+
zoomIn: string;
|
|
10
|
+
zoomOut: string;
|
|
11
|
+
rotateLeft: string;
|
|
12
|
+
rotateRight: string;
|
|
13
|
+
flipH: string;
|
|
14
|
+
flipV: string;
|
|
15
|
+
reset: string;
|
|
16
|
+
original: string;
|
|
17
|
+
square: string;
|
|
18
|
+
social: string;
|
|
19
|
+
landscape: string;
|
|
20
|
+
classic: string;
|
|
21
|
+
portrait: string;
|
|
22
|
+
story: string;
|
|
23
|
+
avatar: string;
|
|
24
|
+
summary: string;
|
|
25
|
+
};
|
|
26
|
+
export type ImageCropperLabels = typeof cropperLabels;
|
|
27
|
+
export interface CropPreset {
|
|
28
|
+
/** Visible name ("Social"). The ratio is appended ("Social 1.91:1"). */
|
|
29
|
+
label: string;
|
|
30
|
+
/** Width / height, or `"original"` for the image's own ratio. */
|
|
31
|
+
value: number | "original";
|
|
32
|
+
/** Key to store the crop under (`asset.crops[name]`), e.g. `"og"`. */
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
/** `1.91` → "1.91:1" (locale decimal: "1,91:1"), `16/9` → "16:9". */
|
|
36
|
+
export declare function formatAspectRatio(value: number, locale?: string): string;
|
|
37
|
+
export interface ImageCropperProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
38
|
+
src: string | MediaAsset;
|
|
39
|
+
/** Crop in source pixels (rotated + flipped space). Controlled. */
|
|
40
|
+
value?: CropRect | null;
|
|
41
|
+
/** Initial crop (e.g. `asset.crops.og`). */
|
|
42
|
+
defaultValue?: CropRect | null;
|
|
43
|
+
/** Fires when an interaction ends, with the non-destructive crop. */
|
|
44
|
+
onChange?: (rect: CropRect, preset: CropPreset | undefined) => void;
|
|
45
|
+
aspect?: number | "original";
|
|
46
|
+
defaultAspect?: number | "original";
|
|
47
|
+
onAspectChange?: (aspect: number | "original") => void;
|
|
48
|
+
/** Ratio buttons. Pass `[]` to lock the ratio to `aspect`. */
|
|
49
|
+
presets?: CropPreset[];
|
|
50
|
+
shape?: "rect" | "round";
|
|
51
|
+
/** Rule-of-thirds grid while cropping. Default `true`. */
|
|
52
|
+
grid?: boolean;
|
|
53
|
+
minZoom?: number;
|
|
54
|
+
maxZoom?: number;
|
|
55
|
+
/** Show the toolbar (presets, zoom, rotate, flip, reset). Default `true`. */
|
|
56
|
+
toolbar?: boolean;
|
|
57
|
+
/** Allow rotate / flip. Default `true`. */
|
|
58
|
+
transform?: boolean;
|
|
59
|
+
/** Stage height. Default 22rem. */
|
|
60
|
+
height?: number | string;
|
|
61
|
+
labels?: Partial<ImageCropperLabels>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Crops an image to a ratio with drag, pinch, wheel and keyboard (arrows move, the slider zooms),
|
|
65
|
+
* plus a toolbar: ratio presets, zoom, rotate ±90°, flip, reset. It outputs a **non-destructive**
|
|
66
|
+
* `CropRect` in source pixels — store it in `asset.crops` and let the loader apply it, or bake a
|
|
67
|
+
* copy with `getCroppedBlob()`.
|
|
68
|
+
*
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <ImageCropper src={asset} defaultAspect={1.91} onChange={(rect) => adapter.update(asset.id, { crops: { ...asset.crops, og: rect } })} />
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const ImageCropper: React.ForwardRefExoticComponent<ImageCropperProps & React.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
export interface CroppedBlobOptions {
|
|
75
|
+
type?: "image/webp" | "image/jpeg" | "image/png";
|
|
76
|
+
/** 0..1, default 0.9. */
|
|
77
|
+
quality?: number;
|
|
78
|
+
/** Downscale so the output is at most this wide. */
|
|
79
|
+
maxWidth?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Bakes a `CropRect` into a new image (canvas, rotation- and flip-aware) for "Save as copy".
|
|
83
|
+
* The source must be same-origin or served with CORS, or the canvas is tainted.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getCroppedBlob(src: string, rect: CropRect, options?: CroppedBlobOptions): Promise<Blob>;
|
|
86
|
+
export {};
|