@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,377 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: AttachmentGallery
|
|
3
|
+
slug: attachment-gallery
|
|
4
|
+
description: "Attached files as tiles with the upload states of shadcn's Attachment: idle, uploading, processing, error and done, each with its status line; a whole-tile trigger, remove, retry and custom actions."
|
|
5
|
+
group: Inputs
|
|
6
|
+
layer: composed
|
|
7
|
+
status: beta
|
|
8
|
+
since: 0.4.0
|
|
9
|
+
import: import { AttachmentGallery, AttachmentGroup, Attachment, AttachmentMedia, AttachmentOverlay, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentProgress, AttachmentTrigger, AttachmentActions, AttachmentAction, ATTACHMENT_STATUSES, ATTACHMENT_GALLERY_SIZES, ATTACHMENT_MEDIA_VARIANTS, isImageAttachment, isAttachmentBusy, getAttachmentStatusLine, formatFileSize } from "@major-tech/ui/attachment-gallery";
|
|
10
|
+
source: packages/ui/src/components/attachment-gallery.tsx
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# AttachmentGallery
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Files
|
|
18
|
+
|
|
19
|
+
Every attached file is a square tile. An image fills its tile, cropped to the square, and opens a larger preview that flips through the gallery’s images (“2 of 3”, the arrows or the left and right keys); any other file shows its icon, its name and its status line, and opens in a new tab.
|
|
20
|
+
|
|
21
|
+
Example: `file-types`
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { AttachmentGallery, type AttachmentItem } from "@major-tech/ui/attachment-gallery";
|
|
27
|
+
|
|
28
|
+
const ITEMS: AttachmentItem[] = [
|
|
29
|
+
{ id: "mark", name: "major-mark.svg", url: "/major-mark.svg" },
|
|
30
|
+
{ id: "brief", name: "Sales dashboard brief.pdf", url: "/major-mark.svg", type: "application/pdf", size: 2_516_582 },
|
|
31
|
+
{ id: "agents", name: "AGENTS.md", url: "/major-mark.svg", size: 12_288 },
|
|
32
|
+
{ id: "leads", name: "leads-november.csv", url: "/major-mark.svg", size: 18_432 },
|
|
33
|
+
{ id: "script", name: "sync-leads.ts", url: "/major-mark.svg", size: 4_096 },
|
|
34
|
+
{ id: "export", name: "hub-export.zip", url: "/major-mark.svg", size: 48_234_496 },
|
|
35
|
+
{ id: "demo", name: "demo-recording.mov", url: "/major-mark.svg", size: 96_468_992 },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export default function AttachmentGalleryFileTypes() {
|
|
39
|
+
return <AttachmentGallery items={ITEMS} className="max-w-140" />;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- **Tiles** are 120px squares, 8px apart, on secondary with a 1px line border and rounded-lg.
|
|
44
|
+
- **One row**: the gallery never grows taller. When the tiles don’t fit, as in a sent message or a narrow chat panel, the row scrolls sideways like a carousel: with a trackpad, Shift and the mouse wheel, or Tab to a tile. Tiles snap to the left edge, and the side that has more fades out.
|
|
45
|
+
- A file tile: the icon by type (text, sheet, code, archive, video, audio, image, or a plain file) in muted, the name in 12px ink up to three lines, and the status line in 11px muted at the bottom: the type and size when it’s uploaded, “PDF · 1.8 MB”.
|
|
46
|
+
- The whole tile opens the file; hover darkens its border to faint. The buttons on its corner stay clickable on their own.
|
|
47
|
+
- The component holds no File objects: pass each file’s name, url, type and size, as the product stored them.
|
|
48
|
+
|
|
49
|
+
### States
|
|
50
|
+
|
|
51
|
+
The upload lifecycle of shadcn’s Attachment, on our tiles. The product passes each file’s status; the tile shows it with an icon and a status line, never with colour alone. Uploading and processing make the name shimmer.
|
|
52
|
+
|
|
53
|
+
Example: `states`
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
"use client";
|
|
57
|
+
|
|
58
|
+
import { useEffect, useState } from "react";
|
|
59
|
+
import {
|
|
60
|
+
ATTACHMENT_GALLERY_SIZES,
|
|
61
|
+
ATTACHMENT_STATUSES,
|
|
62
|
+
AttachmentGallery,
|
|
63
|
+
type AttachmentItem,
|
|
64
|
+
} from "@major-tech/ui/attachment-gallery";
|
|
65
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
66
|
+
|
|
67
|
+
const TICK_MS = 400;
|
|
68
|
+
const PROGRESS_STEP = 6;
|
|
69
|
+
const PROCESSING_MS = 2400;
|
|
70
|
+
const DONE_PROGRESS = 100;
|
|
71
|
+
|
|
72
|
+
const ITEMS: AttachmentItem[] = [
|
|
73
|
+
{ id: "selected", name: "selected-file.pdf", status: ATTACHMENT_STATUSES.IDLE },
|
|
74
|
+
{
|
|
75
|
+
id: "uploading",
|
|
76
|
+
name: "design-system.zip",
|
|
77
|
+
status: ATTACHMENT_STATUSES.UPLOADING,
|
|
78
|
+
progress: 64,
|
|
79
|
+
size: 18_400_000,
|
|
80
|
+
},
|
|
81
|
+
{ id: "processing", name: "market-research.pdf", status: ATTACHMENT_STATUSES.PROCESSING },
|
|
82
|
+
{
|
|
83
|
+
id: "failed",
|
|
84
|
+
name: "financial-model.xlsx",
|
|
85
|
+
status: ATTACHMENT_STATUSES.ERROR,
|
|
86
|
+
error: "Upload failed. Try again.",
|
|
87
|
+
isRetryable: true,
|
|
88
|
+
size: 412_000,
|
|
89
|
+
},
|
|
90
|
+
{ id: "uploaded", name: "uploaded-report.pdf", url: "/major-mark.svg", size: 1_887_437 },
|
|
91
|
+
{ id: "picture", name: "hero.png", url: "/major-mark.svg", status: ATTACHMENT_STATUSES.UPLOADING, progress: 30 },
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
/** One step of a pretend upload: progress moves on, a finished upload processes, then it's done. */
|
|
95
|
+
const advance = (item: AttachmentItem): AttachmentItem => {
|
|
96
|
+
if (item.status !== ATTACHMENT_STATUSES.UPLOADING || item.progress === undefined) {
|
|
97
|
+
return item;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const progress = Math.min(DONE_PROGRESS, item.progress + PROGRESS_STEP);
|
|
101
|
+
|
|
102
|
+
return progress === DONE_PROGRESS
|
|
103
|
+
? { ...item, progress: undefined, status: ATTACHMENT_STATUSES.PROCESSING }
|
|
104
|
+
: { ...item, progress };
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default function AttachmentGalleryStates() {
|
|
108
|
+
const [items, setItems] = useState(ITEMS);
|
|
109
|
+
const processingIds = items
|
|
110
|
+
.filter(({ status }) => status === ATTACHMENT_STATUSES.PROCESSING)
|
|
111
|
+
.map(({ id }) => id)
|
|
112
|
+
.join(",");
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const timer = setInterval(() => setItems((current) => current.map(advance)), TICK_MS);
|
|
116
|
+
|
|
117
|
+
return () => clearInterval(timer);
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (!processingIds) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const ids = new Set(processingIds.split(","));
|
|
126
|
+
const timer = setTimeout(
|
|
127
|
+
() =>
|
|
128
|
+
setItems((current) =>
|
|
129
|
+
current.map((item) =>
|
|
130
|
+
ids.has(item.id) ? { ...item, status: ATTACHMENT_STATUSES.DONE, url: "/major-mark.svg" } : item
|
|
131
|
+
)
|
|
132
|
+
),
|
|
133
|
+
PROCESSING_MS
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
return () => clearTimeout(timer);
|
|
137
|
+
}, [processingIds]);
|
|
138
|
+
|
|
139
|
+
const remove = (id: string) => setItems((current) => current.filter((item) => item.id !== id));
|
|
140
|
+
|
|
141
|
+
const retry = (id: string) =>
|
|
142
|
+
setItems((current) =>
|
|
143
|
+
current.map((item) =>
|
|
144
|
+
item.id === id ? { ...item, status: ATTACHMENT_STATUSES.UPLOADING, error: undefined, progress: 0 } : item
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const reset = () => setItems(ITEMS);
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div className="flex w-full max-w-160 flex-col gap-space-16">
|
|
152
|
+
<AttachmentGallery items={items} onRemove={remove} onRetry={retry} />
|
|
153
|
+
<AttachmentGallery items={items} size={ATTACHMENT_GALLERY_SIZES.SM} onRemove={remove} onRetry={retry} />
|
|
154
|
+
<Button variant={BUTTON_VARIANTS.LINK} size={BUTTON_SIZES.SM} onClick={reset} className="self-start px-0">
|
|
155
|
+
Start again
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- **Idle**: picked, not sent yet. A clock, “Ready to upload”.
|
|
163
|
+
- **Uploading**: a spinner and “Uploading · 64%” (“Uploading…” when the progress isn’t known); the name shimmers. It can’t be opened yet. Where there’s no room for the line (small tiles, pictures), a 4px progress bar in link sits at the bottom of the tile.
|
|
164
|
+
- **Processing**: uploaded, Major is reading it. The file’s icon, “Processing…”, the name shimmers; small tiles and pictures show a spinner.
|
|
165
|
+
- **Error**: a danger border, an alert icon and the reason in danger: “Upload failed. Try again.”, “Larger than 100 MB”, “This file type isn’t supported”.
|
|
166
|
+
- **Done**: the file’s icon and its type and size, “PDF · 1.8 MB”. It opens on click.
|
|
167
|
+
- A picture dims while it isn’t done, with the state’s icon on it.
|
|
168
|
+
- Retry sits next to Remove, only when the upload can succeed next time (`isRetryable`): a dropped connection, not a file that’s too large.
|
|
169
|
+
- Remove and other buttons are 20px round buttons on the top-right corner: shown on hover or focus, always on touch and on a failed tile, so the person can clear it.
|
|
170
|
+
- Send waits while any file uploads or processes, and failed files are left out of what’s sent.
|
|
171
|
+
|
|
172
|
+
### Sizes and places
|
|
173
|
+
|
|
174
|
+
The same gallery everywhere files are attached: md (120px) in the Composer, while files are still being added; sm (64px) once they're sent, in the person's message and in Major's reply, and under the answers in AskUserQuestion and in its summary. Sent files are read-only: no remove.
|
|
175
|
+
|
|
176
|
+
Example: `places`
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
"use client";
|
|
180
|
+
|
|
181
|
+
import { MESSAGE_AUTHORS, Message } from "@major-tech/ui/message";
|
|
182
|
+
import { ATTACHMENT_GALLERY_SIZES, AttachmentGallery, type AttachmentItem } from "@major-tech/ui/attachment-gallery";
|
|
183
|
+
|
|
184
|
+
const ITEMS: AttachmentItem[] = [
|
|
185
|
+
{ id: "mark", name: "major-mark.svg", url: "/major-mark.svg" },
|
|
186
|
+
{ id: "logo", name: "major-mark-ink.svg", url: "/brand/mark-ink.svg" },
|
|
187
|
+
{ id: "agents", name: "AGENTS.md", url: "/major-mark.svg", size: 12_288 },
|
|
188
|
+
{ id: "brief", name: "Login page brief.pdf", url: "/major-mark.svg", size: 1_153_434 },
|
|
189
|
+
{ id: "copy", name: "login-copy.csv", url: "/major-mark.svg", size: 6_144 },
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
export default function AttachmentGalleryPlaces() {
|
|
193
|
+
return (
|
|
194
|
+
<div className="flex w-full max-w-105 flex-col gap-space-24">
|
|
195
|
+
<Message from={MESSAGE_AUTHORS.USER}>
|
|
196
|
+
<AttachmentGallery items={ITEMS} size={ATTACHMENT_GALLERY_SIZES.SM} className="mb-space-6" />
|
|
197
|
+
Use these logos on the login page, with the brief and the copy, and follow AGENTS.md.
|
|
198
|
+
</Message>
|
|
199
|
+
{/* In the Composer, while the files are still being added. */}
|
|
200
|
+
<AttachmentGallery items={ITEMS} />
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- In a sent message the gallery sits above the text, inside the bubble; more files than fit scroll sideways, the bubble stays as wide as ever.
|
|
207
|
+
- At sm a tile shows only an icon and its extension: the state’s icon, or the file’s own when it is done or uploads with a known progress, then above the progress bar. Its name and status line show in a tooltip on hover and focus, like a picture’s at any size.
|
|
208
|
+
- Files are added with FileDropArea: one drop field and the same checks in every place.
|
|
209
|
+
|
|
210
|
+
### Parts
|
|
211
|
+
|
|
212
|
+
AttachmentGallery is built from parts, as shadcn’s Attachment is: use them for a tile the gallery doesn’t make, with your own status line, trigger or buttons. The gallery’s `renderActions` adds buttons to its own tiles.
|
|
213
|
+
|
|
214
|
+
Example: `parts`
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
"use client";
|
|
218
|
+
|
|
219
|
+
import { useState } from "react";
|
|
220
|
+
import { Copy, FileText, X } from "lucide-react";
|
|
221
|
+
import {
|
|
222
|
+
ATTACHMENT_STATUSES,
|
|
223
|
+
Attachment,
|
|
224
|
+
AttachmentAction,
|
|
225
|
+
AttachmentActions,
|
|
226
|
+
AttachmentContent,
|
|
227
|
+
AttachmentDescription,
|
|
228
|
+
AttachmentGroup,
|
|
229
|
+
AttachmentMedia,
|
|
230
|
+
AttachmentTitle,
|
|
231
|
+
AttachmentTrigger,
|
|
232
|
+
} from "@major-tech/ui/attachment-gallery";
|
|
233
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "@major-tech/ui/button";
|
|
234
|
+
|
|
235
|
+
const FILE = { name: "research-summary.pdf", url: "/major-mark.svg" };
|
|
236
|
+
const COPIED_MS = 1600;
|
|
237
|
+
|
|
238
|
+
export default function AttachmentGalleryParts() {
|
|
239
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
240
|
+
const [isRemoved, setIsRemoved] = useState(false);
|
|
241
|
+
|
|
242
|
+
const copyLink = async () => {
|
|
243
|
+
await navigator.clipboard.writeText(new URL(FILE.url, window.location.href).toString());
|
|
244
|
+
setIsCopied(true);
|
|
245
|
+
setTimeout(() => setIsCopied(false), COPIED_MS);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
if (isRemoved) {
|
|
249
|
+
return (
|
|
250
|
+
<Button variant={BUTTON_VARIANTS.LINK} size={BUTTON_SIZES.SM} onClick={() => setIsRemoved(false)} className="px-0">
|
|
251
|
+
Bring it back
|
|
252
|
+
</Button>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<AttachmentGroup>
|
|
258
|
+
<Attachment status={ATTACHMENT_STATUSES.DONE}>
|
|
259
|
+
<AttachmentMedia>
|
|
260
|
+
<FileText />
|
|
261
|
+
</AttachmentMedia>
|
|
262
|
+
<AttachmentContent>
|
|
263
|
+
<AttachmentTitle>{FILE.name}</AttachmentTitle>
|
|
264
|
+
<AttachmentDescription>{isCopied ? "Link copied" : "Summary · 12 pages"}</AttachmentDescription>
|
|
265
|
+
</AttachmentContent>
|
|
266
|
+
<AttachmentTrigger
|
|
267
|
+
render={<a href={FILE.url} target="_blank" rel="noreferrer" aria-label={`Open ${FILE.name}`} />}
|
|
268
|
+
/>
|
|
269
|
+
<AttachmentActions>
|
|
270
|
+
<AttachmentAction aria-label={`Copy a link to ${FILE.name}`} onClick={copyLink}>
|
|
271
|
+
<Copy />
|
|
272
|
+
</AttachmentAction>
|
|
273
|
+
<AttachmentAction aria-label={`Remove ${FILE.name}`} onClick={() => setIsRemoved(true)}>
|
|
274
|
+
<X />
|
|
275
|
+
</AttachmentAction>
|
|
276
|
+
</AttachmentActions>
|
|
277
|
+
</Attachment>
|
|
278
|
+
</AttachmentGroup>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- AttachmentGroup › Attachment › AttachmentMedia, AttachmentContent (AttachmentTitle, AttachmentDescription), AttachmentOverlay, AttachmentProgress, AttachmentTrigger, AttachmentActions (AttachmentAction).
|
|
284
|
+
- Attachment’s status and size reach every part inside it: the title shimmers, the description turns danger, the border follows.
|
|
285
|
+
- AttachmentTrigger covers the tile under the actions: a button, or with `render` a link or a DialogTrigger.
|
|
286
|
+
|
|
287
|
+
## API
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
import { AttachmentGallery, AttachmentGroup, Attachment, AttachmentMedia, AttachmentOverlay, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentProgress, AttachmentTrigger, AttachmentActions, AttachmentAction, ATTACHMENT_STATUSES, ATTACHMENT_GALLERY_SIZES, ATTACHMENT_MEDIA_VARIANTS, isImageAttachment, isAttachmentBusy, getAttachmentStatusLine, formatFileSize } from "@major-tech/ui/attachment-gallery";
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### `<AttachmentGallery />`
|
|
294
|
+
|
|
295
|
+
Renders a `<div>` around the list of tiles; every other `<div>` attribute goes on it, so outside spacing (margin, padding) works as set. Renders nothing with no items.
|
|
296
|
+
|
|
297
|
+
| Prop | Type | Default | Description |
|
|
298
|
+
| --- | --- | --- | --- |
|
|
299
|
+
| `items`* | `AttachmentItem[]` | — | The attached files. |
|
|
300
|
+
| `size` | `"sm" \| "md"` | `"md"` | 64px or 120px tiles. |
|
|
301
|
+
| `onRemove` | `(id: string) => void` | — | Shows a remove button on each tile. Leave it out for sent files. |
|
|
302
|
+
| `onRetry` | `(id: string) => void` | — | Shows Retry on failed tiles marked `isRetryable`. |
|
|
303
|
+
| `renderActions` | `(item: AttachmentItem) => ReactNode` | — | More buttons for a tile, before Retry and Remove: AttachmentAction elements. |
|
|
304
|
+
| `onOpen` | `(item: AttachmentItem) => void` | — | Opens a file that isn't an image the product's own way, in place of the new tab: for a link signed on demand, or a download; such a file needs no `url`. Images keep the preview. |
|
|
305
|
+
|
|
306
|
+
`*` marks a required prop.
|
|
307
|
+
|
|
308
|
+
### `AttachmentItem`
|
|
309
|
+
|
|
310
|
+
| Prop | Type | Default | Description |
|
|
311
|
+
| --- | --- | --- | --- |
|
|
312
|
+
| `id`* | `string` | — | Passed to `onRemove` and `onRetry`. |
|
|
313
|
+
| `name`* | `string` | — | The file name; the image’s alt text. |
|
|
314
|
+
| `url` | `string` | — | A local preview while it uploads, then the uploaded file: what a tile shows and opens. |
|
|
315
|
+
| `type` | `string` | — | MIME type. Without it, the name’s extension tells an image from a file. |
|
|
316
|
+
| `size` | `number` | — | Bytes: shown when done, “PDF · 1.8 MB”. |
|
|
317
|
+
| `status` | `"idle" \| "uploading" \| "processing" \| "error" \| "done"` | `"done"` | The upload state. |
|
|
318
|
+
| `progress` | `number` | — | Upload progress, 0–100. Without it, an uploading tile shows a spinner. |
|
|
319
|
+
| `error` | `string` | — | Why it failed, in a few words. |
|
|
320
|
+
| `isRetryable` | `boolean` | — | The failure can pass: shows Retry. Leave it out for a file that’s too large. |
|
|
321
|
+
| `description` | `string` | — | Replaces the status line: “Reading 12 pages…”. |
|
|
322
|
+
|
|
323
|
+
`*` marks a required prop.
|
|
324
|
+
|
|
325
|
+
### `<Attachment />`
|
|
326
|
+
|
|
327
|
+
Renders an `<li>`: put it in an AttachmentGroup. Its parts go inside the tile; AttachmentActions hang off its corner.
|
|
328
|
+
|
|
329
|
+
| Prop | Type | Default | Description |
|
|
330
|
+
| --- | --- | --- | --- |
|
|
331
|
+
| `status` | `"idle" \| "uploading" \| "processing" \| "error" \| "done"` | `"done"` | Drives the border, the title’s shimmer and the description’s colour. |
|
|
332
|
+
| `size` | `"sm" \| "md"` | `"md"` | 64px or 120px. |
|
|
333
|
+
|
|
334
|
+
### `<AttachmentMedia /> · <AttachmentTrigger /> · <AttachmentProgress /> · <AttachmentAction />`
|
|
335
|
+
|
|
336
|
+
| Prop | Type | Default | Description |
|
|
337
|
+
| --- | --- | --- | --- |
|
|
338
|
+
| `AttachmentMedia variant` | `"icon" \| "image"` | `"icon"` | An icon, or an `<img>` that fills the tile (and hides the text, which stays for screen readers). |
|
|
339
|
+
| `AttachmentTrigger render` | `ReactElement \| function` | — | Render your element (a link, a DialogTrigger) instead of a `<button>`. Give it an `aria-label`. |
|
|
340
|
+
| `AttachmentProgress value`* | `number` | — | 0–100. |
|
|
341
|
+
| `AttachmentAction aria-label`* | `string` | — | The action and the file: “Remove brief.pdf”. |
|
|
342
|
+
|
|
343
|
+
`*` marks a required prop.
|
|
344
|
+
|
|
345
|
+
### `AttachmentGroup · AttachmentContent · AttachmentTitle · AttachmentDescription · AttachmentOverlay · AttachmentActions`
|
|
346
|
+
|
|
347
|
+
Take their element’s attributes and `className`. AttachmentGroup is a `<ul>` named “Attached files” unless you pass `aria-label`.
|
|
348
|
+
|
|
349
|
+
| Prop | Type | Default | Description |
|
|
350
|
+
| --- | --- | --- | --- |
|
|
351
|
+
| `AttachmentGroup` | `<ul>` | — | One row that scrolls, snaps and fades at its edges. |
|
|
352
|
+
| `AttachmentContent` | `<span>` | — | The name and status line; seen on md file tiles. |
|
|
353
|
+
| `AttachmentTitle` | `<span>` | — | The name; shimmers while busy. |
|
|
354
|
+
| `AttachmentDescription` | `<span>` | — | The status line; danger on error. |
|
|
355
|
+
| `AttachmentOverlay` | `<span>` | — | The state’s icon centred on a picture. |
|
|
356
|
+
| `AttachmentActions` | `<span>` | — | The buttons on the corner. |
|
|
357
|
+
|
|
358
|
+
### `ATTACHMENT_STATUSES · ATTACHMENT_GALLERY_SIZES · ATTACHMENT_MEDIA_VARIANTS · helpers`
|
|
359
|
+
|
|
360
|
+
| Prop | Type | Default | Description |
|
|
361
|
+
| --- | --- | --- | --- |
|
|
362
|
+
| `IDLE · UPLOADING · PROCESSING · ERROR · DONE` | `AttachmentStatus` | — | The upload states. |
|
|
363
|
+
| `SM · MD` | `AttachmentGallerySize` | — | The tile sizes. |
|
|
364
|
+
| `ICON · IMAGE` | `AttachmentMediaVariant` | — | What AttachmentMedia holds. |
|
|
365
|
+
| `isImageAttachment(item)` | `boolean` | — | Whether a file shows as a picture. |
|
|
366
|
+
| `isAttachmentBusy(item)` | `boolean` | — | Uploading or processing: send waits for it. |
|
|
367
|
+
| `getAttachmentStatusLine(item)` | `string` | — | The status line the gallery shows. |
|
|
368
|
+
| `formatFileSize(bytes)` | `string` | — | “820 KB”, “1.8 MB”. |
|
|
369
|
+
|
|
370
|
+
### Accessibility
|
|
371
|
+
|
|
372
|
+
- The tiles are a list named “Attached files”.
|
|
373
|
+
- A done tile’s trigger is a button or a link named “Open \<name>”; the preview dialog is titled with the name. With several images, “Previous image” and “Next image” buttons and the left and right keys turn it, round the set.
|
|
374
|
+
- A tile that can’t be opened yet, or failed, is focusable and named “\<name>: \<status line>”; uploading and processing tiles are busy. The tooltip shows on focus too.
|
|
375
|
+
- The state isn’t carried by colour alone: each has an icon and a status line.
|
|
376
|
+
- Remove, Retry and your own buttons are named for the action and the file: “Remove \<name>”, “Retry \<name>”.
|
|
377
|
+
- The trigger sits under the buttons, so each is clickable and focusable on its own.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Avatar
|
|
3
|
+
slug: avatar
|
|
4
|
+
description: "A person: initials on a tinted circle or a photo, and the overlapping stack."
|
|
5
|
+
group: Labels
|
|
6
|
+
layer: primitive
|
|
7
|
+
status: stable
|
|
8
|
+
since: 0.1.0
|
|
9
|
+
primitive: Avatar
|
|
10
|
+
import: import { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AVATAR_SIZES, AVATAR_TONES } from "@major-tech/ui/avatar";
|
|
11
|
+
source: packages/ui/src/components/avatar.tsx
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Avatar
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Sizes and tones
|
|
19
|
+
|
|
20
|
+
xs 18px (the default), sm 22, md 28 and lg 32px. Initials are semibold and scale with the disc, from 8.5px at xs to 11px at lg.
|
|
21
|
+
|
|
22
|
+
Example: `sizes`
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Avatar, AvatarFallback } from "@major-tech/ui/avatar";
|
|
26
|
+
|
|
27
|
+
export default function AvatarSizes() {
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<Avatar size="xs">
|
|
31
|
+
<AvatarFallback>MC</AvatarFallback>
|
|
32
|
+
</Avatar>
|
|
33
|
+
<Avatar size="sm">
|
|
34
|
+
<AvatarFallback>MC</AvatarFallback>
|
|
35
|
+
</Avatar>
|
|
36
|
+
<Avatar size="md">
|
|
37
|
+
<AvatarFallback>MC</AvatarFallback>
|
|
38
|
+
</Avatar>
|
|
39
|
+
<Avatar size="lg">
|
|
40
|
+
<AvatarFallback>MC</AvatarFallback>
|
|
41
|
+
</Avatar>
|
|
42
|
+
<Avatar size="lg">
|
|
43
|
+
<AvatarFallback tone="muted">JB</AvatarFallback>
|
|
44
|
+
</Avatar>
|
|
45
|
+
<Avatar size="lg">
|
|
46
|
+
<AvatarFallback tone="more">+4</AvatarFallback>
|
|
47
|
+
</Avatar>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **self** — the signed-in person: the avatar fill.
|
|
54
|
+
- **muted** — everyone else: secondary.
|
|
55
|
+
- **more** — the “+N” at the end of a stack.
|
|
56
|
+
|
|
57
|
+
### With a name
|
|
58
|
+
|
|
59
|
+
An Avatar holds an AvatarImage, when there is a photo, and the AvatarFallback initials, shown until the photo loads or if it fails.
|
|
60
|
+
|
|
61
|
+
Example: `with-name`
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@major-tech/ui/avatar";
|
|
65
|
+
|
|
66
|
+
interface Member {
|
|
67
|
+
name: string;
|
|
68
|
+
initials: string;
|
|
69
|
+
image?: string;
|
|
70
|
+
isYou?: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const MEMBERS: Member[] = [
|
|
74
|
+
{ name: "Maya Chen", initials: "MC", isYou: true },
|
|
75
|
+
{ name: "Major", initials: "M", image: "/major-mark.svg" },
|
|
76
|
+
{ name: "Jason Bao", initials: "JB" },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export default function AvatarWithName() {
|
|
80
|
+
return (
|
|
81
|
+
<div className="flex flex-col gap-space-10">
|
|
82
|
+
{MEMBERS.map((member) => (
|
|
83
|
+
<div key={member.name} className="flex items-center gap-space-8 text-ui text-ink">
|
|
84
|
+
<Avatar size="md">
|
|
85
|
+
{member.image && <AvatarImage src={member.image} alt="" />}
|
|
86
|
+
<AvatarFallback tone={member.isYou ? "self" : "muted"}>{member.initials}</AvatarFallback>
|
|
87
|
+
</Avatar>
|
|
88
|
+
{member.name}
|
|
89
|
+
{member.isYou && <span className="text-muted">(you)</span>}
|
|
90
|
+
</div>
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Stacks
|
|
98
|
+
|
|
99
|
+
AvatarGroup overlaps avatars by 6px with a 2px ring in the panel colour. It doesn't count them: show up to three and collapse the rest into +N yourself.
|
|
100
|
+
|
|
101
|
+
Example: `stack`
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { Avatar, AvatarFallback, AvatarGroup } from "@major-tech/ui/avatar";
|
|
105
|
+
|
|
106
|
+
const PEOPLE = [
|
|
107
|
+
{ name: "Maya Chen", initials: "MC" },
|
|
108
|
+
{ name: "Jason Bao", initials: "JB" },
|
|
109
|
+
{ name: "Ana Lopez", initials: "AL" },
|
|
110
|
+
{ name: "Rahul Rao", initials: "RR" },
|
|
111
|
+
{ name: "Lee Park", initials: "LP" },
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
const MAX_SHOWN_COUNT = 3;
|
|
115
|
+
|
|
116
|
+
export default function AvatarStack() {
|
|
117
|
+
const shown = PEOPLE.slice(0, MAX_SHOWN_COUNT);
|
|
118
|
+
const restCount = PEOPLE.length - shown.length;
|
|
119
|
+
const names = shown.map((person) => person.name).join(", ");
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<AvatarGroup role="img" aria-label={restCount > 0 ? `${names} and ${restCount} more` : names}>
|
|
123
|
+
{shown.map((person, index) => (
|
|
124
|
+
<Avatar key={person.name} size="md">
|
|
125
|
+
<AvatarFallback tone={index === 0 ? "self" : "muted"}>{person.initials}</AvatarFallback>
|
|
126
|
+
</Avatar>
|
|
127
|
+
))}
|
|
128
|
+
{restCount > 0 && (
|
|
129
|
+
<Avatar size="md">
|
|
130
|
+
<AvatarFallback tone="more">+{restCount}</AvatarFallback>
|
|
131
|
+
</Avatar>
|
|
132
|
+
)}
|
|
133
|
+
</AvatarGroup>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Guidelines
|
|
139
|
+
|
|
140
|
+
Do:
|
|
141
|
+
|
|
142
|
+
- Show the person's name next to the avatar in lists.
|
|
143
|
+
- Use the self tone only for the signed-in person.
|
|
144
|
+
- Show a group as a 28px secondary rounded square with a users icon; an organisation as a BrandTile.
|
|
145
|
+
|
|
146
|
+
Don't:
|
|
147
|
+
|
|
148
|
+
- Colour avatars by person: only you stand out.
|
|
149
|
+
- Stacks of more than three without +N.
|
|
150
|
+
- Avatars as the only way to tell people apart.
|
|
151
|
+
|
|
152
|
+
## API
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AVATAR_SIZES, AVATAR_TONES } from "@major-tech/ui/avatar";
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `<Avatar />`
|
|
159
|
+
|
|
160
|
+
Base UI Avatar.Root; also accepts native `<span>` attributes. `AVATAR_SIZES` holds the sizes as constants.
|
|
161
|
+
|
|
162
|
+
| Prop | Type | Default | Description |
|
|
163
|
+
| --- | --- | --- | --- |
|
|
164
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | `"xs"` | 18, 22, 28 or 32px; the initials scale with it. |
|
|
165
|
+
|
|
166
|
+
### `<AvatarImage />`
|
|
167
|
+
|
|
168
|
+
Base UI Avatar.Image; also accepts native `<img>` attributes.
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
| --- | --- | --- | --- |
|
|
172
|
+
| `src` | `string` | — | The photo. |
|
|
173
|
+
| `alt` | `string` | — | The person's name, or `""` when the name is already written next to it. |
|
|
174
|
+
|
|
175
|
+
### `<AvatarFallback />`
|
|
176
|
+
|
|
177
|
+
Base UI Avatar.Fallback. `AVATAR_TONES` holds the tones as constants.
|
|
178
|
+
|
|
179
|
+
| Prop | Type | Default | Description |
|
|
180
|
+
| --- | --- | --- | --- |
|
|
181
|
+
| `tone` | `"self" \| "muted" \| "more"` | `"self"` | You, everyone else, or the +N. |
|
|
182
|
+
| `children` | `ReactNode` | — | One or two initials, or +N. |
|
|
183
|
+
| `delay` | `number` | `0` | Milliseconds to wait before showing the initials, so a fast photo doesn't flash them. |
|
|
184
|
+
|
|
185
|
+
### `<AvatarGroup />`
|
|
186
|
+
|
|
187
|
+
A `<div>`; collapse the overflow into a more-tone Avatar yourself.
|
|
188
|
+
|
|
189
|
+
| Prop | Type | Default | Description |
|
|
190
|
+
| --- | --- | --- | --- |
|
|
191
|
+
| `children` | `ReactNode` | — | The Avatars, then the +N. |
|
|
192
|
+
|
|
193
|
+
### Accessibility
|
|
194
|
+
|
|
195
|
+
- Initials are the one place text goes below 12px: they read as an icon.
|
|
196
|
+
- Next to a written name, give the photo `alt=""` so the name isn't read twice.
|
|
197
|
+
- A stack that stands alone gets `role="img"` and an `aria-label` naming the people (“Maya Chen, Jason Bao and 2 more”).
|