@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":"island.js","sourceRoot":"","sources":["../../src/components/island.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4EAA4E;IAC5E,IAAI,EAAE,MAAM;IACZ,gFAAgF;IAChF,KAAK,EAAE,OAAO;CACN,CAAC;AAIX,MAAM,sBAAsB,GAAG;IAC7B,6GAA6G;IAC7G,0GAA0G;IAC1G,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,sDAAsD;IAC9E,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE;CACY,CAAC;AAE1C,MAAM,mBAAmB,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAIjD;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,GAAG,KAAK,EAAe;IACzF,MAAM,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAEvD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,+BAAmB,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;IACjG,CAAC;IAED,OAAO,CACL,KAAC,mBAAmB,IAAC,KAAK,kBACxB,+BACY,QAAQ,kBACJ,OAAO,EACrB,SAAS,EAAE,EAAE,CACX,2BAA2B,EAC3B,sBAAsB,CAAC,OAAO,CAAC,EAC/B,gEAAgE,EAChE,SAAS,CACV,KACG,KAAK,GACT,GACkB,CACvB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { createContext, useContext, type ComponentProps } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const ISLAND_VARIANTS = {\n /** A page (lists, settings, Build): the darker home panel with its glow. */\n PAGE: \"page\",\n /** The editor shell's chat and editor panels: the plain panel, side by side. */\n PANEL: \"panel\",\n} as const;\n\nexport type IslandVariant = (typeof ISLAND_VARIANTS)[keyof typeof ISLAND_VARIANTS];\n\nconst ISLAND_VARIANT_CLASSES = {\n // Repaints `--color-panel` a shade darker for everything inside it, so the glow shows and sticky headers and\n // rings match the island. A PageHeader inside reads `data-variant` to paint the same glow once it sticks.\n [ISLAND_VARIANTS.PAGE]: \"bg-page-glow [--color-panel:var(--color-panel-home)]\",\n [ISLAND_VARIANTS.PANEL]: \"\",\n} satisfies Record<IslandVariant, string>;\n\nconst InsideIslandContext = createContext(false);\n\nexport type IslandProps = ComponentProps<\"section\"> & { variant?: IslandVariant };\n\n/**\n * The panel a page sits on, inside the app's 4px gutter: one per page region. Content inside it is never framed\n * in a second island, so an island rendered inside another (a chat embedded in a page) draws no frame of its own.\n * On mobile the island fills the screen, so its frame drops away.\n */\nexport function Island({ className, variant = ISLAND_VARIANTS.PAGE, ...props }: IslandProps) {\n const isInsideIsland = useContext(InsideIslandContext);\n\n if (isInsideIsland) {\n return <section data-slot=\"island\" className={cn(\"relative min-h-0\", className)} {...props} />;\n }\n\n return (\n <InsideIslandContext value>\n <section\n data-slot=\"island\"\n data-variant={variant}\n className={cn(\n \"relative min-h-0 bg-panel\",\n ISLAND_VARIANT_CLASSES[variant],\n \"md:rounded-panel md:border md:border-panel-edge md:shadow-card\",\n className\n )}\n {...props}\n />\n </InsideIslandContext>\n );\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* One keyboard key ("/", "⌘K", "Esc"): 20px tall, mono 12px, a `line` border on `surface`.
|
|
4
|
+
* Inside a Tooltip use a plain `<kbd>`: the tooltip styles it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Kbd({ className, ...props }: ComponentProps<"kbd">): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=kbd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../src/components/kbd.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C;;;GAGG;AACH,wBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAWjE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
/**
|
|
5
|
+
* One keyboard key ("/", "⌘K", "Esc"): 20px tall, mono 12px, a `line` border on `surface`.
|
|
6
|
+
* Inside a Tooltip use a plain `<kbd>`: the tooltip styles it.
|
|
7
|
+
*/
|
|
8
|
+
export function Kbd({ className, ...props }) {
|
|
9
|
+
return (_jsx("kbd", { "data-slot": "kbd", className: cn("pointer-events-none inline-grid h-5 min-w-5 select-none place-items-center rounded-sm border border-line bg-surface px-space-4 font-mono text-small text-ink", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=kbd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.js","sourceRoot":"","sources":["../../src/components/kbd.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IAChE,OAAO,CACL,2BACY,KAAK,EACf,SAAS,EAAE,EAAE,CACX,8JAA8J,EAC9J,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\n/**\n * One keyboard key (\"/\", \"⌘K\", \"Esc\"): 20px tall, mono 12px, a `line` border on `surface`.\n * Inside a Tooltip use a plain `<kbd>`: the tooltip styles it.\n */\nexport function Kbd({ className, ...props }: ComponentProps<\"kbd\">) {\n return (\n <kbd\n data-slot=\"kbd\"\n className={cn(\n \"pointer-events-none inline-grid h-5 min-w-5 select-none place-items-center rounded-sm border border-line bg-surface px-space-4 font-mono text-small text-ink\",\n className\n )}\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The 12px medium `ink-2` label above a control. Inside a form use `FieldLabel`, which adds the
|
|
4
|
+
* required asterisk; beside a check (Checkbox, Switch, RadioGroupItem) use a horizontal `Field`.
|
|
5
|
+
*/
|
|
6
|
+
declare function Label({ className, ...props }: ComponentProps<"label">): import("react").JSX.Element;
|
|
7
|
+
export { Label };
|
|
8
|
+
//# sourceMappingURL=label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C;;;GAGG;AACH,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC,+BAW9D;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
/**
|
|
5
|
+
* The 12px medium `ink-2` label above a control. Inside a form use `FieldLabel`, which adds the
|
|
6
|
+
* required asterisk; beside a check (Checkbox, Switch, RadioGroupItem) use a horizontal `Field`.
|
|
7
|
+
*/
|
|
8
|
+
function Label({ className, ...props }) {
|
|
9
|
+
return (_jsx("label", { "data-slot": "label", className: cn("flex select-none items-center gap-space-4 font-sans text-small font-medium leading-auto text-ink-2 peer-disabled:opacity-50 peer-data-disabled:opacity-50", className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
export { Label };
|
|
12
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;GAGG;AACH,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA2B;IAC7D,OAAO,CACL,6BACY,OAAO,EACjB,SAAS,EAAE,EAAE,CACX,2JAA2J,EAC3J,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\n/**\n * The 12px medium `ink-2` label above a control. Inside a form use `FieldLabel`, which adds the\n * required asterisk; beside a check (Checkbox, Switch, RadioGroupItem) use a horizontal `Field`.\n */\nfunction Label({ className, ...props }: ComponentProps<\"label\">) {\n return (\n <label\n data-slot=\"label\"\n className={cn(\n \"flex select-none items-center gap-space-4 font-sans text-small font-medium leading-auto text-ink-2 peer-disabled:opacity-50 peer-data-disabled:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { type Components, type Options } from "react-markdown";
|
|
3
|
+
import { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants, type MarkdownSize, type MarkdownTone } from "../lib/markdown.ts";
|
|
4
|
+
export { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants, type MarkdownSize, type MarkdownTone };
|
|
5
|
+
export interface MarkdownProps extends Omit<ComponentProps<"div">, "children"> {
|
|
6
|
+
/** The Markdown source, GitHub's flavour: tables, task lists, strikethrough and bare links included. */
|
|
7
|
+
children: string;
|
|
8
|
+
size?: MarkdownSize;
|
|
9
|
+
tone?: MarkdownTone;
|
|
10
|
+
/**
|
|
11
|
+
* Tags drawn by the product instead (react-markdown's `components`): a link that opens a side panel, a mention.
|
|
12
|
+
* Fenced code and tables are the system's unless replaced here.
|
|
13
|
+
*/
|
|
14
|
+
components?: Components;
|
|
15
|
+
/** rehype plugins run on the rendered tree, after GitHub's flavour: a diff's word highlights. */
|
|
16
|
+
rehypePlugins?: Options["rehypePlugins"];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Markdown set in the system's type: a chat reply, an agent's thinking, a .md file. Every tag maps to a named style,
|
|
20
|
+
* so headings stay on the scale and the colours follow the theme; fenced code is a CodeBlock. Needs `react-markdown`
|
|
21
|
+
* and `remark-gfm`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Markdown({ children, size, tone, components, rehypePlugins, className, ...props }: MarkdownProps): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/components/markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,cAAc,EAAkB,MAAM,OAAO,CAAC;AACtF,OAAsB,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG5H,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC;AAqClG,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5E,wGAAwG;IACxG,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAwB,EACxB,IAA6B,EAC7B,UAAU,EACV,aAAa,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,+BAYf"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Children, isValidElement } from "react";
|
|
4
|
+
import ReactMarkdown from "react-markdown";
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { PLAIN_TEXT_LANGUAGE } from "../lib/code-language.js";
|
|
8
|
+
import { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants } from "../lib/markdown.js";
|
|
9
|
+
import { HighlightedCodeBlock } from "./code-block.js";
|
|
10
|
+
export { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants };
|
|
11
|
+
/** The language a fenced block names (```ts), from the class react-markdown gives its code. */
|
|
12
|
+
function findFenceLanguage(className) {
|
|
13
|
+
return /language-([\w-]+)/.exec(className ?? "")?.[1] ?? PLAIN_TEXT_LANGUAGE;
|
|
14
|
+
}
|
|
15
|
+
/** The text of a node react-markdown renders: a fenced block's code is one string. */
|
|
16
|
+
function getText(children) {
|
|
17
|
+
return Children.toArray(children)
|
|
18
|
+
.map((child) => (typeof child === "string" || typeof child === "number" ? String(child) : ""))
|
|
19
|
+
.join("");
|
|
20
|
+
}
|
|
21
|
+
const MARKDOWN_COMPONENTS = {
|
|
22
|
+
// A fenced block is the system's CodeBlock, highlighted and wrapped: never the browser's grey <pre>.
|
|
23
|
+
pre: ({ children }) => {
|
|
24
|
+
const code = Children.toArray(children).find(isValidElement);
|
|
25
|
+
return (_jsx(HighlightedCodeBlock, { code: getText(code?.props.children), language: findFenceLanguage(code?.props.className), wrap: true }));
|
|
26
|
+
},
|
|
27
|
+
// A table wider than the text scrolls sideways on its own instead of spilling out of it.
|
|
28
|
+
table: ({ node: _node, ...props }) => (_jsx("div", { "data-slot": "markdown-table", className: "overflow-x-auto", children: _jsx("table", { ...props }) })),
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Markdown set in the system's type: a chat reply, an agent's thinking, a .md file. Every tag maps to a named style,
|
|
32
|
+
* so headings stay on the scale and the colours follow the theme; fenced code is a CodeBlock. Needs `react-markdown`
|
|
33
|
+
* and `remark-gfm`.
|
|
34
|
+
*/
|
|
35
|
+
export function Markdown({ children, size = MARKDOWN_SIZES.SM, tone = MARKDOWN_TONES.DEFAULT, components, rehypePlugins, className, ...props }) {
|
|
36
|
+
return (_jsx("div", { "data-slot": "markdown", className: cn(markdownVariants({ size, tone }), className), ...props, children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: rehypePlugins, components: { ...MARKDOWN_COMPONENTS, ...components }, children: children }) }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/components/markdown.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAC;AACtF,OAAO,aAAgD,MAAM,gBAAgB,CAAC;AAC9E,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAwC,MAAM,oBAAoB,CAAC;AAC5H,OAAO,EAAE,oBAAo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QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,IAAI,GAAG,cAAc,CAAC,OAAO,EAC7B,UAAU,EACV,aAAa,EACb,SAAS,EACT,GAAG,KAAK,EACM;IACd,OAAO,CACL,2BAAe,UAAU,EAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KAAM,KAAK,YAC7F,KAAC,aAAa,IACZ,aAAa,EAAE,CAAC,SAAS,CAAC,EAC1B,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,UAAU,EAAE,YAEpD,QAAQ,GACK,GACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { Children, isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport ReactMarkdown, { type Components, type Options } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport { cn } from \"../lib/cn.ts\";\nimport { PLAIN_TEXT_LANGUAGE } from \"../lib/code-language.ts\";\nimport { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants, type MarkdownSize, type MarkdownTone } from \"../lib/markdown.ts\";\nimport { HighlightedCodeBlock } from \"./code-block.tsx\";\n\nexport { MARKDOWN_SIZES, MARKDOWN_TONES, markdownVariants, type MarkdownSize, type MarkdownTone };\n\n/** The language a fenced block names (```ts), from the class react-markdown gives its code. */\nfunction findFenceLanguage(className: string | undefined) {\n return /language-([\\w-]+)/.exec(className ?? \"\")?.[1] ?? PLAIN_TEXT_LANGUAGE;\n}\n\n/** The text of a node react-markdown renders: a fenced block's code is one string. */\nfunction getText(children: ReactNode): string {\n return Children.toArray(children)\n .map((child) => (typeof child === \"string\" || typeof child === \"number\" ? String(child) : \"\"))\n .join(\"\");\n}\n\nconst MARKDOWN_COMPONENTS: Components = {\n // A fenced block is the system's CodeBlock, highlighted and wrapped: never the browser's grey <pre>.\n pre: ({ children }) => {\n const code = Children.toArray(children).find(isValidElement) as\n | { props: { className?: string; children?: ReactNode } }\n | undefined;\n\n return (\n <HighlightedCodeBlock\n code={getText(code?.props.children)}\n language={findFenceLanguage(code?.props.className)}\n wrap\n />\n );\n },\n // A table wider than the text scrolls sideways on its own instead of spilling out of it.\n table: ({ node: _node, ...props }) => (\n <div data-slot=\"markdown-table\" className=\"overflow-x-auto\">\n <table {...props} />\n </div>\n ),\n};\n\nexport interface MarkdownProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** The Markdown source, GitHub's flavour: tables, task lists, strikethrough and bare links included. */\n children: string;\n size?: MarkdownSize;\n tone?: MarkdownTone;\n /**\n * Tags drawn by the product instead (react-markdown's `components`): a link that opens a side panel, a mention.\n * Fenced code and tables are the system's unless replaced here.\n */\n components?: Components;\n /** rehype plugins run on the rendered tree, after GitHub's flavour: a diff's word highlights. */\n rehypePlugins?: Options[\"rehypePlugins\"];\n}\n\n/**\n * Markdown set in the system's type: a chat reply, an agent's thinking, a .md file. Every tag maps to a named style,\n * so headings stay on the scale and the colours follow the theme; fenced code is a CodeBlock. Needs `react-markdown`\n * and `remark-gfm`.\n */\nexport function Markdown({\n children,\n size = MARKDOWN_SIZES.SM,\n tone = MARKDOWN_TONES.DEFAULT,\n components,\n rehypePlugins,\n className,\n ...props\n}: MarkdownProps) {\n return (\n <div data-slot=\"markdown\" className={cn(markdownVariants({ size, tone }), className)} {...props}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={rehypePlugins}\n components={{ ...MARKDOWN_COMPONENTS, ...components }}\n >\n {children}\n </ReactMarkdown>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export declare const MESSAGE_AUTHORS: {
|
|
3
|
+
/** The person: a right-aligned bubble with the time below. */
|
|
4
|
+
readonly USER: "user";
|
|
5
|
+
/** Major: plain text in `ink-2`, no bubble, preceded by its Trace. */
|
|
6
|
+
readonly AGENT: "agent";
|
|
7
|
+
};
|
|
8
|
+
export type MessageAuthor = (typeof MESSAGE_AUTHORS)[keyof typeof MESSAGE_AUTHORS];
|
|
9
|
+
export interface MessageProps extends Omit<ComponentProps<"div">, "title"> {
|
|
10
|
+
/** Who wrote it. The person gets a right-aligned bubble; the agent replies in plain text. */
|
|
11
|
+
from: MessageAuthor;
|
|
12
|
+
/** Time under the person's bubble, or after the agent's actions ("9:45am"). */
|
|
13
|
+
time?: ReactNode;
|
|
14
|
+
/** The agent's Trace, shown above its reply. */
|
|
15
|
+
trace?: ReactNode;
|
|
16
|
+
/** Optional avatar before the agent's reply (most chats don't show one). */
|
|
17
|
+
avatar?: ReactNode;
|
|
18
|
+
/** Actions under the reply (Copy, Try again): ghost `icon-sm` Buttons with a Tooltip. */
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
/** On the person's bubble's corner, like a tapback: the emoji Major reacted with. */
|
|
21
|
+
reactions?: ReactNode;
|
|
22
|
+
/** Before the time under the person's bubble: where it was sent from (a 12px Slack or Teams mark). */
|
|
23
|
+
meta?: ReactNode;
|
|
24
|
+
/** The agent's reply in a bubble, like a text message: a reply delivered in a conversation (Pepper over Slack). */
|
|
25
|
+
bubble?: boolean;
|
|
26
|
+
/** The person's message waits until Major finishes: dimmed, with “Queued” under it. */
|
|
27
|
+
queued?: boolean;
|
|
28
|
+
/** With `queued`: Edit under the bubble, which puts the message back in the Composer. */
|
|
29
|
+
onEdit?: () => void;
|
|
30
|
+
/** With `queued`: Cancel under the bubble, which drops the message. */
|
|
31
|
+
onCancel?: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* One turn in the chat panel. Stack turns with a 12px gap (`flex flex-col gap-space-12`), and keep 32px between the
|
|
35
|
+
* last message and the Composer.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Message({ from, time, trace, avatar, actions, reactions, meta, bubble, queued, onEdit, onCancel, className, children, ...props }: MessageProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/components/message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,eAAO,MAAM,eAAe;IAC1B,8DAA8D;;IAE9D,sEAAsE;;CAE9D,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEnF,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACxE,6FAA6F;IAC7F,IAAI,EAAE,aAAa,CAAC;IACpB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yFAAyF;IACzF,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sGAAsG;IACtG,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mHAAmH;IACnH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uFAAuF;IACvF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAQD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,SAAS,EACT,IAAI,EACJ,MAAc,EACd,MAAc,EACd,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,+BA+Ed"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
export const MESSAGE_AUTHORS = {
|
|
5
|
+
/** The person: a right-aligned bubble with the time below. */
|
|
6
|
+
USER: "user",
|
|
7
|
+
/** Major: plain text in `ink-2`, no bubble, preceded by its Trace. */
|
|
8
|
+
AGENT: "agent",
|
|
9
|
+
};
|
|
10
|
+
const QUEUED_ACTION_CLASSES = "cursor-pointer rounded-xs italic underline outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-faint";
|
|
11
|
+
const BUBBLE_CLASSES = "relative max-w-75.5 rounded-lg px-space-10 py-1.75 text-body leading-5 break-words whitespace-pre-wrap text-ink";
|
|
12
|
+
/**
|
|
13
|
+
* One turn in the chat panel. Stack turns with a 12px gap (`flex flex-col gap-space-12`), and keep 32px between the
|
|
14
|
+
* last message and the Composer.
|
|
15
|
+
*/
|
|
16
|
+
export function Message({ from, time, trace, avatar, actions, reactions, meta, bubble = false, queued = false, onEdit, onCancel, className, children, ...props }) {
|
|
17
|
+
if (from === MESSAGE_AUTHORS.USER) {
|
|
18
|
+
return (_jsxs("div", { "data-slot": "message", "data-from": from, className: cn("flex flex-col items-end gap-space-4 self-end", reactions && "pt-4", queued && "opacity-60", className), ...props, children: [_jsxs("div", { className: cn(BUBBLE_CLASSES, "border border-line bg-bubble"), children: [reactions && (_jsx("div", { "data-slot": "message-reactions", className: "absolute -top-3.5 -left-3.5 flex items-center gap-0.5 rounded-full border border-line bg-surface px-space-8 text-editor-body leading-7 shadow-card", children: reactions })), children] }), (meta || time || queued) && (_jsxs("div", { className: "flex items-center gap-space-8 px-space-4 text-small text-faint", children: [meta, queued && (_jsxs("span", { "data-slot": "message-queued", className: "flex items-center gap-1.5 text-muted", children: [_jsx("span", { className: "italic", children: "Queued" }), onEdit && (_jsx("button", { type: "button", onClick: onEdit, className: QUEUED_ACTION_CLASSES, children: "Edit" })), onCancel && (_jsx("button", { type: "button", onClick: onCancel, className: QUEUED_ACTION_CLASSES, children: "Cancel" }))] })), time && _jsx("span", { children: time })] }))] }));
|
|
19
|
+
}
|
|
20
|
+
if (bubble) {
|
|
21
|
+
return (_jsxs("div", { "data-slot": "message", "data-from": from, className: cn("flex flex-col items-start gap-space-4 self-start", className), ...props, children: [_jsx("div", { className: cn(BUBBLE_CLASSES, "bg-secondary"), children: children }), time && _jsx("span", { className: "px-space-4 text-small text-faint", children: time })] }));
|
|
22
|
+
}
|
|
23
|
+
return (_jsxs("div", { "data-slot": "message", "data-from": from, className: cn("flex gap-2.5 self-stretch", className), ...props, children: [avatar && _jsx("div", { className: "shrink-0 pt-0.5", children: avatar }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-space-6", children: [trace, _jsx("div", { className: "flex flex-col gap-space-6 text-body text-ink-2 [&_p]:m-0", children: children }), (actions || time) && (_jsxs("div", { className: "-ml-1 flex items-center gap-0.5 text-small text-faint", children: [actions, time && _jsx("span", { className: "ml-1", children: time })] }))] })] }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/components/message.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,MAAM;IACZ,sEAAsE;IACtE,KAAK,EAAE,OAAO;CACN,CAAC;AA6BX,MAAM,qBAAqB,GACzB,sHAAsH,CAAC;AAEzH,MAAM,cAAc,GAClB,iHAAiH,CAAC;AAEpH;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAA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,CAAC,YAAG,QAAQ,GAAO,EACnE,IAAI,IAAI,eAAM,SAAS,EAAC,kCAAkC,YAAE,IAAI,GAAQ,IACrE,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,4BAAe,SAAS,eAAY,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,2BAA2B,EAAE,SAAS,CAAC,KAAM,KAAK,aACvG,MAAM,IAAI,cAAK,SAAS,EAAC,iBAAiB,YAAE,MAAM,GAAO,EAC1D,eAAK,SAAS,EAAC,0CAA0C,aACtD,KAAK,EACN,cAAK,SAAS,EAAC,0DAA0D,YAAE,QAAQ,GAAO,EACzF,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CACpB,eAAK,SAAS,EAAC,uDAAuD,aACnE,OAAO,EACP,IAAI,IAAI,eAAM,SAAS,EAAC,MAAM,YAAE,IAAI,GAAQ,IACzC,CACP,IACG,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const MESSAGE_AUTHORS = {\n /** The person: a right-aligned bubble with the time below. */\n USER: \"user\",\n /** Major: plain text in `ink-2`, no bubble, preceded by its Trace. */\n AGENT: \"agent\",\n} as const;\n\nexport type MessageAuthor = (typeof MESSAGE_AUTHORS)[keyof typeof MESSAGE_AUTHORS];\n\nexport interface MessageProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n /** Who wrote it. The person gets a right-aligned bubble; the agent replies in plain text. */\n from: MessageAuthor;\n /** Time under the person's bubble, or after the agent's actions (\"9:45am\"). */\n time?: ReactNode;\n /** The agent's Trace, shown above its reply. */\n trace?: ReactNode;\n /** Optional avatar before the agent's reply (most chats don't show one). */\n avatar?: ReactNode;\n /** Actions under the reply (Copy, Try again): ghost `icon-sm` Buttons with a Tooltip. */\n actions?: ReactNode;\n /** On the person's bubble's corner, like a tapback: the emoji Major reacted with. */\n reactions?: ReactNode;\n /** Before the time under the person's bubble: where it was sent from (a 12px Slack or Teams mark). */\n meta?: ReactNode;\n /** The agent's reply in a bubble, like a text message: a reply delivered in a conversation (Pepper over Slack). */\n bubble?: boolean;\n /** The person's message waits until Major finishes: dimmed, with “Queued” under it. */\n queued?: boolean;\n /** With `queued`: Edit under the bubble, which puts the message back in the Composer. */\n onEdit?: () => void;\n /** With `queued`: Cancel under the bubble, which drops the message. */\n onCancel?: () => void;\n}\n\nconst QUEUED_ACTION_CLASSES =\n \"cursor-pointer rounded-xs italic underline outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-faint\";\n\nconst BUBBLE_CLASSES =\n \"relative max-w-75.5 rounded-lg px-space-10 py-1.75 text-body leading-5 break-words whitespace-pre-wrap text-ink\";\n\n/**\n * One turn in the chat panel. Stack turns with a 12px gap (`flex flex-col gap-space-12`), and keep 32px between the\n * last message and the Composer.\n */\nexport function Message({\n from,\n time,\n trace,\n avatar,\n actions,\n reactions,\n meta,\n bubble = false,\n queued = false,\n onEdit,\n onCancel,\n className,\n children,\n ...props\n}: MessageProps) {\n if (from === MESSAGE_AUTHORS.USER) {\n return (\n <div\n data-slot=\"message\"\n data-from={from}\n className={cn(\n \"flex flex-col items-end gap-space-4 self-end\",\n reactions && \"pt-4\",\n queued && \"opacity-60\",\n className,\n )}\n {...props}\n >\n <div className={cn(BUBBLE_CLASSES, \"border border-line bg-bubble\")}>\n {reactions && (\n <div\n data-slot=\"message-reactions\"\n className=\"absolute -top-3.5 -left-3.5 flex items-center gap-0.5 rounded-full border border-line bg-surface px-space-8 text-editor-body leading-7 shadow-card\"\n >\n {reactions}\n </div>\n )}\n {children}\n </div>\n {(meta || time || queued) && (\n <div className=\"flex items-center gap-space-8 px-space-4 text-small text-faint\">\n {meta}\n {queued && (\n <span data-slot=\"message-queued\" className=\"flex items-center gap-1.5 text-muted\">\n <span className=\"italic\">Queued</span>\n {onEdit && (\n <button type=\"button\" onClick={onEdit} className={QUEUED_ACTION_CLASSES}>\n Edit\n </button>\n )}\n {onCancel && (\n <button type=\"button\" onClick={onCancel} className={QUEUED_ACTION_CLASSES}>\n Cancel\n </button>\n )}\n </span>\n )}\n {time && <span>{time}</span>}\n </div>\n )}\n </div>\n );\n }\n\n if (bubble) {\n return (\n <div\n data-slot=\"message\"\n data-from={from}\n className={cn(\"flex flex-col items-start gap-space-4 self-start\", className)}\n {...props}\n >\n <div className={cn(BUBBLE_CLASSES, \"bg-secondary\")}>{children}</div>\n {time && <span className=\"px-space-4 text-small text-faint\">{time}</span>}\n </div>\n );\n }\n\n return (\n <div data-slot=\"message\" data-from={from} className={cn(\"flex gap-2.5 self-stretch\", className)} {...props}>\n {avatar && <div className=\"shrink-0 pt-0.5\">{avatar}</div>}\n <div className=\"flex min-w-0 flex-1 flex-col gap-space-6\">\n {trace}\n <div className=\"flex flex-col gap-space-6 text-body text-ink-2 [&_p]:m-0\">{children}</div>\n {(actions || time) && (\n <div className=\"-ml-1 flex items-center gap-0.5 text-small text-faint\">\n {actions}\n {time && <span className=\"ml-1\">{time}</span>}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const PAGE_HEADER_VARIANTS: {
|
|
3
|
+
/** Apps, Agents, Analytics: title · centred search and tools · CTA. */
|
|
4
|
+
readonly LIST: "list";
|
|
5
|
+
/** One thing: back, title and status, tools on the right. Beside an action, tools drop under the title when they don't fit. */
|
|
6
|
+
readonly DETAIL: "detail";
|
|
7
|
+
};
|
|
8
|
+
export type PageHeaderVariant = (typeof PAGE_HEADER_VARIANTS)[keyof typeof PAGE_HEADER_VARIANTS];
|
|
9
|
+
export interface PageHeaderProps {
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** A row of its own under the title and action, for settings pages. List pages go without. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** A detail page's status line under the title, in 13px `muted`: what the thing is and its state. */
|
|
14
|
+
status?: ReactNode;
|
|
15
|
+
/** Search, sort, filter, view switch. */
|
|
16
|
+
tools?: ReactNode;
|
|
17
|
+
/** The page's one primary action. */
|
|
18
|
+
action?: ReactNode;
|
|
19
|
+
/** Before the title: the mobile nav trigger, or a back button. */
|
|
20
|
+
leading?: ReactNode;
|
|
21
|
+
variant?: PageHeaderVariant;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The top of every page. A list page centres its tools between the title and the main action; a detail page keeps
|
|
26
|
+
* them on the right, beside any action, until the header is too narrow for one row. A settings page's description
|
|
27
|
+
* takes a row of its own under them. It sticks to the top of its Island and, once content scrolls under it, paints
|
|
28
|
+
* the island's own background (and, on a page island, its glow) to hide it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function PageHeader({ title, description, status, tools, action, leading, variant, className, }: PageHeaderProps): import("react").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=page-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-header.d.ts","sourceRoot":"","sources":["../../src/components/page-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAGpF,eAAO,MAAM,oBAAoB;IAC/B,uEAAuE;;IAEvE,+HAA+H;;CAEvH,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEjG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,qGAAqG;IACrG,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yCAAyC;IACzC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsDD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAmC,EACnC,SAAS,GACV,EAAE,eAAe,+BA6GjB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
export const PAGE_HEADER_VARIANTS = {
|
|
6
|
+
/** Apps, Agents, Analytics: title · centred search and tools · CTA. */
|
|
7
|
+
LIST: "list",
|
|
8
|
+
/** One thing: back, title and status, tools on the right. Beside an action, tools drop under the title when they don't fit. */
|
|
9
|
+
DETAIL: "detail",
|
|
10
|
+
};
|
|
11
|
+
/** Watches a zero-height sentinel above the header: once it leaves the scroller, the header is stuck. */
|
|
12
|
+
function useIsStuck() {
|
|
13
|
+
const sentinelRef = useRef(null);
|
|
14
|
+
const [isStuck, setIsStuck] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const sentinel = sentinelRef.current;
|
|
17
|
+
if (!sentinel) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const observer = new IntersectionObserver(([entry]) => setIsStuck(!entry.isIntersecting));
|
|
21
|
+
observer.observe(sentinel);
|
|
22
|
+
return () => observer.disconnect();
|
|
23
|
+
}, []);
|
|
24
|
+
return { sentinelRef, isStuck };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Lines the header's background up with its island's, so the glow runs on behind a stuck header instead of
|
|
28
|
+
* breaking at its edge. A stuck header sits flush with the island's top, so only x and the size vary.
|
|
29
|
+
*/
|
|
30
|
+
function useIslandBackgroundAlignment(headerRef) {
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const header = headerRef.current;
|
|
33
|
+
const island = header?.closest('[data-slot="island"]');
|
|
34
|
+
if (!header || !island) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const align = () => {
|
|
38
|
+
const offsetX = island.getBoundingClientRect().left + island.clientLeft - header.getBoundingClientRect().left;
|
|
39
|
+
header.style.setProperty("--island-bg-x", `${offsetX}px`);
|
|
40
|
+
header.style.setProperty("--island-bg-size", `${island.clientWidth}px ${island.clientHeight}px`);
|
|
41
|
+
};
|
|
42
|
+
align();
|
|
43
|
+
const observer = new ResizeObserver(align);
|
|
44
|
+
observer.observe(island);
|
|
45
|
+
return () => observer.disconnect();
|
|
46
|
+
}, [headerRef]);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The top of every page. A list page centres its tools between the title and the main action; a detail page keeps
|
|
50
|
+
* them on the right, beside any action, until the header is too narrow for one row. A settings page's description
|
|
51
|
+
* takes a row of its own under them. It sticks to the top of its Island and, once content scrolls under it, paints
|
|
52
|
+
* the island's own background (and, on a page island, its glow) to hide it.
|
|
53
|
+
*/
|
|
54
|
+
export function PageHeader({ title, description, status, tools, action, leading, variant = PAGE_HEADER_VARIANTS.LIST, className, }) {
|
|
55
|
+
const headerRef = useRef(null);
|
|
56
|
+
const { sentinelRef, isStuck } = useIsStuck();
|
|
57
|
+
useIslandBackgroundAlignment(headerRef);
|
|
58
|
+
const isList = variant === PAGE_HEADER_VARIANTS.LIST;
|
|
59
|
+
// Without tools there is nothing to centre, so the title takes the free width up to the action.
|
|
60
|
+
const isToolsColumnVisible = isList && Boolean(tools);
|
|
61
|
+
// A detail page's action holds its place beside the title; its tools give way to a row of their own.
|
|
62
|
+
const isToolsRowWrapping = !isList && Boolean(tools) && Boolean(action);
|
|
63
|
+
// With a description the leading takes a column of its own, so the description lines up under the title.
|
|
64
|
+
// Without one it stays in the title row, centred on the title and any status line.
|
|
65
|
+
const isLeadingColumnVisible = Boolean(description);
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-0" }), _jsxs("header", { ref: headerRef, "data-slot": "page-header", "data-stuck": isStuck, className: cn(
|
|
67
|
+
// z-20: above the content scrolling under it, which stacks its own layers at z-10.
|
|
68
|
+
"sticky top-0 z-20 -mx-3 -mt-4 mb-space-24 flex items-start gap-space-8 px-3 pt-4 pb-3",
|
|
69
|
+
// A settings page's description already separates the title from the first card.
|
|
70
|
+
description ? "md:mb-space-16" : "md:mb-11.25",
|
|
71
|
+
// A detail header (back, tile, title, actions) spaces its parts 12px apart, as in the platform design.
|
|
72
|
+
!isList && "gap-space-12", "data-[stuck=true]:bg-panel data-[stuck=true]:[background-position:var(--island-bg-x)_0] data-[stuck=true]:[background-size:var(--island-bg-size)]",
|
|
73
|
+
// Only a page island has a glow; inside a plain panel the stuck header paints the panel alone.
|
|
74
|
+
"in-[[data-slot=island][data-variant=page]]:data-[stuck=true]:bg-page-glow", className), children: [isLeadingColumnVisible && leading, _jsxs("div", { className: cn("min-w-0 flex-1 items-center",
|
|
75
|
+
// Phones wrap instead of using the grid: an action too wide to sit beside the title drops to its own row.
|
|
76
|
+
isList
|
|
77
|
+
? "flex flex-wrap gap-x-space-16 gap-y-space-12 md:grid md:grid-cols-[minmax(0,1fr)_auto]"
|
|
78
|
+
: // Sized by its own width, not the viewport's: that's what decides whether the tools fit.
|
|
79
|
+
"@container flex flex-wrap gap-space-12", isToolsColumnVisible && "md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]"), children: [_jsxs("div", { className: cn("flex min-w-0 items-center gap-space-8", !isList && "gap-space-12",
|
|
80
|
+
// As tall as the leading and the action, so the title centres on both.
|
|
81
|
+
isLeadingColumnVisible && "min-h-8.5",
|
|
82
|
+
// A detail title keeps 15rem before its action drops to a row of its own. Either title takes all but a
|
|
83
|
+
// sliver of the free width while the action shares its row, so the action grows only once it has a row
|
|
84
|
+
// of its own.
|
|
85
|
+
isList ? "grow-999 basis-[min-content] md:basis-auto" : "grow-999 basis-60"), children: [!isLeadingColumnVisible && leading, _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-page-title text-ink", children: title }), status && _jsx("p", { className: "mt-0.5 truncate text-ui text-muted", children: status })] })] }), tools && (_jsx("div", { className: cn("flex min-w-0 items-center gap-space-8", isList && "max-md:order-3 max-md:basis-full md:col-start-2 md:row-start-1", isToolsRowWrapping && "@max-2xl:order-3 @max-2xl:basis-full"), children: tools })), action && (_jsx("div", { className: cn(
|
|
86
|
+
// min-w-0: a control that can shrink (a long custom range) fits the row instead of holding the whole
|
|
87
|
+
// group at its full width.
|
|
88
|
+
"flex min-w-0 items-center gap-space-8",
|
|
89
|
+
// Dropped to a row of its own, it spans the row, and a control given `max-md:grow` stretches across
|
|
90
|
+
// it. A list page's stays right-aligned.
|
|
91
|
+
isList &&
|
|
92
|
+
"max-md:order-2 max-md:ml-auto max-md:grow max-md:justify-end md:col-start-2 md:row-start-1 md:justify-self-end", !isList && "grow", isToolsColumnVisible && "md:col-start-3", isToolsRowWrapping && "@max-2xl:order-2"), children: action })), description && (_jsx("p", { className: "order-last -mt-space-4 basis-full text-body text-muted md:col-span-full md:-mt-space-8", children: description }))] })] })] }));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-header.js","sourceRoot":"","sources":["../../src/components/page-header.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,uEAAuE;IACvE,IAAI,EAAE,MAAM;IACZ,+HAA+H;IAC/H,MAAM,EAAE,QAAQ;CACR,CAAC;AAoBX,yGAAyG;AACzG,SAAS,UAAU;IACjB,MAAM,WAAW,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YAClG,WAAW,GACV,CACL,IACG,IACC,IACR,CACJ,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode, type RefObject } from \"react\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const PAGE_HEADER_VARIANTS = {\n /** Apps, Agents, Analytics: title · centred search and tools · CTA. */\n LIST: \"list\",\n /** One thing: back, title and status, tools on the right. Beside an action, tools drop under the title when they don't fit. */\n DETAIL: \"detail\",\n} as const;\n\nexport type PageHeaderVariant = (typeof PAGE_HEADER_VARIANTS)[keyof typeof PAGE_HEADER_VARIANTS];\n\nexport interface PageHeaderProps {\n title: ReactNode;\n /** A row of its own under the title and action, for settings pages. List pages go without. */\n description?: ReactNode;\n /** A detail page's status line under the title, in 13px `muted`: what the thing is and its state. */\n status?: ReactNode;\n /** Search, sort, filter, view switch. */\n tools?: ReactNode;\n /** The page's one primary action. */\n action?: ReactNode;\n /** Before the title: the mobile nav trigger, or a back button. */\n leading?: ReactNode;\n variant?: PageHeaderVariant;\n className?: string;\n}\n\n/** Watches a zero-height sentinel above the header: once it leaves the scroller, the header is stuck. */\nfunction useIsStuck() {\n const sentinelRef = useRef<HTMLDivElement>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n const sentinel = sentinelRef.current;\n\n if (!sentinel) {\n return;\n }\n\n const observer = new IntersectionObserver(([entry]) => setIsStuck(!entry.isIntersecting));\n\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, []);\n\n return { sentinelRef, isStuck };\n}\n\n/**\n * Lines the header's background up with its island's, so the glow runs on behind a stuck header instead of\n * breaking at its edge. A stuck header sits flush with the island's top, so only x and the size vary.\n */\nfunction useIslandBackgroundAlignment(headerRef: RefObject<HTMLElement | null>) {\n useEffect(() => {\n const header = headerRef.current;\n const island = header?.closest<HTMLElement>('[data-slot=\"island\"]');\n\n if (!header || !island) {\n return;\n }\n\n const align = () => {\n const offsetX = island.getBoundingClientRect().left + island.clientLeft - header.getBoundingClientRect().left;\n\n header.style.setProperty(\"--island-bg-x\", `${offsetX}px`);\n header.style.setProperty(\"--island-bg-size\", `${island.clientWidth}px ${island.clientHeight}px`);\n };\n\n align();\n\n const observer = new ResizeObserver(align);\n\n observer.observe(island);\n\n return () => observer.disconnect();\n }, [headerRef]);\n}\n\n/**\n * The top of every page. A list page centres its tools between the title and the main action; a detail page keeps\n * them on the right, beside any action, until the header is too narrow for one row. A settings page's description\n * takes a row of its own under them. It sticks to the top of its Island and, once content scrolls under it, paints\n * the island's own background (and, on a page island, its glow) to hide it.\n */\nexport function PageHeader({\n title,\n description,\n status,\n tools,\n action,\n leading,\n variant = PAGE_HEADER_VARIANTS.LIST,\n className,\n}: PageHeaderProps) {\n const headerRef = useRef<HTMLElement>(null);\n const { sentinelRef, isStuck } = useIsStuck();\n\n useIslandBackgroundAlignment(headerRef);\n\n const isList = variant === PAGE_HEADER_VARIANTS.LIST;\n // Without tools there is nothing to centre, so the title takes the free width up to the action.\n const isToolsColumnVisible = isList && Boolean(tools);\n // A detail page's action holds its place beside the title; its tools give way to a row of their own.\n const isToolsRowWrapping = !isList && Boolean(tools) && Boolean(action);\n // With a description the leading takes a column of its own, so the description lines up under the title.\n // Without one it stays in the title row, centred on the title and any status line.\n const isLeadingColumnVisible = Boolean(description);\n\n return (\n <>\n <div ref={sentinelRef} aria-hidden=\"true\" className=\"h-0\" />\n <header\n ref={headerRef}\n data-slot=\"page-header\"\n data-stuck={isStuck}\n className={cn(\n // z-20: above the content scrolling under it, which stacks its own layers at z-10.\n \"sticky top-0 z-20 -mx-3 -mt-4 mb-space-24 flex items-start gap-space-8 px-3 pt-4 pb-3\",\n // A settings page's description already separates the title from the first card.\n description ? \"md:mb-space-16\" : \"md:mb-11.25\",\n // A detail header (back, tile, title, actions) spaces its parts 12px apart, as in the platform design.\n !isList && \"gap-space-12\",\n \"data-[stuck=true]:bg-panel data-[stuck=true]:[background-position:var(--island-bg-x)_0] data-[stuck=true]:[background-size:var(--island-bg-size)]\",\n // Only a page island has a glow; inside a plain panel the stuck header paints the panel alone.\n \"in-[[data-slot=island][data-variant=page]]:data-[stuck=true]:bg-page-glow\",\n className\n )}\n >\n {isLeadingColumnVisible && leading}\n\n <div\n className={cn(\n \"min-w-0 flex-1 items-center\",\n // Phones wrap instead of using the grid: an action too wide to sit beside the title drops to its own row.\n isList\n ? \"flex flex-wrap gap-x-space-16 gap-y-space-12 md:grid md:grid-cols-[minmax(0,1fr)_auto]\"\n : // Sized by its own width, not the viewport's: that's what decides whether the tools fit.\n \"@container flex flex-wrap gap-space-12\",\n isToolsColumnVisible && \"md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]\"\n )}\n >\n <div\n className={cn(\n \"flex min-w-0 items-center gap-space-8\",\n !isList && \"gap-space-12\",\n // As tall as the leading and the action, so the title centres on both.\n isLeadingColumnVisible && \"min-h-8.5\",\n // A detail title keeps 15rem before its action drops to a row of its own. Either title takes all but a\n // sliver of the free width while the action shares its row, so the action grows only once it has a row\n // of its own.\n isList ? \"grow-999 basis-[min-content] md:basis-auto\" : \"grow-999 basis-60\"\n )}\n >\n {!isLeadingColumnVisible && leading}\n <div className=\"min-w-0\">\n <h1 className=\"truncate text-page-title text-ink\">{title}</h1>\n {status && <p className=\"mt-0.5 truncate text-ui text-muted\">{status}</p>}\n </div>\n </div>\n\n {tools && (\n <div\n className={cn(\n \"flex min-w-0 items-center gap-space-8\",\n isList && \"max-md:order-3 max-md:basis-full md:col-start-2 md:row-start-1\",\n isToolsRowWrapping && \"@max-2xl:order-3 @max-2xl:basis-full\"\n )}\n >\n {tools}\n </div>\n )}\n\n {action && (\n <div\n className={cn(\n // min-w-0: a control that can shrink (a long custom range) fits the row instead of holding the whole\n // group at its full width.\n \"flex min-w-0 items-center gap-space-8\",\n // Dropped to a row of its own, it spans the row, and a control given `max-md:grow` stretches across\n // it. A list page's stays right-aligned.\n isList &&\n \"max-md:order-2 max-md:ml-auto max-md:grow max-md:justify-end md:col-start-2 md:row-start-1 md:justify-self-end\",\n !isList && \"grow\",\n isToolsColumnVisible && \"md:col-start-3\",\n isToolsRowWrapping && \"@max-2xl:order-2\"\n )}\n >\n {action}\n </div>\n )}\n\n {/* Under the title and the action, across the full width, so on a phone the action stays beside the title\n and the description wraps on the whole row. Pulled up to sit 8px under it on a phone, 4px on desktop. */}\n {description && (\n <p className=\"order-last -mt-space-4 basis-full text-body text-muted md:col-span-full md:-mt-space-8\">\n {description}\n </p>\n )}\n </div>\n </header>\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
/** The current page, 1-based. */
|
|
3
|
+
page: number;
|
|
4
|
+
/** Rows per page. */
|
|
5
|
+
pageSize: number;
|
|
6
|
+
/** All rows, across pages. */
|
|
7
|
+
total: number;
|
|
8
|
+
onPageChange: (page: number) => void;
|
|
9
|
+
/** With options and a handler, a "Rows per page" select leads the row. */
|
|
10
|
+
pageSizeOptions?: number[];
|
|
11
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
12
|
+
/** Page numbers between the arrows instead of the range: only where people jump around (audit log). */
|
|
13
|
+
isPageListVisible?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Paging through a long table or list: "1–10 of 134" with previous and next, optionally a rows-per-page select,
|
|
18
|
+
* optionally page numbers where people jump around. An empty one reads "0–0 of 0".
|
|
19
|
+
*/
|
|
20
|
+
declare function Pagination({ page, pageSize, total, onPageChange, pageSizeOptions, onPageSizeChange, isPageListVisible, className, }: PaginationProps): import("react").JSX.Element;
|
|
21
|
+
export { Pagination };
|
|
22
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,uGAAuG;IACvG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAClB,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,iBAAyB,EACzB,SAAS,GACV,EAAE,eAAe,+BA+EjB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { BUTTON_SIZES, BUTTON_VARIANTS, Button } from "./button.js";
|
|
6
|
+
import { SELECT_TRIGGER_SIZES, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
7
|
+
const ELLIPSIS = "…";
|
|
8
|
+
// One locale on the server and in the browser, so the prerendered range matches the hydrated one.
|
|
9
|
+
const NUMBER_FORMAT = new Intl.NumberFormat("en-US");
|
|
10
|
+
function listPageNumbers(page, pageCount) {
|
|
11
|
+
const numbers = [];
|
|
12
|
+
for (let current = 1; current <= pageCount; current++) {
|
|
13
|
+
if (current === 1 || current === pageCount || Math.abs(current - page) <= 1) {
|
|
14
|
+
numbers.push(current);
|
|
15
|
+
}
|
|
16
|
+
else if (numbers[numbers.length - 1] !== ELLIPSIS) {
|
|
17
|
+
numbers.push(ELLIPSIS);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return numbers;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Paging through a long table or list: "1–10 of 134" with previous and next, optionally a rows-per-page select,
|
|
24
|
+
* optionally page numbers where people jump around. An empty one reads "0–0 of 0".
|
|
25
|
+
*/
|
|
26
|
+
function Pagination({ page, pageSize, total, onPageChange, pageSizeOptions, onPageSizeChange, isPageListVisible = false, className, }) {
|
|
27
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
28
|
+
const rangeStart = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
29
|
+
const rangeEnd = Math.min(total, page * pageSize);
|
|
30
|
+
const isPageSizeSelectVisible = Boolean(pageSizeOptions && onPageSizeChange);
|
|
31
|
+
const goToPage = (next) => onPageChange(Math.min(pageCount, Math.max(1, next)));
|
|
32
|
+
return (_jsxs("nav", { "aria-label": "Pagination", "data-slot": "pagination", className: cn("flex items-center justify-end gap-space-4 text-ui text-muted", className), children: [isPageSizeSelectVisible && (_jsxs("span", { className: "mr-auto inline-flex items-center gap-space-8", children: ["Rows per page", _jsxs(Select, { value: String(pageSize), onValueChange: (value) => value !== null && onPageSizeChange?.(Number(value)), children: [_jsx(SelectTrigger, { size: SELECT_TRIGGER_SIZES.SM, className: "w-auto", "aria-label": "Rows per page", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: pageSizeOptions?.map((option) => (_jsx(SelectItem, { value: String(option), children: option }, option))) })] })] })), !isPageListVisible && (_jsxs("span", { className: "mr-space-8 tabular-nums", children: [NUMBER_FORMAT.format(rangeStart), "\u2013", NUMBER_FORMAT.format(rangeEnd), " of ", NUMBER_FORMAT.format(total)] })), _jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON, "aria-label": "Previous page", disabled: page <= 1, className: "disabled:opacity-40", onClick: () => goToPage(page - 1), children: _jsx(ChevronLeft, {}) }), isPageListVisible &&
|
|
33
|
+
listPageNumbers(page, pageCount).map((item, index) => item === ELLIPSIS ? (_jsx("span", { children: ELLIPSIS }, `ellipsis-${index}`)) : (_jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON, "aria-current": item === page ? "page" : undefined, onClick: () => goToPage(item), className: "text-ui text-ink-2 aria-[current=page]:bg-selected aria-[current=page]:text-ink aria-[current=page]:shadow-card aria-[current=page]:ring-1 aria-[current=page]:ring-inset aria-[current=page]:ring-selected-edge", children: item }, item))), _jsx(Button, { variant: BUTTON_VARIANTS.GHOST, size: BUTTON_SIZES.ICON, "aria-label": "Next page", disabled: page >= pageCount, className: "disabled:opacity-40", onClick: () => goToPage(page + 1), children: _jsx(ChevronRight, {}) })] }));
|
|
34
|
+
}
|
|
35
|
+
export { Pagination };
|
|
36
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAc,CAAC;AAEnH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,kGAAkG;AAClG,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAkBrD,SAAS,eAAe,CAAC,IAAY,EAAE,SAAiB;IACtD,MAAM,OAAO,GAAiC,EAAE,CAAC;IAEjD,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IA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,CAAC,CAClB,yBAAiC,QAAQ,IAA9B,YAAY,KAAK,EAAE,CAAmB,CAClD,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IAEL,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,IAAI,EAAE,YAAY,CAAC,IAAI,kBACT,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B,SAAS,EAAC,kNAAkN,YAE3N,IAAI,IAPA,IAAI,CAQF,CACV,CACF,EAEH,KAAC,MAAM,IACL,OAAO,EAAE,eAAe,CAAC,KAAK,EAC9B,IAAI,EAAE,YAAY,CAAC,IAAI,gBACZ,WAAW,EACtB,QAAQ,EAAE,IAAI,IAAI,SAAS,EAC3B,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,YAEjC,KAAC,YAAY,KAAG,GACT,IACL,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn.ts\";\nimport { BUTTON_SIZES, BUTTON_VARIANTS, Button } from \"./button.tsx\";\nimport { SELECT_TRIGGER_SIZES, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"./select.tsx\";\n\nconst ELLIPSIS = \"…\";\n\n// One locale on the server and in the browser, so the prerendered range matches the hydrated one.\nconst NUMBER_FORMAT = new Intl.NumberFormat(\"en-US\");\n\nexport interface PaginationProps {\n /** The current page, 1-based. */\n page: number;\n /** Rows per page. */\n pageSize: number;\n /** All rows, across pages. */\n total: number;\n onPageChange: (page: number) => void;\n /** With options and a handler, a \"Rows per page\" select leads the row. */\n pageSizeOptions?: number[];\n onPageSizeChange?: (pageSize: number) => void;\n /** Page numbers between the arrows instead of the range: only where people jump around (audit log). */\n isPageListVisible?: boolean;\n className?: string;\n}\n\nfunction listPageNumbers(page: number, pageCount: number): (number | typeof ELLIPSIS)[] {\n const numbers: (number | typeof ELLIPSIS)[] = [];\n\n for (let current = 1; current <= pageCount; current++) {\n if (current === 1 || current === pageCount || Math.abs(current - page) <= 1) {\n numbers.push(current);\n } else if (numbers[numbers.length - 1] !== ELLIPSIS) {\n numbers.push(ELLIPSIS);\n }\n }\n\n return numbers;\n}\n\n/**\n * Paging through a long table or list: \"1–10 of 134\" with previous and next, optionally a rows-per-page select,\n * optionally page numbers where people jump around. An empty one reads \"0–0 of 0\".\n */\nfunction Pagination({\n page,\n pageSize,\n total,\n onPageChange,\n pageSizeOptions,\n onPageSizeChange,\n isPageListVisible = false,\n className,\n}: PaginationProps) {\n const pageCount = Math.max(1, Math.ceil(total / pageSize));\n const rangeStart = total === 0 ? 0 : (page - 1) * pageSize + 1;\n const rangeEnd = Math.min(total, page * pageSize);\n const isPageSizeSelectVisible = Boolean(pageSizeOptions && onPageSizeChange);\n\n const goToPage = (next: number) => onPageChange(Math.min(pageCount, Math.max(1, next)));\n\n return (\n <nav\n aria-label=\"Pagination\"\n data-slot=\"pagination\"\n className={cn(\"flex items-center justify-end gap-space-4 text-ui text-muted\", className)}\n >\n {isPageSizeSelectVisible && (\n <span className=\"mr-auto inline-flex items-center gap-space-8\">\n Rows per page\n <Select value={String(pageSize)} onValueChange={(value) => value !== null && onPageSizeChange?.(Number(value))}>\n <SelectTrigger size={SELECT_TRIGGER_SIZES.SM} className=\"w-auto\" aria-label=\"Rows per page\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions?.map((option) => (\n <SelectItem key={option} value={String(option)}>\n {option}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </span>\n )}\n\n {!isPageListVisible && (\n <span className=\"mr-space-8 tabular-nums\">\n {NUMBER_FORMAT.format(rangeStart)}–{NUMBER_FORMAT.format(rangeEnd)} of {NUMBER_FORMAT.format(total)}\n </span>\n )}\n\n <Button\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON}\n aria-label=\"Previous page\"\n disabled={page <= 1}\n className=\"disabled:opacity-40\"\n onClick={() => goToPage(page - 1)}\n >\n <ChevronLeft />\n </Button>\n\n {isPageListVisible &&\n listPageNumbers(page, pageCount).map((item, index) =>\n item === ELLIPSIS ? (\n <span key={`ellipsis-${index}`}>{ELLIPSIS}</span>\n ) : (\n <Button\n key={item}\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON}\n aria-current={item === page ? \"page\" : undefined}\n onClick={() => goToPage(item)}\n className=\"text-ui text-ink-2 aria-[current=page]:bg-selected aria-[current=page]:text-ink aria-[current=page]:shadow-card aria-[current=page]:ring-1 aria-[current=page]:ring-inset aria-[current=page]:ring-selected-edge\"\n >\n {item}\n </Button>\n )\n )}\n\n <Button\n variant={BUTTON_VARIANTS.GHOST}\n size={BUTTON_SIZES.ICON}\n aria-label=\"Next page\"\n disabled={page >= pageCount}\n className=\"disabled:opacity-40\"\n onClick={() => goToPage(page + 1)}\n >\n <ChevronRight />\n </Button>\n </nav>\n );\n}\n\nexport { Pagination };\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
/** A masked field with a show/hide icon button inside its right edge. Takes every `<input>` prop but `type`. */
|
|
3
|
+
declare function PasswordInput({ className, disabled, ...props }: Omit<ComponentProps<"input">, "type">): import("react").JSX.Element;
|
|
4
|
+
export { PasswordInput };
|
|
5
|
+
//# sourceMappingURL=password-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-input.d.ts","sourceRoot":"","sources":["../../src/components/password-input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAUtD,gHAAgH;AAChH,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,+BAiB9F;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
5
|
+
import { INPUT_GROUP_ADDON_ALIGNS, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "./input-group.js";
|
|
6
|
+
/** A masked field with a show/hide icon button inside its right edge. Takes every `<input>` prop but `type`. */
|
|
7
|
+
function PasswordInput({ className, disabled, ...props }) {
|
|
8
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
9
|
+
return (_jsxs(InputGroup, { className: className, children: [_jsx(InputGroupInput, { type: isPasswordVisible ? "text" : "password", disabled: disabled, ...props }), _jsx(InputGroupAddon, { align: INPUT_GROUP_ADDON_ALIGNS.INLINE_END, children: _jsx(InputGroupButton, { "aria-label": isPasswordVisible ? "Hide password" : "Show password", disabled: disabled, onClick: () => setIsPasswordVisible((isVisible) => !isVisible), children: isPasswordVisible ? _jsx(EyeOff, {}) : _jsx(Eye, {}) }) })] }));
|
|
10
|
+
}
|
|
11
|
+
export { PasswordInput };
|
|
12
|
+
//# sourceMappingURL=password-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-input.js","sourceRoot":"","sources":["../../src/components/password-input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,kBAAmB,CAAC;AAE3B,gHAAgH;AAChH,SAAS,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAyC;IAC7F,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElE,OAAO,CACL,MAAC,UAAU,IAAC,SAAS,EAAE,SAAS,aAC9B,KAAC,eAAe,IAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,KAAM,KAAK,GAAI,EACjG,KAAC,eAAe,IAAC,KAAK,EAAE,wBAAwB,CAAC,UAAU,YACzD,KAAC,gBAAgB,kBACH,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,EACjE,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,YAE7D,iBAAiB,CAAC,CAAC,CAAC,KAAC,MAAM,KAAG,CAAC,CAAC,CAAC,KAAC,GAAG,KAAG,GACxB,GACH,IACP,CACd,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport { useState, type ComponentProps } from \"react\";\nimport { Eye, EyeOff } from \"lucide-react\";\nimport {\n INPUT_GROUP_ADDON_ALIGNS,\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./input-group.tsx\";\n\n/** A masked field with a show/hide icon button inside its right edge. Takes every `<input>` prop but `type`. */\nfunction PasswordInput({ className, disabled, ...props }: Omit<ComponentProps<\"input\">, \"type\">) {\n const [isPasswordVisible, setIsPasswordVisible] = useState(false);\n\n return (\n <InputGroup className={className}>\n <InputGroupInput type={isPasswordVisible ? \"text\" : \"password\"} disabled={disabled} {...props} />\n <InputGroupAddon align={INPUT_GROUP_ADDON_ALIGNS.INLINE_END}>\n <InputGroupButton\n aria-label={isPasswordVisible ? \"Hide password\" : \"Show password\"}\n disabled={disabled}\n onClick={() => setIsPasswordVisible((isVisible) => !isVisible)}\n >\n {isPasswordVisible ? <EyeOff /> : <Eye />}\n </InputGroupButton>\n </InputGroupAddon>\n </InputGroup>\n );\n}\n\nexport { PasswordInput };\n"]}
|