@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,483 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { DayPicker } from "react-day-picker";
|
|
5
|
+
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp, RotateCcw } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useLocale } from "../lib/locale.js";
|
|
8
|
+
import { useLabels } from "../lib/labels.js";
|
|
9
|
+
import { useControllableState, useEventCallback } from "../lib/use-controllable-state.js";
|
|
10
|
+
import { dateToIso, getDateFnsLocale, isoToDate, todayIso } from "../lib/date.js";
|
|
11
|
+
import { getWeekInfo } from "../locale-data/core/week-info.js";
|
|
12
|
+
import { holidayName } from "../locale-data/core/holidays.js";
|
|
13
|
+
import { trHolidays } from "../locale-data/tr/holidays.js";
|
|
14
|
+
import { Button, IconButton } from "./button.js";
|
|
15
|
+
/* ------------------------------------------------------------------ */
|
|
16
|
+
/* Labels */
|
|
17
|
+
/* ------------------------------------------------------------------ */
|
|
18
|
+
const calendarLabels = {
|
|
19
|
+
prevMonth: "Previous month",
|
|
20
|
+
nextMonth: "Next month",
|
|
21
|
+
prevYear: "Previous year",
|
|
22
|
+
nextYear: "Next year",
|
|
23
|
+
selectMonth: "Select month",
|
|
24
|
+
selectYear: "Select year",
|
|
25
|
+
nav: "Calendar navigation",
|
|
26
|
+
today: "Today",
|
|
27
|
+
todayDay: "Today, {date}",
|
|
28
|
+
selectedDay: "{date}, selected",
|
|
29
|
+
weekNumber: "Week {week}",
|
|
30
|
+
weekColumn: "Week",
|
|
31
|
+
weekColumnShort: "Wk",
|
|
32
|
+
holiday: "Holiday",
|
|
33
|
+
halfDay: "{name} (from {time})",
|
|
34
|
+
weekend: "Weekend",
|
|
35
|
+
more: "+{count} more",
|
|
36
|
+
loading: "Loading…",
|
|
37
|
+
slots: "Available times",
|
|
38
|
+
noSlots: "No times available on this day",
|
|
39
|
+
slotsError: "Couldn't load the times.",
|
|
40
|
+
retry: "Try again",
|
|
41
|
+
slotsLeft: "{count, plural, one {# slot left} other {# slots left}}",
|
|
42
|
+
unavailable: "unavailable",
|
|
43
|
+
};
|
|
44
|
+
/** Turns string / matcher input into react-day-picker matchers (min/max become `before`/`after`). */
|
|
45
|
+
export function toDayMatchers(options) {
|
|
46
|
+
const out = [];
|
|
47
|
+
const min = isoToDate(options.min);
|
|
48
|
+
const max = isoToDate(options.max);
|
|
49
|
+
if (min)
|
|
50
|
+
out.push({ before: min });
|
|
51
|
+
if (max)
|
|
52
|
+
out.push({ after: max });
|
|
53
|
+
const list = options.disabledDays === undefined ? [] : Array.isArray(options.disabledDays) ? options.disabledDays : [options.disabledDays];
|
|
54
|
+
for (const m of list) {
|
|
55
|
+
if (typeof m === "string") {
|
|
56
|
+
const d = isoToDate(m);
|
|
57
|
+
if (d)
|
|
58
|
+
out.push(d);
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
out.push(m);
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
/** react-day-picker `weekStartsOn` (0 = Sunday) and `firstWeekContainsDate` of a locale. */
|
|
66
|
+
export function useCalendarWeek(locale) {
|
|
67
|
+
const ctx = useLocale();
|
|
68
|
+
const info = getWeekInfo(locale ?? ctx.locale);
|
|
69
|
+
return React.useMemo(() => ({
|
|
70
|
+
weekStartsOn: (info.firstDay % 7),
|
|
71
|
+
firstWeekContainsDate: (info.minimalDays >= 4 ? 4 : 1),
|
|
72
|
+
/** ISO weekdays (1 = Monday … 7 = Sunday) of the weekend. */
|
|
73
|
+
weekend: info.weekend,
|
|
74
|
+
}), [info]);
|
|
75
|
+
}
|
|
76
|
+
const GridContext = React.createContext({ size: "md" });
|
|
77
|
+
// Modifiers surfaced as data attributes on the day cell (in addition to rdp's own).
|
|
78
|
+
const DATA_MODIFIERS = {
|
|
79
|
+
range_start: "data-range-start",
|
|
80
|
+
range_middle: "data-range-middle",
|
|
81
|
+
range_end: "data-range-end",
|
|
82
|
+
weekend: "data-weekend",
|
|
83
|
+
holiday: "data-holiday",
|
|
84
|
+
preview: "data-preview",
|
|
85
|
+
previewEnd: "data-preview-end",
|
|
86
|
+
marked: "data-marked",
|
|
87
|
+
};
|
|
88
|
+
function GridDay({ day, modifiers, children, ...props }) {
|
|
89
|
+
const ctx = React.useContext(GridContext);
|
|
90
|
+
const extra = {};
|
|
91
|
+
for (const [mod, attr] of Object.entries(DATA_MODIFIERS))
|
|
92
|
+
if (modifiers[mod])
|
|
93
|
+
extra[attr] = "";
|
|
94
|
+
// Non-interactive grids (mode "none") get plain text from rdp; wrap it in the same day box so
|
|
95
|
+
// holidays, markers, today and outside days keep their styling.
|
|
96
|
+
const isStatic = !React.isValidElement(children);
|
|
97
|
+
const dayExtra = isStatic ? ctx.renderDayExtra?.(day.date, modifiers) : null;
|
|
98
|
+
return (_jsx("td", { ...props, ...extra, children: isStatic ? (_jsxs("span", { className: "ui-cal-day", "data-static": "", title: ctx.dayTitle?.(day.date, modifiers), children: [_jsx("span", { "data-slot": "calendar-day-number", children: children }), dayExtra != null && dayExtra !== false ? (_jsx("span", { "data-slot": "calendar-day-extra", "aria-hidden": true, children: dayExtra })) : null] })) : (children) }));
|
|
99
|
+
}
|
|
100
|
+
function GridDayButton({ day, modifiers, className, children, ...props }) {
|
|
101
|
+
const ctx = React.useContext(GridContext);
|
|
102
|
+
const ref = React.useRef(null);
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
if (modifiers.focused)
|
|
105
|
+
ref.current?.focus();
|
|
106
|
+
}, [modifiers.focused]);
|
|
107
|
+
const extra = ctx.renderDayExtra?.(day.date, modifiers);
|
|
108
|
+
const title = ctx.dayTitle?.(day.date, modifiers);
|
|
109
|
+
const hasExtra = extra != null && extra !== false;
|
|
110
|
+
// With visible extras (event lines, counts) the day's name moves from aria-label into hidden
|
|
111
|
+
// text: an aria-label that doesn't contain the visible "2 Discovery call" fails WCAG 2.5.3.
|
|
112
|
+
const { "aria-label": ariaLabel, ...buttonProps } = props;
|
|
113
|
+
return (_jsxs("button", { ref: ref, title: title, ...buttonProps, "aria-label": hasExtra ? undefined : ariaLabel, className: cn("ui-cal-day", className), children: [hasExtra && ariaLabel ? _jsx("span", { className: "sr-only", children: ariaLabel }) : null, _jsx("span", { "data-slot": "calendar-day-number", "aria-hidden": hasExtra && ariaLabel ? true : undefined, children: children }), hasExtra ? (_jsx("span", { "data-slot": "calendar-day-extra", "aria-hidden": true, children: extra })) : null] }));
|
|
114
|
+
}
|
|
115
|
+
function GridChevron({ orientation = "left", className }) {
|
|
116
|
+
const Icon = orientation === "right" ? ChevronRight : orientation === "down" ? ChevronDown : orientation === "up" ? ChevronUp : ChevronLeft;
|
|
117
|
+
return _jsx(Icon, { "aria-hidden": true, className: cn("size-4", (orientation === "left" || orientation === "right") && "rtl:-scale-x-100", className) });
|
|
118
|
+
}
|
|
119
|
+
const MonthDateContext = React.createContext(null);
|
|
120
|
+
function GridMonthCaption({ calendarMonth, displayIndex: _i, ...props }) {
|
|
121
|
+
return (_jsx(MonthDateContext.Provider, { value: calendarMonth.date, children: _jsx("div", { ...props }) }));
|
|
122
|
+
}
|
|
123
|
+
function GridCaptionLabel({ children, className, ...props }) {
|
|
124
|
+
const month = React.useContext(MonthDateContext);
|
|
125
|
+
const { locale } = useLocale();
|
|
126
|
+
// In label mode the caption is a status region: split "November 2026" into month + muted year.
|
|
127
|
+
if (props.role === "status" && month) {
|
|
128
|
+
const parts = new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).formatToParts(month);
|
|
129
|
+
return (_jsx("span", { ...props, className: className, children: parts.map((p, i) => p.type === "year" ? (_jsx("span", { className: "font-normal text-fg-muted", children: p.value }, i)) : (_jsx(React.Fragment, { children: p.value }, i))) }));
|
|
130
|
+
}
|
|
131
|
+
return (_jsx("span", { ...props, className: className, children: children }));
|
|
132
|
+
}
|
|
133
|
+
const gridComponents = {
|
|
134
|
+
Day: GridDay,
|
|
135
|
+
DayButton: GridDayButton,
|
|
136
|
+
Chevron: GridChevron,
|
|
137
|
+
MonthCaption: GridMonthCaption,
|
|
138
|
+
CaptionLabel: GridCaptionLabel,
|
|
139
|
+
};
|
|
140
|
+
const navButton = "inline-flex size-8 items-center justify-center rounded-ui-sm text-fg-muted transition-colors hover:bg-hover hover:text-fg focus-ring aria-disabled:pointer-events-none aria-disabled:opacity-30";
|
|
141
|
+
const gridClassNames = {
|
|
142
|
+
root: "ui-cal relative w-fit max-w-full",
|
|
143
|
+
months: "ui-cal-months relative flex flex-col gap-x-8 gap-y-5 sm:flex-row",
|
|
144
|
+
month: "grid content-start gap-2",
|
|
145
|
+
month_caption: "flex h-8 items-center ps-1.5 pe-[4.5rem]",
|
|
146
|
+
caption_label: "inline-flex items-center gap-1 text-sm font-semibold tracking-[-0.01em] text-fg [&_svg]:size-3.5 [&_svg]:text-fg-subtle",
|
|
147
|
+
nav: "absolute end-0 top-0 z-[1] flex h-8 items-center gap-0.5",
|
|
148
|
+
button_previous: navButton,
|
|
149
|
+
button_next: navButton,
|
|
150
|
+
chevron: "",
|
|
151
|
+
dropdowns: "flex items-center gap-1.5",
|
|
152
|
+
dropdown_root: "relative inline-flex h-7 items-center rounded-ui-sm border border-field-border bg-field ps-2 pe-1.5 transition-[border-color,box-shadow] hover:border-field-border-hover has-[:focus-visible]:border-ring has-[:focus-visible]:shadow-[0_0_0_3px_var(--accent-soft)]",
|
|
153
|
+
dropdown: "absolute inset-0 w-full cursor-pointer appearance-none opacity-0",
|
|
154
|
+
month_grid: "ui-cal-grid border-separate border-spacing-x-0 border-spacing-y-0.5",
|
|
155
|
+
weekdays: "",
|
|
156
|
+
weekday: "ui-cal-weekday h-7 p-0 text-center align-middle text-[10.5px] font-medium uppercase tracking-[0.08em] text-fg-subtle",
|
|
157
|
+
weeks: "",
|
|
158
|
+
week: "",
|
|
159
|
+
week_number_header: "ui-cal-weekno h-7 p-0 text-center align-middle font-mono text-[10px] font-normal tracking-wide text-fg-subtle",
|
|
160
|
+
week_number: "ui-cal-weekno p-0 text-center align-middle font-mono text-[10px] font-normal text-fg-subtle tabular",
|
|
161
|
+
day: "ui-cal-cell p-0 text-center align-middle",
|
|
162
|
+
day_button: "",
|
|
163
|
+
footer: "ui-cal-footer",
|
|
164
|
+
// State classes are replaced by data attributes (see GridDay).
|
|
165
|
+
selected: "",
|
|
166
|
+
range_start: "",
|
|
167
|
+
range_middle: "",
|
|
168
|
+
range_end: "",
|
|
169
|
+
today: "",
|
|
170
|
+
outside: "",
|
|
171
|
+
disabled: "",
|
|
172
|
+
hidden: "invisible",
|
|
173
|
+
focused: "",
|
|
174
|
+
};
|
|
175
|
+
/** react-day-picker styled with tokens. See `CalendarGridProps`. */
|
|
176
|
+
export function CalendarGrid(props) {
|
|
177
|
+
const { size = "md", renderDayExtra, describeDay, dayTitle, markWeekends = true, labels, ariaLabels, className, classNames, components, modifiers, ...rest } = props;
|
|
178
|
+
const t = useLabels("calendar", calendarLabels, labels);
|
|
179
|
+
const { locale, dir } = useLocale();
|
|
180
|
+
const fnsLocale = getDateFnsLocale(locale);
|
|
181
|
+
const week = useCalendarWeek();
|
|
182
|
+
const allModifiers = React.useMemo(() => {
|
|
183
|
+
if (!markWeekends)
|
|
184
|
+
return modifiers;
|
|
185
|
+
const weekend = week.weekend;
|
|
186
|
+
return { weekend: (d) => weekend.includes(((d.getDay() + 6) % 7) + 1), ...modifiers };
|
|
187
|
+
}, [markWeekends, modifiers, week.weekend]);
|
|
188
|
+
const describe = useEventCallback(describeDay);
|
|
189
|
+
const dayLabelFormat = React.useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: "full" }), [locale]);
|
|
190
|
+
const rdpLabels = React.useMemo(() => ({
|
|
191
|
+
labelPrevious: () => t("prevMonth"),
|
|
192
|
+
labelNext: () => t("nextMonth"),
|
|
193
|
+
labelMonthDropdown: () => t("selectMonth"),
|
|
194
|
+
labelYearDropdown: () => t("selectYear"),
|
|
195
|
+
labelNav: () => t("nav"),
|
|
196
|
+
labelWeekNumber: (week) => t("weekNumber", { week }),
|
|
197
|
+
labelWeekNumberHeader: () => t("weekColumn"),
|
|
198
|
+
// Non-interactive cells (read-only grids) are labelled on the <td>; same Intl date.
|
|
199
|
+
labelGridcell: (date, mods) => {
|
|
200
|
+
const label = dayLabelFormat.format(date);
|
|
201
|
+
return mods?.today ? t("todayDay", { date: label }) : label;
|
|
202
|
+
},
|
|
203
|
+
labelDayButton: (date, mods) => {
|
|
204
|
+
// Intl, not date-fns "PPPP": the name must contain the visible day number ("November 1",
|
|
205
|
+
// not "November 1st") or it fails WCAG 2.5.3 label-in-name on every day button.
|
|
206
|
+
let label = dayLabelFormat.format(date);
|
|
207
|
+
if (mods.today)
|
|
208
|
+
label = t("todayDay", { date: label });
|
|
209
|
+
const more = describe(date, mods);
|
|
210
|
+
if (more)
|
|
211
|
+
label = `${label}, ${more}`;
|
|
212
|
+
if (mods.disabled)
|
|
213
|
+
label = `${label}, ${t("unavailable")}`;
|
|
214
|
+
if (mods.selected)
|
|
215
|
+
label = t("selectedDay", { date: label });
|
|
216
|
+
return label;
|
|
217
|
+
},
|
|
218
|
+
...ariaLabels,
|
|
219
|
+
}), [t, dayLabelFormat, describe, ariaLabels]);
|
|
220
|
+
const ctx = React.useMemo(() => ({ renderDayExtra, dayTitle, size }), [renderDayExtra, dayTitle, size]);
|
|
221
|
+
return (_jsx(GridContext.Provider, { value: ctx, children: _jsx(DayPicker, { locale: fnsLocale, dir: dir, weekStartsOn: week.weekStartsOn, firstWeekContainsDate: week.firstWeekContainsDate, showOutsideDays: true, formatters: { formatWeekNumberHeader: () => t("weekColumnShort") }, ...rest, modifiers: allModifiers, labels: rdpLabels, className: cn(className), "data-size": size, classNames: { ...gridClassNames, ...classNames }, components: { ...gridComponents, ...components } }) }));
|
|
222
|
+
}
|
|
223
|
+
const monthOf = (value) => {
|
|
224
|
+
if (!value)
|
|
225
|
+
return null;
|
|
226
|
+
const iso = /^\d{4}-\d{2}$/.test(value) ? `${value}-01` : value;
|
|
227
|
+
const d = isoToDate(iso);
|
|
228
|
+
return d ? new Date(d.getFullYear(), d.getMonth(), 1) : null;
|
|
229
|
+
};
|
|
230
|
+
const addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
231
|
+
const lastOfMonth = (d) => new Date(d.getFullYear(), d.getMonth() + 1, 0);
|
|
232
|
+
const asArray = (v) => (v === undefined ? [] : Array.isArray(v) ? v : [v]);
|
|
233
|
+
const toneVar = {
|
|
234
|
+
neutral: "var(--fg-muted)",
|
|
235
|
+
accent: "var(--accent-ink)",
|
|
236
|
+
success: "var(--success)",
|
|
237
|
+
warning: "var(--warning)",
|
|
238
|
+
danger: "var(--danger)",
|
|
239
|
+
info: "var(--info)",
|
|
240
|
+
};
|
|
241
|
+
function initialSelectionMonth(props) {
|
|
242
|
+
const v = props.value ?? props.defaultValue;
|
|
243
|
+
if (!v)
|
|
244
|
+
return undefined;
|
|
245
|
+
if (typeof v === "string")
|
|
246
|
+
return v;
|
|
247
|
+
if (Array.isArray(v))
|
|
248
|
+
return v[0];
|
|
249
|
+
return v.from;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Standalone month, multi-month or year calendar with per-day content: marker dots, holidays,
|
|
253
|
+
* counts, availability. Values are `YYYY-MM-DD` strings. Week start, weekend and month names
|
|
254
|
+
* follow the locale; holidays come from the locale pack (Turkish public holidays for `tr`).
|
|
255
|
+
*
|
|
256
|
+
* ```tsx
|
|
257
|
+
* <Calendar
|
|
258
|
+
* value={day}
|
|
259
|
+
* onValueChange={setDay}
|
|
260
|
+
* markers={{ "2026-11-12": { label: "2 scheduled posts", tone: "accent", count: 2 } }}
|
|
261
|
+
* />
|
|
262
|
+
* <Calendar months={12} size="sm" markers={density} />
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export const Calendar = React.forwardRef(function Calendar(props, ref) {
|
|
266
|
+
const { months = 1, month: monthProp, defaultMonth, onMonthChange, onVisibleRangeChange, min, max, disabledDays, required, showWeekNumbers, holidays: holidaysProp, holidayRegion, markers, renderDay, size: sizeProp, variant = "plain", header = true, headerAction, legend, loading, weekStartsOn, footer, gridProps, className, id, labels, } = props;
|
|
267
|
+
const mode = props.mode ?? "single";
|
|
268
|
+
const t = useLabels("calendar", calendarLabels, labels);
|
|
269
|
+
const { locale, timeZone } = useLocale();
|
|
270
|
+
const isYear = months === 12;
|
|
271
|
+
const size = sizeProp ?? (isYear ? "sm" : "md");
|
|
272
|
+
const today = todayIso(timeZone === "UTC" ? undefined : timeZone);
|
|
273
|
+
// Visible month
|
|
274
|
+
const startOf = React.useCallback((d) => (isYear ? new Date(d.getFullYear(), 0, 1) : d), [isYear]);
|
|
275
|
+
const initialMonth = () => startOf(monthOf(defaultMonth) ?? monthOf(initialSelectionMonth(props)) ?? monthOf(today));
|
|
276
|
+
const [visibleMonth, setVisibleMonth] = useControllableState({
|
|
277
|
+
value: monthProp ? (monthOf(monthProp) ?? undefined) : undefined,
|
|
278
|
+
defaultValue: initialMonth,
|
|
279
|
+
onChange: (d) => onMonthChange?.(dateToIso(d)),
|
|
280
|
+
name: "Calendar",
|
|
281
|
+
});
|
|
282
|
+
const firstMonth = startOf(visibleMonth);
|
|
283
|
+
const lastMonth = addMonths(firstMonth, months - 1);
|
|
284
|
+
const rangeStart = dateToIso(firstMonth);
|
|
285
|
+
const rangeEnd = dateToIso(lastOfMonth(lastMonth));
|
|
286
|
+
const reportRange = useEventCallback(onVisibleRangeChange);
|
|
287
|
+
React.useEffect(() => {
|
|
288
|
+
reportRange({ start: rangeStart, end: rangeEnd });
|
|
289
|
+
}, [rangeStart, rangeEnd, reportRange]);
|
|
290
|
+
// Selection (string values ↔ rdp Dates)
|
|
291
|
+
const [single, setSingle] = useControllableState({
|
|
292
|
+
value: mode === "single" ? props.value : undefined,
|
|
293
|
+
defaultValue: mode === "single" ? (props.defaultValue ?? null) : null,
|
|
294
|
+
onChange: mode === "single" ? props.onValueChange : undefined,
|
|
295
|
+
name: "Calendar",
|
|
296
|
+
});
|
|
297
|
+
const [multiple, setMultiple] = useControllableState({
|
|
298
|
+
value: mode === "multiple" ? props.value : undefined,
|
|
299
|
+
defaultValue: mode === "multiple" ? (props.defaultValue ?? []) : [],
|
|
300
|
+
onChange: mode === "multiple" ? props.onValueChange : undefined,
|
|
301
|
+
name: "Calendar",
|
|
302
|
+
});
|
|
303
|
+
const [range, setRange] = useControllableState({
|
|
304
|
+
value: mode === "range" ? props.value : undefined,
|
|
305
|
+
defaultValue: mode === "range" ? (props.defaultValue ?? null) : null,
|
|
306
|
+
onChange: mode === "range" ? props.onValueChange : undefined,
|
|
307
|
+
name: "Calendar",
|
|
308
|
+
});
|
|
309
|
+
// Holidays in view
|
|
310
|
+
const providers = React.useMemo(() => {
|
|
311
|
+
if (holidaysProp === false)
|
|
312
|
+
return [];
|
|
313
|
+
if (holidaysProp)
|
|
314
|
+
return asArray(holidaysProp);
|
|
315
|
+
return locale.toLowerCase().startsWith("tr") ? [trHolidays] : [];
|
|
316
|
+
}, [holidaysProp, locale]);
|
|
317
|
+
const padStart = dateToIso(new Date(firstMonth.getFullYear(), firstMonth.getMonth(), -6));
|
|
318
|
+
const padEnd = dateToIso(new Date(lastMonth.getFullYear(), lastMonth.getMonth() + 1, 7));
|
|
319
|
+
const holidayMap = React.useMemo(() => {
|
|
320
|
+
const map = new Map();
|
|
321
|
+
for (const p of providers)
|
|
322
|
+
for (const h of p.get({ start: padStart, end: padEnd }, { region: holidayRegion })) {
|
|
323
|
+
const list = map.get(h.date) ?? [];
|
|
324
|
+
list.push(h);
|
|
325
|
+
map.set(h.date, list);
|
|
326
|
+
}
|
|
327
|
+
return map;
|
|
328
|
+
}, [providers, padStart, padEnd, holidayRegion]);
|
|
329
|
+
const holidayLabel = React.useCallback((h) => {
|
|
330
|
+
const name = holidayName(h, locale, "tr");
|
|
331
|
+
return h.partial ? t("halfDay", { name, time: h.partial.from }) : name;
|
|
332
|
+
}, [locale, t]);
|
|
333
|
+
const markerList = React.useCallback((iso) => asArray(markers?.[iso]), [markers]);
|
|
334
|
+
const describeDay = React.useCallback((date) => {
|
|
335
|
+
const iso = dateToIso(date);
|
|
336
|
+
const words = [...(holidayMap.get(iso) ?? []).map(holidayLabel), ...markerList(iso).map((m) => m.label)];
|
|
337
|
+
return words.length ? words.join(", ") : undefined;
|
|
338
|
+
}, [holidayMap, holidayLabel, markerList]);
|
|
339
|
+
const dayTitle = React.useCallback((date) => {
|
|
340
|
+
const iso = dateToIso(date);
|
|
341
|
+
const words = [...(holidayMap.get(iso) ?? []).map(holidayLabel), ...markerList(iso).map((m) => m.label)];
|
|
342
|
+
return words.length ? words.join(" · ") : undefined;
|
|
343
|
+
}, [holidayMap, holidayLabel, markerList]);
|
|
344
|
+
const renderDayExtra = React.useCallback((date, mods) => {
|
|
345
|
+
const iso = dateToIso(date);
|
|
346
|
+
const hs = holidayMap.get(iso) ?? [];
|
|
347
|
+
const ms = markerList(iso);
|
|
348
|
+
if (renderDay) {
|
|
349
|
+
return renderDay(date, {
|
|
350
|
+
iso,
|
|
351
|
+
isToday: !!mods.today,
|
|
352
|
+
isWeekend: !!mods.weekend,
|
|
353
|
+
outside: !!mods.outside,
|
|
354
|
+
selected: !!mods.selected,
|
|
355
|
+
disabled: !!mods.disabled,
|
|
356
|
+
holidays: hs,
|
|
357
|
+
markers: ms,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (loading && !mods.outside)
|
|
361
|
+
return _jsx("span", { className: "ui-cal-dots", children: _jsx("span", { className: "ui-cal-dot ui-cal-dot-loading" }) });
|
|
362
|
+
if (size === "lg") {
|
|
363
|
+
if (!hs.length && !ms.length)
|
|
364
|
+
return null;
|
|
365
|
+
const shown = ms.slice(0, 2);
|
|
366
|
+
return (_jsxs("span", { className: "ui-cal-lines", children: [hs.map((h, i) => (_jsx("span", { className: "ui-cal-line ui-cal-line-holiday", children: holidayLabel(h) }, `h${i}`))), shown.map((m, i) => (_jsx("span", { className: "ui-cal-line", style: { "--tone": toneVar[m.tone ?? "accent"] }, children: m.label }, i))), ms.length > shown.length ? _jsx("span", { className: "ui-cal-line-more", children: t("more", { count: ms.length - shown.length }) }) : null] }));
|
|
367
|
+
}
|
|
368
|
+
const dots = [];
|
|
369
|
+
if (hs.length)
|
|
370
|
+
dots.push({ tone: "var(--warning)", key: "holiday" });
|
|
371
|
+
for (const [i, m] of ms.entries())
|
|
372
|
+
if (dots.length < 3)
|
|
373
|
+
dots.push({ tone: toneVar[m.tone ?? "accent"], key: String(i) });
|
|
374
|
+
if (!dots.length)
|
|
375
|
+
return null;
|
|
376
|
+
return (_jsx("span", { className: "ui-cal-dots", children: dots.map((d) => (_jsx("span", { className: "ui-cal-dot", style: { "--tone": d.tone } }, d.key))) }));
|
|
377
|
+
}, [holidayMap, markerList, renderDay, loading, size, holidayLabel, t]);
|
|
378
|
+
const modifiers = React.useMemo(() => ({
|
|
379
|
+
holiday: (d) => holidayMap.has(dateToIso(d)),
|
|
380
|
+
marked: (d) => markerList(dateToIso(d)).length > 0,
|
|
381
|
+
}), [holidayMap, markerList]);
|
|
382
|
+
const disabled = React.useMemo(() => toDayMatchers({ min, max, disabledDays }), [min, max, disabledDays]);
|
|
383
|
+
// Navigation
|
|
384
|
+
const step = isYear ? 12 : months;
|
|
385
|
+
const minMonth = monthOf(min);
|
|
386
|
+
const maxMonth = monthOf(max);
|
|
387
|
+
const canPrev = !minMonth || addMonths(firstMonth, -1) >= startOf(minMonth);
|
|
388
|
+
const canNext = !maxMonth || addMonths(lastMonth, 1) <= maxMonth;
|
|
389
|
+
const go = (n) => setVisibleMonth(addMonths(firstMonth, n));
|
|
390
|
+
const goToday = () => setVisibleMonth(startOf(monthOf(today)));
|
|
391
|
+
const showingToday = today >= rangeStart && today <= rangeEnd;
|
|
392
|
+
const title = isYear
|
|
393
|
+
? new Intl.DateTimeFormat(locale, { year: "numeric" }).format(firstMonth)
|
|
394
|
+
: months === 1
|
|
395
|
+
? null
|
|
396
|
+
: new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).formatRange(firstMonth, lastMonth).replace(/[\u2009\u202f]/g, " ");
|
|
397
|
+
const monthParts = months === 1 ? new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).formatToParts(firstMonth) : null;
|
|
398
|
+
// Legend: given items + holidays when any are in view.
|
|
399
|
+
const legendItems = React.useMemo(() => {
|
|
400
|
+
if (!legend)
|
|
401
|
+
return [];
|
|
402
|
+
const items = Array.isArray(legend) ? [...legend] : [];
|
|
403
|
+
const anyHoliday = [...holidayMap.keys()].some((k) => k >= rangeStart && k <= rangeEnd);
|
|
404
|
+
if (anyHoliday && !items.some((i) => i.kind === "holiday"))
|
|
405
|
+
items.push({ label: t("holiday"), kind: "holiday" });
|
|
406
|
+
return items;
|
|
407
|
+
}, [legend, holidayMap, rangeStart, rangeEnd, t]);
|
|
408
|
+
const selectionProps = mode === "single"
|
|
409
|
+
? { mode: "single", required, selected: isoToDate(single) ?? undefined, onSelect: (d) => setSingle(d ? dateToIso(d) : null) }
|
|
410
|
+
: mode === "multiple"
|
|
411
|
+
? { mode: "multiple", selected: multiple.map((v) => isoToDate(v)).filter(Boolean), onSelect: (ds) => setMultiple((ds ?? []).map(dateToIso).sort()) }
|
|
412
|
+
: mode === "range"
|
|
413
|
+
? {
|
|
414
|
+
mode: "range",
|
|
415
|
+
selected: range ? { from: isoToDate(range.from) ?? undefined, to: isoToDate(range.to) ?? undefined } : undefined,
|
|
416
|
+
onSelect: (r) => setRange(r?.from ? { from: dateToIso(r.from), ...(r.to ? { to: dateToIso(r.to) } : {}) } : null),
|
|
417
|
+
}
|
|
418
|
+
: {};
|
|
419
|
+
const week = useCalendarWeek();
|
|
420
|
+
const { classNames: gridClassNamesProp, ...restGrid } = gridProps ?? {};
|
|
421
|
+
return (_jsxs("div", { ref: ref, id: id, "data-slot": "calendar", "data-variant": variant, "data-months": months, "aria-busy": loading || undefined, className: cn("grid min-w-0 gap-3", variant === "card" && "surface rounded-ui-lg p-[calc(var(--gap)*1.1)]", size === "lg" && "w-full", className), children: [header ? (_jsxs("div", { "data-slot": "calendar-header", className: "flex min-h-8 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h3", { className: "me-auto min-w-0 text-[15px] font-semibold tracking-[-0.015em] text-fg", children: monthParts
|
|
422
|
+
? monthParts.map((p, i) => p.type === "year" ? (_jsx("span", { className: "font-normal text-fg-muted", children: p.value }, i)) : (_jsx(React.Fragment, { children: p.value }, i)))
|
|
423
|
+
: title }), headerAction, _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Button, { size: "xs", variant: "secondary", onClick: goToday, disabled: showingToday, children: t("today") }), _jsx(IconButton, { size: "sm", label: isYear ? t("prevYear") : t("prevMonth"), tooltip: false, onClick: () => go(-step), disabled: !canPrev, children: _jsx(ChevronLeft, { className: "rtl:-scale-x-100" }) }), _jsx(IconButton, { size: "sm", label: isYear ? t("nextYear") : t("nextMonth"), tooltip: false, onClick: () => go(step), disabled: !canNext, children: _jsx(ChevronRight, { className: "rtl:-scale-x-100" }) })] })] })) : null, _jsx(CalendarGrid, { ...selectionProps, size: size, labels: labels, month: firstMonth, onMonthChange: (d) => setVisibleMonth(startOf(d)), numberOfMonths: months, pagedNavigation: true, hideNavigation: header, showOutsideDays: months === 1, fixedWeeks: months === 1 && size !== "lg", showWeekNumber: showWeekNumbers, weekStartsOn: weekStartsOn ?? week.weekStartsOn, startMonth: minMonth ?? undefined, endMonth: maxMonth ?? undefined, disabled: disabled, modifiers: modifiers, renderDayExtra: renderDayExtra, describeDay: describeDay, dayTitle: dayTitle, "aria-label": props["aria-label"], footer: footer, classNames: {
|
|
424
|
+
...(months === 1 && header ? { month_caption: "sr-only" } : null),
|
|
425
|
+
...(isYear ? { months: "ui-cal-months grid grid-cols-1 gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", month_caption: "flex h-7 items-center ps-1.5" } : null),
|
|
426
|
+
...(size === "lg" ? { root: "ui-cal relative w-full", months: "ui-cal-months relative grid gap-6", month: "grid min-w-0 content-start gap-2" } : null),
|
|
427
|
+
...gridClassNamesProp,
|
|
428
|
+
}, ...restGrid }), legendItems.length ? _jsx(CalendarLegend, { items: legendItems }) : null] }));
|
|
429
|
+
});
|
|
430
|
+
/** Key for the marks on a Calendar (dot tones, holidays, today). */
|
|
431
|
+
export const CalendarLegend = React.forwardRef(function CalendarLegend({ items, className, labels: _labels, ...props }, ref) {
|
|
432
|
+
return (_jsx("ul", { ref: ref, "data-slot": "calendar-legend", className: cn("flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-fg-muted", className), ...props, children: items.map((item, i) => (_jsxs("li", { className: "inline-flex items-center gap-1.5", children: [item.kind === "holiday" ? (_jsx("span", { "aria-hidden": true, className: "ui-cal-legend-holiday" })) : item.kind === "today" ? (_jsx("span", { "aria-hidden": true, className: "h-0.5 w-3 rounded-full bg-accent-ink" })) : (_jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full", style: { background: toneVar[item.tone ?? "accent"] } })), item.label] }, i))) }));
|
|
433
|
+
});
|
|
434
|
+
/**
|
|
435
|
+
* Time slots for the selected day (booking). A `radiogroup` with roving focus: arrows move,
|
|
436
|
+
* Space / Enter selects. Unavailable slots are shown struck through and skipped.
|
|
437
|
+
*
|
|
438
|
+
* ```tsx
|
|
439
|
+
* <CalendarSlots day={day} slots={slots} value={time} onValueChange={setTime} />
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
export const CalendarSlots = React.forwardRef(function CalendarSlots({ slots, value: valueProp, defaultValue, onValueChange, day, loading, error, onRetry, hourCycle, columns = 3, labels, className, ...props }, ref) {
|
|
443
|
+
const t = useLabels("calendar", calendarLabels, labels);
|
|
444
|
+
const { locale, format } = useLocale();
|
|
445
|
+
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? null, onChange: onValueChange, name: "CalendarSlots" });
|
|
446
|
+
const headingId = React.useId();
|
|
447
|
+
const listRef = React.useRef(null);
|
|
448
|
+
const timeFmt = React.useMemo(() => new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit", timeZone: "UTC", ...(hourCycle ? { hourCycle: hourCycle === 12 ? "h12" : "h23" } : null) }), [locale, hourCycle]);
|
|
449
|
+
const show = (hhmm) => {
|
|
450
|
+
const [h, m] = hhmm.split(":").map(Number);
|
|
451
|
+
return timeFmt.format(new Date(Date.UTC(1970, 0, 1, h ?? 0, m ?? 0)));
|
|
452
|
+
};
|
|
453
|
+
const enabled = slots.filter((s) => s.available);
|
|
454
|
+
const focusIndex = Math.max(0, enabled.findIndex((s) => s.start === value));
|
|
455
|
+
const available = enabled.length;
|
|
456
|
+
const onKeyDown = (e) => {
|
|
457
|
+
const keys = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };
|
|
458
|
+
if (!(e.key in keys) && e.key !== "Home" && e.key !== "End")
|
|
459
|
+
return;
|
|
460
|
+
const buttons = Array.from(listRef.current?.querySelectorAll('[role="radio"]:not([aria-disabled="true"])') ?? []);
|
|
461
|
+
const cur = buttons.indexOf(document.activeElement);
|
|
462
|
+
if (!buttons.length)
|
|
463
|
+
return;
|
|
464
|
+
e.preventDefault();
|
|
465
|
+
const rtl = getComputedStyle(e.currentTarget).direction === "rtl";
|
|
466
|
+
let delta = keys[e.key] ?? 0;
|
|
467
|
+
if (rtl && (e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
468
|
+
delta = -delta;
|
|
469
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? buttons.length - 1 : (cur + delta + buttons.length) % buttons.length;
|
|
470
|
+
const el = buttons[next];
|
|
471
|
+
el.focus();
|
|
472
|
+
setValue(el.dataset.value ?? null);
|
|
473
|
+
};
|
|
474
|
+
return (_jsxs("div", { ref: ref, "data-slot": "calendar-slots", className: cn("grid content-start gap-3", className), ...props, children: [_jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h4", { id: headingId, className: "text-[13px] font-semibold text-fg", children: day ? format.date(day, { weekday: "long", month: "long", day: "numeric" }) : t("slots") }), !loading && !error && slots.length ? _jsx("span", { className: "text-xs text-fg-subtle tabular", children: t("slotsLeft", { count: available }) }) : null] }), loading ? (_jsx("div", { className: cn("grid gap-1.5", columns === 2 ? "grid-cols-2" : columns === 4 ? "grid-cols-4" : "grid-cols-3"), "aria-label": t("loading"), role: "status", children: Array.from({ length: 9 }, (_, i) => (_jsx("span", { className: "h-(--control-h) animate-pulse rounded-ui-sm bg-skeleton motion-reduce:animate-none" }, i))) })) : error ? (_jsxs("div", { role: "alert", className: "grid justify-items-start gap-2 rounded-ui border border-dashed border-line px-3 py-3 text-[13px] text-fg-muted", children: [_jsx("span", { children: error === true ? t("slotsError") : error }), onRetry ? (_jsxs(Button, { size: "xs", variant: "secondary", onClick: onRetry, children: [_jsx(RotateCcw, {}), " ", t("retry")] })) : null] })) : !slots.length || !available ? (_jsx("p", { className: "rounded-ui border border-dashed border-line px-3 py-4 text-center text-[13px] text-fg-muted", children: t("noSlots") })) : (_jsx("div", { ref: listRef, role: "radiogroup", "aria-labelledby": headingId, onKeyDown: onKeyDown, className: cn("grid gap-1.5", columns === 2 ? "grid-cols-2" : columns === 4 ? "grid-cols-4" : "grid-cols-3"), children: slots.map((s) => {
|
|
475
|
+
const checked = s.start === value;
|
|
476
|
+
const idx = enabled.indexOf(s);
|
|
477
|
+
return (_jsxs("button", { type: "button", role: "radio", "aria-checked": checked, "aria-disabled": !s.available || undefined, "data-value": s.start, "data-state": checked ? "checked" : "unchecked", tabIndex: s.available && idx === focusIndex ? 0 : -1, onClick: () => s.available && setValue(s.start), className: cn("flex h-(--control-h) flex-col items-center justify-center rounded-ui-sm border text-[13px] font-medium tabular transition-[background-color,border-color,color] focus-ring", checked
|
|
478
|
+
? "border-transparent bg-accent text-accent-fg"
|
|
479
|
+
: s.available
|
|
480
|
+
? "border-field-border bg-field text-fg hover:border-field-border-hover hover:bg-hover"
|
|
481
|
+
: "cursor-not-allowed border-dashed border-line text-fg-subtle line-through decoration-fg-subtle/60"), children: [_jsx("span", { children: show(s.start) }), s.label ? _jsx("span", { className: cn("text-[10.5px] font-normal leading-none", checked ? "text-accent-fg/80" : "text-fg-subtle"), children: s.label }) : null] }, s.start));
|
|
482
|
+
}) }))] }));
|
|
483
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const cardVariants: (props?: ({
|
|
4
|
+
variant?: "inset" | "outline" | "ghost" | "surface" | null | undefined;
|
|
5
|
+
padding?: "none" | "sm" | "md" | null | undefined;
|
|
6
|
+
interactive?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface CardProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof cardVariants> {
|
|
9
|
+
/** Merge onto the child — e.g. `<Card asChild interactive><Link href>…</Link></Card>` makes the whole card a link. */
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
/** Semantic element. Use `"section"` with `aria-labelledby` pointing at the CardTitle id. Default `"div"`. */
|
|
12
|
+
as?: "div" | "section" | "article" | "aside" | "li";
|
|
13
|
+
/** Sets `aria-busy`; render `<CardBody loading />` for the shimmer. */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** Selected state for selectable cards (`data-selected`, accent border). */
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The main content surface. Takes its glass or solid material from tokens; spacing follows
|
|
20
|
+
* `--gap` (density axis). In glass mode nest cards with `variant="inset"` — a second blurred
|
|
21
|
+
* surface costs frames and blurs text.
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Card>
|
|
25
|
+
* <CardHeader title="Open deals" description="Pipeline value by stage" action={<Button size="sm">View all</Button>} />
|
|
26
|
+
* <CardBody>…</CardBody>
|
|
27
|
+
* </Card>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export interface CardHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
32
|
+
/** Small line above the title ("Q3 · Sales"). No CSS uppercase — Turkish-safe. */
|
|
33
|
+
eyebrow?: React.ReactNode;
|
|
34
|
+
title?: React.ReactNode;
|
|
35
|
+
description?: React.ReactNode;
|
|
36
|
+
/** Actions at the top end. */
|
|
37
|
+
action?: React.ReactNode;
|
|
38
|
+
/** Heading level of `title`. Default `"h3"`. */
|
|
39
|
+
titleAs?: "h2" | "h3" | "h4";
|
|
40
|
+
/** Id for the title (for `aria-labelledby` on a section card). */
|
|
41
|
+
titleId?: string;
|
|
42
|
+
/** Hairline under the header. */
|
|
43
|
+
divider?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Prop-based header (title, description, action). For custom layouts compose CardTitle / CardDescription / CardAction. */
|
|
46
|
+
export declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
/** Small mono line above a title. */
|
|
48
|
+
export declare function CardEyebrow({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
49
|
+
/** Card title. Default `<h3>`. */
|
|
50
|
+
export declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & {
|
|
51
|
+
as?: "h2" | "h3" | "h4" | "p";
|
|
52
|
+
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
53
|
+
/** Secondary line under the title. */
|
|
54
|
+
export declare function CardDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
55
|
+
/** Actions slot at the top end of a header. */
|
|
56
|
+
export declare function CardAction({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
57
|
+
export interface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
58
|
+
/** Replace the content with a text skeleton. */
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
/** Lines of the loading skeleton. Default 3. */
|
|
61
|
+
loadingLines?: number;
|
|
62
|
+
}
|
|
63
|
+
export declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
/** A secondary tile inside a card (`surface-2`, never blurs). */
|
|
66
|
+
export declare const Inset: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { SkeletonText } from "./skeleton.js";
|
|
7
|
+
export const cardVariants = cva("relative block [--card-p:var(--gap)]", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
/** The main surface: glass or solid from tokens. */
|
|
11
|
+
surface: "surface rounded-ui-lg",
|
|
12
|
+
/** Hairline border, no fill — quiet grouping on a surface. */
|
|
13
|
+
outline: "rounded-ui-lg border border-line",
|
|
14
|
+
/** No chrome; keeps the card spacing. */
|
|
15
|
+
ghost: "rounded-ui-lg",
|
|
16
|
+
/** A card inside a card: `surface-2`, never blurs (glass budget). */
|
|
17
|
+
inset: "surface-2 rounded-ui",
|
|
18
|
+
},
|
|
19
|
+
padding: {
|
|
20
|
+
/** Parts (CardHeader/Body/Footer) bring their own padding. */
|
|
21
|
+
none: "",
|
|
22
|
+
sm: "p-[calc(var(--card-p)*0.7)]",
|
|
23
|
+
md: "p-(--card-p)",
|
|
24
|
+
},
|
|
25
|
+
interactive: {
|
|
26
|
+
true: "cursor-pointer transition-[border-color,box-shadow,transform] duration-150 hover:border-field-border-hover focus-ring has-[a:focus-visible]:outline-2 has-[a:focus-visible]:outline-ring motion-safe:active:translate-y-px",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { variant: "surface", padding: "none" },
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* The main content surface. Takes its glass or solid material from tokens; spacing follows
|
|
33
|
+
* `--gap` (density axis). In glass mode nest cards with `variant="inset"` — a second blurred
|
|
34
|
+
* surface costs frames and blurs text.
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Card>
|
|
38
|
+
* <CardHeader title="Open deals" description="Pipeline value by stage" action={<Button size="sm">View all</Button>} />
|
|
39
|
+
* <CardBody>…</CardBody>
|
|
40
|
+
* </Card>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const Card = React.forwardRef(function Card({ className, variant, padding, interactive, asChild, as = "div", loading, selected, ...props }, ref) {
|
|
44
|
+
const Comp = (asChild ? Slot.Root : as);
|
|
45
|
+
return (_jsx(Comp, { ref: ref, "data-slot": "card", "data-variant": variant ?? "surface", "data-selected": selected ? "" : undefined, "aria-busy": loading || undefined, className: cn(cardVariants({ variant, padding, interactive }), selected && "border-accent-ink! ring-1 ring-accent-ink", className), ...props }));
|
|
46
|
+
});
|
|
47
|
+
/** Prop-based header (title, description, action). For custom layouts compose CardTitle / CardDescription / CardAction. */
|
|
48
|
+
export const CardHeader = React.forwardRef(function CardHeader({ eyebrow, title, description, action, titleAs = "h3", titleId, divider, className, children, ...props }, ref) {
|
|
49
|
+
return (_jsxs("div", { ref: ref, "data-slot": "card-header", className: cn("flex items-start justify-between gap-4 px-(--card-p,1.25rem) pt-[calc(var(--card-p,1.25rem)*0.8)] pb-[calc(var(--card-p,1.25rem)*0.6)]", divider && "border-b border-line pb-[calc(var(--card-p,1.25rem)*0.8)]", className), ...props, children: [_jsxs("div", { className: "min-w-0", children: [eyebrow ? _jsx(CardEyebrow, { children: eyebrow }) : null, title ? (_jsx(CardTitle, { as: titleAs, id: titleId, children: title })) : null, description ? _jsx(CardDescription, { children: description }) : null, children] }), action ? _jsx(CardAction, { children: action }) : null] }));
|
|
50
|
+
});
|
|
51
|
+
/** Small mono line above a title. */
|
|
52
|
+
export function CardEyebrow({ className, ...props }) {
|
|
53
|
+
return _jsx("p", { "data-slot": "card-eyebrow", className: cn("mb-1 font-mono text-[11px] tracking-[0.06em] text-fg-subtle", className), ...props });
|
|
54
|
+
}
|
|
55
|
+
/** Card title. Default `<h3>`. */
|
|
56
|
+
export const CardTitle = React.forwardRef(function CardTitle({ as: Tag = "h3", className, ...props }, ref) {
|
|
57
|
+
return _jsx(Tag, { ref: ref, "data-slot": "card-title", className: cn("text-[15px] font-semibold tracking-[-0.01em] text-balance text-fg", className), ...props });
|
|
58
|
+
});
|
|
59
|
+
/** Secondary line under the title. */
|
|
60
|
+
export function CardDescription({ className, ...props }) {
|
|
61
|
+
return _jsx("p", { "data-slot": "card-description", className: cn("mt-0.5 text-[13px] text-pretty text-fg-muted", className), ...props });
|
|
62
|
+
}
|
|
63
|
+
/** Actions slot at the top end of a header. */
|
|
64
|
+
export function CardAction({ className, ...props }) {
|
|
65
|
+
return _jsx("div", { "data-slot": "card-action", className: cn("flex shrink-0 items-center gap-1.5", className), ...props });
|
|
66
|
+
}
|
|
67
|
+
export const CardBody = React.forwardRef(function CardBody({ className, loading, loadingLines = 3, children, ...props }, ref) {
|
|
68
|
+
return (_jsx("div", { ref: ref, "data-slot": "card-body", className: cn("px-(--card-p,1.25rem) pb-(--card-p,1.25rem)", className), ...props, children: loading ? _jsx(SkeletonText, { lines: loadingLines }) : children }));
|
|
69
|
+
});
|
|
70
|
+
export const CardFooter = React.forwardRef(function CardFooter({ className, ...props }, ref) {
|
|
71
|
+
return (_jsx("div", { ref: ref, "data-slot": "card-footer", className: cn("flex items-center gap-2 border-t border-line px-(--card-p,1.25rem) py-[calc(var(--card-p,1.25rem)*0.6)]", className), ...props }));
|
|
72
|
+
});
|
|
73
|
+
/** A secondary tile inside a card (`surface-2`, never blurs). */
|
|
74
|
+
export const Inset = React.forwardRef(function Inset({ className, ...props }, ref) {
|
|
75
|
+
return _jsx("div", { ref: ref, "data-slot": "inset", className: cn("surface-2 rounded-ui", className), ...props });
|
|
76
|
+
});
|