@flamingo-stack/openframe-frontend-core 0.0.438 → 0.0.439
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-LR6A67KZ.js → chunk-2ELBNZJ3.js} +2 -2
- package/dist/{chunk-6R5SZPAQ.cjs → chunk-3WJQL4DN.cjs} +15 -15
- package/dist/{chunk-6R5SZPAQ.cjs.map → chunk-3WJQL4DN.cjs.map} +1 -1
- package/dist/{chunk-KBFQF4AV.js → chunk-7WM77CSW.js} +2 -2
- package/dist/{chunk-B5SGPIJ4.cjs → chunk-AUJXLVXA.cjs} +37 -37
- package/dist/{chunk-B5SGPIJ4.cjs.map → chunk-AUJXLVXA.cjs.map} +1 -1
- package/dist/{chunk-X66KRL5G.cjs → chunk-C3FH53AP.cjs} +11 -11
- package/dist/{chunk-X66KRL5G.cjs.map → chunk-C3FH53AP.cjs.map} +1 -1
- package/dist/{chunk-W2PRXXUD.js → chunk-COMBYYQY.js} +2 -2
- package/dist/{chunk-RTHOCS3S.js → chunk-EGRZHR7J.js} +2 -2
- package/dist/{chunk-D5RTZ2WN.js → chunk-F7YVI54P.js} +4 -4
- package/dist/{chunk-5D5SJOLE.js → chunk-G5FALXNO.js} +4 -4
- package/dist/{chunk-2DCP2TIF.cjs → chunk-HTVVXVJL.cjs} +1966 -1490
- package/dist/chunk-HTVVXVJL.cjs.map +1 -0
- package/dist/{chunk-WF7VGEYR.cjs → chunk-IAN7GUIV.cjs} +26 -26
- package/dist/{chunk-WF7VGEYR.cjs.map → chunk-IAN7GUIV.cjs.map} +1 -1
- package/dist/{chunk-SYTL2VIU.cjs → chunk-M3LD6DNE.cjs} +7 -7
- package/dist/{chunk-SYTL2VIU.cjs.map → chunk-M3LD6DNE.cjs.map} +1 -1
- package/dist/{chunk-YKP2F2NC.cjs → chunk-M6QGB6DC.cjs} +26 -26
- package/dist/{chunk-YKP2F2NC.cjs.map → chunk-M6QGB6DC.cjs.map} +1 -1
- package/dist/{chunk-6ETVJ5ON.js → chunk-NQQ4NLUT.js} +6577 -6101
- package/dist/chunk-NQQ4NLUT.js.map +1 -0
- package/dist/{chunk-A25RPWYF.js → chunk-P7PISHM5.js} +2 -2
- package/dist/{chunk-44HNH57W.js → chunk-PBTY7AH5.js} +4 -4
- package/dist/{chunk-ZEY7A3MP.js → chunk-PEIR7D25.js} +2 -2
- package/dist/{chunk-DTYPYYKD.cjs → chunk-R46QEE3R.cjs} +59 -59
- package/dist/{chunk-DTYPYYKD.cjs.map → chunk-R46QEE3R.cjs.map} +1 -1
- package/dist/{chunk-H2TQ44VD.cjs → chunk-RQQZF6G6.cjs} +31 -31
- package/dist/{chunk-H2TQ44VD.cjs.map → chunk-RQQZF6G6.cjs.map} +1 -1
- package/dist/{chunk-CMP56RUC.cjs → chunk-VWGF6IFR.cjs} +62 -62
- package/dist/{chunk-CMP56RUC.cjs.map → chunk-VWGF6IFR.cjs.map} +1 -1
- package/dist/{chunk-POFDZH2C.js → chunk-WAGTZVQN.js} +4 -4
- package/dist/{chunk-XFSDFO6U.js → chunk-WPVBTVI3.js} +2 -2
- package/dist/{chunk-VYG2CJFJ.cjs → chunk-WZ6TCAYQ.cjs} +9 -9
- package/dist/{chunk-VYG2CJFJ.cjs.map → chunk-WZ6TCAYQ.cjs.map} +1 -1
- package/dist/{chunk-PCMDRDYX.cjs → chunk-ZMUFTGL7.cjs} +5 -5
- package/dist/{chunk-PCMDRDYX.cjs.map → chunk-ZMUFTGL7.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +8 -8
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/chat/chat-archive-page.d.ts +28 -8
- package/dist/components/chat/chat-archive-page.d.ts.map +1 -1
- package/dist/components/chat/chat-header-icon-button.d.ts +6 -2
- package/dist/components/chat/chat-header-icon-button.d.ts.map +1 -1
- package/dist/components/chat/chat-header-search-field.d.ts +25 -0
- package/dist/components/chat/chat-header-search-field.d.ts.map +1 -0
- package/dist/components/chat/chat-list-empty-state.d.ts +20 -0
- package/dist/components/chat/chat-list-empty-state.d.ts.map +1 -0
- package/dist/components/chat/chat-panel-header.d.ts +19 -9
- package/dist/components/chat/chat-panel-header.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.d.ts +15 -6
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-chat-dialog-manager.d.ts +2 -0
- package/dist/components/chat/hooks/use-chat-dialog-manager.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +4 -2
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.d.ts +2 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +5 -3
- package/dist/components/chat/mingo-chat-history.d.ts +5 -10
- package/dist/components/chat/mingo-chat-history.d.ts.map +1 -1
- package/dist/components/chat/mingo-history-rail.d.ts +54 -0
- package/dist/components/chat/mingo-history-rail.d.ts.map +1 -0
- package/dist/components/chat/mingo-welcome.d.ts +6 -25
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +5 -5
- package/dist/components/docs/index.js +4 -4
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/help-center-pages/index.cjs +20 -20
- package/dist/components/help-center-pages/index.js +11 -11
- package/dist/components/index.cjs +130 -128
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +13 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +5 -5
- package/dist/components/tickets/index.js +4 -4
- package/dist/components/ui/index.cjs +4 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +5 -3
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/src/components/chat/chat-archive-page.tsx +89 -73
- package/src/components/chat/chat-header-icon-button.tsx +12 -5
- package/src/components/chat/chat-header-search-field.tsx +144 -0
- package/src/components/chat/chat-list-empty-state.tsx +44 -0
- package/src/components/chat/chat-panel-header.tsx +76 -29
- package/src/components/chat/embeddable-chat.tsx +548 -125
- package/src/components/chat/guide-welcome.tsx +4 -4
- package/src/components/chat/hooks/use-chat-dialog-manager.ts +59 -5
- package/src/components/chat/index.ts +2 -0
- package/src/components/chat/mingo-chat-history.tsx +46 -100
- package/src/components/chat/mingo-history-rail.tsx +161 -0
- package/src/components/chat/mingo-welcome.tsx +17 -98
- package/src/stories/MingoWelcome.stories.tsx +2 -11
- package/dist/chunk-2DCP2TIF.cjs.map +0 -1
- package/dist/chunk-6ETVJ5ON.js.map +0 -1
- /package/dist/{chunk-LR6A67KZ.js.map → chunk-2ELBNZJ3.js.map} +0 -0
- /package/dist/{chunk-KBFQF4AV.js.map → chunk-7WM77CSW.js.map} +0 -0
- /package/dist/{chunk-W2PRXXUD.js.map → chunk-COMBYYQY.js.map} +0 -0
- /package/dist/{chunk-RTHOCS3S.js.map → chunk-EGRZHR7J.js.map} +0 -0
- /package/dist/{chunk-D5RTZ2WN.js.map → chunk-F7YVI54P.js.map} +0 -0
- /package/dist/{chunk-5D5SJOLE.js.map → chunk-G5FALXNO.js.map} +0 -0
- /package/dist/{chunk-A25RPWYF.js.map → chunk-P7PISHM5.js.map} +0 -0
- /package/dist/{chunk-44HNH57W.js.map → chunk-PBTY7AH5.js.map} +0 -0
- /package/dist/{chunk-ZEY7A3MP.js.map → chunk-PEIR7D25.js.map} +0 -0
- /package/dist/{chunk-POFDZH2C.js.map → chunk-WAGTZVQN.js.map} +0 -0
- /package/dist/{chunk-XFSDFO6U.js.map → chunk-WPVBTVI3.js.map} +0 -0
|
@@ -4,75 +4,102 @@ import * as React from 'react'
|
|
|
4
4
|
import { Chevron02LeftIcon, BoxArchiveIcon } from '../icons-v2-generated'
|
|
5
5
|
import { XmarkIcon } from '../icons-v2-generated/signs-and-symbols/xmark-icon'
|
|
6
6
|
import { ChatHeaderIconButton } from './chat-header-icon-button'
|
|
7
|
-
import { COMPACT_HEADER_BUTTON } from './chat-panel-header'
|
|
8
7
|
import { ChatPanelHeaderMobile } from './chat-panel-header-mobile'
|
|
9
|
-
import { MingoChatHistory } from './mingo-chat-history'
|
|
8
|
+
import { MingoChatHistory, MingoChatHistorySkeleton } from './mingo-chat-history'
|
|
9
|
+
import { ChatListEmptyState } from './chat-list-empty-state'
|
|
10
10
|
import type { DialogItem } from './types/component.types'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface ChatArchivePageBaseProps {
|
|
13
13
|
/** Archived dialogs, grouped (Today / Yesterday / Older) by the list. */
|
|
14
14
|
dialogs: ReadonlyArray<DialogItem>
|
|
15
15
|
/** Open an archived dialog. */
|
|
16
16
|
onSelectDialog: (id: string) => void
|
|
17
|
-
/**
|
|
18
|
-
onBack: () => void
|
|
19
|
-
/** Close the whole chat panel. */
|
|
20
|
-
onClose: () => void
|
|
21
|
-
/** True while a page is loading (drives the empty/loading copy + spinner). */
|
|
17
|
+
/** The delayed skeleton is visible (a slow first page is loading). */
|
|
22
18
|
isLoading?: boolean
|
|
19
|
+
/** A first-page load is in flight but the delayed skeleton hasn't appeared
|
|
20
|
+
* yet — keeps the empty state suppressed so it never flashes before the
|
|
21
|
+
* skeleton/data arrives. */
|
|
22
|
+
isFetching?: boolean
|
|
23
23
|
/** Whether another page of archived dialogs remains. */
|
|
24
24
|
hasMore?: boolean
|
|
25
25
|
/** Fetch the next page. */
|
|
26
26
|
onLoadMore?: () => void
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/** Standalone (default): renders its own back/close header, so BOTH handlers
|
|
30
|
+
* are required. */
|
|
31
|
+
export interface ChatArchivePageStandaloneProps extends ChatArchivePageBaseProps {
|
|
32
|
+
embedded?: false
|
|
33
|
+
/** Back chevron — returns to the previous (list) view. */
|
|
34
|
+
onBack: () => void
|
|
35
|
+
/** Close the whole chat panel. */
|
|
36
|
+
onClose: () => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Embedded (wide split layout): the archive lives in the left rail and the
|
|
40
|
+
* host header already provides the "Chat Archive" back + close controls, so
|
|
41
|
+
* the built-in header — and its handlers — are dropped. */
|
|
42
|
+
export interface ChatArchivePageEmbeddedProps extends ChatArchivePageBaseProps {
|
|
43
|
+
embedded: true
|
|
44
|
+
onBack?: never
|
|
45
|
+
onClose?: never
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ChatArchivePageProps =
|
|
49
|
+
| ChatArchivePageStandaloneProps
|
|
50
|
+
| ChatArchivePageEmbeddedProps
|
|
51
|
+
|
|
29
52
|
/**
|
|
30
53
|
* Chat Archive page — Figma node `7361:427312`. Back + title + close header
|
|
31
54
|
* over the date-grouped archived-dialog list (reuses `MingoChatHistory`
|
|
32
|
-
* without the row action menus).
|
|
55
|
+
* without the row action menus). In `embedded` mode the header is dropped so
|
|
56
|
+
* the list can slot into the split layout's left rail.
|
|
33
57
|
*/
|
|
34
|
-
export function ChatArchivePage({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
58
|
+
export function ChatArchivePage(props: ChatArchivePageProps) {
|
|
59
|
+
const {
|
|
60
|
+
dialogs,
|
|
61
|
+
onSelectDialog,
|
|
62
|
+
isLoading = false,
|
|
63
|
+
isFetching = false,
|
|
64
|
+
hasMore = false,
|
|
65
|
+
onLoadMore,
|
|
66
|
+
} = props
|
|
43
67
|
return (
|
|
44
68
|
<>
|
|
45
69
|
{/* Mobile (<md): the shared mobile header — back to the list + a ⋯ menu
|
|
46
|
-
(Close only here, since the archive list has no per-chat actions).
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
(Close only here, since the archive list has no per-chat actions).
|
|
71
|
+
`!props.embedded` narrows the union so `onBack` / `onClose` are the
|
|
72
|
+
required standalone handlers (no no-op fallbacks). */}
|
|
73
|
+
{!props.embedded && (
|
|
74
|
+
<ChatPanelHeaderMobile
|
|
75
|
+
className="flex md:hidden"
|
|
76
|
+
showBack
|
|
77
|
+
title="Chat Archive"
|
|
78
|
+
backAriaLabel="Back"
|
|
79
|
+
onBack={props.onBack}
|
|
80
|
+
onClose={props.onClose}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
55
83
|
|
|
56
|
-
{/* Desktop (md+): fixed-height bar with
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</span>
|
|
70
|
-
</div>
|
|
84
|
+
{/* Desktop (md+): fixed-height bar with full-height divider action cells —
|
|
85
|
+
the back chevron is a leading `ChatHeaderIconButton` cell matching the
|
|
86
|
+
trailing close cell (not a small inline chevron). */}
|
|
87
|
+
{!props.embedded && (
|
|
88
|
+
<div className="hidden md:flex flex-shrink-0 h-14 w-full overflow-hidden border-b border-ods-border bg-ods-card">
|
|
89
|
+
<ChatHeaderIconButton divider="right" onClick={props.onBack} aria-label="Back">
|
|
90
|
+
<Chevron02LeftIcon size={24} />
|
|
91
|
+
</ChatHeaderIconButton>
|
|
92
|
+
<div className="flex flex-1 min-w-0 items-center px-[var(--spacing-system-mf)] py-[var(--spacing-system-sf)]">
|
|
93
|
+
<span className="truncate text-h3 text-ods-text-primary">
|
|
94
|
+
Chat Archive
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
71
97
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
<ChatHeaderIconButton onClick={props.onClose} aria-label="Close">
|
|
99
|
+
<XmarkIcon size={24} />
|
|
100
|
+
</ChatHeaderIconButton>
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
76
103
|
<div className="flex flex-1 min-h-0 flex-col p-[var(--spacing-system-m)]">
|
|
77
104
|
{dialogs.length > 0 ? (
|
|
78
105
|
<MingoChatHistory
|
|
@@ -83,34 +110,23 @@ export function ChatArchivePage({
|
|
|
83
110
|
onLoadMore={onLoadMore}
|
|
84
111
|
/>
|
|
85
112
|
) : isLoading ? (
|
|
86
|
-
// First-load skeleton —
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</div>
|
|
96
|
-
))}
|
|
97
|
-
</div>
|
|
113
|
+
// First-load skeleton — the SAME grouped/bordered placeholder the
|
|
114
|
+
// active list uses, so the archive loads and lands without a layout
|
|
115
|
+
// shift or a mismatched flat-list skeleton.
|
|
116
|
+
<MingoChatHistorySkeleton />
|
|
117
|
+
) : isFetching ? (
|
|
118
|
+
// A first, uncached load is in flight but the delayed skeleton hasn't
|
|
119
|
+
// appeared yet (the 120ms window). Render nothing rather than flashing
|
|
120
|
+
// the empty state before the skeleton / data arrives.
|
|
121
|
+
null
|
|
98
122
|
) : (
|
|
99
|
-
// Empty state —
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<div className="flex flex-col gap-[var(--spacing-system-xxs)]">
|
|
107
|
-
<p className="text-h3 text-ods-text-primary">No archived chats</p>
|
|
108
|
-
<p className="max-w-xs text-h5 text-ods-text-secondary">
|
|
109
|
-
Chats you archive will appear here. Archive a chat from its
|
|
110
|
-
actions menu to tuck it away without deleting it.
|
|
111
|
-
</p>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
123
|
+
// Empty state — mirrors the "Current Chats" rail empty state
|
|
124
|
+
// (Figma 113:60939): centred 24px muted glyph + h4 title + h6 caption.
|
|
125
|
+
<ChatListEmptyState
|
|
126
|
+
icon={<BoxArchiveIcon size={24} />}
|
|
127
|
+
title="No Archived Chats"
|
|
128
|
+
description="Archived Mingo sessions will show here"
|
|
129
|
+
/>
|
|
114
130
|
)}
|
|
115
131
|
</div>
|
|
116
132
|
</>
|
|
@@ -4,12 +4,17 @@ import * as React from 'react'
|
|
|
4
4
|
import { cn } from '../../utils/cn'
|
|
5
5
|
|
|
6
6
|
export interface ChatHeaderIconButtonProps
|
|
7
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
/** Which side carries the 1px cell divider. Trailing cells (close, ⋯,
|
|
9
|
+
* archive) use the default `'left'`; a leading cell (the back chevron) uses
|
|
10
|
+
* `'right'`; `'none'` drops it. */
|
|
11
|
+
divider?: 'left' | 'right' | 'none'
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Square 56×56 icon cell used in the chat panel's top-navigation
|
|
11
|
-
* (archive / restore / close,
|
|
12
|
-
* as the 1px divider between cells.
|
|
16
|
+
* (archive / restore / close, the `⋯` menu trigger, and the leading back
|
|
17
|
+
* chevron). A border on one side acts as the 1px divider between cells.
|
|
13
18
|
*
|
|
14
19
|
* On hover only the background changes (`ods-bg-hover`) — the icon keeps its
|
|
15
20
|
* `ods-text-secondary` colour. `forwardRef` + prop spread so it works as a
|
|
@@ -18,12 +23,14 @@ export interface ChatHeaderIconButtonProps
|
|
|
18
23
|
export const ChatHeaderIconButton = React.forwardRef<
|
|
19
24
|
HTMLButtonElement,
|
|
20
25
|
ChatHeaderIconButtonProps
|
|
21
|
-
>(({ className, children, type = 'button', ...props }, ref) => (
|
|
26
|
+
>(({ className, children, type = 'button', divider = 'left', ...props }, ref) => (
|
|
22
27
|
<button
|
|
23
28
|
ref={ref}
|
|
24
29
|
type={type}
|
|
25
30
|
className={cn(
|
|
26
|
-
'flex size-14 shrink-0 items-center justify-center border-
|
|
31
|
+
'flex size-14 shrink-0 items-center justify-center border-ods-border',
|
|
32
|
+
divider === 'left' && 'border-l',
|
|
33
|
+
divider === 'right' && 'border-r',
|
|
27
34
|
'text-ods-text-secondary transition-colors hover:bg-ods-bg-hover',
|
|
28
35
|
'focus:outline-none focus-visible:ring-2 focus-visible:ring-ods-accent',
|
|
29
36
|
className,
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cn } from '../../utils/cn'
|
|
5
|
+
import { useDebounce } from '../../hooks/ui/use-debounce'
|
|
6
|
+
import { SearchIcon } from '../icons-v2-generated'
|
|
7
|
+
|
|
8
|
+
export interface ChatHeaderSearchFieldProps {
|
|
9
|
+
/** Seeds the field on mount (the current server-side search term). */
|
|
10
|
+
initialValue?: string
|
|
11
|
+
/** Emits the DEBOUNCED term. The host owns the query and refetches the
|
|
12
|
+
* dialog list server-side — the field never filters locally. */
|
|
13
|
+
onSearchChange: (query: string) => void
|
|
14
|
+
/** Collapse the field back to the title. Fired on Escape and on blur while
|
|
15
|
+
* the field is empty (an accidental open closes itself). */
|
|
16
|
+
onCollapse?: () => void
|
|
17
|
+
/** Focus the input on mount (default true — the field only mounts when the
|
|
18
|
+
* user opens search, so we drop them straight into typing). */
|
|
19
|
+
autoFocus?: boolean
|
|
20
|
+
/** Appended to the root element (e.g. to tweak the open animation). */
|
|
21
|
+
className?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Inline chat-header search field (Figma node 116:51217). When search is
|
|
26
|
+
* toggled on, the panel header's title area is REPLACED in place by this
|
|
27
|
+
* full-height field — a leading magnifier + a bare, borderless input — instead
|
|
28
|
+
* of dropping a separate search bar into the list body. Holds its own text for
|
|
29
|
+
* snappy typing and emits the debounced term via `onSearchChange`.
|
|
30
|
+
*/
|
|
31
|
+
export function ChatHeaderSearchField({
|
|
32
|
+
initialValue,
|
|
33
|
+
onSearchChange,
|
|
34
|
+
onCollapse,
|
|
35
|
+
autoFocus = true,
|
|
36
|
+
className,
|
|
37
|
+
}: ChatHeaderSearchFieldProps) {
|
|
38
|
+
const [value, setValue] = React.useState(initialValue ?? '')
|
|
39
|
+
const debounced = useDebounce(value, 300)
|
|
40
|
+
const lastEmitted = React.useRef(initialValue ?? '')
|
|
41
|
+
|
|
42
|
+
// Exit animation: collapsing plays `animate-out` (slide/fade back toward the
|
|
43
|
+
// right) BEFORE the parent unmounts us. We stay mounted through the leave —
|
|
44
|
+
// the parent only drops the field once we call `onCollapse`, which we defer
|
|
45
|
+
// to the animation's end.
|
|
46
|
+
const [exiting, setExiting] = React.useState(false)
|
|
47
|
+
const collapsedRef = React.useRef(false)
|
|
48
|
+
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
// Once the collapse starts, no further emits: Escape already flushed the
|
|
51
|
+
// cleared term synchronously, and a still-pending debounce of the typed
|
|
52
|
+
// text ("abc" → Escape before 300ms) must not resurrect a stale query
|
|
53
|
+
// while the field animates out.
|
|
54
|
+
if (exiting) return
|
|
55
|
+
if (debounced === lastEmitted.current) return
|
|
56
|
+
lastEmitted.current = debounced
|
|
57
|
+
onSearchChange(debounced)
|
|
58
|
+
}, [debounced, exiting, onSearchChange])
|
|
59
|
+
|
|
60
|
+
const finishCollapse = React.useCallback(() => {
|
|
61
|
+
if (collapsedRef.current) return
|
|
62
|
+
collapsedRef.current = true
|
|
63
|
+
onCollapse?.()
|
|
64
|
+
}, [onCollapse])
|
|
65
|
+
|
|
66
|
+
const beginCollapse = React.useCallback(() => {
|
|
67
|
+
setExiting(true)
|
|
68
|
+
}, [])
|
|
69
|
+
|
|
70
|
+
// Fallback for when `animationend` never fires (reduced motion, or the
|
|
71
|
+
// animation utilities are disabled) — otherwise the field would hang open.
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (!exiting) return
|
|
74
|
+
const t = setTimeout(finishCollapse, 240)
|
|
75
|
+
return () => clearTimeout(t)
|
|
76
|
+
}, [exiting, finishCollapse])
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
onAnimationEnd={(e) => {
|
|
81
|
+
// Only the root's OWN leave animation collapses — ignore the child
|
|
82
|
+
// icon's animations bubbling up, and the enter animation.
|
|
83
|
+
if (e.target === e.currentTarget && exiting) finishCollapse()
|
|
84
|
+
}}
|
|
85
|
+
className={cn(
|
|
86
|
+
'flex min-w-0 flex-1 items-center gap-[var(--spacing-system-xs)] px-[var(--spacing-system-sf)]',
|
|
87
|
+
exiting
|
|
88
|
+
? // Elegant leave: sweep back out to the right + fade, holding the end
|
|
89
|
+
// frame (`fill-mode-forwards`) so it stays hidden until unmount.
|
|
90
|
+
'animate-out fade-out-0 slide-out-to-right-4 duration-200 ease-in fill-mode-forwards pointer-events-none'
|
|
91
|
+
: // Elegant open: sweep in from the right (where the magnifier toggle
|
|
92
|
+
// sat) and fade up as it takes over the title area.
|
|
93
|
+
'animate-in fade-in-0 slide-in-from-right-4 duration-200 ease-out',
|
|
94
|
+
className,
|
|
95
|
+
)}
|
|
96
|
+
>
|
|
97
|
+
{/* The magnifier eases in a touch later + scales up, so the icon reads as
|
|
98
|
+
"growing" into the field rather than hard-cutting in. */}
|
|
99
|
+
<SearchIcon
|
|
100
|
+
size={24}
|
|
101
|
+
className="shrink-0 text-ods-text-secondary animate-in fade-in-0 zoom-in-75 duration-300 ease-out"
|
|
102
|
+
/>
|
|
103
|
+
{/* biome-ignore lint/a11y/noAutofocus: the field only mounts on an
|
|
104
|
+
explicit search toggle, so focusing it is the intended behaviour. */}
|
|
105
|
+
<input
|
|
106
|
+
autoFocus={autoFocus}
|
|
107
|
+
type="text"
|
|
108
|
+
value={value}
|
|
109
|
+
disabled={exiting}
|
|
110
|
+
onChange={(e) => setValue(e.target.value)}
|
|
111
|
+
onKeyDown={(e) => {
|
|
112
|
+
if (e.key === 'Escape') {
|
|
113
|
+
e.preventDefault()
|
|
114
|
+
setValue('')
|
|
115
|
+
// Emit the cleared term immediately AND record it as the last emit,
|
|
116
|
+
// so the 300ms debounce effect doesn't fire a second, redundant
|
|
117
|
+
// `onSearchChange('')` (extra server round-trip) before we unmount.
|
|
118
|
+
lastEmitted.current = ''
|
|
119
|
+
onSearchChange('')
|
|
120
|
+
beginCollapse()
|
|
121
|
+
}
|
|
122
|
+
}}
|
|
123
|
+
onBlur={() => {
|
|
124
|
+
// An accidental open (no query typed) collapses itself; a field with
|
|
125
|
+
// an active query stays open so the filtered state stays visible.
|
|
126
|
+
if (!value.trim()) {
|
|
127
|
+
// Flush the cleared term synchronously (mirrors Escape) — the
|
|
128
|
+
// debounce effect is muted once `exiting` flips, so a just-deleted
|
|
129
|
+
// query ("abc" → "" → immediate blur) must emit its reset here or
|
|
130
|
+
// the host would keep filtering by the stale term.
|
|
131
|
+
if (lastEmitted.current !== '') {
|
|
132
|
+
lastEmitted.current = ''
|
|
133
|
+
onSearchChange('')
|
|
134
|
+
}
|
|
135
|
+
beginCollapse()
|
|
136
|
+
}
|
|
137
|
+
}}
|
|
138
|
+
placeholder="Search for Chats"
|
|
139
|
+
aria-label="Search chats"
|
|
140
|
+
className="min-w-0 flex-1 bg-transparent text-h4 text-ods-text-primary placeholder:text-ods-text-secondary focus:outline-none"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cn } from '../../utils/cn'
|
|
5
|
+
|
|
6
|
+
export interface ChatListEmptyStateProps {
|
|
7
|
+
/** Centred 24px glyph — rendered muted (`ods-text-secondary`). Pass the icon
|
|
8
|
+
* already sized (e.g. `<ChatsIcon size={24} />`). */
|
|
9
|
+
icon: React.ReactNode
|
|
10
|
+
/** Title line (`h4`). */
|
|
11
|
+
title: React.ReactNode
|
|
12
|
+
/** Caption line under the title (`h6`). Omitted → title alone. */
|
|
13
|
+
description?: React.ReactNode
|
|
14
|
+
/** Appended to the root element. */
|
|
15
|
+
className?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Shared empty state for the chat-list surfaces — the "Current Chats" rail and
|
|
20
|
+
* the Chat Archive page (Figma node 113:60939). A centred 24px muted glyph over
|
|
21
|
+
* a title (`h4`) + caption (`h6`), both in `ods-text-secondary`. Kept in one
|
|
22
|
+
* place so the two lists can't drift apart.
|
|
23
|
+
*/
|
|
24
|
+
export function ChatListEmptyState({
|
|
25
|
+
icon,
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
className,
|
|
29
|
+
}: ChatListEmptyStateProps) {
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className={cn(
|
|
33
|
+
'flex flex-1 min-h-0 flex-col items-center justify-center gap-[var(--spacing-system-l)] p-[var(--spacing-system-l)] text-center text-ods-text-secondary',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<span className="flex size-6 shrink-0 items-center justify-center">{icon}</span>
|
|
38
|
+
<div className="flex flex-col">
|
|
39
|
+
<p className="text-h4">{title}</p>
|
|
40
|
+
{description && <p className="text-h6">{description}</p>}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -2,37 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { cn } from '../../utils/cn'
|
|
5
|
-
import { Chevron01LeftIcon } from '../icons-v2-generated/arrows/chevron-01-left-icon'
|
|
6
5
|
import {
|
|
6
|
+
Chevron02LeftIcon,
|
|
7
7
|
Ellipsis01Icon,
|
|
8
8
|
ClockHistoryIcon,
|
|
9
9
|
Refresh01LeftIcon,
|
|
10
|
+
SearchIcon,
|
|
10
11
|
} from '../icons-v2-generated'
|
|
11
12
|
import { XmarkIcon } from '../icons-v2-generated/signs-and-symbols/xmark-icon'
|
|
12
13
|
import { ChatHeaderIconButton } from './chat-header-icon-button'
|
|
14
|
+
import { ChatHeaderSearchField } from './chat-header-search-field'
|
|
13
15
|
import { ActionsMenuDropdown, type ActionsMenuItem } from '../ui/actions-menu'
|
|
14
16
|
import { ChatPanelHeaderMobile } from './chat-panel-header-mobile'
|
|
15
17
|
|
|
16
|
-
/**
|
|
17
|
-
* Compact rounded header button used for the desktop back chevron. Borderless
|
|
18
|
-
* square with a hover background. (Mobile uses its own header component —
|
|
19
|
-
* `ChatPanelHeaderMobile`.)
|
|
20
|
-
*/
|
|
21
|
-
export const COMPACT_HEADER_BUTTON =
|
|
22
|
-
'inline-flex shrink-0 items-center justify-center size-8 rounded-md text-ods-text-secondary transition-colors hover:bg-ods-bg-hover hover:text-ods-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ods-accent'
|
|
23
|
-
|
|
24
18
|
export interface ChatPanelHeaderProps {
|
|
25
19
|
/** Show the back-chevron + bold (h3) title. When false, the static list
|
|
26
20
|
* title (h4) is shown with no back affordance. */
|
|
27
21
|
showBack?: boolean
|
|
28
22
|
/** Title text (next to the back chevron, or the static list title). */
|
|
29
23
|
title: string
|
|
24
|
+
/** Optional sub-line under the title (e.g. the signed-in user's name).
|
|
25
|
+
* Rendered muted (`h6`) beneath the title in every view that has one. */
|
|
26
|
+
subtitle?: React.ReactNode
|
|
30
27
|
/** Accessible label for the back chevron. */
|
|
31
28
|
backAriaLabel?: string
|
|
32
29
|
/** The open conversation is an archived chat (read-only). */
|
|
33
30
|
isArchivedView?: boolean
|
|
34
|
-
/** Back-chevron handler.
|
|
35
|
-
|
|
31
|
+
/** Back-chevron handler. Required only when `showBack` — the list view has no
|
|
32
|
+
* back affordance. */
|
|
33
|
+
onBack?: () => void
|
|
36
34
|
/** Close the panel. */
|
|
37
35
|
onClose: () => void
|
|
38
36
|
/** Restore/unarchive — renders the refresh button (archived view only). */
|
|
@@ -48,6 +46,18 @@ export interface ChatPanelHeaderProps {
|
|
|
48
46
|
* panel) where the phone-sized full-bleed header (large `text-h2` title) is
|
|
49
47
|
* wrong regardless of viewport. Default false = viewport-responsive. */
|
|
50
48
|
compact?: boolean
|
|
49
|
+
/** Toggle the dialog-list search field — renders a magnifier button (list
|
|
50
|
+
* view only), before the archive clock. */
|
|
51
|
+
onToggleSearch?: () => void
|
|
52
|
+
/** Whether the search field is currently open. When true (and `onSearchChange`
|
|
53
|
+
* is wired) the title area is REPLACED in place by the inline search field
|
|
54
|
+
* and the magnifier toggle is hidden. */
|
|
55
|
+
searchActive?: boolean
|
|
56
|
+
/** Seeds the inline search field when it opens (current search term). */
|
|
57
|
+
searchQuery?: string
|
|
58
|
+
/** Emits the debounced search term from the inline field. Enables the
|
|
59
|
+
* in-header search experience (list view only). */
|
|
60
|
+
onSearchChange?: (query: string) => void
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
/**
|
|
@@ -59,6 +69,7 @@ export interface ChatPanelHeaderProps {
|
|
|
59
69
|
export function ChatPanelHeader({
|
|
60
70
|
showBack = false,
|
|
61
71
|
title,
|
|
72
|
+
subtitle,
|
|
62
73
|
backAriaLabel = 'Back',
|
|
63
74
|
isArchivedView = false,
|
|
64
75
|
onBack,
|
|
@@ -68,7 +79,13 @@ export function ChatPanelHeader({
|
|
|
68
79
|
onArchive,
|
|
69
80
|
onOpenArchive,
|
|
70
81
|
compact = false,
|
|
82
|
+
onToggleSearch,
|
|
83
|
+
searchActive = false,
|
|
84
|
+
searchQuery,
|
|
85
|
+
onSearchChange,
|
|
71
86
|
}: ChatPanelHeaderProps) {
|
|
87
|
+
// Search open (with a wired handler) swaps the title for the inline field.
|
|
88
|
+
const searchInline = searchActive && !!onSearchChange
|
|
72
89
|
// Desktop ⋯ menu (active, non-archived conversation only) — rename / archive.
|
|
73
90
|
const menuItems = [
|
|
74
91
|
onRename && { id: 'rename', label: 'Rename chat', onClick: onRename },
|
|
@@ -85,6 +102,7 @@ export function ChatPanelHeader({
|
|
|
85
102
|
className="flex md:hidden"
|
|
86
103
|
showBack={showBack}
|
|
87
104
|
title={title}
|
|
105
|
+
subtitle={subtitle}
|
|
88
106
|
backAriaLabel={backAriaLabel}
|
|
89
107
|
isArchivedView={isArchivedView}
|
|
90
108
|
onBack={onBack}
|
|
@@ -98,24 +116,41 @@ export function ChatPanelHeader({
|
|
|
98
116
|
|
|
99
117
|
{/* Compact bar: `md+` normally, or ALL widths when `compact`. Fixed-height
|
|
100
118
|
bar with full-height divider action cells. */}
|
|
101
|
-
<div
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
<div
|
|
120
|
+
className={cn(
|
|
121
|
+
'flex-shrink-0 h-14 w-full overflow-hidden border-b border-ods-border bg-ods-card',
|
|
122
|
+
compact ? 'flex' : 'hidden md:flex',
|
|
123
|
+
)}
|
|
124
|
+
>
|
|
125
|
+
{/* Back — a full-height leading cell (right divider), the same
|
|
126
|
+
`ChatHeaderIconButton` primitive as the trailing ⋯ / close cells. */}
|
|
127
|
+
{showBack && (
|
|
128
|
+
<ChatHeaderIconButton
|
|
129
|
+
divider="right"
|
|
130
|
+
onClick={onBack}
|
|
131
|
+
aria-label={backAriaLabel}
|
|
132
|
+
>
|
|
133
|
+
<Chevron02LeftIcon size={24} />
|
|
134
|
+
</ChatHeaderIconButton>
|
|
135
|
+
)}
|
|
136
|
+
{searchInline ? (
|
|
137
|
+
// Search open — the inline field takes over the title area in place
|
|
138
|
+
// (Figma 116:51217); the magnifier toggle below is hidden.
|
|
139
|
+
<ChatHeaderSearchField
|
|
140
|
+
initialValue={searchQuery}
|
|
141
|
+
onSearchChange={onSearchChange}
|
|
142
|
+
onCollapse={onToggleSearch}
|
|
143
|
+
/>
|
|
144
|
+
) : (
|
|
145
|
+
<div className="flex flex-1 min-w-0 items-center px-[var(--spacing-system-mf)] py-[var(--spacing-system-sf)]">
|
|
146
|
+
<div className="flex min-w-0 flex-col">
|
|
147
|
+
<p className="truncate text-h3 leading-tight text-ods-text-primary">{title}</p>
|
|
148
|
+
{subtitle && (
|
|
149
|
+
<p className="truncate text-h6 leading-tight text-ods-text-secondary">{subtitle}</p>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
119
154
|
|
|
120
155
|
{/* Restore (refresh) — archived chat header (Figma node 7361:425441). */}
|
|
121
156
|
{isArchivedView && onRestore && (
|
|
@@ -138,6 +173,18 @@ export function ChatPanelHeader({
|
|
|
138
173
|
/>
|
|
139
174
|
)}
|
|
140
175
|
|
|
176
|
+
{/* Dialog search toggle — list view only, before the archive entry.
|
|
177
|
+
Hidden while search is open (the inline field owns the magnifier). */}
|
|
178
|
+
{!showBack && !searchInline && onToggleSearch && (
|
|
179
|
+
<ChatHeaderIconButton
|
|
180
|
+
onClick={onToggleSearch}
|
|
181
|
+
aria-label="Search chats"
|
|
182
|
+
aria-pressed={searchActive}
|
|
183
|
+
>
|
|
184
|
+
<SearchIcon size={24} />
|
|
185
|
+
</ChatHeaderIconButton>
|
|
186
|
+
)}
|
|
187
|
+
|
|
141
188
|
{/* Chat Archive entry (Figma node 7532:225034) — list view only. */}
|
|
142
189
|
{!showBack && onOpenArchive && (
|
|
143
190
|
<ChatHeaderIconButton onClick={onOpenArchive} aria-label="Chat archive">
|