@vertesia/ui 1.6.0-dev.20261004.085740Z → 1.6.0-dev.20261009.095813Z
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/README.md +24 -0
- package/lib/boot/vite.d.ts +3 -0
- package/lib/boot/vite.d.ts.map +1 -1
- package/lib/boot/vite.js +12 -0
- package/lib/boot/vite.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts +1 -0
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +2 -2
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/core/components/shadcn/selectBox.js +2 -2
- package/lib/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/core/components/shadcn/tabs.d.ts +2 -1
- package/lib/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/core/components/shadcn/tabs.js +6 -4
- package/lib/core/components/shadcn/tabs.js.map +1 -1
- package/lib/env/index.d.ts +9 -1
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +1 -1
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.js +16 -10
- package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.d.ts +7 -1
- package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.js +17 -16
- package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +2 -253
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.d.ts +1 -3
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.js +2 -8
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.d.ts +4 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.d.ts.map +1 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.js +248 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.js.map +1 -0
- package/lib/features/media-viewer/ImagePanel.d.ts +1 -1
- package/lib/features/media-viewer/ImagePanel.d.ts.map +1 -1
- package/lib/features/media-viewer/ImagePanel.js +40 -10
- package/lib/features/media-viewer/ImagePanel.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
- package/lib/i18n/locales/ar.json +15 -0
- package/lib/i18n/locales/de.json +15 -0
- package/lib/i18n/locales/en.json +15 -0
- package/lib/i18n/locales/es.json +15 -0
- package/lib/i18n/locales/fr.json +15 -0
- package/lib/i18n/locales/it.json +15 -0
- package/lib/i18n/locales/ja.json +15 -0
- package/lib/i18n/locales/ko.json +15 -0
- package/lib/i18n/locales/pt.json +15 -0
- package/lib/i18n/locales/ru.json +15 -0
- package/lib/i18n/locales/tr.json +15 -0
- package/lib/i18n/locales/zh-TW.json +15 -0
- package/lib/i18n/locales/zh.json +15 -0
- package/lib/session/auth/composable.d.ts +1 -5
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +1 -10
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/firebase.d.ts.map +1 -1
- package/lib/session/auth/firebase.js +8 -5
- package/lib/session/auth/firebase.js.map +1 -1
- package/lib/session/auth/oauth.d.ts.map +1 -1
- package/lib/session/auth/oauth.js +43 -17
- package/lib/session/auth/oauth.js.map +1 -1
- package/lib/session/auth/vertesiaHosts.d.ts +0 -40
- package/lib/session/auth/vertesiaHosts.d.ts.map +1 -1
- package/lib/session/auth/vertesiaHosts.js +2 -45
- package/lib/session/auth/vertesiaHosts.js.map +1 -1
- package/lib/session/index.d.ts +1 -1
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +1 -1
- package/lib/session/index.js.map +1 -1
- package/lib/session/scopeSelection.d.ts +4 -0
- package/lib/session/scopeSelection.d.ts.map +1 -1
- package/lib/session/scopeSelection.js +11 -0
- package/lib/session/scopeSelection.js.map +1 -1
- package/lib/shell/AuthScreenPreview.d.ts.map +1 -1
- package/lib/shell/AuthScreenPreview.js +1 -0
- package/lib/shell/AuthScreenPreview.js.map +1 -1
- package/lib/shell/login/SignInFlow.d.ts +3 -1
- package/lib/shell/login/SignInFlow.d.ts.map +1 -1
- package/lib/shell/login/SignInFlow.js +13 -4
- package/lib/shell/login/SignInFlow.js.map +1 -1
- package/lib/shell/login/SignInIcons.d.ts.map +1 -1
- package/lib/shell/login/SignInIcons.js +2 -1
- package/lib/shell/login/SignInIcons.js.map +1 -1
- package/lib/shell/login/SignInPasswordStep.d.ts +9 -0
- package/lib/shell/login/SignInPasswordStep.d.ts.map +1 -0
- package/lib/shell/login/SignInPasswordStep.js +58 -0
- package/lib/shell/login/SignInPasswordStep.js.map +1 -0
- package/lib/shell/login/SignInPrimitives.d.ts +13 -0
- package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
- package/lib/shell/login/SignInPrimitives.js +11 -1
- package/lib/shell/login/SignInPrimitives.js.map +1 -1
- package/lib/shell/login/SignInProvidersStep.d.ts +3 -1
- package/lib/shell/login/SignInProvidersStep.d.ts.map +1 -1
- package/lib/shell/login/SignInProvidersStep.js +4 -2
- package/lib/shell/login/SignInProvidersStep.js.map +1 -1
- package/lib/shell/login/SignInReturningStep.d.ts +3 -1
- package/lib/shell/login/SignInReturningStep.d.ts.map +1 -1
- package/lib/shell/login/SignInReturningStep.js +18 -8
- package/lib/shell/login/SignInReturningStep.js.map +1 -1
- package/lib/shell/login/SignInTenantStep.d.ts +3 -1
- package/lib/shell/login/SignInTenantStep.d.ts.map +1 -1
- package/lib/shell/login/SignInTenantStep.js +2 -2
- package/lib/shell/login/SignInTenantStep.js.map +1 -1
- package/lib/shell/login/SignInWithProviderButton.d.ts +5 -3
- package/lib/shell/login/SignInWithProviderButton.d.ts.map +1 -1
- package/lib/shell/login/SignInWithProviderButton.js +8 -7
- package/lib/shell/login/SignInWithProviderButton.js.map +1 -1
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +9 -3
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/signInUtils.d.ts +24 -4
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +53 -1
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-boot.js.map +1 -1
- package/lib/vertesia-ui-core.js +42 -42
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +574 -589
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.1NWiB6fw.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.1NWiB6fw.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.6Ozlf6Ks.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.6Ozlf6Ks.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.AttJpg8U.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.AttJpg8U.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BI_xdp49.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BI_xdp49.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.C-2EEX6w.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.C-2EEX6w.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CAmo54FO.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CAmo54FO.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CbBzmHNP.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CbBzmHNP.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DZgTzkIg.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DZgTzkIg.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DZsITxq5.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DZsITxq5.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.Dbf2GHth.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.Dbf2GHth.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.lleWnH5n.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.lleWnH5n.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.wG_XSkbr.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.wG_XSkbr.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +15 -15
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +40 -40
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +54 -47
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +47 -47
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +20 -20
- package/src/boot/vite.ts +15 -0
- package/src/core/components/shadcn/button.tsx +3 -2
- package/src/core/components/shadcn/selectBox.tsx +12 -4
- package/src/core/components/shadcn/tabs.tsx +9 -3
- package/src/css/index.css +1 -1
- package/src/css/typography.css +111 -88
- package/src/env/index.ts +10 -3
- package/src/features/agent/chat/AgentRequestInputOverlay.tsx +73 -34
- package/src/features/agent/chat/AskUserWidget.tsx +225 -206
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +2 -253
- package/src/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.tsx +2 -8
- package/src/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.ts +248 -0
- package/src/features/media-viewer/ImagePanel.tsx +51 -10
- package/src/features/store/types/IntakePolicyEditor.tsx +2 -1
- package/src/i18n/locales/ar.json +15 -0
- package/src/i18n/locales/de.json +15 -0
- package/src/i18n/locales/en.json +15 -0
- package/src/i18n/locales/es.json +15 -0
- package/src/i18n/locales/fr.json +15 -0
- package/src/i18n/locales/it.json +15 -0
- package/src/i18n/locales/ja.json +15 -0
- package/src/i18n/locales/ko.json +15 -0
- package/src/i18n/locales/pt.json +15 -0
- package/src/i18n/locales/ru.json +15 -0
- package/src/i18n/locales/tr.json +15 -0
- package/src/i18n/locales/zh-TW.json +15 -0
- package/src/i18n/locales/zh.json +15 -0
- package/src/session/auth/composable.ts +1 -11
- package/src/session/auth/firebase.ts +9 -6
- package/src/session/auth/oauth.ts +47 -16
- package/src/session/auth/vertesiaHosts.ts +2 -47
- package/src/session/index.ts +1 -1
- package/src/session/scopeSelection.ts +13 -0
- package/src/shell/AuthScreenPreview.tsx +1 -0
- package/src/shell/login/SignInFlow.tsx +23 -2
- package/src/shell/login/SignInIcons.tsx +2 -1
- package/src/shell/login/SignInPasswordStep.tsx +103 -0
- package/src/shell/login/SignInPrimitives.tsx +53 -1
- package/src/shell/login/SignInProvidersStep.tsx +8 -4
- package/src/shell/login/SignInReturningStep.tsx +20 -8
- package/src/shell/login/SignInTenantStep.tsx +6 -2
- package/src/shell/login/SignInWithProviderButton.tsx +11 -7
- package/src/shell/login/SigninScreen.tsx +8 -3
- package/src/shell/login/signInUtils.ts +68 -8
- package/lib/vertesia-ui-i18n.BCPusS2_.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BCPusS2_.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BHWlHchf.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BHWlHchf.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BkNx8SZu.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BkNx8SZu.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.C1LasLrO.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.C1LasLrO.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D8PQ5yKU.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D8PQ5yKU.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DUtVV1Bq.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DUtVV1Bq.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DgA36_k5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DgA36_k5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DmG-fjjZ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DmG-fjjZ.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DreWvQIk.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DreWvQIk.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.Pp8Tj48d.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.Pp8Tj48d.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.gais--x5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.gais--x5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.xkqaKpY_.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.xkqaKpY_.chunk.js.map +0 -1
|
@@ -64,6 +64,12 @@ export interface AskUserWidgetProps {
|
|
|
64
64
|
compact?: boolean;
|
|
65
65
|
/** Render as a resolved transcript prompt, without pending controls */
|
|
66
66
|
answered?: boolean;
|
|
67
|
+
/** Optional action beside the question, inside the existing card header. */
|
|
68
|
+
headerAction?: React.ReactNode;
|
|
69
|
+
/** ID of the response controls for an accessible disclosure action. */
|
|
70
|
+
responseControlsId?: string;
|
|
71
|
+
/** Hide response controls while keeping drafts and selections mounted. */
|
|
72
|
+
responseControlsHidden?: boolean;
|
|
67
73
|
|
|
68
74
|
// Styling props for full customization
|
|
69
75
|
/** Additional className for the outer container */
|
|
@@ -146,6 +152,9 @@ export function AskUserWidget({
|
|
|
146
152
|
hideBorder = false,
|
|
147
153
|
compact = false,
|
|
148
154
|
answered = false,
|
|
155
|
+
headerAction,
|
|
156
|
+
responseControlsId,
|
|
157
|
+
responseControlsHidden = false,
|
|
149
158
|
// Styling props
|
|
150
159
|
className,
|
|
151
160
|
cardClassName,
|
|
@@ -160,7 +169,6 @@ export function AskUserWidget({
|
|
|
160
169
|
submitButtonClassName,
|
|
161
170
|
}: AskUserWidgetProps) {
|
|
162
171
|
const { t } = useUITranslation();
|
|
163
|
-
const resolvedPlaceholder = placeholder ?? t('agent.typeYourResponse');
|
|
164
172
|
const resolvedSubmitLabel = submitLabel ?? t('agent.send');
|
|
165
173
|
const [inputValue, setInputValue] = React.useState('');
|
|
166
174
|
const [selectedOptions, setSelectedOptions] = React.useState<Set<string>>(new Set());
|
|
@@ -170,6 +178,9 @@ export function AskUserWidget({
|
|
|
170
178
|
const DefaultIcon = VARIANT_ICONS[variant];
|
|
171
179
|
const validOptions = isAskUserOptions(options);
|
|
172
180
|
const safeOptions = validOptions ? options : [];
|
|
181
|
+
// Next to predefined options the input is an alternative to picking one, not the whole prompt.
|
|
182
|
+
const resolvedPlaceholder =
|
|
183
|
+
placeholder ?? (safeOptions.length > 0 ? t('agent.typeDifferentResponse') : t('agent.typeYourResponse'));
|
|
173
184
|
const invalidOptionsReported = React.useRef(false);
|
|
174
185
|
|
|
175
186
|
React.useEffect(() => {
|
|
@@ -260,124 +271,127 @@ export function AskUserWidget({
|
|
|
260
271
|
)}
|
|
261
272
|
</div>
|
|
262
273
|
</div>
|
|
274
|
+
{headerAction}
|
|
263
275
|
</div>
|
|
264
276
|
</div>
|
|
265
277
|
|
|
266
|
-
{
|
|
267
|
-
|
|
268
|
-
{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
>
|
|
284
|
-
<input
|
|
285
|
-
type="checkbox"
|
|
286
|
-
checked={selected}
|
|
287
|
-
onChange={() => toggleOption(option.id)}
|
|
288
|
-
disabled={isLoading}
|
|
289
|
-
className="mt-1 size-4 rounded border-border bg-background text-info focus:ring-info"
|
|
290
|
-
/>
|
|
291
|
-
<span className="min-w-0 flex-1">
|
|
292
|
-
<span className="flex items-center gap-2 text-sm font-medium leading-5 text-foreground">
|
|
293
|
-
{option.icon}
|
|
294
|
-
<span className="break-words">{option.label}</span>
|
|
295
|
-
</span>
|
|
296
|
-
{option.description && (
|
|
297
|
-
<span className="mt-0.5 block break-words text-xs leading-5 text-muted">
|
|
298
|
-
{option.description}
|
|
299
|
-
</span>
|
|
278
|
+
<div id={responseControlsId} hidden={responseControlsHidden}>
|
|
279
|
+
{safeOptions.length > 0 && (
|
|
280
|
+
<div className={cn('flex flex-col gap-1.5 px-3 pb-3 pt-0', optionsClassName)}>
|
|
281
|
+
{multiSelect ? (
|
|
282
|
+
<>
|
|
283
|
+
{safeOptions.map((option) => {
|
|
284
|
+
const selected = selectedOptions.has(option.id);
|
|
285
|
+
return (
|
|
286
|
+
<label
|
|
287
|
+
key={option.id}
|
|
288
|
+
className={cn(
|
|
289
|
+
'flex cursor-pointer items-start gap-2.5 rounded-md border px-3 py-2 text-start transition-colors',
|
|
290
|
+
selected
|
|
291
|
+
? 'border-info/60 bg-info/10'
|
|
292
|
+
: 'border-border bg-background/70 hover:bg-mixer-muted/15',
|
|
293
|
+
isLoading && 'cursor-not-allowed opacity-50',
|
|
294
|
+
buttonClassName,
|
|
300
295
|
)}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
296
|
+
>
|
|
297
|
+
<input
|
|
298
|
+
type="checkbox"
|
|
299
|
+
checked={selected}
|
|
300
|
+
onChange={() => toggleOption(option.id)}
|
|
301
|
+
disabled={isLoading}
|
|
302
|
+
className="mt-1 size-4 rounded border-border bg-background text-info focus:ring-info"
|
|
303
|
+
/>
|
|
304
|
+
<span className="min-w-0 flex-1">
|
|
305
|
+
<span className="flex items-center gap-2 text-sm font-medium leading-5 text-foreground">
|
|
306
|
+
{option.icon}
|
|
307
|
+
<span className="break-words">{option.label}</span>
|
|
308
|
+
</span>
|
|
309
|
+
{option.description && (
|
|
310
|
+
<span className="mt-0.5 block break-words text-xs leading-5 text-muted">
|
|
311
|
+
{option.description}
|
|
312
|
+
</span>
|
|
313
|
+
)}
|
|
314
|
+
</span>
|
|
315
|
+
</label>
|
|
316
|
+
);
|
|
317
|
+
})}
|
|
318
|
+
<div className="pt-1">
|
|
319
|
+
<Button
|
|
320
|
+
size="sm"
|
|
321
|
+
onClick={handleMultiSubmit}
|
|
322
|
+
disabled={isLoading || selectedOptions.size === 0}
|
|
323
|
+
className="inline-flex items-center gap-2"
|
|
324
|
+
>
|
|
325
|
+
<Send className="size-4" />
|
|
326
|
+
{selectedOptions.size > 0
|
|
327
|
+
? t('agent.submitSelectionCount', { count: selectedOptions.size })
|
|
328
|
+
: t('agent.submitSelection')}
|
|
329
|
+
</Button>
|
|
330
|
+
</div>
|
|
331
|
+
</>
|
|
332
|
+
) : (
|
|
333
|
+
safeOptions.map((option) => (
|
|
334
|
+
<button
|
|
335
|
+
type="button"
|
|
336
|
+
key={option.id}
|
|
337
|
+
onClick={() => onSelect?.(option.id)}
|
|
338
|
+
disabled={isLoading}
|
|
339
|
+
className={cn(
|
|
340
|
+
'flex w-full cursor-pointer items-start gap-2.5 rounded-md border border-border bg-background/70 px-3 py-2 text-start transition-colors',
|
|
341
|
+
'hover:bg-mixer-muted/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
342
|
+
isLoading && 'cursor-not-allowed opacity-50',
|
|
343
|
+
buttonClassName,
|
|
344
|
+
)}
|
|
311
345
|
>
|
|
312
|
-
<
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
346
|
+
<span
|
|
347
|
+
className="mt-1 size-4 flex-shrink-0 rounded-full border border-border"
|
|
348
|
+
aria-hidden="true"
|
|
349
|
+
/>
|
|
350
|
+
<span className="min-w-0 flex-1">
|
|
351
|
+
<span className="flex items-center gap-2 text-sm font-medium leading-5 text-foreground">
|
|
352
|
+
{option.icon}
|
|
353
|
+
<span className="break-words">{option.label}</span>
|
|
354
|
+
</span>
|
|
355
|
+
{option.description && (
|
|
356
|
+
<span className="mt-0.5 block break-words text-xs leading-5 text-muted">
|
|
357
|
+
{option.description}
|
|
358
|
+
</span>
|
|
359
|
+
)}
|
|
360
|
+
</span>
|
|
361
|
+
</button>
|
|
362
|
+
))
|
|
363
|
+
)}
|
|
364
|
+
</div>
|
|
365
|
+
)}
|
|
366
|
+
|
|
367
|
+
{allowFreeResponse && (
|
|
368
|
+
<div className={cn('px-3 pb-3 pt-0', inputContainerClassName)}>
|
|
369
|
+
<div className="flex gap-2">
|
|
370
|
+
<input
|
|
371
|
+
ref={inputRef}
|
|
372
|
+
type="text"
|
|
373
|
+
value={inputValue}
|
|
374
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
375
|
+
onKeyDown={handleKeyDown}
|
|
376
|
+
placeholder={resolvedPlaceholder}
|
|
325
377
|
disabled={isLoading}
|
|
326
378
|
className={cn(
|
|
327
|
-
'
|
|
328
|
-
|
|
329
|
-
isLoading && 'cursor-not-allowed opacity-50',
|
|
330
|
-
buttonClassName,
|
|
379
|
+
'min-w-0 flex-1 rounded-md border border-border bg-background/70 px-3 py-2 text-sm text-foreground focus:border-transparent focus:ring-2 focus:ring-ring',
|
|
380
|
+
inputClassName,
|
|
331
381
|
)}
|
|
382
|
+
/>
|
|
383
|
+
<Button
|
|
384
|
+
size="sm"
|
|
385
|
+
onClick={handleSubmit}
|
|
386
|
+
disabled={isLoading || !inputValue.trim()}
|
|
387
|
+
className={submitButtonClassName}
|
|
332
388
|
>
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
/>
|
|
337
|
-
<span className="min-w-0 flex-1">
|
|
338
|
-
<span className="flex items-center gap-2 text-sm font-medium leading-5 text-foreground">
|
|
339
|
-
{option.icon}
|
|
340
|
-
<span className="break-words">{option.label}</span>
|
|
341
|
-
</span>
|
|
342
|
-
{option.description && (
|
|
343
|
-
<span className="mt-0.5 block break-words text-xs leading-5 text-muted">
|
|
344
|
-
{option.description}
|
|
345
|
-
</span>
|
|
346
|
-
)}
|
|
347
|
-
</span>
|
|
348
|
-
</button>
|
|
349
|
-
))
|
|
350
|
-
)}
|
|
351
|
-
</div>
|
|
352
|
-
)}
|
|
353
|
-
|
|
354
|
-
{allowFreeResponse && (
|
|
355
|
-
<div className={cn('px-3 pb-3 pt-0', inputContainerClassName)}>
|
|
356
|
-
<div className="flex gap-2">
|
|
357
|
-
<input
|
|
358
|
-
ref={inputRef}
|
|
359
|
-
type="text"
|
|
360
|
-
value={inputValue}
|
|
361
|
-
onChange={(e) => setInputValue(e.target.value)}
|
|
362
|
-
onKeyDown={handleKeyDown}
|
|
363
|
-
placeholder={resolvedPlaceholder}
|
|
364
|
-
disabled={isLoading}
|
|
365
|
-
className={cn(
|
|
366
|
-
'min-w-0 flex-1 rounded-md border border-border bg-background/70 px-3 py-2 text-sm text-foreground focus:border-transparent focus:ring-2 focus:ring-ring',
|
|
367
|
-
inputClassName,
|
|
368
|
-
)}
|
|
369
|
-
/>
|
|
370
|
-
<Button
|
|
371
|
-
size="sm"
|
|
372
|
-
onClick={handleSubmit}
|
|
373
|
-
disabled={isLoading || !inputValue.trim()}
|
|
374
|
-
className={submitButtonClassName}
|
|
375
|
-
>
|
|
376
|
-
{isLoading ? '...' : resolvedSubmitLabel}
|
|
377
|
-
</Button>
|
|
389
|
+
{isLoading ? '...' : resolvedSubmitLabel}
|
|
390
|
+
</Button>
|
|
391
|
+
</div>
|
|
378
392
|
</div>
|
|
379
|
-
|
|
380
|
-
|
|
393
|
+
)}
|
|
394
|
+
</div>
|
|
381
395
|
</div>
|
|
382
396
|
</div>
|
|
383
397
|
);
|
|
@@ -408,124 +422,129 @@ export function AskUserWidget({
|
|
|
408
422
|
)}
|
|
409
423
|
</div>
|
|
410
424
|
</div>
|
|
425
|
+
{headerAction}
|
|
411
426
|
</div>
|
|
412
427
|
</div>
|
|
413
428
|
|
|
414
|
-
{
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
429
|
+
<div id={responseControlsId} hidden={responseControlsHidden}>
|
|
430
|
+
{/* Options */}
|
|
431
|
+
{safeOptions.length > 0 && (
|
|
432
|
+
<div className={`px-4 pb-3 pt-1 ${optionsClassName || ''}`}>
|
|
433
|
+
{multiSelect ? (
|
|
434
|
+
/* Multi-select mode with checkboxes */
|
|
435
|
+
<div className="space-y-2">
|
|
436
|
+
{safeOptions.map((option) => (
|
|
437
|
+
<label
|
|
438
|
+
key={option.id}
|
|
439
|
+
className={`flex items-start gap-3 px-4 py-3 rounded-lg cursor-pointer transition-colors
|
|
424
440
|
${
|
|
425
441
|
selectedOptions.has(option.id)
|
|
426
442
|
? 'bg-info border border-info'
|
|
427
443
|
: 'bg-card text-card-foreground border border-border hover:bg-muted'
|
|
428
444
|
}
|
|
429
445
|
${isLoading ? 'opacity-50 cursor-not-allowed' : ''}`}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
</div>
|
|
443
|
-
{option.description && (
|
|
444
|
-
<div className="mt-1 text-sm text-muted break-words whitespace-pre-wrap">
|
|
445
|
-
{option.description}
|
|
446
|
+
>
|
|
447
|
+
<input
|
|
448
|
+
type="checkbox"
|
|
449
|
+
checked={selectedOptions.has(option.id)}
|
|
450
|
+
onChange={() => toggleOption(option.id)}
|
|
451
|
+
disabled={isLoading}
|
|
452
|
+
className="mt-0.5 w-4 h-4 rounded border-border text-info focus:ring-info bg-background"
|
|
453
|
+
/>
|
|
454
|
+
<div className="flex-1 overflow-hidden">
|
|
455
|
+
<div className="flex items-center gap-2 text-sm font-medium text-foreground break-words">
|
|
456
|
+
{option.icon}
|
|
457
|
+
<span className="break-words">{option.label}</span>
|
|
446
458
|
</div>
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
459
|
+
{option.description && (
|
|
460
|
+
<div className="mt-1 text-sm text-muted break-words whitespace-pre-wrap">
|
|
461
|
+
{option.description}
|
|
462
|
+
</div>
|
|
463
|
+
)}
|
|
464
|
+
</div>
|
|
465
|
+
</label>
|
|
466
|
+
))}
|
|
467
|
+
<div className="pt-2">
|
|
468
|
+
<Button
|
|
469
|
+
size="sm"
|
|
470
|
+
onClick={handleMultiSubmit}
|
|
471
|
+
disabled={isLoading || selectedOptions.size === 0}
|
|
472
|
+
className="flex items-center gap-2"
|
|
473
|
+
>
|
|
474
|
+
<Send className="size-4" />
|
|
475
|
+
{selectedOptions.size > 0
|
|
476
|
+
? t('agent.submitSelectionCount', { count: selectedOptions.size })
|
|
477
|
+
: t('agent.submitSelection')}
|
|
478
|
+
</Button>
|
|
479
|
+
</div>
|
|
463
480
|
</div>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
className={`w-full h-auto whitespace-normal text-start px-4 py-3 rounded-lg border border-border
|
|
481
|
+
) : (
|
|
482
|
+
/* Single-select mode - always use full-width card layout for clarity */
|
|
483
|
+
<div className="flex flex-col gap-2 w-full">
|
|
484
|
+
{safeOptions.map((option) => (
|
|
485
|
+
<Button
|
|
486
|
+
variant="unstyled"
|
|
487
|
+
key={option.id}
|
|
488
|
+
onClick={() => onSelect?.(option.id)}
|
|
489
|
+
disabled={isLoading}
|
|
490
|
+
className={`w-full h-auto whitespace-normal text-start px-4 py-3 rounded-lg border border-border
|
|
475
491
|
bg-card text-card-foreground
|
|
476
492
|
hover:bg-muted hover:border-border
|
|
477
493
|
focus:outline-none focus:ring-2 focus:ring-info focus:ring-offset-1
|
|
478
494
|
transition-colors
|
|
479
495
|
${isLoading ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}
|
|
480
496
|
${buttonClassName || ''}`}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
<div className="font-medium text-sm text-foreground break-words text-center">
|
|
488
|
-
{option.label}
|
|
489
|
-
</div>
|
|
490
|
-
{option.description && (
|
|
491
|
-
<div className="mt-1 text-sm text-muted break-words whitespace-pre-wrap">
|
|
492
|
-
{option.description}
|
|
493
|
-
</div>
|
|
497
|
+
>
|
|
498
|
+
<div className="flex items-start gap-3">
|
|
499
|
+
{option.icon && (
|
|
500
|
+
<span className="flex-shrink-0 mt-0.5 text-muted">
|
|
501
|
+
{option.icon}
|
|
502
|
+
</span>
|
|
494
503
|
)}
|
|
504
|
+
<div className="flex-1 overflow-hidden">
|
|
505
|
+
<div className="font-medium text-sm text-foreground break-words text-center">
|
|
506
|
+
{option.label}
|
|
507
|
+
</div>
|
|
508
|
+
{option.description && (
|
|
509
|
+
<div className="mt-1 text-sm text-muted break-words whitespace-pre-wrap">
|
|
510
|
+
{option.description}
|
|
511
|
+
</div>
|
|
512
|
+
)}
|
|
513
|
+
</div>
|
|
495
514
|
</div>
|
|
496
|
-
</
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
)}
|
|
515
|
+
</Button>
|
|
516
|
+
))}
|
|
517
|
+
</div>
|
|
518
|
+
)}
|
|
519
|
+
</div>
|
|
520
|
+
)}
|
|
503
521
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
522
|
+
{/* Free-form input */}
|
|
523
|
+
{allowFreeResponse && (
|
|
524
|
+
<div className={`px-4 pb-3 pt-1 ${inputContainerClassName || ''}`}>
|
|
525
|
+
<div className="flex gap-2">
|
|
526
|
+
<input
|
|
527
|
+
ref={inputRef}
|
|
528
|
+
type="text"
|
|
529
|
+
value={inputValue}
|
|
530
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
531
|
+
onKeyDown={handleKeyDown}
|
|
532
|
+
placeholder={resolvedPlaceholder}
|
|
533
|
+
disabled={isLoading}
|
|
534
|
+
className={`flex-1 px-3 py-2 text-sm border border-border rounded-md bg-card text-card-foreground focus:ring-2 focus:ring-info focus:border-transparent ${inputClassName || ''}`}
|
|
535
|
+
/>
|
|
536
|
+
<Button
|
|
537
|
+
size="sm"
|
|
538
|
+
onClick={handleSubmit}
|
|
539
|
+
disabled={isLoading || !inputValue.trim()}
|
|
540
|
+
className={submitButtonClassName}
|
|
541
|
+
>
|
|
542
|
+
{isLoading ? '...' : resolvedSubmitLabel}
|
|
543
|
+
</Button>
|
|
544
|
+
</div>
|
|
526
545
|
</div>
|
|
527
|
-
|
|
528
|
-
|
|
546
|
+
)}
|
|
547
|
+
</div>
|
|
529
548
|
</div>
|
|
530
549
|
</div>
|
|
531
550
|
);
|