@conscience-technology/ovenn 0.6.7 → 0.7.2
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/assets/components/AIMessage/AIMessage.module.css +23 -1
- package/assets/components/AIMessage/AIMessage.tsx +27 -7
- package/assets/components/Accordion/Accordion.module.css +3 -0
- package/assets/components/AppFrame/AppFrame.module.css +2 -0
- package/assets/components/AttachmentItem/AttachmentItem.module.css +50 -13
- package/assets/components/AttachmentItem/AttachmentItem.tsx +25 -8
- package/assets/components/AttachmentThumb/AttachmentThumb.module.css +12 -9
- package/assets/components/Avatar/Avatar.module.css +26 -11
- package/assets/components/Avatar/Avatar.tsx +1 -1
- package/assets/components/AvatarUpload/AvatarUpload.module.css +4 -3
- package/assets/components/Badge/Badge.module.css +96 -70
- package/assets/components/Badge/Badge.tsx +33 -25
- package/assets/components/Breadcrumb/Breadcrumb.module.css +8 -4
- package/assets/components/Breadcrumb/Breadcrumb.tsx +1 -1
- package/assets/components/Bubble/Bubble.module.css +6 -0
- package/assets/components/Button/Button.module.css +6 -0
- package/assets/components/Calendar/Calendar.module.css +244 -0
- package/assets/components/Calendar/Calendar.tsx +419 -0
- package/assets/components/Calendar/index.ts +2 -0
- package/assets/components/Callout/Callout.module.css +54 -7
- package/assets/components/Callout/Callout.tsx +26 -2
- package/assets/components/Callout/index.ts +1 -1
- package/assets/components/Canvas/Canvas.module.css +75 -0
- package/assets/components/Canvas/Canvas.tsx +699 -0
- package/assets/components/Canvas/alignment.ts +34 -0
- package/assets/components/Canvas/clipboard.ts +30 -0
- package/assets/components/Canvas/collision.ts +67 -0
- package/assets/components/Canvas/edgeOptions.ts +11 -0
- package/assets/components/Canvas/graph.ts +11 -0
- package/assets/components/Canvas/history.ts +41 -0
- package/assets/components/Canvas/index.ts +4 -0
- package/assets/components/Canvas/selection.ts +56 -0
- package/assets/components/Canvas/tokens.css +61 -0
- package/assets/components/Canvas/types.ts +27 -0
- package/assets/components/Canvas/useCanvasSettlement.ts +79 -0
- package/assets/components/CanvasEdge/CanvasEdge.module.css +62 -0
- package/assets/components/CanvasEdge/CanvasEdge.tsx +121 -0
- package/assets/components/CanvasEdge/geometry.ts +350 -0
- package/assets/components/CanvasEdge/index.ts +4 -0
- package/assets/components/CanvasEdge/interactions.ts +14 -0
- package/assets/components/CanvasEdge/tokens.css +29 -0
- package/assets/components/CanvasNode/CanvasNode.module.css +234 -30
- package/assets/components/CanvasNode/CanvasNode.tsx +95 -28
- package/assets/components/CanvasNode/index.ts +1 -1
- package/assets/components/CanvasNode/runningOutline.ts +59 -0
- package/assets/components/CanvasNode/tokens.css +76 -13
- package/assets/components/Card/Card.module.css +5 -0
- package/assets/components/Chart/Chart.module.css +278 -0
- package/assets/components/Chart/Chart.tsx +385 -0
- package/assets/components/Chart/entrance.tsx +57 -0
- package/assets/components/Chart/index.ts +14 -0
- package/assets/components/ChatComposer/ChatComposer.module.css +17 -0
- package/assets/components/ChatComposer/ChatComposer.tsx +131 -0
- package/assets/components/ChatComposer/index.ts +2 -0
- package/assets/components/ChatInput/ChatInput.module.css +197 -30
- package/assets/components/ChatInput/ChatInput.tsx +137 -45
- package/assets/components/ChatInput/SendButton.tsx +4 -1
- package/assets/components/ChatInput/index.ts +5 -0
- package/assets/components/ChatMessage/ChatMessage.module.css +19 -0
- package/assets/components/ChatMessage/ChatMessage.tsx +63 -0
- package/assets/components/ChatMessage/index.ts +2 -0
- package/assets/components/ChatReactions/ChatReactions.module.css +15 -0
- package/assets/components/ChatReactions/ChatReactions.tsx +58 -0
- package/assets/components/ChatReactions/index.ts +2 -0
- package/assets/components/Checkbox/Checkbox.module.css +39 -0
- package/assets/components/Checkbox/Checkbox.tsx +99 -14
- package/assets/components/Checkbox/index.ts +1 -1
- package/assets/components/CheckboxCard/CheckboxCard.module.css +1 -177
- package/assets/components/CheckboxCard/CheckboxCard.tsx +6 -72
- package/assets/components/Chip/Chip.module.css +20 -30
- package/assets/components/Code/Code.module.css +1 -0
- package/assets/components/CodeBlock/CodeBlock.module.css +113 -13
- package/assets/components/CodeBlock/CodeBlock.tsx +114 -29
- package/assets/components/CodeBlock/SyntaxHighlight.tsx +20 -0
- package/assets/components/CodeBlock/diff-lines.ts +21 -0
- package/assets/components/CodeBlock/index.ts +2 -1
- package/assets/components/CodeBlock/line-preview.ts +7 -0
- package/assets/components/CodeBlock/syntax-highlighter.ts +96 -0
- package/assets/components/CodeBlock/use-syntax-tokens.ts +17 -0
- package/assets/components/ColorArea/ColorArea.module.css +3 -0
- package/assets/components/ColorField/ColorField.module.css +19 -190
- package/assets/components/ColorField/ColorField.tsx +116 -107
- package/assets/components/ColorPicker/ColorPicker.module.css +310 -0
- package/assets/components/ColorPicker/ColorPicker.tsx +387 -0
- package/assets/components/ColorPicker/index.ts +16 -0
- package/assets/components/ColorSlider/ColorSlider.module.css +15 -12
- package/assets/components/ColorSlider/ColorSlider.tsx +3 -3
- package/assets/components/ColorSwatch/ColorSwatch.module.css +2 -2
- package/assets/components/ColorSwatchPicker/ColorSwatchPicker.module.css +4 -3
- package/assets/components/Combobox/Combobox.module.css +21 -4
- package/assets/components/Combobox/Combobox.tsx +38 -22
- package/assets/components/CommandPalette/CommandPalette.module.css +19 -24
- package/assets/components/CommandPalette/CommandPalette.tsx +7 -5
- package/assets/components/Comment/Comment.module.css +25 -0
- package/assets/components/Comment/Comment.tsx +44 -0
- package/assets/components/Comment/CommentComposer.module.css +26 -0
- package/assets/components/Comment/CommentComposer.tsx +56 -0
- package/assets/components/Comment/CommentEditor.module.css +8 -0
- package/assets/components/Comment/CommentEditor.tsx +43 -0
- package/assets/components/Comment/CommentMentionInput.module.css +9 -0
- package/assets/components/Comment/CommentMentionInput.tsx +150 -0
- package/assets/components/Comment/index.ts +9 -0
- package/assets/components/Comment/types.ts +1 -0
- package/assets/components/ContextMenu/ContextMenu.module.css +5 -2
- package/assets/components/ContextMenu/ContextMenu.tsx +5 -0
- package/assets/components/ControlGroup/ControlGroup.module.css +20 -7
- package/assets/components/DataTable/DataTable.module.css +2 -0
- package/assets/components/DatePicker/DateField.tsx +72 -25
- package/assets/components/DatePicker/DatePicker.module.css +56 -54
- package/assets/components/DatePicker/DatePicker.tsx +86 -40
- package/assets/components/DatePicker/TimeSelector.tsx +1 -1
- package/assets/components/Disclosure/Disclosure.module.css +1 -0
- package/assets/components/Drawer/Drawer.module.css +23 -19
- package/assets/components/Drawer/Drawer.tsx +20 -24
- package/assets/components/DropdownMenu/DropdownMenu.tsx +5 -0
- package/assets/components/EmojiPicker/EmojiGlyph.module.css +2 -0
- package/assets/components/EmojiPicker/EmojiGlyph.tsx +12 -0
- package/assets/components/EmojiPicker/EmojiPicker.module.css +43 -0
- package/assets/components/EmojiPicker/EmojiPicker.tsx +143 -0
- package/assets/components/EmojiPicker/UNICODE-LICENSE.txt +39 -0
- package/assets/components/EmojiPicker/data.ts +41 -0
- package/assets/components/EmojiPicker/emojiData-0.json +1 -0
- package/assets/components/EmojiPicker/emojiData-1.json +1 -0
- package/assets/components/EmojiPicker/emojiData-2.json +1 -0
- package/assets/components/EmojiPicker/emojiData-3.json +1 -0
- package/assets/components/EmojiPicker/emojiData.sources.json +35 -0
- package/assets/components/EmojiPicker/emojiData.ts +8 -0
- package/assets/components/EmojiPicker/emojiFallbacks.json +1 -0
- package/assets/components/EmojiPicker/index.ts +4 -0
- package/assets/components/EmptyState/EmptyState.module.css +2 -2
- package/assets/components/EventChip/EventChip.module.css +120 -53
- package/assets/components/EventChip/EventChip.tsx +54 -6
- package/assets/components/EventChip/index.ts +1 -1
- package/assets/components/EventListItem/EventListItem.module.css +3 -0
- package/assets/components/EventListItem/EventListItem.tsx +15 -8
- package/assets/components/FileIcon/FileIcon.module.css +6 -6
- package/assets/components/FileUpload/FileUpload.module.css +10 -3
- package/assets/components/FileUpload/FileUpload.tsx +5 -9
- package/assets/components/FileUpload/FileUploadItem.tsx +34 -0
- package/assets/components/GalleryItem/GalleryItem.module.css +16 -19
- package/assets/components/GeneratedImage/GeneratedImage.module.css +2 -0
- package/assets/components/Icon/Icon.tsx +264 -1088
- package/assets/components/Icon/LucideFamilyIcon.tsx +436 -0
- package/assets/components/Icon/MissingIcon.tsx +25 -0
- package/assets/components/Icon/SolarFamilyIcon.tsx +443 -0
- package/assets/components/Icon/catalogNames.ts +8 -0
- package/assets/components/Icon/context.tsx +1 -1
- package/assets/components/Icon/index.ts +2 -0
- package/assets/components/Icon/lucideCatalog.ts +11358 -0
- package/assets/components/Icon/phosphorCatalog.ts +3052 -0
- package/assets/components/Icon/solarCatalog.ts +16064 -0
- package/assets/components/IconButton/IconButton.module.css +3 -2
- package/assets/components/Input/Input.module.css +63 -22
- package/assets/components/Input/Input.tsx +21 -10
- package/assets/components/Kanban/Kanban.module.css +6 -0
- package/assets/components/ListItem/ListItem.module.css +9 -6
- package/assets/components/MenuItem/MenuItem.module.css +24 -22
- package/assets/components/MenuItem/MenuItem.tsx +12 -12
- package/assets/components/MessageActions/MessageActions.module.css +38 -2
- package/assets/components/MessageActions/MessageActions.tsx +53 -28
- package/assets/components/MessageQuote/MessageQuote.module.css +1 -0
- package/assets/components/MessageSources/MessageSources.module.css +2 -0
- package/assets/components/MessageState/MessageState.module.css +1 -1
- package/assets/components/MetricCard/MetricCard.module.css +96 -108
- package/assets/components/MetricCard/MetricCard.tsx +45 -23
- package/assets/components/MetricCard/tokens.css +10 -0
- package/assets/components/MiniCalendar/MiniCalendar.module.css +130 -0
- package/assets/components/MiniCalendar/MiniCalendar.tsx +161 -0
- package/assets/components/MiniCalendar/index.ts +2 -0
- package/assets/components/Modal/Modal.module.css +13 -4
- package/assets/components/Modal/Modal.tsx +4 -0
- package/assets/components/Onboarding/LayoutBuilder.tsx +12 -50
- package/assets/components/Onboarding/Onboarding.module.css +211 -278
- package/assets/components/Onboarding/OnboardingAxisPanel.tsx +81 -125
- package/assets/components/Onboarding/OnboardingPage.tsx +244 -467
- package/assets/components/Onboarding/actions.ts +5 -0
- package/assets/components/Onboarding/palette.css +8 -0
- package/assets/components/Onboarding/wizardData.ts +8 -8
- package/assets/components/ProgressBar/ProgressBar.module.css +42 -8
- package/assets/components/ProgressBar/ProgressBar.tsx +5 -6
- package/assets/components/ProgressBar/index.ts +0 -1
- package/assets/components/QuotationBar/QuotationBar.module.css +2 -0
- package/assets/components/Radio/Radio.module.css +2 -0
- package/assets/components/RadioCard/RadioCard.module.css +96 -3
- package/assets/components/RadioCard/RadioCard.tsx +76 -13
- package/assets/components/RadioCard/index.ts +1 -1
- package/assets/components/SegmentedChart/SegmentedChart.module.css +16 -0
- package/assets/components/SegmentedChart/SegmentedChart.tsx +25 -8
- package/assets/components/Select/Select.module.css +9 -7
- package/assets/components/Select/Select.tsx +22 -6
- package/assets/components/Shortcut/Shortcut.module.css +2 -0
- package/assets/components/Sidebar/Sidebar.module.css +1 -0
- package/assets/components/Sidebar/Sidebar.tsx +2 -2
- package/assets/components/Skeleton/Skeleton.module.css +33 -0
- package/assets/components/Skeleton/Skeleton.tsx +20 -0
- package/assets/components/Skeleton/index.ts +2 -0
- package/assets/components/Skeleton/tokens.css +11 -0
- package/assets/components/Slider/Slider.module.css +3 -0
- package/assets/components/Slider/Slider.tsx +7 -2
- package/assets/components/Spinner/LottiePlayer.tsx +4 -4
- package/assets/components/Spinner/Spinner.module.css +3 -0
- package/assets/components/Spinner/lottieManifest.ts +3 -0
- package/assets/components/Stepper/Stepper.module.css +56 -8
- package/assets/components/Stepper/Stepper.tsx +13 -4
- package/assets/components/Switch/Switch.module.css +55 -42
- package/assets/components/Switch/Switch.tsx +6 -2
- package/assets/components/Switch/index.ts +1 -1
- package/assets/components/TabStrip/TabStrip.module.css +5 -1
- package/assets/components/TableCell/TableCell.module.css +8 -1
- package/assets/components/TableCell/TableCellBadge.tsx +7 -3
- package/assets/components/TableCell/TableCellImage.tsx +1 -1
- package/assets/components/TableCell/TableCellTag.tsx +23 -0
- package/assets/components/TableCell/index.ts +3 -0
- package/assets/components/TableHeader/TableHeader.module.css +4 -0
- package/assets/components/TableRow/TableRow.module.css +3 -0
- package/assets/components/TableRowEdit/TableRowEdit.module.css +2 -0
- package/assets/components/TableToolbar/TableToolbar.module.css +1 -0
- package/assets/components/Tabs/Tabs.module.css +23 -8
- package/assets/components/Tabs/Tabs.tsx +4 -3
- package/assets/components/Tag/Tag.module.css +101 -0
- package/assets/components/Tag/Tag.tsx +55 -0
- package/assets/components/Tag/index.ts +2 -0
- package/assets/components/TemplateBoundary/TemplateBoundary.tsx +22 -18
- package/assets/components/TemplateBoundary/types.ts +2 -0
- package/assets/components/Textarea/Textarea.module.css +30 -226
- package/assets/components/Textarea/Textarea.tsx +2 -2
- package/assets/components/ThemeController.tsx +30 -3
- package/assets/components/TimePicker/TimePicker.module.css +17 -4
- package/assets/components/TimePicker/TimePicker.tsx +102 -23
- package/assets/components/TimelineView/TimelineEventBar.tsx +109 -0
- package/assets/components/TimelineView/TimelineView.module.css +203 -0
- package/assets/components/TimelineView/TimelineView.tsx +137 -0
- package/assets/components/TimelineView/axis.ts +62 -0
- package/assets/components/TimelineView/index.ts +3 -0
- package/assets/components/TimelineView/layout.ts +56 -0
- package/assets/components/TimelineView/move.ts +51 -0
- package/assets/components/TimelineView/useTimelineDrag.ts +215 -0
- package/assets/components/TimelineView/useTimelineZoom.ts +92 -0
- package/assets/components/Toast/Toast.module.css +20 -0
- package/assets/components/Toast/Toast.tsx +1 -1
- package/assets/components/Toolbar/Toolbar.module.css +31 -24
- package/assets/components/Toolbar/Toolbar.tsx +4 -3
- package/assets/components/Tooltip/Tooltip.module.css +10 -0
- package/assets/components/Tooltip/Tooltip.tsx +50 -15
- package/assets/components/TopLoader/TopLoader.module.css +1 -0
- package/assets/components/TreeNav/TreeNav.module.css +1 -0
- package/assets/components/UserMessage/UserMessage.module.css +110 -1
- package/assets/components/UserMessage/UserMessage.tsx +138 -16
- package/assets/components/UserMessage/index.ts +4 -0
- package/assets/components/_color.ts +2 -2
- package/assets/components/_data.ts +37 -31
- package/assets/components/_utils.css +36 -5
- package/assets/components/axisOptions.ts +2 -0
- package/assets/components/component-registry.json +1731 -94
- package/assets/components/index.ts +23 -0
- package/assets/components/materialScope.tsx +11 -0
- package/assets/components/reset.css +1 -0
- package/assets/components/themeBootScript.ts +3 -2
- package/assets/components/tokens.css +308 -71
- package/assets/components/useChartEntrance.ts +119 -0
- package/assets/prompts/ASSEMBLY.md +20 -7
- package/assets/prompts/CATALOG.md +110 -92
- package/assets/prompts/FEEDBACK_PROCESS.md +19 -0
- package/assets/prompts/PRINCIPLES.md +25 -1
- package/assets/prompts/TEMPLATE_PREVIEWS.md +21 -0
- package/assets/prompts/WORKFLOW_DESIGN.md +48 -70
- package/assets/prompts/axes/font.md +12 -1
- package/assets/prompts/axes/icon.md +6 -4
- package/assets/prompts/axes/material.md +40 -0
- package/assets/prompts/axes/motion.md +2 -0
- package/assets/prompts/axes/palette.md +10 -2
- package/assets/prompts/axes/shape.md +8 -0
- package/assets/prompts/axes/voice.md +4 -0
- package/assets/prompts/components/README.md +3 -3
- package/assets/prompts/components/_variants.md +35 -35
- package/assets/prompts/components/accordion.md +15 -15
- package/assets/prompts/components/ai-message.md +14 -12
- package/assets/prompts/components/app-frame.md +16 -16
- package/assets/prompts/components/attachment-item.md +38 -31
- package/assets/prompts/components/attachment-thumb.md +14 -12
- package/assets/prompts/components/avatar-upload.md +10 -10
- package/assets/prompts/components/avatar.md +16 -16
- package/assets/prompts/components/badge.md +32 -97
- package/assets/prompts/components/breadcrumb.md +25 -24
- package/assets/prompts/components/bubble.md +13 -13
- package/assets/prompts/components/button-group.md +1 -1
- package/assets/prompts/components/button.md +36 -36
- package/assets/prompts/components/calendar.md +151 -0
- package/assets/prompts/components/callout.md +39 -23
- package/assets/prompts/components/canvas-edge.md +70 -0
- package/assets/prompts/components/canvas-node.md +27 -10
- package/assets/prompts/components/canvas.md +85 -0
- package/assets/prompts/components/card.md +31 -31
- package/assets/prompts/components/chart-bar.md +77 -0
- package/assets/prompts/components/chart-pie.md +63 -0
- package/assets/prompts/components/chart-radar.md +56 -0
- package/assets/prompts/components/chart-radial.md +56 -0
- package/assets/prompts/components/chart.md +129 -0
- package/assets/prompts/components/chat-composer.md +71 -0
- package/assets/prompts/components/chat-input.md +82 -27
- package/assets/prompts/components/chat-message.md +48 -0
- package/assets/prompts/components/chat-reactions.md +38 -0
- package/assets/prompts/components/checkbox-card.md +26 -45
- package/assets/prompts/components/checkbox.md +40 -17
- package/assets/prompts/components/chip.md +34 -34
- package/assets/prompts/components/code-block.md +109 -65
- package/assets/prompts/components/code.md +4 -4
- package/assets/prompts/components/color-area.md +9 -9
- package/assets/prompts/components/color-field.md +17 -13
- package/assets/prompts/components/color-picker.md +173 -0
- package/assets/prompts/components/color-slider.md +14 -14
- package/assets/prompts/components/color-swatch-picker.md +8 -8
- package/assets/prompts/components/color-swatch.md +9 -9
- package/assets/prompts/components/combobox.md +5 -2
- package/assets/prompts/components/command-palette.md +31 -30
- package/assets/prompts/components/comment.md +75 -0
- package/assets/prompts/components/context-menu.md +28 -25
- package/assets/prompts/components/control-group.md +4 -4
- package/assets/prompts/components/data-table.md +9 -0
- package/assets/prompts/components/date-picker.md +41 -23
- package/assets/prompts/components/disclosure.md +10 -10
- package/assets/prompts/components/drawer.md +29 -18
- package/assets/prompts/components/dropdown-menu.md +23 -21
- package/assets/prompts/components/emoji-picker.md +45 -0
- package/assets/prompts/components/empty-state.md +20 -18
- package/assets/prompts/components/event-chip.md +70 -28
- package/assets/prompts/components/event-list-item.md +32 -28
- package/assets/prompts/components/file-icon.md +18 -19
- package/assets/prompts/components/file-upload.md +1 -1
- package/assets/prompts/components/gallery-item.md +24 -23
- package/assets/prompts/components/generated-image.md +10 -10
- package/assets/prompts/components/hint.md +19 -19
- package/assets/prompts/components/icon-button.md +16 -16
- package/assets/prompts/components/icon.md +42 -17
- package/assets/prompts/components/input.md +49 -46
- package/assets/prompts/components/kanban.md +35 -35
- package/assets/prompts/components/list-item.md +50 -41
- package/assets/prompts/components/menu-item.md +49 -44
- package/assets/prompts/components/message-actions.md +15 -6
- package/assets/prompts/components/message-quote.md +7 -7
- package/assets/prompts/components/message-sources.md +10 -10
- package/assets/prompts/components/message-state.md +17 -17
- package/assets/prompts/components/message-table.md +5 -5
- package/assets/prompts/components/metric-card.md +57 -109
- package/assets/prompts/components/mini-calendar.md +77 -0
- package/assets/prompts/components/modal.md +40 -39
- package/assets/prompts/components/multi-select.md +4 -1
- package/assets/prompts/components/onboarding.md +23 -19
- package/assets/prompts/components/page-header.md +42 -33
- package/assets/prompts/components/pagination.md +17 -17
- package/assets/prompts/components/progress-bar.md +26 -13
- package/assets/prompts/components/quotation-bar.md +10 -10
- package/assets/prompts/components/radio-card.md +34 -117
- package/assets/prompts/components/radio.md +9 -9
- package/assets/prompts/components/segmented-chart.md +19 -5
- package/assets/prompts/components/select.md +29 -25
- package/assets/prompts/components/shortcut.md +11 -11
- package/assets/prompts/components/sidebar.md +67 -58
- package/assets/prompts/components/skeleton.md +47 -0
- package/assets/prompts/components/slider.md +18 -18
- package/assets/prompts/components/spinner.md +16 -16
- package/assets/prompts/components/stepper.md +29 -15
- package/assets/prompts/components/switch.md +30 -26
- package/assets/prompts/components/tab-strip.md +32 -31
- package/assets/prompts/components/table-cell.md +9 -7
- package/assets/prompts/components/table-header.md +16 -16
- package/assets/prompts/components/table-row-edit.md +19 -19
- package/assets/prompts/components/table-row-select.md +9 -9
- package/assets/prompts/components/table-row.md +29 -20
- package/assets/prompts/components/table-toolbar.md +9 -0
- package/assets/prompts/components/tabs.md +30 -27
- package/assets/prompts/components/tag.md +54 -0
- package/assets/prompts/components/textarea.md +16 -15
- package/assets/prompts/components/time-picker.md +22 -14
- package/assets/prompts/components/timeline-view.md +129 -0
- package/assets/prompts/components/toast.md +43 -42
- package/assets/prompts/components/toolbar.md +36 -23
- package/assets/prompts/components/tooltip.md +36 -17
- package/assets/prompts/components/top-loader.md +12 -12
- package/assets/prompts/components/topbar.md +43 -34
- package/assets/prompts/components/tree-nav.md +10 -10
- package/assets/prompts/components/user-message.md +23 -12
- package/assets/prompts/design-examples/README.md +1 -1
- package/assets/prompts/design-examples/ai-chat-full-page.png +0 -0
- package/assets/prompts/design-examples/catalog.json +124 -1
- package/assets/prompts/design-examples/sources/ai-chat-full-page/ChatExperience.module.css +346 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/ChatExperience.tsx +375 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/FullPageChat.tsx +8 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/REFERENCE.md +19 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/useChatDemo.ts +139 -0
- package/assets/prompts/design-examples/sources/ai-chat-full-page/useDemoTextStream.ts +30 -0
- package/assets/prompts/primitives/emerge.md +2 -0
- package/assets/prompts/templates/README.md +1 -1
- package/assets/prompts/templates/ains.md +9 -1
- package/assets/prompts/templates/aurora.md +5 -4
- package/assets/prompts/templates/minimal.md +14 -6
- package/assets/prompts/templates/onboarding.md +156 -0
- package/assets/prompts/templates/workspace.md +16 -11
- package/assets/prompts/tokens/color.md +11 -4
- package/assets/prompts/tokens/material.md +51 -0
- package/assets/prompts/tokens/radius.md +34 -0
- package/assets/prompts/tokens/typography.md +24 -2
- package/assets/prompts/use-cases/chart-chart-area.md +1334 -0
- package/assets/prompts/use-cases/chart-chart-bar.md +1886 -0
- package/assets/prompts/use-cases/chart-chart-pie.md +1031 -0
- package/assets/prompts/use-cases/chart-chart-radar.md +785 -0
- package/assets/prompts/use-cases/chart-chart-radial.md +988 -0
- package/assets/prompts/use-cases/chart-segmented-chart.md +262 -0
- package/assets/prompts/use-cases/chat-chat-composer.md +529 -0
- package/assets/prompts/use-cases/chat-chat-input.md +1766 -0
- package/assets/prompts/use-cases/data-comment.md +360 -0
- package/assets/prompts/use-cases/data-data-table.md +249 -0
- package/assets/prompts/use-cases/data-list-item.md +1056 -0
- package/assets/prompts/use-cases/data-metric-card.md +673 -0
- package/assets/prompts/use-cases/data-table-row.md +966 -0
- package/assets/prompts/use-cases/data-table-toolbar.md +481 -0
- package/assets/prompts/use-cases/feedback-drawer.md +1168 -0
- package/assets/prompts/use-cases/feedback-progress-bar.md +432 -0
- package/assets/prompts/use-cases/general-toolbar.md +854 -0
- package/assets/prompts/use-cases/general-tooltip.md +652 -0
- package/assets/prompts/use-cases/input-checkbox.md +443 -0
- package/assets/prompts/use-cases/structure-card.md +603 -0
- package/assets/prompts/use-cases/structure-page-header.md +755 -0
- package/assets/prompts/use-cases/structure-sidebar.md +1132 -0
- package/assets/prompts/use-cases/structure-topbar.md +1196 -0
- package/assets/public/ovenn-wordmark.svg +19 -0
- package/assets/skills/ovenn-wireframe/SKILL.md +17 -4
- package/package.json +10 -2
- package/src/commands/info.js +1 -1
- package/src/utils/design-examples.js +3 -4
- package/assets/prompts/templates/glass-button.md +0 -336
|
@@ -0,0 +1,1168 @@
|
|
|
1
|
+
# Drawer 사용 사례 소스
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/build-use-cases.mjs. Edit original TSX/CSS, then regenerate. -->
|
|
4
|
+
|
|
5
|
+
### 사례 목록
|
|
6
|
+
|
|
7
|
+
- Trace detail panel
|
|
8
|
+
|
|
9
|
+
문서: /en/components/feedback/drawer#use-cases
|
|
10
|
+
|
|
11
|
+
문서 페이지에서 렌더하는 사례입니다.
|
|
12
|
+
|
|
13
|
+
### 조회 방법
|
|
14
|
+
|
|
15
|
+
get_guide(topic="use-cases/feedback-drawer", sections=["사례 목록", "파일 목록"])로 먼저 확인하고, 필요한 Section 또는 Source 파일 헤딩만 sections로 조회하세요. 전체 문서는 문서 페이지의 다른 예제도 포함합니다. 공용 컴포넌트 계약은 get_component로 읽고, 예제의 docs 전용 셸·locale·import 경로는 대상 프로젝트에 맞게 조합하세요. 이 연결은 디자인 승인이나 기능 검증을 뜻하지 않습니다.
|
|
16
|
+
|
|
17
|
+
### 파일 목록
|
|
18
|
+
|
|
19
|
+
- `web/app/[lang]/components/feedback/drawer/_strings.tsx`
|
|
20
|
+
- `web/app/[lang]/components/feedback/drawer/page.tsx`
|
|
21
|
+
- `web/examples/CommentDiscussion.module.css`
|
|
22
|
+
- `web/examples/CommentDiscussion.tsx`
|
|
23
|
+
- `web/examples/DrawerDetailExamples.module.css`
|
|
24
|
+
- `web/examples/DrawerDetailExamples.tsx`
|
|
25
|
+
- `web/examples/TraceSidePanelExample.module.css`
|
|
26
|
+
- `web/examples/TraceSidePanelExample.tsx`
|
|
27
|
+
|
|
28
|
+
### Section: web/app/[lang]/components/feedback/drawer/page.tsx#use-cases
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<section id="use-cases">
|
|
32
|
+
<h2>{lang === "en" ? "Use cases" : "사용 사례"}</h2>
|
|
33
|
+
<h3>{lang === "en" ? "Trace detail panel" : "트레이스 상세 패널"}</h3>
|
|
34
|
+
<TraceSidePanelExample />
|
|
35
|
+
<DrawerDetailExamples lang={lang} />
|
|
36
|
+
</section>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Source: web/app/[lang]/components/feedback/drawer/_strings.tsx
|
|
40
|
+
|
|
41
|
+
````tsx
|
|
42
|
+
import { Code } from "@/components/Code";
|
|
43
|
+
import type { ReactNode } from "react";
|
|
44
|
+
|
|
45
|
+
type Strings = {
|
|
46
|
+
title: string;
|
|
47
|
+
lead: string;
|
|
48
|
+
|
|
49
|
+
usage: { heading: string; desc: string };
|
|
50
|
+
usageDemo: {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
dismissLabel: string;
|
|
54
|
+
close: string;
|
|
55
|
+
save: string;
|
|
56
|
+
body: string;
|
|
57
|
+
};
|
|
58
|
+
playground: {
|
|
59
|
+
desc: string;
|
|
60
|
+
close: string;
|
|
61
|
+
save: string;
|
|
62
|
+
dismissLabel: string;
|
|
63
|
+
descAxis: string;
|
|
64
|
+
body: string;
|
|
65
|
+
};
|
|
66
|
+
variants: { heading: string; desc1: ReactNode; desc2: ReactNode };
|
|
67
|
+
nonModal: {
|
|
68
|
+
heading: string;
|
|
69
|
+
desc: ReactNode;
|
|
70
|
+
title: string;
|
|
71
|
+
body: string;
|
|
72
|
+
dismissLabel: string;
|
|
73
|
+
};
|
|
74
|
+
locked: {
|
|
75
|
+
heading: string;
|
|
76
|
+
desc: ReactNode;
|
|
77
|
+
title: string;
|
|
78
|
+
description: string;
|
|
79
|
+
done: string;
|
|
80
|
+
};
|
|
81
|
+
api: {
|
|
82
|
+
heading: string;
|
|
83
|
+
columns: { prop: string; type: string; default: string; desc: string };
|
|
84
|
+
rows: {
|
|
85
|
+
open: string;
|
|
86
|
+
onOpenChange: string;
|
|
87
|
+
title: string;
|
|
88
|
+
description: string;
|
|
89
|
+
side: string;
|
|
90
|
+
size: string;
|
|
91
|
+
backdrop: string;
|
|
92
|
+
dismissOnBackdropClick: string;
|
|
93
|
+
dismissible: string;
|
|
94
|
+
disableEscape: string;
|
|
95
|
+
children: string;
|
|
96
|
+
footer: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const en: Strings = {
|
|
102
|
+
title: "Drawer",
|
|
103
|
+
lead: "A full-height side panel for details, editing, or settings alongside the page.",
|
|
104
|
+
|
|
105
|
+
usage: {
|
|
106
|
+
heading: "Usage",
|
|
107
|
+
desc: "Inner content is any ReactNode. Only direction, size, and backdrop are standardized as axes. Use Modal for a single central decision.",
|
|
108
|
+
},
|
|
109
|
+
usageDemo: {
|
|
110
|
+
title: "Details",
|
|
111
|
+
description: "Where extra info or an edit form lives",
|
|
112
|
+
dismissLabel: "Close",
|
|
113
|
+
close: "Close",
|
|
114
|
+
save: "Save",
|
|
115
|
+
body: "children is any ReactNode. Lists, tabs, forms, images, anything fits.",
|
|
116
|
+
},
|
|
117
|
+
playground: {
|
|
118
|
+
desc: "Change the axes and press Open drawer to see the combination.",
|
|
119
|
+
close: "Close",
|
|
120
|
+
save: "Save",
|
|
121
|
+
dismissLabel: "Close",
|
|
122
|
+
descAxis: "Reflects the combination picked from the axes.",
|
|
123
|
+
body: "Drawer body. children accepts any ReactNode.",
|
|
124
|
+
},
|
|
125
|
+
variants: {
|
|
126
|
+
heading: "Variants",
|
|
127
|
+
desc1: (
|
|
128
|
+
<>
|
|
129
|
+
<Code>side</Code> picks which edge opens from. Within one product keep one direction per use case. <Code>size</Code> is a viewport-width ratio: sm 33% / md 50% / lg 67%, with min and max applied on narrow screens.
|
|
130
|
+
</>
|
|
131
|
+
),
|
|
132
|
+
desc2: (
|
|
133
|
+
<>
|
|
134
|
+
<Code>backdrop</Code> only picks the background type. <Code>none</Code> (default) is no backdrop, <Code>dim</Code> is a scrim, <Code>blur</Code> is a scrim plus a blurred backdrop. Outside-click dismiss is handled separately by <Code>dismissOnBackdropClick</Code>.
|
|
135
|
+
</>
|
|
136
|
+
),
|
|
137
|
+
},
|
|
138
|
+
nonModal: {
|
|
139
|
+
heading: "Non-modal",
|
|
140
|
+
desc: (
|
|
141
|
+
<>
|
|
142
|
+
With <Code>backdrop="none"</Code> the drawer sits beside the page without a backdrop. The area behind stays fully interactive.
|
|
143
|
+
</>
|
|
144
|
+
),
|
|
145
|
+
title: "Side panel",
|
|
146
|
+
body: "The area behind stays interactive.",
|
|
147
|
+
dismissLabel: "Close",
|
|
148
|
+
},
|
|
149
|
+
locked: {
|
|
150
|
+
heading: "Locked",
|
|
151
|
+
desc: (
|
|
152
|
+
<>
|
|
153
|
+
Outside click, ESC, and X are all blocked. The user can only continue through a footer action. Use <Code>dim</Code> to interrupt the flow and <Code>dismissOnBackdropClick=false</Code> to block outside click.
|
|
154
|
+
</>
|
|
155
|
+
),
|
|
156
|
+
title: "In progress",
|
|
157
|
+
description: "Closing may cancel the work.",
|
|
158
|
+
done: "Done",
|
|
159
|
+
},
|
|
160
|
+
api: {
|
|
161
|
+
heading: "API Reference",
|
|
162
|
+
columns: { prop: "Prop", type: "Type", default: "Default", desc: "Description" },
|
|
163
|
+
rows: {
|
|
164
|
+
open: "Open state.",
|
|
165
|
+
onOpenChange: "Open state change callback.",
|
|
166
|
+
title: "Required. Use titleSrOnly to hide visually.",
|
|
167
|
+
description: "A line or two directly below the title.",
|
|
168
|
+
side: "Which edge opens from.",
|
|
169
|
+
size: "Viewport width ratio. sm 33 / md 50 / lg 67.",
|
|
170
|
+
backdrop: "Only picks the background type. Outside-click dismiss is separate.",
|
|
171
|
+
dismissOnBackdropClick: "Allow outside click to close. Independent of backdrop.",
|
|
172
|
+
dismissible: "Show the X button in the header.",
|
|
173
|
+
disableEscape: "Block ESC key dismiss.",
|
|
174
|
+
children: "Body. Owns vertical scroll.",
|
|
175
|
+
footer: "Bottom action area.",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const ko: Strings = {
|
|
181
|
+
title: "Drawer",
|
|
182
|
+
lead: "화면 좌우에서 열리는 전체 높이 패널이에요. 본문을 보면서 상세 정보·편집·설정 작업을 할 때 사용해요.",
|
|
183
|
+
|
|
184
|
+
usage: {
|
|
185
|
+
heading: "사용법",
|
|
186
|
+
desc: "본문에는 ReactNode를 자유롭게 넣을 수 있어요. 방향·크기·배경은 속성으로 조절해요. 하나의 결정에 집중해야 한다면 Modal을 사용해 주세요.",
|
|
187
|
+
},
|
|
188
|
+
usageDemo: {
|
|
189
|
+
title: "상세 보기",
|
|
190
|
+
description: "부가 정보나 편집 폼이 들어오는 자리",
|
|
191
|
+
dismissLabel: "닫기",
|
|
192
|
+
close: "닫기",
|
|
193
|
+
save: "저장",
|
|
194
|
+
body: "children에 목록·탭·폼·이미지 등 ReactNode를 넣을 수 있어요.",
|
|
195
|
+
},
|
|
196
|
+
playground: {
|
|
197
|
+
desc: "옵션을 바꾼 뒤 Drawer를 열어 확인해 보세요.",
|
|
198
|
+
close: "닫기",
|
|
199
|
+
save: "저장",
|
|
200
|
+
dismissLabel: "닫기",
|
|
201
|
+
descAxis: "선택한 옵션을 확인할 수 있어요.",
|
|
202
|
+
body: "children에 원하는 ReactNode를 넣어 패널 본문을 구성해요.",
|
|
203
|
+
},
|
|
204
|
+
variants: {
|
|
205
|
+
heading: "모양과 크기",
|
|
206
|
+
desc1: (
|
|
207
|
+
<>
|
|
208
|
+
<Code>side</Code>는 패널이 열리는 방향이에요. 한 제품 안에선 용도별로 하나의 방향만 유지해요. <Code>size</Code>는 뷰포트 폭 기준 비율로 sm 33% · md 50% · lg 67%, 좁은 화면에서는 최소·최대 너비로 보정해요.
|
|
209
|
+
</>
|
|
210
|
+
),
|
|
211
|
+
desc2: (
|
|
212
|
+
<>
|
|
213
|
+
<Code>backdrop</Code>은 배경 타입만 결정해요. <Code>none</Code>(기본)은 배경 없음, <Code>dim</Code>은 어두운 배경, <Code>blur</Code>는 어두운 배경과 흐림 효과를 적용해요. 바깥 클릭 닫힘은 별개로 <Code>dismissOnBackdropClick</Code>으로 설정해요.
|
|
214
|
+
</>
|
|
215
|
+
),
|
|
216
|
+
},
|
|
217
|
+
nonModal: {
|
|
218
|
+
heading: "본문과 함께 사용",
|
|
219
|
+
desc: (
|
|
220
|
+
<>
|
|
221
|
+
<Code>backdrop="none"</Code>이면 배경 없이 상주하는 사이드 패널. 뒤 영역을 그대로 조작할 수 있어요.
|
|
222
|
+
</>
|
|
223
|
+
),
|
|
224
|
+
title: "사이드 패널",
|
|
225
|
+
body: "패널 뒤의 본문도 계속 조작할 수 있어요.",
|
|
226
|
+
dismissLabel: "닫기",
|
|
227
|
+
},
|
|
228
|
+
locked: {
|
|
229
|
+
heading: "닫기 제한",
|
|
230
|
+
desc: (
|
|
231
|
+
<>
|
|
232
|
+
바깥 영역 클릭·ESC·닫기 버튼을 막아 작업 중 실수로 닫히지 않게 해요. 하단 버튼으로 다음 단계로 이동할 수 있어요. 배경은 <Code>dim</Code>으로 흐름을 끊고, <Code>dismissOnBackdropClick=false</Code>로 바깥 클릭을 막아요.
|
|
233
|
+
</>
|
|
234
|
+
),
|
|
235
|
+
title: "진행 중",
|
|
236
|
+
description: "창을 닫으면 작업이 중단될 수 있어요.",
|
|
237
|
+
done: "완료",
|
|
238
|
+
},
|
|
239
|
+
api: {
|
|
240
|
+
heading: "속성",
|
|
241
|
+
columns: { prop: "속성", type: "타입", default: "기본값", desc: "설명" },
|
|
242
|
+
rows: {
|
|
243
|
+
open: "메뉴나 패널이 열려 있는지 나타내요.",
|
|
244
|
+
onOpenChange: "열림 상태가 바뀌면 호출해요.",
|
|
245
|
+
title: "필수. 숨길 땐 titleSrOnly.",
|
|
246
|
+
description: "제목 아래 표시할 설명이에요.",
|
|
247
|
+
side: "열리는 방향.",
|
|
248
|
+
size: "뷰포트 폭 비율. sm 33 · md 50 · lg 67.",
|
|
249
|
+
backdrop: "뒤 배경 타입만. 바깥 클릭 닫힘은 별개.",
|
|
250
|
+
dismissOnBackdropClick: "바깥 클릭으로 닫힘 허용. backdrop과 독립.",
|
|
251
|
+
dismissible: "헤더 우측 X 버튼.",
|
|
252
|
+
disableEscape: "ESC 키 닫힘 차단.",
|
|
253
|
+
children: "바디. 세로 스크롤 담당.",
|
|
254
|
+
footer: "하단 작업 영역.",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const strings = { en, ko };
|
|
260
|
+
export type { Strings };
|
|
261
|
+
````
|
|
262
|
+
|
|
263
|
+
### Source: web/app/[lang]/components/feedback/drawer/page.tsx
|
|
264
|
+
|
|
265
|
+
````tsx
|
|
266
|
+
"use client";
|
|
267
|
+
|
|
268
|
+
import { PreviewButton } from "@/app/_components/PreviewButton";
|
|
269
|
+
|
|
270
|
+
import { useState } from "react";
|
|
271
|
+
import { usePathname } from "next/navigation";
|
|
272
|
+
import {
|
|
273
|
+
Drawer,
|
|
274
|
+
type DrawerSide,
|
|
275
|
+
type DrawerSize,
|
|
276
|
+
type DrawerBackdrop,
|
|
277
|
+
} from "@/components/Drawer";
|
|
278
|
+
import { Button } from "@/components/Button";
|
|
279
|
+
import { DrawerDetailExamples } from "@/examples/DrawerDetailExamples";
|
|
280
|
+
import { TraceSidePanelExample } from "@/examples/TraceSidePanelExample";
|
|
281
|
+
import { Code } from "@/components/Code";
|
|
282
|
+
import { ExampleBlock } from "../../../../_components/ExampleBlock";
|
|
283
|
+
import { Playground } from "../../../../_components/Playground";
|
|
284
|
+
import { DocsTable } from "../../../../_components/DocsTable";
|
|
285
|
+
import { localeFromPathname } from "../../../../_dict";
|
|
286
|
+
import { strings } from "./_strings";
|
|
287
|
+
|
|
288
|
+
const SIDES: DrawerSide[] = ["right", "left"];
|
|
289
|
+
const SIZES: DrawerSize[] = ["sm", "md", "lg"];
|
|
290
|
+
const BACKDROPS: DrawerBackdrop[] = ["none", "dim", "blur"];
|
|
291
|
+
|
|
292
|
+
export default function DrawerPage() {
|
|
293
|
+
const lang = localeFromPathname(usePathname() ?? "/");
|
|
294
|
+
const t = strings[lang];
|
|
295
|
+
|
|
296
|
+
const [usageOpen, setUsageOpen] = useState(false);
|
|
297
|
+
|
|
298
|
+
const [pgOpen, setPgOpen] = useState(false);
|
|
299
|
+
const [pgSide, setPgSide] = useState<DrawerSide>("right");
|
|
300
|
+
const [pgSize, setPgSize] = useState<DrawerSize>("md");
|
|
301
|
+
const [pgBackdrop, setPgBackdrop] = useState<DrawerBackdrop>("none");
|
|
302
|
+
const [pgDescription, setPgDescription] = useState(true);
|
|
303
|
+
const [pgFooter, setPgFooter] = useState(true);
|
|
304
|
+
const [pgDismissible, setPgDismissible] = useState(true);
|
|
305
|
+
const [pgDismissOnBackdropClick, setPgDismissOnBackdropClick] = useState(true);
|
|
306
|
+
|
|
307
|
+
const [lockedOpen, setLockedOpen] = useState(false);
|
|
308
|
+
const [nonModalOpen, setNonModalOpen] = useState(false);
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<>
|
|
312
|
+
<h1 className="page-title">{t.title}</h1>
|
|
313
|
+
<p className="page-lead">{t.lead}</p>
|
|
314
|
+
|
|
315
|
+
<section id="usage" className="section-first">
|
|
316
|
+
<h2>{t.usage.heading}</h2>
|
|
317
|
+
<p className="desc">{t.usage.desc}</p>
|
|
318
|
+
<ExampleBlock
|
|
319
|
+
code={`import { Drawer } from "@/components/Drawer";
|
|
320
|
+
|
|
321
|
+
const [open, setOpen] = useState(false);
|
|
322
|
+
|
|
323
|
+
<Button variant="outline" onClick={() => setOpen(true)}>Open drawer</Button>
|
|
324
|
+
<Drawer
|
|
325
|
+
open={open}
|
|
326
|
+
onOpenChange={setOpen}
|
|
327
|
+
title="${strings.en.usageDemo.title}"
|
|
328
|
+
description="${strings.en.usageDemo.description}"
|
|
329
|
+
footer={
|
|
330
|
+
<>
|
|
331
|
+
<Button variant="outline" onClick={() => setOpen(false)}>${strings.en.usageDemo.close}</Button>
|
|
332
|
+
<Button variant="primary" onClick={() => setOpen(false)}>${strings.en.usageDemo.save}</Button>
|
|
333
|
+
</>
|
|
334
|
+
}
|
|
335
|
+
>
|
|
336
|
+
<p>children is any ReactNode.</p>
|
|
337
|
+
</Drawer>`}
|
|
338
|
+
>
|
|
339
|
+
<>
|
|
340
|
+
<PreviewButton onClick={() => setUsageOpen(true)}>Open drawer</PreviewButton>
|
|
341
|
+
<Drawer
|
|
342
|
+
open={usageOpen}
|
|
343
|
+
onOpenChange={setUsageOpen}
|
|
344
|
+
title={strings.en.usageDemo.title}
|
|
345
|
+
description={strings.en.usageDemo.description}
|
|
346
|
+
dismissLabel={strings.en.usageDemo.dismissLabel}
|
|
347
|
+
footer={
|
|
348
|
+
<>
|
|
349
|
+
<Button variant="outline" onClick={() => setUsageOpen(false)}>{strings.en.usageDemo.close}</Button>
|
|
350
|
+
<Button variant="primary" onClick={() => setUsageOpen(false)}>{strings.en.usageDemo.save}</Button>
|
|
351
|
+
</>
|
|
352
|
+
}
|
|
353
|
+
>
|
|
354
|
+
<p>{strings.en.usageDemo.body}</p>
|
|
355
|
+
</Drawer>
|
|
356
|
+
</>
|
|
357
|
+
</ExampleBlock>
|
|
358
|
+
</section>
|
|
359
|
+
|
|
360
|
+
<Playground
|
|
361
|
+
desc={t.playground.desc}
|
|
362
|
+
axes={[
|
|
363
|
+
{ label: "side", value: pgSide, onChange: (v) => setPgSide(v as DrawerSide), options: SIDES },
|
|
364
|
+
{ label: "size", value: pgSize, onChange: (v) => setPgSize(v as DrawerSize), options: SIZES },
|
|
365
|
+
{ label: "backdrop", value: pgBackdrop, onChange: (v) => setPgBackdrop(v as DrawerBackdrop), options: BACKDROPS },
|
|
366
|
+
]}
|
|
367
|
+
toggles={[
|
|
368
|
+
{ label: "description", value: pgDescription, onChange: setPgDescription },
|
|
369
|
+
{ label: "footer", value: pgFooter, onChange: setPgFooter },
|
|
370
|
+
{ label: "dismissible", value: pgDismissible, onChange: setPgDismissible },
|
|
371
|
+
{ label: "dismissOnBackdropClick", value: pgDismissOnBackdropClick, onChange: setPgDismissOnBackdropClick },
|
|
372
|
+
]}
|
|
373
|
+
>
|
|
374
|
+
<>
|
|
375
|
+
<PreviewButton onClick={() => setPgOpen(true)}>Open drawer</PreviewButton>
|
|
376
|
+
<Drawer
|
|
377
|
+
open={pgOpen}
|
|
378
|
+
onOpenChange={setPgOpen}
|
|
379
|
+
side={pgSide}
|
|
380
|
+
size={pgSize}
|
|
381
|
+
backdrop={pgBackdrop}
|
|
382
|
+
dismissOnBackdropClick={pgDismissOnBackdropClick}
|
|
383
|
+
dismissible={pgDismissible}
|
|
384
|
+
dismissLabel={strings.en.playground.dismissLabel}
|
|
385
|
+
title={`side=${pgSide} · size=${pgSize}`}
|
|
386
|
+
description={pgDescription ? strings.en.playground.descAxis : undefined}
|
|
387
|
+
footer={
|
|
388
|
+
pgFooter ? (
|
|
389
|
+
<>
|
|
390
|
+
<Button variant="outline" onClick={() => setPgOpen(false)}>{strings.en.playground.close}</Button>
|
|
391
|
+
<Button variant="primary" onClick={() => setPgOpen(false)}>{strings.en.playground.save}</Button>
|
|
392
|
+
</>
|
|
393
|
+
) : undefined
|
|
394
|
+
}
|
|
395
|
+
>
|
|
396
|
+
<p>{strings.en.playground.body}</p>
|
|
397
|
+
</Drawer>
|
|
398
|
+
</>
|
|
399
|
+
</Playground>
|
|
400
|
+
|
|
401
|
+
<section id="variants">
|
|
402
|
+
<h2>{t.variants.heading}</h2>
|
|
403
|
+
<p className="desc">{t.variants.desc1}</p>
|
|
404
|
+
|
|
405
|
+
<p className="desc">{t.variants.desc2}</p>
|
|
406
|
+
</section>
|
|
407
|
+
|
|
408
|
+
<section id="with-non-modal">
|
|
409
|
+
<h2>{t.nonModal.heading}</h2>
|
|
410
|
+
<p className="desc">{t.nonModal.desc}</p>
|
|
411
|
+
<ExampleBlock
|
|
412
|
+
code={`<Drawer backdrop="none" side="right" size="sm" title="${strings.en.nonModal.title}" ...>
|
|
413
|
+
<p>${strings.en.nonModal.body}</p>
|
|
414
|
+
</Drawer>`}
|
|
415
|
+
>
|
|
416
|
+
<>
|
|
417
|
+
<PreviewButton onClick={() => setNonModalOpen(true)}>Open drawer</PreviewButton>
|
|
418
|
+
<Drawer
|
|
419
|
+
open={nonModalOpen}
|
|
420
|
+
onOpenChange={setNonModalOpen}
|
|
421
|
+
side="right"
|
|
422
|
+
size="sm"
|
|
423
|
+
backdrop="none"
|
|
424
|
+
title={strings.en.nonModal.title}
|
|
425
|
+
dismissLabel={strings.en.nonModal.dismissLabel}
|
|
426
|
+
>
|
|
427
|
+
<p>{strings.en.nonModal.body}</p>
|
|
428
|
+
</Drawer>
|
|
429
|
+
</>
|
|
430
|
+
</ExampleBlock>
|
|
431
|
+
</section>
|
|
432
|
+
|
|
433
|
+
<section id="locked">
|
|
434
|
+
<h2>{t.locked.heading}</h2>
|
|
435
|
+
<p className="desc">{t.locked.desc}</p>
|
|
436
|
+
<ExampleBlock
|
|
437
|
+
code={`<Drawer
|
|
438
|
+
backdrop="dim"
|
|
439
|
+
dismissOnBackdropClick={false}
|
|
440
|
+
dismissible={false}
|
|
441
|
+
disableEscape
|
|
442
|
+
title="${strings.en.locked.title}"
|
|
443
|
+
description="${strings.en.locked.description}"
|
|
444
|
+
footer={<Button variant="primary">${strings.en.locked.done}</Button>}
|
|
445
|
+
/>`}
|
|
446
|
+
>
|
|
447
|
+
<>
|
|
448
|
+
<PreviewButton onClick={() => setLockedOpen(true)}>Open drawer</PreviewButton>
|
|
449
|
+
<Drawer
|
|
450
|
+
open={lockedOpen}
|
|
451
|
+
onOpenChange={() => {}}
|
|
452
|
+
title={strings.en.locked.title}
|
|
453
|
+
description={strings.en.locked.description}
|
|
454
|
+
backdrop="dim"
|
|
455
|
+
dismissOnBackdropClick={false}
|
|
456
|
+
dismissible={false}
|
|
457
|
+
disableEscape
|
|
458
|
+
footer={
|
|
459
|
+
<Button variant="primary" onClick={() => setLockedOpen(false)}>{strings.en.locked.done}</Button>
|
|
460
|
+
}
|
|
461
|
+
/>
|
|
462
|
+
</>
|
|
463
|
+
</ExampleBlock>
|
|
464
|
+
</section>
|
|
465
|
+
|
|
466
|
+
<section id="use-cases">
|
|
467
|
+
<h2>{lang === "en" ? "Use cases" : "사용 사례"}</h2>
|
|
468
|
+
<h3>{lang === "en" ? "Trace detail panel" : "트레이스 상세 패널"}</h3>
|
|
469
|
+
<TraceSidePanelExample />
|
|
470
|
+
<DrawerDetailExamples lang={lang} />
|
|
471
|
+
</section>
|
|
472
|
+
|
|
473
|
+
<section id="api">
|
|
474
|
+
<h2>{t.api.heading}</h2>
|
|
475
|
+
<DocsTable
|
|
476
|
+
columns={[
|
|
477
|
+
{ key: "prop", label: t.api.columns.prop, width: 160 },
|
|
478
|
+
{ key: "type", label: t.api.columns.type, flex: true, minWidth: 220 },
|
|
479
|
+
{ key: "default", label: t.api.columns.default, width: 120 },
|
|
480
|
+
{ key: "desc", label: t.api.columns.desc, flex: true, minWidth: 240 },
|
|
481
|
+
]}
|
|
482
|
+
rows={[
|
|
483
|
+
{ prop: <Code>open</Code>, type: <Code>boolean</Code>, default: "", desc: t.api.rows.open },
|
|
484
|
+
{ prop: <Code>onOpenChange</Code>, type: <Code>(open) => void</Code>, default: "", desc: t.api.rows.onOpenChange },
|
|
485
|
+
{ prop: <Code>title</Code>, type: <Code>ReactNode</Code>, default: "", desc: t.api.rows.title },
|
|
486
|
+
{ prop: <Code>description</Code>, type: <Code>ReactNode</Code>, default: "", desc: t.api.rows.description },
|
|
487
|
+
{ prop: <Code>side</Code>, type: <Code>'right' | 'left'</Code>, default: <Code>'right'</Code>, desc: t.api.rows.side },
|
|
488
|
+
{ prop: <Code>size</Code>, type: <Code>'sm' | 'md' | 'lg'</Code>, default: <Code>'md'</Code>, desc: t.api.rows.size },
|
|
489
|
+
{ prop: <Code>backdrop</Code>, type: <Code>'none' | 'dim' | 'blur'</Code>, default: <Code>'none'</Code>, desc: t.api.rows.backdrop },
|
|
490
|
+
{ prop: <Code>dismissOnBackdropClick</Code>, type: <Code>boolean</Code>, default: <Code>true</Code>, desc: t.api.rows.dismissOnBackdropClick },
|
|
491
|
+
{ prop: <Code>dismissible</Code>, type: <Code>boolean</Code>, default: <Code>true</Code>, desc: t.api.rows.dismissible },
|
|
492
|
+
{ prop: <Code>disableEscape</Code>, type: <Code>boolean</Code>, default: <Code>false</Code>, desc: t.api.rows.disableEscape },
|
|
493
|
+
{ prop: <Code>children</Code>, type: <Code>ReactNode</Code>, default: "", desc: t.api.rows.children },
|
|
494
|
+
{ prop: <Code>footer</Code>, type: <Code>ReactNode</Code>, default: "", desc: t.api.rows.footer },
|
|
495
|
+
]}
|
|
496
|
+
/>
|
|
497
|
+
</section>
|
|
498
|
+
</>
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
````
|
|
502
|
+
|
|
503
|
+
### Source: web/examples/CommentDiscussion.module.css
|
|
504
|
+
|
|
505
|
+
````css
|
|
506
|
+
.root { min-width: 0; }
|
|
507
|
+
.composer { margin-top: var(--space-5); }
|
|
508
|
+
.replyComposer { margin-top: var(--space-3); padding-bottom: var(--space-2); }
|
|
509
|
+
````
|
|
510
|
+
|
|
511
|
+
### Source: web/examples/CommentDiscussion.tsx
|
|
512
|
+
|
|
513
|
+
````tsx
|
|
514
|
+
"use client";
|
|
515
|
+
|
|
516
|
+
import { useRef, useState, type ReactNode } from "react";
|
|
517
|
+
import { Comment, CommentList, CommentComposer, CommentEditor, CommentText, type CommentMention, type CommentInputVariant } from "@/components/Comment";
|
|
518
|
+
import { Button } from "@/components/Button";
|
|
519
|
+
import { useToast } from "@/components/Toast";
|
|
520
|
+
import type { MessageAction } from "@/components/MessageActions";
|
|
521
|
+
import styles from "./CommentDiscussion.module.css";
|
|
522
|
+
|
|
523
|
+
export type DiscussionComment = { id: number; author: string; time: string; body: string; parentId?: number; replyToId?: number; mentions?: CommentMention[] };
|
|
524
|
+
export type Discussion = { draft: string; comments: DiscussionComment[]; replyDrafts?: Record<number, string>; nextId?: number };
|
|
525
|
+
|
|
526
|
+
export function createDiscussion(): Discussion {
|
|
527
|
+
return { draft: "", replyDrafts: {}, nextId: 2, comments: [
|
|
528
|
+
{ id: 0, author: "Mina Kim", time: "Yesterday", body: "Please check the mobile layout before the next review." },
|
|
529
|
+
{ id: 1, parentId: 0, replyToId: 0, author: "James Lee", time: "2 hours ago", body: "The navigation looks good. I will check the form spacing next." },
|
|
530
|
+
] };
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/** Example-owned data and permissions; shared UI lives in components/Comment. */
|
|
534
|
+
export function CommentDiscussion({ value, onChange, variant = "line", label = "Comments" }: { variant?: CommentInputVariant; label?: string; value?: Discussion; onChange?: (value: Discussion | ((current: Discussion) => Discussion)) => void }) {
|
|
535
|
+
const [local, setLocal] = useState(createDiscussion);
|
|
536
|
+
const { toast, dismiss } = useToast();
|
|
537
|
+
const current = value ?? local;
|
|
538
|
+
const { comments, draft, replyDrafts = {} } = current;
|
|
539
|
+
const [replyTarget, setReplyTarget] = useState<number | null>(null);
|
|
540
|
+
const [editing, setEditing] = useState<{ id: number; body: string; mentions: CommentMention[] } | null>(null);
|
|
541
|
+
const composer = useRef<HTMLTextAreaElement>(null);
|
|
542
|
+
const replyInput = useRef<HTMLTextAreaElement>(null);
|
|
543
|
+
const change = (patch: Partial<Discussion> | ((state: Discussion) => Partial<Discussion>)) => {
|
|
544
|
+
const update = (state: Discussion) => ({ ...state, ...(typeof patch === "function" ? patch(state) : patch) });
|
|
545
|
+
if (onChange) onChange(update); else setLocal(update);
|
|
546
|
+
};
|
|
547
|
+
const remove = (comment: DiscussionComment) => {
|
|
548
|
+
const removed = comments.filter(item => item.id === comment.id || item.parentId === comment.id);
|
|
549
|
+
const ids = new Set(removed.map(item => item.id));
|
|
550
|
+
change(state => ({ comments: state.comments.filter(item => !ids.has(item.id)) }));
|
|
551
|
+
setEditing(null);
|
|
552
|
+
if (replyTarget === comment.id || rootId === comment.id) setReplyTarget(null);
|
|
553
|
+
composer.current?.focus({ preventScroll: true });
|
|
554
|
+
let toastId = "";
|
|
555
|
+
toastId = toast({ title: "Comment deleted", tone: "neutral", icon: "trash", duration: 6000,
|
|
556
|
+
action: <Button size="xs" variant="ghost" onClick={() => {
|
|
557
|
+
change(state => {
|
|
558
|
+
const restored = new Map(state.comments.map(item => [item.id, item]));
|
|
559
|
+
for (const item of removed) if (!restored.has(item.id)) restored.set(item.id, item);
|
|
560
|
+
return { comments: [...restored.values()].sort((a, b) => a.id - b.id) };
|
|
561
|
+
});
|
|
562
|
+
dismiss(toastId);
|
|
563
|
+
}}>Undo</Button>, actionAltText: "Undo comment deletion",
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
const nextId = () => Math.max(current.nextId ?? 0, Math.max(-1, ...comments.map(comment => comment.id)) + 1);
|
|
567
|
+
const target = comments.find(comment => comment.id === replyTarget);
|
|
568
|
+
const rootId = target ? target.parentId ?? target.id : null;
|
|
569
|
+
const submitComment = (body: string) => { const id = nextId(); change({ comments: [...comments, { id, author: "Alex Morgan", time: "Just now", body }], draft: "", nextId: id + 1 }); };
|
|
570
|
+
const submitReply = (body: string) => {
|
|
571
|
+
if (!target || rootId == null) return;
|
|
572
|
+
const id = nextId();
|
|
573
|
+
change({ comments: [...comments, { id, parentId: rootId, replyToId: target.id, author: "Alex Morgan", time: "Just now", body }], replyDrafts: { ...replyDrafts, [target.id]: "" }, nextId: id + 1 });
|
|
574
|
+
setReplyTarget(null); composer.current?.focus();
|
|
575
|
+
};
|
|
576
|
+
const mentionsFor = (comment: DiscussionComment): CommentMention[] => {
|
|
577
|
+
if (comment.mentions) return comment.mentions;
|
|
578
|
+
const target = comments.find(item => item.id === comment.replyToId);
|
|
579
|
+
return target ? [{ id: target.author.toLowerCase().replaceAll(" ", "-"), label: target.author, offset: 0 }] : [];
|
|
580
|
+
};
|
|
581
|
+
const people = Array.from(new Map(comments.map(comment => [comment.author, { id: comment.author.toLowerCase().replaceAll(" ", "-"), label: comment.author }])).values());
|
|
582
|
+
const save = (body: string, mentions: CommentMention[]) => {
|
|
583
|
+
if (!editing) return;
|
|
584
|
+
change({ comments: comments.map(comment => comment.id === editing.id ? { ...comment, body, mentions } : comment) });
|
|
585
|
+
setEditing(null); composer.current?.focus();
|
|
586
|
+
};
|
|
587
|
+
const actionsFor = (comment: DiscussionComment): MessageAction[] => [
|
|
588
|
+
{ kind: "copy", successLabel: "Copied", errorLabel: "Copy failed", onClick: () => navigator.clipboard.writeText(comment.body) },
|
|
589
|
+
{ kind: "reply", onClick: () => { setReplyTarget(comment.id); requestAnimationFrame(() => replyInput.current?.focus()); } },
|
|
590
|
+
...(comment.author === "Alex Morgan" ? [
|
|
591
|
+
{ kind: "edit" as const, onClick: () => setEditing({ id: comment.id, body: comment.body, mentions: mentionsFor(comment) }) },
|
|
592
|
+
{ kind: "delete" as const, onClick: () => remove(comment) },
|
|
593
|
+
] : []),
|
|
594
|
+
];
|
|
595
|
+
const renderComment = (comment: DiscussionComment, nested = false): ReactNode => {
|
|
596
|
+
const replies = comments.filter(item => item.parentId === comment.id);
|
|
597
|
+
const thread = !nested && (replies.length > 0 || rootId === comment.id) ? <>
|
|
598
|
+
{replies.length > 0 && <CommentList aria-label={`Replies to ${comment.author}`}>{replies.map(reply => renderComment(reply, true))}</CommentList>}
|
|
599
|
+
{rootId === comment.id && target && <CommentComposer variant={variant} key={target.id} ref={replyInput} className={styles.replyComposer} autoFocus author="Alex Morgan" replyTo={target.author} value={replyDrafts[target.id] ?? ""} onValueChange={body => change({ replyDrafts: { ...replyDrafts, [target.id]: body } })} onSubmit={submitReply} onCancel={() => { setReplyTarget(null); composer.current?.focus(); }} />}
|
|
600
|
+
</> : undefined;
|
|
601
|
+
return <Comment key={comment.id} author={comment.author} timestamp={comment.time} actions={editing?.id === comment.id ? undefined : actionsFor(comment)} replies={thread} data-comment-id={comment.id}>
|
|
602
|
+
{editing?.id === comment.id ? <CommentEditor variant={variant} originalValue={comment.body} originalMentions={mentionsFor(comment)} value={editing.body} mentions={editing.mentions} mentionOptions={people} onValueChange={(body, mentions) => setEditing({ ...editing, body, mentions })} onSave={save} onCancel={() => { setEditing(null); composer.current?.focus(); }} /> : <CommentText value={comment.body} mentions={mentionsFor(comment)} />}
|
|
603
|
+
</Comment>;
|
|
604
|
+
};
|
|
605
|
+
return <section className={styles.root} aria-label={label} data-variant={variant}>
|
|
606
|
+
<CommentList>{comments.filter(comment => comment.parentId == null).map(comment => renderComment(comment))}</CommentList>
|
|
607
|
+
<CommentComposer variant={variant} className={styles.composer} ref={composer} author="Alex Morgan" value={draft} onValueChange={body => change({ draft: body })} onSubmit={submitComment} />
|
|
608
|
+
</section>;
|
|
609
|
+
}
|
|
610
|
+
````
|
|
611
|
+
|
|
612
|
+
### Source: web/examples/DrawerDetailExamples.module.css
|
|
613
|
+
|
|
614
|
+
````css
|
|
615
|
+
.content {
|
|
616
|
+
--detail-panel-width: calc(var(--size-16) * 9);
|
|
617
|
+
--detail-divider: color-mix(in srgb, var(--fg) 7%, var(--bg));
|
|
618
|
+
--detail-text: var(--text-sm);
|
|
619
|
+
--tag-hover-brightness: 0.97;
|
|
620
|
+
--file-gutter: var(--space-8);
|
|
621
|
+
--file-nav-width: calc(var(--size-16) * 3 + var(--size-6));
|
|
622
|
+
--file-paper-width: calc(var(--size-24) * 6);
|
|
623
|
+
|
|
624
|
+
display: flex;
|
|
625
|
+
flex-direction: column;
|
|
626
|
+
height: 100%;
|
|
627
|
+
min-height: 0;
|
|
628
|
+
color: var(--fg);
|
|
629
|
+
background: var(--bg);
|
|
630
|
+
font-family: var(--font-normal);
|
|
631
|
+
font-size: var(--detail-text);
|
|
632
|
+
line-height: var(--lh-sm);
|
|
633
|
+
}
|
|
634
|
+
.content[data-example-kind="file"] { --detail-panel-width: calc(var(--size-24) * 10); }
|
|
635
|
+
.content[data-example-kind="notion"] { --detail-panel-width: calc(var(--size-24) * 8); }
|
|
636
|
+
:global([role="dialog"]):has(> .content) {
|
|
637
|
+
--detail-panel-width: calc(var(--size-16) * 9);
|
|
638
|
+
--detail-divider: color-mix(in srgb, var(--fg) 7%, var(--bg));
|
|
639
|
+
}
|
|
640
|
+
:global([role="dialog"]):has(> .content[data-example-kind="file"]) { --detail-panel-width: calc(var(--size-24) * 10); }
|
|
641
|
+
:global([role="dialog"]):has(> .content[data-example-kind="notion"]) { --detail-panel-width: calc(var(--size-24) * 8); }
|
|
642
|
+
:global([role="dialog"]):has(> .content) { width: min(var(--detail-panel-width), 100vw); max-width: 100vw; border: 0; border-inline-start: 1px solid var(--detail-divider); corner-shape: var(--corner-shape); border-radius: 0; border-start-start-radius: 0; border-end-start-radius: 0; }
|
|
643
|
+
:global([role="dialog"]):has(> .content[data-expanded]) { width: 100vw; border-radius: 0; border-start-start-radius: 0; border-end-start-radius: 0; }
|
|
644
|
+
.content > :first-child { position: absolute; padding: 0; }
|
|
645
|
+
.topbar.topbar { flex-shrink: 0; padding-inline: var(--space-3); background: var(--bg); }
|
|
646
|
+
.toolbarGroup.toolbarGroup { gap: var(--space-0_5); min-width: 0; }
|
|
647
|
+
.breadcrumb { padding-left: var(--space-2); color: var(--fg-muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
648
|
+
.scroll { flex: 1; min-height: 0; overflow: auto; }
|
|
649
|
+
.content h2, .content h3, .content h4 { font-weight: var(--font-weight-medium); }
|
|
650
|
+
.notionProperties { margin: 0; display: grid; gap: var(--space-1); }
|
|
651
|
+
.property { display: grid; grid-template-columns: calc(var(--size-16) * 2) minmax(0, 1fr); align-items: center; gap: var(--space-4); min-height: var(--size-8); }
|
|
652
|
+
.property dt { display: flex; gap: var(--space-2); align-items: center; color: var(--fg-muted); font-weight: var(--font-weight-regular); }
|
|
653
|
+
.property dt svg { width: var(--size-4); height: var(--size-4); flex-shrink: 0; }
|
|
654
|
+
.property dd { margin: 0; min-width: 0; max-width: calc(var(--size-24) * 2); }
|
|
655
|
+
.pageChecklist label { align-items: flex-start; line-height: var(--lh-sm); }
|
|
656
|
+
.fileLayout { display: grid; grid-template-columns: var(--file-nav-width) minmax(0, 1fr); min-height: 100%; }
|
|
657
|
+
.fileNav { padding: var(--space-5) var(--space-3); border-right: 1px solid var(--detail-divider); }
|
|
658
|
+
.fileNav h3 { color: var(--fg-muted); font-size: var(--text-xs); margin: 0; padding: var(--space-2) var(--space-2) var(--space-3); }
|
|
659
|
+
.fileNav :global([data-slot="list-item-root"]) { margin-inline: 0; width: 100%; box-sizing: border-box; font-size: var(--text-xs); }
|
|
660
|
+
.fileMain { min-width: 0; display: flex; flex-direction: column; }
|
|
661
|
+
.fileHeader { padding: var(--space-5) var(--file-gutter); display: flex; gap: var(--space-3); align-items: center; }
|
|
662
|
+
.fileHeader h2 { font-size: var(--text-xl); line-height: var(--lh-xl); margin: 0; }
|
|
663
|
+
.fileHeader p { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-1) 0 0; color: var(--fg-muted); font-size: var(--text-xs); }
|
|
664
|
+
.fileTabs.fileTabs { gap: 0; flex: 1; }
|
|
665
|
+
.fileTabs > :first-child { padding-inline: var(--file-gutter); }
|
|
666
|
+
.previewArea { padding: var(--file-gutter); background: var(--bg-subtle); flex: 1; }
|
|
667
|
+
.paper { width: 100%; box-sizing: border-box; max-width: var(--file-paper-width); margin: 0 auto; padding: var(--space-10); corner-shape: var(--corner-shape); border-radius: var(--radius-sm); min-height: calc(var(--size-24) * 7); background: var(--bg); }
|
|
668
|
+
.paperPath { color: var(--fg-muted); font-size: var(--text-2xs); }
|
|
669
|
+
.paper h2 { font-size: var(--text-3xl); line-height: var(--lh-3xl); margin: var(--space-5) 0 var(--space-4); }
|
|
670
|
+
.paper p, .paper li { font-size: var(--text-base); line-height: var(--lh-base); }
|
|
671
|
+
.paper h3 { font-size: var(--text-xl); margin-top: var(--space-8); margin-bottom: var(--space-3); }
|
|
672
|
+
.paper ul { padding-inline-start: var(--space-5); }
|
|
673
|
+
.paper li + li { margin-top: var(--space-1_5); }
|
|
674
|
+
.versions { padding: var(--space-6) var(--file-gutter); }
|
|
675
|
+
.versions h3 { margin: 0 0 var(--space-4); font-size: var(--text-base); }
|
|
676
|
+
.notion { max-width: calc(var(--size-24) * 7); padding: var(--space-10) var(--space-12) var(--space-12); margin-inline: auto; }
|
|
677
|
+
.pageTitle.pageTitle { padding: 0; height: auto; min-height: var(--size-10); border: 0; box-shadow: none; margin-bottom: var(--space-4); background: transparent; }
|
|
678
|
+
.pageTitle :global(input) { font-family: var(--font-normal); font-size: var(--text-4xl); font-weight: var(--font-weight-medium); line-height: var(--lh-4xl); letter-spacing: var(--type-4xl-tracking); }
|
|
679
|
+
.notionProperties { gap: 0; }
|
|
680
|
+
.notionProperties .property { grid-template-columns: calc(var(--size-16) * 2) minmax(0, 1fr); min-height: calc(var(--size-3) * 3); gap: var(--space-3); }
|
|
681
|
+
.quietChoice.quietChoice { border: 0; background: transparent; box-shadow: none; padding-inline: var(--space-2); width: fit-content; max-width: 100%; min-width: 0; color: var(--fg); }
|
|
682
|
+
.quietChoice:hover { background: var(--hover); }
|
|
683
|
+
.pageBody h2 { font-size: var(--text-2xl); line-height: var(--lh-2xl); margin: 0 0 var(--space-3); }
|
|
684
|
+
.pageBody p { margin: 0; line-height: var(--lh-base); }
|
|
685
|
+
.pageBody h3 { font-size: var(--text-xl); line-height: var(--lh-xl); margin: var(--space-7) 0 var(--space-2); }
|
|
686
|
+
.pageBody ul { padding-inline-start: var(--space-5); margin: 0; }
|
|
687
|
+
.pageBody li + li { margin-top: var(--space-1); }
|
|
688
|
+
.pageChecklist { display: grid; gap: var(--space-2); }
|
|
689
|
+
@media (max-width: 640px) {
|
|
690
|
+
:global([role="dialog"]):has(> .content) { width: 100vw; border-radius: 0; border-start-start-radius: 0; border-end-start-radius: 0; }
|
|
691
|
+
.property { grid-template-columns: calc(var(--size-4) * 7) minmax(0, 1fr); gap: var(--space-2); }
|
|
692
|
+
.fileLayout { grid-template-columns: minmax(0, 1fr); }
|
|
693
|
+
.fileNav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1); border-right: 0; border-bottom: 1px solid var(--detail-divider); padding: var(--space-2); }
|
|
694
|
+
.fileNav h3 { grid-column: 1 / -1; width: auto; padding: var(--space-1); }
|
|
695
|
+
.content[data-example-kind="file"] { --file-gutter: var(--space-4); }
|
|
696
|
+
.fileHeader { padding: var(--space-5) var(--file-gutter); }
|
|
697
|
+
.previewArea { padding: var(--file-gutter); }
|
|
698
|
+
.paper { padding: var(--space-6) var(--space-5); min-height: calc(var(--size-24) * 6); }
|
|
699
|
+
.notion { padding: var(--space-8) var(--space-5); }
|
|
700
|
+
.notionProperties .property { grid-template-columns: calc(var(--size-4) * 6) minmax(0, 1fr); gap: var(--space-2); }
|
|
701
|
+
.breadcrumb { display: none; }
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.fileTabs > :global([role="tablist"]) { gap: var(--space-4); }
|
|
705
|
+
.fileTabs :global([role="tab"]):focus-visible { box-shadow: inset 0 0 0 var(--hairline) var(--border-strong); }
|
|
706
|
+
.fileNav :global([data-slot="list-item-root"]):focus-visible { box-shadow: none; outline: none; background: var(--hover); }
|
|
707
|
+
.fileNav :global([data-slot="list-item-root"][data-active]) { box-shadow: none; background: color-mix(in srgb, var(--fg) 5%, var(--bg)); }
|
|
708
|
+
.fileNav :global([data-slot="list-item-root"]):has(:focus-visible) { box-shadow: none; outline: none; background: var(--hover); }
|
|
709
|
+
|
|
710
|
+
.notionDiscussion { margin-top: var(--space-5); margin-bottom: var(--space-8); padding-top: var(--space-4); border-top: 1px solid var(--detail-divider); }
|
|
711
|
+
|
|
712
|
+
.personChoice.personChoice { gap: var(--space-1_5); }
|
|
713
|
+
.quietChoice.quietChoice { corner-shape: var(--corner-shape); border-radius: var(--radius-sm); }
|
|
714
|
+
.fileHeader > div { min-width: 0; }
|
|
715
|
+
.fileHeader h2 { overflow-wrap: anywhere; }
|
|
716
|
+
|
|
717
|
+
.fileNav :global([data-slot="list-item-title"]) { font-size: var(--text-xs); line-height: var(--lh-xs); white-space: normal; overflow-wrap: anywhere; }
|
|
718
|
+
|
|
719
|
+
.notionProperties .property dd { width: 100%; }
|
|
720
|
+
|
|
721
|
+
.dateTrigger.dateTrigger { width: fit-content; max-width: 100%; min-width: 0; justify-content: flex-start; padding-inline: var(--space-2); corner-shape: var(--corner-shape); border-radius: var(--radius-sm); font-weight: var(--font-weight-regular); }
|
|
722
|
+
.dateTrigger :global([data-slot="button-label"]) { text-align: start; }
|
|
723
|
+
|
|
724
|
+
.tagChoice.tagChoice { width: fit-content; min-width: 0; height: auto; padding: 0; border: 0; background: transparent; box-shadow: none; corner-shape: var(--corner-shape-mini); border-radius: var(--radius-mini-sm); }
|
|
725
|
+
.tagChoice :global([data-slot="select-indicator"]) { display: none; }
|
|
726
|
+
.tagChoice:hover :global([data-slot="tag-root"]) { filter: brightness(var(--tag-hover-brightness)); }
|
|
727
|
+
.pageBody { font-size: var(--text-base); line-height: var(--lh-base); }
|
|
728
|
+
.pageChecklist label { font-size: var(--text-base); line-height: var(--lh-base); }
|
|
729
|
+
@media (max-width: 640px) {
|
|
730
|
+
.pageTitle :global(input) { font-size: var(--text-3xl); line-height: var(--lh-3xl); }
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.tagChoice:focus-visible :global([data-slot="tag-root"]) { box-shadow: inset 0 0 0 var(--hairline) var(--border-strong); }
|
|
734
|
+
|
|
735
|
+
.tagChoice.tagChoice { margin-inline-start: var(--space-2); }
|
|
736
|
+
.paper h3 { line-height: var(--lh-xl); }
|
|
737
|
+
|
|
738
|
+
.personChoice :global([data-slot="select-indicator"]) { display: none; }
|
|
739
|
+
.tagPicker { composes: surface from "../components/ContextMenu/ContextMenu.module.css"; width: var(--input-w-md); max-width: calc(100vw - var(--space-6)); padding: var(--space-1); z-index: var(--z-popover); font-family: var(--font-normal); }
|
|
740
|
+
.tagOptions { display: grid; gap: var(--space-0_5); margin-top: 0; max-height: calc(var(--size-16) * 3); overflow: auto; }
|
|
741
|
+
.tagOption.tagOption { padding: var(--space-1_5) var(--space-2); corner-shape: var(--corner-shape); border-radius: var(--radius-sm); }
|
|
742
|
+
.tagOption:hover { background: var(--hover); }
|
|
743
|
+
|
|
744
|
+
.tagName { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
745
|
+
.tagOption > :last-child { min-width: 0; flex: 1; overflow: hidden; }
|
|
746
|
+
|
|
747
|
+
/* Input의 공식 prefix 슬롯에 제거 가능한 Chip을 조합한다. */
|
|
748
|
+
.tagInputForm { width: 100%; min-width: 0; }
|
|
749
|
+
.tagInput.tagInput { flex-wrap: nowrap; height: var(--control-h-sm); padding: 0 var(--space-2); gap: var(--space-1); border: 0; background: transparent; box-shadow: none; overflow-x: auto; scrollbar-width: none; }
|
|
750
|
+
.tagInput :global([data-slot="input-prefix"]) { display: contents; }
|
|
751
|
+
.tagInput :global([data-slot="chip-root"]) { min-width: 0; max-width: 100%; flex-shrink: 0; }
|
|
752
|
+
.tagInput :global([data-slot="chip-label"]) { overflow: hidden; }
|
|
753
|
+
.tagInput :global([data-slot="input-field"]) { flex: 1; width: 0; min-width: var(--size-16); height: var(--size-6); padding: 0 var(--space-1); }
|
|
754
|
+
.priorityIcon { display: inline-flex; align-items: center; flex-shrink: 0; }
|
|
755
|
+
.priorityIcon[data-priority="Urgent"] { color: var(--destructive); }
|
|
756
|
+
.priorityIcon[data-priority="High"] { color: var(--destructive); }
|
|
757
|
+
.priorityIcon[data-priority="Medium"] { color: var(--warning); }
|
|
758
|
+
.priorityIcon[data-priority="Low"] { color: var(--success); }
|
|
759
|
+
|
|
760
|
+
.tagCreate.tagCreate { width: 100%; max-width: 100%; min-width: 0; justify-content: flex-start; }
|
|
761
|
+
.tagCreate :global([data-slot="button-label"]) { min-width: 0; overflow: hidden; }
|
|
762
|
+
|
|
763
|
+
.notionProperties .property:has([data-slot="page-tags-input"]) dd { max-width: none; }
|
|
764
|
+
|
|
765
|
+
.priorityIcon[data-priority="None"] { color: var(--fg-muted); }
|
|
766
|
+
````
|
|
767
|
+
|
|
768
|
+
### Source: web/examples/DrawerDetailExamples.tsx
|
|
769
|
+
|
|
770
|
+
````tsx
|
|
771
|
+
"use client";
|
|
772
|
+
|
|
773
|
+
import { PreviewButton } from "@/app/_components/PreviewButton";
|
|
774
|
+
|
|
775
|
+
import * as Popover from "@radix-ui/react-popover";
|
|
776
|
+
import { useRef, useState, useEffect, type FormEvent, type ReactNode } from "react";
|
|
777
|
+
import { Drawer } from "@/components/Drawer";
|
|
778
|
+
import { Topbar } from "@/components/Topbar";
|
|
779
|
+
import { Icon, type IconName } from "@/components/Icon";
|
|
780
|
+
import { IconButton } from "@/components/IconButton";
|
|
781
|
+
import { Button } from "@/components/Button";
|
|
782
|
+
import { Chip } from "@/components/Chip";
|
|
783
|
+
import { Tag } from "@/components/Tag";
|
|
784
|
+
import { Avatar } from "@/components/Avatar";
|
|
785
|
+
import { MenuItem } from "@/components/MenuItem";
|
|
786
|
+
import { Checkbox } from "@/components/Checkbox";
|
|
787
|
+
import { DatePicker, formatISODate, parseISODate } from "@/components/DatePicker";
|
|
788
|
+
import { Input } from "@/components/Input";
|
|
789
|
+
import { Select } from "@/components/Select";
|
|
790
|
+
import { Tabs } from "@/components/Tabs";
|
|
791
|
+
import { ListItem } from "@/components/ListItem";
|
|
792
|
+
import { FileIcon } from "@/components/FileIcon";
|
|
793
|
+
import { DropdownMenu } from "@/components/DropdownMenu";
|
|
794
|
+
import { ThemeLocaleProvider } from "@/components/ThemeController";
|
|
795
|
+
import { CommentDiscussion, createDiscussion, type Discussion } from "./CommentDiscussion";
|
|
796
|
+
import styles from "./DrawerDetailExamples.module.css";
|
|
797
|
+
|
|
798
|
+
type Kind = "file" | "notion";
|
|
799
|
+
type ExampleProps = { open: boolean; onOpenChange: (open: boolean) => void };
|
|
800
|
+
|
|
801
|
+
function Panel({ kind, title, launch, breadcrumb, actions, children, open, onOpenChange, suspendEscape = false }: ExampleProps & {
|
|
802
|
+
kind: Kind; title: string; launch: string; breadcrumb: string; actions?: ReactNode; children: ReactNode; suspendEscape?: boolean;
|
|
803
|
+
}) {
|
|
804
|
+
const trigger = useRef<HTMLButtonElement>(null);
|
|
805
|
+
const [expanded, setExpanded] = useState(false);
|
|
806
|
+
const change = (next: boolean) => { onOpenChange(next); if (!next) requestAnimationFrame(() => trigger.current?.focus()); };
|
|
807
|
+
return <>
|
|
808
|
+
<PreviewButton ref={trigger} onClick={() => change(true)}>{launch}</PreviewButton>
|
|
809
|
+
<Drawer.Root open={open} onOpenChange={change} disableEscape={suspendEscape} size="lg" backdrop="none" dismissOnBackdropClick={false}>
|
|
810
|
+
<div className={styles.content} data-example-kind={kind} data-expanded={expanded || undefined}>
|
|
811
|
+
<Drawer.Header title={title} titleSrOnly dismissible={false} />
|
|
812
|
+
<Topbar size="sm" className={styles.topbar}>
|
|
813
|
+
<Topbar.Leading className={styles.toolbarGroup}>
|
|
814
|
+
<IconButton variant="ghost" size="sm" aria-label={`Close ${title.toLowerCase()}`} icon={<Icon name="arrow-line-right" />} onClick={() => change(false)} />
|
|
815
|
+
<IconButton variant="ghost" size="sm" aria-label={expanded ? `Restore ${title.toLowerCase()}` : `Expand ${title.toLowerCase()}`} icon={<Icon name={expanded ? "arrows-in" : "arrows-out"} />} onClick={() => setExpanded(value => !value)} />
|
|
816
|
+
<span className={styles.breadcrumb}>{breadcrumb}</span>
|
|
817
|
+
</Topbar.Leading>
|
|
818
|
+
<Topbar.Trailing className={styles.toolbarGroup}>{actions}</Topbar.Trailing>
|
|
819
|
+
</Topbar>
|
|
820
|
+
<div className={styles.scroll}>{children}</div>
|
|
821
|
+
</div>
|
|
822
|
+
</Drawer.Root>
|
|
823
|
+
</>;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const priorityIcons: Record<string, IconName> = { Urgent: "cell-signal-full", High: "cell-signal-high", Medium: "cell-signal-medium", Low: "cell-signal-low", None: "cell-signal-none" };
|
|
827
|
+
const priorityStatus = { Urgent: "destructive", High: "destructive", Medium: "warning", Low: "success" } as const;
|
|
828
|
+
function PriorityIcon({ value }: { value: string }) {
|
|
829
|
+
return <span className={styles.priorityIcon} data-priority={value}><Icon name={priorityIcons[value] ?? "cell-signal-none"} size={14} /></span>;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function Choice({ label, value, options, onChange, quiet = false, status = false, person = false, tag = false }: {
|
|
833
|
+
label: string; value: string; options: string[]; onChange: (value: string) => void; quiet?: boolean; status?: boolean; person?: boolean; tag?: boolean;
|
|
834
|
+
}) {
|
|
835
|
+
const tagged = status || tag;
|
|
836
|
+
const choices = tagged ? ["None", ...options.filter(option => option !== "None")] : options;
|
|
837
|
+
const tone = (option: string) => tag ? priorityStatus[option as keyof typeof priorityStatus] ?? "neutral" : option === "Done" ? "success" : option === "In progress" ? "info" : "neutral";
|
|
838
|
+
return <Select value={value} onValueChange={onChange} size="sm" variant={quiet || tagged ? "line" : "outline"}>
|
|
839
|
+
<Select.Trigger className={[tagged ? styles.tagChoice : quiet ? styles.quietChoice : "", person ? styles.personChoice : ""].filter(Boolean).join(" ")} leftIcon={person ? <Avatar size="sm" name={value} aria-hidden="true" /> : undefined} aria-label={label}>{tagged ? <Tag size="md" variant="soft" shape="rounded" status={tone(value)}>{tag && <PriorityIcon value={value} />}<Select.Value>{value}</Select.Value></Tag> : <Select.Value />}</Select.Trigger>
|
|
840
|
+
<Select.Content>{choices.map(option => <Select.Item key={option} value={option} textValue={option} leadingActions={person ? [<Avatar key={option} size="sm" name={option} aria-hidden="true" />] : undefined}>{tagged ? <Tag size="md" variant="soft" shape="rounded" status={tone(option)}>{tag && <PriorityIcon value={option} />}{option}</Tag> : option}</Select.Item>)}</Select.Content>
|
|
841
|
+
</Select>;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function TagPicker({ value, onChange, open, onOpenChange }: { value: string[]; onChange: (tags: string[]) => void; open: boolean; onOpenChange: (open: boolean) => void }) {
|
|
845
|
+
const [query, setQuery] = useState("");
|
|
846
|
+
const [known, setKnown] = useState(["Design", "Website", "Research", "Engineering", "Docs"]);
|
|
847
|
+
const field = useRef<HTMLInputElement>(null);
|
|
848
|
+
useEffect(() => { if (!open) setQuery(""); }, [open]);
|
|
849
|
+
useEffect(() => {
|
|
850
|
+
if (!open) return;
|
|
851
|
+
const reveal = () => field.current?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
852
|
+
const frame = requestAnimationFrame(reveal);
|
|
853
|
+
const observer = new ResizeObserver(reveal);
|
|
854
|
+
const control = field.current?.closest('[data-slot="input-root"]');
|
|
855
|
+
if (control) observer.observe(control);
|
|
856
|
+
return () => { cancelAnimationFrame(frame); observer.disconnect(); };
|
|
857
|
+
}, [open, query]);
|
|
858
|
+
const options = [...new Set([...known, ...value])].filter(tag => !value.includes(tag) && tag.toLowerCase().includes(query.trim().toLowerCase()));
|
|
859
|
+
const add = (event?: Pick<FormEvent, "preventDefault">) => {
|
|
860
|
+
event?.preventDefault();
|
|
861
|
+
const name = query.trim(); if (!name) return;
|
|
862
|
+
const tag = [...known, ...value].find(item => item.toLowerCase() === name.toLowerCase()) ?? name;
|
|
863
|
+
setKnown(items => [...new Set([...items, tag])]);
|
|
864
|
+
onChange([...new Set([...value, tag])]); setQuery(""); field.current?.focus(); onOpenChange(true);
|
|
865
|
+
};
|
|
866
|
+
return <Popover.Root open={open} onOpenChange={onOpenChange}>
|
|
867
|
+
<Popover.Anchor asChild><form onSubmit={add} className={styles.tagInputForm} data-slot="page-tags-input">
|
|
868
|
+
<Input ref={field} className={styles.tagInput} variant="outline" size="sm" aria-label="Tag name" placeholder="Add a tag…" value={query}
|
|
869
|
+
prefix={value.map(tag => <Chip key={tag} size="md" onRemove={() => onChange(value.filter(item => item !== tag))} removeLabel={`Remove ${tag} tag`}><span className={styles.tagName} title={tag}>{tag}</span></Chip>)}
|
|
870
|
+
onFocus={() => { if (query.trim()) onOpenChange(true); }} onChange={event => { setQuery(event.target.value); onOpenChange(Boolean(event.target.value.trim())); }}
|
|
871
|
+
onKeyDown={event => { if (event.key === "Backspace" && !query && value.length) onChange(value.slice(0, -1)); }} />
|
|
872
|
+
</form></Popover.Anchor>
|
|
873
|
+
<Popover.Portal><Popover.Content className={styles.tagPicker} data-slot="page-tag-picker" aria-label="Page tags" align="start" sideOffset={4} collisionPadding={12} onOpenAutoFocus={event => event.preventDefault()} onCloseAutoFocus={event => event.preventDefault()} onInteractOutside={event => { if ((event.target as HTMLElement).closest('[data-slot="page-tags-input"]')) event.preventDefault(); }} onEscapeKeyDown={event => { event.preventDefault(); onOpenChange(false); }}>
|
|
874
|
+
<div className={styles.tagOptions} role="menu" aria-label="Available tags">{options.map(tag => <MenuItem key={tag} size="sm" className={styles.tagOption} onClick={() => { onChange([...new Set([...value, tag])]); setQuery(""); field.current?.focus(); onOpenChange(true); }}><Tag size="md"><span className={styles.tagName} title={tag}>{tag}</span></Tag></MenuItem>)}</div>
|
|
875
|
+
{query.trim() && options.length === 0 && ![...known, ...value].some(tag => tag.toLowerCase() === query.trim().toLowerCase()) && <Button className={styles.tagCreate} variant="ghost" size="sm" onClick={() => add()}><span className={styles.tagName} title={`Add ${query.trim()}`}>Add “{query.trim()}”</span></Button>}
|
|
876
|
+
</Popover.Content></Popover.Portal>
|
|
877
|
+
</Popover.Root>;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function Property({ icon, label, children }: { icon: IconName; label: string; children: ReactNode }) {
|
|
881
|
+
return <div className={styles.property}><dt><Icon name={icon} /><span>{label}</span></dt><dd>{children}</dd></div>;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
const files = [
|
|
885
|
+
{ id: "brief", name: "Launch brief.md", owner: "Mina Kim", heading: "Website launch", intro: "A focused refresh of our public website, from the first visit to the first conversation.", sections: ["Introduce the product with a clear story.", "Make the path to booking a demo easy to find.", "Keep the experience accessible on every screen."] },
|
|
886
|
+
{ id: "research", name: "Research notes.md", owner: "James Lee", heading: "What we learned", intro: "Notes from five conversations with people evaluating the product.", sections: ["People look for a concrete example before reading feature lists.", "Pricing should explain what changes between plans.", "A short demo helps teams share the product internally."] },
|
|
887
|
+
];
|
|
888
|
+
|
|
889
|
+
function FileExample(props: ExampleProps) {
|
|
890
|
+
const [fileId, setFileId] = useState("brief");
|
|
891
|
+
const [view, setView] = useState("preview");
|
|
892
|
+
const [version, setVersion] = useState("v3");
|
|
893
|
+
const file = files.find(item => item.id === fileId)!;
|
|
894
|
+
const revision = version === "v3" ? file.intro : version === "v2" ? "Revised draft: " + file.intro : "Initial draft: " + file.intro;
|
|
895
|
+
const nextSteps = "Review the draft with the team and collect feedback before the next design review.";
|
|
896
|
+
const source = `# ${file.heading}\n\n${revision}\n\n## Goals\n\n${file.sections.map(item => "- " + item).join("\n")}\n\n## Next steps\n\n${nextSteps}\n`;
|
|
897
|
+
const download = () => {
|
|
898
|
+
const url = URL.createObjectURL(new Blob([source], { type: "text/markdown;charset=utf-8" }));
|
|
899
|
+
const link = document.createElement("a"); link.href = url; link.download = file.name; link.click(); setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
900
|
+
};
|
|
901
|
+
return <Panel {...props} kind="file" title="File preview" launch="Open file preview" breadcrumb="Website / Files" actions={<Button variant="ghost" size="sm" leftIcon={<Icon name="download-simple" />} onClick={download}>Download</Button>}>
|
|
902
|
+
<div className={styles.fileLayout}>
|
|
903
|
+
<nav className={styles.fileNav} aria-label="Project files"><h3>Files</h3>{files.map(item => <ListItem key={item.id} size="sm" active={item.id === fileId} onClick={() => { setFileId(item.id); setVersion("v3"); setView("preview"); }} actionLabel={`Preview ${item.name}${item.id === fileId ? " (current file)" : ""}`} leading={<FileIcon ext="md" size="sm" />}><ListItem.Title>{item.name}</ListItem.Title></ListItem>)}</nav>
|
|
904
|
+
<div className={styles.fileMain}>
|
|
905
|
+
<header className={styles.fileHeader}><FileIcon ext="md" size="lg" /><div><h2>{file.name}</h2><p><Avatar size="xs" name={file.owner} />{file.owner}<span>·</span>{new Blob([source]).size} bytes<span>·</span>{version}</p></div></header>
|
|
906
|
+
<Tabs stretch size="sm" value={view} onValueChange={setView} className={styles.fileTabs}>
|
|
907
|
+
<Tabs.List aria-label="File views"><Tabs.Trigger value="preview">Preview</Tabs.Trigger><Tabs.Trigger value="versions">Versions</Tabs.Trigger></Tabs.List>
|
|
908
|
+
<Tabs.Panel value="preview" className={styles.previewArea}><article className={styles.paper}><div className={styles.paperPath}>Website / Launch</div><h2>{file.heading}</h2><p>{revision}</p><h3>Goals</h3><ul>{file.sections.map(item => <li key={item}>{item}</li>)}</ul><h3>Next steps</h3><p>{nextSteps}</p></article></Tabs.Panel>
|
|
909
|
+
<Tabs.Panel value="versions" className={styles.versions}><h3>Version history</h3>{["v3", "v2", "v1"].map((item, index) => <ListItem key={item} onClick={() => { setVersion(item); setView("preview"); }} actionLabel={`View ${item}`} leading={<Icon name="clock" />} trailing={index === 0 ? <Tag size="md" variant="soft" shape="rounded" status="neutral">Current</Tag> : undefined}><ListItem.Title>{item} — {index === 0 ? "Ready for review" : index === 1 ? "Updated project goals" : "Initial draft"}</ListItem.Title><ListItem.Description>{index === 0 ? "Today" : index === 1 ? "Yesterday" : "November 3"} · {file.owner}</ListItem.Description></ListItem>)}</Tabs.Panel>
|
|
910
|
+
</Tabs>
|
|
911
|
+
</div>
|
|
912
|
+
</div>
|
|
913
|
+
</Panel>;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
const pages = ["Website redesign", "Customer research"];
|
|
917
|
+
function NotionExample(props: ExampleProps) {
|
|
918
|
+
const [calendarOpen, setCalendarOpen] = useState(false);
|
|
919
|
+
const [tagsOpen, setTagsOpen] = useState(false);
|
|
920
|
+
useEffect(() => { if (!props.open) { setCalendarOpen(false); setTagsOpen(false); } }, [props.open]);
|
|
921
|
+
const [page, setPage] = useState(0);
|
|
922
|
+
const makeRecords = () => pages.map(title => ({ title, tags: ["Design", "Website"], status: "In progress", owner: "Mina Kim", date: "2026-11-12", favorite: false, priority: "Medium", tasks: ["Collect references and research"], discussion: (title === pages[0] ? createDiscussion() : { draft: "", comments: [], replyDrafts: {} }) as Discussion }));
|
|
923
|
+
const [records, setRecords] = useState(makeRecords);
|
|
924
|
+
const current = records[page];
|
|
925
|
+
const { status, owner, date, favorite, priority, tasks, tags } = current;
|
|
926
|
+
const selectedDate = parseISODate(date);
|
|
927
|
+
const update = (patch: Partial<(typeof records)[number]>) => setRecords(items => items.map((item, index) => index === page ? { ...item, ...patch } : item));
|
|
928
|
+
const comments = useRef<HTMLDivElement>(null);
|
|
929
|
+
const reset = () => { setRecords(makeRecords()); setPage(0); };
|
|
930
|
+
const checklist = ["Collect references and research", "Explore the first design direction", "Review with the team"];
|
|
931
|
+
return <Panel {...props} kind="notion" suspendEscape={calendarOpen || tagsOpen} title="Notion page" launch="Open Notion page" breadcrumb="Projects" actions={<>
|
|
932
|
+
<IconButton variant="ghost" size="sm" aria-label="Previous page" disabled={page === 0} icon={<Icon name="caret-left" />} onClick={() => setPage(0)} />
|
|
933
|
+
<IconButton variant="ghost" size="sm" aria-label="Next page" disabled={page === pages.length - 1} icon={<Icon name="caret-right" />} onClick={() => setPage(1)} />
|
|
934
|
+
<IconButton variant="ghost" size="sm" aria-label="Go to comments" icon={<Icon name="chat-circle" />} onClick={() => { comments.current?.scrollIntoView({ behavior: "auto", block: "start" }); comments.current?.querySelector<HTMLTextAreaElement>('[data-slot="comment-composer"]:not([data-reply]) textarea')?.focus(); }} />
|
|
935
|
+
<IconButton variant="ghost" size="sm" aria-label="Favorite page" aria-pressed={favorite} icon={<Icon name="star" weight={favorite ? "fill" : "regular"} />} onClick={() => update({ favorite: !favorite })} />
|
|
936
|
+
<DropdownMenu><DropdownMenu.Trigger asChild><IconButton variant="ghost" size="sm" aria-label="Page actions" icon={<Icon name="dots-three" />} /></DropdownMenu.Trigger><DropdownMenu.Content align="end"><DropdownMenu.Item onSelect={() => update({ favorite: !favorite })}>{favorite ? "Remove from favorites" : "Add to favorites"}</DropdownMenu.Item><DropdownMenu.Separator /><DropdownMenu.Item onSelect={reset}>Reset example</DropdownMenu.Item></DropdownMenu.Content></DropdownMenu>
|
|
937
|
+
</>}>
|
|
938
|
+
<article className={styles.notion}>
|
|
939
|
+
<Input className={styles.pageTitle} variant="line" aria-label="Page title" value={current.title} onChange={event => update({ title: event.target.value })} />
|
|
940
|
+
<dl className={styles.notionProperties}>
|
|
941
|
+
<Property icon="check-circle" label="Status"><Choice quiet status label="Page status" value={status} options={["Not started", "In progress", "Done"]} onChange={value => update({ status: value })} /></Property>
|
|
942
|
+
<Property icon="user" label="Assignee"><Choice quiet person label="Page assignee" value={owner} options={["Mina Kim", "James Lee", "Alex Morgan"]} onChange={value => update({ owner: value })} /></Property>
|
|
943
|
+
<Property icon="calendar-blank" label="Due date"><DatePicker size="sm" onOpenChange={setCalendarOpen} value={selectedDate} onChange={next => update({ date: next ? formatISODate(next) : "" })} aria-label="Page due date" trigger={<Button variant="ghost" size="sm" className={styles.dateTrigger} aria-label="Page due date">{selectedDate ? selectedDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "Empty"}</Button>} /></Property>
|
|
944
|
+
<Property icon="tag" label="Tags"><TagPicker value={tags} onChange={next => update({ tags: next })} open={tagsOpen} onOpenChange={setTagsOpen} /></Property>
|
|
945
|
+
<Property icon="flag" label="Priority"><Choice quiet tag label="Page priority" value={priority} options={["High", "Medium", "Low"]} onChange={value => update({ priority: value })} /></Property>
|
|
946
|
+
</dl>
|
|
947
|
+
<div ref={comments} className={styles.notionDiscussion}><CommentDiscussion key={page} value={current.discussion} onChange={next => setRecords(items => items.map((item, index) => index === page ? { ...item, discussion: typeof next === "function" ? next(item.discussion) : next } : item))} /></div>
|
|
948
|
+
<section className={styles.pageBody}><h2>{page === 0 ? "Project overview" : "Research plan"}</h2><p>{page === 0 ? "A clearer home for our product. Bring the story, navigation, and visual language together so visitors can find what they need." : "Understand how people evaluate the product and where they need more context. Start with recent conversations and unanswered questions."}</p><h3>What we're working toward</h3><ul><li>A clear first impression</li><li>Simple paths to the most important pages</li><li>A consistent experience on mobile and desktop</li></ul><h3>Next steps</h3><div className={styles.pageChecklist}>{checklist.map(item => <Checkbox key={item} checked={tasks.includes(item)} onChange={event => update({ tasks: event.target.checked ? [...tasks, item] : tasks.filter(value => value !== item) })}>{item}</Checkbox>)}</div></section>
|
|
949
|
+
</article>
|
|
950
|
+
</Panel>;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
export function DrawerDetailExamples({ lang }: { lang: "ko" | "en" }) {
|
|
954
|
+
const [active, setActive] = useState<Kind | null>(null);
|
|
955
|
+
const props = (kind: Kind): ExampleProps => ({ open: active === kind, onOpenChange: open => setActive(open ? kind : null) });
|
|
956
|
+
return <ThemeLocaleProvider lang="en">
|
|
957
|
+
<h3>{lang === "ko" ? "파일 미리보기" : "File preview"}</h3><FileExample {...props("file")} />
|
|
958
|
+
<h3>{lang === "ko" ? "Notion 페이지 미리보기" : "Notion page peek"}</h3><NotionExample {...props("notion")} />
|
|
959
|
+
</ThemeLocaleProvider>;
|
|
960
|
+
}
|
|
961
|
+
````
|
|
962
|
+
|
|
963
|
+
### Source: web/examples/TraceSidePanelExample.module.css
|
|
964
|
+
|
|
965
|
+
````css
|
|
966
|
+
.example,
|
|
967
|
+
.dialogContent,
|
|
968
|
+
:global([role="dialog"]):has(> .dialogContent) {
|
|
969
|
+
--trace-tree-width: calc(var(--size-4) * 18);
|
|
970
|
+
--trace-dialog-width: calc(var(--size-24) * 10);
|
|
971
|
+
--trace-divider: color-mix(in srgb, var(--fg) 7%, var(--bg));
|
|
972
|
+
--trace-selected: color-mix(in srgb, var(--fg) 5%, var(--bg));
|
|
973
|
+
--trace-secondary: color-mix(in srgb, var(--fg) 64%, var(--bg));
|
|
974
|
+
--trace-field-heading: var(--trace-secondary);
|
|
975
|
+
|
|
976
|
+
color: var(--fg);
|
|
977
|
+
font-family: var(--font-normal);
|
|
978
|
+
font-size: var(--text-sm);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
.example { width: 100%; min-width: 0; }
|
|
982
|
+
.panel { display: grid; grid-template-columns: var(--trace-tree-width) minmax(0, 1fr); height: 100%; background: var(--bg); text-align: left; }
|
|
983
|
+
.treePane { display: flex; min-height: 0; min-width: 0; flex-direction: column; border-right: 1px solid var(--trace-divider); }
|
|
984
|
+
.tools.tools { flex-shrink: 0; padding-inline: var(--space-3); }
|
|
985
|
+
.actions.actions { gap: var(--space-0_5); }
|
|
986
|
+
.toolbarLabel { color: var(--trace-secondary); font-size: var(--text-xs); }
|
|
987
|
+
.treeScroll { flex: 1; min-height: 0; overflow: auto; padding: var(--space-1) var(--space-3) var(--space-3); }
|
|
988
|
+
.treeNavigation { --menu-active-bg: var(--trace-selected); --menu-fg: var(--fg-muted); }
|
|
989
|
+
.treeNavigation :global([data-slot="menu-item-root"]) { font-weight: var(--font-weight-medium); }
|
|
990
|
+
.nodeIcon { color: var(--trace-secondary); }
|
|
991
|
+
.duration { font-weight: var(--font-weight-regular); font-size: var(--text-2xs); color: var(--trace-secondary); font-variant-numeric: tabular-nums; }
|
|
992
|
+
.metadata { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2_5) var(--space-3); background: var(--bg-subtle); margin: 0; padding: var(--space-5); border-top: 1px solid var(--trace-divider); font-size: var(--text-xs); line-height: var(--lh-xs); }
|
|
993
|
+
.metadata dt { color: var(--trace-secondary); }
|
|
994
|
+
.metadata dd { color: var(--trace-secondary); margin: 0; min-width: 0; font-variant-numeric: tabular-nums; }
|
|
995
|
+
.mono { font-family: var(--font-code); }
|
|
996
|
+
.detail.detail { gap: 0; min-width: 0; min-height: 0; overflow: auto; }
|
|
997
|
+
.detailHeader { position: sticky; top: 0; z-index: var(--z-sticky); padding: var(--space-4) var(--space-6) var(--space-3); background: var(--bg); }
|
|
998
|
+
.titleRow { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }
|
|
999
|
+
.titleGroup { min-width: 0; }
|
|
1000
|
+
.titleGroup h4 { margin: 0; overflow-wrap: anywhere; font-size: var(--text-xl); font-weight: var(--font-weight-medium); line-height: var(--lh-xl); }
|
|
1001
|
+
.sections { min-width: 0; gap: 0; }
|
|
1002
|
+
.sections > :global([role="tablist"]) { gap: var(--space-4); }
|
|
1003
|
+
.sections > :first-child { padding-inline: var(--space-6); }
|
|
1004
|
+
.body { padding: var(--space-5) var(--space-6); }
|
|
1005
|
+
.body h5 { margin: 0 0 var(--space-2); font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: var(--font-weight-medium); }
|
|
1006
|
+
.field + .field { margin-top: var(--space-6); }
|
|
1007
|
+
.fieldLabel { margin: 0 0 var(--space-1_5); color: var(--trace-field-heading); font-size: var(--text-base); line-height: var(--lh-base); font-weight: var(--font-weight-medium); }
|
|
1008
|
+
.fieldValue { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: var(--lh-sm); }
|
|
1009
|
+
.alternatives { padding-left: var(--space-5); margin: 0; }
|
|
1010
|
+
.alternatives li + li { margin-top: var(--space-4); }
|
|
1011
|
+
.alternatives p { margin: 0 0 var(--space-1); }
|
|
1012
|
+
.alternatives span { color: var(--trace-secondary); font-size: var(--text-2xs); }
|
|
1013
|
+
.dialogContent { --trace-tree-width: calc(var(--size-4) * 18); height: 100%; min-height: 0; }
|
|
1014
|
+
.dialogContent > :first-child { position: absolute; padding: 0; }
|
|
1015
|
+
.dialogContent .panel { height: 100%; }
|
|
1016
|
+
:global([role="dialog"]):has(> .dialogContent) { width: min(var(--trace-dialog-width), 100vw); min-width: 0; max-width: 100vw; border: 0; border-left: 1px solid var(--trace-divider); corner-shape: var(--corner-shape); border-radius: 0; }
|
|
1017
|
+
|
|
1018
|
+
@media (max-width: 640px) {
|
|
1019
|
+
.example, .dialogContent { --trace-tree-width: 100%; }
|
|
1020
|
+
.panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
|
|
1021
|
+
.treePane { border-right: 0; border-bottom: 1px solid var(--trace-divider); }
|
|
1022
|
+
.treeScroll { flex: none; max-height: calc(var(--size-4) * 10); overflow: auto; padding: var(--space-2) var(--space-3); }
|
|
1023
|
+
.metadata { display: none; }
|
|
1024
|
+
.detailHeader { padding-inline: var(--space-6); }
|
|
1025
|
+
.body { padding: var(--space-5) var(--space-6); }
|
|
1026
|
+
.sections > :first-child { padding-inline: var(--space-6); }
|
|
1027
|
+
:global([role="dialog"]):has(> .dialogContent) { corner-shape: var(--corner-shape); border-radius: 0; }
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
.sections :global([role="tab"][aria-selected="false"]) { color: var(--trace-secondary); }
|
|
1031
|
+
.sections :global([role="tab"]:hover), .sections :global([role="tab"]:focus-visible) { color: var(--fg); }
|
|
1032
|
+
.titleRow > :last-child { flex-shrink: 0; }
|
|
1033
|
+
.formatList :global([role="tab"]):focus-visible { box-shadow: inset 0 0 0 var(--hairline) var(--border-strong); }
|
|
1034
|
+
:global([role="dialog"]):has(> .dialogContent[data-expanded]) { width: 100vw; border-radius: 0; }
|
|
1035
|
+
@media (max-width: 640px) {
|
|
1036
|
+
.titleRow { flex-wrap: wrap; row-gap: var(--space-2); }
|
|
1037
|
+
}
|
|
1038
|
+
````
|
|
1039
|
+
|
|
1040
|
+
### Source: web/examples/TraceSidePanelExample.tsx
|
|
1041
|
+
|
|
1042
|
+
````tsx
|
|
1043
|
+
"use client";
|
|
1044
|
+
|
|
1045
|
+
import { PreviewButton } from "@/app/_components/PreviewButton";
|
|
1046
|
+
|
|
1047
|
+
import { Tag } from "@/components/Tag";
|
|
1048
|
+
import { useRef, useState } from "react";
|
|
1049
|
+
import { ThemeLocaleProvider } from "@/components/ThemeController";
|
|
1050
|
+
import { Badge } from "@/components/Badge";
|
|
1051
|
+
import { CodeBlock } from "@/components/CodeBlock";
|
|
1052
|
+
import { Drawer } from "@/components/Drawer";
|
|
1053
|
+
import { IconButton } from "@/components/IconButton";
|
|
1054
|
+
import { Topbar } from "@/components/Topbar";
|
|
1055
|
+
import { Icon } from "@/components/Icon";
|
|
1056
|
+
import { TreeNav, type TreeNavItem } from "@/components/TreeNav";
|
|
1057
|
+
import { Tabs } from "@/components/Tabs";
|
|
1058
|
+
import styles from "./TraceSidePanelExample.module.css";
|
|
1059
|
+
|
|
1060
|
+
type SpanId = "api" | "translate" | "format";
|
|
1061
|
+
const spans = [
|
|
1062
|
+
{ id: "api", name: "API", duration: "1.4s", input: { text: "I mistook A for B.", target: "en" }, output: { status: "completed", result: "I mistook A for B." } },
|
|
1063
|
+
{ id: "translate", name: "sentence-translate", duration: "1.2s", input: { system: "Translate the sentence naturally. Return three alternatives with a short English explanation.", user: "I mistook A for B." }, output: { candidates: [{ en: "I mistook A for B.", hint: "The most natural and direct expression" }, { en: "I confused A with B.", hint: "Emphasizes confusing A with B" }, { en: "I thought A was B.", hint: "A conversational way to describe the mix-up" }] } },
|
|
1064
|
+
{ id: "format", name: "format-response", duration: "188ms", input: { format: "json", language: "en" }, output: { status: "completed", translation: "I mistook A for B." } },
|
|
1065
|
+
] as const;
|
|
1066
|
+
|
|
1067
|
+
type PanelState = {
|
|
1068
|
+
selected: SpanId; setSelected: (value: SpanId) => void;
|
|
1069
|
+
expanded: boolean; setExpanded: (value: boolean) => void;
|
|
1070
|
+
section: string; setSection: (value: string) => void;
|
|
1071
|
+
json: boolean; setJson: (value: boolean) => void;
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
function TracePanel({ state, onClose, onExpand, maximized }: {
|
|
1075
|
+
state: PanelState; onClose: () => void; onExpand: () => void; maximized: boolean;
|
|
1076
|
+
}) {
|
|
1077
|
+
const { selected, setSelected, expanded, setExpanded, section, setSection, json, setJson } = state;
|
|
1078
|
+
const detailRef = useRef<HTMLDivElement>(null);
|
|
1079
|
+
const span = spans.find((item) => item.id === selected)!;
|
|
1080
|
+
const select = (id: SpanId) => { setSelected(id); setSection("input"); detailRef.current?.scrollTo({ top: 0 }); };
|
|
1081
|
+
const labels = { input: "Input", output: "Output", metadata: "Metadata" };
|
|
1082
|
+
const metadata = { model: "gpt-4.1-mini", duration: span.duration, status: "completed", tokens: selected === "translate" ? 382 : 0 };
|
|
1083
|
+
const data = section === "input" ? span.input : section === "output" ? span.output : metadata;
|
|
1084
|
+
|
|
1085
|
+
return <div className={styles.panel} data-testid="trace-panel">
|
|
1086
|
+
<aside className={styles.treePane} aria-label={"Trace navigation"}>
|
|
1087
|
+
<Topbar size="sm" className={styles.tools}>
|
|
1088
|
+
<Topbar.Leading className={styles.actions}>
|
|
1089
|
+
<IconButton variant="ghost" size="sm" aria-label="Close trace panel" icon={<Icon name="arrow-line-right" />} onClick={onClose} />
|
|
1090
|
+
<IconButton variant="ghost" size="sm" aria-label={maximized ? "Restore trace panel" : "Expand trace panel"} icon={<Icon name={maximized ? "arrows-in" : "arrows-out"} />} onClick={onExpand} />
|
|
1091
|
+
</Topbar.Leading>
|
|
1092
|
+
<Topbar.Trailing><span className={styles.toolbarLabel}>Trace</span></Topbar.Trailing>
|
|
1093
|
+
</Topbar>
|
|
1094
|
+
<div className={styles.treeScroll}>
|
|
1095
|
+
<TreeNav
|
|
1096
|
+
aria-label={"Execution tree"}
|
|
1097
|
+
items={[{ id: "api-group", label: "API", children: spans.map((item) => ({
|
|
1098
|
+
id: item.id, label: item.id === "api" ? ("Request") : item.name,
|
|
1099
|
+
})) }]}
|
|
1100
|
+
selectedId={selected}
|
|
1101
|
+
onSelect={(item: TreeNavItem) => select(item.id as SpanId)}
|
|
1102
|
+
expandedIds={expanded ? ["api-group"] : []}
|
|
1103
|
+
onExpandedChange={(ids) => setExpanded(ids.includes("api-group"))}
|
|
1104
|
+
renderIcon={(item, { branch }) => branch ? null : <Icon className={styles.nodeIcon} name={item.id === "translate" ? "lightning" : "code"} />}
|
|
1105
|
+
renderTrailing={(item) => <span className={styles.duration}>{item.id === "api-group" ? spans[0].duration : spans.find((entry) => entry.id === item.id)?.duration}</span>}
|
|
1106
|
+
guides={false}
|
|
1107
|
+
className={styles.treeNavigation}
|
|
1108
|
+
/>
|
|
1109
|
+
</div>
|
|
1110
|
+
<dl className={styles.metadata}>
|
|
1111
|
+
<dt>Trace ID</dt><dd className={styles.mono}>tr_demo_7f8a2c</dd>
|
|
1112
|
+
<dt>{"Started"}</dt><dd><time dateTime="2026-10-07T07:27:00+09:00">10/07 07:27:00</time></dd>
|
|
1113
|
+
<dt>{"Status"}</dt><dd><Tag variant="soft" status="success" shape="rounded" size="md">{"Completed"}</Tag></dd>
|
|
1114
|
+
<dt>{"Duration"}</dt><dd>1.4s</dd>
|
|
1115
|
+
<dt>{"Tokens"}</dt><dd>382</dd>
|
|
1116
|
+
<dt>{"Spans"}</dt><dd><Badge variant="soft" size="sm">{spans.length}</Badge></dd>
|
|
1117
|
+
</dl>
|
|
1118
|
+
</aside>
|
|
1119
|
+
<Tabs variant="segmented" size="xs" stretch className={styles.detail} ref={detailRef} value={json ? "json" : "formatted"} onValueChange={value => setJson(value === "json")}>
|
|
1120
|
+
<div className={styles.detailHeader}>
|
|
1121
|
+
<div className={styles.titleRow}>
|
|
1122
|
+
<div className={styles.titleGroup}><h4>{span.name}</h4></div>
|
|
1123
|
+
<Tabs.List className={styles.formatList} aria-label="Display format">
|
|
1124
|
+
<Tabs.Trigger value="formatted">Formatted</Tabs.Trigger>
|
|
1125
|
+
<Tabs.Trigger value="json">JSON</Tabs.Trigger>
|
|
1126
|
+
</Tabs.List>
|
|
1127
|
+
</div>
|
|
1128
|
+
</div>
|
|
1129
|
+
<Tabs.Panel value={json ? "json" : "formatted"}>
|
|
1130
|
+
<Tabs stretch value={section} onValueChange={setSection} className={styles.sections}>
|
|
1131
|
+
<Tabs.List aria-label={"Span detail sections"}>
|
|
1132
|
+
{Object.entries(labels).map(([key, label]) => <Tabs.Trigger key={key} value={key}>{label}</Tabs.Trigger>)}
|
|
1133
|
+
</Tabs.List>
|
|
1134
|
+
{Object.entries(labels).map(([key, label]) => <Tabs.Panel key={key} value={key} className={styles.body}>
|
|
1135
|
+
{json ? <CodeBlock language="json" code={JSON.stringify(data, null, 2)} /> : <>
|
|
1136
|
+
<h5>{label}</h5>
|
|
1137
|
+
{Object.entries(data).map(([field, value]) => <div className={styles.field} key={field}>
|
|
1138
|
+
<h6 className={styles.fieldLabel}>{field}</h6>
|
|
1139
|
+
{Array.isArray(value) ? <ol className={styles.alternatives}>{value.map((entry, i) => <li key={i}><p>{entry.en}</p><span>{entry.hint}</span></li>)}</ol> : <p className={styles.fieldValue}>{String(value)}</p>}
|
|
1140
|
+
</div>)}
|
|
1141
|
+
</>}
|
|
1142
|
+
</Tabs.Panel>)}
|
|
1143
|
+
</Tabs>
|
|
1144
|
+
</Tabs.Panel>
|
|
1145
|
+
</Tabs>
|
|
1146
|
+
</div>;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
export function TraceSidePanelExample() {
|
|
1150
|
+
const [selected, setSelected] = useState<SpanId>("translate");
|
|
1151
|
+
const [expanded, setExpanded] = useState(true);
|
|
1152
|
+
const [section, setSection] = useState("output");
|
|
1153
|
+
const [json, setJson] = useState(false);
|
|
1154
|
+
const state = { selected, setSelected, expanded, setExpanded, section, setSection, json, setJson };
|
|
1155
|
+
const [open, setOpen] = useState(false);
|
|
1156
|
+
const [maximized, setMaximized] = useState(false);
|
|
1157
|
+
const trigger = useRef<HTMLButtonElement>(null);
|
|
1158
|
+
return <ThemeLocaleProvider lang="en"><div className={styles.example}>
|
|
1159
|
+
<PreviewButton ref={trigger} onClick={() => setOpen(true)}>Open trace panel</PreviewButton>
|
|
1160
|
+
<Drawer.Root open={open} onOpenChange={(value) => { setOpen(value); if (!value) requestAnimationFrame(() => trigger.current?.focus()); }} size="lg" backdrop="none" dismissOnBackdropClick={false}>
|
|
1161
|
+
<div className={styles.dialogContent} data-expanded={maximized || undefined}>
|
|
1162
|
+
<Drawer.Header title={"Trace detail"} titleSrOnly dismissible={false} />
|
|
1163
|
+
<TracePanel state={state} onClose={() => { setOpen(false); requestAnimationFrame(() => trigger.current?.focus()); }} onExpand={() => setMaximized(value => !value)} maximized={maximized} />
|
|
1164
|
+
</div>
|
|
1165
|
+
</Drawer.Root>
|
|
1166
|
+
</div></ThemeLocaleProvider>;
|
|
1167
|
+
}
|
|
1168
|
+
````
|