@zonsh/ui 0.4.1 → 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 +7 -7
- 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/ascii-field.js +2 -1
- 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 +389 -24
- 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 +64 -8
- 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 +38 -1
- package/dist/components/chart.js +27 -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 +4 -4
- 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 +37 -12
- 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 +77 -16
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +8 -6
- 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 +190 -28
- package/dist/components/illustration.js +53 -31
- package/dist/components/input-group.d.ts +6 -11
- package/dist/components/input-group.js +21 -19
- 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/layout.d.ts +2 -1
- package/dist/components/layout.js +55 -11
- package/dist/components/lightbox.d.ts +76 -9
- package/dist/components/lightbox.js +354 -48
- 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 +153 -31
- package/dist/components/message.d.ts +62 -11
- package/dist/components/message.js +51 -14
- 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 -10
- package/dist/components/number-field.d.ts +2 -9
- package/dist/components/number-field.js +90 -26
- 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 +35 -17
- 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 +8 -3
- 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 +4 -3
- package/dist/components/response.js +39 -15
- 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 +90 -31
- package/dist/components/site-header.d.ts +18 -13
- package/dist/components/site-header.js +26 -9
- package/dist/components/skeleton.d.ts +18 -8
- package/dist/components/skeleton.js +23 -8
- package/dist/components/slider.js +2 -2
- package/dist/components/sortable.d.ts +55 -4
- package/dist/components/sortable.js +187 -94
- 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 +13 -7
- package/dist/components/table.js +124 -23
- package/dist/components/tabs.js +15 -8
- 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 +50 -7
- package/dist/components/theme.js +168 -12
- package/dist/components/time-field.d.ts +6 -10
- package/dist/components/time-field.js +19 -9
- 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 +17 -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 +8 -3
- package/dist/components/toolbar.d.ts +57 -4
- package/dist/components/toolbar.js +219 -16
- package/dist/components/tooltip.d.ts +5 -3
- package/dist/components/tooltip.js +14 -6
- package/dist/components/tour.d.ts +1 -1
- package/dist/components/tour.js +70 -24
- package/dist/components/tree.js +33 -10
- 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 +182 -225
- 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 +10 -4
- package/dist/lib/glide.js +14 -5
- 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 +4 -3
- package/dist/lib/table-fit.js +92 -25
- 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 +75 -77
- 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 -193
- package/dist/styles/material.css +177 -31
- package/dist/styles/parts/ai.css +20 -14
- package/dist/styles/parts/brand.css +2 -2
- package/dist/styles/parts/controls.css +51 -38
- package/dist/styles/parts/data.css +43 -11
- package/dist/styles/parts/editor.css +372 -0
- package/dist/styles/parts/feedback.css +75 -15
- 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 +237 -25
- package/dist/styles/parts/overlays.css +110 -8
- package/dist/styles/parts/pdf.css +15 -9
- package/dist/styles/pdf.css +3 -0
- package/dist/styles/prose.css +3 -0
- package/dist/styles/tokens.css +105 -15
- 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,303 @@
|
|
|
1
|
+
# Site header
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Button, SiteHeader, ThemeProvider, ThemeToggle } from "@zonsh/ui";
|
|
5
|
+
import { Logo } from "@zonsh/ui/brand";
|
|
6
|
+
|
|
7
|
+
const links = [
|
|
8
|
+
{ label: "Licht", href: "#licht" },
|
|
9
|
+
{ label: "Gallery", href: "#gallery" },
|
|
10
|
+
{ label: "UI", href: "#ui", current: true },
|
|
11
|
+
{ label: "Brand", href: "#brand" },
|
|
12
|
+
{ label: "Contact", href: "#contact" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function Actions() {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<Button
|
|
19
|
+
variant="ghost"
|
|
20
|
+
size="sm"
|
|
21
|
+
className="font-mono text-[13px] font-normal"
|
|
22
|
+
lang="de"
|
|
23
|
+
title="Deutsch"
|
|
24
|
+
>
|
|
25
|
+
DE
|
|
26
|
+
</Button>
|
|
27
|
+
<ThemeToggle />
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Each demo brings its own `ThemeProvider` so the toggle works on its own; in an app the provider
|
|
34
|
+
* sits once at the root, and the header only holds the `ThemeToggle`.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
export function Default() {
|
|
38
|
+
return (
|
|
39
|
+
<ThemeProvider>
|
|
40
|
+
<SiteHeader
|
|
41
|
+
logo={<Logo variant="compact" href="#top" />}
|
|
42
|
+
links={links}
|
|
43
|
+
actions={<Actions />}
|
|
44
|
+
className="relative"
|
|
45
|
+
/>
|
|
46
|
+
</ThemeProvider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A site's sticky top bar: your logo, Licht Sans links, a hairline divider and actions. Transparent at the top, it takes the page ground and a hairline once scrolled. Below 48rem (768px) of its own width the links move into a full-height menu panel — narrow the frame to see it.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { SiteHeader, ThemeToggle } from "@zonsh/ui";
|
|
57
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
58
|
+
|
|
59
|
+
<SiteHeader
|
|
60
|
+
// Your product's mark and name — not zon's Logo.
|
|
61
|
+
logo={
|
|
62
|
+
<Wordmark href="/" mark={<img src="/mark.svg" alt="" />}>
|
|
63
|
+
Acme
|
|
64
|
+
</Wordmark>
|
|
65
|
+
}
|
|
66
|
+
links={[
|
|
67
|
+
{ label: "Product", href: "/product" },
|
|
68
|
+
{ label: "Docs", href: "/docs" },
|
|
69
|
+
{ label: "Pricing", href: "/pricing" },
|
|
70
|
+
]}
|
|
71
|
+
actions={<ThemeToggle />}
|
|
72
|
+
/>;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- `logo` — your home link: your own mark and name.
|
|
76
|
+
- `links` — `{ label, href }`, or `{ label, items }` for a dropdown panel.
|
|
77
|
+
- `actions` — locale, theme, at most one call to action as a `secondary` or `ghost` button ("Sign in"), never the primary: the page's one primary is in its opening view. In the menu panel on phones.
|
|
78
|
+
|
|
79
|
+
**The logo slot is your product's:** `<Wordmark mark={<YourMark />}>Your name</Wordmark>` (see [Logo](logo.md)), never zon's crescent.
|
|
80
|
+
|
|
81
|
+
**`SiteHeader` is a pattern on `NavigationMenu`:** the links and panels are its parts; SiteHeader adds the slots, scroll treatment and mobile panel.
|
|
82
|
+
|
|
83
|
+
## How it behaves
|
|
84
|
+
|
|
85
|
+
- **Scroll.** The ground is the page's own (with `brand.css`, its grain and light, lined up), so content passes under the bar, not through a band. It fades in over the bar's height of scroll, solid before content reaches it.
|
|
86
|
+
- **Phone panel.** A Base UI `Dialog`: large Licht links, mono indices, dropdown pages listed under each. Links rise 8px, 30ms apart, all in within 300ms, tappable at once.
|
|
87
|
+
- **Container query.** It measures its own width, so it switches in a narrow column too.
|
|
88
|
+
- **Right to left.** The bar mirrors; the portalled panel takes its direction from the `DirectionProvider` (or the header's `dir`).
|
|
89
|
+
|
|
90
|
+
## When to use
|
|
91
|
+
|
|
92
|
+
- Every marketing and content page, once. Sections grouping pages take `items`.
|
|
93
|
+
- Compose `NavigationMenu` yourself only for a header this can't express — then you own the mobile panel.
|
|
94
|
+
|
|
95
|
+
## Examples
|
|
96
|
+
|
|
97
|
+
### With dropdowns
|
|
98
|
+
|
|
99
|
+
Each of `items` takes an optional one-line `description`. In the mobile panel they are listed under their section.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { Button, SiteHeader, type SiteHeaderLink, ThemeProvider, ThemeToggle } from "@zonsh/ui";
|
|
103
|
+
import { Logo } from "@zonsh/ui/brand";
|
|
104
|
+
|
|
105
|
+
// links, Actions: as in the first example on this page that uses them.
|
|
106
|
+
|
|
107
|
+
const linksWithPanels: SiteHeaderLink[] = [
|
|
108
|
+
{
|
|
109
|
+
label: "Made here",
|
|
110
|
+
items: [
|
|
111
|
+
{ label: "Licht", href: "#licht", description: "The typeface: set Light, for headlines." },
|
|
112
|
+
{ label: "Gallery", href: "#gallery", description: "zon.sh/gallery." },
|
|
113
|
+
{ label: "zon/ui", href: "#ui", description: "The components this page is made of." },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: "Elsewhere",
|
|
118
|
+
items: [
|
|
119
|
+
{ label: "openpanel", href: "#openpanel", description: "openpanel.app" },
|
|
120
|
+
{ label: "eigenpair", href: "#eigenpair", description: "eigenpair.com" },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{ label: "UI", href: "#ui", current: true },
|
|
124
|
+
{ label: "Contact", href: "#contact" },
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
export function WithDropdowns() {
|
|
128
|
+
return (
|
|
129
|
+
<ThemeProvider>
|
|
130
|
+
<SiteHeader
|
|
131
|
+
logo={<Logo variant="compact" href="#top" />}
|
|
132
|
+
links={linksWithPanels}
|
|
133
|
+
actions={<Actions />}
|
|
134
|
+
className="relative"
|
|
135
|
+
/>
|
|
136
|
+
</ThemeProvider>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Links at the start
|
|
142
|
+
|
|
143
|
+
`align="start"` puts links after the logo, actions alone at the end — an app bar. With `menu={false}`, links leave the bar below 48rem and actions stay, for an app with its own tab bar on phones.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { Avatar, Button, SiteHeader, ThemeProvider } from "@zonsh/ui";
|
|
147
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
148
|
+
import { SearchIcon } from "lucide-react";
|
|
149
|
+
|
|
150
|
+
// links: as in the first example on this page that uses them.
|
|
151
|
+
|
|
152
|
+
/** Your product's mark — a placeholder for "Acme". Replace it and the name with your own; never zon's Logo. */
|
|
153
|
+
function AcmeMark() {
|
|
154
|
+
return (
|
|
155
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round">
|
|
156
|
+
<path d="M3.5 20.5 12 3.5l8.5 17z" />
|
|
157
|
+
<path d="M8 14.5h8" />
|
|
158
|
+
</svg>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* An app's sections. */
|
|
163
|
+
const sections = [
|
|
164
|
+
{ label: "Home", href: "#home", current: true },
|
|
165
|
+
{ label: "Series", href: "#series" },
|
|
166
|
+
{ label: "Films", href: "#films" },
|
|
167
|
+
{ label: "My list", href: "#list" },
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
/** Links beside the logo, with search and the account on their own at the end. */
|
|
171
|
+
export function LinksAtStart() {
|
|
172
|
+
return (
|
|
173
|
+
<ThemeProvider>
|
|
174
|
+
<SiteHeader
|
|
175
|
+
align="start"
|
|
176
|
+
logo={
|
|
177
|
+
<Wordmark href="#top" mark={<AcmeMark />}>
|
|
178
|
+
Acme
|
|
179
|
+
</Wordmark>
|
|
180
|
+
}
|
|
181
|
+
links={sections}
|
|
182
|
+
actions={
|
|
183
|
+
<>
|
|
184
|
+
<Button variant="ghost" size="icon" aria-label="Search">
|
|
185
|
+
<SearchIcon />
|
|
186
|
+
</Button>
|
|
187
|
+
<Avatar name="Mara Lindqvist" />
|
|
188
|
+
</>
|
|
189
|
+
}
|
|
190
|
+
className="relative"
|
|
191
|
+
/>
|
|
192
|
+
</ThemeProvider>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Actions that stay on phones
|
|
198
|
+
|
|
199
|
+
On a phone `actions` move into the panel; `pinned` (a cart, the account, sign in) stays in the bar beside the menu button. The logo is a placeholder brand.
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
import { Badge, BadgeAnchor, Button, SiteHeader, ThemeProvider, ThemeToggle } from "@zonsh/ui";
|
|
203
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
204
|
+
import { ShoppingBagIcon } from "lucide-react";
|
|
205
|
+
|
|
206
|
+
// AcmeMark, links: as in the first example on this page that uses them.
|
|
207
|
+
|
|
208
|
+
/* A shop's sections. */
|
|
209
|
+
const shop = [
|
|
210
|
+
{ label: "Coffee", href: "#coffee", current: true },
|
|
211
|
+
{ label: "Brewing", href: "#brewing" },
|
|
212
|
+
{ label: "Subscriptions", href: "#subscriptions" },
|
|
213
|
+
{ label: "Visit us", href: "#visit" },
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
/** A shop: the theme toggle folds into the menu on a phone, the cart stays in the bar. */
|
|
217
|
+
export function PinnedActions() {
|
|
218
|
+
return (
|
|
219
|
+
<ThemeProvider>
|
|
220
|
+
<SiteHeader
|
|
221
|
+
logo={
|
|
222
|
+
<Wordmark href="#top" mark={<AcmeMark />}>
|
|
223
|
+
Acme
|
|
224
|
+
</Wordmark>
|
|
225
|
+
}
|
|
226
|
+
links={shop}
|
|
227
|
+
actions={<ThemeToggle />}
|
|
228
|
+
pinned={
|
|
229
|
+
<BadgeAnchor>
|
|
230
|
+
<Button variant="ghost" size="icon" aria-label="Cart, 2 items">
|
|
231
|
+
<ShoppingBagIcon />
|
|
232
|
+
</Button>
|
|
233
|
+
<Badge count={2} aria-hidden />
|
|
234
|
+
</BadgeAnchor>
|
|
235
|
+
}
|
|
236
|
+
className="relative"
|
|
237
|
+
/>
|
|
238
|
+
</ThemeProvider>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Scrolled
|
|
244
|
+
|
|
245
|
+
Forced with `scrolled`, for pages without a hero.
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import { Button, SiteHeader, ThemeProvider, ThemeToggle } from "@zonsh/ui";
|
|
249
|
+
import { Logo } from "@zonsh/ui/brand";
|
|
250
|
+
|
|
251
|
+
// links, Actions: as in the first example on this page that uses them.
|
|
252
|
+
|
|
253
|
+
export function Scrolled() {
|
|
254
|
+
return (
|
|
255
|
+
<ThemeProvider>
|
|
256
|
+
<SiteHeader
|
|
257
|
+
scrolled
|
|
258
|
+
logo={<Logo variant="compact" href="#top" />}
|
|
259
|
+
links={links}
|
|
260
|
+
actions={<Actions />}
|
|
261
|
+
className="relative"
|
|
262
|
+
/>
|
|
263
|
+
</ThemeProvider>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Props
|
|
269
|
+
|
|
270
|
+
| Prop | Type | Default |
|
|
271
|
+
| ----------------- | ------------------------------------------------------------------------------------- | -------- |
|
|
272
|
+
| `logo` | `ReactNode` — your home link: `<Wordmark>` with your mark and name | required |
|
|
273
|
+
| `links` | `{ label; href?; current?; items?; render? }[]` — `href` or `items` | required |
|
|
274
|
+
| `actions` | `ReactNode` — locale, theme, one secondary CTA at most; in the menu panel on phones | — |
|
|
275
|
+
| `pinned` | `ReactNode` — a cart, the account: stays in the bar at every width | — |
|
|
276
|
+
| `scrolled` | `boolean` — force the scrolled treatment, e.g. for a page that scrolls in a container | auto |
|
|
277
|
+
| `scrollThreshold` | `number` (px) | `8` |
|
|
278
|
+
| `labels` | `{ nav?, openMenu?, closeMenu?, menu? }` — the `<nav>`'s name and the phone menu's | English |
|
|
279
|
+
| `align` | `"start" \| "end"` — the links beside the logo, or with the actions at the end | `"end"` |
|
|
280
|
+
| `menu` | `boolean` — `false`: no phone menu; the actions stay in the bar at every width | `true` |
|
|
281
|
+
|
|
282
|
+
Each of `items` is `{ label; href; description?; current?; render? }`. `render` takes a router link (`<Link to="/pricing" />`) so the entry navigates client-side, in the bar and the mobile panel alike. Other `<header>` props are forwarded. Data attributes: `data-scrolled` once scrolled. Slots: `site-header-logo`, `site-header-actions`, `site-header-pinned`. Defaults come from `messages.siteHeader` (`nav`, `openMenu`, `closeMenu`, `menu`); `labels` wins over them.
|
|
283
|
+
|
|
284
|
+
## Brand rules
|
|
285
|
+
|
|
286
|
+
- **Do** keep to about five top-level links, named for what people look for: Product, Docs, Pricing.
|
|
287
|
+
- **Do** keep the actions slot quiet: locale ("DE"), theme toggle, at most one CTA, `secondary` or `ghost`. The header never holds the page's primary.
|
|
288
|
+
- **Do** pin only one or two controls needed on every page (cart, account).
|
|
289
|
+
- **Don't** put zon's `Logo` in another product's header.
|
|
290
|
+
- **Don't** give the bar a background or shadow at the top; it earns its ground on scroll.
|
|
291
|
+
- **Don't** set the links in Licht Mono or uppercase; navigation is Licht Sans, mixed case, like every other control.
|
|
292
|
+
|
|
293
|
+
## Accessibility
|
|
294
|
+
|
|
295
|
+
- Links live in a `<nav>` with an accessible name; `current` sets `aria-current="page"`.
|
|
296
|
+
- The menu and close buttons have accessible names; the panel is a modal dialog with a hidden title, focus trap and Escape to close.
|
|
297
|
+
- Choosing a link in the panel closes it, and so does growing the viewport into the desktop layout.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
- Import: `import { SiteHeader } from "@zonsh/ui"`
|
|
302
|
+
- Source: `packages/ui/src/components/site-header.tsx`
|
|
303
|
+
- Primitive: `@base-ui/react/navigation-menu` (Base UI docs: `node_modules/@base-ui/react/docs/react/components/navigation-menu.md`)
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Skeleton } from "@zonsh/ui";
|
|
5
|
+
|
|
6
|
+
export function Basic() {
|
|
7
|
+
return (
|
|
8
|
+
<div className="flex w-full max-w-sm items-center gap-3" aria-busy="true">
|
|
9
|
+
<span className="sr-only">Loading team member…</span>
|
|
10
|
+
<Skeleton shape="circle" className="size-10" />
|
|
11
|
+
{/* Each line is as tall as the line of text it stands in for: a 14px name, a 13px email. */}
|
|
12
|
+
<div className="flex flex-1 flex-col text-sm">
|
|
13
|
+
<Skeleton className="w-2/5" />
|
|
14
|
+
<Skeleton className="w-4/5 text-[13px]" />
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Holds the place of loading content: `--control-surface` with a hairline inner edge and one soft highlight sweeping every 1.6s (mirrored in RTL) on `--ease-move`; under reduced motion, a slow opacity breath. `shape` sets the radius — and for fields and buttons the 38px height — of what it stands in for.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Skeleton } from "@zonsh/ui";
|
|
27
|
+
|
|
28
|
+
<div aria-busy="true" className="flex items-center gap-3">
|
|
29
|
+
<span className="sr-only">Loading team member…</span>
|
|
30
|
+
<Skeleton shape="circle" className="size-10" />
|
|
31
|
+
<Skeleton className="w-2/5 text-sm" /> {/* one 14px line: 20px tall, the bar 14px */}
|
|
32
|
+
</div>;
|
|
33
|
+
|
|
34
|
+
<Skeleton shape="item" className="aspect-video w-full" />; // a picture: its ratio and corners
|
|
35
|
+
<Skeleton lines={3} className="text-[13px] leading-snug" />; // a paragraph, last line shorter
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- `shape` — what it stands in for: `text`, `field`, `button`, `item`, `circle`, `card`.
|
|
39
|
+
- `lines` — a paragraph of this many text lines.
|
|
40
|
+
- `className` — the text's type (`text-sm`), a width, or the media's `aspect-*`.
|
|
41
|
+
|
|
42
|
+
## A placeholder is the size of its content
|
|
43
|
+
|
|
44
|
+
- **Text lines take the line's height:** `1lh` tall, the bar `1em`. Give it the text's type (`text-sm`, `leading-snug`, `eyebrow`) or put it where the text goes — never `h-*`.
|
|
45
|
+
- **Media take the content's ratio and a shape:** `shape="item"` or `"card"` with the content's `aspect-*` or size, which wins over the line height and is painted edge to edge.
|
|
46
|
+
- **Same wrappers, same row count:** the real `Item`, `ItemTitle`, `CardTitle` or `TimelineItem` with a Skeleton inside, as many rows as will come.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Button, Item, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemSeparator, ItemTitle, Skeleton } from "@zonsh/ui";
|
|
50
|
+
import { PlayIcon } from "lucide-react";
|
|
51
|
+
import { Fragment, useEffect, useState } from "react";
|
|
52
|
+
|
|
53
|
+
const recordings = [
|
|
54
|
+
{ id: "planning", title: "Weekly planning", meta: "32 min · 4 people" },
|
|
55
|
+
{ id: "review", title: "Design review: checkout", meta: "48 min · 6 people" },
|
|
56
|
+
{ id: "onboarding", title: "Onboarding a new teammate", meta: "21 min · 2 people" },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
/** Placeholders built from the same Item parts as the rows, three of them, so nothing moves when the rows arrive. */
|
|
60
|
+
export function List() {
|
|
61
|
+
// It opens loading and stays so until asked: the skeletons are what the demo shows. Load again
|
|
62
|
+
// plays a load of 1.5s.
|
|
63
|
+
const [loading, setLoading] = useState(true);
|
|
64
|
+
const [timed, setTimed] = useState(false);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!loading || !timed) return;
|
|
67
|
+
const timer = setTimeout(() => setLoading(false), 1500);
|
|
68
|
+
return () => clearTimeout(timer);
|
|
69
|
+
}, [loading, timed]);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className="flex w-full max-w-md flex-col items-start gap-4">
|
|
73
|
+
{loading && <span className="sr-only">Loading recordings…</span>}
|
|
74
|
+
<ItemGroup render={<ul />} aria-label="Recordings" aria-busy={loading || undefined}>
|
|
75
|
+
{recordings.map((r, i) => (
|
|
76
|
+
<Fragment key={r.id}>
|
|
77
|
+
{i > 0 && <ItemSeparator />}
|
|
78
|
+
<Item size="sm" render={<li />}>
|
|
79
|
+
<ItemMedia variant="image" className="aspect-video h-auto w-20">
|
|
80
|
+
{loading ? (
|
|
81
|
+
// The picture's own ratio, and a shape: the thumbnail's 7px corners.
|
|
82
|
+
<Skeleton shape="item" className="aspect-video w-full" />
|
|
83
|
+
) : (
|
|
84
|
+
<span className="flex size-full items-center justify-center bg-field-surface text-muted-foreground">
|
|
85
|
+
<PlayIcon className="size-4" />
|
|
86
|
+
</span>
|
|
87
|
+
)}
|
|
88
|
+
</ItemMedia>
|
|
89
|
+
<ItemContent>
|
|
90
|
+
<ItemTitle>{loading ? <Skeleton className="w-40" /> : r.title}</ItemTitle>
|
|
91
|
+
<ItemDescription>{loading ? <Skeleton className="w-28" /> : r.meta}</ItemDescription>
|
|
92
|
+
</ItemContent>
|
|
93
|
+
</Item>
|
|
94
|
+
</Fragment>
|
|
95
|
+
))}
|
|
96
|
+
</ItemGroup>
|
|
97
|
+
{loading && !timed ? (
|
|
98
|
+
<Button variant="secondary" size="sm" onClick={() => setLoading(false)}>
|
|
99
|
+
Show the recordings
|
|
100
|
+
</Button>
|
|
101
|
+
) : (
|
|
102
|
+
<Button
|
|
103
|
+
variant="secondary"
|
|
104
|
+
size="sm"
|
|
105
|
+
disabled={loading}
|
|
106
|
+
onClick={() => {
|
|
107
|
+
setTimed(true);
|
|
108
|
+
setLoading(true);
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
Load again
|
|
112
|
+
</Button>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## When to use
|
|
120
|
+
|
|
121
|
+
- Content whose layout you know (a list, a card, a prefilled form). Mirror it closely.
|
|
122
|
+
- A short wait inside a control (a sending button): `Spinner`.
|
|
123
|
+
- Work with a known length (an upload): `Progress`.
|
|
124
|
+
- Nothing to load: an `Empty` state, not a skeleton that never resolves.
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Card
|
|
129
|
+
|
|
130
|
+
Lines inside a real `Card`, each taking its part's type.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { Card, CardContent, CardFooter, CardHeader, CardTitle, Skeleton } from "@zonsh/ui";
|
|
134
|
+
|
|
135
|
+
export function CardPlaceholder() {
|
|
136
|
+
return (
|
|
137
|
+
<Card className="w-full max-w-sm" aria-busy="true">
|
|
138
|
+
<span className="sr-only">Loading project…</span>
|
|
139
|
+
{/* The card's own parts, with skeletons for their text: each takes the part's type. */}
|
|
140
|
+
<CardHeader>
|
|
141
|
+
<Skeleton className="w-20 eyebrow" />
|
|
142
|
+
<CardTitle>
|
|
143
|
+
<Skeleton className="w-3/4" />
|
|
144
|
+
</CardTitle>
|
|
145
|
+
</CardHeader>
|
|
146
|
+
<CardContent>
|
|
147
|
+
<Skeleton lines={3} />
|
|
148
|
+
</CardContent>
|
|
149
|
+
<CardFooter>
|
|
150
|
+
<Skeleton shape="button" />
|
|
151
|
+
</CardFooter>
|
|
152
|
+
</Card>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Form
|
|
158
|
+
|
|
159
|
+
`shape="field"` and `shape="button"` are 38px tall with 10px and 12px corners. Use `min-h-(--control-h-sm)` for a dense form.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Skeleton } from "@zonsh/ui";
|
|
163
|
+
|
|
164
|
+
export function FormPlaceholder() {
|
|
165
|
+
return (
|
|
166
|
+
<div className="flex w-full max-w-sm flex-col gap-5" aria-busy="true">
|
|
167
|
+
<span className="sr-only">Loading form…</span>
|
|
168
|
+
{[0, 1].map((i) => (
|
|
169
|
+
<div key={i} className="flex flex-col gap-2">
|
|
170
|
+
<Skeleton className="w-24 text-sm" />
|
|
171
|
+
<Skeleton shape="field" />
|
|
172
|
+
</div>
|
|
173
|
+
))}
|
|
174
|
+
<div className="flex flex-wrap gap-3">
|
|
175
|
+
<Skeleton shape="button" className="w-36" />
|
|
176
|
+
<Skeleton shape="button" className="w-24" />
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Shapes
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { Skeleton } from "@zonsh/ui";
|
|
187
|
+
|
|
188
|
+
export function Shapes() {
|
|
189
|
+
return (
|
|
190
|
+
// Columns by the room the example has, not the screen: one per row in a narrow frame.
|
|
191
|
+
<div className="@container w-full max-w-xl">
|
|
192
|
+
<div className="grid grid-cols-1 gap-6 @2xs:grid-cols-2 @lg:grid-cols-3">
|
|
193
|
+
<div className="flex flex-col gap-2">
|
|
194
|
+
<span className="eyebrow">text</span>
|
|
195
|
+
<Skeleton lines={2} className="text-sm" />
|
|
196
|
+
</div>
|
|
197
|
+
<div className="flex flex-col gap-2">
|
|
198
|
+
<span className="eyebrow">field</span>
|
|
199
|
+
<Skeleton shape="field" />
|
|
200
|
+
</div>
|
|
201
|
+
<div className="flex flex-col gap-2">
|
|
202
|
+
<span className="eyebrow">button</span>
|
|
203
|
+
<Skeleton shape="button" />
|
|
204
|
+
</div>
|
|
205
|
+
<div className="flex flex-col gap-2">
|
|
206
|
+
<span className="eyebrow">item</span>
|
|
207
|
+
<Skeleton shape="item" className="h-[22px] w-20" />
|
|
208
|
+
</div>
|
|
209
|
+
<div className="flex flex-col gap-2">
|
|
210
|
+
<span className="eyebrow">circle</span>
|
|
211
|
+
<Skeleton shape="circle" className="size-(--icon-button)" />
|
|
212
|
+
</div>
|
|
213
|
+
<div className="flex flex-col gap-2">
|
|
214
|
+
<span className="eyebrow">card</span>
|
|
215
|
+
<Skeleton shape="card" className="aspect-video w-full" />
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Props
|
|
224
|
+
|
|
225
|
+
| Prop | Type | Default |
|
|
226
|
+
| ------- | --------------------------------------------------------------- | -------- |
|
|
227
|
+
| `shape` | `"text" \| "field" \| "button" \| "item" \| "circle" \| "card"` | `"text"` |
|
|
228
|
+
| `lines` | `number` — with `text`, a paragraph of this many lines | `1` |
|
|
229
|
+
|
|
230
|
+
| Shape | Radius | Default size |
|
|
231
|
+
| -------- | ------ | ------------------------------------------------------------- |
|
|
232
|
+
| `text` | 0 | one line (`1lh`) tall, the bar `1em` — set the width per line |
|
|
233
|
+
| `field` | 10px | 38px tall, full width |
|
|
234
|
+
| `button` | 12px | 38px tall, 112px wide |
|
|
235
|
+
| `item` | 7px | set with `className` |
|
|
236
|
+
| `circle` | round | square — set with `size-*` |
|
|
237
|
+
| `card` | 20px | set with `className` |
|
|
238
|
+
|
|
239
|
+
All `<div>` props are forwarded. A `text` Skeleton renders a block `<span>`, so it fits inside a `<p>` or heading; the others render a `<div>`. Data attributes: `data-slot="skeleton"`, `data-shape`; a `lines` paragraph is `data-slot="skeleton-lines"`.
|
|
240
|
+
|
|
241
|
+
## Brand rules
|
|
242
|
+
|
|
243
|
+
- **Do** match the radius to the thing it stands in for; never invent one.
|
|
244
|
+
- **Do** size text lines by their type, not `h-*`, and media by the content's aspect ratio with an explicit `shape`.
|
|
245
|
+
- **Do** keep the real container (a `Card`, a panel) and put skeletons inside it.
|
|
246
|
+
- **Don't** colour skeletons or add a pulse; the sweep is the motion.
|
|
247
|
+
- **Don't** show skeletons for more than a few seconds without saying what is happening.
|
|
248
|
+
|
|
249
|
+
## Accessibility
|
|
250
|
+
|
|
251
|
+
- Every `Skeleton` is `aria-hidden`. Mark the container `aria-busy="true"` with screen-reader text ("Loading team member…"); remove both on arrival.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
- Import: `import { Skeleton } from "@zonsh/ui"`
|
|
256
|
+
- Source: `packages/ui/src/components/skeleton.tsx`
|