@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 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-gallery.js","sourceRoot":"","sources":["../../src/components/attachment-gallery.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL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,oBAAoB,aACnE,eAAK,SAAS,EAAC,8CAA8C,aAC3D,KAAC,WAAW,IAAC,SAAS,EAAC,UAAU,YAAE,OAAO,CAAC,IAAI,GAAe,EAC7D,WAAW,IAAI,CACd,gBAAM,SAAS,EAAC,6BAA6B,aAC1C,YAAY,GAAG,CAAC,UAAM,MAAM,CAAC,MAAM,IAC/B,CACR,IACG,EACN,eAAK,SAAS,EAAC,UAAU,aACvB,cAAK,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,EAAC,qDAAqD,GAAG,EAE3G,WAAW,IAAI,CACd,8BACE,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,OAAO,EAChC,IAAI,EAAE,YAAY,CAAC,IAAI,gBACZ,gBAAgB,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAC9B,SAAS,EAAC,wEAAwE,YAElF,KAAC,WAAW,KAAG,GACR,EACT,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,OAAO,EAChC,IAAI,EAAE,YAAY,CAAC,IAAI,gBACZ,YAAY,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAC7B,SAAS,EAAC,yEAAyE,YAEnF,KAAC,YAAY,KAAG,GACT,IACR,CACJ,IACG,IACQ,CACjB,GACM,IACR,CACJ,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport {\n Children,\n createContext,\n isValidElement,\n useContext,\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport {\n ChevronLeft,\n ChevronRight,\n CircleAlert,\n Clock,\n File,\n FileArchive,\n FileAudio,\n FileCode,\n FileImage,\n FileSpreadsheet,\n FileText,\n FileVideo,\n RotateCw,\n X,\n} from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { BUTTON_SIZES, BUTTON_VARIANTS, Button } from \"./button.tsx\";\nimport { Dialog, DialogContent, DialogTitle, DIALOG_SIZES } from \"./dialog.tsx\";\nimport { formatFileSize } from \"./file-upload.tsx\";\nimport { ScrollShadows, type ScrollShadowsProps } from \"./scroll-shadows.tsx\";\nimport { Spinner } from \"./spinner.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip.tsx\";\n\n/** The upload lifecycle, named as in shadcn's Attachment. */\nexport const ATTACHMENT_STATUSES = {\n /** Picked but not sent yet: \"Ready to upload\", a clock. */\n IDLE: \"idle\",\n /** Uploading: \"Uploading · 64%\", a spinner or a progress bar; the name shimmers. It can't be opened yet. */\n UPLOADING: \"uploading\",\n /** Uploaded, Major is reading it: \"Processing…\"; the name shimmers. */\n PROCESSING: \"processing\",\n /** Rejected or failed: a danger border, the reason, and Retry when it can be retried. */\n ERROR: \"error\",\n /** Uploaded: the type and size (\"PDF · 1.8 MB\"); opens on click. */\n DONE: \"done\",\n} as const;\n\nexport type AttachmentStatus = (typeof ATTACHMENT_STATUSES)[keyof typeof ATTACHMENT_STATUSES];\n\nexport const ATTACHMENT_GALLERY_SIZES = {\n /** 64px tiles: in sent messages (the person's and Major's) and under the answers in AskUserQuestion. Text only in the tooltip. */\n SM: \"sm\",\n /** 120px tiles: the composer, where files are still being added. */\n MD: \"md\",\n} as const;\n\nexport type AttachmentGallerySize = (typeof ATTACHMENT_GALLERY_SIZES)[keyof typeof ATTACHMENT_GALLERY_SIZES];\n\nexport const ATTACHMENT_MEDIA_VARIANTS = {\n /** A file-type or state icon. */\n ICON: \"icon\",\n /** An <img> that fills the tile. */\n IMAGE: \"image\",\n} as const;\n\nexport type AttachmentMediaVariant = (typeof ATTACHMENT_MEDIA_VARIANTS)[keyof typeof ATTACHMENT_MEDIA_VARIANTS];\n\nexport interface AttachmentItem {\n id: string;\n /** The file name: \"brief.pdf\". Shown on file tiles and as the image's alt text. */\n name: string;\n /** Where the file lives: a local preview while it uploads, then the uploaded file. Images show it; files open it. */\n url?: string;\n /** MIME type: \"image/png\". Without it, the name's extension tells an image from a file. */\n type?: string;\n /** File size in bytes: shown when done, \"PDF · 1.8 MB\". */\n size?: number;\n /** Default: done. */\n status?: AttachmentStatus;\n /** Upload progress, 0–100. Without it, an uploading tile shows a spinner. */\n progress?: number;\n /** Why it failed, in a few words: \"Larger than 100 MB\", \"Upload failed. Try again.\". */\n error?: string;\n /** The upload failed for a reason that can pass (the network): shows Retry. Leave it out for a file that's too large. */\n isRetryable?: boolean;\n /** Replaces the status line: \"Reading 12 pages…\". */\n description?: string;\n}\n\nconst IMAGE_EXTENSION = /\\.(avif|gif|jpe?g|png|svg|webp)$/i;\n\n/** An image shows its picture; anything else shows an icon, its name and its status line. */\nexport const isImageAttachment = ({ type, name }: Pick<AttachmentItem, \"type\" | \"name\">) =>\n type ? type.startsWith(\"image/\") : IMAGE_EXTENSION.test(name);\n\n/** A done image with a picture to show: it opens in the gallery's preview, and the preview flips through these. */\nconst checkIfPreviewable = (item: AttachmentItem) =>\n (item.status ?? ATTACHMENT_STATUSES.DONE) === ATTACHMENT_STATUSES.DONE && isImageAttachment(item) && Boolean(item.url);\n\n/** Uploading or processing: send waits for it. */\nexport const isAttachmentBusy = ({ status }: Pick<AttachmentItem, \"status\">) =>\n status === ATTACHMENT_STATUSES.UPLOADING || status === ATTACHMENT_STATUSES.PROCESSING;\n\n/** 512 → \"512 B\", 840_000 → \"820 KB\", 1_887_437 → \"1.8 MB\". The same sizes FileUpload and validateFiles print. */\nexport { formatFileSize };\n\n/** \"brief.final.pdf\" → \"PDF\"; no extension → the MIME subtype, or \"FILE\". */\nconst getExtension = ({ name, type }: Pick<AttachmentItem, \"name\" | \"type\">) => {\n const fromName = /\\.([a-z0-9]{1,8})$/i.exec(name)?.[1];\n const fromType = type?.split(\"/\")[1]?.split(/[+.;-]/)[0];\n\n return (fromName ?? fromType ?? \"file\").toUpperCase();\n};\n\nconst clampProgress = (progress: number) => Math.round(Math.max(0, Math.min(100, progress)));\n\n/** The line under the name, in shadcn's words: what the file is doing now. */\nexport function getAttachmentStatusLine(item: AttachmentItem) {\n if (item.description) {\n return item.description;\n }\n\n switch (item.status ?? ATTACHMENT_STATUSES.DONE) {\n case ATTACHMENT_STATUSES.IDLE:\n return \"Ready to upload\";\n case ATTACHMENT_STATUSES.UPLOADING:\n return item.progress === undefined ? \"Uploading…\" : `Uploading · ${clampProgress(item.progress)}%`;\n case ATTACHMENT_STATUSES.PROCESSING:\n return \"Processing…\";\n case ATTACHMENT_STATUSES.ERROR:\n return item.error ?? \"Upload failed. Try again.\";\n default:\n return item.size === undefined ? getExtension(item) : `${getExtension(item)} · ${formatFileSize(item.size)}`;\n }\n}\n\nconst ICON_BY_EXTENSION: [RegExp, ReactNode][] = [\n [/^(pdf|docx?|md|txt|rtf|odt|pages)$/i, <FileText key=\"text\" />],\n [/^(csv|tsv|xlsx?|ods|numbers)$/i, <FileSpreadsheet key=\"sheet\" />],\n [/^(js|jsx|ts|tsx|json|html?|css|py|rb|go|rs|java|sql|ya?ml|xml|sh)$/i, <FileCode key=\"code\" />],\n [/^(zip|rar|7z|tar|gz)$/i, <FileArchive key=\"archive\" />],\n [/^(mp4|mov|webm|avi|mkv)$/i, <FileVideo key=\"video\" />],\n [/^(mp3|wav|m4a|ogg|flac)$/i, <FileAudio key=\"audio\" />],\n [/^(png|jpe?g|gif|webp|avif|svg|heic)$/i, <FileImage key=\"image\" />],\n];\n\nconst getFileIcon = (extension: string) =>\n ICON_BY_EXTENSION.find(([pattern]) => pattern.test(extension))?.[1] ?? <File />;\n\n/* ---------------------------------------------------------------------------------------------------------------- */\n/* Parts */\n/* ---------------------------------------------------------------------------------------------------------------- */\n\ninterface AttachmentContextValue {\n status: AttachmentStatus;\n size: AttachmentGallerySize;\n isImage: boolean;\n}\n\nconst AttachmentContext = createContext<AttachmentContextValue>({\n status: ATTACHMENT_STATUSES.DONE,\n size: ATTACHMENT_GALLERY_SIZES.MD,\n isImage: false,\n});\n\nconst useAttachment = () => useContext(AttachmentContext);\n\nconst isBusyStatus = (status: AttachmentStatus) => isAttachmentBusy({ status });\n\nexport interface AttachmentGroupProps extends ComponentProps<\"ul\"> {\n /** Default: \"Attached files\". */\n \"aria-label\"?: string;\n}\n\n/**\n * One row of tiles that scrolls sideways when it doesn't fit: snapping to each tile, with ScrollShadows' fade on the\n * side that has more.\n */\nexport function AttachmentGroup({ className, \"aria-label\": label = \"Attached files\", ...props }: AttachmentGroupProps) {\n return (\n <ScrollShadows\n // The scroller is the list itself (`render`), so its props are the list's.\n {...(props as Omit<ScrollShadowsProps, \"render\">)}\n render={<ul />}\n data-slot=\"attachment-group\"\n aria-label={label}\n // The top and right padding keep the corner buttons visible; the negative margin takes the top padding back,\n // so spacing set from outside stays exact.\n className={cn(\n \"m-0 -mt-space-10 flex list-none snap-x snap-proximity gap-space-8 overflow-y-hidden overscroll-x-contain p-0 pt-space-10 pr-space-10 [scrollbar-width:thin]\",\n className\n )}\n />\n );\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, node: T | null) {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n}\n\nconst TILE_SIZE_CLASSES = {\n [ATTACHMENT_GALLERY_SIZES.SM]: \"size-16 items-center justify-center gap-space-4 p-space-6\",\n [ATTACHMENT_GALLERY_SIZES.MD]: \"size-30 gap-space-6 p-space-10\",\n} satisfies Record<AttachmentGallerySize, string>;\n\nexport interface AttachmentProps extends ComponentProps<\"li\"> {\n /** Default: done. */\n status?: AttachmentStatus;\n /** Default: md. */\n size?: AttachmentGallerySize;\n}\n\n/**\n * One tile. Its media, content and trigger sit inside the square; AttachmentActions hang off its top-right corner.\n * Only the picture is clipped to the rounded square, so the trigger's hover border and the actions stay visible.\n */\nexport function Attachment({\n status = ATTACHMENT_STATUSES.DONE,\n size = ATTACHMENT_GALLERY_SIZES.MD,\n className,\n children,\n ...props\n}: AttachmentProps) {\n // A picture hides the text (it stays for screen readers).\n const isImage = Children.toArray(children).some(\n (child) =>\n isValidElement<AttachmentMediaProps>(child) &&\n child.type === AttachmentMedia &&\n child.props.variant === ATTACHMENT_MEDIA_VARIANTS.IMAGE\n );\n\n return (\n <AttachmentContext.Provider value={{ status, size, isImage }}>\n <li\n data-slot=\"attachment\"\n data-status={status}\n data-size={size}\n // Its own stacking context: the trigger and the actions stay under a drop field laid over the box.\n className={cn(\"group/file relative isolate shrink-0 snap-start\", className)}\n {...props}\n >\n <div\n data-slot=\"attachment-tile\"\n className={cn(\n \"relative flex flex-col rounded-lg border bg-secondary text-left\",\n TILE_SIZE_CLASSES[size],\n status === ATTACHMENT_STATUSES.ERROR ? \"border-danger\" : \"border-line\"\n )}\n >\n {children}\n </div>\n </li>\n </AttachmentContext.Provider>\n );\n}\n\nexport interface AttachmentMediaProps extends ComponentProps<\"span\"> {\n /** Default: icon. */\n variant?: AttachmentMediaVariant;\n}\n\n/** The picture (variant image, an <img> inside) or the icon: the file's type, or the state while it isn't done. */\nexport function AttachmentMedia({ variant = ATTACHMENT_MEDIA_VARIANTS.ICON, className, ...props }: AttachmentMediaProps) {\n const { status, size } = useAttachment();\n const isDone = status === ATTACHMENT_STATUSES.DONE;\n const isFailed = status === ATTACHMENT_STATUSES.ERROR;\n\n if (variant === ATTACHMENT_MEDIA_VARIANTS.IMAGE) {\n return (\n <span\n data-slot=\"attachment-media\"\n data-variant={variant}\n className={cn(\n // Inherits the tile's radius: the picture is the one thing clipped to the rounded square.\n \"absolute inset-0 block overflow-hidden rounded-[inherit] [&_img]:block [&_img]:size-full [&_img]:object-cover\",\n !isDone && \"opacity-40\",\n className\n )}\n {...props}\n />\n );\n }\n\n return (\n <span\n data-slot=\"attachment-media\"\n data-variant={variant}\n className={cn(\n \"flex shrink-0 text-muted [&_svg]:shrink-0\",\n size === ATTACHMENT_GALLERY_SIZES.SM ? \"[&_svg]:size-5\" : \"[&_svg]:size-4\",\n isFailed && \"text-danger\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The state's icon centred on a picture, or on a small tile's face. */\nexport function AttachmentOverlay({ className, ...props }: ComponentProps<\"span\">) {\n const { status } = useAttachment();\n\n return (\n <span\n data-slot=\"attachment-overlay\"\n className={cn(\n \"pointer-events-none absolute inset-0 grid place-items-center text-ink-2 [&_svg]:size-5\",\n status === ATTACHMENT_STATUSES.ERROR && \"text-danger\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The name and status line. Read by screen readers everywhere; seen only on md file tiles. */\nexport function AttachmentContent({ className, ...props }: ComponentProps<\"span\">) {\n const { size, isImage } = useAttachment();\n const isHidden = size === ATTACHMENT_GALLERY_SIZES.SM || isImage;\n\n return (\n <span\n data-slot=\"attachment-content\"\n className={cn(isHidden ? \"sr-only\" : \"flex min-h-0 flex-1 flex-col gap-space-2 overflow-hidden\", className)}\n {...props}\n />\n );\n}\n\n/** The file name. Shimmers while it uploads or processes. */\nexport function AttachmentTitle({ className, ...props }: ComponentProps<\"span\">) {\n const { status } = useAttachment();\n\n return (\n <span\n data-slot=\"attachment-title\"\n className={cn(\n \"line-clamp-3 min-h-0 text-small break-all text-ink\",\n isBusyStatus(status) && \"shimmer-text\",\n className\n )}\n {...props}\n />\n );\n}\n\n/** The status line: \"Uploading · 64%\", \"PDF · 1.8 MB\", or why it failed. */\nexport function AttachmentDescription({ className, ...props }: ComponentProps<\"span\">) {\n const { status } = useAttachment();\n\n return (\n <span\n data-slot=\"attachment-description\"\n className={cn(\n \"mt-auto line-clamp-2 text-2xs text-muted\",\n status === ATTACHMENT_STATUSES.ERROR && \"text-danger\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface AttachmentProgressProps extends ComponentProps<\"span\"> {\n /** 0–100. */\n value: number;\n}\n\n/** A 4px bar at the bottom of the tile, where the tile has no room for \"Uploading · 64%\". */\nexport function AttachmentProgress({ value, className, ...props }: AttachmentProgressProps) {\n const percent = clampProgress(value);\n\n return (\n <span\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={percent}\n data-slot=\"attachment-progress\"\n className={cn(\n \"pointer-events-none absolute inset-x-space-6 bottom-space-6 h-1 overflow-hidden rounded-full bg-line\",\n className\n )}\n {...props}\n >\n <span\n className=\"block h-full rounded-full bg-link transition-[width] duration-160\"\n style={{ width: `${percent}%` }}\n />\n </span>\n );\n}\n\nexport type AttachmentTriggerProps = useRender.ComponentProps<\"button\">;\n\n/**\n * Covers the whole tile and opens it: a button by default, a link with `render`. It sits under the actions, so both\n * stay clickable and focusable. Name it (aria-label): it has no text of its own.\n */\nexport function AttachmentTrigger({ render, className, ref, ...props }: AttachmentTriggerProps) {\n return useRender({\n defaultTagName: \"button\",\n render,\n state: { slot: \"attachment-trigger\" },\n ref,\n props: mergeProps<\"button\">(\n {\n ...(render ? {} : { type: \"button\" as const }),\n className: cn(\n \"absolute -inset-px z-10 cursor-pointer rounded-lg border border-transparent bg-transparent p-0 outline-none transition-[border-color] duration-120 hover:border-faint focus-visible:border-faint focus-visible:ring-1 focus-visible:ring-faint focus-visible:ring-inset\",\n className\n ),\n },\n props\n ),\n });\n}\n\n/** The buttons on a tile's top-right corner: shown on hover or focus, always on touch and on a failed tile. */\nexport function AttachmentActions({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"attachment-actions\"\n className={cn(\n \"absolute -top-2 -right-2 z-20 flex gap-space-2 opacity-0 transition-opacity duration-120 group-hover/file:opacity-100 group-data-[status=error]/file:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface AttachmentActionProps extends ComponentProps<\"button\"> {\n /** Say the action and the file: \"Remove brief.pdf\". */\n \"aria-label\": string;\n}\n\n/** A 20px round icon button. */\nexport function AttachmentAction({ className, ...props }: AttachmentActionProps) {\n return (\n <button\n type=\"button\"\n data-slot=\"attachment-action\"\n className={cn(\n \"relative grid size-5 cursor-pointer place-items-center rounded-full border border-line bg-surface p-0 text-muted shadow-card outline-none after:absolute after:-inset-0.5 after:content-[''] hover:text-ink focus-visible:ring-2 focus-visible:ring-faint [&_svg]:size-3\",\n className\n )}\n {...props}\n />\n );\n}\n\n/* ---------------------------------------------------------------------------------------------------------------- */\n/* The gallery */\n/* ---------------------------------------------------------------------------------------------------------------- */\n\nconst EXTENSION_BADGE_CLASS = \"rounded-sm bg-surface px-space-4 text-2xs font-medium text-muted\";\n\n/** The icon a tile shows for its state: the clock, a spinner, the alert, or the file's own icon. */\nfunction getStateIcon(item: AttachmentItem, status: AttachmentStatus, size: AttachmentGallerySize, extension: string) {\n // Where there's no text to shimmer (small tiles), processing spins like an upload of unknown progress.\n const isSpinning =\n (status === ATTACHMENT_STATUSES.UPLOADING && (size === ATTACHMENT_GALLERY_SIZES.MD || item.progress === undefined)) ||\n (status === ATTACHMENT_STATUSES.PROCESSING && size === ATTACHMENT_GALLERY_SIZES.SM);\n\n if (isSpinning) {\n return <Spinner aria-hidden=\"true\" className=\"text-ink-2\" />;\n }\n\n if (status === ATTACHMENT_STATUSES.IDLE) {\n return <Clock aria-hidden=\"true\" />;\n }\n\n if (status === ATTACHMENT_STATUSES.ERROR) {\n return <CircleAlert aria-hidden=\"true\" />;\n }\n\n return getFileIcon(extension);\n}\n\n/** The icon on a dimmed picture while it isn't done; nothing when it is (or when the bar shows progress). */\nfunction getImageOverlayIcon(item: AttachmentItem, status: AttachmentStatus) {\n switch (status) {\n case ATTACHMENT_STATUSES.IDLE:\n return <Clock aria-hidden=\"true\" />;\n case ATTACHMENT_STATUSES.UPLOADING:\n return item.progress === undefined ? <Spinner aria-hidden=\"true\" /> : null;\n case ATTACHMENT_STATUSES.PROCESSING:\n return <Spinner aria-hidden=\"true\" />;\n case ATTACHMENT_STATUSES.ERROR:\n return <CircleAlert aria-hidden=\"true\" />;\n default:\n return null;\n }\n}\n\ninterface TileProps {\n item: AttachmentItem;\n size: AttachmentGallerySize;\n onOpenImage: (item: AttachmentItem) => void;\n onOpen?: (item: AttachmentItem) => void;\n onRemove?: (id: string) => void;\n onRetry?: (id: string) => void;\n renderActions?: (item: AttachmentItem) => ReactNode;\n}\n\n/** One file built from the parts: the face for its kind and size, the state on top, the trigger and the actions. */\nfunction GalleryTile({ item, size, onOpenImage, onOpen, onRemove, onRetry, renderActions }: TileProps) {\n const status = item.status ?? ATTACHMENT_STATUSES.DONE;\n const isDone = status === ATTACHMENT_STATUSES.DONE;\n const isFailed = status === ATTACHMENT_STATUSES.ERROR;\n const isImage = isImageAttachment(item) && Boolean(item.url);\n const isSmall = size === ATTACHMENT_GALLERY_SIZES.SM;\n const extension = getExtension(item);\n const statusLine = getAttachmentStatusLine(item);\n const hasBar = status === ATTACHMENT_STATUSES.UPLOADING && item.progress !== undefined && (isSmall || isImage);\n // A file the product opens itself needs no url: its link is signed when it's opened.\n const isOpenable = isDone && (Boolean(item.url) || (Boolean(onOpen) && !isImageAttachment(item)));\n // The name and status show on hover wherever the tile doesn't print them: small tiles and pictures.\n const isTooltipVisible = isSmall || isImage;\n const customActions = renderActions?.(item);\n const hasRetry = Boolean(onRetry && isFailed && item.isRetryable);\n const hasActions = Boolean(customActions || hasRetry || onRemove);\n\n let trigger: ReactNode;\n\n if (isOpenable && isImage) {\n trigger = (\n <AttachmentTrigger aria-label={`Open ${item.name}`} onClick={() => onOpenImage(item)} className=\"cursor-zoom-in\" />\n );\n } else if (isOpenable && onOpen) {\n trigger = <AttachmentTrigger aria-label={`Open ${item.name}`} onClick={() => onOpen(item)} />;\n } else if (isOpenable) {\n trigger = (\n <AttachmentTrigger\n render={<a href={item.url} target=\"_blank\" rel=\"noreferrer\" />}\n aria-label={`Open ${item.name}`}\n />\n );\n } else {\n // Not openable yet (or never): still focusable, so the name and the state are reachable from the keyboard.\n trigger = (\n <AttachmentTrigger\n render={<span />}\n tabIndex={0}\n role=\"img\"\n aria-label={`${item.name}: ${statusLine}`}\n aria-busy={isBusyStatus(status) || undefined}\n className=\"cursor-default hover:border-transparent\"\n />\n );\n }\n\n if (isTooltipVisible) {\n trigger = (\n <Tooltip>\n <TooltipTrigger render={trigger} />\n <TooltipContent side=\"top\" className=\"max-w-60 flex-col items-start gap-0 break-all whitespace-normal\">\n <span className=\"block\">{item.name}</span>\n <span className=\"block opacity-75\">{statusLine}</span>\n </TooltipContent>\n </Tooltip>\n );\n }\n\n const overlayIcon = isImage ? getImageOverlayIcon(item, status) : null;\n\n return (\n <Attachment status={status} size={size}>\n {isImage ? (\n <AttachmentMedia variant={ATTACHMENT_MEDIA_VARIANTS.IMAGE}>\n <img src={item.url} alt={item.name} />\n </AttachmentMedia>\n ) : (\n <AttachmentMedia>{getStateIcon(item, status, size, extension)}</AttachmentMedia>\n )}\n {isSmall && !isImage && <span className={EXTENSION_BADGE_CLASS}>{extension}</span>}\n {/* The trigger's label already says the name (and the status, until it's done). */}\n <AttachmentContent aria-hidden=\"true\">\n <AttachmentTitle>{item.name}</AttachmentTitle>\n <AttachmentDescription>{statusLine}</AttachmentDescription>\n </AttachmentContent>\n {overlayIcon && <AttachmentOverlay>{overlayIcon}</AttachmentOverlay>}\n {hasBar && <AttachmentProgress value={item.progress ?? 0} aria-label={`Uploading ${item.name}`} />}\n {trigger}\n {hasActions && (\n <AttachmentActions>\n {customActions}\n {hasRetry && (\n <AttachmentAction aria-label={`Retry ${item.name}`} onClick={() => onRetry?.(item.id)}>\n <RotateCw />\n </AttachmentAction>\n )}\n {onRemove && (\n <AttachmentAction aria-label={`Remove ${item.name}`} onClick={() => onRemove(item.id)}>\n <X />\n </AttachmentAction>\n )}\n </AttachmentActions>\n )}\n </Attachment>\n );\n}\n\nexport interface AttachmentGalleryProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n items: AttachmentItem[];\n /** Default: md. */\n size?: AttachmentGallerySize;\n /** Shows a remove button on each tile. Leave it out for sent files. */\n onRemove?: (id: string) => void;\n /** Shows Retry on failed tiles marked isRetryable. */\n onRetry?: (id: string) => void;\n /** More buttons for a tile, before Retry and Remove: AttachmentAction elements. */\n renderActions?: (item: AttachmentItem) => ReactNode;\n /**\n * Opens a file that isn't an image the product's own way, in place of the new tab: for a link that is signed on\n * demand, or a download. Such a file opens without a `url`. Images keep the preview.\n */\n onOpen?: (item: AttachmentItem) => void;\n}\n\n/**\n * Attached files as tiles, built from the Attachment parts: an image fills its tile and opens a larger preview, which\n * flips through the gallery's images; any other file shows its icon, name and status line and opens the file. The same\n * gallery in the composer (md), under AskUserQuestion's answers and in sent messages (sm).\n */\nexport function AttachmentGallery({\n items,\n size = ATTACHMENT_GALLERY_SIZES.MD,\n onRemove,\n onRetry,\n renderActions,\n onOpen,\n className,\n ...props\n}: AttachmentGalleryProps) {\n // By id, not by item: a preview whose image goes away (removed, or failed on a retry) closes.\n const [previewId, setPreviewId] = useState<string | null>(null);\n const rootRef = useRef<HTMLDivElement>(null);\n // The tile that last held focus. A press that takes its button away (Remove, or Retry turning into a spinner)\n // hands focus to the tile now in that place, instead of dropping it to the page.\n const focusedTileIndex = useRef<number | null>(null);\n\n const listTiles = () => [...(rootRef.current?.querySelectorAll<HTMLElement>(\"[data-slot=attachment]\") ?? [])];\n\n const setRootNode = (node: HTMLDivElement | null) => {\n rootRef.current = node;\n assignRef(props.ref, node);\n };\n\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n props.onFocus?.(event);\n const tile = (event.target as HTMLElement).closest<HTMLElement>(\"[data-slot=attachment]\");\n focusedTileIndex.current = tile ? listTiles().indexOf(tile) : null;\n };\n\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n props.onBlur?.(event);\n // Focus moved on by the person (a click elsewhere, Tab out): nothing to restore.\n if (!event.currentTarget.contains(event.relatedTarget)) focusedTileIndex.current = null;\n };\n\n useEffect(() => {\n const index = focusedTileIndex.current;\n if (index === null || document.activeElement !== document.body) return;\n const tiles = listTiles();\n const tile = tiles[Math.min(index, tiles.length - 1)];\n tile?.querySelector<HTMLElement>(\"button:not(:disabled), a[href], [tabindex='0']\")?.focus();\n }, [items]);\n\n if (items.length === 0) {\n return null;\n }\n\n const images = items.filter(checkIfPreviewable);\n const previewIndex = images.findIndex((item) => item.id === previewId);\n const preview = images[previewIndex];\n const hasSiblings = images.length > 1;\n\n const handleOpenImage = (item: AttachmentItem) => setPreviewId(item.id);\n\n // Round the set: the last image's next is the first.\n const turnPreview = (step: number) => {\n setPreviewId(images[(previewIndex + step + images.length) % images.length].id);\n };\n\n const handlePreviewKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!hasSiblings || (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\")) return;\n event.preventDefault();\n turnPreview(event.key === \"ArrowLeft\" ? -1 : 1);\n };\n\n return (\n <>\n <div\n data-slot=\"attachment-gallery\"\n data-size={size}\n className={cn(\"min-w-0\", className)}\n {...props}\n ref={setRootNode}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n <AttachmentGroup>\n {items.map((item) => (\n <GalleryTile\n key={item.id}\n item={item}\n size={size}\n onOpenImage={handleOpenImage}\n onOpen={onOpen}\n onRemove={onRemove}\n onRetry={onRetry}\n renderActions={renderActions}\n />\n ))}\n </AttachmentGroup>\n </div>\n\n <Dialog open={preview !== undefined} onOpenChange={(open) => !open && setPreviewId(null)}>\n {preview && (\n <DialogContent size={DIALOG_SIZES.XL} onKeyDown={handlePreviewKeyDown}>\n <div className=\"flex min-w-0 items-baseline gap-space-8 pr-8\">\n <DialogTitle className=\"truncate\">{preview.name}</DialogTitle>\n {hasSiblings && (\n <span className=\"shrink-0 text-ui text-muted\">\n {previewIndex + 1} of {images.length}\n </span>\n )}\n </div>\n <div className=\"relative\">\n <img src={preview.url} alt={preview.name} className=\"block max-h-[70vh] w-full rounded-lg object-contain\" />\n {/* Carousel's arrows: outline circles on the picture's edges; the left and right keys turn it too. */}\n {hasSiblings && (\n <>\n <Button\n variant={BUTTON_VARIANTS.OUTLINE}\n size={BUTTON_SIZES.ICON}\n aria-label=\"Previous image\"\n onClick={() => turnPreview(-1)}\n className=\"absolute top-1/2 left-space-8 -translate-y-1/2 rounded-full bg-surface\"\n >\n <ChevronLeft />\n </Button>\n <Button\n variant={BUTTON_VARIANTS.OUTLINE}\n size={BUTTON_SIZES.ICON}\n aria-label=\"Next image\"\n onClick={() => turnPreview(1)}\n className=\"absolute top-1/2 right-space-8 -translate-y-1/2 rounded-full bg-surface\"\n >\n <ChevronRight />\n </Button>\n </>\n )}\n </div>\n </DialogContent>\n )}\n </Dialog>\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
export declare const AVATAR_SIZES: {
|
|
5
|
+
/** 18px, the default: rows, cards, mentions. */
|
|
6
|
+
readonly XS: "xs";
|
|
7
|
+
/** 22px. */
|
|
8
|
+
readonly SM: "sm";
|
|
9
|
+
/** 28px: member lists, share dialogs. */
|
|
10
|
+
readonly MD: "md";
|
|
11
|
+
/** 32px. */
|
|
12
|
+
readonly LG: "lg";
|
|
13
|
+
};
|
|
14
|
+
export declare const AVATAR_TONES: {
|
|
15
|
+
/** The signed-in person. */
|
|
16
|
+
readonly SELF: "self";
|
|
17
|
+
/** Everyone else. */
|
|
18
|
+
readonly MUTED: "muted";
|
|
19
|
+
/** The "+N" in a stack. */
|
|
20
|
+
readonly MORE: "more";
|
|
21
|
+
};
|
|
22
|
+
declare const avatarVariants: (props?: ({
|
|
23
|
+
size?: "sm" | "md" | "lg" | "xs" | null | undefined;
|
|
24
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
25
|
+
/** A person: a disc holding an `AvatarImage` and the `AvatarFallback` initials. 18px by default. */
|
|
26
|
+
export declare function Avatar({ className, size, ...props }: AvatarPrimitive.Root.Props & VariantProps<typeof avatarVariants>): import("react").JSX.Element;
|
|
27
|
+
/** The photo. Until it loads, or if it fails, the fallback shows. */
|
|
28
|
+
export declare function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props): import("react").JSX.Element;
|
|
29
|
+
declare const avatarFallbackVariants: (props?: ({
|
|
30
|
+
tone?: "muted" | "self" | "more" | null | undefined;
|
|
31
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
32
|
+
/** Initials on a tinted disc: `self` for you, `muted` for everyone else, `more` for the "+N". */
|
|
33
|
+
export declare function AvatarFallback({ className, tone, ...props }: AvatarPrimitive.Fallback.Props & VariantProps<typeof avatarFallbackVariants>): import("react").JSX.Element;
|
|
34
|
+
/** Overlaps by 6px with a 2px ring in the panel colour; collapse more than three into "+N". */
|
|
35
|
+
export declare function AvatarGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/components/avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,YAAY;IACvB,gDAAgD;;IAEhD,YAAY;;IAEZ,yCAAyC;;IAEzC,YAAY;;CAEJ,CAAC;AAEX,eAAO,MAAM,YAAY;IACvB,4BAA4B;;IAE5B,qBAAqB;;IAErB,2BAA2B;;CAEnB,CAAC;AAGX,QAAA,MAAM,cAAc;;8EAUlB,CAAC;AAEH,oGAAoG;AACpG,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,+BAElE;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,+BAE/E;AAED,QAAA,MAAM,sBAAsB;;8EAS1B,CAAC;AAEH,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,sBAAsB,CAAC,+BAQ9E;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAQzE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export const AVATAR_SIZES = {
|
|
7
|
+
/** 18px, the default: rows, cards, mentions. */
|
|
8
|
+
XS: "xs",
|
|
9
|
+
/** 22px. */
|
|
10
|
+
SM: "sm",
|
|
11
|
+
/** 28px: member lists, share dialogs. */
|
|
12
|
+
MD: "md",
|
|
13
|
+
/** 32px. */
|
|
14
|
+
LG: "lg",
|
|
15
|
+
};
|
|
16
|
+
export const AVATAR_TONES = {
|
|
17
|
+
/** The signed-in person. */
|
|
18
|
+
SELF: "self",
|
|
19
|
+
/** Everyone else. */
|
|
20
|
+
MUTED: "muted",
|
|
21
|
+
/** The "+N" in a stack. */
|
|
22
|
+
MORE: "more",
|
|
23
|
+
};
|
|
24
|
+
// Initials sit at about 36% of the disc: the one text allowed under 12px, because it reads as an icon.
|
|
25
|
+
const avatarVariants = cva("relative flex shrink-0 overflow-hidden rounded-full", {
|
|
26
|
+
variants: {
|
|
27
|
+
size: {
|
|
28
|
+
[AVATAR_SIZES.XS]: "size-4.5 text-[0.53125rem]",
|
|
29
|
+
[AVATAR_SIZES.SM]: "size-5.5 text-[0.59375rem]",
|
|
30
|
+
[AVATAR_SIZES.MD]: "size-7 text-[0.625rem]",
|
|
31
|
+
[AVATAR_SIZES.LG]: "size-8 text-[0.6875rem]",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { size: AVATAR_SIZES.XS },
|
|
35
|
+
});
|
|
36
|
+
/** A person: a disc holding an `AvatarImage` and the `AvatarFallback` initials. 18px by default. */
|
|
37
|
+
export function Avatar({ className, size, ...props }) {
|
|
38
|
+
return _jsx(AvatarPrimitive.Root, { "data-slot": "avatar", className: cn(avatarVariants({ size }), className), ...props });
|
|
39
|
+
}
|
|
40
|
+
/** The photo. Until it loads, or if it fails, the fallback shows. */
|
|
41
|
+
export function AvatarImage({ className, ...props }) {
|
|
42
|
+
return _jsx(AvatarPrimitive.Image, { "data-slot": "avatar-image", className: cn("aspect-square size-full", className), ...props });
|
|
43
|
+
}
|
|
44
|
+
const avatarFallbackVariants = cva("flex size-full items-center justify-center rounded-full font-sans font-semibold", {
|
|
45
|
+
variants: {
|
|
46
|
+
tone: {
|
|
47
|
+
[AVATAR_TONES.SELF]: "bg-avatar text-avatar-ink",
|
|
48
|
+
[AVATAR_TONES.MUTED]: "bg-secondary text-ink-2",
|
|
49
|
+
[AVATAR_TONES.MORE]: "bg-secondary text-muted",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: { tone: AVATAR_TONES.SELF },
|
|
53
|
+
});
|
|
54
|
+
/** Initials on a tinted disc: `self` for you, `muted` for everyone else, `more` for the "+N". */
|
|
55
|
+
export function AvatarFallback({ className, tone, ...props }) {
|
|
56
|
+
return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn(avatarFallbackVariants({ tone }), className), ...props }));
|
|
57
|
+
}
|
|
58
|
+
/** Overlaps by 6px with a 2px ring in the panel colour; collapse more than three into "+N". */
|
|
59
|
+
export function AvatarGroup({ className, ...props }) {
|
|
60
|
+
return (_jsx("div", { "data-slot": "avatar-group", className: cn("flex *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-panel [&>*+*]:-ml-space-6", className), ...props }));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gDAAgD;IAChD,EAAE,EAAE,IAAI;IACR,YAAY;IACZ,EAAE,EAAE,IAAI;IACR,yCAAyC;IACzC,EAAE,EAAE,IAAI;IACR,YAAY;IACZ,EAAE,EAAE,IAAI;CACA,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,4BAA4B;IAC5B,IAAI,EAAE,MAAM;IACZ,qBAAqB;IACrB,KAAK,EAAE,OAAO;IACd,2BAA2B;IAC3B,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,uGAAuG;AACvG,MAAM,cAAc,GAAG,GAAG,CAAC,qDAAqD,EAAE;IAChF,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,4BAA4B;YAC/C,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,4BAA4B;YAC/C,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,wBAAwB;YAC3C,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,yBAAyB;SAC7C;KACF;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,EAAE,EAAE;CAC3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,EAAE,EAAE,CAAC,sFAAsF,EAAE,SAAS,CAAC,KAC5G,KAAK,GACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const AVATAR_SIZES = {\n /** 18px, the default: rows, cards, mentions. */\n XS: \"xs\",\n /** 22px. */\n SM: \"sm\",\n /** 28px: member lists, share dialogs. */\n MD: \"md\",\n /** 32px. */\n LG: \"lg\",\n} as const;\n\nexport const AVATAR_TONES = {\n /** The signed-in person. */\n SELF: \"self\",\n /** Everyone else. */\n MUTED: \"muted\",\n /** The \"+N\" in a stack. */\n MORE: \"more\",\n} as const;\n\n// Initials sit at about 36% of the disc: the one text allowed under 12px, because it reads as an icon.\nconst avatarVariants = cva(\"relative flex shrink-0 overflow-hidden rounded-full\", {\n variants: {\n size: {\n [AVATAR_SIZES.XS]: \"size-4.5 text-[0.53125rem]\",\n [AVATAR_SIZES.SM]: \"size-5.5 text-[0.59375rem]\",\n [AVATAR_SIZES.MD]: \"size-7 text-[0.625rem]\",\n [AVATAR_SIZES.LG]: \"size-8 text-[0.6875rem]\",\n },\n },\n defaultVariants: { size: AVATAR_SIZES.XS },\n});\n\n/** A person: a disc holding an `AvatarImage` and the `AvatarFallback` initials. 18px by default. */\nexport function Avatar({\n className,\n size,\n ...props\n}: AvatarPrimitive.Root.Props & VariantProps<typeof avatarVariants>) {\n return <AvatarPrimitive.Root data-slot=\"avatar\" className={cn(avatarVariants({ size }), className)} {...props} />;\n}\n\n/** The photo. Until it loads, or if it fails, the fallback shows. */\nexport function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {\n return <AvatarPrimitive.Image data-slot=\"avatar-image\" className={cn(\"aspect-square size-full\", className)} {...props} />;\n}\n\nconst avatarFallbackVariants = cva(\"flex size-full items-center justify-center rounded-full font-sans font-semibold\", {\n variants: {\n tone: {\n [AVATAR_TONES.SELF]: \"bg-avatar text-avatar-ink\",\n [AVATAR_TONES.MUTED]: \"bg-secondary text-ink-2\",\n [AVATAR_TONES.MORE]: \"bg-secondary text-muted\",\n },\n },\n defaultVariants: { tone: AVATAR_TONES.SELF },\n});\n\n/** Initials on a tinted disc: `self` for you, `muted` for everyone else, `more` for the \"+N\". */\nexport function AvatarFallback({\n className,\n tone,\n ...props\n}: AvatarPrimitive.Fallback.Props & VariantProps<typeof avatarFallbackVariants>) {\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-fallback\"\n className={cn(avatarFallbackVariants({ tone }), className)}\n {...props}\n />\n );\n}\n\n/** Overlaps by 6px with a 2px ring in the panel colour; collapse more than three into \"+N\". */\nexport function AvatarGroup({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"avatar-group\"\n className={cn(\"flex *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-panel [&>*+*]:-ml-space-6\", className)}\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const BADGE_VARIANTS: {
|
|
4
|
+
/** Draft, Reply drafted. */
|
|
5
|
+
readonly DEFAULT: "default";
|
|
6
|
+
/** Live, New, Connected, Most popular. */
|
|
7
|
+
readonly LIVE: "live";
|
|
8
|
+
/** Managed, Per-user. */
|
|
9
|
+
readonly OUTLINE: "outline";
|
|
10
|
+
/** Something went wrong or needs fixing first: Failed, Critical. */
|
|
11
|
+
readonly DANGER: "danger";
|
|
12
|
+
/** Worth a look, not broken: High, Expiring. */
|
|
13
|
+
readonly WARN: "warn";
|
|
14
|
+
/** Unread or active-filter count; place it with `absolute -right-1.5 -top-1.5`. */
|
|
15
|
+
readonly COUNT: "count";
|
|
16
|
+
/** Pepper's unread count: it is asking for attention. */
|
|
17
|
+
readonly COUNT_DESTRUCTIVE: "count-destructive";
|
|
18
|
+
};
|
|
19
|
+
/** The cva class builder, for styling another element as a Badge. */
|
|
20
|
+
export declare const badgeVariants: (props?: ({
|
|
21
|
+
variant?: "danger" | "warn" | "default" | "outline" | "live" | "count" | "count-destructive" | null | undefined;
|
|
22
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
23
|
+
export type BadgeProps = useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>;
|
|
24
|
+
/**
|
|
25
|
+
* Small labels (Draft, Live, Managed) and unread or active-filter counts. Sentence case, never uppercase.
|
|
26
|
+
* A status with a dot is `StatusDot`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Badge({ className, variant, render, ref, ...props }: BadgeProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
29
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,cAAc;IACzB,4BAA4B;;IAE5B,0CAA0C;;IAE1C,yBAAyB;;IAEzB,oEAAoE;;IAEpE,gDAAgD;;IAEhD,mFAAmF;;IAEnF,yDAAyD;;CAEjD,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,aAAa;;8EAgBzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAE/F;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,8FAQ9E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
export const BADGE_VARIANTS = {
|
|
7
|
+
/** Draft, Reply drafted. */
|
|
8
|
+
DEFAULT: "default",
|
|
9
|
+
/** Live, New, Connected, Most popular. */
|
|
10
|
+
LIVE: "live",
|
|
11
|
+
/** Managed, Per-user. */
|
|
12
|
+
OUTLINE: "outline",
|
|
13
|
+
/** Something went wrong or needs fixing first: Failed, Critical. */
|
|
14
|
+
DANGER: "danger",
|
|
15
|
+
/** Worth a look, not broken: High, Expiring. */
|
|
16
|
+
WARN: "warn",
|
|
17
|
+
/** Unread or active-filter count; place it with `absolute -right-1.5 -top-1.5`. */
|
|
18
|
+
COUNT: "count",
|
|
19
|
+
/** Pepper's unread count: it is asking for attention. */
|
|
20
|
+
COUNT_DESTRUCTIVE: "count-destructive",
|
|
21
|
+
};
|
|
22
|
+
/** The cva class builder, for styling another element as a Badge. */
|
|
23
|
+
export const badgeVariants = cva("inline-flex w-fit shrink-0 items-center justify-center gap-space-4 whitespace-nowrap rounded-full font-sans [&_svg]:pointer-events-none [&_svg]:size-3", {
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
[BADGE_VARIANTS.DEFAULT]: "h-5 bg-secondary px-space-8 text-small font-medium text-ink-2",
|
|
27
|
+
[BADGE_VARIANTS.LIVE]: "h-5 bg-success-soft px-space-8 text-small font-medium text-link",
|
|
28
|
+
[BADGE_VARIANTS.OUTLINE]: "h-5 border border-line px-space-8 text-small font-medium text-ink-2",
|
|
29
|
+
[BADGE_VARIANTS.DANGER]: "h-5 bg-danger-soft px-space-8 text-small font-medium text-danger",
|
|
30
|
+
[BADGE_VARIANTS.WARN]: "h-5 bg-warn-soft px-space-8 text-small font-medium text-warn",
|
|
31
|
+
[BADGE_VARIANTS.COUNT]: "h-4 min-w-6 bg-accent px-space-4 text-2xs text-accent-ink ring-2 ring-panel",
|
|
32
|
+
[BADGE_VARIANTS.COUNT_DESTRUCTIVE]: "h-4 min-w-6 bg-danger px-space-4 text-2xs text-white ring-2 ring-panel",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { variant: BADGE_VARIANTS.DEFAULT },
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Small labels (Draft, Live, Managed) and unread or active-filter counts. Sentence case, never uppercase.
|
|
39
|
+
* A status with a dot is `StatusDot`.
|
|
40
|
+
*/
|
|
41
|
+
export function Badge({ className, variant, render, ref, ...props }) {
|
|
42
|
+
return useRender({
|
|
43
|
+
defaultTagName: "span",
|
|
44
|
+
render,
|
|
45
|
+
state: { slot: "badge" },
|
|
46
|
+
ref,
|
|
47
|
+
props: mergeProps({ className: cn(badgeVariants({ variant }), className) }, props),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/components/badge.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,4BAA4B;IAC5B,OAAO,EAAE,SAAS;IAClB,0CAA0C;IAC1C,IAAI,EAAE,MAAM;IACZ,yBAAyB;IACzB,OAAO,EAAE,SAAS;IAClB,oEAAoE;IACpE,MAAM,EAAE,QAAQ;IAChB,gDAAgD;IAChD,IAAI,EAAE,MAAM;IACZ,mFAAmF;IACnF,KAAK,EAAE,OAAO;IACd,yDAAyD;IACzD,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC;AAEX,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAC9B,wJAAwJ,EACxJ;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,+DAA+D;YACzF,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,iEAAiE;YACxF,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,qEAAqE;YAC/F,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,kEAAkE;YAC3F,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,8DAA8D;YACrF,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,6EAA6E;YACrG,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,wEAAwE;SAC7G;KACF;IACD,eAAe,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE;CACrD,CACF,CAAC;AAIF;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,EAAc;IAC7E,OAAO,SAAS,CAAC;QACf,cAAc,EAAE,MAAM;QACtB,MAAM;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACxB,GAAG;QACH,KAAK,EAAE,UAAU,CAAS,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC;KAC3F,CAAC,CAAC;AACL,CAAC","sourcesContent":["\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const BADGE_VARIANTS = {\n /** Draft, Reply drafted. */\n DEFAULT: \"default\",\n /** Live, New, Connected, Most popular. */\n LIVE: \"live\",\n /** Managed, Per-user. */\n OUTLINE: \"outline\",\n /** Something went wrong or needs fixing first: Failed, Critical. */\n DANGER: \"danger\",\n /** Worth a look, not broken: High, Expiring. */\n WARN: \"warn\",\n /** Unread or active-filter count; place it with `absolute -right-1.5 -top-1.5`. */\n COUNT: \"count\",\n /** Pepper's unread count: it is asking for attention. */\n COUNT_DESTRUCTIVE: \"count-destructive\",\n} as const;\n\n/** The cva class builder, for styling another element as a Badge. */\nexport const badgeVariants = cva(\n \"inline-flex w-fit shrink-0 items-center justify-center gap-space-4 whitespace-nowrap rounded-full font-sans [&_svg]:pointer-events-none [&_svg]:size-3\",\n {\n variants: {\n variant: {\n [BADGE_VARIANTS.DEFAULT]: \"h-5 bg-secondary px-space-8 text-small font-medium text-ink-2\",\n [BADGE_VARIANTS.LIVE]: \"h-5 bg-success-soft px-space-8 text-small font-medium text-link\",\n [BADGE_VARIANTS.OUTLINE]: \"h-5 border border-line px-space-8 text-small font-medium text-ink-2\",\n [BADGE_VARIANTS.DANGER]: \"h-5 bg-danger-soft px-space-8 text-small font-medium text-danger\",\n [BADGE_VARIANTS.WARN]: \"h-5 bg-warn-soft px-space-8 text-small font-medium text-warn\",\n [BADGE_VARIANTS.COUNT]: \"h-4 min-w-6 bg-accent px-space-4 text-2xs text-accent-ink ring-2 ring-panel\",\n [BADGE_VARIANTS.COUNT_DESTRUCTIVE]: \"h-4 min-w-6 bg-danger px-space-4 text-2xs text-white ring-2 ring-panel\",\n },\n },\n defaultVariants: { variant: BADGE_VARIANTS.DEFAULT },\n }\n);\n\nexport type BadgeProps = useRender.ComponentProps<\"span\"> & VariantProps<typeof badgeVariants>;\n\n/**\n * Small labels (Draft, Live, Managed) and unread or active-filter counts. Sentence case, never uppercase.\n * A status with a dot is `StatusDot`.\n */\nexport function Badge({ className, variant, render, ref, ...props }: BadgeProps) {\n return useRender({\n defaultTagName: \"span\",\n render,\n state: { slot: \"badge\" },\n ref,\n props: mergeProps<\"span\">({ className: cn(badgeVariants({ variant }), className) }, props),\n });\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare const BRAND_TILE_SIZES: {
|
|
3
|
+
/** 14px, inline in text, chips and menus. */
|
|
4
|
+
readonly XS: "xs";
|
|
5
|
+
/** 28px, table rows. */
|
|
6
|
+
readonly SM: "sm";
|
|
7
|
+
/** 36px, catalog cards. */
|
|
8
|
+
readonly MD: "md";
|
|
9
|
+
/** 44px, detail headers. */
|
|
10
|
+
readonly LG: "lg";
|
|
11
|
+
/** 52px, page headers and the connect dialog. */
|
|
12
|
+
readonly XL: "xl";
|
|
13
|
+
};
|
|
14
|
+
export type BrandTileSize = (typeof BRAND_TILE_SIZES)[keyof typeof BRAND_TILE_SIZES];
|
|
15
|
+
export interface BrandTileProps {
|
|
16
|
+
/** "M" for Gmail. Omit when passing `icon`. */
|
|
17
|
+
letter?: string;
|
|
18
|
+
/** The brand colour behind the letter. */
|
|
19
|
+
color?: string;
|
|
20
|
+
/** For things you build yourself: Custom API `<Code />`, MCP `<Plug />`, Webhook `<Zap />`. */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/** A logo image; wins over the letter. */
|
|
23
|
+
src?: string;
|
|
24
|
+
size?: BrandTileSize;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The mark of a connector, service or org: a white letter in the brand colour, or an icon tile for things you
|
|
29
|
+
* build yourself. Decorative: the name always sits next to it.
|
|
30
|
+
*/
|
|
31
|
+
declare function BrandTile({ letter, color, icon, src, size, className, }: BrandTileProps): import("react").JSX.Element;
|
|
32
|
+
export { BrandTile };
|
|
33
|
+
//# sourceMappingURL=brand-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-tile.d.ts","sourceRoot":"","sources":["../../src/components/brand-tile.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,eAAO,MAAM,gBAAgB;IAC3B,6CAA6C;;IAE7C,wBAAwB;;IAExB,2BAA2B;;IAE3B,4BAA4B;;IAE5B,iDAAiD;;CAEzC,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAarF,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+FAA+F;IAC/F,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,iBAAS,SAAS,CAAC,EACjB,MAAM,EACN,KAA0B,EAC1B,IAAI,EACJ,GAAG,EACH,IAA0B,EAC1B,SAAS,GACV,EAAE,cAAc,+BAmBhB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
export const BRAND_TILE_SIZES = {
|
|
5
|
+
/** 14px, inline in text, chips and menus. */
|
|
6
|
+
XS: "xs",
|
|
7
|
+
/** 28px, table rows. */
|
|
8
|
+
SM: "sm",
|
|
9
|
+
/** 36px, catalog cards. */
|
|
10
|
+
MD: "md",
|
|
11
|
+
/** 44px, detail headers. */
|
|
12
|
+
LG: "lg",
|
|
13
|
+
/** 52px, page headers and the connect dialog. */
|
|
14
|
+
XL: "xl",
|
|
15
|
+
};
|
|
16
|
+
// The radius grows with the size (3 → 13px); the letter and the icon follow.
|
|
17
|
+
const SIZE_CLASSES = {
|
|
18
|
+
[BRAND_TILE_SIZES.XS]: "size-3.5 rounded-[0.1875rem] text-[0.5625rem] font-bold [&_svg]:size-2.5",
|
|
19
|
+
[BRAND_TILE_SIZES.SM]: "size-7 rounded-row text-ui [&_svg]:size-3.75",
|
|
20
|
+
[BRAND_TILE_SIZES.MD]: "size-9 rounded-[0.5625rem] text-md [&_svg]:size-4.5",
|
|
21
|
+
[BRAND_TILE_SIZES.LG]: "size-11 rounded-[0.6875rem] text-[1.125rem] font-semibold [&_svg]:size-5",
|
|
22
|
+
[BRAND_TILE_SIZES.XL]: "size-13 rounded-[0.8125rem] text-editor-title [&_svg]:size-6",
|
|
23
|
+
};
|
|
24
|
+
const DEFAULT_TILE_COLOR = "#555555";
|
|
25
|
+
/**
|
|
26
|
+
* The mark of a connector, service or org: a white letter in the brand colour, or an icon tile for things you
|
|
27
|
+
* build yourself. Decorative: the name always sits next to it.
|
|
28
|
+
*/
|
|
29
|
+
function BrandTile({ letter, color = DEFAULT_TILE_COLOR, icon, src, size = BRAND_TILE_SIZES.SM, className, }) {
|
|
30
|
+
const isIconTile = !src && Boolean(icon);
|
|
31
|
+
return (_jsx("span", { "data-slot": "brand-tile", className: cn("inline-grid shrink-0 place-items-center overflow-hidden font-sans font-semibold", isIconTile ? "border border-line bg-surface text-ink-2" : "text-white", SIZE_CLASSES[size],
|
|
32
|
+
// After the size: a text-* class would otherwise set the line height around the letter.
|
|
33
|
+
"leading-none", className), style: isIconTile || src ? undefined : { background: color }, children: src ? _jsx("img", { src: src, alt: "", className: "size-full object-cover" }) : (icon ?? letter) }));
|
|
34
|
+
}
|
|
35
|
+
export { BrandTile };
|
|
36
|
+
//# sourceMappingURL=brand-tile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-tile.js","sourceRoot":"","sources":["../../src/components/brand-tile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,cA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AAS,EAAC,wBAAwB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,GAChF,CACR,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const BRAND_TILE_SIZES = {\n /** 14px, inline in text, chips and menus. */\n XS: \"xs\",\n /** 28px, table rows. */\n SM: \"sm\",\n /** 36px, catalog cards. */\n MD: \"md\",\n /** 44px, detail headers. */\n LG: \"lg\",\n /** 52px, page headers and the connect dialog. */\n XL: \"xl\",\n} as const;\n\nexport type BrandTileSize = (typeof BRAND_TILE_SIZES)[keyof typeof BRAND_TILE_SIZES];\n\n// The radius grows with the size (3 → 13px); the letter and the icon follow.\nconst SIZE_CLASSES = {\n [BRAND_TILE_SIZES.XS]: \"size-3.5 rounded-[0.1875rem] text-[0.5625rem] font-bold [&_svg]:size-2.5\",\n [BRAND_TILE_SIZES.SM]: \"size-7 rounded-row text-ui [&_svg]:size-3.75\",\n [BRAND_TILE_SIZES.MD]: \"size-9 rounded-[0.5625rem] text-md [&_svg]:size-4.5\",\n [BRAND_TILE_SIZES.LG]: \"size-11 rounded-[0.6875rem] text-[1.125rem] font-semibold [&_svg]:size-5\",\n [BRAND_TILE_SIZES.XL]: \"size-13 rounded-[0.8125rem] text-editor-title [&_svg]:size-6\",\n} satisfies Record<BrandTileSize, string>;\n\nconst DEFAULT_TILE_COLOR = \"#555555\";\n\nexport interface BrandTileProps {\n /** \"M\" for Gmail. Omit when passing `icon`. */\n letter?: string;\n /** The brand colour behind the letter. */\n color?: string;\n /** For things you build yourself: Custom API `<Code />`, MCP `<Plug />`, Webhook `<Zap />`. */\n icon?: ReactNode;\n /** A logo image; wins over the letter. */\n src?: string;\n size?: BrandTileSize;\n className?: string;\n}\n\n/**\n * The mark of a connector, service or org: a white letter in the brand colour, or an icon tile for things you\n * build yourself. Decorative: the name always sits next to it.\n */\nfunction BrandTile({\n letter,\n color = DEFAULT_TILE_COLOR,\n icon,\n src,\n size = BRAND_TILE_SIZES.SM,\n className,\n}: BrandTileProps) {\n const isIconTile = !src && Boolean(icon);\n\n return (\n <span\n data-slot=\"brand-tile\"\n className={cn(\n \"inline-grid shrink-0 place-items-center overflow-hidden font-sans font-semibold\",\n isIconTile ? \"border border-line bg-surface text-ink-2\" : \"text-white\",\n SIZE_CLASSES[size],\n // After the size: a text-* class would otherwise set the line height around the letter.\n \"leading-none\",\n className\n )}\n style={isIconTile || src ? undefined : { background: color }}\n >\n {src ? <img src={src} alt=\"\" className=\"size-full object-cover\" /> : (icon ?? letter)}\n </span>\n );\n}\n\nexport { BrandTile };\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const BUTTON_VARIANTS: {
|
|
4
|
+
/** Primary: the ONE green action a view exists for (Create app, Publish, Save changes). */
|
|
5
|
+
readonly DEFAULT: "default";
|
|
6
|
+
/** The neutral "Default" button: Share, Test run, Copy link. */
|
|
7
|
+
readonly OUTLINE: "outline";
|
|
8
|
+
readonly SECONDARY: "secondary";
|
|
9
|
+
/** Cancel, quiet dismissals, icon-only buttons. */
|
|
10
|
+
readonly GHOST: "ghost";
|
|
11
|
+
/** Destructive actions in rows and dialogs. */
|
|
12
|
+
readonly DESTRUCTIVE_SOFT: "destructive-soft";
|
|
13
|
+
/** Only the final confirm of an AlertDialog. */
|
|
14
|
+
readonly DESTRUCTIVE: "destructive";
|
|
15
|
+
/** List-page header tools; `aria-pressed` turns the icon green (an active filter). */
|
|
16
|
+
readonly TOOLBAR: "toolbar";
|
|
17
|
+
readonly LINK: "link";
|
|
18
|
+
/** The glass send tile of a composer that starts something (Build), usually at `icon-lg`. */
|
|
19
|
+
readonly GLASS: "glass";
|
|
20
|
+
};
|
|
21
|
+
export declare const BUTTON_SIZES: {
|
|
22
|
+
/** Small 28px: bars and dense rows (editor header, panel headers, table rows, cards). */
|
|
23
|
+
readonly SM: "sm";
|
|
24
|
+
/** Medium 34px: page level (page headers, toolbars, dialogs, settings rows). */
|
|
25
|
+
readonly DEFAULT: "default";
|
|
26
|
+
/** Large 42px pill: conversations (Pepper's onboarding answers). */
|
|
27
|
+
readonly LG: "lg";
|
|
28
|
+
/** 24px square: sidebar tools. */
|
|
29
|
+
readonly ICON_SM: "icon-sm";
|
|
30
|
+
/** 28px square: overflow menus, row and panel tools. */
|
|
31
|
+
readonly ICON: "icon";
|
|
32
|
+
/** 34px square: list-page header tools (with `toolbar`). */
|
|
33
|
+
readonly ICON_LG: "icon-lg";
|
|
34
|
+
};
|
|
35
|
+
/** The cva class builder, for styling a non-button element as a Button. */
|
|
36
|
+
export declare const buttonVariants: (props?: ({
|
|
37
|
+
variant?: "secondary" | "link" | "destructive" | "glass" | "toolbar" | "default" | "outline" | "ghost" | "destructive-soft" | null | undefined;
|
|
38
|
+
size?: "sm" | "lg" | "default" | "icon-sm" | "icon" | "icon-lg" | null | undefined;
|
|
39
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
40
|
+
export type ButtonProps = ButtonPrimitive.Props & VariantProps<typeof buttonVariants> & {
|
|
41
|
+
/** Shows the spinner and keeps the button disabled until the work it started is done. */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Buttons for actions. The icon goes in children (`<Plus /> Create`); icon-only buttons use the `icon*` sizes and an
|
|
46
|
+
* `aria-label`. Pick the size by where the button lives (bar → `sm`, page → `default`, conversation → `lg`);
|
|
47
|
+
* the green `default` variant is reserved for the one action per view. Navigation is a Link styled with `buttonVariants`,
|
|
48
|
+
* so it stays a link: Base UI gives an element rendered through Button `role="button"`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function Button({ className, variant, size, loading, disabled, children, ...props }: ButtonProps): import("react").JSX.Element;
|
|
51
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,eAAO,MAAM,eAAe;IAC1B,2FAA2F;;IAE3F,gEAAgE;;;IAGhE,mDAAmD;;IAEnD,+CAA+C;;IAE/C,gDAAgD;;IAEhD,sFAAsF;;;IAGtF,6FAA6F;;CAErF,CAAC;AAEX,eAAO,MAAM,YAAY;IACvB,yFAAyF;;IAEzF,gFAAgF;;IAEhF,oEAAoE;;IAEpE,kCAAkC;;IAElC,wDAAwD;;IAExD,4DAA4D;;CAEpD,CAAC;AAEX,2EAA2E;AAC3E,eAAO,MAAM,cAAc;;;8EAkC1B,CAAC;AAWF,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,GAC7C,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,yFAAyF;IACzF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,+BAYb"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Children, isValidElement } from "react";
|
|
4
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { LoaderCircle } from "lucide-react";
|
|
7
|
+
import { cn } from "../lib/cn.js";
|
|
8
|
+
export const BUTTON_VARIANTS = {
|
|
9
|
+
/** Primary: the ONE green action a view exists for (Create app, Publish, Save changes). */
|
|
10
|
+
DEFAULT: "default",
|
|
11
|
+
/** The neutral "Default" button: Share, Test run, Copy link. */
|
|
12
|
+
OUTLINE: "outline",
|
|
13
|
+
SECONDARY: "secondary",
|
|
14
|
+
/** Cancel, quiet dismissals, icon-only buttons. */
|
|
15
|
+
GHOST: "ghost",
|
|
16
|
+
/** Destructive actions in rows and dialogs. */
|
|
17
|
+
DESTRUCTIVE_SOFT: "destructive-soft",
|
|
18
|
+
/** Only the final confirm of an AlertDialog. */
|
|
19
|
+
DESTRUCTIVE: "destructive",
|
|
20
|
+
/** List-page header tools; `aria-pressed` turns the icon green (an active filter). */
|
|
21
|
+
TOOLBAR: "toolbar",
|
|
22
|
+
LINK: "link",
|
|
23
|
+
/** The glass send tile of a composer that starts something (Build), usually at `icon-lg`. */
|
|
24
|
+
GLASS: "glass",
|
|
25
|
+
};
|
|
26
|
+
export const BUTTON_SIZES = {
|
|
27
|
+
/** Small 28px: bars and dense rows (editor header, panel headers, table rows, cards). */
|
|
28
|
+
SM: "sm",
|
|
29
|
+
/** Medium 34px: page level (page headers, toolbars, dialogs, settings rows). */
|
|
30
|
+
DEFAULT: "default",
|
|
31
|
+
/** Large 42px pill: conversations (Pepper's onboarding answers). */
|
|
32
|
+
LG: "lg",
|
|
33
|
+
/** 24px square: sidebar tools. */
|
|
34
|
+
ICON_SM: "icon-sm",
|
|
35
|
+
/** 28px square: overflow menus, row and panel tools. */
|
|
36
|
+
ICON: "icon",
|
|
37
|
+
/** 34px square: list-page header tools (with `toolbar`). */
|
|
38
|
+
ICON_LG: "icon-lg",
|
|
39
|
+
};
|
|
40
|
+
/** The cva class builder, for styling a non-button element as a Button. */
|
|
41
|
+
export const buttonVariants = cva("inline-flex shrink-0 cursor-pointer items-center justify-center gap-space-6 whitespace-nowrap border font-sans font-medium outline-none transition-[background-color,color,filter,border-color] duration-120 focus-visible:ring-2 focus-visible:ring-accent/40 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", {
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
44
|
+
[BUTTON_VARIANTS.DEFAULT]: "border-accent-edge bg-accent text-accent-ink hover:brightness-94",
|
|
45
|
+
[BUTTON_VARIANTS.OUTLINE]: "border-line bg-surface text-ink hover:bg-hover",
|
|
46
|
+
[BUTTON_VARIANTS.SECONDARY]: "border-transparent bg-secondary text-ink hover:bg-hover",
|
|
47
|
+
[BUTTON_VARIANTS.GHOST]: "border-transparent bg-transparent text-muted hover:bg-hover hover:text-ink aria-expanded:bg-hover aria-expanded:text-ink",
|
|
48
|
+
[BUTTON_VARIANTS.DESTRUCTIVE_SOFT]: "border-transparent bg-danger-soft text-danger hover:brightness-97",
|
|
49
|
+
// Dark mode lightens danger, so its label turns dark to stay readable.
|
|
50
|
+
[BUTTON_VARIANTS.DESTRUCTIVE]: "border-danger bg-danger text-white hover:brightness-94 dark:text-panel",
|
|
51
|
+
[BUTTON_VARIANTS.TOOLBAR]: "border-panel-edge bg-surface text-ink-2 shadow-card hover:bg-hover aria-pressed:text-accent",
|
|
52
|
+
[BUTTON_VARIANTS.LINK]: "border-0 bg-transparent p-0 text-link underline-offset-3 hover:underline",
|
|
53
|
+
// A gradient fill under a light edge (Figma 2:44). Disabled drops the glass for the plain secondary fill.
|
|
54
|
+
[BUTTON_VARIANTS.GLASS]: [
|
|
55
|
+
"border-glass-edge bg-(image:--glass) text-white shadow-glass transition-[filter,box-shadow] duration-150",
|
|
56
|
+
"hover:brightness-106 hover:saturate-105 hover:shadow-glass-hover active:brightness-96 active:shadow-glass-active",
|
|
57
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-glass-focus focus-visible:ring-0",
|
|
58
|
+
"disabled:border-transparent disabled:bg-secondary disabled:bg-none disabled:text-faint disabled:opacity-100 disabled:shadow-none",
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
[BUTTON_SIZES.SM]: "h-7 gap-[0.3125rem] rounded-md px-space-10 text-small",
|
|
63
|
+
[BUTTON_SIZES.DEFAULT]: "h-8.5 rounded-lg px-space-14 text-ui",
|
|
64
|
+
[BUTTON_SIZES.LG]: "h-10.5 gap-space-8 rounded-full px-4.5 text-md [&_svg:not([class*='size-'])]:size-4",
|
|
65
|
+
[BUTTON_SIZES.ICON_SM]: "size-6 rounded-row p-0 [&_svg:not([class*='size-'])]:size-4",
|
|
66
|
+
[BUTTON_SIZES.ICON]: "size-7 rounded-row p-0 [&_svg:not([class*='size-'])]:size-4",
|
|
67
|
+
[BUTTON_SIZES.ICON_LG]: "relative size-8.5 rounded-lg p-0 [&_svg:not([class*='size-'])]:size-4",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: { variant: BUTTON_VARIANTS.DEFAULT, size: BUTTON_SIZES.DEFAULT },
|
|
71
|
+
});
|
|
72
|
+
/** While loading, the first icon turns into the spinner; with no icon, the spinner goes first. */
|
|
73
|
+
function swapFirstIcon(children) {
|
|
74
|
+
const spinner = _jsx(LoaderCircle, { className: "animate-spinner" }, "spinner");
|
|
75
|
+
const nodes = Children.toArray(children);
|
|
76
|
+
const iconIndex = nodes.findIndex((node) => isValidElement(node) && typeof node.type !== "string");
|
|
77
|
+
if (iconIndex === -1)
|
|
78
|
+
return [spinner, ...nodes];
|
|
79
|
+
return nodes.map((node, index) => (index === iconIndex ? spinner : node));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Buttons for actions. The icon goes in children (`<Plus /> Create`); icon-only buttons use the `icon*` sizes and an
|
|
83
|
+
* `aria-label`. Pick the size by where the button lives (bar → `sm`, page → `default`, conversation → `lg`);
|
|
84
|
+
* the green `default` variant is reserved for the one action per view. Navigation is a Link styled with `buttonVariants`,
|
|
85
|
+
* so it stays a link: Base UI gives an element rendered through Button `role="button"`.
|
|
86
|
+
*/
|
|
87
|
+
export function Button({ className, variant, size, loading = false, disabled, children, ...props }) {
|
|
88
|
+
return (_jsx(ButtonPrimitive, { "data-slot": "button", "aria-busy": loading || undefined, disabled: disabled || loading, className: cn(buttonVariants({ variant, size }), className), ...props, children: loading ? swapFirstIcon(children) : children }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,2FAA2F;IAC3F,OAAO,EAAE,SAAS;IAClB,gEAAgE;IAChE,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,mDAAmD;IACnD,KAAK,EAAE,OAAO;IACd,+CAA+C;IAC/C,gBAAgB,EAAE,kBAAkB;IACpC,gDAAgD;IAChD,WAAW,EAAE,aAAa;IAC1B,sFAAsF;IACtF,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,6FAA6F;IAC7F,KAAK,EAAE,OAAO;CACN,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,yFAAyF;IACzF,EAAE,EAAE,IAAI;IACR,gFAAgF;IAChF,OAAO,EAAE,SAAS;IAClB,oEAAoE;IACpE,EAAE,EAAE,IAAI;IACR,kCAAkC;IAClC,OAAO,EAAE,SAAS;IAClB,wDAAwD;IACxD,IAAI,EAAE,MAAM;IACZ,4DAA4D;IAC5D,OAAO,E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EAAC,iBAAiB,IAArC,SAAS,CAA+B,CAAC;IAC3E,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACnG,IAAI,SAAS,KAAK,CAAC,CAAC;QAAE,OAAO,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC;AAQD;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACI;IACZ,OAAO,CACL,KAAC,eAAe,iBACJ,QAAQ,eACP,OAAO,IAAI,SAAS,EAC/B,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KACvD,KAAK,YAER,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,GAC7B,CACnB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { Children, isValidElement, type ReactNode } from \"react\";\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { LoaderCircle } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const BUTTON_VARIANTS = {\n /** Primary: the ONE green action a view exists for (Create app, Publish, Save changes). */\n DEFAULT: \"default\",\n /** The neutral \"Default\" button: Share, Test run, Copy link. */\n OUTLINE: \"outline\",\n SECONDARY: \"secondary\",\n /** Cancel, quiet dismissals, icon-only buttons. */\n GHOST: \"ghost\",\n /** Destructive actions in rows and dialogs. */\n DESTRUCTIVE_SOFT: \"destructive-soft\",\n /** Only the final confirm of an AlertDialog. */\n DESTRUCTIVE: \"destructive\",\n /** List-page header tools; `aria-pressed` turns the icon green (an active filter). */\n TOOLBAR: \"toolbar\",\n LINK: \"link\",\n /** The glass send tile of a composer that starts something (Build), usually at `icon-lg`. */\n GLASS: \"glass\",\n} as const;\n\nexport const BUTTON_SIZES = {\n /** Small 28px: bars and dense rows (editor header, panel headers, table rows, cards). */\n SM: \"sm\",\n /** Medium 34px: page level (page headers, toolbars, dialogs, settings rows). */\n DEFAULT: \"default\",\n /** Large 42px pill: conversations (Pepper's onboarding answers). */\n LG: \"lg\",\n /** 24px square: sidebar tools. */\n ICON_SM: \"icon-sm\",\n /** 28px square: overflow menus, row and panel tools. */\n ICON: \"icon\",\n /** 34px square: list-page header tools (with `toolbar`). */\n ICON_LG: \"icon-lg\",\n} as const;\n\n/** The cva class builder, for styling a non-button element as a Button. */\nexport const buttonVariants = cva(\n \"inline-flex shrink-0 cursor-pointer items-center justify-center gap-space-6 whitespace-nowrap border font-sans font-medium outline-none transition-[background-color,color,filter,border-color] duration-120 focus-visible:ring-2 focus-visible:ring-accent/40 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n {\n variants: {\n variant: {\n [BUTTON_VARIANTS.DEFAULT]: \"border-accent-edge bg-accent text-accent-ink hover:brightness-94\",\n [BUTTON_VARIANTS.OUTLINE]: \"border-line bg-surface text-ink hover:bg-hover\",\n [BUTTON_VARIANTS.SECONDARY]: \"border-transparent bg-secondary text-ink hover:bg-hover\",\n [BUTTON_VARIANTS.GHOST]:\n \"border-transparent bg-transparent text-muted hover:bg-hover hover:text-ink aria-expanded:bg-hover aria-expanded:text-ink\",\n [BUTTON_VARIANTS.DESTRUCTIVE_SOFT]: \"border-transparent bg-danger-soft text-danger hover:brightness-97\",\n // Dark mode lightens danger, so its label turns dark to stay readable.\n [BUTTON_VARIANTS.DESTRUCTIVE]: \"border-danger bg-danger text-white hover:brightness-94 dark:text-panel\",\n [BUTTON_VARIANTS.TOOLBAR]: \"border-panel-edge bg-surface text-ink-2 shadow-card hover:bg-hover aria-pressed:text-accent\",\n [BUTTON_VARIANTS.LINK]: \"border-0 bg-transparent p-0 text-link underline-offset-3 hover:underline\",\n // A gradient fill under a light edge (Figma 2:44). Disabled drops the glass for the plain secondary fill.\n [BUTTON_VARIANTS.GLASS]: [\n \"border-glass-edge bg-(image:--glass) text-white shadow-glass transition-[filter,box-shadow] duration-150\",\n \"hover:brightness-106 hover:saturate-105 hover:shadow-glass-hover active:brightness-96 active:shadow-glass-active\",\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-glass-focus focus-visible:ring-0\",\n \"disabled:border-transparent disabled:bg-secondary disabled:bg-none disabled:text-faint disabled:opacity-100 disabled:shadow-none\",\n ],\n },\n size: {\n [BUTTON_SIZES.SM]: \"h-7 gap-[0.3125rem] rounded-md px-space-10 text-small\",\n [BUTTON_SIZES.DEFAULT]: \"h-8.5 rounded-lg px-space-14 text-ui\",\n [BUTTON_SIZES.LG]: \"h-10.5 gap-space-8 rounded-full px-4.5 text-md [&_svg:not([class*='size-'])]:size-4\",\n [BUTTON_SIZES.ICON_SM]: \"size-6 rounded-row p-0 [&_svg:not([class*='size-'])]:size-4\",\n [BUTTON_SIZES.ICON]: \"size-7 rounded-row p-0 [&_svg:not([class*='size-'])]:size-4\",\n [BUTTON_SIZES.ICON_LG]: \"relative size-8.5 rounded-lg p-0 [&_svg:not([class*='size-'])]:size-4\",\n },\n },\n defaultVariants: { variant: BUTTON_VARIANTS.DEFAULT, size: BUTTON_SIZES.DEFAULT },\n }\n);\n\n/** While loading, the first icon turns into the spinner; with no icon, the spinner goes first. */\nfunction swapFirstIcon(children: ReactNode): ReactNode {\n const spinner = <LoaderCircle key=\"spinner\" className=\"animate-spinner\" />;\n const nodes = Children.toArray(children);\n const iconIndex = nodes.findIndex((node) => isValidElement(node) && typeof node.type !== \"string\");\n if (iconIndex === -1) return [spinner, ...nodes];\n return nodes.map((node, index) => (index === iconIndex ? spinner : node));\n}\n\nexport type ButtonProps = ButtonPrimitive.Props &\n VariantProps<typeof buttonVariants> & {\n /** Shows the spinner and keeps the button disabled until the work it started is done. */\n loading?: boolean;\n };\n\n/**\n * Buttons for actions. The icon goes in children (`<Plus /> Create`); icon-only buttons use the `icon*` sizes and an\n * `aria-label`. Pick the size by where the button lives (bar → `sm`, page → `default`, conversation → `lg`);\n * the green `default` variant is reserved for the one action per view. Navigation is a Link styled with `buttonVariants`,\n * so it stays a link: Base UI gives an element rendered through Button `role=\"button\"`.\n */\nexport function Button({\n className,\n variant,\n size,\n loading = false,\n disabled,\n children,\n ...props\n}: ButtonProps) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {loading ? swapFirstIcon(children) : children}\n </ButtonPrimitive>\n );\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { DayPicker, type DayButton } from "react-day-picker";
|
|
3
|
+
export type { DateRange as CalendarRange } from "react-day-picker";
|
|
4
|
+
export type CalendarProps = ComponentProps<typeof DayPicker>;
|
|
5
|
+
/**
|
|
6
|
+
* A month grid for picking a day, several days or a range: shadcn's Calendar on react-day-picker, drawn in Major's
|
|
7
|
+
* tokens. 34px days, `ink` for the picked day or the ends of a range, a `chip` band between them, a dot under today.
|
|
8
|
+
* Six weeks always (`fixedWeeks`), so the grid keeps its height from month to month. Every DayPicker prop passes
|
|
9
|
+
* through: `mode`, `selected`, `onSelect`, `month`, `numberOfMonths`, `disabled`, `onDayMouseEnter`…
|
|
10
|
+
*/
|
|
11
|
+
export declare function Calendar({ className, classNames, showOutsideDays, fixedWeeks, components, ...props }: CalendarProps): import("react").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* One day: a 34px square, `ink` when it is picked or ends a range, a dot under today's number. The button fills its
|
|
14
|
+
* cell, which is wider than the square when the grid fills a wide sheet: the pointer stays on a day between squares,
|
|
15
|
+
* so the hover ring doesn't blink off, and a press there still picks it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function CalendarDayButton({ className, day, modifiers, children, ...props }: ComponentProps<typeof DayButton>): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=calendar.d.ts.map
|