@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,294 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Command as Cmdk } from "cmdk";
|
|
5
|
+
import { Check, ChevronsUpDown, Plus, Search, X } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { FieldContextReset, useFieldContext, useFieldControl } from "../lib/field-context.js";
|
|
8
|
+
import { useLabels } from "../lib/labels.js";
|
|
9
|
+
import { useLocale } from "../lib/locale.js";
|
|
10
|
+
import { cmdkFilter, foldText, highlightParts } from "../lib/text.js";
|
|
11
|
+
import { useAsyncList } from "../lib/use-async-list.js";
|
|
12
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
13
|
+
import { controlVariants, itemSlots, itemVariants } from "../lib/variants.js";
|
|
14
|
+
import { Badge } from "./badge.js";
|
|
15
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
16
|
+
import { Spinner } from "./spinner.js";
|
|
17
|
+
const comboboxLabels = {
|
|
18
|
+
placeholder: "Select…",
|
|
19
|
+
placeholderMultiple: "Add…",
|
|
20
|
+
search: "Search…",
|
|
21
|
+
empty: "No results",
|
|
22
|
+
create: "Create “{query}”",
|
|
23
|
+
results: "{count, plural, =0 {No results} one {# result} other {# results}}",
|
|
24
|
+
error: "Couldn't load results.",
|
|
25
|
+
retry: "Try again",
|
|
26
|
+
loading: "Loading…",
|
|
27
|
+
loadMore: "Show more results",
|
|
28
|
+
clear: "Clear selection",
|
|
29
|
+
selected: "Selected",
|
|
30
|
+
selectedCount: "{count, plural, one {# selected} other {# selected}}",
|
|
31
|
+
remove: "Remove {label}",
|
|
32
|
+
more: "+{count}",
|
|
33
|
+
moreLabel: "{count, plural, one {# more selected} other {# more selected}}",
|
|
34
|
+
};
|
|
35
|
+
const asOption = (item) => item;
|
|
36
|
+
const defaultGetValue = (item) => String(asOption(item).value ?? "");
|
|
37
|
+
const defaultGetLabel = (item) => String(asOption(item).label ?? asOption(item).value ?? "");
|
|
38
|
+
const CREATE_VALUE = "\u0000create";
|
|
39
|
+
const MORE_VALUE = "\u0000more";
|
|
40
|
+
function Highlight({ text, query, locale }) {
|
|
41
|
+
if (!query.trim())
|
|
42
|
+
return _jsx(_Fragment, { children: text });
|
|
43
|
+
return (_jsx(_Fragment, { children: highlightParts(text, query, locale).map((p, i) => p.match ? (_jsx("span", { "data-match": "", className: "font-semibold text-fg", children: p.text }, i)) : (_jsx(React.Fragment, { children: p.text }, i))) }));
|
|
44
|
+
}
|
|
45
|
+
function ComboboxInner(props, ref) {
|
|
46
|
+
const { items: staticItems, loadItems, debounce, getValue = defaultGetValue, getLabel = defaultGetLabel, getKeywords = (item) => asOption(item).keywords, getDisabled = (item) => Boolean(asOption(item).disabled), getGroup = (item) => asOption(item).group, renderItem, onCreate, selectedItems, placeholder, searchPlaceholder, emptyMessage, size = "md", variant = "default", mode = "popover", loading: staticLoading, name: nameProp, disabled: disabledProp, invalid, readOnly: readOnlyProp, required, open: openProp, defaultOpen, onOpenChange, closeOnSelect, id, className, contentClassName, listClassName, labels, multiple, clearable, maxVisibleChips, } = props;
|
|
47
|
+
const t = useLabels("combobox", comboboxLabels, labels);
|
|
48
|
+
const { locale } = useLocale();
|
|
49
|
+
const field = useFieldContext();
|
|
50
|
+
const control = useFieldControl({
|
|
51
|
+
id,
|
|
52
|
+
disabled: disabledProp,
|
|
53
|
+
readOnly: readOnlyProp,
|
|
54
|
+
required,
|
|
55
|
+
"aria-invalid": invalid ? true : undefined,
|
|
56
|
+
"aria-label": props["aria-label"],
|
|
57
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
58
|
+
"aria-describedby": props["aria-describedby"],
|
|
59
|
+
});
|
|
60
|
+
const disabled = Boolean(control.disabled);
|
|
61
|
+
const readOnly = Boolean(control.readOnly);
|
|
62
|
+
const name = nameProp ?? field?.name;
|
|
63
|
+
const inert = disabled || readOnly;
|
|
64
|
+
/* ---------------------------------------------------------------- value */
|
|
65
|
+
const toArray = (v) => v === undefined ? undefined : Array.isArray(v) ? v : v === null ? [] : [v];
|
|
66
|
+
const known = React.useRef(new Map());
|
|
67
|
+
for (const item of selectedItems ?? [])
|
|
68
|
+
known.current.set(getValue(item), item);
|
|
69
|
+
for (const item of staticItems ?? [])
|
|
70
|
+
known.current.set(getValue(item), item);
|
|
71
|
+
const [values, setValues] = useControllableState({
|
|
72
|
+
value: toArray(props.value),
|
|
73
|
+
defaultValue: () => toArray(props.defaultValue) ?? [],
|
|
74
|
+
onChange: (next) => {
|
|
75
|
+
const resolved = next.map((v) => known.current.get(v)).filter((x) => x !== undefined);
|
|
76
|
+
if (multiple)
|
|
77
|
+
props.onValueChange?.(next, resolved);
|
|
78
|
+
else
|
|
79
|
+
props.onValueChange?.(next[0] ?? null, resolved[0] ?? null);
|
|
80
|
+
},
|
|
81
|
+
name: "Combobox",
|
|
82
|
+
});
|
|
83
|
+
const [open, setOpenState] = useControllableState({ value: openProp, defaultValue: defaultOpen ?? false, onChange: onOpenChange, name: "Combobox" });
|
|
84
|
+
const setOpen = (next) => {
|
|
85
|
+
if (next && inert)
|
|
86
|
+
return;
|
|
87
|
+
setOpenState(next);
|
|
88
|
+
if (!next)
|
|
89
|
+
setQuery("");
|
|
90
|
+
};
|
|
91
|
+
const [query, setQuery] = React.useState("");
|
|
92
|
+
const [creating, setCreating] = React.useState(false);
|
|
93
|
+
/* ---------------------------------------------------------------- items */
|
|
94
|
+
const async = useAsyncList({ load: loadItems, query, debounce, enabled: mode === "inline" || open });
|
|
95
|
+
for (const item of async.items)
|
|
96
|
+
known.current.set(getValue(item), item);
|
|
97
|
+
const visible = React.useMemo(() => {
|
|
98
|
+
if (loadItems)
|
|
99
|
+
return async.items;
|
|
100
|
+
const list = staticItems ?? [];
|
|
101
|
+
const q = query.trim();
|
|
102
|
+
if (!q)
|
|
103
|
+
return list;
|
|
104
|
+
const score = cmdkFilter(locale);
|
|
105
|
+
return list
|
|
106
|
+
.map((item, index) => ({ item, index, s: score(getLabel(item), q, getKeywords(item)) }))
|
|
107
|
+
.filter((x) => x.s > 0)
|
|
108
|
+
.sort((a, b) => b.s - a.s || a.index - b.index)
|
|
109
|
+
.map((x) => x.item);
|
|
110
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
+
}, [loadItems, async.items, staticItems, query, locale]);
|
|
112
|
+
const groups = React.useMemo(() => {
|
|
113
|
+
const out = [];
|
|
114
|
+
const byKey = new Map();
|
|
115
|
+
for (const item of visible) {
|
|
116
|
+
const g = getGroup(item);
|
|
117
|
+
const key = g ?? "";
|
|
118
|
+
let entry = byKey.get(key);
|
|
119
|
+
if (!entry) {
|
|
120
|
+
entry = { label: g, items: [] };
|
|
121
|
+
byKey.set(key, entry);
|
|
122
|
+
out.push(entry);
|
|
123
|
+
}
|
|
124
|
+
entry.items.push(item);
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
128
|
+
}, [visible]);
|
|
129
|
+
const loading = loadItems ? async.loading : Boolean(staticLoading);
|
|
130
|
+
const trimmed = query.trim();
|
|
131
|
+
const folded = foldText(trimmed, locale);
|
|
132
|
+
const exactMatch = trimmed !== "" && [...visible, ...known.current.values()].some((item) => foldText(getLabel(item), locale) === folded);
|
|
133
|
+
const showCreate = Boolean(onCreate) && trimmed !== "" && !exactMatch && !loading;
|
|
134
|
+
/* ---------------------------------------------------------------- actions */
|
|
135
|
+
const shouldClose = closeOnSelect ?? !multiple;
|
|
136
|
+
const triggerRef = React.useRef(null);
|
|
137
|
+
const chipsRef = React.useRef(null);
|
|
138
|
+
const select = (value) => {
|
|
139
|
+
if (inert)
|
|
140
|
+
return;
|
|
141
|
+
if (multiple)
|
|
142
|
+
setValues((prev) => (prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]));
|
|
143
|
+
else
|
|
144
|
+
setValues([value]);
|
|
145
|
+
if (multiple)
|
|
146
|
+
setQuery("");
|
|
147
|
+
if (shouldClose && mode === "popover")
|
|
148
|
+
setOpen(false);
|
|
149
|
+
};
|
|
150
|
+
const removeAt = (index, refocus = true) => {
|
|
151
|
+
if (inert)
|
|
152
|
+
return;
|
|
153
|
+
setValues((prev) => prev.filter((_, i) => i !== index));
|
|
154
|
+
if (!refocus)
|
|
155
|
+
return;
|
|
156
|
+
requestAnimationFrame(() => {
|
|
157
|
+
// Focus the previous chip (or the first one), else the trigger.
|
|
158
|
+
const buttons = chipsRef.current?.querySelectorAll('[data-slot="chip-remove"]');
|
|
159
|
+
(buttons?.[Math.max(0, index - 1)] ?? triggerRef.current)?.focus();
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const create = async () => {
|
|
163
|
+
if (!onCreate || creating)
|
|
164
|
+
return;
|
|
165
|
+
setCreating(true);
|
|
166
|
+
try {
|
|
167
|
+
const created = await onCreate(trimmed);
|
|
168
|
+
if (created !== undefined && created !== null) {
|
|
169
|
+
known.current.set(getValue(created), created);
|
|
170
|
+
select(getValue(created));
|
|
171
|
+
}
|
|
172
|
+
setQuery("");
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
setCreating(false);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
/* ---------------------------------------------------------------- panel */
|
|
179
|
+
const itemSize = size === "sm" ? "sm" : "md";
|
|
180
|
+
const showCount = trimmed !== "" || Boolean(loadItems);
|
|
181
|
+
// cmdk names its input with its own <label>; in inline mode reuse the Field's label text.
|
|
182
|
+
const [fieldLabelText, setFieldLabelText] = React.useState();
|
|
183
|
+
const fieldLabelId = field?.labelId;
|
|
184
|
+
React.useEffect(() => {
|
|
185
|
+
if (!fieldLabelId)
|
|
186
|
+
return;
|
|
187
|
+
setFieldLabelText(document.getElementById(fieldLabelId)?.textContent?.replace(/\*$/, "").trim() || undefined);
|
|
188
|
+
}, [fieldLabelId]);
|
|
189
|
+
const panelName = props["aria-label"] ?? fieldLabelText ?? t("search");
|
|
190
|
+
const inputName = mode === "inline"
|
|
191
|
+
? (props["aria-label"] ?? fieldLabelText ?? searchPlaceholder ?? t("search"))
|
|
192
|
+
: (searchPlaceholder ?? t("search"));
|
|
193
|
+
const panel = (_jsxs(Cmdk, { shouldFilter: false, loop: true, label: inputName, "data-slot": "combobox-panel", className: "flex min-h-0 flex-col", children: [_jsxs("div", { className: "flex items-center gap-2 border-b border-line px-3", "data-slot": "combobox-search", children: [_jsx(Search, { "aria-hidden": true, className: "size-4 shrink-0 text-fg-subtle" }), _jsx(Cmdk.Input, { value: query, onValueChange: setQuery, placeholder: searchPlaceholder ?? t("search"), ...(mode === "inline" ? { "aria-describedby": control["aria-describedby"], "aria-invalid": control["aria-invalid"] } : {}), disabled: disabled, readOnly: readOnly, onKeyDown: (e) => {
|
|
194
|
+
if (e.key === "Backspace" && query === "" && multiple && values.length > 0) {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
removeAt(values.length - 1, false);
|
|
197
|
+
}
|
|
198
|
+
}, className: cn("h-(--control-h) min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle disabled:cursor-not-allowed", size === "sm" && "h-[calc(var(--control-h)-0.25rem)] text-[13px]") }), loading || creating ? _jsx(Spinner, { size: "xs", tone: "muted" }) : null] }), _jsxs(Cmdk.List, { label: inputName, "aria-busy": loading || undefined,
|
|
199
|
+
// Keep focus in the search box when an option is clicked.
|
|
200
|
+
onMouseDown: (e) => {
|
|
201
|
+
if (!e.target.closest("button"))
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
}, className: cn("max-h-72 overflow-y-auto overscroll-contain p-1 scroll-py-1", listClassName), onScroll: (e) => {
|
|
204
|
+
const el = e.currentTarget;
|
|
205
|
+
if (async.hasMore && el.scrollTop + el.clientHeight >= el.scrollHeight - 48)
|
|
206
|
+
async.loadMore();
|
|
207
|
+
}, children: [async.error && !loading ? (_jsxs("div", { role: "alert", className: "flex items-center justify-between gap-3 px-2 py-2 text-[13px] text-danger", children: [_jsx("span", { children: t("error") }), _jsx("button", { type: "button", onClick: async.reload, className: "rounded-ui-sm px-1.5 py-0.5 font-medium text-fg underline-offset-2 hover:underline focus-ring", children: t("retry") })] })) : null, loading && visible.length === 0 ? (_jsxs(Cmdk.Loading, { label: t("loading"), className: "flex items-center gap-2 px-2 py-2 text-[13px] text-fg-muted", children: [_jsx(Spinner, { size: "xs", tone: "muted" }), t("loading")] })) : null, groups.map((group, gi) => {
|
|
208
|
+
const rows = group.items.map((item) => {
|
|
209
|
+
const value = getValue(item);
|
|
210
|
+
const label = getLabel(item);
|
|
211
|
+
const selected = values.includes(value);
|
|
212
|
+
const highlight = _jsx(Highlight, { text: label, query: trimmed, locale: locale });
|
|
213
|
+
const opt = asOption(item);
|
|
214
|
+
return (_jsxs(Cmdk.Item, { value: value, disabled: getDisabled(item), onSelect: () => select(value), "data-checked": selected ? "" : undefined, className: cn(itemVariants({ size: itemSize }), multiple ? "ps-2" : "pe-8"), children: [multiple ? (_jsx("span", { "aria-hidden": true, className: cn("flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors", selected ? "border-transparent bg-accent text-accent-fg" : "border-field-border-hover"), children: selected ? _jsx(Check, { strokeWidth: 3, className: "size-3!" }) : null })) : null, renderItem ? (_jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: renderItem(item, { selected, query: trimmed, highlight }) })) : (_jsxs(_Fragment, { children: [opt.icon ? _jsx("span", { className: cn(itemSlots.icon, "flex items-center justify-center"), children: opt.icon }) : null, _jsxs("span", { className: "grid min-w-0 flex-1", children: [_jsx("span", { className: "truncate", children: highlight }), opt.description ? _jsx("span", { className: cn(itemSlots.description, "truncate"), children: opt.description }) : null] })] })), !multiple ? (_jsx("span", { className: "absolute end-2 flex size-4 items-center justify-center text-accent-ink", children: selected ? _jsx(Check, { "aria-hidden": true, strokeWidth: 2.5, className: "size-4" }) : null })) : null, selected ? _jsxs("span", { className: "sr-only", children: [", ", t("selected")] }) : null] }, value));
|
|
215
|
+
});
|
|
216
|
+
return group.label ? (_jsx(Cmdk.Group, { heading: group.label, className: cn(gi > 0 && "mt-1 border-t border-line pt-1", "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pt-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-[11px] [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:tracking-[0.04em] [&_[cmdk-group-heading]]:text-fg-subtle"), children: rows }, group.label)) : (_jsx(React.Fragment, { children: rows }, `_${gi}`));
|
|
217
|
+
}), showCreate ? (_jsxs(Cmdk.Item, { value: CREATE_VALUE, onSelect: create, disabled: creating, className: cn(itemVariants({ size: itemSize }), "text-fg"), children: [_jsx(Plus, { "aria-hidden": true, className: "text-fg-muted" }), _jsx("span", { className: "truncate", children: t("create", { query: trimmed }) })] })) : null, async.hasMore ? (_jsxs(Cmdk.Item, { value: MORE_VALUE, onSelect: async.loadMore, className: cn(itemVariants({ size: itemSize }), "justify-center text-fg-muted"), children: [async.loadingMore ? _jsx(Spinner, { size: "xs", tone: "muted" }) : null, t("loadMore")] })) : null, !loading && visible.length === 0 && !showCreate && !async.error ? (_jsx("div", { "data-slot": "combobox-empty", className: "px-2 py-6 text-center text-[13px] text-fg-subtle", children: emptyMessage ?? t("empty") })) : null] }), _jsx("span", { "aria-live": "polite", className: "sr-only", children: showCount && !loading ? t("results", { count: visible.length }) : "" })] }));
|
|
218
|
+
const hidden = name ? (multiple ? (values.map((v) => _jsx("input", { type: "hidden", name: name, value: v }, v))) : (_jsx("input", { type: "hidden", name: name, value: values[0] ?? "" }))) : null;
|
|
219
|
+
/* ---------------------------------------------------------------- inline */
|
|
220
|
+
if (mode === "inline") {
|
|
221
|
+
return (_jsxs("div", { "data-slot": "combobox", "data-mode": "inline", "aria-disabled": disabled || undefined, className: cn("flex w-full min-w-0 flex-col overflow-hidden rounded-ui border border-field-border bg-field", "has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-[0_0_0_3px_var(--accent-soft)]", control["aria-invalid"] && "border-danger", disabled && "opacity-50", className), children: [_jsx(FieldContextReset, { children: panel }), multiple && values.length > 0 ? (_jsxs("div", { className: "flex items-center justify-between gap-2 border-t border-line px-3 py-1.5 text-xs text-fg-muted", children: [_jsx("span", { className: "tabular", children: t("selectedCount", { count: values.length }) }), clearable && !inert ? (_jsx("button", { type: "button", onClick: () => setValues([]), className: "rounded-ui-sm px-1 font-medium text-fg hover:underline focus-ring", children: t("clear") })) : null] })) : null, hidden] }));
|
|
222
|
+
}
|
|
223
|
+
/* ---------------------------------------------------------------- popover */
|
|
224
|
+
const selectedEntries = values.map((v) => ({ value: v, item: known.current.get(v) }));
|
|
225
|
+
const labelOf = (e) => (e.item ? getLabel(e.item) : e.value);
|
|
226
|
+
const shown = multiple && maxVisibleChips !== undefined ? selectedEntries.slice(0, maxVisibleChips) : selectedEntries;
|
|
227
|
+
const overflow = selectedEntries.length - shown.length;
|
|
228
|
+
const { readOnly: _ro, required: req, ...buttonA11y } = control;
|
|
229
|
+
void _ro;
|
|
230
|
+
const triggerButton = (_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { ref: (node) => {
|
|
231
|
+
triggerRef.current = node;
|
|
232
|
+
if (typeof ref === "function")
|
|
233
|
+
ref(node);
|
|
234
|
+
else if (ref)
|
|
235
|
+
ref.current = node;
|
|
236
|
+
}, type: "button", role: "combobox", "aria-expanded": open, "aria-required": req || undefined, "aria-readonly": readOnly || undefined, "aria-busy": loading || undefined, "data-placeholder": values.length === 0 ? "" : undefined, ...buttonA11y, onKeyDown: (e) => {
|
|
237
|
+
if (!multiple || inert || open)
|
|
238
|
+
return;
|
|
239
|
+
if ((e.key === "Backspace" || e.key === "ArrowLeft") && values.length > 0) {
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
const buttons = chipsRef.current?.querySelectorAll('[data-slot="chip-remove"]');
|
|
242
|
+
buttons?.[buttons.length - 1]?.focus();
|
|
243
|
+
}
|
|
244
|
+
}, className: cn(multiple
|
|
245
|
+
? "flex h-[calc(var(--control-h)-0.5rem)] min-w-24 flex-1 items-center rounded-ui-sm px-1.5 text-start text-fg-subtle outline-none focus-visible:outline-none"
|
|
246
|
+
: cn(controlVariants({ size, variant: variant === "pill" ? "default" : variant, pill: variant === "pill" }), "justify-between text-start data-placeholder:text-fg-subtle", clearable && values.length > 0 && !inert && (size === "sm" ? "pe-12" : "pe-14"), readOnly && "border-dashed", className), inert && "cursor-not-allowed"), children: [multiple ? (_jsx("span", { className: "truncate", children: values.length === 0 ? (placeholder ?? t("placeholder")) : readOnly ? "" : (placeholder ?? t("placeholderMultiple")) })) : (_jsx("span", { className: "min-w-0 truncate", children: selectedEntries[0] ? labelOf(selectedEntries[0]) : (placeholder ?? t("placeholder")) })), !multiple ? (loading && !open ? (_jsx(Spinner, { size: "sm", tone: "muted" })) : readOnly ? null : (_jsx(ChevronsUpDown, { "aria-hidden": true, className: "shrink-0 text-fg-subtle" }))) : null] }) }));
|
|
247
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [multiple ? (_jsx(PopoverAnchor, { asChild: true, children: _jsxs("div", { "data-slot": "combobox", "data-multiple": "", "data-readonly": readOnly ? "" : undefined, "aria-invalid": control["aria-invalid"] || undefined, onPointerDown: (e) => {
|
|
248
|
+
if (e.target === e.currentTarget && !inert) {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
triggerRef.current?.focus();
|
|
251
|
+
setOpen(!open);
|
|
252
|
+
}
|
|
253
|
+
}, className: cn(controlVariants({ size, variant: variant === "pill" ? "default" : variant, pill: variant === "pill", multiline: true }), "min-h-(--control-h) flex-wrap gap-1 py-1 ps-1.5 pe-2", size === "sm" && "min-h-[calc(var(--control-h)-0.5rem)] py-0.5", disabled && "opacity-50", className), children: [shown.length > 0 ? (_jsxs("ul", { ref: chipsRef, "aria-label": t("selected"), className: "contents", onKeyDown: (e) => {
|
|
254
|
+
const buttons = [...(chipsRef.current?.querySelectorAll('[data-slot="chip-remove"]') ?? [])];
|
|
255
|
+
const i = buttons.indexOf(document.activeElement);
|
|
256
|
+
if (i < 0)
|
|
257
|
+
return;
|
|
258
|
+
const rtl = getComputedStyle(e.currentTarget).direction === "rtl";
|
|
259
|
+
const prev = rtl ? "ArrowRight" : "ArrowLeft";
|
|
260
|
+
const next = rtl ? "ArrowLeft" : "ArrowRight";
|
|
261
|
+
if (e.key === prev && i > 0) {
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
buttons[i - 1].focus();
|
|
264
|
+
}
|
|
265
|
+
else if (e.key === next) {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
(buttons[i + 1] ?? triggerRef.current)?.focus();
|
|
268
|
+
}
|
|
269
|
+
}, children: [shown.map((entry, i) => (_jsx("li", { className: "flex min-w-0", children: _jsx(Badge, { size: size === "lg" ? "lg" : "md", shape: "square", className: "max-w-56 min-w-0", onRemove: inert ? undefined : () => removeAt(i), removeLabel: t("remove", { label: labelOf(entry) }), children: _jsx("span", { className: "truncate", children: labelOf(entry) }) }) }, entry.value))), overflow > 0 ? (_jsx("li", { className: "flex", children: _jsxs(Badge, { size: size === "lg" ? "lg" : "md", shape: "square", tone: "outline", className: "tabular", children: [_jsx("span", { "aria-hidden": true, children: t("more", { count: overflow }) }), _jsx("span", { className: "sr-only", children: t("moreLabel", { count: overflow }) })] }) })) : null] })) : null, triggerButton, clearable && values.length > 0 && !inert ? (_jsx("button", { type: "button", "aria-label": t("clear"), onClick: () => {
|
|
270
|
+
setValues([]);
|
|
271
|
+
triggerRef.current?.focus();
|
|
272
|
+
}, className: "inline-flex size-6 shrink-0 items-center justify-center rounded-full text-fg-subtle hover:bg-hover hover:text-fg focus-ring [&_svg]:size-3.5", children: _jsx(X, { "aria-hidden": true }) })) : null, readOnly ? null : (_jsx("span", { "aria-hidden": true, className: "pointer-events-none inline-flex size-6 shrink-0 items-center justify-center text-fg-subtle [&_svg]:size-4", children: _jsx(ChevronsUpDown, {}) })), hidden] }) })) : (_jsxs("div", { "data-slot": "combobox", className: "relative w-full min-w-0", children: [triggerButton, clearable && values.length > 0 && !inert ? (_jsx("button", { type: "button", "aria-label": t("clear"), onClick: () => {
|
|
273
|
+
setValues([]);
|
|
274
|
+
triggerRef.current?.focus();
|
|
275
|
+
}, className: cn("absolute top-1/2 inline-flex -translate-y-1/2 items-center justify-center rounded-full text-fg-subtle transition-colors hover:bg-hover hover:text-fg focus-ring", size === "sm" ? "end-7 size-5 [&_svg]:size-3" : "end-8 size-6 [&_svg]:size-3.5"), children: _jsx(X, { "aria-hidden": true }) })) : null, hidden] })), _jsx(PopoverContent, { size: "trigger", padded: false, align: "start", "aria-label": panelName, className: cn("min-w-60 overflow-hidden", contentClassName), onOpenAutoFocus: (e) => {
|
|
276
|
+
// Focus the search box, not the first focusable in the panel.
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
e.currentTarget?.querySelector("[cmdk-input]")?.focus();
|
|
279
|
+
}, children: _jsx(FieldContextReset, { children: panel }) })] }));
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Searchable selection — single or multiple, static or server-backed, optionally creatable:
|
|
283
|
+
* city, assignee, category, country, tags. WAI-ARIA combobox + listbox in a popover (or inline).
|
|
284
|
+
* Search folds locale characters, so "istanbul" finds "İstanbul" and "cagri" finds "Çağrı";
|
|
285
|
+
* matches are highlighted by weight, not colour (readable on glass).
|
|
286
|
+
*
|
|
287
|
+
* ```tsx
|
|
288
|
+
* <Field label="City"><Combobox name="city" items={cities} /></Field>
|
|
289
|
+
* <Combobox multiple items={labels} defaultValue={["urgent"]} maxVisibleChips={3} />
|
|
290
|
+
* <Combobox loadItems={(q, signal) => fetch(`/api/people?q=${q}`, { signal }).then((r) => r.json())} />
|
|
291
|
+
* <Combobox items={categories} onCreate={async (name) => api.createCategory(name)} />
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
export const Combobox = React.forwardRef(ComboboxInner);
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as Cmdk } from "cmdk";
|
|
3
|
+
import { type DialogProps } from "./dialog.js";
|
|
4
|
+
declare const commandLabels: {
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
empty: string;
|
|
8
|
+
noResultsFor: string;
|
|
9
|
+
results: string;
|
|
10
|
+
recent: string;
|
|
11
|
+
navigate: string;
|
|
12
|
+
select: string;
|
|
13
|
+
back: string;
|
|
14
|
+
close: string;
|
|
15
|
+
sourceError: string;
|
|
16
|
+
loading: string;
|
|
17
|
+
};
|
|
18
|
+
export type CommandLabels = typeof commandLabels;
|
|
19
|
+
export interface CommandProps extends React.ComponentPropsWithoutRef<typeof Cmdk> {
|
|
20
|
+
labels?: Partial<CommandLabels>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A searchable list of actions (WAI-ARIA combobox + listbox). Filtering folds text for the
|
|
24
|
+
* current locale, so "istanbul" finds "İstanbul" and "isik" finds "ışık".
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Command>
|
|
28
|
+
* <CommandInput />
|
|
29
|
+
* <CommandList>
|
|
30
|
+
* <CommandEmpty />
|
|
31
|
+
* <CommandGroup heading="Actions">
|
|
32
|
+
* <CommandItem icon={<FilePlus2 />} shortcut="mod+shift+n" onSelect={newPost}>New post</CommandItem>
|
|
33
|
+
* </CommandGroup>
|
|
34
|
+
* </CommandList>
|
|
35
|
+
* </Command>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const Command: React.ForwardRefExoticComponent<CommandProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
export interface CommandInputProps extends React.ComponentPropsWithoutRef<typeof Cmdk.Input> {
|
|
40
|
+
/** Breadcrumb chip before the input (the current sub-page). */
|
|
41
|
+
chip?: React.ReactNode;
|
|
42
|
+
/** Trailing slot (a spinner, a filter, a close hint). */
|
|
43
|
+
end?: React.ReactNode;
|
|
44
|
+
labels?: Partial<CommandLabels>;
|
|
45
|
+
}
|
|
46
|
+
/** The search field. Placeholder from the dictionary (`command.placeholder`). */
|
|
47
|
+
export declare const CommandInput: React.ForwardRefExoticComponent<CommandInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
48
|
+
/** The scrolling listbox. */
|
|
49
|
+
export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
52
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
53
|
+
} & {
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
56
|
+
label?: string;
|
|
57
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
/** Shown when nothing matches. Default text from the dictionary (`command.empty`). */
|
|
59
|
+
export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
62
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
63
|
+
} & {
|
|
64
|
+
asChild?: boolean;
|
|
65
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
66
|
+
labels?: Partial<CommandLabels>;
|
|
67
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
68
|
+
/** A loading row (async results). */
|
|
69
|
+
export declare const CommandLoading: React.ForwardRefExoticComponent<Omit<{
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
72
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
73
|
+
} & {
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
76
|
+
progress?: number;
|
|
77
|
+
label?: string;
|
|
78
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
79
|
+
labels?: Partial<CommandLabels>;
|
|
80
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
/** A titled group of items. */
|
|
82
|
+
export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
83
|
+
children?: React.ReactNode;
|
|
84
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
85
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
86
|
+
} & {
|
|
87
|
+
asChild?: boolean;
|
|
88
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "value" | "heading"> & {
|
|
89
|
+
heading?: React.ReactNode;
|
|
90
|
+
value?: string;
|
|
91
|
+
forceMount?: boolean;
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
/** A hairline between groups. */
|
|
94
|
+
export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
95
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
96
|
+
} & {
|
|
97
|
+
asChild?: boolean;
|
|
98
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key"> & {
|
|
99
|
+
alwaysRender?: boolean;
|
|
100
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
101
|
+
export interface CommandItemProps extends React.ComponentPropsWithoutRef<typeof Cmdk.Item> {
|
|
102
|
+
icon?: React.ReactNode;
|
|
103
|
+
/** Second line under the label. */
|
|
104
|
+
description?: React.ReactNode;
|
|
105
|
+
/** `"mod+shift+n"` or `["mod","shift","n"]` — display only. */
|
|
106
|
+
shortcut?: string | string[];
|
|
107
|
+
/** Trailing meta (an app badge, a count). */
|
|
108
|
+
badge?: React.ReactNode;
|
|
109
|
+
/** Trailing chevron (opens a sub-page). */
|
|
110
|
+
chevron?: boolean;
|
|
111
|
+
/** Spinner in place of the icon while the action runs. */
|
|
112
|
+
loading?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/** One selectable row. Highlighted with the arrow keys; Enter or click runs `onSelect`. */
|
|
115
|
+
export declare const CommandItem: React.ForwardRefExoticComponent<CommandItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
116
|
+
/** Shortcut keycaps at the end of an item. */
|
|
117
|
+
export declare function CommandShortcut({ keys, className }: {
|
|
118
|
+
keys: string | string[];
|
|
119
|
+
className?: string;
|
|
120
|
+
}): React.JSX.Element;
|
|
121
|
+
export interface CommandDialogProps extends DialogProps {
|
|
122
|
+
/** `md` 560px, `lg` 680px. Default `"lg"`. */
|
|
123
|
+
size?: "md" | "lg";
|
|
124
|
+
/** Hidden dialog title. Default "Command palette" (`command.label`). */
|
|
125
|
+
title?: string;
|
|
126
|
+
/** Props for the inner `Command` (filter, shouldFilter, value…). */
|
|
127
|
+
commandProps?: Omit<CommandProps, "children">;
|
|
128
|
+
className?: string;
|
|
129
|
+
labels?: Partial<CommandLabels>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Command inside a top-anchored dialog (fullscreen on phones). Focus goes to the input; Esc closes
|
|
133
|
+
* and returns focus to whatever opened it.
|
|
134
|
+
*
|
|
135
|
+
* ```tsx
|
|
136
|
+
* const [open, setOpen] = React.useState(false);
|
|
137
|
+
* useHotkeys("mod+k", () => setOpen((o) => !o));
|
|
138
|
+
* <CommandDialog open={open} onOpenChange={setOpen}>
|
|
139
|
+
* <CommandInput />
|
|
140
|
+
* <CommandList>…</CommandList>
|
|
141
|
+
* </CommandDialog>
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare function CommandDialog({ size, title, commandProps, className, labels, children, ...dialogProps }: CommandDialogProps): React.JSX.Element;
|
|
145
|
+
export interface CommandContext {
|
|
146
|
+
/** Navigate through the app router (absolute URLs do a full navigation). */
|
|
147
|
+
navigate: (href: string) => void;
|
|
148
|
+
/** Close the palette. */
|
|
149
|
+
close: () => void;
|
|
150
|
+
/** The query the action was picked with. */
|
|
151
|
+
query: string;
|
|
152
|
+
can: (permission: string) => boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface CommandAction {
|
|
155
|
+
/** Module-prefixed and unique: `"cms.post.new"`. */
|
|
156
|
+
id: string;
|
|
157
|
+
title: string;
|
|
158
|
+
subtitle?: string;
|
|
159
|
+
/** Group heading: "Actions", "Go to", "Posts"… Default "Actions". */
|
|
160
|
+
group?: string;
|
|
161
|
+
icon?: React.ComponentType<{
|
|
162
|
+
className?: string;
|
|
163
|
+
}> | React.ReactNode;
|
|
164
|
+
/** Synonyms: `["article", "entry"]`. */
|
|
165
|
+
keywords?: string[];
|
|
166
|
+
/** `"mod+shift+n"` or `["mod","shift","n"]`. With `global: true` it also works while the palette is closed. */
|
|
167
|
+
shortcut?: string | string[];
|
|
168
|
+
global?: boolean;
|
|
169
|
+
/** Navigates via the app router. */
|
|
170
|
+
href?: string;
|
|
171
|
+
/** Runs the action. Return a promise to keep the palette open with a spinner until it settles. */
|
|
172
|
+
perform?: (ctx: CommandContext) => unknown;
|
|
173
|
+
/** Opens a sub-page with these commands (or loads them). */
|
|
174
|
+
children?: CommandAction[] | (() => Promise<CommandAction[]>);
|
|
175
|
+
/** Hidden unless `can(permission)` (all of them for an array). */
|
|
176
|
+
permission?: string | string[];
|
|
177
|
+
/** Contextual: only listed while this returns true. */
|
|
178
|
+
when?: (ctx: CommandContext) => boolean;
|
|
179
|
+
/** Higher ranks first among equal matches. */
|
|
180
|
+
priority?: number;
|
|
181
|
+
/** App badge in multi-app shells ("CRM"). */
|
|
182
|
+
app?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface CommandSource {
|
|
185
|
+
id: string;
|
|
186
|
+
/** Group heading for the results ("Contacts"). */
|
|
187
|
+
group: string;
|
|
188
|
+
/** Minimum query length. Default 2. */
|
|
189
|
+
minQuery?: number;
|
|
190
|
+
/** ms. Default 200. */
|
|
191
|
+
debounce?: number;
|
|
192
|
+
/** Return matching commands. Abort when `signal` fires (the query changed). */
|
|
193
|
+
search: (query: string, options: {
|
|
194
|
+
signal: AbortSignal;
|
|
195
|
+
}) => Promise<CommandAction[]>;
|
|
196
|
+
}
|
|
197
|
+
export interface CommandRegistry {
|
|
198
|
+
/** Adds commands; returns the remove function. Later registrations win for the same id. */
|
|
199
|
+
register: (actions: CommandAction[]) => () => void;
|
|
200
|
+
registerSource: (source: CommandSource) => () => void;
|
|
201
|
+
getActions: () => CommandAction[];
|
|
202
|
+
getSources: () => CommandSource[];
|
|
203
|
+
subscribe: (listener: () => void) => () => void;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A command store (`useSyncExternalStore`). App shells create one from their app definitions;
|
|
207
|
+
* pages add to it with `useRegisterCommands`.
|
|
208
|
+
*/
|
|
209
|
+
export declare function createCommandRegistry(init?: {
|
|
210
|
+
actions?: CommandAction[];
|
|
211
|
+
sources?: CommandSource[];
|
|
212
|
+
}): CommandRegistry;
|
|
213
|
+
export interface CommandProviderProps {
|
|
214
|
+
/** Use an existing registry (e.g. one built from app definitions). Default: a new one. */
|
|
215
|
+
registry?: CommandRegistry;
|
|
216
|
+
/** Static commands added for the provider's lifetime. */
|
|
217
|
+
actions?: CommandAction[];
|
|
218
|
+
sources?: CommandSource[];
|
|
219
|
+
/** Toggle shortcut. Default `"mod+k"`; `false` disables it. */
|
|
220
|
+
shortcut?: string | false;
|
|
221
|
+
open?: boolean;
|
|
222
|
+
defaultOpen?: boolean;
|
|
223
|
+
onOpenChange?: (open: boolean) => void;
|
|
224
|
+
children: React.ReactNode;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Holds the command registry, the palette's open state and the single global `keydown` listener
|
|
228
|
+
* (`mod+k` plus commands marked `global`). Inside inputs only shortcuts with `mod` fire. App shell
|
|
229
|
+
* mounts one; mount it yourself for a standalone palette.
|
|
230
|
+
*/
|
|
231
|
+
export declare function CommandProvider({ registry: registryProp, actions, sources, shortcut, open: openProp, defaultOpen, onOpenChange, children }: CommandProviderProps): React.JSX.Element;
|
|
232
|
+
/** The registry of the nearest `CommandProvider` (or `null`). */
|
|
233
|
+
export declare function useCommandRegistry(): CommandRegistry | null;
|
|
234
|
+
/**
|
|
235
|
+
* Adds commands while the calling component is mounted (page-scoped: "Publish" only exists in the
|
|
236
|
+
* editor). `perform` always calls the latest closure. Re-registers when ids / titles change or `deps` change.
|
|
237
|
+
*
|
|
238
|
+
* ```tsx
|
|
239
|
+
* useRegisterCommands([{ id: "cms.post.publish", title: "Publish post", group: "This post", perform: publish }]);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function useRegisterCommands(actions: CommandAction[], deps?: React.DependencyList): void;
|
|
243
|
+
/** Adds an async search source (record search) while mounted. */
|
|
244
|
+
export declare function useCommandSource(source: CommandSource | null | undefined): void;
|
|
245
|
+
export interface CommandPaletteControls {
|
|
246
|
+
/** Open the palette, optionally on the sub-page of a command with `children`. */
|
|
247
|
+
open: (pageId?: string) => void;
|
|
248
|
+
close: () => void;
|
|
249
|
+
toggle: () => void;
|
|
250
|
+
isOpen: boolean;
|
|
251
|
+
/** `false` when there is no `CommandProvider` above (calls are no-ops). */
|
|
252
|
+
available: boolean;
|
|
253
|
+
}
|
|
254
|
+
/** Open / close the palette from anywhere (a search button, an empty state). */
|
|
255
|
+
export declare function useCommandPalette(): CommandPaletteControls;
|
|
256
|
+
export interface CommandPaletteProps {
|
|
257
|
+
/** Default `"lg"`. */
|
|
258
|
+
size?: "md" | "lg";
|
|
259
|
+
placeholder?: string;
|
|
260
|
+
/** Show recently used commands first when the query is empty. Default `true`. */
|
|
261
|
+
recents?: boolean;
|
|
262
|
+
/** Footer hint bar (↑↓ navigate · ↵ select · ⌫ back · esc close). Default `true`. */
|
|
263
|
+
footer?: boolean;
|
|
264
|
+
/** Group order; unlisted groups follow in first-seen order. */
|
|
265
|
+
groupOrder?: string[];
|
|
266
|
+
labels?: Partial<CommandLabels>;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The ready-made ⌘K palette wired to the nearest `CommandProvider`: ranked local commands,
|
|
270
|
+
* recents, async sources (debounced, aborted on every keystroke), sub-pages with a breadcrumb chip
|
|
271
|
+
* (Backspace on an empty input goes back), a spinner while an action runs, and a polite result count.
|
|
272
|
+
* App shell mounts one for you.
|
|
273
|
+
*/
|
|
274
|
+
export declare function CommandPalette({ size, placeholder, recents: showRecents, footer, groupOrder, labels }: CommandPaletteProps): React.JSX.Element;
|
|
275
|
+
export {};
|