@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,429 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: AskUserQuestion
|
|
3
|
+
slug: ask-user-question
|
|
4
|
+
description: "Major asks before it builds: two or three short questions in its reply, one at a time, answered with a tap, a typed answer or files."
|
|
5
|
+
group: AI
|
|
6
|
+
layer: composed
|
|
7
|
+
status: beta
|
|
8
|
+
since: 0.4.0
|
|
9
|
+
import: import { AskUserQuestion, AskUserQuestionSummary, summarizeAnswers, QUESTION_KINDS, ASK_USER_QUESTION_SUMMARY_STATUSES } from "@major-tech/ui/ask-user-question";
|
|
10
|
+
source: packages/ui/src/components/ask-user-question.tsx
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# AskUserQuestion
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### In a reply
|
|
18
|
+
|
|
19
|
+
AskUserQuestion renders the tool of the same name. A short, open-ended request (“Add a dashboard for sales”) gets questions first; a long, specific one is built straight away. They sit inside Major’s reply, under its Trace and one line of why. Never more than three; two is better.
|
|
20
|
+
|
|
21
|
+
Example: `in-reply`
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
"use client";
|
|
25
|
+
|
|
26
|
+
import { useState } from "react";
|
|
27
|
+
import { Message } from "@major-tech/ui/message";
|
|
28
|
+
import { AskUserQuestion, QUESTION_KINDS, type Question, type QuestionAnswer } from "@major-tech/ui/ask-user-question";
|
|
29
|
+
import { Trace, TraceLine, TraceTitle } from "@major-tech/ui/trace";
|
|
30
|
+
|
|
31
|
+
const QUESTIONS: Question[] = [
|
|
32
|
+
{
|
|
33
|
+
id: "first",
|
|
34
|
+
title: "What should it show first?",
|
|
35
|
+
options: [
|
|
36
|
+
{ id: "trend", label: "Trend over time", description: "Sales by week, as a line" },
|
|
37
|
+
{ id: "leads", label: "Sales leads", description: "The open leads, newest first" },
|
|
38
|
+
{ id: "totals", label: "This month’s totals", description: "Revenue, deals won, average deal" },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "audience",
|
|
43
|
+
title: "Who will look at it?",
|
|
44
|
+
options: [
|
|
45
|
+
{ id: "me", label: "Just me", description: "Only you can open it" },
|
|
46
|
+
{ id: "team", label: "My team", description: "Everyone on Sales can open it" },
|
|
47
|
+
{ id: "org", label: "Everyone at max-org", description: "Anyone in your organization" },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "extras",
|
|
52
|
+
title: "Anything else to include?",
|
|
53
|
+
kind: QUESTION_KINDS.ANY,
|
|
54
|
+
options: [
|
|
55
|
+
{ id: "filter", label: "Date filter", description: "Switch between week, month and quarter" },
|
|
56
|
+
{ id: "csv", label: "Export to CSV", description: "Download what’s on screen" },
|
|
57
|
+
{ id: "email", label: "Weekly email summary", description: "Every Monday at 9:00" },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export default function AskUserQuestionInReply() {
|
|
63
|
+
const [answers, setAnswers] = useState<QuestionAnswer[] | null>(null);
|
|
64
|
+
const used = answers
|
|
65
|
+
?.flatMap((answer) => {
|
|
66
|
+
const options = QUESTIONS.find(({ id }) => id === answer.questionId)?.options ?? [];
|
|
67
|
+
|
|
68
|
+
return [
|
|
69
|
+
...options.filter(({ id }) => answer.optionIds.includes(id)).map(({ label }) => label),
|
|
70
|
+
...(answer.other ? [answer.other] : []),
|
|
71
|
+
];
|
|
72
|
+
})
|
|
73
|
+
.join(" · ");
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex w-full max-w-105 flex-col gap-space-12">
|
|
77
|
+
<Message from="user">Add a dashboard for sales</Message>
|
|
78
|
+
<Message
|
|
79
|
+
from="agent"
|
|
80
|
+
trace={
|
|
81
|
+
<Trace>
|
|
82
|
+
<TraceLine className="text-faint">
|
|
83
|
+
<TraceTitle>Thought for 2s</TraceTitle>
|
|
84
|
+
</TraceLine>
|
|
85
|
+
</Trace>
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
<p>Before I build it, three quick questions so it fits what you need.</p>
|
|
89
|
+
<AskUserQuestion questions={QUESTIONS} onSubmit={setAnswers} />
|
|
90
|
+
</Message>
|
|
91
|
+
{answers && (
|
|
92
|
+
<Message from="agent">
|
|
93
|
+
<p>{used ? `I went with your answers: ${used}.` : "I’ll decide the details and build it."}</p>
|
|
94
|
+
</Message>
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- **The card**: surface, a 1px line border, rounded-xl, shadow-card. The question in 14px semibold with the pager on the right (‹ “1 of 3” ›, ends disabled); under it the kind in 12px muted: Pick one or Pick any.
|
|
102
|
+
- **Answers** are full-width rows 6px apart, like Radio option cards: the whole row is the hit area, and hover darkens its border to faint. A radio (Pick one) or a checkbox (Pick any) on the left tells the two kinds apart before picking.
|
|
103
|
+
- The answer in 13px ink, two to four words; an optional second line in 12px muted says what it means. Give descriptions to every answer of a question or to none.
|
|
104
|
+
- Picked: the radio or checkbox fills with link. The row itself doesn’t change: no outline, no fill, never green.
|
|
105
|
+
- **Something else** is always the last row, in muted. Clicking it turns the row into a text field (“Type your answer, then Enter”). Typing replaces the pick in a Pick one question and adds to the picks in a Pick any one.
|
|
106
|
+
|
|
107
|
+
### Moving through
|
|
108
|
+
|
|
109
|
+
In a Pick one question, picking an answer moves to the next question after a short beat (200ms), and the last pick sends. Pick any, a typed answer, attached files and a question with previews need Next, which becomes Send answers on the last question. With a file attached to any question, the last question waits for Send answers too.
|
|
110
|
+
|
|
111
|
+
- Next stays disabled until something is picked, and while files upload; a Pick any question shows “2 selected” in 12px muted beside it.
|
|
112
|
+
- Enter anywhere on the card, except on a button or in a field, does what Next does.
|
|
113
|
+
- **Footer** on a line divider: Skip (ghost) passes on this question only; Next or Send answers, the one green action, on the right when it applies.
|
|
114
|
+
- To skip all of them, the person writes a new message in the composer. `onDraftChange` reports the answers so far on every change, so that message can carry them.
|
|
115
|
+
- Answers are kept when you go back with the pager.
|
|
116
|
+
- Each new question slides in 6px from the right and fades (160ms); none with reduced motion.
|
|
117
|
+
|
|
118
|
+
### Previews
|
|
119
|
+
|
|
120
|
+
An answer can carry a preview: an HTML mockup of what it would look like, or plain text (Markdown, ASCII) that is set as written in mono. Picking the answer shows it under the answers in a sandboxed frame on an origin of its own, where the mockup's scripts don't run, on a white page in the system's font, as tall as its content up to 320px; a taller one scrolls. Text counts as HTML only when it starts with a tag. A question with previews doesn’t move on by itself, so the person sees the mockup first.
|
|
121
|
+
|
|
122
|
+
Example: `previews`
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
"use client";
|
|
126
|
+
|
|
127
|
+
import { AskUserQuestion, type Question } from "@major-tech/ui/ask-user-question";
|
|
128
|
+
|
|
129
|
+
const QUESTIONS: Question[] = [
|
|
130
|
+
{
|
|
131
|
+
id: "layout",
|
|
132
|
+
title: "How should the leads list look?",
|
|
133
|
+
options: [
|
|
134
|
+
{
|
|
135
|
+
id: "table",
|
|
136
|
+
label: "A table",
|
|
137
|
+
description: "One row per lead, sortable",
|
|
138
|
+
// HTML: the frame sets it on a white page in the system's font, as tall as it is.
|
|
139
|
+
preview:
|
|
140
|
+
'<table style="border-collapse:collapse;width:100%"><tr><th align="left">Lead</th><th align="left">Stage</th></tr><tr><td>Acme</td><td>Demo</td></tr><tr><td>Globex</td><td>Proposal</td></tr></table>',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "board",
|
|
144
|
+
label: "A board",
|
|
145
|
+
description: "Columns by stage, cards you drag",
|
|
146
|
+
preview:
|
|
147
|
+
'<div style="display:flex;gap:12px"><div style="padding:8px;border:1px solid;border-radius:8px">Demo<br>Acme</div><div style="padding:8px;border:1px solid;border-radius:8px">Proposal<br>Globex</div></div>',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "digest",
|
|
151
|
+
label: "A weekly digest",
|
|
152
|
+
description: "A short note in the chat every Monday",
|
|
153
|
+
// Plain text (Markdown, ASCII) is set as written, in mono.
|
|
154
|
+
preview: "## Leads this week\n\n- Acme: demo on Thursday\n- Globex: proposal sent\n- Initech: no reply yet",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
export default function AskUserQuestionPreviews() {
|
|
161
|
+
return <AskUserQuestion className="w-full max-w-120" questions={QUESTIONS} />;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Attach files
|
|
166
|
+
|
|
167
|
+
With `onAttachFiles`, Attach files (ghost, with a paperclip) sits beside Skip, and files dropped anywhere on the card attach too. While files are over it, the same FileDropArea as the Composer covers the card: “Drop files to attach”, with the question’s title under it. Files go to the question on screen and show under its answers in a small AttachmentGallery. A question with files waits for Next.
|
|
168
|
+
|
|
169
|
+
Example: `attach-files`
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
"use client";
|
|
173
|
+
|
|
174
|
+
import { useEffect, useRef, useState } from "react";
|
|
175
|
+
import { AskUserQuestion, type Question } from "@major-tech/ui/ask-user-question";
|
|
176
|
+
import { ATTACHMENT_STATUSES, type AttachmentItem } from "@major-tech/ui/attachment-gallery";
|
|
177
|
+
import { validateFiles } from "@major-tech/ui/file-upload";
|
|
178
|
+
|
|
179
|
+
const QUESTIONS: Question[] = [
|
|
180
|
+
{
|
|
181
|
+
id: "asset",
|
|
182
|
+
title: "You attached a 3D red warning triangle last time. What should I do with it?",
|
|
183
|
+
options: [
|
|
184
|
+
{
|
|
185
|
+
id: "page",
|
|
186
|
+
label: "Add an Illustrations page",
|
|
187
|
+
description: "Start a Foundations page for 3D illustrations: this asset as the first one, with when and how to use it.",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "errors",
|
|
191
|
+
label: "Use it in error states",
|
|
192
|
+
description: "Show it on the hub’s empty, error and 404 screens, and in the Lab when a check fails.",
|
|
193
|
+
},
|
|
194
|
+
{ id: "hero", label: "Hero decoration", description: "Put it in the Get started hero in place of the flat shapes." },
|
|
195
|
+
{ id: "nothing", label: "Nothing, just testing", description: "Leave the hub as it is." },
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: "more",
|
|
200
|
+
title: "Should I look for more assets like it?",
|
|
201
|
+
options: [
|
|
202
|
+
{ id: "yes", label: "Yes, a full set", description: "Empty, success and warning, in the same style" },
|
|
203
|
+
{ id: "no", label: "Only this one", description: "Keep the system to one illustration for now" },
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
/** The chat's limits: any type, up to 100 MB a file and 30 files a message. */
|
|
209
|
+
const MAX_FILES = 30;
|
|
210
|
+
const MAX_FILE_BYTES = 100 * 1024 * 1024;
|
|
211
|
+
|
|
212
|
+
/** Stands in for the product's upload: a second of "uploading", then the file is ready at its url. */
|
|
213
|
+
const UPLOAD_MS = 1000;
|
|
214
|
+
|
|
215
|
+
export default function AskUserQuestionAttachFiles() {
|
|
216
|
+
const [attachments, setAttachments] = useState<Record<string, AttachmentItem[]>>({});
|
|
217
|
+
const urls = useRef(new Set<string>());
|
|
218
|
+
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const created = urls.current;
|
|
221
|
+
|
|
222
|
+
return () => created.forEach((url) => URL.revokeObjectURL(url));
|
|
223
|
+
}, []);
|
|
224
|
+
|
|
225
|
+
const update = (questionId: string, change: (current: AttachmentItem[]) => AttachmentItem[]) =>
|
|
226
|
+
setAttachments((current) => ({ ...current, [questionId]: change(current[questionId] ?? []) }));
|
|
227
|
+
|
|
228
|
+
const upload = (questionId: string, ids: string[]) => {
|
|
229
|
+
const uploading = new Set(ids);
|
|
230
|
+
|
|
231
|
+
update(questionId, (current) =>
|
|
232
|
+
current.map((item) => (uploading.has(item.id) ? { ...item, status: ATTACHMENT_STATUSES.UPLOADING } : item))
|
|
233
|
+
);
|
|
234
|
+
setTimeout(() => {
|
|
235
|
+
update(questionId, (current) =>
|
|
236
|
+
current.map((item) => (uploading.has(item.id) ? { ...item, status: ATTACHMENT_STATUSES.DONE } : item))
|
|
237
|
+
);
|
|
238
|
+
}, UPLOAD_MS);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const toAttachment = (file: File): AttachmentItem => {
|
|
242
|
+
const url = URL.createObjectURL(file);
|
|
243
|
+
urls.current.add(url);
|
|
244
|
+
|
|
245
|
+
return { id: url, name: file.name, type: file.type, size: file.size, url, status: ATTACHMENT_STATUSES.UPLOADING };
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const attach = (questionId: string, files: File[]) => {
|
|
249
|
+
const { accepted, rejected } = validateFiles(files, {
|
|
250
|
+
maxSize: MAX_FILE_BYTES,
|
|
251
|
+
maxFiles: MAX_FILES,
|
|
252
|
+
attachedCount: attachments[questionId]?.length ?? 0,
|
|
253
|
+
});
|
|
254
|
+
const added = accepted.map(toAttachment);
|
|
255
|
+
const failed = rejected.map(
|
|
256
|
+
({ file, message }): AttachmentItem => ({
|
|
257
|
+
...toAttachment(file),
|
|
258
|
+
status: ATTACHMENT_STATUSES.ERROR,
|
|
259
|
+
error: message,
|
|
260
|
+
})
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
update(questionId, (current) => [...current, ...added, ...failed]);
|
|
264
|
+
upload(
|
|
265
|
+
questionId,
|
|
266
|
+
added.map(({ id }) => id)
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const remove = (questionId: string, id: string) =>
|
|
271
|
+
update(questionId, (current) => current.filter((item) => item.id !== id));
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<AskUserQuestion
|
|
275
|
+
className="w-full max-w-120"
|
|
276
|
+
questions={QUESTIONS}
|
|
277
|
+
attachments={attachments}
|
|
278
|
+
onAttachFiles={attach}
|
|
279
|
+
onRemoveAttachment={remove}
|
|
280
|
+
onRetryAttachment={(questionId, id) => upload(questionId, [id])}
|
|
281
|
+
/>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
- Use it when an answer is easier to show than to say: a screenshot, a sketch, a brief.
|
|
287
|
+
- The product checks the files with validateFiles, uploads the accepted ones and passes all of them back in `attachments` with their status: uploading, done, or failed with the reason. The card holds no files of its own.
|
|
288
|
+
- The card claims the drop, so dropped files don’t land in the composer too.
|
|
289
|
+
- Files alone count as an answer; the summary lists them under the question.
|
|
290
|
+
|
|
291
|
+
### After sending
|
|
292
|
+
|
|
293
|
+
The card folds into AskUserQuestionSummary: Your answers, each question with its answer under it, and “I’ll decide” in muted for a skipped one. Major then builds as usual, and its reply starts with what it used: “I went with your answers: Trend over time · My team · Date filter.”
|
|
294
|
+
|
|
295
|
+
Example: `after-sending`
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
"use client";
|
|
299
|
+
|
|
300
|
+
import {
|
|
301
|
+
ASK_USER_QUESTION_SUMMARY_STATUSES,
|
|
302
|
+
AskUserQuestionSummary,
|
|
303
|
+
type AskUserQuestionSummaryItem,
|
|
304
|
+
} from "@major-tech/ui/ask-user-question";
|
|
305
|
+
|
|
306
|
+
const ITEMS: AskUserQuestionSummaryItem[] = [
|
|
307
|
+
{ question: "What should it show first?", answer: "Trend over time" },
|
|
308
|
+
{ question: "Who will look at it?" },
|
|
309
|
+
{
|
|
310
|
+
question: "Anything else to include?",
|
|
311
|
+
answer: "Date filter, Export to CSV",
|
|
312
|
+
files: [{ name: "major-mark.svg", url: "/major-mark.svg" }],
|
|
313
|
+
},
|
|
314
|
+
];
|
|
315
|
+
|
|
316
|
+
export default function AskUserQuestionAfterSending() {
|
|
317
|
+
return (
|
|
318
|
+
<div className="flex w-full max-w-105 flex-col gap-space-16">
|
|
319
|
+
<AskUserQuestionSummary items={ITEMS} />
|
|
320
|
+
<AskUserQuestionSummary status={ASK_USER_QUESTION_SUMMARY_STATUSES.SKIPPED} />
|
|
321
|
+
<AskUserQuestionSummary status={ASK_USER_QUESTION_SUMMARY_STATUSES.IN_CHAT} />
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
- The summary is mostly rendered on its own: from history and in decision messages. It takes the questions and answers as text, with files as a name and a url (a file with no url yet shows but doesn't open); `summarizeAnswers` makes them from what `onSubmit` received.
|
|
328
|
+
- When the person wrote a new message instead, the summary says “Skipped. You sent a new message instead.”; when they answered in the composer, “Answered in chat”.
|
|
329
|
+
|
|
330
|
+
### Guidelines
|
|
331
|
+
|
|
332
|
+
Do:
|
|
333
|
+
|
|
334
|
+
- Ask about the outcome: “Who will look at it?”
|
|
335
|
+
- Keep answers to two to four words in sentence case.
|
|
336
|
+
- Ask two questions; three at most.
|
|
337
|
+
|
|
338
|
+
Don't:
|
|
339
|
+
|
|
340
|
+
- Ask about the implementation: “Which chart library?”
|
|
341
|
+
- Ask questions before a long, specific request: build it.
|
|
342
|
+
- Colour a picked row green or give it an outline.
|
|
343
|
+
|
|
344
|
+
## API
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
import { AskUserQuestion, AskUserQuestionSummary, summarizeAnswers, QUESTION_KINDS, ASK_USER_QUESTION_SUMMARY_STATUSES } from "@major-tech/ui/ask-user-question";
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### `<AskUserQuestion />`
|
|
351
|
+
|
|
352
|
+
Renders a `<div>`; every other `<div>` attribute goes on it.
|
|
353
|
+
|
|
354
|
+
| Prop | Type | Default | Description |
|
|
355
|
+
| --- | --- | --- | --- |
|
|
356
|
+
| `questions`* | `Question[]` | — | Two or three questions. |
|
|
357
|
+
| `onSubmit` | `(answers: QuestionAnswer[]) => void` | — | Called once with every answer when the last question is answered or skipped. |
|
|
358
|
+
| `onDraftChange` | `(answers: QuestionAnswer[]) => void` | — | Called on every change with the answers so far; skipped and unanswered questions are left out. |
|
|
359
|
+
| `attachments` | `Record<string, AttachmentItem[]>` | — | Files attached to each question, by question id, with their upload status. |
|
|
360
|
+
| `onAttachFiles` | `(questionId: string, files: File[]) => void` | — | Shows Attach files and takes dropped files. Upload them, then pass them in attachments. |
|
|
361
|
+
| `onRemoveAttachment` | `(questionId: string, attachmentId: string) => void` | — | Shows a remove button on each attached file. |
|
|
362
|
+
| `onRetryAttachment` | `(questionId: string, attachmentId: string) => void` | — | Shows Retry on a file whose upload failed and can be retried. |
|
|
363
|
+
| `accept` | `string` | — | Native accept string for Attach files: “image/*,.pdf”. |
|
|
364
|
+
|
|
365
|
+
`*` marks a required prop.
|
|
366
|
+
|
|
367
|
+
### `<AskUserQuestionSummary />`
|
|
368
|
+
|
|
369
|
+
Renders a `<div>`. The questions after they’re done.
|
|
370
|
+
|
|
371
|
+
| Prop | Type | Default | Description |
|
|
372
|
+
| --- | --- | --- | --- |
|
|
373
|
+
| `status` | `"sent" \| "skipped" \| "in-chat"` | `"sent"` | Sent lists the answers; skipped and in-chat say so in one line. |
|
|
374
|
+
| `items` | `AskUserQuestionSummaryItem[]` | — | The questions and their answers, for a sent card. |
|
|
375
|
+
| `onOpenFile` | `(file: { name: string; url?: string }) => void` | — | Opens a sent file the product's own way, for a link signed on demand. Left out, a picture opens in a larger preview and any other file in a new tab. |
|
|
376
|
+
|
|
377
|
+
### `Question`
|
|
378
|
+
|
|
379
|
+
| Prop | Type | Default | Description |
|
|
380
|
+
| --- | --- | --- | --- |
|
|
381
|
+
| `id`* | `string` | — | Matches QuestionAnswer.questionId. |
|
|
382
|
+
| `title`* | `string` | — | Short and about the outcome. |
|
|
383
|
+
| `kind` | `"one" \| "any"` | `"one"` | Pick one or Pick any. |
|
|
384
|
+
| `options`* | `{ id: string; label: string; description?: string; preview?: string }[]` | — | Two to four answers; Something else is added after them. preview is an HTML mockup or plain text. |
|
|
385
|
+
|
|
386
|
+
`*` marks a required prop.
|
|
387
|
+
|
|
388
|
+
### `QuestionAnswer`
|
|
389
|
+
|
|
390
|
+
| Prop | Type | Default | Description |
|
|
391
|
+
| --- | --- | --- | --- |
|
|
392
|
+
| `questionId`* | `string` | — | The question it answers. |
|
|
393
|
+
| `optionIds`* | `string[]` | — | The picked answers. |
|
|
394
|
+
| `other` | `string` | — | The typed Something else answer. |
|
|
395
|
+
| `attachments`* | `AttachmentItem[]` | — | The files attached to the question, as passed in attachments. |
|
|
396
|
+
| `skipped`* | `boolean` | — | Skipped or left unanswered: Major decides. |
|
|
397
|
+
|
|
398
|
+
`*` marks a required prop.
|
|
399
|
+
|
|
400
|
+
### `AskUserQuestionSummaryItem`
|
|
401
|
+
|
|
402
|
+
| Prop | Type | Default | Description |
|
|
403
|
+
| --- | --- | --- | --- |
|
|
404
|
+
| `question`* | `string` | — | The question’s title. |
|
|
405
|
+
| `answer` | `string` | — | The answer as text; a Pick any question’s labels joined by “, ”. Left out when skipped. |
|
|
406
|
+
| `files` | `{ name: string; url?: string }[]` | — | The attached files. A file without a url shows but doesn't open. |
|
|
407
|
+
|
|
408
|
+
`*` marks a required prop.
|
|
409
|
+
|
|
410
|
+
### `summarizeAnswers`
|
|
411
|
+
|
|
412
|
+
| Prop | Type | Default | Description |
|
|
413
|
+
| --- | --- | --- | --- |
|
|
414
|
+
| `(questions, answers)` | `AskUserQuestionSummaryItem[]` | — | The summary’s items from the questions and what onSubmit received. |
|
|
415
|
+
|
|
416
|
+
### `QUESTION_KINDS · ASK_USER_QUESTION_SUMMARY_STATUSES`
|
|
417
|
+
|
|
418
|
+
| Prop | Type | Default | Description |
|
|
419
|
+
| --- | --- | --- | --- |
|
|
420
|
+
| `ONE · ANY` | `QuestionKind` | — | The kinds of question. |
|
|
421
|
+
| `SENT · SKIPPED · IN_CHAT` | `AskUserQuestionSummaryStatus` | — | The summary’s states. |
|
|
422
|
+
|
|
423
|
+
### Accessibility
|
|
424
|
+
|
|
425
|
+
- The card is a group named “Question 1 of 3”; the answers are a radiogroup or a group labelled by the question, each row a radio or checkbox with `aria-checked`. Something else is one of them until it opens: then it’s a text field named Something else, after them.
|
|
426
|
+
- ↑ ↓ move between answers, the Something else field included; ← → between questions; Enter picks, and elsewhere on the card does what Next does; Esc closes an empty Something else.
|
|
427
|
+
- After moving to another question, focus goes to its first answer. Closing an empty Something else gives focus back to its row. After sending from the card, focus goes to the summary.
|
|
428
|
+
- The pager buttons are named Previous question and Next question; the icons are decorative.
|
|
429
|
+
- A preview frame is named after its answer; a sent summary is named “Answers sent”.
|