@micha.bigler/ui-core-micha 4.29.2 → 4.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/chat/ChatComposer.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.30.0 - UCM-CHAT-19
|
|
4
|
+
|
|
5
|
+
`ChatComposer` `layout="compact"` without `context`: the `actions` (the model picker) now sit in the input row before Send/Stop and
|
|
6
|
+
no context row is rendered, which saves a row of about 35 px on a phone. They shrink and clip (max 45% of the row) before the input
|
|
7
|
+
or Send is pushed out, so nothing wraps at 320 px. With a `context` the layout is unchanged (context row, actions at its end), as
|
|
8
|
+
are the standard layout, the notice and the usage limit. Every compact consumer without context gets the new arrangement with its next
|
|
9
|
+
pin bump.
|
|
10
|
+
|
|
3
11
|
## 4.29.2 - UCM-CHAT-16 follow-up
|
|
4
12
|
|
|
5
13
|
The narrow thread no longer has a viewport-height floor (`min-height: 50vh`, 4.29.0): in a host box shorter than that floor plus the
|
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ rows: a context row with the host's content (for example chips of what was added
|
|
|
190
190
|
its end — one line that never wraps, the host content is clipped first (plain text gets an ellipsis; give element
|
|
191
191
|
items `minWidth: 0` and their own ellipsis, as MUI `Chip` labels have, and a "+n" item, so they shorten instead of
|
|
192
192
|
being cut) — and a full-width input with an icon Send that
|
|
193
|
-
becomes Stop ("Antwort stoppen") while an answer runs. The model button then shows a short label ("Sonnet · Gründlich")
|
|
193
|
+
becomes Stop ("Antwort stoppen") while an answer runs. Without host context (nothing returned by `renderComposerContext`) there is no first row: the model choice sits in the input row before Send/Stop (since 4.30.0, UCM-CHAT-19). The model button then shows a short label ("Sonnet · Gründlich")
|
|
194
194
|
without vendor and version. The long-chat hint becomes one line with "Neuer Chat" and a close button; closed, it stays
|
|
195
195
|
closed for that chat until the page reloads, and another chat shows it again. `renderComposerExtra` keeps rendering
|
|
196
196
|
above the composer. Without `composerLayout` the composer is unchanged. `ChatComposer` takes the same `layout`,
|
|
@@ -11,7 +11,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
11
11
|
*
|
|
12
12
|
* `layout="compact"` (UCM-CHAT-7) stacks an optional one-line `notice` (`{ text, action, onAction, onDismiss }`),
|
|
13
13
|
* a context row (`context`, then `actions` at its end; never wraps, the context is clipped first) and a full-width
|
|
14
|
-
* input row with an icon Send that becomes Stop while running.
|
|
14
|
+
* input row with an icon Send that becomes Stop while running. Without `context` there is no context row: the `actions`
|
|
15
|
+
* sit in the input row before Send/Stop (UCM-CHAT-19). The default `standard` layout is unchanged.
|
|
15
16
|
*/
|
|
16
17
|
export const CHAT_COMPOSER_INPUT_SX = { flex: '1 1 12rem', minWidth: 0 };
|
|
17
18
|
export const CHAT_COMPOSER_COMPACT_ROOT_SX = { display: 'flex', flexDirection: 'column', gap: 0.75, p: { xs: 1, md: 1.5 }, borderTop: 1, borderColor: 'divider', minWidth: 0, contain: 'layout paint' };
|
|
@@ -21,6 +22,8 @@ export const CHAT_COMPOSER_CONTEXT_SX = { minWidth: 0, flex: '1 1 auto', overflo
|
|
|
21
22
|
export const CHAT_COMPOSER_CONTEXT_ACTIONS_SX = { flex: '0 0 auto', minWidth: 0, whiteSpace: 'nowrap' };
|
|
22
23
|
export const CHAT_COMPOSER_INPUT_ROW_SX = { display: 'flex', alignItems: 'flex-end', gap: 0.5, minWidth: 0, p: '3px 3px 3px 10px', border: 1, borderColor: 'divider', borderRadius: 1, '&:focus-within': { borderColor: 'primary.main', boxShadow: (theme) => `0 0 0 2px ${theme.palette.primary.main}33` } };
|
|
23
24
|
export const CHAT_COMPOSER_COMPACT_FIELD_SX = { flex: '1 1 auto', minWidth: 0, '& .MuiOutlinedInput-root': { p: 0, alignItems: 'flex-end' }, '& .MuiOutlinedInput-notchedOutline': { border: 0 }, '& .MuiInputBase-inputMultiline': { px: 0, py: 1.5, maxHeight: '7.5em', overflowY: 'auto' } };
|
|
25
|
+
// Without a context the actions (the model picker) sit in the input row before Send/Stop (UCM-CHAT-19); they shrink and clip before the input or Send is pushed out.
|
|
26
|
+
export const CHAT_COMPOSER_INPUT_ACTIONS_SX = { flex: '0 1 auto', minWidth: 0, maxWidth: '45%', overflow: 'hidden', alignSelf: 'center', whiteSpace: 'nowrap' };
|
|
24
27
|
export const CHAT_COMPOSER_ACTION_SX = { width: 36, height: 36, flex: '0 0 36px' };
|
|
25
28
|
// Send is the filled primary action of the input row, as in the prototype; Stop keeps the plain icon button.
|
|
26
29
|
export const CHAT_COMPOSER_SEND_SX = Object.assign(Object.assign({}, CHAT_COMPOSER_ACTION_SX), { bgcolor: 'primary.main', color: 'primary.contrastText', '&:hover': { bgcolor: 'primary.dark' }, '&.Mui-disabled': { bgcolor: 'action.disabledBackground', color: 'action.disabled' } });
|
|
@@ -113,8 +116,10 @@ export function ChatComposer({ value, onChange, onSend, onStop, onComposeStart,
|
|
|
113
116
|
submit();
|
|
114
117
|
}
|
|
115
118
|
};
|
|
119
|
+
// 0 and '' are values a host may render; only nothing at all (null, undefined, false) means there is no context.
|
|
120
|
+
const hasContext = context !== null && context !== undefined && context !== false;
|
|
116
121
|
if (layout === 'compact')
|
|
117
|
-
return (_jsxs(Stack, { sx: sx ? [CHAT_COMPOSER_COMPACT_ROOT_SX, sx] : CHAT_COMPOSER_COMPACT_ROOT_SX, children: [_jsx(CompactNotice, { notice: notice, t: t }), _jsx(UsageLimit, { usageLimit: usageLimit, t: t, language: language }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: CHAT_COMPOSER_CONTEXT_ROW_SX, children: [_jsx(Box, { sx: CHAT_COMPOSER_CONTEXT_SX, children: context }), actions ? _jsx(Box, { sx: CHAT_COMPOSER_CONTEXT_ACTIONS_SX, children: actions }) : null] }), _jsxs(Stack, { direction: "row", alignItems: "flex-end", sx: CHAT_COMPOSER_INPUT_ROW_SX, children: [_jsx(TextField, { multiline: true, maxRows: 5, variant: "outlined", sx: CHAT_COMPOSER_COMPACT_FIELD_SX, size: "small", value: draft, inputRef: inputRef, disabled: blocked, placeholder: t('Chat.message'), slotProps: { htmlInput: { 'aria-label': t('Chat.message') } }, onFocus: handleFocus, onChange: (event) => changeDraft(event.target.value), onKeyDown: handleKeyDown }), running
|
|
122
|
+
return (_jsxs(Stack, { sx: sx ? [CHAT_COMPOSER_COMPACT_ROOT_SX, sx] : CHAT_COMPOSER_COMPACT_ROOT_SX, children: [_jsx(CompactNotice, { notice: notice, t: t }), _jsx(UsageLimit, { usageLimit: usageLimit, t: t, language: language }), hasContext ? (_jsxs(Stack, { direction: "row", alignItems: "center", sx: CHAT_COMPOSER_CONTEXT_ROW_SX, children: [_jsx(Box, { sx: CHAT_COMPOSER_CONTEXT_SX, children: context }), actions ? _jsx(Box, { sx: CHAT_COMPOSER_CONTEXT_ACTIONS_SX, children: actions }) : null] })) : null, _jsxs(Stack, { direction: "row", alignItems: "flex-end", sx: CHAT_COMPOSER_INPUT_ROW_SX, children: [_jsx(TextField, { multiline: true, maxRows: 5, variant: "outlined", sx: CHAT_COMPOSER_COMPACT_FIELD_SX, size: "small", value: draft, inputRef: inputRef, disabled: blocked, placeholder: t('Chat.message'), slotProps: { htmlInput: { 'aria-label': t('Chat.message') } }, onFocus: handleFocus, onChange: (event) => changeDraft(event.target.value), onKeyDown: handleKeyDown }), !hasContext && actions ? _jsx(Box, { sx: CHAT_COMPOSER_INPUT_ACTIONS_SX, children: actions }) : null, running
|
|
118
123
|
? _jsx(IconButton, { "aria-label": t('Chat.stopAnswer'), title: t('Chat.stopAnswer'), sx: CHAT_COMPOSER_ACTION_SX, onClick: onStop, children: _jsx(StopIcon, {}) })
|
|
119
124
|
: _jsx(IconButton, { "aria-label": t('Chat.send'), sx: CHAT_COMPOSER_SEND_SX, onClick: submit, disabled: !canSend, children: _jsx(SendIcon, { fontSize: "small" }) })] })] }));
|
|
120
125
|
return (_jsxs(Stack, { direction: "row", alignItems: "flex-end", flexWrap: "wrap", gap: 1, sx: Object.assign(Object.assign({}, CHAT_COMPOSER_STANDARD_ROOT_SX), sx), children: [usageLimit ? _jsx(Stack, { flexBasis: "100%", children: _jsx(UsageLimit, { usageLimit: usageLimit, t: t, language: language }) }) : null, _jsx(TextField, { multiline: true, maxRows: 6, sx: CHAT_COMPOSER_INPUT_SX, size: "small", value: draft, inputRef: inputRef, disabled: blocked, placeholder: t('Chat.message'), slotProps: { htmlInput: { 'aria-label': t('Chat.message') } }, onFocus: handleFocus, onChange: (event) => changeDraft(event.target.value), onKeyDown: handleKeyDown }), actions ? _jsx(Stack, { direction: "row", alignItems: "flex-end", children: actions }) : null, running ? _jsx(Button, { variant: "outlined", onClick: onStop, children: t('Chat.stop') }) : null, _jsx(Button, { variant: "contained", onClick: submit, disabled: !canSend, children: t('Chat.send') })] }));
|