@zonsh/ui 0.5.0 → 0.6.1
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/CHANGELOG.md +643 -0
- package/README.md +49 -21
- package/dist/brand.d.ts +3 -0
- package/dist/brand.js +7 -0
- package/dist/components/_breadcrumb-more.d.ts +6 -0
- package/dist/components/_breadcrumb-more.js +5 -0
- package/dist/components/_drawing-svg.d.ts +11 -0
- package/dist/components/_drawing-svg.js +30 -0
- package/dist/components/_media.d.ts +159 -0
- package/dist/components/_media.js +266 -0
- package/dist/components/_overlay.d.ts +8 -5
- package/dist/components/_overlay.js +11 -6
- package/dist/components/_scheduler-calendar.d.ts +71 -0
- package/dist/components/_scheduler-calendar.js +940 -0
- package/dist/components/_scheduler-editor.d.ts +29 -0
- package/dist/components/_scheduler-editor.js +111 -0
- package/dist/components/_scheduler-menu.d.ts +16 -0
- package/dist/components/_scheduler-menu.js +18 -0
- package/dist/components/_scheduler-parts.d.ts +164 -0
- package/dist/components/_scheduler-parts.js +327 -0
- package/dist/components/_suggest-list.d.ts +142 -0
- package/dist/components/_suggest-list.js +159 -0
- package/dist/components/_toolbar-more.d.ts +24 -0
- package/dist/components/_toolbar-more.js +25 -0
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +6 -6
- package/dist/components/action-sheet.d.ts +88 -0
- package/dist/components/action-sheet.js +124 -0
- package/dist/components/alert-dialog.js +3 -1
- package/dist/components/alert.d.ts +11 -18
- package/dist/components/alert.js +9 -6
- package/dist/components/app-bar.d.ts +93 -0
- package/dist/components/app-bar.js +175 -0
- package/dist/components/audio-player.d.ts +134 -0
- package/dist/components/audio-player.js +618 -0
- package/dist/components/avatar.d.ts +6 -6
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.d.ts +12 -12
- package/dist/components/badge.js +7 -5
- package/dist/components/bottom-nav.d.ts +53 -11
- package/dist/components/bottom-nav.js +388 -23
- package/dist/components/breadcrumb.d.ts +11 -2
- package/dist/components/breadcrumb.js +60 -6
- package/dist/components/button-group.js +5 -1
- package/dist/components/button.d.ts +23 -6
- package/dist/components/button.js +63 -7
- package/dist/components/calendar.js +8 -6
- package/dist/components/card.d.ts +10 -8
- package/dist/components/card.js +15 -14
- package/dist/components/carousel.d.ts +2 -2
- package/dist/components/carousel.js +21 -8
- package/dist/components/chart.d.ts +27 -1
- package/dist/components/chart.js +15 -5
- package/dist/components/checkbox.js +2 -2
- package/dist/components/code-block.d.ts +9 -2
- package/dist/components/code-block.js +26 -7
- package/dist/components/collapsible.js +3 -3
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/color-picker.js +5 -5
- package/dist/components/combobox.d.ts +26 -7
- package/dist/components/combobox.js +32 -13
- package/dist/components/command.d.ts +29 -5
- package/dist/components/command.js +35 -10
- package/dist/components/context-menu.d.ts +5 -2
- package/dist/components/context-menu.js +24 -3
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +67 -13
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.d.ts +6 -6
- package/dist/components/data-table.js +41 -15
- package/dist/components/date-picker.d.ts +31 -9
- package/dist/components/date-picker.js +100 -18
- package/dist/components/dialog.d.ts +17 -10
- package/dist/components/dialog.js +20 -13
- package/dist/components/drawer.d.ts +26 -8
- package/dist/components/drawer.js +75 -16
- package/dist/components/drawing.d.ts +25 -0
- package/dist/components/drawing.js +32 -0
- package/dist/components/empty.js +2 -2
- package/dist/components/feature-list.d.ts +65 -13
- package/dist/components/feature-list.js +116 -15
- package/dist/components/field.js +2 -2
- package/dist/components/file-drop.d.ts +9 -7
- package/dist/components/file-drop.js +8 -43
- package/dist/components/filter-bar.d.ts +10 -9
- package/dist/components/filter-bar.js +42 -25
- package/dist/components/graph.d.ts +19 -3
- package/dist/components/graph.js +170 -25
- package/dist/components/illustration.js +3 -28
- package/dist/components/input-group.d.ts +5 -10
- package/dist/components/input-group.js +16 -16
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/item.d.ts +9 -6
- package/dist/components/item.js +13 -8
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/lightbox.d.ts +76 -9
- package/dist/components/lightbox.js +333 -45
- package/dist/components/locale.d.ts +6 -6
- package/dist/components/logo.d.ts +21 -1
- package/dist/components/logo.js +32 -2
- package/dist/components/markdown-editor.d.ts +275 -0
- package/dist/components/markdown-editor.js +831 -0
- package/dist/components/mentions.d.ts +153 -0
- package/dist/components/mentions.js +507 -0
- package/dist/components/menu.d.ts +2 -1
- package/dist/components/menu.js +5 -4
- package/dist/components/menubar.d.ts +23 -5
- package/dist/components/menubar.js +97 -22
- package/dist/components/message.d.ts +62 -11
- package/dist/components/message.js +49 -13
- package/dist/components/meter.js +1 -1
- package/dist/components/money-input.d.ts +1 -1
- package/dist/components/money-input.js +1 -1
- package/dist/components/native-select.d.ts +2 -2
- package/dist/components/native-select.js +4 -4
- package/dist/components/navigation-menu.d.ts +3 -1
- package/dist/components/navigation-menu.js +23 -12
- package/dist/components/number-field.d.ts +2 -9
- package/dist/components/number-field.js +86 -36
- package/dist/components/number-roll.d.ts +26 -0
- package/dist/components/number-roll.js +81 -0
- package/dist/components/otp-field.d.ts +1 -1
- package/dist/components/otp-field.js +24 -3
- package/dist/components/pagination.d.ts +11 -3
- package/dist/components/pagination.js +59 -13
- package/dist/components/pdf-viewer.d.ts +1 -1
- package/dist/components/pdf-viewer.js +8 -8
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +2 -2
- package/dist/components/popover.js +5 -3
- package/dist/components/preview-card.d.ts +37 -2
- package/dist/components/preview-card.js +226 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/prompt-input.d.ts +1 -1
- package/dist/components/prompt-input.js +24 -14
- package/dist/components/pull-to-refresh.d.ts +50 -0
- package/dist/components/pull-to-refresh.js +189 -0
- package/dist/components/quote.d.ts +6 -1
- package/dist/components/quote.js +3 -2
- package/dist/components/radio-group.js +1 -1
- package/dist/components/rating.d.ts +4 -1
- package/dist/components/rating.js +131 -10
- package/dist/components/reasoning.d.ts +1 -1
- package/dist/components/reasoning.js +7 -3
- package/dist/components/resizable.d.ts +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/response.d.ts +1 -1
- package/dist/components/response.js +18 -6
- package/dist/components/scheduler.d.ts +352 -0
- package/dist/components/scheduler.js +1717 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.d.ts +17 -4
- package/dist/components/select.js +140 -9
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -3
- package/dist/components/sidebar.d.ts +44 -3
- package/dist/components/sidebar.js +57 -17
- package/dist/components/site-header.d.ts +18 -13
- package/dist/components/site-header.js +23 -11
- package/dist/components/skeleton.d.ts +17 -7
- package/dist/components/skeleton.js +22 -7
- package/dist/components/slider.js +2 -2
- package/dist/components/sortable.d.ts +55 -4
- package/dist/components/sortable.js +172 -103
- package/dist/components/sources.d.ts +1 -1
- package/dist/components/sources.js +2 -2
- package/dist/components/spinner.d.ts +4 -4
- package/dist/components/spinner.js +4 -4
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +17 -8
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +8 -7
- package/dist/components/suggestions.d.ts +11 -3
- package/dist/components/suggestions.js +10 -4
- package/dist/components/swipe-actions.d.ts +66 -0
- package/dist/components/swipe-actions.js +292 -0
- package/dist/components/switch.js +1 -1
- package/dist/components/table.d.ts +12 -6
- package/dist/components/table.js +78 -30
- package/dist/components/tabs.js +7 -4
- package/dist/components/tag.d.ts +19 -20
- package/dist/components/tag.js +9 -5
- package/dist/components/tags-input.d.ts +2 -7
- package/dist/components/tags-input.js +11 -8
- package/dist/components/textarea.d.ts +3 -2
- package/dist/components/textarea.js +4 -3
- package/dist/components/theme.d.ts +49 -6
- package/dist/components/theme.js +147 -9
- package/dist/components/time-field.d.ts +4 -9
- package/dist/components/time-field.js +6 -6
- package/dist/components/timeline.d.ts +19 -3
- package/dist/components/timeline.js +21 -9
- package/dist/components/tippy.d.ts +17 -1
- package/dist/components/tippy.js +95 -15
- package/dist/components/toast.d.ts +2 -7
- package/dist/components/toast.js +12 -8
- package/dist/components/toggle-group.d.ts +7 -1
- package/dist/components/toggle-group.js +16 -5
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +3 -2
- package/dist/components/tool-call.d.ts +1 -1
- package/dist/components/tool-call.js +4 -4
- package/dist/components/toolbar.d.ts +57 -4
- package/dist/components/toolbar.js +216 -16
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +4 -2
- package/dist/components/tour.d.ts +1 -1
- package/dist/components/tour.js +36 -15
- package/dist/components/tree.js +5 -5
- package/dist/components/typography.d.ts +31 -8
- package/dist/components/typography.js +21 -10
- package/dist/components/video-player.d.ts +7 -2
- package/dist/components/video-player.js +121 -220
- package/dist/index.d.ts +99 -92
- package/dist/index.js +99 -92
- package/dist/lib/calendar.d.ts +153 -0
- package/dist/lib/calendar.js +312 -0
- package/dist/lib/cn.d.ts +3 -1
- package/dist/lib/cn.js +5 -0
- package/dist/lib/code-highlight.d.ts +14 -0
- package/dist/lib/code-highlight.js +81 -18
- package/dist/lib/drag.d.ts +39 -0
- package/dist/lib/drag.js +96 -0
- package/dist/lib/editorial-assets.js +16 -8
- package/dist/lib/figure/figures/automation.js +25 -6
- package/dist/lib/figure/figures/bar-chart.js +6 -1
- package/dist/lib/figure/figures/brackets-classic.js +4 -1
- package/dist/lib/figure/figures/city.js +12 -2
- package/dist/lib/figure/figures/conveyor.js +17 -4
- package/dist/lib/figure/figures/database.js +5 -2
- package/dist/lib/figure/figures/documents.js +11 -3
- package/dist/lib/figure/figures/inbox.js +5 -2
- package/dist/lib/figure/figures/laptop.js +3 -1
- package/dist/lib/figure/figures/pipeline.js +45 -10
- package/dist/lib/figure/figures/platform.js +62 -7
- package/dist/lib/figure/figures/server.js +21 -5
- package/dist/lib/figure/figures/spreadsheet.js +29 -5
- package/dist/lib/figure/kernel.d.ts +4 -2
- package/dist/lib/figure/kernel.js +10 -5
- package/dist/lib/figure/parts.js +6 -2
- package/dist/lib/files.d.ts +31 -0
- package/dist/lib/files.js +60 -0
- package/dist/lib/gesture.d.ts +70 -0
- package/dist/lib/gesture.js +141 -0
- package/dist/lib/glide.d.ts +5 -0
- package/dist/lib/glide.js +9 -1
- package/dist/lib/icons.d.ts +1 -0
- package/dist/lib/icons.js +6 -0
- package/dist/lib/illustration-library.js +1 -6
- package/dist/lib/markdown-edit.d.ts +112 -0
- package/dist/lib/markdown-edit.js +557 -0
- package/dist/lib/markdown-rich-editor.d.ts +188 -0
- package/dist/lib/markdown-rich-editor.js +1153 -0
- package/dist/lib/markdown-rich.d.ts +63 -0
- package/dist/lib/markdown-rich.js +534 -0
- package/dist/lib/mentions.d.ts +100 -0
- package/dist/lib/mentions.js +246 -0
- package/dist/lib/motion.d.ts +18 -0
- package/dist/lib/motion.js +43 -5
- package/dist/lib/number-roll.d.ts +89 -0
- package/dist/lib/number-roll.js +391 -0
- package/dist/lib/platform.d.ts +6 -0
- package/dist/lib/platform.js +14 -0
- package/dist/lib/portal-container.d.ts +9 -0
- package/dist/lib/portal-container.js +10 -0
- package/dist/lib/press.d.ts +5 -0
- package/dist/lib/press.js +186 -0
- package/dist/lib/scheduler.d.ts +128 -0
- package/dist/lib/scheduler.js +272 -0
- package/dist/lib/scroll-edges.d.ts +9 -0
- package/dist/lib/scroll-edges.js +50 -0
- package/dist/lib/table-fit.d.ts +1 -1
- package/dist/lib/table-fit.js +65 -8
- package/dist/lib/theme-preset.d.ts +267 -0
- package/dist/lib/theme-preset.js +1046 -0
- package/dist/lib/theme-script.d.ts +23 -3
- package/dist/lib/theme-script.js +17 -5
- package/dist/lib/tippy/sprite.d.ts +36 -4
- package/dist/lib/tippy/sprite.js +188 -15
- package/dist/lib/tone.d.ts +4 -0
- package/dist/lib/tone.js +1 -0
- package/dist/messages/de.d.ts +3 -3
- package/dist/messages/de.js +274 -3
- package/dist/skills/zon-ui/SKILL.md +279 -0
- package/dist/skills/zon-ui/references/authoring.md +265 -0
- package/dist/skills/zon-ui/references/brand.md +416 -0
- package/dist/skills/zon-ui/references/components/accordion.md +199 -0
- package/dist/skills/zon-ui/references/components/action-sheet.md +268 -0
- package/dist/skills/zon-ui/references/components/alert-dialog.md +276 -0
- package/dist/skills/zon-ui/references/components/alert.md +167 -0
- package/dist/skills/zon-ui/references/components/app-bar.md +307 -0
- package/dist/skills/zon-ui/references/components/ascii-field.md +121 -0
- package/dist/skills/zon-ui/references/components/aspect-ratio.md +112 -0
- package/dist/skills/zon-ui/references/components/audio-player.md +231 -0
- package/dist/skills/zon-ui/references/components/avatar.md +98 -0
- package/dist/skills/zon-ui/references/components/badge.md +227 -0
- package/dist/skills/zon-ui/references/components/bottom-nav.md +709 -0
- package/dist/skills/zon-ui/references/components/breadcrumb.md +143 -0
- package/dist/skills/zon-ui/references/components/button-group.md +216 -0
- package/dist/skills/zon-ui/references/components/button.md +309 -0
- package/dist/skills/zon-ui/references/components/calendar.md +296 -0
- package/dist/skills/zon-ui/references/components/card.md +158 -0
- package/dist/skills/zon-ui/references/components/carousel.md +297 -0
- package/dist/skills/zon-ui/references/components/chart.md +739 -0
- package/dist/skills/zon-ui/references/components/chat.md +417 -0
- package/dist/skills/zon-ui/references/components/checkbox.md +219 -0
- package/dist/skills/zon-ui/references/components/code-block.md +143 -0
- package/dist/skills/zon-ui/references/components/code-highlight.md +118 -0
- package/dist/skills/zon-ui/references/components/collapsible.md +146 -0
- package/dist/skills/zon-ui/references/components/color-picker.md +200 -0
- package/dist/skills/zon-ui/references/components/combobox.md +455 -0
- package/dist/skills/zon-ui/references/components/command.md +326 -0
- package/dist/skills/zon-ui/references/components/contact-form.md +562 -0
- package/dist/skills/zon-ui/references/components/context-menu.md +159 -0
- package/dist/skills/zon-ui/references/components/conversation.md +146 -0
- package/dist/skills/zon-ui/references/components/copy-button.md +162 -0
- package/dist/skills/zon-ui/references/components/crm.md +1022 -0
- package/dist/skills/zon-ui/references/components/dashboard.md +612 -0
- package/dist/skills/zon-ui/references/components/data-table.md +776 -0
- package/dist/skills/zon-ui/references/components/date-picker.md +444 -0
- package/dist/skills/zon-ui/references/components/dialog.md +335 -0
- package/dist/skills/zon-ui/references/components/direction.md +165 -0
- package/dist/skills/zon-ui/references/components/drawer.md +276 -0
- package/dist/skills/zon-ui/references/components/drawing.md +94 -0
- package/dist/skills/zon-ui/references/components/empty.md +225 -0
- package/dist/skills/zon-ui/references/components/feature-list.md +412 -0
- package/dist/skills/zon-ui/references/components/field.md +209 -0
- package/dist/skills/zon-ui/references/components/file-drop.md +234 -0
- package/dist/skills/zon-ui/references/components/filter-bar.md +485 -0
- package/dist/skills/zon-ui/references/components/form.md +970 -0
- package/dist/skills/zon-ui/references/components/graph.md +339 -0
- package/dist/skills/zon-ui/references/components/illustration.md +497 -0
- package/dist/skills/zon-ui/references/components/inbox.md +263 -0
- package/dist/skills/zon-ui/references/components/input-group.md +339 -0
- package/dist/skills/zon-ui/references/components/input.md +189 -0
- package/dist/skills/zon-ui/references/components/item.md +277 -0
- package/dist/skills/zon-ui/references/components/kanban.md +626 -0
- package/dist/skills/zon-ui/references/components/kbd.md +116 -0
- package/dist/skills/zon-ui/references/components/label.md +104 -0
- package/dist/skills/zon-ui/references/components/layout.md +291 -0
- package/dist/skills/zon-ui/references/components/lightbox.md +235 -0
- package/dist/skills/zon-ui/references/components/locale.md +279 -0
- package/dist/skills/zon-ui/references/components/logo.md +257 -0
- package/dist/skills/zon-ui/references/components/markdown-editor.md +558 -0
- package/dist/skills/zon-ui/references/components/mentions.md +512 -0
- package/dist/skills/zon-ui/references/components/menu.md +218 -0
- package/dist/skills/zon-ui/references/components/menubar.md +292 -0
- package/dist/skills/zon-ui/references/components/message.md +243 -0
- package/dist/skills/zon-ui/references/components/meter.md +105 -0
- package/dist/skills/zon-ui/references/components/money-input.md +333 -0
- package/dist/skills/zon-ui/references/components/native-select.md +197 -0
- package/dist/skills/zon-ui/references/components/navigation-menu.md +253 -0
- package/dist/skills/zon-ui/references/components/number-field.md +210 -0
- package/dist/skills/zon-ui/references/components/number-roll.md +175 -0
- package/dist/skills/zon-ui/references/components/onboarding.md +896 -0
- package/dist/skills/zon-ui/references/components/otp-field.md +166 -0
- package/dist/skills/zon-ui/references/components/pagination.md +109 -0
- package/dist/skills/zon-ui/references/components/pdf-viewer.md +177 -0
- package/dist/skills/zon-ui/references/components/phone-input.md +252 -0
- package/dist/skills/zon-ui/references/components/popover.md +176 -0
- package/dist/skills/zon-ui/references/components/preview-card.md +193 -0
- package/dist/skills/zon-ui/references/components/pricing.md +724 -0
- package/dist/skills/zon-ui/references/components/progress.md +92 -0
- package/dist/skills/zon-ui/references/components/prompt-input.md +307 -0
- package/dist/skills/zon-ui/references/components/pull-to-refresh.md +188 -0
- package/dist/skills/zon-ui/references/components/quote.md +115 -0
- package/dist/skills/zon-ui/references/components/radio-group.md +215 -0
- package/dist/skills/zon-ui/references/components/rating.md +260 -0
- package/dist/skills/zon-ui/references/components/reasoning.md +102 -0
- package/dist/skills/zon-ui/references/components/resizable.md +213 -0
- package/dist/skills/zon-ui/references/components/response.md +170 -0
- package/dist/skills/zon-ui/references/components/scheduler.md +732 -0
- package/dist/skills/zon-ui/references/components/scroll-area.md +122 -0
- package/dist/skills/zon-ui/references/components/select.md +351 -0
- package/dist/skills/zon-ui/references/components/separator.md +103 -0
- package/dist/skills/zon-ui/references/components/settings.md +793 -0
- package/dist/skills/zon-ui/references/components/shop.md +1715 -0
- package/dist/skills/zon-ui/references/components/sidebar.md +813 -0
- package/dist/skills/zon-ui/references/components/sign-in.md +1639 -0
- package/dist/skills/zon-ui/references/components/site-header.md +303 -0
- package/dist/skills/zon-ui/references/components/skeleton.md +256 -0
- package/dist/skills/zon-ui/references/components/slider.md +172 -0
- package/dist/skills/zon-ui/references/components/sortable.md +405 -0
- package/dist/skills/zon-ui/references/components/sources.md +106 -0
- package/dist/skills/zon-ui/references/components/spinner.md +222 -0
- package/dist/skills/zon-ui/references/components/stat.md +267 -0
- package/dist/skills/zon-ui/references/components/stepper.md +285 -0
- package/dist/skills/zon-ui/references/components/suggestions.md +146 -0
- package/dist/skills/zon-ui/references/components/swipe-actions.md +344 -0
- package/dist/skills/zon-ui/references/components/switch.md +160 -0
- package/dist/skills/zon-ui/references/components/table.md +999 -0
- package/dist/skills/zon-ui/references/components/tabs.md +258 -0
- package/dist/skills/zon-ui/references/components/tag.md +115 -0
- package/dist/skills/zon-ui/references/components/tags-input.md +216 -0
- package/dist/skills/zon-ui/references/components/textarea.md +95 -0
- package/dist/skills/zon-ui/references/components/theme-editor.md +3940 -0
- package/dist/skills/zon-ui/references/components/theme.md +362 -0
- package/dist/skills/zon-ui/references/components/time-field.md +222 -0
- package/dist/skills/zon-ui/references/components/timeline.md +285 -0
- package/dist/skills/zon-ui/references/components/tippy.md +243 -0
- package/dist/skills/zon-ui/references/components/toast.md +220 -0
- package/dist/skills/zon-ui/references/components/toggle-group.md +261 -0
- package/dist/skills/zon-ui/references/components/toggle.md +167 -0
- package/dist/skills/zon-ui/references/components/tool-call.md +146 -0
- package/dist/skills/zon-ui/references/components/toolbar.md +260 -0
- package/dist/skills/zon-ui/references/components/tooltip.md +172 -0
- package/dist/skills/zon-ui/references/components/tour.md +423 -0
- package/dist/skills/zon-ui/references/components/tree.md +481 -0
- package/dist/skills/zon-ui/references/components/typography.md +347 -0
- package/dist/skills/zon-ui/references/components/video-player.md +386 -0
- package/dist/skills/zon-ui/references/marketing.md +467 -0
- package/dist/skills/zon-ui/references/motion.md +455 -0
- package/dist/skills/zon-ui/references/recipes.md +1232 -0
- package/dist/skills/zon-ui/references/tokens.md +866 -0
- package/dist/sources/accordion.css +4 -0
- package/dist/sources/action-sheet.css +11 -0
- package/dist/sources/alert-dialog.css +6 -0
- package/dist/sources/alert.css +3 -0
- package/dist/sources/app-bar.css +14 -0
- package/dist/sources/ascii-field.css +3 -0
- package/dist/sources/aspect-ratio.css +3 -0
- package/dist/sources/audio-player.css +20 -0
- package/dist/sources/avatar.css +3 -0
- package/dist/sources/badge.css +3 -0
- package/dist/sources/bottom-nav.css +9 -0
- package/dist/sources/breadcrumb.css +14 -0
- package/dist/sources/button-group.css +3 -0
- package/dist/sources/button.css +9 -0
- package/dist/sources/calendar.css +13 -0
- package/dist/sources/card.css +3 -0
- package/dist/sources/carousel.css +11 -0
- package/dist/sources/chart.css +5 -0
- package/dist/sources/checkbox.css +6 -0
- package/dist/sources/code-block.css +13 -0
- package/dist/sources/collapsible.css +4 -0
- package/dist/sources/color-picker.css +13 -0
- package/dist/sources/combobox.css +13 -0
- package/dist/sources/command.css +13 -0
- package/dist/sources/context-menu.css +12 -0
- package/dist/sources/conversation.css +10 -0
- package/dist/sources/copy-button.css +10 -0
- package/dist/sources/data-table.css +27 -0
- package/dist/sources/date-picker.css +20 -0
- package/dist/sources/dialog.css +9 -0
- package/dist/sources/direction.css +2 -0
- package/dist/sources/drawer.css +9 -0
- package/dist/sources/drawing.css +5 -0
- package/dist/sources/empty.css +3 -0
- package/dist/sources/feature-list.css +4 -0
- package/dist/sources/field.css +4 -0
- package/dist/sources/file-drop.css +15 -0
- package/dist/sources/filter-bar.css +30 -0
- package/dist/sources/form.css +4 -0
- package/dist/sources/graph.css +19 -0
- package/dist/sources/illustration.css +28 -0
- package/dist/sources/input-group.css +7 -0
- package/dist/sources/input.css +3 -0
- package/dist/sources/item.css +4 -0
- package/dist/sources/kbd.css +5 -0
- package/dist/sources/label.css +3 -0
- package/dist/sources/layout.css +3 -0
- package/dist/sources/lightbox.css +33 -0
- package/dist/sources/locale.css +2 -0
- package/dist/sources/logo.css +4 -0
- package/dist/sources/markdown-editor.css +41 -0
- package/dist/sources/mentions.css +13 -0
- package/dist/sources/menu.css +11 -0
- package/dist/sources/menubar.css +14 -0
- package/dist/sources/message.css +16 -0
- package/dist/sources/meter.css +4 -0
- package/dist/sources/money-input.css +10 -0
- package/dist/sources/native-select.css +4 -0
- package/dist/sources/navigation-menu.css +8 -0
- package/dist/sources/number-field.css +8 -0
- package/dist/sources/number-roll.css +6 -0
- package/dist/sources/otp-field.css +5 -0
- package/dist/sources/pagination.css +11 -0
- package/dist/sources/pdf-viewer.css +30 -0
- package/dist/sources/phone-input.css +20 -0
- package/dist/sources/popover.css +7 -0
- package/dist/sources/preview-card.css +7 -0
- package/dist/sources/progress.css +4 -0
- package/dist/sources/prompt-input.css +15 -0
- package/dist/sources/pull-to-refresh.css +14 -0
- package/dist/sources/quote.css +3 -0
- package/dist/sources/radio-group.css +5 -0
- package/dist/sources/rating.css +6 -0
- package/dist/sources/reasoning.css +6 -0
- package/dist/sources/resizable.css +4 -0
- package/dist/sources/response.css +16 -0
- package/dist/sources/scheduler.css +44 -0
- package/dist/sources/scroll-area.css +3 -0
- package/dist/sources/select.css +12 -0
- package/dist/sources/separator.css +3 -0
- package/dist/sources/sidebar.css +19 -0
- package/dist/sources/site-header.css +15 -0
- package/dist/sources/skeleton.css +3 -0
- package/dist/sources/slider.css +6 -0
- package/dist/sources/sortable.css +12 -0
- package/dist/sources/sources.css +6 -0
- package/dist/sources/spinner.css +6 -0
- package/dist/sources/stat.css +9 -0
- package/dist/sources/stepper.css +6 -0
- package/dist/sources/suggestions.css +10 -0
- package/dist/sources/swipe-actions.css +20 -0
- package/dist/sources/switch.css +5 -0
- package/dist/sources/table.css +7 -0
- package/dist/sources/tabs.css +5 -0
- package/dist/sources/tag.css +3 -0
- package/dist/sources/tags-input.css +6 -0
- package/dist/sources/textarea.css +3 -0
- package/dist/sources/theme.css +13 -0
- package/dist/sources/time-field.css +7 -0
- package/dist/sources/timeline.css +7 -0
- package/dist/sources/tippy.css +6 -0
- package/dist/sources/toast.css +6 -0
- package/dist/sources/toggle-group.css +5 -0
- package/dist/sources/toggle.css +3 -0
- package/dist/sources/tool-call.css +16 -0
- package/dist/sources/toolbar.css +14 -0
- package/dist/sources/tooltip.css +6 -0
- package/dist/sources/tour.css +14 -0
- package/dist/sources/tree.css +6 -0
- package/dist/sources/typography.css +4 -0
- package/dist/sources/video-player.css +21 -0
- package/dist/styles/ai.css +3 -0
- package/dist/styles/brand.css +98 -0
- package/dist/styles/core.css +266 -0
- package/dist/styles/editor.css +3 -0
- package/dist/styles/expressive.css +35 -56
- package/dist/styles/fonts.css +61 -117
- package/dist/styles/graph.css +4 -0
- package/dist/styles/illustration.css +4 -0
- package/dist/styles/index.css +11 -201
- package/dist/styles/material.css +138 -12
- package/dist/styles/parts/ai.css +18 -13
- package/dist/styles/parts/brand.css +2 -2
- package/dist/styles/parts/controls.css +29 -20
- package/dist/styles/parts/data.css +13 -9
- package/dist/styles/parts/editor.css +372 -0
- package/dist/styles/parts/feedback.css +32 -2
- package/dist/styles/parts/foundations.css +12 -7
- package/dist/styles/parts/graph.css +25 -9
- package/dist/styles/parts/inputs.css +172 -9
- package/dist/styles/parts/isometric.css +6 -5
- package/dist/styles/parts/navigation.css +206 -27
- package/dist/styles/parts/overlays.css +19 -4
- package/dist/styles/parts/pdf.css +2 -2
- package/dist/styles/pdf.css +3 -0
- package/dist/styles/prose.css +3 -0
- package/dist/styles/tokens.css +89 -14
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +5 -0
- package/dist/vite.d.ts +48 -59
- package/dist/vite.js +54 -21
- package/package.json +69 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "../lib/icons.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { glideMotion, glideStyle, useGlide, useMergedRef } from "../lib/glide.js";
|
|
@@ -11,6 +11,7 @@ const defaultMessages = {
|
|
|
11
11
|
previous: "Previous page",
|
|
12
12
|
next: "Next page",
|
|
13
13
|
page: (page) => `Page ${page}`,
|
|
14
|
+
status: (page, count) => `Page ${page} of ${count}`,
|
|
14
15
|
};
|
|
15
16
|
const PAGE = '[data-slot="pagination-page"]';
|
|
16
17
|
const findCurrent = (nav) => nav.querySelector(`${PAGE}[aria-current="page"]`);
|
|
@@ -38,7 +39,7 @@ function getPages(page, count, siblings) {
|
|
|
38
39
|
* something short. Under ~50 rows, show them all; a table with `dense` rows is easier to scan
|
|
39
40
|
* than a page switcher.
|
|
40
41
|
*/
|
|
41
|
-
export function Pagination({ page, pageCount, onPageChange, getHref, siblingCount = 1, size = "default", labels, className, ref, ...props }) {
|
|
42
|
+
export function Pagination({ page, pageCount, onPageChange, getHref, siblingCount = 1, compact = "auto", size = "default", labels, className, ref, ...props }) {
|
|
42
43
|
const [navRef, setNavRef] = useMergedRef(ref);
|
|
43
44
|
const glide = useGlide(navRef, findCurrent, { attributes: ["aria-current"], items: PAGE });
|
|
44
45
|
// A count straight from a division (95 rows / 10) rounds up; one that is not a number yet, or
|
|
@@ -50,7 +51,49 @@ export function Pagination({ page, pageCount, onPageChange, getHref, siblingCoun
|
|
|
50
51
|
// the nearest one, so a page still reads as current and Previous and Next still lead somewhere.
|
|
51
52
|
// Choosing a page reports it whenever it differs from `page` itself.
|
|
52
53
|
const current = Number.isNaN(page) ? 1 : Math.min(Math.max(Math.floor(page), 1), Math.max(count, 1));
|
|
53
|
-
const
|
|
54
|
+
const wanted = siblingCount >= 0 ? Math.floor(siblingCount) : 1;
|
|
55
|
+
// Where the row of pages would not fit on one line (a phone), the current page goes without
|
|
56
|
+
// neighbours — 1 … 4 … 12 — rather than wrapping the pager onto a second line; where even that
|
|
57
|
+
// would not fit, the pager turns compact (with `compact="auto"`).
|
|
58
|
+
const [fit, setFit] = React.useState("full");
|
|
59
|
+
React.useLayoutEffect(() => {
|
|
60
|
+
const nav = navRef.current;
|
|
61
|
+
const box = nav?.parentElement;
|
|
62
|
+
if (!nav || !box || typeof ResizeObserver === "undefined" || compact === true)
|
|
63
|
+
return;
|
|
64
|
+
if (wanted === 0 && compact === false)
|
|
65
|
+
return;
|
|
66
|
+
const measure = () => {
|
|
67
|
+
const list = nav.querySelector("ul");
|
|
68
|
+
const arrow = list?.firstElementChild;
|
|
69
|
+
if (!list || !arrow)
|
|
70
|
+
return;
|
|
71
|
+
const style = getComputedStyle(box);
|
|
72
|
+
const room = box.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
|
|
73
|
+
// Every slot is about an arrow's width: the arrows, first, last, the current page, its
|
|
74
|
+
// neighbours and two ellipses.
|
|
75
|
+
const width = (siblings, gapRem) => {
|
|
76
|
+
const slots = Math.min(count, siblings * 2 + 5) + 2;
|
|
77
|
+
// Measured in the root font size, as the gaps are rem (gap-1.5, gap-1).
|
|
78
|
+
const gap = parseFloat(getComputedStyle(document.documentElement).fontSize) * gapRem;
|
|
79
|
+
return slots * arrow.offsetWidth + (slots - 1) * gap;
|
|
80
|
+
};
|
|
81
|
+
// Not laid out (no width to measure): as it is.
|
|
82
|
+
const over = (w) => w > room + 0.5;
|
|
83
|
+
setFit(!over(width(wanted, 0.375))
|
|
84
|
+
? "full"
|
|
85
|
+
: compact === "auto" && over(width(0, 0.25))
|
|
86
|
+
? "compact"
|
|
87
|
+
: "tight");
|
|
88
|
+
};
|
|
89
|
+
measure();
|
|
90
|
+
const observer = new ResizeObserver(measure);
|
|
91
|
+
observer.observe(box);
|
|
92
|
+
return () => observer.disconnect();
|
|
93
|
+
}, [navRef, count, wanted, compact]);
|
|
94
|
+
const tight = fit !== "full";
|
|
95
|
+
const isCompact = compact === true || (compact === "auto" && fit === "compact");
|
|
96
|
+
const siblings = tight ? 0 : wanted;
|
|
54
97
|
const pages = getPages(current, count, siblings);
|
|
55
98
|
const square = size === "sm" ? "min-w-(--control-h-sm) px-2" : "min-w-(--control-h) px-2.5";
|
|
56
99
|
// Previous and Next are exactly square at any control height, not as wide as chevron + padding.
|
|
@@ -62,19 +105,22 @@ export function Pagination({ page, pageCount, onPageChange, getHref, siblingCoun
|
|
|
62
105
|
return (_jsx(Button, { variant: "secondary", size: size, disabled: disabled,
|
|
63
106
|
// Previous and Next stay focusable when they run out, so pressing Next onto the last
|
|
64
107
|
// page leaves keyboard focus on it instead of dropping it to the page.
|
|
65
|
-
focusableWhenDisabled: true, nativeButton: !asLink, render: asLink ? _jsx("a", { href: getHref(target) }) : undefined, onClick: () => !disabled && target !== page && onPageChange?.(target),
|
|
108
|
+
focusableWhenDisabled: true, nativeButton: !asLink, render: asLink ? _jsx("a", { href: getHref(target) }) : undefined, onClick: () => !disabled && target !== page && onPageChange?.(target), ...extra,
|
|
109
|
+
// On a touch screen each takes a 44px tap (touch-target), also at 38px.
|
|
110
|
+
className: cn("touch-target", extra.className ?? square), children: content }));
|
|
66
111
|
};
|
|
67
|
-
return (_jsxs("nav", { "aria-label": text.nav, "data-slot": "pagination", "data-size": size, "data-glide": glide.visible ? "" : undefined, ref: setNavRef, className: cn("group/pagination relative flex", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "pagination-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-button ring-1 ring-control-focus"), style: glideStyle(glide) }), _jsxs("ul", { className: "m-0 flex list-none flex-wrap items-center
|
|
112
|
+
return (_jsxs("nav", { "aria-label": text.nav, "data-slot": "pagination", "data-size": size, "data-compact": isCompact ? "" : undefined, "data-glide": glide.visible ? "" : undefined, ref: setNavRef, className: cn("group/pagination relative flex", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "pagination-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "z-10 rounded-button ring-1 ring-control-focus"), style: glideStyle(glide) }), _jsxs("ul", { className: cn("m-0 flex list-none flex-wrap items-center p-0 [&>li]:flex", tight ? "gap-1" : "gap-1.5"), children: [_jsx("li", { children: control(current - 1, _jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }), {
|
|
68
113
|
"aria-label": text.previous,
|
|
69
114
|
className: arrow,
|
|
70
|
-
}) }),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
115
|
+
}) }), isCompact && (_jsxs("li", { "data-slot": "pagination-status", className: "items-center justify-center px-2", children: [_jsxs("span", { "aria-hidden": true, className: "font-mono text-13 leading-none whitespace-nowrap text-foreground-soft tabular-nums", children: [Math.min(current, Math.max(count, 1)), _jsxs("span", { className: "text-muted-foreground", children: [" / ", count] })] }), _jsx("span", { className: "sr-only", children: text.status(current, count) })] })), !isCompact &&
|
|
116
|
+
pages.map((p) => typeof p === "number" ? (_jsx("li", { children: control(p, p, {
|
|
117
|
+
"aria-label": text.page(p),
|
|
118
|
+
"aria-current": p === current ? "page" : undefined,
|
|
119
|
+
"data-slot": "pagination-page",
|
|
120
|
+
className: cn(square, "font-mono text-13 leading-none font-normal tabular-nums", "aria-[current=page]:bg-control-hover aria-[current=page]:shadow-raised-current",
|
|
121
|
+
// The gliding indicator carries the focus edge once it is placed.
|
|
122
|
+
"group-data-glide/pagination:aria-[current=page]:shadow-raised"),
|
|
123
|
+
}) }, p)) : (_jsx("li", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("inline-flex items-center justify-center font-mono text-13 text-muted-foreground", square), children: "\u2026" }, p))), _jsx("li", { children: control(current + 1, _jsx(ChevronRightIcon, { className: "rtl:-scale-x-100" }), {
|
|
78
124
|
"aria-label": text.next,
|
|
79
125
|
className: arrow,
|
|
80
126
|
}) })] })] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4
|
-
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, DownloadIcon, FileTextIcon, FileWarningIcon, LayoutGridIcon, ListTreeIcon, MaximizeIcon, MinimizeIcon, MinusIcon, PanelLeftIcon, PlusIcon, PrinterIcon, RotateCwIcon, SearchIcon, XIcon, } from "
|
|
4
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, DownloadIcon, FileTextIcon, FileWarningIcon, LayoutGridIcon, ListTreeIcon, MaximizeIcon, MinimizeIcon, MinusIcon, PanelLeftIcon, PlusIcon, PrinterIcon, RotateCwIcon, SearchIcon, XIcon, } from "../lib/icons.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { CSS_UNITS, loadPdfjs, openPdf, pdfFileName, } from "../lib/pdf.js";
|
|
@@ -512,7 +512,7 @@ function OutlineRow({ entry, current, onSelect, }) {
|
|
|
512
512
|
const text = React.useContext(TextContext);
|
|
513
513
|
const [open, setOpen] = React.useState(true);
|
|
514
514
|
const nested = entry.children.length > 0;
|
|
515
|
-
return (_jsxs("li", { className: "flex flex-col gap-0.5", children: [_jsxs("div", { className: "flex items-center", children: [nested ? (_jsx("button", { type: "button", "aria-label": open ? text.collapse(entry.title) : text.expand(entry.title), "aria-expanded": open, onClick: () => setOpen((o) => !o), className: "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-checkbox text-muted-foreground focus-ring transition-colors duration-(--duration) ease-(--ease) hover:text-foreground", children: _jsx(ChevronRightIcon, { "aria-hidden": true, className: cn("size-3.5 transition-transform duration-(--duration) ease-(--ease) motion-reduce:transition-none rtl:-scale-x-100", open && "rotate-90 rtl:-rotate-90") }) })) : (_jsx("span", { "aria-hidden": true, className: "w-6 shrink-0" })), _jsxs("button", { type: "button", disabled: !entry.target && !entry.url, "aria-current": entry === current ? "true" : undefined, onClick: () => onSelect(entry), className: "flex min-h-(--control-h-sm) min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-item material-row px-2 text-start text-
|
|
515
|
+
return (_jsxs("li", { className: "flex flex-col gap-0.5", children: [_jsxs("div", { className: "flex items-center", children: [nested ? (_jsx("button", { type: "button", "aria-label": open ? text.collapse(entry.title) : text.expand(entry.title), "aria-expanded": open, onClick: () => setOpen((o) => !o), className: "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-checkbox text-muted-foreground focus-ring transition-colors duration-(--duration-fade) ease-(--ease) hover:text-foreground", children: _jsx(ChevronRightIcon, { "aria-hidden": true, className: cn("size-3.5 transition-transform duration-(--duration) ease-(--ease) motion-reduce:transition-none rtl:-scale-x-100", open && "rotate-90 rtl:-rotate-90") }) })) : (_jsx("span", { "aria-hidden": true, className: "w-6 shrink-0" })), _jsxs("button", { type: "button", disabled: !entry.target && !entry.url, "aria-current": entry === current ? "true" : undefined, onClick: () => onSelect(entry), className: "flex min-h-(--control-h-sm) min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-item material-row px-2 text-start text-13 leading-tight focus-ring disabled:cursor-default disabled:opacity-60", children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: entry.title }), entry.target && (_jsx("span", { className: "font-mono text-11 text-muted-foreground tabular-nums", children: String(entry.target.page).padStart(2, "0") }))] })] }), nested && open && (_jsx("div", { className: "ps-4", children: _jsx(OutlineList, { entries: entry.children, current: current, onSelect: onSelect }) }))] }));
|
|
516
516
|
}
|
|
517
517
|
/* ── Viewer ─────────────────────────────────────────────────────────────────── */
|
|
518
518
|
const ZOOM_STEPS = [0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4];
|
|
@@ -900,7 +900,7 @@ function Reader({ src, fileName, variant = "region", defaultZoom = "auto", defau
|
|
|
900
900
|
sizes?.map((size, i) => (_jsx(Thumbnail, { doc: doc, n: i + 1, size: size, rotation: rotation, current: page === i + 1, onSelect: goTo }, i))), [doc, sizes, rotation, page, goTo]);
|
|
901
901
|
return (_jsxs("div", { ref: root, "data-slot": "pdf-viewer", "data-variant": variant, "data-fullscreen": isFullscreen ? "" : undefined, "aria-busy": state.status === "idle" || state.status === "loading", onKeyDown: handleKeyDown, className: cn("@container/pdf relative flex h-[min(80svh,46rem)] min-h-0 w-full min-w-0 flex-col font-body", viewerVariants[variant], className,
|
|
902
902
|
// Last, so filling the window beats a height given in `className`.
|
|
903
|
-
isFullscreen && "fixed inset-0 z-50 h-svh w-screen rounded-none border-0 bg-background"), ...props, children: [_jsx("div", { "data-slot": "pdf-viewer-header", className: "flex shrink-0 items-center border-b border-border/
|
|
903
|
+
isFullscreen && "fixed inset-0 z-50 h-svh w-screen rounded-none border-0 bg-background"), ...props, children: [_jsx("div", { "data-slot": "pdf-viewer-header", className: "flex shrink-0 items-center border-b border-border/(--hairline-opacity) p-1.5", children: state.status === "error" ? (_jsxs(Toolbar, { "data-slot": "pdf-viewer-toolbar", "aria-label": text.toolbar, className: "w-full min-w-0", children: [_jsxs("span", { className: "flex min-h-(--control-h-sm) min-w-0 flex-1 items-center gap-2 px-2 font-mono text-xs text-muted-foreground", children: [_jsx(FileWarningIcon, { "aria-hidden": true, className: "size-4 shrink-0" }), _jsx("span", { className: "truncate", children: name })] }), toolbarEnd && _jsx(ToolbarGroup, { className: "ms-auto", children: toolbarEnd })] })) : (_jsxs(Toolbar, { "data-slot": "pdf-viewer-toolbar", "aria-label": text.toolbar, className: "w-full min-w-0 flex-wrap", children: [thumbnails && (_jsxs(_Fragment, { children: [_jsx(Tool, { label: railOpen ? text.hideSidebar : text.showSidebar, "aria-pressed": railOpen, disabled: !ready, onClick: () => setRailOpen((o) => !o), className: "hidden @3xl/pdf:inline-flex", children: _jsx(PanelLeftIcon, { "aria-hidden": true, className: "rtl:-scale-x-100" }) }), _jsx(ToolbarSeparator, { className: "hidden @3xl/pdf:block" })] })), _jsxs(ToolbarGroup, { children: [_jsx(Tool, { label: text.previousPage, disabled: !ready || page <= 1, onClick: () => goTo(page - 1), className: "hidden @min-[25rem]/pdf:inline-flex", children: _jsx(ChevronLeftIcon, { "aria-hidden": true, className: "rtl:-scale-x-100" }) }), _jsxs("span", { className: "flex items-center gap-1.5 px-1 font-mono text-xs text-muted-foreground tabular-nums", children: [_jsx(BaseToolbar.Input, { "aria-label": text.pageField, disabled: !ready, inputMode: "numeric", value: pageDraft ?? String(page), onChange: (e) => setPageDraft(e.currentTarget.value.replace(/\D/g, "")), onFocus: (e) => e.currentTarget.select(), onBlur: commitPage, onKeyDown: (e) => {
|
|
904
904
|
if (e.key === "Enter") {
|
|
905
905
|
// Not a submit of a form the viewer sits in.
|
|
906
906
|
e.preventDefault();
|
|
@@ -911,10 +911,10 @@ function Reader({ src, fileName, variant = "region", defaultZoom = "auto", defau
|
|
|
911
911
|
e.stopPropagation();
|
|
912
912
|
setPageDraft(null);
|
|
913
913
|
}
|
|
914
|
-
}, render: _jsx(Input, { size: "sm", className: "w-11 px-1 text-center font-mono tabular-nums" }) }), _jsx("span", { "aria-hidden": true, children: "/" }), _jsx("span", { "aria-label": text.ofPages(count), children: count || "–" })] }), _jsx(Tool, { label: text.nextPage, disabled: !ready || page >= count, onClick: () => goTo(page + 1), className: "hidden @min-[25rem]/pdf:inline-flex", children: _jsx(ChevronRightIcon, { "aria-hidden": true, className: "rtl:-scale-x-100" }) })] }), _jsx(ToolbarSeparator, {}), _jsxs(ToolbarGroup, { children: [_jsx(Tool, { label: text.zoomOut, disabled: !ready || scale <= 0.26, onClick: () => zoomBy(-1), className: "hidden @md/pdf:inline-flex", children: _jsx(MinusIcon, { "aria-hidden": true }) }), _jsxs(Menu, { children: [_jsxs(ToolbarButton, { disabled: !ready, "aria-label": text.zoom(Math.round(scale * 100)), render: _jsx(MenuTrigger, {}), className: "w-16 gap-1 px-1.5 font-mono text-xs tabular-nums", children: [Math.round(scale * 100), "%", _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3!" })] }), _jsx(MenuContent, { align: "center", children: _jsxs(MenuRadioGroup, { value: zoomValue, onValueChange: (v) => zoomTo(v === "auto" || v === "fit-width" || v === "fit-page" ? v : Number(v)), children: [_jsx(MenuRadioItem, { value: "auto", closeOnClick: true, children: text.zoomAuto }), _jsx(MenuRadioItem, { value: "fit-width", closeOnClick: true, children: text.zoomFitWidth }), _jsx(MenuRadioItem, { value: "fit-page", closeOnClick: true, children: text.zoomFitPage }), _jsx(MenuSeparator, {}), ZOOM_STEPS.map((z) => (_jsxs(MenuRadioItem, { value: String(z), closeOnClick: true, className: "font-mono tabular-nums", children: [Math.round(z * 100), "%"] }, z)))] }) })] }), _jsx(Tool, { label: text.zoomIn, disabled: !ready || scale >= 4.99, onClick: () => zoomBy(1), className: "hidden @md/pdf:inline-flex", children: _jsx(PlusIcon, { "aria-hidden": true }) })] }), _jsx(ToolbarSeparator, { className: "hidden @lg/pdf:block" }), _jsx(Tool, { label: text.rotate, disabled: !ready, onClick: rotate, className: "hidden @lg/pdf:inline-flex", children: _jsx(RotateCwIcon, { "aria-hidden": true }) }), _jsx("span", { className: "hidden min-w-0 flex-1 truncate px-2 text-center font-mono text-xs text-muted-foreground @2xl/pdf:block", children: name }), _jsxs(ToolbarGroup, { className: "ms-auto @2xl/pdf:ms-0", children: [search && (_jsx(Tool, { label: text.search, "aria-pressed": searchOpen, disabled: !ready, onClick: () => (searchOpen ? closeSearch() : openSearch()), children: _jsx(SearchIcon, { "aria-hidden": true }) })), download && (_jsx(Tool, { label: text.download, disabled: !ready, onClick: () => doc && void savePdf(doc, name), children: _jsx(DownloadIcon, { "aria-hidden": true }) })), print && (_jsx(Tool, { label: text.print, disabled: !ready, onClick: () => doc && void printPdf(doc), className: "hidden @lg/pdf:inline-flex", children: _jsx(PrinterIcon, { "aria-hidden": true }) })), allowFullscreen && (_jsx(Tool, { label: isFullscreen ? text.exitFullScreen : text.fullScreen, onClick: toggleFullscreen, children: isFullscreen ? _jsx(MinimizeIcon, { "aria-hidden": true }) : _jsx(MaximizeIcon, { "aria-hidden": true }) })), toolbarEnd] })] })) }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [thumbnails && railOpen && doc && sizes && (_jsxs("div", { "data-slot": "pdf-viewer-rail", className: cn("hidden shrink-0 flex-col border-e border-border/
|
|
914
|
+
}, render: _jsx(Input, { size: "sm", className: "w-11 px-1 text-center font-mono tabular-nums" }) }), _jsx("span", { "aria-hidden": true, children: "/" }), _jsx("span", { "aria-label": text.ofPages(count), children: count || "–" })] }), _jsx(Tool, { label: text.nextPage, disabled: !ready || page >= count, onClick: () => goTo(page + 1), className: "hidden @min-[25rem]/pdf:inline-flex", children: _jsx(ChevronRightIcon, { "aria-hidden": true, className: "rtl:-scale-x-100" }) })] }), _jsx(ToolbarSeparator, {}), _jsxs(ToolbarGroup, { children: [_jsx(Tool, { label: text.zoomOut, disabled: !ready || scale <= 0.26, onClick: () => zoomBy(-1), className: "hidden @md/pdf:inline-flex", children: _jsx(MinusIcon, { "aria-hidden": true }) }), _jsxs(Menu, { children: [_jsxs(ToolbarButton, { disabled: !ready, "aria-label": text.zoom(Math.round(scale * 100)), render: _jsx(MenuTrigger, {}), className: "w-16 gap-1 px-1.5 font-mono text-xs tabular-nums", children: [Math.round(scale * 100), "%", _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3!" })] }), _jsx(MenuContent, { align: "center", children: _jsxs(MenuRadioGroup, { value: zoomValue, onValueChange: (v) => zoomTo(v === "auto" || v === "fit-width" || v === "fit-page" ? v : Number(v)), children: [_jsx(MenuRadioItem, { value: "auto", closeOnClick: true, children: text.zoomAuto }), _jsx(MenuRadioItem, { value: "fit-width", closeOnClick: true, children: text.zoomFitWidth }), _jsx(MenuRadioItem, { value: "fit-page", closeOnClick: true, children: text.zoomFitPage }), _jsx(MenuSeparator, {}), ZOOM_STEPS.map((z) => (_jsxs(MenuRadioItem, { value: String(z), closeOnClick: true, className: "font-mono tabular-nums", children: [Math.round(z * 100), "%"] }, z)))] }) })] }), _jsx(Tool, { label: text.zoomIn, disabled: !ready || scale >= 4.99, onClick: () => zoomBy(1), className: "hidden @md/pdf:inline-flex", children: _jsx(PlusIcon, { "aria-hidden": true }) })] }), _jsx(ToolbarSeparator, { className: "hidden @lg/pdf:block" }), _jsx(Tool, { label: text.rotate, disabled: !ready, onClick: rotate, className: "hidden @lg/pdf:inline-flex", children: _jsx(RotateCwIcon, { "aria-hidden": true }) }), _jsx("span", { className: "hidden min-w-0 flex-1 truncate px-2 text-center font-mono text-xs text-muted-foreground @2xl/pdf:block", children: name }), _jsxs(ToolbarGroup, { className: "ms-auto @2xl/pdf:ms-0", children: [search && (_jsx(Tool, { label: text.search, "aria-pressed": searchOpen, disabled: !ready, onClick: () => (searchOpen ? closeSearch() : openSearch()), children: _jsx(SearchIcon, { "aria-hidden": true }) })), download && (_jsx(Tool, { label: text.download, disabled: !ready, onClick: () => doc && void savePdf(doc, name), children: _jsx(DownloadIcon, { "aria-hidden": true }) })), print && (_jsx(Tool, { label: text.print, disabled: !ready, onClick: () => doc && void printPdf(doc), className: "hidden @lg/pdf:inline-flex", children: _jsx(PrinterIcon, { "aria-hidden": true }) })), allowFullscreen && (_jsx(Tool, { label: isFullscreen ? text.exitFullScreen : text.fullScreen, onClick: toggleFullscreen, children: isFullscreen ? _jsx(MinimizeIcon, { "aria-hidden": true }) : _jsx(MaximizeIcon, { "aria-hidden": true }) })), toolbarEnd] })] })) }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [thumbnails && railOpen && doc && sizes && (_jsxs("div", { "data-slot": "pdf-viewer-rail", className: cn("hidden shrink-0 flex-col border-e border-border/(--hairline-opacity) @3xl/pdf:flex", showOutline ? "w-60" : "w-[136px]"), children: [outline && (_jsx(Tabs, { value: railTab, onValueChange: (v) => setRailTab(v), className: "w-auto shrink-0 gap-0 border-b border-border/(--hairline-opacity) p-1.5", children: _jsx(TabsList, { "aria-label": text.sidebar, className: "w-full", children: [
|
|
915
915
|
["pages", text.pages, LayoutGridIcon],
|
|
916
916
|
["outline", text.outline, ListTreeIcon],
|
|
917
|
-
].map(([value, label, Icon]) => (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(TabsTab, { value: value, "aria-label": label, className: "flex-1 px-0" }), children: _jsx(Icon, { "aria-hidden": true }) }), _jsx(TooltipContent, { children: label })] }, value))) }) })), showOutline ? (_jsx(ScrollArea, { "data-slot": "pdf-viewer-outline", scrollbar: false, className: "min-h-0 flex-1", contentClassName: "p-1.5", children: _jsx("nav", { "aria-label": text.outline, children: _jsx(OutlineList, { entries: outline, current: reading, onSelect: openEntry }) }) })) : (_jsx(ScrollArea, { "data-slot": "pdf-viewer-thumbnails", scrollbar: false, "aria-label": text.pages, className: "min-h-0 flex-1", contentClassName: "flex flex-col items-center gap-1.5 py-3", children: thumbnailViews }))] })), _jsxs("div", { className: "relative min-w-0 flex-1", children: [_jsx("div", { ref: viewport, "data-slot": "pdf-viewer-pages", tabIndex: 0, role: "region", "aria-label": count ? text.document(name, page, count) : name, onScroll: onScroll, className: "absolute inset-0 [scrollbar-gutter:stable] overflow-auto overscroll-contain bg-(--field-surface) focus-ring", children: doc && sizes ? (_jsx("div", { className: "mx-auto flex w-max min-w-full flex-col items-center", style: { padding: pad, gap: pad }, children: pageViews })) : state.status === "error" ? (_jsxs(Empty, { className: "h-full justify-center", children: [_jsx(EmptyMedia, { children: _jsx(FileWarningIcon, { "aria-hidden": true }) }), _jsx(EmptyTitle, { children: text.cantOpen }), _jsx(EmptyDescription, { children: text.error(state.reason) }), (typeof src === "string" || src instanceof URL) && (_jsx(EmptyActions, { children: _jsxs(Button, { variant: "secondary", render: _jsx("a", { href: String(src), download: name }), nativeButton: false, children: [_jsx(DownloadIcon, { "aria-hidden": true }), text.downloadFile] }) }))] })) : (_jsxs("div", { className: "flex h-full items-center justify-center gap-2.5 font-mono text-xs text-muted-foreground", children: [_jsx(Spinner, { size: "sm" }), "Opening ", name] })) }), searchOpen && (_jsxs("div", { "data-slot": "pdf-viewer-search", role: "search", className: "absolute end-5 top-3 z-20 flex w-[min(24rem,calc(100%-2.5rem))] items-center gap-1 rounded-button material-menu p-1 transition-[opacity,translate] duration-(--duration) ease-(--ease)
|
|
917
|
+
].map(([value, label, Icon]) => (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(TabsTab, { value: value, "aria-label": label, className: "flex-1 px-0" }), children: _jsx(Icon, { "aria-hidden": true }) }), _jsx(TooltipContent, { children: label })] }, value))) }) })), showOutline ? (_jsx(ScrollArea, { "data-slot": "pdf-viewer-outline", scrollbar: false, className: "min-h-0 flex-1", contentClassName: "p-1.5", children: _jsx("nav", { "aria-label": text.outline, children: _jsx(OutlineList, { entries: outline, current: reading, onSelect: openEntry }) }) })) : (_jsx(ScrollArea, { "data-slot": "pdf-viewer-thumbnails", scrollbar: false, "aria-label": text.pages, className: "min-h-0 flex-1", contentClassName: "flex flex-col items-center gap-1.5 py-3", children: thumbnailViews }))] })), _jsxs("div", { className: "relative min-w-0 flex-1", children: [_jsx("div", { ref: viewport, "data-slot": "pdf-viewer-pages", tabIndex: 0, role: "region", "aria-label": count ? text.document(name, page, count) : name, onScroll: onScroll, className: "absolute inset-0 [scrollbar-gutter:stable] overflow-auto overscroll-contain bg-(--field-surface) focus-ring", children: doc && sizes ? (_jsx("div", { className: "mx-auto flex w-max min-w-full flex-col items-center", style: { padding: pad, gap: pad }, children: pageViews })) : state.status === "error" ? (_jsxs(Empty, { className: "h-full justify-center", children: [_jsx(EmptyMedia, { children: _jsx(FileWarningIcon, { "aria-hidden": true }) }), _jsx(EmptyTitle, { children: text.cantOpen }), _jsx(EmptyDescription, { children: text.error(state.reason) }), (typeof src === "string" || src instanceof URL) && (_jsx(EmptyActions, { children: _jsxs(Button, { variant: "secondary", render: _jsx("a", { href: String(src), download: name }), nativeButton: false, children: [_jsx(DownloadIcon, { "aria-hidden": true }), text.downloadFile] }) }))] })) : (_jsxs("div", { className: "flex h-full items-center justify-center gap-2.5 font-mono text-xs text-muted-foreground", children: [_jsx(Spinner, { size: "sm" }), "Opening ", name] })) }), searchOpen && (_jsxs("div", { "data-slot": "pdf-viewer-search", role: "search", className: "absolute end-5 top-3 z-20 flex w-[min(24rem,calc(100%-2.5rem))] items-center gap-1 rounded-button material-menu p-1 transition-[opacity,translate] [transition-duration:var(--duration-fade),var(--duration)] ease-(--ease) starting:-translate-y-1 starting:opacity-0", children: [_jsxs(InputGroup, { size: "sm", className: "min-w-0 flex-1", children: [_jsx(InputGroupAddon, { className: "ps-2.5", children: _jsx(SearchIcon, { "aria-hidden": true }) }), _jsx(InputGroupInput, { ref: searchInput, "aria-label": text.searchField, placeholder: text.searchField, value: query, onChange: (e) => setQuery(e.currentTarget.value), onKeyDown: (e) => {
|
|
918
918
|
if (e.key === "Enter") {
|
|
919
919
|
e.preventDefault();
|
|
920
920
|
step(e.shiftKey ? -1 : 1);
|
|
@@ -928,7 +928,7 @@ function Reader({ src, fileName, variant = "region", defaultZoom = "auto", defau
|
|
|
928
928
|
? ""
|
|
929
929
|
: hits.length
|
|
930
930
|
? text.matches(hitIndex + 1, hits.length)
|
|
931
|
-
: text.noMatches }), _jsx(InputGroupButton, { variant: "ghost", size: "icon-sm", "aria-label": text.previousMatch, disabled: !hits?.length, onClick: () => step(-1), children: _jsx(ChevronUpIcon, { "aria-hidden": true }) }), _jsx(InputGroupButton, { variant: "ghost", size: "icon-sm", "aria-label": text.nextMatch, disabled: !hits?.length, onClick: () => step(1), children: _jsx(ChevronDownIcon, { "aria-hidden": true }) })] })] }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": text.closeSearch, onClick: closeSearch, children: _jsx(XIcon, { "aria-hidden": true }) })] })), count > 1 && (_jsxs("span", { "aria-hidden": true, "data-slot": "pdf-viewer-page-chip", className: cn("pointer-events-none absolute bottom-4 left-1/2 z-10 -translate-x-1/2 rounded-item material-menu px-2.5 py-1.5 font-mono text-xs leading-none tabular-nums transition-opacity duration-(--duration) ease-(--ease)", chip ? "opacity-100" : "opacity-0"), children: [String(page).padStart(2, "0"), " / ", String(count).padStart(2, "0")] }))] })] })] }));
|
|
931
|
+
: text.noMatches }), _jsx(InputGroupButton, { variant: "ghost", size: "icon-sm", "aria-label": text.previousMatch, disabled: !hits?.length, onClick: () => step(-1), children: _jsx(ChevronUpIcon, { "aria-hidden": true }) }), _jsx(InputGroupButton, { variant: "ghost", size: "icon-sm", "aria-label": text.nextMatch, disabled: !hits?.length, onClick: () => step(1), children: _jsx(ChevronDownIcon, { "aria-hidden": true }) })] })] }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": text.closeSearch, onClick: closeSearch, children: _jsx(XIcon, { "aria-hidden": true }) })] })), count > 1 && (_jsxs("span", { "aria-hidden": true, "data-slot": "pdf-viewer-page-chip", className: cn("pointer-events-none absolute bottom-4 left-1/2 z-10 -translate-x-1/2 rounded-item material-menu px-2.5 py-1.5 font-mono text-xs leading-none tabular-nums transition-opacity duration-(--duration-fade) ease-(--ease)", chip ? "opacity-100" : "opacity-0"), children: [String(page).padStart(2, "0"), " / ", String(count).padStart(2, "0")] }))] })] })] }));
|
|
932
932
|
}
|
|
933
933
|
/**
|
|
934
934
|
* PdfPreview — a compact card with a document's first page, its name and its length. Clicking it
|
|
@@ -987,10 +987,10 @@ export function PdfPreview({ src, fileName, title, description, viewer, labels,
|
|
|
987
987
|
return () => ac.abort();
|
|
988
988
|
}, [state]);
|
|
989
989
|
const count = state.status === "ready" ? state.sizes.length : undefined;
|
|
990
|
-
return (_jsxs(Dialog, { children: [_jsxs(DialogTrigger, { render: _jsx("button", { ref: ref, type: "button", "data-slot": "pdf-preview", "aria-busy": !drawn && state.status !== "error", className: cn("group/preview flex w-full max-w-xs cursor-pointer flex-col overflow-hidden surface-card text-start focus-ring [--card-padding:0]", className), ...props }), children: [_jsxs("span", { "data-slot": "pdf-preview-page", className: "relative block aspect-[4/3] overflow-hidden border-b border-border/
|
|
990
|
+
return (_jsxs(Dialog, { children: [_jsxs(DialogTrigger, { render: _jsx("button", { ref: ref, type: "button", "data-slot": "pdf-preview", "aria-busy": !drawn && state.status !== "error", className: cn("group/preview flex w-full max-w-xs cursor-pointer flex-col overflow-hidden surface-card text-start focus-ring [--card-padding:0]", className), ...props }), children: [_jsxs("span", { "data-slot": "pdf-preview-page", className: "relative block aspect-[4/3] overflow-hidden border-b border-border/(--hairline-opacity) px-6 pt-6", children: [_jsx("span", { ref: art, "aria-hidden": true, className: "relative block w-full bg-white shadow-card transition-transform duration-(--duration) ease-(--ease) group-hover/preview:-translate-y-1", style: { aspectRatio: first ? `${first.w} / ${first.h}` : "1 / 1.414" } }), state.status === "error" && (_jsx("span", { className: "absolute inset-0 flex items-center justify-center text-muted-foreground", children: _jsx(FileWarningIcon, { "aria-hidden": true, className: "size-6" }) }))] }), _jsxs("span", { className: "flex items-start gap-3 p-4", children: [_jsx(FileTextIcon, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }), _jsxs("span", { className: "flex min-w-0 flex-col gap-1", children: [_jsx("span", { className: "truncate text-sm font-medium text-foreground", children: title ?? name }), _jsx("span", { className: "font-mono text-11 tracking-[0.12em] text-muted-foreground uppercase", children: description ??
|
|
991
991
|
(state.status === "error"
|
|
992
992
|
? text.previewError
|
|
993
993
|
: count
|
|
994
994
|
? text.previewPages(count)
|
|
995
|
-
: text.previewPdf) })] })] })] }), _jsxs(DialogContent, { size: "
|
|
995
|
+
: text.previewPdf) })] })] })] }), _jsxs(DialogContent, { size: "full", showCloseButton: false, className: "gap-0 p-0 sm:p-0", children: [_jsx(DialogTitle, { className: "sr-only", children: typeof title === "string" ? title : name }), _jsx(PdfViewer, { labels: labels, ...viewer, src: src, fileName: name, variant: "plain", className: cn("h-full", viewer?.className), toolbarEnd: _jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(ToolbarButton, { "aria-label": text.close, render: _jsx(DialogClose, {}) }), children: _jsx(XIcon, { "aria-hidden": true }) }), _jsx(TooltipContent, { children: text.close })] })] }) })] })] }));
|
|
996
996
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
|
|
4
4
|
import { Field as BaseField } from "@base-ui/react/field";
|
|
5
|
-
import { ChevronDownIcon } from "
|
|
5
|
+
import { ChevronDownIcon } from "../lib/icons.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { cn } from "../lib/cn.js";
|
|
8
8
|
import { FieldValueInput, useFormatLocale, useFormResetEffect } from "../lib/field-value.js";
|
|
@@ -233,7 +233,7 @@ export function PhoneInput({ value: valueProp, defaultValue, onValueChange, coun
|
|
|
233
233
|
// It stays an input-group-button, so the field rounds and insets it like any.
|
|
234
234
|
, { "data-phone-input-country": "", "aria-label": `${text.country}: ${countryName}, +${country.dial}`, render: _jsx(InputGroupButton, { variant: "ghost", size: sizing.button, ...(size === "lg" ? { "data-size": "lg" } : {}), className: cn(
|
|
235
235
|
// The field already dims when disabled: not the button twice.
|
|
236
|
-
"gap-1.5 font-mono tabular-nums data-disabled:opacity-100", size === "lg" && "min-h-[calc(var(--control-h-lg)-8px)] px-3 text-sm", size === "sm" ? "text-xs" : "text-
|
|
236
|
+
"gap-1.5 font-mono tabular-nums data-disabled:opacity-100", size === "lg" && "min-h-[calc(var(--control-h-lg)-8px)] px-3 text-sm", size === "sm" ? "text-xs" : "text-13",
|
|
237
237
|
// After the text size, which would reset it: one line as tall as the type.
|
|
238
238
|
"leading-none") }), children: [_jsx("span", { className: "text-muted-foreground", children: country.iso }), _jsxs("span", { className: "text-foreground", children: ["+", country.dial] }), _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3.5 text-muted-foreground transition-transform duration-(--duration) ease-(--ease) in-data-popup-open:rotate-180" })] }), _jsxs(ComboboxContent, { "aria-label": text.country, positioner: { anchor: groupRef, align: "start" }, className: "min-w-[min(18rem,var(--available-width))]", children: [_jsx("div", { className: "pb-1", children: _jsx(ComboboxInput, { size: "sm", showTrigger: false, placeholder: text.search, "aria-label": text.search }) }), _jsx(ComboboxEmpty, { children: text.empty }), _jsx(ComboboxList, { children: (option) => (_jsx(ComboboxItem, { value: option, "data-country": option.iso, children: _jsxs("span", { className: "flex min-w-0 items-baseline gap-3", children: [_jsx("span", { className: "w-6 shrink-0 font-mono text-xs text-muted-foreground", children: option.iso }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: option.name }), _jsxs("span", { className: "shrink-0 font-mono text-xs text-muted-foreground tabular-nums", children: ["+", option.dial] })] }) }, option.iso)) })] })] }) }) }), _jsx("input", { ...props, ref: visibleRefs, id: controlId, "data-slot": "input-group-control", type: "tel", inputMode: "tel", autoComplete: props.autoComplete ?? "tel", value: shown, placeholder: placeholder, disabled: off, readOnly: readOnly, required: required, "aria-labelledby": labelledBy ?? props["aria-labelledby"], "aria-describedby": [describedBy, props["aria-describedby"]].filter(Boolean).join(" ") || undefined, "aria-invalid": invalid, onChange: (event) => take(event.currentTarget.value, event.currentTarget.selectionStart), onPaste: (event) => {
|
|
239
239
|
onPaste?.(event);
|
|
@@ -6,6 +6,7 @@ import { sx, triggerSlot } from "../lib/cn.js";
|
|
|
6
6
|
import { mergeRefs } from "../lib/merge-refs.js";
|
|
7
7
|
import { roomBounds, TriggerRoomContext, useTriggerRoom } from "../lib/room.js";
|
|
8
8
|
import { overlayArrow, overlayPopup, usePopupDir } from "./_overlay.js";
|
|
9
|
+
import { usePortalContainer } from "../lib/portal-container.js";
|
|
9
10
|
/**
|
|
10
11
|
* Popover — a small panel anchored to a control: a hint with a link, a short form, a few
|
|
11
12
|
* settings. Menu material at 12px.
|
|
@@ -29,18 +30,19 @@ export function PopoverTrigger({ ref, ...props }) {
|
|
|
29
30
|
}
|
|
30
31
|
/** Portal + Positioner + Popup. Fades and scales from the trigger (`popup-motion`). */
|
|
31
32
|
export function PopoverContent({ side = "bottom", align = "center", sideOffset = 8, alignOffset = 0, positioner, portal, arrow = false, className, children, dir, ...props }) {
|
|
33
|
+
const portalContainer = usePortalContainer();
|
|
32
34
|
// Across, keep inside the trigger's room (a narrow panel), not only the window. Found once per
|
|
33
35
|
// trigger, not on every render of a closed popover.
|
|
34
36
|
const trigger = React.useContext(TriggerRoomContext)?.trigger ?? null;
|
|
35
37
|
const bounds = React.useMemo(() => roomBounds(trigger), [trigger]);
|
|
36
38
|
const popupDir = usePopupDir(dir);
|
|
37
|
-
return (_jsx(BasePopover.Portal, { ...portal, children: _jsx(BasePopover.Positioner, { side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, arrowPadding: 14, collisionPadding: 16, collisionBoundary: bounds, dir: popupDir, ...positioner, className: "z-50 outline-none", children: _jsxs(BasePopover.Popup, { "data-slot": "popover-content", className: sx(["relative flex w-72 max-w-(--available-width) flex-col gap-1.5 p-4 text-sm", overlayPopup], className), ...props, children: [arrow && _jsx(BasePopover.Arrow, { "data-slot": "popover-arrow", className: overlayArrow }), children] }) }) }));
|
|
39
|
+
return (_jsx(BasePopover.Portal, { container: portalContainer, ...portal, children: _jsx(BasePopover.Positioner, { side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, arrowPadding: 14, collisionPadding: 16, collisionBoundary: bounds, dir: popupDir, ...positioner, className: "z-50 outline-none", children: _jsxs(BasePopover.Popup, { "data-slot": "popover-content", className: sx(["relative flex w-72 max-w-(--available-width) flex-col gap-1.5 p-4 text-sm", overlayPopup], className), ...props, children: [arrow && _jsx(BasePopover.Arrow, { "data-slot": "popover-arrow", className: overlayArrow }), children] }) }) }));
|
|
38
40
|
}
|
|
39
41
|
export function PopoverTitle({ className, ...props }) {
|
|
40
|
-
return (_jsx(BasePopover.Title, { "data-slot": "popover-title", className: sx("font-body text-
|
|
42
|
+
return (_jsx(BasePopover.Title, { "data-slot": "popover-title", className: sx("font-body text-15 leading-snug font-medium tracking-normal text-foreground", className), ...props }));
|
|
41
43
|
}
|
|
42
44
|
export function PopoverDescription({ className, ...props }) {
|
|
43
|
-
return (_jsx(BasePopover.Description, { "data-slot": "popover-description", className: sx("text-
|
|
45
|
+
return (_jsx(BasePopover.Description, { "data-slot": "popover-description", className: sx("text-13 leading-normal text-muted-foreground", className), ...props }));
|
|
44
46
|
}
|
|
45
47
|
/** Closes the popover. Compose with a button: `render={<Button variant="ghost" size="sm" />}`. */
|
|
46
48
|
export function PopoverClose(props) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
/**
|
|
3
4
|
* PreviewCard — a hover card that previews what a link points to (a person, an article, a
|
|
4
5
|
* doc page) before the reader commits to the click.
|
|
@@ -8,7 +9,7 @@ import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
|
8
9
|
*/
|
|
9
10
|
export declare const PreviewCard: <Payload>(props: BasePreviewCard.Root.Props<Payload>) => React.JSX.Element;
|
|
10
11
|
/** The link that opens the card. Renders an `<a>`; style it with the `link` utility. */
|
|
11
|
-
export declare function PreviewCardTrigger(props: BasePreviewCard.Trigger.Props):
|
|
12
|
+
export declare function PreviewCardTrigger(props: BasePreviewCard.Trigger.Props): React.JSX.Element;
|
|
12
13
|
export interface PreviewCardContentProps extends BasePreviewCard.Popup.Props {
|
|
13
14
|
side?: BasePreviewCard.Positioner.Props["side"];
|
|
14
15
|
align?: BasePreviewCard.Positioner.Props["align"];
|
|
@@ -22,4 +23,38 @@ export interface PreviewCardContentProps extends BasePreviewCard.Popup.Props {
|
|
|
22
23
|
arrow?: boolean;
|
|
23
24
|
}
|
|
24
25
|
/** Portal + Positioner + Popup. Menu material at 12px, 320px wide, `popup-motion`. */
|
|
25
|
-
export declare function PreviewCardContent({ side, align, sideOffset, alignOffset, positioner, portal, arrow, className, children, dir, ...props }: PreviewCardContentProps):
|
|
26
|
+
export declare function PreviewCardContent({ side, align, sideOffset, alignOffset, positioner, portal, arrow, className, children, dir, ref, ...props }: PreviewCardContentProps): React.JSX.Element;
|
|
27
|
+
export interface PreviewCardDelegateProps {
|
|
28
|
+
/** A CSS selector for the elements that open the card: `"[data-ref]"`, `"a.mention"` … */
|
|
29
|
+
selector: string;
|
|
30
|
+
/**
|
|
31
|
+
* Renders the card for the element that opened it — read what to show from its attributes
|
|
32
|
+
* (`element.dataset`). Return a `PreviewCardContent`; it positions against that element.
|
|
33
|
+
*/
|
|
34
|
+
children: (element: HTMLElement) => React.ReactNode;
|
|
35
|
+
/** Where to listen for hover and focus. The whole document by default. */
|
|
36
|
+
container?: React.RefObject<HTMLElement | null>;
|
|
37
|
+
/** How long to wait before the card opens, in ms. Moving to another match while it is open switches at once. */
|
|
38
|
+
delay?: number;
|
|
39
|
+
/** How long the card lingers after the pointer leaves the element and the card, in ms. */
|
|
40
|
+
closeDelay?: number;
|
|
41
|
+
/** Called when the card opens, moves to another element, or closes (with `null`). */
|
|
42
|
+
onOpenChange?: (open: boolean, element: HTMLElement | null) => void;
|
|
43
|
+
/** Stop listening, and close the card if it is open. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* PreviewCardDelegate — one preview card for every element on the page that matches a selector:
|
|
48
|
+
* reference chips, mentions, links in a long thread. It listens once, on the document or a
|
|
49
|
+
* container, instead of mounting a trigger per element, so a page with hundreds of references
|
|
50
|
+
* stays cheap.
|
|
51
|
+
*
|
|
52
|
+
* It keeps a normal PreviewCard's behaviour: opens on hover or keyboard focus after the delay,
|
|
53
|
+
* lingers so the pointer can move into the card, moves to the next match at once while it is
|
|
54
|
+
* open, and closes on Escape, a press outside, scrolling or leaving the window.
|
|
55
|
+
*
|
|
56
|
+
* The rule people break: the matching elements must make sense on their own. Make them real
|
|
57
|
+
* links (`<a href>`) or focusable (`tabIndex={0}`), since the card adds a glance, never the only
|
|
58
|
+
* way to what they point to.
|
|
59
|
+
*/
|
|
60
|
+
export declare function PreviewCardDelegate({ selector, children, container, delay, closeDelay, onOpenChange, disabled, }: PreviewCardDelegateProps): React.JSX.Element;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
|
|
4
|
+
import * as React from "react";
|
|
4
5
|
import { sx, triggerSlot } from "../lib/cn.js";
|
|
6
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
5
7
|
import { overlayArrow, overlayPopup, usePopupDir } from "./_overlay.js";
|
|
8
|
+
import { usePortalContainer } from "../lib/portal-container.js";
|
|
9
|
+
const DelegateContext = React.createContext(null);
|
|
6
10
|
/**
|
|
7
11
|
* PreviewCard — a hover card that previews what a link points to (a person, an article, a
|
|
8
12
|
* doc page) before the reader commits to the click.
|
|
@@ -16,7 +20,227 @@ export function PreviewCardTrigger(props) {
|
|
|
16
20
|
return _jsx(BasePreviewCard.Trigger, { ...triggerSlot("preview-card-trigger", props.render), ...props });
|
|
17
21
|
}
|
|
18
22
|
/** Portal + Positioner + Popup. Menu material at 12px, 320px wide, `popup-motion`. */
|
|
19
|
-
export function PreviewCardContent({ side = "bottom", align = "center", sideOffset = 8, alignOffset = 0, positioner, portal, arrow = false, className, children, dir, ...props }) {
|
|
23
|
+
export function PreviewCardContent({ side = "bottom", align = "center", sideOffset = 8, alignOffset = 0, positioner, portal, arrow = false, className, children, dir, ref, ...props }) {
|
|
24
|
+
const portalContainer = usePortalContainer();
|
|
20
25
|
const popupDir = usePopupDir(dir);
|
|
21
|
-
|
|
26
|
+
const delegate = React.useContext(DelegateContext);
|
|
27
|
+
const popupRef = delegate?.popupRef;
|
|
28
|
+
const refs = React.useMemo(() => (popupRef ? mergeRefs(popupRef, ref) : ref), [popupRef, ref]);
|
|
29
|
+
return (_jsx(BasePreviewCard.Portal, { container: portalContainer, ...portal, children: _jsx(BasePreviewCard.Positioner, { side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, arrowPadding: 14, collisionPadding: 16, dir: popupDir, ...(delegate && { anchor: delegate.anchor }), ...positioner, className: "z-50 outline-none", children: _jsxs(BasePreviewCard.Popup, { "data-slot": "preview-card-content", ref: refs, className: sx(["relative flex w-80 max-w-(--available-width) flex-col gap-3 p-4 text-sm", overlayPopup], className), ...props, children: [arrow && _jsx(BasePreviewCard.Arrow, { "data-slot": "preview-card-arrow", className: overlayArrow }), children] }) }) }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* PreviewCardDelegate — one preview card for every element on the page that matches a selector:
|
|
33
|
+
* reference chips, mentions, links in a long thread. It listens once, on the document or a
|
|
34
|
+
* container, instead of mounting a trigger per element, so a page with hundreds of references
|
|
35
|
+
* stays cheap.
|
|
36
|
+
*
|
|
37
|
+
* It keeps a normal PreviewCard's behaviour: opens on hover or keyboard focus after the delay,
|
|
38
|
+
* lingers so the pointer can move into the card, moves to the next match at once while it is
|
|
39
|
+
* open, and closes on Escape, a press outside, scrolling or leaving the window.
|
|
40
|
+
*
|
|
41
|
+
* The rule people break: the matching elements must make sense on their own. Make them real
|
|
42
|
+
* links (`<a href>`) or focusable (`tabIndex={0}`), since the card adds a glance, never the only
|
|
43
|
+
* way to what they point to.
|
|
44
|
+
*/
|
|
45
|
+
export function PreviewCardDelegate({ selector, children, container,
|
|
46
|
+
// Base UI's own trigger delays, so a delegated card keeps the timing of a normal one.
|
|
47
|
+
delay = 600, closeDelay = 300, onOpenChange, disabled = false, }) {
|
|
48
|
+
// The element the card sits against. It stays set while the card leaves, so the exit animates
|
|
49
|
+
// in place; `open` is what says whether it is showing.
|
|
50
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
51
|
+
const [open, setOpenState] = React.useState(false);
|
|
52
|
+
const popupRef = React.useRef(null);
|
|
53
|
+
// The listeners below are registered once per selector and container; they read and write
|
|
54
|
+
// the live state through these refs.
|
|
55
|
+
const live = React.useRef({ open: false, anchor: null });
|
|
56
|
+
const options = React.useRef({ delay, closeDelay, onOpenChange });
|
|
57
|
+
options.current = { delay, closeDelay, onOpenChange };
|
|
58
|
+
const closeRef = React.useRef(() => { });
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
if (disabled)
|
|
61
|
+
return;
|
|
62
|
+
const doc = container?.current?.ownerDocument ?? document;
|
|
63
|
+
const win = doc.defaultView ?? window;
|
|
64
|
+
const root = container?.current ?? doc;
|
|
65
|
+
let showTimer;
|
|
66
|
+
let hideTimer;
|
|
67
|
+
// The element waiting out the open delay, or the one shown.
|
|
68
|
+
let pending = null;
|
|
69
|
+
let hovering = false;
|
|
70
|
+
let focused = null;
|
|
71
|
+
const clear = () => {
|
|
72
|
+
clearTimeout(showTimer);
|
|
73
|
+
clearTimeout(hideTimer);
|
|
74
|
+
showTimer = hideTimer = undefined;
|
|
75
|
+
};
|
|
76
|
+
const inPopup = (node) => node instanceof win.Node && !!popupRef.current?.contains(node);
|
|
77
|
+
const match = (node) => {
|
|
78
|
+
if (!(node instanceof win.Element))
|
|
79
|
+
return null;
|
|
80
|
+
const el = node.closest(selector);
|
|
81
|
+
return el instanceof win.HTMLElement && root.contains(el) ? el : null;
|
|
82
|
+
};
|
|
83
|
+
const show = (el) => {
|
|
84
|
+
clear();
|
|
85
|
+
pending = el;
|
|
86
|
+
if (live.current.open && live.current.anchor === el)
|
|
87
|
+
return;
|
|
88
|
+
live.current = { open: true, anchor: el };
|
|
89
|
+
setAnchor(el);
|
|
90
|
+
setOpenState(true);
|
|
91
|
+
options.current.onOpenChange?.(true, el);
|
|
92
|
+
};
|
|
93
|
+
const close = () => {
|
|
94
|
+
clear();
|
|
95
|
+
pending = null;
|
|
96
|
+
hovering = false;
|
|
97
|
+
if (!live.current.open)
|
|
98
|
+
return;
|
|
99
|
+
live.current = { ...live.current, open: false };
|
|
100
|
+
setOpenState(false);
|
|
101
|
+
options.current.onOpenChange?.(false, null);
|
|
102
|
+
};
|
|
103
|
+
closeRef.current = close;
|
|
104
|
+
/** Open after the delay, or move there at once if the card is already showing. */
|
|
105
|
+
const request = (el) => {
|
|
106
|
+
if (live.current.open)
|
|
107
|
+
return show(el);
|
|
108
|
+
clear();
|
|
109
|
+
pending = el;
|
|
110
|
+
showTimer = setTimeout(() => show(el), options.current.delay);
|
|
111
|
+
};
|
|
112
|
+
const scheduleClose = () => {
|
|
113
|
+
clearTimeout(showTimer);
|
|
114
|
+
clearTimeout(hideTimer);
|
|
115
|
+
if (!live.current.open) {
|
|
116
|
+
pending = null;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
hideTimer = setTimeout(close, options.current.closeDelay);
|
|
120
|
+
};
|
|
121
|
+
const onPointerOver = (event) => {
|
|
122
|
+
// Like the trigger: hover is for a mouse or a pen. A tap is a click on the link.
|
|
123
|
+
if (event.pointerType === "touch")
|
|
124
|
+
return;
|
|
125
|
+
if (inPopup(event.target)) {
|
|
126
|
+
hovering = true;
|
|
127
|
+
clearTimeout(hideTimer);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const el = match(event.target);
|
|
131
|
+
if (!el)
|
|
132
|
+
return;
|
|
133
|
+
hovering = true;
|
|
134
|
+
if (el === pending) {
|
|
135
|
+
clearTimeout(hideTimer);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
request(el);
|
|
139
|
+
};
|
|
140
|
+
const onPointerOut = (event) => {
|
|
141
|
+
if (event.pointerType === "touch" || !pending)
|
|
142
|
+
return;
|
|
143
|
+
const from = event.target;
|
|
144
|
+
if (!pending.contains(from) && !inPopup(from))
|
|
145
|
+
return;
|
|
146
|
+
const to = event.relatedTarget;
|
|
147
|
+
if (to instanceof win.Node && (pending.contains(to) || inPopup(to)))
|
|
148
|
+
return;
|
|
149
|
+
hovering = false;
|
|
150
|
+
if (focused === pending)
|
|
151
|
+
return;
|
|
152
|
+
// Onto another match: its pointerover, next, moves the card there.
|
|
153
|
+
scheduleClose();
|
|
154
|
+
};
|
|
155
|
+
const onFocusIn = (event) => {
|
|
156
|
+
if (inPopup(event.target))
|
|
157
|
+
return;
|
|
158
|
+
const el = match(event.target);
|
|
159
|
+
if (!el)
|
|
160
|
+
return;
|
|
161
|
+
// Like the trigger: a click that focuses the link does not open the card, the keyboard does.
|
|
162
|
+
let visible = true;
|
|
163
|
+
try {
|
|
164
|
+
visible = event.target.matches(":focus-visible");
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// An engine without :focus-visible: treat every focus as visible.
|
|
168
|
+
}
|
|
169
|
+
if (!visible)
|
|
170
|
+
return;
|
|
171
|
+
focused = el;
|
|
172
|
+
request(el);
|
|
173
|
+
};
|
|
174
|
+
const onFocusOut = (event) => {
|
|
175
|
+
if (!focused || !focused.contains(event.target))
|
|
176
|
+
return;
|
|
177
|
+
const to = event.relatedTarget;
|
|
178
|
+
if (to instanceof win.Node && (focused.contains(to) || inPopup(to)))
|
|
179
|
+
return;
|
|
180
|
+
const was = focused;
|
|
181
|
+
focused = null;
|
|
182
|
+
// Focus moving to another match is handled by its focusin.
|
|
183
|
+
if (match(to))
|
|
184
|
+
return;
|
|
185
|
+
if (hovering && was === pending)
|
|
186
|
+
return;
|
|
187
|
+
close();
|
|
188
|
+
};
|
|
189
|
+
const onKeyDown = (event) => {
|
|
190
|
+
// Esc on an open card is Base UI's (onOpenChange below); this cancels one still waiting.
|
|
191
|
+
if (event.key === "Escape" && !live.current.open && pending) {
|
|
192
|
+
clear();
|
|
193
|
+
pending = null;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const onScroll = (event) => {
|
|
197
|
+
if (inPopup(event.target))
|
|
198
|
+
return;
|
|
199
|
+
if (live.current.open)
|
|
200
|
+
return close();
|
|
201
|
+
// Focusing an element scrolls it into view: that scroll keeps a keyboard open waiting.
|
|
202
|
+
if (pending && pending !== focused) {
|
|
203
|
+
clear();
|
|
204
|
+
pending = null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
root.addEventListener("pointerover", onPointerOver);
|
|
208
|
+
root.addEventListener("pointerout", onPointerOut);
|
|
209
|
+
root.addEventListener("focusin", onFocusIn);
|
|
210
|
+
root.addEventListener("focusout", onFocusOut);
|
|
211
|
+
// The card is portalled outside a container: hovering it is heard on the document.
|
|
212
|
+
if (root !== doc) {
|
|
213
|
+
doc.addEventListener("pointerover", onPointerOver);
|
|
214
|
+
doc.addEventListener("pointerout", onPointerOut);
|
|
215
|
+
}
|
|
216
|
+
doc.addEventListener("keydown", onKeyDown);
|
|
217
|
+
win.addEventListener("scroll", onScroll, true);
|
|
218
|
+
win.addEventListener("blur", close);
|
|
219
|
+
return () => {
|
|
220
|
+
clear();
|
|
221
|
+
root.removeEventListener("pointerover", onPointerOver);
|
|
222
|
+
root.removeEventListener("pointerout", onPointerOut);
|
|
223
|
+
root.removeEventListener("focusin", onFocusIn);
|
|
224
|
+
root.removeEventListener("focusout", onFocusOut);
|
|
225
|
+
if (root !== doc) {
|
|
226
|
+
doc.removeEventListener("pointerover", onPointerOver);
|
|
227
|
+
doc.removeEventListener("pointerout", onPointerOut);
|
|
228
|
+
}
|
|
229
|
+
doc.removeEventListener("keydown", onKeyDown);
|
|
230
|
+
win.removeEventListener("scroll", onScroll, true);
|
|
231
|
+
win.removeEventListener("blur", close);
|
|
232
|
+
close();
|
|
233
|
+
closeRef.current = () => { };
|
|
234
|
+
};
|
|
235
|
+
}, [selector, container, disabled]);
|
|
236
|
+
const context = React.useMemo(() => ({ anchor, popupRef }), [anchor]);
|
|
237
|
+
return (_jsx(BasePreviewCard.Root, { open: open, onOpenChange: (next, details) => {
|
|
238
|
+
// Hover and focus are this component's; Esc, a press outside and the rest close it.
|
|
239
|
+
if (!next && details.reason !== "trigger-hover" && details.reason !== "trigger-focus") {
|
|
240
|
+
closeRef.current();
|
|
241
|
+
}
|
|
242
|
+
}, onOpenChangeComplete: (isOpen) => {
|
|
243
|
+
if (!isOpen && !live.current.open)
|
|
244
|
+
setAnchor(null);
|
|
245
|
+
}, children: _jsx(DelegateContext.Provider, { value: context, children: anchor && children(anchor) }) }));
|
|
22
246
|
}
|