@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,732 @@
|
|
|
1
|
+
# Scheduler
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { Avatar, Tag } from "@zonsh/ui";
|
|
5
|
+
import { Scheduler, type SchedulerItem } from "@zonsh/ui/scheduler";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
/** The demos' today: the moment the tests freeze the clock at. */
|
|
9
|
+
const today = new Date(2026, 9, 1, 10);
|
|
10
|
+
|
|
11
|
+
/** A day in October 2026 (or the months either side, with an overflowing number). */
|
|
12
|
+
const oct = (day: number, hour = 0, minute = 0) => new Date(2026, 9, day, hour, minute);
|
|
13
|
+
|
|
14
|
+
const phases = {
|
|
15
|
+
Plan: { tone: "violet", label: "Plan" },
|
|
16
|
+
Build: { tone: "blue", label: "Build" },
|
|
17
|
+
Launch: { tone: "orange", label: "Launch" },
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
type Phase = keyof typeof phases;
|
|
21
|
+
|
|
22
|
+
type Task = SchedulerItem & { owner: string; group: Phase };
|
|
23
|
+
|
|
24
|
+
const plan: Omit<Task, "tone">[] = [
|
|
25
|
+
{
|
|
26
|
+
id: "brief",
|
|
27
|
+
title: "Write the launch brief",
|
|
28
|
+
group: "Plan",
|
|
29
|
+
owner: "Maya Brandt",
|
|
30
|
+
start: oct(1),
|
|
31
|
+
end: oct(3),
|
|
32
|
+
progress: 100,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "pricing",
|
|
36
|
+
title: "Settle the prices",
|
|
37
|
+
group: "Plan",
|
|
38
|
+
owner: "Jonas Weber",
|
|
39
|
+
start: oct(2),
|
|
40
|
+
end: oct(7),
|
|
41
|
+
progress: 60,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "site",
|
|
45
|
+
title: "Product page",
|
|
46
|
+
group: "Build",
|
|
47
|
+
owner: "Lea Hoffmann",
|
|
48
|
+
start: oct(5),
|
|
49
|
+
end: oct(14),
|
|
50
|
+
progress: 30,
|
|
51
|
+
dependsOn: ["brief"],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "checkout",
|
|
55
|
+
title: "Checkout flow",
|
|
56
|
+
group: "Build",
|
|
57
|
+
owner: "Tom Kraus",
|
|
58
|
+
start: oct(7),
|
|
59
|
+
end: oct(17),
|
|
60
|
+
progress: 10,
|
|
61
|
+
dependsOn: ["pricing"],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "docs",
|
|
65
|
+
title: "Help articles",
|
|
66
|
+
group: "Build",
|
|
67
|
+
owner: "Maya Brandt",
|
|
68
|
+
start: oct(12),
|
|
69
|
+
end: oct(19),
|
|
70
|
+
dependsOn: ["site"],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "freeze",
|
|
74
|
+
title: "Code freeze",
|
|
75
|
+
group: "Build",
|
|
76
|
+
owner: "Tom Kraus",
|
|
77
|
+
start: oct(19),
|
|
78
|
+
end: oct(19),
|
|
79
|
+
milestone: true,
|
|
80
|
+
dependsOn: ["checkout"],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "press",
|
|
84
|
+
title: "Press kit",
|
|
85
|
+
group: "Launch",
|
|
86
|
+
owner: "Jonas Weber",
|
|
87
|
+
start: oct(14),
|
|
88
|
+
end: oct(21),
|
|
89
|
+
dependsOn: ["site"],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "go",
|
|
93
|
+
title: "Launch day",
|
|
94
|
+
group: "Launch",
|
|
95
|
+
owner: "Lea Hoffmann",
|
|
96
|
+
start: oct(22),
|
|
97
|
+
end: oct(22),
|
|
98
|
+
milestone: true,
|
|
99
|
+
dependsOn: ["freeze", "press"],
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const launch: Task[] = plan.map((task) => ({ ...task, tone: phases[task.group].tone }));
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A small product launch: phases, owners, dependencies and two milestones. Add a task from the list
|
|
107
|
+
* (or a phase's +), drag from a bar's end to another bar to make it wait, and open a row's menu to
|
|
108
|
+
* rename or delete it.
|
|
109
|
+
*/
|
|
110
|
+
export function ProjectGantt() {
|
|
111
|
+
const [items, setItems] = React.useState<SchedulerItem[]>(launch);
|
|
112
|
+
return (
|
|
113
|
+
<Scheduler
|
|
114
|
+
aria-label="Product launch plan"
|
|
115
|
+
items={items}
|
|
116
|
+
onItemsChange={(next) =>
|
|
117
|
+
// A new task takes its phase's colour.
|
|
118
|
+
setItems(next.map((t) => (t.group && !t.tone ? { ...t, tone: phases[t.group as Phase]?.tone } : t)))
|
|
119
|
+
}
|
|
120
|
+
editor
|
|
121
|
+
// The colour is the phase's: the editor offers no other.
|
|
122
|
+
categories={[]}
|
|
123
|
+
today={today}
|
|
124
|
+
columns={[
|
|
125
|
+
{
|
|
126
|
+
id: "owner",
|
|
127
|
+
header: "Owner",
|
|
128
|
+
width: 72,
|
|
129
|
+
cell: (_row, [task]) => {
|
|
130
|
+
const owner = (task as { owner?: string } | undefined)?.owner;
|
|
131
|
+
return owner ? <Avatar size="sm" name={owner} /> : null;
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "phase",
|
|
136
|
+
header: "Phase",
|
|
137
|
+
width: 88,
|
|
138
|
+
cell: (_row, [task]) =>
|
|
139
|
+
task?.group ? <Tag tone={phases[task.group as Phase].tone}>{task.group}</Tag> : null,
|
|
140
|
+
},
|
|
141
|
+
]}
|
|
142
|
+
defaultListWidth={360}
|
|
143
|
+
toolbar={<span className="truncate text-15 font-medium">Spring collection launch</span>}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Work and time on one surface, in three layouts that take the same items. A **Gantt chart** lists tasks on the left beside a timeline under a two-row Licht Mono axis, with dependencies, milestones and phases. A **resource timeline** lists people or rooms, and their bookings stack in lanes. A **calendar** puts days across and the hours down — a day, a few days, the working week or a week — or shows a month of weeks. Drag anything to move it, or its end to resize it; it snaps as it goes and shows where it would land. Escape puts it back. With `editor`, it is edited in place: draw over empty time (or right click it) for a new event or booking, click one to change its title, time, row and category, add and delete tasks and rows from the list, and draw a dependency from a bar's end to another bar.
|
|
150
|
+
|
|
151
|
+
## Usage
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { Scheduler, type SchedulerItem } from "@zonsh/ui/scheduler";
|
|
155
|
+
|
|
156
|
+
const [items, setItems] = React.useState<SchedulerItem[]>([
|
|
157
|
+
{ id: "brief", title: "Write the brief", start: new Date(2026, 9, 1), end: new Date(2026, 9, 3) },
|
|
158
|
+
{
|
|
159
|
+
id: "site",
|
|
160
|
+
title: "Product page",
|
|
161
|
+
start: new Date(2026, 9, 5),
|
|
162
|
+
end: new Date(2026, 9, 14),
|
|
163
|
+
dependsOn: ["brief"],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "go",
|
|
167
|
+
title: "Launch day",
|
|
168
|
+
start: new Date(2026, 9, 22),
|
|
169
|
+
end: new Date(2026, 9, 22),
|
|
170
|
+
milestone: true,
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
|
|
174
|
+
<Scheduler aria-label="Launch plan" items={items} onItemsChange={setItems} />;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
A calendar is the same component with `layout="calendar"`. With `editor`, new events, edits and deletions all come back through `onItemsChange`:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<Scheduler
|
|
181
|
+
aria-label="Team calendar"
|
|
182
|
+
layout="calendar"
|
|
183
|
+
items={events}
|
|
184
|
+
onItemsChange={setEvents}
|
|
185
|
+
editor
|
|
186
|
+
categories={[
|
|
187
|
+
{ id: "focus", label: "Focus", tone: "violet" },
|
|
188
|
+
{ id: "hiring", label: "Hiring", tone: "orange" },
|
|
189
|
+
]}
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- `items` + `onItemsChange` — handed back with new `start`, `end` and `row`; your own fields are kept.
|
|
194
|
+
- `editor` — editing in place; `categories` are the kinds of item it offers (the six category tones by name without them).
|
|
195
|
+
- `layout` — `"gantt"` (default), `"resource"` with `rows`, or `"calendar"` with `view`.
|
|
196
|
+
- `aria-label` — the frame needs a name.
|
|
197
|
+
|
|
198
|
+
`end` is exclusive, as in most calendars: a task through Friday ends Saturday 00:00 and is read out as "Oct 5 – 9". The scheduler fills its width and is 576px tall (at most 80% of the viewport); set a height with a class — `h-full` to fill a frame, or `grow` in a flex column. A timeline's columns stretch when its range is narrower than the frame, so a Week or Month never ends before the frame does. It is its own entry, `@zonsh/ui/scheduler`, so it costs nothing until imported, and needs no other library to show and drag items. The editor (`editor`) needs react-day-picker and date-fns, like `DatePicker`: its days are DatePickers. It loads the first time it opens, so a read-only or drag-only scheduler never asks for them; with `editor`, install both (`pnpm add react-day-picker date-fns`). On a phone the editor's day and row are the platform's own pickers.
|
|
199
|
+
|
|
200
|
+
## When to use
|
|
201
|
+
|
|
202
|
+
- A **project plan** — dates, progress, dependencies, milestones: `layout="gantt"`.
|
|
203
|
+
- **Bookings and capacity** — rooms, desks, vehicles, people through a day or week: `layout="resource"`.
|
|
204
|
+
- **Events and meetings** — a person's or a team's days by the hour, or a month at a glance: `layout="calendar"`.
|
|
205
|
+
- A plan people should not change here: `readOnly` (items still open their details).
|
|
206
|
+
- One view only — an agenda of a day, a month on a wall: `views={["day"]}` or `views={["month"]}` with the same `defaultView`, and the header offers no switch.
|
|
207
|
+
- Not for picking a date (`DatePicker`, `Calendar`), what already happened (`Timeline`) or steps without dates (`Kanban`, `Table`).
|
|
208
|
+
|
|
209
|
+
## Examples
|
|
210
|
+
|
|
211
|
+
### Project plan
|
|
212
|
+
|
|
213
|
+
The chart at the top is edited in place with `editor`: "Add task" at the end of the list (or a phase's +) adds a task from today and puts its name in a field — type it and press Enter. A row's ⋯ menu renames, edits or deletes the task; Delete removes the bar in focus. To link two tasks, hover a bar (or click it): a round handle appears just after its end, with the hint "Drag to another task to link". Drag from it — a dashed line follows the pointer, the tasks it may go to are outlined, held near an edge the timeline scrolls — and let go on another bar: that one now waits for it. Click a dependency line to pick it, Delete to remove it; from the keyboard, a bar's menu (Shift+F10, or the menu key) lists the tasks it may wait for. A loop is never drawn. `categories={[]}` leaves the colour to the phase.
|
|
214
|
+
|
|
215
|
+
### Team week
|
|
216
|
+
|
|
217
|
+
A calendar of a team's week: stand-ups, meetings and focus time by the hour, two all-day items on top, and overlapping events that cascade where one starts later. The kinds of event are the `categories`, in a legend under the frame. Drag an event to another day or time, or its bottom edge to change its end. A click on empty time makes nothing: drag over it to draw an event, or right click it (long press on touch) for "New event here". Either opens the editor beside it — title, person, date, start and end, all day, category — and so does a click on an event, which can also be deleted there. The header offers every view: Day, Work week, Week, Month and the people as a timeline; `views` limits them, so `views={["day"]}` is a single day's agenda and `views={["month"]}` a month to look at.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { Avatar } from "@zonsh/ui";
|
|
221
|
+
import { Scheduler, type SchedulerItem, type SchedulerRow } from "@zonsh/ui/scheduler";
|
|
222
|
+
import * as React from "react";
|
|
223
|
+
|
|
224
|
+
// today, oct: as in the first example on this page that uses them.
|
|
225
|
+
|
|
226
|
+
/** A legend under a calendar: what each colour stands for, as a dot and a word. */
|
|
227
|
+
function Legend({ label, items }: { label: string; items: { tone: keyof typeof dots; label: string }[] }) {
|
|
228
|
+
return (
|
|
229
|
+
<ul
|
|
230
|
+
aria-label={label}
|
|
231
|
+
className="flex flex-wrap items-center gap-x-4 gap-y-1 px-1 text-12 text-foreground-soft"
|
|
232
|
+
>
|
|
233
|
+
{items.map((item) => (
|
|
234
|
+
<li key={item.label} className="flex items-center gap-1.5">
|
|
235
|
+
<span aria-hidden className={`size-2 rounded-full ${dots[item.tone]}`} />
|
|
236
|
+
{item.label}
|
|
237
|
+
</li>
|
|
238
|
+
))}
|
|
239
|
+
</ul>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const dots = {
|
|
244
|
+
violet: "bg-tone-violet",
|
|
245
|
+
orange: "bg-tone-orange",
|
|
246
|
+
blue: "bg-tone-blue",
|
|
247
|
+
aqua: "bg-tone-aqua",
|
|
248
|
+
lime: "bg-tone-lime",
|
|
249
|
+
warning: "bg-warning",
|
|
250
|
+
} as const;
|
|
251
|
+
|
|
252
|
+
const kinds = {
|
|
253
|
+
focus: { tone: "violet", label: "Focus" },
|
|
254
|
+
hiring: { tone: "orange", label: "Hiring" },
|
|
255
|
+
external: { tone: "blue", label: "External" },
|
|
256
|
+
} as const;
|
|
257
|
+
|
|
258
|
+
type Kind = keyof typeof kinds;
|
|
259
|
+
|
|
260
|
+
/** The kinds of event and booking, as the editor offers them. */
|
|
261
|
+
const teamCategories = Object.entries(kinds).map(([id, kind]) => ({ id, ...kind }));
|
|
262
|
+
|
|
263
|
+
const sep = (day: number, hour = 0, minute = 0) => new Date(2026, 8, day, hour, minute);
|
|
264
|
+
|
|
265
|
+
const people: SchedulerRow[] = [
|
|
266
|
+
{ id: "maya", title: "Maya Brandt", description: "Design", icon: <Avatar size="sm" name="Maya Brandt" /> },
|
|
267
|
+
{ id: "tom", title: "Tom Kraus", description: "Engineering", icon: <Avatar size="sm" name="Tom Kraus" /> },
|
|
268
|
+
{
|
|
269
|
+
id: "lea",
|
|
270
|
+
title: "Lea Hoffmann",
|
|
271
|
+
description: "Product",
|
|
272
|
+
icon: <Avatar size="sm" name="Lea Hoffmann" />,
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
type TeamEvent = SchedulerItem & { kind?: Kind };
|
|
277
|
+
|
|
278
|
+
const teamEvents: Omit<TeamEvent, "tone">[] = [
|
|
279
|
+
{ id: "off", title: "Offsite prep", row: "lea", start: sep(29), end: oct(1), allDay: true },
|
|
280
|
+
{ id: "out", title: "Maya away", row: "maya", start: oct(2), end: oct(3), allDay: true },
|
|
281
|
+
...[28, 29, 30, 31, 32].map((day) => ({
|
|
282
|
+
id: `standup-${day}`,
|
|
283
|
+
title: "Stand-up",
|
|
284
|
+
row: "tom",
|
|
285
|
+
start: sep(day, 9),
|
|
286
|
+
end: sep(day, 9, 20),
|
|
287
|
+
})),
|
|
288
|
+
{ id: "plan", title: "Sprint planning", row: "lea", start: sep(28, 10), end: sep(28, 11, 30) },
|
|
289
|
+
{ id: "crit", title: "Design critique", row: "maya", start: sep(28, 14), end: sep(28, 15) },
|
|
290
|
+
{
|
|
291
|
+
id: "int1",
|
|
292
|
+
title: "Interview: frontend",
|
|
293
|
+
row: "tom",
|
|
294
|
+
start: sep(29, 11),
|
|
295
|
+
end: sep(29, 12),
|
|
296
|
+
kind: "hiring",
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: "sup",
|
|
300
|
+
title: "Supplier call",
|
|
301
|
+
row: "lea",
|
|
302
|
+
start: sep(29, 13),
|
|
303
|
+
end: sep(29, 14, 30),
|
|
304
|
+
kind: "external",
|
|
305
|
+
},
|
|
306
|
+
{ id: "pair", title: "Pairing: checkout", row: "tom", start: sep(30, 10), end: sep(30, 12), kind: "focus" },
|
|
307
|
+
{ id: "review", title: "Review the pricing page", row: "maya", start: sep(30, 10, 30), end: sep(30, 11) },
|
|
308
|
+
{
|
|
309
|
+
id: "panel",
|
|
310
|
+
title: "Hiring panel",
|
|
311
|
+
row: "lea",
|
|
312
|
+
start: sep(30, 11),
|
|
313
|
+
end: sep(30, 12, 30),
|
|
314
|
+
kind: "hiring",
|
|
315
|
+
},
|
|
316
|
+
{ id: "one", title: "1:1 Maya and Tom", row: "maya", start: oct(1, 10, 30), end: oct(1, 11, 15) },
|
|
317
|
+
{ id: "shop", title: "Workshop: onboarding", row: "lea", start: oct(1, 13), end: oct(1, 15) },
|
|
318
|
+
{ id: "check", title: "Release check", row: "tom", start: oct(1, 14), end: oct(1, 14, 30) },
|
|
319
|
+
{
|
|
320
|
+
id: "write",
|
|
321
|
+
title: "Write the help article",
|
|
322
|
+
row: "maya",
|
|
323
|
+
start: oct(1, 15, 30),
|
|
324
|
+
end: oct(1, 17),
|
|
325
|
+
kind: "focus",
|
|
326
|
+
},
|
|
327
|
+
{ id: "dinner", title: "Team dinner", row: "lea", start: oct(1, 18, 30), end: oct(1, 20, 30) },
|
|
328
|
+
{ id: "demo", title: "Sprint demo", row: "lea", start: oct(2, 15), end: oct(2, 16) },
|
|
329
|
+
{ id: "retro", title: "Retro", row: "tom", start: oct(2, 16), end: oct(2, 17) },
|
|
330
|
+
{ id: "int2", title: "Interview: design", row: "maya", start: oct(8, 11), end: oct(8, 12), kind: "hiring" },
|
|
331
|
+
{ id: "offsite", title: "Team offsite", row: "lea", start: oct(14), end: oct(17), allDay: true },
|
|
332
|
+
{
|
|
333
|
+
id: "review-q",
|
|
334
|
+
title: "Quarterly review",
|
|
335
|
+
row: "lea",
|
|
336
|
+
start: oct(21, 14),
|
|
337
|
+
end: oct(21, 16),
|
|
338
|
+
kind: "external",
|
|
339
|
+
},
|
|
340
|
+
];
|
|
341
|
+
|
|
342
|
+
const teamWeek: SchedulerItem[] = teamEvents.map(({ kind, ...e }) => ({
|
|
343
|
+
...e,
|
|
344
|
+
category: kind,
|
|
345
|
+
tone: kind ? kinds[kind].tone : undefined,
|
|
346
|
+
}));
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* A team's week as a calendar, with every view: drag to move, draw over empty time (or right click
|
|
350
|
+
* it) for a new event, and click one to edit it.
|
|
351
|
+
*/
|
|
352
|
+
export function TeamWeek() {
|
|
353
|
+
const [items, setItems] = React.useState<SchedulerItem[]>(teamWeek);
|
|
354
|
+
return (
|
|
355
|
+
<div className="flex h-full w-full flex-col gap-2.5">
|
|
356
|
+
<Scheduler
|
|
357
|
+
aria-label="Team calendar"
|
|
358
|
+
layout="calendar"
|
|
359
|
+
views={["day", "work-week", "week", "month", "timeline"]}
|
|
360
|
+
rows={people}
|
|
361
|
+
items={items}
|
|
362
|
+
onItemsChange={setItems}
|
|
363
|
+
editor
|
|
364
|
+
categories={teamCategories}
|
|
365
|
+
labels={{ resourceColumn: "Person" }}
|
|
366
|
+
today={today}
|
|
367
|
+
className="grow"
|
|
368
|
+
/>
|
|
369
|
+
<Legend label="Kinds of event" items={Object.values(kinds)} />
|
|
370
|
+
</div>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
The Month view lays out whole weeks: an event of a day or more as a bar across its days, a timed one as a dot, its time and its name; a day with more than fits says "+2 more", which opens the rest in a popover. On a phone the month is numbers with a dot for each event, and the picked day's events are listed under the weeks.
|
|
376
|
+
|
|
377
|
+
### Room booking
|
|
378
|
+
|
|
379
|
+
A resource timeline in the Day zoom, with a month of bookings around it — busy days, quiet days, free weekends: rooms with their capacity, quarter-hour snapping (`step={15}`), stacked overlaps. Draw over a room's free time (or right click it) to book it in the editor, click a booking to change its title, room, time or category. With `onRowsChange`, "Add room" ends the list and each room's ⋯ menu renames or deletes it (with its bookings). In the Week zoom a resource timeline shows one week across the frame (a day at least 120px wide, scrolling sideways on a phone), where a booking is a chip in the days it touches, its name and start time inside, stacked under the day's earlier ones. The Month zoom shows the booked months, each across the frame (a day at least 28px): a day with bookings is one cell with how many, in Licht Mono on a fill that is light or heavy by how much of the day is booked (four hours or more), with a dot for each category; a click or Enter lists them in a popover, named "Atlas, Oct 1: 3 bookings". "Focus time" is `disabled`: it shows in a dashed edge and opens, but does not move.
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
import { Scheduler, type SchedulerItem, type SchedulerRow } from "@zonsh/ui/scheduler";
|
|
383
|
+
import * as React from "react";
|
|
384
|
+
|
|
385
|
+
// Legend, dots, kinds, Kind, teamCategories, today, oct: as in the first example on this page that uses them.
|
|
386
|
+
|
|
387
|
+
const rooms: SchedulerRow[] = [
|
|
388
|
+
{ id: "atlas", title: "Atlas", description: "12 seats" },
|
|
389
|
+
{ id: "birch", title: "Birch", description: "6 seats" },
|
|
390
|
+
{ id: "cove", title: "Cove", description: "4 seats" },
|
|
391
|
+
{ id: "dock", title: "Dock", description: "2 seats" },
|
|
392
|
+
];
|
|
393
|
+
|
|
394
|
+
/** The first day's bookings: the Day view opens on them. */
|
|
395
|
+
const firstDay: SchedulerItem[] = [
|
|
396
|
+
{ id: "b1", row: "atlas", title: "All-hands", start: oct(1, 9), end: oct(1, 10, 30) },
|
|
397
|
+
{ id: "b2", row: "atlas", title: "Quarterly planning", start: oct(1, 13), end: oct(1, 17) },
|
|
398
|
+
{ id: "b3", row: "atlas", title: "Client workshop", start: oct(1, 15), end: oct(1, 16) },
|
|
399
|
+
{ id: "b4", row: "birch", title: "Design review", start: oct(1, 10), end: oct(1, 11) },
|
|
400
|
+
{ id: "b5", row: "birch", title: "Hiring panel", start: oct(1, 11), end: oct(1, 13) },
|
|
401
|
+
{ id: "b6", row: "cove", title: "1:1 Maya and Tom", start: oct(1, 9, 30), end: oct(1, 10) },
|
|
402
|
+
{ id: "b7", row: "cove", title: "Supplier call", start: oct(1, 14), end: oct(1, 15) },
|
|
403
|
+
{ id: "b8", row: "dock", title: "Focus time", start: oct(1, 8), end: oct(1, 12), disabled: true },
|
|
404
|
+
{ id: "b9", row: "birch", title: "Course recording", start: oct(2, 9), end: oct(2, 12) },
|
|
405
|
+
];
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The rest of the month around it: a weekly kickoff, a few busy days (the 7th, 14th and 22nd),
|
|
409
|
+
* quiet ones, and weekends left free — all in October, so the Month zoom shows one month. [day of
|
|
410
|
+
* October, room, from, to, title, kind]; times are hours, 9.5 for half past nine.
|
|
411
|
+
*/
|
|
412
|
+
const month: [number, string, number, number, string, (Kind | "locked")?][] = [
|
|
413
|
+
[16, "atlas", 10, 11, "Sprint review"],
|
|
414
|
+
[9, "birch", 14, 15, "Interview: frontend", "hiring"],
|
|
415
|
+
[29, "cove", 9, 9.5, "1:1 Ana and Jon"],
|
|
416
|
+
[29, "atlas", 13, 15, "Board prep"],
|
|
417
|
+
[2, "atlas", 10, 11, "Product demo", "external"],
|
|
418
|
+
[2, "cove", 15, 16, "Sprint retro"],
|
|
419
|
+
[5, "atlas", 9, 9.5, "Weekly kickoff"],
|
|
420
|
+
[5, "birch", 11, 12, "Interview: designer", "hiring"],
|
|
421
|
+
[5, "dock", 13, 15, "Deep work", "locked"],
|
|
422
|
+
[6, "cove", 10, 11, "Vendor call", "external"],
|
|
423
|
+
[6, "atlas", 14, 16, "Pricing workshop"],
|
|
424
|
+
[7, "atlas", 9, 10.5, "Investor update", "external"],
|
|
425
|
+
[7, "atlas", 11, 12, "Roadmap review"],
|
|
426
|
+
[7, "birch", 9.5, 11, "Interview loop", "hiring"],
|
|
427
|
+
[7, "birch", 13, 14, "Design critique"],
|
|
428
|
+
[7, "cove", 10, 10.5, "1:1 Lea and Sam"],
|
|
429
|
+
[7, "cove", 15, 16, "Customer interview", "external"],
|
|
430
|
+
[7, "dock", 8, 12, "Deep work", "locked"],
|
|
431
|
+
[8, "birch", 10, 12, "Lesson recording"],
|
|
432
|
+
[9, "atlas", 16, 17, "Friday demo"],
|
|
433
|
+
[12, "atlas", 9, 9.5, "Weekly kickoff"],
|
|
434
|
+
[12, "cove", 14, 15, "Agency check-in", "external"],
|
|
435
|
+
[14, "atlas", 9, 17, "Planning day"],
|
|
436
|
+
[14, "birch", 10, 11, "Interview: data analyst", "hiring"],
|
|
437
|
+
[14, "birch", 14, 16, "Hiring debrief", "hiring"],
|
|
438
|
+
[14, "cove", 11, 12, "Legal review", "external"],
|
|
439
|
+
[14, "cove", 16, 17, "1:1 Ana and Jon"],
|
|
440
|
+
[14, "dock", 9, 11, "Deep work", "locked"],
|
|
441
|
+
[15, "birch", 13, 14, "Copy review"],
|
|
442
|
+
[16, "atlas", 15, 16, "Client onboarding", "external"],
|
|
443
|
+
[19, "atlas", 9, 9.5, "Weekly kickoff"],
|
|
444
|
+
[19, "dock", 13, 16, "Deep work", "locked"],
|
|
445
|
+
[20, "cove", 10, 11, "Supplier follow-up", "external"],
|
|
446
|
+
[20, "birch", 15, 16, "Accessibility review"],
|
|
447
|
+
[22, "atlas", 9, 12, "Quarterly business review", "external"],
|
|
448
|
+
[22, "atlas", 13, 14, "Town hall"],
|
|
449
|
+
[22, "birch", 9, 10, "Interview: support lead", "hiring"],
|
|
450
|
+
[22, "birch", 11, 12.5, "Workshop recording"],
|
|
451
|
+
[22, "cove", 10, 10.5, "1:1 Lea and Sam"],
|
|
452
|
+
[22, "cove", 14, 15, "Partner call", "external"],
|
|
453
|
+
[22, "dock", 8, 11, "Deep work", "locked"],
|
|
454
|
+
[23, "atlas", 16, 17, "Friday demo"],
|
|
455
|
+
[26, "atlas", 9, 9.5, "Weekly kickoff"],
|
|
456
|
+
[26, "birch", 10, 11, "Menu tasting"],
|
|
457
|
+
[27, "cove", 13, 14, "Customer interview", "external"],
|
|
458
|
+
[28, "atlas", 10, 12, "Launch rehearsal"],
|
|
459
|
+
[28, "birch", 14, 15, "Offer review", "hiring"],
|
|
460
|
+
[30, "atlas", 15, 16.5, "Month-end review"],
|
|
461
|
+
];
|
|
462
|
+
|
|
463
|
+
const at = (day: number, hours: number) => oct(day, Math.floor(hours), (hours % 1) * 60);
|
|
464
|
+
|
|
465
|
+
const bookings: SchedulerItem[] = [
|
|
466
|
+
...firstDay,
|
|
467
|
+
...month.map(([day, row, from, to, title, kind], i) => ({
|
|
468
|
+
id: `m${i + 1}`,
|
|
469
|
+
row,
|
|
470
|
+
title,
|
|
471
|
+
start: at(day, from),
|
|
472
|
+
end: at(day, to),
|
|
473
|
+
...(kind === "locked" ? { disabled: true } : kind ? { category: kind, tone: kinds[kind].tone } : {}),
|
|
474
|
+
})),
|
|
475
|
+
];
|
|
476
|
+
|
|
477
|
+
const roomBookings: SchedulerItem[] = bookings.map((b) => {
|
|
478
|
+
const category = ({ b3: "external", b5: "hiring", b7: "external" } as Record<string, Kind>)[b.id];
|
|
479
|
+
return category ? { ...b, category, tone: kinds[category].tone } : b;
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Rooms booked through the month: overlapping bookings stack, and a booking moves between rooms. Draw
|
|
484
|
+
* over a room's free time (or right click it) to book it, click a booking to edit it, and add or
|
|
485
|
+
* rename rooms from the list.
|
|
486
|
+
*/
|
|
487
|
+
export function RoomBooking() {
|
|
488
|
+
const [items, setItems] = React.useState(roomBookings);
|
|
489
|
+
const [rows, setRows] = React.useState(rooms);
|
|
490
|
+
return (
|
|
491
|
+
<div className="flex h-full w-full flex-col gap-2.5">
|
|
492
|
+
<Scheduler
|
|
493
|
+
aria-label="Meeting rooms"
|
|
494
|
+
layout="resource"
|
|
495
|
+
rows={rows}
|
|
496
|
+
onRowsChange={setRows}
|
|
497
|
+
items={items}
|
|
498
|
+
onItemsChange={setItems}
|
|
499
|
+
editor
|
|
500
|
+
categories={teamCategories}
|
|
501
|
+
labels={{ resourceColumn: "Room", addRow: "Add room", newRow: "New room" }}
|
|
502
|
+
defaultZoom="day"
|
|
503
|
+
step={15}
|
|
504
|
+
defaultDate={oct(1, 8)}
|
|
505
|
+
today={today}
|
|
506
|
+
defaultListWidth={180}
|
|
507
|
+
className="grow"
|
|
508
|
+
/>
|
|
509
|
+
<Legend label="Kinds of booking" items={Object.values(kinds)} />
|
|
510
|
+
</div>
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### Read-only
|
|
516
|
+
|
|
517
|
+
A course term in the Month zoom; nothing moves, arrow keys still go from item to item.
|
|
518
|
+
|
|
519
|
+
```tsx
|
|
520
|
+
import { Scheduler, type SchedulerItem } from "@zonsh/ui/scheduler";
|
|
521
|
+
|
|
522
|
+
// today, oct: as in the first example on this page that uses them.
|
|
523
|
+
|
|
524
|
+
const semester: SchedulerItem[] = [
|
|
525
|
+
{ id: "m1", title: "Module 1 · Foundations", start: oct(1), end: oct(15) },
|
|
526
|
+
{ id: "m2", title: "Module 2 · Practice", start: oct(15), end: oct(36) },
|
|
527
|
+
{ id: "e1", title: "Mid-term essay", start: oct(36), end: oct(36), milestone: true },
|
|
528
|
+
{ id: "m3", title: "Module 3 · Projects", start: oct(36), end: oct(64) },
|
|
529
|
+
{ id: "e2", title: "Final presentation", start: oct(64), end: oct(64), milestone: true },
|
|
530
|
+
];
|
|
531
|
+
|
|
532
|
+
/** A course term to look at, in months: nothing moves, items still open. */
|
|
533
|
+
export function ReadOnly() {
|
|
534
|
+
return (
|
|
535
|
+
<Scheduler
|
|
536
|
+
aria-label="Autumn term"
|
|
537
|
+
items={semester}
|
|
538
|
+
readOnly
|
|
539
|
+
defaultZoom="month"
|
|
540
|
+
today={today}
|
|
541
|
+
className="h-80"
|
|
542
|
+
/>
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### Empty and loading
|
|
548
|
+
|
|
549
|
+
`loading` shows placeholders and sets `aria-busy`. With no rows a timeline says nothing is scheduled; `empty` takes your own empty state with the action that fills it.
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { Scheduler } from "@zonsh/ui/scheduler";
|
|
553
|
+
|
|
554
|
+
// today: as in the first example on this page that uses them.
|
|
555
|
+
|
|
556
|
+
/** Before there is anything to show: loading placeholders, then the empty state. */
|
|
557
|
+
export function EmptyAndLoading({ state = "empty" }: { state?: "empty" | "loading" }) {
|
|
558
|
+
return (
|
|
559
|
+
<Scheduler
|
|
560
|
+
aria-label="Release plan"
|
|
561
|
+
items={[]}
|
|
562
|
+
loading={state === "loading"}
|
|
563
|
+
today={today}
|
|
564
|
+
className="h-80"
|
|
565
|
+
/>
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/* ── Calendar ──────────────────────────────────────────────────────────────── */
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
## Views
|
|
573
|
+
|
|
574
|
+
| Layout | View | Shows | Snaps to |
|
|
575
|
+
| ------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
576
|
+
| `gantt`, `resource` | `zoom="day"` | an hour a column, 64px, under the day | an hour, or `step` |
|
|
577
|
+
| `gantt`, `resource` | `zoom="week"` | a day a column, 48px, under "W40 · Sep 28 – Oct 4" | a day |
|
|
578
|
+
| `resource` | `zoom="week"` | one week across the frame, a day at least 120px, bookings as chips in their days | a day |
|
|
579
|
+
| `resource` | `zoom="month"` | each booked month across the frame, a cell a day with how many | a day |
|
|
580
|
+
| `gantt`, `resource` | `zoom="month"` | a day of 16px, under week labels and the month | a day |
|
|
581
|
+
| `calendar` | `view="day"` | one day by the hour, 48px an hour | `step` (15 minutes) |
|
|
582
|
+
| `calendar` | `view="days"` | `days` days from `date` (3) | `step` |
|
|
583
|
+
| `calendar` | `view="work-week"` | the week without the locale's weekend | `step` |
|
|
584
|
+
| `calendar` | `view="week"` | seven days from the locale's first | `step` |
|
|
585
|
+
| `calendar` | `view="month"` | the weeks of `date`'s month | a day |
|
|
586
|
+
| `calendar` | `view="timeline"` | the items as a timeline: a resource timeline with `rows`, a Gantt chart without, in the zoom nearest the view before | as that zoom |
|
|
587
|
+
|
|
588
|
+
`views` sets what the calendar's header offers (Day, Week and Month by default). The header holds Today, the previous and next period and the period's name in Licht; `date`, `defaultDate` and `onDateChange` set the period. Pressing a day's heading opens that day when `views` has `"day"`.
|
|
589
|
+
|
|
590
|
+
**Timelines.** Changing zoom keeps the moment in the middle in place. The axis covers everything scheduled and today, plus a period before and two after; `range` sets it. The period's name stays in view as the timeline scrolls, and the bars fade into an edge they run on past. Today is a pill on the axis and a quiet line down the rows. A name too long for its bar sits after it — in a resource row only where its lane is free that far, otherwise it ends in "…" and the whole of it, with when, shows on hover. In the Day zoom a bar says when it starts beside its name, where there is room.
|
|
591
|
+
|
|
592
|
+
**Calendars.** Events of a whole day or more (midnight to midnight, 24 hours or longer, or `allDay`) sit in the all-day row; the rest in the time grid, split at midnight. Overlapping events are laid as Apple and Google Calendar lay them: events that start within half an hour of each other sit side by side, so both names show; one that starts later is drawn over the lower part of the earlier one, cascading, with a line of the ground around it — the earlier name stays in view above it. No event is drawn narrower than 64px: past that the columns overlap in steps. A name wraps at its words and ends in "…" on its last line; the time under it shows as a range, its start, or not at all as the event narrows; an event of half an hour or less says "Stand-up, 9 AM" on one line. A coloured event is a stripe of its tone on its leading edge over a light tint of it; one without a tone sits in the raised material; past events are drawn a little quieter, and an open or dragged one is lifted. The grid opens at the start of `workHours` (8 to 18) or the first event before it, and shades the hours outside them. The now line is drawn in the ink across today, with a dot where it begins, over the events, and as a hairline across the other days; its time is in the margin.
|
|
593
|
+
|
|
594
|
+
Weeks start on the locale's first day (or `weekStartsOn`); weekends, date and time formats are the locale's (12 or 24 hours, or `hour12`), week numbers ISO 8601. Time is counted in calendar days and hours, so a day keeps its length when the clocks change and an item moved a day keeps its time of day.
|
|
595
|
+
|
|
596
|
+
## Creating
|
|
597
|
+
|
|
598
|
+
Drag over empty space — a calendar's time grid, all-day row or month, or a resource timeline's row — and a dashed "New event" (or "New booking") follows the pointer, snapping to `step` (or whole days). A click alone makes nothing. A right click on empty space, or a long press on touch, opens its menu with "New event here", an hour (or a day) at that point. On touch, a long press then a drag draws, so a swipe still scrolls.
|
|
599
|
+
|
|
600
|
+
With `editor`, what is drawn opens in the editor and comes back through `onItemsChange` (`details.change` `"create"`, an id from `createId`) when it is saved. Without it, `onItemCreate` gets `{ start, end, allDay, row }` to add — at once, or after asking for a title. From the keyboard, give people a button of your own that adds an item and opens it.
|
|
601
|
+
|
|
602
|
+
## Editing
|
|
603
|
+
|
|
604
|
+
`editor` turns on the built-in editor, a popover beside the item (a drawer on a phone), loaded the first time it opens:
|
|
605
|
+
|
|
606
|
+
- **Title**, the **row** (a room, a person — with `rows`), the **date** with a start and end time (`DatePicker`, `TimeField`; an end before the start runs past midnight), or the dates of a task or an all-day event (`DateRangePicker`), **All day** on a calendar, and the **category**: a dot of its tone with its name, never the colour alone.
|
|
607
|
+
- **Save** (Enter in the title), **Cancel** or Escape, and **Delete** for an item that exists. Delete (or Backspace) on an item in focus deletes it too, and a right click or the menu key opens its menu: Edit and Delete, and on a Gantt chart the tasks it may wait for.
|
|
608
|
+
- Every change comes back through `onItemsChange`, with `details.change` `"create"`, `"edit"`, `"delete"` or `"dependency"` and `details.source` `"editor"`, `"pointer"` or `"keyboard"`. Deleting a task takes it out of the `dependsOn` of the tasks that waited for it.
|
|
609
|
+
- A Gantt chart (without `rows`) ends its list with "Add task", each phase has its own +, and a row's ⋯ menu renames, edits or deletes the task. A resource timeline does the same for its rows with `onRowsChange`: "Add row" (`labels.addRow`), rename and delete, the bookings in a deleted row deleted with it.
|
|
610
|
+
- A category sets the item's `tone`, and with your own `categories` its `category` id too. Locked (`disabled`) items and a `readOnly` schedule open `renderDetails` instead.
|
|
611
|
+
|
|
612
|
+
## Details
|
|
613
|
+
|
|
614
|
+
`renderDetails` shows what you return in a popover beside an item when it is clicked, tapped or opened with Enter — on a phone, in a bottom drawer. With `editor`, items that can change open in the editor instead. `onItemOpen` is called either way, for a page or dialog of your own.
|
|
615
|
+
|
|
616
|
+
## On a phone
|
|
617
|
+
|
|
618
|
+
Under 640px a timeline's list keeps only its first column, at most 40% of the width; the timeline scrolls both ways under one finger. A calendar's week keeps its days at least 88px wide and scrolls sideways, and its header puts the views under the period — as a select when there are more than three. The month becomes a phone calendar's: the weeks as numbers with up to three dots a day, and the picked day's events (today's at first) listed under them; a tap picks a day, another opens an event, and the arrow keys still move a focused one, the list following it. A long press (400ms) picks an item up, so a swipe still scrolls; held near an edge it scrolls. A tap opens details in a drawer. Resize handles are wider on touch.
|
|
619
|
+
|
|
620
|
+
## Props
|
|
621
|
+
|
|
622
|
+
| Prop | Type | Default |
|
|
623
|
+
| ------------------ | ------------------------------------------------------------------------------- | ------------------------------------- |
|
|
624
|
+
| `layout` | `"gantt" \| "resource" \| "calendar"` | `"gantt"` |
|
|
625
|
+
| `items` | `SchedulerItem[]` — controlled | — |
|
|
626
|
+
| `defaultItems` | `SchedulerItem[]` — uncontrolled | `[]` |
|
|
627
|
+
| `onItemsChange` | `(items, details: SchedulerChangeDetails) => void` | — |
|
|
628
|
+
| `onItemCreate` | `(draft: SchedulerDraft) => void` — a drawn event or booking, without `editor` | — |
|
|
629
|
+
| `editor` | `boolean` — edit in place: create, edit, delete, add tasks, draw dependencies | `false` |
|
|
630
|
+
| `categories` | `SchedulerCategory[]` — the kinds the editor offers | the six category tones |
|
|
631
|
+
| `onRowsChange` | `(rows, details: SchedulerRowChangeDetails) => void` — add, rename, delete rows | — |
|
|
632
|
+
| `createId` | `() => string` — a new item's or row's id | `crypto.randomUUID()` |
|
|
633
|
+
| `rows` | `SchedulerRow[]` — required for `resource` | a row per item |
|
|
634
|
+
| `columns` | `SchedulerColumn[]` — more list columns after the title | `[]` |
|
|
635
|
+
| `zoom` | `"day" \| "week" \| "month"` | — |
|
|
636
|
+
| `defaultZoom` | `SchedulerZoom` | `"week"` |
|
|
637
|
+
| `onZoomChange` | `(zoom: SchedulerZoom) => void` | — |
|
|
638
|
+
| `zooms` | `SchedulerZoom[]` — the zoom levels offered | all three |
|
|
639
|
+
| `view` | `SchedulerView` — a calendar's, controlled | — |
|
|
640
|
+
| `defaultView` | `SchedulerView` | `"week"` |
|
|
641
|
+
| `onViewChange` | `(view: SchedulerView) => void` | — |
|
|
642
|
+
| `views` | `SchedulerView[]` — the views offered; one alone hides the switch | `["day", "week", "month"]` |
|
|
643
|
+
| `days` | `number` — the `"days"` view's length | `3` |
|
|
644
|
+
| `date` | `Date` — a calendar's period, controlled | — |
|
|
645
|
+
| `onDateChange` | `(date: Date) => void` | — |
|
|
646
|
+
| `defaultDate` | `Date` — in view first | the earliest item (a calendar: today) |
|
|
647
|
+
| `step` | `number` — minutes a calendar (and the Day zoom) snaps to | `15` (Day zoom: `60`) |
|
|
648
|
+
| `workHours` | `{ start: number; end: number }` — hours | `{ start: 8, end: 18 }` |
|
|
649
|
+
| `hour12` | `boolean` | the locale's |
|
|
650
|
+
| `range` | `{ start: Date; end: Date }` | what is scheduled, and today |
|
|
651
|
+
| `today` | `Date` — where the today and now lines are | now |
|
|
652
|
+
| `weekStartsOn` | `0`–`6`, Sunday to Saturday | the locale's |
|
|
653
|
+
| `readOnly` | `boolean` | `false` |
|
|
654
|
+
| `loading` | `boolean` | `false` |
|
|
655
|
+
| `empty` | `ReactNode` | `labels.empty` |
|
|
656
|
+
| `toolbar` | `ReactNode` — the start of the header row | — |
|
|
657
|
+
| `controls` | `boolean` — Today, the zoom or views, and a calendar's previous and next | `true` |
|
|
658
|
+
| `renderDetails` | `(item) => ReactNode` | — |
|
|
659
|
+
| `onItemOpen` | `(item) => void` | — |
|
|
660
|
+
| `size` | `"default" \| "sm"` — 38 or 30px rows | `"default"` |
|
|
661
|
+
| `variant` | `"region" \| "card"` | `"region"` |
|
|
662
|
+
| `defaultListWidth` | `number` — px | 240, plus the columns |
|
|
663
|
+
| `labels` | `Partial<SchedulerMessages>` | — |
|
|
664
|
+
|
|
665
|
+
`SchedulerItem`: `id`, `title`, `start`, `end`, `row` (resource), `group` (a Gantt chart without `rows`), `progress` (0–100), `tone`, `category`, `milestone`, `disabled`, `allDay` (calendar), `dependsOn` (ids). `SchedulerRow`: `id`, `title`, `description`, `icon`, `group`. `SchedulerColumn`: `id`, `header`, `cell(row, items)`, `width`. `SchedulerChangeDetails`: `item`, `previous`, `change` (`"move"`, `"start"`, `"end"`, `"row"`, `"create"`, `"edit"`, `"delete"` or `"dependency"`) and `source` (`"pointer"`, `"keyboard"` or `"editor"`). `SchedulerRowChangeDetails`: `row`, `change` (`"create"`, `"edit"` or `"delete"`). `SchedulerCategory`: `id`, `label`, `tone`. `SchedulerDraft`: `start`, `end`, `allDay`, `row`. `SchedulerView`: `"day"`, `"days"`, `"work-week"`, `"week"`, `"month"` or `"timeline"`.
|
|
666
|
+
|
|
667
|
+
Other `<div>` props go to the frame. Editing parts: `scheduler-editor` (the form, `data-kind`, `data-new`), `scheduler-draft`, `scheduler-add`, `scheduler-add-to-group`, `scheduler-row-actions`, `scheduler-row-name`, `scheduler-item-connector`, `scheduler-link` (`data-link="from>to"`, `data-selected`). Data attributes: `data-slot="scheduler"` with `data-layout`, `data-zoom` (timelines), `data-view` (calendars), `data-dragging`, `data-narrow`, `data-empty`; items `data-slot="scheduler-item"` with `data-id`, `data-tone`, `data-milestone`, `data-all-day`, `data-disabled`, `data-dragging`, and on a calendar `data-past` and `data-stacked` (drawn over an earlier event).
|
|
668
|
+
|
|
669
|
+
`labels` renames the controls, column headers and everything read out; a `LocaleProvider` sets them for every scheduler (`messages.scheduler`), and the German pack has them.
|
|
670
|
+
|
|
671
|
+
## Brand rules
|
|
672
|
+
|
|
673
|
+
- **Do** keep items in the material. A `tone` marks a kind of work (category tone) or a state (status colour: late, blocked, due) — one meaning each — with the same words in a column or a legend (a dot and a word for each, under the frame, as the calendar demos do).
|
|
674
|
+
- **Do** name items as the work is named: "Product page", "Hiring panel". The dates are on the axis and read out with the item.
|
|
675
|
+
- **Do** use the Week zoom for plans, the Day zoom for bookings, and a calendar's week for meetings; start where the work is (`defaultDate`).
|
|
676
|
+
- **Don't** colour every item, or mix category tones and status colours on one chart: they would read as one scale.
|
|
677
|
+
- **Don't** invent progress, owners or dates in sample data presented as real.
|
|
678
|
+
|
|
679
|
+
## Accessibility
|
|
680
|
+
|
|
681
|
+
- A timeline's rows are a list, each placed in the whole ("3 of 8") even while only those on screen are drawn. Each bar is a button named with its title, its row (resource), its dates, its progress and "Locked" when disabled, described by the keyboard instructions, and read as a "task" or a "booking". One bar is in the tab order; the focused bar scrolls into view clear of the axis and the list.
|
|
682
|
+
- A calendar's events are buttons in reading order — the all-day row, then by start — named with the title, the date and time and "Locked", read as an "event". Each is in the tab order once, however many days or weeks it is drawn across. A day's heading is a button that opens it; today's is `aria-current="date"`. The period's name is a polite live heading, so Previous and Next say where they went.
|
|
683
|
+
- Every pickup, move, resize, row change, new event, cancel and unchanged drop is said in a polite live region: "Design moved to Oct 9 – 15.", "Interview moved to South room, Oct 6.", "Sprint planning moved to Sep 28, 10:15 – 11:45 AM.", "Move cancelled. Design stays Oct 8 – 14." Nothing the keyboard does animates.
|
|
684
|
+
- The axis, the grid, weekend and off-hours shading, the today and now lines and dependency lines are decoration, hidden from screen readers; what they show is in each item's name.
|
|
685
|
+
|
|
686
|
+
### Keyboard
|
|
687
|
+
|
|
688
|
+
On a timeline's bar:
|
|
689
|
+
|
|
690
|
+
| Key | What it does |
|
|
691
|
+
| ------------------------- | -------------------------------------------------------------------- |
|
|
692
|
+
| ↑ / ↓ | The item before or after |
|
|
693
|
+
| Home / End | The first or last item |
|
|
694
|
+
| ← / → | Moves the bar a unit (mirrored right to left) |
|
|
695
|
+
| Shift + ← / → | Moves its end |
|
|
696
|
+
| Alt + Shift + ← / → | Moves its start |
|
|
697
|
+
| Alt + ↑ / ↓ | Moves a booking to the row above or below |
|
|
698
|
+
| Enter / Space | Opens the item (in the editor, with `editor`) |
|
|
699
|
+
| Delete / Backspace | Deletes it, with `editor` |
|
|
700
|
+
| Shift + F10, the menu key | Its menu: edit, the tasks it waits for, delete |
|
|
701
|
+
| Escape | Puts a dragged bar back |
|
|
702
|
+
| ← / → on the list handle | Resizes the list; Shift for bigger steps, Home and End to its limits |
|
|
703
|
+
|
|
704
|
+
On a calendar's event in the time grid:
|
|
705
|
+
|
|
706
|
+
| Key | What it does |
|
|
707
|
+
| ------------------- | ----------------------------------------------------------------------------------------- |
|
|
708
|
+
| Tab / Shift + Tab | The next or previous event |
|
|
709
|
+
| Home / End | The first or last event |
|
|
710
|
+
| ↑ / ↓ | Moves it a `step` earlier or later |
|
|
711
|
+
| ← / → | Moves it to the day before or after (mirrored right to left), bringing that day into view |
|
|
712
|
+
| Shift + ↑ / ↓ | Moves its end |
|
|
713
|
+
| Alt + Shift + ↑ / ↓ | Moves its start |
|
|
714
|
+
| Enter / Space | Opens the event (in the editor, with `editor`) |
|
|
715
|
+
| Delete / Backspace | Deletes it, with `editor` |
|
|
716
|
+
| Escape | Puts a dragged event back |
|
|
717
|
+
|
|
718
|
+
In the all-day row and on the month:
|
|
719
|
+
|
|
720
|
+
| Key | What it does |
|
|
721
|
+
| ------------------- | ---------------------------------------------- |
|
|
722
|
+
| ← / → | Moves it a day |
|
|
723
|
+
| ↑ / ↓ | Moves it a week |
|
|
724
|
+
| Shift + ← / → | Moves its end a day |
|
|
725
|
+
| Alt + Shift + ← / → | Moves its start a day |
|
|
726
|
+
| Enter / Space | Opens the event (in the editor, with `editor`) |
|
|
727
|
+
| Delete / Backspace | Deletes it, with `editor` |
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
- Import: `import { Scheduler } from "@zonsh/ui/scheduler"`
|
|
732
|
+
- Source: `packages/ui/src/components/scheduler.tsx`
|