@revikornmann/muka-ui 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/manifest.json +30 -0
- package/dist/cjs/components/AgentTaskList/AgentTaskList.css +22 -3
- package/dist/cjs/components/AgentTaskList/AgentTaskList.js +1 -1
- package/dist/cjs/components/BadgeNumber/BadgeNumber.css +105 -0
- package/dist/cjs/components/BadgeNumber/BadgeNumber.js +19 -0
- package/dist/cjs/components/BadgeNumber/BadgeNumber.js.map +1 -0
- package/dist/cjs/components/BadgeNumber/index.js +11 -0
- package/dist/cjs/components/BadgeNumber/index.js.map +1 -0
- package/dist/cjs/components/BottomBar/BottomBar.css +8 -5
- package/dist/cjs/components/Button/Button.css +13 -6
- package/dist/cjs/components/Button/Button.js +1 -1
- package/dist/cjs/components/ChatComposer/ChatComposer.css +13 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.css +328 -0
- package/dist/cjs/components/ChatMessage/ChatMessage.js +141 -0
- package/dist/cjs/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/cjs/components/ChatMessage/index.js +7 -0
- package/dist/cjs/components/ChatMessage/index.js.map +1 -0
- package/dist/cjs/components/ChatMessageList/ChatMessageList.css +17 -1
- package/dist/cjs/components/ChatMessageList/ChatMessageList.js +1 -1
- package/dist/cjs/components/ChatMessageStack/ChatMessageStack.css +51 -0
- package/dist/cjs/components/ChatMessageStack/ChatMessageStack.js +49 -0
- package/dist/cjs/components/ChatMessageStack/ChatMessageStack.js.map +1 -0
- package/dist/cjs/components/ChatMessageStack/index.js +6 -0
- package/dist/cjs/components/ChatMessageStack/index.js.map +1 -0
- package/dist/cjs/components/ChatPhotoGrid/ChatPhotoGrid.css +119 -0
- package/dist/cjs/components/ChatPhotoGrid/ChatPhotoGrid.js +47 -0
- package/dist/cjs/components/ChatPhotoGrid/ChatPhotoGrid.js.map +1 -0
- package/dist/cjs/components/ChatPhotoGrid/index.js +11 -0
- package/dist/cjs/components/ChatPhotoGrid/index.js.map +1 -0
- package/dist/cjs/components/Menu/Menu.js +5 -4
- package/dist/cjs/components/Menu/Menu.js.map +1 -1
- package/dist/cjs/components/index.js +11 -5
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/utils/useLongPress.js +71 -0
- package/dist/cjs/utils/useLongPress.js.map +1 -0
- package/dist/esm/components/AgentTaskList/AgentTaskList.css +22 -3
- package/dist/esm/components/AgentTaskList/AgentTaskList.js +1 -1
- package/dist/esm/components/BadgeNumber/BadgeNumber.css +105 -0
- package/dist/esm/components/BadgeNumber/BadgeNumber.js +15 -0
- package/dist/esm/components/BadgeNumber/BadgeNumber.js.map +1 -0
- package/dist/esm/components/BadgeNumber/index.js +3 -0
- package/dist/esm/components/BadgeNumber/index.js.map +1 -0
- package/dist/esm/components/BottomBar/BottomBar.css +8 -5
- package/dist/esm/components/Button/Button.css +13 -6
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/ChatComposer/ChatComposer.css +13 -1
- package/dist/esm/components/ChatMessage/ChatMessage.css +328 -0
- package/dist/esm/components/ChatMessage/ChatMessage.js +137 -0
- package/dist/esm/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/esm/components/ChatMessage/index.js +2 -0
- package/dist/esm/components/ChatMessage/index.js.map +1 -0
- package/dist/esm/components/ChatMessageList/ChatMessageList.css +17 -1
- package/dist/esm/components/ChatMessageList/ChatMessageList.js +1 -1
- package/dist/esm/components/ChatMessageStack/ChatMessageStack.css +51 -0
- package/dist/esm/components/ChatMessageStack/ChatMessageStack.js +42 -0
- package/dist/esm/components/ChatMessageStack/ChatMessageStack.js.map +1 -0
- package/dist/esm/components/ChatMessageStack/index.js +2 -0
- package/dist/esm/components/ChatMessageStack/index.js.map +1 -0
- package/dist/esm/components/ChatPhotoGrid/ChatPhotoGrid.css +119 -0
- package/dist/esm/components/ChatPhotoGrid/ChatPhotoGrid.js +43 -0
- package/dist/esm/components/ChatPhotoGrid/ChatPhotoGrid.js.map +1 -0
- package/dist/esm/components/ChatPhotoGrid/index.js +3 -0
- package/dist/esm/components/ChatPhotoGrid/index.js.map +1 -0
- package/dist/esm/components/Menu/Menu.js +5 -4
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/index.js +4 -1
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/utils/useLongPress.js +68 -0
- package/dist/esm/utils/useLongPress.js.map +1 -0
- package/dist/styles/components/AgentTaskList.css +22 -3
- package/dist/styles/components/BadgeNumber.css +105 -0
- package/dist/styles/components/BottomBar.css +8 -5
- package/dist/styles/components/Button.css +13 -6
- package/dist/styles/components/ChatComposer.css +13 -1
- package/dist/styles/components/ChatMessage.css +328 -0
- package/dist/styles/components/ChatMessageList.css +17 -1
- package/dist/styles/components/ChatMessageStack.css +51 -0
- package/dist/styles/components/ChatPhotoGrid.css +119 -0
- package/dist/styles/index.css +2615 -1941
- package/dist/styles/muka-dark.css +2615 -1941
- package/dist/styles/muka-light.css +2615 -1941
- package/dist/styles/tokens-bouwplan-dark.css +85 -0
- package/dist/styles/tokens-bouwplan-light.css +85 -0
- package/dist/styles/tokens-fscl-dark.css +85 -0
- package/dist/styles/tokens-fscl-light.css +85 -0
- package/dist/styles/tokens-grip-dark.css +85 -0
- package/dist/styles/tokens-grip-light.css +85 -0
- package/dist/styles/tokens-muka-dark.css +85 -0
- package/dist/styles/tokens-muka-light.css +85 -0
- package/dist/styles/tokens-wireframe-dark.css +85 -0
- package/dist/styles/tokens-wireframe-light.css +85 -0
- package/dist/styles/wireframe-dark.css +2615 -1941
- package/dist/styles/wireframe-light.css +2615 -1941
- package/dist/types/components/AgentTaskList/AgentTaskList.d.ts +1 -1
- package/dist/types/components/BadgeNumber/BadgeNumber.d.ts +17 -0
- package/dist/types/components/BadgeNumber/BadgeNumber.d.ts.map +1 -0
- package/dist/types/components/BadgeNumber/index.d.ts +3 -0
- package/dist/types/components/BadgeNumber/index.d.ts.map +1 -0
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/ChatMessage/ChatMessage.d.ts +130 -0
- package/dist/types/components/ChatMessage/ChatMessage.d.ts.map +1 -0
- package/dist/types/components/ChatMessage/index.d.ts +2 -0
- package/dist/types/components/ChatMessage/index.d.ts.map +1 -0
- package/dist/types/components/ChatMessageList/ChatMessageList.d.ts +2 -2
- package/dist/types/components/ChatMessageList/ChatMessageList.d.ts.map +1 -1
- package/dist/types/components/ChatMessageStack/ChatMessageStack.d.ts +46 -0
- package/dist/types/components/ChatMessageStack/ChatMessageStack.d.ts.map +1 -0
- package/dist/types/components/ChatMessageStack/index.d.ts +2 -0
- package/dist/types/components/ChatMessageStack/index.d.ts.map +1 -0
- package/dist/types/components/ChatPhotoGrid/ChatPhotoGrid.d.ts +44 -0
- package/dist/types/components/ChatPhotoGrid/ChatPhotoGrid.d.ts.map +1 -0
- package/dist/types/components/ChatPhotoGrid/index.d.ts +3 -0
- package/dist/types/components/ChatPhotoGrid/index.d.ts.map +1 -0
- package/dist/types/components/Menu/Menu.d.ts +12 -0
- package/dist/types/components/Menu/Menu.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/utils/useLongPress.d.ts +28 -0
- package/dist/types/utils/useLongPress.d.ts.map +1 -0
- package/package.json +1 -1
- package/tokens/README.md +14 -0
- package/tokens/t2-alias/brand/bouwplan/dark.json +24 -0
- package/tokens/t2-alias/brand/bouwplan/light.json +24 -0
- package/tokens/t2-alias/brand/fscl/dark.json +24 -0
- package/tokens/t2-alias/brand/fscl/light.json +24 -0
- package/tokens/t2-alias/brand/grip/dark.json +54 -0
- package/tokens/t2-alias/brand/grip/light.json +54 -0
- package/tokens/t2-alias/brand/muka/dark.json +54 -0
- package/tokens/t2-alias/brand/muka/light.json +54 -0
- package/tokens/t2-alias/brand/wireframe/dark.json +54 -0
- package/tokens/t2-alias/brand/wireframe/light.json +54 -0
- package/tokens/t3-semantics/ui.json +219 -0
- package/tokens/t4-components/badge-number.json +48 -0
- package/tokens/t4-components/chatbubble.json +180 -0
- package/tokens/t4-components/chatphotogrid.json +32 -0
- package/dist/cjs/components/ChatBubble/ChatBubble.css +0 -80
- package/dist/cjs/components/ChatBubble/ChatBubble.js +0 -24
- package/dist/cjs/components/ChatBubble/ChatBubble.js.map +0 -1
- package/dist/cjs/components/ChatBubble/index.js +0 -6
- package/dist/cjs/components/ChatBubble/index.js.map +0 -1
- package/dist/esm/components/ChatBubble/ChatBubble.css +0 -80
- package/dist/esm/components/ChatBubble/ChatBubble.js +0 -20
- package/dist/esm/components/ChatBubble/ChatBubble.js.map +0 -1
- package/dist/esm/components/ChatBubble/index.js +0 -2
- package/dist/esm/components/ChatBubble/index.js.map +0 -1
- package/dist/styles/components/ChatBubble.css +0 -80
- package/dist/types/components/ChatBubble/ChatBubble.d.ts +0 -30
- package/dist/types/components/ChatBubble/ChatBubble.d.ts.map +0 -1
- package/dist/types/components/ChatBubble/index.d.ts +0 -2
- package/dist/types/components/ChatBubble/index.d.ts.map +0 -1
|
@@ -96,10 +96,13 @@
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/* `[data-state="open"]` keeps a Button pressed while it's an open disclosure
|
|
99
|
-
trigger (Radix Menu/Popover set this on the trigger).
|
|
99
|
+
trigger (Radix Menu/Popover set this on the trigger). `[aria-pressed="true"]`
|
|
100
|
+
gives toggle buttons a visible selected state, so the toggle is not conveyed
|
|
101
|
+
to sighted users by the accessibility tree alone. */
|
|
100
102
|
.muka-button--primary:active:not(:disabled),
|
|
101
103
|
.muka-button--primary.muka-button--pressed:not(:disabled),
|
|
102
|
-
.muka-button--primary[data-state="open"]:not(:disabled)
|
|
104
|
+
.muka-button--primary[data-state="open"]:not(:disabled),
|
|
105
|
+
.muka-button--primary[aria-pressed="true"]:not(:disabled) {
|
|
103
106
|
background-color: var(--button-color-primary-background-pressed);
|
|
104
107
|
color: var(--button-color-primary-foreground-pressed);
|
|
105
108
|
box-shadow: var(--button-color-primary-shadow-pressed);
|
|
@@ -128,7 +131,8 @@
|
|
|
128
131
|
|
|
129
132
|
.muka-button--secondary:active:not(:disabled),
|
|
130
133
|
.muka-button--secondary.muka-button--pressed:not(:disabled),
|
|
131
|
-
.muka-button--secondary[data-state="open"]:not(:disabled)
|
|
134
|
+
.muka-button--secondary[data-state="open"]:not(:disabled),
|
|
135
|
+
.muka-button--secondary[aria-pressed="true"]:not(:disabled) {
|
|
132
136
|
background-color: var(--button-color-secondary-background-pressed);
|
|
133
137
|
color: var(--button-color-secondary-foreground-pressed);
|
|
134
138
|
box-shadow: var(--button-color-secondary-shadow-pressed);
|
|
@@ -157,7 +161,8 @@
|
|
|
157
161
|
|
|
158
162
|
.muka-button--tertiary:active:not(:disabled),
|
|
159
163
|
.muka-button--tertiary.muka-button--pressed:not(:disabled),
|
|
160
|
-
.muka-button--tertiary[data-state="open"]:not(:disabled)
|
|
164
|
+
.muka-button--tertiary[data-state="open"]:not(:disabled),
|
|
165
|
+
.muka-button--tertiary[aria-pressed="true"]:not(:disabled) {
|
|
161
166
|
background-color: var(--button-color-tertiary-background-pressed);
|
|
162
167
|
color: var(--button-color-tertiary-foreground-pressed);
|
|
163
168
|
border-color: var(--button-color-tertiary-border-pressed);
|
|
@@ -186,7 +191,8 @@
|
|
|
186
191
|
|
|
187
192
|
.muka-button--ghost:active:not(:disabled),
|
|
188
193
|
.muka-button--ghost.muka-button--pressed:not(:disabled),
|
|
189
|
-
.muka-button--ghost[data-state="open"]:not(:disabled)
|
|
194
|
+
.muka-button--ghost[data-state="open"]:not(:disabled),
|
|
195
|
+
.muka-button--ghost[aria-pressed="true"]:not(:disabled) {
|
|
190
196
|
background-color: var(--button-color-ghost-background-pressed);
|
|
191
197
|
color: var(--button-color-ghost-foreground-pressed);
|
|
192
198
|
border-color: var(--button-color-ghost-border-pressed);
|
|
@@ -215,7 +221,8 @@
|
|
|
215
221
|
|
|
216
222
|
.muka-button--muted:active:not(:disabled),
|
|
217
223
|
.muka-button--muted.muka-button--pressed:not(:disabled),
|
|
218
|
-
.muka-button--muted[data-state="open"]:not(:disabled)
|
|
224
|
+
.muka-button--muted[data-state="open"]:not(:disabled),
|
|
225
|
+
.muka-button--muted[aria-pressed="true"]:not(:disabled) {
|
|
219
226
|
background-color: var(--button-color-muted-background-pressed);
|
|
220
227
|
color: var(--button-color-muted-foreground-pressed);
|
|
221
228
|
border-color: var(--button-color-muted-border-pressed);
|
|
@@ -18,7 +18,7 @@ import './Button.css';
|
|
|
18
18
|
* - Uses native <button> element for full keyboard support
|
|
19
19
|
* - Focus indicator meets WCAG 2.4.7 (visible focus)
|
|
20
20
|
* - When iconOnly=true, aria-label is required (dev warning if missing)
|
|
21
|
-
* - Supports aria-pressed for toggle buttons
|
|
21
|
+
* - Supports aria-pressed for toggle buttons (renders the pressed treatment when true)
|
|
22
22
|
* - Supports aria-expanded/aria-controls for menu buttons
|
|
23
23
|
*
|
|
24
24
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/* ChatComposer Component Styles */
|
|
2
2
|
|
|
3
|
+
/*
|
|
4
|
+
* The composer is a bare, fill-width row: no padding, background, border or
|
|
5
|
+
* max-width of its own (Figma 5243:14141). Whatever hosts it owns the
|
|
6
|
+
* container — see BottomBar's `chat` variant.
|
|
7
|
+
*/
|
|
3
8
|
.muka-chat-composer {
|
|
4
9
|
display: flex;
|
|
5
10
|
flex-direction: column;
|
|
6
11
|
gap: var(--spacing-3);
|
|
7
12
|
width: 100%;
|
|
8
|
-
max-width: 768px;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
.muka-chat-composer--disabled {
|
|
@@ -111,3 +115,11 @@
|
|
|
111
115
|
right: var(--spacing-2);
|
|
112
116
|
transform: translateY(-50%);
|
|
113
117
|
}
|
|
118
|
+
|
|
119
|
+
/* ─── Print ────────────────────────────────────────────── */
|
|
120
|
+
|
|
121
|
+
@media print {
|
|
122
|
+
.muka-chat-composer {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/* ChatMessage Component Styles */
|
|
2
|
+
|
|
3
|
+
.muka-chat-message {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
width: 100%;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ─── Row: avatar rail + bubble ────────────────────────── */
|
|
11
|
+
|
|
12
|
+
.muka-chat-message__row {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: minmax(0, 1fr);
|
|
15
|
+
grid-template-areas: 'bubble';
|
|
16
|
+
column-gap: var(--chatbubble-row-gap);
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.muka-chat-message--has-avatar .muka-chat-message__row {
|
|
21
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
22
|
+
grid-template-areas: 'rail bubble';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.muka-chat-message--own.muka-chat-message--has-avatar .muka-chat-message__row {
|
|
26
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
27
|
+
grid-template-areas: 'bubble rail';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.muka-chat-message__rail {
|
|
31
|
+
grid-area: rail;
|
|
32
|
+
/* Sits on the bubble's baseline (Figma 5355:44091) */
|
|
33
|
+
align-self: end;
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
min-width: var(--chatbubble-avatar-size);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* The Small size in Figma (5373:44702) halves the avatar to 32px and tightens
|
|
41
|
+
* the gap to the bubble. Size the avatar itself, not just the rail, so the
|
|
42
|
+
* bubbles keep their alignment. The header row keeps its own gap.
|
|
43
|
+
*/
|
|
44
|
+
@media (max-width: 1023px) {
|
|
45
|
+
.muka-chat-message__row {
|
|
46
|
+
column-gap: var(--chatbubble-row-gap-compact);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.muka-chat-message__rail {
|
|
50
|
+
min-width: var(--chatbubble-avatar-size-compact);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Outweighs the avatar's own size class, which sets width/height directly */
|
|
54
|
+
.muka-chat-message .muka-chat-message__rail > * {
|
|
55
|
+
width: var(--chatbubble-avatar-size-compact);
|
|
56
|
+
height: var(--chatbubble-avatar-size-compact);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ─── Bubble surface ───────────────────────────────────── */
|
|
61
|
+
|
|
62
|
+
.muka-chat-message__bubble {
|
|
63
|
+
grid-area: bubble;
|
|
64
|
+
max-width: var(--chatbubble-max-width);
|
|
65
|
+
position: relative;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
gap: var(--chatbubble-gap);
|
|
69
|
+
padding: var(--chatbubble-padding-block) var(--chatbubble-padding-inline);
|
|
70
|
+
border-radius: var(--chatbubble-radius);
|
|
71
|
+
border: var(--border-width-regular) solid transparent;
|
|
72
|
+
box-shadow: var(--shadow-level2);
|
|
73
|
+
word-break: break-word;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
* Length axis (Figma `Text length` on 5355:44091): short messages hug their
|
|
78
|
+
* content, long ones fill the row up to the shared max width.
|
|
79
|
+
*/
|
|
80
|
+
.muka-chat-message--long .muka-chat-message__bubble {
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.muka-chat-message--short .muka-chat-message__bubble {
|
|
85
|
+
width: fit-content;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.muka-chat-message--own .muka-chat-message__bubble {
|
|
89
|
+
justify-self: end;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.muka-chat-message--own .muka-chat-message__bubble {
|
|
93
|
+
background-color: var(--chatbubble-color-own-background);
|
|
94
|
+
border-color: var(--chatbubble-color-own-border);
|
|
95
|
+
color: var(--chatbubble-color-own-foreground);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.muka-chat-message--peer .muka-chat-message__bubble {
|
|
99
|
+
background-color: var(--chatbubble-color-peer-background);
|
|
100
|
+
border-color: var(--chatbubble-color-peer-border);
|
|
101
|
+
color: var(--chatbubble-color-peer-foreground);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.muka-chat-message--agent .muka-chat-message__bubble {
|
|
105
|
+
background-color: var(--chatbubble-color-agent-background);
|
|
106
|
+
border-color: var(--chatbubble-color-agent-border);
|
|
107
|
+
color: var(--chatbubble-color-agent-foreground);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* ─── Header row (author · meta · time · badge) ────────── */
|
|
111
|
+
|
|
112
|
+
.muka-chat-message__header {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-flow: row wrap;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: var(--chatbubble-row-gap);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.muka-chat-message__author {
|
|
120
|
+
font-family: var(--text-body-base-bold-fontFamily);
|
|
121
|
+
font-weight: var(--text-body-base-bold-fontWeight);
|
|
122
|
+
font-size: var(--text-body-base-bold-fontSize);
|
|
123
|
+
line-height: var(--text-body-base-bold-lineHeight);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.muka-chat-message__author-meta {
|
|
127
|
+
/* Inherits the variant's body colour from the bubble */
|
|
128
|
+
color: inherit;
|
|
129
|
+
font-family: var(--text-body-base-regular-fontFamily);
|
|
130
|
+
font-weight: var(--text-body-base-regular-fontWeight);
|
|
131
|
+
font-size: var(--text-body-base-regular-fontSize);
|
|
132
|
+
line-height: var(--text-body-base-regular-lineHeight);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.muka-chat-message__badge {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/*
|
|
141
|
+
* Keep the first line of content clear of the absolutely positioned menu
|
|
142
|
+
* button in the bubble's top-right corner.
|
|
143
|
+
*/
|
|
144
|
+
.muka-chat-message--has-menu .muka-chat-message__header,
|
|
145
|
+
.muka-chat-message--has-menu.muka-chat-message--no-header .muka-chat-message__message {
|
|
146
|
+
padding-right: var(--spacing-10);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* …and the last line clear of the inset timestamp in the bottom-right corner */
|
|
150
|
+
.muka-chat-message--has-timestamp .muka-chat-message__message {
|
|
151
|
+
padding-right: var(--spacing-10);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* ─── Body ─────────────────────────────────────────────── */
|
|
155
|
+
|
|
156
|
+
.muka-chat-message__body {
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
gap: var(--chatbubble-gap);
|
|
160
|
+
min-width: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.muka-chat-message__media {
|
|
164
|
+
min-width: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.muka-chat-message__message {
|
|
168
|
+
font-family: var(--text-body-base-regular-fontFamily);
|
|
169
|
+
font-weight: var(--text-body-base-regular-fontWeight);
|
|
170
|
+
font-size: var(--text-body-base-regular-fontSize);
|
|
171
|
+
line-height: var(--text-body-base-regular-lineHeight);
|
|
172
|
+
white-space: pre-wrap;
|
|
173
|
+
word-break: break-word;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Empty message block should not add a gap of its own */
|
|
177
|
+
.muka-chat-message__message:empty {
|
|
178
|
+
display: none;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ─── Embedded card ────────────────────────────────────── */
|
|
182
|
+
|
|
183
|
+
.muka-chat-message__embed {
|
|
184
|
+
position: relative;
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
gap: var(--chatbubble-embed-gap);
|
|
188
|
+
/* The card is inset from the blocks above and below it (Figma 5289:40562) */
|
|
189
|
+
margin-block: var(--chatbubble-embed-margin-block);
|
|
190
|
+
padding: var(--chatbubble-embed-padding-block) var(--chatbubble-embed-padding-inline);
|
|
191
|
+
border-radius: var(--chatbubble-embed-radius);
|
|
192
|
+
border: var(--border-width-regular) solid transparent;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/*
|
|
196
|
+
* The embed sits on the raised surface of its author's role, one step apart
|
|
197
|
+
* from the bubble it is nested in, and reuses that role's border colour.
|
|
198
|
+
*/
|
|
199
|
+
.muka-chat-message--own .muka-chat-message__embed {
|
|
200
|
+
background-color: var(--chatbubble-embed-color-own-background);
|
|
201
|
+
border-color: var(--chatbubble-embed-color-own-border);
|
|
202
|
+
color: var(--chatbubble-embed-color-own-foreground);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.muka-chat-message--peer .muka-chat-message__embed {
|
|
206
|
+
background-color: var(--chatbubble-embed-color-peer-background);
|
|
207
|
+
border-color: var(--chatbubble-embed-color-peer-border);
|
|
208
|
+
color: var(--chatbubble-embed-color-peer-foreground);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.muka-chat-message--agent .muka-chat-message__embed {
|
|
212
|
+
background-color: var(--chatbubble-embed-color-agent-background);
|
|
213
|
+
border-color: var(--chatbubble-embed-color-agent-border);
|
|
214
|
+
color: var(--chatbubble-embed-color-agent-foreground);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.muka-chat-message__embed-content {
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
gap: var(--chatbubble-embed-gap);
|
|
221
|
+
min-width: 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.muka-chat-message__embed-copy {
|
|
225
|
+
position: absolute;
|
|
226
|
+
top: var(--chatbubble-embed-padding-block);
|
|
227
|
+
right: var(--chatbubble-embed-padding-inline);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* ─── Stacked full-width action buttons ────────────────── */
|
|
231
|
+
|
|
232
|
+
.muka-chat-message__action-stack {
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
gap: var(--chatbubble-action-stack-gap);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* ─── Inset timestamp ──────────────────────────────────── */
|
|
239
|
+
|
|
240
|
+
/*
|
|
241
|
+
* Every author puts its timestamp in the bubble's bottom-right corner, below
|
|
242
|
+
* the message — never in the header row (Figma 5355:44091).
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
.muka-chat-message__timestamp {
|
|
246
|
+
color: var(--chatbubble-color-timestamp);
|
|
247
|
+
font-family: var(--text-body-xs-regular-fontFamily);
|
|
248
|
+
font-weight: var(--text-body-xs-regular-fontWeight);
|
|
249
|
+
font-size: var(--text-body-xs-regular-fontSize);
|
|
250
|
+
line-height: var(--text-body-xs-regular-lineHeight);
|
|
251
|
+
white-space: nowrap;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/*
|
|
255
|
+
* Pinned to the corner rather than stacked below the message, so a one-line
|
|
256
|
+
* message stays one line tall. The message reserves the width it needs.
|
|
257
|
+
*/
|
|
258
|
+
.muka-chat-message__timestamp--inset {
|
|
259
|
+
position: absolute;
|
|
260
|
+
right: var(--spacing-2);
|
|
261
|
+
bottom: var(--spacing-1);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/*
|
|
265
|
+
* Media, an embed or an action stack run the full width of the bubble, so the
|
|
266
|
+
* corner the timestamp sits in has to be cleared for it.
|
|
267
|
+
*/
|
|
268
|
+
.muka-chat-message--has-timestamp.muka-chat-message--has-blocks .muka-chat-message__body {
|
|
269
|
+
padding-bottom: var(--text-body-xs-regular-lineHeight);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* ─── Menu affordance ──────────────────────────────────── */
|
|
273
|
+
|
|
274
|
+
/*
|
|
275
|
+
* Hidden at rest. Revealed on hover on pointer devices, on keyboard focus
|
|
276
|
+
* everywhere, and pinned while its menu is open. On touch the equivalent
|
|
277
|
+
* affordance is a long-press on the bubble, which opens an ActionSheet.
|
|
278
|
+
*/
|
|
279
|
+
.muka-chat-message__menu {
|
|
280
|
+
position: absolute;
|
|
281
|
+
top: var(--spacing-1);
|
|
282
|
+
right: var(--spacing-1);
|
|
283
|
+
opacity: 0;
|
|
284
|
+
pointer-events: none;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.muka-chat-message__menu:focus-within,
|
|
288
|
+
.muka-chat-message--menu-open .muka-chat-message__menu {
|
|
289
|
+
opacity: 1;
|
|
290
|
+
pointer-events: auto;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
|
|
294
|
+
.muka-chat-message__bubble:hover .muka-chat-message__menu {
|
|
295
|
+
opacity: 1;
|
|
296
|
+
pointer-events: auto;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Suppress iOS Safari's own callout so the long-press sheet can take over */
|
|
301
|
+
@media (pointer: coarse) {
|
|
302
|
+
.muka-chat-message--has-menu .muka-chat-message__bubble {
|
|
303
|
+
-webkit-touch-callout: none;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* ─── Print ────────────────────────────────────────────── */
|
|
308
|
+
|
|
309
|
+
@media print {
|
|
310
|
+
.muka-chat-message__bubble {
|
|
311
|
+
box-shadow: none;
|
|
312
|
+
break-inside: avoid;
|
|
313
|
+
print-color-adjust: exact;
|
|
314
|
+
-webkit-print-color-adjust: exact;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.muka-chat-message__embed {
|
|
318
|
+
break-inside: avoid;
|
|
319
|
+
print-color-adjust: exact;
|
|
320
|
+
-webkit-print-color-adjust: exact;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.muka-chat-message__menu,
|
|
324
|
+
.muka-chat-message__embed-copy,
|
|
325
|
+
.muka-chat-message__action-stack {
|
|
326
|
+
display: none;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { Menu, MenuTrigger, MenuContent, MenuItem, MenuCheckboxItem } from '../Menu';
|
|
7
|
+
import { ActionSheet } from '../ActionSheet';
|
|
8
|
+
import { useLongPress } from '../../utils/useLongPress';
|
|
9
|
+
import './ChatMessage.css';
|
|
10
|
+
/**
|
|
11
|
+
* Messages at or below this many characters hug their content; longer ones fill
|
|
12
|
+
* the available width (Figma `Text length` axis on `5355:44091`).
|
|
13
|
+
*/
|
|
14
|
+
const SHORT_MESSAGE_MAX_LENGTH = 100;
|
|
15
|
+
/**
|
|
16
|
+
* Set by `ChatMessageStack` so its children inherit the author without every
|
|
17
|
+
* message repeating it. Exported for the stack; not part of the public API.
|
|
18
|
+
*/
|
|
19
|
+
export const ChatMessageVariantContext = createContext(null);
|
|
20
|
+
/**
|
|
21
|
+
* ChatMessage — a single chat message.
|
|
22
|
+
*
|
|
23
|
+
* Composes with `ChatMessageList`, and with `ChatMessageStack` for consecutive
|
|
24
|
+
* messages from one author. Pass `<ChatPhotoGrid />` to `media`, an
|
|
25
|
+
* `<AgentTaskList />` above the bubble for tool progress, and a `<Badge />` to
|
|
26
|
+
* `badge` for visibility scope.
|
|
27
|
+
*
|
|
28
|
+
* Secondary actions (copy, feedback, regenerate, plus anything in `menuItems`)
|
|
29
|
+
* live behind one options menu: a dropdown revealed on hover on pointer
|
|
30
|
+
* devices, and a bottom sheet opened by long-pressing the bubble on touch.
|
|
31
|
+
*/
|
|
32
|
+
export const ChatMessage = ({ variant, children, length = 'auto', avatar, reserveAvatar = false, author, authorMeta, badge, timestamp, media, embed, onEmbedCopy, embedCopyLabel = 'Copy', actionStack, onCopy, copyLabel = 'Copy', onFeedback, feedback = null, feedbackUpLabel = 'Helpful', feedbackDownLabel = 'Not helpful', onRefresh, refreshLabel = 'Regenerate', menuItems, menuLabel = 'Message options', menuCancelLabel = 'Cancel', className = '', }) => {
|
|
33
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
34
|
+
const [sheetOpen, setSheetOpen] = useState(false);
|
|
35
|
+
// The trigger is revealed on hover, so focus must not linger on it after a
|
|
36
|
+
// pointer-driven close — Radix restores focus on close, and the browser marks
|
|
37
|
+
// that programmatic focus `:focus-visible`, which would pin the button open.
|
|
38
|
+
// Keyboard users still get focus back, since for them the reveal is correct.
|
|
39
|
+
const openedWithKeyboard = useRef(false);
|
|
40
|
+
const stackVariant = useContext(ChatMessageVariantContext);
|
|
41
|
+
const resolvedVariant = variant ?? stackVariant ?? 'peer';
|
|
42
|
+
// The visibility badge hangs off the author line, so it goes when the author does.
|
|
43
|
+
const showBadge = Boolean(author && badge);
|
|
44
|
+
const hasHeader = Boolean(author || authorMeta || showBadge);
|
|
45
|
+
const hasRail = Boolean(avatar || reserveAvatar);
|
|
46
|
+
const hasBlocks = Boolean(media || embed || actionStack);
|
|
47
|
+
const resolvedLength = length !== 'auto'
|
|
48
|
+
? length
|
|
49
|
+
: hasBlocks || typeof children !== 'string' || children.length > SHORT_MESSAGE_MAX_LENGTH
|
|
50
|
+
? 'long'
|
|
51
|
+
: 'short';
|
|
52
|
+
const items = useMemo(() => {
|
|
53
|
+
const resolved = [];
|
|
54
|
+
if (onCopy) {
|
|
55
|
+
resolved.push({
|
|
56
|
+
id: 'copy',
|
|
57
|
+
label: copyLabel,
|
|
58
|
+
icon: _jsx(Icon, { name: "file-copy", size: "sm" }),
|
|
59
|
+
onSelect: onCopy,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (onFeedback) {
|
|
63
|
+
resolved.push({
|
|
64
|
+
id: 'feedback-up',
|
|
65
|
+
label: feedbackUpLabel,
|
|
66
|
+
icon: _jsx(Icon, { name: "thumb-up", size: "sm" }),
|
|
67
|
+
checked: feedback === 'up',
|
|
68
|
+
onSelect: () => onFeedback(feedback === 'up' ? null : 'up'),
|
|
69
|
+
}, {
|
|
70
|
+
id: 'feedback-down',
|
|
71
|
+
label: feedbackDownLabel,
|
|
72
|
+
icon: _jsx(Icon, { name: "thumb-down", size: "sm" }),
|
|
73
|
+
checked: feedback === 'down',
|
|
74
|
+
onSelect: () => onFeedback(feedback === 'down' ? null : 'down'),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (onRefresh) {
|
|
78
|
+
resolved.push({
|
|
79
|
+
id: 'refresh',
|
|
80
|
+
label: refreshLabel,
|
|
81
|
+
icon: _jsx(Icon, { name: "restart", size: "sm" }),
|
|
82
|
+
onSelect: onRefresh,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (menuItems)
|
|
86
|
+
resolved.push(...menuItems);
|
|
87
|
+
return resolved;
|
|
88
|
+
}, [
|
|
89
|
+
onCopy,
|
|
90
|
+
copyLabel,
|
|
91
|
+
onFeedback,
|
|
92
|
+
feedback,
|
|
93
|
+
feedbackUpLabel,
|
|
94
|
+
feedbackDownLabel,
|
|
95
|
+
onRefresh,
|
|
96
|
+
refreshLabel,
|
|
97
|
+
menuItems,
|
|
98
|
+
]);
|
|
99
|
+
const hasMenu = items.length > 0;
|
|
100
|
+
const longPress = useLongPress({
|
|
101
|
+
enabled: hasMenu,
|
|
102
|
+
onLongPress: () => setSheetOpen(true),
|
|
103
|
+
});
|
|
104
|
+
const classes = [
|
|
105
|
+
'muka-chat-message',
|
|
106
|
+
`muka-chat-message--${resolvedVariant}`,
|
|
107
|
+
`muka-chat-message--${resolvedLength}`,
|
|
108
|
+
hasRail && 'muka-chat-message--has-avatar',
|
|
109
|
+
hasMenu && 'muka-chat-message--has-menu',
|
|
110
|
+
timestamp && 'muka-chat-message--has-timestamp',
|
|
111
|
+
hasBlocks && 'muka-chat-message--has-blocks',
|
|
112
|
+
menuOpen && 'muka-chat-message--menu-open',
|
|
113
|
+
!hasHeader && 'muka-chat-message--no-header',
|
|
114
|
+
className,
|
|
115
|
+
]
|
|
116
|
+
.filter(Boolean)
|
|
117
|
+
.join(' ');
|
|
118
|
+
// Grouped messages set `reserveAvatar` to keep the rail — and so the bubbles —
|
|
119
|
+
// aligned with the one message in the stack that draws the avatar.
|
|
120
|
+
const rail = hasRail ? (_jsx("div", { className: "muka-chat-message__rail", children: avatar })) : null;
|
|
121
|
+
return (_jsxs("div", { className: classes, "data-variant": resolvedVariant, "data-length": resolvedLength, children: [_jsxs("div", { className: "muka-chat-message__row", children: [resolvedVariant !== 'own' ? rail : null, _jsxs("div", { className: "muka-chat-message__bubble", ...(hasMenu ? longPress : {}), children: [hasHeader && (_jsxs("div", { className: "muka-chat-message__header", children: [author && (_jsx("span", { className: "muka-chat-message__author", children: author })), authorMeta && (_jsx("span", { className: "muka-chat-message__author-meta", children: authorMeta })), showBadge && _jsx("span", { className: "muka-chat-message__badge", children: badge })] })), _jsxs("div", { className: "muka-chat-message__body", children: [media && _jsx("div", { className: "muka-chat-message__media", children: media }), _jsx("div", { className: "muka-chat-message__message", children: children }), embed && (_jsxs("div", { className: "muka-chat-message__embed", children: [_jsx("div", { className: "muka-chat-message__embed-content", children: embed }), onEmbedCopy && (_jsx("div", { className: "muka-chat-message__embed-copy", children: _jsx(Button, { variant: "muted", size: "md", iconOnly: true, type: "button", "aria-label": embedCopyLabel, onClick: onEmbedCopy, children: _jsx(Icon, { name: "file-copy", size: "sm" }) }) }))] })), actionStack && (_jsx("div", { className: "muka-chat-message__action-stack", children: actionStack }))] }), timestamp && (_jsx("span", { className: "muka-chat-message__timestamp muka-chat-message__timestamp--inset", children: timestamp })), hasMenu && (_jsx("div", { className: "muka-chat-message__menu", children: _jsxs(Menu, { open: menuOpen, onOpenChange: setMenuOpen, children: [_jsx(MenuTrigger, { asChild: true, children: _jsx(Button, { variant: "secondary", size: "sm", iconOnly: true, type: "button", "aria-label": menuLabel, onPointerDown: () => {
|
|
122
|
+
openedWithKeyboard.current = false;
|
|
123
|
+
}, onKeyDown: () => {
|
|
124
|
+
openedWithKeyboard.current = true;
|
|
125
|
+
}, children: _jsx(Icon, { name: "arrow-down-s", size: "xs" }) }) }), _jsx(MenuContent, { align: "end", onCloseAutoFocus: (event) => {
|
|
126
|
+
if (!openedWithKeyboard.current)
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
}, children: items.map((item) => item.checked === undefined ? (_jsx(MenuItem, { icon: item.icon, destructive: item.destructive, disabled: item.disabled, onSelect: item.onSelect, children: item.label }, item.id)) : (_jsx(MenuCheckboxItem, { checked: item.checked, disabled: item.disabled, icon: item.icon, onCheckedChange: item.onSelect, children: item.label }, item.id))) })] }) }))] }), resolvedVariant === 'own' ? rail : null] }), hasMenu && (_jsx(ActionSheet, { open: sheetOpen, onOpenChange: setSheetOpen, title: menuLabel, cancel: { label: menuCancelLabel }, actions: items.map((item) => ({
|
|
129
|
+
label: item.label,
|
|
130
|
+
icon: item.icon,
|
|
131
|
+
onClick: item.onSelect,
|
|
132
|
+
destructive: item.destructive,
|
|
133
|
+
disabled: item.disabled,
|
|
134
|
+
})) }))] }));
|
|
135
|
+
};
|
|
136
|
+
export default ChatMessage;
|
|
137
|
+
//# sourceMappingURL=ChatMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessage.js","sourceRoot":"","sources":["../../../../components/ChatMessage/ChatMessage.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,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
|
align-items: stretch;
|
|
20
20
|
gap: var(--spacing-8);
|
|
21
21
|
width: 100%;
|
|
22
|
-
max-width:
|
|
22
|
+
max-width: var(--container-max-width-sm);
|
|
23
23
|
margin: 0 auto;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/* ─── Print ────────────────────────────────────────────── */
|
|
27
|
+
|
|
28
|
+
@media print {
|
|
29
|
+
.muka-chat-message-list {
|
|
30
|
+
overflow: visible;
|
|
31
|
+
height: auto;
|
|
32
|
+
max-height: none;
|
|
33
|
+
background: none;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.muka-chat-message-list__inner {
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -8,7 +8,7 @@ import './ChatMessageList.css';
|
|
|
8
8
|
* Auto-scrolls to bottom when content changes. Pin the list to the bottom of
|
|
9
9
|
* the conversation so new messages stay in view as they arrive.
|
|
10
10
|
*
|
|
11
|
-
* Composes with `
|
|
11
|
+
* Composes with `ChatMessage` and `TypingIndicator`.
|
|
12
12
|
*/
|
|
13
13
|
export const ChatMessageList = ({ children, autoScroll = true, className = '', 'aria-label': ariaLabel = 'Chat messages', }) => {
|
|
14
14
|
const ref = useRef(null);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* ChatMessageStack Component Styles */
|
|
2
|
+
|
|
3
|
+
.muka-chat-message-stack {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--chatbubble-stack-gap);
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.muka-chat-message-stack__messages {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--chatbubble-stack-gap);
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Reasoning sits above the stack, indented past the avatar rail so it lines up
|
|
20
|
+
* with the bubbles rather than with the avatar (Figma 5379:47300).
|
|
21
|
+
*/
|
|
22
|
+
.muka-chat-message-stack__reasoning {
|
|
23
|
+
min-width: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.muka-chat-message-stack--has-avatar .muka-chat-message-stack__reasoning {
|
|
27
|
+
padding-left: calc(var(--chatbubble-avatar-size) + var(--chatbubble-row-gap));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.muka-chat-message-stack--own.muka-chat-message-stack--has-avatar
|
|
31
|
+
.muka-chat-message-stack__reasoning {
|
|
32
|
+
padding-left: 0;
|
|
33
|
+
padding-right: calc(var(--chatbubble-avatar-size) + var(--chatbubble-row-gap));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Follow the message's compact rail and gap below the desktop breakpoint */
|
|
37
|
+
@media (max-width: 1023px) {
|
|
38
|
+
.muka-chat-message-stack--has-avatar .muka-chat-message-stack__reasoning {
|
|
39
|
+
padding-left: calc(
|
|
40
|
+
var(--chatbubble-avatar-size-compact) + var(--chatbubble-row-gap-compact)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.muka-chat-message-stack--own.muka-chat-message-stack--has-avatar
|
|
45
|
+
.muka-chat-message-stack__reasoning {
|
|
46
|
+
padding-left: 0;
|
|
47
|
+
padding-right: calc(
|
|
48
|
+
var(--chatbubble-avatar-size-compact) + var(--chatbubble-row-gap-compact)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|