@conscience-technology/ovenn 0.7.0 → 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 +21 -0
- package/assets/components/AIMessage/AIMessage.tsx +27 -7
- package/assets/components/AttachmentItem/AttachmentItem.module.css +41 -10
- package/assets/components/AttachmentItem/AttachmentItem.tsx +25 -8
- package/assets/components/AttachmentThumb/AttachmentThumb.module.css +9 -10
- package/assets/components/Callout/Callout.module.css +53 -7
- package/assets/components/Callout/Callout.tsx +26 -2
- package/assets/components/Callout/index.ts +1 -1
- 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 +192 -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/CodeBlock/CodeBlock.module.css +106 -10
- 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/ColorField/ColorField.module.css +19 -196
- package/assets/components/ColorField/ColorField.tsx +116 -109
- package/assets/components/Combobox/Combobox.module.css +21 -4
- package/assets/components/Combobox/Combobox.tsx +37 -21
- package/assets/components/CommandPalette/CommandPalette.module.css +1 -1
- package/assets/components/ControlGroup/ControlGroup.module.css +13 -6
- package/assets/components/DatePicker/DateField.tsx +72 -25
- package/assets/components/DatePicker/DatePicker.module.css +28 -59
- package/assets/components/DatePicker/DatePicker.tsx +76 -40
- package/assets/components/Drawer/Drawer.module.css +12 -15
- package/assets/components/Drawer/Drawer.tsx +15 -23
- 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/FileIcon/FileIcon.module.css +4 -6
- package/assets/components/Icon/LucideFamilyIcon.tsx +2 -0
- package/assets/components/Icon/SolarFamilyIcon.tsx +4 -0
- package/assets/components/Input/Input.module.css +33 -10
- package/assets/components/Input/Input.tsx +20 -9
- package/assets/components/MessageActions/MessageActions.module.css +2 -2
- package/assets/components/Onboarding/Onboarding.module.css +1 -1
- package/assets/components/ProgressBar/ProgressBar.module.css +38 -4
- package/assets/components/ProgressBar/ProgressBar.tsx +5 -1
- package/assets/components/RadioCard/RadioCard.module.css +18 -0
- package/assets/components/RadioCard/RadioCard.tsx +48 -7
- package/assets/components/Select/Select.module.css +9 -7
- package/assets/components/Select/Select.tsx +15 -2
- package/assets/components/Tabs/Tabs.module.css +1 -1
- package/assets/components/Tabs/Tabs.tsx +2 -2
- package/assets/components/Textarea/Textarea.module.css +28 -231
- package/assets/components/Textarea/Textarea.tsx +2 -2
- package/assets/components/TimePicker/TimePicker.module.css +16 -4
- package/assets/components/TimePicker/TimePicker.tsx +66 -8
- package/assets/components/Toast/Toast.module.css +18 -0
- package/assets/components/Toast/Toast.tsx +1 -1
- package/assets/components/Tooltip/Tooltip.tsx +33 -7
- 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/_data.ts +10 -5
- package/assets/components/_utils.css +31 -5
- package/assets/components/component-registry.json +1595 -107
- package/assets/components/index.ts +7 -0
- package/assets/components/tokens.css +83 -0
- package/assets/prompts/ASSEMBLY.md +11 -0
- package/assets/prompts/CATALOG.md +110 -106
- package/assets/prompts/PRINCIPLES.md +11 -1
- package/assets/prompts/TEMPLATE_PREVIEWS.md +21 -0
- package/assets/prompts/WORKFLOW_DESIGN.md +2 -0
- package/assets/prompts/axes/font.md +6 -0
- package/assets/prompts/axes/material.md +1 -1
- package/assets/prompts/axes/motion.md +2 -0
- package/assets/prompts/axes/palette.md +9 -2
- 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 +36 -30
- 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 +4 -4
- package/assets/prompts/components/breadcrumb.md +24 -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 +29 -29
- package/assets/prompts/components/callout.md +39 -23
- package/assets/prompts/components/canvas-edge.md +5 -2
- package/assets/prompts/components/canvas-node.md +3 -3
- package/assets/prompts/components/canvas.md +5 -2
- package/assets/prompts/components/card.md +21 -21
- package/assets/prompts/components/chart-bar.md +7 -7
- package/assets/prompts/components/chart-pie.md +3 -3
- package/assets/prompts/components/chart-radar.md +3 -3
- package/assets/prompts/components/chart-radial.md +4 -4
- 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 +3 -3
- package/assets/prompts/components/checkbox.md +17 -17
- package/assets/prompts/components/chip.md +32 -32
- package/assets/prompts/components/code-block.md +109 -66
- 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 +6 -6
- package/assets/prompts/components/color-slider.md +8 -8
- 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 +26 -26
- package/assets/prompts/components/comment.md +5 -2
- package/assets/prompts/components/context-menu.md +22 -22
- package/assets/prompts/components/control-group.md +4 -4
- package/assets/prompts/components/date-picker.md +31 -23
- package/assets/prompts/components/disclosure.md +10 -10
- package/assets/prompts/components/drawer.md +19 -18
- package/assets/prompts/components/dropdown-menu.md +21 -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 +11 -11
- package/assets/prompts/components/event-list-item.md +21 -21
- package/assets/prompts/components/file-icon.md +18 -19
- package/assets/prompts/components/gallery-item.md +19 -19
- 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 +12 -9
- package/assets/prompts/components/input.md +49 -46
- package/assets/prompts/components/kanban.md +34 -34
- package/assets/prompts/components/list-item.md +39 -39
- package/assets/prompts/components/menu-item.md +41 -41
- package/assets/prompts/components/message-actions.md +6 -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/mini-calendar.md +6 -1
- package/assets/prompts/components/modal.md +39 -39
- package/assets/prompts/components/multi-select.md +4 -1
- package/assets/prompts/components/onboarding.md +19 -19
- package/assets/prompts/components/page-header.md +31 -31
- package/assets/prompts/components/pagination.md +17 -17
- package/assets/prompts/components/progress-bar.md +14 -11
- package/assets/prompts/components/quotation-bar.md +10 -10
- package/assets/prompts/components/radio-card.md +7 -6
- package/assets/prompts/components/radio.md +9 -9
- package/assets/prompts/components/select.md +28 -25
- package/assets/prompts/components/shortcut.md +11 -11
- package/assets/prompts/components/sidebar.md +56 -56
- package/assets/prompts/components/skeleton.md +7 -4
- package/assets/prompts/components/slider.md +18 -18
- package/assets/prompts/components/spinner.md +16 -16
- package/assets/prompts/components/stepper.md +14 -14
- package/assets/prompts/components/switch.md +19 -20
- package/assets/prompts/components/tab-strip.md +31 -31
- package/assets/prompts/components/table-cell.md +4 -4
- 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 +18 -18
- package/assets/prompts/components/tabs.md +26 -25
- package/assets/prompts/components/tag.md +6 -6
- package/assets/prompts/components/textarea.md +16 -15
- package/assets/prompts/components/time-picker.md +21 -14
- package/assets/prompts/components/timeline-view.md +4 -4
- package/assets/prompts/components/toast.md +42 -41
- package/assets/prompts/components/toolbar.md +23 -23
- package/assets/prompts/components/tooltip.md +15 -14
- package/assets/prompts/components/top-loader.md +11 -11
- package/assets/prompts/components/topbar.md +35 -35
- package/assets/prompts/components/tree-nav.md +9 -9
- 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 +7 -0
- package/assets/prompts/templates/minimal.md +6 -0
- package/assets/prompts/templates/onboarding.md +156 -0
- package/assets/prompts/templates/workspace.md +13 -8
- package/assets/prompts/tokens/color.md +7 -2
- package/assets/prompts/tokens/radius.md +22 -0
- package/assets/prompts/use-cases/chart-chart-area.md +40 -40
- package/assets/prompts/use-cases/chart-chart-bar.md +34 -34
- package/assets/prompts/use-cases/chart-chart-pie.md +14 -14
- package/assets/prompts/use-cases/chart-chart-radar.md +24 -24
- package/assets/prompts/use-cases/chart-chart-radial.md +14 -14
- package/assets/prompts/use-cases/chart-segmented-chart.md +32 -32
- 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 +39 -39
- package/assets/prompts/use-cases/data-data-table.md +34 -34
- package/assets/prompts/use-cases/data-list-item.md +16 -16
- package/assets/prompts/use-cases/data-metric-card.md +18 -18
- package/assets/prompts/use-cases/data-table-row.md +19 -19
- package/assets/prompts/use-cases/data-table-toolbar.md +10 -10
- package/assets/prompts/use-cases/feedback-drawer.md +35 -30
- package/assets/prompts/use-cases/feedback-progress-bar.md +23 -18
- package/assets/prompts/use-cases/general-toolbar.md +16 -16
- package/assets/prompts/use-cases/general-tooltip.md +26 -26
- package/assets/prompts/use-cases/input-checkbox.md +27 -27
- package/assets/prompts/use-cases/structure-card.md +9 -9
- package/assets/prompts/use-cases/structure-page-header.md +17 -17
- package/assets/prompts/use-cases/structure-sidebar.md +20 -20
- package/assets/prompts/use-cases/structure-topbar.md +38 -42
- package/assets/skills/ovenn-wireframe/SKILL.md +17 -4
- package/package.json +6 -2
- package/src/utils/design-examples.js +3 -4
- package/assets/prompts/templates/glass-button.md +0 -337
|
@@ -10,10 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
/* Bubble 가로 상한 — 채팅 트랙 폭 전체를 쓰지 않도록 "말풍선" 리듬 유지.
|
|
12
12
|
토큰 `--user-message-max`는 content-max의 ~70% (iMessage/ChatGPT/Claude 표준). */
|
|
13
|
-
.bubble {
|
|
13
|
+
.bubble.bubble {
|
|
14
|
+
padding-inline: var(--space-4);
|
|
14
15
|
max-width: var(--user-message-max);
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
.before + .bubble {
|
|
19
|
+
margin-top: var(--space-1);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
/* 첨부·인용 등 bubble 위에 올리는 영역. bubble과 동일한 가로 상한. */
|
|
18
23
|
.before {
|
|
19
24
|
display: flex;
|
|
@@ -45,3 +50,107 @@
|
|
|
45
50
|
opacity: 1;
|
|
46
51
|
transform: translateY(0);
|
|
47
52
|
}
|
|
53
|
+
|
|
54
|
+
.root[data-size="lg"] .bubble {
|
|
55
|
+
padding-inline: var(--space-5);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.root[data-fill="none"] .bubble {
|
|
59
|
+
padding-inline: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.root[data-animate] {
|
|
63
|
+
animation: user-message-send var(--duration-slower) var(--ease-emphasized) both;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes user-message-send {
|
|
67
|
+
from {
|
|
68
|
+
opacity: 0;
|
|
69
|
+
transform: translateY(calc(var(--space-4) * var(--motion-distance-scale)));
|
|
70
|
+
}
|
|
71
|
+
to {
|
|
72
|
+
opacity: 1;
|
|
73
|
+
transform: translateY(0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:global([data-motion="none"]) .root[data-animate] {
|
|
78
|
+
animation: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (prefers-reduced-motion: reduce) {
|
|
82
|
+
.root[data-animate] {
|
|
83
|
+
animation: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Resolve duration/easing for the height animation from the active motion axis. */
|
|
88
|
+
.root {
|
|
89
|
+
transition: height var(--duration-slow) var(--ease-out);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.root[data-edit-transition] {
|
|
93
|
+
overflow: clip;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.editor {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: var(--space-4);
|
|
100
|
+
width: 100%;
|
|
101
|
+
padding: var(--space-4);
|
|
102
|
+
border: 1px solid var(--border);
|
|
103
|
+
corner-shape: var(--corner-shape);
|
|
104
|
+
border-radius: var(--radius-xl);
|
|
105
|
+
animation: user-message-editor-in var(--duration-slow) var(--ease-out) both;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.editor .editorField.editorField {
|
|
109
|
+
--_line-height-extra: 0px;
|
|
110
|
+
|
|
111
|
+
border: 0;
|
|
112
|
+
background: transparent;
|
|
113
|
+
font: inherit;
|
|
114
|
+
font-size: var(--text-base);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.editor .editorField textarea {
|
|
118
|
+
padding: 0;
|
|
119
|
+
font: inherit;
|
|
120
|
+
line-height: 1.5;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.editorActions {
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: flex-end;
|
|
126
|
+
gap: var(--space-1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.editorSend {
|
|
130
|
+
box-shadow: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.error {
|
|
134
|
+
margin: 0;
|
|
135
|
+
color: var(--destructive);
|
|
136
|
+
font-size: var(--text-sm);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.root[data-edit-transition] > .bubble {
|
|
140
|
+
animation: user-message-editor-in var(--duration-slow) var(--ease-out) both;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@keyframes user-message-editor-in {
|
|
144
|
+
from { opacity: 0; }
|
|
145
|
+
to { opacity: 1; }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:global([data-motion="none"]) .editor,
|
|
149
|
+
:global([data-motion="none"]) .root[data-edit-transition] > .bubble {
|
|
150
|
+
animation: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (prefers-reduced-motion: reduce) {
|
|
154
|
+
.editor,
|
|
155
|
+
.root[data-edit-transition] > .bubble { animation: none; }
|
|
156
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { isValidElement, useEffect, useLayoutEffect, useRef, useState, type HTMLAttributes, type ReactNode } from "react";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Textarea } from "../Textarea";
|
|
6
|
+
import { useTheme } from "../ThemeController";
|
|
4
7
|
import { Bubble, type BubbleFill, type BubbleShape, type BubbleSize } from "@/components/ovenn/Bubble";
|
|
5
8
|
import {
|
|
6
9
|
MessageActions,
|
|
@@ -25,6 +28,21 @@ export interface UserMessageProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
25
28
|
actions?: MessageAction[];
|
|
26
29
|
/** 메시지 위에 올라올 첨부(이미지/파일) 등 — 상위에서 자유 조합. */
|
|
27
30
|
before?: ReactNode;
|
|
31
|
+
/** 새 메시지의 아래→위 등장 모션. 기본 true. 과거 이력은 false로 표시 가능. */
|
|
32
|
+
animate?: boolean;
|
|
33
|
+
/** 커스텀 ReactNode의 편집·복사 원문. 일반 문자열 본문은 생략 가능. */
|
|
34
|
+
textValue?: string;
|
|
35
|
+
/** 수정한 내용을 전송. 실패 시 reject하면 편집 내용을 보존한다. */
|
|
36
|
+
onEdit?: (text: string) => void | Promise<void>;
|
|
37
|
+
/** 명시적인 delete 액션의 삭제 처리. 기본 액션에는 삭제가 없다. */
|
|
38
|
+
onDelete?: () => void | Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function nodeText(node: ReactNode): string {
|
|
42
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
43
|
+
if (Array.isArray(node)) return node.map(nodeText).join("");
|
|
44
|
+
if (isValidElement<{ children?: ReactNode }>(node)) return nodeText(node.props.children);
|
|
45
|
+
return "";
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
const DEFAULT_ACTIONS: MessageAction[] = [
|
|
@@ -40,27 +58,131 @@ export function UserMessage({
|
|
|
40
58
|
actionsVisibility = "hover",
|
|
41
59
|
actions = DEFAULT_ACTIONS,
|
|
42
60
|
before,
|
|
61
|
+
animate = true,
|
|
62
|
+
onEdit,
|
|
63
|
+
onDelete,
|
|
64
|
+
textValue,
|
|
43
65
|
className,
|
|
44
66
|
...rest
|
|
45
67
|
}: UserMessageProps) {
|
|
68
|
+
const { lang, motionMode } = useTheme();
|
|
69
|
+
const labels = lang === "ko"
|
|
70
|
+
? { edit: "메시지 수정", cancel: "취소", send: "보내기", copied: "복사했어요", copyError: "복사하지 못했어요", editError: "수정 내용을 보내지 못했어요. 다시 시도해 주세요.", deleteError: "삭제하지 못했어요. 다시 시도해 주세요." }
|
|
71
|
+
: { edit: "Edit message", cancel: "Cancel", send: "Send", copied: "Copied", copyError: "Could not copy", editError: "Could not send your edit. Please try again.", deleteError: "Could not delete the message. Please try again." };
|
|
72
|
+
const root = useRef<HTMLDivElement>(null);
|
|
73
|
+
const returnFocus = useRef<number | null>(null);
|
|
74
|
+
const oldHeight = useRef<number | null>(null);
|
|
75
|
+
const transition = useRef<Animation | null>(null);
|
|
76
|
+
const mounted = useRef(true);
|
|
77
|
+
const busy = useRef(false);
|
|
78
|
+
const [editing, setEditing] = useState(false);
|
|
79
|
+
const [draft, setDraft] = useState("");
|
|
80
|
+
const [originalDraft, setOriginalDraft] = useState("");
|
|
81
|
+
const [committed, setCommitted] = useState<{ source: string; text: string } | null>(null);
|
|
82
|
+
const [pending, setPending] = useState(false);
|
|
83
|
+
const [error, setError] = useState("");
|
|
84
|
+
const [deleted, setDeleted] = useState(false);
|
|
85
|
+
const sourceText = textValue ?? nodeText(children);
|
|
86
|
+
const body = committed && committed.source === sourceText ? committed.text : children;
|
|
87
|
+
const text = () => committed && committed.source === sourceText ? committed.text : textValue ?? root.current?.querySelector("[data-user-message-body]")?.textContent ?? "";
|
|
88
|
+
const changeMode = (next: boolean) => {
|
|
89
|
+
oldHeight.current = root.current?.getBoundingClientRect().height ?? null;
|
|
90
|
+
transition.current?.cancel();
|
|
91
|
+
setEditing(next);
|
|
92
|
+
};
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
mounted.current = true;
|
|
95
|
+
const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
96
|
+
const reduce = () => { if (preference.matches) transition.current?.cancel(); };
|
|
97
|
+
preference.addEventListener("change", reduce);
|
|
98
|
+
return () => { mounted.current = false; transition.current?.cancel(); preference.removeEventListener("change", reduce); };
|
|
99
|
+
}, []);
|
|
100
|
+
useEffect(() => { if (motionMode === "none") transition.current?.cancel(); }, [motionMode]);
|
|
101
|
+
useLayoutEffect(() => {
|
|
102
|
+
const element = root.current;
|
|
103
|
+
if (!element || oldHeight.current === null) return;
|
|
104
|
+
const height = oldHeight.current;
|
|
105
|
+
oldHeight.current = null;
|
|
106
|
+
if (editing) element.querySelector("textarea")?.focus({ preventScroll: true });
|
|
107
|
+
else if (returnFocus.current !== null) element.querySelectorAll<HTMLButtonElement>('[role="toolbar"] button').item(returnFocus.current)?.focus({ preventScroll: true });
|
|
108
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches || element.closest('[data-motion="none"]')) return;
|
|
109
|
+
const style = getComputedStyle(element);
|
|
110
|
+
const seconds = style.transitionDuration.split(",")[0].trim();
|
|
111
|
+
const duration = parseFloat(seconds) * (seconds.endsWith("ms") ? 1 : 1000);
|
|
112
|
+
if (!duration) return;
|
|
113
|
+
const animation = element.animate({ height: [`${height}px`, `${element.getBoundingClientRect().height}px`] }, { duration, easing: style.transitionTimingFunction });
|
|
114
|
+
transition.current = animation;
|
|
115
|
+
element.dataset.editTransition = "true";
|
|
116
|
+
const finish = () => { if (transition.current === animation) delete element.dataset.editTransition; };
|
|
117
|
+
animation.finished.then(finish, finish);
|
|
118
|
+
}, [editing]);
|
|
119
|
+
const canSubmit = draft.trim().length > 0 && draft.trim() !== originalDraft.trim();
|
|
120
|
+
const submit = async () => {
|
|
121
|
+
if (!canSubmit || busy.current) return;
|
|
122
|
+
busy.current = true;
|
|
123
|
+
setPending(true);
|
|
124
|
+
setError("");
|
|
125
|
+
try {
|
|
126
|
+
const next = draft.trim();
|
|
127
|
+
await onEdit?.(next);
|
|
128
|
+
if (!mounted.current) return;
|
|
129
|
+
setCommitted({ source: sourceText, text: next });
|
|
130
|
+
changeMode(false);
|
|
131
|
+
} catch {
|
|
132
|
+
if (mounted.current) setError(labels.editError);
|
|
133
|
+
} finally {
|
|
134
|
+
busy.current = false;
|
|
135
|
+
if (mounted.current) setPending(false);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const resolvedActions = actions.map((action, index): MessageAction => {
|
|
139
|
+
if (action.onClick) return action;
|
|
140
|
+
if (action.kind === "copy") return { ...action, onClick: () => navigator.clipboard.writeText(text()), successLabel: action.successLabel ?? labels.copied, errorLabel: action.errorLabel ?? labels.copyError };
|
|
141
|
+
if (action.kind === "edit") return { ...action, onClick: () => {
|
|
142
|
+
if (busy.current) return;
|
|
143
|
+
returnFocus.current = index;
|
|
144
|
+
const original = text();
|
|
145
|
+
setOriginalDraft(original);
|
|
146
|
+
setDraft(original);
|
|
147
|
+
setError("");
|
|
148
|
+
changeMode(true);
|
|
149
|
+
} };
|
|
150
|
+
if (action.kind === "delete") return { ...action, onClick: async () => {
|
|
151
|
+
if (busy.current) return;
|
|
152
|
+
busy.current = true;
|
|
153
|
+
setError("");
|
|
154
|
+
try { await onDelete?.(); if (mounted.current) setDeleted(true); }
|
|
155
|
+
catch { if (mounted.current) setError(labels.deleteError); }
|
|
156
|
+
finally { busy.current = false; }
|
|
157
|
+
} };
|
|
158
|
+
return action;
|
|
159
|
+
});
|
|
46
160
|
const cls = [styles.root, className].filter(Boolean).join(" ");
|
|
47
|
-
|
|
48
|
-
|
|
161
|
+
if (deleted) return null;
|
|
49
162
|
return (
|
|
50
|
-
<div
|
|
51
|
-
className={cls}
|
|
52
|
-
data-actions-visibility={actionsVisibility}
|
|
53
|
-
{...rest}
|
|
54
|
-
>
|
|
163
|
+
<div ref={root} className={cls} data-actions-visibility={actionsVisibility} data-size={size} data-fill={fill} data-animate={animate || undefined} data-editing={editing || undefined} {...rest}>
|
|
55
164
|
{before ? <div className={styles.before}>{before}</div> : null}
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
165
|
+
{editing ? (
|
|
166
|
+
<form className={styles.editor} aria-label={labels.edit} aria-busy={pending || undefined} onSubmit={(event) => { event.preventDefault(); void submit(); }}>
|
|
167
|
+
<Textarea className={styles.editorField} variant="line" aria-label={labels.edit} autoResize rows={1} minRows={1} maxRows={8} value={draft} readOnly={pending}
|
|
168
|
+
onChange={(event) => setDraft(event.target.value)} onKeyDown={(event) => {
|
|
169
|
+
if (event.nativeEvent.isComposing || pending) return;
|
|
170
|
+
if (event.key === "Escape") { event.preventDefault(); setError(""); changeMode(false); }
|
|
171
|
+
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) { event.preventDefault(); void submit(); }
|
|
172
|
+
}} />
|
|
173
|
+
{error && <p className={styles.error} role="alert">{error}</p>}
|
|
174
|
+
<div className={styles.editorActions}>
|
|
175
|
+
<Button type="button" variant="outline" size="md" disabled={pending} onClick={() => { setError(""); changeMode(false); }}>{labels.cancel}</Button>
|
|
176
|
+
<Button type="submit" className={styles.editorSend} variant="primary" size="md" loading={pending} disabled={!canSubmit || pending}>{labels.send}</Button>
|
|
177
|
+
</div>
|
|
178
|
+
</form>
|
|
179
|
+
) : (
|
|
180
|
+
<>
|
|
181
|
+
<Bubble shape={shape} fill={fill} size={size} tail="end" className={styles.bubble} data-user-message-body>{body}</Bubble>
|
|
182
|
+
{actions.length > 0 && <div className={styles.actions}><MessageActions align="end" actions={resolvedActions} /></div>}
|
|
183
|
+
{error && <p className={styles.error} role="alert">{error}</p>}
|
|
184
|
+
</>
|
|
185
|
+
)}
|
|
64
186
|
</div>
|
|
65
187
|
);
|
|
66
188
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { UserMessage } from "./UserMessage";
|
|
2
2
|
export type { UserMessageProps, UserMessageActionsVisibility } from "./UserMessage";
|
|
3
|
+
|
|
4
|
+
/** Explicit AI chat name; the original export remains compatible. */
|
|
5
|
+
export { UserMessage as AIUserMessage } from "./UserMessage";
|
|
6
|
+
export type { UserMessageProps as AIUserMessageProps } from "./UserMessage";
|
|
@@ -553,7 +553,7 @@ export const components: { id: string; title: string; items: string[] }[] = [
|
|
|
553
553
|
{
|
|
554
554
|
id: "input",
|
|
555
555
|
title: "Input",
|
|
556
|
-
items: ["Input","Textarea","Select","Combobox","Multi-Select","Checkbox","Checkbox Card","Radio","Radio Card","Switch","Slider","Date Picker","Time Picker","File Upload"],
|
|
556
|
+
items: ["Input","Textarea","Select","Combobox","Multi-Select","Checkbox","Checkbox Card","Radio","Radio Card","Switch","Slider","Date Picker","Time Picker","File Upload","Emoji Picker"],
|
|
557
557
|
},
|
|
558
558
|
{
|
|
559
559
|
id: "color",
|
|
@@ -590,15 +590,20 @@ export const components: { id: string; title: string; items: string[] }[] = [
|
|
|
590
590
|
title: "Menu",
|
|
591
591
|
items: ["Context Menu","Dropdown Menu","Command Palette","Accordion","Disclosure"],
|
|
592
592
|
},
|
|
593
|
+
{
|
|
594
|
+
id: "team-chat",
|
|
595
|
+
title: "Team Chat",
|
|
596
|
+
items: ["Chat Composer","Chat Message","Chat Reactions"],
|
|
597
|
+
},
|
|
593
598
|
{
|
|
594
599
|
id: "chat-input",
|
|
595
|
-
title: "Chat Input",
|
|
596
|
-
items: ["Chat Input","Quotation Bar","Attachment Thumb","Generated Image"],
|
|
600
|
+
title: "AI Chat Input",
|
|
601
|
+
items: ["AI Chat Input","Quotation Bar","Attachment Thumb","Generated Image"],
|
|
597
602
|
},
|
|
598
603
|
{
|
|
599
604
|
id: "chat-message",
|
|
600
|
-
title: "Chat Messages",
|
|
601
|
-
items: ["Bubble","User Message","AI Message","Message State","Message Actions","Message Quote","Message Sources","Message Table"],
|
|
605
|
+
title: "AI Chat Messages",
|
|
606
|
+
items: ["Bubble","AI User Message","AI Message","Message State","Message Actions","Message Quote","Message Sources","Message Table"],
|
|
602
607
|
},
|
|
603
608
|
{
|
|
604
609
|
id: "chat-shell",
|
|
@@ -4,6 +4,24 @@
|
|
|
4
4
|
접근성 유틸의 1px/-1px 값은 "픽셀 토큰"이 아니라 스크린리더 공식 트릭이라
|
|
5
5
|
Ovenn 토큰 훅의 EXEMPT_FILES에 등록돼 예외 처리. */
|
|
6
6
|
|
|
7
|
+
/* 임의의 HTML 표면도 radius가 있으면 Shape 곡선을 자동 적용한다.
|
|
8
|
+
낮은 우선순위 layer로 기존 컴포넌트의 round/mini/로컬 곡률을 보존한다.
|
|
9
|
+
radius 자체는 변경하지 않으며, 원형 직접 구현은 data-corner-shape="round"
|
|
10
|
+
또는 로컬 corner-shape: round로 표시한다. */
|
|
11
|
+
@layer ovenn-shape {
|
|
12
|
+
:where(*),
|
|
13
|
+
:where(*)::before,
|
|
14
|
+
:where(*)::after {
|
|
15
|
+
corner-shape: var(--corner-shape, squircle);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:where([data-corner-shape="round"]),
|
|
19
|
+
:where([data-corner-shape="round"])::before,
|
|
20
|
+
:where([data-corner-shape="round"])::after {
|
|
21
|
+
corner-shape: round;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
/* 스크린리더만 읽는 숨김 — CheckboxCard, Checkbox 등 네이티브 input을 가리고
|
|
8
26
|
커스텀 UI 그리는 컴포넌트가 사용. */
|
|
9
27
|
.visually-hidden {
|
|
@@ -98,16 +116,16 @@
|
|
|
98
116
|
}
|
|
99
117
|
.m-float[data-state="open"][data-side="top"],
|
|
100
118
|
.m-float[data-state="instant-open"][data-side="top"],
|
|
101
|
-
.m-float[data-state="delayed-open"][data-side="top"] { animation: m-emerge-from-bottom var(--duration-base) var(--ease-emphasized); }
|
|
119
|
+
.m-float[data-state="delayed-open"][data-side="top"] { animation: m-emerge-from-bottom var(--float-open-duration, var(--duration-base)) var(--ease-emphasized); }
|
|
102
120
|
.m-float[data-state="open"][data-side="bottom"],
|
|
103
121
|
.m-float[data-state="instant-open"][data-side="bottom"],
|
|
104
|
-
.m-float[data-state="delayed-open"][data-side="bottom"] { animation: m-emerge-from-top var(--duration-base) var(--ease-emphasized); }
|
|
122
|
+
.m-float[data-state="delayed-open"][data-side="bottom"] { animation: m-emerge-from-top var(--float-open-duration, var(--duration-base)) var(--ease-emphasized); }
|
|
105
123
|
.m-float[data-state="open"][data-side="left"],
|
|
106
124
|
.m-float[data-state="instant-open"][data-side="left"],
|
|
107
|
-
.m-float[data-state="delayed-open"][data-side="left"] { animation: m-emerge-from-right var(--duration-base) var(--ease-emphasized); }
|
|
125
|
+
.m-float[data-state="delayed-open"][data-side="left"] { animation: m-emerge-from-right var(--float-open-duration, var(--duration-base)) var(--ease-emphasized); }
|
|
108
126
|
.m-float[data-state="open"][data-side="right"],
|
|
109
127
|
.m-float[data-state="instant-open"][data-side="right"],
|
|
110
|
-
.m-float[data-state="delayed-open"][data-side="right"] { animation: m-emerge-from-left var(--duration-base) var(--ease-emphasized); }
|
|
128
|
+
.m-float[data-state="delayed-open"][data-side="right"] { animation: m-emerge-from-left var(--float-open-duration, var(--duration-base)) var(--ease-emphasized); }
|
|
111
129
|
|
|
112
130
|
.m-float[data-state="closed"][data-side="top"] { animation: m-recede-to-bottom var(--duration-fast) var(--ease-in); }
|
|
113
131
|
.m-float[data-state="closed"][data-side="bottom"] { animation: m-recede-to-top var(--duration-fast) var(--ease-in); }
|
|
@@ -124,7 +142,7 @@
|
|
|
124
142
|
.m-float[data-state="open"]:not([data-side]),
|
|
125
143
|
.m-float[data-state="instant-open"]:not([data-side]),
|
|
126
144
|
.m-float[data-state="delayed-open"]:not([data-side]) {
|
|
127
|
-
animation: m-emerge-from-top var(--duration-base) var(--ease-emphasized);
|
|
145
|
+
animation: m-emerge-from-top var(--float-open-duration, var(--duration-base)) var(--ease-emphasized);
|
|
128
146
|
}
|
|
129
147
|
.m-float[data-state="closed"]:not([data-side]) {
|
|
130
148
|
animation: m-recede-to-top var(--duration-fast) var(--ease-in);
|
|
@@ -133,3 +151,11 @@
|
|
|
133
151
|
@media (prefers-reduced-motion: reduce) {
|
|
134
152
|
.m-float { animation: none !important; }
|
|
135
153
|
}
|
|
154
|
+
|
|
155
|
+
/* Placeholder ink is one shared token so native fields and custom placeholder labels match. */
|
|
156
|
+
@layer ovenn-placeholder {
|
|
157
|
+
input::placeholder,
|
|
158
|
+
textarea::placeholder {
|
|
159
|
+
color: var(--fg-placeholder);
|
|
160
|
+
}
|
|
161
|
+
}
|