@zonsh/ui 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +639 -0
- package/README.md +49 -21
- package/dist/brand.d.ts +3 -0
- package/dist/brand.js +7 -0
- package/dist/components/_breadcrumb-more.d.ts +6 -0
- package/dist/components/_breadcrumb-more.js +5 -0
- package/dist/components/_drawing-svg.d.ts +11 -0
- package/dist/components/_drawing-svg.js +30 -0
- package/dist/components/_media.d.ts +159 -0
- package/dist/components/_media.js +266 -0
- package/dist/components/_overlay.d.ts +8 -5
- package/dist/components/_overlay.js +11 -6
- package/dist/components/_scheduler-calendar.d.ts +71 -0
- package/dist/components/_scheduler-calendar.js +940 -0
- package/dist/components/_scheduler-editor.d.ts +29 -0
- package/dist/components/_scheduler-editor.js +111 -0
- package/dist/components/_scheduler-menu.d.ts +16 -0
- package/dist/components/_scheduler-menu.js +18 -0
- package/dist/components/_scheduler-parts.d.ts +164 -0
- package/dist/components/_scheduler-parts.js +327 -0
- package/dist/components/_suggest-list.d.ts +142 -0
- package/dist/components/_suggest-list.js +159 -0
- package/dist/components/_toolbar-more.d.ts +24 -0
- package/dist/components/_toolbar-more.js +25 -0
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +6 -6
- package/dist/components/action-sheet.d.ts +88 -0
- package/dist/components/action-sheet.js +124 -0
- package/dist/components/alert-dialog.js +3 -1
- package/dist/components/alert.d.ts +11 -18
- package/dist/components/alert.js +9 -6
- package/dist/components/app-bar.d.ts +93 -0
- package/dist/components/app-bar.js +175 -0
- package/dist/components/audio-player.d.ts +134 -0
- package/dist/components/audio-player.js +618 -0
- package/dist/components/avatar.d.ts +6 -6
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.d.ts +12 -12
- package/dist/components/badge.js +7 -5
- package/dist/components/bottom-nav.d.ts +53 -11
- package/dist/components/bottom-nav.js +388 -23
- package/dist/components/breadcrumb.d.ts +11 -2
- package/dist/components/breadcrumb.js +60 -6
- package/dist/components/button-group.js +5 -1
- package/dist/components/button.d.ts +23 -6
- package/dist/components/button.js +63 -7
- package/dist/components/calendar.js +8 -6
- package/dist/components/card.d.ts +10 -8
- package/dist/components/card.js +15 -14
- package/dist/components/carousel.d.ts +2 -2
- package/dist/components/carousel.js +21 -8
- package/dist/components/chart.d.ts +27 -1
- package/dist/components/chart.js +15 -5
- package/dist/components/checkbox.js +2 -2
- package/dist/components/code-block.d.ts +9 -2
- package/dist/components/code-block.js +26 -7
- package/dist/components/collapsible.js +3 -3
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/color-picker.js +5 -5
- package/dist/components/combobox.d.ts +26 -7
- package/dist/components/combobox.js +32 -13
- package/dist/components/command.d.ts +29 -5
- package/dist/components/command.js +35 -10
- package/dist/components/context-menu.d.ts +5 -2
- package/dist/components/context-menu.js +24 -3
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +67 -13
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.d.ts +6 -6
- package/dist/components/data-table.js +41 -15
- package/dist/components/date-picker.d.ts +31 -9
- package/dist/components/date-picker.js +100 -18
- package/dist/components/dialog.d.ts +17 -10
- package/dist/components/dialog.js +20 -13
- package/dist/components/drawer.d.ts +26 -8
- package/dist/components/drawer.js +75 -16
- package/dist/components/drawing.d.ts +25 -0
- package/dist/components/drawing.js +32 -0
- package/dist/components/empty.js +2 -2
- package/dist/components/feature-list.d.ts +65 -13
- package/dist/components/feature-list.js +116 -15
- package/dist/components/field.js +2 -2
- package/dist/components/file-drop.d.ts +9 -7
- package/dist/components/file-drop.js +8 -43
- package/dist/components/filter-bar.d.ts +10 -9
- package/dist/components/filter-bar.js +42 -25
- package/dist/components/graph.d.ts +19 -3
- package/dist/components/graph.js +170 -25
- package/dist/components/illustration.js +3 -28
- package/dist/components/input-group.d.ts +5 -10
- package/dist/components/input-group.js +16 -16
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/item.d.ts +9 -6
- package/dist/components/item.js +13 -8
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/lightbox.d.ts +76 -9
- package/dist/components/lightbox.js +333 -45
- package/dist/components/locale.d.ts +6 -6
- package/dist/components/logo.d.ts +21 -1
- package/dist/components/logo.js +32 -2
- package/dist/components/markdown-editor.d.ts +275 -0
- package/dist/components/markdown-editor.js +831 -0
- package/dist/components/mentions.d.ts +153 -0
- package/dist/components/mentions.js +507 -0
- package/dist/components/menu.d.ts +2 -1
- package/dist/components/menu.js +5 -4
- package/dist/components/menubar.d.ts +23 -5
- package/dist/components/menubar.js +97 -22
- package/dist/components/message.d.ts +62 -11
- package/dist/components/message.js +49 -13
- package/dist/components/meter.js +1 -1
- package/dist/components/money-input.d.ts +1 -1
- package/dist/components/money-input.js +1 -1
- package/dist/components/native-select.d.ts +2 -2
- package/dist/components/native-select.js +4 -4
- package/dist/components/navigation-menu.d.ts +3 -1
- package/dist/components/navigation-menu.js +23 -12
- package/dist/components/number-field.d.ts +2 -9
- package/dist/components/number-field.js +86 -36
- package/dist/components/number-roll.d.ts +26 -0
- package/dist/components/number-roll.js +81 -0
- package/dist/components/otp-field.d.ts +1 -1
- package/dist/components/otp-field.js +24 -3
- package/dist/components/pagination.d.ts +11 -3
- package/dist/components/pagination.js +59 -13
- package/dist/components/pdf-viewer.d.ts +1 -1
- package/dist/components/pdf-viewer.js +8 -8
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +2 -2
- package/dist/components/popover.js +5 -3
- package/dist/components/preview-card.d.ts +37 -2
- package/dist/components/preview-card.js +226 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/prompt-input.d.ts +1 -1
- package/dist/components/prompt-input.js +24 -14
- package/dist/components/pull-to-refresh.d.ts +50 -0
- package/dist/components/pull-to-refresh.js +189 -0
- package/dist/components/quote.d.ts +6 -1
- package/dist/components/quote.js +3 -2
- package/dist/components/radio-group.js +1 -1
- package/dist/components/rating.d.ts +4 -1
- package/dist/components/rating.js +131 -10
- package/dist/components/reasoning.d.ts +1 -1
- package/dist/components/reasoning.js +7 -3
- package/dist/components/resizable.d.ts +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/response.d.ts +1 -1
- package/dist/components/response.js +18 -6
- package/dist/components/scheduler.d.ts +352 -0
- package/dist/components/scheduler.js +1717 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.d.ts +17 -4
- package/dist/components/select.js +140 -9
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -3
- package/dist/components/sidebar.d.ts +44 -3
- package/dist/components/sidebar.js +57 -17
- package/dist/components/site-header.d.ts +18 -13
- package/dist/components/site-header.js +23 -11
- package/dist/components/skeleton.d.ts +17 -7
- package/dist/components/skeleton.js +22 -7
- package/dist/components/slider.js +2 -2
- package/dist/components/sortable.d.ts +55 -4
- package/dist/components/sortable.js +172 -103
- package/dist/components/sources.d.ts +1 -1
- package/dist/components/sources.js +2 -2
- package/dist/components/spinner.d.ts +4 -4
- package/dist/components/spinner.js +4 -4
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +17 -8
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +8 -7
- package/dist/components/suggestions.d.ts +11 -3
- package/dist/components/suggestions.js +10 -4
- package/dist/components/swipe-actions.d.ts +66 -0
- package/dist/components/swipe-actions.js +292 -0
- package/dist/components/switch.js +1 -1
- package/dist/components/table.d.ts +12 -6
- package/dist/components/table.js +78 -30
- package/dist/components/tabs.js +7 -4
- package/dist/components/tag.d.ts +19 -20
- package/dist/components/tag.js +9 -5
- package/dist/components/tags-input.d.ts +2 -7
- package/dist/components/tags-input.js +11 -8
- package/dist/components/textarea.d.ts +3 -2
- package/dist/components/textarea.js +4 -3
- package/dist/components/theme.d.ts +49 -6
- package/dist/components/theme.js +147 -9
- package/dist/components/time-field.d.ts +4 -9
- package/dist/components/time-field.js +6 -6
- package/dist/components/timeline.d.ts +19 -3
- package/dist/components/timeline.js +21 -9
- package/dist/components/tippy.d.ts +17 -1
- package/dist/components/tippy.js +95 -15
- package/dist/components/toast.d.ts +2 -7
- package/dist/components/toast.js +12 -8
- package/dist/components/toggle-group.d.ts +7 -1
- package/dist/components/toggle-group.js +16 -5
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +3 -2
- package/dist/components/tool-call.d.ts +1 -1
- package/dist/components/tool-call.js +4 -4
- package/dist/components/toolbar.d.ts +57 -4
- package/dist/components/toolbar.js +216 -16
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +4 -2
- package/dist/components/tour.d.ts +1 -1
- package/dist/components/tour.js +36 -15
- package/dist/components/tree.js +5 -5
- package/dist/components/typography.d.ts +31 -8
- package/dist/components/typography.js +21 -10
- package/dist/components/video-player.d.ts +7 -2
- package/dist/components/video-player.js +121 -220
- package/dist/index.d.ts +99 -92
- package/dist/index.js +99 -92
- package/dist/lib/calendar.d.ts +153 -0
- package/dist/lib/calendar.js +312 -0
- package/dist/lib/cn.d.ts +3 -1
- package/dist/lib/cn.js +5 -0
- package/dist/lib/code-highlight.d.ts +14 -0
- package/dist/lib/code-highlight.js +81 -18
- package/dist/lib/drag.d.ts +39 -0
- package/dist/lib/drag.js +96 -0
- package/dist/lib/editorial-assets.js +16 -8
- package/dist/lib/figure/figures/automation.js +25 -6
- package/dist/lib/figure/figures/bar-chart.js +6 -1
- package/dist/lib/figure/figures/brackets-classic.js +4 -1
- package/dist/lib/figure/figures/city.js +12 -2
- package/dist/lib/figure/figures/conveyor.js +17 -4
- package/dist/lib/figure/figures/database.js +5 -2
- package/dist/lib/figure/figures/documents.js +11 -3
- package/dist/lib/figure/figures/inbox.js +5 -2
- package/dist/lib/figure/figures/laptop.js +3 -1
- package/dist/lib/figure/figures/pipeline.js +45 -10
- package/dist/lib/figure/figures/platform.js +62 -7
- package/dist/lib/figure/figures/server.js +21 -5
- package/dist/lib/figure/figures/spreadsheet.js +29 -5
- package/dist/lib/figure/kernel.d.ts +4 -2
- package/dist/lib/figure/kernel.js +10 -5
- package/dist/lib/figure/parts.js +6 -2
- package/dist/lib/files.d.ts +31 -0
- package/dist/lib/files.js +60 -0
- package/dist/lib/gesture.d.ts +70 -0
- package/dist/lib/gesture.js +141 -0
- package/dist/lib/glide.d.ts +5 -0
- package/dist/lib/glide.js +9 -1
- package/dist/lib/icons.d.ts +1 -0
- package/dist/lib/icons.js +6 -0
- package/dist/lib/illustration-library.js +1 -6
- package/dist/lib/markdown-edit.d.ts +112 -0
- package/dist/lib/markdown-edit.js +557 -0
- package/dist/lib/markdown-rich-editor.d.ts +188 -0
- package/dist/lib/markdown-rich-editor.js +1153 -0
- package/dist/lib/markdown-rich.d.ts +63 -0
- package/dist/lib/markdown-rich.js +534 -0
- package/dist/lib/mentions.d.ts +100 -0
- package/dist/lib/mentions.js +246 -0
- package/dist/lib/motion.d.ts +18 -0
- package/dist/lib/motion.js +43 -5
- package/dist/lib/number-roll.d.ts +89 -0
- package/dist/lib/number-roll.js +391 -0
- package/dist/lib/platform.d.ts +6 -0
- package/dist/lib/platform.js +14 -0
- package/dist/lib/portal-container.d.ts +9 -0
- package/dist/lib/portal-container.js +10 -0
- package/dist/lib/press.d.ts +5 -0
- package/dist/lib/press.js +186 -0
- package/dist/lib/scheduler.d.ts +128 -0
- package/dist/lib/scheduler.js +272 -0
- package/dist/lib/scroll-edges.d.ts +9 -0
- package/dist/lib/scroll-edges.js +50 -0
- package/dist/lib/table-fit.d.ts +1 -1
- package/dist/lib/table-fit.js +65 -8
- package/dist/lib/theme-preset.d.ts +267 -0
- package/dist/lib/theme-preset.js +1046 -0
- package/dist/lib/theme-script.d.ts +23 -3
- package/dist/lib/theme-script.js +17 -5
- package/dist/lib/tippy/sprite.d.ts +36 -4
- package/dist/lib/tippy/sprite.js +188 -15
- package/dist/lib/tone.d.ts +4 -0
- package/dist/lib/tone.js +1 -0
- package/dist/messages/de.d.ts +3 -3
- package/dist/messages/de.js +274 -3
- package/dist/skills/zon-ui/SKILL.md +279 -0
- package/dist/skills/zon-ui/references/authoring.md +265 -0
- package/dist/skills/zon-ui/references/brand.md +416 -0
- package/dist/skills/zon-ui/references/components/accordion.md +199 -0
- package/dist/skills/zon-ui/references/components/action-sheet.md +268 -0
- package/dist/skills/zon-ui/references/components/alert-dialog.md +276 -0
- package/dist/skills/zon-ui/references/components/alert.md +167 -0
- package/dist/skills/zon-ui/references/components/app-bar.md +307 -0
- package/dist/skills/zon-ui/references/components/ascii-field.md +121 -0
- package/dist/skills/zon-ui/references/components/aspect-ratio.md +112 -0
- package/dist/skills/zon-ui/references/components/audio-player.md +231 -0
- package/dist/skills/zon-ui/references/components/avatar.md +98 -0
- package/dist/skills/zon-ui/references/components/badge.md +227 -0
- package/dist/skills/zon-ui/references/components/bottom-nav.md +709 -0
- package/dist/skills/zon-ui/references/components/breadcrumb.md +143 -0
- package/dist/skills/zon-ui/references/components/button-group.md +216 -0
- package/dist/skills/zon-ui/references/components/button.md +309 -0
- package/dist/skills/zon-ui/references/components/calendar.md +296 -0
- package/dist/skills/zon-ui/references/components/card.md +158 -0
- package/dist/skills/zon-ui/references/components/carousel.md +297 -0
- package/dist/skills/zon-ui/references/components/chart.md +739 -0
- package/dist/skills/zon-ui/references/components/chat.md +417 -0
- package/dist/skills/zon-ui/references/components/checkbox.md +219 -0
- package/dist/skills/zon-ui/references/components/code-block.md +143 -0
- package/dist/skills/zon-ui/references/components/code-highlight.md +118 -0
- package/dist/skills/zon-ui/references/components/collapsible.md +146 -0
- package/dist/skills/zon-ui/references/components/color-picker.md +200 -0
- package/dist/skills/zon-ui/references/components/combobox.md +455 -0
- package/dist/skills/zon-ui/references/components/command.md +326 -0
- package/dist/skills/zon-ui/references/components/contact-form.md +562 -0
- package/dist/skills/zon-ui/references/components/context-menu.md +159 -0
- package/dist/skills/zon-ui/references/components/conversation.md +146 -0
- package/dist/skills/zon-ui/references/components/copy-button.md +162 -0
- package/dist/skills/zon-ui/references/components/crm.md +1022 -0
- package/dist/skills/zon-ui/references/components/dashboard.md +612 -0
- package/dist/skills/zon-ui/references/components/data-table.md +776 -0
- package/dist/skills/zon-ui/references/components/date-picker.md +444 -0
- package/dist/skills/zon-ui/references/components/dialog.md +335 -0
- package/dist/skills/zon-ui/references/components/direction.md +165 -0
- package/dist/skills/zon-ui/references/components/drawer.md +276 -0
- package/dist/skills/zon-ui/references/components/drawing.md +94 -0
- package/dist/skills/zon-ui/references/components/empty.md +225 -0
- package/dist/skills/zon-ui/references/components/feature-list.md +412 -0
- package/dist/skills/zon-ui/references/components/field.md +209 -0
- package/dist/skills/zon-ui/references/components/file-drop.md +234 -0
- package/dist/skills/zon-ui/references/components/filter-bar.md +485 -0
- package/dist/skills/zon-ui/references/components/form.md +970 -0
- package/dist/skills/zon-ui/references/components/graph.md +339 -0
- package/dist/skills/zon-ui/references/components/illustration.md +497 -0
- package/dist/skills/zon-ui/references/components/inbox.md +263 -0
- package/dist/skills/zon-ui/references/components/input-group.md +339 -0
- package/dist/skills/zon-ui/references/components/input.md +189 -0
- package/dist/skills/zon-ui/references/components/item.md +277 -0
- package/dist/skills/zon-ui/references/components/kanban.md +626 -0
- package/dist/skills/zon-ui/references/components/kbd.md +116 -0
- package/dist/skills/zon-ui/references/components/label.md +104 -0
- package/dist/skills/zon-ui/references/components/layout.md +291 -0
- package/dist/skills/zon-ui/references/components/lightbox.md +235 -0
- package/dist/skills/zon-ui/references/components/locale.md +279 -0
- package/dist/skills/zon-ui/references/components/logo.md +257 -0
- package/dist/skills/zon-ui/references/components/markdown-editor.md +558 -0
- package/dist/skills/zon-ui/references/components/mentions.md +512 -0
- package/dist/skills/zon-ui/references/components/menu.md +218 -0
- package/dist/skills/zon-ui/references/components/menubar.md +292 -0
- package/dist/skills/zon-ui/references/components/message.md +243 -0
- package/dist/skills/zon-ui/references/components/meter.md +105 -0
- package/dist/skills/zon-ui/references/components/money-input.md +333 -0
- package/dist/skills/zon-ui/references/components/native-select.md +197 -0
- package/dist/skills/zon-ui/references/components/navigation-menu.md +253 -0
- package/dist/skills/zon-ui/references/components/number-field.md +210 -0
- package/dist/skills/zon-ui/references/components/number-roll.md +175 -0
- package/dist/skills/zon-ui/references/components/onboarding.md +896 -0
- package/dist/skills/zon-ui/references/components/otp-field.md +166 -0
- package/dist/skills/zon-ui/references/components/pagination.md +109 -0
- package/dist/skills/zon-ui/references/components/pdf-viewer.md +177 -0
- package/dist/skills/zon-ui/references/components/phone-input.md +252 -0
- package/dist/skills/zon-ui/references/components/popover.md +176 -0
- package/dist/skills/zon-ui/references/components/preview-card.md +193 -0
- package/dist/skills/zon-ui/references/components/pricing.md +724 -0
- package/dist/skills/zon-ui/references/components/progress.md +92 -0
- package/dist/skills/zon-ui/references/components/prompt-input.md +307 -0
- package/dist/skills/zon-ui/references/components/pull-to-refresh.md +188 -0
- package/dist/skills/zon-ui/references/components/quote.md +115 -0
- package/dist/skills/zon-ui/references/components/radio-group.md +215 -0
- package/dist/skills/zon-ui/references/components/rating.md +260 -0
- package/dist/skills/zon-ui/references/components/reasoning.md +102 -0
- package/dist/skills/zon-ui/references/components/resizable.md +213 -0
- package/dist/skills/zon-ui/references/components/response.md +170 -0
- package/dist/skills/zon-ui/references/components/scheduler.md +732 -0
- package/dist/skills/zon-ui/references/components/scroll-area.md +122 -0
- package/dist/skills/zon-ui/references/components/select.md +351 -0
- package/dist/skills/zon-ui/references/components/separator.md +103 -0
- package/dist/skills/zon-ui/references/components/settings.md +793 -0
- package/dist/skills/zon-ui/references/components/shop.md +1715 -0
- package/dist/skills/zon-ui/references/components/sidebar.md +813 -0
- package/dist/skills/zon-ui/references/components/sign-in.md +1639 -0
- package/dist/skills/zon-ui/references/components/site-header.md +303 -0
- package/dist/skills/zon-ui/references/components/skeleton.md +256 -0
- package/dist/skills/zon-ui/references/components/slider.md +172 -0
- package/dist/skills/zon-ui/references/components/sortable.md +405 -0
- package/dist/skills/zon-ui/references/components/sources.md +106 -0
- package/dist/skills/zon-ui/references/components/spinner.md +222 -0
- package/dist/skills/zon-ui/references/components/stat.md +267 -0
- package/dist/skills/zon-ui/references/components/stepper.md +285 -0
- package/dist/skills/zon-ui/references/components/suggestions.md +146 -0
- package/dist/skills/zon-ui/references/components/swipe-actions.md +344 -0
- package/dist/skills/zon-ui/references/components/switch.md +160 -0
- package/dist/skills/zon-ui/references/components/table.md +999 -0
- package/dist/skills/zon-ui/references/components/tabs.md +258 -0
- package/dist/skills/zon-ui/references/components/tag.md +115 -0
- package/dist/skills/zon-ui/references/components/tags-input.md +216 -0
- package/dist/skills/zon-ui/references/components/textarea.md +95 -0
- package/dist/skills/zon-ui/references/components/theme-editor.md +3940 -0
- package/dist/skills/zon-ui/references/components/theme.md +362 -0
- package/dist/skills/zon-ui/references/components/time-field.md +222 -0
- package/dist/skills/zon-ui/references/components/timeline.md +285 -0
- package/dist/skills/zon-ui/references/components/tippy.md +243 -0
- package/dist/skills/zon-ui/references/components/toast.md +220 -0
- package/dist/skills/zon-ui/references/components/toggle-group.md +261 -0
- package/dist/skills/zon-ui/references/components/toggle.md +167 -0
- package/dist/skills/zon-ui/references/components/tool-call.md +146 -0
- package/dist/skills/zon-ui/references/components/toolbar.md +260 -0
- package/dist/skills/zon-ui/references/components/tooltip.md +172 -0
- package/dist/skills/zon-ui/references/components/tour.md +423 -0
- package/dist/skills/zon-ui/references/components/tree.md +481 -0
- package/dist/skills/zon-ui/references/components/typography.md +347 -0
- package/dist/skills/zon-ui/references/components/video-player.md +386 -0
- package/dist/skills/zon-ui/references/marketing.md +467 -0
- package/dist/skills/zon-ui/references/motion.md +455 -0
- package/dist/skills/zon-ui/references/recipes.md +1232 -0
- package/dist/skills/zon-ui/references/tokens.md +866 -0
- package/dist/sources/accordion.css +4 -0
- package/dist/sources/action-sheet.css +11 -0
- package/dist/sources/alert-dialog.css +6 -0
- package/dist/sources/alert.css +3 -0
- package/dist/sources/app-bar.css +14 -0
- package/dist/sources/ascii-field.css +3 -0
- package/dist/sources/aspect-ratio.css +3 -0
- package/dist/sources/audio-player.css +20 -0
- package/dist/sources/avatar.css +3 -0
- package/dist/sources/badge.css +3 -0
- package/dist/sources/bottom-nav.css +9 -0
- package/dist/sources/breadcrumb.css +14 -0
- package/dist/sources/button-group.css +3 -0
- package/dist/sources/button.css +9 -0
- package/dist/sources/calendar.css +13 -0
- package/dist/sources/card.css +3 -0
- package/dist/sources/carousel.css +11 -0
- package/dist/sources/chart.css +5 -0
- package/dist/sources/checkbox.css +6 -0
- package/dist/sources/code-block.css +13 -0
- package/dist/sources/collapsible.css +4 -0
- package/dist/sources/color-picker.css +13 -0
- package/dist/sources/combobox.css +13 -0
- package/dist/sources/command.css +13 -0
- package/dist/sources/context-menu.css +12 -0
- package/dist/sources/conversation.css +10 -0
- package/dist/sources/copy-button.css +10 -0
- package/dist/sources/data-table.css +27 -0
- package/dist/sources/date-picker.css +20 -0
- package/dist/sources/dialog.css +9 -0
- package/dist/sources/direction.css +2 -0
- package/dist/sources/drawer.css +9 -0
- package/dist/sources/drawing.css +5 -0
- package/dist/sources/empty.css +3 -0
- package/dist/sources/feature-list.css +4 -0
- package/dist/sources/field.css +4 -0
- package/dist/sources/file-drop.css +15 -0
- package/dist/sources/filter-bar.css +30 -0
- package/dist/sources/form.css +4 -0
- package/dist/sources/graph.css +19 -0
- package/dist/sources/illustration.css +28 -0
- package/dist/sources/input-group.css +7 -0
- package/dist/sources/input.css +3 -0
- package/dist/sources/item.css +4 -0
- package/dist/sources/kbd.css +5 -0
- package/dist/sources/label.css +3 -0
- package/dist/sources/layout.css +3 -0
- package/dist/sources/lightbox.css +33 -0
- package/dist/sources/locale.css +2 -0
- package/dist/sources/logo.css +4 -0
- package/dist/sources/markdown-editor.css +41 -0
- package/dist/sources/mentions.css +13 -0
- package/dist/sources/menu.css +11 -0
- package/dist/sources/menubar.css +14 -0
- package/dist/sources/message.css +16 -0
- package/dist/sources/meter.css +4 -0
- package/dist/sources/money-input.css +10 -0
- package/dist/sources/native-select.css +4 -0
- package/dist/sources/navigation-menu.css +8 -0
- package/dist/sources/number-field.css +8 -0
- package/dist/sources/number-roll.css +6 -0
- package/dist/sources/otp-field.css +5 -0
- package/dist/sources/pagination.css +11 -0
- package/dist/sources/pdf-viewer.css +30 -0
- package/dist/sources/phone-input.css +20 -0
- package/dist/sources/popover.css +7 -0
- package/dist/sources/preview-card.css +7 -0
- package/dist/sources/progress.css +4 -0
- package/dist/sources/prompt-input.css +15 -0
- package/dist/sources/pull-to-refresh.css +14 -0
- package/dist/sources/quote.css +3 -0
- package/dist/sources/radio-group.css +5 -0
- package/dist/sources/rating.css +6 -0
- package/dist/sources/reasoning.css +6 -0
- package/dist/sources/resizable.css +4 -0
- package/dist/sources/response.css +16 -0
- package/dist/sources/scheduler.css +44 -0
- package/dist/sources/scroll-area.css +3 -0
- package/dist/sources/select.css +12 -0
- package/dist/sources/separator.css +3 -0
- package/dist/sources/sidebar.css +19 -0
- package/dist/sources/site-header.css +15 -0
- package/dist/sources/skeleton.css +3 -0
- package/dist/sources/slider.css +6 -0
- package/dist/sources/sortable.css +12 -0
- package/dist/sources/sources.css +6 -0
- package/dist/sources/spinner.css +6 -0
- package/dist/sources/stat.css +9 -0
- package/dist/sources/stepper.css +6 -0
- package/dist/sources/suggestions.css +10 -0
- package/dist/sources/swipe-actions.css +20 -0
- package/dist/sources/switch.css +5 -0
- package/dist/sources/table.css +7 -0
- package/dist/sources/tabs.css +5 -0
- package/dist/sources/tag.css +3 -0
- package/dist/sources/tags-input.css +6 -0
- package/dist/sources/textarea.css +3 -0
- package/dist/sources/theme.css +13 -0
- package/dist/sources/time-field.css +7 -0
- package/dist/sources/timeline.css +7 -0
- package/dist/sources/tippy.css +6 -0
- package/dist/sources/toast.css +6 -0
- package/dist/sources/toggle-group.css +5 -0
- package/dist/sources/toggle.css +3 -0
- package/dist/sources/tool-call.css +16 -0
- package/dist/sources/toolbar.css +14 -0
- package/dist/sources/tooltip.css +6 -0
- package/dist/sources/tour.css +14 -0
- package/dist/sources/tree.css +6 -0
- package/dist/sources/typography.css +4 -0
- package/dist/sources/video-player.css +21 -0
- package/dist/styles/ai.css +3 -0
- package/dist/styles/brand.css +98 -0
- package/dist/styles/core.css +266 -0
- package/dist/styles/editor.css +3 -0
- package/dist/styles/expressive.css +35 -56
- package/dist/styles/fonts.css +61 -117
- package/dist/styles/graph.css +4 -0
- package/dist/styles/illustration.css +4 -0
- package/dist/styles/index.css +11 -201
- package/dist/styles/material.css +138 -12
- package/dist/styles/parts/ai.css +18 -13
- package/dist/styles/parts/brand.css +2 -2
- package/dist/styles/parts/controls.css +29 -20
- package/dist/styles/parts/data.css +13 -9
- package/dist/styles/parts/editor.css +372 -0
- package/dist/styles/parts/feedback.css +32 -2
- package/dist/styles/parts/foundations.css +12 -7
- package/dist/styles/parts/graph.css +25 -9
- package/dist/styles/parts/inputs.css +172 -9
- package/dist/styles/parts/isometric.css +6 -5
- package/dist/styles/parts/navigation.css +206 -27
- package/dist/styles/parts/overlays.css +19 -4
- package/dist/styles/parts/pdf.css +2 -2
- package/dist/styles/pdf.css +3 -0
- package/dist/styles/prose.css +3 -0
- package/dist/styles/tokens.css +89 -14
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +5 -0
- package/dist/vite.d.ts +48 -59
- package/dist/vite.js +54 -21
- package/package.json +69 -2
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
# Onboarding
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Button, Card, CardDescription, CardHeader, CardTitle, Field, FieldDescription, FieldError, FieldItem, FieldLabel, Fieldset, FieldsetLegend, Form, FormActions, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, Radio, RadioGroup, Separator, Stepper, Switch } from "@zonsh/ui";
|
|
5
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
6
|
+
import { Tippy, type TippyMove } from "@zonsh/ui/tippy";
|
|
7
|
+
import { ArrowLeftIcon, CheckIcon, PlusIcon, XIcon } from "lucide-react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
|
|
10
|
+
/** Your product's mark — a placeholder for "Acme". Replace it and the name with your own; never zon's Logo. */
|
|
11
|
+
function AcmeMark() {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round">
|
|
14
|
+
<path d="M3.5 20.5 12 3.5l8.5 17z" />
|
|
15
|
+
<path d="M8 14.5h8" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* A workspace setup for a fictional notes app. Nothing is sent: creating the workspace waits on a
|
|
21
|
+
* timer, and the address "taken" is refused to show an error from the server. */
|
|
22
|
+
const LATENCY = 700;
|
|
23
|
+
|
|
24
|
+
const TAKEN_SLUG = "taken";
|
|
25
|
+
|
|
26
|
+
const MAX_INVITES = 5;
|
|
27
|
+
|
|
28
|
+
const DOMAIN = "notes.example/";
|
|
29
|
+
|
|
30
|
+
type Errors = Record<string, string>;
|
|
31
|
+
|
|
32
|
+
interface Setup {
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
/** Set once the address has been typed in by hand, so the name stops filling it. */
|
|
36
|
+
slugEdited: boolean;
|
|
37
|
+
invites: string[];
|
|
38
|
+
use: string;
|
|
39
|
+
weeklySummary: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const emptySetup: Setup = {
|
|
43
|
+
name: "",
|
|
44
|
+
slug: "",
|
|
45
|
+
slugEdited: false,
|
|
46
|
+
invites: [""],
|
|
47
|
+
use: "",
|
|
48
|
+
weeklySummary: true,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const steps = [
|
|
52
|
+
{ id: "workspace", title: "Workspace" },
|
|
53
|
+
{ id: "team", title: "Team" },
|
|
54
|
+
{ id: "preferences", title: "Preferences" },
|
|
55
|
+
{ id: "review", title: "Review" },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const uses = [
|
|
59
|
+
{
|
|
60
|
+
value: "wiki",
|
|
61
|
+
label: "A team wiki",
|
|
62
|
+
description: "Pages people come back to: how-tos, policies, who does what.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "projects",
|
|
66
|
+
label: "Project notes",
|
|
67
|
+
description: "One notebook per project, with decisions and next steps.",
|
|
68
|
+
},
|
|
69
|
+
{ value: "meetings", label: "Meeting notes", description: "Agendas before, notes and actions after." },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
/** "Harbour Line Ferries" → "harbour-line-ferries". */
|
|
73
|
+
function slugify(name: string) {
|
|
74
|
+
return name
|
|
75
|
+
.toLowerCase()
|
|
76
|
+
.normalize("NFKD")
|
|
77
|
+
.replace(/[̀-ͯ]/g, "")
|
|
78
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
79
|
+
.replace(/^-+|-+$/g, "")
|
|
80
|
+
.slice(0, 40);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Fake latency that is cancelled when the component unmounts. */
|
|
84
|
+
function useWait() {
|
|
85
|
+
const timers = React.useRef(new Set<ReturnType<typeof setTimeout>>());
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
const pending = timers.current;
|
|
88
|
+
return () => pending.forEach(clearTimeout);
|
|
89
|
+
}, []);
|
|
90
|
+
return React.useCallback(
|
|
91
|
+
(ms: number) =>
|
|
92
|
+
new Promise<void>((resolve) => {
|
|
93
|
+
const id = setTimeout(() => {
|
|
94
|
+
timers.current.delete(id);
|
|
95
|
+
resolve();
|
|
96
|
+
}, ms);
|
|
97
|
+
timers.current.add(id);
|
|
98
|
+
}),
|
|
99
|
+
[],
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The submit button keeps its width while pending: the label hides, a spinner sits on top. */
|
|
104
|
+
function SubmitButton({
|
|
105
|
+
pending = false,
|
|
106
|
+
pendingLabel = "",
|
|
107
|
+
children,
|
|
108
|
+
}: {
|
|
109
|
+
pending?: boolean;
|
|
110
|
+
pendingLabel?: string;
|
|
111
|
+
children: React.ReactNode;
|
|
112
|
+
}) {
|
|
113
|
+
return (
|
|
114
|
+
<Button type="submit" loading={pending} loadingLabel={pendingLabel}>
|
|
115
|
+
{children}
|
|
116
|
+
</Button>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function BackButton({ onClick }: { onClick: () => void }) {
|
|
121
|
+
return (
|
|
122
|
+
<Button type="button" variant="ghost" onClick={onClick}>
|
|
123
|
+
<ArrowLeftIcon aria-hidden className="rtl:-scale-x-100" />
|
|
124
|
+
Back
|
|
125
|
+
</Button>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ── The steps ─────────────────────────────────────────────────────────────── */
|
|
130
|
+
|
|
131
|
+
interface StepProps {
|
|
132
|
+
setup: Setup;
|
|
133
|
+
/** Errors from the server, by field name. */
|
|
134
|
+
errors: Errors;
|
|
135
|
+
clearError: (name: string) => void;
|
|
136
|
+
update: (patch: Partial<Setup>) => void;
|
|
137
|
+
onBack: () => void;
|
|
138
|
+
onNext: () => void;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function WorkspaceStep({ setup, update, errors, clearError, onNext }: StepProps) {
|
|
142
|
+
const slugRef = React.useRef<HTMLInputElement>(null);
|
|
143
|
+
// Coming back with the server's error on the address: select it, ready to retype.
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
if (errors.slug) slugRef.current?.select();
|
|
146
|
+
}, [errors.slug]);
|
|
147
|
+
return (
|
|
148
|
+
<Form errors={errors} onFormSubmit={onNext}>
|
|
149
|
+
<Field name="name">
|
|
150
|
+
<FieldLabel>Workspace name</FieldLabel>
|
|
151
|
+
<Input
|
|
152
|
+
required
|
|
153
|
+
minLength={2}
|
|
154
|
+
autoComplete="organization"
|
|
155
|
+
placeholder="Harbour Line Ferries"
|
|
156
|
+
value={setup.name}
|
|
157
|
+
onValueChange={(name) => update(setup.slugEdited ? { name } : { name, slug: slugify(name) })}
|
|
158
|
+
/>
|
|
159
|
+
<FieldDescription>Usually the name of your team or company.</FieldDescription>
|
|
160
|
+
<FieldError match="valueMissing">Give the workspace a name.</FieldError>
|
|
161
|
+
<FieldError match="tooShort">Use at least two characters.</FieldError>
|
|
162
|
+
</Field>
|
|
163
|
+
<Field name="slug">
|
|
164
|
+
<FieldLabel>Address</FieldLabel>
|
|
165
|
+
{/* A web address reads left to right, in a right-to-left page too. */}
|
|
166
|
+
<InputGroup dir="ltr">
|
|
167
|
+
<InputGroupInput
|
|
168
|
+
ref={slugRef}
|
|
169
|
+
required
|
|
170
|
+
pattern="[a-z0-9]+(-[a-z0-9]+)*"
|
|
171
|
+
spellCheck={false}
|
|
172
|
+
autoCapitalize="none"
|
|
173
|
+
value={setup.slug}
|
|
174
|
+
onValueChange={(slug) => {
|
|
175
|
+
update({ slug, slugEdited: true });
|
|
176
|
+
clearError("slug");
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
<InputGroupAddon>
|
|
180
|
+
<InputGroupText>{DOMAIN}</InputGroupText>
|
|
181
|
+
</InputGroupAddon>
|
|
182
|
+
</InputGroup>
|
|
183
|
+
<FieldDescription>Lowercase letters, numbers and dashes. You can change it later.</FieldDescription>
|
|
184
|
+
<FieldError match="valueMissing">Pick an address for the workspace.</FieldError>
|
|
185
|
+
<FieldError match="patternMismatch">
|
|
186
|
+
Use lowercase letters and numbers, with single dashes between words.
|
|
187
|
+
</FieldError>
|
|
188
|
+
{errors.slug && <FieldError match>{errors.slug}</FieldError>}
|
|
189
|
+
</Field>
|
|
190
|
+
<FormActions>
|
|
191
|
+
<SubmitButton>Continue</SubmitButton>
|
|
192
|
+
</FormActions>
|
|
193
|
+
</Form>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function TeamStep({ setup, update, onBack, onNext }: StepProps) {
|
|
198
|
+
const [errors, setErrors] = React.useState<Errors>({});
|
|
199
|
+
const listRef = React.useRef<HTMLDivElement>(null);
|
|
200
|
+
const invites = setup.invites;
|
|
201
|
+
|
|
202
|
+
const setInvite = (index: number, value: string) => {
|
|
203
|
+
update({ invites: invites.map((v, i) => (i === index ? value : v)) });
|
|
204
|
+
setErrors({});
|
|
205
|
+
};
|
|
206
|
+
const add = () => {
|
|
207
|
+
update({ invites: [...invites, ""] });
|
|
208
|
+
// Focus the new field once it is there.
|
|
209
|
+
requestAnimationFrame(() => {
|
|
210
|
+
const fields = listRef.current?.querySelectorAll("input");
|
|
211
|
+
fields?.[fields.length - 1]?.focus();
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const remove = (index: number) => {
|
|
215
|
+
update({ invites: invites.filter((_, i) => i !== index) });
|
|
216
|
+
setErrors({});
|
|
217
|
+
// The button can go with its row (the last one, or every one when one row is left): focus the
|
|
218
|
+
// field now in its place, or the one above it.
|
|
219
|
+
requestAnimationFrame(() => {
|
|
220
|
+
const fields = listRef.current?.querySelectorAll("input");
|
|
221
|
+
if (fields?.length) fields[Math.min(index, fields.length - 1)]?.focus();
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<Form
|
|
227
|
+
errors={errors}
|
|
228
|
+
onFormSubmit={() => {
|
|
229
|
+
// The same address twice is the one thing native validation cannot see.
|
|
230
|
+
const seen = new Map<string, number>();
|
|
231
|
+
for (const [i, raw] of invites.entries()) {
|
|
232
|
+
const email = raw.trim().toLowerCase();
|
|
233
|
+
if (!email) continue;
|
|
234
|
+
if (seen.has(email)) {
|
|
235
|
+
setErrors({ [`invite-${i}`]: "This address is already on the list." });
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
seen.set(email, i);
|
|
239
|
+
}
|
|
240
|
+
update({ invites: invites.filter((v) => v.trim()).length ? invites.filter((v) => v.trim()) : [""] });
|
|
241
|
+
onNext();
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
<Fieldset className="flex flex-col gap-3">
|
|
245
|
+
<FieldsetLegend>Email addresses</FieldsetLegend>
|
|
246
|
+
<div ref={listRef} className="flex flex-col gap-3">
|
|
247
|
+
{invites.map((value, i) => (
|
|
248
|
+
<Field key={i} name={`invite-${i}`}>
|
|
249
|
+
<div className="flex items-center gap-2">
|
|
250
|
+
<Input
|
|
251
|
+
type="email"
|
|
252
|
+
autoComplete="off"
|
|
253
|
+
aria-label={`Teammate ${i + 1}, email`}
|
|
254
|
+
placeholder={i === 0 ? "kenji@harbourline.example" : "name@company.example"}
|
|
255
|
+
value={value}
|
|
256
|
+
onValueChange={(next) => setInvite(i, next)}
|
|
257
|
+
/>
|
|
258
|
+
{invites.length > 1 && (
|
|
259
|
+
<Button
|
|
260
|
+
type="button"
|
|
261
|
+
variant="ghost"
|
|
262
|
+
size="icon"
|
|
263
|
+
aria-label={`Remove teammate ${i + 1}`}
|
|
264
|
+
onClick={() => remove(i)}
|
|
265
|
+
>
|
|
266
|
+
<XIcon />
|
|
267
|
+
</Button>
|
|
268
|
+
)}
|
|
269
|
+
</div>
|
|
270
|
+
<FieldError match="typeMismatch">That does not look like an email address.</FieldError>
|
|
271
|
+
{errors[`invite-${i}`] && <FieldError match>{errors[`invite-${i}`]}</FieldError>}
|
|
272
|
+
</Field>
|
|
273
|
+
))}
|
|
274
|
+
</div>
|
|
275
|
+
{invites.length < MAX_INVITES && (
|
|
276
|
+
<Button type="button" variant="ghost" size="sm" className="self-start" onClick={add}>
|
|
277
|
+
<PlusIcon aria-hidden />
|
|
278
|
+
Add another
|
|
279
|
+
</Button>
|
|
280
|
+
)}
|
|
281
|
+
</Fieldset>
|
|
282
|
+
<p className="m-0 text-13 leading-relaxed text-muted-foreground">
|
|
283
|
+
Invitations go out when you create the workspace. Everyone joins as a member; you can change roles in
|
|
284
|
+
Settings. Leave this empty to invite people later.
|
|
285
|
+
</p>
|
|
286
|
+
<FormActions align="between">
|
|
287
|
+
<BackButton onClick={onBack} />
|
|
288
|
+
<SubmitButton>Continue</SubmitButton>
|
|
289
|
+
</FormActions>
|
|
290
|
+
</Form>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function PreferencesStep({ setup, update, onBack, onNext }: StepProps) {
|
|
295
|
+
// Set as the form's errors, so focus moves to the choice like it does for a native check.
|
|
296
|
+
const [errors, setErrors] = React.useState<Errors>({});
|
|
297
|
+
return (
|
|
298
|
+
<Form
|
|
299
|
+
errors={errors}
|
|
300
|
+
onFormSubmit={() => {
|
|
301
|
+
if (!setup.use) {
|
|
302
|
+
setErrors({ use: "Pick the closest one. It only decides which templates you see first." });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
onNext();
|
|
306
|
+
}}
|
|
307
|
+
>
|
|
308
|
+
<Field name="use">
|
|
309
|
+
<Fieldset
|
|
310
|
+
render={
|
|
311
|
+
<RadioGroup
|
|
312
|
+
value={setup.use}
|
|
313
|
+
onValueChange={(use) => {
|
|
314
|
+
update({ use: use as string });
|
|
315
|
+
setErrors({});
|
|
316
|
+
}}
|
|
317
|
+
/>
|
|
318
|
+
}
|
|
319
|
+
>
|
|
320
|
+
<FieldsetLegend>What will you use it for first?</FieldsetLegend>
|
|
321
|
+
{uses.map((option) => (
|
|
322
|
+
<FieldItem key={option.value} className="gap-1">
|
|
323
|
+
<FieldLabel>
|
|
324
|
+
<Radio value={option.value} />
|
|
325
|
+
{option.label}
|
|
326
|
+
</FieldLabel>
|
|
327
|
+
<FieldDescription className="ps-7">{option.description}</FieldDescription>
|
|
328
|
+
</FieldItem>
|
|
329
|
+
))}
|
|
330
|
+
</Fieldset>
|
|
331
|
+
{errors.use && <FieldError match>{errors.use}</FieldError>}
|
|
332
|
+
</Field>
|
|
333
|
+
<Separator />
|
|
334
|
+
<Field className="flex-row items-center justify-between gap-6">
|
|
335
|
+
<div className="flex flex-col gap-1">
|
|
336
|
+
<FieldLabel>Weekly summary</FieldLabel>
|
|
337
|
+
<FieldDescription>An email on Monday morning with what changed in the workspace.</FieldDescription>
|
|
338
|
+
</div>
|
|
339
|
+
<Switch
|
|
340
|
+
checked={setup.weeklySummary}
|
|
341
|
+
onCheckedChange={(weeklySummary) => update({ weeklySummary })}
|
|
342
|
+
nativeButton
|
|
343
|
+
render={<button type="button" />}
|
|
344
|
+
/>
|
|
345
|
+
</Field>
|
|
346
|
+
<FormActions align="between">
|
|
347
|
+
<BackButton onClick={onBack} />
|
|
348
|
+
<SubmitButton>Continue</SubmitButton>
|
|
349
|
+
</FormActions>
|
|
350
|
+
</Form>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function ReviewStep({
|
|
355
|
+
setup,
|
|
356
|
+
onBack,
|
|
357
|
+
onEdit,
|
|
358
|
+
onCreated,
|
|
359
|
+
onTaken,
|
|
360
|
+
onPendingChange,
|
|
361
|
+
}: StepProps & {
|
|
362
|
+
onEdit: (step: number) => void;
|
|
363
|
+
onCreated: () => void;
|
|
364
|
+
onTaken: (error: string) => void;
|
|
365
|
+
onPendingChange?: (pending: boolean) => void;
|
|
366
|
+
}) {
|
|
367
|
+
const wait = useWait();
|
|
368
|
+
const [pending, setPendingState] = React.useState(false);
|
|
369
|
+
const setPending = (next: boolean) => {
|
|
370
|
+
setPendingState(next);
|
|
371
|
+
onPendingChange?.(next);
|
|
372
|
+
};
|
|
373
|
+
const invites = setup.invites.filter((v) => v.trim());
|
|
374
|
+
const use = uses.find((u) => u.value === setup.use)?.label ?? "—";
|
|
375
|
+
|
|
376
|
+
const rows: { label: string; value: React.ReactNode; step: number }[] = [
|
|
377
|
+
{ label: "Workspace", value: <span className="wrap-anywhere">{setup.name}</span>, step: 0 },
|
|
378
|
+
{
|
|
379
|
+
label: "Address",
|
|
380
|
+
value: (
|
|
381
|
+
<span className="font-mono text-13 wrap-anywhere">
|
|
382
|
+
{DOMAIN}
|
|
383
|
+
{setup.slug}
|
|
384
|
+
</span>
|
|
385
|
+
),
|
|
386
|
+
step: 0,
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
label: "Invitations",
|
|
390
|
+
value: invites.length ? (
|
|
391
|
+
<ul className="m-0 flex list-none flex-col gap-0.5 p-0">
|
|
392
|
+
{invites.map((email) => (
|
|
393
|
+
<li key={email} className="wrap-anywhere">
|
|
394
|
+
{email}
|
|
395
|
+
</li>
|
|
396
|
+
))}
|
|
397
|
+
</ul>
|
|
398
|
+
) : (
|
|
399
|
+
<span className="text-muted-foreground">None yet</span>
|
|
400
|
+
),
|
|
401
|
+
step: 1,
|
|
402
|
+
},
|
|
403
|
+
{ label: "First use", value: use, step: 2 },
|
|
404
|
+
{ label: "Weekly summary", value: setup.weeklySummary ? "On" : "Off", step: 2 },
|
|
405
|
+
];
|
|
406
|
+
|
|
407
|
+
return (
|
|
408
|
+
<Form
|
|
409
|
+
onFormSubmit={async () => {
|
|
410
|
+
if (pending) return;
|
|
411
|
+
setPending(true);
|
|
412
|
+
await wait(LATENCY);
|
|
413
|
+
setPending(false);
|
|
414
|
+
// The server's answer goes on the field it is about, back on the first step.
|
|
415
|
+
if (setup.slug === TAKEN_SLUG) {
|
|
416
|
+
onTaken(`${DOMAIN}${TAKEN_SLUG} belongs to another workspace. Pick another address.`);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
onCreated();
|
|
420
|
+
}}
|
|
421
|
+
>
|
|
422
|
+
{/* Label beside the answer; on a phone the label sits above it, so the answer keeps its width. */}
|
|
423
|
+
<dl className="@container m-0 flex flex-col">
|
|
424
|
+
{rows.map((row) => (
|
|
425
|
+
<div
|
|
426
|
+
key={row.label}
|
|
427
|
+
className="grid items-baseline gap-x-4 gap-y-1 border-t border-border/60 py-3 last:border-b @sm:grid-cols-[minmax(0,9rem)_minmax(0,1fr)]"
|
|
428
|
+
>
|
|
429
|
+
<dt className="eyebrow">{row.label}</dt>
|
|
430
|
+
{/* The link sits in the dd: a dl's groups hold only dt and dd. */}
|
|
431
|
+
<dd className="m-0 flex min-w-0 items-baseline gap-4 text-sm text-foreground">
|
|
432
|
+
<div className="min-w-0 flex-1">{row.value}</div>
|
|
433
|
+
<Button
|
|
434
|
+
type="button"
|
|
435
|
+
variant="link"
|
|
436
|
+
className="text-13"
|
|
437
|
+
aria-label={`Change ${row.label.toLowerCase()}`}
|
|
438
|
+
onClick={() => onEdit(row.step)}
|
|
439
|
+
>
|
|
440
|
+
Change
|
|
441
|
+
</Button>
|
|
442
|
+
</dd>
|
|
443
|
+
</div>
|
|
444
|
+
))}
|
|
445
|
+
</dl>
|
|
446
|
+
<FormActions align="between">
|
|
447
|
+
<BackButton onClick={onBack} />
|
|
448
|
+
<SubmitButton pending={pending} pendingLabel="Creating your workspace">
|
|
449
|
+
Create workspace
|
|
450
|
+
</SubmitButton>
|
|
451
|
+
</FormActions>
|
|
452
|
+
</Form>
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function Created({
|
|
457
|
+
setup,
|
|
458
|
+
onRestart,
|
|
459
|
+
className,
|
|
460
|
+
}: {
|
|
461
|
+
setup: Setup;
|
|
462
|
+
onRestart: () => void;
|
|
463
|
+
className?: string;
|
|
464
|
+
}) {
|
|
465
|
+
const invites = setup.invites.filter((v) => v.trim()).length;
|
|
466
|
+
return (
|
|
467
|
+
<div className={`flex flex-col gap-6 ${className ?? ""}`}>
|
|
468
|
+
<CardHeader>
|
|
469
|
+
<p role="status" className="m-0 flex items-center gap-1.5 font-mono text-xs text-success">
|
|
470
|
+
<CheckIcon aria-hidden className="size-3.5" />
|
|
471
|
+
Workspace created
|
|
472
|
+
</p>
|
|
473
|
+
{/* The name is whatever was typed, perhaps one long word: it wraps, not the page. */}
|
|
474
|
+
<CardTitle render={<h2 />} tabIndex={-1} data-step-heading className="wrap-anywhere outline-none">
|
|
475
|
+
{setup.name} is ready
|
|
476
|
+
</CardTitle>
|
|
477
|
+
<CardDescription>
|
|
478
|
+
{invites === 0
|
|
479
|
+
? "Invite people whenever you are ready, from Settings."
|
|
480
|
+
: `We sent ${invites === 1 ? "an invitation" : `${invites} invitations`}. People appear in the workspace as they accept.`}
|
|
481
|
+
</CardDescription>
|
|
482
|
+
</CardHeader>
|
|
483
|
+
<div className="flex flex-wrap justify-end gap-3">
|
|
484
|
+
<Button variant="ghost" onClick={onRestart}>
|
|
485
|
+
Start over
|
|
486
|
+
</Button>
|
|
487
|
+
<Button nativeButton={false} render={<a href={`#${setup.slug}`} />}>
|
|
488
|
+
Open the workspace
|
|
489
|
+
</Button>
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/* ── The flow ──────────────────────────────────────────────────────────────── */
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* A new step's body comes in from the way people are going: from the end when they go on, from
|
|
499
|
+
* the start when they go back (so in a right-to-left page, from the left on Next). The header and
|
|
500
|
+
* the Stepper stay put; nothing leaves, and nothing inside it is staggered. Under reduced motion
|
|
501
|
+
* only the fade is left.
|
|
502
|
+
*/
|
|
503
|
+
const stepEntrance = {
|
|
504
|
+
forward:
|
|
505
|
+
"transition-[opacity,translate] duration-[calc(var(--duration-fade)*4/3),calc(var(--duration)*4/3)] ease-(--ease) starting:opacity-0 starting:translate-x-3 rtl:starting:-translate-x-3",
|
|
506
|
+
back: "transition-[opacity,translate] duration-[calc(var(--duration-fade)*4/3),calc(var(--duration)*4/3)] ease-(--ease) starting:opacity-0 starting:-translate-x-3 rtl:starting:translate-x-3",
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
const copy = [
|
|
510
|
+
{
|
|
511
|
+
title: "Name your workspace",
|
|
512
|
+
description: "Where your team's notes will live. You can rename it later.",
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
title: "Invite your team",
|
|
516
|
+
description: "Add the people you write with. Up to five now, as many as you like later.",
|
|
517
|
+
},
|
|
518
|
+
{ title: "Set it up for your team", description: "So the first page you see is a useful one." },
|
|
519
|
+
{ title: "Check and create", description: "Change anything before the workspace is created." },
|
|
520
|
+
];
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* What Tippy does at each point of the setup. It stands in one place and only reacts: a wave to
|
|
524
|
+
* start, a nod for the team, a look round the choices, a think over the review and while the
|
|
525
|
+
* workspace is created, a shrug when the address is taken, and a hop with a check when it is done.
|
|
526
|
+
*/
|
|
527
|
+
function tippyMove({
|
|
528
|
+
step,
|
|
529
|
+
done,
|
|
530
|
+
pending,
|
|
531
|
+
refused,
|
|
532
|
+
}: {
|
|
533
|
+
step: number;
|
|
534
|
+
done: boolean;
|
|
535
|
+
pending: boolean;
|
|
536
|
+
refused: boolean;
|
|
537
|
+
}): TippyMove {
|
|
538
|
+
if (done) return "success";
|
|
539
|
+
if (pending) return "think";
|
|
540
|
+
if (refused) return "shrug";
|
|
541
|
+
return (["wave", "nod", "look", "think"] as const)[step] ?? "idle";
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* The page around the card: the logo above it, a way out below it, on a blueprint grid that
|
|
546
|
+
* fades out towards the edges — the same stage as the Card layout of the Sign in and sign up block.
|
|
547
|
+
* With a `move`, Tippy keeps the card company: standing on its top edge on a phone, beside it at
|
|
548
|
+
* its foot when there is room.
|
|
549
|
+
*/
|
|
550
|
+
function Stage({ children, move }: { children: React.ReactNode; move?: TippyMove }) {
|
|
551
|
+
return (
|
|
552
|
+
<div className="@container relative isolate flex w-full flex-col items-center gap-8 py-2">
|
|
553
|
+
<div
|
|
554
|
+
aria-hidden
|
|
555
|
+
className="blueprint pointer-events-none absolute inset-x-0 -inset-y-12 -z-1 [mask-image:radial-gradient(ellipse_50%_55%_at_50%_50%,#000_25%,transparent_80%)]"
|
|
556
|
+
/>
|
|
557
|
+
<Wordmark href="#home" mark={<AcmeMark />} size={24}>
|
|
558
|
+
Acme
|
|
559
|
+
</Wordmark>
|
|
560
|
+
<div className={`relative w-full max-w-xl ${move ? "mt-14 @3xl:mt-0" : ""}`}>
|
|
561
|
+
{move && (
|
|
562
|
+
<>
|
|
563
|
+
{/* On a phone: on the card's top edge, at its end, turned towards the step. */}
|
|
564
|
+
<Tippy
|
|
565
|
+
move={move}
|
|
566
|
+
facing="left"
|
|
567
|
+
scale={1}
|
|
568
|
+
className="pointer-events-none absolute end-2 bottom-[calc(100%-1px)] @3xl:hidden"
|
|
569
|
+
/>
|
|
570
|
+
{/* With room: beside the card, standing where it stands, turned towards it. */}
|
|
571
|
+
<Tippy
|
|
572
|
+
move={move}
|
|
573
|
+
scale={1.5}
|
|
574
|
+
className="pointer-events-none absolute right-[calc(100%-52px)] bottom-0 hidden @3xl:block"
|
|
575
|
+
/>
|
|
576
|
+
</>
|
|
577
|
+
)}
|
|
578
|
+
<Card className="w-full">{children}</Card>
|
|
579
|
+
</div>
|
|
580
|
+
<p className="m-0 max-w-xs text-center text-13 leading-normal text-muted-foreground">
|
|
581
|
+
Joining a team that already uses it? Ask them for an invitation instead.
|
|
582
|
+
</p>
|
|
583
|
+
</div>
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The setup on the page, with no card: the logo and a hairline over two columns, the steps
|
|
589
|
+
* stacked on the left and the current step beside them; on a phone, the step in mono over a
|
|
590
|
+
* track, then the step.
|
|
591
|
+
*/
|
|
592
|
+
function PageStage({
|
|
593
|
+
stepper,
|
|
594
|
+
children,
|
|
595
|
+
}: {
|
|
596
|
+
stepper: (props: { orientation: "horizontal" | "vertical" }) => React.ReactNode;
|
|
597
|
+
children: React.ReactNode;
|
|
598
|
+
}) {
|
|
599
|
+
return (
|
|
600
|
+
<div className="@container mx-auto w-full max-w-[51rem]">
|
|
601
|
+
<div className="flex flex-col gap-8">
|
|
602
|
+
<div className="flex flex-wrap items-baseline justify-between gap-x-6 gap-y-2 border-b border-border/60 pb-5">
|
|
603
|
+
<Wordmark href="#home" mark={<AcmeMark />} size={24}>
|
|
604
|
+
Acme
|
|
605
|
+
</Wordmark>
|
|
606
|
+
<p className="m-0 font-mono text-12 text-muted-foreground">Workspace setup</p>
|
|
607
|
+
</div>
|
|
608
|
+
<div className="grid gap-8 @3xl:grid-cols-[12rem_minmax(0,1fr)] @3xl:gap-12">
|
|
609
|
+
<div className="@3xl:hidden">{stepper({ orientation: "horizontal" })}</div>
|
|
610
|
+
<div className="hidden @3xl:block @3xl:border-e @3xl:border-border/60 @3xl:pe-8">
|
|
611
|
+
{stepper({ orientation: "vertical" })}
|
|
612
|
+
</div>
|
|
613
|
+
<div className="flex max-w-xl min-w-0 flex-col gap-8">{children}</div>
|
|
614
|
+
</div>
|
|
615
|
+
<p className="m-0 border-t border-border/60 pt-5 text-13 leading-normal text-muted-foreground">
|
|
616
|
+
Joining a team that already uses it? Ask them for an invitation instead.
|
|
617
|
+
</p>
|
|
618
|
+
</div>
|
|
619
|
+
</div>
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function OnboardingFlow({
|
|
624
|
+
initialStep = 0,
|
|
625
|
+
initialSetup = emptySetup,
|
|
626
|
+
layout = "card",
|
|
627
|
+
guide = false,
|
|
628
|
+
}: {
|
|
629
|
+
initialStep?: number;
|
|
630
|
+
initialSetup?: Setup;
|
|
631
|
+
/** `card`: the setup in a 20px card under the logo. `page`: on the page, under hairlines. */
|
|
632
|
+
layout?: "card" | "page";
|
|
633
|
+
/** Tippy beside the card, reacting to each step. */
|
|
634
|
+
guide?: boolean;
|
|
635
|
+
}) {
|
|
636
|
+
const [step, setStep] = React.useState(initialStep);
|
|
637
|
+
const [setup, setSetup] = React.useState(initialSetup);
|
|
638
|
+
const [errors, setErrors] = React.useState<Errors>({});
|
|
639
|
+
const [pending, setPending] = React.useState(false);
|
|
640
|
+
// Which way the last move went; null until the first one, so the first step does not animate in.
|
|
641
|
+
const [direction, setDirection] = React.useState<keyof typeof stepEntrance | null>(null);
|
|
642
|
+
const rootRef = React.useRef<HTMLDivElement>(null);
|
|
643
|
+
const done = step >= steps.length;
|
|
644
|
+
|
|
645
|
+
const update = (patch: Partial<Setup>) => setSetup((s) => ({ ...s, ...patch }));
|
|
646
|
+
const go = (next: number) => {
|
|
647
|
+
setDirection(next >= step ? "forward" : "back");
|
|
648
|
+
setStep(next);
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
// A new step moves focus to its heading, so screen readers start reading from there.
|
|
652
|
+
React.useEffect(() => {
|
|
653
|
+
if (!direction) return;
|
|
654
|
+
rootRef.current?.querySelector<HTMLElement>("[data-step-heading]")?.focus();
|
|
655
|
+
}, [step]);
|
|
656
|
+
|
|
657
|
+
const props: StepProps = {
|
|
658
|
+
setup,
|
|
659
|
+
update,
|
|
660
|
+
errors,
|
|
661
|
+
clearError: (name) =>
|
|
662
|
+
setErrors((e) => {
|
|
663
|
+
if (!(name in e)) return e;
|
|
664
|
+
const next = { ...e };
|
|
665
|
+
delete next[name];
|
|
666
|
+
return next;
|
|
667
|
+
}),
|
|
668
|
+
onBack: () => go(step - 1),
|
|
669
|
+
onNext: () => go(step + 1),
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
// Where people are: the step in mono over a track that fills as they go, or the steps stacked.
|
|
673
|
+
// A server error on the address marks the first step.
|
|
674
|
+
const stepper = ({ orientation = "horizontal" }: { orientation?: "horizontal" | "vertical" } = {}) => (
|
|
675
|
+
<Stepper
|
|
676
|
+
compact={orientation === "horizontal"}
|
|
677
|
+
orientation={orientation}
|
|
678
|
+
steps={steps.map((s, i) => (i === 0 && errors.slug ? { ...s, error: errors.slug } : s))}
|
|
679
|
+
value={step}
|
|
680
|
+
aria-label="Workspace setup"
|
|
681
|
+
/>
|
|
682
|
+
);
|
|
683
|
+
|
|
684
|
+
const page = layout === "page";
|
|
685
|
+
const body = done ? (
|
|
686
|
+
<Created
|
|
687
|
+
key="created"
|
|
688
|
+
className={direction ? stepEntrance[direction] : undefined}
|
|
689
|
+
setup={setup}
|
|
690
|
+
onRestart={() => {
|
|
691
|
+
setSetup(emptySetup);
|
|
692
|
+
setErrors({});
|
|
693
|
+
go(0);
|
|
694
|
+
}}
|
|
695
|
+
/>
|
|
696
|
+
) : (
|
|
697
|
+
<>
|
|
698
|
+
<CardHeader>
|
|
699
|
+
<CardTitle
|
|
700
|
+
render={<h2 />}
|
|
701
|
+
tabIndex={-1}
|
|
702
|
+
data-step-heading
|
|
703
|
+
className={`outline-none ${page ? "text-28 sm:text-32" : ""}`}
|
|
704
|
+
>
|
|
705
|
+
{copy[step]!.title}
|
|
706
|
+
</CardTitle>
|
|
707
|
+
<CardDescription>{copy[step]!.description}</CardDescription>
|
|
708
|
+
</CardHeader>
|
|
709
|
+
{/* Keyed by step, so each step's body mounts afresh and plays its entrance once. */}
|
|
710
|
+
<div key={step} className={direction ? stepEntrance[direction] : undefined}>
|
|
711
|
+
{step === 0 && <WorkspaceStep {...props} />}
|
|
712
|
+
{step === 1 && <TeamStep {...props} />}
|
|
713
|
+
{step === 2 && <PreferencesStep {...props} />}
|
|
714
|
+
{step === 3 && (
|
|
715
|
+
<ReviewStep
|
|
716
|
+
{...props}
|
|
717
|
+
onEdit={go}
|
|
718
|
+
onCreated={() => go(steps.length)}
|
|
719
|
+
onPendingChange={setPending}
|
|
720
|
+
onTaken={(error) => {
|
|
721
|
+
setErrors({ slug: error });
|
|
722
|
+
go(0);
|
|
723
|
+
}}
|
|
724
|
+
/>
|
|
725
|
+
)}
|
|
726
|
+
</div>
|
|
727
|
+
</>
|
|
728
|
+
);
|
|
729
|
+
|
|
730
|
+
if (page)
|
|
731
|
+
return (
|
|
732
|
+
<div ref={rootRef} className="w-full">
|
|
733
|
+
<PageStage stepper={stepper}>{body}</PageStage>
|
|
734
|
+
</div>
|
|
735
|
+
);
|
|
736
|
+
|
|
737
|
+
return (
|
|
738
|
+
<Stage
|
|
739
|
+
move={guide ? tippyMove({ step, done, pending, refused: step === 0 && !!errors.slug }) : undefined}
|
|
740
|
+
>
|
|
741
|
+
<div ref={rootRef} className="flex flex-col gap-8">
|
|
742
|
+
{stepper()}
|
|
743
|
+
{body}
|
|
744
|
+
</div>
|
|
745
|
+
</Stage>
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export function Onboarding() {
|
|
750
|
+
return <OnboardingFlow />;
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
A notes app's first run: four steps in one 20px card under the logo, on a fading `blueprint` grid.
|
|
755
|
+
|
|
756
|
+
1. **Workspace** — a name and an address that follows it.
|
|
757
|
+
2. **Team** — up to five optional invites.
|
|
758
|
+
3. **Preferences** — first use, weekly summary.
|
|
759
|
+
4. **Review** — each answer with a change link.
|
|
760
|
+
|
|
761
|
+
## Usage
|
|
762
|
+
|
|
763
|
+
```tsx
|
|
764
|
+
import {
|
|
765
|
+
Button,
|
|
766
|
+
Card,
|
|
767
|
+
CardHeader,
|
|
768
|
+
CardTitle,
|
|
769
|
+
Field,
|
|
770
|
+
FieldLabel,
|
|
771
|
+
Form,
|
|
772
|
+
FormActions,
|
|
773
|
+
Input,
|
|
774
|
+
Stepper,
|
|
775
|
+
} from "@zonsh/ui";
|
|
776
|
+
|
|
777
|
+
const steps = [
|
|
778
|
+
{ id: "workspace", title: "Workspace" },
|
|
779
|
+
{ id: "team", title: "Team" },
|
|
780
|
+
{ id: "preferences", title: "Preferences" },
|
|
781
|
+
{ id: "review", title: "Review" },
|
|
782
|
+
];
|
|
783
|
+
|
|
784
|
+
const [step, setStep] = React.useState(0);
|
|
785
|
+
|
|
786
|
+
<Card className="w-full max-w-xl">
|
|
787
|
+
<Stepper compact steps={steps} value={step} aria-label="Workspace setup" />
|
|
788
|
+
<CardHeader>
|
|
789
|
+
<CardTitle render={<h2 />} tabIndex={-1}>
|
|
790
|
+
Name your workspace
|
|
791
|
+
</CardTitle>
|
|
792
|
+
</CardHeader>
|
|
793
|
+
<Form onFormSubmit={() => setStep(1)}>
|
|
794
|
+
<Field name="name">
|
|
795
|
+
<FieldLabel>Workspace name</FieldLabel>
|
|
796
|
+
<Input required minLength={2} value={name} onValueChange={setName} />
|
|
797
|
+
</Field>
|
|
798
|
+
<FormActions align="between">
|
|
799
|
+
<Button type="button" variant="ghost" onClick={() => setStep(step - 1)}>
|
|
800
|
+
Back
|
|
801
|
+
</Button>
|
|
802
|
+
<Button type="submit">Continue</Button>
|
|
803
|
+
</FormActions>
|
|
804
|
+
</Form>
|
|
805
|
+
</Card>;
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
- `Stepper compact` — "02 / 04 · Team" over a track.
|
|
809
|
+
- `Form onFormSubmit` — runs only when the step is valid.
|
|
810
|
+
- `FormActions align="between"` — Back left, primary right.
|
|
811
|
+
|
|
812
|
+
Keep all answers in one object above the steps so nothing is lost going back or via the review's "Change" links. Steps validate with native constraints plus checks for a repeated address and the missing choice. Nothing is sent; give the address `taken` to see a server error sent back to step one, on the address field, selected.
|
|
813
|
+
|
|
814
|
+
The header and Stepper stay put; only the body changes, fading in from the end of the line on Continue and from the start on Back (mirrored right to left). Key the body by step so it mounts afresh with that one entrance — nothing leaves, nothing inside is staggered — and focus moves to the new step's heading.
|
|
815
|
+
|
|
816
|
+
## When to use
|
|
817
|
+
|
|
818
|
+
- Setup after sign-up, when a few answers make the product useful.
|
|
819
|
+
- Ask only what changes the first screen; the rest is Settings.
|
|
820
|
+
- One or two questions: one form, no stepper.
|
|
821
|
+
- A long one-off form: sections on one page.
|
|
822
|
+
|
|
823
|
+
## Examples
|
|
824
|
+
|
|
825
|
+
### With Tippy
|
|
826
|
+
|
|
827
|
+
Tippy reacts to each step beside the card, silent and hidden from screen readers. See [Tippy](tippy.md).
|
|
828
|
+
|
|
829
|
+
```tsx
|
|
830
|
+
import { Button, Card, CardDescription, CardHeader, CardTitle, Field, FieldDescription, FieldError, FieldItem, FieldLabel, Fieldset, FieldsetLegend, Form, FormActions, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, Radio, RadioGroup, Separator, Stepper, Switch } from "@zonsh/ui";
|
|
831
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
832
|
+
import { Tippy, type TippyMove } from "@zonsh/ui/tippy";
|
|
833
|
+
import { ArrowLeftIcon, CheckIcon, PlusIcon, XIcon } from "lucide-react";
|
|
834
|
+
import * as React from "react";
|
|
835
|
+
|
|
836
|
+
// AcmeMark, LATENCY, TAKEN_SLUG, MAX_INVITES, DOMAIN, Errors, Setup, emptySetup, steps, uses, slugify, useWait, SubmitButton, BackButton, StepProps, WorkspaceStep, TeamStep, PreferencesStep, ReviewStep, Created, stepEntrance, copy, tippyMove, Stage, PageStage, OnboardingFlow: as in the first example on this page that uses them.
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* The same setup with Tippy beside the card. It stays where it stands and reacts to the step:
|
|
840
|
+
* it waves at the start, thinks over the review and hops with a check when the workspace is made.
|
|
841
|
+
*/
|
|
842
|
+
export function WithTippy() {
|
|
843
|
+
return <OnboardingFlow guide />;
|
|
844
|
+
}
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
### On the page
|
|
848
|
+
|
|
849
|
+
No card, steps down the left, for a setup that is the whole screen.
|
|
850
|
+
|
|
851
|
+
```tsx
|
|
852
|
+
import { Button, Card, CardDescription, CardHeader, CardTitle, Field, FieldDescription, FieldError, FieldItem, FieldLabel, Fieldset, FieldsetLegend, Form, FormActions, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, Radio, RadioGroup, Separator, Stepper, Switch } from "@zonsh/ui";
|
|
853
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
854
|
+
import { Tippy, type TippyMove } from "@zonsh/ui/tippy";
|
|
855
|
+
import { ArrowLeftIcon, CheckIcon, PlusIcon, XIcon } from "lucide-react";
|
|
856
|
+
import * as React from "react";
|
|
857
|
+
|
|
858
|
+
// AcmeMark, LATENCY, TAKEN_SLUG, MAX_INVITES, DOMAIN, Errors, Setup, emptySetup, steps, uses, slugify, useWait, SubmitButton, BackButton, StepProps, WorkspaceStep, TeamStep, PreferencesStep, ReviewStep, Created, stepEntrance, copy, tippyMove, Stage, PageStage, OnboardingFlow: as in the first example on this page that uses them.
|
|
859
|
+
|
|
860
|
+
/** The same setup on the page, with no card: the steps stacked beside the current one, under hairlines. */
|
|
861
|
+
export function OnThePage() {
|
|
862
|
+
return <OnboardingFlow layout="page" />;
|
|
863
|
+
}
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
## The parts
|
|
867
|
+
|
|
868
|
+
| Part | Page | Job |
|
|
869
|
+
| ---------------------- | ------------------- | ----------------------------------------------------------------------- |
|
|
870
|
+
| `Stepper` | Stepper | Where people are: the step in mono over a track that fills as they go |
|
|
871
|
+
| `Card` | Cards | The 20px object the setup sits in, with its own padding |
|
|
872
|
+
| `Form`, `Field` | Form, Field | Each step's validation, errors by field name, and the actions row |
|
|
873
|
+
| `InputGroup` | Input Group | The address with the domain as a mono prefix |
|
|
874
|
+
| `RadioGroup`, `Switch` | Radio Group, Switch | The first use, one of three; the weekly summary, on or off |
|
|
875
|
+
| `Button` | Button | Back (ghost) and the one primary per step; "Change" links on the review |
|
|
876
|
+
| `Spinner` | Spinner | The pending "Create workspace", laid over the label to keep the width |
|
|
877
|
+
| `Wordmark` | Logo | Your product's mark and name above the card — replace "Acme" with yours |
|
|
878
|
+
| `Tippy` | Tippy | With Tippy: the mascot beside the card, a move per step |
|
|
879
|
+
|
|
880
|
+
## Brand rules
|
|
881
|
+
|
|
882
|
+
- **Do** keep one primary per step, on the right; Back is ghost, left.
|
|
883
|
+
- **Do** name the last primary "Create workspace", not "Finish".
|
|
884
|
+
- **Do** let people skip optional steps, and say so.
|
|
885
|
+
- **Do** put a server error on the field it is about, even on an earlier step.
|
|
886
|
+
- **Don't** let people move past a step before it is valid.
|
|
887
|
+
- **Don't** disable Continue; show what is missing on press.
|
|
888
|
+
- **Don't** add promises or numbers; say what each step is for.
|
|
889
|
+
|
|
890
|
+
## Accessibility
|
|
891
|
+
|
|
892
|
+
- The stepper's track is a progress bar labelled "02 / 04 · Team", read as "Step 2 of 4". When the server refuses the address, the first step is marked "Needs attention" too.
|
|
893
|
+
- Moving to a step moves focus to its heading, so screen readers start from the top.
|
|
894
|
+
- Every control has a visible label or legend; invite fields are named "Teammate 2, email", remove buttons "Remove teammate 2". Removing one moves focus to the field taking its place.
|
|
895
|
+
- Errors are linked to their field and shown in words as well as red; focus moves to the first field with one, the missing choice included, shown on the radio group's legend.
|
|
896
|
+
- The pending submit is `aria-busy`, with a spinner labelled "Creating your workspace"; "Workspace created" is a `role="status"` line.
|