@zonsh/ui 0.5.0 → 0.6.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/CHANGELOG.md +639 -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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Inbox
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { ActionSheet, ActionSheetAction, ActionSheetContent, ActionSheetTrigger, AppBar, AppBarAction, AppBarSearch, BottomNav, BottomNavItem, Button, PullToRefresh, SwipeActions } from "@zonsh/ui";
|
|
5
|
+
import { ArchiveIcon, EllipsisIcon, InboxIcon, MailIcon, MailOpenIcon, SearchIcon, SendIcon, SquarePenIcon, Trash2Icon, UserIcon } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
interface Mail {
|
|
9
|
+
id: string;
|
|
10
|
+
from: string;
|
|
11
|
+
subject: string;
|
|
12
|
+
preview: string;
|
|
13
|
+
time: string;
|
|
14
|
+
unread: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Sample mail for a fictional notebook app's team: nothing here is a real person or company. */
|
|
18
|
+
const first: Mail[] = [
|
|
19
|
+
{
|
|
20
|
+
id: "m1",
|
|
21
|
+
from: "Ines Moreau",
|
|
22
|
+
subject: "Kiln booking for Saturday",
|
|
23
|
+
preview: "I can take the 10 o'clock firing if you glaze the tiles by Friday.",
|
|
24
|
+
time: "09:41",
|
|
25
|
+
unread: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "m2",
|
|
29
|
+
from: "Theo Lindqvist",
|
|
30
|
+
subject: "Notes from the reading group",
|
|
31
|
+
preview: "We got as far as chapter nine. Next time at Ana's, bring the copy with the map.",
|
|
32
|
+
time: "08:15",
|
|
33
|
+
unread: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "m3",
|
|
37
|
+
from: "Allotment society",
|
|
38
|
+
subject: "Water is back on at the east gate",
|
|
39
|
+
preview: "The pipe under the path is fixed. Please close the tap after use.",
|
|
40
|
+
time: "Yesterday",
|
|
41
|
+
unread: false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "m4",
|
|
45
|
+
from: "Jun Park",
|
|
46
|
+
subject: "Photos from the coast walk",
|
|
47
|
+
preview: "Forty-two of them, sorry. The ones of the seals are near the end.",
|
|
48
|
+
time: "Yesterday",
|
|
49
|
+
unread: false,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "m5",
|
|
53
|
+
from: "Library",
|
|
54
|
+
subject: "Two books are due on Friday",
|
|
55
|
+
preview: "Renew them online or at the desk; the reading room closes at six.",
|
|
56
|
+
time: "Mon",
|
|
57
|
+
unread: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "m6",
|
|
61
|
+
from: "Ana Ribeiro",
|
|
62
|
+
subject: "Porto — train times",
|
|
63
|
+
preview: "The 09:39 from Lisbon gets in just after noon. Shall we meet at São Bento?",
|
|
64
|
+
time: "Sun",
|
|
65
|
+
unread: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "m7",
|
|
69
|
+
from: "Bike workshop",
|
|
70
|
+
subject: "Your bike is ready",
|
|
71
|
+
preview: "New brake pads and chain; the rear wheel is true again. Open until 18:00.",
|
|
72
|
+
time: "Sat",
|
|
73
|
+
unread: false,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
const arriving: Mail = {
|
|
78
|
+
id: "m0",
|
|
79
|
+
from: "Mara Okafor",
|
|
80
|
+
subject: "Sourdough for Sunday?",
|
|
81
|
+
preview: "I'm baking two loaves. One is yours if you bring the butter.",
|
|
82
|
+
time: "09:44",
|
|
83
|
+
unread: true,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A mail app's inbox on a phone: a large title and a search field that fold into the bar, rows
|
|
90
|
+
* that swipe to Archive, Delete or mark as read, a pull that fetches new mail, a "…" on each row
|
|
91
|
+
* opening the same choices in an action sheet, and the bottom nav. Nothing is sent or saved.
|
|
92
|
+
*/
|
|
93
|
+
export function Inbox() {
|
|
94
|
+
const screen = React.useRef<HTMLDivElement>(null);
|
|
95
|
+
const [mail, setMail] = React.useState(first);
|
|
96
|
+
const [query, setQuery] = React.useState("");
|
|
97
|
+
const [tab, setTab] = React.useState("inbox");
|
|
98
|
+
const [status, setStatus] = React.useState("");
|
|
99
|
+
|
|
100
|
+
const refresh = async () => {
|
|
101
|
+
await wait(1200);
|
|
102
|
+
setMail((list) => (list.some((m) => m.id === arriving.id) ? list : [arriving, ...list]));
|
|
103
|
+
};
|
|
104
|
+
const remove = (m: Mail, verb: string) => {
|
|
105
|
+
setMail((list) => list.filter((x) => x.id !== m.id));
|
|
106
|
+
setStatus(`${verb}: ${m.subject}`);
|
|
107
|
+
};
|
|
108
|
+
const toggleRead = (m: Mail) =>
|
|
109
|
+
setMail((list) => list.map((x) => (x.id === m.id ? { ...x, unread: !x.unread } : x)));
|
|
110
|
+
|
|
111
|
+
const q = query.trim().toLowerCase();
|
|
112
|
+
const shown = q
|
|
113
|
+
? mail.filter((m) => `${m.from} ${m.subject} ${m.preview}`.toLowerCase().includes(q))
|
|
114
|
+
: mail;
|
|
115
|
+
const unread = mail.filter((m) => m.unread).length;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
ref={screen}
|
|
120
|
+
className="relative mx-auto h-[720px] w-full max-w-[390px] overflow-hidden border border-field-edge bg-background [contain:layout_paint]"
|
|
121
|
+
>
|
|
122
|
+
<PullToRefresh
|
|
123
|
+
role="region"
|
|
124
|
+
aria-label="Inbox screen"
|
|
125
|
+
onRefresh={refresh}
|
|
126
|
+
className="h-full pb-[calc(var(--bottom-nav-bar)+1px)]"
|
|
127
|
+
header={
|
|
128
|
+
<AppBar
|
|
129
|
+
title="Inbox"
|
|
130
|
+
largeTitle
|
|
131
|
+
actions={<AppBarAction icon={<SquarePenIcon />} label="New message" />}
|
|
132
|
+
search={<AppBarSearch value={query} onChange={(event) => setQuery(event.target.value)} />}
|
|
133
|
+
/>
|
|
134
|
+
}
|
|
135
|
+
>
|
|
136
|
+
<ul aria-label="Messages" className="border-t border-border/60">
|
|
137
|
+
{shown.map((m) => (
|
|
138
|
+
<li key={m.id} className="border-b border-border/60">
|
|
139
|
+
<SwipeActions
|
|
140
|
+
label={m.subject}
|
|
141
|
+
// The row's own "…" opens the actions as a sheet: it stands in for the menu button.
|
|
142
|
+
menu={false}
|
|
143
|
+
leading={[
|
|
144
|
+
{
|
|
145
|
+
label: m.unread ? "Read" : "Unread",
|
|
146
|
+
icon: m.unread ? <MailOpenIcon /> : <MailIcon />,
|
|
147
|
+
tone: "info",
|
|
148
|
+
onSelect: () => toggleRead(m),
|
|
149
|
+
},
|
|
150
|
+
]}
|
|
151
|
+
trailing={[
|
|
152
|
+
{ label: "Archive", icon: <ArchiveIcon />, onSelect: () => remove(m, "Archived") },
|
|
153
|
+
{
|
|
154
|
+
label: "Delete",
|
|
155
|
+
icon: <Trash2Icon />,
|
|
156
|
+
tone: "destructive",
|
|
157
|
+
onSelect: () => remove(m, "Deleted"),
|
|
158
|
+
},
|
|
159
|
+
]}
|
|
160
|
+
>
|
|
161
|
+
<div className="flex items-start gap-1 py-3 ps-4 pe-2">
|
|
162
|
+
<span
|
|
163
|
+
aria-hidden
|
|
164
|
+
className={
|
|
165
|
+
m.unread ? "mt-2 size-2 shrink-0 rounded-full bg-info" : "mt-2 size-2 shrink-0"
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
<a href={`#${m.id}`} className="min-w-0 flex-1 rounded-item px-2 focus-ring">
|
|
169
|
+
<span className="flex items-baseline gap-2">
|
|
170
|
+
<span
|
|
171
|
+
className={
|
|
172
|
+
m.unread
|
|
173
|
+
? "min-w-0 flex-1 truncate text-15 font-medium text-foreground"
|
|
174
|
+
: "min-w-0 flex-1 truncate text-15 text-foreground"
|
|
175
|
+
}
|
|
176
|
+
>
|
|
177
|
+
{m.unread && <span className="sr-only">Unread: </span>}
|
|
178
|
+
{m.from}
|
|
179
|
+
</span>
|
|
180
|
+
<span className="shrink-0 font-mono text-11 text-muted-foreground">{m.time}</span>
|
|
181
|
+
</span>
|
|
182
|
+
<span className="mt-0.5 block truncate text-14 text-foreground-soft">{m.subject}</span>
|
|
183
|
+
<span className="mt-0.5 block truncate text-13 text-muted-foreground">{m.preview}</span>
|
|
184
|
+
</a>
|
|
185
|
+
<ActionSheet presentation="sheet">
|
|
186
|
+
<ActionSheetTrigger
|
|
187
|
+
render={
|
|
188
|
+
<Button variant="ghost" size="icon-sm" aria-label={`Actions for ${m.subject}`} />
|
|
189
|
+
}
|
|
190
|
+
>
|
|
191
|
+
<EllipsisIcon />
|
|
192
|
+
</ActionSheetTrigger>
|
|
193
|
+
<ActionSheetContent portal={{ container: screen }} title={m.subject} description={`From ${m.from}`}>
|
|
194
|
+
<ActionSheetAction onClick={() => toggleRead(m)}>
|
|
195
|
+
{m.unread ? "Mark as read" : "Mark as unread"}
|
|
196
|
+
</ActionSheetAction>
|
|
197
|
+
<ActionSheetAction onClick={() => remove(m, "Archived")}>Archive</ActionSheetAction>
|
|
198
|
+
<ActionSheetAction variant="destructive" onClick={() => remove(m, "Deleted")}>
|
|
199
|
+
Delete message
|
|
200
|
+
</ActionSheetAction>
|
|
201
|
+
</ActionSheetContent>
|
|
202
|
+
</ActionSheet>
|
|
203
|
+
</div>
|
|
204
|
+
</SwipeActions>
|
|
205
|
+
</li>
|
|
206
|
+
))}
|
|
207
|
+
</ul>
|
|
208
|
+
<p className="px-4 py-6 text-center text-13 text-muted-foreground" aria-live="polite">
|
|
209
|
+
{shown.length === 0 ? (q ? "No messages match." : "Inbox zero.") : status}
|
|
210
|
+
</p>
|
|
211
|
+
</PullToRefresh>
|
|
212
|
+
<BottomNav position="absolute" aria-label="Mail" value={tab} onValueChange={setTab}>
|
|
213
|
+
<BottomNavItem value="inbox" icon={<InboxIcon />} label="Inbox" badge={unread || undefined} />
|
|
214
|
+
<BottomNavItem value="search" icon={<SearchIcon />} label="Search" />
|
|
215
|
+
<BottomNavItem value="sent" icon={<SendIcon className="rtl:-scale-x-100" />} label="Sent" />
|
|
216
|
+
<BottomNavItem value="account" icon={<UserIcon />} label="Account" />
|
|
217
|
+
</BottomNav>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
A mail app's inbox on a 390px phone screen, put together from the Phone parts and nothing else:
|
|
224
|
+
|
|
225
|
+
- **AppBar** with a large "Inbox" title and a search field under it; both scroll under the bar, which takes the page ground and a hairline and shows the small title once they have gone. The search filters the list as you type.
|
|
226
|
+
- **PullToRefresh** around the list, with the AppBar as its `header`: pull down at the top and a new message arrives after a moment. Its Refresh button is first in the list for the keyboard.
|
|
227
|
+
- **SwipeActions** on every row: swipe left to show Archive and Delete, then tap one (two actions, so no swipe runs one by itself); swipe right through the row to mark it read or unread.
|
|
228
|
+
- **ActionSheet** from each row's "…": the same choices as a sheet, the way the keyboard and screen readers reach them (the row's `menu` is off, as the "…" takes its place).
|
|
229
|
+
- **BottomNav** pinned to the bottom of the screen, its Inbox count following the unread mail.
|
|
230
|
+
|
|
231
|
+
All of it is sample mail for a fictional team; nothing is sent, fetched or saved.
|
|
232
|
+
|
|
233
|
+
## Usage
|
|
234
|
+
|
|
235
|
+
The screen is one scroller with the bar inside it, so the bar can stick and the large title can scroll away:
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
<PullToRefresh
|
|
239
|
+
className="h-dvh pb-(--bottom-nav-h)"
|
|
240
|
+
onRefresh={fetchMail}
|
|
241
|
+
header={<AppBar title="Inbox" largeTitle search={<AppBarSearch value={query} onChange={…} />} />}
|
|
242
|
+
>
|
|
243
|
+
<ul>
|
|
244
|
+
{mail.map((m) => (
|
|
245
|
+
<li key={m.id}>
|
|
246
|
+
<SwipeActions label={m.subject} menu={false} trailing={[archive(m), remove(m)]}>
|
|
247
|
+
<MailRow mail={m} actions={<MailActionSheet mail={m} />} />
|
|
248
|
+
</SwipeActions>
|
|
249
|
+
</li>
|
|
250
|
+
))}
|
|
251
|
+
</ul>
|
|
252
|
+
</PullToRefresh>
|
|
253
|
+
<BottomNav>…</BottomNav>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
In an app the bottom nav is `position="fixed"` and the scroller reserves `--bottom-nav-h`; in the preview here it is pinned to the screen with `position="absolute"`, and the action sheets render into the screen (`portal={{ container }}` and `contain: layout paint` on it).
|
|
257
|
+
|
|
258
|
+
To adapt it, change **the rows** (what a message shows), **the actions** (the same list for the swipe and the sheet) and **what a refresh does** (`onRefresh`).
|
|
259
|
+
|
|
260
|
+
## When to use
|
|
261
|
+
|
|
262
|
+
- The list screen of a phone app people triage every day: mail, notifications, orders, tasks.
|
|
263
|
+
- A desktop mail client: a `Sidebar` and a `Table` or `Item` list, with row actions in a `Menu`.
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Input Group
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { InputGroup, InputGroupAddon, InputGroupInput, KbdShortcut } from "@zonsh/ui";
|
|
5
|
+
import { SearchIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
export function Basic() {
|
|
8
|
+
return (
|
|
9
|
+
<InputGroup className="w-full max-w-sm">
|
|
10
|
+
<InputGroupInput type="search" placeholder="Search components" aria-label="Search components" />
|
|
11
|
+
<InputGroupAddon>
|
|
12
|
+
<SearchIcon />
|
|
13
|
+
</InputGroupAddon>
|
|
14
|
+
<InputGroupAddon align="inline-end">
|
|
15
|
+
<KbdShortcut keys={["mod", "K"]} />
|
|
16
|
+
</InputGroupAddon>
|
|
17
|
+
</InputGroup>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
One recessed field — 10px corners, 38px (30px with `size="sm"`) — with addons inside its edge: a 16px icon, a Licht Mono prefix, a `Kbd`, or a small raised button. The input has no border of its own; on focus the whole group takes the softer edge of a focused field, halfway to `--control-focus`, with no ring, so it reads as one object.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "@zonsh/ui";
|
|
28
|
+
import { SearchIcon } from "lucide-react";
|
|
29
|
+
|
|
30
|
+
<InputGroup>
|
|
31
|
+
<InputGroupInput placeholder="Search components" aria-label="Search components" />
|
|
32
|
+
<InputGroupAddon>
|
|
33
|
+
<SearchIcon />
|
|
34
|
+
</InputGroupAddon>
|
|
35
|
+
</InputGroup>;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- `align` on `InputGroupAddon` — `inline-start` (default), `inline-end`, `block-start` / `block-end` for a toolbar. Keep the control first in the source; `align` places the addons.
|
|
39
|
+
- `size` on `InputGroup` — `"sm"` for the dense field.
|
|
40
|
+
- `size` / `variant` on `InputGroupButton` — `"icon"` is a 30px round button for the 38px field.
|
|
41
|
+
|
|
42
|
+
## When to use
|
|
43
|
+
|
|
44
|
+
- A hint inside the field: a search icon, `https://`, a unit, a domain suffix.
|
|
45
|
+
- A small action on the value: copy, clear, show password.
|
|
46
|
+
- A textarea with a toolbar under it: a count and a Send button.
|
|
47
|
+
- A form action (Submit, Save) is a `Button` beside the field; to join them edge to edge, `ButtonGroup`. No addons: `Input`.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Prefix
|
|
52
|
+
|
|
53
|
+
A mono `InputGroupText` for a fixed part of the value.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { Field, FieldDescription, FieldLabel, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@zonsh/ui";
|
|
57
|
+
|
|
58
|
+
export function Prefix() {
|
|
59
|
+
return (
|
|
60
|
+
<Field className="w-full max-w-sm">
|
|
61
|
+
<FieldLabel>Your website</FieldLabel>
|
|
62
|
+
<InputGroup>
|
|
63
|
+
<InputGroupInput placeholder="example.com" inputMode="url" />
|
|
64
|
+
<InputGroupAddon>
|
|
65
|
+
<InputGroupText>https://</InputGroupText>
|
|
66
|
+
</InputGroupAddon>
|
|
67
|
+
</InputGroup>
|
|
68
|
+
<FieldDescription>Shown on your public profile, next to your name.</FieldDescription>
|
|
69
|
+
</Field>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Copy button
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { Field, FieldLabel, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@zonsh/ui";
|
|
78
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
79
|
+
import * as React from "react";
|
|
80
|
+
|
|
81
|
+
export function CopyButton() {
|
|
82
|
+
const [copied, setCopied] = React.useState(false);
|
|
83
|
+
const value = "https://zon.sh/ui/brand.md";
|
|
84
|
+
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (!copied) return;
|
|
87
|
+
const timeout = window.setTimeout(() => setCopied(false), 2000);
|
|
88
|
+
return () => window.clearTimeout(timeout);
|
|
89
|
+
}, [copied]);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Field className="w-full max-w-sm">
|
|
93
|
+
<FieldLabel>Brand portal</FieldLabel>
|
|
94
|
+
<InputGroup>
|
|
95
|
+
<InputGroupInput readOnly value={value} className="font-mono text-[13px] pointer-coarse:text-base" />
|
|
96
|
+
<InputGroupAddon align="inline-end">
|
|
97
|
+
<InputGroupButton
|
|
98
|
+
size="icon"
|
|
99
|
+
aria-label={copied ? "Copied" : "Copy link"}
|
|
100
|
+
onClick={() => {
|
|
101
|
+
void navigator.clipboard?.writeText(value);
|
|
102
|
+
setCopied(true);
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
{copied ? <CheckIcon /> : <CopyIcon />}
|
|
106
|
+
</InputGroupButton>
|
|
107
|
+
</InputGroupAddon>
|
|
108
|
+
</InputGroup>
|
|
109
|
+
</Field>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Textarea toolbar
|
|
115
|
+
|
|
116
|
+
`align="block-end"` puts a toolbar under the textarea, at least 140px tall together, with no resize handle. The textarea grows to 240px, then scrolls (`field-sizing: content`; elsewhere it keeps its height).
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { Field, FieldLabel, InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupTextarea } from "@zonsh/ui";
|
|
120
|
+
import { ArrowUpIcon } from "lucide-react";
|
|
121
|
+
import * as React from "react";
|
|
122
|
+
|
|
123
|
+
export function Composer() {
|
|
124
|
+
const [text, setText] = React.useState("");
|
|
125
|
+
const max = 500;
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Field className="w-full max-w-lg">
|
|
129
|
+
<FieldLabel>Leave a comment</FieldLabel>
|
|
130
|
+
<InputGroup>
|
|
131
|
+
<InputGroupTextarea
|
|
132
|
+
value={text}
|
|
133
|
+
onValueChange={(next) => setText(String(next))}
|
|
134
|
+
maxLength={max}
|
|
135
|
+
placeholder="The section on night trains was useful. Is the Vienna route still running in winter?"
|
|
136
|
+
/>
|
|
137
|
+
<InputGroupAddon align="block-end">
|
|
138
|
+
<InputGroupText className="pl-1.5">
|
|
139
|
+
{text.length}/{max}
|
|
140
|
+
</InputGroupText>
|
|
141
|
+
<InputGroupButton variant="primary" className="ml-auto" disabled={text.trim().length === 0}>
|
|
142
|
+
Send
|
|
143
|
+
<ArrowUpIcon />
|
|
144
|
+
</InputGroupButton>
|
|
145
|
+
</InputGroupAddon>
|
|
146
|
+
</InputGroup>
|
|
147
|
+
</Field>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Clear button
|
|
153
|
+
|
|
154
|
+
`InputGroupClearButton` erases the text right to left (150ms), clears the value and returns focus to the field. While the field is empty it fades out and can't be clicked or tabbed to. Pass `onClear` to clear your state; without it, it empties an uncontrolled input and fires its change event. Name it with `label` ("Clear search"). Enter, Space and reduced motion clear at once.
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { InputGroup, InputGroupAddon, InputGroupClearButton, InputGroupInput } from "@zonsh/ui";
|
|
158
|
+
import { SearchIcon } from "lucide-react";
|
|
159
|
+
import * as React from "react";
|
|
160
|
+
|
|
161
|
+
export function ClearButton() {
|
|
162
|
+
const [query, setQuery] = React.useState("Night trains");
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<InputGroup className="w-full max-w-sm">
|
|
166
|
+
<InputGroupInput
|
|
167
|
+
value={query}
|
|
168
|
+
onValueChange={(next) => setQuery(String(next))}
|
|
169
|
+
placeholder="Search articles"
|
|
170
|
+
aria-label="Search articles"
|
|
171
|
+
/>
|
|
172
|
+
<InputGroupAddon>
|
|
173
|
+
<SearchIcon />
|
|
174
|
+
</InputGroupAddon>
|
|
175
|
+
<InputGroupAddon align="inline-end">
|
|
176
|
+
<InputGroupClearButton label="Clear search" onClear={() => setQuery("")} />
|
|
177
|
+
</InputGroupAddon>
|
|
178
|
+
</InputGroup>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Password
|
|
184
|
+
|
|
185
|
+
`InputGroupPasswordToggle` is a ghost icon button whose eye takes a slash while the password shows, uncovering the text left to right (about 330ms; never blocking input; skipped under reduced motion). Its name stays "Show password" (`label`) and `aria-pressed` gives the state. Switch the input's `type` with the same state.
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import { Field, FieldLabel, InputGroup, InputGroupAddon, InputGroupInput, InputGroupPasswordToggle } from "@zonsh/ui";
|
|
189
|
+
import * as React from "react";
|
|
190
|
+
|
|
191
|
+
export function Password() {
|
|
192
|
+
const [visible, setVisible] = React.useState(false);
|
|
193
|
+
return (
|
|
194
|
+
<Field className="w-full max-w-sm">
|
|
195
|
+
<FieldLabel>Password</FieldLabel>
|
|
196
|
+
<InputGroup>
|
|
197
|
+
<InputGroupInput
|
|
198
|
+
type={visible ? "text" : "password"}
|
|
199
|
+
autoComplete="current-password"
|
|
200
|
+
spellCheck={false}
|
|
201
|
+
defaultValue="correct horse"
|
|
202
|
+
/>
|
|
203
|
+
<InputGroupAddon align="inline-end">
|
|
204
|
+
<InputGroupPasswordToggle visible={visible} onVisibleChange={setVisible} />
|
|
205
|
+
</InputGroupAddon>
|
|
206
|
+
</InputGroup>
|
|
207
|
+
</Field>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Sizes
|
|
213
|
+
|
|
214
|
+
Dense groups take 24px buttons (`size="sm"` / `"icon-sm"`). Corners stay concentric: 10 − 3 = 7px at 38px, 10 − 2 = 8px at 30px, from `--radius-control`, `--control-inset` and `--control-inset-sm`.
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@zonsh/ui";
|
|
218
|
+
import { SearchIcon } from "lucide-react";
|
|
219
|
+
|
|
220
|
+
export function Sizes() {
|
|
221
|
+
return (
|
|
222
|
+
<div className="flex w-full max-w-sm flex-col gap-4">
|
|
223
|
+
<InputGroup size="sm">
|
|
224
|
+
<InputGroupInput placeholder="Filter rows" aria-label="Filter rows" />
|
|
225
|
+
<InputGroupAddon>
|
|
226
|
+
<SearchIcon />
|
|
227
|
+
</InputGroupAddon>
|
|
228
|
+
<InputGroupAddon align="inline-end">
|
|
229
|
+
<InputGroupButton size="sm">Apply</InputGroupButton>
|
|
230
|
+
</InputGroupAddon>
|
|
231
|
+
</InputGroup>
|
|
232
|
+
<InputGroup>
|
|
233
|
+
<InputGroupInput placeholder="Filter rows" aria-label="Filter rows" />
|
|
234
|
+
<InputGroupAddon>
|
|
235
|
+
<SearchIcon />
|
|
236
|
+
</InputGroupAddon>
|
|
237
|
+
<InputGroupAddon align="inline-end">
|
|
238
|
+
<InputGroupButton>Apply</InputGroupButton>
|
|
239
|
+
</InputGroupAddon>
|
|
240
|
+
</InputGroup>
|
|
241
|
+
</div>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### States
|
|
247
|
+
|
|
248
|
+
Inside `Field invalid`, the group shows the destructive border and ring.
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
import { Field, FieldError, FieldLabel, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@zonsh/ui";
|
|
252
|
+
|
|
253
|
+
function Invalid() {
|
|
254
|
+
return (
|
|
255
|
+
<Field invalid className="w-full max-w-sm">
|
|
256
|
+
<FieldLabel>Team size</FieldLabel>
|
|
257
|
+
<InputGroup>
|
|
258
|
+
<InputGroupInput defaultValue="0" inputMode="numeric" className="font-mono tabular-nums" />
|
|
259
|
+
<InputGroupAddon align="inline-end">
|
|
260
|
+
<InputGroupText>people</InputGroupText>
|
|
261
|
+
</InputGroupAddon>
|
|
262
|
+
</InputGroup>
|
|
263
|
+
<FieldError match>Enter at least one person.</FieldError>
|
|
264
|
+
</Field>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function Disabled() {
|
|
269
|
+
return (
|
|
270
|
+
<Field disabled className="w-full max-w-sm">
|
|
271
|
+
<FieldLabel>Workspace address</FieldLabel>
|
|
272
|
+
<InputGroup>
|
|
273
|
+
<InputGroupInput defaultValue="cologne-office" />
|
|
274
|
+
<InputGroupAddon align="inline-end">
|
|
275
|
+
<InputGroupText>.zon.sh</InputGroupText>
|
|
276
|
+
</InputGroupAddon>
|
|
277
|
+
</InputGroup>
|
|
278
|
+
</Field>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** The invalid and disabled states, one under the other. */
|
|
283
|
+
export function States() {
|
|
284
|
+
return (
|
|
285
|
+
<div className="flex w-full max-w-sm flex-col gap-8">
|
|
286
|
+
<Invalid />
|
|
287
|
+
<Disabled />
|
|
288
|
+
</div>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Props
|
|
294
|
+
|
|
295
|
+
| Component | Prop | Type | Default |
|
|
296
|
+
| -------------------------- | ----------------------------- | ---------------------------------------------------------------- | ----------------- |
|
|
297
|
+
| `InputGroup` | `size` | `"sm" \| "default"` | `"default"` |
|
|
298
|
+
| `InputGroupAddon` | `align` | `"inline-start" \| "inline-end" \| "block-start" \| "block-end"` | `"inline-start"` |
|
|
299
|
+
| `InputGroupButton` | `variant` | `"secondary" \| "ghost" \| "primary"` | `"secondary"` |
|
|
300
|
+
| `InputGroupButton` | `size` | `"default"` (30px) \| `"sm"` (24px) \| `"icon"` \| `"icon-sm"` | `"default"` |
|
|
301
|
+
| `InputGroupPasswordToggle` | `visible` / `onVisibleChange` | `boolean` / `(visible) => void` | — |
|
|
302
|
+
| `InputGroupPasswordToggle` | `label` | `string` — one name for both states | `"Show password"` |
|
|
303
|
+
| `InputGroupClearButton` | `onClear` | `() => void` — clear your state; omit for an uncontrolled input | — |
|
|
304
|
+
| `InputGroupClearButton` | `label` | `string` | `"Clear"` |
|
|
305
|
+
|
|
306
|
+
`InputGroupInput` takes every Base UI `Input` prop (`value`, `defaultValue`, `onValueChange`, …). `InputGroupTextarea` takes Base UI `Field.Control` props. `InputGroupButton` takes Base UI `Button` props. `InputGroupText` is a `<span>`. Data attributes: group `data-size`; addon `data-align`; button `data-variant` and `data-size`; the control has `data-slot="input-group-control"`.
|
|
307
|
+
|
|
308
|
+
The password toggle's and the clear button's default names come from `messages.inputGroup` (`showPassword`, `clear`).
|
|
309
|
+
|
|
310
|
+
## Brand rules
|
|
311
|
+
|
|
312
|
+
- **Do** keep addons quiet: muted icons and mono text. The value is what people read.
|
|
313
|
+
- **Do** size inner buttons to the field: 30px in the 38px group, 24px in the 30px group.
|
|
314
|
+
- **Don't** give an inner button its own radius.
|
|
315
|
+
- **Do** use `primary` only for the view's one action, such as Send in a composer.
|
|
316
|
+
- **Don't** give the inner input its own border, background or focus ring.
|
|
317
|
+
- **Don't** put more than two buttons in a group; use a textarea toolbar.
|
|
318
|
+
|
|
319
|
+
## Accessibility
|
|
320
|
+
|
|
321
|
+
- The group is `role="group"`; the input or textarea is the labelled control — use a `Field` with a `FieldLabel`, or `aria-label`.
|
|
322
|
+
- Icon-only buttons need an `aria-label`. A button whose icon changes (copy → check) changes its label; a toggle keeps its name and sets `aria-pressed`.
|
|
323
|
+
- Clicking an addon's icon or padding focuses the control.
|
|
324
|
+
- Focus gives the whole group the softer edge of a focused field (halfway to `--control-focus`), no ring; its buttons keep the 2px ring for keyboard focus.
|
|
325
|
+
|
|
326
|
+
### Keyboard
|
|
327
|
+
|
|
328
|
+
| Key | What it does |
|
|
329
|
+
| ------------- | -------------------------------------------------------------------------------------------------- |
|
|
330
|
+
| Tab | Moves to the control and to each button in the addons, in order |
|
|
331
|
+
| Enter / Space | Presses the focused addon button; the clear button clears at once and returns focus to the control |
|
|
332
|
+
|
|
333
|
+
The control keeps its own keys. The clear button leaves the Tab order while the field is empty.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
- Import: `import { InputGroup, InputGroupInput, InputGroupTextarea, InputGroupAddon, InputGroupText, InputGroupButton, InputGroupPasswordToggle, InputGroupClearButton } from "@zonsh/ui"`
|
|
338
|
+
- Source: `packages/ui/src/components/input-group.tsx`
|
|
339
|
+
- Primitive: `@base-ui/react/input` (Base UI docs: `node_modules/@base-ui/react/docs/react/components/input.md`)
|