@major-tech/ui 0.0.0-stage → 1.0.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 +101 -0
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/components/accordion.d.ts +33 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +51 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/activity-chart.d.ts +26 -0
- package/dist/components/activity-chart.d.ts.map +1 -0
- package/dist/components/activity-chart.js +56 -0
- package/dist/components/activity-chart.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +28 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +51 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +34 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +59 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/ask-user-question.d.ts +103 -0
- package/dist/components/ask-user-question.d.ts.map +1 -0
- package/dist/components/ask-user-question.js +401 -0
- package/dist/components/ask-user-question.js.map +1 -0
- package/dist/components/attachment-gallery.d.ts +137 -0
- package/dist/components/attachment-gallery.d.ts.map +1 -0
- package/dist/components/attachment-gallery.js +317 -0
- package/dist/components/attachment-gallery.js.map +1 -0
- package/dist/components/avatar.d.ts +37 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +62 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +29 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +50 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/brand-tile.d.ts +33 -0
- package/dist/components/brand-tile.d.ts.map +1 -0
- package/dist/components/brand-tile.js +36 -0
- package/dist/components/brand-tile.js.map +1 -0
- package/dist/components/button.d.ts +51 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +90 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +18 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +78 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +18 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +34 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +48 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +227 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/catalog-card.d.ts +29 -0
- package/dist/components/catalog-card.d.ts.map +1 -0
- package/dist/components/catalog-card.js +20 -0
- package/dist/components/catalog-card.js.map +1 -0
- package/dist/components/chart.d.ts +118 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +209 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +14 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +68 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +100 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/code-block.d.ts +99 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +144 -0
- package/dist/components/code-block.js.map +1 -0
- package/dist/components/collapsible.d.ts +17 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +25 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +51 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +120 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/composer.d.ts +211 -0
- package/dist/components/composer.d.ts.map +1 -0
- package/dist/components/composer.js +605 -0
- package/dist/components/composer.js.map +1 -0
- package/dist/components/connector-request.d.ts +63 -0
- package/dist/components/connector-request.d.ts.map +1 -0
- package/dist/components/connector-request.js +57 -0
- package/dist/components/connector-request.js.map +1 -0
- package/dist/components/context-menu.d.ts +26 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +33 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +61 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +79 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-range-picker.d.ts +54 -0
- package/dist/components/date-range-picker.d.ts.map +1 -0
- package/dist/components/date-range-picker.js +451 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +46 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +75 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +85 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +166 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +77 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +112 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/editor-tabs.d.ts +49 -0
- package/dist/components/editor-tabs.d.ts.map +1 -0
- package/dist/components/editor-tabs.js +157 -0
- package/dist/components/editor-tabs.js.map +1 -0
- package/dist/components/empty-state.d.ts +21 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +14 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/entity-card.d.ts +301 -0
- package/dist/components/entity-card.d.ts.map +1 -0
- package/dist/components/entity-card.js +392 -0
- package/dist/components/entity-card.js.map +1 -0
- package/dist/components/entity-row.d.ts +37 -0
- package/dist/components/entity-row.d.ts.map +1 -0
- package/dist/components/entity-row.js +65 -0
- package/dist/components/entity-row.js.map +1 -0
- package/dist/components/env-var-request.d.ts +51 -0
- package/dist/components/env-var-request.d.ts.map +1 -0
- package/dist/components/env-var-request.js +50 -0
- package/dist/components/env-var-request.js.map +1 -0
- package/dist/components/field.d.ts +30 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +48 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/file-upload.d.ts +108 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +217 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/components/hover-card.d.ts +18 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +84 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +29 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +9 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +13 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/island.d.ts +18 -0
- package/dist/components/island.d.ts.map +1 -0
- package/dist/components/island.js +30 -0
- package/dist/components/island.js.map +1 -0
- package/dist/components/kbd.d.ts +7 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +12 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +38 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/message.d.ts +38 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +25 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +94 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +22 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +36 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/password-input.d.ts +5 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/components/password-input.js +12 -0
- package/dist/components/password-input.js.map +1 -0
- package/dist/components/pepper.d.ts +92 -0
- package/dist/components/pepper.d.ts.map +1 -0
- package/dist/components/pepper.js +1279 -0
- package/dist/components/pepper.js.map +1 -0
- package/dist/components/permission-request.d.ts +53 -0
- package/dist/components/permission-request.d.ts.map +1 -0
- package/dist/components/permission-request.js +54 -0
- package/dist/components/permission-request.js.map +1 -0
- package/dist/components/popover.d.ts +42 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +76 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +9 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +12 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +31 -0
- package/dist/components/progressive-blur.d.ts.map +1 -0
- package/dist/components/progressive-blur.js +44 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +15 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/request-card.d.ts +34 -0
- package/dist/components/request-card.d.ts.map +1 -0
- package/dist/components/request-card.js +50 -0
- package/dist/components/request-card.js.map +1 -0
- package/dist/components/resizable.d.ts +24 -0
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +40 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-overlay.d.ts +136 -0
- package/dist/components/responsive-overlay.d.ts.map +1 -0
- package/dist/components/responsive-overlay.js +302 -0
- package/dist/components/responsive-overlay.js.map +1 -0
- package/dist/components/scroll-shadows.d.ts +11 -0
- package/dist/components/scroll-shadows.d.ts.map +1 -0
- package/dist/components/scroll-shadows.js +53 -0
- package/dist/components/scroll-shadows.js.map +1 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.d.ts.map +1 -0
- package/dist/components/search-field.js +50 -0
- package/dist/components/search-field.js.map +1 -0
- package/dist/components/searchable-select.d.ts +43 -0
- package/dist/components/searchable-select.d.ts.map +1 -0
- package/dist/components/searchable-select.js +39 -0
- package/dist/components/searchable-select.js.map +1 -0
- package/dist/components/select.d.ts +60 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +94 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +12 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/settings-section.d.ts +41 -0
- package/dist/components/settings-section.d.ts.map +1 -0
- package/dist/components/settings-section.js +50 -0
- package/dist/components/settings-section.js.map +1 -0
- package/dist/components/sidebar-item.d.ts +41 -0
- package/dist/components/sidebar-item.d.ts.map +1 -0
- package/dist/components/sidebar-item.js +59 -0
- package/dist/components/sidebar-item.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +10 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +36 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +8 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +21 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +12 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-strip.d.ts +20 -0
- package/dist/components/stat-strip.d.ts.map +1 -0
- package/dist/components/stat-strip.js +11 -0
- package/dist/components/stat-strip.js.map +1 -0
- package/dist/components/status-dot.d.ts +25 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +31 -0
- package/dist/components/status-dot.js.map +1 -0
- package/dist/components/subagent-run.d.ts +27 -0
- package/dist/components/subagent-run.d.ts.map +1 -0
- package/dist/components/subagent-run.js +38 -0
- package/dist/components/subagent-run.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +13 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/system-notice.d.ts +34 -0
- package/dist/components/system-notice.d.ts.map +1 -0
- package/dist/components/system-notice.js +52 -0
- package/dist/components/system-notice.js.map +1 -0
- package/dist/components/table.d.ts +27 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +37 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +40 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +52 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +9 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/thinking-indicator.d.ts +21 -0
- package/dist/components/thinking-indicator.d.ts.map +1 -0
- package/dist/components/thinking-indicator.js +136 -0
- package/dist/components/thinking-indicator.js.map +1 -0
- package/dist/components/thread-status.d.ts +25 -0
- package/dist/components/thread-status.d.ts.map +1 -0
- package/dist/components/thread-status.js +41 -0
- package/dist/components/thread-status.js.map +1 -0
- package/dist/components/todo-list.d.ts +52 -0
- package/dist/components/todo-list.d.ts.map +1 -0
- package/dist/components/todo-list.js +137 -0
- package/dist/components/todo-list.js.map +1 -0
- package/dist/components/toggle-group.d.ts +17 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +26 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tool-call.d.ts +60 -0
- package/dist/components/tool-call.d.ts.map +1 -0
- package/dist/components/tool-call.js +94 -0
- package/dist/components/tool-call.js.map +1 -0
- package/dist/components/tool-result.d.ts +127 -0
- package/dist/components/tool-result.d.ts.map +1 -0
- package/dist/components/tool-result.js +155 -0
- package/dist/components/tool-result.js.map +1 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +38 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trace.d.ts +38 -0
- package/dist/components/trace.d.ts.map +1 -0
- package/dist/components/trace.js +52 -0
- package/dist/components/trace.js.map +1 -0
- package/dist/components/turn-summary.d.ts +17 -0
- package/dist/components/turn-summary.d.ts.map +1 -0
- package/dist/components/turn-summary.js +19 -0
- package/dist/components/turn-summary.js.map +1 -0
- package/dist/components/usage-meter.d.ts +16 -0
- package/dist/components/usage-meter.d.ts.map +1 -0
- package/dist/components/usage-meter.js +10 -0
- package/dist/components/usage-meter.js.map +1 -0
- package/dist/components/view-switcher.d.ts +25 -0
- package/dist/components/view-switcher.d.ts.map +1 -0
- package/dist/components/view-switcher.js +196 -0
- package/dist/components/view-switcher.js.map +1 -0
- package/dist/docs/components/accordion.md +151 -0
- package/dist/docs/components/activity-chart.md +104 -0
- package/dist/docs/components/alert-dialog.md +216 -0
- package/dist/docs/components/alert.md +203 -0
- package/dist/docs/components/ask-user-question.md +429 -0
- package/dist/docs/components/attachment-gallery.md +377 -0
- package/dist/docs/components/avatar.md +197 -0
- package/dist/docs/components/badge.md +162 -0
- package/dist/docs/components/brand-tile.md +138 -0
- package/dist/docs/components/button.md +392 -0
- package/dist/docs/components/calendar.md +113 -0
- package/dist/docs/components/card.md +157 -0
- package/dist/docs/components/carousel.md +144 -0
- package/dist/docs/components/catalog-card.md +136 -0
- package/dist/docs/components/chart.md +608 -0
- package/dist/docs/components/checkbox.md +164 -0
- package/dist/docs/components/chip.md +411 -0
- package/dist/docs/components/code-block.md +389 -0
- package/dist/docs/components/collapsible.md +93 -0
- package/dist/docs/components/command.md +276 -0
- package/dist/docs/components/composer.md +1092 -0
- package/dist/docs/components/connector-request.md +497 -0
- package/dist/docs/components/context-menu.md +127 -0
- package/dist/docs/components/data-table.md +462 -0
- package/dist/docs/components/date-range-picker.md +425 -0
- package/dist/docs/components/dialog.md +263 -0
- package/dist/docs/components/drawer.md +505 -0
- package/dist/docs/components/dropdown-menu.md +336 -0
- package/dist/docs/components/editor-tabs.md +283 -0
- package/dist/docs/components/empty-state.md +134 -0
- package/dist/docs/components/entity-card.md +640 -0
- package/dist/docs/components/entity-row.md +291 -0
- package/dist/docs/components/env-var-request.md +223 -0
- package/dist/docs/components/field.md +272 -0
- package/dist/docs/components/file-upload.md +255 -0
- package/dist/docs/components/hover-card.md +335 -0
- package/dist/docs/components/input-group.md +134 -0
- package/dist/docs/components/input.md +97 -0
- package/dist/docs/components/island.md +97 -0
- package/dist/docs/components/kbd.md +91 -0
- package/dist/docs/components/markdown.md +180 -0
- package/dist/docs/components/message.md +336 -0
- package/dist/docs/components/page-header.md +203 -0
- package/dist/docs/components/pagination.md +211 -0
- package/dist/docs/components/password-input.md +68 -0
- package/dist/docs/components/pepper.md +238 -0
- package/dist/docs/components/permission-request.md +265 -0
- package/dist/docs/components/popover.md +206 -0
- package/dist/docs/components/progress.md +142 -0
- package/dist/docs/components/progressive-blur.md +195 -0
- package/dist/docs/components/radio-group.md +129 -0
- package/dist/docs/components/request-card.md +305 -0
- package/dist/docs/components/resizable.md +318 -0
- package/dist/docs/components/responsive-overlay.md +449 -0
- package/dist/docs/components/scroll-shadows.md +161 -0
- package/dist/docs/components/search-field.md +86 -0
- package/dist/docs/components/searchable-select.md +144 -0
- package/dist/docs/components/select.md +331 -0
- package/dist/docs/components/separator.md +80 -0
- package/dist/docs/components/settings-section.md +246 -0
- package/dist/docs/components/sidebar-item.md +307 -0
- package/dist/docs/components/skeleton.md +107 -0
- package/dist/docs/components/slider.md +171 -0
- package/dist/docs/components/sonner.md +122 -0
- package/dist/docs/components/spinner.md +112 -0
- package/dist/docs/components/stat-strip.md +85 -0
- package/dist/docs/components/status-dot.md +190 -0
- package/dist/docs/components/subagent-run.md +196 -0
- package/dist/docs/components/switch.md +91 -0
- package/dist/docs/components/system-notice.md +144 -0
- package/dist/docs/components/table.md +201 -0
- package/dist/docs/components/tabs.md +233 -0
- package/dist/docs/components/textarea.md +89 -0
- package/dist/docs/components/thinking-indicator.md +164 -0
- package/dist/docs/components/thread-status.md +143 -0
- package/dist/docs/components/todo-list.md +225 -0
- package/dist/docs/components/toggle-group.md +117 -0
- package/dist/docs/components/toggle.md +132 -0
- package/dist/docs/components/tool-call.md +237 -0
- package/dist/docs/components/tool-result.md +418 -0
- package/dist/docs/components/tooltip.md +136 -0
- package/dist/docs/components/trace.md +319 -0
- package/dist/docs/components/turn-summary.md +218 -0
- package/dist/docs/components/usage-meter.md +69 -0
- package/dist/docs/components/view-switcher.md +193 -0
- package/dist/docs/foundations/colors.md +83 -0
- package/dist/docs/foundations/elevation.md +19 -0
- package/dist/docs/foundations/iconography.md +34 -0
- package/dist/docs/foundations/layout.md +42 -0
- package/dist/docs/foundations/logo.md +111 -0
- package/dist/docs/foundations/motion.md +91 -0
- package/dist/docs/foundations/radius.md +13 -0
- package/dist/docs/foundations/spacing.md +23 -0
- package/dist/docs/foundations/typography.md +42 -0
- package/dist/docs/getting-started/installation.md +116 -0
- package/dist/docs/getting-started/releases.md +59 -0
- package/dist/docs/getting-started/theming.md +58 -0
- package/dist/docs/guidelines/accessibility.md +28 -0
- package/dist/docs/guidelines/content.md +36 -0
- package/dist/docs/guidelines/forms.md +36 -0
- package/dist/docs/guidelines/principles.md +30 -0
- package/dist/docs/hooks/use-is-mobile.md +134 -0
- package/dist/docs/index.md +182 -0
- package/dist/docs/overview.md +35 -0
- package/dist/docs/patterns/chat.md +477 -0
- package/dist/docs/patterns/index.md +13 -0
- package/dist/docs/patterns/login.md +311 -0
- package/dist/docs/patterns/share.md +415 -0
- package/dist/hooks/use-is-mobile.d.ts +9 -0
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +26 -0
- package/dist/hooks/use-is-mobile.js.map +1 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +31 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/code-language.d.ts +8 -0
- package/dist/lib/code-language.d.ts.map +1 -0
- package/dist/lib/code-language.js +48 -0
- package/dist/lib/code-language.js.map +1 -0
- package/dist/lib/date-range.d.ts +122 -0
- package/dist/lib/date-range.d.ts.map +1 -0
- package/dist/lib/date-range.js +281 -0
- package/dist/lib/date-range.js.map +1 -0
- package/dist/lib/major-tokens.d.ts +40 -0
- package/dist/lib/major-tokens.d.ts.map +1 -0
- package/dist/lib/major-tokens.js +602 -0
- package/dist/lib/major-tokens.js.map +1 -0
- package/dist/lib/markdown.d.ts +25 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +87 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/overlay-portal-branch.d.ts +6 -0
- package/dist/lib/overlay-portal-branch.d.ts.map +1 -0
- package/dist/lib/overlay-portal-branch.js +15 -0
- package/dist/lib/overlay-portal-branch.js.map +1 -0
- package/dist/lib/pepper-matcap.d.ts +2 -0
- package/dist/lib/pepper-matcap.d.ts.map +1 -0
- package/dist/lib/pepper-matcap.js +4 -0
- package/dist/lib/pepper-matcap.js.map +1 -0
- package/dist/lib/scroll-fade.d.ts +28 -0
- package/dist/lib/scroll-fade.d.ts.map +1 -0
- package/dist/lib/scroll-fade.js +57 -0
- package/dist/lib/scroll-fade.js.map +1 -0
- package/dist/tailwind.css +7 -0
- package/dist/theme.css +428 -0
- package/package.json +145 -3
- package/tokens.json +841 -0
- package/README.md +0 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import { Area, Bar, CartesianGrid, Line, Pie, Tooltip, XAxis, YAxis, type BarStackProps, type TooltipContentProps, type TooltipPayloadEntry } from "recharts";
|
|
3
|
+
/**
|
|
4
|
+
* The series colours, in order: the three chart tokens, then the same three at 45% on the surface for a fourth to
|
|
5
|
+
* sixth series. They follow the theme. Never tool or status colours.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CHART_COLORS: readonly ["var(--color-chart-1)", "var(--color-chart-2)", "var(--color-chart-3)", "color-mix(in srgb, var(--color-chart-1) 45%, var(--color-surface))", "color-mix(in srgb, var(--color-chart-2) 45%, var(--color-surface))", "color-mix(in srgb, var(--color-chart-3) 45%, var(--color-surface))"];
|
|
8
|
+
/** A rollup of the rest ("Other"), and the previous period drawn behind the current one. */
|
|
9
|
+
export declare const CHART_MUTED_COLOR = "var(--color-faint)";
|
|
10
|
+
/** A limit or a target the series is read against: a dashed line. */
|
|
11
|
+
export declare const CHART_REFERENCE_COLOR = "var(--color-muted)";
|
|
12
|
+
/** How a series is drawn in the legend and the tooltip: like its mark. */
|
|
13
|
+
export declare const CHART_SWATCHES: {
|
|
14
|
+
/** Bars, areas and slices. The default. */
|
|
15
|
+
readonly SQUARE: "square";
|
|
16
|
+
/** A line. */
|
|
17
|
+
readonly LINE: "line";
|
|
18
|
+
/** A dashed line: a limit, a target. */
|
|
19
|
+
readonly DASHED: "dashed";
|
|
20
|
+
};
|
|
21
|
+
export type ChartSwatch = (typeof CHART_SWATCHES)[keyof typeof CHART_SWATCHES];
|
|
22
|
+
export interface ChartSeriesConfig {
|
|
23
|
+
/** The series' name in the legend and the tooltip: "Model". */
|
|
24
|
+
label: ReactNode;
|
|
25
|
+
/** One of CHART_COLORS, CHART_MUTED_COLOR or CHART_REFERENCE_COLOR. Default: the next series colour in order. */
|
|
26
|
+
color?: string;
|
|
27
|
+
/** Default: square. */
|
|
28
|
+
swatch?: ChartSwatch;
|
|
29
|
+
}
|
|
30
|
+
/** The chart's series by their data key, in the order they stack and read: the first is the bottom of a stack. */
|
|
31
|
+
export type ChartConfig = Record<string, ChartSeriesConfig>;
|
|
32
|
+
/** A series' colour: its own, or the next series colour by its place in the config. */
|
|
33
|
+
export declare function getChartColor(config: ChartConfig, key: string): string;
|
|
34
|
+
export interface ChartContainerProps extends Omit<ComponentProps<"div">, "children"> {
|
|
35
|
+
config: ChartConfig;
|
|
36
|
+
/** One Recharts chart: BarChart, LineChart, AreaChart, ComposedChart or PieChart. */
|
|
37
|
+
children: ReactElement;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The frame of every chart: it fills its width at a fixed height (200px; set another with `h-*`), draws Recharts in
|
|
41
|
+
* the tokens and gives its parts the series. Its child is one Recharts chart built from the parts below.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ChartContainer({ config, className, children, ...props }: ChartContainerProps): import("react").JSX.Element;
|
|
44
|
+
/** Horizontal lines at the value ticks, in `line`. */
|
|
45
|
+
export declare function ChartGrid(props: ComponentProps<typeof CartesianGrid>): import("react").JSX.Element;
|
|
46
|
+
/** The category axis: labels only, 8px under the plot; crowded labels drop out. */
|
|
47
|
+
export declare function ChartXAxis(props: ComponentProps<typeof XAxis>): import("react").JSX.Element;
|
|
48
|
+
/** The value axis: labels only, as wide as its longest label. */
|
|
49
|
+
export declare function ChartYAxis(props: ComponentProps<typeof YAxis>): import("react").JSX.Element;
|
|
50
|
+
export type ChartBarProps = ComponentProps<typeof Bar>;
|
|
51
|
+
/**
|
|
52
|
+
* A bar series, in its colour from the config: rounded on top, at most 32px wide. Inside a ChartBarStack its parts
|
|
53
|
+
* stack with 2px between them and only the top of the stack is rounded.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ChartBar({ dataKey, fill, isAnimationActive, ...props }: ChartBarProps): import("react").JSX.Element;
|
|
56
|
+
/** Stacks the ChartBars inside it, bottom to top in their order: one column per point, rounded once on top. */
|
|
57
|
+
export declare function ChartBarStack({ children, ...props }: BarStackProps): import("react").JSX.Element;
|
|
58
|
+
export type ChartLineProps = ComponentProps<typeof Line>;
|
|
59
|
+
/**
|
|
60
|
+
* A line series, 2px in its colour, without dots; the hovered point gets one. A limit is `type="stepAfter"` with
|
|
61
|
+
* `strokeDasharray="4 4"` in CHART_REFERENCE_COLOR.
|
|
62
|
+
*/
|
|
63
|
+
export declare function ChartLine({ dataKey, stroke, isAnimationActive, ...props }: ChartLineProps): import("react").JSX.Element;
|
|
64
|
+
export type ChartAreaProps = ComponentProps<typeof Area>;
|
|
65
|
+
/** An area series: a 2px line in its colour over a fill that fades from 30% at the line to nothing at the axis. */
|
|
66
|
+
export declare function ChartArea({ dataKey, stroke, fill, isAnimationActive, ...props }: ChartAreaProps): import("react").JSX.Element;
|
|
67
|
+
export type ChartPieProps = ComponentProps<typeof Pie>;
|
|
68
|
+
/** Parts of a whole, a slice per row in the series colours. A donut takes `innerRadius="55%"`. */
|
|
69
|
+
export declare function ChartPie({ isAnimationActive, ...props }: ChartPieProps): import("react").JSX.Element;
|
|
70
|
+
/** The hover tooltip: ChartTooltipContent by default; pass your own `content` built from the tooltip parts. */
|
|
71
|
+
export declare function ChartTooltip(props: ComponentProps<typeof Tooltip>): import("react").JSX.Element;
|
|
72
|
+
/** The tooltip's surface: a card 12px inside, in small type. Build a custom tooltip in it. */
|
|
73
|
+
export declare function ChartTooltipPanel({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
74
|
+
/** What the point is: its date or name, above the rows. */
|
|
75
|
+
export declare function ChartTooltipTitle({ className, ...props }: ComponentProps<"p">): import("react").JSX.Element;
|
|
76
|
+
export interface ChartTooltipRowProps extends Omit<ComponentProps<"div">, "children"> {
|
|
77
|
+
label: ReactNode;
|
|
78
|
+
value: ReactNode;
|
|
79
|
+
/** The series' swatch; a row without one (a note, a count) has none. */
|
|
80
|
+
color?: string;
|
|
81
|
+
swatch?: ChartSwatch;
|
|
82
|
+
/** A sum under the rows, set off by a rule. */
|
|
83
|
+
isTotal?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** One value: the series' swatch and name, its value on the right in tabular figures. */
|
|
86
|
+
export declare function ChartTooltipRow({ label, value, color, swatch, isTotal, className, ...props }: ChartTooltipRowProps): import("react").JSX.Element;
|
|
87
|
+
export interface ChartTooltipContentProps extends Partial<Pick<TooltipContentProps, "active" | "payload" | "label">> {
|
|
88
|
+
/** The title from the hovered point's x value: "Oct 3". Default: the value as it is. */
|
|
89
|
+
labelFormatter?: (label: string | number | undefined, payload: ReadonlyArray<TooltipPayloadEntry>) => ReactNode;
|
|
90
|
+
/** A value as it reads: "$0.25". Default: the number with thousands separators. */
|
|
91
|
+
valueFormatter?: (value: number, key: string) => ReactNode;
|
|
92
|
+
/** A Total row under the series: for stacked bars. */
|
|
93
|
+
hasTotal?: boolean;
|
|
94
|
+
/** Leaves out series that are zero at this point. */
|
|
95
|
+
isZeroHidden?: boolean;
|
|
96
|
+
className?: string;
|
|
97
|
+
}
|
|
98
|
+
/** The default tooltip: the point's title, a row per series in the config's names and colours, an optional total. */
|
|
99
|
+
export declare function ChartTooltipContent({ active, payload, label, labelFormatter, valueFormatter, hasTotal, isZeroHidden, className, }: ChartTooltipContentProps): import("react").JSX.Element | null;
|
|
100
|
+
export interface ChartLegendProps extends Omit<ComponentProps<"div">, "onSelect"> {
|
|
101
|
+
config: ChartConfig;
|
|
102
|
+
/** Which series, in order. Default: every series in the config. */
|
|
103
|
+
keys?: string[];
|
|
104
|
+
/**
|
|
105
|
+
* With `onSelect`, each name is a button that picks its series (the chart then shows only it) and picks nothing
|
|
106
|
+
* when pressed again.
|
|
107
|
+
*/
|
|
108
|
+
selected?: string | null;
|
|
109
|
+
onSelect?: (key: string | null) => void;
|
|
110
|
+
/** Names that can't be picked: a rollup like "Other". */
|
|
111
|
+
disabledKeys?: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The series' names with their swatches, above the plot on the right or beside the chart's title. With `onSelect` a
|
|
115
|
+
* name picks its series.
|
|
116
|
+
*/
|
|
117
|
+
export declare function ChartLegend({ config, keys, selected, onSelect, disabledKeys, className, ...props }: ChartLegendProps): import("react").JSX.Element;
|
|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AAS,CAAC;IAC3D,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,qHAAqH;AACrH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,KAAK,EACL,cAAc,EACd,cAA6B,EAC7B,QAAgB,EAChB,YAAoB,EACpB,SAAS,GACV,EAAE,wBAAwB,sCAmC1B;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC/E,MAAM,EAAE,WAAW,CAAC;IACpB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAe,EAAE,QAAQ,EAAE,YAAiB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BAwChI"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useId } from "react";
|
|
4
|
+
import { useReducedMotion } from "motion/react";
|
|
5
|
+
import { Area, Bar, BarStack, CartesianGrid, Line, Pie, ResponsiveContainer, Sector, Tooltip, XAxis, YAxis, } from "recharts";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
/**
|
|
8
|
+
* The series colours, in order: the three chart tokens, then the same three at 45% on the surface for a fourth to
|
|
9
|
+
* sixth series. They follow the theme. Never tool or status colours.
|
|
10
|
+
*/
|
|
11
|
+
export const CHART_COLORS = [
|
|
12
|
+
"var(--color-chart-1)",
|
|
13
|
+
"var(--color-chart-2)",
|
|
14
|
+
"var(--color-chart-3)",
|
|
15
|
+
"color-mix(in srgb, var(--color-chart-1) 45%, var(--color-surface))",
|
|
16
|
+
"color-mix(in srgb, var(--color-chart-2) 45%, var(--color-surface))",
|
|
17
|
+
"color-mix(in srgb, var(--color-chart-3) 45%, var(--color-surface))",
|
|
18
|
+
];
|
|
19
|
+
/** A rollup of the rest ("Other"), and the previous period drawn behind the current one. */
|
|
20
|
+
export const CHART_MUTED_COLOR = "var(--color-faint)";
|
|
21
|
+
/** A limit or a target the series is read against: a dashed line. */
|
|
22
|
+
export const CHART_REFERENCE_COLOR = "var(--color-muted)";
|
|
23
|
+
/** How a series is drawn in the legend and the tooltip: like its mark. */
|
|
24
|
+
export const CHART_SWATCHES = {
|
|
25
|
+
/** Bars, areas and slices. The default. */
|
|
26
|
+
SQUARE: "square",
|
|
27
|
+
/** A line. */
|
|
28
|
+
LINE: "line",
|
|
29
|
+
/** A dashed line: a limit, a target. */
|
|
30
|
+
DASHED: "dashed",
|
|
31
|
+
};
|
|
32
|
+
/** A series' colour: its own, or the next series colour by its place in the config. */
|
|
33
|
+
export function getChartColor(config, key) {
|
|
34
|
+
const own = config[key]?.color;
|
|
35
|
+
if (own) {
|
|
36
|
+
return own;
|
|
37
|
+
}
|
|
38
|
+
const index = Object.keys(config).indexOf(key);
|
|
39
|
+
return CHART_COLORS[Math.max(index, 0) % CHART_COLORS.length];
|
|
40
|
+
}
|
|
41
|
+
const ChartContext = createContext({});
|
|
42
|
+
/** Inside a ChartBarStack: its bars leave the rounding to the stack and keep a gap between them. */
|
|
43
|
+
const ChartStackContext = createContext(false);
|
|
44
|
+
const DEFAULT_SIZE = { width: 320, height: 200 };
|
|
45
|
+
/** Bars: rounded on top, never wider than 32px, 2px between stacked parts, a value never thinner than 2px. */
|
|
46
|
+
const BAR_RADIUS_PX = 3;
|
|
47
|
+
const BAR_MAX_WIDTH_PX = 32;
|
|
48
|
+
const STACK_GAP_PX = 2;
|
|
49
|
+
const MIN_BAR_HEIGHT_PX = 2;
|
|
50
|
+
const STROKE_WIDTH_PX = 2;
|
|
51
|
+
/** Marks grow in once, together. */
|
|
52
|
+
const ANIMATION_DURATION_MS = 450;
|
|
53
|
+
const ANIMATION_EASING = "ease-out";
|
|
54
|
+
/** An area fades from this at its line to nothing at the axis, so bars in front of it stay legible. */
|
|
55
|
+
const AREA_FILL_OPACITY = 0.3;
|
|
56
|
+
// Recharts draws in its own colours; the tokens replace them. Axis text takes the container's 12px.
|
|
57
|
+
const CONTAINER_CLASSES = [
|
|
58
|
+
"flex h-50 w-full justify-center font-sans text-small text-muted",
|
|
59
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-muted [&_.recharts-cartesian-grid_line]:stroke-line",
|
|
60
|
+
"[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-hover [&_.recharts-curve.recharts-tooltip-cursor]:stroke-line",
|
|
61
|
+
"[&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none",
|
|
62
|
+
// The plot takes focus for the arrow keys (Recharts' accessibility layer): a ring from the keyboard only.
|
|
63
|
+
"[&_.recharts-surface]:rounded-sm [&_.recharts-surface]:outline-none [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-solid [&_.recharts-surface:focus-visible]:outline-faint",
|
|
64
|
+
];
|
|
65
|
+
const formatNumber = (value) => value.toLocaleString("en-US");
|
|
66
|
+
function useSeriesColor(dataKey, color) {
|
|
67
|
+
const config = useContext(ChartContext);
|
|
68
|
+
if (color) {
|
|
69
|
+
return color;
|
|
70
|
+
}
|
|
71
|
+
return typeof dataKey === "string" ? getChartColor(config, dataKey) : CHART_COLORS[0];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The frame of every chart: it fills its width at a fixed height (200px; set another with `h-*`), draws Recharts in
|
|
75
|
+
* the tokens and gives its parts the series. Its child is one Recharts chart built from the parts below.
|
|
76
|
+
*/
|
|
77
|
+
export function ChartContainer({ config, className, children, ...props }) {
|
|
78
|
+
return (_jsx(ChartContext.Provider, { value: config, children: _jsx("div", { ...props, "data-slot": "chart", className: cn(CONTAINER_CLASSES, className), children: _jsx(ResponsiveContainer, { initialDimension: DEFAULT_SIZE, children: children }) }) }));
|
|
79
|
+
}
|
|
80
|
+
/** Horizontal lines at the value ticks, in `line`. */
|
|
81
|
+
export function ChartGrid(props) {
|
|
82
|
+
return _jsx(CartesianGrid, { vertical: false, ...props });
|
|
83
|
+
}
|
|
84
|
+
/** The category axis: labels only, 8px under the plot; crowded labels drop out. */
|
|
85
|
+
export function ChartXAxis(props) {
|
|
86
|
+
return _jsx(XAxis, { tickLine: false, axisLine: false, tickMargin: 8, minTickGap: 16, ...props });
|
|
87
|
+
}
|
|
88
|
+
/** The value axis: labels only, as wide as its longest label. */
|
|
89
|
+
export function ChartYAxis(props) {
|
|
90
|
+
return _jsx(YAxis, { tickLine: false, axisLine: false, width: "auto", ...props });
|
|
91
|
+
}
|
|
92
|
+
/** A stacked part: a gap under it unless it starts the stack, and never thinner than 2px. */
|
|
93
|
+
function StackedBarPart({ x, y, width, height, fill, stackedBarStart }) {
|
|
94
|
+
if (!height || height <= 0) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const bottom = y + height;
|
|
98
|
+
const gap = Math.abs(bottom - stackedBarStart) < 1 ? 0 : STACK_GAP_PX;
|
|
99
|
+
const drawnHeight = Math.max(height - gap, MIN_BAR_HEIGHT_PX);
|
|
100
|
+
return _jsx("rect", { x: x, y: bottom - gap - drawnHeight, width: width, height: drawnHeight, fill: fill });
|
|
101
|
+
}
|
|
102
|
+
const keepNonZeroVisible = (value) => (value ? MIN_BAR_HEIGHT_PX : 0);
|
|
103
|
+
/**
|
|
104
|
+
* A bar series, in its colour from the config: rounded on top, at most 32px wide. Inside a ChartBarStack its parts
|
|
105
|
+
* stack with 2px between them and only the top of the stack is rounded.
|
|
106
|
+
*/
|
|
107
|
+
export function ChartBar({ dataKey, fill, isAnimationActive = true, ...props }) {
|
|
108
|
+
const color = useSeriesColor(dataKey, fill);
|
|
109
|
+
const isStacked = useContext(ChartStackContext);
|
|
110
|
+
const isReducedMotion = useReducedMotion();
|
|
111
|
+
return (_jsx(Bar, { dataKey: dataKey, fill: color, maxBarSize: BAR_MAX_WIDTH_PX, radius: isStacked ? 0 : [BAR_RADIUS_PX, BAR_RADIUS_PX, 0, 0], minPointSize: isStacked ? 0 : keepNonZeroVisible, shape: isStacked ? (shape) => _jsx(StackedBarPart, { ...shape }) : undefined, isAnimationActive: isAnimationActive && !isReducedMotion, animationDuration: ANIMATION_DURATION_MS, animationEasing: ANIMATION_EASING, ...props }));
|
|
112
|
+
}
|
|
113
|
+
/** Stacks the ChartBars inside it, bottom to top in their order: one column per point, rounded once on top. */
|
|
114
|
+
export function ChartBarStack({ children, ...props }) {
|
|
115
|
+
return (_jsx(ChartStackContext.Provider, { value: true, children: _jsx(BarStack, { radius: [BAR_RADIUS_PX, BAR_RADIUS_PX, 0, 0], ...props, children: children }) }));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A line series, 2px in its colour, without dots; the hovered point gets one. A limit is `type="stepAfter"` with
|
|
119
|
+
* `strokeDasharray="4 4"` in CHART_REFERENCE_COLOR.
|
|
120
|
+
*/
|
|
121
|
+
export function ChartLine({ dataKey, stroke, isAnimationActive = true, ...props }) {
|
|
122
|
+
const color = useSeriesColor(dataKey, stroke);
|
|
123
|
+
const isReducedMotion = useReducedMotion();
|
|
124
|
+
return (_jsx(Line, { type: "monotone", dataKey: dataKey, stroke: color, strokeWidth: STROKE_WIDTH_PX, dot: false, activeDot: { r: 4, fill: color, stroke: "var(--color-surface)", strokeWidth: STROKE_WIDTH_PX }, isAnimationActive: isAnimationActive && !isReducedMotion, animationDuration: ANIMATION_DURATION_MS, animationEasing: ANIMATION_EASING, ...props }));
|
|
125
|
+
}
|
|
126
|
+
/** An area series: a 2px line in its colour over a fill that fades from 30% at the line to nothing at the axis. */
|
|
127
|
+
export function ChartArea({ dataKey, stroke, fill, isAnimationActive = true, ...props }) {
|
|
128
|
+
const color = useSeriesColor(dataKey, stroke);
|
|
129
|
+
const isReducedMotion = useReducedMotion();
|
|
130
|
+
const gradientId = `chart-fill-${useId().replace(/[^\w-]/g, "")}`;
|
|
131
|
+
return (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: color, stopOpacity: AREA_FILL_OPACITY }), _jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })] }) }), _jsx(Area, { type: "monotone", dataKey: dataKey, stroke: color, strokeWidth: STROKE_WIDTH_PX, fill: fill ?? `url(#${gradientId})`, dot: false, activeDot: { r: 4, fill: color, stroke: "var(--color-surface)", strokeWidth: STROKE_WIDTH_PX }, isAnimationActive: isAnimationActive && !isReducedMotion, animationDuration: ANIMATION_DURATION_MS, animationEasing: ANIMATION_EASING, ...props })] }));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* A slice in its name's colour, by the same rule as the legend and the tooltip (`getChartColor`), so all three agree
|
|
135
|
+
* whatever order the rows come in; a name the config lacks takes the next series colour. 2px of surface between slices.
|
|
136
|
+
*/
|
|
137
|
+
function PieSlice(props) {
|
|
138
|
+
const config = useContext(ChartContext);
|
|
139
|
+
const name = typeof props.name === "string" || typeof props.name === "number" ? String(props.name) : undefined;
|
|
140
|
+
const color = name !== undefined && name in config ? getChartColor(config, name) : CHART_COLORS[props.index % CHART_COLORS.length];
|
|
141
|
+
return _jsx(Sector, { ...props, fill: color, stroke: "var(--color-surface)", strokeWidth: STROKE_WIDTH_PX });
|
|
142
|
+
}
|
|
143
|
+
/** Parts of a whole, a slice per row in the series colours. A donut takes `innerRadius="55%"`. */
|
|
144
|
+
export function ChartPie({ isAnimationActive = true, ...props }) {
|
|
145
|
+
const isReducedMotion = useReducedMotion();
|
|
146
|
+
return (_jsx(Pie, { shape: (slice) => _jsx(PieSlice, { ...slice }), isAnimationActive: isAnimationActive && !isReducedMotion, animationDuration: ANIMATION_DURATION_MS, animationEasing: ANIMATION_EASING, ...props }));
|
|
147
|
+
}
|
|
148
|
+
/** The hover tooltip: ChartTooltipContent by default; pass your own `content` built from the tooltip parts. */
|
|
149
|
+
export function ChartTooltip(props) {
|
|
150
|
+
return _jsx(Tooltip, { content: _jsx(ChartTooltipContent, {}), isAnimationActive: false, ...props });
|
|
151
|
+
}
|
|
152
|
+
function ChartSwatchMark({ color, swatch = CHART_SWATCHES.SQUARE }) {
|
|
153
|
+
if (swatch === CHART_SWATCHES.LINE) {
|
|
154
|
+
return _jsx("i", { "aria-hidden": true, className: "block h-0.5 w-3 shrink-0 rounded-full", style: { backgroundColor: color } });
|
|
155
|
+
}
|
|
156
|
+
if (swatch === CHART_SWATCHES.DASHED) {
|
|
157
|
+
return _jsx("i", { "aria-hidden": true, className: "block w-3 shrink-0 border-t-2 border-dashed", style: { borderColor: color } });
|
|
158
|
+
}
|
|
159
|
+
return _jsx("i", { "aria-hidden": true, className: "block size-2 shrink-0 rounded-[0.125rem]", style: { backgroundColor: color } });
|
|
160
|
+
}
|
|
161
|
+
/** The tooltip's surface: a card 12px inside, in small type. Build a custom tooltip in it. */
|
|
162
|
+
export function ChartTooltipPanel({ className, ...props }) {
|
|
163
|
+
return (_jsx("div", { ...props, "data-slot": "chart-tooltip", className: cn("flex min-w-32 max-w-64 flex-col gap-space-4 rounded-panel border border-panel-edge bg-surface px-space-12 py-space-10 font-sans text-small text-ink shadow-pop", className) }));
|
|
164
|
+
}
|
|
165
|
+
/** What the point is: its date or name, above the rows. */
|
|
166
|
+
export function ChartTooltipTitle({ className, ...props }) {
|
|
167
|
+
return _jsx("p", { ...props, className: cn("m-0 mb-space-2 font-medium text-ink", className) });
|
|
168
|
+
}
|
|
169
|
+
/** One value: the series' swatch and name, its value on the right in tabular figures. */
|
|
170
|
+
export function ChartTooltipRow({ label, value, color, swatch, isTotal = false, className, ...props }) {
|
|
171
|
+
return (_jsxs("div", { ...props, className: cn("flex items-center gap-space-6", isTotal && "mt-space-2 border-t border-line pt-space-6", className), children: [color && _jsx(ChartSwatchMark, { color: color, swatch: swatch }), _jsx("span", { className: "min-w-0 truncate text-ink-2", children: label }), _jsx("span", { className: "ml-auto pl-space-16 text-ink tabular-nums", children: value })] }));
|
|
172
|
+
}
|
|
173
|
+
function toNumber(value) {
|
|
174
|
+
return typeof value === "number" ? value : Number(value) || 0;
|
|
175
|
+
}
|
|
176
|
+
/** The default tooltip: the point's title, a row per series in the config's names and colours, an optional total. */
|
|
177
|
+
export function ChartTooltipContent({ active, payload, label, labelFormatter, valueFormatter = formatNumber, hasTotal = false, isZeroHidden = false, className, }) {
|
|
178
|
+
const config = useContext(ChartContext);
|
|
179
|
+
if (!active || !payload?.length) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const entries = payload.filter((entry) => entry.type !== "none" && !(isZeroHidden && !toNumber(entry.value)));
|
|
183
|
+
const title = labelFormatter ? labelFormatter(label, payload) : label;
|
|
184
|
+
const total = entries.reduce((sum, entry) => sum + toNumber(entry.value), 0);
|
|
185
|
+
return (_jsxs(ChartTooltipPanel, { className: className, children: [title !== undefined && title !== "" && _jsx(ChartTooltipTitle, { children: title }), entries.map((entry, index) => {
|
|
186
|
+
// A slice is keyed by its name, a series by its data key.
|
|
187
|
+
const name = entry.name === undefined ? undefined : String(entry.name);
|
|
188
|
+
const key = name && config[name] ? name : String(entry.dataKey ?? name ?? index);
|
|
189
|
+
const color = config[key] ? getChartColor(config, key) : (entry.color ?? CHART_COLORS[0]);
|
|
190
|
+
return (_jsx(ChartTooltipRow, { color: color, swatch: config[key]?.swatch, label: config[key]?.label ?? name ?? key, value: valueFormatter(toNumber(entry.value), key) }, key));
|
|
191
|
+
}), hasTotal && entries.length > 1 && (_jsx(ChartTooltipRow, { label: "Total", value: valueFormatter(total, "total"), isTotal: true }))] }));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The series' names with their swatches, above the plot on the right or beside the chart's title. With `onSelect` a
|
|
195
|
+
* name picks its series.
|
|
196
|
+
*/
|
|
197
|
+
export function ChartLegend({ config, keys, selected = null, onSelect, disabledKeys = [], className, ...props }) {
|
|
198
|
+
const shown = keys ?? Object.keys(config);
|
|
199
|
+
return (_jsx("div", { ...props, "data-slot": "chart-legend", className: cn("flex flex-wrap items-center text-small text-ink-2", onSelect ? "gap-space-4" : "gap-space-16", className), children: shown.map((key) => {
|
|
200
|
+
const mark = _jsx(ChartSwatchMark, { color: getChartColor(config, key), swatch: config[key]?.swatch });
|
|
201
|
+
const label = config[key]?.label ?? key;
|
|
202
|
+
if (!onSelect) {
|
|
203
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-space-6", children: [mark, label] }, key));
|
|
204
|
+
}
|
|
205
|
+
const isSelected = selected === key;
|
|
206
|
+
return (_jsxs("button", { type: "button", "aria-pressed": isSelected, disabled: disabledKeys.includes(key), onClick: () => onSelect(isSelected ? null : key), className: "inline-flex h-6 cursor-pointer items-center gap-space-6 rounded-sm px-space-6 outline-none transition-colors duration-120 hover:bg-hover focus-visible:ring-2 focus-visible:ring-faint aria-pressed:bg-hover aria-pressed:text-ink disabled:cursor-default disabled:hover:bg-transparent", children: [mark, label] }, key));
|
|
207
|
+
}) }));
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../../src/components/chart.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAA0D,MAAM,OAAO,CAAC;AACjH,OAAO,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AAC,EAAE,MAAM,GAAI,CAAC;YACjG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC;YAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,CACL,gBAAgB,SAAS,EAAC,sCAAsC,aAC7D,IAAI,EACJ,KAAK,KAFG,GAAG,CAGP,CACR,CAAC;YACJ,CAAC;YAED,MAAM,UAAU,GAAG,QAAQ,KAAK,GAAG,CAAC;YAEpC,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,kBACC,UAAU,EACxB,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EACpC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAChD,SAAS,EAAC,0RAA0R,aAEnS,IAAI,EACJ,KAAK,KARD,GAAG,CASD,CACV,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { createContext, useContext, useId, type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useReducedMotion } from \"motion/react\";\nimport {\n Area,\n Bar,\n BarStack,\n CartesianGrid,\n Line,\n Pie,\n ResponsiveContainer,\n Sector,\n Tooltip,\n XAxis,\n YAxis,\n type BarShapeProps,\n type BarStackProps,\n type PieSectorShapeProps,\n type TooltipContentProps,\n type TooltipPayloadEntry,\n} from \"recharts\";\nimport { cn } from \"../lib/cn.ts\";\n\n/**\n * The series colours, in order: the three chart tokens, then the same three at 45% on the surface for a fourth to\n * sixth series. They follow the theme. Never tool or status colours.\n */\nexport const CHART_COLORS = [\n \"var(--color-chart-1)\",\n \"var(--color-chart-2)\",\n \"var(--color-chart-3)\",\n \"color-mix(in srgb, var(--color-chart-1) 45%, var(--color-surface))\",\n \"color-mix(in srgb, var(--color-chart-2) 45%, var(--color-surface))\",\n \"color-mix(in srgb, var(--color-chart-3) 45%, var(--color-surface))\",\n] as const;\n\n/** A rollup of the rest (\"Other\"), and the previous period drawn behind the current one. */\nexport const CHART_MUTED_COLOR = \"var(--color-faint)\";\n\n/** A limit or a target the series is read against: a dashed line. */\nexport const CHART_REFERENCE_COLOR = \"var(--color-muted)\";\n\n/** How a series is drawn in the legend and the tooltip: like its mark. */\nexport const CHART_SWATCHES = {\n /** Bars, areas and slices. The default. */\n SQUARE: \"square\",\n /** A line. */\n LINE: \"line\",\n /** A dashed line: a limit, a target. */\n DASHED: \"dashed\",\n} as const;\n\nexport type ChartSwatch = (typeof CHART_SWATCHES)[keyof typeof CHART_SWATCHES];\n\nexport interface ChartSeriesConfig {\n /** The series' name in the legend and the tooltip: \"Model\". */\n label: ReactNode;\n /** One of CHART_COLORS, CHART_MUTED_COLOR or CHART_REFERENCE_COLOR. Default: the next series colour in order. */\n color?: string;\n /** Default: square. */\n swatch?: ChartSwatch;\n}\n\n/** The chart's series by their data key, in the order they stack and read: the first is the bottom of a stack. */\nexport type ChartConfig = Record<string, ChartSeriesConfig>;\n\n/** A series' colour: its own, or the next series colour by its place in the config. */\nexport function getChartColor(config: ChartConfig, key: string): string {\n const own = config[key]?.color;\n\n if (own) {\n return own;\n }\n\n const index = Object.keys(config).indexOf(key);\n\n return CHART_COLORS[Math.max(index, 0) % CHART_COLORS.length];\n}\n\nconst ChartContext = createContext<ChartConfig>({});\n\n/** Inside a ChartBarStack: its bars leave the rounding to the stack and keep a gap between them. */\nconst ChartStackContext = createContext(false);\n\nconst DEFAULT_SIZE = { width: 320, height: 200 } as const;\n/** Bars: rounded on top, never wider than 32px, 2px between stacked parts, a value never thinner than 2px. */\nconst BAR_RADIUS_PX = 3;\nconst BAR_MAX_WIDTH_PX = 32;\nconst STACK_GAP_PX = 2;\nconst MIN_BAR_HEIGHT_PX = 2;\nconst STROKE_WIDTH_PX = 2;\n/** Marks grow in once, together. */\nconst ANIMATION_DURATION_MS = 450;\nconst ANIMATION_EASING = \"ease-out\";\n/** An area fades from this at its line to nothing at the axis, so bars in front of it stay legible. */\nconst AREA_FILL_OPACITY = 0.3;\n\n// Recharts draws in its own colours; the tokens replace them. Axis text takes the container's 12px.\nconst CONTAINER_CLASSES = [\n \"flex h-50 w-full justify-center font-sans text-small text-muted\",\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted [&_.recharts-cartesian-grid_line]:stroke-line\",\n \"[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-hover [&_.recharts-curve.recharts-tooltip-cursor]:stroke-line\",\n \"[&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none\",\n // The plot takes focus for the arrow keys (Recharts' accessibility layer): a ring from the keyboard only.\n \"[&_.recharts-surface]:rounded-sm [&_.recharts-surface]:outline-none [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-solid [&_.recharts-surface:focus-visible]:outline-faint\",\n];\n\nconst formatNumber = (value: number) => value.toLocaleString(\"en-US\");\n\nfunction useSeriesColor(dataKey: unknown, color: string | undefined): string {\n const config = useContext(ChartContext);\n\n if (color) {\n return color;\n }\n\n return typeof dataKey === \"string\" ? getChartColor(config, dataKey) : CHART_COLORS[0];\n}\n\nexport interface ChartContainerProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n config: ChartConfig;\n /** One Recharts chart: BarChart, LineChart, AreaChart, ComposedChart or PieChart. */\n children: ReactElement;\n}\n\n/**\n * The frame of every chart: it fills its width at a fixed height (200px; set another with `h-*`), draws Recharts in\n * the tokens and gives its parts the series. Its child is one Recharts chart built from the parts below.\n */\nexport function ChartContainer({ config, className, children, ...props }: ChartContainerProps) {\n return (\n <ChartContext.Provider value={config}>\n <div {...props} data-slot=\"chart\" className={cn(CONTAINER_CLASSES, className)}>\n <ResponsiveContainer initialDimension={DEFAULT_SIZE}>{children}</ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\n/** Horizontal lines at the value ticks, in `line`. */\nexport function ChartGrid(props: ComponentProps<typeof CartesianGrid>) {\n return <CartesianGrid vertical={false} {...props} />;\n}\n\n/** The category axis: labels only, 8px under the plot; crowded labels drop out. */\nexport function ChartXAxis(props: ComponentProps<typeof XAxis>) {\n return <XAxis tickLine={false} axisLine={false} tickMargin={8} minTickGap={16} {...props} />;\n}\n\n/** The value axis: labels only, as wide as its longest label. */\nexport function ChartYAxis(props: ComponentProps<typeof YAxis>) {\n return <YAxis tickLine={false} axisLine={false} width=\"auto\" {...props} />;\n}\n\n/** A stacked part: a gap under it unless it starts the stack, and never thinner than 2px. */\nfunction StackedBarPart({ x, y, width, height, fill, stackedBarStart }: BarShapeProps) {\n if (!height || height <= 0) {\n return null;\n }\n\n const bottom = y + height;\n const gap = Math.abs(bottom - stackedBarStart) < 1 ? 0 : STACK_GAP_PX;\n const drawnHeight = Math.max(height - gap, MIN_BAR_HEIGHT_PX);\n\n return <rect x={x} y={bottom - gap - drawnHeight} width={width} height={drawnHeight} fill={fill} />;\n}\n\nconst keepNonZeroVisible = (value: number | undefined | null) => (value ? MIN_BAR_HEIGHT_PX : 0);\n\nexport type ChartBarProps = ComponentProps<typeof Bar>;\n\n/**\n * A bar series, in its colour from the config: rounded on top, at most 32px wide. Inside a ChartBarStack its parts\n * stack with 2px between them and only the top of the stack is rounded.\n */\nexport function ChartBar({ dataKey, fill, isAnimationActive = true, ...props }: ChartBarProps) {\n const color = useSeriesColor(dataKey, fill);\n const isStacked = useContext(ChartStackContext);\n const isReducedMotion = useReducedMotion();\n\n return (\n <Bar\n dataKey={dataKey}\n fill={color}\n maxBarSize={BAR_MAX_WIDTH_PX}\n radius={isStacked ? 0 : [BAR_RADIUS_PX, BAR_RADIUS_PX, 0, 0]}\n minPointSize={isStacked ? 0 : keepNonZeroVisible}\n shape={isStacked ? (shape: BarShapeProps) => <StackedBarPart {...shape} /> : undefined}\n isAnimationActive={isAnimationActive && !isReducedMotion}\n animationDuration={ANIMATION_DURATION_MS}\n animationEasing={ANIMATION_EASING}\n {...props}\n />\n );\n}\n\n/** Stacks the ChartBars inside it, bottom to top in their order: one column per point, rounded once on top. */\nexport function ChartBarStack({ children, ...props }: BarStackProps) {\n return (\n <ChartStackContext.Provider value>\n <BarStack radius={[BAR_RADIUS_PX, BAR_RADIUS_PX, 0, 0]} {...props}>\n {children}\n </BarStack>\n </ChartStackContext.Provider>\n );\n}\n\nexport type ChartLineProps = ComponentProps<typeof Line>;\n\n/**\n * A line series, 2px in its colour, without dots; the hovered point gets one. A limit is `type=\"stepAfter\"` with\n * `strokeDasharray=\"4 4\"` in CHART_REFERENCE_COLOR.\n */\nexport function ChartLine({ dataKey, stroke, isAnimationActive = true, ...props }: ChartLineProps) {\n const color = useSeriesColor(dataKey, stroke);\n const isReducedMotion = useReducedMotion();\n\n return (\n <Line\n type=\"monotone\"\n dataKey={dataKey}\n stroke={color}\n strokeWidth={STROKE_WIDTH_PX}\n dot={false}\n activeDot={{ r: 4, fill: color, stroke: \"var(--color-surface)\", strokeWidth: STROKE_WIDTH_PX }}\n isAnimationActive={isAnimationActive && !isReducedMotion}\n animationDuration={ANIMATION_DURATION_MS}\n animationEasing={ANIMATION_EASING}\n {...props}\n />\n );\n}\n\nexport type ChartAreaProps = ComponentProps<typeof Area>;\n\n/** An area series: a 2px line in its colour over a fill that fades from 30% at the line to nothing at the axis. */\nexport function ChartArea({ dataKey, stroke, fill, isAnimationActive = true, ...props }: ChartAreaProps) {\n const color = useSeriesColor(dataKey, stroke);\n const isReducedMotion = useReducedMotion();\n const gradientId = `chart-fill-${useId().replace(/[^\\w-]/g, \"\")}`;\n\n return (\n <>\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={color} stopOpacity={AREA_FILL_OPACITY} />\n <stop offset=\"100%\" stopColor={color} stopOpacity={0} />\n </linearGradient>\n </defs>\n <Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke={color}\n strokeWidth={STROKE_WIDTH_PX}\n fill={fill ?? `url(#${gradientId})`}\n dot={false}\n activeDot={{ r: 4, fill: color, stroke: \"var(--color-surface)\", strokeWidth: STROKE_WIDTH_PX }}\n isAnimationActive={isAnimationActive && !isReducedMotion}\n animationDuration={ANIMATION_DURATION_MS}\n animationEasing={ANIMATION_EASING}\n {...props}\n />\n </>\n );\n}\n\n/**\n * A slice in its name's colour, by the same rule as the legend and the tooltip (`getChartColor`), so all three agree\n * whatever order the rows come in; a name the config lacks takes the next series colour. 2px of surface between slices.\n */\nfunction PieSlice(props: PieSectorShapeProps) {\n const config = useContext(ChartContext);\n const name = typeof props.name === \"string\" || typeof props.name === \"number\" ? String(props.name) : undefined;\n const color =\n name !== undefined && name in config ? getChartColor(config, name) : CHART_COLORS[props.index % CHART_COLORS.length];\n\n return <Sector {...props} fill={color} stroke=\"var(--color-surface)\" strokeWidth={STROKE_WIDTH_PX} />;\n}\n\nexport type ChartPieProps = ComponentProps<typeof Pie>;\n\n/** Parts of a whole, a slice per row in the series colours. A donut takes `innerRadius=\"55%\"`. */\nexport function ChartPie({ isAnimationActive = true, ...props }: ChartPieProps) {\n const isReducedMotion = useReducedMotion();\n\n return (\n <Pie\n shape={(slice: PieSectorShapeProps) => <PieSlice {...slice} />}\n isAnimationActive={isAnimationActive && !isReducedMotion}\n animationDuration={ANIMATION_DURATION_MS}\n animationEasing={ANIMATION_EASING}\n {...props}\n />\n );\n}\n\n/** The hover tooltip: ChartTooltipContent by default; pass your own `content` built from the tooltip parts. */\nexport function ChartTooltip(props: ComponentProps<typeof Tooltip>) {\n return <Tooltip content={<ChartTooltipContent />} isAnimationActive={false} {...props} />;\n}\n\nfunction ChartSwatchMark({ color, swatch = CHART_SWATCHES.SQUARE }: { color: string; swatch?: ChartSwatch }) {\n if (swatch === CHART_SWATCHES.LINE) {\n return <i aria-hidden className=\"block h-0.5 w-3 shrink-0 rounded-full\" style={{ backgroundColor: color }} />;\n }\n\n if (swatch === CHART_SWATCHES.DASHED) {\n return <i aria-hidden className=\"block w-3 shrink-0 border-t-2 border-dashed\" style={{ borderColor: color }} />;\n }\n\n return <i aria-hidden className=\"block size-2 shrink-0 rounded-[0.125rem]\" style={{ backgroundColor: color }} />;\n}\n\n/** The tooltip's surface: a card 12px inside, in small type. Build a custom tooltip in it. */\nexport function ChartTooltipPanel({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n data-slot=\"chart-tooltip\"\n className={cn(\n \"flex min-w-32 max-w-64 flex-col gap-space-4 rounded-panel border border-panel-edge bg-surface px-space-12 py-space-10 font-sans text-small text-ink shadow-pop\",\n className\n )}\n />\n );\n}\n\n/** What the point is: its date or name, above the rows. */\nexport function ChartTooltipTitle({ className, ...props }: ComponentProps<\"p\">) {\n return <p {...props} className={cn(\"m-0 mb-space-2 font-medium text-ink\", className)} />;\n}\n\nexport interface ChartTooltipRowProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n label: ReactNode;\n value: ReactNode;\n /** The series' swatch; a row without one (a note, a count) has none. */\n color?: string;\n swatch?: ChartSwatch;\n /** A sum under the rows, set off by a rule. */\n isTotal?: boolean;\n}\n\n/** One value: the series' swatch and name, its value on the right in tabular figures. */\nexport function ChartTooltipRow({ label, value, color, swatch, isTotal = false, className, ...props }: ChartTooltipRowProps) {\n return (\n <div\n {...props}\n className={cn(\"flex items-center gap-space-6\", isTotal && \"mt-space-2 border-t border-line pt-space-6\", className)}\n >\n {color && <ChartSwatchMark color={color} swatch={swatch} />}\n <span className=\"min-w-0 truncate text-ink-2\">{label}</span>\n <span className=\"ml-auto pl-space-16 text-ink tabular-nums\">{value}</span>\n </div>\n );\n}\n\ntype TooltipValue = number | string | ReadonlyArray<number | string>;\n\nexport interface ChartTooltipContentProps extends Partial<Pick<TooltipContentProps, \"active\" | \"payload\" | \"label\">> {\n /** The title from the hovered point's x value: \"Oct 3\". Default: the value as it is. */\n labelFormatter?: (label: string | number | undefined, payload: ReadonlyArray<TooltipPayloadEntry>) => ReactNode;\n /** A value as it reads: \"$0.25\". Default: the number with thousands separators. */\n valueFormatter?: (value: number, key: string) => ReactNode;\n /** A Total row under the series: for stacked bars. */\n hasTotal?: boolean;\n /** Leaves out series that are zero at this point. */\n isZeroHidden?: boolean;\n className?: string;\n}\n\nfunction toNumber(value: TooltipValue | undefined): number {\n return typeof value === \"number\" ? value : Number(value) || 0;\n}\n\n/** The default tooltip: the point's title, a row per series in the config's names and colours, an optional total. */\nexport function ChartTooltipContent({\n active,\n payload,\n label,\n labelFormatter,\n valueFormatter = formatNumber,\n hasTotal = false,\n isZeroHidden = false,\n className,\n}: ChartTooltipContentProps) {\n const config = useContext(ChartContext);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const entries = payload.filter((entry) => entry.type !== \"none\" && !(isZeroHidden && !toNumber(entry.value)));\n const title = labelFormatter ? labelFormatter(label, payload) : label;\n const total = entries.reduce((sum, entry) => sum + toNumber(entry.value), 0);\n\n return (\n <ChartTooltipPanel className={className}>\n {title !== undefined && title !== \"\" && <ChartTooltipTitle>{title}</ChartTooltipTitle>}\n {entries.map((entry, index) => {\n // A slice is keyed by its name, a series by its data key.\n const name = entry.name === undefined ? undefined : String(entry.name);\n const key = name && config[name] ? name : String(entry.dataKey ?? name ?? index);\n const color = config[key] ? getChartColor(config, key) : (entry.color ?? CHART_COLORS[0]);\n\n return (\n <ChartTooltipRow\n key={key}\n color={color}\n swatch={config[key]?.swatch}\n label={config[key]?.label ?? name ?? key}\n value={valueFormatter(toNumber(entry.value), key)}\n />\n );\n })}\n {hasTotal && entries.length > 1 && (\n <ChartTooltipRow label=\"Total\" value={valueFormatter(total, \"total\")} isTotal />\n )}\n </ChartTooltipPanel>\n );\n}\n\nexport interface ChartLegendProps extends Omit<ComponentProps<\"div\">, \"onSelect\"> {\n config: ChartConfig;\n /** Which series, in order. Default: every series in the config. */\n keys?: string[];\n /**\n * With `onSelect`, each name is a button that picks its series (the chart then shows only it) and picks nothing\n * when pressed again.\n */\n selected?: string | null;\n onSelect?: (key: string | null) => void;\n /** Names that can't be picked: a rollup like \"Other\". */\n disabledKeys?: string[];\n}\n\n/**\n * The series' names with their swatches, above the plot on the right or beside the chart's title. With `onSelect` a\n * name picks its series.\n */\nexport function ChartLegend({ config, keys, selected = null, onSelect, disabledKeys = [], className, ...props }: ChartLegendProps) {\n const shown = keys ?? Object.keys(config);\n\n return (\n <div\n {...props}\n data-slot=\"chart-legend\"\n className={cn(\"flex flex-wrap items-center text-small text-ink-2\", onSelect ? \"gap-space-4\" : \"gap-space-16\", className)}\n >\n {shown.map((key) => {\n const mark = <ChartSwatchMark color={getChartColor(config, key)} swatch={config[key]?.swatch} />;\n const label = config[key]?.label ?? key;\n\n if (!onSelect) {\n return (\n <span key={key} className=\"inline-flex items-center gap-space-6\">\n {mark}\n {label}\n </span>\n );\n }\n\n const isSelected = selected === key;\n\n return (\n <button\n key={key}\n type=\"button\"\n aria-pressed={isSelected}\n disabled={disabledKeys.includes(key)}\n onClick={() => onSelect(isSelected ? null : key)}\n className=\"inline-flex h-6 cursor-pointer items-center gap-space-6 rounded-sm px-space-6 outline-none transition-colors duration-120 hover:bg-hover focus-visible:ring-2 focus-visible:ring-faint aria-pressed:bg-hover aria-pressed:text-ink disabled:cursor-default disabled:hover:bg-transparent\"\n >\n {mark}\n {label}\n </button>\n );\n })}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
2
|
+
/**
|
|
3
|
+
* A square check for several independent options, filled with `link` when checked or indeterminate
|
|
4
|
+
* (checks use `link`, never `accent`). Just the box: label it with a horizontal `Field`. `indeterminate` shows a dash.
|
|
5
|
+
*/
|
|
6
|
+
declare function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props): import("react").JSX.Element;
|
|
7
|
+
export { Checkbox };
|
|
8
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIxE;;;GAGG;AACH,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,+BAoBtE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
4
|
+
import { Check, Minus } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
/**
|
|
7
|
+
* A square check for several independent options, filled with `link` when checked or indeterminate
|
|
8
|
+
* (checks use `link`, never `accent`). Just the box: label it with a horizontal `Field`. `indeterminate` shows a dash.
|
|
9
|
+
*/
|
|
10
|
+
function Checkbox({ className, ...props }) {
|
|
11
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn("group/checkbox peer mt-px grid size-4 shrink-0 cursor-pointer place-items-center rounded-sm border-[1.5px] border-faint bg-surface text-white outline-none transition-[background-color,border-color] duration-120", "hover:border-ink-2 focus-visible:ring-2 focus-visible:ring-secondary focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-faint", "data-checked:border-link data-checked:bg-link data-indeterminate:border-link data-indeterminate:bg-link", "data-disabled:cursor-not-allowed data-disabled:opacity-50", className), ...props, children: _jsxs(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "grid place-items-center", children: [_jsx(Check, { className: "size-3 stroke-2 group-data-indeterminate/checkbox:hidden" }), _jsx(Minus, { className: "hidden size-3 stroke-2 group-data-indeterminate/checkbox:block" })] }) }));
|
|
12
|
+
}
|
|
13
|
+
export { Checkbox };
|
|
14
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;GAGG;AACH,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgC;IACrE,OAAO,CACL,KAAC,iBAAiB,CAAC,IAAI,iBACX,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,oNAAoN,EACpN,sJAAsJ,EACtJ,yGAAyG,EACzG,2DAA2D,EAC3D,SAAS,CACV,KACG,KAAK,YAET,MAAC,iBAAiB,CAAC,SAAS,iBAAW,oBAAoB,EAAC,SAAS,EAAC,yBAAyB,aAC7F,KAAC,KAAK,IAAC,SAAS,EAAC,0DAA0D,GAAG,EAE9E,KAAC,KAAK,IAAC,SAAS,EAAC,gEAAgE,GAAG,IACxD,GACP,CAC1B,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\n\n/**\n * A square check for several independent options, filled with `link` when checked or indeterminate\n * (checks use `link`, never `accent`). Just the box: label it with a horizontal `Field`. `indeterminate` shows a dash.\n */\nfunction Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"group/checkbox peer mt-px grid size-4 shrink-0 cursor-pointer place-items-center rounded-sm border-[1.5px] border-faint bg-surface text-white outline-none transition-[background-color,border-color] duration-120\",\n \"hover:border-ink-2 focus-visible:ring-2 focus-visible:ring-secondary focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-faint\",\n \"data-checked:border-link data-checked:bg-link data-indeterminate:border-link data-indeterminate:bg-link\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"grid place-items-center\">\n <Check className=\"size-3 stroke-2 group-data-indeterminate/checkbox:hidden\" />\n {/* A dash, not a tick: \"some of these\" must not read as \"all of these\". */}\n <Minus className=\"hidden size-3 stroke-2 group-data-indeterminate/checkbox:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
/** What a chip stands for, which fixes its colours. Without a kind it is neutral: a file, an attachment. */
|
|
3
|
+
export declare const CHIP_KINDS: {
|
|
4
|
+
/** What uses a skill: neutral, with its icon. */
|
|
5
|
+
readonly AGENT: "agent";
|
|
6
|
+
readonly CONNECTOR: "connector";
|
|
7
|
+
readonly APPLICATION: "application";
|
|
8
|
+
/** A workflow an agent can start: neutral, with its icon. */
|
|
9
|
+
readonly WORKFLOW: "workflow";
|
|
10
|
+
readonly SKILL: "skill";
|
|
11
|
+
readonly VARIABLE: "variable";
|
|
12
|
+
/** What the person points at for the agent: an element picked with Click and ask, or a node on a workflow canvas. */
|
|
13
|
+
readonly ELEMENT: "element";
|
|
14
|
+
};
|
|
15
|
+
export type ChipKind = (typeof CHIP_KINDS)[keyof typeof CHIP_KINDS];
|
|
16
|
+
/** Whether what the chip stands for can work. What makes it `warn` is the product's call: not attached, not connected. */
|
|
17
|
+
export declare const CHIP_STATES: {
|
|
18
|
+
readonly OK: "ok";
|
|
19
|
+
/** Can't work yet: `warn` on `warn-soft`. */
|
|
20
|
+
readonly WARN: "warn";
|
|
21
|
+
/** No longer in the organization: faint and struck through. */
|
|
22
|
+
readonly MISSING: "missing";
|
|
23
|
+
};
|
|
24
|
+
export type ChipState = (typeof CHIP_STATES)[keyof typeof CHIP_STATES];
|
|
25
|
+
export interface ChipProps extends ComponentProps<"button"> {
|
|
26
|
+
/** Omitted for what isn't one of an agent's objects (a file, an attachment): neutral. */
|
|
27
|
+
kind?: ChipKind;
|
|
28
|
+
/** Set in a line of text (a mention in instructions, a composer or a message): sized to the text, it wraps with it. */
|
|
29
|
+
inline?: boolean;
|
|
30
|
+
/** A 14px mark before the name: a connector's logo or BrandTile, an app's tiles, a skill's BookOpenText. */
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
/** Regular-weight text after the name: the way out ("Connect"), or where a picked element is (its text and page). */
|
|
33
|
+
note?: ReactNode;
|
|
34
|
+
/** Default `ok`. `warn` and `missing` replace the kind's colours. */
|
|
35
|
+
state?: ChipState;
|
|
36
|
+
/**
|
|
37
|
+
* A 6px dot after the name for what the colours don't tell: why it can't work ("Not connected"), the comment written
|
|
38
|
+
* on a picked element. The text is its tooltip and is read with the name.
|
|
39
|
+
*/
|
|
40
|
+
dot?: string;
|
|
41
|
+
/** Adds a small ✕ after the name that calls this: detach the object, delete the mention, drop the pick. */
|
|
42
|
+
onRemove?: () => void;
|
|
43
|
+
isRemoveDisabled?: boolean;
|
|
44
|
+
/** The ✕'s accessible name. Default: "Remove". */
|
|
45
|
+
removeLabel?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Something a person or an agent works with, as a chip: a connector, app, agent, workflow, skill or variable, a file, a
|
|
49
|
+
* picked element. The same chip in the Details panel, the Composer, a sent message and an agent's instructions. A
|
|
50
|
+
* button when something handles its click (its details popover's trigger, or `onClick`); otherwise a static chip, so
|
|
51
|
+
* it isn't a tab stop that does nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function Chip({ kind, inline, icon, note, state, dot, onRemove, isRemoveDisabled, removeLabel, disabled, className, children, ...props }: ChipProps): import("react").JSX.Element;
|
|
54
|
+
export interface ChipAddProps extends ComponentProps<"button"> {
|
|
55
|
+
/** Also says "Add", for a group with nothing in it yet: a lone "+" reads as decoration. */
|
|
56
|
+
isLabelVisible?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** The "+" after a group's chips. Usually the trigger of a picker (a DropdownMenu or Popover). */
|
|
59
|
+
export declare function ChipAdd({ isLabelVisible, className, ...props }: ChipAddProps): import("react").JSX.Element;
|
|
60
|
+
export interface DetailsGroupProps {
|
|
61
|
+
label: ReactNode;
|
|
62
|
+
/** Label row extras on the right (a suggestions chip). */
|
|
63
|
+
actions?: ReactNode;
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
}
|
|
66
|
+
/** A label + values pair in the Details panel: 12px faint label over a wrapping row of chips. */
|
|
67
|
+
export declare function DetailsGroup({ label, actions, children }: DetailsGroupProps): import("react").JSX.Element;
|
|
68
|
+
//# sourceMappingURL=chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAKnE,4GAA4G;AAC5G,eAAO,MAAM,UAAU;IACrB,iDAAiD;;;;IAIjD,6DAA6D;;;;IAI7D,qHAAqH;;CAE7G,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE,0HAA0H;AAC1H,eAAO,MAAM,WAAW;;IAEtB,6CAA6C;;IAE7C,+DAA+D;;CAEvD,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAyFvE,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACzD,yFAAyF;IACzF,IAAI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