@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,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
5
|
+
import { CircleAlert, X } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useComposedRefs, mergeIds } from "../lib/compose-refs.js";
|
|
8
|
+
import { FieldContext, useFieldControl } from "../lib/field-context.js";
|
|
9
|
+
import { useLabels } from "../lib/labels.js";
|
|
10
|
+
import { controlVariants } from "../lib/variants.js";
|
|
11
|
+
/**
|
|
12
|
+
* The classic field look for a bare `<input>` / `<textarea>`. Kept for compatibility —
|
|
13
|
+
* new controls should use `controlVariants` from `lib/variants`.
|
|
14
|
+
*/
|
|
15
|
+
export const fieldBase = "w-full min-w-0 rounded-ui border border-field-border bg-field text-sm text-fg placeholder:text-fg-subtle transition-[border-color,box-shadow] duration-150 hover:border-field-border-hover focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_var(--accent-soft)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger aria-invalid:focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--danger)_18%,transparent)]";
|
|
16
|
+
/* ------------------------------------------------------------------ */
|
|
17
|
+
/* Input */
|
|
18
|
+
/* ------------------------------------------------------------------ */
|
|
19
|
+
const inputLabels = {
|
|
20
|
+
clear: "Clear",
|
|
21
|
+
count: "{count} / {max}",
|
|
22
|
+
remaining: "{count, plural, =0 {No characters left} one {# character left} other {# characters left}}",
|
|
23
|
+
};
|
|
24
|
+
const setNativeValue = (el, value) => {
|
|
25
|
+
const proto = el instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
26
|
+
Object.getOwnPropertyDescriptor(proto, "value")?.set?.call(el, value);
|
|
27
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Single-line text entry. Native contract (`value` / `defaultValue` / `onChange(event)`); the
|
|
31
|
+
* `ref` always reaches the `<input>`, so `react-hook-form`'s `register` works. Inside a `Field`
|
|
32
|
+
* the id, description and invalid/required/disabled state are wired automatically.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Field label="Title" hint="Under 60 characters for search results.">
|
|
36
|
+
* <Input maxLength={60} showCount />
|
|
37
|
+
* </Field>
|
|
38
|
+
* <Input leading={<Search />} placeholder="Search contacts" clearable />
|
|
39
|
+
* <Input addonStart="https://" addonEnd=".vamos.ist" defaultValue="acme" />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const Input = React.forwardRef(function Input(rawProps, forwardedRef) {
|
|
43
|
+
const { className, inputClassName, size = "md", variant = "default", leading, trailing, addonStart, addonEnd, clearable, onClear, showCount, invalid, labels, style, ...rest } = rawProps;
|
|
44
|
+
const props = useFieldControl({ ...rest, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
45
|
+
const t = useLabels("input", inputLabels, labels);
|
|
46
|
+
const inputRef = React.useRef(null);
|
|
47
|
+
const ref = useComposedRefs(forwardedRef, inputRef);
|
|
48
|
+
const countId = React.useId();
|
|
49
|
+
const controlled = props.value !== undefined;
|
|
50
|
+
const [uncontrolledLength, setLength] = React.useState(() => String(props.defaultValue ?? "").length);
|
|
51
|
+
const length = controlled ? String(props.value ?? "").length : uncontrolledLength;
|
|
52
|
+
const hasValue = length > 0;
|
|
53
|
+
const inert = props.disabled || props.readOnly;
|
|
54
|
+
const max = props.maxLength !== undefined && props.maxLength >= 0 ? props.maxLength : undefined;
|
|
55
|
+
const remaining = max !== undefined ? max - length : undefined;
|
|
56
|
+
const clear = () => {
|
|
57
|
+
const el = inputRef.current;
|
|
58
|
+
if (!el)
|
|
59
|
+
return;
|
|
60
|
+
setNativeValue(el, "");
|
|
61
|
+
if (!controlled)
|
|
62
|
+
setLength(0);
|
|
63
|
+
onClear?.();
|
|
64
|
+
el.focus();
|
|
65
|
+
};
|
|
66
|
+
const showClear = clearable && hasValue && !inert;
|
|
67
|
+
const adornment = "pointer-events-none flex shrink-0 items-center text-fg-subtle [&_svg]:size-[1em]";
|
|
68
|
+
const addon = "flex shrink-0 items-center self-stretch bg-surface-2 text-fg-muted whitespace-nowrap";
|
|
69
|
+
return (_jsxs("div", { "data-slot": "input", "data-size": size, "data-readonly": props.readOnly ? "" : undefined, className: cn(controlVariants({ size, variant }), "cursor-text gap-0 overflow-visible px-0", className), style: style, onPointerDown: (e) => {
|
|
70
|
+
// Clicking padding or an adornment focuses the input (not addons/buttons).
|
|
71
|
+
if (e.target === e.currentTarget) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
inputRef.current?.focus();
|
|
74
|
+
}
|
|
75
|
+
}, children: [addonStart ? _jsx("span", { className: cn(addon, "rounded-s-[inherit] border-e border-field-border px-3"), children: addonStart }) : null, leading ? _jsx("span", { className: cn(adornment, "ps-3"), children: leading }) : null, _jsx("input", { ref: ref, ...props, "aria-describedby": mergeIds(props["aria-describedby"], showCount ? countId : undefined), className: cn("h-full min-w-0 flex-1 bg-transparent px-3 text-[length:inherit] text-fg outline-none placeholder:text-fg-subtle disabled:cursor-not-allowed", leading && "ps-2", (trailing || showClear || showCount) && "pe-1.5", inputClassName), onChange: (e) => {
|
|
76
|
+
if (!controlled)
|
|
77
|
+
setLength(e.currentTarget.value.length);
|
|
78
|
+
props.onChange?.(e);
|
|
79
|
+
}, onKeyDown: (e) => {
|
|
80
|
+
props.onKeyDown?.(e);
|
|
81
|
+
if (!e.defaultPrevented && clearable && e.key === "Escape" && hasValue && !inert) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
clear();
|
|
85
|
+
}
|
|
86
|
+
} }), showClear ? (_jsx("button", { type: "button", tabIndex: -1, "aria-label": t("clear"), onClick: clear, className: "me-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-ui-sm text-fg-subtle transition-colors hover:bg-hover hover:text-fg [&_svg]:size-3.5", children: _jsx(X, { "aria-hidden": true }) })) : null, showCount ? (_jsxs("span", { className: cn("pointer-events-none shrink-0 pe-3 font-mono text-[11px] tabular text-fg-subtle", remaining !== undefined && remaining <= 0 && "text-danger", remaining !== undefined && remaining > 0 && remaining <= 10 && "text-warning"), children: [_jsx("span", { "aria-hidden": true, children: max !== undefined ? t("count", { count: length, max }) : length }), _jsx("span", { id: countId, className: "sr-only", "aria-live": "polite", children: remaining !== undefined && remaining <= 10 ? t("remaining", { count: Math.max(remaining, 0) }) : "" })] })) : null, trailing ? _jsx("span", { className: cn("flex shrink-0 items-center text-fg-subtle [&_svg]:size-[1em]", !addonEnd && "pe-1.5", "[&>svg]:me-1.5"), children: trailing }) : null, addonEnd ? _jsx("span", { className: cn(addon, "rounded-e-[inherit] border-s border-field-border px-3"), children: addonEnd }) : null] }));
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* Multi-line text. Grows with its content (`field-sizing: content`) and reads Field context.
|
|
90
|
+
*
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <Field label="Anything we should know first?"><Textarea maxLength={400} showCount /></Field>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export const Textarea = React.forwardRef(function Textarea({ className, rows = 4, invalid, showCount, labels, ...rest }, ref) {
|
|
96
|
+
const props = useFieldControl({ ...rest, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
97
|
+
const t = useLabels("input", inputLabels, labels);
|
|
98
|
+
const countId = React.useId();
|
|
99
|
+
const controlled = props.value !== undefined;
|
|
100
|
+
const [uncontrolledLength, setLength] = React.useState(() => String(props.defaultValue ?? "").length);
|
|
101
|
+
const length = controlled ? String(props.value ?? "").length : uncontrolledLength;
|
|
102
|
+
const max = props.maxLength !== undefined && props.maxLength >= 0 ? props.maxLength : undefined;
|
|
103
|
+
const remaining = max !== undefined ? max - length : undefined;
|
|
104
|
+
const area = (_jsx("textarea", { ref: ref, rows: rows, "data-slot": "textarea", className: cn(fieldBase, "field-sizing-content min-h-20 px-3 py-2.5 leading-relaxed read-only:border-dashed read-only:bg-transparent", className), ...props, "aria-describedby": showCount ? mergeIds(props["aria-describedby"], countId) : props["aria-describedby"], onChange: (e) => {
|
|
105
|
+
if (!controlled)
|
|
106
|
+
setLength(e.currentTarget.value.length);
|
|
107
|
+
props.onChange?.(e);
|
|
108
|
+
} }));
|
|
109
|
+
if (!showCount)
|
|
110
|
+
return area;
|
|
111
|
+
return (_jsxs("div", { "data-slot": "textarea-root", className: "flex w-full flex-col gap-1", children: [area, _jsxs("span", { className: cn("self-end font-mono text-[11px] tabular text-fg-muted", remaining !== undefined && remaining <= 0 && "text-danger", remaining !== undefined && remaining > 0 && remaining <= 20 && "text-warning"), children: [_jsx("span", { "aria-hidden": true, children: max !== undefined ? t("count", { count: length, max }) : length }), _jsx("span", { id: countId, className: "sr-only", "aria-live": "polite", children: remaining !== undefined && remaining <= 20 ? t("remaining", { count: Math.max(remaining, 0) }) : "" })] })] }));
|
|
112
|
+
});
|
|
113
|
+
/* ------------------------------------------------------------------ */
|
|
114
|
+
/* Label */
|
|
115
|
+
/* ------------------------------------------------------------------ */
|
|
116
|
+
/** Form label (Radix Label: no text selection on double-click). */
|
|
117
|
+
export const Label = React.forwardRef(function Label({ className, ...props }, ref) {
|
|
118
|
+
return (_jsx(LabelPrimitive.Root, { ref: ref, "data-slot": "label", className: cn("text-[13px] font-medium text-fg", className), ...props }));
|
|
119
|
+
});
|
|
120
|
+
/* ------------------------------------------------------------------ */
|
|
121
|
+
/* Field */
|
|
122
|
+
/* ------------------------------------------------------------------ */
|
|
123
|
+
const fieldLabels = { optional: "(optional)", required: "(required)" };
|
|
124
|
+
const NATIVE = new Set(["input", "select", "textarea"]);
|
|
125
|
+
/**
|
|
126
|
+
* Label + control + hint/error, with the accessibility wiring done for you:
|
|
127
|
+
* `<label for>`, `aria-describedby` (merged with the control's own), `aria-invalid`, `required`,
|
|
128
|
+
* `disabled`. Works with any kit control through context — Select, Combobox, Date picker —
|
|
129
|
+
* not only a single direct child.
|
|
130
|
+
*
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <Field label="Work email" hint="We send the invoice here." required>
|
|
133
|
+
* <Input type="email" />
|
|
134
|
+
* </Field>
|
|
135
|
+
* <Field label="Status" error={errors.status}><Select … /></Field>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export function Field({ label, hint, error, id, name, required = false, optional = false, disabled = false, readOnly = false, orientation = "vertical", layout = "stack", labelAction, className, labels, children, }) {
|
|
139
|
+
const t = useLabels("field", fieldLabels, labels);
|
|
140
|
+
const autoId = React.useId();
|
|
141
|
+
const only = React.Children.count(children) === 1 && React.isValidElement(children) ? children : null;
|
|
142
|
+
const controlId = id ?? only?.props.id ?? `field${autoId.replace(/:/g, "")}`;
|
|
143
|
+
const firstError = Array.isArray(error) ? error.find((e) => e != null && e !== false && e !== "") : error;
|
|
144
|
+
const hasError = firstError != null && firstError !== false && firstError !== "";
|
|
145
|
+
const labelId = label ? `${controlId}-label` : undefined;
|
|
146
|
+
const hintId = !hasError && hint ? `${controlId}-hint` : undefined;
|
|
147
|
+
const errorId = hasError ? `${controlId}-error` : undefined;
|
|
148
|
+
const ctx = React.useMemo(() => ({ id: controlId, labelId, describedBy: mergeIds(hintId, errorId), errorId, invalid: hasError, required, disabled, readOnly, name }), [controlId, labelId, hintId, errorId, hasError, required, disabled, readOnly, name]);
|
|
149
|
+
// A plain DOM control can't read context: wire it by cloning.
|
|
150
|
+
let control = children;
|
|
151
|
+
if (only && typeof only.type === "string" && NATIVE.has(only.type)) {
|
|
152
|
+
const p = only.props;
|
|
153
|
+
control = React.cloneElement(only, {
|
|
154
|
+
id: controlId,
|
|
155
|
+
name: p.name ?? name,
|
|
156
|
+
"aria-describedby": mergeIds(ctx.describedBy, p["aria-describedby"]),
|
|
157
|
+
"aria-invalid": p["aria-invalid"] ?? (hasError || undefined),
|
|
158
|
+
required: p.required ?? (required || undefined),
|
|
159
|
+
disabled: p.disabled ?? (disabled || undefined),
|
|
160
|
+
readOnly: p.readOnly ?? (readOnly || undefined),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const labelEl = label ? (_jsxs("div", { className: cn("flex min-w-0 items-baseline justify-between gap-3", orientation === "horizontal" && "col-start-2 row-start-1"), children: [_jsxs(Label, { id: labelId, htmlFor: controlId, className: cn(disabled && "opacity-60", orientation === "horizontal" && "font-normal"), children: [label, required ? (_jsx("span", { "aria-hidden": true, className: "ms-0.5 text-danger", children: "*" })) : null, optional && !required ? _jsx("span", { className: "ms-1 font-normal text-fg-subtle", children: t("optional") }) : null] }), labelAction ? _jsx("div", { className: "shrink-0 text-xs", children: labelAction }) : null] })) : null;
|
|
164
|
+
const message = hasError ? (_jsxs("p", { id: errorId, "data-slot": "field-error", className: "flex items-start gap-1.5 text-xs text-danger", children: [_jsx(CircleAlert, { "aria-hidden": true, className: "mt-px size-3.5 shrink-0" }), _jsx("span", { children: firstError })] })) : hint ? (_jsx("p", { id: hintId, "data-slot": "field-hint", className: "text-xs text-pretty text-fg-subtle", children: hint })) : null;
|
|
165
|
+
const body = orientation === "horizontal" ? (_jsxs("div", { className: "grid grid-cols-[auto_minmax(0,1fr)] items-start gap-x-2.5 gap-y-0.5", children: [_jsx("div", { className: "col-start-1 row-span-2 row-start-1 flex min-h-5 items-center", children: control }), labelEl, message ? _jsx("div", { className: "col-start-2 row-start-2", children: message }) : null] })) : layout === "inline" ? (_jsxs("div", { className: "grid gap-1.5 sm:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)] sm:gap-x-6", children: [_jsx("div", { className: "sm:pt-[calc((var(--control-h)-1.25rem)/2)]", children: labelEl }), _jsxs("div", { className: "grid min-w-0 gap-1.5", children: [control, message] })] })) : (_jsxs(_Fragment, { children: [labelEl, control, message] }));
|
|
166
|
+
return (_jsx(FieldContext.Provider, { value: ctx, children: _jsx("div", { "data-slot": "field", "data-invalid": hasError ? "" : undefined, "data-disabled": disabled ? "" : undefined, className: cn("group/field grid min-w-0 content-start gap-1.5", className), children: body }) }));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Groups related controls with a real `<fieldset>` + `<legend>` — radio and checkbox groups,
|
|
170
|
+
* an address block. `disabled` disables every native control inside.
|
|
171
|
+
*
|
|
172
|
+
* ```tsx
|
|
173
|
+
* <Fieldset legend="Notifications" hint="Choose where we reach you.">
|
|
174
|
+
* <Field label="Email" orientation="horizontal"><Checkbox /></Field>
|
|
175
|
+
* </Fieldset>
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export const Fieldset = React.forwardRef(function Fieldset({ legend, hint, error, className, children, "aria-describedby": describedBy, ...props }, ref) {
|
|
179
|
+
const id = React.useId();
|
|
180
|
+
const hintId = hint && !error ? `${id}-hint` : undefined;
|
|
181
|
+
const errorId = error ? `${id}-error` : undefined;
|
|
182
|
+
return (_jsxs("fieldset", { ref: ref, "data-slot": "fieldset", "aria-describedby": mergeIds(hintId, errorId, describedBy), "data-invalid": error ? "" : undefined, className: cn("grid min-w-0 gap-3 border-0 p-0 disabled:opacity-60", className), ...props, children: [legend ? _jsx(Legend, { className: "float-left w-full", children: legend }) : null, hint && !error ? (_jsx("p", { id: hintId, className: "-mt-2 text-xs text-fg-subtle", children: hint })) : null, error ? (_jsxs("p", { id: errorId, className: "-mt-2 flex items-start gap-1.5 text-xs text-danger", children: [_jsx(CircleAlert, { "aria-hidden": true, className: "mt-px size-3.5 shrink-0" }), _jsx("span", { children: error })] })) : null, children] }));
|
|
183
|
+
});
|
|
184
|
+
/** Title of a Fieldset. */
|
|
185
|
+
export const Legend = React.forwardRef(function Legend({ className, ...props }, ref) {
|
|
186
|
+
return _jsx("legend", { ref: ref, "data-slot": "legend", className: cn("mb-0 p-0 text-sm font-semibold tracking-[-0.005em] text-fg", className), ...props });
|
|
187
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ItemListProps extends Omit<React.HTMLAttributes<HTMLElement>, "defaultValue" | "onChange" | "value"> {
|
|
3
|
+
/** Hairlines between rows. Default `true`. */
|
|
4
|
+
divided?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Rows with small side padding and rounded hover — for a list inside a padded CardBody.
|
|
7
|
+
* Without it rows use the card padding, so a list placed straight in a Card lines up with the header.
|
|
8
|
+
*/
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
/** Turns the list into a listbox (↑ ↓ Home End, Space toggles). Children need a `value`. */
|
|
11
|
+
selectable?: "single" | "multiple";
|
|
12
|
+
/** Selected values (controlled). */
|
|
13
|
+
value?: string[];
|
|
14
|
+
defaultValue?: string[];
|
|
15
|
+
onValueChange?: (value: string[]) => void;
|
|
16
|
+
/** Element. Default `"ul"` (`"div"` for a list of plain blocks). */
|
|
17
|
+
as?: "ul" | "ol" | "div";
|
|
18
|
+
/** Shown instead of the rows when there are none. */
|
|
19
|
+
empty?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The container of Item rows. A plain `<ul>` by default; with `selectable` it becomes a listbox
|
|
23
|
+
* (single or multiple) with arrow-key navigation. Server-component compatible unless selectable.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ItemList>
|
|
27
|
+
* <Item><ItemContent><ItemTitle>Local SEO checklist for 2026</ItemTitle><ItemDescription>Samet · Edited yesterday</ItemDescription></ItemContent></Item>
|
|
28
|
+
* </ItemList>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const ItemList: React.ForwardRefExoticComponent<ItemListProps & React.RefAttributes<HTMLElement>>;
|
|
32
|
+
export declare const itemRowVariants: (props?: ({
|
|
33
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
34
|
+
align?: "start" | "center" | null | undefined;
|
|
35
|
+
interactive?: boolean | null | undefined;
|
|
36
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
37
|
+
export interface ItemProps extends Omit<React.HTMLAttributes<HTMLElement>, "value"> {
|
|
38
|
+
/** Option value — required for rows of a selectable ItemList. */
|
|
39
|
+
value?: string;
|
|
40
|
+
/** Merge the row styles onto the child (a link: `<Item asChild><a href>…</a></Item>`). */
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
/** Hover tint + pointer. On by default for `asChild` rows and options. */
|
|
43
|
+
interactive?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Row height from `--row-h`: sm −0.5rem, md, lg +1rem. Default `"md"`. */
|
|
46
|
+
size?: "sm" | "md" | "lg";
|
|
47
|
+
/** Vertical alignment of the parts. Default `"center"`. */
|
|
48
|
+
align?: "center" | "start";
|
|
49
|
+
/** Element of the row wrapper. Default `"li"` (use `"div"` inside `ItemList as="div"`). */
|
|
50
|
+
as?: "li" | "div";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The generic row of a non-tabular list: leading visual, title + description, meta and actions.
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Item>
|
|
57
|
+
* <ItemLeading><Avatar … /></ItemLeading>
|
|
58
|
+
* <ItemContent><ItemTitle>Ayşe Kaya</ItemTitle><ItemDescription>Head of Sales · Northwind</ItemDescription></ItemContent>
|
|
59
|
+
* <ItemMeta>2h</ItemMeta>
|
|
60
|
+
* <ItemActions reveal="hover"><IconButton label="Call Ayşe Kaya" size="xs"><Phone /></IconButton></ItemActions>
|
|
61
|
+
* </Item>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const Item: React.ForwardRefExoticComponent<ItemProps & React.RefAttributes<HTMLElement>>;
|
|
65
|
+
/** Leading visual: avatar, icon tile, thumbnail or checkbox. */
|
|
66
|
+
export declare function ItemLeading({ className, variant, ...props }: React.HTMLAttributes<HTMLDivElement> & {
|
|
67
|
+
variant?: "plain" | "icon" | "thumbnail";
|
|
68
|
+
}): React.JSX.Element;
|
|
69
|
+
/** Title + description column; takes the remaining width and truncates. */
|
|
70
|
+
export declare function ItemContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
71
|
+
export interface ItemTitleProps extends React.HTMLAttributes<HTMLElement> {
|
|
72
|
+
/** Render as the child (a link or heading). */
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
/** Cut to one line (with the full text as `title` when it is a string). Default `true`. */
|
|
75
|
+
truncate?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare function ItemTitle({ className, asChild, truncate, title, children, ...props }: ItemTitleProps): React.JSX.Element;
|
|
78
|
+
export declare function ItemDescription({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
79
|
+
/** Trailing information: time, count, badge. */
|
|
80
|
+
export declare function ItemMeta({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
81
|
+
export interface ItemActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
82
|
+
/**
|
|
83
|
+
* `"always"` (default) or `"hover"`: hidden until the row is hovered — but still visible when
|
|
84
|
+
* anything in the row has focus, and always visible on touch screens.
|
|
85
|
+
*/
|
|
86
|
+
reveal?: "always" | "hover";
|
|
87
|
+
}
|
|
88
|
+
export declare function ItemActions({ className, reveal, ...props }: ItemActionsProps): React.JSX.Element;
|
|
89
|
+
export interface ItemSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
90
|
+
/** Number of placeholder rows. Default 3. */
|
|
91
|
+
count?: number;
|
|
92
|
+
/** Include a leading circle. Default `true`. */
|
|
93
|
+
leading?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** Placeholder rows while a list loads (one `aria-busy` region). */
|
|
96
|
+
export declare function ItemSkeleton({ count, leading, className, ...props }: ItemSkeletonProps): React.JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { Check } from "lucide-react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { ItemListbox } from "../lib/data-islands.js";
|
|
8
|
+
import { Skeleton } from "./skeleton.js";
|
|
9
|
+
/**
|
|
10
|
+
* The container of Item rows. A plain `<ul>` by default; with `selectable` it becomes a listbox
|
|
11
|
+
* (single or multiple) with arrow-key navigation. Server-component compatible unless selectable.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ItemList>
|
|
15
|
+
* <Item><ItemContent><ItemTitle>Local SEO checklist for 2026</ItemTitle><ItemDescription>Samet · Edited yesterday</ItemDescription></ItemContent></Item>
|
|
16
|
+
* </ItemList>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const ItemList = React.forwardRef(function ItemList({ divided = true, inset, selectable, value, defaultValue, onValueChange, as = "ul", empty, className, children, ...props }, ref) {
|
|
20
|
+
const count = React.Children.toArray(children).length;
|
|
21
|
+
const classes = cn("group/list m-0 grid list-none p-0", inset && "-mx-2 gap-0.5",
|
|
22
|
+
// hairline at the bottom of every row but the last (also through an asChild wrapper)
|
|
23
|
+
divided && !inset && "[&>[data-slot=item]:not(:last-child)]:shadow-[inset_0_-1px_0_var(--line)] [&>[data-slot=item-wrapper]:not(:last-child)>*]:shadow-[inset_0_-1px_0_var(--line)]", className);
|
|
24
|
+
const data = { "data-slot": "item-list", "data-divided": divided ? "" : undefined, "data-inset": inset ? "" : undefined };
|
|
25
|
+
if (count === 0 && empty !== undefined) {
|
|
26
|
+
return (_jsx("div", { ref: ref, ...data, className: cn("px-(--card-p,1.25rem) py-8 text-center text-[13px] text-fg-muted", className), children: empty }));
|
|
27
|
+
}
|
|
28
|
+
if (selectable) {
|
|
29
|
+
return (_jsx(ItemListbox, { ref: ref, selectable: selectable, value: value, defaultValue: defaultValue, onValueChange: onValueChange, ...data, className: classes, ...props, children: children }));
|
|
30
|
+
}
|
|
31
|
+
const Comp = as;
|
|
32
|
+
return (_jsx(Comp, { ref: ref, ...data, className: classes, ...props, children: children }));
|
|
33
|
+
});
|
|
34
|
+
/* ------------------------------------------------------------------ */
|
|
35
|
+
/* Item */
|
|
36
|
+
/* ------------------------------------------------------------------ */
|
|
37
|
+
export const itemRowVariants = cva([
|
|
38
|
+
"group/item relative flex w-full min-w-0 gap-3 text-start text-[13px] text-fg outline-none",
|
|
39
|
+
"px-(--card-p,1.25rem) group-data-inset/list:rounded-ui-sm group-data-inset/list:px-2",
|
|
40
|
+
// states (also driven by the listbox island via aria-selected / aria-disabled)
|
|
41
|
+
"aria-selected:bg-selected data-[state=selected]:bg-selected",
|
|
42
|
+
"aria-disabled:pointer-events-none aria-disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
43
|
+
"focus-visible:z-[1] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
|
|
44
|
+
], {
|
|
45
|
+
variants: {
|
|
46
|
+
size: {
|
|
47
|
+
sm: "min-h-[calc(var(--row-h)-0.5rem)] py-1.5",
|
|
48
|
+
md: "min-h-(--row-h) py-2.5",
|
|
49
|
+
lg: "min-h-[calc(var(--row-h)+1rem)] py-3.5",
|
|
50
|
+
},
|
|
51
|
+
align: { center: "items-center", start: "items-start" },
|
|
52
|
+
interactive: {
|
|
53
|
+
true: "cursor-pointer transition-colors duration-100 hover:bg-hover",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: { size: "md", align: "center" },
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* The generic row of a non-tabular list: leading visual, title + description, meta and actions.
|
|
60
|
+
*
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Item>
|
|
63
|
+
* <ItemLeading><Avatar … /></ItemLeading>
|
|
64
|
+
* <ItemContent><ItemTitle>Ayşe Kaya</ItemTitle><ItemDescription>Head of Sales · Northwind</ItemDescription></ItemContent>
|
|
65
|
+
* <ItemMeta>2h</ItemMeta>
|
|
66
|
+
* <ItemActions reveal="hover"><IconButton label="Call Ayşe Kaya" size="xs"><Phone /></IconButton></ItemActions>
|
|
67
|
+
* </Item>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export const Item = React.forwardRef(function Item({ value, asChild, interactive, disabled, size, align, as = "li", className, children, ...props }, ref) {
|
|
71
|
+
const option = value !== undefined;
|
|
72
|
+
const rowClass = cn(itemRowVariants({ size, align, interactive: interactive ?? (asChild || option) }), className);
|
|
73
|
+
const state = {
|
|
74
|
+
"data-slot": "item",
|
|
75
|
+
"data-value": value,
|
|
76
|
+
"data-disabled": disabled ? "" : undefined,
|
|
77
|
+
"aria-disabled": disabled || undefined,
|
|
78
|
+
};
|
|
79
|
+
const check = option ? (_jsx("span", { "aria-hidden": true, "data-slot": "item-check", className: "ms-1 grid size-4 shrink-0 place-items-center self-center text-accent-ink opacity-0 transition-opacity group-aria-selected/item:opacity-100 [&_svg]:size-3.5", children: _jsx(Check, { strokeWidth: 2.5 }) })) : null;
|
|
80
|
+
if (asChild) {
|
|
81
|
+
const Wrapper = as;
|
|
82
|
+
return (_jsx(Wrapper, { className: "contents", "data-slot": "item-wrapper", children: _jsx(Slot.Root, { ref: ref, ...state, className: rowClass, ...props, children: children }) }));
|
|
83
|
+
}
|
|
84
|
+
const Comp = as;
|
|
85
|
+
return (_jsxs(Comp, { ref: ref, ...state, className: rowClass, ...props, children: [children, check] }));
|
|
86
|
+
});
|
|
87
|
+
/** Leading visual: avatar, icon tile, thumbnail or checkbox. */
|
|
88
|
+
export function ItemLeading({ className, variant, ...props }) {
|
|
89
|
+
return (_jsx("div", { "data-slot": "item-leading", className: cn("flex shrink-0 items-center", variant === "icon" && "grid size-8 place-items-center rounded-ui-sm border border-line bg-surface-2 text-fg-muted [&_svg]:size-4", variant === "thumbnail" && "h-10 w-14 overflow-hidden rounded-ui-sm border border-line bg-surface-2 [&_img]:size-full [&_img]:object-cover", className), ...props }));
|
|
90
|
+
}
|
|
91
|
+
/** Title + description column; takes the remaining width and truncates. */
|
|
92
|
+
export function ItemContent({ className, ...props }) {
|
|
93
|
+
return _jsx("div", { "data-slot": "item-content", className: cn("grid min-w-0 flex-1 gap-0.5", className), ...props });
|
|
94
|
+
}
|
|
95
|
+
export function ItemTitle({ className, asChild, truncate = true, title, children, ...props }) {
|
|
96
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
97
|
+
return (_jsx(Comp, { "data-slot": "item-title", title: title ?? (truncate && typeof children === "string" ? children : undefined), className: cn("font-medium text-fg", truncate && "truncate", className), ...props, children: children }));
|
|
98
|
+
}
|
|
99
|
+
export function ItemDescription({ className, ...props }) {
|
|
100
|
+
return _jsx("div", { "data-slot": "item-description", className: cn("min-w-0 truncate text-xs text-fg-subtle", className), ...props });
|
|
101
|
+
}
|
|
102
|
+
/** Trailing information: time, count, badge. */
|
|
103
|
+
export function ItemMeta({ className, ...props }) {
|
|
104
|
+
return _jsx("div", { "data-slot": "item-meta", className: cn("flex shrink-0 items-center gap-2 text-xs text-fg-subtle tabular", className), ...props });
|
|
105
|
+
}
|
|
106
|
+
export function ItemActions({ className, reveal = "always", ...props }) {
|
|
107
|
+
return (_jsx("div", { "data-slot": "item-actions", "data-reveal": reveal, className: cn("flex shrink-0 items-center gap-1", reveal === "hover" &&
|
|
108
|
+
"opacity-0 transition-opacity duration-100 group-hover/item:opacity-100 group-focus-within/item:opacity-100 has-[[data-state=open]]:opacity-100 [@media(hover:none)]:opacity-100", className), ...props }));
|
|
109
|
+
}
|
|
110
|
+
/** Placeholder rows while a list loads (one `aria-busy` region). */
|
|
111
|
+
export function ItemSkeleton({ count = 3, leading = true, className, ...props }) {
|
|
112
|
+
return (_jsx("div", { "data-slot": "item-skeleton", "aria-busy": "true", className: cn("grid", className), ...props, children: Array.from({ length: count }, (_, i) => (_jsxs("div", { className: "flex min-h-(--row-h) items-center gap-3 px-(--card-p,1.25rem) py-2.5", children: [leading ? _jsx(Skeleton, { shape: "circle", className: "size-8" }) : null, _jsxs("div", { className: "grid flex-1 gap-2", children: [_jsx(Skeleton, { shape: "text", className: "h-3", style: { width: `${68 - ((i * 17) % 30)}%` } }), _jsx(Skeleton, { shape: "text", className: "h-2.5", style: { width: `${38 - ((i * 11) % 14)}%` } })] }), _jsx(Skeleton, { shape: "text", className: "h-2.5 w-10" })] }, i))) }));
|
|
113
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const kbdVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | null | undefined;
|
|
5
|
+
variant?: "nav" | "default" | "ghost" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
/** Key names Kbd understands. Anything else is shown as typed (single letters are uppercased). */
|
|
8
|
+
export type KeyName = "mod" | "ctrl" | "meta" | "alt" | "shift" | "enter" | "esc" | "escape" | "tab" | "space" | "backspace" | "delete" | "up" | "down" | "left" | "right" | (string & {});
|
|
9
|
+
declare const kbdLabels: {
|
|
10
|
+
command: string;
|
|
11
|
+
control: string;
|
|
12
|
+
option: string;
|
|
13
|
+
alt: string;
|
|
14
|
+
shift: string;
|
|
15
|
+
windows: string;
|
|
16
|
+
enter: string;
|
|
17
|
+
escape: string;
|
|
18
|
+
backspace: string;
|
|
19
|
+
delete: string;
|
|
20
|
+
tab: string;
|
|
21
|
+
space: string;
|
|
22
|
+
up: string;
|
|
23
|
+
down: string;
|
|
24
|
+
left: string;
|
|
25
|
+
right: string;
|
|
26
|
+
};
|
|
27
|
+
export type KbdLabels = typeof kbdLabels;
|
|
28
|
+
export interface KbdProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof kbdVariants> {
|
|
29
|
+
/**
|
|
30
|
+
* A key token to render platform-aware (`"mod"` → ⌘ / Ctrl, `"shift"` → ⇧ / Shift, `"enter"` → ↩ / Enter).
|
|
31
|
+
* Without it, `children` are shown as-is.
|
|
32
|
+
*/
|
|
33
|
+
keyName?: KeyName;
|
|
34
|
+
/** Overrides for the spoken key names (`kbd` namespace). */
|
|
35
|
+
labels?: Partial<KbdLabels>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One keyboard key, rendered as `<kbd>`.
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Kbd>Esc</Kbd>
|
|
42
|
+
* <Kbd keyName="mod" /> // ⌘ on macOS, Ctrl elsewhere
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
|
|
46
|
+
export interface KbdGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, "children">, VariantProps<typeof kbdVariants> {
|
|
47
|
+
/** A shortcut string (`"mod+shift+k"`) or key tokens (`["mod", "k"]`). */
|
|
48
|
+
keys: string | KeyName[];
|
|
49
|
+
/** Visible text between keycaps (e.g. "+" or "then"). Default: none (keycaps sit side by side). */
|
|
50
|
+
separator?: React.ReactNode;
|
|
51
|
+
labels?: Partial<KbdLabels>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A key combination: one `<kbd>` per key nested in an outer `<kbd>` (per the HTML spec).
|
|
55
|
+
* Platform-aware and always left-to-right; key order follows platform convention
|
|
56
|
+
* (⌃ ⌥ ⇧ ⌘ on Apple, Ctrl Alt Shift elsewhere). SSR renders the non-Apple form.
|
|
57
|
+
*
|
|
58
|
+
* ```tsx
|
|
59
|
+
* <KbdGroup keys="mod+k" /> // ⌘ K / Ctrl K
|
|
60
|
+
* <KbdGroup keys={["g", "p"]} separator="then" />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const KbdGroup: React.ForwardRefExoticComponent<KbdGroupProps & React.RefAttributes<HTMLElement>>;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
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 { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { formatKey, parseShortcut, shortcutKeys, useIsMac } from "../lib/use-hotkeys.js";
|
|
7
|
+
import { useLabels } from "../lib/labels.js";
|
|
8
|
+
export const kbdVariants = cva("ui-keycap inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap rounded-[calc(var(--radius)*0.42)] font-mono font-medium leading-none tabular", {
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "h-[1.125rem] min-w-[1.125rem] px-1 text-[10.5px]",
|
|
12
|
+
md: "h-6 min-w-6 px-1.5 text-[11.5px]",
|
|
13
|
+
},
|
|
14
|
+
variant: {
|
|
15
|
+
/** Inset keycap on surfaces. */
|
|
16
|
+
default: "border border-line bg-surface-2 text-fg-muted",
|
|
17
|
+
/** Border only — inside inputs and dense menus. */
|
|
18
|
+
ghost: "border border-field-border bg-transparent text-fg-subtle shadow-none",
|
|
19
|
+
/** Inside the dark sidebar or nav popovers. */
|
|
20
|
+
nav: "border border-nav-line bg-nav-hover text-nav-fg [--kbd-edge:var(--nav-line)]",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { size: "md", variant: "default" },
|
|
24
|
+
});
|
|
25
|
+
const kbdLabels = {
|
|
26
|
+
command: "Command",
|
|
27
|
+
control: "Control",
|
|
28
|
+
option: "Option",
|
|
29
|
+
alt: "Alt",
|
|
30
|
+
shift: "Shift",
|
|
31
|
+
windows: "Windows",
|
|
32
|
+
enter: "Enter",
|
|
33
|
+
escape: "Escape",
|
|
34
|
+
backspace: "Backspace",
|
|
35
|
+
delete: "Delete",
|
|
36
|
+
tab: "Tab",
|
|
37
|
+
space: "Space",
|
|
38
|
+
up: "Up arrow",
|
|
39
|
+
down: "Down arrow",
|
|
40
|
+
left: "Left arrow",
|
|
41
|
+
right: "Right arrow",
|
|
42
|
+
};
|
|
43
|
+
/** Accessible name key for a canonical key token, when the visible glyph is a symbol or abbreviation. */
|
|
44
|
+
function spokenKey(token, isMac) {
|
|
45
|
+
switch (token) {
|
|
46
|
+
case "mod":
|
|
47
|
+
return isMac ? "command" : "control";
|
|
48
|
+
case "meta":
|
|
49
|
+
return isMac ? "command" : "windows";
|
|
50
|
+
case "ctrl":
|
|
51
|
+
return "control";
|
|
52
|
+
case "alt":
|
|
53
|
+
return isMac ? "option" : "alt";
|
|
54
|
+
case "shift":
|
|
55
|
+
return "shift";
|
|
56
|
+
case "enter":
|
|
57
|
+
return "enter";
|
|
58
|
+
case "escape":
|
|
59
|
+
return "escape";
|
|
60
|
+
case "backspace":
|
|
61
|
+
return "backspace";
|
|
62
|
+
case "delete":
|
|
63
|
+
return "delete";
|
|
64
|
+
case "tab":
|
|
65
|
+
return "tab";
|
|
66
|
+
case " ":
|
|
67
|
+
return "space";
|
|
68
|
+
case "arrowup":
|
|
69
|
+
return "up";
|
|
70
|
+
case "arrowdown":
|
|
71
|
+
return "down";
|
|
72
|
+
case "arrowleft":
|
|
73
|
+
return "left";
|
|
74
|
+
case "arrowright":
|
|
75
|
+
return "right";
|
|
76
|
+
default:
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One keyboard key, rendered as `<kbd>`.
|
|
82
|
+
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <Kbd>Esc</Kbd>
|
|
85
|
+
* <Kbd keyName="mod" /> // ⌘ on macOS, Ctrl elsewhere
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export const Kbd = React.forwardRef(function Kbd({ keyName, size, variant, labels, className, children, ...props }, ref) {
|
|
89
|
+
const isMac = useIsMac();
|
|
90
|
+
const t = useLabels("kbd", kbdLabels, labels);
|
|
91
|
+
let content = children;
|
|
92
|
+
if (keyName !== undefined && children === undefined) {
|
|
93
|
+
const token = parseShortcut(keyName === "+" ? "plus" : keyName);
|
|
94
|
+
const canonical = token.key || (token.mod ? "mod" : token.meta ? "meta" : token.ctrl ? "ctrl" : token.alt ? "alt" : token.shift ? "shift" : keyName);
|
|
95
|
+
const glyph = formatKey(canonical, isMac);
|
|
96
|
+
const spoken = spokenKey(canonical, isMac);
|
|
97
|
+
const name = spoken ? t(spoken) : undefined;
|
|
98
|
+
// Symbol glyphs (⌘ ⇧ ⌥ ↩) fall back to a system font that draws them small next to letters.
|
|
99
|
+
const symbol = /^[^\x00-\x7f]$/.test(glyph);
|
|
100
|
+
content =
|
|
101
|
+
name && name !== glyph ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: symbol ? "text-[1.2em] leading-none" : undefined, children: glyph }), _jsx("span", { className: "sr-only", children: name })] })) : (glyph);
|
|
102
|
+
}
|
|
103
|
+
return (_jsx("kbd", { ref: ref, "data-slot": "kbd", className: cn(kbdVariants({ size, variant }), className), ...props, children: content }));
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* A key combination: one `<kbd>` per key nested in an outer `<kbd>` (per the HTML spec).
|
|
107
|
+
* Platform-aware and always left-to-right; key order follows platform convention
|
|
108
|
+
* (⌃ ⌥ ⇧ ⌘ on Apple, Ctrl Alt Shift elsewhere). SSR renders the non-Apple form.
|
|
109
|
+
*
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <KbdGroup keys="mod+k" /> // ⌘ K / Ctrl K
|
|
112
|
+
* <KbdGroup keys={["g", "p"]} separator="then" />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export const KbdGroup = React.forwardRef(function KbdGroup({ keys, separator, size, variant, labels, className, ...props }, ref) {
|
|
116
|
+
const isMac = useIsMac();
|
|
117
|
+
const tokens = typeof keys === "string" ? shortcutKeys(keys, isMac) : keys;
|
|
118
|
+
return (_jsx("kbd", { ref: ref, dir: "ltr", "data-slot": "kbd-group", className: cn("inline-flex items-center gap-1 font-sans", className), ...props, children: tokens.map((k, i) => (_jsxs(React.Fragment, { children: [i > 0 && separator != null ? (_jsx("span", { "aria-hidden": typeof separator === "string" && /^[+\-–]$/.test(separator) ? true : undefined, className: "text-[11px] text-fg-subtle", children: separator })) : null, _jsx(Kbd, { keyName: k, size: size, variant: variant, labels: labels })] }, `${k}-${i}`))) }));
|
|
119
|
+
});
|