@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,251 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CalendarRange, X } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { useLocale } from "../lib/locale.js";
|
|
7
|
+
import { useLabels } from "../lib/labels.js";
|
|
8
|
+
import { useFieldControl, FieldContextReset } from "../lib/field-context.js";
|
|
9
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
10
|
+
import { useMediaQuery } from "../lib/use-media-query.js";
|
|
11
|
+
import { mergeIds } from "../lib/compose-refs.js";
|
|
12
|
+
import { controlVariants, itemVariants } from "../lib/variants.js";
|
|
13
|
+
import { addIsoDays, dateToIso, defaultRangePresets, isoToDate, rangeLength, todayIso, } from "../lib/date.js";
|
|
14
|
+
import { CalendarGrid, toDayMatchers, useCalendarWeek } from "./calendar.js";
|
|
15
|
+
import { useDateInputText } from "./date-picker.js";
|
|
16
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
17
|
+
import { Button } from "./button.js";
|
|
18
|
+
const dateRangePickerLabels = {
|
|
19
|
+
placeholder: "Pick a date range",
|
|
20
|
+
openCalendar: "Open calendar",
|
|
21
|
+
clear: "Clear",
|
|
22
|
+
apply: "Apply",
|
|
23
|
+
cancel: "Cancel",
|
|
24
|
+
presets: "Quick ranges",
|
|
25
|
+
start: "Start date",
|
|
26
|
+
end: "End date",
|
|
27
|
+
dialog: "Choose dates",
|
|
28
|
+
days: "{count, plural, one {# day} other {# days}}",
|
|
29
|
+
summary: "From {from} to {to}, {days}",
|
|
30
|
+
pickEnd: "From {from}. Now pick the end date.",
|
|
31
|
+
minDays: "Pick at least {count} days",
|
|
32
|
+
maxDays: "Pick at most {count} days",
|
|
33
|
+
today: "Today",
|
|
34
|
+
yesterday: "Yesterday",
|
|
35
|
+
last7: "Last 7 days",
|
|
36
|
+
last30: "Last 30 days",
|
|
37
|
+
thisWeek: "This week",
|
|
38
|
+
thisMonth: "This month",
|
|
39
|
+
lastMonth: "Last month",
|
|
40
|
+
last90: "Last 90 days",
|
|
41
|
+
thisYear: "This year",
|
|
42
|
+
};
|
|
43
|
+
const sameRange = (a, b) => (a?.from ?? null) === (b?.from ?? null) && (a?.to ?? null) === (b?.to ?? null);
|
|
44
|
+
/**
|
|
45
|
+
* A from–to range in one popover: presets column, one or two month grids, and a footer with the
|
|
46
|
+
* selected length. Hovering previews the band; `commit="apply"` holds changes until Apply.
|
|
47
|
+
* Values are `YYYY-MM-DD` strings.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <DateRangePicker presets value={range} onValueChange={setRange} />
|
|
51
|
+
* <DateRangePicker commit="apply" maxDays={31} min={todayIso()} />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export const DateRangePicker = React.forwardRef(function DateRangePicker(rawProps, ref) {
|
|
55
|
+
const { value: valueProp, defaultValue, onValueChange, presets: presetsProp = false, numberOfMonths = 2, commit = "immediate", minDays, maxDays, min, max, disabledDays, excludeDisabled, trigger = "button", nameFrom, nameTo, placeholder, clearable, size = "md", invalid, align = "start", open: openProp, defaultOpen, onOpenChange, onInputError, calendarProps, className, labels, inputLabels, calendarLabels, ...rest } = rawProps;
|
|
56
|
+
const control = useFieldControl({ ...rest, "aria-invalid": invalid ? true : undefined });
|
|
57
|
+
const t = useLabels("dateRangePicker", dateRangePickerLabels, labels);
|
|
58
|
+
const { format, timeZone } = useLocale();
|
|
59
|
+
const week = useCalendarWeek();
|
|
60
|
+
const wide = useMediaQuery("(min-width: 640px)");
|
|
61
|
+
const months = numberOfMonths === 2 && wide !== false ? 2 : 1;
|
|
62
|
+
const today = todayIso(timeZone === "UTC" ? undefined : timeZone);
|
|
63
|
+
const inert = control.disabled || control.readOnly;
|
|
64
|
+
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? null, onChange: onValueChange, name: "DateRangePicker" });
|
|
65
|
+
const [open, setOpenState] = useControllableState({ value: openProp, defaultValue: defaultOpen ?? false, onChange: onOpenChange, name: "DateRangePicker" });
|
|
66
|
+
const [draft, setDraft] = React.useState(value);
|
|
67
|
+
const [hover, setHover] = React.useState(null);
|
|
68
|
+
const [month, setMonth] = React.useState(() => isoToDate(value?.from ?? today));
|
|
69
|
+
const [lengthError, setLengthError] = React.useState(null);
|
|
70
|
+
const setOpen = (o) => {
|
|
71
|
+
if (o) {
|
|
72
|
+
setDraft(value);
|
|
73
|
+
setHover(null);
|
|
74
|
+
setLengthError(null);
|
|
75
|
+
const anchor = isoToDate(value?.from ?? today);
|
|
76
|
+
setMonth(new Date(anchor.getFullYear(), anchor.getMonth(), 1));
|
|
77
|
+
}
|
|
78
|
+
setOpenState(o);
|
|
79
|
+
};
|
|
80
|
+
const presets = React.useMemo(() => {
|
|
81
|
+
if (!presetsProp)
|
|
82
|
+
return [];
|
|
83
|
+
if (Array.isArray(presetsProp))
|
|
84
|
+
return presetsProp;
|
|
85
|
+
const keys = Object.keys(dateRangePickerLabels).filter((k) => ["today", "yesterday", "last7", "last30", "thisWeek", "thisMonth", "lastMonth", "last90", "thisYear"].includes(k));
|
|
86
|
+
return defaultRangePresets(Object.fromEntries(keys.map((k) => [k, t(k)])));
|
|
87
|
+
}, [presetsProp, t]);
|
|
88
|
+
const shown = commit === "apply" || open ? draft : value;
|
|
89
|
+
const activePreset = presets.find((p) => sameRange(p.range(today, week), shown))?.id ?? null;
|
|
90
|
+
const commitRange = (r, close) => {
|
|
91
|
+
setDraft(r);
|
|
92
|
+
if (commit === "immediate")
|
|
93
|
+
setValue(r);
|
|
94
|
+
if (close && commit === "immediate")
|
|
95
|
+
setOpenState(false);
|
|
96
|
+
};
|
|
97
|
+
const checkLength = (r) => {
|
|
98
|
+
if (!r.to)
|
|
99
|
+
return null;
|
|
100
|
+
const n = rangeLength(r);
|
|
101
|
+
if (minDays && n < minDays)
|
|
102
|
+
return t("minDays", { count: minDays });
|
|
103
|
+
if (maxDays && n > maxDays)
|
|
104
|
+
return t("maxDays", { count: maxDays });
|
|
105
|
+
return null;
|
|
106
|
+
};
|
|
107
|
+
const onSelect = (r) => {
|
|
108
|
+
setHover(null);
|
|
109
|
+
if (!r?.from) {
|
|
110
|
+
setLengthError(null);
|
|
111
|
+
return commitRange(null, false);
|
|
112
|
+
}
|
|
113
|
+
const next = { from: dateToIso(r.from), ...(r.to ? { to: dateToIso(r.to) } : {}) };
|
|
114
|
+
const problem = checkLength(next);
|
|
115
|
+
setLengthError(problem);
|
|
116
|
+
if (problem) {
|
|
117
|
+
setDraft({ from: next.from });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
commitRange(next, !!next.to);
|
|
121
|
+
};
|
|
122
|
+
// While the end is being picked, block days that would break min/max length.
|
|
123
|
+
const matchers = React.useMemo(() => {
|
|
124
|
+
const base = toDayMatchers({ min, max, disabledDays });
|
|
125
|
+
if (draft?.from && !draft.to) {
|
|
126
|
+
const from = isoToDate(draft.from);
|
|
127
|
+
if (maxDays) {
|
|
128
|
+
base.push({ after: isoToDate(addIsoDays(draft.from, maxDays - 1)) }, { before: isoToDate(addIsoDays(draft.from, -(maxDays - 1))) });
|
|
129
|
+
}
|
|
130
|
+
if (minDays && minDays > 1) {
|
|
131
|
+
const lo = isoToDate(addIsoDays(draft.from, -(minDays - 2)));
|
|
132
|
+
const hi = isoToDate(addIsoDays(draft.from, minDays - 2));
|
|
133
|
+
base.push((d) => d >= lo && d <= hi && d.getTime() !== from.getTime());
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return base;
|
|
137
|
+
}, [min, max, disabledDays, draft, minDays, maxDays]);
|
|
138
|
+
const previewModifiers = React.useMemo(() => {
|
|
139
|
+
if (!draft?.from || draft.to || !hover || hover === draft.from)
|
|
140
|
+
return undefined;
|
|
141
|
+
const [lo, hi] = hover > draft.from ? [draft.from, hover] : [hover, draft.from];
|
|
142
|
+
const a = isoToDate(lo);
|
|
143
|
+
const b = isoToDate(hi);
|
|
144
|
+
return { preview: (d) => d >= a && d <= b };
|
|
145
|
+
}, [draft, hover]);
|
|
146
|
+
const fmtRange = (r, style = "medium") => {
|
|
147
|
+
if (!r?.from)
|
|
148
|
+
return "";
|
|
149
|
+
if (!r.to)
|
|
150
|
+
return `${format.date(r.from, style)} – …`;
|
|
151
|
+
return r.from === r.to ? format.date(r.from, style) : format.dateRange(r.from, r.to, style);
|
|
152
|
+
};
|
|
153
|
+
const announcement = draft?.from
|
|
154
|
+
? draft.to
|
|
155
|
+
? t("summary", { from: format.date(draft.from, "long"), to: format.date(draft.to, "long"), days: t("days", { count: rangeLength(draft) }) })
|
|
156
|
+
: t("pickEnd", { from: format.date(draft.from, "long") })
|
|
157
|
+
: "";
|
|
158
|
+
/* ---------------- presets listbox ---------------- */
|
|
159
|
+
const presetRef = React.useRef(null);
|
|
160
|
+
const pickPreset = (p) => {
|
|
161
|
+
const r = p.range(today, week);
|
|
162
|
+
setLengthError(null);
|
|
163
|
+
const anchor = isoToDate(r.from);
|
|
164
|
+
setMonth(new Date(anchor.getFullYear(), anchor.getMonth(), 1));
|
|
165
|
+
commitRange(r, true);
|
|
166
|
+
};
|
|
167
|
+
const onPresetKeyDown = (e) => {
|
|
168
|
+
const opts = Array.from(presetRef.current?.querySelectorAll('[role="option"]') ?? []);
|
|
169
|
+
const cur = opts.indexOf(document.activeElement);
|
|
170
|
+
let next = -1;
|
|
171
|
+
if (e.key === "ArrowDown")
|
|
172
|
+
next = (cur + 1) % opts.length;
|
|
173
|
+
else if (e.key === "ArrowUp")
|
|
174
|
+
next = (cur - 1 + opts.length) % opts.length;
|
|
175
|
+
else if (e.key === "Home")
|
|
176
|
+
next = 0;
|
|
177
|
+
else if (e.key === "End")
|
|
178
|
+
next = opts.length - 1;
|
|
179
|
+
else if (e.key === "Enter" || e.key === " ") {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
const p = presets[cur];
|
|
182
|
+
if (p)
|
|
183
|
+
pickPreset(p);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
return;
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
opts[next]?.focus();
|
|
190
|
+
};
|
|
191
|
+
const focusablePreset = Math.max(0, presets.findIndex((p) => p.id === activePreset));
|
|
192
|
+
const footer = (_jsxs("div", { className: "-mx-1 flex flex-wrap items-center gap-x-3 gap-y-2 border-t border-line px-1 pt-2.5", children: [_jsx("p", { className: cn("me-auto min-w-0 text-xs tabular", lengthError ? "text-danger" : "text-fg-muted"), children: lengthError ?? (draft?.from ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-fg", children: fmtRange(draft) }), draft.to ? _jsx("span", { className: "ms-2 text-fg-subtle", children: t("days", { count: rangeLength(draft) }) }) : null] })) : ((placeholder ?? t("placeholder")))) }), _jsxs("div", { className: "flex items-center gap-1.5", children: [clearable && draft?.from ? (_jsx(Button, { size: "xs", variant: "ghost", onClick: () => commitRange(null, false), children: t("clear") })) : null, commit === "apply" ? (_jsxs(_Fragment, { children: [_jsx(Button, { size: "xs", variant: "ghost", onClick: () => setOpenState(false), children: t("cancel") }), _jsx(Button, { size: "xs", variant: "primary", disabled: !!draft?.from && !draft.to, onClick: () => {
|
|
193
|
+
setValue(draft);
|
|
194
|
+
setOpenState(false);
|
|
195
|
+
}, children: t("apply") })] })) : null] })] }));
|
|
196
|
+
const content = (_jsx(PopoverContent, { size: "auto", padded: false, align: align, "aria-label": t("dialog"), onOpenAutoFocus: (e) => e.preventDefault(), className: "max-w-[calc(100vw-1.5rem)]", children: _jsxs(FieldContextReset, { children: [_jsxs("div", { className: "flex flex-col sm:flex-row", children: [presets.length ? (_jsx("div", { ref: presetRef, role: "listbox", "aria-label": t("presets"), onKeyDown: onPresetKeyDown, className: "flex gap-1 overflow-x-auto border-b border-line p-2 scrollbar-none sm:w-40 sm:flex-col sm:overflow-visible sm:border-e sm:border-b-0", children: presets.map((p, i) => {
|
|
197
|
+
const selected = p.id === activePreset;
|
|
198
|
+
return (_jsx("div", { role: "option", "aria-selected": selected, tabIndex: i === focusablePreset ? 0 : -1, onClick: () => pickPreset(p), className: cn(itemVariants({ size: "sm" }), "shrink-0 whitespace-nowrap focus-ring sm:w-full", selected && "bg-accent-soft! font-medium text-accent-ink"), children: p.label }, p.id));
|
|
199
|
+
}) })) : null, _jsx("div", { className: "p-(--popover-p) [--popover-p:calc(var(--gap)*0.85)]", children: _jsx(CalendarGrid, { autoFocus: !presets.length, ...calendarProps, labels: calendarLabels, mode: "range", resetOnSelect: true, excludeDisabled: excludeDisabled, selected: draft ? { from: isoToDate(draft.from) ?? undefined, to: isoToDate(draft.to) ?? undefined } : undefined, onSelect: onSelect, month: month, onMonthChange: setMonth, numberOfMonths: months, disabled: matchers, modifiers: previewModifiers, onDayMouseEnter: (d) => setHover(dateToIso(d)), onDayFocus: (d) => setHover(dateToIso(d)), onDayMouseLeave: () => setHover(null), startMonth: calendarProps?.startMonth ?? (isoToDate(min) ?? undefined), endMonth: calendarProps?.endMonth ?? (isoToDate(max) ?? undefined), footer: footer }) })] }), _jsx("p", { className: "sr-only", "aria-live": "polite", children: announcement })] }) }));
|
|
200
|
+
const hidden = (_jsxs(_Fragment, { children: [nameFrom ? _jsx("input", { type: "hidden", name: nameFrom, value: value?.from ?? "" }) : null, nameTo ? _jsx("input", { type: "hidden", name: nameTo, value: value?.to ?? "" }) : null] }));
|
|
201
|
+
if (trigger === "input") {
|
|
202
|
+
return (_jsx(RangeInputs, { value: value, setValue: setValue, open: open, setOpen: (o) => !inert && setOpen(o), control: control, size: size, className: className, labels: labels, inputLabels: inputLabels, clearable: clearable, min: min, max: max, disabledDays: disabledDays, onInputError: onInputError, content: content, hidden: hidden, buttonRef: ref }));
|
|
203
|
+
}
|
|
204
|
+
return (_jsxs(Popover, { open: open, onOpenChange: (o) => !inert && setOpen(o), children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { ref: ref, type: "button", id: control.id, disabled: control.disabled, "aria-labelledby": control["aria-labelledby"] ? `${control["aria-labelledby"]} ${control.id}` : undefined, "aria-describedby": control["aria-describedby"], "aria-invalid": control["aria-invalid"] || undefined, "data-slot": "date-range-picker", "data-readonly": control.readOnly ? "" : undefined, "data-placeholder": value?.from ? undefined : "", className: cn(controlVariants({ size }), "w-auto cursor-default justify-start text-start focus-ring", className), children: [_jsx(CalendarRange, { "aria-hidden": true, className: "text-fg-subtle" }), control["aria-label"] && !control["aria-labelledby"] ? _jsxs("span", { className: "sr-only", children: [control["aria-label"], ", "] }) : null, _jsx("span", { className: cn("truncate tabular", !value?.from && "text-fg-subtle"), children: value?.from ? fmtRange(value) : (placeholder ?? t("placeholder")) })] }) }), content, hidden] }));
|
|
205
|
+
});
|
|
206
|
+
/* Two typeable fields in one box (trigger="input"). */
|
|
207
|
+
function RangeInputs({ value, setValue, open, setOpen, control, size, className, labels, inputLabels, clearable, min, max, disabledDays, onInputError, content, hidden, buttonRef, }) {
|
|
208
|
+
const t = useLabels("dateRangePicker", dateRangePickerLabels, labels);
|
|
209
|
+
const errorId = React.useId();
|
|
210
|
+
const from = useDateInputText({
|
|
211
|
+
value: value?.from ?? null,
|
|
212
|
+
onCommit: (f) => {
|
|
213
|
+
if (!f)
|
|
214
|
+
return setValue(null);
|
|
215
|
+
const to = value?.to && value.to >= f ? value.to : undefined;
|
|
216
|
+
setValue({ from: f, ...(to ? { to } : {}) });
|
|
217
|
+
},
|
|
218
|
+
min,
|
|
219
|
+
max,
|
|
220
|
+
disabledDays,
|
|
221
|
+
labels: inputLabels,
|
|
222
|
+
onError: onInputError,
|
|
223
|
+
});
|
|
224
|
+
const to = useDateInputText({
|
|
225
|
+
value: value?.to ?? null,
|
|
226
|
+
onCommit: (tv) => {
|
|
227
|
+
if (!tv)
|
|
228
|
+
return setValue(value?.from ? { from: value.from } : null);
|
|
229
|
+
if (!value?.from)
|
|
230
|
+
return setValue({ from: tv, to: tv });
|
|
231
|
+
setValue(tv < value.from ? { from: tv, to: value.from } : { from: value.from, to: tv });
|
|
232
|
+
},
|
|
233
|
+
min,
|
|
234
|
+
max,
|
|
235
|
+
disabledDays,
|
|
236
|
+
labels: inputLabels,
|
|
237
|
+
onError: onInputError,
|
|
238
|
+
});
|
|
239
|
+
const inert = control.disabled || control.readOnly;
|
|
240
|
+
const errorMessage = from.error ? from.errorMessage : to.error ? to.errorMessage : "";
|
|
241
|
+
const field = "h-full w-[calc(10ch+1rem)] min-w-0 flex-1 bg-transparent px-2 text-[length:inherit] text-fg tabular outline-none placeholder:text-fg-subtle disabled:cursor-not-allowed";
|
|
242
|
+
const shared = {
|
|
243
|
+
type: "text",
|
|
244
|
+
autoComplete: "off",
|
|
245
|
+
spellCheck: false,
|
|
246
|
+
disabled: control.disabled,
|
|
247
|
+
readOnly: control.readOnly,
|
|
248
|
+
"aria-describedby": mergeIds(control["aria-describedby"], errorMessage ? errorId : undefined),
|
|
249
|
+
};
|
|
250
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsxs("div", { role: "group", "aria-labelledby": control["aria-labelledby"], "aria-label": control["aria-label"], "data-slot": "date-range-picker", "data-readonly": control.readOnly ? "" : undefined, className: cn(controlVariants({ size }), "w-auto cursor-text gap-0 px-0", className), children: [_jsx(CalendarRange, { "aria-hidden": true, className: "ms-3 shrink-0 text-fg-subtle" }), _jsx("input", { ...shared, id: control.id, "aria-label": t("start"), "aria-invalid": !!from.error || !!control["aria-invalid"] || undefined, placeholder: from.placeholder, value: from.text, onChange: (e) => from.setText(e.currentTarget.value), onBlur: () => from.commit(), onKeyDown: (e) => e.key === "Enter" && from.commit(), className: cn(field, "ps-2") }), _jsx("span", { "aria-hidden": true, className: "text-fg-subtle", children: "\u2013" }), _jsx("input", { ...shared, "aria-label": t("end"), "aria-invalid": !!to.error || !!control["aria-invalid"] || undefined, placeholder: to.placeholder, value: to.text, onChange: (e) => to.setText(e.currentTarget.value), onBlur: () => to.commit(), onKeyDown: (e) => e.key === "Enter" && to.commit(), className: field }), errorMessage ? (_jsx("span", { id: errorId, className: "sr-only", children: errorMessage })) : null, _jsxs("span", { className: "flex shrink-0 items-center gap-0.5 pe-1", children: [clearable && value?.from && !inert ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": t("clear"), onClick: () => setValue(null), className: "inline-flex size-[calc(var(--control-h)-0.75rem)] items-center justify-center rounded-ui-sm text-fg-muted hover:bg-hover hover:text-fg [&_svg]:size-3.5", children: _jsx(X, { "aria-hidden": true }) })) : null, _jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { ref: buttonRef, type: "button", "aria-label": t("openCalendar"), disabled: inert, className: "inline-flex size-[calc(var(--control-h)-0.75rem)] items-center justify-center rounded-ui-sm text-fg-muted transition-colors hover:bg-hover hover:text-fg focus-ring disabled:opacity-40 [&_svg]:size-4", children: _jsx(CalendarRange, { "aria-hidden": true }) }) })] })] }) }), content, hidden] }));
|
|
251
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { descriptionListLabels } from "../lib/data-islands.js";
|
|
3
|
+
import type { ValueFormat } from "../lib/value-format.js";
|
|
4
|
+
export { DescriptionEditable, type DescriptionEditableProps } from "../lib/data-islands.js";
|
|
5
|
+
export type DescriptionListLabels = Partial<typeof descriptionListLabels>;
|
|
6
|
+
/** One row of `DescriptionList items`. */
|
|
7
|
+
export interface DescriptionEntry {
|
|
8
|
+
/** Stable key (also passed to `onEdit`). */
|
|
9
|
+
key: string;
|
|
10
|
+
label: React.ReactNode;
|
|
11
|
+
/** The value. Numbers/dates are formatted with `format`; `null`/`undefined`/`""` show the empty value. */
|
|
12
|
+
value?: React.ReactNode;
|
|
13
|
+
/** Small help text under the value. */
|
|
14
|
+
hint?: React.ReactNode;
|
|
15
|
+
/** Format a number or date value. */
|
|
16
|
+
format?: ValueFormat;
|
|
17
|
+
/** Copy button: `true` copies the value text, a string copies that string. */
|
|
18
|
+
copyable?: boolean | string;
|
|
19
|
+
/** Grid layout only: columns to span. */
|
|
20
|
+
span?: 1 | 2 | "full";
|
|
21
|
+
/** Click-to-edit (needs `onEdit` on the list). The edited text starts from `editValue` or the value. */
|
|
22
|
+
editable?: boolean;
|
|
23
|
+
editValue?: string;
|
|
24
|
+
inputType?: "text" | "email" | "tel" | "url" | "number";
|
|
25
|
+
}
|
|
26
|
+
export interface DescriptionListProps extends Omit<React.HTMLAttributes<HTMLDListElement>, "children"> {
|
|
27
|
+
/** Rows as data. Or compose `<DescriptionItem>` children. */
|
|
28
|
+
items?: DescriptionEntry[];
|
|
29
|
+
/**
|
|
30
|
+
* `"horizontal"` (default): label start, value end — switches to stacked under ~28rem of container width.
|
|
31
|
+
* `"vertical"`: label above value. `"grid"`: stacked pairs in `columns`.
|
|
32
|
+
*/
|
|
33
|
+
layout?: "horizontal" | "vertical" | "grid";
|
|
34
|
+
/** Grid layout columns (fewer on narrow containers). Default 2. */
|
|
35
|
+
columns?: 1 | 2 | 3;
|
|
36
|
+
/** Width of the label column in horizontal layout. Default `"11rem"`. */
|
|
37
|
+
labelWidth?: string;
|
|
38
|
+
/** Hairlines between rows. Default `true` for horizontal, `false` otherwise. */
|
|
39
|
+
divided?: boolean;
|
|
40
|
+
/** Default `"md"`. */
|
|
41
|
+
size?: "sm" | "md";
|
|
42
|
+
/** Shown for empty values. Default "—". */
|
|
43
|
+
emptyValue?: React.ReactNode;
|
|
44
|
+
/** Saves an inline edit (rows with `editable`). Reject to show the error state. */
|
|
45
|
+
onEdit?: (key: string, value: string) => void | Promise<void>;
|
|
46
|
+
/** Label + value skeletons for this many rows. */
|
|
47
|
+
loading?: boolean | number;
|
|
48
|
+
labels?: DescriptionListLabels;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Label/value pairs for record details and summaries — a native `<dl>`. Values can be copied
|
|
53
|
+
* or edited in place. Server-component compatible (copy and edit are small client islands).
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <DescriptionList items={[
|
|
57
|
+
* { key: "owner", label: "Owner", value: "Ayşe Kaya" },
|
|
58
|
+
* { key: "amount", label: "Amount", value: 48500, format: "currency" },
|
|
59
|
+
* { key: "iban", label: "IBAN", value: "TR33 0006 1005 1978 6457 8413 26", copyable: true },
|
|
60
|
+
* ]} />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const DescriptionList: React.ForwardRefExoticComponent<DescriptionListProps & React.RefAttributes<HTMLDListElement>>;
|
|
64
|
+
export interface DescriptionItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
65
|
+
label: React.ReactNode;
|
|
66
|
+
/** The value. */
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
hint?: React.ReactNode;
|
|
69
|
+
/** Copy button: `true` copies the text value, a string copies that string. */
|
|
70
|
+
copyable?: boolean | string;
|
|
71
|
+
/** Grid layout: columns to span. */
|
|
72
|
+
span?: 1 | 2 | "full";
|
|
73
|
+
/** Shown when the value is empty. Default "—". */
|
|
74
|
+
emptyValue?: React.ReactNode;
|
|
75
|
+
/** Inline edit slot (e.g. `<DescriptionEditable … />`) — replaces the value. */
|
|
76
|
+
edit?: React.ReactNode;
|
|
77
|
+
/** Trailing slot after the value (a link, a status badge). */
|
|
78
|
+
action?: React.ReactNode;
|
|
79
|
+
labels?: DescriptionListLabels;
|
|
80
|
+
}
|
|
81
|
+
/** One label/value pair (`<div><dt/><dd/></div>`). */
|
|
82
|
+
export declare const DescriptionItem: React.ForwardRefExoticComponent<DescriptionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
|
+
export interface DescriptionGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
84
|
+
title: React.ReactNode;
|
|
85
|
+
description?: React.ReactNode;
|
|
86
|
+
/** Heading level. Default `"h4"`. */
|
|
87
|
+
titleAs?: "h2" | "h3" | "h4" | "h5";
|
|
88
|
+
/** Slot at the end of the heading row ("Edit" link). */
|
|
89
|
+
action?: React.ReactNode;
|
|
90
|
+
}
|
|
91
|
+
/** A titled section of a details view; put a DescriptionList inside. */
|
|
92
|
+
export declare function DescriptionGroup({ title, description, titleAs: H, action, className, children, ...props }: DescriptionGroupProps): React.JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { CopyValueButton, DataLabel, DescriptionEditable, ValueText } from "../lib/data-islands.js";
|
|
5
|
+
import { Skeleton } from "./skeleton.js";
|
|
6
|
+
export { DescriptionEditable } from "../lib/data-islands.js";
|
|
7
|
+
const gridCols = { 1: "", 2: "@lg/dl:grid-cols-2", 3: "@lg/dl:grid-cols-2 @3xl/dl:grid-cols-3" };
|
|
8
|
+
/**
|
|
9
|
+
* Label/value pairs for record details and summaries — a native `<dl>`. Values can be copied
|
|
10
|
+
* or edited in place. Server-component compatible (copy and edit are small client islands).
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <DescriptionList items={[
|
|
14
|
+
* { key: "owner", label: "Owner", value: "Ayşe Kaya" },
|
|
15
|
+
* { key: "amount", label: "Amount", value: 48500, format: "currency" },
|
|
16
|
+
* { key: "iban", label: "IBAN", value: "TR33 0006 1005 1978 6457 8413 26", copyable: true },
|
|
17
|
+
* ]} />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const DescriptionList = React.forwardRef(function DescriptionList({ items, layout = "horizontal", columns = 2, labelWidth, divided, size = "md", emptyValue, onEdit, loading, labels, className, style, children, ...props }, ref) {
|
|
21
|
+
const isDivided = divided ?? layout === "horizontal";
|
|
22
|
+
const rows = loading ? (Array.from({ length: typeof loading === "number" ? loading : 4 }, (_, i) => (_jsxs("div", { "data-slot": "description-item", "aria-hidden": true, className: "ui-dl-row", children: [_jsx("dt", { children: _jsx(Skeleton, { shape: "text", className: "h-3 w-20" }) }), _jsx("dd", { children: _jsx(Skeleton, { shape: "text", className: "h-3", style: { width: `${70 - ((i * 13) % 35)}%` } }) })] }, i)))) : items ? (items.map((it) => (_jsx(DescriptionItem, { label: it.label, hint: it.hint, span: it.span, copyable: it.copyable, emptyValue: emptyValue, labels: labels, edit: it.editable && onEdit ? (_jsx(DescriptionEditable, { value: it.editValue ?? (typeof it.value === "string" || typeof it.value === "number" ? String(it.value) : ""), display: renderValue(it.value, it.format), label: typeof it.label === "string" ? it.label : it.key, inputType: it.inputType, labels: labels, onSave: (v) => onEdit(it.key, v) })) : undefined, children: renderValue(it.value, it.format) }, it.key)))) : (children);
|
|
23
|
+
return (_jsx("dl", { ref: ref, "data-slot": "description-list", "data-layout": layout, "data-divided": isDivided ? "" : undefined, "data-size": size, "aria-busy": loading ? true : undefined, className: cn("ui-dl @container/dl m-0 grid min-w-0", size === "sm" ? "text-[12.5px]" : "text-[13px]", layout === "grid" ? cn("grid-cols-1 gap-x-6 gap-y-4", gridCols[columns]) : null, className), style: labelWidth ? { ["--dl-label-w"]: labelWidth, ...style } : style, ...props, children: rows }));
|
|
24
|
+
});
|
|
25
|
+
function renderValue(value, format) {
|
|
26
|
+
if (format && (typeof value === "number" || typeof value === "string"))
|
|
27
|
+
return _jsx(ValueText, { value: value, format: format });
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
const isEmpty = (v) => v === null || v === undefined || v === "" || v === false;
|
|
31
|
+
/** One label/value pair (`<div><dt/><dd/></div>`). */
|
|
32
|
+
export const DescriptionItem = React.forwardRef(function DescriptionItem({ label, children, hint, copyable, span, emptyValue, edit, action, labels, className, ...props }, ref) {
|
|
33
|
+
const empty = isEmpty(children);
|
|
34
|
+
const copyText = typeof copyable === "string" ? copyable : copyable && (typeof children === "string" || typeof children === "number") ? String(children) : undefined;
|
|
35
|
+
const labelText = typeof label === "string" ? label : "value";
|
|
36
|
+
return (_jsxs("div", { ref: ref, "data-slot": "description-item", className: cn("ui-dl-row", span === 2 && "@lg/dl:col-span-2", span === "full" && "col-span-full", className), ...props, children: [_jsx("dt", { "data-slot": "description-label", children: label }), _jsxs("dd", { "data-slot": "description-value", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [edit ?? (_jsx("span", { className: cn("min-w-0 break-words", empty && "text-fg-subtle"), children: empty ? (emptyValue ?? _jsx("span", { "aria-hidden": true, children: "\u2014" })) : children })), copyText && !empty ? _jsx(CopyValueButton, { text: copyText, label: labelText, labels: labels, className: "-my-1" }) : null, action ? _jsx("span", { className: "ms-auto flex shrink-0 items-center gap-1.5", children: action }) : null] }), empty && !edit && emptyValue === undefined ? (_jsx("span", { className: "sr-only", children: _jsx(DataLabel, { ns: "descriptionList", id: "empty", override: labels }) })) : null, hint ? _jsx("span", { className: "mt-0.5 block text-xs text-fg-subtle", children: hint }) : null] })] }));
|
|
37
|
+
});
|
|
38
|
+
/** A titled section of a details view; put a DescriptionList inside. */
|
|
39
|
+
export function DescriptionGroup({ title, description, titleAs: H = "h4", action, className, children, ...props }) {
|
|
40
|
+
const id = React.useId();
|
|
41
|
+
return (_jsxs("section", { "data-slot": "description-group", "aria-labelledby": id, className: cn("grid content-start gap-2", className), ...props, children: [_jsxs("div", { className: "flex items-end justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(H, { id: id, className: "font-mono text-[11px] font-medium tracking-[0.06em] text-fg-subtle", children: title }), description ? _jsx("p", { className: "mt-0.5 text-xs text-fg-muted", children: description }) : null] }), action] }), children] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
3
|
+
type SlotComponent = React.ComponentType<React.HTMLAttributes<HTMLElement> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
interface LayerParts {
|
|
8
|
+
/** Element that names the layer (Radix Title → `aria-labelledby`). */
|
|
9
|
+
Title: SlotComponent;
|
|
10
|
+
/** Element that describes the layer (Radix Description → `aria-describedby`). */
|
|
11
|
+
Description: SlotComponent;
|
|
12
|
+
/** Called while a description is mounted, so the content can drop a dangling `aria-describedby`. */
|
|
13
|
+
registerDescription?: () => () => void;
|
|
14
|
+
}
|
|
15
|
+
/** Lets a layer (Dialog, Alert Dialog, Sheet…) plug its accessible Title/Description into the shared header. */
|
|
16
|
+
export declare function LayerPartsProvider({ value, children }: {
|
|
17
|
+
value: LayerParts;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
export interface LayerHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
21
|
+
/** Required: names the layer for assistive tech. Use `srOnly` to hide it visually. */
|
|
22
|
+
title: React.ReactNode;
|
|
23
|
+
description?: React.ReactNode;
|
|
24
|
+
/** Leading icon or icon well. */
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
/** Trailing control next to the title (a status badge, a menu). */
|
|
27
|
+
action?: React.ReactNode;
|
|
28
|
+
/** Keeps title and description for screen readers only. */
|
|
29
|
+
srOnly?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The fixed top of a layer: title, optional description, icon and action. Shared by Dialog,
|
|
33
|
+
* Alert Dialog, Sheet and Drawer (exported under each name: `DialogHeader`, `SheetHeader`…).
|
|
34
|
+
*/
|
|
35
|
+
export declare const LayerHeader: React.ForwardRefExoticComponent<LayerHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export interface LayerBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
/** Remove the default padding (full-bleed lists, media). */
|
|
38
|
+
flush?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The scrolling middle of a layer. Header and footer stay fixed; only the body scrolls. */
|
|
41
|
+
export declare const LayerBody: React.ForwardRefExoticComponent<LayerBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
export interface LayerFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
43
|
+
/** `"end"` (default) groups the buttons at the end; `"between"` pushes the first child to the start. */
|
|
44
|
+
align?: "end" | "between" | "stretch";
|
|
45
|
+
}
|
|
46
|
+
/** The fixed bottom of a layer: actions, primary last. Stacks (primary on top) inside a mobile sheet. */
|
|
47
|
+
export declare const LayerFooter: React.ForwardRefExoticComponent<LayerFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
|
+
type Guard = () => boolean | Promise<boolean>;
|
|
49
|
+
interface DialogRootContextValue {
|
|
50
|
+
open: boolean;
|
|
51
|
+
/** Request a state change; closing runs the content's `onBeforeClose` guard first. */
|
|
52
|
+
requestOpenChange: (open: boolean) => void;
|
|
53
|
+
setGuard: (guard: Guard | undefined) => void;
|
|
54
|
+
modal: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** Read the nearest Dialog/Sheet/Drawer root — e.g. to close it from custom code (`requestOpenChange(false)`). */
|
|
57
|
+
export declare function useDialogRoot(): DialogRootContextValue;
|
|
58
|
+
export interface DialogProps {
|
|
59
|
+
open?: boolean;
|
|
60
|
+
defaultOpen?: boolean;
|
|
61
|
+
onOpenChange?: (open: boolean) => void;
|
|
62
|
+
/** `false` keeps the page behind interactive (no overlay, no focus trap). Default `true`. */
|
|
63
|
+
modal?: boolean;
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A focused task that keeps the user in context (modal by default).
|
|
68
|
+
*
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <Dialog>
|
|
71
|
+
* <DialogTrigger asChild><Button>New contact</Button></DialogTrigger>
|
|
72
|
+
* <DialogContent size="md">
|
|
73
|
+
* <DialogHeader title="New contact" description="Add a contact manually." />
|
|
74
|
+
* <DialogBody>…</DialogBody>
|
|
75
|
+
* <DialogFooter>
|
|
76
|
+
* <DialogClose asChild><Button>Cancel</Button></DialogClose>
|
|
77
|
+
* <Button variant="primary">Save</Button>
|
|
78
|
+
* </DialogFooter>
|
|
79
|
+
* </DialogContent>
|
|
80
|
+
* </Dialog>
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function Dialog({ open: openProp, defaultOpen, onOpenChange, modal, children }: DialogProps): React.JSX.Element;
|
|
84
|
+
export declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
85
|
+
export declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
86
|
+
export declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
87
|
+
export declare const DialogTitle: React.ForwardRefExoticComponent<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
88
|
+
export declare const DialogDescription: React.ForwardRefExoticComponent<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
89
|
+
/** The dimmed backdrop. `DialogContent` renders its own; export for custom layers. */
|
|
90
|
+
export declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
91
|
+
blurred?: boolean;
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
declare const dialogLabels: {
|
|
94
|
+
close: string;
|
|
95
|
+
};
|
|
96
|
+
/** Shared plumbing for every Radix Dialog-based panel (Dialog, Sheet, Drawer). */
|
|
97
|
+
export interface LayerContentBaseProps {
|
|
98
|
+
/** `false` → overlay click and Esc do not close (an unsaved form, a running import). Close buttons still work. */
|
|
99
|
+
dismissible?: boolean;
|
|
100
|
+
/** Runs on every close attempt (Esc, overlay, close button, `DialogClose`). Return/resolve `false` to stay open. */
|
|
101
|
+
onBeforeClose?: () => boolean | Promise<boolean>;
|
|
102
|
+
/** Hide the built-in × button. */
|
|
103
|
+
hideClose?: boolean;
|
|
104
|
+
/** Portal target. Defaults to the nearest `PortalContainer` / `ThemeScope`, else `document.body`. */
|
|
105
|
+
container?: HTMLElement | null;
|
|
106
|
+
/** Override the built-in strings (`close`). */
|
|
107
|
+
labels?: Partial<typeof dialogLabels>;
|
|
108
|
+
}
|
|
109
|
+
export interface LayerContentShellProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, LayerContentBaseProps {
|
|
110
|
+
/** Class of the overlay element. */
|
|
111
|
+
overlayClassName?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Internal: portal + overlay + layer depth + close guard + × button around a Radix Dialog.Content.
|
|
115
|
+
* Exported so other layers (Sheet, Drawer, Notification panel) share one implementation.
|
|
116
|
+
*/
|
|
117
|
+
export declare const LayerContentShell: React.ForwardRefExoticComponent<LayerContentShellProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
+
export type DialogSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
119
|
+
export interface DialogContentProps extends LayerContentShellProps {
|
|
120
|
+
/** 400 / 520 / 680 / 880 px, or the viewport minus a 12px gutter. Default `"md"`. */
|
|
121
|
+
size?: DialogSize;
|
|
122
|
+
/**
|
|
123
|
+
* Behaviour below 640px (CSS only, no component swap): `"sheet"` (default) anchors to the bottom
|
|
124
|
+
* and stacks the footer; `"center"` stays a centred card; `"fullscreen"` fills the screen (long forms).
|
|
125
|
+
*/
|
|
126
|
+
mobile?: "sheet" | "center" | "fullscreen";
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The dialog panel. Renders its own portal and overlay, traps focus, closes on Esc, returns
|
|
130
|
+
* focus to the trigger. Initial focus goes to `[data-autofocus]` if present, else the first field.
|
|
131
|
+
*/
|
|
132
|
+
export declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
133
|
+
/** `LayerHeader` for dialogs. */
|
|
134
|
+
export declare const DialogHeader: React.ForwardRefExoticComponent<LayerHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
135
|
+
/** `LayerBody` for dialogs. */
|
|
136
|
+
export declare const DialogBody: React.ForwardRefExoticComponent<LayerBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
+
/** `LayerFooter` for dialogs. */
|
|
138
|
+
export declare const DialogFooter: React.ForwardRefExoticComponent<LayerFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
139
|
+
export {};
|