@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @major-tech/ui
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- @major-tech/ui is on npm: `yarn add @major-tech/ui`, no registry setup or token. A product on a dev build replaces the `npm:@major-technology/ui-dev@…` alias with `^1.0.0` and drops the GitHub Packages lines from its `.npmrc` and CI.
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- ef1b560: Add AskUserQuestion: Major's questions before it builds, one at a time in its reply, answered with a tap, a typed answer or attached files, with optional previews; AskUserQuestionSummary shows the answers after sending, on its own from history too. Add AttachmentGallery: attached files as tiles, the same in the Composer, AskUserQuestion and sent messages, with the upload states of shadcn's Attachment (idle, uploading, processing, error, done) and their status lines, a whole-tile trigger, custom actions and a row that fades at its edges; its Attachment parts build custom tiles. Add FileDropArea and validateFiles to FileUpload: one drop field and the same checks for several files anywhere. FileUpload now refuses a picked or dropped file that doesn't match `accept`, with an error under it; `matchesAccept`, `FILE_REJECTIONS` and `formatFileSize` are exported for the same checks. Composer takes dropped and pasted files (files, onAddFiles, dropHint) and shows picked elements as ObjectChips; ObjectChip gets the element kind: an exhaustive `Record<ObjectKind, …>` needs an entry for it.
|
|
12
|
+
- Badge: the `danger` (Failed, Critical) and `warn` (High, Expiring) variants, danger and warn on their soft fills.
|
|
13
|
+
- ef1b560: Breaking: every primitive moves from Radix to Base UI in shadcn base-nova's shape, with the same look and position, and `radix-ui` is no longer a dependency. `render` replaces `asChild` on every part that took it (`<DialogTrigger render={<Button />}>`, `<DropdownMenuItem render={<Link href="/settings" />}>`). A link that looks like a button is the link styled with `buttonVariants` (`<Link className={buttonVariants({ variant: "outline" })}>`), not a Button: Base UI gives what Button renders `role="button"`. State attributes are Base UI's (`data-open`, `data-popup-open`, `data-panel-open`, `data-checked`, `data-pressed`, `data-active`, `data-disabled`) instead of `data-state`, and so are the CSS variables (`--anchor-width` for `--radix-popover-trigger-width`, `--available-height` for `--radix-…-content-available-height`). `onOpenChange`, `onValueChange`, `onCheckedChange` and `onPressedChange` get Base UI's event details as a second argument. By component:
|
|
14
|
+
|
|
15
|
+
- Button and SidebarItem default to `type="button"`: a button that submits its form passes `type="submit"`. Separator is always announced (no `decorative`); Progress takes `min`, `getAriaValueText` and `format`; Label is a plain `<label>`; AvatarFallback's `delayMs` is `delay`.
|
|
16
|
+
- Overlay content drops Radix's focus and dismissal props: `onOpenAutoFocus` and `onCloseAutoFocus` are `initialFocus` and `finalFocus`, and `onEscapeKeyDown`, `onPointerDownOutside` and `onInteractOutside` are the root's `onOpenChange` with `eventDetails.reason` and `eventDetails.cancel()`. `avoidCollisions`, `sticky` and `hideWhenDetached` are `collisionAvoidance` or gone, and a `z-*` class on the content no longer lifts it above other layers. Dialog, Drawer and Popover also stay open when focus moves into a `data-overlay-portal-branch` element.
|
|
17
|
+
- Tooltip's `delayDuration` is TooltipTrigger's `delay`, TooltipProvider's is `delay`, `disableHoverableContent` is Tooltip's `disableHoverablePopup`, and a tooltip no longer describes its trigger to assistive tech. HoverCard's delays move to HoverCardTrigger as `delay` and `closeDelay`; PopoverAnchor is gone (PopoverContent takes `anchor`); AlertDialogAction is a plain Button and no longer closes the dialog.
|
|
18
|
+
- DropdownMenuItem's `onSelect` is `onClick`, and `closeOnClick={false}` keeps the menu open; radio and checkbox items keep it open unless they pass `closeOnClick`. DropdownMenuLabel goes inside the DropdownMenuGroup or DropdownMenuRadioGroup it heads. DropdownMenuContent's `onCloseAutoFocus` is gone: DropdownMenu takes `onOpenChangeComplete`. The arrow keys still stop at the first and last rows and Escape still closes the whole menu from a submenu (`loopFocus` and `closeParentOnEsc={false}` opt out), but they now stop on disabled rows, which still can't be picked. Style a trigger's open state off `aria-expanded`: a Tooltip around the trigger sets `data-popup-open` too.
|
|
19
|
+
- Select takes `items` (the options' labels) so its trigger shows the picked label, and `onValueChange` can get `null`. SelectContent's `position` is gone: the sheet always opens under the field. SelectLabel goes inside a SelectGroup. The arrow keys stop on disabled options, which still can't be picked.
|
|
20
|
+
- Checkbox shows the dash with `indeterminate`, not `checked="indeterminate"`. Checkbox, RadioGroupItem and Switch render a `<span>` beside a hidden input, styled off `data-disabled`. RadioGroup's `orientation` and `loop` are gone: the arrow keys move both ways.
|
|
21
|
+
- Slider's `onValueCommit` is `onValueCommitted`, `minStepsBetweenThumbs` is `minStepsBetweenValues`, and `inverted` is gone. Thumbs push each other instead of swapping, and a two-thumb Slider with a `name` submits one entry per thumb.
|
|
22
|
+
- ToggleGroup's `type` is gone: `multiple` lets several be pressed, and the value is always an array. `loop` is `loopFocus` and `rovingFocus` is gone; items are buttons with `aria-pressed`, not radios, and only the left and right arrows move between them (up and down with `orientation="vertical"`).
|
|
23
|
+
- Accordion's `type` and `collapsible` are gone: `multiple` keeps several sections open, the value is always an array, and the open section can always close. The arrow keys, Home and End no longer move between headers, as the updated WAI-ARIA guidance has it: Tab does. CollapsibleContent and TraceCollapsibleContent take `keepMounted` instead of `forceMount`.
|
|
24
|
+
- Tabs select on Enter or Space, and on click rather than on press, as Base UI's do; `activateOnFocus` on TabsList selects as the arrows move, and `activationMode` is gone. Without `value` or `defaultValue` the first enabled tab is selected and `onValueChange` fires once on mount (`value={null}` selects none). A disabled tab stays reachable by the arrow keys but can't be picked.
|
|
25
|
+
- Add CaretPopover to Popover: the sheet an editor's `@` and `/` menus open in at the text caret. It picks its side once, below the caret when the sheet fits, keeps the focus in the text, and never grows past the room there. The Composer's mention menu opens in it.
|
|
26
|
+
- Breaking: Chart replaces BarChart. Every chart is built on Recharts from Chart's parts: bars by day (stacked or not), lines, areas against a limit or the previous period, and donuts, in the series colours, with one tooltip and one legend whose names can pick a series. It needs recharts (3.6 or later), an optional peer dependency: install it in a product that shows charts. BarChart and BarChartLegend are removed.
|
|
27
|
+
- 9ff7f7c: Add the chat's working parts from the web. ThinkingIndicator: Major at work, its mark as glass cubes turning in 3D (ThinkingMark) beside what it is doing now, each label rolling into the next, with the brand-deep and brand-mint tokens for the mark. ThreadStatus: a conversation's state at the start of its row, three pulsing dots while Major works and a dot when it waits or has news. ToolCall: one tool call as a step line that opens into its input and output (ToolCallOutput, formatToolOutput), and ToolCallGroup for a run of calls in one line. ToolResult: what an open call shows instead of raw output, a command and its output, a file, an edit's diff, search matches, a list, a created app, an error. SubagentRun: a subagent's run as one step line that opens into its own steps. TurnSummary: a finished turn folded into “Worked for 42s · 5 steps”. TodoList: Major's checklist in the chat and the card that floats over it while it works. SystemNotice: how a turn ended as a pill, or a step's outcome as a line. RequestCard: the frame every request Major stops on sits in, and the requests built on it: PermissionRequest (with PermissionDecision), EnvVarRequest (with EnvVarRequestOutcome) and ConnectorRequest (with ConnectorGroup for several at once). CodeBlock: code on the code surface with a header and copy, numbered or added and removed lines, in syntax colours (HighlightedCodeBlock, CodeBlockHighlightedLines, SYNTAX_THEME, and findCodeLanguage from @major-tech/ui/lib/code-language) on the new syntax-* tokens, One Light and One Dark, darkened where needed to reach 4.5:1 contrast; the package now depends on prism-react-renderer.
|
|
28
|
+
- Breaking: ObjectChip and InlineObjectChip are one component, Chip (`@major-tech/ui/chip`), for everything a person or an agent works with: in the Details panel, the Composer, a sent message and an agent's instructions; `inline` sets it in a line of text. ObjectChipAdd is ChipAdd, OBJECT_KINDS is CHIP_KINDS, OBJECT_CHIP_STATES is CHIP_STATES. `isUnavailable` gives way to `state="warn"`, and `dotLabel` to `dot`, now in the chip's colour, which also carries a comment written on a picked element. A Chip without a kind is neutral, for a file; one nothing opens is static, so an inline chip no longer needs `disabled` to stop being a button. An element's `note` (its text and page) gives way before its name.
|
|
29
|
+
- Add Command (a searchable list worked from the keyboard, for the ⌘K palette and pickers with many options, on Base UI Autocomplete), SearchableSelect (a Select that grows a search line past ten options, or its `threshold`), ContextMenu (DropdownMenu's sheet and rows on a right click) and Carousel (one slide at a time, turned by arrows, a swipe, the keys or a timer). ScrollShadows takes `render`, and AttachmentGallery's row fades its edges with it. AttachmentGallery's preview flips through the gallery's images, by its arrows or the left and right keys; sent messages show the gallery at sm (64px), and md stays for the Composer. A Tabs trigger sizes its icon to 14px, so a tab can be an icon named by its tooltip.
|
|
30
|
+
- Breaking: Composer is built from parts, so a chat panel, Pepper's conversation and a start composer are put together from the same pieces: `ComposerBox`, `ComposerFiles`, `ComposerChips`, `ComposerEditor`, `ComposerActions`, `ComposerActionGroup`, `ComposerAttachButton`, `ComposerAttachFileItem`, `ComposerPicker`, `ComposerSend`, `ComposerContextRing` and `ComposerFooter` inside `<Composer>`. The text is a TipTap editor with @ mentions as inline Chips, so Composer needs TipTap 3.30 or later (`@tiptap/core`, `@tiptap/react`, `@tiptap/pm`, `@tiptap/extension-document`, `@tiptap/extension-paragraph`, `@tiptap/extension-text`, `@tiptap/extension-hard-break`, `@tiptap/extensions`, `@tiptap/extension-mention`, `@tiptap/suggestion`), optional peer dependencies. `onSubmit` and `onValueChange` get `{ text, mentions, document }`; the ref is a handle (`focus`, `clear`, `insertMention`, `setText`, `getMessage`, `setDocument`, `openFilePicker`). `placeholder` and the initial text move to ComposerEditor, `attachments` and `COMPOSER_ATTACHMENT_KINDS` give way to Chips in ComposerChips, `addMenu` and `onAdd` to ComposerAttachButton, `pickerActive` to ComposerPicker, `settings` and `contextUsage` to ComposerFooter and ComposerContextRing, `dropHint` to ComposerBox. `queue`, `onSendNow` and `onRemoveQueued` are gone: a message sent while Major works is queued in the conversation, as a Message with `queued`. New: the `submitting` status, the glass Send, the docked box for phones, and Send beside Stop while Major works, or Respond while it waits on its questions.
|
|
31
|
+
- 5e91943: Add Calendar: shadcn's month grid on react-day-picker for a day, several days or a range. Add DateRangePicker: the time range of a log or a dashboard in one popover, with quick ranges in one click, a calendar, typed dates, and times with a time zone when minutes matter (or whole days); `DATE_PICKER_PRESETS` holds ready quick ranges, and `@major-tech/ui/lib/date-range` builds others; `DateRangePickerPanel` is its popover's content, for an overlay of the page's own (a ResponsiveOverlay's sheet on a phone).
|
|
32
|
+
- 6d0f203: Add `variant="ghost"` to SelectTrigger (`SELECT_TRIGGER_VARIANTS`): no box, muted 12px text, 28px tall, filled on hover and while open, for a quiet row of settings such as the Composer's; `getSelectTriggerClassName` takes the variant as its second argument. Composer: ⌘⇧C (Ctrl+Shift+C) toggles Click and ask from anywhere on the page, as its tooltip says. SettingsDangerButton announces its armed label in a polite live region. The catalogue and docs now list every export: `toggleVariants` and `ToggleChipCheck` (Toggle), `DATA_TABLE_EXPAND_COLUMN_ID` and the TanStack types `ColumnDef`, `ExpandedState`, `PaginationState`, `Row` and `SortingState` (DataTable), and `formatFileSize` (FileUpload); the build fails when a component exports a value the catalogue doesn't list. The component docs match the code again: EntityCard's badges, defaults and Pin, EntityRow's parts, DateRangePicker's Cancel, UTC badge and `disabledDays`, SelectContent's `alignOffset` and `collisionPadding`, Slider's thumb names, and the examples that broke their own rules.
|
|
33
|
+
- ef1b560: Add Drawer, on Base UI's Drawer: a panel that slides in from the right (a member's details over the dimmed page, `DRAWER_SIZES.LG`), floats beside a page that stays usable with `modal={false}` (the workflow node inspector, `DRAWER_SIZES.SM`), comes up from the bottom on phones with `swipeDirection="down"`, or from the left for the phone's navigation. It follows the finger and closes on a swipe toward its edge, and drawers nest. DrawerHeader takes a small `label` and the ×, DrawerBody scrolls, and DrawerFooter puts `start` on the left and its children on the right.
|
|
34
|
+
- ef1b560: EditorTabs: with `onReorder`, tabs drag into a new order, and Alt+Shift+← / → moves the focused one. Tabs that don't fit scroll, fading out on the side with more, with arrows at the end of the strip, and the open tab is kept in view. The package now depends on motion.
|
|
35
|
+
- EditorTabs carries a chat's sessions too: `trailing` for the control after the tabs (New chat), `isSingleTabVisible` to keep the strip with one tab, a `preview` tab in italics, and a label that can be any node, with `closeLabel` for its ×.
|
|
36
|
+
- ef1b560: Breaking: ListCard, ListRow and ListHeader (with `USAGE_STATES` and `LIST_ROW_KINDS`) are replaced by the web's EntityCard, composed from parts (`EntityTitle`, `EntityPin`, `EntityBadges`, `EntityMenu`, `EntityDescription`, `EntityMeta`, `EntityActions`, `EntityStrip`, `EntityActivity`, `EntityUnpublished`, `EntityRepublish`, `EntityEditors`…) for apps, agents, skills and workflows, and by EntityList and EntityRow for a library's list: the library declares its columns once, and each row puts EntityRowCells in them, built from the same parts. `buildEntityCardMenu` builds the shared menu, a sheet from the bottom on a phone, and `EntityCardPersonAvatar` draws a person's face. Unlike the web, the title is a link or button stretched over the card (`href`/`linkAs` or `onOpen`), the product passes times as sentences (`line`, `edited`) and the "Used by" people (`usedBy`), and `isWide` columns drop out under 720px. Locked and disabled cards don't open. Add the `shadow-card-hover` token, with a light edge in dark.
|
|
37
|
+
- Markdown (`@major-tech/ui/markdown`): Markdown set in the system's type, for a chat reply (`sm`), an agent's thinking (`muted`), a document (`md`) or text inside a highlight (`inherit`). Every tag maps to a named style and fenced code is a CodeBlock; `markdownVariants` gives the same type to HTML from elsewhere. Needs `react-markdown` 10 and `remark-gfm` 4, optional peer dependencies.
|
|
38
|
+
- Message: `reactions` on the person's bubble's corner (the emoji Major reacted with), `meta` before the time under it (where it was sent from), and `bubble` for Major's reply delivered in a conversation. `queued`, with `onEdit` and `onCancel`, for a message waiting until Major finishes: dimmed, with Queued · Edit · Cancel under it.
|
|
39
|
+
- Breaking: ChatMessage is now Message, imported from `@major-tech/ui/message`: `ChatMessage`, `ChatMessageProps`, `ChatMessageAuthor` and `CHAT_MESSAGE_AUTHORS` are `Message`, `MessageProps`, `MessageAuthor` and `MESSAGE_AUTHORS`, with the same props and look.
|
|
40
|
+
- b80e5f4: ObjectChip: add the `workflow` kind, for a workflow an agent can start: a neutral chip with its icon in ink-2, as an agent's.
|
|
41
|
+
- ef1b560: Breaking: TablePagination is Pagination again (`@major-tech/ui/pagination`, `PaginationProps`, `data-slot="pagination"`): it pages long lists as well as tables.
|
|
42
|
+
- 6d0f203: Add Pepper, Major's 3D assistant character, with moods, reactions and an entrance. Pepper needs `three` (0.182 or later), an optional peer dependency: install it in a product that shows Pepper. three loads only when Pepper renders.
|
|
43
|
+
- ef1b560: Add ProgressiveBlur: a blur that fades out from one edge of its parent, for content that scrolls or slides under something floating (a chat header over its transcript, the stack above the composer, the sidebar sliding over the page), with `PROGRESSIVE_BLUR_SIDES`. It is the web's ProgressiveBlur with `side` naming the edge it sits against and is strongest at: the web's `direction="bottom"` is `side="top"`.
|
|
44
|
+
- 6d0f203: Add Resizable, the web's `components/ui/resizable` on react-resizable-panels 4.7: ResizablePanelGroup, ResizablePanel and ResizableHandle, with sizes in pixels as numbers (`defaultSize={360}`) and percentages as strings. ResizableHandle has two variants in `RESIZABLE_HANDLE_VARIANTS`: `line` (the web's 1px rule, the default) and `gap`, the 4px gap between two islands that shows an accent line on hover, while dragging and on focus. Drag a handle, step it with the arrow keys, double-click it to reset; panels can collapse, stack vertically and resize from code. `usePanelRef` and `useDefaultLayout` are re-exported, so products don't import react-resizable-panels themselves.
|
|
45
|
+
- 5cc538b: Add ResponsiveOverlayCheckboxItem: a row that turns an option on or off, for a filter whose values can be on together. The dropdown's checkbox item from 768px up, a row with a check in the sheet below it; a pick keeps the overlay open.
|
|
46
|
+
- 88e3368: Add ResponsiveOverlay, in the new Service group: one overlay for both widths, a Dialog, Popover or DropdownMenu from 768px up (`desktopVariant`) and a Drawer from the bottom below it, with Item, Label, Separator, RadioGroup and Sub rows that work in both and close it on a pick. Add hooks to the package, imported from `@major-tech/ui/hooks/<name>`: `useIsMobile` is `true` below 768px, `false` from 768px up and `null` on the server and while the page hydrates, so a client-side navigation never draws the desktop layout first.
|
|
47
|
+
- 9ff7f7c: Add ScrollShadows: a scroll container that fades its content out on the edges with more to scroll to, vertically, horizontally or both, and updates as its content arrives or resizes. The fades are a mask on the content, so they work on any surface.
|
|
48
|
+
- 88e3368: Add `isPulsing` to StatusDot: a ring of the dot's colour pings out of it once a second while the state is happening right now (Live, Running), in every tone. It holds still with reduced motion.
|
|
49
|
+
- 595c769: Add the `glass` Button variant (the composer's send tile) with its tokens: `shadow-glass`, `shadow-glass-hover`, `shadow-glass-active` and the `--glass` fill. Dialog and Popover no longer close on clicks inside an element marked `data-overlay-portal-branch` (a list portaled out of them); `eventTargetsOverlayPortalBranch` from `@major-tech/ui/lib/overlay-portal-branch` does the same check for products' own overlays.
|
|
50
|
+
|
|
51
|
+
The package now ships its Markdown docs in `dist/docs/` (`node_modules/@major-tech/ui/dist/docs/`): every component's usage rules and API, the foundations, guidelines and patterns, for agents writing product code.
|
|
52
|
+
- 5cc538b: AskUserQuestion: a preview can be plain text (Markdown, ASCII), set as written, and its frame is as tall as its content up to 320px. Add `onOpenFile` to AskUserQuestionSummary and `onOpen` to AttachmentGallery, for files whose links are signed when they're opened (images keep the preview). Add `checkIfFileDragClaimed`, so a product's own drop zone lets a drop go that a FileDropArea inside it took. Fix AskUserQuestionSummary: a sent file with no url (a PDF has no local preview) is listed instead of dropped, and shows without opening. Fix TodoList: a list whose items were all cancelled reads as done.
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- 9ff7f7c: ActivityChart: each day of the mini row is its own hover target, and the day under the pointer, in the row or in its hover card, lights up in both.
|
|
57
|
+
- 9afa64d: The docs in the package start at `dist/docs/index.md`: which file answers which task, then every page and component with what it covers, so an agent opens only the files it needs.
|
|
58
|
+
- 5cc538b: Docs: the Markdown in `dist/docs` is now generated from the documentation site's own pages, so it says exactly what the site says: every example comes with its code, and the Motion page lists every animation's full spec.
|
|
59
|
+
- 9ff7f7c: Document HoverCard, in Overlays: when to dim the page behind it (one object's detail in a library: activity, editors, who used it, a workflow's elements, a theme's preview) and when not (help beside a control, a table cell's overflow), its timing and its keyboard and touch behaviour.
|
|
60
|
+
- 88e3368: Document Spinner, in Feedback before Progress: in the control that started the work, beside a line of text, and which of Spinner, Progress, Skeleton and a pulsing StatusDot to use.
|
|
61
|
+
- Tabs: the selected tab's rule in the underline variant is accent again; it was drawn white, since `shadow-card` also sets the shadow colour.
|
|
62
|
+
|
|
63
|
+
Toaster: a long toast wraps at the toast column's width instead of running past it, off the screen when the toaster sits in a corner.
|
|
64
|
+
|
|
65
|
+
## 0.3.0
|
|
66
|
+
|
|
67
|
+
### Minor Changes
|
|
68
|
+
|
|
69
|
+
- 0c22098: One package: `@major/tokens` is part of `@major-tech/ui`.
|
|
70
|
+
|
|
71
|
+
- Styles: `@import "@major-tech/ui/tailwind.css"` (theme + `@source` on the components) or `@major-tech/ui/theme.css` (theme only). Replace `@import "@major/tokens/theme.css"`.
|
|
72
|
+
- Tokens in JS: `import { tokens } from "@major-tech/ui/lib/major-tokens"`; the source is `@major-tech/ui/tokens.json`. Uninstall `@major/tokens`.
|
|
73
|
+
- Breaking: one entry point per component — `import { Button } from "@major-tech/ui/button"`, `import { cn } from "@major-tech/ui/lib/cn"`. The `@major-tech/ui` barrel is gone.
|
|
74
|
+
- Breaking: the precompiled `@major-tech/ui/styles.css` for apps without Tailwind is gone; the package needs Tailwind v4.
|
|
75
|
+
- `cn()` and the tokens no longer carry `"use client"`, so Server Components can call them.
|
|
76
|
+
- "Go to definition" opens the TypeScript source: the package ships declaration maps and sourcemaps with the sources inside.
|
|
77
|
+
- 0c22098: Primitives and composed components, named and composed as in the web app.
|
|
78
|
+
|
|
79
|
+
- Breaking: components are composed from parts, as in shadcn/ui: `Field` + `FieldLabel` + `Input` instead of `TextField`, compound `Select`, `Tooltip`, `Alert`, `Avatar`, `Accordion`. Icons go in `children`.
|
|
80
|
+
- Breaking, renamed: IconButton → Button icon sizes, Tag → Badge, Notice → Alert, Toast → Sonner, TextField → Field, Radio → RadioGroup, ChoiceChip → Toggle / ToggleGroup, SegmentedControl → Tabs, Tabs → EditorTabs, Menu → DropdownMenu, ConfirmDialog → AlertDialog, Pagination → TablePagination, RunsChart → ActivityChart.
|
|
81
|
+
- New primitives: Card, Separator, Kbd, StatusDot, Input, Textarea, InputGroup, Popover, Collapsible, Table, Island. New composed: PasswordInput, UsageMeter; DataTable is built on TanStack Table.
|
|
82
|
+
- Breaking, tokens: radii named by role (`rounded-sm` 4 · `segment` 5 · `md` 6 · `row` 7 · `lg` 8 · `panel` 10 · `xl` 12 · `full`); text styles 2xs, ui-sm, nav, md, title-sm, display; no xs/sm/base/lg aliases; colour `code` is `code-surface`; colours only as `--color-*`; `p-space-N` spacing utilities; sizes in rem.
|
|
83
|
+
- Fixed: `bubble` is #ededed in light, as in the platform design. New: `island-glow` and `bg-page-glow`, the light in a page panel's corner.
|
|
84
|
+
|
|
85
|
+
## 0.2.0
|
|
86
|
+
|
|
87
|
+
### Minor Changes
|
|
88
|
+
|
|
89
|
+
- Add BarChart and RunsChart.
|
|
90
|
+
|
|
91
|
+
- `BarChart`: daily values over a period, stacked by up to three series (chart-1 → chart-3), a dashed previous-period comparison, and a tooltip you can scrub with the keyboard.
|
|
92
|
+
- `RunsChart`: the 7-bar mini chart of an agent's runs, with its hover card and the focus dim.
|
|
93
|
+
- `@major/tokens`: `animate-mj-dim`, the 600ms ease-in fade for focus dims.
|
|
94
|
+
- Fix: `cn()` didn't treat `bg-transparent` as a background colour, so a fill such as `bg-selected` lost to it. Selected `SidebarItem`s now get their fill.
|
|
95
|
+
- `SidebarItem`: top-level icons are 16px, matching the Figma library.
|
|
96
|
+
|
|
97
|
+
## 0.1.0
|
|
98
|
+
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- First release of `@major/tokens` and `@major-tech/ui`: tokens (light and dark), the Tailwind v4 theme, and the Actions, Inputs, Navigation, Feedback, Data, Overlays, Chat and Lists components.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Portions of `@major-tech/ui` are derived from shadcn/ui (https://github.com/shadcn-ui/ui), used under the MIT License:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2023 shadcn
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
3
|
+
export declare const ACCORDION_VARIANTS: {
|
|
4
|
+
/** Sections stacked as one card with `line` dividers. */
|
|
5
|
+
readonly CARD: "card";
|
|
6
|
+
/** A single quiet toggle inside dialogs ("Advanced settings"). */
|
|
7
|
+
readonly PLAIN: "plain";
|
|
8
|
+
};
|
|
9
|
+
type AccordionVariant = (typeof ACCORDION_VARIANTS)[keyof typeof ACCORDION_VARIANTS];
|
|
10
|
+
type AccordionProps = AccordionPrimitive.Root.Props & {
|
|
11
|
+
/** `card` (default): sections stacked as one card. `plain`: a quiet toggle inside dialogs. */
|
|
12
|
+
variant?: AccordionVariant;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Sections that open to reveal more. `multiple` for stacked sections (open as many as you like); without it one is
|
|
16
|
+
* open at a time and opening another closes it. `value` / `defaultValue` are arrays of the open items' values.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Accordion({ variant, ...props }: AccordionProps): import("react").JSX.Element;
|
|
19
|
+
/** One section. In a card, sections after the first get a `line` divider. */
|
|
20
|
+
export declare function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props): import("react").JSX.Element;
|
|
21
|
+
type AccordionTriggerProps = AccordionPrimitive.Trigger.Props & {
|
|
22
|
+
/** What's inside or on, right-aligned in `muted` ("Rate limit 60/min"). */
|
|
23
|
+
summary?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The header: a chevron on the left that turns 90° in 150ms, the title, then the summary. 14px semibold
|
|
27
|
+
* in a card, 13px semibold `ink-2` as a plain toggle.
|
|
28
|
+
*/
|
|
29
|
+
export declare function AccordionTrigger({ className, children, summary, ...props }: AccordionTriggerProps): import("react").JSX.Element;
|
|
30
|
+
/** The section's content. It opens over 200ms and closes over 150ms. `className` goes to the inner padding box. */
|
|
31
|
+
export declare function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI3E,eAAO,MAAM,kBAAkB;IAC7B,yDAAyD;;IAEzD,kEAAkE;;CAE1D,CAAC;AAEX,KAAK,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAIrF,KAAK,cAAc,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,GAAG;IACpD,8FAA8F;IAC9F,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,OAAiC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAcxF;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,+BAUnF;AAED,KAAK,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,CAAC,KAAK,GAAG;IAC9D,2EAA2E;IAC3E,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+BA4BjG;AAWD,mHAAmH;AACnH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,KAAK,+BAYjG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
export const ACCORDION_VARIANTS = {
|
|
8
|
+
/** Sections stacked as one card with `line` dividers. */
|
|
9
|
+
CARD: "card",
|
|
10
|
+
/** A single quiet toggle inside dialogs ("Advanced settings"). */
|
|
11
|
+
PLAIN: "plain",
|
|
12
|
+
};
|
|
13
|
+
const AccordionVariantContext = createContext(ACCORDION_VARIANTS.CARD);
|
|
14
|
+
/**
|
|
15
|
+
* Sections that open to reveal more. `multiple` for stacked sections (open as many as you like); without it one is
|
|
16
|
+
* open at a time and opening another closes it. `value` / `defaultValue` are arrays of the open items' values.
|
|
17
|
+
*/
|
|
18
|
+
export function Accordion({ variant = ACCORDION_VARIANTS.CARD, ...props }) {
|
|
19
|
+
return (_jsx(AccordionVariantContext.Provider, { value: variant, children: _jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props, className: cn(variant === ACCORDION_VARIANTS.CARD &&
|
|
20
|
+
"w-full overflow-hidden rounded-xl border border-panel-edge bg-surface shadow-card", props.className) }) }));
|
|
21
|
+
}
|
|
22
|
+
/** One section. In a card, sections after the first get a `line` divider. */
|
|
23
|
+
export function AccordionItem({ className, ...props }) {
|
|
24
|
+
const variant = useContext(AccordionVariantContext);
|
|
25
|
+
return (_jsx(AccordionPrimitive.Item, { "data-slot": "accordion-item", className: cn(variant === ACCORDION_VARIANTS.CARD && "border-t border-line first:border-t-0", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The header: a chevron on the left that turns 90° in 150ms, the title, then the summary. 14px semibold
|
|
29
|
+
* in a card, 13px semibold `ink-2` as a plain toggle.
|
|
30
|
+
*/
|
|
31
|
+
export function AccordionTrigger({ className, children, summary, ...props }) {
|
|
32
|
+
const variant = useContext(AccordionVariantContext);
|
|
33
|
+
const isCard = variant === ACCORDION_VARIANTS.CARD;
|
|
34
|
+
return (_jsx(AccordionPrimitive.Header, { className: "flex", children: _jsxs(AccordionPrimitive.Trigger, { "data-slot": "accordion-trigger", className: cn("group/accordion flex flex-1 cursor-pointer items-center gap-space-8 border-0 bg-transparent text-left font-sans outline-none hover:bg-hover focus-visible:ring-2 focus-visible:ring-faint", isCard
|
|
35
|
+
? "px-4.5 py-space-14 text-body font-semibold leading-auto text-ink"
|
|
36
|
+
: "-ml-space-8 flex-none rounded-md px-space-8 py-space-6 text-ui font-semibold text-ink-2", className), ...props, children: [_jsx(ChevronRight, { className: cn("shrink-0 text-muted transition-transform duration-150 group-data-panel-open/accordion:rotate-90", isCard ? "size-3.75" : "size-3.5") }), _jsx("span", { children: children }), summary && _jsx("small", { className: "ml-auto text-small font-normal text-muted", children: summary })] }) }));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Content clears its trigger and lines up with the trigger's title: in a card, inset past the chevron and
|
|
40
|
+
* padded like the trigger; under a plain toggle, a gap below it. Full-bleed content (settings rows) passes `p-0`.
|
|
41
|
+
*/
|
|
42
|
+
const ACCORDION_CONTENT_CLASSES = {
|
|
43
|
+
[ACCORDION_VARIANTS.CARD]: "pb-space-14 pl-10 pr-4.5 pt-space-2",
|
|
44
|
+
[ACCORDION_VARIANTS.PLAIN]: "pt-space-8",
|
|
45
|
+
};
|
|
46
|
+
/** The section's content. It opens over 200ms and closes over 150ms. `className` goes to the inner padding box. */
|
|
47
|
+
export function AccordionContent({ className, children, ...props }) {
|
|
48
|
+
const variant = useContext(AccordionVariantContext);
|
|
49
|
+
return (_jsx(AccordionPrimitive.Panel, { "data-slot": "accordion-content", className: "overflow-hidden data-open:animate-accordion-open data-closed:animate-accordion-close", ...props, children: _jsx("div", { className: cn(ACCORDION_CONTENT_CLASSES[variant], className), children: children }) }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ReactNode } from \"react\";\nimport { Accordion as AccordionPrimitive } from \"@base-ui/react/accordion\";\nimport { ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const ACCORDION_VARIANTS = {\n /** Sections stacked as one card with `line` dividers. */\n CARD: \"card\",\n /** A single quiet toggle inside dialogs (\"Advanced settings\"). */\n PLAIN: \"plain\",\n} as const;\n\ntype AccordionVariant = (typeof ACCORDION_VARIANTS)[keyof typeof ACCORDION_VARIANTS];\n\nconst AccordionVariantContext = createContext<AccordionVariant>(ACCORDION_VARIANTS.CARD);\n\ntype AccordionProps = AccordionPrimitive.Root.Props & {\n /** `card` (default): sections stacked as one card. `plain`: a quiet toggle inside dialogs. */\n variant?: AccordionVariant;\n};\n\n/**\n * Sections that open to reveal more. `multiple` for stacked sections (open as many as you like); without it one is\n * open at a time and opening another closes it. `value` / `defaultValue` are arrays of the open items' values.\n */\nexport function Accordion({ variant = ACCORDION_VARIANTS.CARD, ...props }: AccordionProps) {\n return (\n <AccordionVariantContext.Provider value={variant}>\n <AccordionPrimitive.Root\n data-slot=\"accordion\"\n {...props}\n className={cn(\n variant === ACCORDION_VARIANTS.CARD &&\n \"w-full overflow-hidden rounded-xl border border-panel-edge bg-surface shadow-card\",\n props.className\n )}\n />\n </AccordionVariantContext.Provider>\n );\n}\n\n/** One section. In a card, sections after the first get a `line` divider. */\nexport function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {\n const variant = useContext(AccordionVariantContext);\n\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn(variant === ACCORDION_VARIANTS.CARD && \"border-t border-line first:border-t-0\", className)}\n {...props}\n />\n );\n}\n\ntype AccordionTriggerProps = AccordionPrimitive.Trigger.Props & {\n /** What's inside or on, right-aligned in `muted` (\"Rate limit 60/min\"). */\n summary?: ReactNode;\n};\n\n/**\n * The header: a chevron on the left that turns 90° in 150ms, the title, then the summary. 14px semibold\n * in a card, 13px semibold `ink-2` as a plain toggle.\n */\nexport function AccordionTrigger({ className, children, summary, ...props }: AccordionTriggerProps) {\n const variant = useContext(AccordionVariantContext);\n const isCard = variant === ACCORDION_VARIANTS.CARD;\n\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n \"group/accordion flex flex-1 cursor-pointer items-center gap-space-8 border-0 bg-transparent text-left font-sans outline-none hover:bg-hover focus-visible:ring-2 focus-visible:ring-faint\",\n isCard\n ? \"px-4.5 py-space-14 text-body font-semibold leading-auto text-ink\"\n : \"-ml-space-8 flex-none rounded-md px-space-8 py-space-6 text-ui font-semibold text-ink-2\",\n className\n )}\n {...props}\n >\n <ChevronRight\n className={cn(\n \"shrink-0 text-muted transition-transform duration-150 group-data-panel-open/accordion:rotate-90\",\n isCard ? \"size-3.75\" : \"size-3.5\"\n )}\n />\n <span>{children}</span>\n {summary && <small className=\"ml-auto text-small font-normal text-muted\">{summary}</small>}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n}\n\n/**\n * Content clears its trigger and lines up with the trigger's title: in a card, inset past the chevron and\n * padded like the trigger; under a plain toggle, a gap below it. Full-bleed content (settings rows) passes `p-0`.\n */\nconst ACCORDION_CONTENT_CLASSES = {\n [ACCORDION_VARIANTS.CARD]: \"pb-space-14 pl-10 pr-4.5 pt-space-2\",\n [ACCORDION_VARIANTS.PLAIN]: \"pt-space-8\",\n} satisfies Record<AccordionVariant, string>;\n\n/** The section's content. It opens over 200ms and closes over 150ms. `className` goes to the inner padding box. */\nexport function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props) {\n const variant = useContext(AccordionVariantContext);\n\n return (\n <AccordionPrimitive.Panel\n data-slot=\"accordion-content\"\n className=\"overflow-hidden data-open:animate-accordion-open data-closed:animate-accordion-close\"\n {...props}\n >\n <div className={cn(ACCORDION_CONTENT_CLASSES[variant], className)}>{children}</div>\n </AccordionPrimitive.Panel>\n );\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface ActivityChartProps {
|
|
3
|
+
/** One value per day, oldest first. Any number of days. */
|
|
4
|
+
values: number[];
|
|
5
|
+
/** The failed share of each day's value, drawn in `danger` on top of it. */
|
|
6
|
+
failures?: number[];
|
|
7
|
+
/** Per value, the day as the hover card names it: "Mon 26 Oct", "Today". */
|
|
8
|
+
dayLabels: string[];
|
|
9
|
+
/** The hover card's heading: "Runs, last 7 days". */
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** "2 runs", "1.5h". Also formats the window total. */
|
|
12
|
+
formatValue: (value: number) => string;
|
|
13
|
+
/** Under the plot: the first day, the window, the last day. */
|
|
14
|
+
axisLabels?: [string, string, string];
|
|
15
|
+
/** Below a rule at the bottom: "Last run · 14h ago". */
|
|
16
|
+
footer?: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* How much something ran or was used over a short window. A mini bar row on cards and list rows; hovering it
|
|
21
|
+
* dims the page and opens the same window drawn large, with a value for the day under the pointer. The day is the
|
|
22
|
+
* same in both: point at it in the row or in the card, and it lights up in each.
|
|
23
|
+
*/
|
|
24
|
+
declare function ActivityChart({ values, failures, dayLabels, title, formatValue, axisLabels, footer, className, }: ActivityChartProps): import("react").JSX.Element;
|
|
25
|
+
export { ActivityChart };
|
|
26
|
+
//# sourceMappingURL=activity-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-chart.d.ts","sourceRoot":"","sources":["../../src/components/activity-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUjD,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qDAAqD;IACrD,KAAK,EAAE,SAAS,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;GAIG;AACH,iBAAS,aAAa,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,+BAwFpB;AA8CD,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./hover-card.js";
|
|
6
|
+
/** The mini row is 16px tall, the hover card's plot 42px. */
|
|
7
|
+
const MINI_PLOT_HEIGHT = 16;
|
|
8
|
+
const PANEL_PLOT_HEIGHT = 42;
|
|
9
|
+
/** A day with any activity never draws shorter than this, so one busy day can't flatten the rest. */
|
|
10
|
+
const MINI_MIN_BAR_HEIGHT = 3;
|
|
11
|
+
function sumValues(values) {
|
|
12
|
+
return values.reduce((total, value) => total + value, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* How much something ran or was used over a short window. A mini bar row on cards and list rows; hovering it
|
|
16
|
+
* dims the page and opens the same window drawn large, with a value for the day under the pointer. The day is the
|
|
17
|
+
* same in both: point at it in the row or in the card, and it lights up in each.
|
|
18
|
+
*/
|
|
19
|
+
function ActivityChart({ values, failures, dayLabels, title, formatValue, axisLabels, footer, className, }) {
|
|
20
|
+
const lastIndex = values.length - 1;
|
|
21
|
+
const [activeIndex, setActiveIndex] = useState(lastIndex);
|
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
+
const max = Math.max(1, ...values);
|
|
24
|
+
const total = sumValues(values);
|
|
25
|
+
const activeFailures = failures?.[activeIndex] ?? 0;
|
|
26
|
+
// Not pointing at a day: the card reads the latest one.
|
|
27
|
+
const showLatestDay = () => setActiveIndex(lastIndex);
|
|
28
|
+
const handleOpenChange = (open) => {
|
|
29
|
+
setIsOpen(open);
|
|
30
|
+
if (!open) {
|
|
31
|
+
showLatestDay();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(HoverCard, { onOpenChange: handleOpenChange, children: [_jsx(HoverCardTrigger, { onPointerLeave: showLatestDay, render: _jsx("span", { tabIndex: 0, "data-slot": "activity-chart", "aria-label": `${typeof title === "string" ? title : "Activity"}: ${formatValue(total)}`, className: cn(
|
|
35
|
+
// No gap: each day's slot takes its share of the row, so the pointer is always over a day.
|
|
36
|
+
"inline-flex h-5.5 shrink-0 items-end rounded-segment px-1 py-0.75 outline-none transition-colors duration-120", "hover:bg-ink/6 focus-visible:bg-ink/6 focus-visible:ring-2 focus-visible:ring-secondary", className) }), children: values.map((value, index) => (
|
|
37
|
+
// 1px on each side makes the 2px between bars, inside the slots.
|
|
38
|
+
_jsx("span", { onPointerEnter: () => setActiveIndex(index), className: "flex h-full items-end px-px", children: _jsx(MiniBar, { value: value, failures: failures?.[index] ?? 0, max: max, isDimmed: isOpen && index !== activeIndex }) }, index))) }), _jsxs(HoverCardContent, { dim: true, side: "bottom", align: "start", onPointerLeave: showLatestDay, children: [_jsxs("div", { className: "mb-space-8 flex items-center justify-between gap-space-8", children: [_jsx("span", { children: title }), _jsx("b", { className: "font-medium text-ink-2", children: formatValue(total) })] }), _jsx("div", { className: "flex items-end border-b border-ink/12", style: { height: PANEL_PLOT_HEIGHT }, children: values.map((value, index) => (_jsx("span", { onPointerEnter: () => setActiveIndex(index), className: cn("flex h-full flex-1 flex-col-reverse items-center rounded-t-sm", index === activeIndex && "bg-hover"), children: _jsx(PanelBar, { value: value, failures: failures?.[index] ?? 0, max: max }) }, index))) }), axisLabels !== undefined && (_jsx("div", { className: "flex justify-between px-space-2 pt-space-4 text-faint", children: axisLabels.map((label) => (_jsx("span", { children: label }, label))) })), _jsxs("div", { className: "mt-space-8 min-h-4 text-ink-2", children: [_jsx("b", { className: "font-semibold text-ink", children: dayLabels[activeIndex] }), " \u00B7 ", formatValue(values[activeIndex] ?? 0), activeFailures > 0 && _jsxs("span", { className: "text-danger", children: [" \u00B7 ", activeFailures, " failed"] })] }), footer && _jsx("div", { className: "mt-space-6 border-t border-ink/8 pt-space-8", children: footer })] })] }));
|
|
39
|
+
}
|
|
40
|
+
/** While the card is open, every day but the one it reads fades back. */
|
|
41
|
+
const MINI_BAR_DIM_CLASS = "transition-opacity duration-120";
|
|
42
|
+
function MiniBar({ value, failures, max, isDimmed }) {
|
|
43
|
+
if (value === 0) {
|
|
44
|
+
return _jsx("i", { className: cn("block h-0.5 w-1.25 rounded-[1px] bg-line", MINI_BAR_DIM_CLASS, isDimmed && "opacity-40") });
|
|
45
|
+
}
|
|
46
|
+
const height = Math.max(MINI_MIN_BAR_HEIGHT, (value / max) * MINI_PLOT_HEIGHT);
|
|
47
|
+
const failedShare = Math.min(1, failures / value);
|
|
48
|
+
return (_jsx("i", { className: cn("flex w-1.25 flex-col overflow-hidden rounded-t-[1.5px] bg-chart-1", MINI_BAR_DIM_CLASS, isDimmed && "opacity-40"), style: { height }, children: failedShare > 0 && _jsx("span", { className: "block w-full bg-danger", style: { height: `${failedShare * 100}%` } }) }));
|
|
49
|
+
}
|
|
50
|
+
function PanelBar({ value, failures, max }) {
|
|
51
|
+
const height = (value / max) * PANEL_PLOT_HEIGHT;
|
|
52
|
+
const failedShare = value > 0 ? Math.min(1, failures / value) : 0;
|
|
53
|
+
return (_jsx("i", { className: "flex w-[58%] max-w-5.5 flex-col overflow-hidden rounded-t-sm bg-chart-1", style: { height }, children: failedShare > 0 && _jsx("span", { className: "block w-full bg-danger", style: { height: `${failedShare * 100}%` } }) }));
|
|
54
|
+
}
|
|
55
|
+
export { ActivityChart };
|
|
56
|
+
//# sourceMappingURL=activity-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-chart.js","sourceRoot":"","sources":["../../src/components/activity-chart.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { HoverCard, HoverCardContent, HoverCardTrigger } from \"./hover-card.tsx\";\n\n/** The mini row is 16px tall, the hover card's plot 42px. */\nconst MINI_PLOT_HEIGHT = 16;\nconst PANEL_PLOT_HEIGHT = 42;\n/** A day with any activity never draws shorter than this, so one busy day can't flatten the rest. */\nconst MINI_MIN_BAR_HEIGHT = 3;\n\nexport interface ActivityChartProps {\n /** One value per day, oldest first. Any number of days. */\n values: number[];\n /** The failed share of each day's value, drawn in `danger` on top of it. */\n failures?: number[];\n /** Per value, the day as the hover card names it: \"Mon 26 Oct\", \"Today\". */\n dayLabels: string[];\n /** The hover card's heading: \"Runs, last 7 days\". */\n title: ReactNode;\n /** \"2 runs\", \"1.5h\". Also formats the window total. */\n formatValue: (value: number) => string;\n /** Under the plot: the first day, the window, the last day. */\n axisLabels?: [string, string, string];\n /** Below a rule at the bottom: \"Last run · 14h ago\". */\n footer?: ReactNode;\n className?: string;\n}\n\nfunction sumValues(values: number[]): number {\n return values.reduce((total, value) => total + value, 0);\n}\n\n/**\n * How much something ran or was used over a short window. A mini bar row on cards and list rows; hovering it\n * dims the page and opens the same window drawn large, with a value for the day under the pointer. The day is the\n * same in both: point at it in the row or in the card, and it lights up in each.\n */\nfunction ActivityChart({\n values,\n failures,\n dayLabels,\n title,\n formatValue,\n axisLabels,\n footer,\n className,\n}: ActivityChartProps) {\n const lastIndex = values.length - 1;\n const [activeIndex, setActiveIndex] = useState(lastIndex);\n const [isOpen, setIsOpen] = useState(false);\n const max = Math.max(1, ...values);\n const total = sumValues(values);\n const activeFailures = failures?.[activeIndex] ?? 0;\n\n // Not pointing at a day: the card reads the latest one.\n const showLatestDay = () => setActiveIndex(lastIndex);\n\n const handleOpenChange = (open: boolean) => {\n setIsOpen(open);\n\n if (!open) {\n showLatestDay();\n }\n };\n\n return (\n <HoverCard onOpenChange={handleOpenChange}>\n <HoverCardTrigger\n onPointerLeave={showLatestDay}\n render={\n <span\n tabIndex={0}\n data-slot=\"activity-chart\"\n aria-label={`${typeof title === \"string\" ? title : \"Activity\"}: ${formatValue(total)}`}\n className={cn(\n // No gap: each day's slot takes its share of the row, so the pointer is always over a day.\n \"inline-flex h-5.5 shrink-0 items-end rounded-segment px-1 py-0.75 outline-none transition-colors duration-120\",\n \"hover:bg-ink/6 focus-visible:bg-ink/6 focus-visible:ring-2 focus-visible:ring-secondary\",\n className\n )}\n />\n }\n >\n {values.map((value, index) => (\n // 1px on each side makes the 2px between bars, inside the slots.\n <span key={index} onPointerEnter={() => setActiveIndex(index)} className=\"flex h-full items-end px-px\">\n <MiniBar\n value={value}\n failures={failures?.[index] ?? 0}\n max={max}\n isDimmed={isOpen && index !== activeIndex}\n />\n </span>\n ))}\n </HoverCardTrigger>\n\n <HoverCardContent dim side=\"bottom\" align=\"start\" onPointerLeave={showLatestDay}>\n <div className=\"mb-space-8 flex items-center justify-between gap-space-8\">\n <span>{title}</span>\n <b className=\"font-medium text-ink-2\">{formatValue(total)}</b>\n </div>\n\n <div className=\"flex items-end border-b border-ink/12\" style={{ height: PANEL_PLOT_HEIGHT }}>\n {values.map((value, index) => (\n <span\n key={index}\n onPointerEnter={() => setActiveIndex(index)}\n className={cn(\n \"flex h-full flex-1 flex-col-reverse items-center rounded-t-sm\",\n index === activeIndex && \"bg-hover\"\n )}\n >\n <PanelBar value={value} failures={failures?.[index] ?? 0} max={max} />\n </span>\n ))}\n </div>\n\n {axisLabels !== undefined && (\n <div className=\"flex justify-between px-space-2 pt-space-4 text-faint\">\n {axisLabels.map((label) => (\n <span key={label}>{label}</span>\n ))}\n </div>\n )}\n\n <div className=\"mt-space-8 min-h-4 text-ink-2\">\n <b className=\"font-semibold text-ink\">{dayLabels[activeIndex]}</b> · {formatValue(values[activeIndex] ?? 0)}\n {activeFailures > 0 && <span className=\"text-danger\"> · {activeFailures} failed</span>}\n </div>\n\n {footer && <div className=\"mt-space-6 border-t border-ink/8 pt-space-8\">{footer}</div>}\n </HoverCardContent>\n </HoverCard>\n );\n}\n\ninterface MiniBarProps {\n value: number;\n failures: number;\n max: number;\n /** Another day is the one under the pointer, in the row or in the card. */\n isDimmed: boolean;\n}\n\n/** While the card is open, every day but the one it reads fades back. */\nconst MINI_BAR_DIM_CLASS = \"transition-opacity duration-120\";\n\nfunction MiniBar({ value, failures, max, isDimmed }: MiniBarProps) {\n if (value === 0) {\n return <i className={cn(\"block h-0.5 w-1.25 rounded-[1px] bg-line\", MINI_BAR_DIM_CLASS, isDimmed && \"opacity-40\")} />;\n }\n\n const height = Math.max(MINI_MIN_BAR_HEIGHT, (value / max) * MINI_PLOT_HEIGHT);\n const failedShare = Math.min(1, failures / value);\n\n return (\n <i\n className={cn(\n \"flex w-1.25 flex-col overflow-hidden rounded-t-[1.5px] bg-chart-1\",\n MINI_BAR_DIM_CLASS,\n isDimmed && \"opacity-40\"\n )}\n style={{ height }}\n >\n {failedShare > 0 && <span className=\"block w-full bg-danger\" style={{ height: `${failedShare * 100}%` }} />}\n </i>\n );\n}\n\nfunction PanelBar({ value, failures, max }: { value: number; failures: number; max: number }) {\n const height = (value / max) * PANEL_PLOT_HEIGHT;\n const failedShare = value > 0 ? Math.min(1, failures / value) : 0;\n\n return (\n <i className=\"flex w-[58%] max-w-5.5 flex-col overflow-hidden rounded-t-sm bg-chart-1\" style={{ height }}>\n {failedShare > 0 && <span className=\"block w-full bg-danger\" style={{ height: `${failedShare * 100}%` }} />}\n </i>\n );\n}\n\nexport { ActivityChart };\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
3
|
+
import { type ButtonProps } from "./button.tsx";
|
|
4
|
+
/**
|
|
5
|
+
* Root of the blocking question before anything that can't be undone. The title names the object,
|
|
6
|
+
* the description the consequence, the action repeats the verb. Controlled with `open` / `onOpenChange`,
|
|
7
|
+
* or uncontrolled with an `AlertDialogTrigger`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function AlertDialog(props: AlertDialogPrimitive.Root.Props): import("react").JSX.Element;
|
|
10
|
+
/** Pass the danger button that asks as `render`: `<AlertDialogTrigger render={<Button … />}>Delete</AlertDialogTrigger>`. */
|
|
11
|
+
export declare function AlertDialogTrigger(props: AlertDialogPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
12
|
+
/** The 378px sheet, with its portal and dimmed overlay. Clicks outside don't close it. */
|
|
13
|
+
export declare function AlertDialogContent({ className, ...props }: AlertDialogPrimitive.Popup.Props): import("react").JSX.Element;
|
|
14
|
+
export declare function AlertDialogHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
15
|
+
/** Cancel first, then the action. */
|
|
16
|
+
export declare function AlertDialogFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
17
|
+
/** 15px semibold. Names the object: "Delete lead-scoring?" */
|
|
18
|
+
export declare function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props): import("react").JSX.Element;
|
|
19
|
+
/** The consequence, in one or two sentences. */
|
|
20
|
+
export declare function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* The confirm button: solid danger, repeating verb and object ("Delete skill"). A Button: it doesn't close the
|
|
23
|
+
* dialog by itself, so the dialog stays up, `loading`, until the work it started is done; close it then.
|
|
24
|
+
*/
|
|
25
|
+
export declare function AlertDialogAction({ variant, ...props }: ButtonProps): import("react").JSX.Element;
|
|
26
|
+
/** Closes the dialog. Give it `autoFocus`: focus starts on Cancel. */
|
|
27
|
+
export declare function AlertDialogCancel({ variant, size, ...props }: AlertDialogPrimitive.Close.Props & Pick<ButtonProps, "variant" | "size">): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=alert-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../src/components/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,+BAEjE;AAED,6HAA6H;AAC7H,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,+BAE3E;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,+BAqB3F;AAED,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAE/E;AAED,qCAAqC;AACrC,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAE/E;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,+BAQzF;AAED,gDAAgD;AAChD,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,+BAQrG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAqC,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,+BAEjG;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,EAChC,OAAiC,EACjC,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,+BAQ1E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { BUTTON_VARIANTS, Button } from "./button.js";
|
|
6
|
+
/**
|
|
7
|
+
* Root of the blocking question before anything that can't be undone. The title names the object,
|
|
8
|
+
* the description the consequence, the action repeats the verb. Controlled with `open` / `onOpenChange`,
|
|
9
|
+
* or uncontrolled with an `AlertDialogTrigger`.
|
|
10
|
+
*/
|
|
11
|
+
export function AlertDialog(props) {
|
|
12
|
+
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
13
|
+
}
|
|
14
|
+
/** Pass the danger button that asks as `render`: `<AlertDialogTrigger render={<Button … />}>Delete</AlertDialogTrigger>`. */
|
|
15
|
+
export function AlertDialogTrigger(props) {
|
|
16
|
+
return _jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
|
|
17
|
+
}
|
|
18
|
+
/** The 378px sheet, with its portal and dimmed overlay. Clicks outside don't close it. */
|
|
19
|
+
export function AlertDialogContent({ className, ...props }) {
|
|
20
|
+
return (_jsxs(AlertDialogPrimitive.Portal, { children: [_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", forceRender: true,
|
|
21
|
+
// A press on the dim doesn't close it, and mustn't take focus out of it either: from the page's body, Tab
|
|
22
|
+
// would land on the last button, the destructive one.
|
|
23
|
+
onMouseDown: (event) => event.preventDefault(), className: "fixed inset-0 z-50 bg-dim data-open:animate-fade-in" }), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", className: cn("fixed top-1/2 left-1/2 z-50 w-94.5 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-panel-edge bg-surface p-4.5 text-ink shadow-pop outline-none data-open:animate-pop-in", className), ...props })] }));
|
|
24
|
+
}
|
|
25
|
+
export function AlertDialogHeader({ className, ...props }) {
|
|
26
|
+
return _jsx("div", { "data-slot": "alert-dialog-header", className: cn("flex flex-col", className), ...props });
|
|
27
|
+
}
|
|
28
|
+
/** Cancel first, then the action. */
|
|
29
|
+
export function AlertDialogFooter({ className, ...props }) {
|
|
30
|
+
return _jsx("div", { "data-slot": "alert-dialog-footer", className: cn("flex justify-end gap-space-8", className), ...props });
|
|
31
|
+
}
|
|
32
|
+
/** 15px semibold. Names the object: "Delete lead-scoring?" */
|
|
33
|
+
export function AlertDialogTitle({ className, ...props }) {
|
|
34
|
+
return (_jsx(AlertDialogPrimitive.Title, { "data-slot": "alert-dialog-title", className: cn("m-0 mb-space-6 font-sans text-md leading-auto", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
/** The consequence, in one or two sentences. */
|
|
37
|
+
export function AlertDialogDescription({ className, ...props }) {
|
|
38
|
+
return (_jsx(AlertDialogPrimitive.Description, { "data-slot": "alert-dialog-description", className: cn("m-0 mb-space-16 text-ui leading-normal text-muted", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The confirm button: solid danger, repeating verb and object ("Delete skill"). A Button: it doesn't close the
|
|
42
|
+
* dialog by itself, so the dialog stays up, `loading`, until the work it started is done; close it then.
|
|
43
|
+
*/
|
|
44
|
+
export function AlertDialogAction({ variant = BUTTON_VARIANTS.DESTRUCTIVE, ...props }) {
|
|
45
|
+
return _jsx(Button, { "data-slot": "alert-dialog-action", variant: variant, ...props });
|
|
46
|
+
}
|
|
47
|
+
/** Closes the dialog. Give it `autoFocus`: focus starts on Cancel. */
|
|
48
|
+
export function AlertDialogCancel({ variant = BUTTON_VARIANTS.OUTLINE, size, ...props }) {
|
|
49
|
+
return (_jsx(AlertDialogPrimitive.Close, { "data-slot": "alert-dialog-cancel", render: _jsx(Button, { variant: variant, size: size }), ...props }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=alert-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","sourceRoot":"","sources":["../../src/components/alert-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAoB,MAAM,aAAc,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAsC;IAChE,OAAO,KAAC,oBAAoB,CAAC,IAAI,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAC;AAC3E,CAAC;AAED,6HAA6H;AAC7H,MAAM,UAAU,kBAAkB,CAAC,KAAyC;IAC1E,OAAO,KAAC,oBAAoB,CAAC,OAAO,iBAAW,sBAAsB,KAAK,KAAK,GAAI,CAAC;AACtF,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoC;IAC1F,OAAO,CACL,MAAC,oBAAoB,CAAC,MAAM,eAC1B,KAAC,oBAAoB,CAAC,QAAQ,iBAClB,sBAAsB,EAChC,WAAW;gBACX,0GAA0G;gBAC1G,sDAAsD;gBACtD,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAC9C,SAAS,EAAC,qDAAqD,GAC/D,EACF,KAAC,oBAAoB,CAAC,KAAK,iBACf,sBAAsB,EAChC,SAAS,EAAE,EAAE,CACX,6MAA6M,EAC7M,SAAS,CACV,KACG,KAAK,GACT,IAC0B,CAC/B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IAC9E,OAAO,2BAAe,qBAAqB,EAAC,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AACvG,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IAC9E,OAAO,2BAAe,qBAAqB,EAAC,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AACtH,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoC;IACxF,OAAO,CACL,KAAC,oBAAoB,CAAC,KAAK,iBACf,oBAAoB,EAC9B,SAAS,EAAE,EAAE,CAAC,+CAA+C,EAAE,SAAS,CAAC,KACrE,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,sBAAsB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA0C;IACpG,OAAO,CACL,KAAC,oBAAoB,CAAC,WAAW,iBACrB,0BAA0B,EACpC,SAAS,EAAE,EAAE,CAAC,mDAAmD,EAAE,SAAS,CAAC,KACzE,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,WAAW,EAAE,GAAG,KAAK,EAAe;IAChG,OAAO,KAAC,MAAM,iBAAW,qBAAqB,EAAC,OAAO,EAAE,OAAO,KAAM,KAAK,GAAI,CAAC;AACjF,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,GAAG,eAAe,CAAC,OAAO,EACjC,IAAI,EACJ,GAAG,KAAK,EACiE;IACzE,OAAO,CACL,KAAC,oBAAoB,CAAC,KAAK,iBACf,qBAAqB,EAC/B,MAAM,EAAE,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAI,KAC5C,KAAK,GACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { AlertDialog as AlertDialogPrimitive } from \"@base-ui/react/alert-dialog\";\nimport { cn } from \"../lib/cn.ts\";\nimport { BUTTON_VARIANTS, Button, type ButtonProps } from \"./button.tsx\";\n\n/**\n * Root of the blocking question before anything that can't be undone. The title names the object,\n * the description the consequence, the action repeats the verb. Controlled with `open` / `onOpenChange`,\n * or uncontrolled with an `AlertDialogTrigger`.\n */\nexport function AlertDialog(props: AlertDialogPrimitive.Root.Props) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />;\n}\n\n/** Pass the danger button that asks as `render`: `<AlertDialogTrigger render={<Button … />}>Delete</AlertDialogTrigger>`. */\nexport function AlertDialogTrigger(props: AlertDialogPrimitive.Trigger.Props) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />;\n}\n\n/** The 378px sheet, with its portal and dimmed overlay. Clicks outside don't close it. */\nexport function AlertDialogContent({ className, ...props }: AlertDialogPrimitive.Popup.Props) {\n return (\n <AlertDialogPrimitive.Portal>\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n forceRender\n // A press on the dim doesn't close it, and mustn't take focus out of it either: from the page's body, Tab\n // would land on the last button, the destructive one.\n onMouseDown={(event) => event.preventDefault()}\n className=\"fixed inset-0 z-50 bg-dim data-open:animate-fade-in\"\n />\n <AlertDialogPrimitive.Popup\n data-slot=\"alert-dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 w-94.5 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-panel-edge bg-surface p-4.5 text-ink shadow-pop outline-none data-open:animate-pop-in\",\n className\n )}\n {...props}\n />\n </AlertDialogPrimitive.Portal>\n );\n}\n\nexport function AlertDialogHeader({ className, ...props }: ComponentProps<\"div\">) {\n return <div data-slot=\"alert-dialog-header\" className={cn(\"flex flex-col\", className)} {...props} />;\n}\n\n/** Cancel first, then the action. */\nexport function AlertDialogFooter({ className, ...props }: ComponentProps<\"div\">) {\n return <div data-slot=\"alert-dialog-footer\" className={cn(\"flex justify-end gap-space-8\", className)} {...props} />;\n}\n\n/** 15px semibold. Names the object: \"Delete lead-scoring?\" */\nexport function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\"m-0 mb-space-6 font-sans text-md leading-auto\", className)}\n {...props}\n />\n );\n}\n\n/** The consequence, in one or two sentences. */\nexport function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn(\"m-0 mb-space-16 text-ui leading-normal text-muted\", className)}\n {...props}\n />\n );\n}\n\n/**\n * The confirm button: solid danger, repeating verb and object (\"Delete skill\"). A Button: it doesn't close the\n * dialog by itself, so the dialog stays up, `loading`, until the work it started is done; close it then.\n */\nexport function AlertDialogAction({ variant = BUTTON_VARIANTS.DESTRUCTIVE, ...props }: ButtonProps) {\n return <Button data-slot=\"alert-dialog-action\" variant={variant} {...props} />;\n}\n\n/** Closes the dialog. Give it `autoFocus`: focus starts on Cancel. */\nexport function AlertDialogCancel({\n variant = BUTTON_VARIANTS.OUTLINE,\n size,\n ...props\n}: AlertDialogPrimitive.Close.Props & Pick<ButtonProps, \"variant\" | \"size\">) {\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n render={<Button variant={variant} size={size} />}\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const ALERT_VARIANTS: {
|
|
4
|
+
/** Something to know. */
|
|
5
|
+
readonly INFO: "info";
|
|
6
|
+
/** Something that worked and is still true. */
|
|
7
|
+
readonly SUCCESS: "success";
|
|
8
|
+
/** Something to look at before it breaks: an expired sign-in, a missing connection. */
|
|
9
|
+
readonly WARNING: "warning";
|
|
10
|
+
/** Something to fix. */
|
|
11
|
+
readonly DESTRUCTIVE: "destructive";
|
|
12
|
+
};
|
|
13
|
+
declare const alertVariants: (props?: ({
|
|
14
|
+
variant?: "success" | "destructive" | "info" | "warning" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
export type AlertProps = ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
|
|
17
|
+
/** Replaces the tone's icon; `false` drops it. */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* An inline message about what is true now, with the tone's 16px icon added for you. Children: `AlertContent`
|
|
22
|
+
* (holding `AlertTitle` and `AlertDescription`), then at most one `AlertAction`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Alert({ className, variant, icon, children, ...props }: AlertProps): import("react").JSX.Element;
|
|
25
|
+
/** The text column: an optional `AlertTitle`, then an `AlertDescription`. */
|
|
26
|
+
export declare function AlertContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
27
|
+
/** An optional bold first line. */
|
|
28
|
+
export declare function AlertTitle({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
29
|
+
/** One or two sentences: the problem and the way out. */
|
|
30
|
+
export declare function AlertDescription({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
31
|
+
/** An outline Button, or a ghost × when the alert is safe to ignore. */
|
|
32
|
+
export declare function AlertAction({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/components/alert.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,eAAO,MAAM,cAAc;IACzB,yBAAyB;;IAEzB,+CAA+C;;IAE/C,uFAAuF;;IAEvF,wBAAwB;;CAEhB,CAAC;AAIX,QAAA,MAAM,aAAa;;8EAalB,CAAC;AASF,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,GAC5C,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC,kDAAkD;IAClD,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEJ;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,+BAUjF;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAE1E;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAExE;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAE9E;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAIzE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { CircleAlert, CircleCheck, Info, TriangleAlert } from "lucide-react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export const ALERT_VARIANTS = {
|
|
7
|
+
/** Something to know. */
|
|
8
|
+
INFO: "info",
|
|
9
|
+
/** Something that worked and is still true. */
|
|
10
|
+
SUCCESS: "success",
|
|
11
|
+
/** Something to look at before it breaks: an expired sign-in, a missing connection. */
|
|
12
|
+
WARNING: "warning",
|
|
13
|
+
/** Something to fix. */
|
|
14
|
+
DESTRUCTIVE: "destructive",
|
|
15
|
+
};
|
|
16
|
+
const alertVariants = cva("relative flex w-full items-start gap-space-10 rounded-lg px-space-14 py-space-12 font-sans text-ui leading-[1.1875rem] [&>svg]:mt-px [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
[ALERT_VARIANTS.INFO]: "bg-secondary text-ink-2 [&_[data-slot=alert-title]]:text-ink",
|
|
20
|
+
[ALERT_VARIANTS.SUCCESS]: "bg-success-soft text-success",
|
|
21
|
+
[ALERT_VARIANTS.WARNING]: "bg-warn-soft text-warn",
|
|
22
|
+
[ALERT_VARIANTS.DESTRUCTIVE]: "bg-danger-soft text-danger",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { variant: ALERT_VARIANTS.INFO },
|
|
26
|
+
});
|
|
27
|
+
const ALERT_ICONS = {
|
|
28
|
+
[ALERT_VARIANTS.INFO]: Info,
|
|
29
|
+
[ALERT_VARIANTS.SUCCESS]: CircleCheck,
|
|
30
|
+
[ALERT_VARIANTS.WARNING]: TriangleAlert,
|
|
31
|
+
[ALERT_VARIANTS.DESTRUCTIVE]: CircleAlert,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* An inline message about what is true now, with the tone's 16px icon added for you. Children: `AlertContent`
|
|
35
|
+
* (holding `AlertTitle` and `AlertDescription`), then at most one `AlertAction`.
|
|
36
|
+
*/
|
|
37
|
+
export function Alert({ className, variant, icon, children, ...props }) {
|
|
38
|
+
const tone = variant ?? ALERT_VARIANTS.INFO;
|
|
39
|
+
const Icon = ALERT_ICONS[tone];
|
|
40
|
+
const isUrgent = tone === ALERT_VARIANTS.WARNING || tone === ALERT_VARIANTS.DESTRUCTIVE;
|
|
41
|
+
return (_jsxs("div", { "data-slot": "alert", role: isUrgent ? "alert" : "status", className: cn(alertVariants({ variant }), className), ...props, children: [icon ?? _jsx(Icon, { "aria-hidden": true }), children] }));
|
|
42
|
+
}
|
|
43
|
+
/** The text column: an optional `AlertTitle`, then an `AlertDescription`. */
|
|
44
|
+
export function AlertContent({ className, ...props }) {
|
|
45
|
+
return _jsx("div", { "data-slot": "alert-content", className: cn("min-w-0 flex-1", className), ...props });
|
|
46
|
+
}
|
|
47
|
+
/** An optional bold first line. */
|
|
48
|
+
export function AlertTitle({ className, ...props }) {
|
|
49
|
+
return _jsx("div", { "data-slot": "alert-title", className: cn("font-semibold", className), ...props });
|
|
50
|
+
}
|
|
51
|
+
/** One or two sentences: the problem and the way out. */
|
|
52
|
+
export function AlertDescription({ className, ...props }) {
|
|
53
|
+
return _jsx("div", { "data-slot": "alert-description", className: cn("[&_p]:m-0", className), ...props });
|
|
54
|
+
}
|
|
55
|
+
/** An outline Button, or a ghost × when the alert is safe to ignore. */
|
|
56
|
+
export function AlertAction({ className, ...props }) {
|
|
57
|
+
return (_jsx("div", { "data-slot": "alert-action", className: cn("-my-space-4 -mr-space-4 flex shrink-0 items-center", className), ...props }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=alert.js.map
|