@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,149 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import type { timelineLabels } from "../lib/data-islands.js";
|
|
4
|
+
export { RelativeTime, type RelativeTimeProps } from "../lib/data-islands.js";
|
|
5
|
+
export type TimelineLabels = Partial<typeof timelineLabels>;
|
|
6
|
+
export type TimelineTone = "neutral" | "accent" | "success" | "warning" | "danger" | "info";
|
|
7
|
+
export type TimelineStatus = "done" | "current" | "upcoming" | "failed";
|
|
8
|
+
/** One event of `ActivityTimeline items`. */
|
|
9
|
+
export interface TimelineEntry {
|
|
10
|
+
id: string;
|
|
11
|
+
/** When it happened: a Date, an ISO instant, or `"YYYY-MM-DD"`. */
|
|
12
|
+
at: Date | string;
|
|
13
|
+
/** Lucide icon component shown in the indicator. */
|
|
14
|
+
icon?: LucideIcon;
|
|
15
|
+
/** Person who did it — shown as an Avatar in the indicator (wins over `icon`). */
|
|
16
|
+
avatar?: {
|
|
17
|
+
src?: string | null;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
tone?: TimelineTone;
|
|
21
|
+
/** What happened. */
|
|
22
|
+
title: React.ReactNode;
|
|
23
|
+
/** Note, quoted comment or details under the title. */
|
|
24
|
+
body?: React.ReactNode;
|
|
25
|
+
/** Actor name, bolded before the title ("Meltem scheduled a post"). */
|
|
26
|
+
actor?: string;
|
|
27
|
+
/** Makes the title a link to the record. */
|
|
28
|
+
href?: string;
|
|
29
|
+
/** Steps variant: progress state. */
|
|
30
|
+
status?: TimelineStatus;
|
|
31
|
+
/** Trailing actions (Undo, View). */
|
|
32
|
+
actions?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export interface TimelineProps extends React.OlHTMLAttributes<HTMLOListElement> {
|
|
35
|
+
/** `"feed"` (events) or `"steps"` (a process with done / current / upcoming). Default `"feed"`. */
|
|
36
|
+
variant?: "feed" | "steps";
|
|
37
|
+
/** `"inherit"` follows the page `data-density`. Default `"inherit"`. */
|
|
38
|
+
density?: "inherit" | "compact" | "comfortable";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Composable timeline (`<ol>`). For data use `ActivityTimeline`; compose these parts for
|
|
42
|
+
* custom rows: `Timeline › TimelineGroup › TimelineItem › TimelineIndicator + TimelineContent`.
|
|
43
|
+
*/
|
|
44
|
+
export declare const Timeline: React.ForwardRefExoticComponent<TimelineProps & React.RefAttributes<HTMLOListElement>>;
|
|
45
|
+
export interface TimelineGroupProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
|
|
46
|
+
/** Day as `"YYYY-MM-DD"` — rendered as "Today", "Yesterday" or "Monday, Nov 8" in the current locale. */
|
|
47
|
+
date?: string;
|
|
48
|
+
/** Custom heading (wins over `date`). */
|
|
49
|
+
label?: React.ReactNode;
|
|
50
|
+
/** Fix the reference time for "Today" (docs, tests). */
|
|
51
|
+
now?: Date | string | number;
|
|
52
|
+
labels?: TimelineLabels;
|
|
53
|
+
}
|
|
54
|
+
/** A labelled section (a day). Children are TimelineItems. */
|
|
55
|
+
export declare const TimelineGroup: React.ForwardRefExoticComponent<TimelineGroupProps & React.RefAttributes<HTMLLIElement>>;
|
|
56
|
+
export interface TimelineItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
|
|
57
|
+
/** Steps variant: drives the indicator, connector and `aria-current="step"`. */
|
|
58
|
+
status?: TimelineStatus;
|
|
59
|
+
/** Brief accent highlight for a just-arrived item (none under reduced motion). */
|
|
60
|
+
highlight?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare const TimelineItem: React.ForwardRefExoticComponent<TimelineItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
63
|
+
export interface TimelineIndicatorProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
64
|
+
icon?: LucideIcon | React.ReactNode;
|
|
65
|
+
avatar?: {
|
|
66
|
+
src?: string | null;
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
tone?: TimelineTone;
|
|
70
|
+
/** Steps: picks the look (check for done, ring for current, hollow for upcoming, × for failed). */
|
|
71
|
+
status?: TimelineStatus;
|
|
72
|
+
labels?: TimelineLabels;
|
|
73
|
+
}
|
|
74
|
+
/** The dot / icon / avatar on the connector. Opaque in glass so the line never shows through. */
|
|
75
|
+
export declare function TimelineIndicator({ icon, avatar, tone, status, labels, className, children, ...props }: TimelineIndicatorProps): React.JSX.Element;
|
|
76
|
+
/** Text column: title, time, body, actions. */
|
|
77
|
+
export declare function TimelineContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
78
|
+
export declare function TimelineTitle({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
79
|
+
export interface TimelineBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
80
|
+
/** `"card"` (default) sets the note on an inset surface; `"plain"` is unstyled text for typographic layouts (CVs, changelogs). */
|
|
81
|
+
variant?: "card" | "plain";
|
|
82
|
+
}
|
|
83
|
+
/** Note or quoted comment under the title. */
|
|
84
|
+
export declare function TimelineBody({ className, variant, ...props }: TimelineBodyProps): React.JSX.Element;
|
|
85
|
+
export interface TimelineTimeProps {
|
|
86
|
+
value: Date | string | number;
|
|
87
|
+
/** Fix the reference time (docs, tests). */
|
|
88
|
+
now?: Date | string | number;
|
|
89
|
+
/** `"absolute"` shows the time of day ("9:30 AM") — useful inside day groups. Default `"relative"`. */
|
|
90
|
+
mode?: "relative" | "absolute";
|
|
91
|
+
className?: string;
|
|
92
|
+
}
|
|
93
|
+
/** `<time>` with "4 minutes ago" (full date on hover). Server render shows the absolute time. */
|
|
94
|
+
export declare function TimelineTime({ value, now, mode, className }: TimelineTimeProps): React.JSX.Element;
|
|
95
|
+
export declare function TimelineActions({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
96
|
+
export interface TimelineNewItemsProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
97
|
+
/** Number of waiting items. */
|
|
98
|
+
count: number;
|
|
99
|
+
labels?: TimelineLabels;
|
|
100
|
+
}
|
|
101
|
+
/** "3 new updates" pill for live feeds: new items wait above instead of shifting the list. */
|
|
102
|
+
export declare const TimelineNewItems: React.ForwardRefExoticComponent<TimelineNewItemsProps & React.RefAttributes<HTMLButtonElement>>;
|
|
103
|
+
/** Placeholder items while the feed loads. */
|
|
104
|
+
export declare function TimelineSkeleton({ count, className }: {
|
|
105
|
+
count?: number;
|
|
106
|
+
className?: string;
|
|
107
|
+
}): React.JSX.Element;
|
|
108
|
+
export interface ActivityTimelineProps extends Omit<TimelineProps, "children"> {
|
|
109
|
+
items: TimelineEntry[];
|
|
110
|
+
/** `"day"` groups under "Today / Yesterday / Monday, Nov 8". Default `"none"`. */
|
|
111
|
+
groupBy?: "day" | "none";
|
|
112
|
+
/** Default `"desc"` (newest first) for feeds, `"asc"` for steps. */
|
|
113
|
+
order?: "desc" | "asc";
|
|
114
|
+
/** Time zone used to split days — pass the same one as your LocaleProvider. Default `"UTC"`. */
|
|
115
|
+
timeZone?: string;
|
|
116
|
+
/** Fix the reference time ("4 minutes ago", "Today") — docs, tests, snapshots. */
|
|
117
|
+
now?: Date | string | number;
|
|
118
|
+
/** Times as `"relative"` ("4 minutes ago") or `"absolute"` time of day. Default: relative, absolute inside day groups. */
|
|
119
|
+
timeMode?: "relative" | "absolute";
|
|
120
|
+
/** Three skeleton items. */
|
|
121
|
+
loading?: boolean;
|
|
122
|
+
/** Shown when there are no items. Default: "No activity yet". */
|
|
123
|
+
empty?: React.ReactNode;
|
|
124
|
+
/** Show the "Load older activity" button. */
|
|
125
|
+
hasMore?: boolean;
|
|
126
|
+
/** Called by the load-more button; return a promise for the busy state. */
|
|
127
|
+
onLoadMore?: () => void | Promise<void>;
|
|
128
|
+
/** Waiting live items — shows the "3 new updates" pill. */
|
|
129
|
+
newCount?: number;
|
|
130
|
+
onShowNew?: () => void;
|
|
131
|
+
/** Polite live region text for screen readers (batched by you, e.g. "2 new comments"). */
|
|
132
|
+
announcement?: string;
|
|
133
|
+
/** Filter chips above the list. */
|
|
134
|
+
filter?: React.ReactNode;
|
|
135
|
+
labels?: TimelineLabels;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A chronological, human-readable history: dashboard activity, record history, approval steps.
|
|
139
|
+
* Server-component compatible: relative times and day names are small client islands
|
|
140
|
+
* (`Intl.RelativeTimeFormat`, one shared ticker).
|
|
141
|
+
*
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <ActivityTimeline groupBy="day" items={[
|
|
144
|
+
* { id: "1", at: "2026-11-10T09:12:00Z", icon: Inbox, title: <>New submission on <b>Contact form</b></> },
|
|
145
|
+
* { id: "2", at: "2026-11-09T16:40:00Z", avatar: { name: "Ahmet Kaya" }, actor: "Ahmet Kaya", title: "commented on “QR menus guide”" },
|
|
146
|
+
* ]} />
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export declare const ActivityTimeline: React.ForwardRefExoticComponent<ActivityTimelineProps & React.RefAttributes<HTMLOListElement>>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Check, X } from "lucide-react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { DataLabel, LoadMoreButton, RelativeTime, TimelineDayLabel } from "../lib/data-islands.js";
|
|
7
|
+
import { dayKey, toIsoInstant } from "../lib/value-format.js";
|
|
8
|
+
import { Avatar } from "./avatar.js";
|
|
9
|
+
import { EmptyState } from "./empty-state.js";
|
|
10
|
+
import { Skeleton } from "./skeleton.js";
|
|
11
|
+
export { RelativeTime } from "../lib/data-islands.js";
|
|
12
|
+
/**
|
|
13
|
+
* Composable timeline (`<ol>`). For data use `ActivityTimeline`; compose these parts for
|
|
14
|
+
* custom rows: `Timeline › TimelineGroup › TimelineItem › TimelineIndicator + TimelineContent`.
|
|
15
|
+
*/
|
|
16
|
+
export const Timeline = React.forwardRef(function Timeline({ variant = "feed", density = "inherit", className, ...props }, ref) {
|
|
17
|
+
return (_jsx("ol", { ref: ref, "data-slot": "timeline", "data-variant": variant, "data-density": density === "inherit" ? undefined : density, className: cn("group/timeline m-0 grid list-none gap-(--tl-gap) p-0 [--tl-gap:calc(var(--row-h)*0.3)] [--tl-ind:1.75rem]", "data-[density=compact]:[--tl-ind:1.5rem] [[data-density=compact]_&]:[--tl-ind:1.5rem]", className), ...props }));
|
|
18
|
+
});
|
|
19
|
+
/** A labelled section (a day). Children are TimelineItems. */
|
|
20
|
+
export const TimelineGroup = React.forwardRef(function TimelineGroup({ date, label, now, labels, className, children, ...props }, ref) {
|
|
21
|
+
const id = React.useId();
|
|
22
|
+
return (_jsxs("li", { ref: ref, "data-slot": "timeline-group", "aria-labelledby": id, className: cn("grid gap-(--tl-gap)", className), ...props, children: [_jsxs("div", { id: id, className: "flex items-center gap-3 font-mono text-[11px] font-medium tracking-[0.06em] text-fg-subtle", children: [_jsx("span", { className: "shrink-0", children: label ?? (date ? _jsx(TimelineDayLabel, { date: date, now: now, labels: labels }) : null) }), _jsx("span", { "aria-hidden": true, className: "h-px flex-1 bg-line" })] }), _jsx("ol", { className: "m-0 grid list-none gap-(--tl-gap) p-0", children: children })] }));
|
|
23
|
+
});
|
|
24
|
+
export const TimelineItem = React.forwardRef(function TimelineItem({ status, highlight, className, ...props }, ref) {
|
|
25
|
+
return (_jsx("li", { ref: ref, "data-slot": "timeline-item", "data-status": status, "data-highlight": highlight ? "" : undefined, "aria-current": status === "current" ? "step" : undefined, className: cn("relative grid grid-cols-[var(--tl-ind)_minmax(0,1fr)] gap-x-3",
|
|
26
|
+
// connector from below this indicator to the next one (start side, RTL-aware)
|
|
27
|
+
"before:absolute before:start-[calc(var(--tl-ind)/2-0.5px)] before:top-[calc(var(--tl-ind)+0.25rem)] before:-bottom-[calc(var(--tl-gap)-0.25rem)] before:w-px before:bg-line last:before:hidden", "data-[status=upcoming]:before:w-0 data-[status=upcoming]:before:border-s data-[status=upcoming]:before:border-dashed data-[status=upcoming]:before:border-line data-[status=upcoming]:before:bg-transparent", "data-[status=current]:before:w-0 data-[status=current]:before:border-s data-[status=current]:before:border-dashed data-[status=current]:before:border-line data-[status=current]:before:bg-transparent", className), ...props }));
|
|
28
|
+
});
|
|
29
|
+
const indicatorVariants = cva("relative z-[1] grid size-(--tl-ind) shrink-0 place-items-center rounded-full border text-fg-muted [&_svg]:size-[calc(var(--tl-ind)*0.5)] [&_svg]:shrink-0", {
|
|
30
|
+
variants: {
|
|
31
|
+
tone: {
|
|
32
|
+
neutral: "border-line bg-[color-mix(in_oklch,var(--surface)_90%,var(--scene))]",
|
|
33
|
+
accent: "tone-accent border-[color-mix(in_srgb,var(--tone)_35%,var(--line))] bg-[color-mix(in_oklch,var(--tone)_14%,color-mix(in_oklch,var(--surface)_92%,var(--scene)))] text-(--tone)",
|
|
34
|
+
success: "tone-success border-[color-mix(in_srgb,var(--tone)_35%,var(--line))] bg-[color-mix(in_oklch,var(--tone)_14%,color-mix(in_oklch,var(--surface)_92%,var(--scene)))] text-(--tone)",
|
|
35
|
+
warning: "tone-warning border-[color-mix(in_srgb,var(--tone)_35%,var(--line))] bg-[color-mix(in_oklch,var(--tone)_14%,color-mix(in_oklch,var(--surface)_92%,var(--scene)))] text-(--tone)",
|
|
36
|
+
danger: "tone-danger border-[color-mix(in_srgb,var(--tone)_35%,var(--line))] bg-[color-mix(in_oklch,var(--tone)_14%,color-mix(in_oklch,var(--surface)_92%,var(--scene)))] text-(--tone)",
|
|
37
|
+
info: "tone-info border-[color-mix(in_srgb,var(--tone)_35%,var(--line))] bg-[color-mix(in_oklch,var(--tone)_14%,color-mix(in_oklch,var(--surface)_92%,var(--scene)))] text-(--tone)",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: { tone: "neutral" },
|
|
41
|
+
});
|
|
42
|
+
/** The dot / icon / avatar on the connector. Opaque in glass so the line never shows through. */
|
|
43
|
+
export function TimelineIndicator({ icon, avatar, tone, status, labels, className, children, ...props }) {
|
|
44
|
+
const statusText = status ? (_jsx("span", { className: "sr-only", children: _jsx(DataLabel, { ns: "timeline", id: status, override: labels }) })) : null;
|
|
45
|
+
if (avatar && !status) {
|
|
46
|
+
return (_jsx("span", { "data-slot": "timeline-indicator", className: cn("relative z-[1] grid size-(--tl-ind) place-items-center", className), ...props, children: _jsx(Avatar, { name: avatar.name, src: avatar.src, size: "sm", className: "size-(--tl-ind)! ring-2 ring-[color-mix(in_oklch,var(--surface)_90%,var(--scene))]" }) }));
|
|
47
|
+
}
|
|
48
|
+
if (status) {
|
|
49
|
+
return (_jsxs("span", { "data-slot": "timeline-indicator", "data-status": status, className: cn(indicatorVariants({ tone: status === "done" ? "success" : status === "failed" ? "danger" : "neutral" }), status === "current" && "border-accent-ink border-[1.5px] text-accent-ink", status === "upcoming" && "border-dashed text-fg-subtle", className), ...props, children: [status === "done" ? _jsx(Check, { "aria-hidden": true, strokeWidth: 2.5 }) : status === "failed" ? _jsx(X, { "aria-hidden": true, strokeWidth: 2.5 }) : status === "current" ? _jsx("span", { "aria-hidden": true, className: "size-2 rounded-full bg-accent-ink" }) : _jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current" }), statusText, children] }));
|
|
50
|
+
}
|
|
51
|
+
const Icon = typeof icon === "function" || (typeof icon === "object" && icon !== null && !React.isValidElement(icon) && "render" in icon) ? icon : undefined;
|
|
52
|
+
return (_jsx("span", { "data-slot": "timeline-indicator", className: cn(indicatorVariants({ tone }), className), ...props, children: Icon ? _jsx(Icon, { "aria-hidden": true }) : icon ? icon : children ?? _jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current opacity-70" }) }));
|
|
53
|
+
}
|
|
54
|
+
/** Text column: title, time, body, actions. */
|
|
55
|
+
export function TimelineContent({ className, ...props }) {
|
|
56
|
+
return _jsx("div", { "data-slot": "timeline-content", className: cn("min-w-0 pt-[calc((var(--tl-ind)-1.25rem)/2)] text-[13px] leading-5 text-fg-muted", className), ...props });
|
|
57
|
+
}
|
|
58
|
+
export function TimelineTitle({ className, ...props }) {
|
|
59
|
+
return _jsx("div", { "data-slot": "timeline-title", className: cn("text-pretty [&_b]:font-medium [&_b]:text-fg [&_strong]:font-medium [&_strong]:text-fg", className), ...props });
|
|
60
|
+
}
|
|
61
|
+
/** Note or quoted comment under the title. */
|
|
62
|
+
export function TimelineBody({ className, variant = "card", ...props }) {
|
|
63
|
+
return (_jsx("div", { "data-slot": "timeline-body", "data-variant": variant, className: cn(variant === "card" ? "surface-2 mt-2 rounded-ui-sm px-3 py-2 text-[13px] leading-relaxed text-fg" : "mt-1 leading-relaxed text-fg", className), ...props }));
|
|
64
|
+
}
|
|
65
|
+
/** `<time>` with "4 minutes ago" (full date on hover). Server render shows the absolute time. */
|
|
66
|
+
export function TimelineTime({ value, now, mode = "relative", className }) {
|
|
67
|
+
return _jsx(RelativeTime, { value: value, now: now, display: mode === "absolute" ? "time" : "relative", className: cn("mt-0.5 block text-[11.5px] text-fg-subtle", className) });
|
|
68
|
+
}
|
|
69
|
+
export function TimelineActions({ className, ...props }) {
|
|
70
|
+
return _jsx("div", { "data-slot": "timeline-actions", className: cn("mt-2 flex flex-wrap items-center gap-1.5", className), ...props });
|
|
71
|
+
}
|
|
72
|
+
/** "3 new updates" pill for live feeds: new items wait above instead of shifting the list. */
|
|
73
|
+
export const TimelineNewItems = React.forwardRef(function TimelineNewItems({ count, labels, className, children, ...props }, ref) {
|
|
74
|
+
if (count <= 0)
|
|
75
|
+
return null;
|
|
76
|
+
return (_jsxs("button", { ref: ref, type: "button", "data-slot": "timeline-new-items", className: cn("mx-auto inline-flex h-7 items-center gap-1.5 rounded-full bg-accent-soft px-3 text-xs font-medium text-accent-ink transition-[filter] hover:brightness-95 focus-ring motion-safe:ui-fade", className), ...props, children: [_jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current" }), children ?? _jsx(DataLabel, { ns: "timeline", id: "newItems", vars: { count }, override: labels })] }));
|
|
77
|
+
});
|
|
78
|
+
/** Placeholder items while the feed loads. */
|
|
79
|
+
export function TimelineSkeleton({ count = 3, className }) {
|
|
80
|
+
return (_jsx("div", { "data-slot": "timeline-skeleton", "aria-busy": "true", className: cn("grid gap-4 [--tl-ind:1.75rem]", className), children: Array.from({ length: count }, (_, i) => (_jsxs("div", { className: "grid grid-cols-[var(--tl-ind)_1fr] gap-x-3", children: [_jsx(Skeleton, { shape: "circle", className: "size-(--tl-ind)" }), _jsxs("div", { className: "grid gap-2 pt-1", children: [_jsx(Skeleton, { shape: "text", className: "h-3", style: { width: `${78 - ((i * 19) % 30)}%` } }), _jsx(Skeleton, { shape: "text", className: "h-2.5 w-16" })] })] }, i))) }));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A chronological, human-readable history: dashboard activity, record history, approval steps.
|
|
84
|
+
* Server-component compatible: relative times and day names are small client islands
|
|
85
|
+
* (`Intl.RelativeTimeFormat`, one shared ticker).
|
|
86
|
+
*
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <ActivityTimeline groupBy="day" items={[
|
|
89
|
+
* { id: "1", at: "2026-11-10T09:12:00Z", icon: Inbox, title: <>New submission on <b>Contact form</b></> },
|
|
90
|
+
* { id: "2", at: "2026-11-09T16:40:00Z", avatar: { name: "Ahmet Kaya" }, actor: "Ahmet Kaya", title: "commented on “QR menus guide”" },
|
|
91
|
+
* ]} />
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export const ActivityTimeline = React.forwardRef(function ActivityTimeline({ items, variant = "feed", groupBy = "none", order, timeZone = "UTC", now, timeMode, loading, empty, hasMore, onLoadMore, newCount = 0, onShowNew, announcement, filter, labels, className, density, ...props }, ref) {
|
|
95
|
+
const dir = order ?? (variant === "steps" ? "asc" : "desc");
|
|
96
|
+
const sorted = variant === "steps" && order === undefined ? items : [...items].sort((a, b) => cmp(a.at, b.at) * (dir === "asc" ? 1 : -1));
|
|
97
|
+
const renderItem = (it, inGroup) => (_jsxs(TimelineItem, { status: it.status, children: [_jsx(TimelineIndicator, { icon: it.icon, avatar: it.avatar, tone: it.tone, status: variant === "steps" ? (it.status ?? "upcoming") : undefined, labels: labels }), _jsxs(TimelineContent, { children: [_jsxs(TimelineTitle, { className: it.status === "upcoming" ? "text-fg-subtle" : undefined, children: [it.actor ? _jsxs("b", { children: [it.actor, " "] }) : null, it.href ? (_jsx("a", { href: it.href, className: "rounded-[2px] underline-offset-2 hover:text-fg hover:underline focus-ring", children: it.title })) : (it.title)] }), variant === "steps" && it.status === "upcoming" ? null : _jsx(TimelineTime, { value: toIsoInstant(it.at), now: now, mode: timeMode ?? (inGroup ? "absolute" : "relative") }), it.body ? _jsx(TimelineBody, { children: it.body }) : null, it.actions ? _jsx(TimelineActions, { children: it.actions }) : null] })] }, it.id));
|
|
98
|
+
let list;
|
|
99
|
+
if (loading)
|
|
100
|
+
list = _jsx(TimelineSkeleton, {});
|
|
101
|
+
else if (sorted.length === 0)
|
|
102
|
+
list = empty ?? _jsx(EmptyState, { size: "sm", title: _jsx(DataLabel, { ns: "timeline", id: "empty", override: labels }) });
|
|
103
|
+
else if (groupBy === "day") {
|
|
104
|
+
const groups = new Map();
|
|
105
|
+
for (const it of sorted) {
|
|
106
|
+
const k = dayKey(it.at, timeZone);
|
|
107
|
+
groups.set(k, [...(groups.get(k) ?? []), it]);
|
|
108
|
+
}
|
|
109
|
+
list = (_jsx(Timeline, { ref: ref, variant: variant, density: density, className: className, ...props, children: [...groups].map(([day, entries]) => (_jsx(TimelineGroup, { date: day, now: now, labels: labels, children: entries.map((e) => renderItem(e, true)) }, day))) }));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
list = (_jsx(Timeline, { ref: ref, variant: variant, density: density, className: className, ...props, children: sorted.map((e) => renderItem(e, false)) }));
|
|
113
|
+
}
|
|
114
|
+
const wrapped = Boolean(filter || newCount > 0 || announcement !== undefined || (hasMore && onLoadMore) || loading || sorted.length === 0);
|
|
115
|
+
if (!wrapped)
|
|
116
|
+
return list;
|
|
117
|
+
return (_jsxs("div", { "data-slot": "activity-timeline", className: "grid gap-4", children: [filter ? _jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: filter }) : null, newCount > 0 ? _jsx(TimelineNewItems, { count: newCount, onClick: onShowNew, labels: labels }) : null, list, hasMore && onLoadMore && !loading ? (_jsx("div", { className: "flex justify-center", children: _jsx(LoadMoreButton, { onLoadMore: onLoadMore, labels: labels }) })) : null, announcement !== undefined ? (_jsx("div", { "aria-live": "polite", role: "status", className: "sr-only", children: announcement })) : null] }));
|
|
118
|
+
});
|
|
119
|
+
function cmp(a, b) {
|
|
120
|
+
const t = (v) => (v instanceof Date ? v.getTime() : Date.parse(v.length === 10 ? `${v}T00:00:00Z` : v));
|
|
121
|
+
return t(a) - t(b);
|
|
122
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ControlA11yProps } from "../lib/field-context.js";
|
|
3
|
+
import type { AddressDataSource } from "../locale-data/core/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* A structured postal address. Region names are stored as text (official spelling), because
|
|
6
|
+
* invoices (UBL-TR `CityName` / `CitySubdivisionName`) and labels need names, not codes.
|
|
7
|
+
*/
|
|
8
|
+
export interface Address {
|
|
9
|
+
/** ISO 3166-1 alpha-2. */
|
|
10
|
+
country: string;
|
|
11
|
+
/** Province / state ("İstanbul", "California"). */
|
|
12
|
+
region1?: string;
|
|
13
|
+
/** District / city ("Kadıköy", "San Francisco"). */
|
|
14
|
+
region2?: string;
|
|
15
|
+
/** Neighbourhood (from an app endpoint; not bundled). */
|
|
16
|
+
region3?: string;
|
|
17
|
+
line1?: string;
|
|
18
|
+
line2?: string;
|
|
19
|
+
postalCode?: string;
|
|
20
|
+
}
|
|
21
|
+
export type AddressPart = keyof Address;
|
|
22
|
+
declare const addressLabels: {
|
|
23
|
+
country: string;
|
|
24
|
+
province: string;
|
|
25
|
+
district: string;
|
|
26
|
+
state: string;
|
|
27
|
+
city: string;
|
|
28
|
+
line1: string;
|
|
29
|
+
line2: string;
|
|
30
|
+
postalCode: string;
|
|
31
|
+
zip: string;
|
|
32
|
+
select: string;
|
|
33
|
+
selectProvince: string;
|
|
34
|
+
selectDistrict: string;
|
|
35
|
+
provinceFirst: string;
|
|
36
|
+
loading: string;
|
|
37
|
+
districtCleared: string;
|
|
38
|
+
postalMismatch: string;
|
|
39
|
+
};
|
|
40
|
+
export type AddressFieldLabels = typeof addressLabels;
|
|
41
|
+
/**
|
|
42
|
+
* Formats an address as lines in the country's convention.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* formatAddress({ country: "TR", region1: "İstanbul", region2: "Kadıköy", line1: "Caferağa Mah. Moda Cad. No: 12", postalCode: "34710" }, { locale: "en-US" });
|
|
46
|
+
* // ["Caferağa Mah. Moda Cad. No: 12", "34710 Kadıköy/İstanbul", "Türkiye"]
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatAddress(a: Address, opts?: {
|
|
50
|
+
locale?: string;
|
|
51
|
+
includeCountry?: boolean;
|
|
52
|
+
}): string[];
|
|
53
|
+
interface NativeSelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size">, ControlA11yProps {
|
|
54
|
+
size?: "sm" | "md" | "lg";
|
|
55
|
+
invalid?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface RegionSelectProps extends Omit<NativeSelectProps, "value" | "defaultValue" | "onChange"> {
|
|
58
|
+
/** Region data (e.g. `trAddress` from `@vamos-ui/react/locale-data`). */
|
|
59
|
+
source: AddressDataSource;
|
|
60
|
+
level: "province" | "district";
|
|
61
|
+
/** Parent province name, for `level="district"`. */
|
|
62
|
+
province?: string;
|
|
63
|
+
value?: string;
|
|
64
|
+
defaultValue?: string;
|
|
65
|
+
onValueChange?: (name: string) => void;
|
|
66
|
+
/** First option text. */
|
|
67
|
+
placeholder?: string;
|
|
68
|
+
labels?: Partial<AddressFieldLabels>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Province or district picker over an address data source, loaded lazily. Values are official
|
|
72
|
+
* names. Use alone in filter bars ("Branches in İzmir") or inside AddressField.
|
|
73
|
+
*
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <Field label="Province"><RegionSelect source={trAddress} level="province" /></Field>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const RegionSelect: React.ForwardRefExoticComponent<RegionSelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
79
|
+
export interface AddressFieldProps extends Omit<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, "defaultValue" | "onChange" | "required"> {
|
|
80
|
+
value?: Address | null;
|
|
81
|
+
defaultValue?: Address | null;
|
|
82
|
+
onValueChange?: (address: Address) => void;
|
|
83
|
+
/** Region data per country. Default `{ TR: trAddress }` (81 provinces, 973 districts, lazy). */
|
|
84
|
+
sources?: Record<string, AddressDataSource>;
|
|
85
|
+
/** Country list. Default: every country. */
|
|
86
|
+
countries?: string[];
|
|
87
|
+
/** Initial country when there is no value. Default `"TR"` for Turkish locales, else the locale's region. */
|
|
88
|
+
defaultCountry?: string;
|
|
89
|
+
/** Parts to show, in any order of preference. Default: all except `region3`. */
|
|
90
|
+
fields?: AddressPart[];
|
|
91
|
+
/** Parts that are required. */
|
|
92
|
+
required?: AddressPart[];
|
|
93
|
+
/** `"grid"` (two columns from `sm`, default) or `"stack"`. */
|
|
94
|
+
layout?: "grid" | "stack";
|
|
95
|
+
/** Prefix for form names: `billing` → `billing[country]`, `billing[region1]`… */
|
|
96
|
+
name?: string;
|
|
97
|
+
legend?: React.ReactNode;
|
|
98
|
+
hint?: React.ReactNode;
|
|
99
|
+
/** Per-part errors from your validation. */
|
|
100
|
+
errors?: Partial<Record<AddressPart, React.ReactNode>>;
|
|
101
|
+
readOnly?: boolean;
|
|
102
|
+
size?: "sm" | "md" | "lg";
|
|
103
|
+
labels?: Partial<AddressFieldLabels>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Structured postal address in a fieldset: country → province → district cascading pickers for
|
|
107
|
+
* countries with a data source (Türkiye ships built in, loaded lazily), free text elsewhere.
|
|
108
|
+
* Changing a parent clears its children (and says so to screen readers). Read-only shows the
|
|
109
|
+
* address formatted the way the country writes it.
|
|
110
|
+
*
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <AddressField legend="Billing address" name="billing" defaultValue={{ country: "TR" }} required={["line1", "region1", "region2"]} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare const AddressField: React.ForwardRefExoticComponent<AddressFieldProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { useFieldControl } from "../lib/field-context.js";
|
|
7
|
+
import { useLabels } from "../lib/labels.js";
|
|
8
|
+
import { useLocale } from "../lib/locale.js";
|
|
9
|
+
import { compareText } from "../lib/text.js";
|
|
10
|
+
import { useControllableState, useLatest } from "../lib/use-controllable-state.js";
|
|
11
|
+
import { controlVariants } from "../lib/variants.js";
|
|
12
|
+
import { checkTrPostalCode, trAddress } from "../locale-data/tr/address.js";
|
|
13
|
+
import { Field, Fieldset, Input } from "./input.js";
|
|
14
|
+
/** ISO 3166-1 alpha-2 codes (names come from `Intl.DisplayNames`). */
|
|
15
|
+
const COUNTRY_CODES = "AD AE AF AG AI AL AM AO AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GT GU GW GY HK HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" ");
|
|
16
|
+
const addressLabels = {
|
|
17
|
+
country: "Country",
|
|
18
|
+
province: "Province",
|
|
19
|
+
district: "District",
|
|
20
|
+
state: "State / Province",
|
|
21
|
+
city: "City",
|
|
22
|
+
line1: "Street address",
|
|
23
|
+
line2: "Apartment, suite, building",
|
|
24
|
+
postalCode: "Postal code",
|
|
25
|
+
zip: "ZIP code",
|
|
26
|
+
select: "Select…",
|
|
27
|
+
selectProvince: "Select a province",
|
|
28
|
+
selectDistrict: "Select a district",
|
|
29
|
+
provinceFirst: "Choose a province first",
|
|
30
|
+
loading: "Loading…",
|
|
31
|
+
districtCleared: "District cleared",
|
|
32
|
+
postalMismatch: "Postal codes in {province} start with {prefix}",
|
|
33
|
+
};
|
|
34
|
+
const US_LIKE = new Set(["US", "CA", "AU"]);
|
|
35
|
+
function displayNames(locale) {
|
|
36
|
+
try {
|
|
37
|
+
return new Intl.DisplayNames([locale], { type: "region" });
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Formats an address as lines in the country's convention.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* formatAddress({ country: "TR", region1: "İstanbul", region2: "Kadıköy", line1: "Caferağa Mah. Moda Cad. No: 12", postalCode: "34710" }, { locale: "en-US" });
|
|
48
|
+
* // ["Caferağa Mah. Moda Cad. No: 12", "34710 Kadıköy/İstanbul", "Türkiye"]
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function formatAddress(a, opts = {}) {
|
|
52
|
+
const { locale = "en-US", includeCountry = true } = opts;
|
|
53
|
+
const c = a.country?.toUpperCase();
|
|
54
|
+
const join = (...xs) => xs.filter(Boolean).join(" ");
|
|
55
|
+
let lines;
|
|
56
|
+
if (c === "TR")
|
|
57
|
+
lines = [a.line1, a.line2, a.region3, join(a.postalCode, [a.region2, a.region1].filter(Boolean).join("/"))];
|
|
58
|
+
else if (US_LIKE.has(c))
|
|
59
|
+
lines = [a.line1, a.line2, [a.region2, join(a.region1, a.postalCode)].filter(Boolean).join(", ")];
|
|
60
|
+
else if (c === "GB" || c === "IE")
|
|
61
|
+
lines = [a.line1, a.line2, a.region2, a.region1, a.postalCode];
|
|
62
|
+
else
|
|
63
|
+
lines = [a.line1, a.line2, join(a.postalCode, a.region2), a.region1];
|
|
64
|
+
if (includeCountry && c)
|
|
65
|
+
lines.push(displayNames(locale)?.of(c) ?? c);
|
|
66
|
+
return lines.map((l) => l?.trim()).filter((l) => !!l);
|
|
67
|
+
}
|
|
68
|
+
const NativeSelect = React.forwardRef(function NativeSelect({ className, size = "md", invalid, children, ...rest }, ref) {
|
|
69
|
+
const props = useFieldControl({ ...rest, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
70
|
+
return (_jsxs("div", { "data-slot": "address-select", className: cn(controlVariants({ size }), "px-0", className), children: [_jsx("select", { ref: ref, ...props, className: cn("h-full w-full min-w-0 cursor-pointer appearance-none rounded-[inherit] bg-transparent ps-3 pe-9 text-[length:inherit] text-fg outline-none disabled:cursor-not-allowed", props.value === "" && "text-fg-subtle"), children: children }), _jsx(ChevronDown, { "aria-hidden": true, className: "pointer-events-none absolute end-3 size-4 text-fg-subtle" })] }));
|
|
71
|
+
});
|
|
72
|
+
/* ------------------------------------------------------------------ */
|
|
73
|
+
/* RegionSelect */
|
|
74
|
+
/* ------------------------------------------------------------------ */
|
|
75
|
+
function useRegions(source, level, province) {
|
|
76
|
+
const [state, setState] = React.useState({ key: "", items: null });
|
|
77
|
+
const [provinces, setProvinces] = React.useState(null);
|
|
78
|
+
const key = `${source?.id ?? ""}|${level}|${level === "district" ? province ?? "" : ""}`;
|
|
79
|
+
const cmp = React.useMemo(() => compareText(source?.id ?? "en"), [source?.id]);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!source)
|
|
82
|
+
return;
|
|
83
|
+
let alive = true;
|
|
84
|
+
source.provinces().then((p) => {
|
|
85
|
+
if (alive)
|
|
86
|
+
setProvinces(p);
|
|
87
|
+
});
|
|
88
|
+
return () => {
|
|
89
|
+
alive = false;
|
|
90
|
+
};
|
|
91
|
+
}, [source]);
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
if (!source || !provinces)
|
|
94
|
+
return;
|
|
95
|
+
let alive = true;
|
|
96
|
+
if (level === "province") {
|
|
97
|
+
setState({ key, items: [...provinces].sort((a, b) => cmp(a.name, b.name)) });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const p = provinces.find((x) => x.name === province);
|
|
101
|
+
if (!p)
|
|
102
|
+
setState({ key, items: [] });
|
|
103
|
+
else
|
|
104
|
+
source.districts(p.code).then((d) => {
|
|
105
|
+
if (alive)
|
|
106
|
+
setState({ key, items: d });
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return () => {
|
|
110
|
+
alive = false;
|
|
111
|
+
};
|
|
112
|
+
}, [source, provinces, level, province, key, cmp]);
|
|
113
|
+
return { items: state.key === key ? state.items : null, provinces };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Province or district picker over an address data source, loaded lazily. Values are official
|
|
117
|
+
* names. Use alone in filter bars ("Branches in İzmir") or inside AddressField.
|
|
118
|
+
*
|
|
119
|
+
* ```tsx
|
|
120
|
+
* <Field label="Province"><RegionSelect source={trAddress} level="province" /></Field>
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export const RegionSelect = React.forwardRef(function RegionSelect({ source, level, province, value, defaultValue, onValueChange, placeholder, labels, disabled, ...rest }, ref) {
|
|
124
|
+
const t = useLabels("address", addressLabels, labels);
|
|
125
|
+
const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? "", onChange: onValueChange, name: "RegionSelect" });
|
|
126
|
+
const { items } = useRegions(source, level, province);
|
|
127
|
+
const needsParent = level === "district" && !province;
|
|
128
|
+
const loading = !needsParent && items === null;
|
|
129
|
+
const known = items?.some((x) => x.name === current);
|
|
130
|
+
return (_jsxs(NativeSelect, { ref: ref, ...rest, value: current, disabled: disabled || needsParent || loading, "aria-busy": loading || undefined, "data-level": level, onChange: (e) => setCurrent(e.currentTarget.value), children: [_jsx("option", { value: "", children: loading ? t("loading") : needsParent ? t("provinceFirst") : placeholder ?? (level === "province" ? t("selectProvince") : t("selectDistrict")) }), current && !known && !loading ? _jsx("option", { value: current, children: current }) : null, items?.map((x) => (_jsx("option", { value: x.name, children: x.name }, x.code)))] }));
|
|
131
|
+
});
|
|
132
|
+
const DEFAULT_FIELDS = ["country", "region1", "region2", "line1", "line2", "postalCode"];
|
|
133
|
+
/**
|
|
134
|
+
* Structured postal address in a fieldset: country → province → district cascading pickers for
|
|
135
|
+
* countries with a data source (Türkiye ships built in, loaded lazily), free text elsewhere.
|
|
136
|
+
* Changing a parent clears its children (and says so to screen readers). Read-only shows the
|
|
137
|
+
* address formatted the way the country writes it.
|
|
138
|
+
*
|
|
139
|
+
* ```tsx
|
|
140
|
+
* <AddressField legend="Billing address" name="billing" defaultValue={{ country: "TR" }} required={["line1", "region1", "region2"]} />
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export const AddressField = React.forwardRef(function AddressField(props, ref) {
|
|
144
|
+
const { value, defaultValue, onValueChange, sources = { TR: trAddress }, countries, defaultCountry, fields = DEFAULT_FIELDS, required = [], layout = "grid", name, legend, hint, errors, readOnly, disabled, size, labels, className, ...rest } = props;
|
|
145
|
+
const { locale } = useLocale();
|
|
146
|
+
const t = useLabels("address", addressLabels, labels);
|
|
147
|
+
const fallbackCountry = (defaultCountry ?? (locale.toLowerCase().startsWith("tr") ? "TR" : regionOfLocale(locale)) ?? "US").toUpperCase();
|
|
148
|
+
const [address, setAddress] = useControllableState({
|
|
149
|
+
value,
|
|
150
|
+
defaultValue: defaultValue ?? { country: fallbackCountry },
|
|
151
|
+
onChange: (a) => a && onValueChange?.(a),
|
|
152
|
+
name: "AddressField",
|
|
153
|
+
});
|
|
154
|
+
const a = { ...address, country: (address?.country || fallbackCountry).toUpperCase() };
|
|
155
|
+
const source = sources[a.country];
|
|
156
|
+
const [announce, setAnnounce] = React.useState("");
|
|
157
|
+
const [postalWarning, setPostalWarning] = React.useState(null);
|
|
158
|
+
const { provinces } = useRegions(source, "province", undefined);
|
|
159
|
+
const latest = useLatest(a);
|
|
160
|
+
const set = (patch) => setAddress({ ...latest.current, ...patch });
|
|
161
|
+
const names = React.useMemo(() => displayNames(locale), [locale]);
|
|
162
|
+
const countryList = React.useMemo(() => {
|
|
163
|
+
const cmp = compareText(locale);
|
|
164
|
+
const list = (countries ?? COUNTRY_CODES).map((c) => c.toUpperCase());
|
|
165
|
+
if (!list.includes(a.country))
|
|
166
|
+
list.push(a.country);
|
|
167
|
+
return list.map((code) => ({ code, name: names?.of(code) ?? code })).sort((x, y) => cmp(x.name, y.name));
|
|
168
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
169
|
+
}, [countries, locale, names]);
|
|
170
|
+
const show = (p) => fields.includes(p);
|
|
171
|
+
const req = (p) => required.includes(p);
|
|
172
|
+
const fname = (p) => (name ? `${name}[${p}]` : undefined);
|
|
173
|
+
const usLike = US_LIKE.has(a.country);
|
|
174
|
+
if (readOnly) {
|
|
175
|
+
const lines = formatAddress(a, { locale });
|
|
176
|
+
return (_jsxs("fieldset", { ref: ref, ...rest, "data-slot": "address-field", "data-readonly": "", className: cn("grid min-w-0 gap-1.5 border-0 p-0", className), children: [legend ? _jsx("legend", { className: "mb-1.5 p-0 text-sm font-semibold text-fg", children: legend }) : null, _jsx("address", { className: "text-sm leading-relaxed text-fg not-italic", children: lines.map((l, i) => (_jsx("span", { className: cn("block", i === lines.length - 1 && lines.length > 1 && "text-fg-muted"), children: l }, i))) }), name ? Object.keys(a).map((k) => (a[k] ? _jsx("input", { type: "hidden", name: fname(k), value: a[k] }, k) : null)) : null] }));
|
|
177
|
+
}
|
|
178
|
+
const checkPostal = (code) => {
|
|
179
|
+
if (a.country !== "TR" || !code)
|
|
180
|
+
return setPostalWarning(null);
|
|
181
|
+
const plate = provinces?.find((p) => p.name === a.region1)?.code;
|
|
182
|
+
const r = checkTrPostalCode(code, plate);
|
|
183
|
+
setPostalWarning(r === "province" && plate ? t("postalMismatch", { province: a.region1, prefix: String(plate).padStart(2, "0") }) : null);
|
|
184
|
+
};
|
|
185
|
+
const parts = {
|
|
186
|
+
country: show("country") ? (_jsx(Field, { label: t("country"), name: fname("country"), required: req("country"), error: errors?.country, children: _jsx(NativeSelect, { size: size, value: a.country, autoComplete: "country", onChange: (e) => {
|
|
187
|
+
const country = e.currentTarget.value;
|
|
188
|
+
setPostalWarning(null);
|
|
189
|
+
set({ country, region1: undefined, region2: undefined, region3: undefined });
|
|
190
|
+
}, children: countryList.map((c) => (
|
|
191
|
+
// Country names come from Intl.DisplayNames, whose data differs between the server's
|
|
192
|
+
// and the browser's ICU ("Falkland Islands" vs "Falkland Islands (Islas Malvinas)").
|
|
193
|
+
_jsx("option", { value: c.code, suppressHydrationWarning: true, children: c.name }, c.code))) }) }, "country")) : null,
|
|
194
|
+
region1: show("region1") ? (_jsx(Field, { label: source ? t("province") : usLike ? t("state") : t("state"), name: fname("region1"), required: req("region1"), error: errors?.region1, children: source ? (_jsx(RegionSelect, { size: size, source: source, level: "province", value: a.region1 ?? "", labels: labels, autoComplete: "address-level1", onValueChange: (region1) => {
|
|
195
|
+
const hadChild = !!latest.current.region2;
|
|
196
|
+
set({ region1: region1 || undefined, region2: undefined, region3: undefined });
|
|
197
|
+
if (hadChild)
|
|
198
|
+
setAnnounce(t("districtCleared"));
|
|
199
|
+
} })) : (_jsx(Input, { size: size, value: a.region1 ?? "", autoComplete: "address-level1", onChange: (e) => set({ region1: e.currentTarget.value || undefined }) })) }, "region1")) : null,
|
|
200
|
+
region2: show("region2") ? (_jsx(Field, { label: source ? t("district") : t("city"), name: fname("region2"), required: req("region2"), error: errors?.region2, children: source ? (_jsx(RegionSelect, { size: size, source: source, level: "district", province: a.region1, value: a.region2 ?? "", labels: labels, autoComplete: "address-level2", onValueChange: (region2) => {
|
|
201
|
+
set({ region2: region2 || undefined, region3: undefined });
|
|
202
|
+
setAnnounce("");
|
|
203
|
+
} })) : (_jsx(Input, { size: size, value: a.region2 ?? "", autoComplete: "address-level2", onChange: (e) => set({ region2: e.currentTarget.value || undefined }) })) }, "region2")) : null,
|
|
204
|
+
region3: show("region3") ? (_jsx(Field, { label: t("city"), name: fname("region3"), required: req("region3"), error: errors?.region3, children: _jsx(Input, { size: size, value: a.region3 ?? "", autoComplete: "address-level3", onChange: (e) => set({ region3: e.currentTarget.value || undefined }) }) }, "region3")) : null,
|
|
205
|
+
line1: show("line1") ? (_jsx(Field, { label: t("line1"), name: fname("line1"), required: req("line1"), error: errors?.line1, className: layout === "grid" ? "sm:col-span-2" : undefined, children: _jsx(Input, { size: size, value: a.line1 ?? "", autoComplete: "address-line1", onChange: (e) => set({ line1: e.currentTarget.value || undefined }) }) }, "line1")) : null,
|
|
206
|
+
line2: show("line2") ? (_jsx(Field, { label: t("line2"), optional: !req("line2"), name: fname("line2"), required: req("line2"), error: errors?.line2, className: layout === "grid" ? "sm:col-span-2" : undefined, children: _jsx(Input, { size: size, value: a.line2 ?? "", autoComplete: "address-line2", onChange: (e) => set({ line2: e.currentTarget.value || undefined }) }) }, "line2")) : null,
|
|
207
|
+
postalCode: show("postalCode") ? (_jsx(Field, { label: usLike && a.country === "US" ? t("zip") : t("postalCode"), name: fname("postalCode"), required: req("postalCode"), error: errors?.postalCode, hint: postalWarning ?? undefined, children: _jsx(Input, { size: size, value: a.postalCode ?? "", autoComplete: "postal-code", inputMode: a.country === "TR" || a.country === "US" || a.country === "DE" ? "numeric" : undefined, dir: "ltr", className: "tabular", onChange: (e) => set({ postalCode: e.currentTarget.value || undefined }), onBlur: (e) => checkPostal(e.currentTarget.value.trim()) }) }, "postalCode")) : null,
|
|
208
|
+
};
|
|
209
|
+
const order = ["country", "postalCode", "region1", "region2", "region3", "line1", "line2"];
|
|
210
|
+
return (_jsxs(Fieldset, { ref: ref, ...rest, legend: legend, hint: hint, disabled: disabled, "data-slot": "address-field", "data-country": a.country, className: className, children: [_jsx("div", { className: cn("grid min-w-0 gap-x-4 gap-y-3.5", layout === "grid" && "sm:grid-cols-2"), children: order.map((p) => parts[p]) }), _jsx("span", { className: "sr-only", "aria-live": "polite", children: announce })] }));
|
|
211
|
+
});
|
|
212
|
+
function regionOfLocale(locale) {
|
|
213
|
+
try {
|
|
214
|
+
return new Intl.Locale(locale).maximize().region;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
}
|