@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,360 @@
|
|
|
1
|
+
# Comment 사용 사례 소스
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/build-use-cases.mjs. Edit original TSX/CSS, then regenerate. -->
|
|
4
|
+
|
|
5
|
+
### 사례 목록
|
|
6
|
+
|
|
7
|
+
- Document review
|
|
8
|
+
- Task discussion
|
|
9
|
+
|
|
10
|
+
문서: /en/components/data/comment#use-cases
|
|
11
|
+
|
|
12
|
+
문서 페이지에서 렌더하는 사례입니다.
|
|
13
|
+
|
|
14
|
+
### 조회 방법
|
|
15
|
+
|
|
16
|
+
get_guide(topic="use-cases/data-comment", sections=["사례 목록", "파일 목록"])로 먼저 확인하고, 필요한 Section 또는 Source 파일 헤딩만 sections로 조회하세요. 전체 문서는 문서 페이지의 다른 예제도 포함합니다. 공용 컴포넌트 계약은 get_component로 읽고, 예제의 docs 전용 셸·locale·import 경로는 대상 프로젝트에 맞게 조합하세요. 이 연결은 디자인 승인이나 기능 검증을 뜻하지 않습니다.
|
|
17
|
+
|
|
18
|
+
### 파일 목록
|
|
19
|
+
|
|
20
|
+
- `web/app/[lang]/components/data/comment/page.module.css`
|
|
21
|
+
- `web/app/[lang]/components/data/comment/page.tsx`
|
|
22
|
+
- `web/examples/CommentDiscussion.module.css`
|
|
23
|
+
- `web/examples/CommentDiscussion.tsx`
|
|
24
|
+
- `web/examples/CommentDocsExamples.module.css`
|
|
25
|
+
- `web/examples/CommentDocsExamples.tsx`
|
|
26
|
+
|
|
27
|
+
### Section: web/app/[lang]/components/data/comment/page.tsx#use-cases
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<section id="use-cases">
|
|
31
|
+
<h2>{ko ? "사용 사례" : "In Use"}</h2>
|
|
32
|
+
<h3>{ko ? "문서 검토" : "Document review"}</h3>
|
|
33
|
+
<ExampleBlock previewWidth="full"><div className={styles.example}><CommentDiscussion /></div></ExampleBlock>
|
|
34
|
+
<h3>{ko ? "업무 대화" : "Task discussion"}</h3>
|
|
35
|
+
<ExampleBlock previewWidth="full"><div className={styles.example}><CommentDiscussion variant="box" label="Box comments" /></div></ExampleBlock>
|
|
36
|
+
</section>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Source: web/app/[lang]/components/data/comment/page.module.css
|
|
40
|
+
|
|
41
|
+
````css
|
|
42
|
+
.example { width: 100%; min-width: 0; }
|
|
43
|
+
.stack { display: grid; gap: var(--space-6); width: 100%; min-width: 0; }
|
|
44
|
+
````
|
|
45
|
+
|
|
46
|
+
### Source: web/app/[lang]/components/data/comment/page.tsx
|
|
47
|
+
|
|
48
|
+
````tsx
|
|
49
|
+
"use client";
|
|
50
|
+
|
|
51
|
+
import { useState } from "react";
|
|
52
|
+
import { usePathname } from "next/navigation";
|
|
53
|
+
import { Comment, CommentList, type CommentInputVariant } from "@/components/Comment";
|
|
54
|
+
import { Code } from "@/components/Code";
|
|
55
|
+
import { CommentDiscussion } from "@/examples/CommentDiscussion";
|
|
56
|
+
import { CommentActionsExample, CommentComposerExample } from "@/examples/CommentDocsExamples";
|
|
57
|
+
import { ExampleBlock } from "../../../../_components/ExampleBlock";
|
|
58
|
+
import { Playground } from "../../../../_components/Playground";
|
|
59
|
+
import { DocsTable } from "../../../../_components/DocsTable";
|
|
60
|
+
import { localeFromPathname } from "../../../../_dict";
|
|
61
|
+
import styles from "./page.module.css";
|
|
62
|
+
|
|
63
|
+
type ApiRow = [prop: string, type: string, defaultValue: string, description: string];
|
|
64
|
+
|
|
65
|
+
export default function CommentPage() {
|
|
66
|
+
const ko = localeFromPathname(usePathname() ?? "/") === "ko";
|
|
67
|
+
const [variant, setVariant] = useState<CommentInputVariant>("line");
|
|
68
|
+
const [disabled, setDisabled] = useState(false);
|
|
69
|
+
const text = (korean: string, english: string) => ko ? korean : english;
|
|
70
|
+
const required = text("필수", "Required");
|
|
71
|
+
const automatic = text("자동", "Automatic");
|
|
72
|
+
const api = (rows: ApiRow[]) => <DocsTable columns={[
|
|
73
|
+
{ key: "prop", label: ko ? "속성" : "Prop", width: 160 },
|
|
74
|
+
{ key: "type", label: ko ? "타입" : "Type", flex: true, minWidth: 160 },
|
|
75
|
+
{ key: "default", label: "Default", width: 100 },
|
|
76
|
+
{ key: "desc", label: text("설명", "Description"), flex: true, minWidth: 200 },
|
|
77
|
+
]} rows={rows.map(([prop, type, value, desc]) => ({ prop: <Code>{prop}</Code>, type: <Code>{type}</Code>, default: value === required || value === automatic ? value : <Code>{value}</Code>, desc }))} />;
|
|
78
|
+
|
|
79
|
+
return <>
|
|
80
|
+
<h1 className="page-title">Comment</h1>
|
|
81
|
+
<p className="page-lead">{text("작성자와 함께 댓글과 답글을 보여줘요.", "Displays comments and replies with their authors.")}</p>
|
|
82
|
+
|
|
83
|
+
<section id="usage" className="section-first">
|
|
84
|
+
<h2>{ko ? "사용법" : "Usage"}</h2>
|
|
85
|
+
<p className="desc">{text("검토 의견이나 업무 대화처럼 작성자를 함께 남길 때 사용하세요.", "Use for review feedback or discussions that need an author.")}</p>
|
|
86
|
+
<ExampleBlock previewWidth="full" code={'import { Comment } from "@/components/Comment";\n\n<Comment author="Alex Morgan">Please check the mobile layout before the next review.</Comment>'}>
|
|
87
|
+
<div className={styles.example}><Comment author="Alex Morgan">Please check the mobile layout before the next review.</Comment></div>
|
|
88
|
+
</ExampleBlock>
|
|
89
|
+
</section>
|
|
90
|
+
|
|
91
|
+
<Playground controlsPlacement="bottom" togglesLabel="state" axes={[
|
|
92
|
+
{ label: "variant", value: variant, onChange: value => setVariant(value as CommentInputVariant), options: ["line", "box"] },
|
|
93
|
+
]} toggles={[{ label: "disabled", value: disabled, onChange: setDisabled }]}>
|
|
94
|
+
<CommentComposerExample variant={variant} disabled={disabled} label="Playground composer" />
|
|
95
|
+
</Playground>
|
|
96
|
+
|
|
97
|
+
<section id="variants">
|
|
98
|
+
<h2>{ko ? "표현" : "Variants"}</h2>
|
|
99
|
+
<p className="desc">{ko ? <>본문에 붙이는 입력창은 <Code>line</Code>, 입력 영역을 구분하려면 <Code>box</Code>를 사용하세요.</> : <>Use <Code>line</Code> for an inline composer and <Code>box</Code> to separate the input area.</>}</p>
|
|
100
|
+
<ExampleBlock align="column" previewWidth="full" code={'<CommentComposer author="Alex Morgan" value={draft} onValueChange={setDraft} onSubmit={addComment} />\n<CommentComposer variant="box" author="Alex Morgan" value={boxDraft} onValueChange={setBoxDraft} onSubmit={addComment} />'}>
|
|
101
|
+
<div className={styles.stack}>
|
|
102
|
+
<CommentComposerExample />
|
|
103
|
+
<CommentComposerExample variant="box" />
|
|
104
|
+
</div>
|
|
105
|
+
</ExampleBlock>
|
|
106
|
+
</section>
|
|
107
|
+
|
|
108
|
+
<section id="with-actions">
|
|
109
|
+
<h2>With Actions</h2>
|
|
110
|
+
<p className="desc">{text("댓글을 가리키거나 작업 버튼에 포커스를 옮겨 수정·삭제할 수 있어요. 삭제한 댓글은 Undo로 되돌릴 수 있어요.", "Hover a comment or focus its actions to edit or delete it. Undo restores a deleted comment.")}</p>
|
|
111
|
+
<ExampleBlock previewWidth="full" code={'<Comment author="Alex Morgan" timestamp="Just now"\n actions={editing ? undefined : [\n { kind: "copy", onClick: copyComment, successLabel: "Copied", errorLabel: "Copy failed" },\n { kind: "edit", onClick: startEditing },\n { kind: "delete", onClick: deleteWithUndo },\n ]}\n>\n {editing ? (\n <CommentEditor value={draft} originalValue={body}\n mentions={draftMentions} originalMentions={mentions} mentionOptions={people}\n onValueChange={updateDraft} onSave={saveComment} onCancel={cancelEdit} />\n ) : <CommentText value={body} mentions={mentions} />}\n</Comment>'}>
|
|
112
|
+
<CommentActionsExample />
|
|
113
|
+
</ExampleBlock>
|
|
114
|
+
</section>
|
|
115
|
+
|
|
116
|
+
<section id="with-replies">
|
|
117
|
+
<h2>With Replies</h2>
|
|
118
|
+
<p className="desc">{ko ? <>답글은 <Code>replies</Code>에 넣고, 여러 댓글은 <Code>CommentList</Code>로 묶으세요.</> : <>Place replies in <Code>replies</Code> and group comments with <Code>CommentList</Code>.</>}</p>
|
|
119
|
+
<ExampleBlock previewWidth="full" code={'<Comment author="Mina Kim" timestamp="Yesterday" replies={\n <CommentList>\n <Comment author="James Lee" timestamp="2 hours ago">I will check the form spacing next.</Comment>\n </CommentList>\n}>\n Please check the mobile layout.\n</Comment>'}>
|
|
120
|
+
<div className={styles.example}><Comment author="Mina Kim" timestamp="Yesterday" replies={<CommentList><Comment author="James Lee" timestamp="2 hours ago">I will check the form spacing next.</Comment></CommentList>}>
|
|
121
|
+
Please check the mobile layout.
|
|
122
|
+
</Comment></div>
|
|
123
|
+
</ExampleBlock>
|
|
124
|
+
</section>
|
|
125
|
+
|
|
126
|
+
<section id="use-cases">
|
|
127
|
+
<h2>{ko ? "사용 사례" : "In Use"}</h2>
|
|
128
|
+
<h3>{ko ? "문서 검토" : "Document review"}</h3>
|
|
129
|
+
<ExampleBlock previewWidth="full"><div className={styles.example}><CommentDiscussion /></div></ExampleBlock>
|
|
130
|
+
<h3>{ko ? "업무 대화" : "Task discussion"}</h3>
|
|
131
|
+
<ExampleBlock previewWidth="full"><div className={styles.example}><CommentDiscussion variant="box" label="Box comments" /></div></ExampleBlock>
|
|
132
|
+
</section>
|
|
133
|
+
|
|
134
|
+
<section id="api">
|
|
135
|
+
<h2>{ko ? "속성" : "API Reference"}</h2>
|
|
136
|
+
<p className="desc">{text("댓글과 목록, 작성·수정 폼은 기본 HTML 속성을 함께 받아요.", "The comment, list and input forms also accept native HTML attributes.")}</p>
|
|
137
|
+
<h3>Comment</h3>
|
|
138
|
+
{api([
|
|
139
|
+
["author", "string", required, text("작성자 이름이에요.", "The author's display name.")],
|
|
140
|
+
["timestamp", "ReactNode", "undefined", text("댓글에 표시할 시간이에요.", "The displayed timestamp.")],
|
|
141
|
+
["dateTime", "string", "undefined", text("시간을 제공할 때 기계가 읽을 수 있는 날짜를 함께 지정하세요.", "Supply a machine-readable date when available.")],
|
|
142
|
+
["avatar", 'Omit<AvatarProps, "name" | "size">', "undefined", text("작성자 사진과 대체 표시를 지정해요.", "Sets the author image and fallback.")],
|
|
143
|
+
["actions", "MessageAction[]", "[]", text("권한이 있는 작업만 전달하세요.", "Include only permitted actions.")],
|
|
144
|
+
["replies", "ReactNode", "undefined", text("해당 댓글에 이어지는 답글이에요.", "Replies belonging to this comment.")],
|
|
145
|
+
["children", "ReactNode", "undefined", text("댓글 본문이나 수정창이에요.", "The comment body or editor.")],
|
|
146
|
+
])}
|
|
147
|
+
<h3>CommentList</h3>
|
|
148
|
+
{api([["children", "ReactNode", "undefined", text("댓글을 직접 나열하면 목록 항목으로 묶어요.", "Wraps comment children as list items.")]])}
|
|
149
|
+
<h3>CommentComposer</h3>
|
|
150
|
+
{api([
|
|
151
|
+
["variant", '"line" | "box"', '"line"', text("본문과 붙이거나 입력 영역을 분리할 때 선택하세요.", "Choose an inline or outlined input area.")],
|
|
152
|
+
["author", "string", required, text("작성 중인 사용자의 이름이에요.", "The current author's name.")],
|
|
153
|
+
["avatar", 'Omit<AvatarProps, "name" | "size">', "undefined", text("작성 중인 사용자의 사진을 지정해요.", "Sets the current author's image.")],
|
|
154
|
+
["value", "string", required, text("작성 중인 본문이에요.", "The current draft.")],
|
|
155
|
+
["onValueChange", "(value: string) => void", required, text("입력한 본문을 상태에 반영하세요.", "Update the draft state.")],
|
|
156
|
+
["onSubmit", "(body: string) => void", required, text("Enter로 전송하며 Shift+Enter는 줄바꿈해요.", "Enter submits; Shift+Enter adds a line.")],
|
|
157
|
+
["replyTo", "string", "undefined", text("답글 대상 이름을 멘션으로 표시해요.", "Shows the reply target as a mention.")],
|
|
158
|
+
["onCancel", "() => void", "undefined", text("답글 취소 버튼을 표시해요.", "Shows the cancel-reply action.")],
|
|
159
|
+
["disabled", "boolean", "false", text("작성할 수 없는 상태에 사용하세요.", "Use when writing is unavailable.")],
|
|
160
|
+
["submitting", "boolean", "false", text("처리 중 중복 전송을 막아요.", "Prevents duplicate submissions while pending.")],
|
|
161
|
+
["label", "string", automatic, text("입력창의 접근성 이름을 바꿔요.", "Overrides the input's accessible name.")],
|
|
162
|
+
["placeholder", "string", automatic, text("입력할 내용의 짧은 힌트예요.", "A short input hint.")],
|
|
163
|
+
])}
|
|
164
|
+
<h3>CommentEditor</h3>
|
|
165
|
+
{api([
|
|
166
|
+
["variant", '"line" | "box"', '"line"', text("작성창과 같은 형태로 맞추세요.", "Match the composer's presentation.")],
|
|
167
|
+
["value", "string", required, text("수정 중인 본문이에요.", "The edited draft.")],
|
|
168
|
+
["originalValue", "string", required, text("변경 여부를 비교할 원문이에요.", "The original body used to detect changes.")],
|
|
169
|
+
["onValueChange", "(body: string, mentions: CommentMention[]) => void", required, text("본문과 멘션을 함께 상태에 반영하세요.", "Update text and mentions together.")],
|
|
170
|
+
["onSave", "(body: string, mentions: CommentMention[]) => void", required, text("Enter로 저장하며 Shift+Enter는 줄바꿈해요.", "Enter saves; Shift+Enter adds a line.")],
|
|
171
|
+
["onCancel", "() => void", required, text("Escape나 취소 버튼으로 수정을 취소해요.", "Cancels editing with Escape or the cancel action.")],
|
|
172
|
+
["mentions", "CommentMention[]", "[]", text("사용자 멘션을 한 번에 지우거나 바꿀 수 있어요.", "Mentions that can be removed or replaced as a unit.")],
|
|
173
|
+
["originalMentions", "CommentMention[]", "[]", text("변경 여부를 비교할 원래 멘션이에요.", "The original mentions used to detect changes.")],
|
|
174
|
+
["mentionOptions", "CommentMentionOption[]", "[]", text("입력창에서 @로 검색할 사용자 목록이에요.", "People to suggest when typing @.")],
|
|
175
|
+
["disabled", "boolean", "false", text("수정할 수 없는 상태에 사용하세요.", "Use when editing is unavailable.")],
|
|
176
|
+
["submitting", "boolean", "false", text("처리 중 중복 저장을 막아요.", "Prevents duplicate saves while pending.")],
|
|
177
|
+
["autoFocus", "boolean", "true", text("수정창을 열면 입력에 포커스를 둬요.", "Focuses the editor when opened.")],
|
|
178
|
+
])}
|
|
179
|
+
<h3>CommentText</h3>
|
|
180
|
+
{api([
|
|
181
|
+
["value", "string", required, text("저장된 댓글 본문이에요.", "The saved comment body.")],
|
|
182
|
+
["mentions", "CommentMention[]", "[]", text("본문 안에 표시할 사용자 멘션이에요.", "Mentions to render within the body.")],
|
|
183
|
+
])}
|
|
184
|
+
<h3>CommentMention</h3>
|
|
185
|
+
{api([
|
|
186
|
+
["id", "string", required, text("사용자를 식별할 값이에요.", "The person's identifier.")],
|
|
187
|
+
["label", "string", required, text("화면에 표시할 이름이에요.", "The displayed name.")],
|
|
188
|
+
["offset", "number", required, text("태그를 제외한 본문에서 멘션을 넣을 문자 위치예요.", "The insertion position in text, excluding mention tags.")],
|
|
189
|
+
])}
|
|
190
|
+
</section>
|
|
191
|
+
</>;
|
|
192
|
+
}
|
|
193
|
+
````
|
|
194
|
+
|
|
195
|
+
### Source: web/examples/CommentDiscussion.module.css
|
|
196
|
+
|
|
197
|
+
````css
|
|
198
|
+
.root { min-width: 0; }
|
|
199
|
+
.composer { margin-top: var(--space-5); }
|
|
200
|
+
.replyComposer { margin-top: var(--space-3); padding-bottom: var(--space-2); }
|
|
201
|
+
````
|
|
202
|
+
|
|
203
|
+
### Source: web/examples/CommentDiscussion.tsx
|
|
204
|
+
|
|
205
|
+
````tsx
|
|
206
|
+
"use client";
|
|
207
|
+
|
|
208
|
+
import { useRef, useState, type ReactNode } from "react";
|
|
209
|
+
import { Comment, CommentList, CommentComposer, CommentEditor, CommentText, type CommentMention, type CommentInputVariant } from "@/components/Comment";
|
|
210
|
+
import { Button } from "@/components/Button";
|
|
211
|
+
import { useToast } from "@/components/Toast";
|
|
212
|
+
import type { MessageAction } from "@/components/MessageActions";
|
|
213
|
+
import styles from "./CommentDiscussion.module.css";
|
|
214
|
+
|
|
215
|
+
export type DiscussionComment = { id: number; author: string; time: string; body: string; parentId?: number; replyToId?: number; mentions?: CommentMention[] };
|
|
216
|
+
export type Discussion = { draft: string; comments: DiscussionComment[]; replyDrafts?: Record<number, string>; nextId?: number };
|
|
217
|
+
|
|
218
|
+
export function createDiscussion(): Discussion {
|
|
219
|
+
return { draft: "", replyDrafts: {}, nextId: 2, comments: [
|
|
220
|
+
{ id: 0, author: "Mina Kim", time: "Yesterday", body: "Please check the mobile layout before the next review." },
|
|
221
|
+
{ 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." },
|
|
222
|
+
] };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Example-owned data and permissions; shared UI lives in components/Comment. */
|
|
226
|
+
export function CommentDiscussion({ value, onChange, variant = "line", label = "Comments" }: { variant?: CommentInputVariant; label?: string; value?: Discussion; onChange?: (value: Discussion | ((current: Discussion) => Discussion)) => void }) {
|
|
227
|
+
const [local, setLocal] = useState(createDiscussion);
|
|
228
|
+
const { toast, dismiss } = useToast();
|
|
229
|
+
const current = value ?? local;
|
|
230
|
+
const { comments, draft, replyDrafts = {} } = current;
|
|
231
|
+
const [replyTarget, setReplyTarget] = useState<number | null>(null);
|
|
232
|
+
const [editing, setEditing] = useState<{ id: number; body: string; mentions: CommentMention[] } | null>(null);
|
|
233
|
+
const composer = useRef<HTMLTextAreaElement>(null);
|
|
234
|
+
const replyInput = useRef<HTMLTextAreaElement>(null);
|
|
235
|
+
const change = (patch: Partial<Discussion> | ((state: Discussion) => Partial<Discussion>)) => {
|
|
236
|
+
const update = (state: Discussion) => ({ ...state, ...(typeof patch === "function" ? patch(state) : patch) });
|
|
237
|
+
if (onChange) onChange(update); else setLocal(update);
|
|
238
|
+
};
|
|
239
|
+
const remove = (comment: DiscussionComment) => {
|
|
240
|
+
const removed = comments.filter(item => item.id === comment.id || item.parentId === comment.id);
|
|
241
|
+
const ids = new Set(removed.map(item => item.id));
|
|
242
|
+
change(state => ({ comments: state.comments.filter(item => !ids.has(item.id)) }));
|
|
243
|
+
setEditing(null);
|
|
244
|
+
if (replyTarget === comment.id || rootId === comment.id) setReplyTarget(null);
|
|
245
|
+
composer.current?.focus({ preventScroll: true });
|
|
246
|
+
let toastId = "";
|
|
247
|
+
toastId = toast({ title: "Comment deleted", tone: "neutral", icon: "trash", duration: 6000,
|
|
248
|
+
action: <Button size="xs" variant="ghost" onClick={() => {
|
|
249
|
+
change(state => {
|
|
250
|
+
const restored = new Map(state.comments.map(item => [item.id, item]));
|
|
251
|
+
for (const item of removed) if (!restored.has(item.id)) restored.set(item.id, item);
|
|
252
|
+
return { comments: [...restored.values()].sort((a, b) => a.id - b.id) };
|
|
253
|
+
});
|
|
254
|
+
dismiss(toastId);
|
|
255
|
+
}}>Undo</Button>, actionAltText: "Undo comment deletion",
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
const nextId = () => Math.max(current.nextId ?? 0, Math.max(-1, ...comments.map(comment => comment.id)) + 1);
|
|
259
|
+
const target = comments.find(comment => comment.id === replyTarget);
|
|
260
|
+
const rootId = target ? target.parentId ?? target.id : null;
|
|
261
|
+
const submitComment = (body: string) => { const id = nextId(); change({ comments: [...comments, { id, author: "Alex Morgan", time: "Just now", body }], draft: "", nextId: id + 1 }); };
|
|
262
|
+
const submitReply = (body: string) => {
|
|
263
|
+
if (!target || rootId == null) return;
|
|
264
|
+
const id = nextId();
|
|
265
|
+
change({ comments: [...comments, { id, parentId: rootId, replyToId: target.id, author: "Alex Morgan", time: "Just now", body }], replyDrafts: { ...replyDrafts, [target.id]: "" }, nextId: id + 1 });
|
|
266
|
+
setReplyTarget(null); composer.current?.focus();
|
|
267
|
+
};
|
|
268
|
+
const mentionsFor = (comment: DiscussionComment): CommentMention[] => {
|
|
269
|
+
if (comment.mentions) return comment.mentions;
|
|
270
|
+
const target = comments.find(item => item.id === comment.replyToId);
|
|
271
|
+
return target ? [{ id: target.author.toLowerCase().replaceAll(" ", "-"), label: target.author, offset: 0 }] : [];
|
|
272
|
+
};
|
|
273
|
+
const people = Array.from(new Map(comments.map(comment => [comment.author, { id: comment.author.toLowerCase().replaceAll(" ", "-"), label: comment.author }])).values());
|
|
274
|
+
const save = (body: string, mentions: CommentMention[]) => {
|
|
275
|
+
if (!editing) return;
|
|
276
|
+
change({ comments: comments.map(comment => comment.id === editing.id ? { ...comment, body, mentions } : comment) });
|
|
277
|
+
setEditing(null); composer.current?.focus();
|
|
278
|
+
};
|
|
279
|
+
const actionsFor = (comment: DiscussionComment): MessageAction[] => [
|
|
280
|
+
{ kind: "copy", successLabel: "Copied", errorLabel: "Copy failed", onClick: () => navigator.clipboard.writeText(comment.body) },
|
|
281
|
+
{ kind: "reply", onClick: () => { setReplyTarget(comment.id); requestAnimationFrame(() => replyInput.current?.focus()); } },
|
|
282
|
+
...(comment.author === "Alex Morgan" ? [
|
|
283
|
+
{ kind: "edit" as const, onClick: () => setEditing({ id: comment.id, body: comment.body, mentions: mentionsFor(comment) }) },
|
|
284
|
+
{ kind: "delete" as const, onClick: () => remove(comment) },
|
|
285
|
+
] : []),
|
|
286
|
+
];
|
|
287
|
+
const renderComment = (comment: DiscussionComment, nested = false): ReactNode => {
|
|
288
|
+
const replies = comments.filter(item => item.parentId === comment.id);
|
|
289
|
+
const thread = !nested && (replies.length > 0 || rootId === comment.id) ? <>
|
|
290
|
+
{replies.length > 0 && <CommentList aria-label={`Replies to ${comment.author}`}>{replies.map(reply => renderComment(reply, true))}</CommentList>}
|
|
291
|
+
{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(); }} />}
|
|
292
|
+
</> : undefined;
|
|
293
|
+
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}>
|
|
294
|
+
{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)} />}
|
|
295
|
+
</Comment>;
|
|
296
|
+
};
|
|
297
|
+
return <section className={styles.root} aria-label={label} data-variant={variant}>
|
|
298
|
+
<CommentList>{comments.filter(comment => comment.parentId == null).map(comment => renderComment(comment))}</CommentList>
|
|
299
|
+
<CommentComposer variant={variant} className={styles.composer} ref={composer} author="Alex Morgan" value={draft} onValueChange={body => change({ draft: body })} onSubmit={submitComment} />
|
|
300
|
+
</section>;
|
|
301
|
+
}
|
|
302
|
+
````
|
|
303
|
+
|
|
304
|
+
### Source: web/examples/CommentDocsExamples.module.css
|
|
305
|
+
|
|
306
|
+
````css
|
|
307
|
+
.example { display: grid; gap: var(--space-4); width: 100%; min-width: 0; }
|
|
308
|
+
````
|
|
309
|
+
|
|
310
|
+
### Source: web/examples/CommentDocsExamples.tsx
|
|
311
|
+
|
|
312
|
+
````tsx
|
|
313
|
+
"use client";
|
|
314
|
+
|
|
315
|
+
import { useState } from "react";
|
|
316
|
+
import { Comment, CommentList, CommentEditor, CommentText, CommentComposer, type CommentMention, type CommentInputVariant } from "@/components/Comment";
|
|
317
|
+
import { Button } from "@/components/Button";
|
|
318
|
+
import { useToast } from "@/components/Toast";
|
|
319
|
+
import styles from "./CommentDocsExamples.module.css";
|
|
320
|
+
|
|
321
|
+
const initial = "Please check the mobile layout before the next review.";
|
|
322
|
+
|
|
323
|
+
export function CommentActionsExample() {
|
|
324
|
+
const [body, setBody] = useState(initial);
|
|
325
|
+
const [draft, setDraft] = useState(initial);
|
|
326
|
+
const [mentions, setMentions] = useState<CommentMention[]>([]);
|
|
327
|
+
const [draftMentions, setDraftMentions] = useState<CommentMention[]>([]);
|
|
328
|
+
const [editing, setEditing] = useState(false);
|
|
329
|
+
const [deleted, setDeleted] = useState(false);
|
|
330
|
+
const { toast, dismiss } = useToast();
|
|
331
|
+
const remove = () => {
|
|
332
|
+
setDeleted(true); setEditing(false);
|
|
333
|
+
let toastId = "";
|
|
334
|
+
toastId = toast({ title: "Comment deleted", tone: "neutral", icon: "trash", duration: 6000,
|
|
335
|
+
action: <Button size="xs" variant="ghost" onClick={() => { setDeleted(false); dismiss(toastId); }}>Undo</Button>, actionAltText: "Undo comment deletion",
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
return <div className={styles.example}>
|
|
339
|
+
{!deleted && <CommentList aria-label="Comments">
|
|
340
|
+
<Comment author="Alex Morgan" timestamp="Just now" actions={editing ? undefined : [
|
|
341
|
+
{ kind: "copy", successLabel: "Copied", errorLabel: "Copy failed", onClick: () => navigator.clipboard.writeText(body) },
|
|
342
|
+
{ kind: "edit", onClick: () => { setDraft(body); setDraftMentions(mentions); setEditing(true); } },
|
|
343
|
+
{ kind: "delete", onClick: remove },
|
|
344
|
+
]}>
|
|
345
|
+
{editing ? <CommentEditor originalValue={body} originalMentions={mentions} value={draft} mentions={draftMentions} mentionOptions={[{ id: "mina", label: "Mina Kim" }, { id: "james", label: "James Lee" }, { id: "alex", label: "Alex Morgan" }]} onValueChange={(value, mentions) => { setDraft(value); setDraftMentions(mentions); }} onSave={(body, mentions) => { setBody(body); setMentions(mentions); setEditing(false); }} onCancel={() => setEditing(false)} /> : <CommentText value={body} mentions={mentions} />}
|
|
346
|
+
</Comment>
|
|
347
|
+
</CommentList>}
|
|
348
|
+
</div>;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
export function CommentComposerExample({ variant = "line", disabled = false, label }: { variant?: CommentInputVariant; disabled?: boolean; label?: string }) {
|
|
353
|
+
const [draft, setDraft] = useState("");
|
|
354
|
+
const [comments, setComments] = useState<string[]>([]);
|
|
355
|
+
return <div className={styles.example} role="region" aria-label={label ?? `${variant} composer example`}>
|
|
356
|
+
{comments.length > 0 && <CommentList>{comments.map((body, index) => <Comment key={index} author="Alex Morgan" timestamp="Just now">{body}</Comment>)}</CommentList>}
|
|
357
|
+
<CommentComposer variant={variant} author="Alex Morgan" disabled={disabled} value={draft} onValueChange={setDraft} onSubmit={body => { setComments(items => [...items, body]); setDraft(""); }} />
|
|
358
|
+
</div>;
|
|
359
|
+
}
|
|
360
|
+
````
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Data Table 사용 사례 소스
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/build-use-cases.mjs. Edit original TSX/CSS, then regenerate. -->
|
|
4
|
+
|
|
5
|
+
### 사례 목록
|
|
6
|
+
|
|
7
|
+
- Member directory
|
|
8
|
+
- Design tasks
|
|
9
|
+
|
|
10
|
+
문서: /en/components/data/data-table#use-cases
|
|
11
|
+
|
|
12
|
+
문서 페이지에서 렌더하는 사례입니다.
|
|
13
|
+
|
|
14
|
+
### 조회 방법
|
|
15
|
+
|
|
16
|
+
get_guide(topic="use-cases/data-data-table", sections=["사례 목록", "파일 목록"])로 먼저 확인하고, 필요한 Section 또는 Source 파일 헤딩만 sections로 조회하세요. 전체 문서는 문서 페이지의 다른 예제도 포함합니다. 공용 컴포넌트 계약은 get_component로 읽고, 예제의 docs 전용 셸·locale·import 경로는 대상 프로젝트에 맞게 조합하세요. 이 연결은 디자인 승인이나 기능 검증을 뜻하지 않습니다.
|
|
17
|
+
|
|
18
|
+
### 파일 목록
|
|
19
|
+
|
|
20
|
+
- `web/app/[lang]/components/data/data-table/page.module.css`
|
|
21
|
+
- `web/app/[lang]/components/data/data-table/page.tsx`
|
|
22
|
+
- `web/examples/ContainedTableExample.tsx`
|
|
23
|
+
|
|
24
|
+
### Section: web/app/[lang]/components/data/data-table/page.tsx#use-cases
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<section id="use-cases">
|
|
28
|
+
<h2>{ko ? "사용 사례" : "In Use"}</h2>
|
|
29
|
+
<h3>{ko ? "회원 목록" : "Member directory"}</h3>
|
|
30
|
+
<ExampleBlock previewWidth="full" align="column"><TableDemo label="Member directory" directory /></ExampleBlock>
|
|
31
|
+
<p className="desc"><Link href={`/${lang}/patterns/members`}>{ko ? "회원 관리 전체 화면 보기" : "View the member management page"}</Link></p>
|
|
32
|
+
<h3>{ko ? "디자인 작업 목록" : "Design tasks"}</h3>
|
|
33
|
+
<ExampleBlock previewWidth="full" align="column"><ContainedTableExample ko={false} /></ExampleBlock>
|
|
34
|
+
</section>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Source: web/app/[lang]/components/data/data-table/page.module.css
|
|
38
|
+
|
|
39
|
+
````css
|
|
40
|
+
.preview {
|
|
41
|
+
width: 100%;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
}
|
|
44
|
+
````
|
|
45
|
+
|
|
46
|
+
### Source: web/app/[lang]/components/data/data-table/page.tsx
|
|
47
|
+
|
|
48
|
+
````tsx
|
|
49
|
+
"use client";
|
|
50
|
+
|
|
51
|
+
import { useState } from "react";
|
|
52
|
+
import { usePathname } from "next/navigation";
|
|
53
|
+
import { DataTable, createDataTableState, type DataTableProps } from "@/components/DataTable";
|
|
54
|
+
import { type TableRowColumn } from "@/components/TableRow";
|
|
55
|
+
import { TableCellText } from "@/components/TableCell";
|
|
56
|
+
import { Button } from "@/components/Button";
|
|
57
|
+
import { DropdownMenu } from "@/components/DropdownMenu";
|
|
58
|
+
import { Icon } from "@/components/Icon";
|
|
59
|
+
import { Code } from "@/components/Code";
|
|
60
|
+
import { ContainedTableExample } from "@/examples/ContainedTableExample";
|
|
61
|
+
import { ProgressLink as Link } from "@/app/_components/ProgressLink";
|
|
62
|
+
import { ExampleBlock } from "@/app/_components/ExampleBlock";
|
|
63
|
+
import { Playground } from "@/app/_components/Playground";
|
|
64
|
+
import { DocsTable } from "@/app/_components/DocsTable";
|
|
65
|
+
import styles from "./page.module.css";
|
|
66
|
+
|
|
67
|
+
type Member = { id: string; name: string; role: string; email: string };
|
|
68
|
+
const MEMBERS: Member[] = [
|
|
69
|
+
{ id: "mina", name: "Mina Kim", role: "Design", email: "mina@example.com" },
|
|
70
|
+
{ id: "james", name: "James Lee", role: "Engineering", email: "james@example.com" },
|
|
71
|
+
{ id: "sarah", name: "Sarah Park", role: "Product", email: "sarah@example.com" },
|
|
72
|
+
{ id: "alex", name: "Alex Chen", role: "Engineering", email: "alex@example.com" },
|
|
73
|
+
{ id: "emma", name: "Emma Wilson", role: "Design", email: "emma@example.com" },
|
|
74
|
+
{ id: "noah", name: "Noah Brown", role: "Product", email: "noah@example.com" },
|
|
75
|
+
];
|
|
76
|
+
const BASIC_MEMBERS = MEMBERS.slice(0, 3);
|
|
77
|
+
const EMPTY_MEMBERS: Member[] = [];
|
|
78
|
+
const COLUMNS: TableRowColumn<Member>[] = [
|
|
79
|
+
{ key: "name", label: "Name", width: 180, sortable: true, render: (row) => <TableCellText>{row.name}</TableCellText> },
|
|
80
|
+
{ key: "role", label: "Role", width: 140, sortable: true, render: (row) => <TableCellText>{row.role}</TableCellText> },
|
|
81
|
+
{ key: "email", label: "Email", flex: true, minWidth: 220, render: (row) => <TableCellText tone="muted">{row.email}</TableCellText> },
|
|
82
|
+
];
|
|
83
|
+
const getRowId = (row: Member) => row.id;
|
|
84
|
+
const BASIC_CODE = `import { DataTable, createDataTableState } from "@/components/DataTable";
|
|
85
|
+
|
|
86
|
+
const [state, setState] = useState(() => createDataTableState());
|
|
87
|
+
|
|
88
|
+
<DataTable label="Members" rows={rows} columns={columns}
|
|
89
|
+
getRowId={(row) => row.id} state={state} onStateChange={setState} />`;
|
|
90
|
+
|
|
91
|
+
type DemoProps = Pick<DataTableProps<Member>, "variant" | "selectable" | "selectionPinned" | "pagination" | "status" | "onRetry"> & {
|
|
92
|
+
label?: string;
|
|
93
|
+
toolbar?: boolean;
|
|
94
|
+
empty?: boolean;
|
|
95
|
+
directory?: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
function TableDemo({ label = "Members", variant = "default", selectable = true, selectionPinned = true,
|
|
99
|
+
pagination = true, toolbar = true, status = "idle", onRetry, empty = false, directory = false }: DemoProps) {
|
|
100
|
+
const [state, setState] = useState(() => createDataTableState(directory ? 5 : 10));
|
|
101
|
+
const [role, setRole] = useState("all");
|
|
102
|
+
const source = directory ? MEMBERS : BASIC_MEMBERS;
|
|
103
|
+
const rows = empty ? EMPTY_MEMBERS : role === "all" ? source : source.filter((row) => row.role === role);
|
|
104
|
+
const filters = directory ? <DropdownMenu>
|
|
105
|
+
<DropdownMenu.Trigger asChild>
|
|
106
|
+
<Button variant="outline" leftIcon={<Icon name="sliders" />}>{role === "all" ? "All roles" : role}</Button>
|
|
107
|
+
</DropdownMenu.Trigger>
|
|
108
|
+
<DropdownMenu.Content>
|
|
109
|
+
<DropdownMenu.RadioGroup value={role} onValueChange={(next) => {
|
|
110
|
+
setRole(next);
|
|
111
|
+
setState(createDataTableState(5));
|
|
112
|
+
}}>
|
|
113
|
+
<DropdownMenu.RadioItem value="all">All roles</DropdownMenu.RadioItem>
|
|
114
|
+
{["Design", "Engineering", "Product"].map((value) => <DropdownMenu.RadioItem key={value} value={value}>{value}</DropdownMenu.RadioItem>)}
|
|
115
|
+
</DropdownMenu.RadioGroup>
|
|
116
|
+
</DropdownMenu.Content>
|
|
117
|
+
</DropdownMenu> : undefined;
|
|
118
|
+
return <DataTable label={label} rows={rows} columns={COLUMNS} getRowId={getRowId}
|
|
119
|
+
state={state} onStateChange={setState} variant={variant} selectable={selectable}
|
|
120
|
+
selectionPinned={selectionPinned} pagination={pagination} status={status} onRetry={onRetry}
|
|
121
|
+
toolbar={toolbar ? undefined : null} filters={filters} />;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export default function Page() {
|
|
125
|
+
const ko = (usePathname() ?? "/en").startsWith("/ko/");
|
|
126
|
+
const lang = ko ? "ko" : "en";
|
|
127
|
+
const [variant, setVariant] = useState<"default" | "contained">("default");
|
|
128
|
+
const [status, setStatus] = useState<"idle" | "loading" | "error">("idle");
|
|
129
|
+
const [selectable, setSelectable] = useState(true);
|
|
130
|
+
const [selectionPinned, setSelectionPinned] = useState(true);
|
|
131
|
+
const [toolbar, setToolbar] = useState(true);
|
|
132
|
+
const [pagination, setPagination] = useState(true);
|
|
133
|
+
const [empty, setEmpty] = useState(false);
|
|
134
|
+
const api = [
|
|
135
|
+
["label", "string", "Required", ko ? "표의 내용을 구분하는 접근성 이름이에요." : "Accessible name describing the table."],
|
|
136
|
+
["rows", "T[]", "Required", ko ? "클라이언트 모드에서는 전체 데이터, 서버 모드에서는 현재 페이지를 전달해요." : "All rows in client mode, or the current page in server mode."],
|
|
137
|
+
["columns", "TableRowColumn<T>[]", "Required", ko ? "셀 표시와 정렬 여부를 열마다 지정해요." : "Defines each column’s content and sorting options."],
|
|
138
|
+
["getRowId", "(row: T) => string", "Required", ko ? "정렬이나 페이지가 바뀌어도 유지되는 고유 키를 반환해요." : "Returns a stable, unique ID for each row."],
|
|
139
|
+
["state", "DataTableState", "Required", ko ? "검색·정렬·페이지·선택·열 설정을 제어해요." : "Controls search, sorting, pagination, selection and columns."],
|
|
140
|
+
["onStateChange", "(state) => void", "Required", ko ? "변경된 상태를 저장해요." : "Stores the updated table state."],
|
|
141
|
+
["variant", '"default" | "contained"', '"default"', ko ? "기본 표와 헤더까지 감싸는 표면을 선택해요." : "Chooses an open table or a shared header-and-body surface."],
|
|
142
|
+
["selectable", "boolean", "true", ko ? "행 선택 체크박스를 표시해요." : "Shows row selection checkboxes."],
|
|
143
|
+
["selectionPinned", "boolean", "true", ko ? "가로 스크롤 중에도 선택 열을 고정해요." : "Pins the selection column during horizontal scrolling."],
|
|
144
|
+
["pagination", "boolean", "true", ko ? "하단 페이지 이동을 표시해요." : "Shows pagination below the table."],
|
|
145
|
+
["toolbar", "ReactNode | null", "Built-in toolbar", ko ? "도구 영역을 바꾸거나 null로 숨겨요." : "Replaces the default toolbar, or hides it with null."],
|
|
146
|
+
["filters / toolbarActions", "ReactNode", "None", ko ? "도구 영역에 필터와 목록 작업을 추가해요." : "Adds filters and list actions to the toolbar."],
|
|
147
|
+
["actions", "(row: T) => ReactNode", "None", ko ? "각 행의 마지막 열에 작업을 추가해요." : "Adds actions in the final column of each row."],
|
|
148
|
+
["onRowClick", "(row: T) => void", "None", ko ? "행을 눌렀을 때 실행할 동작이에요." : "Runs when a row is clicked."],
|
|
149
|
+
["getRowHref", "(row: T) => string", "None", ko ? "행의 이동 경로를 반환해요." : "Returns the navigation destination for a row."],
|
|
150
|
+
["getRowLabel", "(row: T) => string", "None", ko ? "행 동작의 접근성 이름을 지정해요." : "Names the action performed by a row."],
|
|
151
|
+
["activeRowId", "string", "None", ko ? "현재 열려 있는 행을 강조해요." : "Highlights the currently open row."],
|
|
152
|
+
["mode", '"client" | "server"', '"client"', ko ? "검색·정렬·페이지 처리를 테이블 또는 서버에 맡겨요." : "Processes search, sorting and pagination locally or on the server."],
|
|
153
|
+
["total", "number", "rows.length", ko ? "서버 모드에서 필터가 적용된 전체 행 수를 전달해요." : "Filtered row count across all pages in server mode."],
|
|
154
|
+
["status", '"idle" | "loading" | "error"', '"idle"', ko ? "목록의 로딩과 오류 상태를 표시해요." : "Sets the loading or error state of the list."],
|
|
155
|
+
["error / onRetry", "string / () => void", "Default message", ko ? "오류 안내와 다시 불러오기 동작을 지정해요." : "Customizes the error message and retry action."],
|
|
156
|
+
["search", "(row: T, query: string) => boolean", "JSON matching", ko ? "검색 조건과 일치하는 행을 판별해요." : "Tests whether a row matches the search query."],
|
|
157
|
+
["sortValue", "(row: T, key: string) => string | number", "String value", ko ? "열을 정렬할 값을 반환해요." : "Returns the value used to sort a column."],
|
|
158
|
+
["rowVariant", '"navigate" | "edit"', '"navigate"', ko ? "행 동작과 셀 편집 중 상호작용 방식을 선택해요." : "Chooses row actions or cell editing."],
|
|
159
|
+
["activeCell / onActiveCellChange", "{ rowId, key } | null / callback", "Internal state", ko ? "편집 중인 셀을 외부에서 제어해요." : "Controls the cell currently being edited."],
|
|
160
|
+
["rowSize", '"sm" | "md" | "lg"', '"md"', ko ? "셀 편집 모드의 행 크기를 정해요." : "Sets the row size in cell editing mode."],
|
|
161
|
+
];
|
|
162
|
+
return <>
|
|
163
|
+
<h1 className="page-title">Data Table</h1>
|
|
164
|
+
<p className="page-lead">{ko ? "검색·정렬·선택·페이지 이동을 함께 쓰는 데이터 목록이에요. 행과 셀을 직접 조합하려면 Table Header와 Table Row를 사용하세요." : "A data list with search, sorting, selection and pagination. Use Table Header and Table Row when you need to compose the rows yourself."}</p>
|
|
165
|
+
|
|
166
|
+
<section id="usage" className="section-first">
|
|
167
|
+
<h2>{ko ? "사용법" : "Usage"}</h2>
|
|
168
|
+
<ExampleBlock previewWidth="full" align="column" code={BASIC_CODE}><TableDemo /></ExampleBlock>
|
|
169
|
+
</section>
|
|
170
|
+
|
|
171
|
+
<Playground axes={[
|
|
172
|
+
{ label: "variant", value: variant, onChange: (value) => setVariant(value as typeof variant), options: ["default", "contained"] },
|
|
173
|
+
{ label: "status", value: status, onChange: (value) => setStatus(value as typeof status), options: ["idle", "loading", "error"] },
|
|
174
|
+
]} toggles={[
|
|
175
|
+
{ label: "selection", value: selectable, onChange: setSelectable },
|
|
176
|
+
{ label: "pin selection", value: selectionPinned, onChange: setSelectionPinned },
|
|
177
|
+
{ label: "toolbar", value: toolbar, onChange: setToolbar },
|
|
178
|
+
{ label: "pagination", value: pagination, onChange: setPagination },
|
|
179
|
+
{ label: "empty", value: empty, onChange: setEmpty },
|
|
180
|
+
]}>
|
|
181
|
+
<div className={styles.preview}><TableDemo label="Playground members" variant={variant} status={status}
|
|
182
|
+
selectable={selectable} selectionPinned={selectionPinned} toolbar={toolbar} pagination={pagination}
|
|
183
|
+
empty={empty} onRetry={() => setStatus("idle")} /></div>
|
|
184
|
+
</Playground>
|
|
185
|
+
|
|
186
|
+
<section id="variants">
|
|
187
|
+
<h2>{ko ? "표현" : "Variants"}</h2>
|
|
188
|
+
<p className="desc">{ko ? "기본형은 목록을 넓게 보여주고, 둘러싼 형태는 헤더와 행을 한 덩어리로 묶어요." : "Use the default for an open list, or contained to group the header and rows on one surface."}</p>
|
|
189
|
+
<ExampleBlock previewWidth="full" align="column" code={'<DataTable {...tableProps} />\n<DataTable {...tableProps} variant="contained" />'}>
|
|
190
|
+
<TableDemo label="Default table" toolbar={false} pagination={false} />
|
|
191
|
+
<div id="contained" className={styles.preview}><TableDemo label="Contained table" variant="contained" toolbar={false} pagination={false} /></div>
|
|
192
|
+
</ExampleBlock>
|
|
193
|
+
</section>
|
|
194
|
+
|
|
195
|
+
<section id="use-cases">
|
|
196
|
+
<h2>{ko ? "사용 사례" : "In Use"}</h2>
|
|
197
|
+
<h3>{ko ? "회원 목록" : "Member directory"}</h3>
|
|
198
|
+
<ExampleBlock previewWidth="full" align="column"><TableDemo label="Member directory" directory /></ExampleBlock>
|
|
199
|
+
<p className="desc"><Link href={`/${lang}/patterns/members`}>{ko ? "회원 관리 전체 화면 보기" : "View the member management page"}</Link></p>
|
|
200
|
+
<h3>{ko ? "디자인 작업 목록" : "Design tasks"}</h3>
|
|
201
|
+
<ExampleBlock previewWidth="full" align="column"><ContainedTableExample ko={false} /></ExampleBlock>
|
|
202
|
+
</section>
|
|
203
|
+
|
|
204
|
+
<section id="api">
|
|
205
|
+
<h2>{ko ? "속성" : "API Reference"}</h2>
|
|
206
|
+
<DocsTable columns={[
|
|
207
|
+
{ key: "prop", label: ko ? "속성" : "Prop", width: 200 }, { key: "type", label: ko ? "타입" : "Type", width: 230 },
|
|
208
|
+
{ key: "default", label: "Default", width: 140 }, { key: "desc", label: ko ? "설명" : "Description", flex: true, minWidth: 240 },
|
|
209
|
+
]} rows={api.map(([prop, type, fallback, desc]) => ({ prop: <Code>{prop}</Code>, type: <Code>{type}</Code>, default: <Code>{fallback}</Code>, desc }))} />
|
|
210
|
+
</section>
|
|
211
|
+
</>;
|
|
212
|
+
}
|
|
213
|
+
````
|
|
214
|
+
|
|
215
|
+
### Source: web/examples/ContainedTableExample.tsx
|
|
216
|
+
|
|
217
|
+
````tsx
|
|
218
|
+
"use client";
|
|
219
|
+
|
|
220
|
+
import { useState } from "react";
|
|
221
|
+
import { DataTable, createDataTableState } from "@/components/DataTable";
|
|
222
|
+
import { type TableRowColumn } from "@/components/TableRow";
|
|
223
|
+
import { TableCellAvatar, TableCellText } from "@/components/TableCell";
|
|
224
|
+
import { Checkbox } from "@/components/Checkbox";
|
|
225
|
+
|
|
226
|
+
type Task = { id: string; task: string; description: string; assignee: string; due: string };
|
|
227
|
+
|
|
228
|
+
export function ContainedTableExample({ ko }: { ko: boolean }) {
|
|
229
|
+
const [state, setState] = useState(() => createDataTableState(10));
|
|
230
|
+
const [selectionPinned, setSelectionPinned] = useState(true);
|
|
231
|
+
const rows: Task[] = [
|
|
232
|
+
{ id: "wireframe", task: "Wireframe", description: "Define page structure and user flows", assignee: "Mina Kim", due: "2026-11-02" },
|
|
233
|
+
{ id: "style", task: "Style guide", description: "Document colors, typography and components", assignee: "James Lee", due: "2026-11-03" },
|
|
234
|
+
{ id: "prototype", task: "Interactive prototype", description: "Connect the core interaction flows", assignee: "Sarah Park", due: "2026-11-04" },
|
|
235
|
+
{ id: "audit", task: "Usability review", description: "Review navigation, forms and error recovery", assignee: "Mina Kim", due: "2026-11-05" },
|
|
236
|
+
{ id: "responsive", task: "Responsive layout", description: "Adapt the layout for mobile and desktop", assignee: "James Lee", due: "2026-11-06" },
|
|
237
|
+
];
|
|
238
|
+
const columns: TableRowColumn<Task>[] = [
|
|
239
|
+
{ key: "task", label: "Task", width: 180, sortable: true, render: (row) => <TableCellText tone="strong">{row.task}</TableCellText> },
|
|
240
|
+
{ key: "description", label: "Description", flex: true, minWidth: 200, render: (row) => <TableCellText>{row.description}</TableCellText> },
|
|
241
|
+
{ key: "assignee", label: "Assignee", width: 140, sortable: true, render: (row) => <TableCellAvatar size="sm" name={row.assignee} /> },
|
|
242
|
+
{ key: "due", label: "Due date", width: 140, sortable: true, render: (row) => <TableCellText><time dateTime={row.due}>{row.due}</time></TableCellText> },
|
|
243
|
+
];
|
|
244
|
+
return <DataTable variant="contained" label={"Design tasks"}
|
|
245
|
+
selectionPinned={selectionPinned}
|
|
246
|
+
toolbarActions={<Checkbox checked={selectionPinned} onChange={(event) => setSelectionPinned(event.currentTarget.checked)}>{"Pin selection column"}</Checkbox>}
|
|
247
|
+
rows={rows} columns={columns} getRowId={(row) => row.id} state={state} onStateChange={setState} />;
|
|
248
|
+
}
|
|
249
|
+
````
|