@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
package/dist/lib/date.js
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date & time helpers for the pickers (Date picker, Date range picker, Time picker, Calendar).
|
|
3
|
+
*
|
|
4
|
+
* Value rules (X11): a date-only value is a `"YYYY-MM-DD"` string, read and written in the local
|
|
5
|
+
* calendar — never through `toISOString()`, which shifts the day east of UTC. A time of day is
|
|
6
|
+
* `"HH:mm"` or `"HH:mm:ss"` (24h) whatever the display uses.
|
|
7
|
+
*
|
|
8
|
+
* React-free: usable from server components and tests.
|
|
9
|
+
*/
|
|
10
|
+
import { enUS } from "date-fns/locale/en-US";
|
|
11
|
+
import { tr as trLocale } from "date-fns/locale/tr";
|
|
12
|
+
import { parse as parseWithPattern, isValid } from "date-fns";
|
|
13
|
+
const ISO_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
14
|
+
const pad = (n, len = 2) => String(n).padStart(len, "0");
|
|
15
|
+
/* ------------------------------------------------------------------ */
|
|
16
|
+
/* ISO <-> Date */
|
|
17
|
+
/* ------------------------------------------------------------------ */
|
|
18
|
+
/** `YYYY-MM-DD` of a `Date` in the local calendar (no UTC shift). */
|
|
19
|
+
export function dateToIso(date) {
|
|
20
|
+
return `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
21
|
+
}
|
|
22
|
+
/** A `YYYY-MM-DD` string as a local-midnight `Date`, or `null` when malformed / non-existent. */
|
|
23
|
+
export function isoToDate(value) {
|
|
24
|
+
if (!value)
|
|
25
|
+
return null;
|
|
26
|
+
const m = ISO_RE.exec(value);
|
|
27
|
+
if (!m)
|
|
28
|
+
return null;
|
|
29
|
+
const y = Number(m[1]);
|
|
30
|
+
const mo = Number(m[2]) - 1;
|
|
31
|
+
const d = Number(m[3]);
|
|
32
|
+
const date = new Date(y, mo, d);
|
|
33
|
+
date.setFullYear(y); // years 0–99
|
|
34
|
+
if (date.getFullYear() !== y || date.getMonth() !== mo || date.getDate() !== d)
|
|
35
|
+
return null;
|
|
36
|
+
return date;
|
|
37
|
+
}
|
|
38
|
+
/** True for a well-formed, existing `YYYY-MM-DD` date. */
|
|
39
|
+
export function isIsoDateString(value) {
|
|
40
|
+
return typeof value === "string" && isoToDate(value) !== null;
|
|
41
|
+
}
|
|
42
|
+
/** Today as `YYYY-MM-DD` in the local calendar (or in `timeZone` when given). */
|
|
43
|
+
export function todayIso(timeZone, now = new Date()) {
|
|
44
|
+
if (!timeZone)
|
|
45
|
+
return dateToIso(now);
|
|
46
|
+
const parts = new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(now);
|
|
47
|
+
const get = (t) => parts.find((p) => p.type === t)?.value ?? "";
|
|
48
|
+
return `${get("year")}-${get("month")}-${get("day")}`;
|
|
49
|
+
}
|
|
50
|
+
/** Adds whole days to a `YYYY-MM-DD` string. */
|
|
51
|
+
export function addIsoDays(value, days) {
|
|
52
|
+
const d = isoToDate(value);
|
|
53
|
+
if (!d)
|
|
54
|
+
return value;
|
|
55
|
+
d.setDate(d.getDate() + days);
|
|
56
|
+
return dateToIso(d);
|
|
57
|
+
}
|
|
58
|
+
/** Days from `a` to `b` (`b − a`), DST-safe. */
|
|
59
|
+
export function isoDiffDays(a, b) {
|
|
60
|
+
const da = isoToDate(a);
|
|
61
|
+
const db = isoToDate(b);
|
|
62
|
+
if (!da || !db)
|
|
63
|
+
return 0;
|
|
64
|
+
return Math.round((Date.UTC(db.getFullYear(), db.getMonth(), db.getDate()) - Date.UTC(da.getFullYear(), da.getMonth(), da.getDate())) / 86_400_000);
|
|
65
|
+
}
|
|
66
|
+
/** Inclusive number of days in a range (`1` for a single-day range). */
|
|
67
|
+
export function rangeLength(range) {
|
|
68
|
+
if (!range?.from)
|
|
69
|
+
return 0;
|
|
70
|
+
return isoDiffDays(range.from, range.to ?? range.from) + 1;
|
|
71
|
+
}
|
|
72
|
+
/** ISO weekday of a local date: 1 = Monday … 7 = Sunday. */
|
|
73
|
+
export function isoWeekdayOf(date) {
|
|
74
|
+
return ((date.getDay() + 6) % 7) + 1;
|
|
75
|
+
}
|
|
76
|
+
/* ------------------------------------------------------------------ */
|
|
77
|
+
/* date-fns locales */
|
|
78
|
+
/* ------------------------------------------------------------------ */
|
|
79
|
+
const DATE_FNS_LOCALES = new Map([
|
|
80
|
+
["en", enUS],
|
|
81
|
+
["en-us", enUS],
|
|
82
|
+
["tr", trLocale],
|
|
83
|
+
["tr-tr", trLocale],
|
|
84
|
+
]);
|
|
85
|
+
/**
|
|
86
|
+
* Registers a date-fns locale for a BCP 47 tag or language, so the calendars use its month and
|
|
87
|
+
* weekday names. `en-US` and `tr` ship built in.
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { de } from "date-fns/locale/de";
|
|
91
|
+
* registerDateLocale("de", de);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function registerDateLocale(tag, locale) {
|
|
95
|
+
DATE_FNS_LOCALES.set(tag.toLowerCase(), locale);
|
|
96
|
+
}
|
|
97
|
+
/** The date-fns locale for a BCP 47 tag: exact tag, then language, then `en-US`. */
|
|
98
|
+
export function getDateFnsLocale(tag) {
|
|
99
|
+
const key = tag.toLowerCase().replace("_", "-");
|
|
100
|
+
return DATE_FNS_LOCALES.get(key) ?? DATE_FNS_LOCALES.get(key.split("-")[0]) ?? enUS;
|
|
101
|
+
}
|
|
102
|
+
const patternCache = new Map();
|
|
103
|
+
/** The numeric short-date pattern of a locale, read from `Intl.DateTimeFormat#formatToParts`. */
|
|
104
|
+
export function getDatePattern(locale) {
|
|
105
|
+
const hit = patternCache.get(locale);
|
|
106
|
+
if (hit)
|
|
107
|
+
return hit;
|
|
108
|
+
let order = ["month", "day", "year"];
|
|
109
|
+
let separator = "/";
|
|
110
|
+
try {
|
|
111
|
+
const parts = new Intl.DateTimeFormat(locale, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2026, 10, 23));
|
|
112
|
+
const found = parts.filter((p) => p.type === "day" || p.type === "month" || p.type === "year").map((p) => p.type);
|
|
113
|
+
if (found.length === 3)
|
|
114
|
+
order = found;
|
|
115
|
+
const lit = parts.find((p) => p.type === "literal")?.value.trim();
|
|
116
|
+
if (lit)
|
|
117
|
+
separator = lit.slice(0, 1);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
/* invalid tag: en-US order */
|
|
121
|
+
}
|
|
122
|
+
const token = { day: "dd", month: "MM", year: "yyyy" };
|
|
123
|
+
const result = { order, separator, pattern: order.map((p) => token[p]).join(separator) };
|
|
124
|
+
patternCache.set(locale, result);
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The placeholder for a typed date: the locale pattern spelled with `tokens`
|
|
129
|
+
* (`"MM/DD/YYYY"` for en-US; tr with `{ day: "GG", month: "AA" }` → `"GG.AA.YYYY"`).
|
|
130
|
+
*/
|
|
131
|
+
export function datePlaceholder(locale, tokens = {}) {
|
|
132
|
+
const { order, separator } = getDatePattern(locale);
|
|
133
|
+
const t = { day: tokens.day ?? "DD", month: tokens.month ?? "MM", year: tokens.year ?? "YYYY" };
|
|
134
|
+
return order.map((p) => t[p]).join(separator);
|
|
135
|
+
}
|
|
136
|
+
/** A `YYYY-MM-DD` value in the locale's numeric pattern (`"11/23/2026"`, `"23.11.2026"`). */
|
|
137
|
+
export function formatDateInput(value, locale) {
|
|
138
|
+
const d = isoToDate(value);
|
|
139
|
+
if (!d)
|
|
140
|
+
return "";
|
|
141
|
+
const { order, separator } = getDatePattern(locale);
|
|
142
|
+
const v = { day: pad(d.getDate()), month: pad(d.getMonth() + 1), year: pad(d.getFullYear(), 4) };
|
|
143
|
+
return order.map((p) => v[p]).join(separator);
|
|
144
|
+
}
|
|
145
|
+
const DEFAULT_WORDS = { today: ["today", "now"], tomorrow: ["tomorrow", "tmrw"], yesterday: ["yesterday"] };
|
|
146
|
+
function build(y, m, d) {
|
|
147
|
+
if (!Number.isFinite(y) || !Number.isFinite(m) || !Number.isFinite(d))
|
|
148
|
+
return null;
|
|
149
|
+
const iso = `${pad(y, 4)}-${pad(m)}-${pad(d)}`;
|
|
150
|
+
return isIsoDateString(iso) ? iso : null;
|
|
151
|
+
}
|
|
152
|
+
function fullYear(y, reference) {
|
|
153
|
+
const n = Number(y);
|
|
154
|
+
if (y.length > 2)
|
|
155
|
+
return n;
|
|
156
|
+
// Two-digit year: pick the century that lands within (now − 80, now + 20].
|
|
157
|
+
const now = reference.getFullYear();
|
|
158
|
+
let full = Math.floor(now / 100) * 100 + n;
|
|
159
|
+
if (full > now + 20)
|
|
160
|
+
full -= 100;
|
|
161
|
+
return full;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Parses what a person types into a date field. Returns `YYYY-MM-DD` or `null`.
|
|
165
|
+
*
|
|
166
|
+
* Accepts the locale's numeric pattern with any of `. / - ␣` as separator, digits only
|
|
167
|
+
* (`11232026` / `23112026`), partial dates (day + month = this year), two-digit years, ISO
|
|
168
|
+
* `2026-11-23`, month names (`Nov 23, 2026`, `23 Kasım 2026`), relative words and `+3` / `-2` days.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* parseDateInput("11/23/2026", "en-US"); // "2026-11-23"
|
|
172
|
+
* parseDateInput("23.11", "tr-TR"); // "2026-11-23" (this year)
|
|
173
|
+
* parseDateInput("tomorrow", "en-US"); // the day after today
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export function parseDateInput(input, locale, options = {}) {
|
|
177
|
+
const reference = options.reference ?? new Date();
|
|
178
|
+
const raw = input.trim();
|
|
179
|
+
if (!raw)
|
|
180
|
+
return null;
|
|
181
|
+
const lower = raw.toLocaleLowerCase(locale);
|
|
182
|
+
const words = { ...DEFAULT_WORDS, ...options.words };
|
|
183
|
+
const refIso = dateToIso(reference);
|
|
184
|
+
if (words.today?.includes(lower))
|
|
185
|
+
return refIso;
|
|
186
|
+
if (words.tomorrow?.includes(lower))
|
|
187
|
+
return addIsoDays(refIso, 1);
|
|
188
|
+
if (words.yesterday?.includes(lower))
|
|
189
|
+
return addIsoDays(refIso, -1);
|
|
190
|
+
const rel = /^([+-])\s*(\d{1,4})\s*d?$/.exec(lower);
|
|
191
|
+
if (rel)
|
|
192
|
+
return addIsoDays(refIso, (rel[1] === "-" ? -1 : 1) * Number(rel[2]));
|
|
193
|
+
if (ISO_RE.test(raw))
|
|
194
|
+
return isIsoDateString(raw) ? raw : null;
|
|
195
|
+
const { order } = getDatePattern(locale);
|
|
196
|
+
const pick = (vals) => build(fullYear(vals.year, reference), Number(vals.month), Number(vals.day));
|
|
197
|
+
// Digits only: 8 = full, 6 = two-digit year, 4 = day + month this year.
|
|
198
|
+
if (/^\d+$/.test(raw)) {
|
|
199
|
+
const len = raw.length;
|
|
200
|
+
if (len !== 4 && len !== 6 && len !== 8)
|
|
201
|
+
return null;
|
|
202
|
+
const vals = { day: "", month: "", year: String(reference.getFullYear()) };
|
|
203
|
+
let i = 0;
|
|
204
|
+
for (const p of order) {
|
|
205
|
+
if (p === "year") {
|
|
206
|
+
if (len === 4)
|
|
207
|
+
continue;
|
|
208
|
+
const n = len === 8 ? 4 : 2;
|
|
209
|
+
vals.year = raw.slice(i, i + n);
|
|
210
|
+
i += n;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
vals[p] = raw.slice(i, i + 2);
|
|
214
|
+
i += 2;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return pick(vals);
|
|
218
|
+
}
|
|
219
|
+
// Numeric with separators.
|
|
220
|
+
if (/^\d{1,4}([./\-\s]+\d{1,4}){1,2}[./\s]*$/.test(raw)) {
|
|
221
|
+
const nums = raw.split(/[./\-\s]+/).filter(Boolean);
|
|
222
|
+
if (nums.length === 3) {
|
|
223
|
+
// A leading 4-digit number is a year (ISO-like order), whatever the locale says.
|
|
224
|
+
const effective = nums[0].length === 4 ? ["year", "month", "day"] : order;
|
|
225
|
+
const vals = { day: "", month: "", year: "" };
|
|
226
|
+
effective.forEach((p, idx) => (vals[p] = nums[idx]));
|
|
227
|
+
return pick(vals);
|
|
228
|
+
}
|
|
229
|
+
if (nums.length === 2) {
|
|
230
|
+
const dm = order.filter((p) => p !== "year");
|
|
231
|
+
const vals = { day: "", month: "", year: String(reference.getFullYear()) };
|
|
232
|
+
dm.forEach((p, idx) => (vals[p] = nums[idx]));
|
|
233
|
+
return pick(vals);
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
// Month names: try the locale's long formats.
|
|
238
|
+
const fnsLocale = getDateFnsLocale(locale);
|
|
239
|
+
const patterns = ["PPP", "PP", "P", "d MMMM yyyy", "d MMM yyyy", "MMMM d yyyy", "MMM d yyyy", "MMMM d, yyyy", "MMM d, yyyy", "d MMMM", "d MMM", "MMMM d", "MMM d"];
|
|
240
|
+
const cleaned = raw.replace(/\s+/g, " ").replace(/(\d)(st|nd|rd|th)\b/gi, "$1");
|
|
241
|
+
for (const p of patterns) {
|
|
242
|
+
const d = parseWithPattern(cleaned, p, reference, { locale: fnsLocale });
|
|
243
|
+
if (isValid(d))
|
|
244
|
+
return dateToIso(d);
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const TIME_RE = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/;
|
|
249
|
+
/** `"14:30"` / `"14:30:05"` → parts, or `null` when malformed or out of range. */
|
|
250
|
+
export function parseTime(value) {
|
|
251
|
+
if (!value)
|
|
252
|
+
return null;
|
|
253
|
+
const m = TIME_RE.exec(value.trim());
|
|
254
|
+
if (!m)
|
|
255
|
+
return null;
|
|
256
|
+
const hour = Number(m[1]);
|
|
257
|
+
const minute = Number(m[2]);
|
|
258
|
+
const second = m[3] ? Number(m[3]) : 0;
|
|
259
|
+
if (hour > 23 || minute > 59 || second > 59)
|
|
260
|
+
return null;
|
|
261
|
+
return { hour, minute, second };
|
|
262
|
+
}
|
|
263
|
+
/** Parts → `"HH:mm"` (or `"HH:mm:ss"` with `seconds`). */
|
|
264
|
+
export function formatTimeValue(parts, seconds = false) {
|
|
265
|
+
return `${pad(parts.hour)}:${pad(parts.minute)}${seconds ? `:${pad(parts.second)}` : ""}`;
|
|
266
|
+
}
|
|
267
|
+
/** Minutes since midnight of `"HH:mm[:ss]"` (seconds ignored), or `NaN`. */
|
|
268
|
+
export function timeToMinutes(value) {
|
|
269
|
+
const p = parseTime(value);
|
|
270
|
+
return p ? p.hour * 60 + p.minute : Number.NaN;
|
|
271
|
+
}
|
|
272
|
+
/** Minutes since midnight → `"HH:mm"` (wraps past midnight). */
|
|
273
|
+
export function minutesToTime(minutes) {
|
|
274
|
+
const m = ((Math.round(minutes) % 1440) + 1440) % 1440;
|
|
275
|
+
return `${pad(Math.floor(m / 60))}:${pad(m % 60)}`;
|
|
276
|
+
}
|
|
277
|
+
/** Compares two `"HH:mm[:ss]"` strings. */
|
|
278
|
+
export function compareTime(a, b) {
|
|
279
|
+
const pa = parseTime(a);
|
|
280
|
+
const pb = parseTime(b);
|
|
281
|
+
if (!pa || !pb)
|
|
282
|
+
return 0;
|
|
283
|
+
return pa.hour * 3600 + pa.minute * 60 + pa.second - (pb.hour * 3600 + pb.minute * 60 + pb.second);
|
|
284
|
+
}
|
|
285
|
+
/** 12 for locales that show AM/PM (en-US), 24 otherwise (tr, most of Europe). */
|
|
286
|
+
export function getHourCycle(locale) {
|
|
287
|
+
try {
|
|
288
|
+
const hc = new Intl.DateTimeFormat(locale, { hour: "numeric" }).resolvedOptions().hourCycle;
|
|
289
|
+
return hc === "h11" || hc === "h12" ? 12 : 24;
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
return 24;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/** AM / PM labels of a locale (`["AM","PM"]`, `["ÖÖ","ÖS"]`). */
|
|
296
|
+
export function getDayPeriodLabels(locale) {
|
|
297
|
+
const read = (h) => {
|
|
298
|
+
try {
|
|
299
|
+
return new Intl.DateTimeFormat(locale, { hour: "numeric", hour12: true }).formatToParts(new Date(2026, 0, 1, h)).find((p) => p.type === "dayPeriod")?.value;
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
return [read(9) ?? "AM", read(15) ?? "PM"];
|
|
306
|
+
}
|
|
307
|
+
/** The time separator of a locale (`":"` almost everywhere, `"."` for some). */
|
|
308
|
+
export function getTimeSeparator(locale) {
|
|
309
|
+
try {
|
|
310
|
+
const parts = new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).formatToParts(new Date(2026, 0, 1, 9, 30));
|
|
311
|
+
return parts.find((p) => p.type === "literal")?.value.trim() || ":";
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
return ":";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/** Whether the locale puts the day period before the hour (ko, zh). */
|
|
318
|
+
export function dayPeriodFirst(locale) {
|
|
319
|
+
try {
|
|
320
|
+
const parts = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit", hour12: true }).formatToParts(new Date(2026, 0, 1, 9, 30));
|
|
321
|
+
const dp = parts.findIndex((p) => p.type === "dayPeriod");
|
|
322
|
+
const h = parts.findIndex((p) => p.type === "hour");
|
|
323
|
+
return dp !== -1 && dp < h;
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** A list of times from `start` to `end` (inclusive of start, exclusive of end) every `step` minutes. */
|
|
330
|
+
export function timeSlots(step = 15, start = "00:00", end = "24:00") {
|
|
331
|
+
const s = start === "24:00" ? 1440 : timeToMinutes(start);
|
|
332
|
+
const e = end === "24:00" ? 1440 : timeToMinutes(end);
|
|
333
|
+
const out = [];
|
|
334
|
+
if (!Number.isFinite(s) || !Number.isFinite(e) || step <= 0)
|
|
335
|
+
return out;
|
|
336
|
+
for (let m = s; m < e; m += step)
|
|
337
|
+
out.push(minutesToTime(m));
|
|
338
|
+
return out;
|
|
339
|
+
}
|
|
340
|
+
const monthStart = (iso) => `${iso.slice(0, 7)}-01`;
|
|
341
|
+
const monthEnd = (iso) => {
|
|
342
|
+
const d = isoToDate(monthStart(iso));
|
|
343
|
+
d.setMonth(d.getMonth() + 1, 0);
|
|
344
|
+
return dateToIso(d);
|
|
345
|
+
};
|
|
346
|
+
const shiftMonth = (iso, n) => {
|
|
347
|
+
const d = isoToDate(monthStart(iso));
|
|
348
|
+
d.setMonth(d.getMonth() + n);
|
|
349
|
+
return dateToIso(d);
|
|
350
|
+
};
|
|
351
|
+
/** English labels of the default presets (the `dateRangePicker` namespace overrides them). */
|
|
352
|
+
export const defaultPresetLabels = {
|
|
353
|
+
today: "Today",
|
|
354
|
+
yesterday: "Yesterday",
|
|
355
|
+
last7: "Last 7 days",
|
|
356
|
+
last30: "Last 30 days",
|
|
357
|
+
thisWeek: "This week",
|
|
358
|
+
thisMonth: "This month",
|
|
359
|
+
lastMonth: "Last month",
|
|
360
|
+
last90: "Last 90 days",
|
|
361
|
+
thisYear: "This year",
|
|
362
|
+
};
|
|
363
|
+
/** The built-in presets. `weekStartsOn` (0 = Sunday … 6) comes from the locale's week info. */
|
|
364
|
+
export function defaultRangePresets(labels = {}) {
|
|
365
|
+
const l = { ...defaultPresetLabels, ...labels };
|
|
366
|
+
return [
|
|
367
|
+
{ id: "today", label: l.today, range: (t) => ({ from: t, to: t }) },
|
|
368
|
+
{ id: "yesterday", label: l.yesterday, range: (t) => ({ from: addIsoDays(t, -1), to: addIsoDays(t, -1) }) },
|
|
369
|
+
{ id: "last7", label: l.last7, range: (t) => ({ from: addIsoDays(t, -6), to: t }) },
|
|
370
|
+
{ id: "last30", label: l.last30, range: (t) => ({ from: addIsoDays(t, -29), to: t }) },
|
|
371
|
+
{
|
|
372
|
+
id: "thisWeek",
|
|
373
|
+
label: l.thisWeek,
|
|
374
|
+
range: (t, { weekStartsOn }) => {
|
|
375
|
+
const d = isoToDate(t);
|
|
376
|
+
const back = (d.getDay() - weekStartsOn + 7) % 7;
|
|
377
|
+
const from = addIsoDays(t, -back);
|
|
378
|
+
return { from, to: addIsoDays(from, 6) };
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
{ id: "thisMonth", label: l.thisMonth, range: (t) => ({ from: monthStart(t), to: monthEnd(t) }) },
|
|
382
|
+
{ id: "lastMonth", label: l.lastMonth, range: (t) => ({ from: shiftMonth(t, -1), to: monthEnd(shiftMonth(t, -1)) }) },
|
|
383
|
+
{ id: "last90", label: l.last90, range: (t) => ({ from: addIsoDays(t, -89), to: t }) },
|
|
384
|
+
{ id: "thisYear", label: l.thisYear, range: (t) => ({ from: `${t.slice(0, 4)}-01-01`, to: `${t.slice(0, 4)}-12-31` }) },
|
|
385
|
+
];
|
|
386
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** What a `Field` tells the control inside it. */
|
|
3
|
+
export interface FieldContextValue {
|
|
4
|
+
/** Id for the control (the `<label for>` target). */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Id of the visible label, for role-based controls that `<label for>` can't name (radio group, slider…). */
|
|
7
|
+
labelId?: string;
|
|
8
|
+
/** Ids of the visible hint / error, in reading order. */
|
|
9
|
+
describedBy?: string;
|
|
10
|
+
/** Id of the error text when it is shown. */
|
|
11
|
+
errorId?: string;
|
|
12
|
+
invalid: boolean;
|
|
13
|
+
required: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
readOnly: boolean;
|
|
16
|
+
/** Form field name, so adapters can look up errors. */
|
|
17
|
+
name?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const FieldContext: React.Context<FieldContextValue | null>;
|
|
20
|
+
/** The surrounding Field, or `null`. */
|
|
21
|
+
export declare function useFieldContext(): FieldContextValue | null;
|
|
22
|
+
/**
|
|
23
|
+
* Stops a Field's wiring from reaching controls rendered inside an overlay of a field control
|
|
24
|
+
* (e.g. the search input inside a Combobox popover).
|
|
25
|
+
*/
|
|
26
|
+
export declare function FieldContextReset({ children }: {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
/** Accessibility props a control can receive from a Field. */
|
|
30
|
+
export interface ControlA11yProps {
|
|
31
|
+
id?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
"aria-describedby"?: string;
|
|
34
|
+
"aria-labelledby"?: string;
|
|
35
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling";
|
|
36
|
+
"aria-required"?: boolean | "true" | "false";
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
readOnly?: boolean;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Wires a control to the surrounding `Field`. Call it in every kit control with the control's own
|
|
43
|
+
* props and spread the result on the focusable element. The control's own values win, except
|
|
44
|
+
* `aria-describedby`, which is merged (Field ids first).
|
|
45
|
+
*
|
|
46
|
+
* ```tsx
|
|
47
|
+
* const Select = React.forwardRef((props, ref) => {
|
|
48
|
+
* const control = useFieldControl(props);
|
|
49
|
+
* return <button ref={ref} {...control} />;
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Outside a Field it returns the props unchanged (with an `id` only if one was given).
|
|
54
|
+
* Native elements only get `required`; set `aria-required` yourself for role-based controls.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useFieldControl<P extends ControlA11yProps>(props: P): P;
|
|
57
|
+
/**
|
|
58
|
+
* Focuses the first invalid control in a form (after a failed submit). Returns it, or `null`.
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* onSubmit={(e) => { if (!valid) { e.preventDefault(); focusFirstInvalid(e.currentTarget); } }}
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function focusFirstInvalid(root: HTMLElement | null | undefined): HTMLElement | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { mergeIds } from "./compose-refs.js";
|
|
5
|
+
export const FieldContext = React.createContext(null);
|
|
6
|
+
/** The surrounding Field, or `null`. */
|
|
7
|
+
export function useFieldContext() {
|
|
8
|
+
return React.useContext(FieldContext);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Stops a Field's wiring from reaching controls rendered inside an overlay of a field control
|
|
12
|
+
* (e.g. the search input inside a Combobox popover).
|
|
13
|
+
*/
|
|
14
|
+
export function FieldContextReset({ children }) {
|
|
15
|
+
return _jsx(FieldContext.Provider, { value: null, children: children });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wires a control to the surrounding `Field`. Call it in every kit control with the control's own
|
|
19
|
+
* props and spread the result on the focusable element. The control's own values win, except
|
|
20
|
+
* `aria-describedby`, which is merged (Field ids first).
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const Select = React.forwardRef((props, ref) => {
|
|
24
|
+
* const control = useFieldControl(props);
|
|
25
|
+
* return <button ref={ref} {...control} />;
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Outside a Field it returns the props unchanged (with an `id` only if one was given).
|
|
30
|
+
* Native elements only get `required`; set `aria-required` yourself for role-based controls.
|
|
31
|
+
*/
|
|
32
|
+
export function useFieldControl(props) {
|
|
33
|
+
const field = React.useContext(FieldContext);
|
|
34
|
+
if (!field)
|
|
35
|
+
return props;
|
|
36
|
+
const invalid = props["aria-invalid"] ?? (field.invalid ? true : undefined);
|
|
37
|
+
return {
|
|
38
|
+
...props,
|
|
39
|
+
id: props.id ?? field.id,
|
|
40
|
+
name: props.name ?? field.name,
|
|
41
|
+
"aria-describedby": mergeIds(field.describedBy, props["aria-describedby"]),
|
|
42
|
+
"aria-invalid": invalid,
|
|
43
|
+
required: props.required ?? (field.required || undefined),
|
|
44
|
+
disabled: props.disabled ?? (field.disabled || undefined),
|
|
45
|
+
readOnly: props.readOnly ?? (field.readOnly || undefined),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Focuses the first invalid control in a form (after a failed submit). Returns it, or `null`.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* onSubmit={(e) => { if (!valid) { e.preventDefault(); focusFirstInvalid(e.currentTarget); } }}
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function focusFirstInvalid(root) {
|
|
56
|
+
const el = root?.querySelector('[aria-invalid="true"], :invalid:not(fieldset):not(form)');
|
|
57
|
+
if (!el)
|
|
58
|
+
return null;
|
|
59
|
+
el.focus();
|
|
60
|
+
el.scrollIntoView?.({ block: "center", behavior: "smooth" });
|
|
61
|
+
return el;
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface FloatingArrowProps extends React.SVGAttributes<SVGSVGElement> {
|
|
3
|
+
/** Fill colour (a CSS value, usually a token). Default: `var(--popover)`. */
|
|
4
|
+
fill?: string;
|
|
5
|
+
/** Hairline colour along the two slanted edges. `"none"` for no edge. Default: `var(--popover-border)`. */
|
|
6
|
+
stroke?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The arrow shape used by floating layers (Popover, Tooltip, Hover Card). Pass it through the
|
|
10
|
+
* Radix `Arrow` part with `asChild` so Radix positions it:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Popover.Arrow asChild width={14} height={7}><FloatingArrow /></Popover.Arrow>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Only the two slanted edges are stroked, so the arrow melts into the layer's own border.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FloatingArrow: React.ForwardRefExoticComponent<FloatingArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The arrow shape used by floating layers (Popover, Tooltip, Hover Card). Pass it through the
|
|
5
|
+
* Radix `Arrow` part with `asChild` so Radix positions it:
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Popover.Arrow asChild width={14} height={7}><FloatingArrow /></Popover.Arrow>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Only the two slanted edges are stroked, so the arrow melts into the layer's own border.
|
|
12
|
+
*/
|
|
13
|
+
export const FloatingArrow = React.forwardRef(function FloatingArrow({ fill = "var(--popover)", stroke = "var(--popover-border)", width = 14, height = 7, style, ...props }, ref) {
|
|
14
|
+
return (_jsxs("svg", { ref: ref, width: width, height: height, viewBox: "0 0 14 7", "aria-hidden": true, focusable: "false", style: { display: "block", overflow: "visible", ...style }, ...props, children: [_jsx("path", { d: "M0 -1 L7 6.2 L14 -1 Z", fill: fill }), stroke !== "none" ? _jsx("path", { d: "M0 0 L7 6.2 L14 0", fill: "none", stroke: stroke, strokeWidth: 1, vectorEffect: "non-scaling-stroke" }) : null] }));
|
|
15
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny client islands that let otherwise server-compatible components (Badge, Skeleton, Card)
|
|
3
|
+
* show localized text without becoming client components themselves.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { type LabelValues } from "./labels.js";
|
|
7
|
+
/** Renders one label from the dictionary: `<LocalizedText namespace="skeleton" id="loading" defaults={…} />`. */
|
|
8
|
+
export declare function LocalizedText<T extends LabelValues>({ namespace, id, defaults, override, vars, }: {
|
|
9
|
+
namespace: string;
|
|
10
|
+
id: keyof T & string;
|
|
11
|
+
defaults: T;
|
|
12
|
+
override?: Partial<T>;
|
|
13
|
+
vars?: Record<string, unknown>;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
/** A locale-formatted count with an optional cap ("99+"). */
|
|
16
|
+
export declare function LocaleCount({ value, max }: {
|
|
17
|
+
value: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare const chipLabels: {
|
|
21
|
+
remove: string;
|
|
22
|
+
removeGeneric: string;
|
|
23
|
+
};
|
|
24
|
+
export interface ChipRemoveButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "children"> {
|
|
25
|
+
onRemove: () => void;
|
|
26
|
+
/** Text of the chip, used in the accessible name ("Remove Design"). */
|
|
27
|
+
itemLabel?: string;
|
|
28
|
+
/** Full accessible name override. */
|
|
29
|
+
removeLabel?: string;
|
|
30
|
+
/** Label overrides for the `badge` namespace. */
|
|
31
|
+
labels?: Partial<typeof chipLabels>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The remove (×) button of a chip — Badge `onRemove`, Tag input, Combobox multi, Filter bar.
|
|
35
|
+
* Delete / Backspace on the focused button also remove.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ChipRemoveButton: React.ForwardRefExoticComponent<ChipRemoveButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Tiny client islands that let otherwise server-compatible components (Badge, Skeleton, Card)
|
|
5
|
+
* show localized text without becoming client components themselves.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { X } from "lucide-react";
|
|
9
|
+
import { cn } from "./cn.js";
|
|
10
|
+
import { useLabels } from "./labels.js";
|
|
11
|
+
import { useFormat } from "./locale.js";
|
|
12
|
+
/** Renders one label from the dictionary: `<LocalizedText namespace="skeleton" id="loading" defaults={…} />`. */
|
|
13
|
+
export function LocalizedText({ namespace, id, defaults, override, vars, }) {
|
|
14
|
+
const t = useLabels(namespace, defaults, override);
|
|
15
|
+
return _jsx(_Fragment, { children: t(id, vars) });
|
|
16
|
+
}
|
|
17
|
+
/** A locale-formatted count with an optional cap ("99+"). */
|
|
18
|
+
export function LocaleCount({ value, max }) {
|
|
19
|
+
const f = useFormat();
|
|
20
|
+
return _jsx(_Fragment, { children: max === undefined ? f.number(value) : f.count(value, max) });
|
|
21
|
+
}
|
|
22
|
+
const chipLabels = { remove: "Remove {label}", removeGeneric: "Remove" };
|
|
23
|
+
/**
|
|
24
|
+
* The remove (×) button of a chip — Badge `onRemove`, Tag input, Combobox multi, Filter bar.
|
|
25
|
+
* Delete / Backspace on the focused button also remove.
|
|
26
|
+
*/
|
|
27
|
+
export const ChipRemoveButton = React.forwardRef(function ChipRemoveButton({ onRemove, itemLabel, removeLabel, labels, className, onKeyDown, disabled, ...props }, ref) {
|
|
28
|
+
const t = useLabels("badge", chipLabels, labels);
|
|
29
|
+
const name = removeLabel ?? (itemLabel ? t("remove", { label: itemLabel }) : t("removeGeneric"));
|
|
30
|
+
return (_jsx("button", { ref: ref, type: "button", "data-slot": "chip-remove", "aria-label": name, disabled: disabled, className: cn("-me-1 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-current opacity-60 transition-[opacity,background-color]", "hover:bg-[color-mix(in_srgb,currentColor_14%,transparent)] hover:opacity-100 focus-ring disabled:pointer-events-none", "[&_svg]:size-3", className), onClick: (e) => {
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
onRemove();
|
|
33
|
+
}, onKeyDown: (e) => {
|
|
34
|
+
onKeyDown?.(e);
|
|
35
|
+
if (!e.defaultPrevented && (e.key === "Delete" || e.key === "Backspace")) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
onRemove();
|
|
38
|
+
}
|
|
39
|
+
}, ...props, children: _jsx(X, { "aria-hidden": true, strokeWidth: 2.25 }) }));
|
|
40
|
+
});
|