@vamos-ui/react 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/blocks/block-heading.d.ts +29 -0
- package/dist/blocks/block-heading.js +39 -0
- package/dist/blocks/block-image.d.ts +52 -0
- package/dist/blocks/block-image.js +48 -0
- package/dist/blocks/block-link.d.ts +30 -0
- package/dist/blocks/block-link.js +36 -0
- package/dist/blocks/create-blocks.d.ts +54 -0
- package/dist/blocks/create-blocks.js +52 -0
- package/dist/blocks/index.d.ts +55 -0
- package/dist/blocks/index.js +59 -0
- package/dist/blocks/json-ld.d.ts +18 -0
- package/dist/blocks/json-ld.js +44 -0
- package/dist/blocks/labels.d.ts +20 -0
- package/dist/blocks/labels.js +43 -0
- package/dist/blocks/rich-text.d.ts +36 -0
- package/dist/blocks/rich-text.js +106 -0
- package/dist/blocks/schema/define-block.d.ts +151 -0
- package/dist/blocks/schema/define-block.js +120 -0
- package/dist/blocks/schema/emphasis.d.ts +17 -0
- package/dist/blocks/schema/emphasis.js +69 -0
- package/dist/blocks/schema/fields.d.ts +497 -0
- package/dist/blocks/schema/fields.js +240 -0
- package/dist/blocks/schema/icons.d.ts +2 -0
- package/dist/blocks/schema/icons.js +26 -0
- package/dist/blocks/schema/index.d.ts +18 -0
- package/dist/blocks/schema/index.js +21 -0
- package/dist/blocks/schema/lint-types.d.ts +16 -0
- package/dist/blocks/schema/lint-types.js +2 -0
- package/dist/blocks/schema/lint.d.ts +32 -0
- package/dist/blocks/schema/lint.js +164 -0
- package/dist/blocks/schema/localize.d.ts +20 -0
- package/dist/blocks/schema/localize.js +29 -0
- package/dist/blocks/schema/localized.d.ts +25 -0
- package/dist/blocks/schema/localized.js +53 -0
- package/dist/blocks/schema/migrate.d.ts +24 -0
- package/dist/blocks/schema/migrate.js +75 -0
- package/dist/blocks/schema/nodes.d.ts +196 -0
- package/dist/blocks/schema/nodes.js +78 -0
- package/dist/blocks/schema/rich-doc-schema.d.ts +32 -0
- package/dist/blocks/schema/rich-doc-schema.js +66 -0
- package/dist/blocks/schema/rich-doc.d.ts +90 -0
- package/dist/blocks/schema/rich-doc.js +62 -0
- package/dist/blocks/schema/safety.d.ts +20 -0
- package/dist/blocks/schema/safety.js +49 -0
- package/dist/blocks/schema/types.d.ts +172 -0
- package/dist/blocks/schema/types.js +3 -0
- package/dist/blocks/schema/validate.d.ts +17 -0
- package/dist/blocks/schema/validate.js +32 -0
- package/dist/blocks/schema/walk.d.ts +22 -0
- package/dist/blocks/schema/walk.js +60 -0
- package/dist/blocks/section-header.d.ts +38 -0
- package/dist/blocks/section-header.js +22 -0
- package/dist/blocks/section.d.ts +59 -0
- package/dist/blocks/section.js +66 -0
- package/dist/blocks/site/_kit-1.d.ts +100 -0
- package/dist/blocks/site/_kit-1.js +135 -0
- package/dist/blocks/site/_site-icon-1.d.ts +6 -0
- package/dist/blocks/site/_site-icon-1.js +15 -0
- package/dist/blocks/site/announcement-bar.d.ts +42 -0
- package/dist/blocks/site/announcement-bar.js +38 -0
- package/dist/blocks/site/announcement-dismiss.d.ts +18 -0
- package/dist/blocks/site/announcement-dismiss.js +28 -0
- package/dist/blocks/site/article-layout.d.ts +65 -0
- package/dist/blocks/site/article-layout.js +88 -0
- package/dist/blocks/site/blog-list.d.ts +79 -0
- package/dist/blocks/site/blog-list.js +78 -0
- package/dist/blocks/site/comparison-table.d.ts +54 -0
- package/dist/blocks/site/comparison-table.js +38 -0
- package/dist/blocks/site/consent-banner.d.ts +52 -0
- package/dist/blocks/site/consent-banner.js +33 -0
- package/dist/blocks/site/contact-dock.d.ts +52 -0
- package/dist/blocks/site/contact-dock.js +55 -0
- package/dist/blocks/site/contact-form.d.ts +60 -0
- package/dist/blocks/site/contact-form.js +45 -0
- package/dist/blocks/site/cta-booking.d.ts +43 -0
- package/dist/blocks/site/cta-booking.js +69 -0
- package/dist/blocks/site/cta.d.ts +74 -0
- package/dist/blocks/site/cta.js +112 -0
- package/dist/blocks/site/embed-facade.d.ts +20 -0
- package/dist/blocks/site/embed-facade.js +21 -0
- package/dist/blocks/site/faq.d.ts +48 -0
- package/dist/blocks/site/faq.js +51 -0
- package/dist/blocks/site/feature-grid.d.ts +46 -0
- package/dist/blocks/site/feature-grid.js +49 -0
- package/dist/blocks/site/feature-tabs.d.ts +22 -0
- package/dist/blocks/site/feature-tabs.js +11 -0
- package/dist/blocks/site/footer.d.ts +68 -0
- package/dist/blocks/site/footer.js +61 -0
- package/dist/blocks/site/gallery-section.d.ts +42 -0
- package/dist/blocks/site/gallery-section.js +47 -0
- package/dist/blocks/site/hero-video.d.ts +15 -0
- package/dist/blocks/site/hero-video.js +31 -0
- package/dist/blocks/site/hero.d.ts +64 -0
- package/dist/blocks/site/hero.js +67 -0
- package/dist/blocks/site/logo-strip.d.ts +42 -0
- package/dist/blocks/site/logo-strip.js +26 -0
- package/dist/blocks/site/map-hours.d.ts +83 -0
- package/dist/blocks/site/map-hours.js +125 -0
- package/dist/blocks/site/media-text.d.ts +45 -0
- package/dist/blocks/site/media-text.js +55 -0
- package/dist/blocks/site/menu-list.d.ts +74 -0
- package/dist/blocks/site/menu-list.js +84 -0
- package/dist/blocks/site/navbar-submenu.d.ts +18 -0
- package/dist/blocks/site/navbar-submenu.js +51 -0
- package/dist/blocks/site/navbar.d.ts +67 -0
- package/dist/blocks/site/navbar.js +64 -0
- package/dist/blocks/site/not-found.d.ts +40 -0
- package/dist/blocks/site/not-found.js +38 -0
- package/dist/blocks/site/page-intro.d.ts +46 -0
- package/dist/blocks/site/page-intro.js +44 -0
- package/dist/blocks/site/pricing-table.d.ts +67 -0
- package/dist/blocks/site/pricing-table.js +82 -0
- package/dist/blocks/site/process.d.ts +36 -0
- package/dist/blocks/site/process.js +41 -0
- package/dist/blocks/site/registry-1.d.ts +720 -0
- package/dist/blocks/site/registry-1.js +783 -0
- package/dist/blocks/site/registry-2.d.ts +914 -0
- package/dist/blocks/site/registry-2.js +563 -0
- package/dist/blocks/site/rich-text-section.d.ts +34 -0
- package/dist/blocks/site/rich-text-section.js +32 -0
- package/dist/blocks/site/shared/brand-icons.d.ts +21 -0
- package/dist/blocks/site/shared/brand-icons.js +56 -0
- package/dist/blocks/site/shared/consent-gate.d.ts +41 -0
- package/dist/blocks/site/shared/consent-gate.js +43 -0
- package/dist/blocks/site/shared/consent-island.d.ts +38 -0
- package/dist/blocks/site/shared/consent-island.js +63 -0
- package/dist/blocks/site/shared/consent.d.ts +49 -0
- package/dist/blocks/site/shared/consent.js +130 -0
- package/dist/blocks/site/shared/contact-form-island.d.ts +41 -0
- package/dist/blocks/site/shared/contact-form-island.js +100 -0
- package/dist/blocks/site/shared/copy-link.d.ts +10 -0
- package/dist/blocks/site/shared/copy-link.js +25 -0
- package/dist/blocks/site/shared/dock-avoid.d.ts +15 -0
- package/dist/blocks/site/shared/dock-avoid.js +107 -0
- package/dist/blocks/site/shared/dock-hours.d.ts +13 -0
- package/dist/blocks/site/shared/dock-hours.js +25 -0
- package/dist/blocks/site/shared/gallery-lightbox.d.ts +12 -0
- package/dist/blocks/site/shared/gallery-lightbox.js +10 -0
- package/dist/blocks/site/shared/island-keys.d.ts +10 -0
- package/dist/blocks/site/shared/island-keys.js +44 -0
- package/dist/blocks/site/shared/kit-2.d.ts +55 -0
- package/dist/blocks/site/shared/kit-2.js +84 -0
- package/dist/blocks/site/shared/labels-2.d.ts +209 -0
- package/dist/blocks/site/shared/labels-2.js +427 -0
- package/dist/blocks/site/shared/open-now.d.ts +22 -0
- package/dist/blocks/site/shared/open-now.js +27 -0
- package/dist/blocks/site/shared/opening-hours.d.ts +117 -0
- package/dist/blocks/site/shared/opening-hours.js +245 -0
- package/dist/blocks/site/shared/site-accent.d.ts +48 -0
- package/dist/blocks/site/shared/site-accent.js +249 -0
- package/dist/blocks/site/shared/site-form.d.ts +79 -0
- package/dist/blocks/site/shared/site-form.js +111 -0
- package/dist/blocks/site/shared/site-routing.d.ts +54 -0
- package/dist/blocks/site/shared/site-routing.js +86 -0
- package/dist/blocks/site/shared/testimonials-carousel.d.ts +17 -0
- package/dist/blocks/site/shared/testimonials-carousel.js +64 -0
- package/dist/blocks/site/site-shell.d.ts +97 -0
- package/dist/blocks/site/site-shell.js +227 -0
- package/dist/blocks/site/stats-band.d.ts +40 -0
- package/dist/blocks/site/stats-band.js +41 -0
- package/dist/blocks/site/team.d.ts +44 -0
- package/dist/blocks/site/team.js +48 -0
- package/dist/blocks/site/testimonials.d.ts +68 -0
- package/dist/blocks/site/testimonials.js +65 -0
- package/dist/blocks/types.d.ts +63 -0
- package/dist/blocks/types.js +2 -0
- package/dist/business/approval-flow.d.ts +152 -0
- package/dist/business/approval-flow.js +221 -0
- package/dist/business/export-core.d.ts +55 -0
- package/dist/business/export-core.js +101 -0
- package/dist/business/export.d.ts +148 -0
- package/dist/business/export.js +264 -0
- package/dist/business/import-core.d.ts +104 -0
- package/dist/business/import-core.js +281 -0
- package/dist/business/import-wizard.d.ts +186 -0
- package/dist/business/import-wizard.js +401 -0
- package/dist/business/index.d.ts +11 -0
- package/dist/business/index.js +20 -0
- package/dist/business/line-items-core.d.ts +129 -0
- package/dist/business/line-items-core.js +183 -0
- package/dist/business/line-items.d.ts +119 -0
- package/dist/business/line-items.js +299 -0
- package/dist/business/multi-step-form.d.ts +131 -0
- package/dist/business/multi-step-form.js +337 -0
- package/dist/business/permission-core.d.ts +59 -0
- package/dist/business/permission-core.js +99 -0
- package/dist/business/permission-matrix.d.ts +158 -0
- package/dist/business/permission-matrix.js +341 -0
- package/dist/business/setup-checklist.d.ts +80 -0
- package/dist/business/setup-checklist.js +92 -0
- package/dist/charts/area-chart.d.ts +35 -0
- package/dist/charts/area-chart.js +33 -0
- package/dist/charts/bar-chart.d.ts +27 -0
- package/dist/charts/bar-chart.js +42 -0
- package/dist/charts/bar-list.d.ts +47 -0
- package/dist/charts/bar-list.js +60 -0
- package/dist/charts/chart-shell.d.ts +173 -0
- package/dist/charts/chart-shell.js +205 -0
- package/dist/charts/chart.d.ts +73 -0
- package/dist/charts/chart.js +106 -0
- package/dist/charts/combo-chart.d.ts +29 -0
- package/dist/charts/combo-chart.js +47 -0
- package/dist/charts/donut-chart.d.ts +33 -0
- package/dist/charts/donut-chart.js +113 -0
- package/dist/charts/funnel.d.ts +51 -0
- package/dist/charts/funnel.js +69 -0
- package/dist/charts/gauge.d.ts +62 -0
- package/dist/charts/gauge.js +104 -0
- package/dist/charts/heatmap.d.ts +81 -0
- package/dist/charts/heatmap.js +338 -0
- package/dist/charts/index.d.ts +12 -0
- package/dist/charts/index.js +14 -0
- package/dist/charts/line-chart.d.ts +21 -0
- package/dist/charts/line-chart.js +36 -0
- package/dist/charts/test-utils.d.ts +2 -0
- package/dist/charts/test-utils.js +38 -0
- package/dist/charts/utils.d.ts +130 -0
- package/dist/charts/utils.js +262 -0
- package/dist/components/accordion.d.ts +47 -0
- package/dist/components/accordion.js +70 -0
- package/dist/components/activity-timeline.d.ts +149 -0
- package/dist/components/activity-timeline.js +122 -0
- package/dist/components/address-field.d.ts +116 -0
- package/dist/components/address-field.js +219 -0
- package/dist/components/alert-dialog.d.ts +99 -0
- package/dist/components/alert-dialog.js +192 -0
- package/dist/components/alert.d.ts +42 -0
- package/dist/components/alert.js +82 -0
- package/dist/components/app-shell.d.ts +159 -0
- package/dist/components/app-shell.js +289 -0
- package/dist/components/attachment-list.d.ts +96 -0
- package/dist/components/attachment-list.js +196 -0
- package/dist/components/audit-log.d.ts +150 -0
- package/dist/components/audit-log.js +205 -0
- package/dist/components/avatar.d.ts +87 -0
- package/dist/components/avatar.js +126 -0
- package/dist/components/badge.d.ts +41 -0
- package/dist/components/badge.js +68 -0
- package/dist/components/breadcrumb.d.ts +78 -0
- package/dist/components/breadcrumb.js +106 -0
- package/dist/components/button-group.d.ts +52 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button.d.ts +58 -0
- package/dist/components/button.js +107 -0
- package/dist/components/calendar.d.ts +240 -0
- package/dist/components/calendar.js +483 -0
- package/dist/components/card.d.ts +66 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +170 -0
- package/dist/components/carousel.js +348 -0
- package/dist/components/checkbox.d.ts +78 -0
- package/dist/components/checkbox.js +138 -0
- package/dist/components/color-picker.d.ts +112 -0
- package/dist/components/color-picker.js +235 -0
- package/dist/components/combobox.d.ts +136 -0
- package/dist/components/combobox.js +294 -0
- package/dist/components/command.d.ts +275 -0
- package/dist/components/command.js +493 -0
- package/dist/components/comment-thread.d.ts +252 -0
- package/dist/components/comment-thread.js +449 -0
- package/dist/components/context-menu.d.ts +77 -0
- package/dist/components/context-menu.js +82 -0
- package/dist/components/currency-input.d.ts +43 -0
- package/dist/components/currency-input.js +85 -0
- package/dist/components/date-picker.d.ts +141 -0
- package/dist/components/date-picker.js +241 -0
- package/dist/components/date-range-picker.d.ts +91 -0
- package/dist/components/date-range-picker.js +251 -0
- package/dist/components/description-list.d.ts +92 -0
- package/dist/components/description-list.js +42 -0
- package/dist/components/dialog.d.ts +139 -0
- package/dist/components/dialog.js +185 -0
- package/dist/components/dropdown-menu.d.ts +100 -0
- package/dist/components/dropdown-menu.js +102 -0
- package/dist/components/editor-layout.d.ts +166 -0
- package/dist/components/editor-layout.js +237 -0
- package/dist/components/empty-state.d.ts +49 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/entity-card.d.ts +83 -0
- package/dist/components/entity-card.js +92 -0
- package/dist/components/file-upload.d.ts +256 -0
- package/dist/components/file-upload.js +490 -0
- package/dist/components/formatted-input.d.ts +177 -0
- package/dist/components/formatted-input.js +399 -0
- package/dist/components/hierarchy-chart.d.ts +190 -0
- package/dist/components/hierarchy-chart.js +890 -0
- package/dist/components/hover-card.d.ts +21 -0
- package/dist/components/hover-card.js +32 -0
- package/dist/components/iban-input.d.ts +38 -0
- package/dist/components/iban-input.js +112 -0
- package/dist/components/id-input.d.ts +65 -0
- package/dist/components/id-input.js +130 -0
- package/dist/components/image.d.ts +130 -0
- package/dist/components/image.js +168 -0
- package/dist/components/input-otp.d.ts +62 -0
- package/dist/components/input-otp.js +73 -0
- package/dist/components/input.d.ts +141 -0
- package/dist/components/input.js +187 -0
- package/dist/components/item.d.ts +96 -0
- package/dist/components/item.js +113 -0
- package/dist/components/kbd.d.ts +64 -0
- package/dist/components/kbd.js +119 -0
- package/dist/components/list-layout.d.ts +144 -0
- package/dist/components/list-layout.js +210 -0
- package/dist/components/native-select.d.ts +33 -0
- package/dist/components/native-select.js +48 -0
- package/dist/components/navigation-menu.d.ts +127 -0
- package/dist/components/navigation-menu.js +129 -0
- package/dist/components/notification-center.d.ts +164 -0
- package/dist/components/notification-center.js +399 -0
- package/dist/components/page-header.d.ts +60 -0
- package/dist/components/page-header.js +60 -0
- package/dist/components/pagination.d.ts +121 -0
- package/dist/components/pagination.js +174 -0
- package/dist/components/phone-input.d.ts +49 -0
- package/dist/components/phone-input.js +266 -0
- package/dist/components/popover.d.ts +38 -0
- package/dist/components/popover.js +69 -0
- package/dist/components/progress.d.ts +79 -0
- package/dist/components/progress.js +97 -0
- package/dist/components/radio-group.d.ts +43 -0
- package/dist/components/radio-group.js +81 -0
- package/dist/components/record-detail-layout.d.ts +167 -0
- package/dist/components/record-detail-layout.js +233 -0
- package/dist/components/record-picker.d.ts +199 -0
- package/dist/components/record-picker.js +650 -0
- package/dist/components/resizable.d.ts +50 -0
- package/dist/components/resizable.js +88 -0
- package/dist/components/scroll-area.d.ts +40 -0
- package/dist/components/scroll-area.js +56 -0
- package/dist/components/select.d.ts +126 -0
- package/dist/components/select.js +137 -0
- package/dist/components/separator.d.ts +31 -0
- package/dist/components/separator.js +41 -0
- package/dist/components/settings-layout.d.ts +134 -0
- package/dist/components/settings-layout.js +180 -0
- package/dist/components/sheet.d.ts +103 -0
- package/dist/components/sheet.js +165 -0
- package/dist/components/sidebar.d.ts +171 -0
- package/dist/components/sidebar.js +421 -0
- package/dist/components/signature-pad.d.ts +85 -0
- package/dist/components/signature-pad.js +283 -0
- package/dist/components/skeleton.d.ts +64 -0
- package/dist/components/skeleton.js +53 -0
- package/dist/components/slider.d.ts +57 -0
- package/dist/components/slider.js +133 -0
- package/dist/components/slug-input.d.ts +69 -0
- package/dist/components/slug-input.js +201 -0
- package/dist/components/sparkline.d.ts +54 -0
- package/dist/components/sparkline.js +122 -0
- package/dist/components/spinner.d.ts +34 -0
- package/dist/components/spinner.js +34 -0
- package/dist/components/stat.d.ts +135 -0
- package/dist/components/stat.js +130 -0
- package/dist/components/status-picker.d.ts +107 -0
- package/dist/components/status-picker.js +175 -0
- package/dist/components/stepper.d.ts +86 -0
- package/dist/components/stepper.js +103 -0
- package/dist/components/switch.d.ts +34 -0
- package/dist/components/switch.js +70 -0
- package/dist/components/table.d.ts +101 -0
- package/dist/components/table.js +72 -0
- package/dist/components/tabs.d.ts +103 -0
- package/dist/components/tabs.js +173 -0
- package/dist/components/tag-input.d.ts +77 -0
- package/dist/components/tag-input.js +305 -0
- package/dist/components/task-list.d.ts +89 -0
- package/dist/components/task-list.js +238 -0
- package/dist/components/time-picker.d.ts +119 -0
- package/dist/components/time-picker.js +399 -0
- package/dist/components/toast.d.ts +87 -0
- package/dist/components/toast.js +142 -0
- package/dist/components/toggle.d.ts +77 -0
- package/dist/components/toggle.js +109 -0
- package/dist/components/tooltip.d.ts +69 -0
- package/dist/components/tooltip.js +105 -0
- package/dist/components/top-bar.d.ts +87 -0
- package/dist/components/top-bar.js +99 -0
- package/dist/components/tree-select.d.ts +89 -0
- package/dist/components/tree-select.js +243 -0
- package/dist/components/tree-view.d.ts +109 -0
- package/dist/components/tree-view.js +170 -0
- package/dist/components/typography.d.ts +107 -0
- package/dist/components/typography.js +128 -0
- package/dist/components/user-picker.d.ts +89 -0
- package/dist/components/user-picker.js +162 -0
- package/dist/components/version-history.d.ts +191 -0
- package/dist/components/version-history.js +431 -0
- package/dist/data-table/csv.d.ts +27 -0
- package/dist/data-table/csv.js +68 -0
- package/dist/data-table/data-table.d.ts +423 -0
- package/dist/data-table/data-table.js +1259 -0
- package/dist/data-table/filter-bar.d.ts +146 -0
- package/dist/data-table/filter-bar.js +569 -0
- package/dist/data-table/filter-fns.d.ts +65 -0
- package/dist/data-table/filter-fns.js +382 -0
- package/dist/data-table/index.d.ts +8 -0
- package/dist/data-table/index.js +9 -0
- package/dist/data-table/saved-views.d.ts +100 -0
- package/dist/data-table/saved-views.js +251 -0
- package/dist/data-table/types.d.ts +168 -0
- package/dist/data-table/types.js +87 -0
- package/dist/data-table/url-state.d.ts +94 -0
- package/dist/data-table/url-state.js +303 -0
- package/dist/data-table/view-state.d.ts +16 -0
- package/dist/data-table/view-state.js +81 -0
- package/dist/editor/_test-setup.d.ts +1 -0
- package/dist/editor/_test-setup.js +33 -0
- package/dist/editor/block-editor.d.ts +137 -0
- package/dist/editor/block-editor.js +280 -0
- package/dist/editor/commands.d.ts +31 -0
- package/dist/editor/commands.js +150 -0
- package/dist/editor/context.d.ts +108 -0
- package/dist/editor/context.js +30 -0
- package/dist/editor/convert.d.ts +66 -0
- package/dist/editor/convert.js +567 -0
- package/dist/editor/drag-handle.d.ts +10 -0
- package/dist/editor/drag-handle.js +69 -0
- package/dist/editor/extensions.d.ts +34 -0
- package/dist/editor/extensions.js +239 -0
- package/dist/editor/index.d.ts +14 -0
- package/dist/editor/index.js +17 -0
- package/dist/editor/inserter.d.ts +12 -0
- package/dist/editor/inserter.js +88 -0
- package/dist/editor/inspector.d.ts +17 -0
- package/dist/editor/inspector.js +65 -0
- package/dist/editor/items.d.ts +62 -0
- package/dist/editor/items.js +195 -0
- package/dist/editor/labels.d.ts +119 -0
- package/dist/editor/labels.js +130 -0
- package/dist/editor/markdown.d.ts +14 -0
- package/dist/editor/markdown.js +209 -0
- package/dist/editor/menus.d.ts +20 -0
- package/dist/editor/menus.js +236 -0
- package/dist/editor/nodes.d.ts +14 -0
- package/dist/editor/nodes.js +201 -0
- package/dist/editor/outline.d.ts +11 -0
- package/dist/editor/outline.js +52 -0
- package/dist/editor/schema-form.d.ts +64 -0
- package/dist/editor/schema-form.js +290 -0
- package/dist/editor/slash-menu.d.ts +15 -0
- package/dist/editor/slash-menu.js +119 -0
- package/dist/fonts/catalog.d.ts +53 -0
- package/dist/fonts/catalog.js +121 -0
- package/dist/fonts/font-picker.d.ts +70 -0
- package/dist/fonts/font-picker.js +225 -0
- package/dist/fonts/index.d.ts +6 -0
- package/dist/fonts/index.js +7 -0
- package/dist/fonts/loader.d.ts +66 -0
- package/dist/fonts/loader.js +161 -0
- package/dist/fonts/pairing-picker.d.ts +31 -0
- package/dist/fonts/pairing-picker.js +81 -0
- package/dist/fonts/pairings.d.ts +84 -0
- package/dist/fonts/pairings.js +149 -0
- package/dist/fonts/provider.d.ts +34 -0
- package/dist/fonts/provider.js +51 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.js +1 -0
- package/dist/format/core.d.ts +149 -0
- package/dist/format/core.js +357 -0
- package/dist/format/index.d.ts +4 -0
- package/dist/format/index.js +5 -0
- package/dist/format/use-format.d.ts +1 -0
- package/dist/format/use-format.js +3 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +87 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +16 -0
- package/dist/lib/color.d.ts +64 -0
- package/dist/lib/color.js +177 -0
- package/dist/lib/compose-refs.d.ts +24 -0
- package/dist/lib/compose-refs.js +45 -0
- package/dist/lib/data-islands.d.ts +194 -0
- package/dist/lib/data-islands.js +368 -0
- package/dist/lib/date.d.ts +129 -0
- package/dist/lib/date.js +386 -0
- package/dist/lib/field-context.d.ts +64 -0
- package/dist/lib/field-context.js +62 -0
- package/dist/lib/floating-arrow.d.ts +18 -0
- package/dist/lib/floating-arrow.js +15 -0
- package/dist/lib/islands.d.ts +38 -0
- package/dist/lib/islands.js +40 -0
- package/dist/lib/labels.d.ts +51 -0
- package/dist/lib/labels.js +56 -0
- package/dist/lib/layer.d.ts +36 -0
- package/dist/lib/layer.js +42 -0
- package/dist/lib/locale.d.ts +85 -0
- package/dist/lib/locale.js +105 -0
- package/dist/lib/menu.d.ts +58 -0
- package/dist/lib/menu.js +99 -0
- package/dist/lib/message-format.d.ts +20 -0
- package/dist/lib/message-format.js +116 -0
- package/dist/lib/nav.d.ts +132 -0
- package/dist/lib/nav.js +178 -0
- package/dist/lib/provider.d.ts +100 -0
- package/dist/lib/provider.js +105 -0
- package/dist/lib/public.d.ts +22 -0
- package/dist/lib/public.js +33 -0
- package/dist/lib/sr-name.d.ts +18 -0
- package/dist/lib/sr-name.js +17 -0
- package/dist/lib/text.d.ts +100 -0
- package/dist/lib/text.js +233 -0
- package/dist/lib/theme-scope.d.ts +58 -0
- package/dist/lib/theme-scope.js +59 -0
- package/dist/lib/use-async-list.d.ts +60 -0
- package/dist/lib/use-async-list.js +119 -0
- package/dist/lib/use-container-width.d.ts +19 -0
- package/dist/lib/use-container-width.js +39 -0
- package/dist/lib/use-controllable-state.d.ts +33 -0
- package/dist/lib/use-controllable-state.js +56 -0
- package/dist/lib/use-edge-fade.d.ts +13 -0
- package/dist/lib/use-edge-fade.js +43 -0
- package/dist/lib/use-formatted-input.d.ts +69 -0
- package/dist/lib/use-formatted-input.js +152 -0
- package/dist/lib/use-hotkeys.d.ts +80 -0
- package/dist/lib/use-hotkeys.js +221 -0
- package/dist/lib/use-hover-intent.d.ts +44 -0
- package/dist/lib/use-hover-intent.js +119 -0
- package/dist/lib/use-media-query.d.ts +21 -0
- package/dist/lib/use-media-query.js +28 -0
- package/dist/lib/use-reduced-motion.d.ts +8 -0
- package/dist/lib/use-reduced-motion.js +13 -0
- package/dist/lib/use-tree.d.ts +153 -0
- package/dist/lib/use-tree.js +534 -0
- package/dist/lib/value-format.d.ts +25 -0
- package/dist/lib/value-format.js +56 -0
- package/dist/lib/variants.d.ts +131 -0
- package/dist/lib/variants.js +109 -0
- package/dist/locale-data/core/date.d.ts +24 -0
- package/dist/locale-data/core/date.js +68 -0
- package/dist/locale-data/core/decimal.d.ts +19 -0
- package/dist/locale-data/core/decimal.js +79 -0
- package/dist/locale-data/core/holidays.d.ts +30 -0
- package/dist/locale-data/core/holidays.js +79 -0
- package/dist/locale-data/core/iban.d.ts +29 -0
- package/dist/locale-data/core/iban.js +74 -0
- package/dist/locale-data/core/index.d.ts +7 -0
- package/dist/locale-data/core/index.js +6 -0
- package/dist/locale-data/core/types.d.ts +173 -0
- package/dist/locale-data/core/types.js +6 -0
- package/dist/locale-data/core/week-info.d.ts +23 -0
- package/dist/locale-data/core/week-info.js +85 -0
- package/dist/locale-data/core/working-days.d.ts +27 -0
- package/dist/locale-data/core/working-days.js +133 -0
- package/dist/locale-data/index.d.ts +2 -0
- package/dist/locale-data/index.js +4 -0
- package/dist/locale-data/tr/address-tr.json +1 -0
- package/dist/locale-data/tr/address.d.ts +23 -0
- package/dist/locale-data/tr/address.js +52 -0
- package/dist/locale-data/tr/holidays.d.ts +31 -0
- package/dist/locale-data/tr/holidays.js +81 -0
- package/dist/locale-data/tr/iban.d.ts +21 -0
- package/dist/locale-data/tr/iban.js +45 -0
- package/dist/locale-data/tr/id.d.ts +36 -0
- package/dist/locale-data/tr/id.js +120 -0
- package/dist/locale-data/tr/index.d.ts +12 -0
- package/dist/locale-data/tr/index.js +33 -0
- package/dist/locale-data/tr/kdv.d.ts +91 -0
- package/dist/locale-data/tr/kdv.js +222 -0
- package/dist/locales/en.d.ts +2102 -0
- package/dist/locales/en.js +2088 -0
- package/dist/locales/tr.d.ts +2086 -0
- package/dist/locales/tr.js +2087 -0
- package/dist/media/focal-point.d.ts +42 -0
- package/dist/media/focal-point.js +96 -0
- package/dist/media/gallery-layout.d.ts +19 -0
- package/dist/media/gallery-layout.js +61 -0
- package/dist/media/gallery.d.ts +64 -0
- package/dist/media/gallery.js +138 -0
- package/dist/media/image-cropper.d.ts +86 -0
- package/dist/media/image-cropper.js +170 -0
- package/dist/media/image-field.d.ts +115 -0
- package/dist/media/image-field.js +212 -0
- package/dist/media/index.d.ts +19 -0
- package/dist/media/index.js +23 -0
- package/dist/media/lightbox.d.ts +82 -0
- package/dist/media/lightbox.js +171 -0
- package/dist/media/link-preview.d.ts +97 -0
- package/dist/media/link-preview.js +177 -0
- package/dist/media/media-library.d.ts +244 -0
- package/dist/media/media-library.js +776 -0
- package/dist/media/media-picker.d.ts +96 -0
- package/dist/media/media-picker.js +209 -0
- package/dist/media/media-provider.d.ts +23 -0
- package/dist/media/media-provider.js +44 -0
- package/dist/media/media-utils.d.ts +39 -0
- package/dist/media/media-utils.js +145 -0
- package/dist/media/memory-adapter.d.ts +22 -0
- package/dist/media/memory-adapter.js +162 -0
- package/dist/media/rest-adapter.d.ts +90 -0
- package/dist/media/rest-adapter.js +208 -0
- package/dist/media/serp.d.ts +62 -0
- package/dist/media/serp.js +108 -0
- package/dist/media/test-fixtures.d.ts +3 -0
- package/dist/media/test-fixtures.js +37 -0
- package/dist/media/types.d.ts +183 -0
- package/dist/media/types.js +3 -0
- package/dist/media/use-pan-zoom.d.ts +51 -0
- package/dist/media/use-pan-zoom.js +156 -0
- package/dist/media/use-upload-queue.d.ts +64 -0
- package/dist/media/use-upload-queue.js +115 -0
- package/dist/media/video-player.d.ts +135 -0
- package/dist/media/video-player.js +319 -0
- package/dist/next/index.d.ts +42 -0
- package/dist/next/index.js +36 -0
- package/dist/render/block-renderer.d.ts +56 -0
- package/dist/render/block-renderer.js +137 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.js +7 -0
- package/dist/render/prepare.d.ts +61 -0
- package/dist/render/prepare.js +119 -0
- package/dist/scheduler/core/duration.d.ts +83 -0
- package/dist/scheduler/core/duration.js +174 -0
- package/dist/scheduler/core/gantt.d.ts +63 -0
- package/dist/scheduler/core/gantt.js +226 -0
- package/dist/scheduler/core/index.d.ts +6 -0
- package/dist/scheduler/core/index.js +7 -0
- package/dist/scheduler/core/layout.d.ts +97 -0
- package/dist/scheduler/core/layout.js +249 -0
- package/dist/scheduler/core/time-scale.d.ts +89 -0
- package/dist/scheduler/core/time-scale.js +173 -0
- package/dist/scheduler/gantt.d.ts +125 -0
- package/dist/scheduler/gantt.js +532 -0
- package/dist/scheduler/index.d.ts +6 -0
- package/dist/scheduler/index.js +7 -0
- package/dist/scheduler/resource-calendar.d.ts +218 -0
- package/dist/scheduler/resource-calendar.js +661 -0
- package/dist/scheduler/scheduler.d.ts +168 -0
- package/dist/scheduler/scheduler.js +768 -0
- package/dist/scheduler/shared.d.ts +63 -0
- package/dist/scheduler/shared.js +145 -0
- package/dist/scheduler/time-tracker.d.ts +138 -0
- package/dist/scheduler/time-tracker.js +403 -0
- package/dist/sortable/core.d.ts +67 -0
- package/dist/sortable/core.js +167 -0
- package/dist/sortable/index.d.ts +8 -0
- package/dist/sortable/index.js +10 -0
- package/dist/sortable/kanban-core.d.ts +70 -0
- package/dist/sortable/kanban-core.js +67 -0
- package/dist/sortable/kanban.d.ts +147 -0
- package/dist/sortable/kanban.js +472 -0
- package/dist/sortable/sortable-list.d.ts +71 -0
- package/dist/sortable/sortable-list.js +76 -0
- package/dist/sortable/sortable-tree.d.ts +101 -0
- package/dist/sortable/sortable-tree.js +450 -0
- package/dist/sortable/sortable.d.ts +188 -0
- package/dist/sortable/sortable.js +485 -0
- package/dist/sortable/use-pointer-drag.d.ts +75 -0
- package/dist/sortable/use-pointer-drag.js +173 -0
- package/dist/sortable/use-time-scale.d.ts +11 -0
- package/dist/sortable/use-time-scale.js +19 -0
- package/dist/styles/base.css +51 -0
- package/dist/styles/blocks.css +949 -0
- package/dist/styles/calendar.css +642 -0
- package/dist/styles/charts.css +264 -0
- package/dist/styles/data.css +474 -0
- package/dist/styles/editors.css +1022 -0
- package/dist/styles/forms.css +406 -0
- package/dist/styles/media.css +515 -0
- package/dist/styles/navigation.css +293 -0
- package/dist/styles/overlays.css +244 -0
- package/dist/styles.css +742 -0
- package/package.json +156 -4
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
6
|
+
import { useLabels } from "../lib/labels.js";
|
|
7
|
+
import { fontStack, getFont } from "./catalog.js";
|
|
8
|
+
import { loadFontPreviews } from "./loader.js";
|
|
9
|
+
import { fontPairings } from "./pairings.js";
|
|
10
|
+
export const fontPairingPickerLabels = {
|
|
11
|
+
label: "Type pairing",
|
|
12
|
+
headings: "Headings",
|
|
13
|
+
body: "Body",
|
|
14
|
+
code: "Code",
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Pick one of the curated pairings. A WAI-ARIA radio group with a roving tab stop:
|
|
18
|
+
* arrow keys move and select, Home/End jump to the ends.
|
|
19
|
+
*/
|
|
20
|
+
export const FontPairingPicker = React.forwardRef(function FontPairingPicker({ value: valueProp, defaultValue, onValueChange, pairings = fontPairings, layout = "grid", showDescription, loadPreviews = true, disabled, labels, className, onKeyDown, ...props }, ref) {
|
|
21
|
+
const t = useLabels("fontPairingPicker", fontPairingPickerLabels, labels);
|
|
22
|
+
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? null, name: "FontPairingPicker" });
|
|
23
|
+
const refs = React.useRef([]);
|
|
24
|
+
const describe = showDescription ?? layout === "grid";
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
if (!loadPreviews)
|
|
27
|
+
return;
|
|
28
|
+
void loadFontPreviews(pairings.flatMap((p) => [
|
|
29
|
+
{ family: p.heading, weights: [p.display.weight], italics: p.display.em === "italic" },
|
|
30
|
+
{ family: p.body, weights: [400] },
|
|
31
|
+
]));
|
|
32
|
+
}, [loadPreviews, pairings]);
|
|
33
|
+
const selectedIndex = pairings.findIndex((p) => p.id === value);
|
|
34
|
+
const tabIndexOf = (i) => (selectedIndex === -1 ? (i === 0 ? 0 : -1) : i === selectedIndex ? 0 : -1);
|
|
35
|
+
const choose = (i, focus = false) => {
|
|
36
|
+
const p = pairings[i];
|
|
37
|
+
if (!p || disabled)
|
|
38
|
+
return;
|
|
39
|
+
if (focus)
|
|
40
|
+
refs.current[i]?.focus();
|
|
41
|
+
if (p.id !== value) {
|
|
42
|
+
setValue(p.id);
|
|
43
|
+
onValueChange?.(p.id, p);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const handleKey = (e) => {
|
|
47
|
+
onKeyDown?.(e);
|
|
48
|
+
if (e.defaultPrevented)
|
|
49
|
+
return;
|
|
50
|
+
const current = refs.current.findIndex((el) => el === document.activeElement);
|
|
51
|
+
if (current === -1)
|
|
52
|
+
return;
|
|
53
|
+
const rtl = getComputedStyle(e.currentTarget).direction === "rtl";
|
|
54
|
+
const last = pairings.length - 1;
|
|
55
|
+
let next = null;
|
|
56
|
+
if (e.key === "ArrowDown" || e.key === (rtl ? "ArrowLeft" : "ArrowRight"))
|
|
57
|
+
next = current === last ? 0 : current + 1;
|
|
58
|
+
else if (e.key === "ArrowUp" || e.key === (rtl ? "ArrowRight" : "ArrowLeft"))
|
|
59
|
+
next = current === 0 ? last : current - 1;
|
|
60
|
+
else if (e.key === "Home")
|
|
61
|
+
next = 0;
|
|
62
|
+
else if (e.key === "End")
|
|
63
|
+
next = last;
|
|
64
|
+
if (next !== null) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
choose(next, true);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return (_jsx("div", { ref: ref, role: "radiogroup", "aria-label": props["aria-labelledby"] ? undefined : t("label"), "aria-disabled": disabled || undefined, "data-slot": "font-pairing-picker", "data-layout": layout, onKeyDown: handleKey, className: cn(layout === "grid" ? "grid grid-cols-[repeat(auto-fill,minmax(13.5rem,1fr))] gap-2" : "grid gap-0.5", className), ...props, children: pairings.map((p, i) => {
|
|
70
|
+
const checked = p.id === value;
|
|
71
|
+
const heading = { fontFamily: fontStack(p.heading), fontWeight: p.display.weight, letterSpacing: p.display.tracking };
|
|
72
|
+
const body = { fontFamily: fontStack(p.body) };
|
|
73
|
+
const hName = getFont(p.heading)?.family ?? "System UI";
|
|
74
|
+
const bName = getFont(p.body)?.family ?? "System UI";
|
|
75
|
+
return (_jsx("button", { ref: (el) => {
|
|
76
|
+
refs.current[i] = el;
|
|
77
|
+
}, type: "button", role: "radio", "aria-checked": checked, "aria-label": `${p.label}: ${hName} / ${bName}`, tabIndex: tabIndexOf(i), disabled: disabled, "data-state": checked ? "checked" : "unchecked", onClick: () => choose(i), className: cn("group/pair relative text-start outline-none transition-[border-color,background-color,box-shadow] duration-150 focus-ring disabled:cursor-not-allowed disabled:opacity-50", layout === "grid"
|
|
78
|
+
? "grid min-h-32 content-between gap-3 rounded-ui border border-line bg-surface-2 p-3.5 hover:border-field-border-hover data-[state=checked]:border-fg/70 data-[state=checked]:bg-surface data-[state=checked]:shadow-[inset_0_0_0_1px_var(--fg)]"
|
|
79
|
+
: "grid grid-cols-[2.75rem_minmax(0,1fr)] items-center gap-3 rounded-ui-sm px-2 py-1.5 hover:bg-hover data-[state=checked]:bg-selected"), children: layout === "grid" ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "flex items-start justify-between gap-2", children: [_jsxs("span", { "aria-hidden": true, className: "text-[44px] leading-[0.9] text-fg", style: heading, children: ["A", _jsx("em", { style: { fontStyle: p.display.em }, children: "g" })] }), _jsx("span", { "aria-hidden": true, className: cn("mt-1 size-2 rounded-full border border-field-border transition-colors", checked && "border-transparent bg-accent shadow-[0_0_0_3px_var(--accent-soft)]") })] }), _jsxs("span", { className: "grid gap-1", children: [_jsxs("span", { className: "flex items-baseline justify-between gap-2", children: [_jsx("span", { className: "text-[13.5px] font-semibold text-fg", children: p.label }), _jsx("span", { className: "truncate font-mono text-[10.5px] text-fg-subtle", children: p.id })] }), _jsxs("span", { "aria-hidden": true, className: "truncate text-[12px] text-fg-muted", children: [_jsx("span", { style: heading, children: hName }), _jsx("span", { className: "px-1 text-fg-subtle", children: "/" }), _jsx("span", { style: body, children: bName })] }), describe ? _jsx("span", { className: "line-clamp-2 text-[11.5px] leading-snug text-fg-subtle", children: p.description }) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "grid h-9 place-items-center rounded-ui-sm border border-line bg-surface-2 text-[22px] leading-none text-fg", style: heading, children: "Ag" }), _jsxs("span", { className: "grid min-w-0", children: [_jsxs("span", { className: "flex items-baseline justify-between gap-2", children: [_jsx("span", { className: "text-[13px] font-medium text-fg", children: p.label }), checked ? _jsx("span", { "aria-hidden": true, className: "size-1.5 shrink-0 rounded-full bg-accent shadow-[0_0_0_3px_var(--accent-soft)]" }) : null] }), _jsxs("span", { "aria-hidden": true, className: "truncate text-[11.5px] text-fg-muted", children: [_jsx("span", { style: heading, children: hName }), _jsx("span", { className: "px-1 text-fg-subtle", children: "/" }), _jsx("span", { style: body, children: bName })] }), describe ? _jsx("span", { className: "truncate text-[11px] text-fg-subtle", children: p.description }) : null] })] })) }, p.id));
|
|
80
|
+
}) }));
|
|
81
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { googleFontsUrl, type FontRequest, type LoadGoogleFontsOptions } from "./loader.js";
|
|
2
|
+
export interface FontDisplayTokens {
|
|
3
|
+
/** `--display-weight`: weight of display headings. */
|
|
4
|
+
weight: number;
|
|
5
|
+
/** `--display-tracking`, e.g. `"-0.02em"`. */
|
|
6
|
+
tracking: string;
|
|
7
|
+
/** `--display-em`: how `<em>` inside a display heading looks. */
|
|
8
|
+
em: "italic" | "normal";
|
|
9
|
+
/** `--display-scale`: multiplier on the display sizes (wide faces want < 1). */
|
|
10
|
+
scale: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FontPairing {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
/** One line: the mood and where it fits. */
|
|
16
|
+
description: string;
|
|
17
|
+
/** Heading family (catalog name) or a raw CSS stack. */
|
|
18
|
+
heading: string;
|
|
19
|
+
/** UI / body family. */
|
|
20
|
+
body: string;
|
|
21
|
+
/** Code, IDs and numbers. */
|
|
22
|
+
mono: string;
|
|
23
|
+
display: FontDisplayTokens;
|
|
24
|
+
/** The preset also exists as a `[data-font="<id>"]` block in styles.css. */
|
|
25
|
+
css?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** 16 curated pairings. The first four match the `data-font` presets in styles.css (same ids). */
|
|
28
|
+
export declare const fontPairings: FontPairing[];
|
|
29
|
+
/** Find a pairing by id. */
|
|
30
|
+
export declare function getFontPairing(id: string, pairings?: FontPairing[]): FontPairing | undefined;
|
|
31
|
+
/** Display tokens that suit a heading family (used for custom pairings). */
|
|
32
|
+
export declare function displayTokensFor(heading: string): FontDisplayTokens;
|
|
33
|
+
/** Build a pairing from any three families; display tokens follow the heading family. */
|
|
34
|
+
export declare function createFontPairing(input: {
|
|
35
|
+
heading: string;
|
|
36
|
+
body: string;
|
|
37
|
+
mono?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
label?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
display?: Partial<FontDisplayTokens>;
|
|
42
|
+
}): FontPairing;
|
|
43
|
+
/** The Google Fonts families a pairing needs (skips raw CSS stacks). */
|
|
44
|
+
export declare function pairingFamilies(pairing: FontPairing): FontRequest[];
|
|
45
|
+
/** Stylesheet URL for a pairing, or `null` when it needs no web fonts (System). */
|
|
46
|
+
export declare function pairingUrl(pairing: FontPairing, options?: Parameters<typeof googleFontsUrl>[1]): string | null;
|
|
47
|
+
export declare const FONT_PAIRING_VARS: readonly ["--font-ui", "--font-heading", "--font-code", "--display-weight", "--display-tracking", "--display-em", "--display-scale"];
|
|
48
|
+
/** The CSS custom properties a pairing sets, ready for `style` or `setProperty`. */
|
|
49
|
+
export declare function pairingVars(pairing: FontPairing): Record<(typeof FONT_PAIRING_VARS)[number], string>;
|
|
50
|
+
export interface ApplyFontPairingOptions extends LoadGoogleFontsOptions {
|
|
51
|
+
/** Inject the Google Fonts stylesheet. Default `true`. */
|
|
52
|
+
load?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Applies a pairing to an element: sets `data-font`, the three family tokens and the display tokens
|
|
56
|
+
* as inline custom properties, and (by default) loads the families from Google Fonts.
|
|
57
|
+
* Resolves when the stylesheet has loaded.
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyFontPairing(el: HTMLElement, pairing: FontPairing, options?: ApplyFontPairingOptions): Promise<void>;
|
|
60
|
+
/** Removes the inline pairing tokens so the `[data-font]` CSS preset (if any) applies again. */
|
|
61
|
+
export declare function clearFontPairing(el: HTMLElement): void;
|
|
62
|
+
/** A pairing resolved for storage (localStorage, cookies): a boot script can apply it without the catalog. */
|
|
63
|
+
export interface StoredFontPairing {
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
heading: string;
|
|
67
|
+
body: string;
|
|
68
|
+
mono: string;
|
|
69
|
+
display: FontDisplayTokens;
|
|
70
|
+
css?: boolean;
|
|
71
|
+
/** Google Fonts stylesheet, `null` when none is needed. */
|
|
72
|
+
href: string | null;
|
|
73
|
+
/** Dedupe key of the stylesheet (lets `loadGoogleFonts` skip what the boot script loaded). */
|
|
74
|
+
key: string;
|
|
75
|
+
vars: Record<string, string>;
|
|
76
|
+
}
|
|
77
|
+
export declare function serializeFontPairing(pairing: FontPairing): StoredFontPairing;
|
|
78
|
+
/** Reads a stored pairing back (validates the shape; unknown input returns `undefined`). */
|
|
79
|
+
export declare function parseFontPairing(value: unknown): FontPairing | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Inline boot script (string) that applies a stored pairing before first paint. Put it in `<head>`.
|
|
82
|
+
* It reads `localStorage[storageKey][field]` (a `StoredFontPairing`).
|
|
83
|
+
*/
|
|
84
|
+
export declare function fontBootScript(storageKey?: string, field?: string): string;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Curated type pairings (heading + body + mono + display character) and the helpers that apply them.
|
|
2
|
+
import { fontStack, getFont } from "./catalog.js";
|
|
3
|
+
import { familySpec, googleFontsUrl, loadGoogleFonts } from "./loader.js";
|
|
4
|
+
const SYSTEM_SANS = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
5
|
+
const SYSTEM_MONO = 'ui-monospace, "SF Mono", Menlo, Consolas, monospace';
|
|
6
|
+
const d = (weight, tracking, em, scale) => ({ weight, tracking, em, scale });
|
|
7
|
+
/** 16 curated pairings. The first four match the `data-font` presets in styles.css (same ids). */
|
|
8
|
+
export const fontPairings = [
|
|
9
|
+
{ id: "editorial", label: "Editorial", description: "Condensed serif headlines over a warm sans. The house style.", heading: "Instrument Serif", body: "Onest", mono: "JetBrains Mono", display: d(400, "-0.01em", "italic", 1), css: true },
|
|
10
|
+
{ id: "grotesk", label: "Grotesk", description: "Expressive grotesque headlines; neutral text. Product and agency sites.", heading: "Bricolage Grotesque", body: "Hanken Grotesk", mono: "Geist Mono", display: d(640, "-0.035em", "normal", 0.86), css: true },
|
|
11
|
+
{ id: "corporate", label: "Corporate", description: "One engineered superfamily. B2B, finance, internal tools.", heading: "IBM Plex Sans", body: "IBM Plex Sans", mono: "IBM Plex Mono", display: d(600, "-0.025em", "normal", 0.8), css: true },
|
|
12
|
+
{ id: "system", label: "System", description: "The platform UI font. Zero downloads.", heading: SYSTEM_SANS, body: SYSTEM_SANS, mono: SYSTEM_MONO, display: d(650, "-0.03em", "normal", 0.8), css: true },
|
|
13
|
+
{ id: "newsroom", label: "Newsroom", description: "Optical-size text serif headlines with a calm sans. Blogs and magazines.", heading: "Newsreader", body: "Source Sans 3", mono: "IBM Plex Mono", display: d(500, "-0.02em", "italic", 0.94) },
|
|
14
|
+
{ id: "product", label: "Product", description: "Tight Swiss-style grotesk throughout. Developer tools and dashboards.", heading: "Geist", body: "Geist", mono: "Geist Mono", display: d(600, "-0.045em", "normal", 0.82) },
|
|
15
|
+
{ id: "fintech", label: "Fintech", description: "Wide geometric headlines, compact text, clear numerals. Banking and SaaS.", heading: "Sora", body: "Manrope", mono: "JetBrains Mono", display: d(600, "-0.035em", "normal", 0.8) },
|
|
16
|
+
{ id: "boutique", label: "Boutique", description: "Soft, wonky serif over a friendly sans. Spas, food and hospitality.", heading: "Fraunces", body: "Figtree", mono: "DM Mono", display: d(420, "-0.02em", "italic", 0.92) },
|
|
17
|
+
{ id: "luxe", label: "Luxe", description: "Razor-thin Didone with an airy geometric. Fashion and beauty.", heading: "Bodoni Moda", body: "Urbanist", mono: "DM Mono", display: d(500, "-0.015em", "italic", 0.96) },
|
|
18
|
+
{ id: "magazine", label: "Magazine", description: "High-contrast display serif over its sans sibling. Features and lookbooks.", heading: "DM Serif Display", body: "DM Sans", mono: "DM Mono", display: d(400, "-0.015em", "italic", 0.94) },
|
|
19
|
+
{ id: "studio", label: "Studio", description: "Extended avant-garde headlines, precise text, retro mono. Art and culture.", heading: "Syne", body: "Instrument Sans", mono: "Space Mono", display: d(700, "-0.03em", "normal", 0.8) },
|
|
20
|
+
{ id: "bistro", label: "Bistro", description: "Chunky warm serif with a modern sans. Cafes, bakeries, restaurants.", heading: "Young Serif", body: "Plus Jakarta Sans", mono: "JetBrains Mono", display: d(400, "-0.02em", "normal", 0.9) },
|
|
21
|
+
{ id: "friendly", label: "Friendly", description: "Rounded throughout. Education, health and consumer apps.", heading: "Fredoka", body: "Nunito", mono: "DM Mono", display: d(600, "-0.02em", "normal", 0.86) },
|
|
22
|
+
{ id: "poster", label: "Poster", description: "Condensed sports-poster headlines over a sturdy grotesk. Events and transport.", heading: "Barlow Condensed", body: "Archivo", mono: "Martian Mono", display: d(700, "-0.005em", "normal", 1.08) },
|
|
23
|
+
{ id: "bookish", label: "Bookish", description: "Classic Garamond headings with a screen-reading serif. Long reads and archives.", heading: "EB Garamond", body: "Literata", mono: "Fira Code", display: d(500, "-0.01em", "italic", 0.96) },
|
|
24
|
+
{ id: "civic", label: "Civic", description: "Open, sturdy and neutral. Public sector, HR and non-profits.", heading: "Commissioner", body: "Commissioner", mono: "IBM Plex Mono", display: d(620, "-0.025em", "normal", 0.82) },
|
|
25
|
+
];
|
|
26
|
+
/** Find a pairing by id. */
|
|
27
|
+
export function getFontPairing(id, pairings = fontPairings) {
|
|
28
|
+
return pairings.find((p) => p.id === id);
|
|
29
|
+
}
|
|
30
|
+
/** Display tokens that suit a heading family (used for custom pairings). */
|
|
31
|
+
export function displayTokensFor(heading) {
|
|
32
|
+
const f = getFont(heading);
|
|
33
|
+
if (!f)
|
|
34
|
+
return d(650, "-0.03em", "normal", 0.8);
|
|
35
|
+
const w = (target) => clampWeight(f, target);
|
|
36
|
+
switch (f.category) {
|
|
37
|
+
case "serif":
|
|
38
|
+
return f.style === "display" ? d(w(400), "-0.01em", "italic", 0.96) : d(w(500), "-0.02em", "italic", 0.94);
|
|
39
|
+
case "condensed":
|
|
40
|
+
return d(w(700), "-0.005em", "normal", 1.06);
|
|
41
|
+
case "display":
|
|
42
|
+
return d(w(700), "-0.03em", "normal", 0.78);
|
|
43
|
+
case "rounded":
|
|
44
|
+
return d(w(600), "-0.02em", "normal", 0.86);
|
|
45
|
+
case "handwriting":
|
|
46
|
+
return d(w(600), "0em", "normal", 1);
|
|
47
|
+
case "mono":
|
|
48
|
+
return d(w(600), "-0.04em", "normal", 0.74);
|
|
49
|
+
default:
|
|
50
|
+
return d(w(620), "-0.035em", "normal", 0.84);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function clampWeight(f, target) {
|
|
54
|
+
const axis = f.axes.find((a) => a.tag === "wght");
|
|
55
|
+
if (axis)
|
|
56
|
+
return Math.min(axis.max, Math.max(axis.min, target));
|
|
57
|
+
return f.weights.reduce((best, x) => (Math.abs(x - target) < Math.abs(best - target) ? x : best), f.weights[0] ?? 400);
|
|
58
|
+
}
|
|
59
|
+
/** Build a pairing from any three families; display tokens follow the heading family. */
|
|
60
|
+
export function createFontPairing(input) {
|
|
61
|
+
return {
|
|
62
|
+
id: input.id ?? "custom",
|
|
63
|
+
label: input.label ?? "Custom",
|
|
64
|
+
description: input.description ?? `${input.heading} · ${input.body}`,
|
|
65
|
+
heading: input.heading,
|
|
66
|
+
body: input.body,
|
|
67
|
+
mono: input.mono ?? "JetBrains Mono",
|
|
68
|
+
display: { ...displayTokensFor(input.heading), ...input.display },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** The Google Fonts families a pairing needs (skips raw CSS stacks). */
|
|
72
|
+
export function pairingFamilies(pairing) {
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const fam of [pairing.heading, pairing.body, pairing.mono]) {
|
|
75
|
+
const f = getFont(fam);
|
|
76
|
+
if (f && !out.some((r) => r.family === f.family))
|
|
77
|
+
out.push({ family: f.family });
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
/** Stylesheet URL for a pairing, or `null` when it needs no web fonts (System). */
|
|
82
|
+
export function pairingUrl(pairing, options) {
|
|
83
|
+
const fams = pairingFamilies(pairing);
|
|
84
|
+
return fams.length ? googleFontsUrl(fams, options) : null;
|
|
85
|
+
}
|
|
86
|
+
export const FONT_PAIRING_VARS = ["--font-ui", "--font-heading", "--font-code", "--display-weight", "--display-tracking", "--display-em", "--display-scale"];
|
|
87
|
+
/** The CSS custom properties a pairing sets, ready for `style` or `setProperty`. */
|
|
88
|
+
export function pairingVars(pairing) {
|
|
89
|
+
return {
|
|
90
|
+
"--font-ui": fontStack(pairing.body),
|
|
91
|
+
"--font-heading": fontStack(pairing.heading),
|
|
92
|
+
"--font-code": fontStack(pairing.mono),
|
|
93
|
+
"--display-weight": String(pairing.display.weight),
|
|
94
|
+
"--display-tracking": pairing.display.tracking,
|
|
95
|
+
"--display-em": pairing.display.em,
|
|
96
|
+
"--display-scale": String(pairing.display.scale),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Applies a pairing to an element: sets `data-font`, the three family tokens and the display tokens
|
|
101
|
+
* as inline custom properties, and (by default) loads the families from Google Fonts.
|
|
102
|
+
* Resolves when the stylesheet has loaded.
|
|
103
|
+
*/
|
|
104
|
+
export function applyFontPairing(el, pairing, options = {}) {
|
|
105
|
+
const { load = true, ...loadOptions } = options;
|
|
106
|
+
el.dataset.font = pairing.id;
|
|
107
|
+
const vars = pairingVars(pairing);
|
|
108
|
+
for (const k of FONT_PAIRING_VARS)
|
|
109
|
+
el.style.setProperty(k, vars[k]);
|
|
110
|
+
return load ? loadGoogleFonts(pairingFamilies(pairing), { document: el.ownerDocument, ...loadOptions }) : Promise.resolve();
|
|
111
|
+
}
|
|
112
|
+
/** Removes the inline pairing tokens so the `[data-font]` CSS preset (if any) applies again. */
|
|
113
|
+
export function clearFontPairing(el) {
|
|
114
|
+
for (const k of FONT_PAIRING_VARS)
|
|
115
|
+
el.style.removeProperty(k);
|
|
116
|
+
}
|
|
117
|
+
export function serializeFontPairing(pairing) {
|
|
118
|
+
return {
|
|
119
|
+
id: pairing.id,
|
|
120
|
+
label: pairing.label,
|
|
121
|
+
heading: pairing.heading,
|
|
122
|
+
body: pairing.body,
|
|
123
|
+
mono: pairing.mono,
|
|
124
|
+
display: pairing.display,
|
|
125
|
+
css: pairing.css,
|
|
126
|
+
href: pairingUrl(pairing),
|
|
127
|
+
key: pairingFamilies(pairing).map((f) => familySpec(f)).join("|"),
|
|
128
|
+
vars: pairingVars(pairing),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/** Reads a stored pairing back (validates the shape; unknown input returns `undefined`). */
|
|
132
|
+
export function parseFontPairing(value) {
|
|
133
|
+
if (!value || typeof value !== "object")
|
|
134
|
+
return undefined;
|
|
135
|
+
const v = value;
|
|
136
|
+
if (typeof v.id !== "string" || typeof v.heading !== "string" || typeof v.body !== "string")
|
|
137
|
+
return undefined;
|
|
138
|
+
const preset = getFontPairing(v.id);
|
|
139
|
+
if (preset && preset.heading === v.heading && preset.body === v.body && preset.mono === v.mono)
|
|
140
|
+
return preset;
|
|
141
|
+
return createFontPairing({ id: v.id, label: v.label ?? "Custom", heading: v.heading, body: v.body, mono: typeof v.mono === "string" ? v.mono : undefined, display: v.display });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Inline boot script (string) that applies a stored pairing before first paint. Put it in `<head>`.
|
|
145
|
+
* It reads `localStorage[storageKey][field]` (a `StoredFontPairing`).
|
|
146
|
+
*/
|
|
147
|
+
export function fontBootScript(storageKey = "vamos-theme", field = "fontPairing") {
|
|
148
|
+
return `try{var s=JSON.parse(localStorage.getItem(${JSON.stringify(storageKey)})||"{}"),p=s[${JSON.stringify(field)}],h=document.documentElement;if(p&&p.id){h.dataset.font=p.id;if(!p.css&&p.vars){for(var k in p.vars)h.style.setProperty(k,p.vars[k]);if(p.href){["https://fonts.googleapis.com","https://fonts.gstatic.com"].forEach(function(o,i){var c=document.createElement("link");c.rel="preconnect";c.href=o;if(i)c.crossOrigin="anonymous";document.head.appendChild(c)});var l=document.createElement("link");l.rel="stylesheet";l.href=p.href;l.setAttribute("blocking","render");l.setAttribute("data-vamos-fonts",p.key||"");l.setAttribute("data-variant","swap||1");document.head.appendChild(l)}}}}catch(e){}`;
|
|
149
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type FontPairing } from "./pairings.js";
|
|
3
|
+
export interface FontPairingContextValue {
|
|
4
|
+
pairing: FontPairing;
|
|
5
|
+
setPairing: (pairing: FontPairing | string) => void;
|
|
6
|
+
pairings: FontPairing[];
|
|
7
|
+
}
|
|
8
|
+
/** The active pairing and a setter. Outside a `FontProvider` it returns the Editorial preset and a no-op setter. */
|
|
9
|
+
export declare function useFontPairing(): FontPairingContextValue;
|
|
10
|
+
export interface FontProviderProps {
|
|
11
|
+
/** Controlled pairing (object or preset id). */
|
|
12
|
+
pairing?: FontPairing | string;
|
|
13
|
+
defaultPairing?: FontPairing | string;
|
|
14
|
+
onPairingChange?: (pairing: FontPairing) => void;
|
|
15
|
+
/** Presets offered to `useFontPairing().pairings` and resolvable by id. Default: the 16 built-ins. */
|
|
16
|
+
pairings?: FontPairing[];
|
|
17
|
+
/**
|
|
18
|
+
* `"element"` (default) renders a wrapper `<div>` carrying the tokens, so only its subtree changes;
|
|
19
|
+
* `"document"` applies the pairing to `<html>`.
|
|
20
|
+
*/
|
|
21
|
+
scope?: "element" | "document";
|
|
22
|
+
/** Load the families from Google Fonts. Default `true`. Turn off when you self-host. */
|
|
23
|
+
load?: boolean;
|
|
24
|
+
className?: string;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Applies a type pairing to its subtree (or the document) and shares it through `useFontPairing()`.
|
|
29
|
+
*
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <FontProvider defaultPairing="boutique"><SitePreview /></FontProvider>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function FontProvider({ pairing: pairingProp, defaultPairing, onPairingChange, pairings, scope, load, className, children }: FontProviderProps): React.JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { useControllableState, useIsomorphicLayoutEffect } from "../lib/use-controllable-state.js";
|
|
6
|
+
import { applyFontPairing, clearFontPairing, fontPairings, getFontPairing, pairingFamilies, pairingVars } from "./pairings.js";
|
|
7
|
+
import { loadGoogleFonts } from "./loader.js";
|
|
8
|
+
const FontPairingContext = React.createContext(null);
|
|
9
|
+
/** The active pairing and a setter. Outside a `FontProvider` it returns the Editorial preset and a no-op setter. */
|
|
10
|
+
export function useFontPairing() {
|
|
11
|
+
return React.useContext(FontPairingContext) ?? { pairing: fontPairings[0], setPairing: () => { }, pairings: fontPairings };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Applies a type pairing to its subtree (or the document) and shares it through `useFontPairing()`.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <FontProvider defaultPairing="boutique"><SitePreview /></FontProvider>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function FontProvider({ pairing: pairingProp, defaultPairing = "editorial", onPairingChange, pairings = fontPairings, scope = "element", load = true, className, children }) {
|
|
21
|
+
const resolve = React.useCallback((p) => (typeof p === "string" ? getFontPairing(p, pairings) : p), [pairings]);
|
|
22
|
+
const [pairing, setPairingState] = useControllableState({
|
|
23
|
+
value: resolve(pairingProp),
|
|
24
|
+
defaultValue: resolve(defaultPairing) ?? pairings[0],
|
|
25
|
+
onChange: onPairingChange,
|
|
26
|
+
});
|
|
27
|
+
const active = pairing ?? pairings[0];
|
|
28
|
+
const setPairing = React.useCallback((p) => {
|
|
29
|
+
const next = resolve(p);
|
|
30
|
+
if (next)
|
|
31
|
+
setPairingState(next);
|
|
32
|
+
}, [resolve, setPairingState]);
|
|
33
|
+
useIsomorphicLayoutEffect(() => {
|
|
34
|
+
if (scope !== "document" || typeof document === "undefined")
|
|
35
|
+
return;
|
|
36
|
+
const el = document.documentElement;
|
|
37
|
+
const prevFont = el.dataset.font;
|
|
38
|
+
void applyFontPairing(el, active, { load });
|
|
39
|
+
return () => {
|
|
40
|
+
clearFontPairing(el);
|
|
41
|
+
if (prevFont)
|
|
42
|
+
el.dataset.font = prevFont;
|
|
43
|
+
};
|
|
44
|
+
}, [scope, active, load]);
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (scope === "element" && load)
|
|
47
|
+
void loadGoogleFonts(pairingFamilies(active));
|
|
48
|
+
}, [scope, active, load]);
|
|
49
|
+
const value = React.useMemo(() => ({ pairing: active, setPairing, pairings }), [active, setPairing, pairings]);
|
|
50
|
+
return (_jsx(FontPairingContext.Provider, { value: value, children: scope === "element" ? (_jsx("div", { "data-font": active.id, "data-slot": "font-provider", style: pairingVars(active), className: cn("font-sans", className), children: children })) : (children) }));
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vamos-ui/react/format — React-free formatting core. Works in server components, route
|
|
3
|
+
* handlers and the browser. Every formatter goes through cached `Intl.*` instances.
|
|
4
|
+
*
|
|
5
|
+
* Value rules (X11): a date-only value is a `"YYYY-MM-DD"` string (formatted as a calendar
|
|
6
|
+
* date, never shifted by a time zone); money is a decimal string (`"1250.50"`) or a number;
|
|
7
|
+
* the time zone is always explicit (default `"UTC"`, so server and client agree).
|
|
8
|
+
*/
|
|
9
|
+
export type DateInput = Date | number | string;
|
|
10
|
+
export type NumericInput = number | bigint | string;
|
|
11
|
+
export interface FormatterOptions {
|
|
12
|
+
/** ISO 4217 code used by `currency()` when none is passed. Default `"USD"`. */
|
|
13
|
+
currency?: string;
|
|
14
|
+
/** IANA time zone for instants. Default `"UTC"`. Date-only strings ignore it. */
|
|
15
|
+
timeZone?: string;
|
|
16
|
+
}
|
|
17
|
+
export type DatePreset = "short" | "medium" | "long" | "full" | "datetime" | "datetime-short" | "datetime-seconds" | "month-year" | "weekday";
|
|
18
|
+
export type DurationStyle = "narrow" | "short" | "long";
|
|
19
|
+
export interface CurrencyOptions extends Intl.NumberFormatOptions {
|
|
20
|
+
currency?: string;
|
|
21
|
+
/** `"symbol"` (default) | `"narrowSymbol"` | `"code"` | `"name"`. */
|
|
22
|
+
display?: Intl.NumberFormatOptions["currencyDisplay"];
|
|
23
|
+
}
|
|
24
|
+
export interface BytesOptions {
|
|
25
|
+
/** Default 1. */
|
|
26
|
+
maximumFractionDigits?: number;
|
|
27
|
+
/** Use 1024 steps. Default `false` (1000, SI — what file managers show). */
|
|
28
|
+
binary?: boolean;
|
|
29
|
+
unitDisplay?: "short" | "long" | "narrow";
|
|
30
|
+
}
|
|
31
|
+
export interface DurationOptions {
|
|
32
|
+
/** Unit of the input. Default `"s"`. */
|
|
33
|
+
unit?: "ms" | "s" | "min" | "h";
|
|
34
|
+
/** Default: `"narrow"` for English ("2m 47s"), `"short"` elsewhere ("2 dk. 47 sn."). */
|
|
35
|
+
style?: DurationStyle;
|
|
36
|
+
/** Max number of parts, largest first. Default 2 ("1h 5m", not "1h 5m 12s"). */
|
|
37
|
+
maxParts?: number;
|
|
38
|
+
/** Smallest unit shown. Default `"s"`. */
|
|
39
|
+
smallest?: "d" | "h" | "min" | "s";
|
|
40
|
+
}
|
|
41
|
+
export interface RelativeOptions {
|
|
42
|
+
/** Reference time. Default `Date.now()`. */
|
|
43
|
+
now?: DateInput;
|
|
44
|
+
style?: Intl.RelativeTimeFormatStyle;
|
|
45
|
+
/** `"auto"` (default) gives "yesterday"/"dün"; `"always"` gives "1 day ago". */
|
|
46
|
+
numeric?: Intl.RelativeTimeFormatNumeric;
|
|
47
|
+
}
|
|
48
|
+
export declare const numberFormat: (locale: string, o?: Intl.NumberFormatOptions) => Intl.NumberFormat;
|
|
49
|
+
export declare const dateTimeFormat: (locale: string, o?: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
50
|
+
/** `true` for `"YYYY-MM-DD"` strings. */
|
|
51
|
+
export declare const isDateOnly: (v: unknown) => v is string;
|
|
52
|
+
/** Fraction digits a currency uses (USD/TRY 2, JPY 0, KWD 3). */
|
|
53
|
+
export declare function currencyDigits(currency: string): number;
|
|
54
|
+
/** The kit's formatter. Create one with `createFormatter(locale)`; in client components use `useFormat()`. */
|
|
55
|
+
export interface Formatter {
|
|
56
|
+
readonly locale: string;
|
|
57
|
+
readonly currencyCode: string;
|
|
58
|
+
readonly timeZone: string;
|
|
59
|
+
/** `1234.5` → "1,234.5" / "1.234,5". Accepts decimal strings exactly ("1250.50"). */
|
|
60
|
+
number(value: NumericInput, options?: Intl.NumberFormatOptions): string;
|
|
61
|
+
/** Money. `currency(1250.5)` uses the default currency; `currency(5, "EUR")` or `currency(5, { currency: "EUR" })`. */
|
|
62
|
+
currency(value: NumericInput, currency?: string | CurrencyOptions, options?: Intl.NumberFormatOptions): string;
|
|
63
|
+
/** Ratio → percent: `0.124` → "12.4%" / "%12,4". Max 1 fraction digit by default. */
|
|
64
|
+
percent(value: number, options?: Intl.NumberFormatOptions): string;
|
|
65
|
+
/** `1234567` → "1.2M" / "1,2 Mn". */
|
|
66
|
+
compact(value: NumericInput, options?: Intl.NumberFormatOptions): string;
|
|
67
|
+
/** Bytes → "1.2 MB" / "1,2 MB". */
|
|
68
|
+
bytes(value: number, options?: BytesOptions): string;
|
|
69
|
+
/** `167` (seconds) → "2m 47s" / "2 dk. 47 sn.". */
|
|
70
|
+
duration(value: number, options?: DurationOptions): string;
|
|
71
|
+
/** Date, instant or `"YYYY-MM-DD"`. Preset name or Intl options. Default `"medium"`. */
|
|
72
|
+
date(value: DateInput, options?: DatePreset | Intl.DateTimeFormatOptions): string;
|
|
73
|
+
/** Shorthand for `date(value, "datetime")`. */
|
|
74
|
+
dateTime(value: DateInput, options?: Intl.DateTimeFormatOptions): string;
|
|
75
|
+
/** "Nov 8 – 12, 2026" / "8–12 Kas 2026". */
|
|
76
|
+
dateRange(start: DateInput, end: DateInput, options?: DatePreset | Intl.DateTimeFormatOptions): string;
|
|
77
|
+
/** Time of an instant, or an `"HH:mm"` string: "9:30 AM" / "09:30". */
|
|
78
|
+
time(value: DateInput, options?: Intl.DateTimeFormatOptions): string;
|
|
79
|
+
/** "3 minutes ago", "yesterday", "in 2 weeks". Also the classic `relative(-1, "day")`. */
|
|
80
|
+
relative(value: DateInput, options?: RelativeOptions): string;
|
|
81
|
+
relative(value: number, unit: Intl.RelativeTimeFormatUnit, options?: Omit<RelativeOptions, "now">): string;
|
|
82
|
+
/** "Ada, Grace, and Linus" / "Ada, Grace ve Linus". */
|
|
83
|
+
list(items: string[], options?: Intl.ListFormatOptions): string;
|
|
84
|
+
/** Counts with a cap: `count(120)` → "99+". */
|
|
85
|
+
count(value: number, max?: number): string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a formatter bound to a locale, a default currency and a time zone.
|
|
89
|
+
*
|
|
90
|
+
* ```ts
|
|
91
|
+
* const f = createFormatter("tr-TR", { currency: "TRY", timeZone: "Europe/Istanbul" });
|
|
92
|
+
* f.currency("1250.50"); // "₺1.250,50"
|
|
93
|
+
* f.date("2026-11-08"); // "8 Kas 2026"
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function createFormatter(locale?: string, options?: FormatterOptions): Formatter;
|
|
97
|
+
/** Decimal and group separators of a locale: en-US `{ decimal: ".", group: "," }`, tr-TR `{ decimal: ",", group: "." }`. */
|
|
98
|
+
export declare function numberSeparators(locale?: string): {
|
|
99
|
+
decimal: string;
|
|
100
|
+
group: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Parses user input into a normalised decimal string (`"-1250.5"`), or `null` when it isn't a number.
|
|
104
|
+
* Strict about the locale's separators, lenient about what people actually type:
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* parseDecimal("1.250,50", "tr-TR"); // "1250.50"
|
|
108
|
+
* parseDecimal("₺1.250", "tr-TR"); // "1250"
|
|
109
|
+
* parseDecimal("12,5", "tr-TR"); // "12.5"
|
|
110
|
+
* parseDecimal("1250.75", "tr-TR"); // "1250.75" (single non-locale separator not followed by 3 digits → decimal)
|
|
111
|
+
* parseDecimal("(42.00)", "en-US"); // "-42.00" (accounting negative)
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function parseDecimal(input: string, locale?: string): string | null;
|
|
115
|
+
/**
|
|
116
|
+
* `parseNumber(locale)` returns a parser: `parseNumber("tr-TR")("1.250,5")` → `1250.5`.
|
|
117
|
+
* Prefer `parseDecimal` for money (no float).
|
|
118
|
+
*/
|
|
119
|
+
export declare function parseNumber(locale?: string): (input: string) => number | null;
|
|
120
|
+
/** `true` for canonical decimal strings: `"12"`, `"-0.5"`, `"1250.50"`. */
|
|
121
|
+
export declare const isDecimalString: (v: unknown) => v is string;
|
|
122
|
+
export type RoundingMode = "half-up" | "half-even" | "down" | "up";
|
|
123
|
+
/** Decimal string → integer minor units at `scale` (`"12.345"`, 2 → `1235n` with half-up). */
|
|
124
|
+
export declare function toMinorUnits(value: string | number, scale?: number, rounding?: RoundingMode): bigint;
|
|
125
|
+
/** Integer minor units → decimal string with exactly `scale` digits (`1235n`, 2 → `"12.35"`). */
|
|
126
|
+
export declare function fromMinorUnits(minor: bigint, scale?: number): string;
|
|
127
|
+
/** Round a decimal string to `scale` digits: `roundDecimal("2.345", 2)` → `"2.35"`. */
|
|
128
|
+
export declare const roundDecimal: (value: string, scale?: number, rounding?: RoundingMode) => string;
|
|
129
|
+
/** Exact sum of decimal strings at `scale` digits. */
|
|
130
|
+
export declare const addDecimal: (values: string[], scale?: number) => string;
|
|
131
|
+
/** `a - b` at `scale` digits. */
|
|
132
|
+
export declare const subtractDecimal: (a: string, b: string, scale?: number) => string;
|
|
133
|
+
/**
|
|
134
|
+
* `value × factor`, rounded to `scale` (quantity × unit price, VAT rate…). `factor` may be a decimal string.
|
|
135
|
+
*
|
|
136
|
+
* ```ts
|
|
137
|
+
* multiplyDecimal("19.99", "3"); // "59.97"
|
|
138
|
+
* multiplyDecimal("1250.00", "0.20"); // "250.00"
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function multiplyDecimal(value: string, factor: string | number, scale?: number, rounding?: RoundingMode): string;
|
|
142
|
+
/** -1, 0 or 1. */
|
|
143
|
+
export declare function compareDecimal(a: string, b: string): -1 | 0 | 1;
|
|
144
|
+
/** Estimated reading time in whole minutes (min 1) for text or a word count. Default 220 wpm. */
|
|
145
|
+
export declare function readingMinutes(textOrWords: string | number, wordsPerMinute?: number): number;
|
|
146
|
+
/** Local calendar date → `"YYYY-MM-DD"` (never `toISOString()`, which shifts the day at UTC+3). */
|
|
147
|
+
export declare function toISODate(d: Date): string;
|
|
148
|
+
/** `"YYYY-MM-DD"` → a local-midnight `Date` (for date pickers). Returns `null` for invalid input. */
|
|
149
|
+
export declare function fromISODate(s: string): Date | null;
|