@major-tech/ui 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -0
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/components/accordion.d.ts +33 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +51 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/activity-chart.d.ts +26 -0
- package/dist/components/activity-chart.d.ts.map +1 -0
- package/dist/components/activity-chart.js +56 -0
- package/dist/components/activity-chart.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +28 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +51 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +34 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +59 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/ask-user-question.d.ts +103 -0
- package/dist/components/ask-user-question.d.ts.map +1 -0
- package/dist/components/ask-user-question.js +401 -0
- package/dist/components/ask-user-question.js.map +1 -0
- package/dist/components/attachment-gallery.d.ts +137 -0
- package/dist/components/attachment-gallery.d.ts.map +1 -0
- package/dist/components/attachment-gallery.js +317 -0
- package/dist/components/attachment-gallery.js.map +1 -0
- package/dist/components/avatar.d.ts +37 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +62 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +29 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +50 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/brand-tile.d.ts +33 -0
- package/dist/components/brand-tile.d.ts.map +1 -0
- package/dist/components/brand-tile.js +36 -0
- package/dist/components/brand-tile.js.map +1 -0
- package/dist/components/button.d.ts +51 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +90 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +18 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +78 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +18 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +34 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +48 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +227 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/catalog-card.d.ts +29 -0
- package/dist/components/catalog-card.d.ts.map +1 -0
- package/dist/components/catalog-card.js +20 -0
- package/dist/components/catalog-card.js.map +1 -0
- package/dist/components/chart.d.ts +118 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +209 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +14 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +68 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +100 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/code-block.d.ts +99 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +144 -0
- package/dist/components/code-block.js.map +1 -0
- package/dist/components/collapsible.d.ts +17 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +25 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +51 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +120 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/composer.d.ts +211 -0
- package/dist/components/composer.d.ts.map +1 -0
- package/dist/components/composer.js +605 -0
- package/dist/components/composer.js.map +1 -0
- package/dist/components/connector-request.d.ts +63 -0
- package/dist/components/connector-request.d.ts.map +1 -0
- package/dist/components/connector-request.js +57 -0
- package/dist/components/connector-request.js.map +1 -0
- package/dist/components/context-menu.d.ts +26 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +33 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +61 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +79 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-range-picker.d.ts +54 -0
- package/dist/components/date-range-picker.d.ts.map +1 -0
- package/dist/components/date-range-picker.js +451 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +46 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +75 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +85 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +166 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +77 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +112 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/editor-tabs.d.ts +49 -0
- package/dist/components/editor-tabs.d.ts.map +1 -0
- package/dist/components/editor-tabs.js +157 -0
- package/dist/components/editor-tabs.js.map +1 -0
- package/dist/components/empty-state.d.ts +21 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +14 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/entity-card.d.ts +301 -0
- package/dist/components/entity-card.d.ts.map +1 -0
- package/dist/components/entity-card.js +392 -0
- package/dist/components/entity-card.js.map +1 -0
- package/dist/components/entity-row.d.ts +37 -0
- package/dist/components/entity-row.d.ts.map +1 -0
- package/dist/components/entity-row.js +65 -0
- package/dist/components/entity-row.js.map +1 -0
- package/dist/components/env-var-request.d.ts +51 -0
- package/dist/components/env-var-request.d.ts.map +1 -0
- package/dist/components/env-var-request.js +50 -0
- package/dist/components/env-var-request.js.map +1 -0
- package/dist/components/field.d.ts +30 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +48 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/file-upload.d.ts +108 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +217 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/components/hover-card.d.ts +18 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +84 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +29 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +9 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +13 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/island.d.ts +18 -0
- package/dist/components/island.d.ts.map +1 -0
- package/dist/components/island.js +30 -0
- package/dist/components/island.js.map +1 -0
- package/dist/components/kbd.d.ts +7 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +12 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/markdown.d.ts +24 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +38 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/message.d.ts +38 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +25 -0
- package/dist/components/message.js.map +1 -0
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +94 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +22 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +36 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/password-input.d.ts +5 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/components/password-input.js +12 -0
- package/dist/components/password-input.js.map +1 -0
- package/dist/components/pepper.d.ts +92 -0
- package/dist/components/pepper.d.ts.map +1 -0
- package/dist/components/pepper.js +1279 -0
- package/dist/components/pepper.js.map +1 -0
- package/dist/components/permission-request.d.ts +53 -0
- package/dist/components/permission-request.d.ts.map +1 -0
- package/dist/components/permission-request.js +54 -0
- package/dist/components/permission-request.js.map +1 -0
- package/dist/components/popover.d.ts +42 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +76 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +9 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +12 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +31 -0
- package/dist/components/progressive-blur.d.ts.map +1 -0
- package/dist/components/progressive-blur.js +44 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +15 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/request-card.d.ts +34 -0
- package/dist/components/request-card.d.ts.map +1 -0
- package/dist/components/request-card.js +50 -0
- package/dist/components/request-card.js.map +1 -0
- package/dist/components/resizable.d.ts +24 -0
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +40 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-overlay.d.ts +136 -0
- package/dist/components/responsive-overlay.d.ts.map +1 -0
- package/dist/components/responsive-overlay.js +302 -0
- package/dist/components/responsive-overlay.js.map +1 -0
- package/dist/components/scroll-shadows.d.ts +11 -0
- package/dist/components/scroll-shadows.d.ts.map +1 -0
- package/dist/components/scroll-shadows.js +53 -0
- package/dist/components/scroll-shadows.js.map +1 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.d.ts.map +1 -0
- package/dist/components/search-field.js +50 -0
- package/dist/components/search-field.js.map +1 -0
- package/dist/components/searchable-select.d.ts +43 -0
- package/dist/components/searchable-select.d.ts.map +1 -0
- package/dist/components/searchable-select.js +39 -0
- package/dist/components/searchable-select.js.map +1 -0
- package/dist/components/select.d.ts +60 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +94 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +12 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/settings-section.d.ts +41 -0
- package/dist/components/settings-section.d.ts.map +1 -0
- package/dist/components/settings-section.js +50 -0
- package/dist/components/settings-section.js.map +1 -0
- package/dist/components/sidebar-item.d.ts +41 -0
- package/dist/components/sidebar-item.d.ts.map +1 -0
- package/dist/components/sidebar-item.js +59 -0
- package/dist/components/sidebar-item.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +10 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +36 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +8 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +21 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +12 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-strip.d.ts +20 -0
- package/dist/components/stat-strip.d.ts.map +1 -0
- package/dist/components/stat-strip.js +11 -0
- package/dist/components/stat-strip.js.map +1 -0
- package/dist/components/status-dot.d.ts +25 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +31 -0
- package/dist/components/status-dot.js.map +1 -0
- package/dist/components/subagent-run.d.ts +27 -0
- package/dist/components/subagent-run.d.ts.map +1 -0
- package/dist/components/subagent-run.js +38 -0
- package/dist/components/subagent-run.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +13 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/system-notice.d.ts +34 -0
- package/dist/components/system-notice.d.ts.map +1 -0
- package/dist/components/system-notice.js +52 -0
- package/dist/components/system-notice.js.map +1 -0
- package/dist/components/table.d.ts +27 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +37 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +40 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +52 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +9 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/thinking-indicator.d.ts +21 -0
- package/dist/components/thinking-indicator.d.ts.map +1 -0
- package/dist/components/thinking-indicator.js +136 -0
- package/dist/components/thinking-indicator.js.map +1 -0
- package/dist/components/thread-status.d.ts +25 -0
- package/dist/components/thread-status.d.ts.map +1 -0
- package/dist/components/thread-status.js +41 -0
- package/dist/components/thread-status.js.map +1 -0
- package/dist/components/todo-list.d.ts +52 -0
- package/dist/components/todo-list.d.ts.map +1 -0
- package/dist/components/todo-list.js +137 -0
- package/dist/components/todo-list.js.map +1 -0
- package/dist/components/toggle-group.d.ts +17 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +26 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +44 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tool-call.d.ts +60 -0
- package/dist/components/tool-call.d.ts.map +1 -0
- package/dist/components/tool-call.js +94 -0
- package/dist/components/tool-call.js.map +1 -0
- package/dist/components/tool-result.d.ts +127 -0
- package/dist/components/tool-result.d.ts.map +1 -0
- package/dist/components/tool-result.js +155 -0
- package/dist/components/tool-result.js.map +1 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +38 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trace.d.ts +38 -0
- package/dist/components/trace.d.ts.map +1 -0
- package/dist/components/trace.js +52 -0
- package/dist/components/trace.js.map +1 -0
- package/dist/components/turn-summary.d.ts +17 -0
- package/dist/components/turn-summary.d.ts.map +1 -0
- package/dist/components/turn-summary.js +19 -0
- package/dist/components/turn-summary.js.map +1 -0
- package/dist/components/usage-meter.d.ts +16 -0
- package/dist/components/usage-meter.d.ts.map +1 -0
- package/dist/components/usage-meter.js +10 -0
- package/dist/components/usage-meter.js.map +1 -0
- package/dist/components/view-switcher.d.ts +25 -0
- package/dist/components/view-switcher.d.ts.map +1 -0
- package/dist/components/view-switcher.js +196 -0
- package/dist/components/view-switcher.js.map +1 -0
- package/dist/docs/components/accordion.md +151 -0
- package/dist/docs/components/activity-chart.md +104 -0
- package/dist/docs/components/alert-dialog.md +216 -0
- package/dist/docs/components/alert.md +203 -0
- package/dist/docs/components/ask-user-question.md +429 -0
- package/dist/docs/components/attachment-gallery.md +377 -0
- package/dist/docs/components/avatar.md +197 -0
- package/dist/docs/components/badge.md +162 -0
- package/dist/docs/components/brand-tile.md +138 -0
- package/dist/docs/components/button.md +392 -0
- package/dist/docs/components/calendar.md +113 -0
- package/dist/docs/components/card.md +157 -0
- package/dist/docs/components/carousel.md +144 -0
- package/dist/docs/components/catalog-card.md +136 -0
- package/dist/docs/components/chart.md +608 -0
- package/dist/docs/components/checkbox.md +164 -0
- package/dist/docs/components/chip.md +411 -0
- package/dist/docs/components/code-block.md +389 -0
- package/dist/docs/components/collapsible.md +93 -0
- package/dist/docs/components/command.md +276 -0
- package/dist/docs/components/composer.md +1092 -0
- package/dist/docs/components/connector-request.md +497 -0
- package/dist/docs/components/context-menu.md +127 -0
- package/dist/docs/components/data-table.md +462 -0
- package/dist/docs/components/date-range-picker.md +425 -0
- package/dist/docs/components/dialog.md +263 -0
- package/dist/docs/components/drawer.md +505 -0
- package/dist/docs/components/dropdown-menu.md +336 -0
- package/dist/docs/components/editor-tabs.md +283 -0
- package/dist/docs/components/empty-state.md +134 -0
- package/dist/docs/components/entity-card.md +640 -0
- package/dist/docs/components/entity-row.md +291 -0
- package/dist/docs/components/env-var-request.md +223 -0
- package/dist/docs/components/field.md +272 -0
- package/dist/docs/components/file-upload.md +255 -0
- package/dist/docs/components/hover-card.md +335 -0
- package/dist/docs/components/input-group.md +134 -0
- package/dist/docs/components/input.md +97 -0
- package/dist/docs/components/island.md +97 -0
- package/dist/docs/components/kbd.md +91 -0
- package/dist/docs/components/markdown.md +180 -0
- package/dist/docs/components/message.md +336 -0
- package/dist/docs/components/page-header.md +203 -0
- package/dist/docs/components/pagination.md +211 -0
- package/dist/docs/components/password-input.md +68 -0
- package/dist/docs/components/pepper.md +238 -0
- package/dist/docs/components/permission-request.md +265 -0
- package/dist/docs/components/popover.md +206 -0
- package/dist/docs/components/progress.md +142 -0
- package/dist/docs/components/progressive-blur.md +195 -0
- package/dist/docs/components/radio-group.md +129 -0
- package/dist/docs/components/request-card.md +305 -0
- package/dist/docs/components/resizable.md +318 -0
- package/dist/docs/components/responsive-overlay.md +449 -0
- package/dist/docs/components/scroll-shadows.md +161 -0
- package/dist/docs/components/search-field.md +86 -0
- package/dist/docs/components/searchable-select.md +144 -0
- package/dist/docs/components/select.md +331 -0
- package/dist/docs/components/separator.md +80 -0
- package/dist/docs/components/settings-section.md +246 -0
- package/dist/docs/components/sidebar-item.md +307 -0
- package/dist/docs/components/skeleton.md +107 -0
- package/dist/docs/components/slider.md +171 -0
- package/dist/docs/components/sonner.md +122 -0
- package/dist/docs/components/spinner.md +112 -0
- package/dist/docs/components/stat-strip.md +85 -0
- package/dist/docs/components/status-dot.md +190 -0
- package/dist/docs/components/subagent-run.md +196 -0
- package/dist/docs/components/switch.md +91 -0
- package/dist/docs/components/system-notice.md +144 -0
- package/dist/docs/components/table.md +201 -0
- package/dist/docs/components/tabs.md +233 -0
- package/dist/docs/components/textarea.md +89 -0
- package/dist/docs/components/thinking-indicator.md +164 -0
- package/dist/docs/components/thread-status.md +143 -0
- package/dist/docs/components/todo-list.md +225 -0
- package/dist/docs/components/toggle-group.md +117 -0
- package/dist/docs/components/toggle.md +132 -0
- package/dist/docs/components/tool-call.md +237 -0
- package/dist/docs/components/tool-result.md +418 -0
- package/dist/docs/components/tooltip.md +136 -0
- package/dist/docs/components/trace.md +319 -0
- package/dist/docs/components/turn-summary.md +218 -0
- package/dist/docs/components/usage-meter.md +69 -0
- package/dist/docs/components/view-switcher.md +193 -0
- package/dist/docs/foundations/colors.md +83 -0
- package/dist/docs/foundations/elevation.md +19 -0
- package/dist/docs/foundations/iconography.md +34 -0
- package/dist/docs/foundations/layout.md +42 -0
- package/dist/docs/foundations/logo.md +111 -0
- package/dist/docs/foundations/motion.md +91 -0
- package/dist/docs/foundations/radius.md +13 -0
- package/dist/docs/foundations/spacing.md +23 -0
- package/dist/docs/foundations/typography.md +42 -0
- package/dist/docs/getting-started/installation.md +116 -0
- package/dist/docs/getting-started/releases.md +59 -0
- package/dist/docs/getting-started/theming.md +58 -0
- package/dist/docs/guidelines/accessibility.md +28 -0
- package/dist/docs/guidelines/content.md +36 -0
- package/dist/docs/guidelines/forms.md +36 -0
- package/dist/docs/guidelines/principles.md +30 -0
- package/dist/docs/hooks/use-is-mobile.md +134 -0
- package/dist/docs/index.md +182 -0
- package/dist/docs/overview.md +35 -0
- package/dist/docs/patterns/chat.md +477 -0
- package/dist/docs/patterns/index.md +13 -0
- package/dist/docs/patterns/login.md +311 -0
- package/dist/docs/patterns/share.md +415 -0
- package/dist/hooks/use-is-mobile.d.ts +9 -0
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +26 -0
- package/dist/hooks/use-is-mobile.js.map +1 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +31 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/code-language.d.ts +8 -0
- package/dist/lib/code-language.d.ts.map +1 -0
- package/dist/lib/code-language.js +48 -0
- package/dist/lib/code-language.js.map +1 -0
- package/dist/lib/date-range.d.ts +122 -0
- package/dist/lib/date-range.d.ts.map +1 -0
- package/dist/lib/date-range.js +281 -0
- package/dist/lib/date-range.js.map +1 -0
- package/dist/lib/major-tokens.d.ts +40 -0
- package/dist/lib/major-tokens.d.ts.map +1 -0
- package/dist/lib/major-tokens.js +602 -0
- package/dist/lib/major-tokens.js.map +1 -0
- package/dist/lib/markdown.d.ts +25 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +87 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/overlay-portal-branch.d.ts +6 -0
- package/dist/lib/overlay-portal-branch.d.ts.map +1 -0
- package/dist/lib/overlay-portal-branch.js +15 -0
- package/dist/lib/overlay-portal-branch.js.map +1 -0
- package/dist/lib/pepper-matcap.d.ts +2 -0
- package/dist/lib/pepper-matcap.d.ts.map +1 -0
- package/dist/lib/pepper-matcap.js +4 -0
- package/dist/lib/pepper-matcap.js.map +1 -0
- package/dist/lib/scroll-fade.d.ts +28 -0
- package/dist/lib/scroll-fade.d.ts.map +1 -0
- package/dist/lib/scroll-fade.js +57 -0
- package/dist/lib/scroll-fade.js.map +1 -0
- package/dist/tailwind.css +7 -0
- package/dist/theme.css +428 -0
- package/package.json +145 -3
- package/tokens.json +841 -0
- package/README.md +0 -3
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: RequestCard
|
|
3
|
+
slug: request-card
|
|
4
|
+
description: "The frame every request Major stops on sits in: what kind of request, what it asks for and why, and the actions under a rule."
|
|
5
|
+
group: AI
|
|
6
|
+
layer: primitive
|
|
7
|
+
status: beta
|
|
8
|
+
since: 0.4.0
|
|
9
|
+
import: import { RequestCard, RequestCardKicker, RequestCardHeader, RequestCardTitle, RequestCardDescription, RequestCardBody, RequestCardFooter, REQUEST_CARD_SIZES } from "@major-tech/ui/request-card";
|
|
10
|
+
source: packages/ui/src/components/request-card.tsx
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# RequestCard
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Anatomy
|
|
18
|
+
|
|
19
|
+
A surface card with rounded-xl and shadow-card, 320px wide: the kicker naming the kind of request, the header saying what Major asks for and why, anything the request shows in its body, and the actions under a line rule. A request of the product's own is built from the same parts.
|
|
20
|
+
|
|
21
|
+
Example: `anatomy`
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
27
|
+
import {
|
|
28
|
+
RequestCard,
|
|
29
|
+
RequestCardBody,
|
|
30
|
+
RequestCardDescription,
|
|
31
|
+
RequestCardFooter,
|
|
32
|
+
RequestCardHeader,
|
|
33
|
+
RequestCardKicker,
|
|
34
|
+
RequestCardTitle,
|
|
35
|
+
} from "@major-tech/ui/request-card";
|
|
36
|
+
import { Rocket } from "lucide-react";
|
|
37
|
+
|
|
38
|
+
const CHANGES = [
|
|
39
|
+
"Jokes skip people who are out of office",
|
|
40
|
+
"A Friday-only pun channel",
|
|
41
|
+
"Fixed the duplicate Monday post",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export default function RequestCardAnatomy() {
|
|
45
|
+
return (
|
|
46
|
+
<RequestCard aria-label="Publish request">
|
|
47
|
+
<RequestCardKicker>
|
|
48
|
+
<Rocket />
|
|
49
|
+
Publish
|
|
50
|
+
</RequestCardKicker>
|
|
51
|
+
<RequestCardHeader>
|
|
52
|
+
<RequestCardTitle>Publish Daily Joke v8?</RequestCardTitle>
|
|
53
|
+
<RequestCardDescription>Everyone who runs the agent gets it; v7 stays in its history.</RequestCardDescription>
|
|
54
|
+
</RequestCardHeader>
|
|
55
|
+
<RequestCardBody>
|
|
56
|
+
<ul className="m-0 flex list-disc flex-col gap-space-4 pl-space-16 text-ui text-ink-2">
|
|
57
|
+
{CHANGES.map((change) => (
|
|
58
|
+
<li key={change}>{change}</li>
|
|
59
|
+
))}
|
|
60
|
+
</ul>
|
|
61
|
+
</RequestCardBody>
|
|
62
|
+
<RequestCardFooter>
|
|
63
|
+
<Button variant={BUTTON_VARIANTS.GHOST} size={BUTTON_SIZES.SM} className="me-auto">
|
|
64
|
+
Not now
|
|
65
|
+
</Button>
|
|
66
|
+
<Button variant={BUTTON_VARIANTS.OUTLINE} size={BUTTON_SIZES.SM}>
|
|
67
|
+
Review changes
|
|
68
|
+
</Button>
|
|
69
|
+
<Button size={BUTTON_SIZES.SM}>Publish</Button>
|
|
70
|
+
</RequestCardFooter>
|
|
71
|
+
</RequestCard>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- **RequestCardKicker**: 12px muted after a 14px faint icon, 12px from the top.
|
|
77
|
+
- **RequestCardHeader**: the `RequestCardTitle` (14px semibold ink) and the `RequestCardDescription` (13px muted) under it, 6px under the kicker.
|
|
78
|
+
- **RequestCardBody**: code, fields or a connector, 12px under the header at the card’s 14px inset.
|
|
79
|
+
- **RequestCardFooter**: the actions, Small buttons, at the right under a line rule.
|
|
80
|
+
- `size="wide"` (480px) gives room for code the request shows, or answers with mockups.
|
|
81
|
+
|
|
82
|
+
### One family
|
|
83
|
+
|
|
84
|
+
Every request Major stops on in its reply sits in this frame, so a question, a permission, a connector and a sign-in read as one family in the chat.
|
|
85
|
+
|
|
86
|
+
Example: `family`
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
"use client";
|
|
90
|
+
|
|
91
|
+
import { useState } from "react";
|
|
92
|
+
import { BRAND_TILE_SIZES, BrandTile } from "@major-tech/ui/brand-tile";
|
|
93
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
94
|
+
import { MESSAGE_AUTHORS, Message } from "@major-tech/ui/message";
|
|
95
|
+
import {
|
|
96
|
+
ConnectorRequest,
|
|
97
|
+
ConnectorRequestConnected,
|
|
98
|
+
ConnectorRequestConnector,
|
|
99
|
+
} from "@major-tech/ui/connector-request";
|
|
100
|
+
import { PERMISSION_DECISIONS, PermissionDecision, PermissionRequest } from "@major-tech/ui/permission-request";
|
|
101
|
+
import {
|
|
102
|
+
RequestCardDescription,
|
|
103
|
+
RequestCardFooter,
|
|
104
|
+
RequestCardHeader,
|
|
105
|
+
RequestCardTitle,
|
|
106
|
+
} from "@major-tech/ui/request-card";
|
|
107
|
+
|
|
108
|
+
type Decision = (typeof PERMISSION_DECISIONS)[keyof typeof PERMISSION_DECISIONS];
|
|
109
|
+
|
|
110
|
+
const QUERY = "SELECT id, name, plan FROM customers WHERE churned_at IS NULL;";
|
|
111
|
+
|
|
112
|
+
// A letter tile stands in for the product's connector logo.
|
|
113
|
+
const SLACK_LOGO = <BrandTile letter="S" color="#4A154B" size={BRAND_TILE_SIZES.XS} className="size-full" />;
|
|
114
|
+
|
|
115
|
+
export default function RequestCardFamily() {
|
|
116
|
+
const [decision, setDecision] = useState<Decision | null>(null);
|
|
117
|
+
const [isConnected, setIsConnected] = useState(false);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div className="flex w-full max-w-120 flex-col gap-space-16">
|
|
121
|
+
<Message from={MESSAGE_AUTHORS.AGENT}>
|
|
122
|
+
I’ll read your active customers first, then post the dashboard to Slack.
|
|
123
|
+
</Message>
|
|
124
|
+
{decision ? (
|
|
125
|
+
<PermissionDecision decision={decision} />
|
|
126
|
+
) : (
|
|
127
|
+
<PermissionRequest
|
|
128
|
+
toolName="PostgreSQL query"
|
|
129
|
+
reason="Read the active customers"
|
|
130
|
+
code={QUERY}
|
|
131
|
+
language="sql"
|
|
132
|
+
onApprove={() => setDecision(PERMISSION_DECISIONS.APPROVED)}
|
|
133
|
+
onDeny={() => setDecision(PERMISSION_DECISIONS.DENIED)}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
<ConnectorRequest>
|
|
137
|
+
<RequestCardHeader>
|
|
138
|
+
<RequestCardTitle>Create a new connection</RequestCardTitle>
|
|
139
|
+
<RequestCardDescription>
|
|
140
|
+
It’ll be saved to your account and reusable across your agents.
|
|
141
|
+
</RequestCardDescription>
|
|
142
|
+
</RequestCardHeader>
|
|
143
|
+
<ConnectorRequestConnector logo={SLACK_LOGO} name="Slack" description="Post messages to your channels" />
|
|
144
|
+
<RequestCardFooter>
|
|
145
|
+
{isConnected ? (
|
|
146
|
+
<ConnectorRequestConnected />
|
|
147
|
+
) : (
|
|
148
|
+
<>
|
|
149
|
+
<Button variant={BUTTON_VARIANTS.GHOST} size={BUTTON_SIZES.SM} className="me-auto">
|
|
150
|
+
Cancel
|
|
151
|
+
</Button>
|
|
152
|
+
<Button size={BUTTON_SIZES.SM} onClick={() => setIsConnected(true)}>
|
|
153
|
+
Connect
|
|
154
|
+
</Button>
|
|
155
|
+
</>
|
|
156
|
+
)}
|
|
157
|
+
</RequestCardFooter>
|
|
158
|
+
</ConnectorRequest>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- [AskUserQuestion](ask-user-question.md): Major’s questions before it builds. It draws the same frame itself, not from these parts.
|
|
165
|
+
- [PermissionRequest](permission-request.md): a tool that needs a yes before it runs.
|
|
166
|
+
- [EnvVarRequest](env-var-request.md): an app’s environment variables.
|
|
167
|
+
- [ConnectorRequest](connector-request.md): a connector to set up, sign in to, finish or reconnect.
|
|
168
|
+
- Use those where they fit; build from the parts only for a request none of them covers.
|
|
169
|
+
|
|
170
|
+
### Kinds
|
|
171
|
+
|
|
172
|
+
The kicker says what kind of request it is, with the same icon every time.
|
|
173
|
+
|
|
174
|
+
Example: `kinds`
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import {
|
|
178
|
+
RequestCard,
|
|
179
|
+
RequestCardDescription,
|
|
180
|
+
RequestCardHeader,
|
|
181
|
+
RequestCardKicker,
|
|
182
|
+
RequestCardTitle,
|
|
183
|
+
} from "@major-tech/ui/request-card";
|
|
184
|
+
import { KeyRound, MessageCircleQuestion, Plug, ShieldQuestionMark } from "lucide-react";
|
|
185
|
+
|
|
186
|
+
const KINDS = [
|
|
187
|
+
{
|
|
188
|
+
kicker: "Your answers",
|
|
189
|
+
icon: <MessageCircleQuestion />,
|
|
190
|
+
title: "Who will look at it?",
|
|
191
|
+
description: "The team",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
kicker: "Permission request",
|
|
195
|
+
icon: <ShieldQuestionMark />,
|
|
196
|
+
title: "Run migration",
|
|
197
|
+
description: "Reason: Add users table",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
kicker: "Environment variables",
|
|
201
|
+
icon: <KeyRound />,
|
|
202
|
+
title: "The agent needs you to add environment variables.",
|
|
203
|
+
description: "STRIPE_SECRET_KEY",
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
kicker: "Connector",
|
|
207
|
+
icon: <Plug />,
|
|
208
|
+
title: "Create a new connection",
|
|
209
|
+
description: "It'll be saved to your account and reusable across your agents.",
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
export default function RequestCardKinds() {
|
|
214
|
+
return (
|
|
215
|
+
<div className="grid w-full grid-cols-1 gap-space-16 sm:grid-cols-2">
|
|
216
|
+
{KINDS.map((kind) => (
|
|
217
|
+
<RequestCard key={kind.kicker} aria-label={kind.kicker} className="w-full pb-space-12">
|
|
218
|
+
<RequestCardKicker>
|
|
219
|
+
{kind.icon}
|
|
220
|
+
{kind.kicker}
|
|
221
|
+
</RequestCardKicker>
|
|
222
|
+
<RequestCardHeader>
|
|
223
|
+
<RequestCardTitle>{kind.title}</RequestCardTitle>
|
|
224
|
+
<RequestCardDescription>{kind.description}</RequestCardDescription>
|
|
225
|
+
</RequestCardHeader>
|
|
226
|
+
</RequestCard>
|
|
227
|
+
))}
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- **MessageCircleQuestion**: the answers a question folds into (Your answers). AskUserQuestion has no kicker while it asks: its question is the title.
|
|
234
|
+
- **ShieldQuestionMark**: Permission request.
|
|
235
|
+
- **KeyRound**: Environment variables.
|
|
236
|
+
- **Plug**: Connector, for setting one up and for signing in.
|
|
237
|
+
|
|
238
|
+
### Actions
|
|
239
|
+
|
|
240
|
+
The footer's order is the same on every request, so the main action is always in one place.
|
|
241
|
+
|
|
242
|
+
- The main action is last, at the right: the one primary Button (Approve, Save, Connect), or an outline one when the request has no green action (Configure connector, Reconnect resource).
|
|
243
|
+
- Before it, the alternative: Deny in outline, Advanced in ghost.
|
|
244
|
+
- A quiet action that stands apart (Skip, Cancel, Done, Always approve) is a ghost Button at the left: give it `className="me-auto"`.
|
|
245
|
+
- Once answered, a request folds into its outcome (a decision line, a summary, Connected), never disappears.
|
|
246
|
+
|
|
247
|
+
### Guidelines
|
|
248
|
+
|
|
249
|
+
Do:
|
|
250
|
+
|
|
251
|
+
- Title it with what Major asks for, in a few words: “Sign in to continue”.
|
|
252
|
+
- Say in the description what happens next, or why Major needs it.
|
|
253
|
+
- Keep one primary action per request.
|
|
254
|
+
|
|
255
|
+
Don't:
|
|
256
|
+
|
|
257
|
+
- Nest a request in another card or a bubble: it sits in Major's reply.
|
|
258
|
+
- Leave the kicker out of a request people act on: it says what kind it is. AskUserQuestion and ConnectorGroup, whose titles say it, are the exceptions.
|
|
259
|
+
- Put more than three actions in the footer.
|
|
260
|
+
|
|
261
|
+
## API
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import { RequestCard, RequestCardKicker, RequestCardHeader, RequestCardTitle, RequestCardDescription, RequestCardBody, RequestCardFooter, REQUEST_CARD_SIZES } from "@major-tech/ui/request-card";
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### `<RequestCard />`
|
|
268
|
+
|
|
269
|
+
Renders a `<div>` with `role=group`; also accepts its attributes. Name it with `aria-label` (“Permission request”).
|
|
270
|
+
|
|
271
|
+
| Prop | Type | Default | Description |
|
|
272
|
+
| --- | --- | --- | --- |
|
|
273
|
+
| `size` | `"default" \| "wide"` | `"default"` | 320px, or 480px for code or answers with mockups. Never wider than its container. |
|
|
274
|
+
|
|
275
|
+
### `<RequestCardKicker /> · <RequestCardTitle /> · <RequestCardDescription />`
|
|
276
|
+
|
|
277
|
+
Each renders a `<p>`.
|
|
278
|
+
|
|
279
|
+
| Prop | Type | Default | Description |
|
|
280
|
+
| --- | --- | --- | --- |
|
|
281
|
+
| `RequestCardKicker` | `ReactNode` | — | A lucide icon (sized 14px and faint for you) and the kind of request. |
|
|
282
|
+
| `RequestCardTitle` | `ReactNode` | — | What Major asks for. |
|
|
283
|
+
| `RequestCardDescription` | `ReactNode` | — | Why, or what happens next. |
|
|
284
|
+
|
|
285
|
+
### `<RequestCardHeader /> · <RequestCardBody /> · <RequestCardFooter />`
|
|
286
|
+
|
|
287
|
+
Each renders a `<div>`.
|
|
288
|
+
|
|
289
|
+
| Prop | Type | Default | Description |
|
|
290
|
+
| --- | --- | --- | --- |
|
|
291
|
+
| `RequestCardHeader` | `ReactNode` | — | The title and description; 12px from the top when there's no kicker. |
|
|
292
|
+
| `RequestCardBody` | `ReactNode` | — | What the request shows, at the 14px inset. |
|
|
293
|
+
| `RequestCardFooter` | `ReactNode` | — | The actions, at the right; main one last. |
|
|
294
|
+
|
|
295
|
+
### `REQUEST_CARD_SIZES`
|
|
296
|
+
|
|
297
|
+
| Prop | Type | Default | Description |
|
|
298
|
+
| --- | --- | --- | --- |
|
|
299
|
+
| `DEFAULT · WIDE` | `RequestCardSize` | — | The widths. |
|
|
300
|
+
|
|
301
|
+
### Accessibility
|
|
302
|
+
|
|
303
|
+
- The card is a group: give it an `aria-label` that names the request.
|
|
304
|
+
- The kicker's icon is decorative: lucide icons are `aria-hidden` by default.
|
|
305
|
+
- Buttons say what they do (Approve, Save), never just OK.
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Resizable
|
|
3
|
+
slug: resizable
|
|
4
|
+
description: "Panels side by side or stacked, split by a handle people drag: the chat beside its workspace, a file list beside the open file."
|
|
5
|
+
group: Layout
|
|
6
|
+
layer: primitive
|
|
7
|
+
status: beta
|
|
8
|
+
since: 0.4.0
|
|
9
|
+
import: import { ResizablePanelGroup, ResizablePanel, ResizableHandle, RESIZABLE_HANDLE_VARIANTS, usePanelRef, useDefaultLayout } from "@major-tech/ui/resizable";
|
|
10
|
+
source: packages/ui/src/components/resizable.tsx
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Resizable
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Two islands
|
|
18
|
+
|
|
19
|
+
The editor puts its chat and its workspace side by side as two islands with a draggable 4px gap between them: the gap variant. The chat is 360px and can be dragged down to 280px; the workspace takes the rest, down to 250px.
|
|
20
|
+
|
|
21
|
+
Example: `islands`
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { Island } from "@major-tech/ui/island";
|
|
27
|
+
import {
|
|
28
|
+
RESIZABLE_HANDLE_VARIANTS,
|
|
29
|
+
ResizableHandle,
|
|
30
|
+
ResizablePanel,
|
|
31
|
+
ResizablePanelGroup,
|
|
32
|
+
} from "@major-tech/ui/resizable";
|
|
33
|
+
|
|
34
|
+
/** The editor's chat: 360px, resizable from 280px. */
|
|
35
|
+
const CHAT_WIDTH_PX = 360;
|
|
36
|
+
const CHAT_MIN_WIDTH_PX = 280;
|
|
37
|
+
const WORKSPACE_MIN_WIDTH_PX = 250;
|
|
38
|
+
|
|
39
|
+
export default function ResizableIslands() {
|
|
40
|
+
return (
|
|
41
|
+
<div className="h-80 w-full overflow-hidden rounded-lg bg-app-bg">
|
|
42
|
+
<ResizablePanelGroup>
|
|
43
|
+
{/* The 4px gutter sits inside each panel: a panel clips, so outside it the island's shadow would be cut. */}
|
|
44
|
+
<ResizablePanel
|
|
45
|
+
defaultSize={CHAT_WIDTH_PX}
|
|
46
|
+
minSize={CHAT_MIN_WIDTH_PX}
|
|
47
|
+
groupResizeBehavior="preserve-pixel-size"
|
|
48
|
+
className="flex py-space-4 pl-space-4"
|
|
49
|
+
>
|
|
50
|
+
<Island variant="panel" className="flex-1 p-space-12 text-ui text-muted">
|
|
51
|
+
Chat
|
|
52
|
+
</Island>
|
|
53
|
+
</ResizablePanel>
|
|
54
|
+
<ResizableHandle variant={RESIZABLE_HANDLE_VARIANTS.GAP} aria-label="Resize chat" />
|
|
55
|
+
<ResizablePanel minSize={WORKSPACE_MIN_WIDTH_PX} className="flex py-space-4 pr-space-4">
|
|
56
|
+
<Island variant="panel" className="flex-1 p-space-12 text-ui text-muted">
|
|
57
|
+
Workspace
|
|
58
|
+
</Island>
|
|
59
|
+
</ResizablePanel>
|
|
60
|
+
</ResizablePanelGroup>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Drag the gap, or focus it with Tab and step it with the arrow keys. A double-click puts the chat back to 360px.
|
|
67
|
+
- The accent shows a beat after the pointer arrives (so passing over doesn't flash), at once while dragging or focused, and, between islands, fades out over its ends.
|
|
68
|
+
- The 4px gutter sits inside each panel (`py-space-4` with `pl-space-4` or `pr-space-4`): a panel clips what it holds, so outside it the island's shadow would be cut.
|
|
69
|
+
- The chat keeps its 360px when the window resizes (`groupResizeBehavior="preserve-pixel-size"`); the workspace takes the difference.
|
|
70
|
+
|
|
71
|
+
### Panes on one surface
|
|
72
|
+
|
|
73
|
+
Inside one island, panes are split by the default line variant: a 1px line rule. This settings column starts at 280px and stays between 240 and 360px.
|
|
74
|
+
|
|
75
|
+
Example: `line`
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { Island } from "@major-tech/ui/island";
|
|
79
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@major-tech/ui/resizable";
|
|
80
|
+
|
|
81
|
+
const SETTINGS_WIDTH_PX = 280;
|
|
82
|
+
const SETTINGS_MIN_WIDTH_PX = 240;
|
|
83
|
+
const SETTINGS_MAX_WIDTH_PX = 360;
|
|
84
|
+
|
|
85
|
+
export default function ResizableLine() {
|
|
86
|
+
return (
|
|
87
|
+
<div className="h-80 w-full rounded-lg bg-app-bg p-space-4">
|
|
88
|
+
<Island variant="panel" className="h-full overflow-hidden">
|
|
89
|
+
<ResizablePanelGroup>
|
|
90
|
+
<ResizablePanel
|
|
91
|
+
defaultSize={SETTINGS_WIDTH_PX}
|
|
92
|
+
minSize={SETTINGS_MIN_WIDTH_PX}
|
|
93
|
+
maxSize={SETTINGS_MAX_WIDTH_PX}
|
|
94
|
+
className="p-space-12 text-ui text-muted"
|
|
95
|
+
>
|
|
96
|
+
Settings
|
|
97
|
+
</ResizablePanel>
|
|
98
|
+
<ResizableHandle aria-label="Resize settings" />
|
|
99
|
+
<ResizablePanel className="p-space-12 text-ui text-muted">Preview</ResizablePanel>
|
|
100
|
+
</ResizablePanelGroup>
|
|
101
|
+
</Island>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Stacked
|
|
108
|
+
|
|
109
|
+
`orientation="vertical"` stacks the panels: a preview above its logs.
|
|
110
|
+
|
|
111
|
+
Example: `vertical`
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { Island } from "@major-tech/ui/island";
|
|
115
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@major-tech/ui/resizable";
|
|
116
|
+
|
|
117
|
+
const LOGS_HEIGHT_PX = 112;
|
|
118
|
+
const LOGS_MIN_HEIGHT_PX = 64;
|
|
119
|
+
const PREVIEW_MIN_HEIGHT_PX = 120;
|
|
120
|
+
|
|
121
|
+
export default function ResizableVertical() {
|
|
122
|
+
return (
|
|
123
|
+
<div className="h-80 w-full rounded-lg bg-app-bg p-space-4">
|
|
124
|
+
<Island variant="panel" className="h-full overflow-hidden">
|
|
125
|
+
<ResizablePanelGroup orientation="vertical">
|
|
126
|
+
<ResizablePanel minSize={PREVIEW_MIN_HEIGHT_PX} className="p-space-12 text-ui text-muted">
|
|
127
|
+
Preview
|
|
128
|
+
</ResizablePanel>
|
|
129
|
+
<ResizableHandle aria-label="Resize logs" />
|
|
130
|
+
<ResizablePanel
|
|
131
|
+
defaultSize={LOGS_HEIGHT_PX}
|
|
132
|
+
minSize={LOGS_MIN_HEIGHT_PX}
|
|
133
|
+
className="p-space-12 font-mono text-small text-muted"
|
|
134
|
+
>
|
|
135
|
+
Logs
|
|
136
|
+
</ResizablePanel>
|
|
137
|
+
</ResizablePanelGroup>
|
|
138
|
+
</Island>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Folding a panel away
|
|
145
|
+
|
|
146
|
+
A collapsible panel folds to nothing when it's dragged past its minimum, or when Enter is pressed on its focused handle. Its panel ref folds and unfolds it from code: `usePanelRef()`, then `collapse()`, `expand()` or `resize(px)`.
|
|
147
|
+
|
|
148
|
+
Example: `collapsible`
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
"use client";
|
|
152
|
+
|
|
153
|
+
import { useState } from "react";
|
|
154
|
+
import { PanelLeft } from "lucide-react";
|
|
155
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
156
|
+
import { Island } from "@major-tech/ui/island";
|
|
157
|
+
import {
|
|
158
|
+
RESIZABLE_HANDLE_VARIANTS,
|
|
159
|
+
ResizableHandle,
|
|
160
|
+
ResizablePanel,
|
|
161
|
+
ResizablePanelGroup,
|
|
162
|
+
usePanelRef,
|
|
163
|
+
} from "@major-tech/ui/resizable";
|
|
164
|
+
|
|
165
|
+
const FILES_WIDTH_PX = 200;
|
|
166
|
+
const FILES_MIN_WIDTH_PX = 160;
|
|
167
|
+
const FILE_MIN_WIDTH_PX = 240;
|
|
168
|
+
|
|
169
|
+
export default function ResizableCollapsible() {
|
|
170
|
+
const filesPanelRef = usePanelRef();
|
|
171
|
+
const [isFileListVisible, setIsFileListVisible] = useState(true);
|
|
172
|
+
|
|
173
|
+
const handleToggleFiles = () => {
|
|
174
|
+
if (isFileListVisible) {
|
|
175
|
+
filesPanelRef.current?.collapse();
|
|
176
|
+
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
filesPanelRef.current?.expand();
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<div className="h-80 w-full overflow-hidden rounded-lg bg-app-bg">
|
|
185
|
+
<ResizablePanelGroup>
|
|
186
|
+
<ResizablePanel
|
|
187
|
+
panelRef={filesPanelRef}
|
|
188
|
+
defaultSize={FILES_WIDTH_PX}
|
|
189
|
+
minSize={FILES_MIN_WIDTH_PX}
|
|
190
|
+
collapsible
|
|
191
|
+
groupResizeBehavior="preserve-pixel-size"
|
|
192
|
+
onResize={({ inPixels }) => setIsFileListVisible(inPixels > 0)}
|
|
193
|
+
className="flex py-space-4 pl-space-4"
|
|
194
|
+
>
|
|
195
|
+
<Island variant="panel" className="flex-1 p-space-12 text-ui text-muted">
|
|
196
|
+
Files
|
|
197
|
+
</Island>
|
|
198
|
+
</ResizablePanel>
|
|
199
|
+
<ResizableHandle variant={RESIZABLE_HANDLE_VARIANTS.GAP} aria-label="Resize files" />
|
|
200
|
+
{/* Collapsed, the files panel is 0px wide and the gap is the gutter on the left. */}
|
|
201
|
+
<ResizablePanel minSize={FILE_MIN_WIDTH_PX} className="flex py-space-4 pr-space-4">
|
|
202
|
+
<Island variant="panel" className="flex flex-1 flex-col gap-space-8 p-space-8">
|
|
203
|
+
<Button
|
|
204
|
+
variant={BUTTON_VARIANTS.GHOST}
|
|
205
|
+
size={BUTTON_SIZES.SM}
|
|
206
|
+
onClick={handleToggleFiles}
|
|
207
|
+
className="self-start"
|
|
208
|
+
>
|
|
209
|
+
<PanelLeft />
|
|
210
|
+
{isFileListVisible ? "Hide files" : "Show files"}
|
|
211
|
+
</Button>
|
|
212
|
+
<p className="px-space-4 text-ui text-muted">index.ts</p>
|
|
213
|
+
</Island>
|
|
214
|
+
</ResizablePanel>
|
|
215
|
+
</ResizablePanelGroup>
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Guidelines
|
|
222
|
+
|
|
223
|
+
Do:
|
|
224
|
+
|
|
225
|
+
- Sizes in pixels, as numbers: `defaultSize={360}` `minSize={280}`. A string is a percentage (`"30%"`) or another CSS unit (`"20rem"`).
|
|
226
|
+
- Size the side panel (`defaultSize`, `minSize`, and `maxSize` when it shouldn't grow too wide) and leave the main panel without a `defaultSize`: it takes the rest, with a `minSize` so it can't be squeezed out.
|
|
227
|
+
- The gap between islands, the line between panes on one surface.
|
|
228
|
+
- Size the group's parent: the group fills it.
|
|
229
|
+
- Name each handle after what it resizes: `aria-label="Resize chat"`.
|
|
230
|
+
|
|
231
|
+
Don't:
|
|
232
|
+
|
|
233
|
+
- A split on a phone: show one pane at a time with a toggle between them, as the editor does below 768px.
|
|
234
|
+
- Resizable for a layout nobody needs to change: put the islands side by side with a gap instead.
|
|
235
|
+
- Restyling the handle: pick a variant.
|
|
236
|
+
- Panels or handles wrapped in other elements: they are direct children of the group, which measures them.
|
|
237
|
+
|
|
238
|
+
## API
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle, RESIZABLE_HANDLE_VARIANTS, usePanelRef, useDefaultLayout } from "@major-tech/ui/resizable";
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### `<ResizablePanelGroup />`
|
|
245
|
+
|
|
246
|
+
react-resizable-panels' Group: a `<div>` that fills its parent. Every other prop and attribute goes to it.
|
|
247
|
+
|
|
248
|
+
| Prop | Type | Default | Description |
|
|
249
|
+
| --- | --- | --- | --- |
|
|
250
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Side by side, or stacked. |
|
|
251
|
+
| `defaultLayout` | `Layout` | — | Sizes to start from, as `useDefaultLayout` gives them: each panel's id and its percentage. |
|
|
252
|
+
| `onLayoutChanged` | `(layout: Layout) => void` | — | Called once a drag ends, and after a resize from the keyboard or from code. Save the layout here. |
|
|
253
|
+
| `onLayoutChange` | `(layout: Layout) => void` | — | Called on every move while dragging. |
|
|
254
|
+
| `disabled` | `boolean` | `false` | Turns resizing off for every handle. |
|
|
255
|
+
| `groupRef` | `Ref<GroupImperativeHandle>` | — | `getLayout()` and `setLayout(layout)`, in percentages. |
|
|
256
|
+
|
|
257
|
+
### `<ResizablePanel />`
|
|
258
|
+
|
|
259
|
+
react-resizable-panels' Panel, a direct child of the group. `className` and `style` go to its inner box, which holds the content; the outer one clips it.
|
|
260
|
+
|
|
261
|
+
| Prop | Type | Default | Description |
|
|
262
|
+
| --- | --- | --- | --- |
|
|
263
|
+
| `defaultSize` | `number \| string` | an equal share | Its size at first, and after a double-click on its handle. A number is pixels; a string is a percentage (`"30%"`) or a CSS unit. |
|
|
264
|
+
| `minSize` | `number \| string` | `0` | The least it can be dragged to. |
|
|
265
|
+
| `maxSize` | `number \| string` | `"100%"` | The most it can be dragged to. |
|
|
266
|
+
| `collapsible` | `boolean` | `false` | Folds to `collapsedSize` when dragged past `minSize`, or on Enter on its handle. |
|
|
267
|
+
| `collapsedSize` | `number \| string` | `0` | Its size folded. |
|
|
268
|
+
| `groupResizeBehavior` | `"preserve-relative-size" \| "preserve-pixel-size"` | `"preserve-relative-size"` | When the group's size changes, it keeps its share, or its pixels. At least one panel in a group keeps its share. |
|
|
269
|
+
| `panelRef` | `Ref<PanelImperativeHandle>` | — | `resize(size)`, `collapse()`, `expand()`, `isCollapsed()` and `getSize()` (`{ inPixels, asPercentage }`). Make it with `usePanelRef()`. |
|
|
270
|
+
| `onResize` | `(size: PanelSize, id, previousSize) => void` | — | Called when its size changes; size is `{ inPixels, asPercentage }`. |
|
|
271
|
+
| `id` | `string \| number` | `useId()` | Names it in a saved layout. |
|
|
272
|
+
| `disabled` | `boolean` | `false` | It can't be resized, by its handle or by its neighbours. |
|
|
273
|
+
|
|
274
|
+
### `<ResizableHandle />`
|
|
275
|
+
|
|
276
|
+
react-resizable-panels' Separator, a direct child of the group between two panels: a `<div role="separator">`. Every other attribute goes to it.
|
|
277
|
+
|
|
278
|
+
| Prop | Type | Default | Description |
|
|
279
|
+
| --- | --- | --- | --- |
|
|
280
|
+
| `variant` | `"line" \| "gap"` | `"line"` | line: a 1px rule between panes on one surface that turns accent on hover, while dragging and on focus. gap: 4px between two islands, with an accent line on hover, while dragging and on focus. |
|
|
281
|
+
| `disabled` | `boolean` | `false` | It can't be dragged or focused; its panels may still resize through another handle. |
|
|
282
|
+
|
|
283
|
+
### `RESIZABLE_HANDLE_VARIANTS`
|
|
284
|
+
|
|
285
|
+
| Prop | Type | Default | Description |
|
|
286
|
+
| --- | --- | --- | --- |
|
|
287
|
+
| `LINE` | `"line"` | — | Panes on one surface: a settings column beside its preview. |
|
|
288
|
+
| `GAP` | `"gap"` | — | Two islands: the chat beside its workspace. |
|
|
289
|
+
|
|
290
|
+
### `usePanelRef()`
|
|
291
|
+
|
|
292
|
+
react-resizable-panels' hook, re-exported from `@major-tech/ui/resizable`: a ref for a panel's `panelRef`.
|
|
293
|
+
|
|
294
|
+
| Prop | Type | Default | Description |
|
|
295
|
+
| --- | --- | --- | --- |
|
|
296
|
+
| `Returns` | `RefObject<PanelImperativeHandle \| null>` | — | Pass it to `panelRef`; then `ref.current` resizes, folds and unfolds the panel. |
|
|
297
|
+
|
|
298
|
+
### `useDefaultLayout(options)`
|
|
299
|
+
|
|
300
|
+
react-resizable-panels' hook, re-exported from `@major-tech/ui/resizable`: remembers a group's layout in localStorage between visits. It reads the storage while rendering, so use it only where the group renders in the browser, not on the server.
|
|
301
|
+
|
|
302
|
+
| Prop | Type | Default | Description |
|
|
303
|
+
| --- | --- | --- | --- |
|
|
304
|
+
| `options.id`* | `string` | — | Names the saved layout; one per group. |
|
|
305
|
+
| `options.panelIds` | `string[]` | — | The panels' ids, for a group whose panels come and go: a layout is saved for each set. |
|
|
306
|
+
| `options.storage` | `LayoutStorage` | `localStorage` | Where it's saved: `sessionStorage`, or anything with `getItem` and `setItem`. |
|
|
307
|
+
| `Returns` | `{ defaultLayout, onLayoutChanged }` | — | Pass both to the group. |
|
|
308
|
+
|
|
309
|
+
`*` marks a required prop.
|
|
310
|
+
|
|
311
|
+
### Accessibility
|
|
312
|
+
|
|
313
|
+
- The handle is `role="separator"` and focusable, with `aria-orientation` (across its group), `aria-controls` (the panel before it), and `aria-valuenow`, `aria-valuemin` and `aria-valuemax`: that panel's size as a percentage of the group.
|
|
314
|
+
- The arrow keys move it by 5% of the group (left and right side by side, up and down stacked); Home and End take the panel before it to its minimum and maximum; Enter folds or unfolds a collapsible panel; F6 and Shift+F6 move to the group's next and previous handle.
|
|
315
|
+
- A double-click resets the panel beside it that has a `defaultSize`.
|
|
316
|
+
- Give each handle an `aria-label` that says what it resizes ("Resize chat"): the library sets none.
|
|
317
|
+
- Focused, the handle turns accent.
|
|
318
|
+
- Its hit area is at least 10px wide (20px on touch screens), wider than the line or the gap.
|