@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,172 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Slider } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
export function Basic() {
|
|
7
|
+
return (
|
|
8
|
+
<div className="w-full max-w-sm">
|
|
9
|
+
<Slider label="Hours spent on manual data entry each week" showValue defaultValue={12} max={40} />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
A recessed 6px track with a `--foreground-soft` fill and raised 18px thumbs that stop at the track's ends (a clipping box never cuts them). The value label is tabular Licht Mono.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Slider } from "@zonsh/ui";
|
|
21
|
+
|
|
22
|
+
<Slider label="Hours spent on manual data entry each week" showValue defaultValue={12} max={40} />;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `defaultValue` — a number, or an array for a range.
|
|
26
|
+
- `label` / `showValue` — the label and the value beside it.
|
|
27
|
+
- `min` / `max` / `step` — the range and snapping.
|
|
28
|
+
|
|
29
|
+
## When to use
|
|
30
|
+
|
|
31
|
+
- When the rough position matters more than the number (an estimate, a zoom level); exact values are a `NumberField`.
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Range
|
|
36
|
+
|
|
37
|
+
One thumb per value; `format` for currency and units.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Slider } from "@zonsh/ui";
|
|
41
|
+
|
|
42
|
+
export function Range() {
|
|
43
|
+
return (
|
|
44
|
+
<div className="w-full max-w-sm">
|
|
45
|
+
<Slider
|
|
46
|
+
label="Budget range"
|
|
47
|
+
showValue
|
|
48
|
+
defaultValue={[20000, 60000]}
|
|
49
|
+
min={5000}
|
|
50
|
+
max={150000}
|
|
51
|
+
step={5000}
|
|
52
|
+
format={{ style: "currency", currency: "EUR", maximumFractionDigits: 0 }}
|
|
53
|
+
thumbLabels={["Minimum budget", "Maximum budget"]}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Steps
|
|
61
|
+
|
|
62
|
+
`largeStep` is the Page Up/Down and Shift+arrow jump.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { Slider } from "@zonsh/ui";
|
|
66
|
+
|
|
67
|
+
export function Steps() {
|
|
68
|
+
return (
|
|
69
|
+
<div className="w-full max-w-sm">
|
|
70
|
+
<Slider
|
|
71
|
+
label="People who will use it"
|
|
72
|
+
showValue
|
|
73
|
+
defaultValue={25}
|
|
74
|
+
min={5}
|
|
75
|
+
max={200}
|
|
76
|
+
step={5}
|
|
77
|
+
largeStep={25}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Without label
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { Slider } from "@zonsh/ui";
|
|
88
|
+
|
|
89
|
+
export function WithoutLabel() {
|
|
90
|
+
return (
|
|
91
|
+
<div className="w-full max-w-xs">
|
|
92
|
+
<Slider defaultValue={60} thumbLabels={["Preview zoom"]} />
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Squash
|
|
99
|
+
|
|
100
|
+
A held thumb squashes with its speed and wobbles back round on release (not on keyboard steps or under reduced motion). For playful products, not dense forms.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import { Slider } from "@zonsh/ui";
|
|
104
|
+
|
|
105
|
+
export function Squash() {
|
|
106
|
+
return (
|
|
107
|
+
<div className="w-full max-w-sm">
|
|
108
|
+
<Slider label="Playback volume" showValue defaultValue={65} squash />
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Disabled
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { Slider } from "@zonsh/ui";
|
|
118
|
+
|
|
119
|
+
export function Disabled() {
|
|
120
|
+
return (
|
|
121
|
+
<div className="w-full max-w-sm">
|
|
122
|
+
<Slider label="Retry attempts" showValue defaultValue={3} max={10} disabled />
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Props
|
|
129
|
+
|
|
130
|
+
| Prop | Type | Default |
|
|
131
|
+
| ---------------- | -------------------------------------------------------------------------------------------- | -------------- |
|
|
132
|
+
| `label` | `ReactNode`: visible label, associated with the thumbs | — |
|
|
133
|
+
| `showValue` | `boolean`: mono value (or "min – max") beside the label | `false` |
|
|
134
|
+
| `thumbLabels` | `string[]`: `aria-label` per thumb | — |
|
|
135
|
+
| `squash` | `boolean`: a dragged thumb squashes and stretches | `false` |
|
|
136
|
+
| `value` | `number \| number[]` | — |
|
|
137
|
+
| `defaultValue` | `number \| number[]` | — |
|
|
138
|
+
| `min` / `max` | `number` | `0` / `100` |
|
|
139
|
+
| `step` | `number` | `1` |
|
|
140
|
+
| `format` | `Intl.NumberFormatOptions` | — |
|
|
141
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |
|
|
142
|
+
| `thumbAlignment` | `"edge" \| "center"`: at min and max, a thumb stops at the track's end or hangs half past it | `"edge"` |
|
|
143
|
+
|
|
144
|
+
Forwarded: `onValueChange`, `onValueCommitted`, `name`, `disabled`, `largeStep`, `minStepsBetweenValues`, `thumbCollisionBehavior`. Children render in the track. `data-dragging`, `data-disabled`, `data-orientation`.
|
|
145
|
+
|
|
146
|
+
## Brand rules
|
|
147
|
+
|
|
148
|
+
- **Do** show the value when the number matters.
|
|
149
|
+
- **Don't** colour the indicator: a value is not a status.
|
|
150
|
+
- **Don't** enlarge or glow the thumb while dragging.
|
|
151
|
+
|
|
152
|
+
## Accessibility
|
|
153
|
+
|
|
154
|
+
- Each thumb is a native `input[type=range]`; without a visible label, or in a range, give each a `thumbLabels` entry.
|
|
155
|
+
- On touch, a press anywhere on the control (16px taller than the track) drags the nearest thumb; it doesn't scroll the page (`touch-action: none`), so leave room to scroll by.
|
|
156
|
+
- The label focuses a single thumb; focus is a flush 2px `--control-focus` outline.
|
|
157
|
+
|
|
158
|
+
### Keyboard
|
|
159
|
+
|
|
160
|
+
| Key | What it does |
|
|
161
|
+
| -------------------------------- | ----------------------------------------------------------------------- |
|
|
162
|
+
| → / ↑ | Raises the value by `step` (← and → swapped right to left) |
|
|
163
|
+
| ← / ↓ | Lowers the value by `step` |
|
|
164
|
+
| Shift+arrow, Page Up / Page Down | Raises or lowers it by `largeStep` (10 by default) |
|
|
165
|
+
| Home / End | Sets it to `min` or `max`; in a range, as far as the other thumb allows |
|
|
166
|
+
| Tab | Moves to the next thumb: each one is its own Tab stop |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
- Import: `import { Slider } from "@zonsh/ui"`
|
|
171
|
+
- Source: `packages/ui/src/components/slider.tsx`
|
|
172
|
+
- Primitive: `@base-ui/react/slider` (Base UI docs: `node_modules/@base-ui/react/docs/react/components/slider.md`)
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Sortable
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { cn, Item, ItemActions, ItemContent, ItemDescription, ItemTitle, Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
/* The lessons of a fictional evening course on bread baking. */
|
|
8
|
+
const lessons: Record<string, { title: string; summary: string; minutes: number }> = {
|
|
9
|
+
starter: { title: "Feeding a starter", summary: "Flour, water and a warm shelf", minutes: 18 },
|
|
10
|
+
mix: { title: "Mixing and autolyse", summary: "Why the dough rests before the salt", minutes: 24 },
|
|
11
|
+
fold: { title: "Stretch and fold", summary: "Four sets, thirty minutes apart", minutes: 21 },
|
|
12
|
+
shape: { title: "Shaping a boule", summary: "Tension without tearing", minutes: 16 },
|
|
13
|
+
bake: { title: "Baking in a pot", summary: "Lid on, lid off, and when to stop", minutes: 27 },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function Basic() {
|
|
17
|
+
const [order, setOrder] = React.useState(["starter", "mix", "fold", "shape", "bake"]);
|
|
18
|
+
return (
|
|
19
|
+
<Sortable value={order} onValueChange={setOrder} className="w-full max-w-md">
|
|
20
|
+
<SortableList label="Lessons" className="m-0 flex list-none flex-col gap-2 p-0">
|
|
21
|
+
{order.map((id, index) => (
|
|
22
|
+
<SortableItem key={id} value={id} label={lessons[id]!.title} className="group/lesson">
|
|
23
|
+
<Item
|
|
24
|
+
variant="raised"
|
|
25
|
+
size="sm"
|
|
26
|
+
className={cn(
|
|
27
|
+
"ps-1.5 transition-[box-shadow,translate] duration-[var(--duration-fade),var(--duration)] ease-(--ease)",
|
|
28
|
+
// Lifted with the keyboard, and as the copy under the pointer: off the page.
|
|
29
|
+
"group-data-lifted/lesson:-translate-y-0.5 group-data-lifted/lesson:shadow-overlay",
|
|
30
|
+
"group-data-sortable-overlay/lesson:shadow-overlay",
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<SortableHandle />
|
|
34
|
+
<span className="w-5 font-mono text-[12px] text-muted-foreground tabular-nums">
|
|
35
|
+
{String(index + 1).padStart(2, "0")}
|
|
36
|
+
</span>
|
|
37
|
+
<ItemContent>
|
|
38
|
+
<ItemTitle>{lessons[id]!.title}</ItemTitle>
|
|
39
|
+
<ItemDescription>{lessons[id]!.summary}</ItemDescription>
|
|
40
|
+
</ItemContent>
|
|
41
|
+
<ItemActions>
|
|
42
|
+
<span className="font-mono text-[12px] text-muted-foreground tabular-nums">
|
|
43
|
+
{lessons[id]!.minutes} min
|
|
44
|
+
</span>
|
|
45
|
+
</ItemActions>
|
|
46
|
+
</Item>
|
|
47
|
+
</SortableItem>
|
|
48
|
+
))}
|
|
49
|
+
</SortableList>
|
|
50
|
+
</Sortable>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A list people put in their own order. Drag an item, or its handle: a mouse drag starts after a few pixels (a click stays a click), touch after a long press (a swipe still scrolls; the handle drags at once). A lifted copy follows the pointer while the others slide aside to open a gap where it will land; near an edge it autoscrolls. From the keyboard, Space on a handle picks up, the arrows move, Space drops, Escape puts back, each step read out. The items are yours; no drag-and-drop library, slides 150ms on `--ease`.
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
61
|
+
|
|
62
|
+
const [order, setOrder] = React.useState(["starter", "mix", "fold"]);
|
|
63
|
+
|
|
64
|
+
<Sortable value={order} onValueChange={setOrder}>
|
|
65
|
+
<SortableList label="Lessons" className="flex flex-col gap-2">
|
|
66
|
+
{order.map((id) => (
|
|
67
|
+
<SortableItem key={id} value={id} label={lessons[id].title}>
|
|
68
|
+
<SortableHandle />
|
|
69
|
+
{lessons[id].title}
|
|
70
|
+
</SortableItem>
|
|
71
|
+
))}
|
|
72
|
+
</SortableList>
|
|
73
|
+
</Sortable>;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Render items in the order of `value`; Sortable never moves your elements itself.
|
|
77
|
+
|
|
78
|
+
- `value` / `onValueChange` — the ids, and the new order on every step.
|
|
79
|
+
- `SortableItem.label` — its name in announcements.
|
|
80
|
+
- `onMoveEnd` — once an item is put down: save there.
|
|
81
|
+
|
|
82
|
+
## When to use
|
|
83
|
+
|
|
84
|
+
- An order people choose: a course's lessons, a queue's priority; or lists items move between (the Kanban block).
|
|
85
|
+
- Not for sorting by a value: sort a Data Table column.
|
|
86
|
+
- In a long list, add a "Move to" menu with `useSortable().move`.
|
|
87
|
+
|
|
88
|
+
## Examples
|
|
89
|
+
|
|
90
|
+
### In a row
|
|
91
|
+
|
|
92
|
+
Left and Right move items (mirrored right to left); a handle without children turns its grip.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
96
|
+
import { CalendarIcon, FileTextIcon, InboxIcon, SearchIcon, StarIcon } from "lucide-react";
|
|
97
|
+
import * as React from "react";
|
|
98
|
+
|
|
99
|
+
/* The shortcuts on the start screen of a notes app. */
|
|
100
|
+
const shortcuts: Record<string, { label: string; icon: React.ReactNode }> = {
|
|
101
|
+
inbox: { label: "Inbox", icon: <InboxIcon /> },
|
|
102
|
+
today: { label: "Today", icon: <CalendarIcon /> },
|
|
103
|
+
starred: { label: "Starred", icon: <StarIcon /> },
|
|
104
|
+
search: { label: "Search", icon: <SearchIcon /> },
|
|
105
|
+
drafts: { label: "Drafts", icon: <FileTextIcon /> },
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export function Horizontal() {
|
|
109
|
+
const [order, setOrder] = React.useState(["inbox", "today", "starred", "search", "drafts"]);
|
|
110
|
+
return (
|
|
111
|
+
<Sortable value={order} onValueChange={setOrder} className="@container w-full max-w-2xl">
|
|
112
|
+
<SortableList
|
|
113
|
+
orientation="horizontal"
|
|
114
|
+
label="Start screen shortcuts"
|
|
115
|
+
className="m-0 flex list-none gap-2 overflow-x-auto p-1"
|
|
116
|
+
>
|
|
117
|
+
{order.map((id) => (
|
|
118
|
+
<SortableItem key={id} value={id} label={shortcuts[id]!.label} className="shrink-0">
|
|
119
|
+
<div className="flex w-28 flex-col items-start gap-3 surface-card [--card-padding:10px]">
|
|
120
|
+
<SortableHandle className="-ms-1 -mt-1" />
|
|
121
|
+
<span aria-hidden className="flex text-foreground-soft [&_svg]:size-5">
|
|
122
|
+
{shortcuts[id]!.icon}
|
|
123
|
+
</span>
|
|
124
|
+
<span className="text-[13px] font-medium text-foreground">{shortcuts[id]!.label}</span>
|
|
125
|
+
</div>
|
|
126
|
+
</SortableItem>
|
|
127
|
+
))}
|
|
128
|
+
</SortableList>
|
|
129
|
+
</Sortable>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### In a grid
|
|
135
|
+
|
|
136
|
+
For items in rows that wrap. A dragged item takes the slot under the pointer and the rest shift in reading order. Left and Right move by one, Up and Down by a row. Wrapping items move as a grid whatever the `orientation`; `grid` keeps grid keys at one row. Give the items one size. The handle's grip is a square of dots.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { cn, Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
140
|
+
import { CalendarIcon, ChartLineIcon, CheckSquareIcon, FileTextIcon, FolderIcon, InboxIcon, MessageSquareIcon, StarIcon, UsersIcon } from "lucide-react";
|
|
141
|
+
import * as React from "react";
|
|
142
|
+
|
|
143
|
+
/* The panels on a team's home page, in the order they are shown. */
|
|
144
|
+
const panels: Record<string, { title: string; summary: string; icon: React.ReactNode }> = {
|
|
145
|
+
inbox: { title: "Inbox", summary: "Messages waiting for a reply", icon: <InboxIcon /> },
|
|
146
|
+
calendar: { title: "Calendar", summary: "Today and the next two days", icon: <CalendarIcon /> },
|
|
147
|
+
tasks: { title: "Tasks", summary: "Assigned to you", icon: <CheckSquareIcon /> },
|
|
148
|
+
docs: { title: "Documents", summary: "Opened this week", icon: <FileTextIcon /> },
|
|
149
|
+
chat: { title: "Discussions", summary: "Threads you follow", icon: <MessageSquareIcon /> },
|
|
150
|
+
people: { title: "People", summary: "Who is in today", icon: <UsersIcon /> },
|
|
151
|
+
files: { title: "Files", summary: "Shared with the team", icon: <FolderIcon /> },
|
|
152
|
+
metrics: { title: "Metrics", summary: "The numbers you pinned", icon: <ChartLineIcon /> },
|
|
153
|
+
starred: { title: "Starred", summary: "Anything you marked", icon: <StarIcon /> },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export function Grid() {
|
|
157
|
+
const [order, setOrder] = React.useState(Object.keys(panels));
|
|
158
|
+
return (
|
|
159
|
+
<Sortable value={order} onValueChange={setOrder} className="@container w-full max-w-2xl">
|
|
160
|
+
<SortableList
|
|
161
|
+
orientation="grid"
|
|
162
|
+
label="Home page panels"
|
|
163
|
+
className="m-0 grid list-none grid-cols-2 gap-3 p-0 @lg:grid-cols-3"
|
|
164
|
+
>
|
|
165
|
+
{order.map((id, index) => (
|
|
166
|
+
<SortableItem key={id} value={id} label={panels[id]!.title} className="group/panel">
|
|
167
|
+
<div
|
|
168
|
+
className={cn(
|
|
169
|
+
"flex h-full flex-col gap-3 surface-card [--card-padding:12px]",
|
|
170
|
+
"transition-[box-shadow,translate] duration-[var(--duration-fade),var(--duration)] ease-(--ease)",
|
|
171
|
+
"group-data-lifted/panel:-translate-y-0.5 group-data-lifted/panel:shadow-overlay",
|
|
172
|
+
"group-data-sortable-overlay/panel:shadow-overlay",
|
|
173
|
+
)}
|
|
174
|
+
>
|
|
175
|
+
<div className="-ms-1 -me-1 -mt-1 flex items-center justify-between">
|
|
176
|
+
<SortableHandle />
|
|
177
|
+
<span className="font-mono text-[12px] text-muted-foreground tabular-nums">
|
|
178
|
+
{String(index + 1).padStart(2, "0")}
|
|
179
|
+
</span>
|
|
180
|
+
</div>
|
|
181
|
+
<span aria-hidden className="flex text-foreground-soft [&_svg]:size-5">
|
|
182
|
+
{panels[id]!.icon}
|
|
183
|
+
</span>
|
|
184
|
+
<div className="flex flex-col gap-0.5">
|
|
185
|
+
<span className="text-[13px] font-medium text-foreground">{panels[id]!.title}</span>
|
|
186
|
+
<span className="text-[12px] text-muted-foreground">{panels[id]!.summary}</span>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</SortableItem>
|
|
190
|
+
))}
|
|
191
|
+
</SortableList>
|
|
192
|
+
</Sortable>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Between lists
|
|
198
|
+
|
|
199
|
+
A `value` of `{ [listId]: ids }`, one `SortableList id` per key. Items cross by pointer and by ArrowLeft / ArrowRight (see Keyboard). An empty list takes a drop at its top. Over a list of another width, the copy takes that width.
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
import { Item, ItemActions, ItemContent, ItemTitle, Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
203
|
+
import * as React from "react";
|
|
204
|
+
|
|
205
|
+
/* A week's dinners, picked from a list of recipes saved for later. */
|
|
206
|
+
const recipes: Record<string, { title: string; time: string }> = {
|
|
207
|
+
dal: { title: "Red lentil dal", time: "35 min" },
|
|
208
|
+
risotto: { title: "Mushroom risotto", time: "45 min" },
|
|
209
|
+
tacos: { title: "Black bean tacos", time: "25 min" },
|
|
210
|
+
soup: { title: "Leek and potato soup", time: "40 min" },
|
|
211
|
+
gnocchi: { title: "Gnocchi with sage butter", time: "20 min" },
|
|
212
|
+
curry: { title: "Chickpea curry", time: "30 min" },
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
type Plan = { week: string[]; ideas: string[] };
|
|
216
|
+
|
|
217
|
+
export function Lists() {
|
|
218
|
+
const [plan, setPlan] = React.useState<Plan>({
|
|
219
|
+
week: ["dal", "tacos"],
|
|
220
|
+
ideas: ["risotto", "soup", "gnocchi", "curry"],
|
|
221
|
+
});
|
|
222
|
+
const columns = [
|
|
223
|
+
{ id: "week", label: "This week" },
|
|
224
|
+
{ id: "ideas", label: "Saved recipes" },
|
|
225
|
+
] as const;
|
|
226
|
+
return (
|
|
227
|
+
// The week is the wider column: over the saved recipes, a dragged dinner narrows to fit them.
|
|
228
|
+
<Sortable
|
|
229
|
+
value={plan}
|
|
230
|
+
onValueChange={setPlan}
|
|
231
|
+
className="grid w-full max-w-2xl gap-6 @lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]"
|
|
232
|
+
>
|
|
233
|
+
{columns.map((column) => (
|
|
234
|
+
<section key={column.id} aria-labelledby={`plan-${column.id}`} className="flex flex-col gap-3">
|
|
235
|
+
<h3
|
|
236
|
+
id={`plan-${column.id}`}
|
|
237
|
+
className="m-0 flex items-baseline justify-between border-b border-border/60 pb-2 font-body text-[13px] font-medium text-foreground"
|
|
238
|
+
>
|
|
239
|
+
{column.label}
|
|
240
|
+
<span className="font-mono text-[12px] font-normal text-muted-foreground tabular-nums">
|
|
241
|
+
{plan[column.id].length}
|
|
242
|
+
</span>
|
|
243
|
+
</h3>
|
|
244
|
+
<SortableList
|
|
245
|
+
id={column.id}
|
|
246
|
+
label={column.label}
|
|
247
|
+
aria-labelledby={`plan-${column.id}`}
|
|
248
|
+
className="m-0 flex min-h-24 list-none flex-col gap-2 p-0"
|
|
249
|
+
>
|
|
250
|
+
{plan[column.id].map((id) => (
|
|
251
|
+
<SortableItem key={id} value={id} label={recipes[id]!.title} className="group/recipe">
|
|
252
|
+
<Item
|
|
253
|
+
variant="raised"
|
|
254
|
+
size="sm"
|
|
255
|
+
className="ps-1.5 group-data-lifted/recipe:shadow-overlay group-data-sortable-overlay/recipe:shadow-overlay"
|
|
256
|
+
>
|
|
257
|
+
<SortableHandle />
|
|
258
|
+
<ItemContent>
|
|
259
|
+
<ItemTitle>{recipes[id]!.title}</ItemTitle>
|
|
260
|
+
</ItemContent>
|
|
261
|
+
<ItemActions>
|
|
262
|
+
<span className="font-mono text-[12px] text-muted-foreground tabular-nums">
|
|
263
|
+
{recipes[id]!.time}
|
|
264
|
+
</span>
|
|
265
|
+
</ItemActions>
|
|
266
|
+
</Item>
|
|
267
|
+
</SortableItem>
|
|
268
|
+
))}
|
|
269
|
+
{plan[column.id].length === 0 && (
|
|
270
|
+
<li className="rounded-button border border-dashed border-field-edge px-4 py-5 text-center text-[13px] text-muted-foreground">
|
|
271
|
+
Drag a recipe here
|
|
272
|
+
</li>
|
|
273
|
+
)}
|
|
274
|
+
</SortableList>
|
|
275
|
+
</section>
|
|
276
|
+
))}
|
|
277
|
+
</Sortable>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### From the handle only
|
|
283
|
+
|
|
284
|
+
So the items' text can be selected.
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
import { cn, Sortable, SortableHandle, SortableItem, SortableList } from "@zonsh/ui";
|
|
288
|
+
import { NotebookPenIcon } from "lucide-react";
|
|
289
|
+
import * as React from "react";
|
|
290
|
+
|
|
291
|
+
/* A font stack, in the order the browser tries it. */
|
|
292
|
+
export function HandleOnly() {
|
|
293
|
+
const [stack, setStack] = React.useState(["Licht Sans", "Inter", "system-ui", "Helvetica Neue", "Arial"]);
|
|
294
|
+
// The stack is saved once an item is put down, not on every arrow key while it is held.
|
|
295
|
+
const [saved, setSaved] = React.useState(stack);
|
|
296
|
+
const latest = React.useRef(stack);
|
|
297
|
+
return (
|
|
298
|
+
<div className="flex w-full max-w-md flex-col gap-3">
|
|
299
|
+
<Sortable
|
|
300
|
+
value={stack}
|
|
301
|
+
onValueChange={(next) => {
|
|
302
|
+
latest.current = next;
|
|
303
|
+
setStack(next);
|
|
304
|
+
}}
|
|
305
|
+
onMoveEnd={() => setSaved(latest.current)}
|
|
306
|
+
handleOnly
|
|
307
|
+
>
|
|
308
|
+
<SortableList label="Font stack" className="m-0 flex list-none flex-col p-0">
|
|
309
|
+
{stack.map((font, index) => (
|
|
310
|
+
<SortableItem
|
|
311
|
+
key={font}
|
|
312
|
+
value={font}
|
|
313
|
+
className={cn(
|
|
314
|
+
"flex items-center gap-2 border-b border-border/60 py-1 last:border-b-0",
|
|
315
|
+
"data-lifted:bg-control-hover",
|
|
316
|
+
)}
|
|
317
|
+
>
|
|
318
|
+
<SortableHandle />
|
|
319
|
+
<span className="w-5 font-mono text-[12px] text-muted-foreground tabular-nums">
|
|
320
|
+
{index + 1}
|
|
321
|
+
</span>
|
|
322
|
+
<code className="font-mono text-[13px] text-foreground">{font}</code>
|
|
323
|
+
</SortableItem>
|
|
324
|
+
))}
|
|
325
|
+
</SortableList>
|
|
326
|
+
</Sortable>
|
|
327
|
+
<p className="m-0 flex items-center gap-2 text-[13px] text-muted-foreground">
|
|
328
|
+
<NotebookPenIcon aria-hidden className="size-4 shrink-0" />
|
|
329
|
+
<code className="min-w-0 truncate font-mono text-[12px]">
|
|
330
|
+
font-family: {saved.map((f) => (f.includes(" ") ? `"${f}"` : f)).join(", ")};
|
|
331
|
+
</code>
|
|
332
|
+
</p>
|
|
333
|
+
</div>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Props
|
|
339
|
+
|
|
340
|
+
### Sortable
|
|
341
|
+
|
|
342
|
+
| Prop | Type | Default |
|
|
343
|
+
| --------------- | ----------------------------------------------------------- | ---------------------------- |
|
|
344
|
+
| `value` | `string[]` (one list) or `Record<string, string[]>` (lists) | — |
|
|
345
|
+
| `defaultValue` | the same, uncontrolled | `[]` |
|
|
346
|
+
| `onValueChange` | `(value, { item, from, to, source }) => void` | — |
|
|
347
|
+
| `onMoveEnd` | `({ item, from, to, cancelled }) => void` | — |
|
|
348
|
+
| `overlay` | `(item) => ReactNode` — the copy under the pointer | a copy of the item's element |
|
|
349
|
+
| `handleOnly` | `boolean` | `false` |
|
|
350
|
+
| `labels` | `Partial<SortableMessages>` | English; see Accessibility |
|
|
351
|
+
| `render` | an element to draw instead of the `div` | — |
|
|
352
|
+
|
|
353
|
+
`onValueChange` fires on each arrow key, drop and cancel; `source` is `"pointer"`, `"keyboard"`, `"api"` or `"cancel"`.
|
|
354
|
+
|
|
355
|
+
### SortableList
|
|
356
|
+
|
|
357
|
+
| Prop | Type | Default |
|
|
358
|
+
| ------------- | ---------------------------------------------------------------------------- | ------------ |
|
|
359
|
+
| `id` | `string` — the list's key in a value of several lists | `""` |
|
|
360
|
+
| `orientation` | `"vertical"` \| `"horizontal"` \| `"grid"` | `"vertical"` |
|
|
361
|
+
| `label` | `string` — its name in announcements, and its `aria-label` if it has no name | — |
|
|
362
|
+
| `render` | an element to draw instead of the `<ol>` | — |
|
|
363
|
+
|
|
364
|
+
`data-over` while a dragged item would land in it.
|
|
365
|
+
|
|
366
|
+
### SortableItem, SortableHandle
|
|
367
|
+
|
|
368
|
+
`SortableItem` takes `value`, `label` (defaults to `value`), `disabled` and `render` (instead of the `<li>`); `data-dragging` while its copy is out, `data-lifted` while held from the keyboard. The slides use its `translate`: leave that alone. The copy has `data-sortable-overlay` (`group-data-sortable-overlay/item:shadow-overlay`). `SortableHandle` is a ghost `Button` at `icon-sm`.
|
|
369
|
+
|
|
370
|
+
### Hooks and helpers
|
|
371
|
+
|
|
372
|
+
- `useSortable()` — `{ move(item, { list?, index? }, { focus? }), dragging, lifted }`: `move` places an item (default: the list's end) and announces it; `focus` is a selector to focus after it remounts.
|
|
373
|
+
- `useSortableItem()` — `{ value, label, dragging, lifted, overlay }` inside an item or your `overlay`.
|
|
374
|
+
- `moveSortableItem(value, item, { list?, index })` — the move as a pure function.
|
|
375
|
+
|
|
376
|
+
## Brand rules
|
|
377
|
+
|
|
378
|
+
- **Do** let the gap show where an item lands: no line or placeholder of your own.
|
|
379
|
+
- **Do** give every item a handle (the keyboard's way in) and make items raised rows or cards; the copy takes `shadow-overlay`, nothing heavier.
|
|
380
|
+
- **Don't** make dragging the only way to reach a far place, or take over touch scrolling.
|
|
381
|
+
|
|
382
|
+
## Accessibility
|
|
383
|
+
|
|
384
|
+
- Each handle is a button ("Move Feeding a starter") described by the instructions, `aria-pressed` while held; focus stays on it, even into another list. A click elsewhere drops the item; past the lists' edge, puts it back.
|
|
385
|
+
- Every pickup, move, drop and cancel is announced politely ("Moved to Saved recipes, position 1 of 5."), in words from `labels` or `messages.sortable`.
|
|
386
|
+
- Escape, an interrupted touch or a release 32px past the lists cancels a drag. Unmounting mid-drag cleans up silently.
|
|
387
|
+
- The copy is `aria-hidden` and inert. Under reduced motion nothing slides.
|
|
388
|
+
|
|
389
|
+
### Keyboard
|
|
390
|
+
|
|
391
|
+
| Key | What it does |
|
|
392
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
393
|
+
| Space / Enter | Picks up the item whose handle has the focus; pressed again, drops it |
|
|
394
|
+
| ↑ / ↓ | Moves the held item one place in a list; in a row, to the list before or after; in a grid, to the item above or below, and past the first or last row into the list before or after |
|
|
395
|
+
| ← / → | Moves the held item one place in a row or a grid; in a list, to the list before or after (swapped right to left) |
|
|
396
|
+
| Home / End | Moves the held item to the start or end of its list |
|
|
397
|
+
| Escape | Puts the held item back where it was picked up; also cancels a pointer drag |
|
|
398
|
+
| Tab | Drops the held item where it is, and moves on |
|
|
399
|
+
|
|
400
|
+
Arrows work only while an item is held. In another list an item keeps its position, or goes last.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
- Import: `import { Sortable, SortableList, SortableItem, SortableHandle, useSortable, useSortableItem, moveSortableItem } from "@zonsh/ui"`
|
|
405
|
+
- Source: `packages/ui/src/components/sortable.tsx`
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Sources
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Source, Sources, SourcesContent, SourcesTrigger } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
const sources = [
|
|
7
|
+
{ href: "https://zon.sh/ui/brand", title: "Brand guide — zon/ui" },
|
|
8
|
+
{ href: "https://zon.sh/licht", title: "Licht Serif — a soft serif typeface" },
|
|
9
|
+
{ href: "https://zon.sh/gallery", title: "Gallery — zon" },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export function Basic() {
|
|
13
|
+
return (
|
|
14
|
+
<div className="w-full max-w-xl">
|
|
15
|
+
<Sources defaultOpen>
|
|
16
|
+
<SourcesTrigger count={sources.length} />
|
|
17
|
+
<SourcesContent>
|
|
18
|
+
{sources.map((s) => (
|
|
19
|
+
<Source key={s.href} href={s.href} title={s.title} />
|
|
20
|
+
))}
|
|
21
|
+
</SourcesContent>
|
|
22
|
+
</Sources>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An answer's citations under a mono count; each opens in a new tab.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Source, Sources, SourcesContent, SourcesTrigger } from "@zonsh/ui";
|
|
34
|
+
|
|
35
|
+
<Sources>
|
|
36
|
+
<SourcesTrigger count={sources.length} />
|
|
37
|
+
<SourcesContent>
|
|
38
|
+
{sources.map((s) => (
|
|
39
|
+
<Source key={s.url} href={s.url} title={s.title} />
|
|
40
|
+
))}
|
|
41
|
+
</SourcesContent>
|
|
42
|
+
</Sources>;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- `count` — the n in "Used n sources".
|
|
46
|
+
- `href` / `title` — the link and its title.
|
|
47
|
+
- `defaultOpen` — on `Sources`: open at once.
|
|
48
|
+
|
|
49
|
+
## When to use
|
|
50
|
+
|
|
51
|
+
- Under a `Response` that searched.
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
### Open from the start
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<Sources defaultOpen>
|
|
59
|
+
<SourcesTrigger count={2} />
|
|
60
|
+
<SourcesContent>
|
|
61
|
+
<Source href="https://developer.mozilla.org/docs/Web/CSS/aspect-ratio" title="aspect-ratio — CSS" />
|
|
62
|
+
<Source href="https://www.w3.org/TR/css-sizing-4/" title="CSS Box Sizing Module Level 4" />
|
|
63
|
+
</SourcesContent>
|
|
64
|
+
</Sources>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Your own label
|
|
68
|
+
|
|
69
|
+
Children replace "Used n sources".
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<SourcesTrigger>Searched 3 documents</SourcesTrigger>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Props
|
|
76
|
+
|
|
77
|
+
| Component | Prop | Type | Default |
|
|
78
|
+
| ---------------- | ---------- | ------------------ | -------------- |
|
|
79
|
+
| `SourcesTrigger` | `count` | `number` | — |
|
|
80
|
+
| | `children` | replaces the label | Used n sources |
|
|
81
|
+
| `Source` | `href` | `string` | — |
|
|
82
|
+
| | `title` | `ReactNode` | the address |
|
|
83
|
+
|
|
84
|
+
`Sources` takes `Collapsible` props, `Source` `<a>` props. Words: `labels` (`used(count)`, `newTab`) or `LocaleProvider` `messages.sources`.
|
|
85
|
+
|
|
86
|
+
## Brand rules
|
|
87
|
+
|
|
88
|
+
- **Do** list what the answer used, in citation order.
|
|
89
|
+
- **Don't** add favicons.
|
|
90
|
+
|
|
91
|
+
## Accessibility
|
|
92
|
+
|
|
93
|
+
- The trigger is a button with `aria-expanded`; sources are a list of links, each saying it opens a new tab.
|
|
94
|
+
|
|
95
|
+
### Keyboard
|
|
96
|
+
|
|
97
|
+
| Key | What it does |
|
|
98
|
+
| ------------- | ------------------------------------------------------------- |
|
|
99
|
+
| Enter / Space | Opens or closes the list from the trigger |
|
|
100
|
+
| Tab | Moves through the open list's links; a closed list is skipped |
|
|
101
|
+
| Enter | Opens the focused source in a new tab |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
- Import: `import { Sources, SourcesTrigger, SourcesContent, Source } from "@zonsh/ui"`
|
|
106
|
+
- Source: `packages/ui/src/components/sources.tsx`
|