@vamos-ui/react 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/blocks/block-heading.d.ts +29 -0
- package/dist/blocks/block-heading.js +39 -0
- package/dist/blocks/block-image.d.ts +52 -0
- package/dist/blocks/block-image.js +48 -0
- package/dist/blocks/block-link.d.ts +30 -0
- package/dist/blocks/block-link.js +36 -0
- package/dist/blocks/create-blocks.d.ts +54 -0
- package/dist/blocks/create-blocks.js +52 -0
- package/dist/blocks/index.d.ts +55 -0
- package/dist/blocks/index.js +59 -0
- package/dist/blocks/json-ld.d.ts +18 -0
- package/dist/blocks/json-ld.js +44 -0
- package/dist/blocks/labels.d.ts +20 -0
- package/dist/blocks/labels.js +43 -0
- package/dist/blocks/rich-text.d.ts +36 -0
- package/dist/blocks/rich-text.js +106 -0
- package/dist/blocks/schema/define-block.d.ts +151 -0
- package/dist/blocks/schema/define-block.js +120 -0
- package/dist/blocks/schema/emphasis.d.ts +17 -0
- package/dist/blocks/schema/emphasis.js +69 -0
- package/dist/blocks/schema/fields.d.ts +497 -0
- package/dist/blocks/schema/fields.js +240 -0
- package/dist/blocks/schema/icons.d.ts +2 -0
- package/dist/blocks/schema/icons.js +26 -0
- package/dist/blocks/schema/index.d.ts +18 -0
- package/dist/blocks/schema/index.js +21 -0
- package/dist/blocks/schema/lint-types.d.ts +16 -0
- package/dist/blocks/schema/lint-types.js +2 -0
- package/dist/blocks/schema/lint.d.ts +32 -0
- package/dist/blocks/schema/lint.js +164 -0
- package/dist/blocks/schema/localize.d.ts +20 -0
- package/dist/blocks/schema/localize.js +29 -0
- package/dist/blocks/schema/localized.d.ts +25 -0
- package/dist/blocks/schema/localized.js +53 -0
- package/dist/blocks/schema/migrate.d.ts +24 -0
- package/dist/blocks/schema/migrate.js +75 -0
- package/dist/blocks/schema/nodes.d.ts +196 -0
- package/dist/blocks/schema/nodes.js +78 -0
- package/dist/blocks/schema/rich-doc-schema.d.ts +32 -0
- package/dist/blocks/schema/rich-doc-schema.js +66 -0
- package/dist/blocks/schema/rich-doc.d.ts +90 -0
- package/dist/blocks/schema/rich-doc.js +62 -0
- package/dist/blocks/schema/safety.d.ts +20 -0
- package/dist/blocks/schema/safety.js +49 -0
- package/dist/blocks/schema/types.d.ts +172 -0
- package/dist/blocks/schema/types.js +3 -0
- package/dist/blocks/schema/validate.d.ts +17 -0
- package/dist/blocks/schema/validate.js +32 -0
- package/dist/blocks/schema/walk.d.ts +22 -0
- package/dist/blocks/schema/walk.js +60 -0
- package/dist/blocks/section-header.d.ts +38 -0
- package/dist/blocks/section-header.js +22 -0
- package/dist/blocks/section.d.ts +59 -0
- package/dist/blocks/section.js +66 -0
- package/dist/blocks/site/_kit-1.d.ts +101 -0
- package/dist/blocks/site/_kit-1.js +137 -0
- package/dist/blocks/site/_site-icon-1.d.ts +6 -0
- package/dist/blocks/site/_site-icon-1.js +15 -0
- package/dist/blocks/site/announcement-bar.d.ts +42 -0
- package/dist/blocks/site/announcement-bar.js +38 -0
- package/dist/blocks/site/announcement-dismiss.d.ts +18 -0
- package/dist/blocks/site/announcement-dismiss.js +28 -0
- package/dist/blocks/site/article-layout.d.ts +65 -0
- package/dist/blocks/site/article-layout.js +88 -0
- package/dist/blocks/site/blog-list.d.ts +79 -0
- package/dist/blocks/site/blog-list.js +78 -0
- package/dist/blocks/site/comparison-table.d.ts +54 -0
- package/dist/blocks/site/comparison-table.js +38 -0
- package/dist/blocks/site/consent-banner.d.ts +52 -0
- package/dist/blocks/site/consent-banner.js +33 -0
- package/dist/blocks/site/contact-dock.d.ts +52 -0
- package/dist/blocks/site/contact-dock.js +55 -0
- package/dist/blocks/site/contact-form.d.ts +60 -0
- package/dist/blocks/site/contact-form.js +45 -0
- package/dist/blocks/site/cta-booking.d.ts +43 -0
- package/dist/blocks/site/cta-booking.js +69 -0
- package/dist/blocks/site/cta.d.ts +74 -0
- package/dist/blocks/site/cta.js +113 -0
- package/dist/blocks/site/embed-facade.d.ts +20 -0
- package/dist/blocks/site/embed-facade.js +21 -0
- package/dist/blocks/site/faq.d.ts +48 -0
- package/dist/blocks/site/faq.js +52 -0
- package/dist/blocks/site/feature-grid.d.ts +46 -0
- package/dist/blocks/site/feature-grid.js +50 -0
- package/dist/blocks/site/feature-tabs.d.ts +22 -0
- package/dist/blocks/site/feature-tabs.js +11 -0
- package/dist/blocks/site/footer.d.ts +68 -0
- package/dist/blocks/site/footer.js +61 -0
- package/dist/blocks/site/gallery-section.d.ts +42 -0
- package/dist/blocks/site/gallery-section.js +48 -0
- package/dist/blocks/site/hero-video.d.ts +15 -0
- package/dist/blocks/site/hero-video.js +31 -0
- package/dist/blocks/site/hero.d.ts +64 -0
- package/dist/blocks/site/hero.js +73 -0
- package/dist/blocks/site/logo-strip.d.ts +44 -0
- package/dist/blocks/site/logo-strip.js +27 -0
- package/dist/blocks/site/map-hours.d.ts +83 -0
- package/dist/blocks/site/map-hours.js +125 -0
- package/dist/blocks/site/media-text.d.ts +45 -0
- package/dist/blocks/site/media-text.js +56 -0
- package/dist/blocks/site/menu-list.d.ts +74 -0
- package/dist/blocks/site/menu-list.js +84 -0
- package/dist/blocks/site/navbar-submenu.d.ts +18 -0
- package/dist/blocks/site/navbar-submenu.js +51 -0
- package/dist/blocks/site/navbar.d.ts +67 -0
- package/dist/blocks/site/navbar.js +64 -0
- package/dist/blocks/site/not-found.d.ts +40 -0
- package/dist/blocks/site/not-found.js +38 -0
- package/dist/blocks/site/page-intro.d.ts +46 -0
- package/dist/blocks/site/page-intro.js +44 -0
- package/dist/blocks/site/pricing-table.d.ts +67 -0
- package/dist/blocks/site/pricing-table.js +83 -0
- package/dist/blocks/site/process.d.ts +36 -0
- package/dist/blocks/site/process.js +42 -0
- package/dist/blocks/site/registry-1.d.ts +720 -0
- package/dist/blocks/site/registry-1.js +783 -0
- package/dist/blocks/site/registry-2.d.ts +914 -0
- package/dist/blocks/site/registry-2.js +563 -0
- package/dist/blocks/site/rich-text-section.d.ts +34 -0
- package/dist/blocks/site/rich-text-section.js +32 -0
- package/dist/blocks/site/shared/brand-icons.d.ts +21 -0
- package/dist/blocks/site/shared/brand-icons.js +56 -0
- package/dist/blocks/site/shared/consent-gate.d.ts +41 -0
- package/dist/blocks/site/shared/consent-gate.js +43 -0
- package/dist/blocks/site/shared/consent-island.d.ts +38 -0
- package/dist/blocks/site/shared/consent-island.js +63 -0
- package/dist/blocks/site/shared/consent.d.ts +49 -0
- package/dist/blocks/site/shared/consent.js +130 -0
- package/dist/blocks/site/shared/contact-form-island.d.ts +41 -0
- package/dist/blocks/site/shared/contact-form-island.js +100 -0
- package/dist/blocks/site/shared/copy-link.d.ts +10 -0
- package/dist/blocks/site/shared/copy-link.js +25 -0
- package/dist/blocks/site/shared/dock-avoid.d.ts +15 -0
- package/dist/blocks/site/shared/dock-avoid.js +107 -0
- package/dist/blocks/site/shared/dock-hours.d.ts +13 -0
- package/dist/blocks/site/shared/dock-hours.js +25 -0
- package/dist/blocks/site/shared/gallery-lightbox.d.ts +12 -0
- package/dist/blocks/site/shared/gallery-lightbox.js +10 -0
- package/dist/blocks/site/shared/island-keys.d.ts +10 -0
- package/dist/blocks/site/shared/island-keys.js +44 -0
- package/dist/blocks/site/shared/kit-2.d.ts +55 -0
- package/dist/blocks/site/shared/kit-2.js +84 -0
- package/dist/blocks/site/shared/labels-2.d.ts +209 -0
- package/dist/blocks/site/shared/labels-2.js +427 -0
- package/dist/blocks/site/shared/open-now.d.ts +22 -0
- package/dist/blocks/site/shared/open-now.js +27 -0
- package/dist/blocks/site/shared/opening-hours.d.ts +117 -0
- package/dist/blocks/site/shared/opening-hours.js +245 -0
- package/dist/blocks/site/shared/site-accent.d.ts +48 -0
- package/dist/blocks/site/shared/site-accent.js +249 -0
- package/dist/blocks/site/shared/site-form.d.ts +79 -0
- package/dist/blocks/site/shared/site-form.js +111 -0
- package/dist/blocks/site/shared/site-routing.d.ts +54 -0
- package/dist/blocks/site/shared/site-routing.js +86 -0
- package/dist/blocks/site/shared/testimonials-carousel.d.ts +17 -0
- package/dist/blocks/site/shared/testimonials-carousel.js +64 -0
- package/dist/blocks/site/site-shell.d.ts +108 -0
- package/dist/blocks/site/site-shell.js +254 -0
- package/dist/blocks/site/stats-band.d.ts +42 -0
- package/dist/blocks/site/stats-band.js +45 -0
- package/dist/blocks/site/team.d.ts +44 -0
- package/dist/blocks/site/team.js +48 -0
- package/dist/blocks/site/testimonials.d.ts +68 -0
- package/dist/blocks/site/testimonials.js +66 -0
- package/dist/blocks/types.d.ts +63 -0
- package/dist/blocks/types.js +2 -0
- package/dist/business/approval-flow.d.ts +152 -0
- package/dist/business/approval-flow.js +221 -0
- package/dist/business/export-core.d.ts +55 -0
- package/dist/business/export-core.js +101 -0
- package/dist/business/export.d.ts +148 -0
- package/dist/business/export.js +264 -0
- package/dist/business/import-core.d.ts +104 -0
- package/dist/business/import-core.js +281 -0
- package/dist/business/import-wizard.d.ts +186 -0
- package/dist/business/import-wizard.js +401 -0
- package/dist/business/index.d.ts +12 -0
- package/dist/business/index.js +22 -0
- package/dist/business/line-items-core.d.ts +129 -0
- package/dist/business/line-items-core.js +183 -0
- package/dist/business/line-items.d.ts +119 -0
- package/dist/business/line-items.js +299 -0
- package/dist/business/multi-step-form.d.ts +131 -0
- package/dist/business/multi-step-form.js +337 -0
- package/dist/business/permission-core.d.ts +59 -0
- package/dist/business/permission-core.js +99 -0
- package/dist/business/permission-matrix.d.ts +158 -0
- package/dist/business/permission-matrix.js +341 -0
- package/dist/business/setup-checklist.d.ts +80 -0
- package/dist/business/setup-checklist.js +92 -0
- package/dist/business/signer-status.d.ts +53 -0
- package/dist/business/signer-status.js +76 -0
- package/dist/charts/area-chart.d.ts +35 -0
- package/dist/charts/area-chart.js +33 -0
- package/dist/charts/bar-chart.d.ts +27 -0
- package/dist/charts/bar-chart.js +46 -0
- package/dist/charts/bar-list.d.ts +47 -0
- package/dist/charts/bar-list.js +60 -0
- package/dist/charts/chart-shell.d.ts +173 -0
- package/dist/charts/chart-shell.js +205 -0
- package/dist/charts/chart.d.ts +73 -0
- package/dist/charts/chart.js +106 -0
- package/dist/charts/combo-chart.d.ts +29 -0
- package/dist/charts/combo-chart.js +47 -0
- package/dist/charts/donut-chart.d.ts +33 -0
- package/dist/charts/donut-chart.js +113 -0
- package/dist/charts/funnel.d.ts +51 -0
- package/dist/charts/funnel.js +69 -0
- package/dist/charts/gauge.d.ts +62 -0
- package/dist/charts/gauge.js +104 -0
- package/dist/charts/heatmap.d.ts +81 -0
- package/dist/charts/heatmap.js +338 -0
- package/dist/charts/index.d.ts +12 -0
- package/dist/charts/index.js +14 -0
- package/dist/charts/line-chart.d.ts +21 -0
- package/dist/charts/line-chart.js +36 -0
- package/dist/charts/test-utils.d.ts +2 -0
- package/dist/charts/test-utils.js +38 -0
- package/dist/charts/utils.d.ts +130 -0
- package/dist/charts/utils.js +262 -0
- package/dist/components/_qr-core.d.ts +26 -0
- package/dist/components/_qr-core.js +376 -0
- package/dist/components/accordion.d.ts +47 -0
- package/dist/components/accordion.js +70 -0
- package/dist/components/activity-timeline.d.ts +149 -0
- package/dist/components/activity-timeline.js +122 -0
- package/dist/components/address-field.d.ts +116 -0
- package/dist/components/address-field.js +219 -0
- package/dist/components/alert-dialog.d.ts +99 -0
- package/dist/components/alert-dialog.js +192 -0
- package/dist/components/alert.d.ts +42 -0
- package/dist/components/alert.js +82 -0
- package/dist/components/app-shell.d.ts +159 -0
- package/dist/components/app-shell.js +289 -0
- package/dist/components/attachment-list.d.ts +96 -0
- package/dist/components/attachment-list.js +196 -0
- package/dist/components/audit-log.d.ts +150 -0
- package/dist/components/audit-log.js +205 -0
- package/dist/components/avatar.d.ts +87 -0
- package/dist/components/avatar.js +126 -0
- package/dist/components/backup-codes.d.ts +42 -0
- package/dist/components/backup-codes.js +67 -0
- package/dist/components/badge.d.ts +41 -0
- package/dist/components/badge.js +68 -0
- package/dist/components/breadcrumb.d.ts +78 -0
- package/dist/components/breadcrumb.js +106 -0
- package/dist/components/button-group.d.ts +52 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button.d.ts +58 -0
- package/dist/components/button.js +107 -0
- package/dist/components/calendar.d.ts +240 -0
- package/dist/components/calendar.js +483 -0
- package/dist/components/card.d.ts +66 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +170 -0
- package/dist/components/carousel.js +348 -0
- package/dist/components/checkbox.d.ts +78 -0
- package/dist/components/checkbox.js +138 -0
- package/dist/components/color-picker.d.ts +112 -0
- package/dist/components/color-picker.js +235 -0
- package/dist/components/combobox.d.ts +136 -0
- package/dist/components/combobox.js +294 -0
- package/dist/components/command.d.ts +281 -0
- package/dist/components/command.js +498 -0
- package/dist/components/comment-thread.d.ts +252 -0
- package/dist/components/comment-thread.js +449 -0
- package/dist/components/context-menu.d.ts +77 -0
- package/dist/components/context-menu.js +82 -0
- package/dist/components/currency-input.d.ts +43 -0
- package/dist/components/currency-input.js +85 -0
- package/dist/components/date-picker.d.ts +141 -0
- package/dist/components/date-picker.js +241 -0
- package/dist/components/date-range-picker.d.ts +91 -0
- package/dist/components/date-range-picker.js +251 -0
- package/dist/components/description-list.d.ts +92 -0
- package/dist/components/description-list.js +42 -0
- package/dist/components/dialog.d.ts +139 -0
- package/dist/components/dialog.js +185 -0
- package/dist/components/dropdown-menu.d.ts +100 -0
- package/dist/components/dropdown-menu.js +102 -0
- package/dist/components/editor-layout.d.ts +166 -0
- package/dist/components/editor-layout.js +237 -0
- package/dist/components/empty-state.d.ts +49 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/entity-card.d.ts +83 -0
- package/dist/components/entity-card.js +92 -0
- package/dist/components/file-upload.d.ts +256 -0
- package/dist/components/file-upload.js +490 -0
- package/dist/components/formatted-input.d.ts +177 -0
- package/dist/components/formatted-input.js +399 -0
- package/dist/components/hierarchy-chart.d.ts +190 -0
- package/dist/components/hierarchy-chart.js +890 -0
- package/dist/components/hover-card.d.ts +21 -0
- package/dist/components/hover-card.js +32 -0
- package/dist/components/iban-input.d.ts +38 -0
- package/dist/components/iban-input.js +112 -0
- package/dist/components/id-input.d.ts +65 -0
- package/dist/components/id-input.js +130 -0
- package/dist/components/image.d.ts +130 -0
- package/dist/components/image.js +168 -0
- package/dist/components/input-otp.d.ts +62 -0
- package/dist/components/input-otp.js +73 -0
- package/dist/components/input.d.ts +141 -0
- package/dist/components/input.js +187 -0
- package/dist/components/item.d.ts +96 -0
- package/dist/components/item.js +113 -0
- package/dist/components/kbd.d.ts +64 -0
- package/dist/components/kbd.js +119 -0
- package/dist/components/list-layout.d.ts +144 -0
- package/dist/components/list-layout.js +210 -0
- package/dist/components/native-select.d.ts +33 -0
- package/dist/components/native-select.js +48 -0
- package/dist/components/navigation-menu.d.ts +127 -0
- package/dist/components/navigation-menu.js +129 -0
- package/dist/components/notification-center.d.ts +164 -0
- package/dist/components/notification-center.js +399 -0
- package/dist/components/page-header.d.ts +60 -0
- package/dist/components/page-header.js +60 -0
- package/dist/components/pagination.d.ts +121 -0
- package/dist/components/pagination.js +174 -0
- package/dist/components/phone-input.d.ts +49 -0
- package/dist/components/phone-input.js +266 -0
- package/dist/components/pin-map.d.ts +58 -0
- package/dist/components/pin-map.js +167 -0
- package/dist/components/popover.d.ts +38 -0
- package/dist/components/popover.js +69 -0
- package/dist/components/progress.d.ts +79 -0
- package/dist/components/progress.js +97 -0
- package/dist/components/qr-code.d.ts +36 -0
- package/dist/components/qr-code.js +27 -0
- package/dist/components/radio-group.d.ts +43 -0
- package/dist/components/radio-group.js +81 -0
- package/dist/components/record-detail-layout.d.ts +167 -0
- package/dist/components/record-detail-layout.js +233 -0
- package/dist/components/record-picker.d.ts +199 -0
- package/dist/components/record-picker.js +650 -0
- package/dist/components/resizable.d.ts +50 -0
- package/dist/components/resizable.js +88 -0
- package/dist/components/scroll-area.d.ts +40 -0
- package/dist/components/scroll-area.js +56 -0
- package/dist/components/select.d.ts +126 -0
- package/dist/components/select.js +137 -0
- package/dist/components/separator.d.ts +31 -0
- package/dist/components/separator.js +41 -0
- package/dist/components/settings-layout.d.ts +134 -0
- package/dist/components/settings-layout.js +180 -0
- package/dist/components/sheet.d.ts +103 -0
- package/dist/components/sheet.js +165 -0
- package/dist/components/sidebar.d.ts +171 -0
- package/dist/components/sidebar.js +421 -0
- package/dist/components/signature-pad.d.ts +85 -0
- package/dist/components/signature-pad.js +283 -0
- package/dist/components/skeleton.d.ts +64 -0
- package/dist/components/skeleton.js +53 -0
- package/dist/components/sla-timer.d.ts +75 -0
- package/dist/components/sla-timer.js +142 -0
- package/dist/components/slider.d.ts +57 -0
- package/dist/components/slider.js +133 -0
- package/dist/components/slug-input.d.ts +69 -0
- package/dist/components/slug-input.js +201 -0
- package/dist/components/sparkline.d.ts +54 -0
- package/dist/components/sparkline.js +122 -0
- package/dist/components/spinner.d.ts +34 -0
- package/dist/components/spinner.js +34 -0
- package/dist/components/stat.d.ts +135 -0
- package/dist/components/stat.js +130 -0
- package/dist/components/status-picker.d.ts +107 -0
- package/dist/components/status-picker.js +175 -0
- package/dist/components/stepper.d.ts +86 -0
- package/dist/components/stepper.js +103 -0
- package/dist/components/switch.d.ts +34 -0
- package/dist/components/switch.js +70 -0
- package/dist/components/table.d.ts +101 -0
- package/dist/components/table.js +72 -0
- package/dist/components/tabs.d.ts +103 -0
- package/dist/components/tabs.js +173 -0
- package/dist/components/tag-input.d.ts +77 -0
- package/dist/components/tag-input.js +305 -0
- package/dist/components/task-list.d.ts +89 -0
- package/dist/components/task-list.js +238 -0
- package/dist/components/time-picker.d.ts +119 -0
- package/dist/components/time-picker.js +399 -0
- package/dist/components/toast.d.ts +87 -0
- package/dist/components/toast.js +142 -0
- package/dist/components/toggle.d.ts +77 -0
- package/dist/components/toggle.js +109 -0
- package/dist/components/tooltip.d.ts +69 -0
- package/dist/components/tooltip.js +105 -0
- package/dist/components/top-bar.d.ts +87 -0
- package/dist/components/top-bar.js +99 -0
- package/dist/components/tour.d.ts +60 -0
- package/dist/components/tour.js +139 -0
- package/dist/components/tree-select.d.ts +89 -0
- package/dist/components/tree-select.js +243 -0
- package/dist/components/tree-view.d.ts +109 -0
- package/dist/components/tree-view.js +170 -0
- package/dist/components/typography.d.ts +107 -0
- package/dist/components/typography.js +128 -0
- package/dist/components/user-picker.d.ts +89 -0
- package/dist/components/user-picker.js +162 -0
- package/dist/components/version-history.d.ts +191 -0
- package/dist/components/version-history.js +431 -0
- package/dist/data-table/csv.d.ts +27 -0
- package/dist/data-table/csv.js +68 -0
- package/dist/data-table/data-table.d.ts +423 -0
- package/dist/data-table/data-table.js +1259 -0
- package/dist/data-table/filter-bar.d.ts +146 -0
- package/dist/data-table/filter-bar.js +569 -0
- package/dist/data-table/filter-fns.d.ts +65 -0
- package/dist/data-table/filter-fns.js +382 -0
- package/dist/data-table/index.d.ts +8 -0
- package/dist/data-table/index.js +9 -0
- package/dist/data-table/saved-views.d.ts +100 -0
- package/dist/data-table/saved-views.js +251 -0
- package/dist/data-table/types.d.ts +168 -0
- package/dist/data-table/types.js +87 -0
- package/dist/data-table/url-state.d.ts +94 -0
- package/dist/data-table/url-state.js +303 -0
- package/dist/data-table/view-state.d.ts +16 -0
- package/dist/data-table/view-state.js +81 -0
- package/dist/editor/_test-setup.d.ts +1 -0
- package/dist/editor/_test-setup.js +33 -0
- package/dist/editor/block-editor.d.ts +137 -0
- package/dist/editor/block-editor.js +280 -0
- package/dist/editor/commands.d.ts +31 -0
- package/dist/editor/commands.js +150 -0
- package/dist/editor/context.d.ts +108 -0
- package/dist/editor/context.js +30 -0
- package/dist/editor/convert.d.ts +66 -0
- package/dist/editor/convert.js +567 -0
- package/dist/editor/drag-handle.d.ts +10 -0
- package/dist/editor/drag-handle.js +69 -0
- package/dist/editor/extensions.d.ts +34 -0
- package/dist/editor/extensions.js +239 -0
- package/dist/editor/index.d.ts +14 -0
- package/dist/editor/index.js +17 -0
- package/dist/editor/inserter.d.ts +12 -0
- package/dist/editor/inserter.js +88 -0
- package/dist/editor/inspector.d.ts +17 -0
- package/dist/editor/inspector.js +65 -0
- package/dist/editor/items.d.ts +62 -0
- package/dist/editor/items.js +195 -0
- package/dist/editor/labels.d.ts +119 -0
- package/dist/editor/labels.js +130 -0
- package/dist/editor/markdown.d.ts +14 -0
- package/dist/editor/markdown.js +209 -0
- package/dist/editor/menus.d.ts +20 -0
- package/dist/editor/menus.js +236 -0
- package/dist/editor/nodes.d.ts +14 -0
- package/dist/editor/nodes.js +201 -0
- package/dist/editor/outline.d.ts +11 -0
- package/dist/editor/outline.js +52 -0
- package/dist/editor/schema-form.d.ts +64 -0
- package/dist/editor/schema-form.js +290 -0
- package/dist/editor/slash-menu.d.ts +15 -0
- package/dist/editor/slash-menu.js +119 -0
- package/dist/fonts/catalog.d.ts +53 -0
- package/dist/fonts/catalog.js +121 -0
- package/dist/fonts/font-picker.d.ts +70 -0
- package/dist/fonts/font-picker.js +225 -0
- package/dist/fonts/index.d.ts +6 -0
- package/dist/fonts/index.js +7 -0
- package/dist/fonts/loader.d.ts +66 -0
- package/dist/fonts/loader.js +161 -0
- package/dist/fonts/pairing-picker.d.ts +31 -0
- package/dist/fonts/pairing-picker.js +81 -0
- package/dist/fonts/pairings.d.ts +84 -0
- package/dist/fonts/pairings.js +149 -0
- package/dist/fonts/provider.d.ts +34 -0
- package/dist/fonts/provider.js +51 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.js +1 -0
- package/dist/format/core.d.ts +149 -0
- package/dist/format/core.js +357 -0
- package/dist/format/index.d.ts +4 -0
- package/dist/format/index.js +5 -0
- package/dist/format/use-format.d.ts +1 -0
- package/dist/format/use-format.js +3 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +92 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +16 -0
- package/dist/lib/color.d.ts +64 -0
- package/dist/lib/color.js +177 -0
- package/dist/lib/compose-refs.d.ts +24 -0
- package/dist/lib/compose-refs.js +45 -0
- package/dist/lib/data-islands.d.ts +194 -0
- package/dist/lib/data-islands.js +368 -0
- package/dist/lib/date.d.ts +129 -0
- package/dist/lib/date.js +386 -0
- package/dist/lib/field-context.d.ts +64 -0
- package/dist/lib/field-context.js +62 -0
- package/dist/lib/floating-arrow.d.ts +18 -0
- package/dist/lib/floating-arrow.js +15 -0
- package/dist/lib/islands.d.ts +38 -0
- package/dist/lib/islands.js +40 -0
- package/dist/lib/labels.d.ts +51 -0
- package/dist/lib/labels.js +56 -0
- package/dist/lib/layer.d.ts +36 -0
- package/dist/lib/layer.js +42 -0
- package/dist/lib/locale.d.ts +85 -0
- package/dist/lib/locale.js +105 -0
- package/dist/lib/menu.d.ts +58 -0
- package/dist/lib/menu.js +99 -0
- package/dist/lib/message-format.d.ts +20 -0
- package/dist/lib/message-format.js +116 -0
- package/dist/lib/nav.d.ts +132 -0
- package/dist/lib/nav.js +178 -0
- package/dist/lib/provider.d.ts +100 -0
- package/dist/lib/provider.js +105 -0
- package/dist/lib/public.d.ts +23 -0
- package/dist/lib/public.js +34 -0
- package/dist/lib/sr-name.d.ts +18 -0
- package/dist/lib/sr-name.js +17 -0
- package/dist/lib/text.d.ts +100 -0
- package/dist/lib/text.js +233 -0
- package/dist/lib/theme-scope.d.ts +58 -0
- package/dist/lib/theme-scope.js +59 -0
- package/dist/lib/use-async-list.d.ts +60 -0
- package/dist/lib/use-async-list.js +119 -0
- package/dist/lib/use-container-width.d.ts +19 -0
- package/dist/lib/use-container-width.js +39 -0
- package/dist/lib/use-controllable-state.d.ts +33 -0
- package/dist/lib/use-controllable-state.js +56 -0
- package/dist/lib/use-edge-fade.d.ts +13 -0
- package/dist/lib/use-edge-fade.js +43 -0
- package/dist/lib/use-formatted-input.d.ts +69 -0
- package/dist/lib/use-formatted-input.js +152 -0
- package/dist/lib/use-hotkeys.d.ts +80 -0
- package/dist/lib/use-hotkeys.js +221 -0
- package/dist/lib/use-hover-intent.d.ts +44 -0
- package/dist/lib/use-hover-intent.js +119 -0
- package/dist/lib/use-media-query.d.ts +21 -0
- package/dist/lib/use-media-query.js +28 -0
- package/dist/lib/use-reduced-motion.d.ts +8 -0
- package/dist/lib/use-reduced-motion.js +13 -0
- package/dist/lib/use-tree.d.ts +153 -0
- package/dist/lib/use-tree.js +534 -0
- package/dist/lib/value-format.d.ts +25 -0
- package/dist/lib/value-format.js +56 -0
- package/dist/lib/variants.d.ts +131 -0
- package/dist/lib/variants.js +109 -0
- package/dist/locale-data/core/date.d.ts +24 -0
- package/dist/locale-data/core/date.js +68 -0
- package/dist/locale-data/core/decimal.d.ts +19 -0
- package/dist/locale-data/core/decimal.js +79 -0
- package/dist/locale-data/core/holidays.d.ts +30 -0
- package/dist/locale-data/core/holidays.js +79 -0
- package/dist/locale-data/core/iban.d.ts +29 -0
- package/dist/locale-data/core/iban.js +74 -0
- package/dist/locale-data/core/index.d.ts +7 -0
- package/dist/locale-data/core/index.js +6 -0
- package/dist/locale-data/core/types.d.ts +173 -0
- package/dist/locale-data/core/types.js +6 -0
- package/dist/locale-data/core/week-info.d.ts +23 -0
- package/dist/locale-data/core/week-info.js +85 -0
- package/dist/locale-data/core/working-days.d.ts +27 -0
- package/dist/locale-data/core/working-days.js +133 -0
- package/dist/locale-data/index.d.ts +2 -0
- package/dist/locale-data/index.js +4 -0
- package/dist/locale-data/tr/address-tr.json +1 -0
- package/dist/locale-data/tr/address.d.ts +23 -0
- package/dist/locale-data/tr/address.js +52 -0
- package/dist/locale-data/tr/holidays.d.ts +31 -0
- package/dist/locale-data/tr/holidays.js +81 -0
- package/dist/locale-data/tr/iban.d.ts +21 -0
- package/dist/locale-data/tr/iban.js +45 -0
- package/dist/locale-data/tr/id.d.ts +36 -0
- package/dist/locale-data/tr/id.js +120 -0
- package/dist/locale-data/tr/index.d.ts +12 -0
- package/dist/locale-data/tr/index.js +33 -0
- package/dist/locale-data/tr/kdv.d.ts +91 -0
- package/dist/locale-data/tr/kdv.js +222 -0
- package/dist/locales/en.d.ts +2102 -0
- package/dist/locales/en.js +2088 -0
- package/dist/locales/tr.d.ts +2086 -0
- package/dist/locales/tr.js +2087 -0
- package/dist/media/focal-point.d.ts +42 -0
- package/dist/media/focal-point.js +96 -0
- package/dist/media/gallery-layout.d.ts +19 -0
- package/dist/media/gallery-layout.js +61 -0
- package/dist/media/gallery.d.ts +64 -0
- package/dist/media/gallery.js +140 -0
- package/dist/media/image-cropper.d.ts +86 -0
- package/dist/media/image-cropper.js +170 -0
- package/dist/media/image-field.d.ts +115 -0
- package/dist/media/image-field.js +212 -0
- package/dist/media/index.d.ts +19 -0
- package/dist/media/index.js +23 -0
- package/dist/media/lightbox.d.ts +82 -0
- package/dist/media/lightbox.js +171 -0
- package/dist/media/link-preview.d.ts +97 -0
- package/dist/media/link-preview.js +177 -0
- package/dist/media/media-library.d.ts +244 -0
- package/dist/media/media-library.js +776 -0
- package/dist/media/media-picker.d.ts +96 -0
- package/dist/media/media-picker.js +209 -0
- package/dist/media/media-provider.d.ts +23 -0
- package/dist/media/media-provider.js +44 -0
- package/dist/media/media-utils.d.ts +39 -0
- package/dist/media/media-utils.js +145 -0
- package/dist/media/memory-adapter.d.ts +22 -0
- package/dist/media/memory-adapter.js +162 -0
- package/dist/media/rest-adapter.d.ts +90 -0
- package/dist/media/rest-adapter.js +208 -0
- package/dist/media/serp.d.ts +62 -0
- package/dist/media/serp.js +108 -0
- package/dist/media/test-fixtures.d.ts +3 -0
- package/dist/media/test-fixtures.js +37 -0
- package/dist/media/types.d.ts +183 -0
- package/dist/media/types.js +3 -0
- package/dist/media/use-pan-zoom.d.ts +51 -0
- package/dist/media/use-pan-zoom.js +156 -0
- package/dist/media/use-upload-queue.d.ts +64 -0
- package/dist/media/use-upload-queue.js +115 -0
- package/dist/media/video-player.d.ts +135 -0
- package/dist/media/video-player.js +319 -0
- package/dist/motion/core.d.ts +32 -0
- package/dist/motion/core.js +77 -0
- package/dist/motion/count-up.d.ts +29 -0
- package/dist/motion/count-up.js +92 -0
- package/dist/motion/index.d.ts +11 -0
- package/dist/motion/index.js +13 -0
- package/dist/motion/motion-scope.d.ts +17 -0
- package/dist/motion/motion-scope.js +16 -0
- package/dist/motion/page-transition.d.ts +33 -0
- package/dist/motion/page-transition.js +61 -0
- package/dist/motion/parallax.d.ts +37 -0
- package/dist/motion/parallax.js +90 -0
- package/dist/motion/pointer.d.ts +38 -0
- package/dist/motion/pointer.js +117 -0
- package/dist/motion/reveal.d.ts +72 -0
- package/dist/motion/reveal.js +133 -0
- package/dist/motion/scroll-shrink.d.ts +18 -0
- package/dist/motion/scroll-shrink.js +47 -0
- package/dist/motion/skeleton-swap.d.ts +17 -0
- package/dist/motion/skeleton-swap.js +43 -0
- package/dist/motion/text-reveal.d.ts +30 -0
- package/dist/motion/text-reveal.js +29 -0
- package/dist/motion/ticker.d.ts +35 -0
- package/dist/motion/ticker.js +16 -0
- package/dist/next/index.d.ts +42 -0
- package/dist/next/index.js +36 -0
- package/dist/render/block-renderer.d.ts +56 -0
- package/dist/render/block-renderer.js +137 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.js +7 -0
- package/dist/render/prepare.d.ts +61 -0
- package/dist/render/prepare.js +119 -0
- package/dist/scheduler/core/duration.d.ts +83 -0
- package/dist/scheduler/core/duration.js +174 -0
- package/dist/scheduler/core/gantt.d.ts +63 -0
- package/dist/scheduler/core/gantt.js +226 -0
- package/dist/scheduler/core/index.d.ts +6 -0
- package/dist/scheduler/core/index.js +7 -0
- package/dist/scheduler/core/layout.d.ts +97 -0
- package/dist/scheduler/core/layout.js +249 -0
- package/dist/scheduler/core/time-scale.d.ts +89 -0
- package/dist/scheduler/core/time-scale.js +173 -0
- package/dist/scheduler/gantt.d.ts +125 -0
- package/dist/scheduler/gantt.js +532 -0
- package/dist/scheduler/index.d.ts +6 -0
- package/dist/scheduler/index.js +7 -0
- package/dist/scheduler/resource-calendar.d.ts +218 -0
- package/dist/scheduler/resource-calendar.js +661 -0
- package/dist/scheduler/scheduler.d.ts +168 -0
- package/dist/scheduler/scheduler.js +768 -0
- package/dist/scheduler/shared.d.ts +63 -0
- package/dist/scheduler/shared.js +145 -0
- package/dist/scheduler/time-tracker.d.ts +138 -0
- package/dist/scheduler/time-tracker.js +403 -0
- package/dist/sortable/core.d.ts +67 -0
- package/dist/sortable/core.js +167 -0
- package/dist/sortable/index.d.ts +8 -0
- package/dist/sortable/index.js +10 -0
- package/dist/sortable/kanban-core.d.ts +70 -0
- package/dist/sortable/kanban-core.js +67 -0
- package/dist/sortable/kanban.d.ts +147 -0
- package/dist/sortable/kanban.js +472 -0
- package/dist/sortable/sortable-list.d.ts +71 -0
- package/dist/sortable/sortable-list.js +76 -0
- package/dist/sortable/sortable-tree.d.ts +105 -0
- package/dist/sortable/sortable-tree.js +462 -0
- package/dist/sortable/sortable.d.ts +188 -0
- package/dist/sortable/sortable.js +485 -0
- package/dist/sortable/use-pointer-drag.d.ts +75 -0
- package/dist/sortable/use-pointer-drag.js +173 -0
- package/dist/sortable/use-time-scale.d.ts +11 -0
- package/dist/sortable/use-time-scale.js +19 -0
- package/dist/styles/base.css +51 -0
- package/dist/styles/blocks.css +949 -0
- package/dist/styles/calendar.css +642 -0
- package/dist/styles/charts.css +264 -0
- package/dist/styles/data.css +474 -0
- package/dist/styles/editors.css +1022 -0
- package/dist/styles/forms.css +406 -0
- package/dist/styles/media.css +515 -0
- package/dist/styles/motion.css +389 -0
- package/dist/styles/navigation.css +293 -0
- package/dist/styles/overlays.css +244 -0
- package/dist/styles.css +743 -0
- package/package.json +160 -4
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type BadgeSpec, type NavIcon, type NavNode } from "../lib/nav.js";
|
|
3
|
+
export type { BadgeSpec, NavIcon, NavItem, NavGroup, NavSeparator, NavNode, NavEntry, FlatNavItem, ActiveNav, FilterNavOptions } from "../lib/nav.js";
|
|
4
|
+
declare const sidebarLabels: {
|
|
5
|
+
label: string;
|
|
6
|
+
collapse: string;
|
|
7
|
+
expand: string;
|
|
8
|
+
collapseShort: string;
|
|
9
|
+
badge: string;
|
|
10
|
+
newTab: string;
|
|
11
|
+
showSubmenu: string;
|
|
12
|
+
switchApp: string;
|
|
13
|
+
apps: string;
|
|
14
|
+
workspaces: string;
|
|
15
|
+
loading: string;
|
|
16
|
+
};
|
|
17
|
+
export type SidebarLabels = typeof sidebarLabels;
|
|
18
|
+
/** Collapsed state and helpers of the nearest `Sidebar`. */
|
|
19
|
+
export declare function useSidebar(): {
|
|
20
|
+
collapsed: boolean;
|
|
21
|
+
setCollapsed: (v: boolean) => void;
|
|
22
|
+
toggle: () => void;
|
|
23
|
+
mode: "desktop" | "mobile";
|
|
24
|
+
variant: "nav" | "surface";
|
|
25
|
+
};
|
|
26
|
+
export interface SidebarProps extends Omit<React.HTMLAttributes<HTMLElement>, "dir"> {
|
|
27
|
+
/** `nav`: dark in both themes (default). `surface`: same background as the content — client portals, websites. */
|
|
28
|
+
variant?: "nav" | "surface";
|
|
29
|
+
/** Rail mode (icons only, submenus as flyouts). */
|
|
30
|
+
collapsed?: boolean;
|
|
31
|
+
defaultCollapsed?: boolean;
|
|
32
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
33
|
+
/** Allow the rail. Default `true`. */
|
|
34
|
+
collapsible?: boolean;
|
|
35
|
+
/** `mobile`: always expanded, accordion levels instead of flyouts (inside the App shell's Sheet). */
|
|
36
|
+
mode?: "desktop" | "mobile";
|
|
37
|
+
/** Toggle shortcut, e.g. `"mod+\\"`. Default off (App shell turns it on). `mod+b` is never used — it is Bold in editors. */
|
|
38
|
+
shortcut?: string | false;
|
|
39
|
+
/** Called after any link is followed. */
|
|
40
|
+
onNavigate?: () => void;
|
|
41
|
+
labels?: Partial<SidebarLabels>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The primary app navigation. Dark in both themes; the active section's submenu stays open in
|
|
45
|
+
* place, other sections open as flyouts, and the rail turns every submenu into a flyout.
|
|
46
|
+
* Router-agnostic: links and the current path come from `VamosProvider`.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Sidebar>
|
|
50
|
+
* <SidebarHeader><AppSwitcher apps={apps} activeApp="site" /></SidebarHeader>
|
|
51
|
+
* <SidebarContent><SidebarNav items={nav} badges={{ comments: 4 }} /></SidebarContent>
|
|
52
|
+
* <SidebarFooter><SidebarCollapseButton /></SidebarFooter>
|
|
53
|
+
* </Sidebar>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLElement>>;
|
|
57
|
+
/** Top slot: app switcher, workspace switcher, logo. */
|
|
58
|
+
export declare const SidebarHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
export interface SidebarContentProps extends React.HTMLAttributes<HTMLElement> {
|
|
60
|
+
/** Accessible name of the `nav`. Default "Main navigation" (`sidebar.label`). */
|
|
61
|
+
"aria-label"?: string;
|
|
62
|
+
}
|
|
63
|
+
/** The scrolling `<nav>` with the menu. */
|
|
64
|
+
export declare const SidebarContent: React.ForwardRefExoticComponent<SidebarContentProps & React.RefAttributes<HTMLElement>>;
|
|
65
|
+
/** Bottom slot: shared menu, collapse button, user. */
|
|
66
|
+
export declare const SidebarFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
export interface SidebarGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
68
|
+
/** Section heading ("Content"). In the rail it becomes a hairline. */
|
|
69
|
+
label?: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/** A section: optional heading plus a list of `SidebarItem`s. */
|
|
72
|
+
export declare const SidebarGroup: React.ForwardRefExoticComponent<SidebarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
73
|
+
/** A hairline between sections. */
|
|
74
|
+
export declare function SidebarSeparator({ className }: {
|
|
75
|
+
className?: string;
|
|
76
|
+
}): React.JSX.Element;
|
|
77
|
+
export interface SidebarItemProps {
|
|
78
|
+
/** Stable key (matches `badges` and the active trail in `SidebarNav`). */
|
|
79
|
+
id?: string;
|
|
80
|
+
label: string;
|
|
81
|
+
href?: string;
|
|
82
|
+
icon?: NavIcon;
|
|
83
|
+
/** Count, label or `{ count, tone, dot, label }`. */
|
|
84
|
+
badge?: BadgeSpec;
|
|
85
|
+
/** `true`, or a reason shown as a badge ("Coming soon"). */
|
|
86
|
+
disabled?: boolean | string;
|
|
87
|
+
external?: boolean;
|
|
88
|
+
/** Force the active state. Default: from `SidebarNav`'s trail or the current path. */
|
|
89
|
+
active?: boolean;
|
|
90
|
+
/** `SidebarSubItem`s. */
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A level-1 item (icon + label). With children it is a section: open in place when active,
|
|
96
|
+
* a flyout otherwise (and always in the rail), an accordion in the mobile sheet.
|
|
97
|
+
*/
|
|
98
|
+
export declare function SidebarItem({ id, label, href, icon: Icon, badge, disabled, external, active, children, className }: SidebarItemProps): React.JSX.Element;
|
|
99
|
+
export interface SidebarSubItemProps {
|
|
100
|
+
id?: string;
|
|
101
|
+
label: string;
|
|
102
|
+
href?: string;
|
|
103
|
+
badge?: BadgeSpec;
|
|
104
|
+
disabled?: boolean | string;
|
|
105
|
+
external?: boolean;
|
|
106
|
+
active?: boolean;
|
|
107
|
+
/** Level-3 `SidebarSubItem`s: a collapsible inline, a heading + list in a flyout. */
|
|
108
|
+
children?: React.ReactNode;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
/** A level-2 (or level-3) link under a `SidebarItem`. */
|
|
112
|
+
export declare function SidebarSubItem({ id, label, href, badge, disabled, external, active, children, className }: SidebarSubItemProps): React.JSX.Element;
|
|
113
|
+
export interface SidebarNavProps {
|
|
114
|
+
items: NavNode[];
|
|
115
|
+
/** Live counts by item id, separate from the config so updates don't rebuild the tree: `{ comments: 4 }`. */
|
|
116
|
+
badges?: Record<string, BadgeSpec | undefined>;
|
|
117
|
+
/** Feature flags / module toggles for `feature`. */
|
|
118
|
+
features?: Record<string, boolean | undefined>;
|
|
119
|
+
/** Active trail override (App shell resolves it across every nav on the page). Default: `resolveActive(items, currentPath)`. */
|
|
120
|
+
trail?: string[];
|
|
121
|
+
/** Wraps the menu in its own `<nav>` with this name (e.g. a second "Workspace" menu in the footer). */
|
|
122
|
+
"aria-label"?: string;
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Renders a `NavNode[]` config with the same parts as the compound API (identical DOM). Items the
|
|
127
|
+
* user can't see (`permission` via `can`, `feature`) are filtered out before render — **UI only**;
|
|
128
|
+
* enforce permissions on the server.
|
|
129
|
+
*/
|
|
130
|
+
export declare function SidebarNav({ items, badges, features, trail: trailProp, className, ...props }: SidebarNavProps): React.JSX.Element;
|
|
131
|
+
/** Toggles the rail. `aria-pressed` is true while collapsed. */
|
|
132
|
+
export declare const SidebarCollapseButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
133
|
+
/** Placeholder rows while permissions load. */
|
|
134
|
+
export declare function SidebarSkeleton({ rows, className }: {
|
|
135
|
+
rows?: number;
|
|
136
|
+
className?: string;
|
|
137
|
+
}): React.JSX.Element;
|
|
138
|
+
export interface AppSwitcherApp {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
icon?: React.ComponentType<{
|
|
143
|
+
className?: string;
|
|
144
|
+
strokeWidth?: number;
|
|
145
|
+
}> | React.ReactNode;
|
|
146
|
+
href: string;
|
|
147
|
+
}
|
|
148
|
+
export interface AppSwitcherProps {
|
|
149
|
+
apps: AppSwitcherApp[];
|
|
150
|
+
activeApp?: string;
|
|
151
|
+
/** Called instead of following the app's `href` (the App shell switches in place). */
|
|
152
|
+
onSelect?: (id: string) => void;
|
|
153
|
+
/** Small line under the app name. Default the app's description. */
|
|
154
|
+
subtitle?: React.ReactNode;
|
|
155
|
+
workspaces?: {
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
logo?: string;
|
|
159
|
+
}[];
|
|
160
|
+
activeWorkspace?: string;
|
|
161
|
+
onWorkspaceChange?: (id: string) => void;
|
|
162
|
+
/** Extra links at the bottom ("Manage apps & modules…"). */
|
|
163
|
+
footer?: React.ReactNode;
|
|
164
|
+
className?: string;
|
|
165
|
+
labels?: Partial<SidebarLabels>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The app (and workspace) switcher in `SidebarHeader`: a panel of every app the user can open.
|
|
169
|
+
* With a single app it is a static title.
|
|
170
|
+
*/
|
|
171
|
+
export declare function AppSwitcher({ apps, activeApp, onSelect, subtitle, workspaces, activeWorkspace, onWorkspaceChange, footer, className, labels }: AppSwitcherProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,421 @@
|
|
|
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 { Collapsible, Popover as PopoverPrimitive } from "radix-ui";
|
|
5
|
+
import { ArrowUpRight, Check, ChevronDown, ChevronRight, ChevronsUpDown, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useLabels } from "../lib/labels.js";
|
|
8
|
+
import { useLocale } from "../lib/locale.js";
|
|
9
|
+
import { useCan, useLink, useNavigation } from "../lib/provider.js";
|
|
10
|
+
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
11
|
+
import { Layer } from "../lib/layer.js";
|
|
12
|
+
import { useHoverIntent } from "../lib/use-hover-intent.js";
|
|
13
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
14
|
+
import { useHotkeys } from "../lib/use-hotkeys.js";
|
|
15
|
+
import { filterNav, isAbsoluteHref, isNavGroup, isNavSeparator, normaliseBadge, resolveActive, } from "../lib/nav.js";
|
|
16
|
+
import { Tooltip, TooltipContent, TooltipRoot, TooltipTrigger } from "./tooltip.js";
|
|
17
|
+
const sidebarLabels = {
|
|
18
|
+
label: "Main navigation",
|
|
19
|
+
collapse: "Collapse sidebar",
|
|
20
|
+
expand: "Expand sidebar",
|
|
21
|
+
collapseShort: "Collapse",
|
|
22
|
+
badge: "{count, plural, one {# new} other {# new}}",
|
|
23
|
+
newTab: "opens in a new tab",
|
|
24
|
+
showSubmenu: "Show {label} pages",
|
|
25
|
+
switchApp: "Switch app, current: {app}",
|
|
26
|
+
apps: "Apps",
|
|
27
|
+
workspaces: "Workspaces",
|
|
28
|
+
loading: "Loading menu",
|
|
29
|
+
};
|
|
30
|
+
const SidebarContext = React.createContext(null);
|
|
31
|
+
/** Collapsed state and helpers of the nearest `Sidebar`. */
|
|
32
|
+
export function useSidebar() {
|
|
33
|
+
const ctx = React.useContext(SidebarContext);
|
|
34
|
+
if (!ctx)
|
|
35
|
+
throw new Error("useSidebar must be used inside <Sidebar>.");
|
|
36
|
+
return { collapsed: ctx.collapsed, setCollapsed: ctx.setCollapsed, toggle: () => ctx.setCollapsed(!ctx.collapsed), mode: ctx.mode, variant: ctx.variant };
|
|
37
|
+
}
|
|
38
|
+
const useSidebarCtx = () => {
|
|
39
|
+
const ctx = React.useContext(SidebarContext);
|
|
40
|
+
if (!ctx)
|
|
41
|
+
throw new Error("Sidebar parts must be used inside <Sidebar>.");
|
|
42
|
+
return ctx;
|
|
43
|
+
};
|
|
44
|
+
/** Active trail from `SidebarNav` (data-driven); `null` in the compound API (each item checks its own href). */
|
|
45
|
+
const TrailContext = React.createContext(null);
|
|
46
|
+
const SubContext = React.createContext({ placement: "inline", depth: 1 });
|
|
47
|
+
/**
|
|
48
|
+
* The primary app navigation. Dark in both themes; the active section's submenu stays open in
|
|
49
|
+
* place, other sections open as flyouts, and the rail turns every submenu into a flyout.
|
|
50
|
+
* Router-agnostic: links and the current path come from `VamosProvider`.
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Sidebar>
|
|
54
|
+
* <SidebarHeader><AppSwitcher apps={apps} activeApp="site" /></SidebarHeader>
|
|
55
|
+
* <SidebarContent><SidebarNav items={nav} badges={{ comments: 4 }} /></SidebarContent>
|
|
56
|
+
* <SidebarFooter><SidebarCollapseButton /></SidebarFooter>
|
|
57
|
+
* </Sidebar>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const Sidebar = React.forwardRef(function Sidebar({ variant = "nav", collapsed: collapsedProp, defaultCollapsed = false, onCollapsedChange, collapsible = true, mode = "desktop", shortcut = false, onNavigate, labels, className, children, ...props }, ref) {
|
|
61
|
+
const t = useLabels("sidebar", sidebarLabels, labels);
|
|
62
|
+
const [collapsedState, setCollapsed] = useControllableState({ value: collapsedProp, defaultValue: defaultCollapsed, onChange: onCollapsedChange, name: "Sidebar" });
|
|
63
|
+
const collapsed = mode === "desktop" && collapsible && collapsedState;
|
|
64
|
+
useHotkeys(shortcut || "", () => setCollapsed(!collapsedState), { enabled: Boolean(shortcut) && collapsible && mode === "desktop" });
|
|
65
|
+
const ctx = React.useMemo(() => ({ collapsed, setCollapsed, collapsible, variant, mode, onNavigate, t }), [collapsed, setCollapsed, collapsible, variant, mode, onNavigate, t]);
|
|
66
|
+
return (_jsx(SidebarContext.Provider, { value: ctx, children: _jsx("aside", { ref: ref, "data-slot": "sidebar", "data-variant": variant, "data-mode": mode, "data-collapsed": collapsed ? "" : undefined, className: cn("vui-sidebar surface-nav relative flex h-full min-h-0 shrink-0 flex-col text-[13.5px]", mode === "desktop" && "border-e border-nav-line", variant === "surface" && "border-line", className), ...props, children: children }) }));
|
|
67
|
+
});
|
|
68
|
+
/** Top slot: app switcher, workspace switcher, logo. */
|
|
69
|
+
export const SidebarHeader = React.forwardRef(function SidebarHeader({ className, ...props }, ref) {
|
|
70
|
+
return _jsx("div", { ref: ref, "data-slot": "sidebar-header", className: cn("grid gap-1 border-b border-nav-line p-2", className), ...props });
|
|
71
|
+
});
|
|
72
|
+
/** The scrolling `<nav>` with the menu. */
|
|
73
|
+
export const SidebarContent = React.forwardRef(function SidebarContent({ className, ...props }, ref) {
|
|
74
|
+
const { t } = useSidebarCtx();
|
|
75
|
+
return (_jsx("nav", { ref: ref, "data-slot": "sidebar-content", "aria-label": props["aria-label"] ?? t("label"), className: cn("min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain py-2 scrollbar-none", className), ...props }));
|
|
76
|
+
});
|
|
77
|
+
/** Bottom slot: shared menu, collapse button, user. */
|
|
78
|
+
export const SidebarFooter = React.forwardRef(function SidebarFooter({ className, ...props }, ref) {
|
|
79
|
+
return _jsx("div", { ref: ref, "data-slot": "sidebar-footer", className: cn("border-t border-nav-line", className), ...props });
|
|
80
|
+
});
|
|
81
|
+
/** A section: optional heading plus a list of `SidebarItem`s. */
|
|
82
|
+
export const SidebarGroup = React.forwardRef(function SidebarGroup({ label, className, children, ...props }, ref) {
|
|
83
|
+
const { collapsed } = useSidebarCtx();
|
|
84
|
+
const id = React.useId();
|
|
85
|
+
return (_jsxs("div", { ref: ref, "data-slot": "sidebar-group", role: label ? "group" : undefined, "aria-labelledby": label ? id : undefined, className: cn("grid", className), ...props, children: [label ? (collapsed ? (_jsxs(_Fragment, { children: [_jsx("span", { id: id, className: "sr-only", children: label }), _jsx("span", { "aria-hidden": true, className: "mx-4 my-2 h-px bg-nav-line" })] })) : (_jsx("span", { id: id, className: "px-4.5 pt-4 pb-1.5 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: label }))) : null, _jsx("ul", { className: "grid gap-px", children: children })] }));
|
|
86
|
+
});
|
|
87
|
+
/** A hairline between sections. */
|
|
88
|
+
export function SidebarSeparator({ className }) {
|
|
89
|
+
return _jsx("div", { role: "separator", "data-slot": "sidebar-separator", className: cn("mx-4 my-2 h-px bg-nav-line", className) });
|
|
90
|
+
}
|
|
91
|
+
/* ------------------------------------------------------------------ */
|
|
92
|
+
/* Badge */
|
|
93
|
+
/* ------------------------------------------------------------------ */
|
|
94
|
+
const badgeTone = {
|
|
95
|
+
accent: "bg-accent text-accent-fg",
|
|
96
|
+
danger: "bg-danger-solid text-white",
|
|
97
|
+
warning: "tone-warning bg-[color-mix(in_srgb,var(--warning)_26%,transparent)] text-nav-fg-strong",
|
|
98
|
+
neutral: "bg-nav-active text-nav-fg-strong",
|
|
99
|
+
};
|
|
100
|
+
const dotTone = { accent: "bg-accent", danger: "bg-danger-solid", warning: "bg-warning", neutral: "bg-nav-fg" };
|
|
101
|
+
/** The count / dot next to a sidebar item. Visual only; the accessible text is added to the link name. */
|
|
102
|
+
function SidebarBadgeView({ spec, rail }) {
|
|
103
|
+
const { format } = useLocale();
|
|
104
|
+
const b = normaliseBadge(spec);
|
|
105
|
+
if (!b)
|
|
106
|
+
return null;
|
|
107
|
+
if (rail || b.dot) {
|
|
108
|
+
return _jsx("span", { "aria-hidden": true, "data-slot": "sidebar-badge", className: cn("size-1.5 shrink-0 rounded-full", rail && "absolute end-2 top-2", dotTone[b.tone]) });
|
|
109
|
+
}
|
|
110
|
+
const text = b.count !== undefined ? (b.count > 99 ? `${format.number(99)}+` : format.number(b.count)) : b.text;
|
|
111
|
+
return (_jsx("span", { "aria-hidden": true, "data-slot": "sidebar-badge", className: cn("min-w-[18px] shrink-0 rounded-full px-1.5 text-center text-[10.5px] font-semibold leading-[18px] tabular", badgeTone[b.tone]), children: text }));
|
|
112
|
+
}
|
|
113
|
+
function useBadgeText(spec) {
|
|
114
|
+
const { t } = useSidebarCtx();
|
|
115
|
+
const b = normaliseBadge(spec);
|
|
116
|
+
if (!b)
|
|
117
|
+
return undefined;
|
|
118
|
+
if (b.label)
|
|
119
|
+
return b.label;
|
|
120
|
+
if (b.count !== undefined)
|
|
121
|
+
return t("badge", { count: b.count });
|
|
122
|
+
return b.text;
|
|
123
|
+
}
|
|
124
|
+
/* ------------------------------------------------------------------ */
|
|
125
|
+
/* Items */
|
|
126
|
+
/* ------------------------------------------------------------------ */
|
|
127
|
+
function hrefsOf(children) {
|
|
128
|
+
const out = [];
|
|
129
|
+
React.Children.forEach(children, (c) => {
|
|
130
|
+
if (!React.isValidElement(c))
|
|
131
|
+
return;
|
|
132
|
+
if (c.props.href)
|
|
133
|
+
out.push(c.props.href);
|
|
134
|
+
if (c.props.children)
|
|
135
|
+
out.push(...hrefsOf(c.props.children));
|
|
136
|
+
});
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
function useItemActive(id, href, children, explicit) {
|
|
140
|
+
const trail = React.useContext(TrailContext);
|
|
141
|
+
const { isActive } = useNavigation();
|
|
142
|
+
if (explicit !== undefined)
|
|
143
|
+
return { inTrail: explicit, current: explicit };
|
|
144
|
+
if (trail && id)
|
|
145
|
+
return { inTrail: trail.includes(id), current: trail[trail.length - 1] === id };
|
|
146
|
+
const self = href ? isActive(href) : false;
|
|
147
|
+
const child = hrefsOf(children).some((h) => isActive(h));
|
|
148
|
+
return { inTrail: self || child, current: self && !child };
|
|
149
|
+
}
|
|
150
|
+
const rowBase = "relative flex w-full items-center gap-3 rounded-ui-sm text-start outline-none transition-colors focus-ring";
|
|
151
|
+
/** An `<a>` through the app router, a `<button>` (no href) or a disabled `<span>`. */
|
|
152
|
+
const LinkRow = React.forwardRef(function LinkRow({ href, external, disabled, className, children, onClick, buttonProps, ...rest }, ref) {
|
|
153
|
+
const Link = useLink();
|
|
154
|
+
const { onNavigate } = useSidebarCtx();
|
|
155
|
+
if (disabled) {
|
|
156
|
+
return (_jsx("span", { ref: ref, "aria-disabled": "true", className: cn(className, "cursor-not-allowed opacity-45"), ...rest, children: children }));
|
|
157
|
+
}
|
|
158
|
+
if (!href) {
|
|
159
|
+
return (_jsx("button", { ref: ref, type: "button", className: className, onClick: onClick, ...buttonProps, ...rest, children: children }));
|
|
160
|
+
}
|
|
161
|
+
const ext = external ?? isAbsoluteHref(href);
|
|
162
|
+
const handle = (e) => {
|
|
163
|
+
onClick?.(e);
|
|
164
|
+
if (!e.defaultPrevented)
|
|
165
|
+
onNavigate?.();
|
|
166
|
+
};
|
|
167
|
+
if (ext) {
|
|
168
|
+
return (_jsx("a", { ref: ref, href: href, target: "_blank", rel: "noopener noreferrer", className: className, onClick: handle, ...rest, children: children }));
|
|
169
|
+
}
|
|
170
|
+
return (_jsx(Link, { ref: ref, href: href, className: className, onClick: handle, ...rest, children: children }));
|
|
171
|
+
});
|
|
172
|
+
function ExternalMark() {
|
|
173
|
+
const { t } = useSidebarCtx();
|
|
174
|
+
return (_jsxs(_Fragment, { children: [_jsx(ArrowUpRight, { "aria-hidden": true, className: "size-3.5 shrink-0 opacity-60 rtl:-scale-x-100" }), _jsxs("span", { className: "sr-only", children: ["(", t("newTab"), ")"] })] }));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* A level-1 item (icon + label). With children it is a section: open in place when active,
|
|
178
|
+
* a flyout otherwise (and always in the rail), an accordion in the mobile sheet.
|
|
179
|
+
*/
|
|
180
|
+
export function SidebarItem({ id, label, href, icon: Icon, badge, disabled, external, active, children, className }) {
|
|
181
|
+
const ctx = useSidebarCtx();
|
|
182
|
+
const { collapsed, mode, t, variant } = ctx;
|
|
183
|
+
const { inTrail, current } = useItemActive(id, href, children, active);
|
|
184
|
+
const hasChildren = React.Children.toArray(children).length > 0;
|
|
185
|
+
const badgeText = useBadgeText(badge);
|
|
186
|
+
const reason = typeof disabled === "string" ? disabled : undefined;
|
|
187
|
+
const inline = hasChildren && !collapsed && mode === "desktop" && inTrail;
|
|
188
|
+
const flyout = mode === "desktop" && !disabled && (collapsed || (hasChildren && !inline));
|
|
189
|
+
const accordion = hasChildren && mode === "mobile";
|
|
190
|
+
const rowClass = cn(rowBase, "mx-2 h-(--sidebar-item-h) w-auto", collapsed ? "justify-center px-0" : "px-2.5", inTrail ? "bg-nav-active font-medium text-nav-fg-strong" : "hover:bg-nav-hover hover:text-nav-fg-strong", className);
|
|
191
|
+
const content = (_jsxs(_Fragment, { children: [inTrail ? _jsx("span", { "aria-hidden": true, className: "absolute -start-2 top-1.5 bottom-1.5 w-[3px] rounded-e-full bg-accent" }) : null, Icon ? _jsx(Icon, { "aria-hidden": true, className: cn("size-[17px] shrink-0", inTrail ? (variant === "surface" ? "text-accent-ink" : "text-accent") : "opacity-80"), strokeWidth: 1.8 }) : null, _jsx("span", { className: cn("min-w-0 flex-1 truncate", collapsed && "sr-only"), children: label }), badgeText ? _jsxs("span", { className: "sr-only", children: [", ", badgeText] }) : null, reason && !collapsed ? _jsx("span", { className: "shrink-0 rounded-full bg-nav-hover px-1.5 text-[10.5px] leading-[18px] text-nav-fg", children: reason }) : null, reason && collapsed ? _jsxs("span", { className: "sr-only", children: [", ", reason] }) : null, !reason ? _jsx(SidebarBadgeView, { spec: badge, rail: collapsed }) : null, (external ?? (href ? isAbsoluteHref(href) : false)) && !collapsed ? _jsx(ExternalMark, {}) : null, flyout && hasChildren && !collapsed ? _jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 opacity-0 transition-opacity group-hover/item:opacity-50 rtl:-scale-x-100" }) : null] }));
|
|
192
|
+
if (accordion) {
|
|
193
|
+
return (_jsxs(SidebarAccordionItem, { label: label, href: href, defaultOpen: inTrail, rowClass: rowClass, current: current, disabled: disabled, external: external, showLabel: t("showSubmenu", { label }), children: [content, _jsx(SubContext.Provider, { value: { placement: "mobile", depth: 1 }, children: children })] }));
|
|
194
|
+
}
|
|
195
|
+
if (flyout) {
|
|
196
|
+
return (_jsxs(SidebarFlyoutItem, { label: label, href: href, rowClass: rowClass, current: current, inTrail: inTrail, external: external, hasChildren: hasChildren, children: [content, hasChildren ? _jsx(SubContext.Provider, { value: { placement: "flyout", depth: 1 }, children: children }) : null] }));
|
|
197
|
+
}
|
|
198
|
+
return (_jsxs("li", { "data-slot": "sidebar-item", className: "group/item", children: [_jsx(LinkRow, { href: href, external: external, disabled: disabled, "aria-current": current ? "page" : inTrail && hasChildren ? "true" : undefined, className: rowClass, children: content }), inline ? (_jsx("ul", { className: "mx-2 mt-px mb-1 grid gap-px rounded-ui-sm bg-nav-sub py-1", children: _jsx(SubContext.Provider, { value: { placement: "inline", depth: 1 }, children: children }) })) : null] }));
|
|
199
|
+
}
|
|
200
|
+
function SidebarAccordionItem({ label, href, defaultOpen, rowClass, current, disabled, external, showLabel, children, }) {
|
|
201
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
202
|
+
const [content, sub] = children;
|
|
203
|
+
return (_jsx(Collapsible.Root, { asChild: true, open: open, onOpenChange: setOpen, children: _jsxs("li", { "data-slot": "sidebar-item", className: "group/item", children: [_jsxs("div", { className: "relative flex items-center", children: [href ? (_jsx(LinkRow, { href: href, external: external, disabled: disabled, "aria-current": current ? "page" : undefined, className: cn(rowClass, "flex-1 pe-10"), children: content })) : (_jsx(Collapsible.Trigger, { asChild: true, children: _jsx("button", { type: "button", className: cn(rowClass, "flex-1 pe-10"), children: content }) })), href ? (_jsx(Collapsible.Trigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": showLabel, className: "absolute end-3 grid size-7 place-items-center rounded-ui-sm text-nav-fg hover:bg-nav-hover hover:text-nav-fg-strong focus-ring", children: _jsx(ChevronDown, { "aria-hidden": true, className: cn("size-4 transition-transform", open && "rotate-180") }) }) })) : (_jsx(ChevronDown, { "aria-hidden": true, className: cn("pointer-events-none absolute end-5 size-4 transition-transform", open && "rotate-180") }))] }), _jsx(Collapsible.Content, { className: "ui-collapse", children: _jsx("ul", { "aria-label": label, className: "mx-2 mt-px mb-1 grid gap-px rounded-ui-sm bg-nav-sub py-1", children: sub }) })] }) }));
|
|
204
|
+
}
|
|
205
|
+
function focusables(root) {
|
|
206
|
+
return root ? Array.from(root.querySelectorAll("a[href],button:not([disabled])")) : [];
|
|
207
|
+
}
|
|
208
|
+
function SidebarFlyoutItem({ label, href, rowClass, current, inTrail, external, hasChildren, children, }) {
|
|
209
|
+
const { collapsed, variant } = useSidebarCtx();
|
|
210
|
+
const { dir } = useLocale();
|
|
211
|
+
const container = usePortalContainer();
|
|
212
|
+
const [content, sub] = children;
|
|
213
|
+
const hover = useHoverIntent({ openDelay: 60, closeDelay: 180, openOnFocus: false });
|
|
214
|
+
const triggerRef = React.useRef(null);
|
|
215
|
+
const viaKeyboard = React.useRef(false);
|
|
216
|
+
const pointerType = React.useRef("mouse");
|
|
217
|
+
const panelRef = React.useRef(null);
|
|
218
|
+
const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
219
|
+
const backward = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
220
|
+
// Leaf in the rail: a tooltip is enough.
|
|
221
|
+
if (!hasChildren) {
|
|
222
|
+
return (_jsx("li", { "data-slot": "sidebar-item", className: "group/item", children: _jsx(Tooltip, { content: label, side: dir === "rtl" ? "left" : "right", children: _jsx(LinkRow, { ref: triggerRef, href: href, external: external, "aria-current": current ? "page" : undefined, className: rowClass, children: content }) }) }));
|
|
223
|
+
}
|
|
224
|
+
const openWithKeyboard = () => {
|
|
225
|
+
viaKeyboard.current = true;
|
|
226
|
+
hover.setOpen(true);
|
|
227
|
+
};
|
|
228
|
+
const close = (refocus) => {
|
|
229
|
+
hover.setOpen(false);
|
|
230
|
+
if (refocus)
|
|
231
|
+
triggerRef.current?.focus();
|
|
232
|
+
};
|
|
233
|
+
return (_jsxs(PopoverPrimitive.Root, { open: hover.open, onOpenChange: (o) => (o ? hover.setOpen(true) : close(false)), modal: false, children: [_jsx("li", { "data-slot": "sidebar-item", className: "group/item", children: _jsx(PopoverPrimitive.Anchor, { asChild: true, children: _jsx(LinkRow, { ref: triggerRef, href: href, external: external, "aria-current": current ? "page" : inTrail ? "true" : undefined, "aria-haspopup": "true", "aria-expanded": hover.open, className: cn(rowClass, hover.open && !inTrail && "bg-nav-hover text-nav-fg-strong"), ...hover.triggerProps, onPointerDown: (e) => (pointerType.current = e.pointerType), onClick: (e) => {
|
|
234
|
+
// Touch: the first tap opens the flyout, the second follows the link (WordPress-style).
|
|
235
|
+
if (!href) {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
if (hover.open)
|
|
238
|
+
close(false);
|
|
239
|
+
else if (e.detail === 0)
|
|
240
|
+
openWithKeyboard();
|
|
241
|
+
else
|
|
242
|
+
hover.setOpen(true);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (pointerType.current === "touch" && !hover.open) {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
hover.setOpen(true);
|
|
248
|
+
}
|
|
249
|
+
}, onKeyDown: (e) => {
|
|
250
|
+
if (e.key === forward || (e.key === "ArrowDown" && !href && hover.open)) {
|
|
251
|
+
e.preventDefault();
|
|
252
|
+
if (hover.open)
|
|
253
|
+
focusables(panelRef.current)[0]?.focus();
|
|
254
|
+
else
|
|
255
|
+
openWithKeyboard();
|
|
256
|
+
}
|
|
257
|
+
else if (e.key === "Escape" && hover.open) {
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
close(true);
|
|
260
|
+
}
|
|
261
|
+
}, children: content }) }) }), _jsx(PopoverPrimitive.Portal, { container: container, children: _jsx(Layer, { asChild: true, children: _jsxs(PopoverPrimitive.Content, { ref: (node) => {
|
|
262
|
+
panelRef.current = node;
|
|
263
|
+
hover.contentRef(node);
|
|
264
|
+
}, side: dir === "rtl" ? "left" : "right", align: "start", sideOffset: 8, alignOffset: -6, collisionPadding: 12, "aria-label": label, "data-slot": "sidebar-flyout", "data-variant": variant, className: "vui-sidebar-flyout ui-pop z-(--z-popover) min-w-52 max-w-72 rounded-ui-lg p-1.5 text-[13px] outline-none", ...hover.contentProps, onOpenAutoFocus: (e) => {
|
|
265
|
+
// Radix skips links on auto-focus; focus the first item ourselves when opened from the keyboard.
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
if (viaKeyboard.current)
|
|
268
|
+
focusables(e.currentTarget)[0]?.focus();
|
|
269
|
+
viaKeyboard.current = false;
|
|
270
|
+
}, onCloseAutoFocus: (e) => e.preventDefault(), onEscapeKeyDown: (e) => {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
close(true);
|
|
273
|
+
}, onKeyDown: (e) => {
|
|
274
|
+
const items = focusables(panelRef.current);
|
|
275
|
+
const i = items.indexOf(document.activeElement);
|
|
276
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
const next = e.key === "ArrowDown" ? (i + 1) % items.length : (i - 1 + items.length) % items.length;
|
|
279
|
+
items[next]?.focus();
|
|
280
|
+
}
|
|
281
|
+
else if (e.key === "Home" || e.key === "End") {
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
items[e.key === "Home" ? 0 : items.length - 1]?.focus();
|
|
284
|
+
}
|
|
285
|
+
else if (e.key === backward) {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
close(true);
|
|
288
|
+
}
|
|
289
|
+
}, children: [collapsed ? _jsx("p", { className: "px-2.5 pt-1 pb-1.5 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: label }) : null, _jsx(SubContext.Provider, { value: { placement: "flyout", depth: 1, close: () => close(false) }, children: _jsx("ul", { className: "grid gap-px", children: sub }) })] }) }) })] }));
|
|
290
|
+
}
|
|
291
|
+
/** A level-2 (or level-3) link under a `SidebarItem`. */
|
|
292
|
+
export function SidebarSubItem({ id, label, href, badge, disabled, external, active, children, className }) {
|
|
293
|
+
const { placement, depth, close } = React.useContext(SubContext);
|
|
294
|
+
const { inTrail, current } = useItemActive(id, href, children, active);
|
|
295
|
+
const badgeText = useBadgeText(badge);
|
|
296
|
+
const hasChildren = React.Children.toArray(children).length > 0;
|
|
297
|
+
const [open, setOpen] = React.useState(inTrail);
|
|
298
|
+
if (process.env.NODE_ENV !== "production" && depth > 2)
|
|
299
|
+
console.warn("[vamos-ui] Sidebar supports up to 3 levels.");
|
|
300
|
+
const flyout = placement === "flyout";
|
|
301
|
+
const pad = flyout ? (depth > 1 ? "ps-5 pe-2.5" : "px-2.5") : depth > 1 ? "ps-[54px] pe-3" : "ps-[42px] pe-3";
|
|
302
|
+
const rowClass = cn(rowBase, "gap-2 py-1.5 text-[13px]", flyout ? "rounded-ui-sm hover:bg-nav-hover hover:text-nav-fg-strong" : "hover:text-nav-fg-strong", pad, current ? "font-medium text-nav-fg-strong" : undefined, className);
|
|
303
|
+
const body = (_jsxs(_Fragment, { children: [current && flyout ? _jsx(Check, { "aria-hidden": true, className: "size-3.5 shrink-0 text-accent" }) : null, _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), badgeText ? _jsxs("span", { className: "sr-only", children: [", ", badgeText] }) : null, typeof disabled === "string" ? _jsx("span", { className: "shrink-0 text-[10.5px] text-nav-fg/70", children: disabled }) : _jsx(SidebarBadgeView, { spec: badge, rail: false }), (external ?? (href ? isAbsoluteHref(href) : false)) ? _jsx(ExternalMark, {}) : null] }));
|
|
304
|
+
if (hasChildren && flyout) {
|
|
305
|
+
return (_jsxs("li", { "data-slot": "sidebar-sub-item", className: "mt-1 first:mt-0", children: [_jsx("p", { className: "px-2.5 pt-1.5 pb-1 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: label }), _jsx("ul", { className: "grid gap-px", children: _jsx(SubContext.Provider, { value: { placement, depth: depth + 1, close }, children: children }) })] }));
|
|
306
|
+
}
|
|
307
|
+
if (hasChildren) {
|
|
308
|
+
return (_jsx(Collapsible.Root, { asChild: true, open: open, onOpenChange: setOpen, children: _jsxs("li", { "data-slot": "sidebar-sub-item", children: [_jsx(Collapsible.Trigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn(rowClass, inTrail && "text-nav-fg-strong"), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(ChevronDown, { "aria-hidden": true, className: cn("size-3.5 shrink-0 opacity-60 transition-transform", open && "rotate-180") })] }) }), _jsx(Collapsible.Content, { className: "ui-collapse", children: _jsx("ul", { "aria-label": label, className: "grid gap-px", children: _jsx(SubContext.Provider, { value: { placement, depth: depth + 1, close }, children: children }) }) })] }) }));
|
|
309
|
+
}
|
|
310
|
+
return (_jsx("li", { "data-slot": "sidebar-sub-item", children: _jsx(LinkRow, { href: href, external: external, disabled: disabled, "aria-current": current ? "page" : undefined, className: rowClass, onClick: () => close?.(), children: body }) }));
|
|
311
|
+
}
|
|
312
|
+
function renderItem(it, badges) {
|
|
313
|
+
return (_jsx(SidebarItem, { id: it.id, label: it.label, href: it.href, icon: it.icon, badge: badges?.[it.id] ?? it.badge, disabled: it.disabled, external: it.external, children: it.children?.map((c) => renderSub(c, badges)) }, it.id));
|
|
314
|
+
}
|
|
315
|
+
function renderSub(it, badges) {
|
|
316
|
+
return (_jsx(SidebarSubItem, { id: it.id, label: it.label, href: it.href, badge: badges?.[it.id] ?? it.badge, disabled: it.disabled, external: it.external, children: it.children?.map((c) => renderSub(c, badges)) }, it.id));
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Renders a `NavNode[]` config with the same parts as the compound API (identical DOM). Items the
|
|
320
|
+
* user can't see (`permission` via `can`, `feature`) are filtered out before render — **UI only**;
|
|
321
|
+
* enforce permissions on the server.
|
|
322
|
+
*/
|
|
323
|
+
export function SidebarNav({ items, badges, features, trail: trailProp, className, ...props }) {
|
|
324
|
+
const can = useCan();
|
|
325
|
+
const { currentPath } = useNavigation();
|
|
326
|
+
const visible = React.useMemo(() => filterNav(items, { can, features }), [items, can, features]);
|
|
327
|
+
const trail = React.useMemo(() => trailProp ?? resolveActive(visible, currentPath).trail, [trailProp, visible, currentPath]);
|
|
328
|
+
const blocks = [];
|
|
329
|
+
let loose = [];
|
|
330
|
+
const flush = (key) => {
|
|
331
|
+
if (!loose.length)
|
|
332
|
+
return;
|
|
333
|
+
blocks.push(_jsx(SidebarGroup, { children: loose.map((it) => renderItem(it, badges)) }, `loose-${key}`));
|
|
334
|
+
loose = [];
|
|
335
|
+
};
|
|
336
|
+
visible.forEach((n, i) => {
|
|
337
|
+
if (isNavSeparator(n)) {
|
|
338
|
+
flush(String(i));
|
|
339
|
+
blocks.push(_jsx(SidebarSeparator, {}, n.id ?? `sep-${i}`));
|
|
340
|
+
}
|
|
341
|
+
else if (isNavGroup(n)) {
|
|
342
|
+
flush(String(i));
|
|
343
|
+
blocks.push(_jsx(SidebarGroup, { label: n.label, children: n.items.map((it) => renderItem(it, badges)) }, n.id));
|
|
344
|
+
}
|
|
345
|
+
else
|
|
346
|
+
loose.push(n);
|
|
347
|
+
});
|
|
348
|
+
flush("end");
|
|
349
|
+
const body = _jsx(TrailContext.Provider, { value: trail, children: blocks });
|
|
350
|
+
if (props["aria-label"]) {
|
|
351
|
+
return (_jsx("nav", { "aria-label": props["aria-label"], "data-slot": "sidebar-nav", className: cn("py-2", className), children: body }));
|
|
352
|
+
}
|
|
353
|
+
return (_jsx("div", { "data-slot": "sidebar-nav", className: className, children: body }));
|
|
354
|
+
}
|
|
355
|
+
/* ------------------------------------------------------------------ */
|
|
356
|
+
/* Collapse button, skeleton */
|
|
357
|
+
/* ------------------------------------------------------------------ */
|
|
358
|
+
/** Toggles the rail. `aria-pressed` is true while collapsed. */
|
|
359
|
+
export const SidebarCollapseButton = React.forwardRef(function SidebarCollapseButton({ className, onClick, ...props }, ref) {
|
|
360
|
+
const { collapsed, setCollapsed, collapsible, mode, t } = useSidebarCtx();
|
|
361
|
+
const { dir } = useLocale();
|
|
362
|
+
if (!collapsible || mode === "mobile")
|
|
363
|
+
return null;
|
|
364
|
+
const Icon = collapsed ? PanelLeftOpen : PanelLeftClose;
|
|
365
|
+
// One stable element in both states (a remount would drop focus after the click).
|
|
366
|
+
return (_jsxs(TooltipRoot, { open: collapsed ? undefined : false, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { ref: ref, type: "button", "aria-pressed": collapsed, "aria-label": t("collapse"), onClick: (e) => {
|
|
367
|
+
onClick?.(e);
|
|
368
|
+
if (!e.defaultPrevented)
|
|
369
|
+
setCollapsed(!collapsed);
|
|
370
|
+
}, className: cn("flex h-10 w-full items-center gap-3 text-[12.5px] text-nav-fg/70 transition-colors hover:text-nav-fg-strong focus-ring", collapsed ? "justify-center" : "px-4.5", className), ...props, children: [_jsx(Icon, { "aria-hidden": true, className: "size-4 rtl:-scale-x-100" }), !collapsed ? _jsx("span", { "aria-hidden": true, children: t("collapseShort") }) : null] }) }), _jsx(TooltipContent, { side: dir === "rtl" ? "left" : "right", children: t("expand") })] }));
|
|
371
|
+
});
|
|
372
|
+
/** Placeholder rows while permissions load. */
|
|
373
|
+
export function SidebarSkeleton({ rows = 6, className }) {
|
|
374
|
+
const { collapsed, t } = useSidebarCtx();
|
|
375
|
+
return (_jsx("div", { role: "status", "aria-label": t("loading"), "data-slot": "sidebar-skeleton", className: cn("grid gap-1.5 px-2 py-3", className), children: Array.from({ length: rows }, (_, i) => (_jsxs("div", { className: cn("flex h-(--sidebar-item-h) items-center gap-3 rounded-ui-sm", collapsed ? "justify-center" : "px-2.5"), children: [_jsx("span", { className: "size-4 shrink-0 animate-pulse rounded-[5px] bg-nav-active motion-reduce:animate-none" }), !collapsed ? _jsx("span", { className: "h-2.5 animate-pulse rounded-full bg-nav-active motion-reduce:animate-none", style: { width: `${48 + ((i * 37) % 40)}%` } }) : null] }, i))) }));
|
|
376
|
+
}
|
|
377
|
+
function AppIcon({ icon, className }) {
|
|
378
|
+
if (!icon)
|
|
379
|
+
return null;
|
|
380
|
+
if (React.isValidElement(icon))
|
|
381
|
+
return icon;
|
|
382
|
+
if (typeof icon === "function" || (typeof icon === "object" && icon !== null && "$$typeof" in icon)) {
|
|
383
|
+
const I = icon;
|
|
384
|
+
return _jsx(I, { "aria-hidden": true, className: className, strokeWidth: 2 });
|
|
385
|
+
}
|
|
386
|
+
return _jsx(_Fragment, { children: icon });
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* The app (and workspace) switcher in `SidebarHeader`: a panel of every app the user can open.
|
|
390
|
+
* With a single app it is a static title.
|
|
391
|
+
*/
|
|
392
|
+
export function AppSwitcher({ apps, activeApp, onSelect, subtitle, workspaces, activeWorkspace, onWorkspaceChange, footer, className, labels }) {
|
|
393
|
+
const { collapsed, variant, onNavigate } = useSidebarCtx();
|
|
394
|
+
const t = useLabels("sidebar", sidebarLabels, labels);
|
|
395
|
+
const Link = useLink();
|
|
396
|
+
const { dir } = useLocale();
|
|
397
|
+
const container = usePortalContainer();
|
|
398
|
+
const [open, setOpen] = React.useState(false);
|
|
399
|
+
const app = apps.find((a) => a.id === activeApp) ?? apps[0];
|
|
400
|
+
if (!app)
|
|
401
|
+
return null;
|
|
402
|
+
const single = apps.length < 2 && !(workspaces && workspaces.length > 1);
|
|
403
|
+
const workspace = workspaces?.find((w) => w.id === activeWorkspace);
|
|
404
|
+
const tile = (_jsxs(_Fragment, { children: [_jsx("span", { className: "grid size-8 shrink-0 place-items-center rounded-[9px] bg-accent text-accent-fg [&_svg]:size-[17px]", children: _jsx(AppIcon, { icon: app.icon }) }), _jsxs("span", { className: cn("min-w-0 flex-1 leading-tight", collapsed && "sr-only"), children: [_jsx("span", { className: "block truncate text-[13.5px] font-semibold text-nav-fg-strong", children: app.name }), _jsx("span", { className: "block truncate text-[11.5px] text-nav-fg/75", children: subtitle ?? (workspace ? workspace.name : app.description) })] })] }));
|
|
405
|
+
const boxClass = cn("flex w-full items-center gap-2.5 rounded-ui-sm p-1.5 text-start", collapsed && "justify-center");
|
|
406
|
+
if (single)
|
|
407
|
+
return _jsx("div", { className: cn(boxClass, className), children: tile });
|
|
408
|
+
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn(boxClass, "transition-colors hover:bg-nav-hover focus-ring", className), children: [_jsx("span", { className: "sr-only", children: t("switchApp", { app: app.name }) }), _jsx("span", { "aria-hidden": true, className: "contents", children: tile }), !collapsed ? _jsx(ChevronsUpDown, { "aria-hidden": true, className: "size-4 shrink-0 text-nav-fg/50" }) : null] }) }), _jsx(PopoverPrimitive.Portal, { container: container, children: _jsx(Layer, { asChild: true, children: _jsxs(PopoverPrimitive.Content, { side: collapsed ? (dir === "rtl" ? "left" : "right") : "bottom", align: "start", sideOffset: 6, collisionPadding: 12, "aria-label": t("apps"), "data-variant": variant, className: "vui-sidebar-flyout ui-pop z-(--z-popover) w-64 max-w-[calc(100vw-1.5rem)] rounded-ui-lg p-1.5 outline-none", children: [workspaces && workspaces.length > 1 ? (_jsxs("div", { role: "group", "aria-label": t("workspaces"), className: "mb-1 border-b border-nav-line pb-1.5", children: [_jsx("p", { className: "px-2.5 pt-1 pb-1.5 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: t("workspaces") }), workspaces.map((w) => (_jsxs("button", { type: "button", "aria-pressed": w.id === activeWorkspace, onClick: () => {
|
|
409
|
+
onWorkspaceChange?.(w.id);
|
|
410
|
+
setOpen(false);
|
|
411
|
+
}, className: "flex w-full items-center gap-2.5 rounded-ui-sm px-2 py-1.5 text-start text-[13px] text-nav-fg hover:bg-nav-hover hover:text-nav-fg-strong focus-ring", children: [_jsx("span", { "aria-hidden": true, className: "grid size-6 place-items-center rounded-[7px] bg-nav-active text-[11px] font-semibold text-nav-fg-strong", children: w.name.slice(0, 1) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: w.name }), w.id === activeWorkspace ? _jsx(Check, { "aria-hidden": true, className: "size-4 text-accent" }) : null] }, w.id)))] })) : null, _jsx("p", { className: "px-2.5 pt-1 pb-1.5 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: t("apps") }), _jsx("ul", { className: "grid gap-px", children: apps.map((a) => {
|
|
412
|
+
const isActive = a.id === app.id;
|
|
413
|
+
const inner = (_jsxs(_Fragment, { children: [_jsx("span", { className: cn("grid size-7 shrink-0 place-items-center rounded-[8px] [&_svg]:size-[15px]", isActive ? "bg-accent text-accent-fg" : "bg-nav-active text-nav-fg-strong"), children: _jsx(AppIcon, { icon: a.icon }) }), _jsxs("span", { className: "min-w-0 flex-1 leading-tight", children: [_jsx("span", { className: "block text-[13px] font-medium text-nav-fg-strong", children: a.name }), a.description ? _jsx("span", { className: "block truncate text-[11.5px] text-nav-fg/70", children: a.description }) : null] }), isActive ? _jsx(Check, { "aria-hidden": true, className: "size-4 shrink-0 text-accent" }) : null] }));
|
|
414
|
+
const cls = "flex w-full items-center gap-2.5 rounded-ui-sm px-2 py-1.5 text-start hover:bg-nav-hover focus-ring";
|
|
415
|
+
return (_jsx("li", { children: onSelect ? (_jsx("button", { type: "button", "aria-current": isActive ? "true" : undefined, className: cls, onClick: () => {
|
|
416
|
+
onSelect(a.id);
|
|
417
|
+
setOpen(false);
|
|
418
|
+
onNavigate?.();
|
|
419
|
+
}, children: inner })) : (_jsx(Link, { href: a.href, "aria-current": isActive ? "true" : undefined, className: cls, onClick: () => setOpen(false), children: inner })) }, a.id));
|
|
420
|
+
}) }), footer ? _jsx("div", { className: "mt-1 border-t border-nav-line pt-1 text-[12.5px] [&_a]:block [&_a]:rounded-ui-sm [&_a]:px-2.5 [&_a]:py-1.5 [&_a:hover]:bg-nav-hover [&_a:hover]:text-nav-fg-strong", children: footer }) : null] }) }) })] }));
|
|
421
|
+
}
|