@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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Code block
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
const css = `@import "tailwindcss";
|
|
7
|
+
@import "@zonsh/ui/styles.css";
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export function WithHeader() {
|
|
11
|
+
return <CodeBlock filename="src/styles.css" language="css" code={css} />;
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Source in Licht Mono 13px, 1.75 line height, tab size 2, scrolling sideways rather than wrapping. By default a **region** (square `surface-container`); `variant="card"` makes it a 20px object. An optional header holds a filename eyebrow over a hairline, sized so the raised copy button sits as far from the top as from the right; it confirms with a check. With a `language` the code is coloured; without, mono.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
21
|
+
|
|
22
|
+
<CodeBlock filename="Terminal" language="bash" code="pnpm add @zonsh/ui" />;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The props you'll reach for: `code`, `language` and `filename`.
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
- Install commands (one row), configuration and short examples in docs and articles.
|
|
30
|
+
- `variant="card"` for a standalone snippet beside prose; the region inside a page section.
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Card with line numbers
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
38
|
+
|
|
39
|
+
const config = `import { defineConfig } from "vite";
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
default defineConfig({
|
|
43
|
+
plugins: [react()],
|
|
44
|
+
server: {
|
|
45
|
+
port: 5173,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export function CardWithLineNumbers() {
|
|
51
|
+
return <CodeBlock variant="card" filename="vite.config.ts" language="ts" lineNumbers code={config} />;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Syntax colours
|
|
56
|
+
|
|
57
|
+
Shiki with VS Code's grammars, in the zon theme: keywords violet, strings lime, numbers orange, functions blue, types aqua, tags magenta, comments and punctuation grey, diff lines in status colours.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
61
|
+
|
|
62
|
+
const component = `import { useState } from "react";
|
|
63
|
+
|
|
64
|
+
export function Highlighted() {
|
|
65
|
+
return <CodeBlock variant="card" filename="counter.tsx" language="tsx" lineNumbers code={component} />;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Nothing to set up: Shiki loads the first time a block needs it, each language on first use; until then (and on the server, and for unknown languages) the block is plain mono, so nothing shifts. About 35 languages are built in; `registerCodeLanguage` adds more (see [Code Highlight › Languages](code-highlight.md#languages)). `highlight={false}` keeps a block mono.
|
|
70
|
+
|
|
71
|
+
Long code appears at once: past 400 lines it is coloured a slice at a time from the top, in 100-line chunks laid out only near the view. Every line stays in the page for find, select and copy.
|
|
72
|
+
|
|
73
|
+
The colours are custom properties on the block — `--code-keyword`, `--code-string`, `--code-constant`, `--code-function`, `--code-type`, `--code-tag`, `--code-attribute`, `--code-comment`, `--code-punctuation`, `--code-inserted`, `--code-deleted` — so a page can change one. The code is React text, never HTML, so untrusted input is safe.
|
|
74
|
+
|
|
75
|
+
### One-line commands
|
|
76
|
+
|
|
77
|
+
One line without a `filename` is `size="sm"`: line and copy button share one 46px row, with no language label. `size="default"` brings the header back; `size="sm"` forces the row.
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
81
|
+
|
|
82
|
+
export function Commands() {
|
|
83
|
+
return (
|
|
84
|
+
<div className="flex flex-col gap-3">
|
|
85
|
+
<CodeBlock language="bash" code="pnpm add @zonsh/ui" />
|
|
86
|
+
<CodeBlock language="bash" code="pnpm create zon@latest my-app --next" />
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Minimal
|
|
93
|
+
|
|
94
|
+
No header: the copy button floats level with the first line.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
98
|
+
|
|
99
|
+
export function Minimal() {
|
|
100
|
+
return (
|
|
101
|
+
<CodeBlock>{`pnpm add @zonsh/ui
|
|
102
|
+
cp -r node_modules/@zonsh/ui/dist/skills/zon-ui .claude/skills/`}</CodeBlock>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Props
|
|
108
|
+
|
|
109
|
+
| Prop | Type | Default |
|
|
110
|
+
| ------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------- |
|
|
111
|
+
| `code` | `string` — or pass it as the child | — |
|
|
112
|
+
| `variant` | `"region" \| "card"` | `"region"` |
|
|
113
|
+
| `filename` | `ReactNode` | — |
|
|
114
|
+
| `language` | `string` — label and grammar, e.g. `"tsx"` | — |
|
|
115
|
+
| `highlight` | `boolean` — colour by `language` | `true` |
|
|
116
|
+
| `lineNumbers` | `boolean` | `false` |
|
|
117
|
+
| `wrap` | `boolean` — wrap long lines, for prose such as a prompt | `false` |
|
|
118
|
+
| `copyable` | `boolean` | `true` |
|
|
119
|
+
| `size` | `"sm" \| "default"` — `sm`: the line and the copy button in one row, no header | `sm` for one line without `filename` or `lineNumbers` |
|
|
120
|
+
| `labels` | `{ copy?, copied?, failed? }` | English |
|
|
121
|
+
|
|
122
|
+
Other `<figure>` props are forwarded; a height in `className` scrolls the code under the header. A trailing newline is trimmed. Data attributes: `data-size` (`sm` on a one-row block), `data-highlighted` once the code is coloured, `data-highlight-pending` while the colours load.
|
|
123
|
+
|
|
124
|
+
The copy button reads `messages.codeBlock.copy` and `messages.copyButton`; `labels` wins.
|
|
125
|
+
|
|
126
|
+
## Brand rules
|
|
127
|
+
|
|
128
|
+
- **Do** name the `language`: kinds of token are categories, so they take the category tones.
|
|
129
|
+
- **Do** let the mono face, indentation and line numbers carry the structure; colour never carries meaning alone.
|
|
130
|
+
- **Do** use a filename or "Terminal" as the header.
|
|
131
|
+
- **Don't** bring in an editor theme or colour tokens by hand; change a `--code-*` property if one tone has to differ.
|
|
132
|
+
- **Don't** round the region variant or give it a shadow; only `card` is an object.
|
|
133
|
+
|
|
134
|
+
## Accessibility
|
|
135
|
+
|
|
136
|
+
- The `<pre>` is focusable, so keyboard users can scroll long lines and tall blocks.
|
|
137
|
+
- The copy button has an accessible name and announces "Copied" through a polite live region.
|
|
138
|
+
- Line numbers are `aria-hidden` and not selectable, so copying by hand takes only the code.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
- Import: `import { CodeBlock } from "@zonsh/ui"`
|
|
143
|
+
- Source: `packages/ui/src/components/code-block.tsx`
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Code Highlight
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { CodeBlock, Tabs, TabsList, TabsPanel, TabsTab } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
/* Illustrative sources. */
|
|
7
|
+
const samples = [
|
|
8
|
+
{
|
|
9
|
+
language: "tsx",
|
|
10
|
+
filename: "use-online.ts",
|
|
11
|
+
code: `import { useSyncExternalStore } from "react";
|
|
12
|
+
|
|
13
|
+
/** The same zon theme across languages. */
|
|
14
|
+
export function Languages() {
|
|
15
|
+
return (
|
|
16
|
+
<Tabs defaultValue="tsx" className="w-full max-w-2xl">
|
|
17
|
+
<TabsList>
|
|
18
|
+
{samples.map((s) => (
|
|
19
|
+
<TabsTab key={s.language} value={s.language}>
|
|
20
|
+
{s.language}
|
|
21
|
+
</TabsTab>
|
|
22
|
+
))}
|
|
23
|
+
</TabsList>
|
|
24
|
+
{samples.map((s) => (
|
|
25
|
+
<TabsPanel key={s.language} value={s.language}>
|
|
26
|
+
<CodeBlock variant="card" filename={s.filename} language={s.language} code={s.code} />
|
|
27
|
+
</TabsPanel>
|
|
28
|
+
))}
|
|
29
|
+
</Tabs>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Syntax colours for `CodeBlock`, a `Response`'s fenced code and a `ToolCall`'s parameters and result, with [Shiki](https://shiki.style) and VS Code's own grammars. The zon theme gives one category tone per kind of token, greys for comments and punctuation, status colours for diff lines, in light and dark.
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Nothing to set up: Shiki comes with `@zonsh/ui`.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { CodeBlock } from "@zonsh/ui";
|
|
42
|
+
|
|
43
|
+
<CodeBlock language="tsx" code={source} />;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The props you'll reach for: `language` and `highlight` on `CodeBlock` (`highlight` also on `Response` and `ToolCall`), and `registerCodeLanguage` for a language not in the list.
|
|
47
|
+
|
|
48
|
+
Shiki (JavaScript regex engine, no WebAssembly) loads the first time a block asks for colour, each grammar on first use. Until then, on the server, and for an unknown language, the block is plain mono, so nothing shifts. A page without a coloured block never loads Shiki; a build without the three components leaves it out. Once loaded, tokenising is synchronous, so a streaming reply colours as it is written.
|
|
49
|
+
|
|
50
|
+
## When to use
|
|
51
|
+
|
|
52
|
+
- Always, unless a block has a reason to be plain: it is the default.
|
|
53
|
+
- `highlight={false}` keeps a block mono, e.g. one that shows output rather than code.
|
|
54
|
+
|
|
55
|
+
## Languages
|
|
56
|
+
|
|
57
|
+
Coloured, under their usual names: JavaScript (`js`, `mjs`, `cjs`), TypeScript (`ts`), JSX, TSX, JSON, JSONC, HTML, CSS, SCSS, Markdown (`md`), MDX, YAML (`yml`), TOML, XML (`svg`), shell (`bash`, `sh`, `shell`, `zsh`), shell sessions (`console`), PowerShell, Dockerfile, diff, SQL, GraphQL, Python (`py`), Go, Rust (`rs`), Java, Kotlin, Swift, C, C++, C# (`cs`), PHP, Ruby (`rb`), INI, dotenv (`env`), Vue and Svelte. `codeLanguages()` lists every name. Any other language stays mono.
|
|
58
|
+
|
|
59
|
+
Each grammar is its own lazy chunk, not one of Shiki's 230-odd. To colour another, register it once in client code before the blocks render: the grammar's id, then other fence names. It stays lazy.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { registerCodeLanguage } from "@zonsh/ui";
|
|
63
|
+
|
|
64
|
+
registerCodeLanguage(["elixir", "ex"], () => import("shiki/langs/elixir.mjs"));
|
|
65
|
+
registerCodeLanguage("terraform", () => import("shiki/langs/terraform.mjs"));
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
With pnpm, `pnpm add shiki` to import its grammars yourself.
|
|
69
|
+
|
|
70
|
+
## Shiki HTML of your own
|
|
71
|
+
|
|
72
|
+
For highlighted HTML of your own — on the server or in a Markdown pipeline — use Shiki with `zonCodeTheme`. Its colours are the `--code-*` properties, set on every `pre.shiki` too, so output follows light and dark. It is plain data, usable in a server component.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { codeToHtml } from "shiki";
|
|
76
|
+
import { zonCodeTheme } from "@zonsh/ui";
|
|
77
|
+
|
|
78
|
+
const html = await codeToHtml(source, { lang: "tsx", theme: zonCodeTheme });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`highlight` (default `true`) and `language` are props of `CodeBlock`; `highlight` is also on `Response` and `ToolCall`.
|
|
82
|
+
|
|
83
|
+
## The zon code theme
|
|
84
|
+
|
|
85
|
+
| Token | Property | Colour |
|
|
86
|
+
| ------------------------------ | ------------------------------ | ----------------------------- |
|
|
87
|
+
| Keywords, `this` | `--code-keyword` | `--tone-violet` |
|
|
88
|
+
| Strings | `--code-string` | `--tone-lime` |
|
|
89
|
+
| Template parts, regex, escapes | `--code-string-expression` | `--tone-aqua` |
|
|
90
|
+
| Numbers, constants | `--code-constant` | `--tone-orange` |
|
|
91
|
+
| Functions, headings | `--code-function` | `--tone-blue` |
|
|
92
|
+
| Types, classes | `--code-type` | `--tone-aqua` |
|
|
93
|
+
| Tags, components | `--code-tag` | `--tone-magenta` |
|
|
94
|
+
| Attributes, keys, properties | `--code-attribute` | `--tone-blue` |
|
|
95
|
+
| Comments | `--code-comment` | `--muted-foreground` |
|
|
96
|
+
| Punctuation, operators | `--code-punctuation` | `--foreground-soft` |
|
|
97
|
+
| Added / removed lines | `--code-inserted` / `-deleted` | `--success` / `--destructive` |
|
|
98
|
+
|
|
99
|
+
Each colour is mixed 18% toward `--foreground`, so 13px code clears 4.5:1 in light and dark (5.8:1 and up). Set per block, so a forced `.theme-dark` region gets its own; override one on a block or ancestor.
|
|
100
|
+
|
|
101
|
+
## Brand rules
|
|
102
|
+
|
|
103
|
+
- **Do** keep the zon theme: kinds of token are categories, so they take the category tones.
|
|
104
|
+
- **Do** name the language of every block.
|
|
105
|
+
- **Don't** bring in an editor theme or colour tokens by hand; change a `--code-*` property if one tone has to differ.
|
|
106
|
+
|
|
107
|
+
## Accessibility
|
|
108
|
+
|
|
109
|
+
- Every token colour, comments included, clears 4.5:1 against the code surface in light and dark.
|
|
110
|
+
- Colour never carries meaning alone: the code reads the same in mono, and a screen reader hears only the text.
|
|
111
|
+
- The code is rendered as React text, never as HTML, so it is safe with untrusted input such as model output.
|
|
112
|
+
- Until its grammar loads, a block shows plain mono; colours arrive in place, nothing moving or announced. Long code is coloured a slice at a time.
|
|
113
|
+
- Code keeps `dir="ltr"` on a right-to-left page.
|
|
114
|
+
- The block is focusable, so overflowing code scrolls with the arrow keys; focus is the usual 2px `--control-focus` outline.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
- Import: `import { zonCodeTheme, registerCodeLanguage, codeLanguages } from "@zonsh/ui"`
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Collapsible
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
export function Basic() {
|
|
7
|
+
return (
|
|
8
|
+
<div className="flex w-full max-w-xl flex-col gap-4">
|
|
9
|
+
<h3 className="m-0 display text-[28px] leading-[1.1] text-foreground">Version history</h3>
|
|
10
|
+
<p className="m-0 text-[15px] leading-relaxed text-foreground-soft">
|
|
11
|
+
Every change to a note is kept, so you can see what changed and go back to any earlier draft.
|
|
12
|
+
</p>
|
|
13
|
+
<Collapsible>
|
|
14
|
+
<CollapsibleTrigger>Technical notes</CollapsibleTrigger>
|
|
15
|
+
<CollapsiblePanel>
|
|
16
|
+
<p className="m-0 pt-3 text-[15px] leading-relaxed text-foreground-soft">
|
|
17
|
+
Versions are stored as small differences from the one before, so a long history takes little
|
|
18
|
+
space. Versions older than a year are kept as one per week.
|
|
19
|
+
</p>
|
|
20
|
+
</CollapsiblePanel>
|
|
21
|
+
</Collapsible>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
One disclosure: a quiet Licht Mono trigger whose chevron turns as the panel opens. No box — it sits in the flow of the page.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@zonsh/ui";
|
|
33
|
+
|
|
34
|
+
<Collapsible>
|
|
35
|
+
<CollapsibleTrigger>Technical notes</CollapsibleTrigger>
|
|
36
|
+
<CollapsiblePanel>…</CollapsiblePanel>
|
|
37
|
+
</Collapsible>;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The props you'll reach for: `defaultOpen`, `open` / `onOpenChange`, and `hiddenUntilFound` on the panel.
|
|
41
|
+
|
|
42
|
+
## When to use
|
|
43
|
+
|
|
44
|
+
- Optional detail: "Show technical notes", "View all formats".
|
|
45
|
+
- A list of questions is an `Accordion`.
|
|
46
|
+
- Not for content people need to finish the task.
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### With button
|
|
51
|
+
|
|
52
|
+
`render` a `Button`; `showIcon={false}` when it has its own icon.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { Button, Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@zonsh/ui";
|
|
56
|
+
import { ChevronsUpDownIcon } from "lucide-react";
|
|
57
|
+
|
|
58
|
+
export function WithButton() {
|
|
59
|
+
return (
|
|
60
|
+
<div className="flex w-full max-w-xl flex-col gap-4">
|
|
61
|
+
<h3 className="m-0 display text-[28px] leading-[1.1] text-foreground">Supported formats</h3>
|
|
62
|
+
<p className="m-0 text-[15px] leading-relaxed text-foreground-soft">
|
|
63
|
+
Upload photos and videos straight from your camera or phone, in the formats they already use.
|
|
64
|
+
</p>
|
|
65
|
+
<Collapsible>
|
|
66
|
+
<CollapsibleTrigger showIcon={false} render={<Button variant="secondary" size="sm" />}>
|
|
67
|
+
View all formats
|
|
68
|
+
<ChevronsUpDownIcon />
|
|
69
|
+
</CollapsibleTrigger>
|
|
70
|
+
<CollapsiblePanel>
|
|
71
|
+
<ul className="m-0 flex flex-col gap-2 pt-3 pl-5 text-[15px] text-foreground-soft">
|
|
72
|
+
<li>JPEG and HEIC</li>
|
|
73
|
+
<li>PNG and WebP</li>
|
|
74
|
+
<li>RAW: DNG, CR3, NEF and ARW</li>
|
|
75
|
+
<li>MP4 and MOV video</li>
|
|
76
|
+
</ul>
|
|
77
|
+
</CollapsiblePanel>
|
|
78
|
+
</Collapsible>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Disabled
|
|
85
|
+
|
|
86
|
+
Dimmed, shut and out of the tab order; say nearby why.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@zonsh/ui";
|
|
90
|
+
|
|
91
|
+
export function Disabled() {
|
|
92
|
+
return (
|
|
93
|
+
<div className="flex w-full max-w-xl flex-col gap-4">
|
|
94
|
+
<h3 className="m-0 display text-28 leading-[1.1] text-foreground">Shared with you</h3>
|
|
95
|
+
<p className="m-0 text-15 leading-relaxed text-foreground-soft">
|
|
96
|
+
Ines shared this notebook with you to read. Its edit history is visible to editors only.
|
|
97
|
+
</p>
|
|
98
|
+
<Collapsible disabled>
|
|
99
|
+
<CollapsibleTrigger>Edit history</CollapsibleTrigger>
|
|
100
|
+
<CollapsiblePanel>
|
|
101
|
+
<p className="m-0 pt-3 text-15 leading-relaxed text-foreground-soft">No edits yet.</p>
|
|
102
|
+
</CollapsiblePanel>
|
|
103
|
+
</Collapsible>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Props
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default |
|
|
112
|
+
| --------------------------------------------------- | -------------- | ------- |
|
|
113
|
+
| `Collapsible.defaultOpen` | `boolean` | `false` |
|
|
114
|
+
| `Collapsible.open` / `onOpenChange` | controlled | — |
|
|
115
|
+
| `Collapsible.disabled` | `boolean` | `false` |
|
|
116
|
+
| `CollapsibleTrigger.showIcon` | `boolean` | `true` |
|
|
117
|
+
| `CollapsibleTrigger.render` | `ReactElement` | — |
|
|
118
|
+
| `CollapsiblePanel.keepMounted` / `hiddenUntilFound` | `boolean` | `false` |
|
|
119
|
+
|
|
120
|
+
Data attributes: `data-panel-open` on the trigger, `data-open` / `data-closed` on the root and panel.
|
|
121
|
+
|
|
122
|
+
## Brand rules
|
|
123
|
+
|
|
124
|
+
- **Do** label the trigger with what it reveals, not "More".
|
|
125
|
+
- **Do** put the space between trigger and content inside the panel (`pt-3` on its content), not as a `gap` on the root, so the panel grows from zero and nothing else moves.
|
|
126
|
+
- **Don't** box the panel; the content continues the page.
|
|
127
|
+
- **Don't** nest collapsibles more than one level deep.
|
|
128
|
+
|
|
129
|
+
## Accessibility
|
|
130
|
+
|
|
131
|
+
- The trigger is a `<button>` with `aria-expanded` and `aria-controls`.
|
|
132
|
+
- Set `hiddenUntilFound` so the browser's find-in-page can open the panel.
|
|
133
|
+
- The chevron is decorative (`aria-hidden`).
|
|
134
|
+
|
|
135
|
+
### Keyboard
|
|
136
|
+
|
|
137
|
+
| Key | What it does |
|
|
138
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
139
|
+
| Enter / Space | Opens or closes the panel from the trigger |
|
|
140
|
+
| Tab | Moves from the trigger into the open panel; a closed panel is skipped |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
- Import: `import { Collapsible, CollapsibleTrigger, CollapsiblePanel } from "@zonsh/ui"`
|
|
145
|
+
- Source: `packages/ui/src/components/collapsible.tsx`
|
|
146
|
+
- Primitive: `@base-ui/react/collapsible` (Base UI docs: `node_modules/@base-ui/react/docs/react/components/collapsible.md`)
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Color Picker
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { ColorPicker, Field, FieldDescription, FieldLabel } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
export function Basic() {
|
|
7
|
+
return (
|
|
8
|
+
<Field className="w-full max-w-60">
|
|
9
|
+
<FieldLabel>Label colour</FieldLabel>
|
|
10
|
+
<ColorPicker defaultValue="#3f7fd9" name="label-colour" />
|
|
11
|
+
<FieldDescription>Shown on the “Needs review” label in the issue list.</FieldDescription>
|
|
12
|
+
</Field>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A recessed, `Select`-like trigger with a swatch and the value in mono. It opens the panel people know from design tools: a saturation × brightness area at the colour's hue, a hue slider, an optional opacity slider, the value as text and optional presets. The panel holds hue, saturation and brightness while you pick, so a grey keeps its hue: drag to a corner and back and your colour is still there. The value is written in `format` — hex, or `rgb()`, `hsl()`, `oklch()` for theme work. Everything around the colour stays grey.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { ColorPicker, Field, FieldLabel } from "@zonsh/ui";
|
|
23
|
+
|
|
24
|
+
<Field>
|
|
25
|
+
<FieldLabel>Label colour</FieldLabel>
|
|
26
|
+
<ColorPicker defaultValue="#3f7fd9" name="label-colour" />
|
|
27
|
+
</Field>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The props you'll reach for: `value` / `onValueChange`, `format`, `presets`.
|
|
31
|
+
|
|
32
|
+
## When to use
|
|
33
|
+
|
|
34
|
+
- People choosing their own colour: a label, a calendar, a highlight, a brand colour, a chart series.
|
|
35
|
+
- `presets` when most people want one of a few named colours.
|
|
36
|
+
- `ColorPickerPanel` where the picker is the task: a theme panel, an inspector.
|
|
37
|
+
- For a few fixed colours that mean something, use a `RadioGroup` or `ToggleGroup` with names, not a picker.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Presets
|
|
42
|
+
|
|
43
|
+
The current preset carries a tick and `aria-pressed`; each is named by its `label`. A preset that repeats an earlier colour (`#fff` after `rgb(255 255 255)`, or a translucent one without `alpha`) is left out.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { ColorPicker, Field, FieldDescription, FieldLabel } from "@zonsh/ui";
|
|
47
|
+
import * as React from "react";
|
|
48
|
+
|
|
49
|
+
const calendarColours = [
|
|
50
|
+
{ value: "#d64545", label: "Tomato" },
|
|
51
|
+
{ value: "#e08a2c", label: "Tangerine" },
|
|
52
|
+
{ value: "#c9a62a", label: "Mustard" },
|
|
53
|
+
{ value: "#3f9b57", label: "Basil" },
|
|
54
|
+
{ value: "#2f9aa0", label: "Peacock" },
|
|
55
|
+
{ value: "#3f7fd9", label: "Blueberry" },
|
|
56
|
+
{ value: "#7a5bd1", label: "Lavender" },
|
|
57
|
+
{ value: "#c2468f", label: "Orchid" },
|
|
58
|
+
{ value: "#6b6b6b", label: "Graphite" },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export function Presets() {
|
|
62
|
+
const [colour, setColour] = React.useState("#3f9b57");
|
|
63
|
+
const name = calendarColours.find((c) => c.value === colour)?.label;
|
|
64
|
+
return (
|
|
65
|
+
<Field className="w-full max-w-60">
|
|
66
|
+
<FieldLabel>Calendar colour</FieldLabel>
|
|
67
|
+
<ColorPicker value={colour} onValueChange={setColour} presets={calendarColours} />
|
|
68
|
+
<FieldDescription>
|
|
69
|
+
{name ? `${name} — ` : ""}Events in “Allotment” take this colour in the week view.
|
|
70
|
+
</FieldDescription>
|
|
71
|
+
</Field>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### OKLCH and opacity
|
|
77
|
+
|
|
78
|
+
`format="oklch"` writes `oklch(0.85 0.16 95 / 60%)`; `alpha` adds an opacity slider. The text field accepts any of the four syntaxes and writes back in `format`. An `oklch()` colour outside sRGB loses chroma until it fits, keeping lightness and hue.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { ColorPicker, Field, FieldDescription, FieldLabel } from "@zonsh/ui";
|
|
82
|
+
|
|
83
|
+
export function OklchWithAlpha() {
|
|
84
|
+
return (
|
|
85
|
+
<Field className="w-full max-w-72">
|
|
86
|
+
<FieldLabel>Highlight</FieldLabel>
|
|
87
|
+
<ColorPicker format="oklch" alpha defaultValue="oklch(0.85 0.16 95 / 60%)" />
|
|
88
|
+
<FieldDescription>Marks the passages readers saved, over the page’s own text.</FieldDescription>
|
|
89
|
+
</Field>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Inline panel
|
|
95
|
+
|
|
96
|
+
`ColorPickerPanel` is the same panel without the popover.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { ColorPickerPanel, ColorSwatch } from "@zonsh/ui";
|
|
100
|
+
import * as React from "react";
|
|
101
|
+
|
|
102
|
+
export function Panel() {
|
|
103
|
+
const [colour, setColour] = React.useState("oklch(0.62 0.17 152)");
|
|
104
|
+
return (
|
|
105
|
+
<div className="flex w-full max-w-sm flex-col gap-4">
|
|
106
|
+
<div className="flex items-center gap-3 border-b border-border/60 pb-3">
|
|
107
|
+
<ColorSwatch color={colour} className="size-5" />
|
|
108
|
+
<span className="text-sm font-medium">Chart series: Returning customers</span>
|
|
109
|
+
</div>
|
|
110
|
+
<ColorPickerPanel format="oklch" value={colour} onValueChange={setColour} />
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### States
|
|
117
|
+
|
|
118
|
+
`invalid` (or a failed `required`) gives the trigger its red edge, with a `FieldError`; `disabled` keeps it shut, out of the tab order, and submits nothing.
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { ColorPicker, Field, FieldDescription, FieldError, FieldLabel } from "@zonsh/ui";
|
|
122
|
+
|
|
123
|
+
export function States() {
|
|
124
|
+
return (
|
|
125
|
+
<div className="flex w-full max-w-60 flex-col gap-4">
|
|
126
|
+
<Field invalid>
|
|
127
|
+
<FieldLabel>Team colour</FieldLabel>
|
|
128
|
+
<ColorPicker required />
|
|
129
|
+
<FieldError match>Pick a colour for the team’s avatar.</FieldError>
|
|
130
|
+
</Field>
|
|
131
|
+
<Field disabled>
|
|
132
|
+
<FieldLabel>Brand colour</FieldLabel>
|
|
133
|
+
<ColorPicker defaultValue="#2f9aa0" />
|
|
134
|
+
<FieldDescription>Set by your organisation’s brand settings.</FieldDescription>
|
|
135
|
+
</Field>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Props
|
|
142
|
+
|
|
143
|
+
| Prop | Type | Default |
|
|
144
|
+
| --------------------------------------- | ------------------------------------------------------------ | ----------------- |
|
|
145
|
+
| `value` | `string` — hex, `rgb()`, `hsl()` or `oklch()` | — (uncontrolled) |
|
|
146
|
+
| `defaultValue` | `string` | `""` |
|
|
147
|
+
| `onValueChange` | `(value: string) => void` — on every step of a drag | — |
|
|
148
|
+
| `format` | `"hex" \| "rgb" \| "hsl" \| "oklch"` | `"hex"` |
|
|
149
|
+
| `alpha` | `boolean` — an opacity slider | `false` |
|
|
150
|
+
| `presets` | `(string \| { value: string; label: string })[]` | — |
|
|
151
|
+
| `labels` | `Partial<ColorPickerMessages> & { input? }` | English |
|
|
152
|
+
| `disabled` | `boolean` | `false` |
|
|
153
|
+
| `size` | `"sm" \| "default"` (ColorPicker) | `"default"` |
|
|
154
|
+
| `name` | `string` — submits the value in a hidden input (ColorPicker) | the `Field`'s |
|
|
155
|
+
| `required` | `boolean` — a colour must be picked (ColorPicker) | `false` |
|
|
156
|
+
| `placeholder` | `string` — shown while empty (ColorPicker) | `"Pick a colour"` |
|
|
157
|
+
| `open` / `defaultOpen` / `onOpenChange` | controlled or initial open state (ColorPicker) | — |
|
|
158
|
+
| `popover` | `PopoverContent` props: `side`, `align`, `className` … | `align: "start"` |
|
|
159
|
+
|
|
160
|
+
On `ColorPicker`, `className`, `id` and `aria-*` go to the trigger, a Field control. `Form` and `Field` validation get the value. `required` makes an empty picker `valueMissing` like a native input (the form won't submit, `FieldError match="valueMissing"` shows, focus goes to the trigger); with `validationMode="onBlur"` it validates when focus leaves both trigger and popover. Disabled, it submits nothing and isn't validated; a form reset restores `defaultValue`. The panel rereads the value only when it changes from outside. `ColorPickerPanel` forwards `<div>` props. Parts carry `data-slot`: `color-picker-trigger`, `color-picker-value`, `color-picker-content` (the popover), `color-picker-panel`, `color-picker-area`, `color-picker-area-thumb`, `color-picker-hue`, `color-picker-alpha`, `color-picker-input`, `color-picker-presets`, `color-picker-preset` (with `data-current` on the current one), `color-swatch` and, inside it, `color-swatch-fill` (the colour over the checkerboard). `ColorSwatch` takes a CSS `color` and `<span>` props: a 16px square with 5px corners over a checkerboard, `aria-hidden`.
|
|
161
|
+
|
|
162
|
+
A `LocaleProvider` sets the same words for every picker (`messages.colorPicker`: `area`, `areaRole`, `areaValue`, `hue`, `alpha`, `value` by format, `presets`, `placeholder`).
|
|
163
|
+
|
|
164
|
+
## Brand rules
|
|
165
|
+
|
|
166
|
+
- **Do** label the picker with what the colour is for: "Label colour", not "Colour".
|
|
167
|
+
- **Do** give presets names people would say: "Basil", "Graphite".
|
|
168
|
+
- **Do** keep the chrome monochrome; the colour belongs in the swatch, area, sliders and presets.
|
|
169
|
+
- **Don't** use a picker to choose a status or a category; those colours are fixed tokens with a meaning.
|
|
170
|
+
- **Don't** put an "Apply" button in the popover; the colour changes as it is picked.
|
|
171
|
+
|
|
172
|
+
## Accessibility
|
|
173
|
+
|
|
174
|
+
- The area's thumb is one `role="slider"` named "Saturation and brightness" (`aria-roledescription="2D slider"`), its value text "Saturation 80%, brightness 96%". A press in the area moves, focuses and drags it.
|
|
175
|
+
- The hue and opacity sliders are `Slider`s, named "Hue" and "Opacity"; the text field is named by its format ("Hex value"). Rename them with `labels`.
|
|
176
|
+
- A value that cannot be read marks the text field `aria-invalid` and keeps the last good colour.
|
|
177
|
+
- In forced colours, the area, tracks, presets and swatch keep their colours.
|
|
178
|
+
- The trigger is a button, which can't carry `aria-required`: with `required`, say so in the label or description. The form's hidden input is hidden from assistive tech.
|
|
179
|
+
- Presets are named buttons with `aria-pressed`. The trigger's swatch is decorative; its name is the label and the value ("Label colour #3f7fd9").
|
|
180
|
+
|
|
181
|
+
### Keyboard
|
|
182
|
+
|
|
183
|
+
| Key | What it does |
|
|
184
|
+
| ------------------- | ------------------------------------------------------------------------------------ |
|
|
185
|
+
| Enter / Space | Opens the popover, on the trigger |
|
|
186
|
+
| Tab | Moves through the area, the hue and opacity sliders, the text field and the presets |
|
|
187
|
+
| ← / → | Steps saturation by 1% on the area, the hue by 1° and opacity by 1% on their sliders |
|
|
188
|
+
| ↑ / ↓ | Steps brightness by 1% on the area, and the sliders like ← / → |
|
|
189
|
+
| Shift+arrow | Steps by 10% on the area, by 10° on the hue and by 10% on opacity |
|
|
190
|
+
| Page Up / Page Down | Steps brightness by 10% on the area, the hue by 10° and opacity by 10% |
|
|
191
|
+
| Home / End | Takes saturation to 0% or 100% on the area, and a slider to its ends |
|
|
192
|
+
| Enter | Puts the typed value in, from the text field, without submitting the form |
|
|
193
|
+
| Escape | Puts the value back in the text field; otherwise closes the popover |
|
|
194
|
+
|
|
195
|
+
The area and sliders run left to right in either direction, so the arrows never swap. An IME's Enter only picks its characters.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
- Import: `import { ColorPicker, ColorPickerPanel, ColorSwatch } from "@zonsh/ui"`
|
|
200
|
+
- Source: `packages/ui/src/components/color-picker.tsx`
|