@major-tech/ui 0.0.0-stage → 1.0.1
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 +107 -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 +159 -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 +284 -0
- package/dist/docs/components/empty-state.md +134 -0
- package/dist/docs/components/entity-card.md +640 -0
- package/dist/docs/components/entity-row.md +291 -0
- package/dist/docs/components/env-var-request.md +223 -0
- package/dist/docs/components/field.md +272 -0
- package/dist/docs/components/file-upload.md +255 -0
- package/dist/docs/components/hover-card.md +335 -0
- package/dist/docs/components/input-group.md +134 -0
- package/dist/docs/components/input.md +97 -0
- package/dist/docs/components/island.md +97 -0
- package/dist/docs/components/kbd.md +91 -0
- package/dist/docs/components/markdown.md +180 -0
- package/dist/docs/components/message.md +336 -0
- package/dist/docs/components/page-header.md +203 -0
- package/dist/docs/components/pagination.md +211 -0
- package/dist/docs/components/password-input.md +68 -0
- package/dist/docs/components/pepper.md +238 -0
- package/dist/docs/components/permission-request.md +265 -0
- package/dist/docs/components/popover.md +206 -0
- package/dist/docs/components/progress.md +142 -0
- package/dist/docs/components/progressive-blur.md +195 -0
- package/dist/docs/components/radio-group.md +129 -0
- package/dist/docs/components/request-card.md +305 -0
- package/dist/docs/components/resizable.md +318 -0
- package/dist/docs/components/responsive-overlay.md +449 -0
- package/dist/docs/components/scroll-shadows.md +161 -0
- package/dist/docs/components/search-field.md +86 -0
- package/dist/docs/components/searchable-select.md +144 -0
- package/dist/docs/components/select.md +331 -0
- package/dist/docs/components/separator.md +80 -0
- package/dist/docs/components/settings-section.md +246 -0
- package/dist/docs/components/sidebar-item.md +307 -0
- package/dist/docs/components/skeleton.md +107 -0
- package/dist/docs/components/slider.md +171 -0
- package/dist/docs/components/sonner.md +122 -0
- package/dist/docs/components/spinner.md +112 -0
- package/dist/docs/components/stat-strip.md +85 -0
- package/dist/docs/components/status-dot.md +190 -0
- package/dist/docs/components/subagent-run.md +196 -0
- package/dist/docs/components/switch.md +91 -0
- package/dist/docs/components/system-notice.md +144 -0
- package/dist/docs/components/table.md +201 -0
- package/dist/docs/components/tabs.md +233 -0
- package/dist/docs/components/textarea.md +89 -0
- package/dist/docs/components/thinking-indicator.md +164 -0
- package/dist/docs/components/thread-status.md +143 -0
- package/dist/docs/components/todo-list.md +225 -0
- package/dist/docs/components/toggle-group.md +117 -0
- package/dist/docs/components/toggle.md +132 -0
- package/dist/docs/components/tool-call.md +237 -0
- package/dist/docs/components/tool-result.md +418 -0
- package/dist/docs/components/tooltip.md +136 -0
- package/dist/docs/components/trace.md +319 -0
- package/dist/docs/components/turn-summary.md +218 -0
- package/dist/docs/components/usage-meter.md +69 -0
- package/dist/docs/components/view-switcher.md +193 -0
- package/dist/docs/foundations/colors.md +83 -0
- package/dist/docs/foundations/elevation.md +19 -0
- package/dist/docs/foundations/iconography.md +34 -0
- package/dist/docs/foundations/layout.md +42 -0
- package/dist/docs/foundations/logo.md +111 -0
- package/dist/docs/foundations/motion.md +91 -0
- package/dist/docs/foundations/radius.md +13 -0
- package/dist/docs/foundations/spacing.md +23 -0
- package/dist/docs/foundations/typography.md +42 -0
- package/dist/docs/getting-started/installation.md +116 -0
- package/dist/docs/getting-started/releases.md +59 -0
- package/dist/docs/getting-started/theming.md +58 -0
- package/dist/docs/guidelines/accessibility.md +28 -0
- package/dist/docs/guidelines/content.md +36 -0
- package/dist/docs/guidelines/forms.md +36 -0
- package/dist/docs/guidelines/principles.md +30 -0
- package/dist/docs/hooks/use-is-mobile.md +134 -0
- package/dist/docs/index.md +182 -0
- package/dist/docs/overview.md +35 -0
- package/dist/docs/patterns/chat.md +477 -0
- package/dist/docs/patterns/index.md +13 -0
- package/dist/docs/patterns/login.md +311 -0
- package/dist/docs/patterns/share.md +415 -0
- package/dist/hooks/use-is-mobile.d.ts +9 -0
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +26 -0
- package/dist/hooks/use-is-mobile.js.map +1 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +31 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/code-language.d.ts +8 -0
- package/dist/lib/code-language.d.ts.map +1 -0
- package/dist/lib/code-language.js +48 -0
- package/dist/lib/code-language.js.map +1 -0
- package/dist/lib/date-range.d.ts +122 -0
- package/dist/lib/date-range.d.ts.map +1 -0
- package/dist/lib/date-range.js +281 -0
- package/dist/lib/date-range.js.map +1 -0
- package/dist/lib/major-tokens.d.ts +40 -0
- package/dist/lib/major-tokens.d.ts.map +1 -0
- package/dist/lib/major-tokens.js +602 -0
- package/dist/lib/major-tokens.js.map +1 -0
- package/dist/lib/markdown.d.ts +25 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +87 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/overlay-portal-branch.d.ts +6 -0
- package/dist/lib/overlay-portal-branch.d.ts.map +1 -0
- package/dist/lib/overlay-portal-branch.js +15 -0
- package/dist/lib/overlay-portal-branch.js.map +1 -0
- package/dist/lib/pepper-matcap.d.ts +2 -0
- package/dist/lib/pepper-matcap.d.ts.map +1 -0
- package/dist/lib/pepper-matcap.js +4 -0
- package/dist/lib/pepper-matcap.js.map +1 -0
- package/dist/lib/scroll-fade.d.ts +28 -0
- package/dist/lib/scroll-fade.d.ts.map +1 -0
- package/dist/lib/scroll-fade.js +57 -0
- package/dist/lib/scroll-fade.js.map +1 -0
- package/dist/tailwind.css +7 -0
- package/dist/theme.css +428 -0
- package/package.json +145 -3
- package/tokens.json +841 -0
- package/README.md +0 -3
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: DropdownMenu
|
|
3
|
+
slug: dropdown-menu
|
|
4
|
+
description: The one menu sheet for overflow, sort, filter, mentions and pickers.
|
|
5
|
+
group: Overlays
|
|
6
|
+
layer: primitive
|
|
7
|
+
status: stable
|
|
8
|
+
since: 0.3.0
|
|
9
|
+
primitive: Menu
|
|
10
|
+
import: import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DROPDOWN_MENU_ITEM_VARIANTS, DROPDOWN_MENU_SHEET_CLASSES, DROPDOWN_MENU_LABEL_CLASSES, DROPDOWN_MENU_ITEM_CLASSES } from "@major-tech/ui/dropdown-menu";
|
|
11
|
+
source: packages/ui/src/components/dropdown-menu.tsx
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# DropdownMenu
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Overflow
|
|
19
|
+
|
|
20
|
+
A short action menu, 196px wide (`w-49`). Plain 16px icons, no tiles. Delete goes last, after a separator, with the destructive variant. Overflow triggers are vertical dots; toolbar menus align to the anchor's right edge.
|
|
21
|
+
|
|
22
|
+
Example: `overflow`
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
"use client";
|
|
26
|
+
|
|
27
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
28
|
+
import {
|
|
29
|
+
DROPDOWN_MENU_ITEM_VARIANTS,
|
|
30
|
+
DropdownMenu,
|
|
31
|
+
DropdownMenuContent,
|
|
32
|
+
DropdownMenuItem,
|
|
33
|
+
DropdownMenuSeparator,
|
|
34
|
+
DropdownMenuSub,
|
|
35
|
+
DropdownMenuSubContent,
|
|
36
|
+
DropdownMenuSubTrigger,
|
|
37
|
+
DropdownMenuTrigger,
|
|
38
|
+
} from "@major-tech/ui/dropdown-menu";
|
|
39
|
+
import { toast } from "@major-tech/ui/sonner";
|
|
40
|
+
import { Download, EllipsisVertical, Pencil, Pin, Share, Trash2 } from "lucide-react";
|
|
41
|
+
|
|
42
|
+
export default function DropdownMenuOverflow() {
|
|
43
|
+
return (
|
|
44
|
+
<DropdownMenu>
|
|
45
|
+
<DropdownMenuTrigger
|
|
46
|
+
render={<Button variant={BUTTON_VARIANTS.GHOST} size={BUTTON_SIZES.ICON} aria-label="lead-scoring options" />}
|
|
47
|
+
>
|
|
48
|
+
<EllipsisVertical />
|
|
49
|
+
</DropdownMenuTrigger>
|
|
50
|
+
<DropdownMenuContent align="end" className="w-49">
|
|
51
|
+
<DropdownMenuItem>
|
|
52
|
+
<Pencil />
|
|
53
|
+
Edit
|
|
54
|
+
</DropdownMenuItem>
|
|
55
|
+
<DropdownMenuItem onClick={() => toast("lead-scoring pinned to the top")}>
|
|
56
|
+
<Pin />
|
|
57
|
+
Pin to top
|
|
58
|
+
</DropdownMenuItem>
|
|
59
|
+
<DropdownMenuItem>
|
|
60
|
+
<Download />
|
|
61
|
+
Download
|
|
62
|
+
</DropdownMenuItem>
|
|
63
|
+
<DropdownMenuSub>
|
|
64
|
+
<DropdownMenuSubTrigger>
|
|
65
|
+
<Share />
|
|
66
|
+
Share
|
|
67
|
+
</DropdownMenuSubTrigger>
|
|
68
|
+
<DropdownMenuSubContent>
|
|
69
|
+
<DropdownMenuItem onClick={() => toast("Link copied")}>Copy link</DropdownMenuItem>
|
|
70
|
+
<DropdownMenuItem>Invite people…</DropdownMenuItem>
|
|
71
|
+
</DropdownMenuSubContent>
|
|
72
|
+
</DropdownMenuSub>
|
|
73
|
+
<DropdownMenuSeparator />
|
|
74
|
+
<DropdownMenuItem variant={DROPDOWN_MENU_ITEM_VARIANTS.DESTRUCTIVE}>
|
|
75
|
+
<Trash2 />
|
|
76
|
+
Delete
|
|
77
|
+
</DropdownMenuItem>
|
|
78
|
+
</DropdownMenuContent>
|
|
79
|
+
</DropdownMenu>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Sort and filter
|
|
85
|
+
|
|
86
|
+
A 12px muted section header, then the options, inside their DropdownMenuRadioGroup or DropdownMenuGroup. Checked options show a link check on the right: radio items for one choice, checkbox items for toggles. Both keep the menu open; `closeOnClick` closes it on a pick.
|
|
87
|
+
|
|
88
|
+
Example: `sort-filter`
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
"use client";
|
|
92
|
+
|
|
93
|
+
import { useState } from "react";
|
|
94
|
+
import { BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
95
|
+
import {
|
|
96
|
+
DropdownMenu,
|
|
97
|
+
DropdownMenuCheckboxItem,
|
|
98
|
+
DropdownMenuContent,
|
|
99
|
+
DropdownMenuGroup,
|
|
100
|
+
DropdownMenuLabel,
|
|
101
|
+
DropdownMenuRadioGroup,
|
|
102
|
+
DropdownMenuRadioItem,
|
|
103
|
+
DropdownMenuSeparator,
|
|
104
|
+
DropdownMenuTrigger,
|
|
105
|
+
} from "@major-tech/ui/dropdown-menu";
|
|
106
|
+
import { ArrowUpDown } from "lucide-react";
|
|
107
|
+
|
|
108
|
+
const SORT_OPTIONS = [
|
|
109
|
+
{ value: "recent", label: "Recently used" },
|
|
110
|
+
{ value: "edited", label: "Last edited" },
|
|
111
|
+
{ value: "name", label: "Name" },
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
export default function DropdownMenuSortFilter() {
|
|
115
|
+
const [sort, setSort] = useState(SORT_OPTIONS[0].value);
|
|
116
|
+
const [isOnlyMineEnabled, setIsOnlyMineEnabled] = useState(true);
|
|
117
|
+
const [isPinnedFirstEnabled, setIsPinnedFirstEnabled] = useState(false);
|
|
118
|
+
const sortLabel = SORT_OPTIONS.find((option) => option.value === sort)?.label;
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<DropdownMenu>
|
|
122
|
+
<DropdownMenuTrigger render={<Button variant={BUTTON_VARIANTS.OUTLINE} />}>
|
|
123
|
+
<ArrowUpDown />
|
|
124
|
+
{sortLabel}
|
|
125
|
+
</DropdownMenuTrigger>
|
|
126
|
+
<DropdownMenuContent align="start">
|
|
127
|
+
<DropdownMenuRadioGroup value={sort} onValueChange={setSort}>
|
|
128
|
+
<DropdownMenuLabel>Sort by</DropdownMenuLabel>
|
|
129
|
+
{SORT_OPTIONS.map((option) => (
|
|
130
|
+
// A sort is one pick, so it closes the menu.
|
|
131
|
+
<DropdownMenuRadioItem key={option.value} value={option.value} closeOnClick>
|
|
132
|
+
{option.label}
|
|
133
|
+
</DropdownMenuRadioItem>
|
|
134
|
+
))}
|
|
135
|
+
</DropdownMenuRadioGroup>
|
|
136
|
+
<DropdownMenuSeparator />
|
|
137
|
+
{/* Filters keep the menu open, so several can change in one go. */}
|
|
138
|
+
<DropdownMenuGroup>
|
|
139
|
+
<DropdownMenuLabel>Show</DropdownMenuLabel>
|
|
140
|
+
<DropdownMenuCheckboxItem checked={isOnlyMineEnabled} onCheckedChange={setIsOnlyMineEnabled}>
|
|
141
|
+
Only mine
|
|
142
|
+
</DropdownMenuCheckboxItem>
|
|
143
|
+
<DropdownMenuCheckboxItem checked={isPinnedFirstEnabled} onCheckedChange={setIsPinnedFirstEnabled}>
|
|
144
|
+
Pinned first
|
|
145
|
+
</DropdownMenuCheckboxItem>
|
|
146
|
+
</DropdownMenuGroup>
|
|
147
|
+
</DropdownMenuContent>
|
|
148
|
+
</DropdownMenu>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Descriptions and meta
|
|
154
|
+
|
|
155
|
+
A row grows a second muted line when the choice needs explaining; `meta` on the right shows a state. A shortcut goes in DropdownMenuShortcut.
|
|
156
|
+
|
|
157
|
+
Example: `descriptions`
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
"use client";
|
|
161
|
+
|
|
162
|
+
import { useState } from "react";
|
|
163
|
+
import { BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
164
|
+
import {
|
|
165
|
+
DropdownMenu,
|
|
166
|
+
DropdownMenuContent,
|
|
167
|
+
DropdownMenuItem,
|
|
168
|
+
DropdownMenuLabel,
|
|
169
|
+
DropdownMenuRadioGroup,
|
|
170
|
+
DropdownMenuRadioItem,
|
|
171
|
+
DropdownMenuSeparator,
|
|
172
|
+
DropdownMenuShortcut,
|
|
173
|
+
DropdownMenuTrigger,
|
|
174
|
+
} from "@major-tech/ui/dropdown-menu";
|
|
175
|
+
import { ChevronDown } from "lucide-react";
|
|
176
|
+
|
|
177
|
+
const PERMISSIONS = [
|
|
178
|
+
{ value: "always", label: "Always allow", description: "Runs without asking" },
|
|
179
|
+
{ value: "ask", label: "Ask first", description: "Waits for your approval each time" },
|
|
180
|
+
{ value: "never", label: "Never", description: "The agent can't use it" },
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
const DEFAULT_PERMISSION = PERMISSIONS[1].value;
|
|
184
|
+
|
|
185
|
+
export default function DropdownMenuDescriptions() {
|
|
186
|
+
const [permission, setPermission] = useState(DEFAULT_PERMISSION);
|
|
187
|
+
const permissionLabel = PERMISSIONS.find((option) => option.value === permission)?.label;
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<DropdownMenu>
|
|
191
|
+
<DropdownMenuTrigger render={<Button variant={BUTTON_VARIANTS.OUTLINE} />}>
|
|
192
|
+
{permissionLabel}
|
|
193
|
+
<ChevronDown />
|
|
194
|
+
</DropdownMenuTrigger>
|
|
195
|
+
<DropdownMenuContent align="start">
|
|
196
|
+
<DropdownMenuRadioGroup value={permission} onValueChange={setPermission}>
|
|
197
|
+
<DropdownMenuLabel>slack.send_direct_message</DropdownMenuLabel>
|
|
198
|
+
{PERMISSIONS.map((option) => (
|
|
199
|
+
<DropdownMenuRadioItem
|
|
200
|
+
key={option.value}
|
|
201
|
+
value={option.value}
|
|
202
|
+
closeOnClick
|
|
203
|
+
description={option.description}
|
|
204
|
+
meta={option.value === DEFAULT_PERMISSION && "Default"}
|
|
205
|
+
>
|
|
206
|
+
{option.label}
|
|
207
|
+
</DropdownMenuRadioItem>
|
|
208
|
+
))}
|
|
209
|
+
</DropdownMenuRadioGroup>
|
|
210
|
+
<DropdownMenuSeparator />
|
|
211
|
+
<DropdownMenuItem>
|
|
212
|
+
Search actions
|
|
213
|
+
<DropdownMenuShortcut>⌘K</DropdownMenuShortcut>
|
|
214
|
+
</DropdownMenuItem>
|
|
215
|
+
</DropdownMenuContent>
|
|
216
|
+
</DropdownMenu>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Links
|
|
222
|
+
|
|
223
|
+
Pass the link as `render`: it becomes the row and takes its styles; `description` and `meta` still apply.
|
|
224
|
+
|
|
225
|
+
Example: `links`
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
"use client";
|
|
229
|
+
|
|
230
|
+
import Link from "next/link";
|
|
231
|
+
import { BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
232
|
+
import {
|
|
233
|
+
DropdownMenu,
|
|
234
|
+
DropdownMenuContent,
|
|
235
|
+
DropdownMenuGroup,
|
|
236
|
+
DropdownMenuItem,
|
|
237
|
+
DropdownMenuLabel,
|
|
238
|
+
DropdownMenuTrigger,
|
|
239
|
+
} from "@major-tech/ui/dropdown-menu";
|
|
240
|
+
import { BookOpen, ChevronDown, Palette, Rocket } from "lucide-react";
|
|
241
|
+
|
|
242
|
+
export default function DropdownMenuLinks() {
|
|
243
|
+
return (
|
|
244
|
+
<DropdownMenu>
|
|
245
|
+
<DropdownMenuTrigger render={<Button variant={BUTTON_VARIANTS.OUTLINE} />}>
|
|
246
|
+
Docs
|
|
247
|
+
<ChevronDown />
|
|
248
|
+
</DropdownMenuTrigger>
|
|
249
|
+
<DropdownMenuContent align="start" className="w-49">
|
|
250
|
+
<DropdownMenuGroup>
|
|
251
|
+
<DropdownMenuLabel>Getting started</DropdownMenuLabel>
|
|
252
|
+
<DropdownMenuItem render={<Link href="/getting-started" />}>
|
|
253
|
+
<Rocket />
|
|
254
|
+
Installation
|
|
255
|
+
</DropdownMenuItem>
|
|
256
|
+
<DropdownMenuItem render={<Link href="/getting-started/theming" />}>
|
|
257
|
+
<Palette />
|
|
258
|
+
Theming
|
|
259
|
+
</DropdownMenuItem>
|
|
260
|
+
<DropdownMenuItem render={<Link href="/guidelines/principles" />}>
|
|
261
|
+
<BookOpen />
|
|
262
|
+
Principles
|
|
263
|
+
</DropdownMenuItem>
|
|
264
|
+
</DropdownMenuGroup>
|
|
265
|
+
</DropdownMenuContent>
|
|
266
|
+
</DropdownMenu>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Guidelines
|
|
272
|
+
|
|
273
|
+
- 280px wide by default, 196px for short action menus; surface, 12px radius, `shadow-pop`, 6px inset.
|
|
274
|
+
- Rows are 32px, `rounded-row` and touching: only the hovered or focused row fills. 13px text, icons 10px from the label.
|
|
275
|
+
- Opens 6px from its anchor, centred on it; `align` start or end lines it up with an edge.
|
|
276
|
+
|
|
277
|
+
Do:
|
|
278
|
+
|
|
279
|
+
- Sentence-case section headers (“Sort by”).
|
|
280
|
+
- Destructive items last, after a separator.
|
|
281
|
+
- A Select, not a menu, when the person picks a value for a form field.
|
|
282
|
+
|
|
283
|
+
Don't:
|
|
284
|
+
|
|
285
|
+
- Icon tiles or coloured icons for plain actions.
|
|
286
|
+
- Delete in the middle of the list.
|
|
287
|
+
- Nesting more than one level deep.
|
|
288
|
+
|
|
289
|
+
## API
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DROPDOWN_MENU_ITEM_VARIANTS, DROPDOWN_MENU_SHEET_CLASSES, DROPDOWN_MENU_LABEL_CLASSES, DROPDOWN_MENU_ITEM_CLASSES } from "@major-tech/ui/dropdown-menu";
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### `<DropdownMenuContent />`
|
|
296
|
+
|
|
297
|
+
Base UI Menu.Popup props pass through, with the positioner's `side`, `alignOffset`, `collisionPadding` and `collisionAvoidance`. Renders in a portal and scrolls when it runs out of room.
|
|
298
|
+
|
|
299
|
+
| Prop | Type | Default | Description |
|
|
300
|
+
| --- | --- | --- | --- |
|
|
301
|
+
| `align` | `"start" \| "center" \| "end"` | `"center"` | Which edge of the anchor it lines up with. |
|
|
302
|
+
| `sideOffset` | `number` | `6` | Gap to the anchor, in px. |
|
|
303
|
+
| `className` | `string` | — | `w-49` for a 196px action menu. |
|
|
304
|
+
|
|
305
|
+
### `<DropdownMenuItem />`
|
|
306
|
+
|
|
307
|
+
DropdownMenuCheckboxItem and DropdownMenuRadioItem take `description` and `meta` too. Leading icons go in children, before the label.
|
|
308
|
+
|
|
309
|
+
| Prop | Type | Default | Description |
|
|
310
|
+
| --- | --- | --- | --- |
|
|
311
|
+
| `variant` | `"default" \| "destructive"` | `"default"` | Danger text and icon. `DROPDOWN_MENU_ITEM_VARIANTS` holds the values. |
|
|
312
|
+
| `description` | `ReactNode` | — | A second line in 12px muted. |
|
|
313
|
+
| `meta` | `ReactNode` | — | Right-aligned muted text (“Asks first”). |
|
|
314
|
+
| `render` | `ReactElement` | — | The element the row is drawn as: `render={<Link href=… />}` for a link row. |
|
|
315
|
+
| `onClick` | `(event) => void` | — | Runs on pick. |
|
|
316
|
+
| `closeOnClick` | `boolean` | `true` | `false` keeps the menu open. Radio and checkbox items default to `false`. |
|
|
317
|
+
|
|
318
|
+
### Parts
|
|
319
|
+
|
|
320
|
+
| Prop | Type | Default | Description |
|
|
321
|
+
| --- | --- | --- | --- |
|
|
322
|
+
| `DropdownMenu` | `Root` | — | `open` / `onOpenChange` / `modal`; `onOpenChangeComplete` runs once it has opened or closed. `loopFocus` wraps the arrow keys past the first and last rows (off here). |
|
|
323
|
+
| `DropdownMenuTrigger` | `—` | — | Pass a Button as `render`; overflow menus use a ghost icon Button. Carries `aria-expanded` while the menu is open: style the open state off it, since a Tooltip around the trigger sets `data-popup-open` too. |
|
|
324
|
+
| `DropdownMenuLabel · DropdownMenuSeparator · DropdownMenuGroup` | `—` | — | Section header, divider, grouping. The header goes inside the group it heads. |
|
|
325
|
+
| `DropdownMenuRadioGroup · DropdownMenuRadioItem` | `—` | — | One choice (sort by). |
|
|
326
|
+
| `DropdownMenuCheckboxItem` | `—` | — | Toggles (filters). |
|
|
327
|
+
| `DropdownMenuShortcut` | `span` | — | A key hint at the end of a row. |
|
|
328
|
+
| `DropdownMenuSub · DropdownMenuSubTrigger · DropdownMenuSubContent` | `—` | — | One level of nesting; the submenu is 196px. `closeParentOnEsc={false}` on DropdownMenuSub makes Esc close only the submenu. |
|
|
329
|
+
| `DROPDOWN_MENU_SHEET_CLASSES · _LABEL_CLASSES · _ITEM_CLASSES` | `string` | — | The sheet, header and row styles, for a menu driven from outside Base UI (an editor's @ list). |
|
|
330
|
+
|
|
331
|
+
### Accessibility
|
|
332
|
+
|
|
333
|
+
- The WAI-ARIA menu pattern from Base UI: arrow keys move and stop at the first and last rows, typeahead jumps, Enter and Space pick, Esc closes the whole menu, even from a submenu. Disabled rows can't be picked, but the arrow keys still reach them.
|
|
334
|
+
- Focus returns to the trigger on close.
|
|
335
|
+
- Checked items expose their state as `menuitemradio` or `menuitemcheckbox`.
|
|
336
|
+
- An icon-only trigger needs an `aria-label`.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: EditorTabs
|
|
3
|
+
slug: editor-tabs
|
|
4
|
+
description: "The tab strip above the editor: the agent or skill tab plus the apps opened from it, or a chat's sessions with New chat after them, dragged into any order, scrolling when they don't fit."
|
|
5
|
+
group: Navigation
|
|
6
|
+
layer: composed
|
|
7
|
+
status: stable
|
|
8
|
+
since: 0.3.0
|
|
9
|
+
primitive: Tabs
|
|
10
|
+
import: import { EditorTabs } from "@major-tech/ui/editor-tabs";
|
|
11
|
+
source: packages/ui/src/components/editor-tabs.tsx
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# EditorTabs
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Agent and apps
|
|
19
|
+
|
|
20
|
+
The agent (or skill) tab first, then the apps opened from it. App tabs close with ×; a warn dot marks unsaved changes. Close both apps: the strip hides and the agent's panel stays.
|
|
21
|
+
|
|
22
|
+
Example: `agent`
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
"use client";
|
|
26
|
+
|
|
27
|
+
import { useState } from "react";
|
|
28
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
29
|
+
import { EditorTabs, type EditorTab } from "@major-tech/ui/editor-tabs";
|
|
30
|
+
import { TabsContent } from "@major-tech/ui/tabs";
|
|
31
|
+
import { AppWindow, Bot } from "lucide-react";
|
|
32
|
+
|
|
33
|
+
const AGENT_TAB: EditorTab = { value: "agent", label: "Daily Joke", icon: <Bot />, unsaved: true };
|
|
34
|
+
|
|
35
|
+
const APP_TABS: EditorTab[] = [
|
|
36
|
+
{ value: "joke-archive", label: "Joke archive", icon: <AppWindow />, closable: true },
|
|
37
|
+
{ value: "lead-tracker", label: "Lead tracker", icon: <AppWindow />, closable: true },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export default function EditorTabsAgent() {
|
|
41
|
+
const [apps, setApps] = useState(APP_TABS);
|
|
42
|
+
const [openTab, setOpenTab] = useState(AGENT_TAB.value);
|
|
43
|
+
|
|
44
|
+
const handleClose = (value: string) => {
|
|
45
|
+
setApps(apps.filter((app) => app.value !== value));
|
|
46
|
+
|
|
47
|
+
if (openTab === value) {
|
|
48
|
+
setOpenTab(AGENT_TAB.value);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<EditorTabs
|
|
54
|
+
tabs={[AGENT_TAB, ...apps]}
|
|
55
|
+
value={openTab}
|
|
56
|
+
onValueChange={setOpenTab}
|
|
57
|
+
onClose={handleClose}
|
|
58
|
+
className="w-full gap-space-12"
|
|
59
|
+
>
|
|
60
|
+
<TabsContent value={AGENT_TAB.value} className="flex items-center gap-space-12 text-ui text-muted">
|
|
61
|
+
The agent’s instructions. The dot means unsaved changes.
|
|
62
|
+
{apps.length === 0 && (
|
|
63
|
+
<Button variant={BUTTON_VARIANTS.OUTLINE} size={BUTTON_SIZES.SM} onClick={() => setApps(APP_TABS)}>
|
|
64
|
+
Open the apps again
|
|
65
|
+
</Button>
|
|
66
|
+
)}
|
|
67
|
+
</TabsContent>
|
|
68
|
+
{apps.map((app) => (
|
|
69
|
+
<TabsContent key={app.value} value={app.value} className="text-ui text-muted">
|
|
70
|
+
{app.label} preview.
|
|
71
|
+
</TabsContent>
|
|
72
|
+
))}
|
|
73
|
+
</EditorTabs>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Many tabs
|
|
79
|
+
|
|
80
|
+
With onReorder, drag a tab to move it, or press Alt+Shift+← / → on a focused one; the others make room. When the tabs don't fit, the strip scrolls: the side with more fades out, and two arrows appear at its end, each off when there's nothing more that way. The open tab is always scrolled into view.
|
|
81
|
+
|
|
82
|
+
Example: `many-tabs`
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
"use client";
|
|
86
|
+
|
|
87
|
+
import { useState } from "react";
|
|
88
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
89
|
+
import { EditorTabs, type EditorTab } from "@major-tech/ui/editor-tabs";
|
|
90
|
+
import { TabsContent } from "@major-tech/ui/tabs";
|
|
91
|
+
import { AppWindow, Bot } from "lucide-react";
|
|
92
|
+
|
|
93
|
+
const TABS: EditorTab[] = [
|
|
94
|
+
{ value: "agent", label: "Daily Joke", icon: <Bot /> },
|
|
95
|
+
{ value: "joke-archive", label: "Joke archive", icon: <AppWindow />, closable: true },
|
|
96
|
+
{ value: "lead-tracker", label: "Lead tracker", icon: <AppWindow />, closable: true },
|
|
97
|
+
{ value: "invoice-chaser", label: "Invoice chaser", icon: <AppWindow />, closable: true },
|
|
98
|
+
{ value: "standup-digest", label: "Standup digest", icon: <AppWindow />, closable: true },
|
|
99
|
+
{ value: "release-notes", label: "Release notes", icon: <AppWindow />, closable: true },
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
export default function EditorTabsManyTabs() {
|
|
103
|
+
const [tabs, setTabs] = useState(TABS);
|
|
104
|
+
const [openTab, setOpenTab] = useState(TABS[0].value);
|
|
105
|
+
|
|
106
|
+
const handleReorder = (order: string[]) => {
|
|
107
|
+
setTabs(order.flatMap((value) => tabs.filter((tab) => tab.value === value)));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// The tab before the closed one opens in its place.
|
|
111
|
+
const handleClose = (value: string) => {
|
|
112
|
+
const index = tabs.findIndex((tab) => tab.value === value);
|
|
113
|
+
const rest = tabs.filter((tab) => tab.value !== value);
|
|
114
|
+
|
|
115
|
+
setTabs(rest);
|
|
116
|
+
|
|
117
|
+
if (openTab === value) {
|
|
118
|
+
setOpenTab(rest[Math.max(0, index - 1)].value);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<EditorTabs
|
|
124
|
+
tabs={tabs}
|
|
125
|
+
value={openTab}
|
|
126
|
+
onValueChange={setOpenTab}
|
|
127
|
+
onClose={handleClose}
|
|
128
|
+
onReorder={handleReorder}
|
|
129
|
+
className="w-full max-w-120 gap-space-12"
|
|
130
|
+
>
|
|
131
|
+
{tabs.map((tab) => (
|
|
132
|
+
<TabsContent key={tab.value} value={tab.value} className="flex items-center gap-space-12 text-ui text-muted">
|
|
133
|
+
{tab.label}
|
|
134
|
+
{tabs.length === 1 && (
|
|
135
|
+
<Button variant={BUTTON_VARIANTS.OUTLINE} size={BUTTON_SIZES.SM} onClick={() => setTabs(TABS)}>
|
|
136
|
+
Open the apps again
|
|
137
|
+
</Button>
|
|
138
|
+
)}
|
|
139
|
+
</TabsContent>
|
|
140
|
+
))}
|
|
141
|
+
</EditorTabs>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Chat sessions
|
|
147
|
+
|
|
148
|
+
The chat's sessions in the same strip, with New chat after the tabs as `trailing`. A session only looked into, not running yet, is a preview: its name in italics until it starts. With `isSingleTabVisible` the strip stays while one tab is open, so New chat alone still has its tab.
|
|
149
|
+
|
|
150
|
+
Example: `sessions`
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
"use client";
|
|
154
|
+
|
|
155
|
+
import { useState } from "react";
|
|
156
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
157
|
+
import { EditorTabs, type EditorTab } from "@major-tech/ui/editor-tabs";
|
|
158
|
+
import { Plus } from "lucide-react";
|
|
159
|
+
|
|
160
|
+
const NEW_CHAT_VALUE = "new";
|
|
161
|
+
|
|
162
|
+
const SESSION_TABS: EditorTab[] = [
|
|
163
|
+
{ value: "s1", label: "Shorter jokes", closable: true },
|
|
164
|
+
{ value: "s2", label: "Weekend version", closable: true, preview: true },
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
export default function EditorTabsSessions() {
|
|
168
|
+
const [tabs, setTabs] = useState(SESSION_TABS);
|
|
169
|
+
const [openTab, setOpenTab] = useState(SESSION_TABS[0].value);
|
|
170
|
+
const isNewChatOpen = tabs.some((tab) => tab.value === NEW_CHAT_VALUE);
|
|
171
|
+
|
|
172
|
+
const handleNewChat = () => {
|
|
173
|
+
setTabs([...tabs, { value: NEW_CHAT_VALUE, label: "New chat", closable: true }]);
|
|
174
|
+
setOpenTab(NEW_CHAT_VALUE);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const handleClose = (value: string) => {
|
|
178
|
+
const rest = tabs.filter((tab) => tab.value !== value);
|
|
179
|
+
|
|
180
|
+
setTabs(rest.length > 0 ? rest : [{ value: NEW_CHAT_VALUE, label: "New chat" }]);
|
|
181
|
+
|
|
182
|
+
if (openTab === value) {
|
|
183
|
+
setOpenTab(rest.at(-1)?.value ?? NEW_CHAT_VALUE);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const handleReorder = (values: string[]) =>
|
|
188
|
+
setTabs(values.flatMap((value) => tabs.filter((tab) => tab.value === value)));
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<EditorTabs
|
|
192
|
+
tabs={tabs}
|
|
193
|
+
value={openTab}
|
|
194
|
+
onValueChange={setOpenTab}
|
|
195
|
+
onClose={handleClose}
|
|
196
|
+
onReorder={handleReorder}
|
|
197
|
+
isSingleTabVisible
|
|
198
|
+
trailing={
|
|
199
|
+
!isNewChatOpen && (
|
|
200
|
+
<Button
|
|
201
|
+
variant={BUTTON_VARIANTS.GHOST}
|
|
202
|
+
size={BUTTON_SIZES.ICON}
|
|
203
|
+
aria-label="New chat"
|
|
204
|
+
onClick={handleNewChat}
|
|
205
|
+
>
|
|
206
|
+
<Plus />
|
|
207
|
+
</Button>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
className="w-full"
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
- `trailing` sits right after the last tab (after the arrows once the tabs overflow), and keeps the strip with one tab. Only one New chat exists, so its + goes away while it's open.
|
|
217
|
+
- A label can be a node that looks the name up; give such a tab a `closeLabel`, or its × is “Close tab”.
|
|
218
|
+
|
|
219
|
+
### Guidelines
|
|
220
|
+
|
|
221
|
+
- Built on Tabs. 28px tabs, 6px radius, 12.5px text, 14px icons, 4px apart.
|
|
222
|
+
- Tabs that don't fit scroll, with no scrollbar: a 24px fade on each side with more to scroll to, then the arrows, 24px ghost buttons.
|
|
223
|
+
- The selected tab is surface with a panel-edge border; the others are muted, with no fill.
|
|
224
|
+
- The panels are TabsContent from `@major-tech/ui/tabs`, passed as children.
|
|
225
|
+
|
|
226
|
+
Do:
|
|
227
|
+
|
|
228
|
+
- Let the strip hide while only one tab is open: EditorTabs does it, unless the strip has a `trailing` control or `isSingleTabVisible`.
|
|
229
|
+
- Mark unsaved changes with the dot, not with text in the tab.
|
|
230
|
+
- Give app tabs a ×; the agent's own tab never closes.
|
|
231
|
+
- Pass onReorder and keep `tabs` in its order: people arrange their tabs.
|
|
232
|
+
|
|
233
|
+
Don't:
|
|
234
|
+
|
|
235
|
+
- Switching an editor's views: that's the ViewSwitcher.
|
|
236
|
+
- A green selected tab: selection is the white surface.
|
|
237
|
+
- Long labels: they truncate at 180px.
|
|
238
|
+
|
|
239
|
+
## API
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { EditorTabs } from "@major-tech/ui/editor-tabs";
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### `<EditorTabs />`
|
|
246
|
+
|
|
247
|
+
| Prop | Type | Default | Description |
|
|
248
|
+
| --- | --- | --- | --- |
|
|
249
|
+
| `tabs`* | `EditorTab[]` | — | The agent's tab, then the apps. |
|
|
250
|
+
| `value · onValueChange` | `string · (value) => void` | — | Controlled. |
|
|
251
|
+
| `defaultValue` | `string` | the first tab | The tab open on first render. |
|
|
252
|
+
| `onClose` | `(value: string) => void` | — | Called with the tab whose × was pressed: pick the next tab and drop this one. |
|
|
253
|
+
| `onReorder` | `(values: string[]) => void` | — | Called with every tab's value in the new order while a tab is dragged, or moved with Alt+Shift+← / →. Put `tabs` in that order. Without it the tabs stay where they are. |
|
|
254
|
+
| `trailing` | `ReactNode` | — | After the tabs and their arrows: the control that opens a new tab (New chat). Keeps the strip with one tab. |
|
|
255
|
+
| `isSingleTabVisible` | `boolean` | `false` | Keeps the strip while only one tab is open. |
|
|
256
|
+
| `aria-label` | `string` | — | The tab list's name, where the page has more than one strip: “Chat sessions”. |
|
|
257
|
+
| `children` | `ReactNode` | — | The panels, as TabsContent. They stay visible when the strip hides. |
|
|
258
|
+
| `className` | `string` | — | On the Tabs root. |
|
|
259
|
+
|
|
260
|
+
`*` marks a required prop.
|
|
261
|
+
|
|
262
|
+
### `EditorTab`
|
|
263
|
+
|
|
264
|
+
| Prop | Type | Default | Description |
|
|
265
|
+
| --- | --- | --- | --- |
|
|
266
|
+
| `value`* | `string` | — | Its id. |
|
|
267
|
+
| `label`* | `ReactNode` | — | Its name: text, or a node that looks it up. Truncates at 180px. |
|
|
268
|
+
| `icon` | `ReactNode` | — | A 14px icon before the label. |
|
|
269
|
+
| `closable` | `boolean` | `false` | Shows the × (apps, sessions). |
|
|
270
|
+
| `closeLabel` | `string` | “Close {label}”, or “Close tab” | The ×'s name. |
|
|
271
|
+
| `unsaved` | `boolean` | `false` | Shows the warn dot. |
|
|
272
|
+
| `preview` | `boolean` | `false` | A tab only looked into, not started yet: its label in italics. |
|
|
273
|
+
|
|
274
|
+
`*` marks a required prop.
|
|
275
|
+
|
|
276
|
+
### Accessibility
|
|
277
|
+
|
|
278
|
+
- The WAI-ARIA tabs pattern from Base UI: arrow keys move between tabs, Enter or Space selects.
|
|
279
|
+
- The × sits next to its tab, not inside it: its own focus stop, named “Close {label}” or its `closeLabel`.
|
|
280
|
+
- The unsaved dot is announced as “Unsaved changes”.
|
|
281
|
+
- With `onReorder`, Alt+Shift+← / → moves the focused tab and keeps focus on it; each tab names the keys in `aria-keyshortcuts`.
|
|
282
|
+
- The arrows are named “Scroll tabs left” and “Scroll tabs right”. Keyboard focus scrolls the strip by itself.
|
|
283
|
+
- The focus ring is drawn inside the tab: the strip scrolls, and it would cut off a ring outside.
|
|
284
|
+
- Tabs opening, closing and making room animate only without `prefers-reduced-motion`.
|