@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,1022 @@
|
|
|
1
|
+
# CRM
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { cn, Avatar, Breadcrumb, Button, Drawer, DrawerContent, DrawerDescription, DrawerHeader, DrawerTitle, Empty, EmptyActions, EmptyDescription, EmptyMedia, EmptyTitle, Field, FieldLabel, InputGroup, InputGroupAddon, InputGroupInput, Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemSeparator, ItemTitle, Menu, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger, Separator, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Table, TableCell, TableGroup, TableGroupHeader, TableHead, TableHeader, TableRow, Tag, Textarea, useDirection, useSidebar } from "@zonsh/ui";
|
|
5
|
+
import { Wordmark } from "@zonsh/ui/brand";
|
|
6
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@zonsh/ui/resizable";
|
|
7
|
+
import { ActivityIcon, Building2Icon, CalendarIcon, ChevronDownIcon, ChevronsUpDownIcon, CircleCheckIcon, CircleDashedIcon, CircleDotIcon, CopyIcon, EuroIcon, FileTextIcon, KanbanIcon, LogOutIcon, MailIcon, PhoneIcon, SearchIcon, SettingsIcon, StickyNoteIcon, UserRoundIcon, UsersIcon } from "lucide-react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
|
|
10
|
+
/** Your product's mark — a placeholder for "Acme". Replace it and the name with your own; never zon's Logo. */
|
|
11
|
+
function AcmeMark() {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinejoin="round">
|
|
14
|
+
<path d="M3.5 20.5 12 3.5l8.5 17z" />
|
|
15
|
+
<path d="M8 14.5h8" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* Event bookings at a fictional venue. Every company, person, address and figure is invented for
|
|
22
|
+
* the demo; the email addresses use the reserved `.example` domain.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
type Stage = "lead" | "qualified" | "proposal" | "won";
|
|
26
|
+
|
|
27
|
+
type ActivityKind = "call" | "email" | "meeting" | "note";
|
|
28
|
+
|
|
29
|
+
interface Contact {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
company: string;
|
|
33
|
+
email: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Deal {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
contact: string;
|
|
40
|
+
stage: Stage;
|
|
41
|
+
/** In euros. */
|
|
42
|
+
value: number;
|
|
43
|
+
/** ISO date of the next step. */
|
|
44
|
+
followUp: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface Entry {
|
|
48
|
+
id: string;
|
|
49
|
+
/** ISO date. */
|
|
50
|
+
date: string;
|
|
51
|
+
kind: ActivityKind;
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Notes added in the demo are dated to the day the tests freeze the clock at. */
|
|
56
|
+
const TODAY = "2026-10-01";
|
|
57
|
+
|
|
58
|
+
const contacts: Contact[] = [
|
|
59
|
+
{ id: "c1", name: "Amara Okafor", company: "Kestrel Robotics", email: "amara@kestrel.example" },
|
|
60
|
+
{
|
|
61
|
+
id: "c2",
|
|
62
|
+
name: "Luca Bianchi",
|
|
63
|
+
company: "Bianchi & Rossi Architects",
|
|
64
|
+
email: "luca@bianchirossi.example",
|
|
65
|
+
},
|
|
66
|
+
{ id: "c3", name: "Sofia Lindqvist", company: "Northwind Books", email: "sofia@northwind.example" },
|
|
67
|
+
{ id: "c4", name: "Kenji Mori", company: "Harbour Line Ferries", email: "kenji@harbourline.example" },
|
|
68
|
+
{ id: "c5", name: "Priya Nair", company: "Linden Primary School", email: "priya@linden.example" },
|
|
69
|
+
{ id: "c6", name: "Mateo García", company: "Cooperativa Olivar", email: "mateo@olivar.example" },
|
|
70
|
+
{ id: "c7", name: "Hanna Vogel", company: "Praxis Birkenweg", email: "hanna@birkenweg.example" },
|
|
71
|
+
{ id: "c8", name: "Chloé Martin", company: "Atelier Lumière", email: "chloe@lumiere.example" },
|
|
72
|
+
{ id: "c9", name: "Oliver Grant", company: "Grant Family", email: "oliver@grant.example" },
|
|
73
|
+
{ id: "c10", name: "Ines Duarte", company: "Tidewater Running Club", email: "ines@tidewater.example" },
|
|
74
|
+
{ id: "c11", name: "Noah Frank", company: "Fernhill Software", email: "noah@fernhill.example" },
|
|
75
|
+
{ id: "c12", name: "Yara Haddad", company: "City Choir", email: "yara@citychoir.example" },
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
const initialDeals: Deal[] = [
|
|
79
|
+
{
|
|
80
|
+
id: "D-118",
|
|
81
|
+
title: "Book launch and signing",
|
|
82
|
+
contact: "c3",
|
|
83
|
+
stage: "lead",
|
|
84
|
+
value: 2400,
|
|
85
|
+
followUp: "2026-10-06",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "D-121",
|
|
89
|
+
title: "Developer meetup, every month",
|
|
90
|
+
contact: "c11",
|
|
91
|
+
stage: "lead",
|
|
92
|
+
value: 3600,
|
|
93
|
+
followUp: "2026-10-08",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "D-122",
|
|
97
|
+
title: "Winter concert, 200 seats",
|
|
98
|
+
contact: "c12",
|
|
99
|
+
stage: "lead",
|
|
100
|
+
value: 5200,
|
|
101
|
+
followUp: "2026-10-09",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "D-114",
|
|
105
|
+
title: "Product launch evening",
|
|
106
|
+
contact: "c1",
|
|
107
|
+
stage: "qualified",
|
|
108
|
+
value: 9800,
|
|
109
|
+
followUp: "2026-10-05",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "D-116",
|
|
113
|
+
title: "Crew training day",
|
|
114
|
+
contact: "c4",
|
|
115
|
+
stage: "qualified",
|
|
116
|
+
value: 4600,
|
|
117
|
+
followUp: "2026-10-07",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "D-117",
|
|
121
|
+
title: "School summer fair",
|
|
122
|
+
contact: "c5",
|
|
123
|
+
stage: "qualified",
|
|
124
|
+
value: 0,
|
|
125
|
+
followUp: "2026-10-12",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "D-109",
|
|
129
|
+
title: "Exhibition of competition entries",
|
|
130
|
+
contact: "c2",
|
|
131
|
+
stage: "proposal",
|
|
132
|
+
value: 8500,
|
|
133
|
+
followUp: "2026-10-02",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "D-111",
|
|
137
|
+
title: "Olive oil tasting for buyers",
|
|
138
|
+
contact: "c6",
|
|
139
|
+
stage: "proposal",
|
|
140
|
+
value: 5600,
|
|
141
|
+
followUp: "2026-10-05",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "D-112",
|
|
145
|
+
title: "Practice team offsite",
|
|
146
|
+
contact: "c7",
|
|
147
|
+
stage: "proposal",
|
|
148
|
+
value: 4200,
|
|
149
|
+
followUp: "2026-10-06",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "D-103",
|
|
153
|
+
title: "Fashion show, autumn collection",
|
|
154
|
+
contact: "c8",
|
|
155
|
+
stage: "won",
|
|
156
|
+
value: 11900,
|
|
157
|
+
followUp: "2026-10-14",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "D-105",
|
|
161
|
+
title: "Wedding reception, 90 guests",
|
|
162
|
+
contact: "c9",
|
|
163
|
+
stage: "won",
|
|
164
|
+
value: 7200,
|
|
165
|
+
followUp: "2026-10-10",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "D-106",
|
|
169
|
+
title: "Season awards night",
|
|
170
|
+
contact: "c10",
|
|
171
|
+
stage: "won",
|
|
172
|
+
value: -800,
|
|
173
|
+
followUp: "2026-10-13",
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
/** [deal, date, kind, text] — newest last; the views sort them. */
|
|
178
|
+
const activitySeed: [string, string, ActivityKind, string][] = [
|
|
179
|
+
["D-118", "2026-09-22", "email", "Asked about dates in November and how many chairs the small hall takes."],
|
|
180
|
+
["D-118", "2026-09-29", "call", "First call. About 60 guests; the author wants a table for signing."],
|
|
181
|
+
["D-121", "2026-09-28", "email", "Sent the floor plan and prices for a regular weekday evening."],
|
|
182
|
+
["D-122", "2026-09-25", "meeting", "Walked through the main hall. The choir needs risers for 40 singers."],
|
|
183
|
+
["D-122", "2026-09-30", "note", "Check whether the piano can stay on stage for the rehearsal."],
|
|
184
|
+
["D-114", "2026-09-15", "call", "Wants a stage, a demo area and catering for 150."],
|
|
185
|
+
["D-114", "2026-09-23", "meeting", "Site visit. They will bring two robots, so the floor load matters."],
|
|
186
|
+
["D-114", "2026-09-29", "email", "Sent two layouts: theatre seating or standing with high tables."],
|
|
187
|
+
["D-116", "2026-09-18", "call", "Training for 30 crew, with a room for the safety briefing."],
|
|
188
|
+
["D-116", "2026-09-26", "email", "Shared the timetable for the day and the lunch options."],
|
|
189
|
+
["D-117", "2026-09-21", "meeting", "Looked at the garden and the hall in case of rain."],
|
|
190
|
+
["D-117", "2026-09-30", "note", "Ask the parents' committee who handles the stalls."],
|
|
191
|
+
["D-109", "2026-09-08", "meeting", "Twelve entries on boards, with models on plinths."],
|
|
192
|
+
["D-109", "2026-09-24", "email", "Sent the proposal with the setup and opening times."],
|
|
193
|
+
[
|
|
194
|
+
"D-109",
|
|
195
|
+
"2026-09-30",
|
|
196
|
+
"call",
|
|
197
|
+
"Questions about lighting for the models. Answered; waiting for a decision.",
|
|
198
|
+
],
|
|
199
|
+
["D-111", "2026-09-17", "call", "Tasting for 40 buyers, with a short talk from the growers."],
|
|
200
|
+
["D-111", "2026-09-27", "email", "Sent the proposal with the kitchen and the tasting tables."],
|
|
201
|
+
["D-112", "2026-09-19", "meeting", "Reviewed rooms for a day of workshops and a dinner."],
|
|
202
|
+
["D-112", "2026-09-28", "email", "Proposal sent. They will reply after the team meeting."],
|
|
203
|
+
["D-103", "2026-09-02", "email", "Signed. Rehearsal booked for the day before."],
|
|
204
|
+
["D-103", "2026-09-26", "note", "The runway layout arrives in the first week of October."],
|
|
205
|
+
["D-105", "2026-09-10", "call", "Agreed on the terrace for drinks and the main hall for dinner."],
|
|
206
|
+
["D-105", "2026-09-24", "meeting", "Signed after the tasting menu."],
|
|
207
|
+
["D-106", "2026-09-12", "email", "Signed. The club brings its own trophies and screen."],
|
|
208
|
+
["D-106", "2026-09-29", "note", "Send the parking map before the night."],
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
function seedActivity(): Record<string, Entry[]> {
|
|
212
|
+
const out: Record<string, Entry[]> = {};
|
|
213
|
+
activitySeed.forEach(([deal, date, kind, text], i) => {
|
|
214
|
+
(out[deal] ??= []).push({ id: `a${i}`, date, kind, text });
|
|
215
|
+
});
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Each stage is a kind people scan for, so each has one category tone, used for it everywhere: its
|
|
221
|
+
* tag, its segment of the stage track, and its column on the Kanban board. The name always goes
|
|
222
|
+
* with the colour.
|
|
223
|
+
*/
|
|
224
|
+
const stages: {
|
|
225
|
+
id: Stage;
|
|
226
|
+
label: string;
|
|
227
|
+
icon: React.ReactNode;
|
|
228
|
+
tone: "blue" | "aqua" | "violet" | "lime";
|
|
229
|
+
/** The tone as a fill, written out so Tailwind finds the class. */
|
|
230
|
+
fill: string;
|
|
231
|
+
}[] = [
|
|
232
|
+
{ id: "lead", label: "Lead", icon: <CircleDashedIcon />, tone: "blue", fill: "bg-tone-blue" },
|
|
233
|
+
{ id: "qualified", label: "Qualified", icon: <CircleDotIcon />, tone: "aqua", fill: "bg-tone-aqua" },
|
|
234
|
+
{ id: "proposal", label: "Proposal", icon: <FileTextIcon />, tone: "violet", fill: "bg-tone-violet" },
|
|
235
|
+
{ id: "won", label: "Won", icon: <CircleCheckIcon />, tone: "lime", fill: "bg-tone-lime" },
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
const stageOf = (stage: Stage) => stages.find((s) => s.id === stage) ?? stages[0]!;
|
|
239
|
+
|
|
240
|
+
/** A stage as a tag in its tone, with its icon: the text names it, the colour finds it. */
|
|
241
|
+
function StageTag({ stage, className }: { stage: Stage; className?: string }) {
|
|
242
|
+
const s = stageOf(stage);
|
|
243
|
+
return (
|
|
244
|
+
// Licht Mono sits its capitals a pixel above the middle of the 22px tag: the icon rises with
|
|
245
|
+
// them, so the check and "Won" (and every stage's icon and name) share one centre line.
|
|
246
|
+
<Tag tone={s.tone} className={className}>
|
|
247
|
+
{s.icon}
|
|
248
|
+
{s.label}
|
|
249
|
+
</Tag>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const kindIcon = { call: PhoneIcon, email: MailIcon, meeting: CalendarIcon, note: StickyNoteIcon } as const;
|
|
254
|
+
|
|
255
|
+
const kindLabel = { call: "Call", email: "Email", meeting: "Meeting", note: "Note" } as const;
|
|
256
|
+
|
|
257
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
258
|
+
|
|
259
|
+
/** "2026-10-06" → "Oct 06", without the time zone getting a say. */
|
|
260
|
+
function formatDate(iso: string) {
|
|
261
|
+
const [, month = "1", day = "1"] = iso.split("-");
|
|
262
|
+
return `${MONTHS[Number(month) - 1] ?? ""} ${day}`;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** A signed figure by its sign: above zero in the success colour, below in the destructive
|
|
266
|
+
colour, zero in the ink. The sign stays in the text, so the colour only repeats it. */
|
|
267
|
+
|
|
268
|
+
const valueTone = (value: number) =>
|
|
269
|
+
value > 0 ? "text-success" : value < 0 ? "text-destructive" : "text-foreground";
|
|
270
|
+
|
|
271
|
+
const euros = new Intl.NumberFormat("en-GB", {
|
|
272
|
+
style: "currency",
|
|
273
|
+
currency: "EUR",
|
|
274
|
+
maximumFractionDigits: 0,
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const contactOf = (deal: Deal): Contact => contacts.find((c) => c.id === deal.contact) ?? contacts[0]!;
|
|
278
|
+
|
|
279
|
+
function newestFirst(entries: Entry[]) {
|
|
280
|
+
// A stable sort keeps a note added today above the older entries of the same day.
|
|
281
|
+
return [...entries].sort((a, b) => b.date.localeCompare(a.date));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function matches(deal: Deal, query: string) {
|
|
285
|
+
if (!query) return true;
|
|
286
|
+
const contact = contactOf(deal);
|
|
287
|
+
return [deal.id, deal.title, contact.name, contact.company].some((s) => s.toLowerCase().includes(query));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* ── The deal list ─────────────────────────────────────────────────────────── */
|
|
291
|
+
|
|
292
|
+
/** A column header drawn as its icon; screen readers hear the name. */
|
|
293
|
+
function HeadIcon({ icon, name }: { icon: React.ReactNode; name: string }) {
|
|
294
|
+
return (
|
|
295
|
+
<>
|
|
296
|
+
<span aria-hidden className="flex [&_svg]:size-3.5">
|
|
297
|
+
{icon}
|
|
298
|
+
</span>
|
|
299
|
+
<span className="sr-only">{name}</span>
|
|
300
|
+
</>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The deals under their stage. As the list narrows, the contact's avatar steps out first, then
|
|
306
|
+
* the company moves inline after the title, then the follow-up date steps out. The value always
|
|
307
|
+
* keeps its column.
|
|
308
|
+
*/
|
|
309
|
+
function DealTable({
|
|
310
|
+
groups,
|
|
311
|
+
selectedId,
|
|
312
|
+
onOpen,
|
|
313
|
+
open,
|
|
314
|
+
onOpenChange,
|
|
315
|
+
}: {
|
|
316
|
+
groups: { id: Stage; label: string; items: Deal[] }[];
|
|
317
|
+
selectedId: string;
|
|
318
|
+
onOpen: (id: string) => void;
|
|
319
|
+
open: string[];
|
|
320
|
+
onOpenChange: (id: string, open: boolean) => void;
|
|
321
|
+
}) {
|
|
322
|
+
return (
|
|
323
|
+
<Table fit aria-label="Deals by stage" containerProps={{ className: "min-h-0 flex-1" }}>
|
|
324
|
+
<TableHeader>
|
|
325
|
+
<TableRow>
|
|
326
|
+
<TableHead>Deal</TableHead>
|
|
327
|
+
<TableHead priority={2} inline width="9.5rem">
|
|
328
|
+
<HeadIcon icon={<Building2Icon />} name="Company" />
|
|
329
|
+
</TableHead>
|
|
330
|
+
<TableHead priority={1} align="end" width="1.5rem">
|
|
331
|
+
<HeadIcon icon={<UserRoundIcon />} name="Contact" />
|
|
332
|
+
</TableHead>
|
|
333
|
+
<TableHead priority={3} align="end" width="3.5rem">
|
|
334
|
+
<HeadIcon icon={<CalendarIcon />} name="Follow-up" />
|
|
335
|
+
</TableHead>
|
|
336
|
+
<TableHead align="end" width="4rem">
|
|
337
|
+
<HeadIcon icon={<EuroIcon />} name="Value" />
|
|
338
|
+
</TableHead>
|
|
339
|
+
</TableRow>
|
|
340
|
+
</TableHeader>
|
|
341
|
+
{groups.map((group) => (
|
|
342
|
+
<TableGroup
|
|
343
|
+
key={group.id}
|
|
344
|
+
open={open.includes(group.id)}
|
|
345
|
+
onOpenChange={(next) => onOpenChange(group.id, next)}
|
|
346
|
+
>
|
|
347
|
+
<TableGroupHeader sticky count={group.items.length}>
|
|
348
|
+
<StageTag stage={group.id} />
|
|
349
|
+
</TableGroupHeader>
|
|
350
|
+
{group.items.map((d) => (
|
|
351
|
+
// The margin keeps a row scrolled into view clear of its sticky group header.
|
|
352
|
+
<TableRow
|
|
353
|
+
key={d.id}
|
|
354
|
+
data-selected={d.id === selectedId ? "" : undefined}
|
|
355
|
+
className="scroll-mt-12"
|
|
356
|
+
>
|
|
357
|
+
<TableCell>
|
|
358
|
+
<button
|
|
359
|
+
type="button"
|
|
360
|
+
aria-current={d.id === selectedId ? "true" : undefined}
|
|
361
|
+
onClick={() => onOpen(d.id)}
|
|
362
|
+
// The stretched ::after makes the whole row the target; the row is the positioned box.
|
|
363
|
+
className="cursor-pointer text-start after:absolute after:inset-0 after:content-['']"
|
|
364
|
+
>
|
|
365
|
+
{d.title}
|
|
366
|
+
</button>
|
|
367
|
+
</TableCell>
|
|
368
|
+
<TableCell className="text-13 text-muted-foreground">{contactOf(d).company}</TableCell>
|
|
369
|
+
<TableCell>
|
|
370
|
+
<Avatar size="sm" name={contactOf(d).name} aria-hidden />
|
|
371
|
+
<span className="sr-only">{contactOf(d).name}</span>
|
|
372
|
+
</TableCell>
|
|
373
|
+
<TableCell className="font-mono text-12 tabular-nums">{formatDate(d.followUp)}</TableCell>
|
|
374
|
+
<TableCell className={cn("font-mono text-12 tabular-nums", valueTone(d.value))}>
|
|
375
|
+
{euros.format(d.value)}
|
|
376
|
+
</TableCell>
|
|
377
|
+
</TableRow>
|
|
378
|
+
))}
|
|
379
|
+
</TableGroup>
|
|
380
|
+
))}
|
|
381
|
+
</Table>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/* ── Deal detail ───────────────────────────────────────────────────────────── */
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Where the deal stands: the four stages as segments of one track. Each stage reached fills its
|
|
389
|
+
* segment in its own tone; the stages ahead stay grey. The current stage is named in the ink.
|
|
390
|
+
*/
|
|
391
|
+
function StageTrack({ stage }: { stage: Stage }) {
|
|
392
|
+
const at = stages.findIndex((s) => s.id === stage);
|
|
393
|
+
return (
|
|
394
|
+
<ol aria-label="Stage" className="m-0 grid list-none grid-cols-4 gap-1.5 p-0">
|
|
395
|
+
{stages.map((s, i) => (
|
|
396
|
+
<li key={s.id} aria-current={i === at ? "step" : undefined} className="flex min-w-0 flex-col gap-2">
|
|
397
|
+
{/* Drawn in system colours when colours are forced, which would otherwise erase the fill. */}
|
|
398
|
+
<span
|
|
399
|
+
aria-hidden
|
|
400
|
+
className={cn(
|
|
401
|
+
"h-1 rounded-full transition-colors duration-(--duration-fade) ease-(--ease) forced-color-adjust-none",
|
|
402
|
+
i <= at
|
|
403
|
+
? cn(s.fill, "forced-colors:bg-[CanvasText]")
|
|
404
|
+
: "bg-control-hover forced-colors:bg-[GrayText]",
|
|
405
|
+
)}
|
|
406
|
+
/>
|
|
407
|
+
<span
|
|
408
|
+
className={cn(
|
|
409
|
+
"flex min-w-0 items-center gap-1 font-mono text-11 tracking-[0.04em]",
|
|
410
|
+
i === at ? "text-foreground" : "text-muted-foreground",
|
|
411
|
+
)}
|
|
412
|
+
>
|
|
413
|
+
{/* Its own box, so a label too long for a narrow panel ends in an ellipsis. */}
|
|
414
|
+
<span className="truncate">{s.label}</span>
|
|
415
|
+
{i < at && <span className="sr-only"> (done)</span>}
|
|
416
|
+
</span>
|
|
417
|
+
</li>
|
|
418
|
+
))}
|
|
419
|
+
</ol>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
interface DealDetailProps {
|
|
424
|
+
deal: Deal;
|
|
425
|
+
activity: Entry[];
|
|
426
|
+
/** The title block: an `h3` beside the list, `DrawerTitle` in the drawer. */
|
|
427
|
+
heading: React.ReactNode;
|
|
428
|
+
onMove: (stage: Stage) => void;
|
|
429
|
+
onAddNote: (text: string) => void;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function DealDetail({ deal, activity, heading, onMove, onAddNote }: DealDetailProps) {
|
|
433
|
+
const contact = contactOf(deal);
|
|
434
|
+
const [draft, setDraft] = React.useState("");
|
|
435
|
+
|
|
436
|
+
const addNote = (event: React.FormEvent) => {
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
const text = draft.trim();
|
|
439
|
+
if (!text) return;
|
|
440
|
+
onAddNote(text);
|
|
441
|
+
setDraft("");
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
return (
|
|
445
|
+
<div className="flex flex-col gap-6">
|
|
446
|
+
{heading}
|
|
447
|
+
|
|
448
|
+
<StageTrack stage={deal.stage} />
|
|
449
|
+
|
|
450
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
451
|
+
<span className="font-mono text-12 text-muted-foreground tabular-nums">{deal.id}</span>
|
|
452
|
+
<Menu>
|
|
453
|
+
<MenuTrigger render={<Button variant="secondary" size="sm" className="ms-auto" />}>
|
|
454
|
+
Actions
|
|
455
|
+
<ChevronDownIcon aria-hidden />
|
|
456
|
+
</MenuTrigger>
|
|
457
|
+
<MenuContent align="end">
|
|
458
|
+
<MenuGroup>
|
|
459
|
+
<MenuGroupLabel>Move to stage</MenuGroupLabel>
|
|
460
|
+
<MenuRadioGroup value={deal.stage} onValueChange={(value) => onMove(value as Stage)}>
|
|
461
|
+
{stages.map((s) => (
|
|
462
|
+
<MenuRadioItem key={s.id} value={s.id}>
|
|
463
|
+
{s.label}
|
|
464
|
+
</MenuRadioItem>
|
|
465
|
+
))}
|
|
466
|
+
</MenuRadioGroup>
|
|
467
|
+
</MenuGroup>
|
|
468
|
+
<MenuSeparator />
|
|
469
|
+
<MenuItem
|
|
470
|
+
onClick={() => {
|
|
471
|
+
navigator.clipboard?.writeText(contact.email).catch(() => {});
|
|
472
|
+
}}
|
|
473
|
+
>
|
|
474
|
+
<CopyIcon />
|
|
475
|
+
Copy email address
|
|
476
|
+
</MenuItem>
|
|
477
|
+
<MenuLinkItem href={`mailto:${contact.email}`}>
|
|
478
|
+
<MailIcon />
|
|
479
|
+
Write to {contact.name.split(" ")[0]}
|
|
480
|
+
</MenuLinkItem>
|
|
481
|
+
</MenuContent>
|
|
482
|
+
</Menu>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
<dl className="m-0 grid grid-cols-2 gap-x-6 gap-y-4 border-t border-border/60 pt-5">
|
|
486
|
+
<div className="flex flex-col gap-1.5">
|
|
487
|
+
<dt className="eyebrow">Value</dt>
|
|
488
|
+
<dd className={cn("m-0 font-mono text-15 tabular-nums", valueTone(deal.value))}>
|
|
489
|
+
{euros.format(deal.value)}
|
|
490
|
+
</dd>
|
|
491
|
+
</div>
|
|
492
|
+
<div className="flex flex-col gap-1.5">
|
|
493
|
+
<dt className="eyebrow">Follow-up</dt>
|
|
494
|
+
<dd className="m-0 font-mono text-15 tabular-nums">{formatDate(deal.followUp)}</dd>
|
|
495
|
+
</div>
|
|
496
|
+
</dl>
|
|
497
|
+
|
|
498
|
+
<section aria-label="Contact" className="flex flex-col gap-3 border-t border-border/60 pt-5">
|
|
499
|
+
<span className="eyebrow" aria-hidden>
|
|
500
|
+
Contact
|
|
501
|
+
</span>
|
|
502
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
503
|
+
<Avatar size="lg" name={contact.name} aria-hidden />
|
|
504
|
+
<div className="flex min-w-0 flex-col gap-0.5">
|
|
505
|
+
<span className="text-15 text-foreground">{contact.name}</span>
|
|
506
|
+
<span className="text-13 text-muted-foreground">{contact.company}</span>
|
|
507
|
+
<a href={`mailto:${contact.email}`} className="w-fit text-13 wrap-anywhere link">
|
|
508
|
+
{contact.email}
|
|
509
|
+
</a>
|
|
510
|
+
</div>
|
|
511
|
+
</div>
|
|
512
|
+
</section>
|
|
513
|
+
|
|
514
|
+
<form onSubmit={addNote} className="flex flex-col gap-3 border-t border-border/60 pt-5">
|
|
515
|
+
<Field>
|
|
516
|
+
<FieldLabel>Note</FieldLabel>
|
|
517
|
+
<Textarea
|
|
518
|
+
value={draft}
|
|
519
|
+
onChange={(event) => setDraft(event.target.value)}
|
|
520
|
+
placeholder={`What did you agree with ${contact.name.split(" ")[0]}?`}
|
|
521
|
+
/>
|
|
522
|
+
</Field>
|
|
523
|
+
{/* Focusable while disabled: it disables itself once the note is added, and keeps focus. */}
|
|
524
|
+
<Button type="submit" className="self-end" disabled={!draft.trim()} focusableWhenDisabled>
|
|
525
|
+
Add note
|
|
526
|
+
</Button>
|
|
527
|
+
</form>
|
|
528
|
+
|
|
529
|
+
<section aria-label="Activity" className="flex flex-col gap-2">
|
|
530
|
+
<span className="eyebrow" aria-hidden>
|
|
531
|
+
Activity
|
|
532
|
+
</span>
|
|
533
|
+
<ul className="m-0 list-none p-0">
|
|
534
|
+
{newestFirst(activity).map((entry) => {
|
|
535
|
+
const Icon = kindIcon[entry.kind];
|
|
536
|
+
return (
|
|
537
|
+
<li
|
|
538
|
+
key={entry.id}
|
|
539
|
+
className="grid grid-cols-[3.25rem_1rem_minmax(0,1fr)] items-start gap-3 border-t border-border/60 py-3"
|
|
540
|
+
>
|
|
541
|
+
<span className="pt-px font-mono text-12 leading-5 text-muted-foreground tabular-nums">
|
|
542
|
+
{formatDate(entry.date)}
|
|
543
|
+
</span>
|
|
544
|
+
<Icon aria-hidden className="mt-0.5 size-4 text-muted-foreground" />
|
|
545
|
+
<span className="text-sm leading-5 wrap-anywhere text-foreground-soft">
|
|
546
|
+
<span className="sr-only">{kindLabel[entry.kind]}: </span>
|
|
547
|
+
{entry.text}
|
|
548
|
+
</span>
|
|
549
|
+
</li>
|
|
550
|
+
);
|
|
551
|
+
})}
|
|
552
|
+
</ul>
|
|
553
|
+
</section>
|
|
554
|
+
</div>
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/* ── Pages ─────────────────────────────────────────────────────────────────── */
|
|
559
|
+
|
|
560
|
+
/** The signed-in person at the foot of the sidebar, with their own menu. */
|
|
561
|
+
function AccountMenu() {
|
|
562
|
+
return (
|
|
563
|
+
<Menu>
|
|
564
|
+
<MenuTrigger
|
|
565
|
+
render={
|
|
566
|
+
<SidebarItem
|
|
567
|
+
render={<button type="button" />}
|
|
568
|
+
tooltip={false}
|
|
569
|
+
// A 24px avatar in place of a 16px icon: (row - avatar - border) / 2 a side in the icon rail.
|
|
570
|
+
className="group-data-[collapsible=icon]/sidebar:px-[6px]"
|
|
571
|
+
/>
|
|
572
|
+
}
|
|
573
|
+
>
|
|
574
|
+
{/* Named by what it shows, so voice control reaches it by any word on it. */}
|
|
575
|
+
<span className="sr-only">Account: </span>
|
|
576
|
+
<Avatar size="sm" name="Mira Castell" aria-hidden />
|
|
577
|
+
<span className="flex min-w-0 flex-1 flex-col gap-0.5 text-start">
|
|
578
|
+
<span className="truncate leading-tight">Mira Castell</span>
|
|
579
|
+
<span className="truncate text-xs leading-tight text-muted-foreground">Events team</span>
|
|
580
|
+
</span>
|
|
581
|
+
<ChevronsUpDownIcon className="text-muted-foreground" />
|
|
582
|
+
</MenuTrigger>
|
|
583
|
+
<MenuContent side="top" align="start" className="min-w-56">
|
|
584
|
+
<MenuItem>
|
|
585
|
+
<UserRoundIcon />
|
|
586
|
+
Your profile
|
|
587
|
+
</MenuItem>
|
|
588
|
+
<MenuItem>
|
|
589
|
+
<SettingsIcon />
|
|
590
|
+
Settings
|
|
591
|
+
</MenuItem>
|
|
592
|
+
<MenuSeparator />
|
|
593
|
+
<MenuItem>
|
|
594
|
+
<LogOutIcon className="rtl:-scale-x-100" />
|
|
595
|
+
Sign out
|
|
596
|
+
</MenuItem>
|
|
597
|
+
</MenuContent>
|
|
598
|
+
</Menu>
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
type Page = "pipeline" | "contacts" | "activity";
|
|
603
|
+
|
|
604
|
+
const pages: { id: Page; label: string; icon: React.ComponentType }[] = [
|
|
605
|
+
{ id: "pipeline", label: "Pipeline", icon: KanbanIcon },
|
|
606
|
+
{ id: "contacts", label: "Contacts", icon: UsersIcon },
|
|
607
|
+
{ id: "activity", label: "Activity", icon: ActivityIcon },
|
|
608
|
+
];
|
|
609
|
+
|
|
610
|
+
function PageHeading({ children }: { children: React.ReactNode }) {
|
|
611
|
+
return (
|
|
612
|
+
<div className="flex shrink-0 flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
|
|
613
|
+
<h2 className="m-0 font-heading text-28 leading-[1.1] font-light tracking-[-0.02em]">{children}</h2>
|
|
614
|
+
</div>
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function NoMatches({ what, onClear }: { what: string; onClear: () => void }) {
|
|
619
|
+
return (
|
|
620
|
+
<Empty className="flex-1">
|
|
621
|
+
<EmptyMedia>
|
|
622
|
+
<SearchIcon />
|
|
623
|
+
</EmptyMedia>
|
|
624
|
+
<EmptyTitle>No {what} match</EmptyTitle>
|
|
625
|
+
<EmptyDescription>Search looks at deal names, companies and contacts.</EmptyDescription>
|
|
626
|
+
<EmptyActions>
|
|
627
|
+
<Button variant="secondary" onClick={onClear}>
|
|
628
|
+
Clear search
|
|
629
|
+
</Button>
|
|
630
|
+
</EmptyActions>
|
|
631
|
+
</Empty>
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/** The width of an element, kept current with a ResizeObserver. */
|
|
636
|
+
function useWidth<T extends HTMLElement>() {
|
|
637
|
+
const ref = React.useRef<T>(null);
|
|
638
|
+
const [width, setWidth] = React.useState(0);
|
|
639
|
+
React.useLayoutEffect(() => {
|
|
640
|
+
const el = ref.current;
|
|
641
|
+
if (!el) return;
|
|
642
|
+
setWidth(el.getBoundingClientRect().width);
|
|
643
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
644
|
+
if (entry) setWidth(entry.contentRect.width);
|
|
645
|
+
});
|
|
646
|
+
observer.observe(el);
|
|
647
|
+
return () => observer.disconnect();
|
|
648
|
+
}, []);
|
|
649
|
+
return [ref, width] as const;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/** Below this width of the main area the detail opens in a drawer instead of beside the list. */
|
|
653
|
+
const SPLIT_MIN = 720;
|
|
654
|
+
|
|
655
|
+
function Workspace() {
|
|
656
|
+
const { isMobile } = useSidebar();
|
|
657
|
+
const direction = useDirection();
|
|
658
|
+
const [page, setPage] = React.useState<Page>("pipeline");
|
|
659
|
+
const [deals, setDeals] = React.useState(initialDeals);
|
|
660
|
+
const [activity, setActivity] = React.useState(seedActivity);
|
|
661
|
+
const [selectedId, setSelectedId] = React.useState("D-109");
|
|
662
|
+
const [query, setQuery] = React.useState("");
|
|
663
|
+
const [openGroups, setOpenGroups] = React.useState<string[]>(stages.map((s) => s.id));
|
|
664
|
+
const [drawerOpen, setDrawerOpen] = React.useState(false);
|
|
665
|
+
const [mainRef, mainWidth] = useWidth<HTMLDivElement>();
|
|
666
|
+
const searchRef = React.useRef<HTMLInputElement>(null);
|
|
667
|
+
const detailHeading = React.useRef<HTMLHeadingElement>(null);
|
|
668
|
+
/** Set when a deal opens from Contacts or Activity: the button pressed goes with that page. */
|
|
669
|
+
const focusDetail = React.useRef(false);
|
|
670
|
+
|
|
671
|
+
const split = mainWidth >= SPLIT_MIN;
|
|
672
|
+
const q = query.trim().toLowerCase();
|
|
673
|
+
const selected = deals.find((d) => d.id === selectedId) ?? deals[0]!;
|
|
674
|
+
const shown = deals.filter((d) => matches(d, q));
|
|
675
|
+
const groups = stages.map((s) => ({
|
|
676
|
+
...s,
|
|
677
|
+
items: shown.filter((d) => d.stage === s.id),
|
|
678
|
+
}));
|
|
679
|
+
const currentLabel = pages.find((p) => p.id === page)?.label ?? "Pipeline";
|
|
680
|
+
|
|
681
|
+
const openDeal = (id: string) => {
|
|
682
|
+
setSelectedId(id);
|
|
683
|
+
setPage("pipeline");
|
|
684
|
+
if (!split) setDrawerOpen(true);
|
|
685
|
+
else if (page !== "pipeline") focusDetail.current = true;
|
|
686
|
+
};
|
|
687
|
+
// Focus lands on the deal's heading beside the list (the drawer takes focus by itself).
|
|
688
|
+
React.useEffect(() => {
|
|
689
|
+
if (!focusDetail.current) return;
|
|
690
|
+
focusDetail.current = false;
|
|
691
|
+
detailHeading.current?.focus();
|
|
692
|
+
}, [page, selectedId]);
|
|
693
|
+
// A window widened past the split closes the drawer for good, so narrowing it again shows the
|
|
694
|
+
// list, not the drawer. Focus was in the drawer, which is gone: it moves to the same deal beside
|
|
695
|
+
// the list.
|
|
696
|
+
React.useEffect(() => {
|
|
697
|
+
if (!split || !drawerOpen) return;
|
|
698
|
+
setDrawerOpen(false);
|
|
699
|
+
detailHeading.current?.focus();
|
|
700
|
+
}, [split, drawerOpen]);
|
|
701
|
+
/** The empty state and its button go once the search is cleared: back to the search field. */
|
|
702
|
+
const clearSearch = () => {
|
|
703
|
+
setQuery("");
|
|
704
|
+
searchRef.current?.focus();
|
|
705
|
+
};
|
|
706
|
+
const listRef = React.useRef<HTMLDivElement>(null);
|
|
707
|
+
/** Moving a deal moves its row to another group: once it has been drawn there, it is scrolled
|
|
708
|
+
* only as far as it takes to be in view, so the list still shows which deal is open. */
|
|
709
|
+
const moveDeal = (stage: Stage) => {
|
|
710
|
+
setDeals((prev) => prev.map((d) => (d.id === selected.id ? { ...d, stage } : d)));
|
|
711
|
+
requestAnimationFrame(() =>
|
|
712
|
+
listRef.current?.querySelector("[data-selected]")?.scrollIntoView({ block: "nearest" }),
|
|
713
|
+
);
|
|
714
|
+
};
|
|
715
|
+
const addNote = (text: string) =>
|
|
716
|
+
setActivity((prev) => ({
|
|
717
|
+
...prev,
|
|
718
|
+
[selected.id]: [
|
|
719
|
+
{ id: `${selected.id}-note-${(prev[selected.id] ?? []).length}`, date: TODAY, kind: "note", text },
|
|
720
|
+
...(prev[selected.id] ?? []),
|
|
721
|
+
],
|
|
722
|
+
}));
|
|
723
|
+
|
|
724
|
+
const detail = (inDrawer: boolean) => (
|
|
725
|
+
<DealDetail
|
|
726
|
+
key={selected.id}
|
|
727
|
+
deal={selected}
|
|
728
|
+
activity={activity[selected.id] ?? []}
|
|
729
|
+
onMove={moveDeal}
|
|
730
|
+
onAddNote={addNote}
|
|
731
|
+
heading={
|
|
732
|
+
inDrawer ? (
|
|
733
|
+
<DrawerHeader>
|
|
734
|
+
<DrawerTitle>{selected.title}</DrawerTitle>
|
|
735
|
+
<DrawerDescription>{contactOf(selected).company}</DrawerDescription>
|
|
736
|
+
</DrawerHeader>
|
|
737
|
+
) : (
|
|
738
|
+
<div className="flex flex-col gap-1.5">
|
|
739
|
+
<h3
|
|
740
|
+
ref={detailHeading}
|
|
741
|
+
tabIndex={-1}
|
|
742
|
+
className="m-0 font-heading text-24 leading-[1.15] font-light tracking-[-0.02em] outline-none"
|
|
743
|
+
>
|
|
744
|
+
{selected.title}
|
|
745
|
+
</h3>
|
|
746
|
+
<p className="m-0 text-sm text-muted-foreground">{contactOf(selected).company}</p>
|
|
747
|
+
</div>
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
/>
|
|
751
|
+
);
|
|
752
|
+
|
|
753
|
+
const list = (
|
|
754
|
+
<div ref={listRef} className="flex h-full min-h-0 flex-col gap-4 p-4 @xl:p-6">
|
|
755
|
+
<PageHeading>Pipeline</PageHeading>
|
|
756
|
+
{shown.length === 0 ? (
|
|
757
|
+
<NoMatches what="deals" onClear={clearSearch} />
|
|
758
|
+
) : (
|
|
759
|
+
<DealTable
|
|
760
|
+
groups={groups}
|
|
761
|
+
selectedId={selected.id}
|
|
762
|
+
onOpen={openDeal}
|
|
763
|
+
open={openGroups}
|
|
764
|
+
onOpenChange={(id, next) =>
|
|
765
|
+
setOpenGroups((prev) =>
|
|
766
|
+
next ? [...prev.filter((x) => x !== id), id] : prev.filter((x) => x !== id),
|
|
767
|
+
)
|
|
768
|
+
}
|
|
769
|
+
/>
|
|
770
|
+
)}
|
|
771
|
+
</div>
|
|
772
|
+
);
|
|
773
|
+
|
|
774
|
+
let content: React.ReactNode;
|
|
775
|
+
if (page === "pipeline") {
|
|
776
|
+
content = split ? (
|
|
777
|
+
<ResizablePanelGroup className="min-h-0 flex-1">
|
|
778
|
+
<ResizablePanel id="deals" defaultSize="58%" minSize="340px">
|
|
779
|
+
{list}
|
|
780
|
+
</ResizablePanel>
|
|
781
|
+
<ResizableHandle aria-label="Resize deal details" />
|
|
782
|
+
<ResizablePanel id="detail" defaultSize="42%" minSize="300px">
|
|
783
|
+
<section aria-label="Deal details" className="h-full overflow-y-auto p-5 @xl:p-6">
|
|
784
|
+
{detail(false)}
|
|
785
|
+
</section>
|
|
786
|
+
</ResizablePanel>
|
|
787
|
+
</ResizablePanelGroup>
|
|
788
|
+
) : (
|
|
789
|
+
<>
|
|
790
|
+
{list}
|
|
791
|
+
{/* From the end of the line, where the detail sits when there is room: the left, right to left. */}
|
|
792
|
+
<Drawer
|
|
793
|
+
open={drawerOpen && !split}
|
|
794
|
+
onOpenChange={setDrawerOpen}
|
|
795
|
+
side={isMobile ? "bottom" : direction === "rtl" ? "left" : "right"}
|
|
796
|
+
>
|
|
797
|
+
<DrawerContent>{detail(true)}</DrawerContent>
|
|
798
|
+
</Drawer>
|
|
799
|
+
</>
|
|
800
|
+
);
|
|
801
|
+
} else if (page === "contacts") {
|
|
802
|
+
const people = deals.filter((d) => matches(d, q));
|
|
803
|
+
content = (
|
|
804
|
+
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4 @xl:p-6">
|
|
805
|
+
<PageHeading>Contacts</PageHeading>
|
|
806
|
+
{people.length === 0 ? (
|
|
807
|
+
<NoMatches what="contacts" onClear={clearSearch} />
|
|
808
|
+
) : (
|
|
809
|
+
<ItemGroup render={<ul />} aria-label="Contacts" className="gap-0">
|
|
810
|
+
{people.map((deal, i) => {
|
|
811
|
+
const contact = contactOf(deal);
|
|
812
|
+
return (
|
|
813
|
+
<React.Fragment key={contact.id}>
|
|
814
|
+
{i > 0 && <ItemSeparator />}
|
|
815
|
+
<Item render={<li />} className="px-0 @xl:px-2">
|
|
816
|
+
<ItemMedia>
|
|
817
|
+
<Avatar name={contact.name} aria-hidden />
|
|
818
|
+
</ItemMedia>
|
|
819
|
+
<ItemContent>
|
|
820
|
+
<ItemTitle>{contact.name}</ItemTitle>
|
|
821
|
+
<ItemDescription>
|
|
822
|
+
{contact.company} · <a href={`mailto:${contact.email}`}>{contact.email}</a>
|
|
823
|
+
</ItemDescription>
|
|
824
|
+
</ItemContent>
|
|
825
|
+
<ItemActions>
|
|
826
|
+
<StageTag stage={deal.stage} />
|
|
827
|
+
<Button
|
|
828
|
+
variant="ghost"
|
|
829
|
+
size="sm"
|
|
830
|
+
onClick={() => openDeal(deal.id)}
|
|
831
|
+
aria-label={`Open deal: ${deal.title}`}
|
|
832
|
+
>
|
|
833
|
+
Open deal
|
|
834
|
+
</Button>
|
|
835
|
+
</ItemActions>
|
|
836
|
+
</Item>
|
|
837
|
+
</React.Fragment>
|
|
838
|
+
);
|
|
839
|
+
})}
|
|
840
|
+
</ItemGroup>
|
|
841
|
+
)}
|
|
842
|
+
</div>
|
|
843
|
+
);
|
|
844
|
+
} else {
|
|
845
|
+
const entries = deals
|
|
846
|
+
.filter((d) => matches(d, q))
|
|
847
|
+
.flatMap((deal) => (activity[deal.id] ?? []).map((entry) => ({ entry, deal })))
|
|
848
|
+
.sort((a, b) => b.entry.date.localeCompare(a.entry.date));
|
|
849
|
+
content = (
|
|
850
|
+
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4 @xl:p-6">
|
|
851
|
+
<PageHeading>Activity</PageHeading>
|
|
852
|
+
{entries.length === 0 ? (
|
|
853
|
+
<NoMatches what="activities" onClear={clearSearch} />
|
|
854
|
+
) : (
|
|
855
|
+
<ul className="m-0 list-none p-0" aria-label="Activity, newest first">
|
|
856
|
+
{entries.map(({ entry, deal }) => {
|
|
857
|
+
const Icon = kindIcon[entry.kind];
|
|
858
|
+
return (
|
|
859
|
+
<li
|
|
860
|
+
key={entry.id}
|
|
861
|
+
className="grid grid-cols-[3.25rem_1rem_minmax(0,1fr)] items-start gap-3 border-t border-border/60 py-3 last:border-b"
|
|
862
|
+
>
|
|
863
|
+
<span className="pt-px font-mono text-12 leading-5 text-muted-foreground tabular-nums">
|
|
864
|
+
{formatDate(entry.date)}
|
|
865
|
+
</span>
|
|
866
|
+
<Icon aria-hidden className="mt-0.5 size-4 text-muted-foreground" />
|
|
867
|
+
<span className="flex min-w-0 flex-col gap-0.5">
|
|
868
|
+
<span className="text-sm leading-5 wrap-anywhere text-foreground-soft">
|
|
869
|
+
<span className="sr-only">{kindLabel[entry.kind]}: </span>
|
|
870
|
+
{entry.text}
|
|
871
|
+
</span>
|
|
872
|
+
<button
|
|
873
|
+
type="button"
|
|
874
|
+
onClick={() => openDeal(deal.id)}
|
|
875
|
+
className="w-fit cursor-pointer text-start text-13 link"
|
|
876
|
+
>
|
|
877
|
+
{deal.title} · {contactOf(deal).company}
|
|
878
|
+
</button>
|
|
879
|
+
</span>
|
|
880
|
+
</li>
|
|
881
|
+
);
|
|
882
|
+
})}
|
|
883
|
+
</ul>
|
|
884
|
+
)}
|
|
885
|
+
</div>
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
return (
|
|
890
|
+
<>
|
|
891
|
+
<Sidebar aria-label="CRM">
|
|
892
|
+
<SidebarHeader>
|
|
893
|
+
<div className="flex min-h-(--control-h) items-center gap-2.5 overflow-hidden px-[7px] whitespace-nowrap">
|
|
894
|
+
<Wordmark mark={<AcmeMark />} size={24}>
|
|
895
|
+
Acme
|
|
896
|
+
</Wordmark>
|
|
897
|
+
</div>
|
|
898
|
+
</SidebarHeader>
|
|
899
|
+
<SidebarSeparator />
|
|
900
|
+
<SidebarContent>
|
|
901
|
+
<SidebarGroup>
|
|
902
|
+
<SidebarGroupLabel>CRM</SidebarGroupLabel>
|
|
903
|
+
{pages.map((p) => (
|
|
904
|
+
<SidebarItem
|
|
905
|
+
key={p.id}
|
|
906
|
+
href={`#${p.id}`}
|
|
907
|
+
current={p.id === page}
|
|
908
|
+
onClick={(event) => {
|
|
909
|
+
event.preventDefault();
|
|
910
|
+
setPage(p.id);
|
|
911
|
+
}}
|
|
912
|
+
>
|
|
913
|
+
<p.icon />
|
|
914
|
+
{p.label}
|
|
915
|
+
</SidebarItem>
|
|
916
|
+
))}
|
|
917
|
+
</SidebarGroup>
|
|
918
|
+
</SidebarContent>
|
|
919
|
+
<SidebarFooter>
|
|
920
|
+
<AccountMenu />
|
|
921
|
+
</SidebarFooter>
|
|
922
|
+
<SidebarRail />
|
|
923
|
+
</Sidebar>
|
|
924
|
+
<SidebarInset className="@container min-h-0 overflow-hidden">
|
|
925
|
+
<header className="flex shrink-0 items-center gap-3 border-b border-border/60 py-2 ps-2 pe-4">
|
|
926
|
+
<SidebarTrigger variant="bare" />
|
|
927
|
+
<Separator orientation="vertical" className="my-auto h-4 min-h-0 self-center @max-xl:hidden" />
|
|
928
|
+
<Breadcrumb className="@max-xl:hidden" items={[{ label: "CRM" }, { label: currentLabel }]} />
|
|
929
|
+
<InputGroup size="sm" className="ms-auto w-full max-w-64">
|
|
930
|
+
<InputGroupInput
|
|
931
|
+
ref={searchRef}
|
|
932
|
+
type="search"
|
|
933
|
+
value={query}
|
|
934
|
+
onValueChange={(value) => setQuery(value)}
|
|
935
|
+
placeholder="Search deals and contacts"
|
|
936
|
+
aria-label="Search deals and contacts"
|
|
937
|
+
/>
|
|
938
|
+
<InputGroupAddon>
|
|
939
|
+
<SearchIcon />
|
|
940
|
+
</InputGroupAddon>
|
|
941
|
+
</InputGroup>
|
|
942
|
+
</header>
|
|
943
|
+
<div ref={mainRef} className="flex min-h-0 flex-1 flex-col">
|
|
944
|
+
{content}
|
|
945
|
+
</div>
|
|
946
|
+
</SidebarInset>
|
|
947
|
+
</>
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
export function Pipeline() {
|
|
952
|
+
return (
|
|
953
|
+
<SidebarProvider
|
|
954
|
+
collapsible="icon"
|
|
955
|
+
storageKey={null}
|
|
956
|
+
keyboardShortcut={false}
|
|
957
|
+
className="h-[720px] min-h-0 w-full overflow-hidden surface-container"
|
|
958
|
+
>
|
|
959
|
+
<Workspace />
|
|
960
|
+
</SidebarProvider>
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
Event bookings at a fictional venue as deals under their stage — Lead, Qualified, Proposal, Won — in the sidebar shell. Pick one and its detail opens beside the list, or in a drawer when there is no room (a bottom sheet on a phone). Move it from the Actions menu, add a note, or search deals, companies and contacts.
|
|
966
|
+
|
|
967
|
+
## Usage
|
|
968
|
+
|
|
969
|
+
- **`Table fit` with `TableGroup`s** — deals under sticky stage headers; columns step out as the list narrows.
|
|
970
|
+
- **`ResizablePanelGroup`** — the list beside the deal's detail when the main area is wide.
|
|
971
|
+
- **`Drawer`** — the detail when it is not: from the side the detail sits on, or the bottom on a phone.
|
|
972
|
+
|
|
973
|
+
To adapt it, swap the columns and the detail: support tickets with the customer, applications with the applicant, orders with the buyer.
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
## Split or drawer
|
|
977
|
+
|
|
978
|
+
- **Decide by the main area's width, not the viewport's**: the sidebar takes its share first. The demo measures it with a `ResizeObserver` and switches below 720px.
|
|
979
|
+
- Keep open groups in your own state (`open` / `onOpenChange`) so they survive the switch. Once the split fits, close the drawer too, or it reopens when the window narrows; focus moves to the deal's heading.
|
|
980
|
+
- A moved deal changes group, perhaps out of view: next frame, `scrollIntoView({ block: "nearest" })` its row; give rows a top scroll margin the sticky header's height.
|
|
981
|
+
- The drawer comes from the right, or the left on a right-to-left page (`useDirection()`).
|
|
982
|
+
|
|
983
|
+
## Colour
|
|
984
|
+
|
|
985
|
+
One tone per stage, everywhere: Lead blue, Qualified aqua, Proposal violet, Won lime — tags, the deal's stage track (stages ahead stay grey) and the Kanban block's columns.
|
|
986
|
+
|
|
987
|
+
## When to use
|
|
988
|
+
|
|
989
|
+
- A small sales tool, or any list–detail tool of the same shape.
|
|
990
|
+
- Sorting and filtering across every column: `DataTable`. Dragging cards across stages: the Kanban block.
|
|
991
|
+
|
|
992
|
+
## The parts
|
|
993
|
+
|
|
994
|
+
| Part | Page | Job |
|
|
995
|
+
| --------------------- | --------------- | ------------------------------------------------------------------------------ |
|
|
996
|
+
| `SidebarProvider` | Sidebar | The app shell: Pipeline, Contacts, Activity; an icon rail, a sheet below 768px |
|
|
997
|
+
| `Table` with `fit` | Table | Deals under their stage; columns step out as the list narrows |
|
|
998
|
+
| `ResizablePanelGroup` | Resizable | The list beside the deal, divided by a hairline people can drag |
|
|
999
|
+
| `Drawer` | Drawer | The deal when there is no room beside the list: a side panel or bottom sheet |
|
|
1000
|
+
| `Menu` | Menu | Actions on the deal: move to a stage, copy or write to the contact |
|
|
1001
|
+
| `InputGroup` | Input Group | Search across deals, companies and contacts |
|
|
1002
|
+
| `Avatar`, `Tag` | Avatar, Tag | The contact's initials; the stage as a tag in its tone, with its icon |
|
|
1003
|
+
| `Field`, `Textarea` | Field, Textarea | The note, with the view's one primary: Add note |
|
|
1004
|
+
| `Item`, `Empty` | Item, Empty | Contact rows; the state when a search finds nothing |
|
|
1005
|
+
|
|
1006
|
+
## Brand rules
|
|
1007
|
+
|
|
1008
|
+
- **Do** keep one primary in view: Add note. Actions, Open deal and Clear search are secondary or ghost.
|
|
1009
|
+
- **Do** set deal values, ids and dates in Licht Mono with tabular figures, with an eyebrow label above in the detail.
|
|
1010
|
+
- **Do** present invented records plainly, but never show invented totals, forecasts or win rates as if measured.
|
|
1011
|
+
- **Do** keep one tone per stage across the app; its name and icon say which stage.
|
|
1012
|
+
- **Do** colour a value by its sign: green above zero, red below (a credit), the ink at zero. The sign stays in the figure.
|
|
1013
|
+
- **Don't** colour rows, group bands or people. Colour stays a small mark: a tag, a 4px segment, a value.
|
|
1014
|
+
- **Don't** box the detail. It is a region divided from the list by the resize hairline, grouped inside by hairlines and whitespace.
|
|
1015
|
+
|
|
1016
|
+
## Accessibility
|
|
1017
|
+
|
|
1018
|
+
- Each deal title is a button that selects it (`aria-current="true"` while shown); a stretched hit area makes the row clickable without changing what screen readers hear.
|
|
1019
|
+
- The table is named "Deals by stage"; the contact column keeps the name for assistive tech beside the decorative avatar.
|
|
1020
|
+
- The detail beside the list is a named region ("Deal details"); in the drawer the deal's title is the drawer's title, focus is trapped, and Esc, a swipe or the close button closes it.
|
|
1021
|
+
- The resize handle is named "Resize deal details" and works with the arrow keys. Search and note have visible or accessible labels; Add note stays disabled until there is text, and keeps focus after adding.
|
|
1022
|
+
- Focus is never left behind: "Clear search" returns it to the search field; opening a deal from Contacts or Activity moves it to the deal's heading.
|