@flamingo-stack/openframe-frontend-core 0.0.449 → 0.0.450-snapshot.20260718144519
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/{chunk-6TS4AIDX.cjs → chunk-2EBWR7TL.cjs} +15 -15
- package/dist/{chunk-6TS4AIDX.cjs.map → chunk-2EBWR7TL.cjs.map} +1 -1
- package/dist/{chunk-X754WDWO.cjs → chunk-2EDOYQ4B.cjs} +40 -40
- package/dist/{chunk-X754WDWO.cjs.map → chunk-2EDOYQ4B.cjs.map} +1 -1
- package/dist/{chunk-VSWFYFIG.js → chunk-2OYAYIEY.js} +5 -5
- package/dist/{chunk-5SJGFLL2.js → chunk-6ZIUQ2SL.js} +6371 -6032
- package/dist/chunk-6ZIUQ2SL.js.map +1 -0
- package/dist/{chunk-BSBWBQ7M.js → chunk-A7Z6UBVS.js} +6 -6
- package/dist/{chunk-4IMXFDRI.js → chunk-B77WL4O5.js} +3 -3
- package/dist/{chunk-KKJRBMG3.cjs → chunk-DGQHHMTR.cjs} +73 -73
- package/dist/{chunk-KKJRBMG3.cjs.map → chunk-DGQHHMTR.cjs.map} +1 -1
- package/dist/{chunk-LWT6G75Q.js → chunk-DREXTFSD.js} +2 -2
- package/dist/{chunk-YHNBJ3F3.js → chunk-EQWE64RJ.js} +2 -2
- package/dist/{chunk-YSNMV53O.js → chunk-FZG2BBFM.js} +6 -6
- package/dist/{chunk-JAASDJOF.js → chunk-I4KRIE5C.js} +5 -5
- package/dist/{chunk-XLFAFH2B.js → chunk-I5GIVUTT.js} +2 -2
- package/dist/{chunk-4S4RR7XC.cjs → chunk-L5C7LUKR.cjs} +40 -40
- package/dist/{chunk-4S4RR7XC.cjs.map → chunk-L5C7LUKR.cjs.map} +1 -1
- package/dist/{chunk-TKGCTDQY.js → chunk-MLFFBQ5B.js} +180 -87
- package/dist/chunk-MLFFBQ5B.js.map +1 -0
- package/dist/{chunk-EOFENGSZ.cjs → chunk-OIQVRUXB.cjs} +12 -12
- package/dist/{chunk-EOFENGSZ.cjs.map → chunk-OIQVRUXB.cjs.map} +1 -1
- package/dist/{chunk-H56AEHFC.cjs → chunk-PSXGALZS.cjs} +1605 -1266
- package/dist/chunk-PSXGALZS.cjs.map +1 -0
- package/dist/{chunk-UNQVTGVG.js → chunk-PXCMC2IV.js} +2 -2
- package/dist/{chunk-DJP5HYFG.cjs → chunk-PZJ7K3IB.cjs} +7 -7
- package/dist/{chunk-DJP5HYFG.cjs.map → chunk-PZJ7K3IB.cjs.map} +1 -1
- package/dist/{chunk-AN7MCJTV.cjs → chunk-QF3NQW7C.cjs} +122 -29
- package/dist/chunk-QF3NQW7C.cjs.map +1 -0
- package/dist/{chunk-WYPROXL4.cjs → chunk-R3J3J343.cjs} +73 -73
- package/dist/{chunk-WYPROXL4.cjs.map → chunk-R3J3J343.cjs.map} +1 -1
- package/dist/{chunk-MWRFPLNB.js → chunk-R4WXQKOP.js} +3 -3
- package/dist/{chunk-ROCJMSJI.cjs → chunk-UPRY4I63.cjs} +3 -3
- package/dist/{chunk-ROCJMSJI.cjs.map → chunk-UPRY4I63.cjs.map} +1 -1
- package/dist/{chunk-AZKVNRZP.cjs → chunk-VDG22PSI.cjs} +32 -32
- package/dist/{chunk-AZKVNRZP.cjs.map → chunk-VDG22PSI.cjs.map} +1 -1
- package/dist/{chunk-LQTX7EJS.cjs → chunk-X6XGYRAK.cjs} +29 -29
- package/dist/{chunk-LQTX7EJS.cjs.map → chunk-X6XGYRAK.cjs.map} +1 -1
- package/dist/{chunk-HQ7S6JG5.js → chunk-XNH5GGEI.js} +3 -3
- package/dist/{chunk-NPBTNWRA.js → chunk-XSBQ2REJ.js} +4 -4
- package/dist/{chunk-47AMTR2S.cjs → chunk-ZDW5ETYK.cjs} +18 -18
- package/dist/{chunk-47AMTR2S.cjs.map → chunk-ZDW5ETYK.cjs.map} +1 -1
- package/dist/{chunk-DRKQNXSZ.cjs → chunk-ZP62C5A3.cjs} +5 -5
- package/dist/{chunk-DRKQNXSZ.cjs.map → chunk-ZP62C5A3.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/chat-quick-action-row.d.ts +21 -1
- package/dist/components/chat/chat-quick-action-row.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +13 -3
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +12 -2
- package/dist/components/chat/quick-action-chip.d.ts +27 -4
- package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
- package/dist/components/chat/quick-action-marquee.d.ts +24 -9
- package/dist/components/chat/quick-action-marquee.d.ts.map +1 -1
- package/dist/components/chat/quick-action-wall.d.ts +93 -0
- package/dist/components/chat/quick-action-wall.d.ts.map +1 -0
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/content-loading-container.d.ts +1 -1
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/cards-strip.d.ts.map +1 -1
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/form.d.ts +1 -1
- package/dist/components/form.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +157 -135
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +33 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +3 -3
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +25 -3
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +24 -2
- package/dist/components/ui/marquee-wall.d.ts +159 -0
- package/dist/components/ui/marquee-wall.d.ts.map +1 -0
- package/dist/hooks/index.cjs +6 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/ui/index.d.ts +2 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/use-marquee-engine.d.ts +73 -0
- package/dist/hooks/ui/use-marquee-engine.d.ts.map +1 -0
- package/dist/hooks/ui/use-suppress-clone-focus.d.ts +24 -0
- package/dist/hooks/ui/use-suppress-clone-focus.d.ts.map +1 -0
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -2
- package/dist/tailwind.config.cjs +1 -8
- package/dist/tailwind.config.cjs.map +1 -1
- package/dist/tailwind.config.js +1 -8
- package/dist/tailwind.config.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/chat-quick-action-row.tsx +38 -3
- package/src/components/chat/index.ts +1 -0
- package/src/components/chat/quick-action-chip.tsx +50 -13
- package/src/components/chat/quick-action-marquee.tsx +54 -47
- package/src/components/chat/quick-action-wall.tsx +242 -0
- package/src/components/features/cards-strip.tsx +88 -158
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/marquee-wall.tsx +522 -0
- package/src/hooks/ui/index.ts +2 -0
- package/src/hooks/ui/use-marquee-engine.ts +158 -0
- package/src/hooks/ui/use-suppress-clone-focus.ts +61 -0
- package/src/stories/MarqueeWall.stories.tsx +132 -0
- package/src/stories/QuickActionMarquee.stories.tsx +8 -7
- package/src/stories/QuickActionWall.stories.tsx +130 -0
- package/tailwind.config.ts +0 -7
- package/dist/chunk-5SJGFLL2.js.map +0 -1
- package/dist/chunk-AN7MCJTV.cjs.map +0 -1
- package/dist/chunk-H56AEHFC.cjs.map +0 -1
- package/dist/chunk-TKGCTDQY.js.map +0 -1
- /package/dist/{chunk-VSWFYFIG.js.map → chunk-2OYAYIEY.js.map} +0 -0
- /package/dist/{chunk-BSBWBQ7M.js.map → chunk-A7Z6UBVS.js.map} +0 -0
- /package/dist/{chunk-4IMXFDRI.js.map → chunk-B77WL4O5.js.map} +0 -0
- /package/dist/{chunk-LWT6G75Q.js.map → chunk-DREXTFSD.js.map} +0 -0
- /package/dist/{chunk-YHNBJ3F3.js.map → chunk-EQWE64RJ.js.map} +0 -0
- /package/dist/{chunk-YSNMV53O.js.map → chunk-FZG2BBFM.js.map} +0 -0
- /package/dist/{chunk-JAASDJOF.js.map → chunk-I4KRIE5C.js.map} +0 -0
- /package/dist/{chunk-XLFAFH2B.js.map → chunk-I5GIVUTT.js.map} +0 -0
- /package/dist/{chunk-UNQVTGVG.js.map → chunk-PXCMC2IV.js.map} +0 -0
- /package/dist/{chunk-MWRFPLNB.js.map → chunk-R4WXQKOP.js.map} +0 -0
- /package/dist/{chunk-HQ7S6JG5.js.map → chunk-XNH5GGEI.js.map} +0 -0
- /package/dist/{chunk-NPBTNWRA.js.map → chunk-XSBQ2REJ.js.map} +0 -0
|
@@ -14,6 +14,9 @@ import { EntityIcon, type EntityIconValue } from '../icon-display'
|
|
|
14
14
|
* (agent/persona `icon_props.color`). */
|
|
15
15
|
export type QuickActionAccent = 'pink' | 'cyan' | (string & {})
|
|
16
16
|
|
|
17
|
+
/** THE built-in agent→accent pairs ({@link getAgentAccent} derives from it). */
|
|
18
|
+
const AGENT_ACCENTS = { fae: 'pink', mingo: 'cyan' } as const
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* FALLBACK-ONLY agent→accent mapping (fae→pink, mingo→cyan) for the built-in
|
|
19
22
|
* agents when nothing is configured. A color configured on the entity itself —
|
|
@@ -23,9 +26,7 @@ export type QuickActionAccent = 'pink' | 'cyan' | (string & {})
|
|
|
23
26
|
* comparison elsewhere.
|
|
24
27
|
*/
|
|
25
28
|
export function getAgentAccent(slug: string | null | undefined): QuickActionAccent | undefined {
|
|
26
|
-
|
|
27
|
-
if (slug === 'mingo') return 'cyan'
|
|
28
|
-
return undefined
|
|
29
|
+
return slug === 'fae' || slug === 'mingo' ? AGENT_ACCENTS[slug] : undefined
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/** Admin-configured identity color (`icon_props.color` on the agent/persona
|
|
@@ -63,18 +64,24 @@ const ACCENT_CLASS: Record<string, string> = {
|
|
|
63
64
|
cyan: 'text-ods-flamingo-cyan',
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
/** A spec is a plain data object, never a React element — so any non-element,
|
|
68
|
+
* non-array object is a spec; strings, elements, fragments, and ReactNode
|
|
69
|
+
* ARRAYS stay ReactNode. */
|
|
70
|
+
export function isQuickActionIconSpec(
|
|
71
|
+
icon: React.ReactNode | QuickActionIconSpec | undefined,
|
|
72
|
+
): icon is QuickActionIconSpec {
|
|
73
|
+
return typeof icon === 'object' && icon !== null && !Array.isArray(icon) && !React.isValidElement(icon)
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
/** Resolve a chip `icon` prop to a renderable node. Specs go through
|
|
67
77
|
* `<EntityIcon>`; ReactNodes pass through untouched. */
|
|
68
78
|
export function renderQuickActionIcon(
|
|
69
79
|
icon: React.ReactNode | QuickActionIconSpec | undefined,
|
|
70
80
|
): React.ReactNode {
|
|
71
|
-
|
|
72
|
-
// non-array object is a spec; strings, elements, fragments, and ReactNode
|
|
73
|
-
// ARRAYS stay ReactNode.
|
|
74
|
-
if (typeof icon !== 'object' || icon === null || Array.isArray(icon) || React.isValidElement(icon)) {
|
|
81
|
+
if (!isQuickActionIconSpec(icon)) {
|
|
75
82
|
return icon
|
|
76
83
|
}
|
|
77
|
-
const spec = icon
|
|
84
|
+
const spec = icon
|
|
78
85
|
if (!spec.name && !spec.url) return undefined
|
|
79
86
|
// Named brand tokens tint via a text class on `currentColor`; any other
|
|
80
87
|
// accent value is an admin-configured CSS color, delivered as the glyph's
|
|
@@ -104,6 +111,26 @@ export interface QuickActionChipLozenge {
|
|
|
104
111
|
className?: string
|
|
105
112
|
}
|
|
106
113
|
|
|
114
|
+
// =============================================================================
|
|
115
|
+
// Themes
|
|
116
|
+
// =============================================================================
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A caller-supplied chip theme — the accent (and optional classification
|
|
120
|
+
* lozenge) for "who does this work". The lib deliberately ships NO theme
|
|
121
|
+
* registry and NO fallbacks: agent colors are server-configured (resolve via
|
|
122
|
+
* {@link accentFromIdentityIcon} on the agent row's `icon_props.color`, or
|
|
123
|
+
* {@link getAgentAccent} for the built-in agents) and category pairs are
|
|
124
|
+
* product decisions — the CONSUMER defines its specs and injects them, per
|
|
125
|
+
* chip or as a wall default.
|
|
126
|
+
*/
|
|
127
|
+
export interface QuickActionThemeSpec {
|
|
128
|
+
/** Chip icon tint ({@link QuickActionAccent}: brand token or CSS color). */
|
|
129
|
+
accent: QuickActionAccent
|
|
130
|
+
/** Classification affix rendered inside the chip (category themes). */
|
|
131
|
+
lozenge?: QuickActionChipLozenge
|
|
132
|
+
}
|
|
133
|
+
|
|
107
134
|
/** Resolve a chip label + optional lozenge to the Tag label node. */
|
|
108
135
|
function composeChipLabel(
|
|
109
136
|
label: React.ReactNode,
|
|
@@ -136,9 +163,13 @@ export interface QuickActionChipButtonProps {
|
|
|
136
163
|
/** Icon: a declarative {@link QuickActionIconSpec} (preferred — unified
|
|
137
164
|
* EntityIcon resolution) or a pre-rendered ReactNode. */
|
|
138
165
|
icon?: React.ReactNode | QuickActionIconSpec
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
|
|
166
|
+
/** Caller-supplied {@link QuickActionThemeSpec}: supplies the icon accent
|
|
167
|
+
* when the icon spec doesn't carry its own, and the lozenge when `lozenge`
|
|
168
|
+
* is `true`. Explicit values always win over the theme. */
|
|
169
|
+
theme?: QuickActionThemeSpec
|
|
170
|
+
/** {@link QuickActionChipLozenge} at the label's leading edge (e.g. an
|
|
171
|
+
* IT/SEC classification affix). `true` renders the `theme`'s lozenge. */
|
|
172
|
+
lozenge?: QuickActionChipLozenge | boolean
|
|
142
173
|
/** `'primary'` = accent (yellow) chip, `'outline'` = bordered chip (default). */
|
|
143
174
|
variant?: 'primary' | 'outline'
|
|
144
175
|
/** Active single-select state (Figma "Feature Item" active): renders the
|
|
@@ -227,6 +258,7 @@ export function QuickActionChipSkeleton({ labelCh = 16, icon = true, lozenge = f
|
|
|
227
258
|
export function QuickActionChipButton({
|
|
228
259
|
label,
|
|
229
260
|
icon,
|
|
261
|
+
theme,
|
|
230
262
|
lozenge,
|
|
231
263
|
variant = 'outline',
|
|
232
264
|
selected = false,
|
|
@@ -238,8 +270,13 @@ export function QuickActionChipButton({
|
|
|
238
270
|
interactive = true,
|
|
239
271
|
className,
|
|
240
272
|
}: QuickActionChipButtonProps) {
|
|
241
|
-
|
|
242
|
-
|
|
273
|
+
// The theme's accent only fills the gap — an icon spec's own accent
|
|
274
|
+
// (admin-configured per-action color) always wins.
|
|
275
|
+
const themedIcon =
|
|
276
|
+
theme && isQuickActionIconSpec(icon) && !icon.accent ? { ...icon, accent: theme.accent } : icon
|
|
277
|
+
const resolvedLozenge = lozenge === true ? theme?.lozenge : lozenge === false ? undefined : lozenge
|
|
278
|
+
const resolvedIcon = renderQuickActionIcon(themedIcon)
|
|
279
|
+
const resolvedLabel = composeChipLabel(label, resolvedLozenge)
|
|
243
280
|
const tagVariant = selected ? (selectedAccent === 'cyan' ? 'selectedCyan' : 'selected') : variant
|
|
244
281
|
if (!interactive) {
|
|
245
282
|
return <Tag variant={tagVariant} size={size} icon={resolvedIcon} label={resolvedLabel} className={className} />
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { MarqueeSyncController } from '../ui/marquee-wall'
|
|
5
|
+
import type { QuickActionIconSpec } from './quick-action-chip'
|
|
6
|
+
import type { QuickActionChip } from './chat-quick-action-row'
|
|
7
|
+
import { QuickActionWall } from './quick-action-wall'
|
|
6
8
|
|
|
7
9
|
// =============================================================================
|
|
8
10
|
// Types
|
|
@@ -17,76 +19,81 @@ export interface QuickActionMarqueeItem {
|
|
|
17
19
|
|
|
18
20
|
export interface QuickActionMarqueeProps {
|
|
19
21
|
items: ReadonlyArray<QuickActionMarqueeItem>
|
|
20
|
-
/**
|
|
22
|
+
/** `'animated'` (default): endless scroll. `'plain'`: a static chip row —
|
|
23
|
+
* the consumer's opt-out of the marquee (no motion, no track padding
|
|
24
|
+
* effects beyond the plain layout). */
|
|
25
|
+
mode?: 'animated' | 'plain'
|
|
26
|
+
/** Scroll direction. `'right'` reverses the travel. Default `'left'`. */
|
|
21
27
|
direction?: 'left' | 'right'
|
|
22
|
-
/**
|
|
23
|
-
|
|
28
|
+
/** Scroll speed in px/s — the shared marquee unit (CardsStrip cruises at
|
|
29
|
+
* 60). Default 40: on-screen speed stays constant no matter how many quick
|
|
30
|
+
* actions an agent has (the engine is position-based, not loop-based). */
|
|
31
|
+
speed?: number
|
|
24
32
|
/** Pause the scroll while hovered. Default true. */
|
|
25
33
|
pauseOnHover?: boolean
|
|
26
34
|
/** When provided chips are interactive buttons; omitted → decorative tags. */
|
|
27
35
|
onSelect?: (item: QuickActionMarqueeItem) => void
|
|
36
|
+
/** Repeat-pad the track to at least this many chips so one copy overflows
|
|
37
|
+
* the widest container this strip can get (the loop only engages on
|
|
38
|
+
* overflow). Default 12 ≈ 2600px+, enough for a full-bleed max-w-[1920px]
|
|
39
|
+
* section. */
|
|
40
|
+
minChips?: number
|
|
41
|
+
/** Pair with a sibling marquee under ONE position driver (the resolve
|
|
42
|
+
* strips' pending/resolved copies stay pixel-locked). */
|
|
43
|
+
sync?: MarqueeSyncController
|
|
28
44
|
className?: string
|
|
29
45
|
}
|
|
30
46
|
|
|
31
|
-
// Heuristic: ~6 chips ≈ one 1280px viewport width, so the halved track always
|
|
32
|
-
// fills the screen; bump if chips shrink.
|
|
33
|
-
const MIN_TRACK_ITEMS = 6
|
|
34
|
-
|
|
35
47
|
// =============================================================================
|
|
36
48
|
// Component
|
|
37
49
|
// =============================================================================
|
|
38
50
|
|
|
39
51
|
/**
|
|
40
52
|
* Endless horizontally-scrolling strip of quick-action chips (Figma fae/mingo
|
|
41
|
-
* marquee rows)
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* and always under `prefers-reduced-motion`.
|
|
53
|
+
* marquee rows) — the single-row preset of {@link QuickActionWall} (same
|
|
54
|
+
* chips, same engine, `flex-nowrap` layout). Clone-copy chips stay
|
|
55
|
+
* interactive when `onSelect` is set (clone wrapper a11y applies). Pauses on
|
|
56
|
+
* hover (optional) and always under `prefers-reduced-motion`.
|
|
45
57
|
*/
|
|
46
58
|
export function QuickActionMarquee({
|
|
47
59
|
items,
|
|
60
|
+
mode = 'animated',
|
|
48
61
|
direction = 'left',
|
|
49
|
-
|
|
62
|
+
speed = 40,
|
|
50
63
|
pauseOnHover = true,
|
|
51
64
|
onSelect,
|
|
65
|
+
minChips = 12,
|
|
66
|
+
sync,
|
|
52
67
|
className,
|
|
53
68
|
}: QuickActionMarqueeProps) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
const chips = React.useMemo<QuickActionChip[]>(
|
|
70
|
+
() =>
|
|
71
|
+
items.map(item => ({
|
|
72
|
+
id: item.id,
|
|
73
|
+
label: item.label,
|
|
74
|
+
icon: item.icon,
|
|
75
|
+
onSelect: onSelect ? () => onSelect(item) : undefined,
|
|
76
|
+
})),
|
|
77
|
+
[items, onSelect],
|
|
78
|
+
)
|
|
59
79
|
|
|
60
80
|
if (items.length === 0) return null
|
|
61
81
|
|
|
62
82
|
return (
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
chips render as plain tags even when the strip is
|
|
79
|
-
interactive. */}
|
|
80
|
-
<QuickActionChipButton
|
|
81
|
-
label={item.label}
|
|
82
|
-
icon={item.icon}
|
|
83
|
-
interactive={!!onSelect && !isHiddenCopy}
|
|
84
|
-
onSelect={onSelect && !isHiddenCopy ? () => onSelect(item) : undefined}
|
|
85
|
-
/>
|
|
86
|
-
</span>
|
|
87
|
-
)
|
|
88
|
-
})}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
83
|
+
<QuickActionWall
|
|
84
|
+
chips={chips}
|
|
85
|
+
mode={mode}
|
|
86
|
+
axis="x"
|
|
87
|
+
reverse={direction === 'right'}
|
|
88
|
+
speed={speed}
|
|
89
|
+
pauseOnHover={pauseOnHover}
|
|
90
|
+
// Plain mode shows the items once, untruncated; padding only serves
|
|
91
|
+
// the endless loop.
|
|
92
|
+
minChips={mode === 'plain' ? undefined : minChips}
|
|
93
|
+
copyGap="var(--spacing-system-xsf)"
|
|
94
|
+
className={className}
|
|
95
|
+
contentClassName="flex-nowrap items-center"
|
|
96
|
+
sync={sync}
|
|
97
|
+
/>
|
|
91
98
|
)
|
|
92
99
|
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cn } from '../../utils/cn'
|
|
5
|
+
import {
|
|
6
|
+
MarqueeWall,
|
|
7
|
+
MarqueeWallFades,
|
|
8
|
+
type MarqueeSyncController,
|
|
9
|
+
type MarqueeWallFadeEdge,
|
|
10
|
+
type MarqueeWallProps,
|
|
11
|
+
} from '../ui/marquee-wall'
|
|
12
|
+
import { QuickActionChipSkeleton } from './quick-action-chip'
|
|
13
|
+
import type { QuickActionThemeSpec } from './quick-action-chip'
|
|
14
|
+
import { QuickActionChipFromData } from './chat-quick-action-row'
|
|
15
|
+
import type { QuickActionChip } from './chat-quick-action-row'
|
|
16
|
+
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// Shared wall constants
|
|
19
|
+
// =============================================================================
|
|
20
|
+
|
|
21
|
+
/** Skeleton label widths (ch) — realistic spread, cycled. THE wall-skeleton
|
|
22
|
+
* spread, shared with the company-hub deck's ChipWall: sized so a 24-item
|
|
23
|
+
* wall overflows typical caps at any viewport width (same fill + fade as
|
|
24
|
+
* the loaded state — zero height jump when data lands). */
|
|
25
|
+
export const WALL_SKELETON_LABEL_CH = [17, 24, 14, 20, 15, 25, 12, 21, 16, 19, 13, 23]
|
|
26
|
+
|
|
27
|
+
/** Deterministic index-alternating merge — the mixed "one stream" pile
|
|
28
|
+
* (deck slide 3's IT+SEC blend and its Storybook mirror). Input order
|
|
29
|
+
* stable → the blend never reshuffles across renders or consumers. */
|
|
30
|
+
export function interleave<T>(a: ReadonlyArray<T>, b: ReadonlyArray<T>): T[] {
|
|
31
|
+
const out: T[] = []
|
|
32
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
33
|
+
if (a[i] !== undefined) out.push(a[i])
|
|
34
|
+
if (b[i] !== undefined) out.push(b[i])
|
|
35
|
+
}
|
|
36
|
+
return out
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Brick-mode padding default: ~14 columns of chips per row (~3200px) — one
|
|
40
|
+
// row copy overflows any sensible container, so the loop always engages.
|
|
41
|
+
const DEFAULT_MIN_CHIPS_PER_ROW = 14
|
|
42
|
+
|
|
43
|
+
// =============================================================================
|
|
44
|
+
// Types
|
|
45
|
+
// =============================================================================
|
|
46
|
+
|
|
47
|
+
export interface QuickActionWallProps {
|
|
48
|
+
/** The wall's chips — the shared {@link QuickActionChip} shape (same as the
|
|
49
|
+
* chat rows), including per-chip `theme`/`lozenge` for mixed IT/SEC
|
|
50
|
+
* streams. Chips with `onSelect` render as buttons; without, as tags. */
|
|
51
|
+
chips: ReadonlyArray<QuickActionChip>
|
|
52
|
+
/** Wall-default {@link QuickActionThemeSpec} for chips without their own.
|
|
53
|
+
* Caller-supplied — the lib ships no theme registry; resolve agent colors
|
|
54
|
+
* server-side (e.g. `accentFromIdentityIcon`) and pass the spec here. */
|
|
55
|
+
theme?: QuickActionThemeSpec
|
|
56
|
+
/** `'animated'` (default): marquee + overflow fades. `'plain'`: no motion,
|
|
57
|
+
* no blur — the consumer's per-surface opt-out (forwarded to
|
|
58
|
+
* {@link MarqueeWall}; in brick mode the rows render static and the
|
|
59
|
+
* stack-level fades are skipped). */
|
|
60
|
+
mode?: 'animated' | 'plain'
|
|
61
|
+
/** Render every chip's theme lozenge (classification walls). Per-chip
|
|
62
|
+
* `lozenge` values still win. */
|
|
63
|
+
lozenges?: boolean
|
|
64
|
+
/** Marquee axis — defaults to where `fade` sits (see {@link MarqueeWall}). */
|
|
65
|
+
axis?: MarqueeWallProps['axis']
|
|
66
|
+
reverse?: boolean
|
|
67
|
+
/** px/s. Default 40 (MarqueeWall default). */
|
|
68
|
+
speed?: number
|
|
69
|
+
/** Marquee on/off (auto-off when content fits / reduced motion / loading). */
|
|
70
|
+
animate?: boolean
|
|
71
|
+
pauseOnHover?: boolean
|
|
72
|
+
fade?: MarqueeWallFadeEdge | ReadonlyArray<MarqueeWallFadeEdge>
|
|
73
|
+
/** Color behind the wall — the fades blend into it. */
|
|
74
|
+
fadeColor?: string
|
|
75
|
+
fadeSize?: MarqueeWallProps['fadeSize']
|
|
76
|
+
/** THE wall pitch — one value drives the chip gap, the clone-seam gap, and
|
|
77
|
+
* (in brick mode) the row-stack gap, so the courses read as a uniform wall
|
|
78
|
+
* and the seam is invisible by construction. Default
|
|
79
|
+
* `var(--spacing-system-xsf)`. */
|
|
80
|
+
copyGap?: number | string
|
|
81
|
+
/** Pad the track by REPEATING the chips up to this count (suffixed keys) so
|
|
82
|
+
* one copy always overflows the container and the loop engages — without
|
|
83
|
+
* it a wall whose content roughly fits its box goes static (the marquee
|
|
84
|
+
* only loops what overflows). Defaults to `rows × 14` in brick mode;
|
|
85
|
+
* unset otherwise (capped walls that always overflow, and FLIP-tracked
|
|
86
|
+
* walls where repeats would duplicate flip ids, need no padding). */
|
|
87
|
+
minChips?: number
|
|
88
|
+
/**
|
|
89
|
+
* BRICK-WALL mode: render this many stacked independent single-row
|
|
90
|
+
* marquees (chips distributed round-robin) instead of one track. Rows pack
|
|
91
|
+
* their chips edge-to-edge like bricks — a grid would column-align chips
|
|
92
|
+
* of different widths and leave holes — and each row loops on its own
|
|
93
|
+
* wrap, so the courses stagger organically. Horizontal only; the fades
|
|
94
|
+
* draw ONCE over the whole stack.
|
|
95
|
+
*/
|
|
96
|
+
rows?: number
|
|
97
|
+
/** Draw skeleton chips instead of `chips` (the shared
|
|
98
|
+
* {@link QuickActionChipSkeleton} — 1:1 geometry with loaded chips).
|
|
99
|
+
* Callers own the policy (`loading` flag vs skeleton-when-empty). */
|
|
100
|
+
loading?: boolean
|
|
101
|
+
skeletonCount?: number
|
|
102
|
+
/** Outer container (sizing: height cap for vertical walls). */
|
|
103
|
+
className?: string
|
|
104
|
+
/** Per-copy layout — default a wrapping chip wall. Override for single-row
|
|
105
|
+
* marquee strips (`flex-nowrap`). */
|
|
106
|
+
contentClassName?: string
|
|
107
|
+
/** Pair with sibling walls under one position driver (resolve strips). */
|
|
108
|
+
sync?: MarqueeSyncController
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// =============================================================================
|
|
112
|
+
// Component
|
|
113
|
+
// =============================================================================
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* <QuickActionWall> — THE quick-action chip wall: a themed pile of the shared
|
|
117
|
+
* chip on the shared {@link MarqueeWall} engine. One component for every
|
|
118
|
+
* surface that shows "the work the agents do" — homepage hero tabs, deck
|
|
119
|
+
* panels, marketing strips — whether static-with-fade or endlessly scrolling
|
|
120
|
+
* (axis follows the fade), interactive or decorative.
|
|
121
|
+
*
|
|
122
|
+
* Clone-copy chips stay INTERACTIVE (pointer cursor + working click) — the
|
|
123
|
+
* loop paints clones inside the viewport (reverse walls even START on the
|
|
124
|
+
* clone copy), and a visible chip that ignores clicks reads as broken. A11y
|
|
125
|
+
* holds via the clone wrapper: aria-hidden + focus suppression (the standard
|
|
126
|
+
* Swiper/Splide loop-clone treatment, same as CardsStrip). `pauseOnHover`
|
|
127
|
+
* (default on) freezes the track under a pointing cursor so chips never
|
|
128
|
+
* dodge a click.
|
|
129
|
+
*/
|
|
130
|
+
export function QuickActionWall({
|
|
131
|
+
chips,
|
|
132
|
+
theme,
|
|
133
|
+
mode = 'animated',
|
|
134
|
+
lozenges = false,
|
|
135
|
+
axis,
|
|
136
|
+
reverse,
|
|
137
|
+
speed,
|
|
138
|
+
animate = true,
|
|
139
|
+
pauseOnHover,
|
|
140
|
+
fade,
|
|
141
|
+
fadeColor,
|
|
142
|
+
fadeSize,
|
|
143
|
+
copyGap,
|
|
144
|
+
minChips,
|
|
145
|
+
rows,
|
|
146
|
+
loading = false,
|
|
147
|
+
skeletonCount = 24,
|
|
148
|
+
className,
|
|
149
|
+
contentClassName,
|
|
150
|
+
sync,
|
|
151
|
+
}: QuickActionWallProps) {
|
|
152
|
+
// Repeat-pad the track (stable suffixed keys; repeats keep the full chip —
|
|
153
|
+
// identical selected/interactive state, so every visible instance behaves
|
|
154
|
+
// the same and the clone copy stays geometry-identical by construction).
|
|
155
|
+
const padTarget = minChips ?? (rows ? rows * DEFAULT_MIN_CHIPS_PER_ROW : undefined)
|
|
156
|
+
const track = React.useMemo(() => {
|
|
157
|
+
if (!padTarget || chips.length === 0 || chips.length >= padTarget) return chips
|
|
158
|
+
const repeats = Math.ceil(padTarget / chips.length)
|
|
159
|
+
return Array.from({ length: repeats }, (_, r) =>
|
|
160
|
+
r === 0 ? chips : chips.map(chip => ({ ...chip, id: `${chip.id}__r${r}` })),
|
|
161
|
+
).flat()
|
|
162
|
+
}, [chips, padTarget])
|
|
163
|
+
|
|
164
|
+
const renderSkeletons = (count: number, offset = 0) =>
|
|
165
|
+
Array.from({ length: count }, (_, i) => (
|
|
166
|
+
<QuickActionChipSkeleton
|
|
167
|
+
key={i}
|
|
168
|
+
lozenge={lozenges}
|
|
169
|
+
labelCh={WALL_SKELETON_LABEL_CH[(offset + i) % WALL_SKELETON_LABEL_CH.length]}
|
|
170
|
+
/>
|
|
171
|
+
))
|
|
172
|
+
|
|
173
|
+
const renderChipNodes = (list: ReadonlyArray<QuickActionChip>) =>
|
|
174
|
+
list.map(chip => (
|
|
175
|
+
<QuickActionChipFromData
|
|
176
|
+
key={chip.id}
|
|
177
|
+
chip={chip}
|
|
178
|
+
defaultTheme={theme}
|
|
179
|
+
defaultLozenge={lozenges}
|
|
180
|
+
interactive={!!chip.onSelect}
|
|
181
|
+
className="max-w-full"
|
|
182
|
+
/>
|
|
183
|
+
))
|
|
184
|
+
|
|
185
|
+
const renderChips = () => (loading ? renderSkeletons(skeletonCount) : renderChipNodes(track))
|
|
186
|
+
|
|
187
|
+
// ONE pitch for chips, clone seams, and (brick mode) the row stack — a
|
|
188
|
+
// custom `copyGap` moves all three together, so no seam can ever disagree
|
|
189
|
+
// with the chip gap.
|
|
190
|
+
const gap = copyGap ?? 'var(--spacing-system-xsf)'
|
|
191
|
+
|
|
192
|
+
// ---- BRICK-WALL mode: stacked independent row marquees ---------------------
|
|
193
|
+
if (rows && rows > 0) {
|
|
194
|
+
const rowLists = Array.from({ length: rows }, (_, r) => track.filter((_, i) => i % rows === r))
|
|
195
|
+
const skelPerRow = Math.ceil(skeletonCount / rows)
|
|
196
|
+
return (
|
|
197
|
+
<div className={cn('relative flex flex-col overflow-hidden', className)} style={{ gap }}>
|
|
198
|
+
{rowLists.map((list, r) => (
|
|
199
|
+
<MarqueeWall
|
|
200
|
+
key={r}
|
|
201
|
+
mode={mode}
|
|
202
|
+
axis="x"
|
|
203
|
+
reverse={reverse}
|
|
204
|
+
speed={speed}
|
|
205
|
+
animate={animate && !loading}
|
|
206
|
+
pauseOnHover={pauseOnHover}
|
|
207
|
+
copyGap={gap}
|
|
208
|
+
contentClassName={cn('flex items-center', contentClassName)}
|
|
209
|
+
contentStyle={{ gap }}
|
|
210
|
+
>
|
|
211
|
+
{loading ? renderSkeletons(skelPerRow, r * 3) : renderChipNodes(list)}
|
|
212
|
+
</MarqueeWall>
|
|
213
|
+
))}
|
|
214
|
+
{mode === 'animated' && (
|
|
215
|
+
<MarqueeWallFades fade={fade} fadeColor={fadeColor} fadeSize={fadeSize} />
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<MarqueeWall
|
|
223
|
+
mode={mode}
|
|
224
|
+
axis={axis}
|
|
225
|
+
reverse={reverse}
|
|
226
|
+
speed={speed}
|
|
227
|
+
// Skeleton walls stay put — the marquee starts when real chips land.
|
|
228
|
+
animate={animate && !loading}
|
|
229
|
+
pauseOnHover={pauseOnHover}
|
|
230
|
+
fade={fade}
|
|
231
|
+
fadeColor={fadeColor}
|
|
232
|
+
fadeSize={fadeSize}
|
|
233
|
+
copyGap={gap}
|
|
234
|
+
className={className}
|
|
235
|
+
contentClassName={cn('flex flex-wrap content-start items-start', contentClassName)}
|
|
236
|
+
contentStyle={{ gap }}
|
|
237
|
+
sync={sync}
|
|
238
|
+
>
|
|
239
|
+
{renderChips()}
|
|
240
|
+
</MarqueeWall>
|
|
241
|
+
)
|
|
242
|
+
}
|