@krizaka/ui 3.3.0 → 3.4.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/dist/activity-feed.d.ts +199 -0
- package/dist/activity-feed.js +155 -0
- package/dist/activity-feed.js.map +1 -0
- package/dist/argument-card.js +3 -3
- package/dist/chunk-7Z4KHPFC.js +42 -0
- package/dist/chunk-7Z4KHPFC.js.map +1 -0
- package/dist/data-table.js +98 -131
- package/dist/data-table.js.map +1 -1
- package/dist/description-list.d.ts +105 -0
- package/dist/description-list.js +49 -0
- package/dist/description-list.js.map +1 -0
- package/dist/index.js +13 -66
- package/dist/index.js.map +1 -1
- package/dist/kanban.d.ts +132 -0
- package/dist/kanban.js +187 -0
- package/dist/kanban.js.map +1 -0
- package/dist/list.d.ts +153 -0
- package/dist/list.js +130 -0
- package/dist/list.js.map +1 -0
- package/dist/map.d.ts +463 -0
- package/dist/map.js +952 -0
- package/dist/map.js.map +1 -0
- package/dist/motion.css +12 -1
- package/dist/native/map.d.ts +200 -0
- package/dist/native/map.js +673 -0
- package/dist/native/map.js.map +1 -0
- package/dist/native/media-picker.d.ts +58 -0
- package/dist/native/media-picker.js +63 -0
- package/dist/native/media-picker.js.map +1 -0
- package/dist/native.d.ts +568 -6
- package/dist/native.js +1989 -868
- package/dist/native.js.map +1 -1
- package/dist/page-hero.js +3 -3
- package/dist/stat.d.ts +31 -2
- package/dist/stat.js +21 -4
- package/dist/stat.js.map +1 -1
- package/dist/tree-view.d.ts +111 -0
- package/dist/tree-view.js +154 -0
- package/dist/tree-view.js.map +1 -0
- package/package.json +147 -10
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/action-sheet.json +121 -0
- package/registry/activity-feed.json +468 -0
- package/registry/alert.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +58 -3
- package/registry/badge.json +1 -1
- package/registry/button.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/countdown.json +1 -1
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +1 -1
- package/registry/date-picker.json +2 -2
- package/registry/decision-list.json +1 -1
- package/registry/description-list.json +232 -0
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/action-sheet/native/video-actions.d.ts +4 -0
- package/registry/examples/action-sheet/native/video-actions.dark.png +0 -0
- package/registry/examples/action-sheet/native/video-actions.js +30 -0
- package/registry/examples/action-sheet/native/video-actions.light.png +0 -0
- package/registry/examples/action-sheet/native/video-actions.tsx +24 -0
- package/registry/examples/activity-feed/job-activity.d.ts +4 -0
- package/registry/examples/activity-feed/job-activity.js +21 -0
- package/registry/examples/activity-feed/job-activity.tsx +17 -0
- package/registry/examples/activity-feed/live.d.ts +4 -0
- package/registry/examples/activity-feed/live.js +23 -0
- package/registry/examples/activity-feed/live.tsx +24 -0
- package/registry/examples/activity-feed/native/notifications.d.ts +4 -0
- package/registry/examples/activity-feed/native/notifications.dark.png +0 -0
- package/registry/examples/activity-feed/native/notifications.js +18 -0
- package/registry/examples/activity-feed/native/notifications.light.png +0 -0
- package/registry/examples/activity-feed/native/notifications.tsx +18 -0
- package/registry/examples/activity-feed/timeline.d.ts +4 -0
- package/registry/examples/activity-feed/timeline.js +25 -0
- package/registry/examples/activity-feed/timeline.tsx +19 -0
- package/registry/examples/avatar/native/presence.d.ts +4 -0
- package/registry/examples/avatar/native/presence.dark.png +0 -0
- package/registry/examples/avatar/native/presence.js +18 -0
- package/registry/examples/avatar/native/presence.light.png +0 -0
- package/registry/examples/avatar/native/presence.tsx +15 -0
- package/registry/examples/description-list/job-details.d.ts +4 -0
- package/registry/examples/description-list/job-details.js +23 -0
- package/registry/examples/description-list/job-details.tsx +17 -0
- package/registry/examples/description-list/key-value-grid.d.ts +4 -0
- package/registry/examples/description-list/key-value-grid.js +22 -0
- package/registry/examples/description-list/key-value-grid.tsx +16 -0
- package/registry/examples/description-list/native/job-details.d.ts +4 -0
- package/registry/examples/description-list/native/job-details.dark.png +0 -0
- package/registry/examples/description-list/native/job-details.js +33 -0
- package/registry/examples/description-list/native/job-details.light.png +0 -0
- package/registry/examples/description-list/native/job-details.tsx +24 -0
- package/registry/examples/description-list/receipt.d.ts +4 -0
- package/registry/examples/description-list/receipt.js +23 -0
- package/registry/examples/description-list/receipt.tsx +17 -0
- package/registry/examples/fab/native/extended.d.ts +4 -0
- package/registry/examples/fab/native/extended.dark.png +0 -0
- package/registry/examples/fab/native/extended.js +18 -0
- package/registry/examples/fab/native/extended.light.png +0 -0
- package/registry/examples/fab/native/extended.tsx +23 -0
- package/registry/examples/header/native/large-title.d.ts +4 -0
- package/registry/examples/header/native/large-title.dark.png +0 -0
- package/registry/examples/header/native/large-title.js +23 -0
- package/registry/examples/header/native/large-title.light.png +0 -0
- package/registry/examples/header/native/large-title.tsx +31 -0
- package/registry/examples/image-viewer/native/gallery.d.ts +4 -0
- package/registry/examples/image-viewer/native/gallery.dark.png +0 -0
- package/registry/examples/image-viewer/native/gallery.js +22 -0
- package/registry/examples/image-viewer/native/gallery.light.png +0 -0
- package/registry/examples/image-viewer/native/gallery.tsx +21 -0
- package/registry/examples/kanban/moderation.d.ts +4 -0
- package/registry/examples/kanban/moderation.js +35 -0
- package/registry/examples/kanban/moderation.tsx +37 -0
- package/registry/examples/list/jobs.d.ts +4 -0
- package/registry/examples/list/jobs.js +35 -0
- package/registry/examples/list/jobs.tsx +33 -0
- package/registry/examples/list/selectable.d.ts +4 -0
- package/registry/examples/list/selectable.js +33 -0
- package/registry/examples/list/selectable.tsx +30 -0
- package/registry/examples/list/virtualized.d.ts +4 -0
- package/registry/examples/list/virtualized.js +22 -0
- package/registry/examples/list/virtualized.tsx +17 -0
- package/registry/examples/loader/native/block.d.ts +4 -0
- package/registry/examples/loader/native/block.dark.png +0 -0
- package/registry/examples/loader/native/block.js +12 -0
- package/registry/examples/loader/native/block.light.png +0 -0
- package/registry/examples/loader/native/block.tsx +11 -0
- package/registry/examples/loader/native/job-wait.d.ts +4 -0
- package/registry/examples/loader/native/job-wait.dark.png +0 -0
- package/registry/examples/loader/native/job-wait.js +17 -0
- package/registry/examples/loader/native/job-wait.light.png +0 -0
- package/registry/examples/loader/native/job-wait.tsx +14 -0
- package/registry/examples/map/cluster.d.ts +4 -0
- package/registry/examples/map/cluster.js +16 -0
- package/registry/examples/map/cluster.tsx +18 -0
- package/registry/examples/map/location-picker.d.ts +4 -0
- package/registry/examples/map/location-picker.js +24 -0
- package/registry/examples/map/location-picker.tsx +22 -0
- package/registry/examples/map/native/location-picker.d.ts +4 -0
- package/registry/examples/map/native/location-picker.dark.png +0 -0
- package/registry/examples/map/native/location-picker.js +14 -0
- package/registry/examples/map/native/location-picker.light.png +0 -0
- package/registry/examples/map/native/location-picker.tsx +13 -0
- package/registry/examples/map/native/places.d.ts +4 -0
- package/registry/examples/map/native/places.dark.png +0 -0
- package/registry/examples/map/native/places.js +25 -0
- package/registry/examples/map/native/places.light.png +0 -0
- package/registry/examples/map/native/places.tsx +27 -0
- package/registry/examples/map/places.d.ts +4 -0
- package/registry/examples/map/places.js +28 -0
- package/registry/examples/map/places.tsx +28 -0
- package/registry/examples/map/static.d.ts +4 -0
- package/registry/examples/map/static.js +22 -0
- package/registry/examples/map/static.tsx +18 -0
- package/registry/examples/media-picker/native/story.d.ts +4 -0
- package/registry/examples/media-picker/native/story.dark.png +0 -0
- package/registry/examples/media-picker/native/story.js +30 -0
- package/registry/examples/media-picker/native/story.light.png +0 -0
- package/registry/examples/media-picker/native/story.tsx +26 -0
- package/registry/examples/meter/native/credits.d.ts +4 -0
- package/registry/examples/meter/native/credits.dark.png +0 -0
- package/registry/examples/meter/native/credits.js +15 -0
- package/registry/examples/meter/native/credits.light.png +0 -0
- package/registry/examples/meter/native/credits.tsx +12 -0
- package/registry/examples/meter/native/split-ring.d.ts +4 -0
- package/registry/examples/meter/native/split-ring.dark.png +0 -0
- package/registry/examples/meter/native/split-ring.js +24 -0
- package/registry/examples/meter/native/split-ring.light.png +0 -0
- package/registry/examples/meter/native/split-ring.tsx +19 -0
- package/registry/examples/number-ticker/native/balance.d.ts +4 -0
- package/registry/examples/number-ticker/native/balance.dark.png +0 -0
- package/registry/examples/number-ticker/native/balance.js +18 -0
- package/registry/examples/number-ticker/native/balance.light.png +0 -0
- package/registry/examples/number-ticker/native/balance.tsx +17 -0
- package/registry/examples/onboarding/native/first-launch.d.ts +4 -0
- package/registry/examples/onboarding/native/first-launch.dark.png +0 -0
- package/registry/examples/onboarding/native/first-launch.js +23 -0
- package/registry/examples/onboarding/native/first-launch.light.png +0 -0
- package/registry/examples/onboarding/native/first-launch.tsx +19 -0
- package/registry/examples/otp-input/native/invalid.d.ts +4 -0
- package/registry/examples/otp-input/native/invalid.dark.png +0 -0
- package/registry/examples/otp-input/native/invalid.js +15 -0
- package/registry/examples/otp-input/native/invalid.light.png +0 -0
- package/registry/examples/otp-input/native/invalid.tsx +14 -0
- package/registry/examples/otp-input/native/verify.d.ts +4 -0
- package/registry/examples/otp-input/native/verify.dark.png +0 -0
- package/registry/examples/otp-input/native/verify.js +17 -0
- package/registry/examples/otp-input/native/verify.light.png +0 -0
- package/registry/examples/otp-input/native/verify.tsx +14 -0
- package/registry/examples/permission-prompt/native/blocked.d.ts +4 -0
- package/registry/examples/permission-prompt/native/blocked.dark.png +0 -0
- package/registry/examples/permission-prompt/native/blocked.js +25 -0
- package/registry/examples/permission-prompt/native/blocked.light.png +0 -0
- package/registry/examples/permission-prompt/native/blocked.tsx +21 -0
- package/registry/examples/permission-prompt/native/camera.d.ts +4 -0
- package/registry/examples/permission-prompt/native/camera.dark.png +0 -0
- package/registry/examples/permission-prompt/native/camera.js +25 -0
- package/registry/examples/permission-prompt/native/camera.light.png +0 -0
- package/registry/examples/permission-prompt/native/camera.tsx +21 -0
- package/registry/examples/pull-to-refresh/native/feed.d.ts +4 -0
- package/registry/examples/pull-to-refresh/native/feed.dark.png +0 -0
- package/registry/examples/pull-to-refresh/native/feed.js +14 -0
- package/registry/examples/pull-to-refresh/native/feed.light.png +0 -0
- package/registry/examples/pull-to-refresh/native/feed.tsx +19 -0
- package/registry/examples/search-field/native/cancel.d.ts +4 -0
- package/registry/examples/search-field/native/cancel.dark.png +0 -0
- package/registry/examples/search-field/native/cancel.js +14 -0
- package/registry/examples/search-field/native/cancel.light.png +0 -0
- package/registry/examples/search-field/native/cancel.tsx +13 -0
- package/registry/examples/stat/grid.d.ts +4 -0
- package/registry/examples/stat/grid.js +17 -0
- package/registry/examples/stat/grid.tsx +14 -0
- package/registry/examples/stepper/native/run.d.ts +4 -0
- package/registry/examples/stepper/native/run.dark.png +0 -0
- package/registry/examples/stepper/native/run.js +24 -0
- package/registry/examples/stepper/native/run.light.png +0 -0
- package/registry/examples/stepper/native/run.tsx +20 -0
- package/registry/examples/swipeable-row/native/conversation.d.ts +4 -0
- package/registry/examples/swipeable-row/native/conversation.dark.png +0 -0
- package/registry/examples/swipeable-row/native/conversation.js +30 -0
- package/registry/examples/swipeable-row/native/conversation.light.png +0 -0
- package/registry/examples/swipeable-row/native/conversation.tsx +27 -0
- package/registry/examples/tab-bar/native/main-sections.d.ts +4 -0
- package/registry/examples/tab-bar/native/main-sections.dark.png +0 -0
- package/registry/examples/tab-bar/native/main-sections.js +29 -0
- package/registry/examples/tab-bar/native/main-sections.light.png +0 -0
- package/registry/examples/tab-bar/native/main-sections.tsx +30 -0
- package/registry/examples/tabs/native/sections.d.ts +4 -0
- package/registry/examples/tabs/native/sections.dark.png +0 -0
- package/registry/examples/tabs/native/sections.js +23 -0
- package/registry/examples/tabs/native/sections.light.png +0 -0
- package/registry/examples/tabs/native/sections.tsx +19 -0
- package/registry/examples/tabs/native/segmented.d.ts +4 -0
- package/registry/examples/tabs/native/segmented.dark.png +0 -0
- package/registry/examples/tabs/native/segmented.js +22 -0
- package/registry/examples/tabs/native/segmented.light.png +0 -0
- package/registry/examples/tabs/native/segmented.tsx +18 -0
- package/registry/examples/toast/native/snackbar.d.ts +4 -0
- package/registry/examples/toast/native/snackbar.dark.png +0 -0
- package/registry/examples/toast/native/snackbar.js +23 -0
- package/registry/examples/toast/native/snackbar.light.png +0 -0
- package/registry/examples/toast/native/snackbar.tsx +21 -0
- package/registry/examples/tree-view/docs.d.ts +4 -0
- package/registry/examples/tree-view/docs.js +24 -0
- package/registry/examples/tree-view/docs.tsx +22 -0
- package/registry/examples/tree-view/lazy.d.ts +4 -0
- package/registry/examples/tree-view/lazy.js +21 -0
- package/registry/examples/tree-view/lazy.tsx +19 -0
- package/registry/fab.json +122 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +2 -2
- package/registry/filter-bar.json +1 -1
- package/registry/form.json +2 -2
- package/registry/gallery-page.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/header.json +137 -0
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/image-viewer.json +107 -0
- package/registry/index.json +299 -25
- package/registry/iso.json +1 -1
- package/registry/kanban.json +253 -0
- package/registry/kbd.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +367 -30
- package/registry/loader.json +157 -4
- package/registry/longform-page.json +1 -1
- package/registry/map.json +1368 -0
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/media-capture.json +1 -1
- package/registry/media-picker.json +129 -0
- package/registry/meter.json +136 -4
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +96 -4
- package/registry/onboarding.json +95 -0
- package/registry/otp-input.json +150 -0
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/permission-prompt.json +172 -0
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +2 -2
- package/registry/promise-card.json +1 -1
- package/registry/pull-to-refresh.json +74 -0
- package/registry/radio-group.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +30 -3
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/settings-layout.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +68 -5
- package/registry/status-page.json +1 -1
- package/registry/stepper.json +75 -4
- package/registry/swipeable-row.json +124 -0
- package/registry/switch.json +1 -1
- package/registry/tab-bar.json +115 -0
- package/registry/tabs.json +94 -4
- package/registry/tag-input.json +1 -1
- package/registry/terminal-replay.json +1 -1
- package/registry/theme.json +8 -1
- package/registry/toast.json +17 -3
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +291 -0
- package/registry/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/skills/map/SKILL.md +35 -0
package/dist/list.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/list/list.tsx"],"sourcesContent":["// Client (the selection, the windowing of long lists). A list of records read top to bottom: a leading visual, a\n// title and a line, trailing details and actions — dense or comfortable, selectable with a checkbox per row, windowed\n// past a few hundred rows, with its loading, empty and error states. A real `<ul>`: each row a `<li>`, its main action\n// a link or a button that fills the row, its secondary actions beside it (never nested in the main one).\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Checkbox } from \"../checkbox\";\nimport { ChevronGlyph } from \"../glyphs\";\nimport { useControllable } from \"../media\";\n\nexport const list = tv({\n slots: {\n root: \"w-full overflow-hidden rounded-xl border border-border-default bg-surface-1\",\n scroller: \"overflow-y-auto focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n ul: \"m-0 list-none divide-y divide-border-subtle p-0\",\n item: \"relative flex items-center gap-3 px-4 transition-colors data-[state=selected]:bg-accent-soft has-[[data-main]:hover]:bg-surface-2/60\",\n main:\n \"flex min-w-0 flex-1 items-center gap-3 self-stretch text-left text-fg outline-hidden \" +\n \"focus-visible:after:absolute focus-visible:after:inset-0.5 focus-visible:after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-ring\",\n leading: \"flex shrink-0 items-center justify-center text-fg-secondary\",\n text: \"flex min-w-0 flex-1 flex-col\",\n title: \"truncate text-sm font-semibold text-fg\",\n description: \"line-clamp-2 text-xs text-fg-secondary\",\n meta: \"flex shrink-0 flex-col items-end gap-1 text-xs tabular-nums text-fg-secondary\",\n actions: \"relative z-10 flex shrink-0 items-center gap-1\",\n chevron: \"h-4 w-4 shrink-0 text-fg-muted\",\n message: \"px-4 py-10 text-center text-sm text-fg-secondary\",\n skeleton: \"animate-pulse rounded bg-surface-3 motion-reduce:animate-none\",\n footer: \"border-t border-border-default px-4 py-3\",\n },\n variants: {\n density: {\n comfortable: { item: \"min-h-16 py-2.5\" },\n compact: { item: \"min-h-11 py-1.5\", description: \"line-clamp-1\" },\n },\n },\n defaultVariants: { density: \"comfortable\" },\n});\n\nexport type ListLabels = {\n /** The checkbox of a row: `(title) => \"Select \" + title`. */\n selectRow: (title: string) => string;\n /** Read while the rows load (“Loading”). */\n loading: string;\n /** The default empty state (“Nothing to show”). */\n empty: string;\n};\n\nexport const listLabels: ListLabels = { selectRow: (title) => `Select ${title}`, loading: \"Loading\", empty: \"Nothing to show\" };\n\nexport type ListRow = {\n /** The row's main line — passed translated. */\n title: string;\n /** A second line (a detail, a status in words). */\n description?: React.ReactNode;\n /** Before the text: an `Avatar`, an icon, a thumbnail. */\n leading?: React.ReactNode;\n /** After the text: a time, an amount, a `Badge`. */\n meta?: React.ReactNode;\n /** Secondary actions beside the row (icon buttons, a menu) — outside the main action. */\n actions?: React.ReactNode;\n /** The row opens this address (its main action is a link). */\n href?: string;\n /** The row's main action (a button), when it is not a link. */\n onSelect?: () => void;\n};\n\nexport type ListProps<T> = {\n /** The records, in order. */\n items: readonly T[];\n /** A stable id per record: the React key and the selection's value. */\n getId: (item: T) => string;\n /** What a record shows: its title, line, visuals, details, actions and where it leads. */\n row: (item: T) => ListRow;\n /** The list's accessible name (“Jobs”). */\n \"aria-label\": string;\n /** comfortable (default: 64 px rows with a line) · compact (44 px: dense admin lists). */\n density?: \"comfortable\" | \"compact\";\n /** A checkbox per row. */\n selectable?: boolean;\n /** The ids selected (controlled). */\n selected?: readonly string[];\n /** The ids selected at first, uncontrolled. */\n defaultSelected?: readonly string[];\n /** Called with the new selection. */\n onSelectedChange?: (selected: string[]) => void;\n /** Shows a chevron on the rows that lead somewhere. */\n chevrons?: boolean;\n /** Loading: `loadingRows` skeleton rows and `aria-busy`. */\n loading?: boolean;\n /** How many skeleton rows. Default 5. */\n loadingRows?: number;\n /** A failure in place of the rows (an `Alert` with a retry); announced. */\n error?: React.ReactNode;\n /** Shown when there is no record (an `EmptyState`). */\n empty?: React.ReactNode;\n /** Renders only the rows in view: fixed `rowHeight`, a scrolling region of `height` px. */\n virtualize?: { rowHeight: number; height: number; overscan?: number };\n /** Under the list: a `Pagination`, a “Load more” button, a total. */\n footer?: React.ReactNode;\n /** The words, passed translated; English by default. */\n labels?: Partial<ListLabels>;\n /** Classes merged on the root. */\n className?: string;\n};\n\n/** A list of records: dense or comfortable, selectable, actions beside each row, windowed when long, with its states. */\nexport function List<T>({\n items,\n getId,\n row,\n \"aria-label\": label,\n density,\n selectable,\n selected: selectedProp,\n defaultSelected = [],\n onSelectedChange,\n chevrons,\n loading,\n loadingRows = 5,\n error,\n empty,\n virtualize,\n footer,\n labels: given,\n className,\n}: ListProps<T>) {\n const labels = { ...listLabels, ...given };\n const s = list({ density });\n const [selected, setSelected] = useControllable<readonly string[]>(selectedProp, defaultSelected, onSelectedChange as (next: readonly string[]) => void);\n const [scrollTop, setScrollTop] = React.useState(0);\n const chosen = new Set(selected);\n const toggle = (id: string) => setSelected(chosen.has(id) ? selected.filter((x) => x !== id) : [...selected, id]);\n\n let shown = items;\n let before = 0;\n let after = 0;\n if (virtualize && !loading) {\n const overscan = virtualize.overscan ?? 6;\n const start = Math.max(0, Math.floor(scrollTop / virtualize.rowHeight) - overscan);\n const end = Math.min(items.length, Math.ceil((scrollTop + virtualize.height) / virtualize.rowHeight) + overscan);\n shown = items.slice(start, end);\n before = start * virtualize.rowHeight;\n after = (items.length - end) * virtualize.rowHeight;\n }\n\n let body: React.ReactNode;\n if (loading) {\n body = Array.from({ length: loadingRows }, (_, i) => (\n <li key={`loading-${i}`} aria-hidden className={s.item()}>\n <div className={s.skeleton({ className: \"h-9 w-9 rounded-full\" })} />\n <div className=\"flex flex-1 flex-col gap-2\">\n <div className={s.skeleton({ className: \"h-3.5 w-2/5\" })} />\n <div className={s.skeleton({ className: \"h-3 w-3/5\" })} />\n </div>\n </li>\n ));\n } else if (error) {\n body = (\n <li className={s.message()}>\n <div role=\"alert\">{error}</div>\n </li>\n );\n } else if (items.length === 0) {\n body = <li className={s.message()}>{empty ?? labels.empty}</li>;\n } else {\n body = shown.map((item) => {\n const id = getId(item);\n const r = row(item);\n const isChosen = chosen.has(id);\n const content = (\n <>\n {r.leading ? <span className={s.leading()}>{r.leading}</span> : null}\n <span className={s.text()}>\n <span className={s.title()}>{r.title}</span>\n {r.description ? <span className={s.description()}>{r.description}</span> : null}\n </span>\n {r.meta ? <span className={s.meta()}>{r.meta}</span> : null}\n {chevrons && (r.href || r.onSelect) ? <ChevronGlyph direction=\"right\" className={s.chevron()} /> : null}\n </>\n );\n return (\n <li key={id} data-state={isChosen ? \"selected\" : undefined} className={s.item()} style={virtualize ? { height: virtualize.rowHeight } : undefined}>\n {selectable ? <Checkbox checked={isChosen} onCheckedChange={() => toggle(id)} aria-label={labels.selectRow(r.title)} className=\"relative z-10\" /> : null}\n {r.href ? (\n <a href={r.href} data-main=\"\" className={s.main()}>\n {content}\n </a>\n ) : r.onSelect ? (\n <button type=\"button\" data-main=\"\" onClick={r.onSelect} className={s.main()}>\n {content}\n </button>\n ) : (\n <div className={s.main()}>{content}</div>\n )}\n {r.actions ? <div className={s.actions()}>{r.actions}</div> : null}\n </li>\n );\n });\n }\n\n const ul = (\n <ul aria-label={label} aria-busy={loading || undefined} className={s.ul()}>\n {before > 0 ? <li aria-hidden style={{ height: before }} /> : null}\n {body}\n {after > 0 ? <li aria-hidden style={{ height: after }} /> : null}\n </ul>\n );\n return (\n <div className={s.root({ className })}>\n {loading ? <span className=\"sr-only\" role=\"status\">{labels.loading}</span> : null}\n {virtualize ? (\n <div tabIndex={0} role=\"region\" aria-label={label} className={s.scroller()} style={{ height: virtualize.height }} onScroll={(e) => setScrollTop(e.currentTarget.scrollTop)}>\n {ul}\n </div>\n ) : (\n ul\n )}\n {footer ? <div className={s.footer()}>{footer}</div> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAIA,YAAY,WAAW;AACvB,SAAS,UAAU;AAkJX,SAqBA,UArBA,KACA,YADA;AA5ID,IAA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AAG,eAAW,MAAC,OAAO,EAAE,QAAQ,OAAO,GAAG,IAAK;AAAA,IAC7D;AAAA,IACA,QAAQ,IAAI,oBAAC,QAAG,eAAW,MAAC,OAAO,EAAE,QAAQ,MAAM,GAAG,IAAK;AAAA,KAC9D;AAEF,SACE,qBAAC,SAAI,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GACjC;AAAA,cAAU,oBAAC,UAAK,WAAU,WAAU,MAAK,UAAU,iBAAO,SAAQ,IAAU;AAAA,IAC5E,aACC,oBAAC,SAAI,UAAU,GAAG,MAAK,UAAS,cAAY,OAAO,WAAW,EAAE,SAAS,GAAG,OAAO,EAAE,QAAQ,WAAW,OAAO,GAAG,UAAU,CAAC,MAAM,aAAa,EAAE,cAAc,SAAS,GACtK,cACH,IAEA;AAAA,IAED,SAAS,oBAAC,SAAI,WAAW,EAAE,OAAO,GAAI,kBAAO,IAAS;AAAA,KACzD;AAEJ;","names":[]}
|
package/dist/map.d.ts
ADDED
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as maplibre_gl from 'maplibre-gl';
|
|
4
|
+
import { brands } from '@krizaka/tokens/native';
|
|
5
|
+
import { Flavor } from '@protomaps/basemaps';
|
|
6
|
+
|
|
7
|
+
/** The basemap extracts: OpenStreetMap data built by Protomaps (ODbL). `world` up to zoom 6, `quebec` (Montréal–Québec) up to 14. */
|
|
8
|
+
declare const MAP_TILES: {
|
|
9
|
+
readonly world: "https://krizaka-assets.b-cdn.net/maps/v1/tiles/world-20261012.pmtiles";
|
|
10
|
+
readonly quebec: "https://krizaka-assets.b-cdn.net/maps/v1/tiles/quebec-20261012.pmtiles";
|
|
11
|
+
};
|
|
12
|
+
/** The glyphs of the labels (Noto Sans, SIL OFL): `{fontstack}` and `{range}` filled by MapLibre. */
|
|
13
|
+
declare const MAP_GLYPHS = "https://krizaka-assets.b-cdn.net/maps/v1/fonts/{fontstack}/{range}.pbf";
|
|
14
|
+
/** The words every map shows, as the licences ask: OpenStreetMap's contributors (ODbL) and Protomaps. */
|
|
15
|
+
declare const MAP_ATTRIBUTION: {
|
|
16
|
+
readonly osm: "© OpenStreetMap contributors";
|
|
17
|
+
readonly osmUrl: "https://www.openstreetmap.org/copyright";
|
|
18
|
+
readonly protomaps: "Protomaps";
|
|
19
|
+
readonly protomapsUrl: "https://protomaps.com";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Where the maps read the tiles and the glyphs, when not from the CDN itself: a same-origin path that proxies it
|
|
23
|
+
* (`https://www.krizaka.com/maps/v1`, a rewrite of the site) — no cross-origin request at all. Absolute URL, no trailing slash.
|
|
24
|
+
*/
|
|
25
|
+
declare function setMapAssetsBase(url: string | null): void;
|
|
26
|
+
/** The tiles and glyphs the maps read now: the CDN's, or under the base set by `setMapAssetsBase`. */
|
|
27
|
+
declare function mapAssets(): {
|
|
28
|
+
tiles: {
|
|
29
|
+
world: string;
|
|
30
|
+
quebec: string;
|
|
31
|
+
};
|
|
32
|
+
glyphs: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** A position: longitude, latitude (GeoJSON's order, MapLibre's `LngLat`). */
|
|
36
|
+
type LngLat = readonly [lng: number, lat: number];
|
|
37
|
+
/** The great-circle distance between two positions, in metres (haversine). */
|
|
38
|
+
declare function distanceMeters(a: LngLat, b: LngLat): number;
|
|
39
|
+
/** A circle of `radius` metres around `center` as a GeoJSON polygon (`steps` points): a delivery zone, a search radius. */
|
|
40
|
+
declare function circlePolygon(center: LngLat, radius: number, steps?: number): GeoJSON.Feature<GeoJSON.Polygon>;
|
|
41
|
+
/** The Web Mercator pixel of a position at a zoom (256-px tiles): what a static map draws without an engine. */
|
|
42
|
+
declare function project([lng, lat]: LngLat, zoom: number): [number, number];
|
|
43
|
+
/** A distance written the locale's way: metres under 1 km, kilometres (one decimal under 10) above. */
|
|
44
|
+
declare function formatDistance(meters: number, locale: string): string;
|
|
45
|
+
|
|
46
|
+
/** A product of the family: its accent paints the map. */
|
|
47
|
+
type MapBrand = keyof typeof brands;
|
|
48
|
+
/** A colour mixed into another (`#rrggbb` only): `t` = 0 gives `a`, 1 gives `b`. */
|
|
49
|
+
declare function mix(a: string, b: string, t: number): string;
|
|
50
|
+
/** The colours of the map in a scheme (and a brand): what the style, the markers and the static map share. */
|
|
51
|
+
declare function mapPalette(scheme: "dark" | "light", brand?: MapBrand): {
|
|
52
|
+
land: string;
|
|
53
|
+
background: string;
|
|
54
|
+
water: string;
|
|
55
|
+
park: string;
|
|
56
|
+
road: string;
|
|
57
|
+
roadMajor: string;
|
|
58
|
+
casing: string;
|
|
59
|
+
building: string;
|
|
60
|
+
boundary: string;
|
|
61
|
+
label: string;
|
|
62
|
+
labelStrong: string;
|
|
63
|
+
halo: string;
|
|
64
|
+
accent: string;
|
|
65
|
+
onAccent: string;
|
|
66
|
+
};
|
|
67
|
+
/** The basemap flavour of a palette: every role of Protomaps' layers filled from the tokens. */
|
|
68
|
+
declare function mapFlavor(scheme: "dark" | "light", brand?: MapBrand): Flavor;
|
|
69
|
+
/** A region of the basemap: its PMTiles file and the zoom up to which it has tiles. */
|
|
70
|
+
type MapRegion = {
|
|
71
|
+
url: string;
|
|
72
|
+
maxzoom: number;
|
|
73
|
+
};
|
|
74
|
+
type MapStyleOptions = {
|
|
75
|
+
/** `dark` or `light`: the scheme of the page or the app. */
|
|
76
|
+
scheme: "dark" | "light";
|
|
77
|
+
/** The product whose accent the map carries (its markers, its water's tint). Default `krizaka`. */
|
|
78
|
+
brand?: MapBrand;
|
|
79
|
+
/** The language of the labels (`fr`, `en`): the place names in it where OpenStreetMap has them. Default `en`. */
|
|
80
|
+
lang?: string;
|
|
81
|
+
/** The low zooms of the whole world. Default: our world extract (zoom 0–6). */
|
|
82
|
+
world?: MapRegion | null;
|
|
83
|
+
/** The detailed region drawn from zoom 7. Default: Montréal–Québec (up to 14, overzoomed beyond). */
|
|
84
|
+
region?: MapRegion | null;
|
|
85
|
+
/** The glyphs' URL template. Default: our Noto Sans on the CDN. */
|
|
86
|
+
glyphs?: string;
|
|
87
|
+
};
|
|
88
|
+
/** The zoom where the detailed region takes over from the world. */
|
|
89
|
+
declare const REGION_FROM_ZOOM = 6.5;
|
|
90
|
+
/**
|
|
91
|
+
* The MapLibre style of a Krizaka map (a `StyleSpecification`): the world's low zooms, then the detailed region,
|
|
92
|
+
* painted from the tokens. The `pmtiles://` sources need the PMTiles protocol (the web `Map` registers it; MapLibre
|
|
93
|
+
* Native reads it as it is).
|
|
94
|
+
*/
|
|
95
|
+
declare function mapStyle({ scheme, brand, lang, world, region, glyphs }: MapStyleOptions): {
|
|
96
|
+
version: 8;
|
|
97
|
+
glyphs: string;
|
|
98
|
+
sources: Record<string, unknown>;
|
|
99
|
+
layers: {
|
|
100
|
+
[k: string]: unknown;
|
|
101
|
+
id: string;
|
|
102
|
+
minzoom?: number;
|
|
103
|
+
maxzoom?: number;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type MapLibre = typeof maplibre_gl;
|
|
108
|
+
type MapInstance = maplibre_gl.Map;
|
|
109
|
+
declare const map: tailwind_variants.TVReturnType<{
|
|
110
|
+
[key: string]: {
|
|
111
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
112
|
+
root?: tailwind_variants.ClassValue;
|
|
113
|
+
canvas?: tailwind_variants.ClassValue;
|
|
114
|
+
fallback?: tailwind_variants.ClassValue;
|
|
115
|
+
controls?: tailwind_variants.ClassValue;
|
|
116
|
+
attribution?: tailwind_variants.ClassValue;
|
|
117
|
+
places?: tailwind_variants.ClassValue;
|
|
118
|
+
markerLabel?: tailwind_variants.ClassValue;
|
|
119
|
+
control?: tailwind_variants.ClassValue;
|
|
120
|
+
marker?: tailwind_variants.ClassValue;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
} | {
|
|
124
|
+
[x: string]: {
|
|
125
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
126
|
+
root?: tailwind_variants.ClassValue;
|
|
127
|
+
canvas?: tailwind_variants.ClassValue;
|
|
128
|
+
fallback?: tailwind_variants.ClassValue;
|
|
129
|
+
controls?: tailwind_variants.ClassValue;
|
|
130
|
+
attribution?: tailwind_variants.ClassValue;
|
|
131
|
+
places?: tailwind_variants.ClassValue;
|
|
132
|
+
markerLabel?: tailwind_variants.ClassValue;
|
|
133
|
+
control?: tailwind_variants.ClassValue;
|
|
134
|
+
marker?: tailwind_variants.ClassValue;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
} | {}, {
|
|
138
|
+
root: string;
|
|
139
|
+
canvas: string;
|
|
140
|
+
fallback: string;
|
|
141
|
+
controls: string;
|
|
142
|
+
control: string;
|
|
143
|
+
attribution: string;
|
|
144
|
+
places: string;
|
|
145
|
+
marker: string;
|
|
146
|
+
markerLabel: string;
|
|
147
|
+
}, undefined, {
|
|
148
|
+
[key: string]: {
|
|
149
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
150
|
+
root?: tailwind_variants.ClassValue;
|
|
151
|
+
canvas?: tailwind_variants.ClassValue;
|
|
152
|
+
fallback?: tailwind_variants.ClassValue;
|
|
153
|
+
controls?: tailwind_variants.ClassValue;
|
|
154
|
+
attribution?: tailwind_variants.ClassValue;
|
|
155
|
+
places?: tailwind_variants.ClassValue;
|
|
156
|
+
markerLabel?: tailwind_variants.ClassValue;
|
|
157
|
+
control?: tailwind_variants.ClassValue;
|
|
158
|
+
marker?: tailwind_variants.ClassValue;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
} | {}, {
|
|
162
|
+
root: string;
|
|
163
|
+
canvas: string;
|
|
164
|
+
fallback: string;
|
|
165
|
+
controls: string;
|
|
166
|
+
control: string;
|
|
167
|
+
attribution: string;
|
|
168
|
+
places: string;
|
|
169
|
+
marker: string;
|
|
170
|
+
markerLabel: string;
|
|
171
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
172
|
+
root: string;
|
|
173
|
+
canvas: string;
|
|
174
|
+
fallback: string;
|
|
175
|
+
controls: string;
|
|
176
|
+
control: string;
|
|
177
|
+
attribution: string;
|
|
178
|
+
places: string;
|
|
179
|
+
marker: string;
|
|
180
|
+
markerLabel: string;
|
|
181
|
+
}>>;
|
|
182
|
+
type Registry = {
|
|
183
|
+
add: (id: string, text: string) => void;
|
|
184
|
+
remove: (id: string) => void;
|
|
185
|
+
};
|
|
186
|
+
type Ctx = {
|
|
187
|
+
map: MapInstance | null;
|
|
188
|
+
lib: MapLibre | null;
|
|
189
|
+
ready: boolean;
|
|
190
|
+
reduce: boolean;
|
|
191
|
+
places: Registry;
|
|
192
|
+
};
|
|
193
|
+
/** The map a child is drawn on (`Marker`, `RadiusCircle`, `Cluster`…): the MapLibre instance once it is ready. */
|
|
194
|
+
declare function useMap(): Ctx;
|
|
195
|
+
/**
|
|
196
|
+
* Where MapLibre's worker comes from. A bundler (Next.js, Vite) renames MapLibre's module and leaves its worker behind:
|
|
197
|
+
* by default the worker of the very version the app installed is imported from jsDelivr (free, open source, no key)
|
|
198
|
+
* through a module worker of the page's own origin. An app with a strict CSP serves it itself —
|
|
199
|
+
* `configureMaps({ workerUrl: "/maplibre-gl-worker.mjs" })` (with `maplibre-gl-shared.mjs` beside it), once, before a map.
|
|
200
|
+
* `assetsBase` reads the tiles and glyphs through a same-origin proxy of the CDN (`setMapAssetsBase`).
|
|
201
|
+
*/
|
|
202
|
+
declare function configureMaps(options: {
|
|
203
|
+
workerUrl?: string;
|
|
204
|
+
assetsBase?: string;
|
|
205
|
+
}): void;
|
|
206
|
+
type MapLabels = {
|
|
207
|
+
/** The zoom-in button ("Zoom in"). */
|
|
208
|
+
zoomIn: string;
|
|
209
|
+
/** The zoom-out button ("Zoom out"). */
|
|
210
|
+
zoomOut: string;
|
|
211
|
+
/** Before the list of places read in place of the map ("Places on the map"). */
|
|
212
|
+
places: string;
|
|
213
|
+
};
|
|
214
|
+
declare const mapLabels: MapLabels;
|
|
215
|
+
type MapProps = {
|
|
216
|
+
/** The map's accessible name ("Pick-up points near you"), passed translated. */
|
|
217
|
+
label: string;
|
|
218
|
+
/** Where the map looks at first: longitude, latitude. */
|
|
219
|
+
center: LngLat;
|
|
220
|
+
/** The zoom at first (0 the world, 12 a city, 16 a street). Default 12. */
|
|
221
|
+
zoom?: number;
|
|
222
|
+
/** The camera follows `center` and `zoom` when they change (flies, or jumps under reduced motion). */
|
|
223
|
+
controlled?: boolean;
|
|
224
|
+
/** The scheme. Default: the page's (`html.light`), followed. */
|
|
225
|
+
scheme?: "dark" | "light";
|
|
226
|
+
/** The product whose accent the map carries. Default `krizaka`. */
|
|
227
|
+
brand?: MapBrand;
|
|
228
|
+
/** The language of the labels (`fr`, `en`). Default `en`. */
|
|
229
|
+
lang?: string;
|
|
230
|
+
/** The detailed region (PMTiles) drawn from zoom 6.5. Default: our Montréal–Québec extract (to zoom 14). */
|
|
231
|
+
region?: MapRegion | null;
|
|
232
|
+
/** The world's low zooms (PMTiles). Default: our world extract (to zoom 6). */
|
|
233
|
+
world?: MapRegion | null;
|
|
234
|
+
/** The zoom buttons (default) — the keyboard also zooms with + and − on the focused map. */
|
|
235
|
+
controls?: boolean;
|
|
236
|
+
/** Moves with the hand (default); `false` makes a still picture of a place. */
|
|
237
|
+
interactive?: boolean;
|
|
238
|
+
/** Shown in place of the map while its engine loads, and for good without WebGL: a `StaticMap`, a picture. */
|
|
239
|
+
fallback?: React.ReactNode;
|
|
240
|
+
/** Called when the camera rests: its centre and zoom. */
|
|
241
|
+
onMoveEnd?: (view: {
|
|
242
|
+
center: LngLat;
|
|
243
|
+
zoom: number;
|
|
244
|
+
}) => void;
|
|
245
|
+
/** Called with the position pressed on the map (not on a marker). */
|
|
246
|
+
onPress?: (position: LngLat) => void;
|
|
247
|
+
/** Markers, circles, clusters, the user's position — and anything drawn over the map. */
|
|
248
|
+
children?: React.ReactNode;
|
|
249
|
+
/** The words, passed translated; English by default. */
|
|
250
|
+
labels?: Partial<MapLabels>;
|
|
251
|
+
/** Classes merged on the root (its height: `h-80`, `aspect-video`). */
|
|
252
|
+
className?: string;
|
|
253
|
+
};
|
|
254
|
+
/** A map: MapLibre over our Protomaps tiles, styled from the tokens, with its places as a list for screen readers. */
|
|
255
|
+
declare function Map({ label, center, zoom, controlled, scheme: schemeProp, brand, lang, region, world, controls, interactive, fallback, onMoveEnd, onPress, children, labels: given, className, }: MapProps): React.JSX.Element;
|
|
256
|
+
type MarkerProps = {
|
|
257
|
+
/** Where it stands. */
|
|
258
|
+
position: LngLat;
|
|
259
|
+
/** Its words: the place's name, read in the list of places and as the button's name ("Café Olimpico, 350 m"). */
|
|
260
|
+
label: string;
|
|
261
|
+
/** Pressing it (details in a panel, a sheet): the marker becomes a button. */
|
|
262
|
+
onPress?: () => void;
|
|
263
|
+
/** The chosen one: larger, its label shown above it. */
|
|
264
|
+
selected?: boolean;
|
|
265
|
+
/** Its size in pixels. Default 18. */
|
|
266
|
+
size?: number;
|
|
267
|
+
/** What it draws instead of the accent dot (an avatar, an icon). */
|
|
268
|
+
children?: React.ReactNode;
|
|
269
|
+
};
|
|
270
|
+
/** A place on the map: an accent dot (or your content) that is a button when it does something. */
|
|
271
|
+
declare function Marker({ position, label, onPress, selected, size, children }: MarkerProps): React.ReactPortal | null;
|
|
272
|
+
type UserPositionProps = {
|
|
273
|
+
/** Where the person is. */
|
|
274
|
+
position: LngLat;
|
|
275
|
+
/** Its words ("You are here"), read in the list of places. */
|
|
276
|
+
label: string;
|
|
277
|
+
/** The accuracy in metres: a soft disc around the dot. */
|
|
278
|
+
accuracy?: number;
|
|
279
|
+
};
|
|
280
|
+
/** The person's position: a dot that pulses (still under reduced motion), its accuracy as a soft disc. */
|
|
281
|
+
declare function UserPosition({ position, label, accuracy }: UserPositionProps): React.JSX.Element | null;
|
|
282
|
+
type RadiusCircleProps = {
|
|
283
|
+
/** Its centre. */
|
|
284
|
+
center: LngLat;
|
|
285
|
+
/** Its radius in metres. */
|
|
286
|
+
radius: number;
|
|
287
|
+
/** `accent` (a zone that matters: a delivery area, a search radius) or `soft` (an accuracy). */
|
|
288
|
+
tone?: "accent" | "soft";
|
|
289
|
+
};
|
|
290
|
+
/** A circle on the ground: a delivery zone, a search radius — filled with the accent, its edge drawn. */
|
|
291
|
+
declare function RadiusCircle({ center, radius, tone }: RadiusCircleProps): null;
|
|
292
|
+
type ClusterPoint = {
|
|
293
|
+
id: string;
|
|
294
|
+
position: LngLat;
|
|
295
|
+
label: string;
|
|
296
|
+
};
|
|
297
|
+
type ClusterProps = {
|
|
298
|
+
/** The points: many of them (creators, pick-up points, events). */
|
|
299
|
+
points: readonly ClusterPoint[];
|
|
300
|
+
/** Pressing a single point. A group zooms in to open itself. */
|
|
301
|
+
onPointPress?: (point: ClusterPoint) => void;
|
|
302
|
+
/** The radius, in pixels, within which points group. Default 48. */
|
|
303
|
+
radius?: number;
|
|
304
|
+
};
|
|
305
|
+
/** Many points grouped while they are close: a disc with the count, opened by zooming in; each point is listed for screen readers. */
|
|
306
|
+
declare function Cluster({ points, onPointPress, radius }: ClusterProps): null;
|
|
307
|
+
|
|
308
|
+
declare const locationPicker: tailwind_variants.TVReturnType<{
|
|
309
|
+
[key: string]: {
|
|
310
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
311
|
+
root?: tailwind_variants.ClassValue;
|
|
312
|
+
status?: tailwind_variants.ClassValue;
|
|
313
|
+
frame?: tailwind_variants.ClassValue;
|
|
314
|
+
pin?: tailwind_variants.ClassValue;
|
|
315
|
+
bar?: tailwind_variants.ClassValue;
|
|
316
|
+
chip?: tailwind_variants.ClassValue;
|
|
317
|
+
near?: tailwind_variants.ClassValue;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
} | {
|
|
321
|
+
[x: string]: {
|
|
322
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
323
|
+
root?: tailwind_variants.ClassValue;
|
|
324
|
+
status?: tailwind_variants.ClassValue;
|
|
325
|
+
frame?: tailwind_variants.ClassValue;
|
|
326
|
+
pin?: tailwind_variants.ClassValue;
|
|
327
|
+
bar?: tailwind_variants.ClassValue;
|
|
328
|
+
chip?: tailwind_variants.ClassValue;
|
|
329
|
+
near?: tailwind_variants.ClassValue;
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
} | {}, {
|
|
333
|
+
root: string;
|
|
334
|
+
frame: string;
|
|
335
|
+
pin: string;
|
|
336
|
+
bar: string;
|
|
337
|
+
chip: string;
|
|
338
|
+
near: string;
|
|
339
|
+
status: string;
|
|
340
|
+
}, undefined, {
|
|
341
|
+
[key: string]: {
|
|
342
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
343
|
+
root?: tailwind_variants.ClassValue;
|
|
344
|
+
status?: tailwind_variants.ClassValue;
|
|
345
|
+
frame?: tailwind_variants.ClassValue;
|
|
346
|
+
pin?: tailwind_variants.ClassValue;
|
|
347
|
+
bar?: tailwind_variants.ClassValue;
|
|
348
|
+
chip?: tailwind_variants.ClassValue;
|
|
349
|
+
near?: tailwind_variants.ClassValue;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
} | {}, {
|
|
353
|
+
root: string;
|
|
354
|
+
frame: string;
|
|
355
|
+
pin: string;
|
|
356
|
+
bar: string;
|
|
357
|
+
chip: string;
|
|
358
|
+
near: string;
|
|
359
|
+
status: string;
|
|
360
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
361
|
+
root: string;
|
|
362
|
+
frame: string;
|
|
363
|
+
pin: string;
|
|
364
|
+
bar: string;
|
|
365
|
+
chip: string;
|
|
366
|
+
near: string;
|
|
367
|
+
status: string;
|
|
368
|
+
}>>;
|
|
369
|
+
type LocationPickerLabels = {
|
|
370
|
+
/** The button that centres the map on the person ("Near me"). */
|
|
371
|
+
nearMe: string;
|
|
372
|
+
/** While the position is asked ("Finding you…"). */
|
|
373
|
+
locating: string;
|
|
374
|
+
/** The person refused ("Location is off for this site. Move the map instead."). */
|
|
375
|
+
denied: string;
|
|
376
|
+
/** No position (no GPS, a timeout) ("We could not find you. Move the map instead."). */
|
|
377
|
+
unavailable: string;
|
|
378
|
+
/** The person's place in the list of places ("You are here"). */
|
|
379
|
+
you: string;
|
|
380
|
+
/** The distance chip, from a written distance ("1.2 km from you"). */
|
|
381
|
+
distance: (distance: string) => string;
|
|
382
|
+
};
|
|
383
|
+
declare const locationPickerLabels: LocationPickerLabels;
|
|
384
|
+
type LocationPickerProps = Pick<MapProps, "scheme" | "brand" | "lang" | "region" | "world" | "fallback" | "className"> & {
|
|
385
|
+
/** The picker's accessible name ("Meeting point"), passed translated. */
|
|
386
|
+
label: string;
|
|
387
|
+
/** The chosen position (controlled): the centre of the map. */
|
|
388
|
+
value: LngLat;
|
|
389
|
+
/** Called when the map rests on a new position. */
|
|
390
|
+
onValueChange: (value: LngLat) => void;
|
|
391
|
+
/** The BCP 47 locale of the distance. */
|
|
392
|
+
locale: string;
|
|
393
|
+
/** The zoom at first. Default 14. */
|
|
394
|
+
zoom?: number;
|
|
395
|
+
/** A radius in metres drawn around the chosen position (a delivery zone, a search radius). */
|
|
396
|
+
radius?: number;
|
|
397
|
+
/** Where the person is, when the app already knows it (the distance chip shows at once). */
|
|
398
|
+
origin?: LngLat | null;
|
|
399
|
+
/** The words, passed translated; English by default. */
|
|
400
|
+
labels?: Partial<LocationPickerLabels>;
|
|
401
|
+
};
|
|
402
|
+
/** A position picked by moving the map under a pin; its distance from the person; "near me" on request. */
|
|
403
|
+
declare function LocationPicker({ label, value, onValueChange, locale, zoom, radius, origin: originProp, labels: given, className, ...map }: LocationPickerProps): React.JSX.Element;
|
|
404
|
+
|
|
405
|
+
declare const staticMap: tailwind_variants.TVReturnType<{
|
|
406
|
+
[key: string]: {
|
|
407
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
408
|
+
root?: tailwind_variants.ClassValue;
|
|
409
|
+
attribution?: tailwind_variants.ClassValue;
|
|
410
|
+
svg?: tailwind_variants.ClassValue;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
} | {
|
|
414
|
+
[x: string]: {
|
|
415
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
416
|
+
root?: tailwind_variants.ClassValue;
|
|
417
|
+
attribution?: tailwind_variants.ClassValue;
|
|
418
|
+
svg?: tailwind_variants.ClassValue;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
} | {}, {
|
|
422
|
+
root: string;
|
|
423
|
+
svg: string;
|
|
424
|
+
attribution: string;
|
|
425
|
+
}, undefined, {
|
|
426
|
+
[key: string]: {
|
|
427
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
428
|
+
root?: tailwind_variants.ClassValue;
|
|
429
|
+
attribution?: tailwind_variants.ClassValue;
|
|
430
|
+
svg?: tailwind_variants.ClassValue;
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
} | {}, {
|
|
434
|
+
root: string;
|
|
435
|
+
svg: string;
|
|
436
|
+
attribution: string;
|
|
437
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
438
|
+
root: string;
|
|
439
|
+
svg: string;
|
|
440
|
+
attribution: string;
|
|
441
|
+
}>>;
|
|
442
|
+
type StaticMapPlace = {
|
|
443
|
+
position: LngLat;
|
|
444
|
+
label: string;
|
|
445
|
+
};
|
|
446
|
+
type StaticMapProps = {
|
|
447
|
+
/** What the picture shows, in words ("Three pick-up points in the Plateau"), passed translated: its accessible name. */
|
|
448
|
+
label: string;
|
|
449
|
+
/** The centre of the picture. */
|
|
450
|
+
center: LngLat;
|
|
451
|
+
/** The zoom of the picture. Default 12. */
|
|
452
|
+
zoom?: number;
|
|
453
|
+
/** The places drawn on it (an accent dot each), listed in its name. */
|
|
454
|
+
places?: readonly StaticMapPlace[];
|
|
455
|
+
/** A snapshot of the real map of the area (same centre and zoom), drawn under the places; the attribution then shows. */
|
|
456
|
+
image?: string;
|
|
457
|
+
/** Classes merged on the root (its size). */
|
|
458
|
+
className?: string;
|
|
459
|
+
};
|
|
460
|
+
/** A still map: the places on the map's paper (or on a snapshot), named in words. */
|
|
461
|
+
declare function StaticMap({ label, center, zoom, places, image, className }: StaticMapProps): React.JSX.Element;
|
|
462
|
+
|
|
463
|
+
export { Cluster, type ClusterPoint, type ClusterProps, type LngLat, LocationPicker, type LocationPickerLabels, type LocationPickerProps, MAP_ATTRIBUTION, MAP_GLYPHS, MAP_TILES, Map, type MapBrand, type MapLabels, type MapProps, type MapRegion, type MapStyleOptions, Marker, type MarkerProps, REGION_FROM_ZOOM, RadiusCircle, type RadiusCircleProps, StaticMap, type StaticMapPlace, type StaticMapProps, UserPosition, type UserPositionProps, circlePolygon, configureMaps, distanceMeters, formatDistance, locationPicker, locationPickerLabels, map, mapAssets, mapFlavor, mapLabels, mapPalette, mapStyle, mix, project, setMapAssetsBase, staticMap, useMap };
|