@flamingo-stack/openframe-frontend-core 0.0.829 → 0.0.830
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/dist/build/export-map.json +1 -1
- package/dist/{chunk-DU6AF77X.cjs → chunk-2BGLALP5.cjs} +14 -14
- package/dist/{chunk-MFYSV7DE.cjs → chunk-56EP4QM2.cjs} +24 -24
- package/dist/{chunk-IHRMX3X6.cjs → chunk-5KSPG3TV.cjs} +357 -357
- package/dist/{chunk-UO6F6LLI.cjs → chunk-5LED4QHZ.cjs} +508 -451
- package/dist/{chunk-IMDYB77M.cjs → chunk-CAGQAMJ6.cjs} +21 -21
- package/dist/{chunk-4DUVTJ6A.cjs → chunk-D2LXFMZI.cjs} +22 -22
- package/dist/{chunk-LNXRTVOY.cjs → chunk-DUGOOTER.cjs} +11 -11
- package/dist/{chunk-R3PKAIX3.cjs → chunk-E6W4YDPS.cjs} +2 -2
- package/dist/{chunk-AH4YWTWZ.cjs → chunk-FFFN4IY2.cjs} +5 -5
- package/dist/{chunk-THPAGFT6.cjs → chunk-HYCMMECU.cjs} +44 -44
- package/dist/{chunk-UE5ZBCJ4.cjs → chunk-HYGWRUEM.cjs} +3 -3
- package/dist/{chunk-ZJXLNIWC.cjs → chunk-M75723HD.cjs} +8 -8
- package/dist/{chunk-IBQ3CSKL.cjs → chunk-PUXYAHH3.cjs} +3 -3
- package/dist/{chunk-3B6ZE4EZ.cjs → chunk-QTLWU6FY.cjs} +5 -5
- package/dist/{chunk-HMC2IWV4.cjs → chunk-RRPID7Z7.cjs} +6 -6
- package/dist/{chunk-6WNSZ5XP.cjs → chunk-SAW7V7CU.cjs} +13 -13
- package/dist/{chunk-4ZIKDOPY.cjs → chunk-TUMSVFVS.cjs} +4 -4
- package/dist/{chunk-DWSU35QQ.cjs → chunk-ULF4ZOUM.cjs} +57 -57
- package/dist/{chunk-IFLGIBFZ.cjs → chunk-WCCE4WF3.cjs} +50 -50
- package/dist/{chunk-7PZQ7SHB.cjs → chunk-WWDNLMB7.cjs} +16 -16
- package/dist/{chunk-PRZAEPGG.cjs → chunk-WZYBUJJG.cjs} +41 -41
- package/dist/{chunk-YHQDB5QJ.cjs → chunk-X425BGXS.cjs} +2 -2
- package/dist/{chunk-BIG3O33P.cjs → chunk-YJZ7R3W5.cjs} +28 -2
- package/dist/{cloud-tenants-YVCSVVIS.cjs → cloud-tenants-4KQQPXPM.cjs} +9 -9
- package/dist/components/case-studies/index.cjs +21 -21
- package/dist/components/chat/embeddable-chat.d.ts +3 -3
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +21 -14
- package/dist/components/chat/guide-welcome.d.ts +5 -16
- package/dist/components/chat/guide-welcome.d.ts.map +1 -1
- package/dist/components/chat/guide-welcome.js +4 -29
- package/dist/components/chat/index.cjs +9 -5
- package/dist/components/chat/mingo-quick-action-wall.d.ts +42 -16
- package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -1
- package/dist/components/chat/mingo-quick-action-wall.js +105 -19
- package/dist/components/chat/mingo-welcome.d.ts +6 -13
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/mingo-welcome.js +5 -9
- package/dist/components/chat/quick-action-chip.d.ts +8 -2
- package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
- package/dist/components/chat/quick-action-chip.js +18 -8
- package/dist/components/contact/index.cjs +10 -10
- package/dist/components/docs/index.cjs +13 -13
- package/dist/components/embeds/index.cjs +10 -10
- package/dist/components/faq/index.cjs +11 -11
- package/dist/components/features/index.cjs +9 -9
- package/dist/components/help-center-pages/index.cjs +71 -71
- package/dist/components/index.cjs +47 -43
- package/dist/components/meeting-scheduler/index.cjs +41 -41
- package/dist/components/navigation/index.cjs +12 -12
- package/dist/components/onboarding-guides/index.cjs +11 -11
- package/dist/components/product-demo/index.cjs +20 -20
- package/dist/components/tickets/index.cjs +14 -14
- package/dist/components/ui/actions-menu.d.ts.map +1 -1
- package/dist/components/ui/actions-menu.js +27 -1
- package/dist/components/ui/index.cjs +13 -9
- package/dist/{devices-AW6BERJF.cjs → devices-H6C4NMIY.cjs} +10 -10
- package/dist/{embeddable-chat-ZJIOMMSA.cjs → embeddable-chat-KUESE7P6.cjs} +104 -97
- package/dist/index.cjs +17 -13
- package/dist/{knowledge-PEOXTIVS.cjs → knowledge-O6IBO5Y5.cjs} +10 -10
- package/dist/{logs-CYA7H4KM.cjs → logs-Y2UCF24Z.cjs} +16 -16
- package/dist/{policies-M6QSFL5G.cjs → policies-J6O3RLJT.cjs} +13 -13
- package/dist/{remote-session-QGFG5WAL.cjs → remote-session-RVTFWSU4.cjs} +5 -5
- package/dist/{scripts-Y46ECDDP.cjs → scripts-N67MM4T2.cjs} +16 -16
- package/dist/{software-update-OTC2DGQZ.cjs → software-update-HB7F6KNG.cjs} +13 -13
- package/dist/{tickets-board-KCH6ITUV.cjs → tickets-board-2K3PBCNW.cjs} +8 -8
- package/package.json +1 -1
- package/src/components/chat/embeddable-chat.tsx +29 -45
- package/src/components/chat/guide-welcome.tsx +12 -57
- package/src/components/chat/mingo-quick-action-wall.tsx +166 -31
- package/src/components/chat/mingo-welcome.tsx +16 -35
- package/src/components/chat/quick-action-chip.tsx +32 -8
- package/src/components/ui/actions-menu.tsx +35 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { type ReactNode, useMemo } from 'react';
|
|
4
|
-
import { usePageTopicStamp } from '../../contexts/page-topics-context';
|
|
5
4
|
import { cn } from '../../utils/cn';
|
|
6
5
|
import { AgentMark } from '../agent-mark';
|
|
7
6
|
import { EntityIcon } from '../icon-display';
|
|
8
7
|
import { TextLineSkeleton } from '../loading/unified-skeleton';
|
|
9
|
-
import { PageTopicLabel } from '../page-topic-label';
|
|
10
8
|
import { useLoadingScope } from '../ui/loading-scope';
|
|
11
9
|
import { ScrollFadeOverlay, useScrollFade } from '../ui/scroll-fade';
|
|
10
|
+
import { QuickActionSet } from './mingo-quick-action-wall';
|
|
12
11
|
import { accentFromIdentityIcon, type QuickActionAccent } from './quick-action-chip';
|
|
13
|
-
import { QuickActionWall } from './quick-action-wall';
|
|
14
12
|
|
|
15
13
|
// =============================================================================
|
|
16
14
|
// Types
|
|
@@ -50,10 +48,9 @@ export interface GuideWelcomeProps {
|
|
|
50
48
|
* `subtitle` is present. A loading scope draws the skeleton too. */
|
|
51
49
|
subtitleLoading?: boolean;
|
|
52
50
|
/** Quick-action chips — caller-provided; there are no built-in defaults, so
|
|
53
|
-
* the
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* the composer; click sends it. */
|
|
51
|
+
* the set is omitted entirely unless the host supplies actions. The first
|
|
52
|
+
* ones fill the set's slots and the rest open from its "More" slot; a click
|
|
53
|
+
* hands the action to `onQuickAction` (the chat puts its `prompt` into the composer). */
|
|
57
54
|
quickActions?: ReadonlyArray<GuideQuickAction>;
|
|
58
55
|
/** The host is still reading the chips (e.g. the quick actions of the page's
|
|
59
56
|
* topic): with none to show yet the wall draws its own loading form. A
|
|
@@ -66,15 +63,6 @@ export interface GuideWelcomeProps {
|
|
|
66
63
|
showTopic?: boolean;
|
|
67
64
|
/** Fired when a quick-action chip is activated (click). */
|
|
68
65
|
onQuickAction?: (action: GuideQuickAction) => void;
|
|
69
|
-
/** Pointer/keyboard focus enters a quick-action chip — e.g. preview the
|
|
70
|
-
* action's full `prompt` in the composer input. */
|
|
71
|
-
onQuickActionHover?: (action: GuideQuickAction) => void;
|
|
72
|
-
/** Pointer/keyboard focus leaves the chip — e.g. restore the composer. */
|
|
73
|
-
onQuickActionHoverEnd?: () => void;
|
|
74
|
-
/** Agent this empty state belongs to — forwarded to the quick-action
|
|
75
|
-
* {@link QuickActionWall} so a built-in agent (`'fae'`/`'mingo'`) caps the
|
|
76
|
-
* brick stack at 2 rows. Unset (host/guide mode) keeps the full `rows` cap. */
|
|
77
|
-
agentSlug?: string;
|
|
78
66
|
/** Slash-command onboarding list — rendered inside the shared scroll region
|
|
79
67
|
* below the greeting (so greeting + list scroll together, with edge fades). */
|
|
80
68
|
children?: ReactNode;
|
|
@@ -96,8 +84,7 @@ const DEFAULT_TITLE = 'Guide Mode Chat';
|
|
|
96
84
|
*
|
|
97
85
|
* Guide-mode chat empty state: a centred greeting and the slash-command
|
|
98
86
|
* onboarding list share one scroll region (with top/bottom fade affordances),
|
|
99
|
-
* and
|
|
100
|
-
* quick actions render as chips; the remainder collapse under a "⋯" menu.
|
|
87
|
+
* and the pinned quick-action set sits above the composer.
|
|
101
88
|
*
|
|
102
89
|
* Mirrors `MingoWelcome` (the default-mode empty state) — content is
|
|
103
90
|
* configurable with OpenFrame defaults.
|
|
@@ -111,15 +98,9 @@ export function GuideWelcome({
|
|
|
111
98
|
quickActionsLoading = false,
|
|
112
99
|
showTopic: showTopicProp,
|
|
113
100
|
onQuickAction,
|
|
114
|
-
onQuickActionHover,
|
|
115
|
-
onQuickActionHoverEnd,
|
|
116
|
-
agentSlug,
|
|
117
101
|
children,
|
|
118
102
|
className,
|
|
119
103
|
}: GuideWelcomeProps) {
|
|
120
|
-
// The host's choice (`PageTopicsProvider showTopic`) unless this surface states its own.
|
|
121
|
-
const topicStamp = usePageTopicStamp();
|
|
122
|
-
const showTopic = showTopicProp ?? topicStamp;
|
|
123
104
|
// Scroll-fade affordances: a 48px gradient at the top/bottom edge of the
|
|
124
105
|
// scroll region, shown only while content is actually hidden in that
|
|
125
106
|
// direction. (Same behaviour as MingoWelcome.)
|
|
@@ -130,11 +111,8 @@ export function GuideWelcome({
|
|
|
130
111
|
// The same switch for the chips (read data): the wall draws its loading form while there are none to show yet.
|
|
131
112
|
const chipsAreLoading = inLoadingScope || (quickActionsLoading && quickActions.length === 0);
|
|
132
113
|
|
|
133
|
-
// Map to the shared {@link QuickActionChip} shape
|
|
134
|
-
//
|
|
135
|
-
// the chat's quick actions read as "the work the agent does". Every chip
|
|
136
|
-
// stays interactive (clone copies included); `onHoverStart`/`onHoverEnd` drive
|
|
137
|
-
// the composer prompt preview and `onSelect` sends.
|
|
114
|
+
// Map to the shared {@link QuickActionChip} shape the chat's {@link QuickActionSet} draws (the set Mingo's empty
|
|
115
|
+
// state and the OpenFrame dock draw too). `onSelect` hands the action to the host.
|
|
138
116
|
const chipItems = useMemo(
|
|
139
117
|
() =>
|
|
140
118
|
quickActions.map(action => ({
|
|
@@ -152,10 +130,8 @@ export function GuideWelcome({
|
|
|
152
130
|
accent: action.accent ?? accentFromIdentityIcon(icon) ?? 'cyan',
|
|
153
131
|
},
|
|
154
132
|
onSelect: () => onQuickAction?.(action),
|
|
155
|
-
onHoverStart: () => onQuickActionHover?.(action),
|
|
156
|
-
onHoverEnd: () => onQuickActionHoverEnd?.(),
|
|
157
133
|
})),
|
|
158
|
-
[quickActions, icon, onQuickAction
|
|
134
|
+
[quickActions, icon, onQuickAction],
|
|
159
135
|
);
|
|
160
136
|
|
|
161
137
|
return (
|
|
@@ -211,32 +187,11 @@ export function GuideWelcome({
|
|
|
211
187
|
<ScrollFadeOverlay edge="bottom" visible={fadeBottom} className="h-12" />
|
|
212
188
|
</div>
|
|
213
189
|
|
|
214
|
-
{/*
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
chips packed edge-to-edge, drifting under left/right edge fades so a
|
|
218
|
-
long agent action set gets "reach" without squeezing the composer.
|
|
219
|
-
Chips stay directly hoverable — hover/focus previews the action's full
|
|
220
|
-
prompt in the composer, click sends it — and `pauseOnHover` freezes
|
|
221
|
-
the hovered row so a moving chip never dodges a click. */}
|
|
222
|
-
{/* Right-aligned and pulled against the chips, so it reads as a stamp on the wall, not a row of its own. */}
|
|
223
|
-
{showTopic && (
|
|
224
|
-
<PageTopicLabel className="-mb-[var(--spacing-system-xs)] shrink-0 px-[var(--spacing-system-l)] text-right" />
|
|
225
|
-
)}
|
|
190
|
+
{/* The quick actions, pinned above the composer: the static {@link QuickActionSet} (fixed slots, its height
|
|
191
|
+
set by the width alone, "More" for the rest). A click hands the action to `onQuickAction`. The set prints
|
|
192
|
+
the page's topic over itself. */}
|
|
226
193
|
{(quickActions.length > 0 || chipsAreLoading) && (
|
|
227
|
-
<
|
|
228
|
-
chips={chipItems}
|
|
229
|
-
loading={chipsAreLoading}
|
|
230
|
-
agentSlug={agentSlug}
|
|
231
|
-
rows={4}
|
|
232
|
-
pauseOnHover
|
|
233
|
-
dragScroll
|
|
234
|
-
fade={['left', 'right']}
|
|
235
|
-
fadeSize={{ left: 32 }}
|
|
236
|
-
fadeColor="var(--color-bg)"
|
|
237
|
-
copyGap="var(--spacing-system-xxs)"
|
|
238
|
-
className="max-h-44 shrink-0"
|
|
239
|
-
/>
|
|
194
|
+
<QuickActionSet chips={chipItems} loading={chipsAreLoading} showTopic={showTopicProp} />
|
|
240
195
|
)}
|
|
241
196
|
</div>
|
|
242
197
|
);
|
|
@@ -1,64 +1,199 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { usePageTopicStamp } from '../../contexts/page-topics-context';
|
|
3
5
|
import { cn } from '../../utils/cn';
|
|
6
|
+
import { Ellipsis01Icon } from '../icons-v2-generated';
|
|
7
|
+
import { PageTopicLabel } from '../page-topic-label';
|
|
8
|
+
import { ActionsMenuDropdown } from '../ui/actions-menu';
|
|
9
|
+
import { Button } from '../ui/button';
|
|
10
|
+
import { LoadingItems, useLoadingScope } from '../ui/loading-scope';
|
|
4
11
|
import type { MingoQuickAction } from './mingo-welcome';
|
|
5
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
QuickActionChipButton,
|
|
14
|
+
QuickActionChipFromData,
|
|
15
|
+
type QuickActionChip,
|
|
16
|
+
type QuickActionThemeSpec,
|
|
17
|
+
isQuickActionIconSpec,
|
|
18
|
+
renderQuickActionIcon,
|
|
19
|
+
} from './quick-action-chip';
|
|
20
|
+
import { WALL_SKELETON_LABEL_CH } from './quick-action-wall';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The slots a chat's quick-action set holds: what it shows, and what it reserves. Suggested-prompt research and
|
|
24
|
+
* every leading AI chat show three to five starters at once (NN/g, "Designing use-case prompt suggestions", 2025;
|
|
25
|
+
* ChatGPT, Claude, Gemini, Copilot), so four slots, the last one "More" when there are more actions.
|
|
26
|
+
*/
|
|
27
|
+
export const QUICK_ACTION_SET_SLOTS = 4;
|
|
28
|
+
|
|
29
|
+
export interface QuickActionSetProps {
|
|
30
|
+
/** The actions, in the order to show them (the host puts the page topic's own first). */
|
|
31
|
+
chips: ReadonlyArray<QuickActionChip>;
|
|
32
|
+
/** Default theme for chips without their own (the agent's accent). */
|
|
33
|
+
theme?: QuickActionThemeSpec;
|
|
34
|
+
/** The actions are still read: every slot draws its chip's loading form. */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/** The group's accessible name. */
|
|
37
|
+
label?: string;
|
|
38
|
+
/** Print the page's topic (`PageTopicLabel`, the stamp the FAQ block prints) over the set, right-aligned, so
|
|
39
|
+
* whoever tags quick actions on the hub sees which topic this page asks for. Default: the host's choice
|
|
40
|
+
* (`PageTopicsProvider showTopic`), so every surface that draws the set prints it alike. Drawn in the loading
|
|
41
|
+
* form too, so the set is the same box either way. */
|
|
42
|
+
showTopic?: boolean;
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A chat's quick actions: a STATIC set of {@link QUICK_ACTION_SET_SLOTS} fixed slots above the composer, never a
|
|
48
|
+
* moving wall. Its height is decided by its container's width alone (one column under 18rem, two under 48rem, four
|
|
49
|
+
* above), never by the actions: fewer actions leave their slots empty, more turn the last slot into "More (n)", which
|
|
50
|
+
* opens the rest in a menu that floats over the page, and a long name clips on its one line (its tooltip shows it
|
|
51
|
+
* whole). Loading draws the same slots, each the chip's own loading form. So the set is the same box loading,
|
|
52
|
+
* loaded, with 1 action or 40, and opening "More" moves nothing.
|
|
53
|
+
*
|
|
54
|
+
* A click on a chip, or on a row of the "More" menu, calls its `onSelect` (the chat puts the action's prompt into the
|
|
55
|
+
* composer to edit and send).
|
|
56
|
+
*/
|
|
57
|
+
export function QuickActionSet({
|
|
58
|
+
chips,
|
|
59
|
+
theme,
|
|
60
|
+
loading: loadingProp = false,
|
|
61
|
+
label = 'Quick actions',
|
|
62
|
+
showTopic: showTopicProp,
|
|
63
|
+
className,
|
|
64
|
+
}: QuickActionSetProps) {
|
|
65
|
+
const loading = useLoadingScope() || loadingProp;
|
|
66
|
+
const topicStamp = usePageTopicStamp();
|
|
67
|
+
const showTopic = showTopicProp ?? topicStamp;
|
|
68
|
+
const overflows = chips.length > QUICK_ACTION_SET_SLOTS;
|
|
69
|
+
const shown = overflows ? chips.slice(0, QUICK_ACTION_SET_SLOTS - 1) : chips;
|
|
70
|
+
const rest = overflows ? chips.slice(QUICK_ACTION_SET_SLOTS - 1) : [];
|
|
71
|
+
const empty = loading ? 0 : QUICK_ACTION_SET_SLOTS - shown.length - (overflows ? 1 : 0);
|
|
72
|
+
|
|
73
|
+
const moreItems = rest.map(chip => {
|
|
74
|
+
const icon =
|
|
75
|
+
theme && isQuickActionIconSpec(chip.icon) && !chip.icon.accent
|
|
76
|
+
? { ...chip.icon, accent: theme.accent }
|
|
77
|
+
: chip.icon;
|
|
78
|
+
return { id: chip.id, label: chip.label, icon: renderQuickActionIcon(icon), onClick: chip.onSelect };
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
role="group"
|
|
84
|
+
aria-label={label}
|
|
85
|
+
className={cn('flex shrink-0 flex-col gap-[var(--spacing-system-xxs)] @container', className)}
|
|
86
|
+
>
|
|
87
|
+
{showTopic && <PageTopicLabel className="text-right" />}
|
|
88
|
+
<div className="grid grid-cols-1 gap-[var(--spacing-system-xs)] @[18rem]:grid-cols-2 @[48rem]:grid-cols-4">
|
|
89
|
+
{loading ? (
|
|
90
|
+
<LoadingItems count={QUICK_ACTION_SET_SLOTS}>
|
|
91
|
+
{i => (
|
|
92
|
+
<Slot>
|
|
93
|
+
<QuickActionChipButton
|
|
94
|
+
loading
|
|
95
|
+
fill
|
|
96
|
+
label=""
|
|
97
|
+
icon
|
|
98
|
+
labelCh={WALL_SKELETON_LABEL_CH[i % WALL_SKELETON_LABEL_CH.length]}
|
|
99
|
+
data-loading-item
|
|
100
|
+
/>
|
|
101
|
+
</Slot>
|
|
102
|
+
)}
|
|
103
|
+
</LoadingItems>
|
|
104
|
+
) : (
|
|
105
|
+
<>
|
|
106
|
+
{shown.map(chip => (
|
|
107
|
+
<Slot key={chip.id}>
|
|
108
|
+
<QuickActionChipFromData chip={chip} defaultTheme={theme} fill data-loading-item />
|
|
109
|
+
</Slot>
|
|
110
|
+
))}
|
|
111
|
+
{overflows && (
|
|
112
|
+
<Slot>
|
|
113
|
+
<ActionsMenuDropdown
|
|
114
|
+
groups={[{ items: moreItems }]}
|
|
115
|
+
align="end"
|
|
116
|
+
side="top"
|
|
117
|
+
customTrigger={
|
|
118
|
+
<Button
|
|
119
|
+
variant="card"
|
|
120
|
+
type="button"
|
|
121
|
+
aria-label={`More quick actions (${rest.length})`}
|
|
122
|
+
className="w-full min-w-0"
|
|
123
|
+
>
|
|
124
|
+
<QuickActionChipButton
|
|
125
|
+
interactive={false}
|
|
126
|
+
fill
|
|
127
|
+
label={`More (${rest.length})`}
|
|
128
|
+
icon={<Ellipsis01Icon size={16} />}
|
|
129
|
+
/>
|
|
130
|
+
</Button>
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
</Slot>
|
|
134
|
+
)}
|
|
135
|
+
{/* Unused slots keep their place, so the set never shrinks: the chip's own box, unseen. */}
|
|
136
|
+
{Array.from({ length: empty }, (_, i) => (
|
|
137
|
+
<Slot key={`empty-${i}`} unused>
|
|
138
|
+
<QuickActionChipButton loading fill label="" icon />
|
|
139
|
+
</Slot>
|
|
140
|
+
))}
|
|
141
|
+
</>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** One cell of the set's grid: whatever it holds (a chip, its loading form, "More", or an unused slot's unseen box)
|
|
149
|
+
* fills it. */
|
|
150
|
+
function Slot({ unused = false, children }: { unused?: boolean; children: ReactNode }) {
|
|
151
|
+
return (
|
|
152
|
+
<div
|
|
153
|
+
data-testid="quick-action-slot"
|
|
154
|
+
aria-hidden={unused || undefined}
|
|
155
|
+
className={cn('min-w-0', unused && 'invisible')}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
6
161
|
|
|
7
162
|
export interface MingoQuickActionWallProps {
|
|
8
163
|
quickActions: ReadonlyArray<MingoQuickAction>;
|
|
9
|
-
/** Pointer/keyboard focus enters a chip — e.g. preview its prompt in the composer. */
|
|
10
|
-
onQuickActionHover?: (action: MingoQuickAction) => void;
|
|
11
|
-
/** Pointer/keyboard focus leaves the chip. */
|
|
12
|
-
onQuickActionHoverEnd?: () => void;
|
|
13
|
-
/** A built-in agent (`'fae'`/`'mingo'`) caps the wall at 2 rows. Default `'mingo'`. */
|
|
14
|
-
agentSlug?: string;
|
|
15
164
|
/**
|
|
16
|
-
* The actions are still being read: the
|
|
17
|
-
*
|
|
18
|
-
* greeting centred above) does not move when the actions land.
|
|
165
|
+
* The actions are still being read: the set draws its chips' loading form in every slot, so a host that holds its
|
|
166
|
+
* layout around it (a composer under it, a greeting centred above) does not move when the actions land.
|
|
19
167
|
*/
|
|
20
168
|
loading?: boolean;
|
|
169
|
+
/** See {@link QuickActionSetProps.showTopic}. */
|
|
170
|
+
showTopic?: boolean;
|
|
21
171
|
className?: string;
|
|
22
172
|
}
|
|
23
173
|
|
|
24
174
|
/**
|
|
25
|
-
* Mingo's quick actions as the chat's empty state draws them (`MingoWelcome`): the
|
|
26
|
-
*
|
|
27
|
-
* agent) under left/right edge fades, so a long action set gets "reach" without
|
|
28
|
-
* squeezing the composer. `pauseOnHover` freezes the hovered row so a moving chip
|
|
29
|
-
* never dodges a click. One component, so a host that shows the actions outside the
|
|
30
|
-
* chat (a docked composer's home) draws the very same wall.
|
|
175
|
+
* Mingo's quick actions as the chat's empty state draws them (`MingoWelcome`): the {@link QuickActionSet}. One
|
|
176
|
+
* component, so a host that shows the actions outside the chat (a docked composer's home) draws the very same set.
|
|
31
177
|
*/
|
|
32
178
|
export function MingoQuickActionWall({
|
|
33
179
|
quickActions,
|
|
34
|
-
onQuickActionHover,
|
|
35
|
-
onQuickActionHoverEnd,
|
|
36
|
-
agentSlug = 'mingo',
|
|
37
180
|
loading = false,
|
|
181
|
+
showTopic,
|
|
38
182
|
className,
|
|
39
183
|
}: MingoQuickActionWallProps) {
|
|
40
184
|
if (quickActions.length === 0 && !loading) return null;
|
|
41
185
|
return (
|
|
42
|
-
<
|
|
186
|
+
<QuickActionSet
|
|
43
187
|
chips={quickActions.map(action => ({
|
|
44
188
|
id: action.id,
|
|
45
189
|
label: action.label,
|
|
46
190
|
icon: action.icon,
|
|
47
191
|
variant: action.variant,
|
|
48
192
|
onSelect: action.onClick,
|
|
49
|
-
onHoverStart: () => onQuickActionHover?.(action),
|
|
50
|
-
onHoverEnd: () => onQuickActionHoverEnd?.(),
|
|
51
193
|
}))}
|
|
52
|
-
agentSlug={agentSlug}
|
|
53
194
|
loading={loading}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
dragScroll
|
|
57
|
-
fade={['left', 'right']}
|
|
58
|
-
fadeSize={{ left: 32 }}
|
|
59
|
-
fadeColor="var(--color-bg)"
|
|
60
|
-
copyGap="var(--spacing-system-xxs)"
|
|
61
|
-
className={cn('max-h-44 shrink-0', className)}
|
|
195
|
+
showTopic={showTopic}
|
|
196
|
+
className={className}
|
|
62
197
|
/>
|
|
63
198
|
);
|
|
64
199
|
}
|
|
@@ -33,9 +33,8 @@ export interface MingoQuickAction {
|
|
|
33
33
|
/** `'primary'` = accent (yellow) chip, `'outline'` = bordered chip. */
|
|
34
34
|
variant?: 'primary' | 'outline';
|
|
35
35
|
onClick?: () => void;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* Omitted → falls back to `label`. */
|
|
36
|
+
/** The full prompt the action asks: in `EmbeddableChat` a click puts it into the composer to edit and send. The
|
|
37
|
+
* chip `label` is short. Omitted → falls back to `label`. */
|
|
39
38
|
prompt?: string;
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -55,11 +54,6 @@ export interface MingoWelcomeProps {
|
|
|
55
54
|
promoStorage?: 'local' | 'session';
|
|
56
55
|
/** Extra quick-action chips appended after the "Start Guide Chat" chip. */
|
|
57
56
|
quickActions?: ReadonlyArray<MingoQuickAction>;
|
|
58
|
-
/** Pointer/keyboard focus enters a quick-action chip — e.g. preview the
|
|
59
|
-
* action's full `prompt` in the composer input. */
|
|
60
|
-
onQuickActionHover?: (action: MingoQuickAction) => void;
|
|
61
|
-
/** Pointer/keyboard focus leaves the chip — e.g. restore the composer. */
|
|
62
|
-
onQuickActionHoverEnd?: () => void;
|
|
63
57
|
/** Returning-user variation: the user already has chats. Hides the
|
|
64
58
|
* "New to OpenFrame?" notification entirely and renders the "Start Guide
|
|
65
59
|
* Chat" chip in the muted `outline` style instead of the accent yellow. */
|
|
@@ -88,10 +82,9 @@ export interface MingoWelcomeProps {
|
|
|
88
82
|
* action — switches the host chat to Guide mode) and enables the default
|
|
89
83
|
* promo notification. When omitted, both are suppressed. */
|
|
90
84
|
onStartGuideChat?: () => void;
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
agentSlug?: string;
|
|
85
|
+
/** The host is still reading the quick actions: the set draws its loading form in every slot, so the empty state
|
|
86
|
+
* keeps its height when they land. */
|
|
87
|
+
quickActionsLoading?: boolean;
|
|
95
88
|
/** Appended to the root element. */
|
|
96
89
|
className?: string;
|
|
97
90
|
}
|
|
@@ -137,8 +130,6 @@ export function MingoWelcome({
|
|
|
137
130
|
promoStorageKey = DEFAULT_PROMO_STORAGE_KEY,
|
|
138
131
|
promoStorage = 'local',
|
|
139
132
|
quickActions,
|
|
140
|
-
onQuickActionHover,
|
|
141
|
-
onQuickActionHoverEnd,
|
|
142
133
|
hasExistingChats = false,
|
|
143
134
|
dialogHistory,
|
|
144
135
|
isLoadingHistory = false,
|
|
@@ -146,7 +137,7 @@ export function MingoWelcome({
|
|
|
146
137
|
loadError = false,
|
|
147
138
|
onRetry,
|
|
148
139
|
onStartGuideChat,
|
|
149
|
-
|
|
140
|
+
quickActionsLoading = false,
|
|
150
141
|
className,
|
|
151
142
|
}: MingoWelcomeProps) {
|
|
152
143
|
// Greeting never weaves the user's name in — always the plain "Hey, I'm
|
|
@@ -316,18 +307,12 @@ export function MingoWelcome({
|
|
|
316
307
|
</div>
|
|
317
308
|
)}
|
|
318
309
|
|
|
319
|
-
{/* Quick actions. "Start Guide Chat" stays pinned above the
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
moving chip never dodges a click; hover/focus previews the action's
|
|
326
|
-
full prompt in the composer. */}
|
|
327
|
-
{/* The standalone chip sits one WALL PITCH above the wall, so it reads
|
|
328
|
-
as that wall's first row rather than a separate control. */}
|
|
329
|
-
{(onStartGuideChat || (quickActions && quickActions.length > 0)) && (
|
|
330
|
-
<div className="flex shrink-0 flex-col gap-[var(--chip-wall-gap)]">
|
|
310
|
+
{/* Quick actions. "Start Guide Chat" stays pinned above the set: it is the primary mode switch and must
|
|
311
|
+
never move out of reach. The rest are the static {@link QuickActionSet} (fixed slots, "More" for the
|
|
312
|
+
rest); a click puts the action's prompt into the composer. The standalone chip sits one
|
|
313
|
+
chip gap above the set, so it reads as its first row rather than a separate control. */}
|
|
314
|
+
{(onStartGuideChat || (quickActions && quickActions.length > 0) || quickActionsLoading) && (
|
|
315
|
+
<div className="flex shrink-0 flex-col gap-[var(--spacing-system-xs)]">
|
|
331
316
|
{onStartGuideChat && (
|
|
332
317
|
<QuickActionChipButton
|
|
333
318
|
label="Start Guide Chat"
|
|
@@ -337,14 +322,10 @@ export function MingoWelcome({
|
|
|
337
322
|
className="self-start"
|
|
338
323
|
/>
|
|
339
324
|
)}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
onQuickActionHoverEnd={onQuickActionHoverEnd}
|
|
345
|
-
agentSlug={agentSlug}
|
|
346
|
-
/>
|
|
347
|
-
)}
|
|
325
|
+
<MingoQuickActionWall
|
|
326
|
+
quickActions={quickActions ?? []}
|
|
327
|
+
loading={quickActionsLoading && !quickActions?.length}
|
|
328
|
+
/>
|
|
348
329
|
</div>
|
|
349
330
|
)}
|
|
350
331
|
</div>
|
|
@@ -188,6 +188,10 @@ export interface QuickActionChipButtonProps {
|
|
|
188
188
|
loading?: boolean;
|
|
189
189
|
/** While loading, the label placeholder's width in `ch` (see {@link QuickActionChipSkeletonProps.labelCh}). */
|
|
190
190
|
labelCh?: number;
|
|
191
|
+
/** The chip fills its slot: full width and a FIXED two-line height, the label in sentence type as it was
|
|
192
|
+
* written (not the uppercase label type), wrapping to at most two lines. The quick-action set's fixed grid draws
|
|
193
|
+
* its chips this way, so a long name never changes the slot's size. */
|
|
194
|
+
fill?: boolean;
|
|
191
195
|
/** The list's markers (`data-loading-item`), forwarded in both forms. */
|
|
192
196
|
[marker: `data-${string}`]: unknown;
|
|
193
197
|
}
|
|
@@ -208,11 +212,23 @@ interface QuickActionChipSkeletonProps {
|
|
|
208
212
|
size?: 'default' | 'large';
|
|
209
213
|
/** `'question'`: the placeholder of a `variant="question"` chip (its height and padding). */
|
|
210
214
|
variant?: 'outline' | 'question';
|
|
215
|
+
/** The loaded chip fills its slot ({@link QuickActionChipButtonProps.fill}): so does its placeholder. */
|
|
216
|
+
fill?: boolean;
|
|
211
217
|
className?: string;
|
|
212
218
|
/** The list's markers (`data-loading-item`), forwarded like the loaded chip's. */
|
|
213
219
|
[marker: `data-${string}`]: unknown;
|
|
214
220
|
}
|
|
215
221
|
|
|
222
|
+
/** A chip that fills its slot: the tag spans the slot at a fixed two-line height, its content at the leading edge.
|
|
223
|
+
* Prompts read better in sentence case and whole than uppercase and cut (NN/g, "glanceable fonts"; AWS Cloudscape,
|
|
224
|
+
* support prompts), so a filled chip uses the sentence type and wraps instead of clipping on one line. */
|
|
225
|
+
const FILL_TAG_CLASS = 'h-14 w-full min-w-0 justify-start text-left';
|
|
226
|
+
|
|
227
|
+
/** A filled chip's label: at most two lines, broken anywhere a long word needs it. */
|
|
228
|
+
function fillLabel(label: ReactNode): ReactNode {
|
|
229
|
+
return <span className="line-clamp-2 whitespace-normal [overflow-wrap:anywhere]">{label}</span>;
|
|
230
|
+
}
|
|
231
|
+
|
|
216
232
|
/**
|
|
217
233
|
* Loading placeholder for {@link QuickActionChipButton} — renders the REAL
|
|
218
234
|
* `Tag` (same height, padding, border, radius, icon box) with `UnifiedSkeleton`
|
|
@@ -227,6 +243,7 @@ function QuickActionChipSkeleton({
|
|
|
227
243
|
lozenge = false,
|
|
228
244
|
size = 'default',
|
|
229
245
|
variant = 'outline',
|
|
246
|
+
fill = false,
|
|
230
247
|
className,
|
|
231
248
|
...props
|
|
232
249
|
}: QuickActionChipSkeletonProps) {
|
|
@@ -235,8 +252,8 @@ function QuickActionChipSkeleton({
|
|
|
235
252
|
<Tag
|
|
236
253
|
{...loadingItemProps(props)}
|
|
237
254
|
variant="outline"
|
|
238
|
-
size={question ? 'sentence' : size}
|
|
239
|
-
className={cn(question && 'max-w-full', className)}
|
|
255
|
+
size={question || fill ? 'sentence' : size}
|
|
256
|
+
className={cn(question && 'max-w-full', fill && FILL_TAG_CLASS, className)}
|
|
240
257
|
icon={
|
|
241
258
|
icon && !question ? (
|
|
242
259
|
<UnifiedSkeleton as="span" aria-hidden className={size === 'large' ? 'block size-5' : 'block size-4'} />
|
|
@@ -287,6 +304,7 @@ export function QuickActionChipButton({
|
|
|
287
304
|
className,
|
|
288
305
|
loading: loadingProp = false,
|
|
289
306
|
labelCh,
|
|
307
|
+
fill = false,
|
|
290
308
|
...props
|
|
291
309
|
}: QuickActionChipButtonProps) {
|
|
292
310
|
// ONE switch: in a page's loading state, or while the host reads the label, the chip is its skeleton (same box).
|
|
@@ -301,7 +319,8 @@ export function QuickActionChipButton({
|
|
|
301
319
|
lozenge={!!lozenge}
|
|
302
320
|
size={size}
|
|
303
321
|
variant={variant === 'question' ? 'question' : 'outline'}
|
|
304
|
-
|
|
322
|
+
fill={fill}
|
|
323
|
+
className={cn(fill && 'w-full', className)}
|
|
305
324
|
/>
|
|
306
325
|
);
|
|
307
326
|
// The theme's accent only fills the gap — an icon spec's own accent
|
|
@@ -309,7 +328,8 @@ export function QuickActionChipButton({
|
|
|
309
328
|
const themedIcon = theme && isQuickActionIconSpec(icon) && !icon.accent ? { ...icon, accent: theme.accent } : icon;
|
|
310
329
|
const resolvedLozenge = lozenge === true ? theme?.lozenge : lozenge === false ? undefined : lozenge;
|
|
311
330
|
const resolvedIcon = renderQuickActionIcon(themedIcon);
|
|
312
|
-
const
|
|
331
|
+
const composedLabel = composeChipLabel(label, resolvedLozenge);
|
|
332
|
+
const resolvedLabel = fill ? fillLabel(composedLabel) : composedLabel;
|
|
313
333
|
const question = variant === 'question';
|
|
314
334
|
const tagVariant = selected
|
|
315
335
|
? selectedAccent === 'cyan'
|
|
@@ -318,7 +338,7 @@ export function QuickActionChipButton({
|
|
|
318
338
|
: question
|
|
319
339
|
? 'outline'
|
|
320
340
|
: variant;
|
|
321
|
-
const tagSize = question ? 'sentence' : size;
|
|
341
|
+
const tagSize = question || fill ? 'sentence' : size;
|
|
322
342
|
if (!interactive) {
|
|
323
343
|
return (
|
|
324
344
|
<Tag
|
|
@@ -327,7 +347,7 @@ export function QuickActionChipButton({
|
|
|
327
347
|
size={tagSize}
|
|
328
348
|
icon={resolvedIcon}
|
|
329
349
|
label={resolvedLabel}
|
|
330
|
-
className={className}
|
|
350
|
+
className={cn(fill && FILL_TAG_CLASS, className)}
|
|
331
351
|
/>
|
|
332
352
|
);
|
|
333
353
|
}
|
|
@@ -344,7 +364,7 @@ export function QuickActionChipButton({
|
|
|
344
364
|
aria-pressed={selected || undefined}
|
|
345
365
|
className={cn(
|
|
346
366
|
// A question may be longer than a narrow column: it shrinks and clips there, read from its start.
|
|
347
|
-
question ? 'w-auto min-w-0 max-w-full' : 'w-auto shrink-0',
|
|
367
|
+
fill ? 'w-full min-w-0' : question ? 'w-auto min-w-0 max-w-full' : 'w-auto shrink-0',
|
|
348
368
|
className,
|
|
349
369
|
)}
|
|
350
370
|
>
|
|
@@ -353,7 +373,7 @@ export function QuickActionChipButton({
|
|
|
353
373
|
size={tagSize}
|
|
354
374
|
icon={resolvedIcon}
|
|
355
375
|
label={resolvedLabel}
|
|
356
|
-
className={question ? 'max-w-full' : undefined}
|
|
376
|
+
className={fill ? FILL_TAG_CLASS : question ? 'max-w-full' : undefined}
|
|
357
377
|
/>
|
|
358
378
|
</Button>
|
|
359
379
|
);
|
|
@@ -410,6 +430,7 @@ export function QuickActionChipFromData({
|
|
|
410
430
|
defaultTheme,
|
|
411
431
|
defaultLozenge,
|
|
412
432
|
interactive = true,
|
|
433
|
+
fill,
|
|
413
434
|
className,
|
|
414
435
|
...props
|
|
415
436
|
}: {
|
|
@@ -417,6 +438,8 @@ export function QuickActionChipFromData({
|
|
|
417
438
|
defaultTheme?: QuickActionThemeSpec;
|
|
418
439
|
defaultLozenge?: boolean;
|
|
419
440
|
interactive?: boolean;
|
|
441
|
+
/** See {@link QuickActionChipButtonProps.fill}. */
|
|
442
|
+
fill?: boolean;
|
|
420
443
|
className?: string;
|
|
421
444
|
/** The list's markers (`data-loading-item`), forwarded to the chip. */
|
|
422
445
|
[marker: `data-${string}`]: unknown;
|
|
@@ -435,6 +458,7 @@ export function QuickActionChipFromData({
|
|
|
435
458
|
onHoverStart={chip.onHoverStart}
|
|
436
459
|
onHoverEnd={chip.onHoverEnd}
|
|
437
460
|
interactive={interactive}
|
|
461
|
+
fill={fill}
|
|
438
462
|
className={className}
|
|
439
463
|
/>
|
|
440
464
|
);
|