@kelpie/ui 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/resources/ai.d.ts +5 -0
- package/dist/api/resources/ai.d.ts.map +1 -1
- package/dist/api/resources/ai.js +9 -1
- package/dist/api/resources/ai.js.map +1 -1
- package/dist/api/resources/forms.d.ts +8 -0
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +39 -0
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +12 -0
- package/dist/api/resources/personIntake.d.ts.map +1 -0
- package/dist/api/resources/personIntake.js +54 -0
- package/dist/api/resources/personIntake.js.map +1 -0
- package/dist/app/KelpieApp.js +2 -2
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/AgentTasks.js +2 -2
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/AiDrawer.d.ts +13 -0
- package/dist/components/AiDrawer.d.ts.map +1 -0
- package/dist/components/AiDrawer.js +165 -0
- package/dist/components/AiDrawer.js.map +1 -0
- package/dist/components/ApiKeysPanel.js +1 -1
- package/dist/components/DataTable.js +1 -1
- package/dist/components/KanbanBoard.d.ts +5 -1
- package/dist/components/KanbanBoard.d.ts.map +1 -1
- package/dist/components/KanbanBoard.js +37 -2
- package/dist/components/KanbanBoard.js.map +1 -1
- package/dist/components/NotesPanel.js +2 -2
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/PageHeader.js +1 -1
- package/dist/components/PageHeader.js.map +1 -1
- package/dist/components/PersonIntakeDialog.d.ts +19 -0
- package/dist/components/PersonIntakeDialog.d.ts.map +1 -0
- package/dist/components/PersonIntakeDialog.js +87 -0
- package/dist/components/PersonIntakeDialog.js.map +1 -0
- package/dist/components/PersonIntakePanel.d.ts +21 -0
- package/dist/components/PersonIntakePanel.d.ts.map +1 -0
- package/dist/components/PersonIntakePanel.js +76 -0
- package/dist/components/PersonIntakePanel.js.map +1 -0
- package/dist/components/SegmentedControl.js +2 -2
- package/dist/components/SegmentedControl.js.map +1 -1
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +40 -4
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
- package/dist/components/WorkspaceSwitcher.js +10 -2
- package/dist/components/WorkspaceSwitcher.js.map +1 -1
- package/dist/components/aiDrawerState.d.ts +45 -0
- package/dist/components/aiDrawerState.d.ts.map +1 -0
- package/dist/components/aiDrawerState.js +14 -0
- package/dist/components/aiDrawerState.js.map +1 -0
- package/dist/components/personIntakeTask.d.ts +5 -0
- package/dist/components/personIntakeTask.d.ts.map +1 -0
- package/dist/components/personIntakeTask.js +13 -0
- package/dist/components/personIntakeTask.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/mediaQuery.d.ts +9 -0
- package/dist/lib/mediaQuery.d.ts.map +1 -0
- package/dist/lib/mediaQuery.js +24 -0
- package/dist/lib/mediaQuery.js.map +1 -0
- package/dist/modules/PersonIntakeWizard.d.ts +3 -0
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -0
- package/dist/modules/PersonIntakeWizard.js +227 -0
- package/dist/modules/PersonIntakeWizard.js.map +1 -0
- package/dist/modules/ai.d.ts +4 -3
- package/dist/modules/ai.d.ts.map +1 -1
- package/dist/modules/ai.js +10 -6
- package/dist/modules/ai.js.map +1 -1
- package/dist/modules/aiRunner.d.ts.map +1 -1
- package/dist/modules/aiRunner.js +7 -5
- package/dist/modules/aiRunner.js.map +1 -1
- package/dist/modules/personIntakeSelection.d.ts +7 -0
- package/dist/modules/personIntakeSelection.d.ts.map +1 -0
- package/dist/modules/personIntakeSelection.js +21 -0
- package/dist/modules/personIntakeSelection.js.map +1 -0
- package/dist/pages/FormDetail.d.ts.map +1 -1
- package/dist/pages/FormDetail.js +7 -7
- package/dist/pages/FormDetail.js.map +1 -1
- package/dist/pages/FormsPage.js +4 -4
- package/dist/pages/FormsPage.js.map +1 -1
- package/dist/pages/ListDetail.d.ts.map +1 -1
- package/dist/pages/ListDetail.js +2 -2
- package/dist/pages/ListDetail.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +9 -1
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/RoleDetail.d.ts.map +1 -1
- package/dist/pages/RoleDetail.js +3 -3
- package/dist/pages/RoleDetail.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.js +1 -1
- package/dist/pages/admin/AiAdminPage.d.ts +2 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -0
- package/dist/pages/admin/AiAdminPage.js +19 -0
- package/dist/pages/admin/AiAdminPage.js.map +1 -0
- package/dist/pages/admin/AiPage.d.ts +4 -1
- package/dist/pages/admin/AiPage.d.ts.map +1 -1
- package/dist/pages/admin/AiPage.js +77 -15
- package/dist/pages/admin/AiPage.js.map +1 -1
- package/dist/pages/admin/DataPage.js +2 -2
- package/dist/pages/admin/McpPanel.d.ts +3 -0
- package/dist/pages/admin/McpPanel.d.ts.map +1 -0
- package/dist/pages/admin/McpPanel.js +123 -0
- package/dist/pages/admin/McpPanel.js.map +1 -0
- package/dist/pages/admin/PrivacyPage.js +19 -3
- package/dist/pages/admin/PrivacyPage.js.map +1 -1
- package/dist/pages/forms/AddFieldMenu.js +2 -2
- package/dist/pages/forms/AddFieldMenu.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +5 -2
- package/dist/pages/forms/EmbedPanel.js.map +1 -1
- package/dist/pages/forms/FieldsEditor.d.ts.map +1 -1
- package/dist/pages/forms/FieldsEditor.js +90 -8
- package/dist/pages/forms/FieldsEditor.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +73 -6
- package/dist/pages/forms/FormSettings.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +2 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +2 -1
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/fieldList.d.ts +2 -2
- package/dist/pages/forms/fieldList.d.ts.map +1 -1
- package/dist/pages/forms/fieldList.js +38 -10
- package/dist/pages/forms/fieldList.js.map +1 -1
- package/dist/pages/forms/template.d.ts.map +1 -1
- package/dist/pages/forms/template.js +13 -0
- package/dist/pages/forms/template.js.map +1 -1
- package/dist/pages/handbook/HandbookPage.js +4 -4
- package/dist/pages/handbook/HandbookPage.js.map +1 -1
- package/dist/registry/context.d.ts +5 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +8 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +37 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/registry.d.ts +8 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +13 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/resources/ai.ts +11 -1
- package/src/api/resources/forms.ts +56 -0
- package/src/api/resources/personIntake.ts +95 -0
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/AgentTasks.tsx +2 -2
- package/src/components/AiDrawer.tsx +272 -0
- package/src/components/ApiKeysPanel.tsx +1 -1
- package/src/components/DataTable.tsx +1 -1
- package/src/components/KanbanBoard.tsx +119 -2
- package/src/components/NotesPanel.tsx +7 -4
- package/src/components/PageHeader.tsx +1 -1
- package/src/components/PersonIntakePanel.tsx +193 -0
- package/src/components/SegmentedControl.tsx +2 -2
- package/src/components/Shell.tsx +99 -13
- package/src/components/WorkspaceSwitcher.tsx +13 -2
- package/src/components/aiDrawerState.ts +61 -0
- package/src/components/personIntakeTask.tsx +14 -0
- package/src/index.ts +12 -1
- package/src/lib/mediaQuery.ts +32 -0
- package/src/modules/PersonIntakeWizard.tsx +638 -0
- package/src/modules/ai.tsx +10 -6
- package/src/modules/aiRunner.ts +8 -5
- package/src/modules/personIntakeSelection.ts +24 -0
- package/src/pages/FormDetail.tsx +18 -14
- package/src/pages/FormsPage.tsx +4 -4
- package/src/pages/ListDetail.tsx +5 -3
- package/src/pages/PeoplePage.tsx +18 -5
- package/src/pages/RoleDetail.tsx +10 -5
- package/src/pages/account/ConnectedAppsPage.tsx +1 -1
- package/src/pages/admin/AiAdminPage.tsx +52 -0
- package/src/pages/admin/AiPage.tsx +136 -32
- package/src/pages/admin/DataPage.tsx +2 -2
- package/src/pages/admin/{McpPage.tsx → McpPanel.tsx} +4 -6
- package/src/pages/admin/PrivacyPage.tsx +42 -0
- package/src/pages/forms/AddFieldMenu.tsx +2 -2
- package/src/pages/forms/EmbedPanel.tsx +5 -1
- package/src/pages/forms/FieldsEditor.tsx +204 -15
- package/src/pages/forms/FormSettings.tsx +156 -9
- package/src/pages/forms/SubmissionDetail.tsx +2 -1
- package/src/pages/forms/SubmissionsTable.tsx +2 -1
- package/src/pages/forms/fieldList.ts +39 -10
- package/src/pages/forms/template.ts +13 -0
- package/src/pages/handbook/HandbookPage.tsx +5 -5
- package/src/registry/context.ts +13 -0
- package/src/registry/contributions.ts +39 -1
- package/src/registry/registry.ts +30 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
import { useSession } from '../api/resources/session.ts'
|
|
5
|
+
import {
|
|
6
|
+
AiDrawerBusyNoticeContext,
|
|
7
|
+
AiDrawerContext,
|
|
8
|
+
AiDrawerPendingContext,
|
|
9
|
+
useAiDrawer,
|
|
10
|
+
} from './aiDrawerState.ts'
|
|
11
|
+
import type { AiDrawerControls, AiDrawerState, AiDrawerTask } from './aiDrawerState.ts'
|
|
12
|
+
import { ErrorBoundary } from './ErrorBoundary.tsx'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The side drawer AI work runs in, so the page next to it stays usable.
|
|
16
|
+
*
|
|
17
|
+
* Core owns the frame, the open state and the one active task. Modules and
|
|
18
|
+
* pages supply the content through `useAiDrawer().open(task)`, from
|
|
19
|
+
* `aiDrawerState.ts`. The state sits
|
|
20
|
+
* in `Shell`, above the routed outlet, so it survives a route change.
|
|
21
|
+
*
|
|
22
|
+
* Closing only hides the drawer. A task keeps its step and any request in
|
|
23
|
+
* flight in React state, and unmounting it would lose both, so the content
|
|
24
|
+
* stays mounted until the task finishes or the user discards it.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const WIDTH_STORAGE_KEY = 'kelpie.aiDrawer.width'
|
|
28
|
+
const DEFAULT_WIDTH = 400
|
|
29
|
+
const MIN_WIDTH = 320
|
|
30
|
+
|
|
31
|
+
function maxWidth(): number {
|
|
32
|
+
return Math.max(MIN_WIDTH, Math.floor(window.innerWidth / 2))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function clampWidth(width: number): number {
|
|
36
|
+
return Math.min(Math.max(width, MIN_WIDTH), maxWidth())
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A convenience, so a failed read (private window, blocked storage) falls back to the default. */
|
|
40
|
+
function readStoredWidth(): number {
|
|
41
|
+
try {
|
|
42
|
+
const stored = Number(localStorage.getItem(WIDTH_STORAGE_KEY))
|
|
43
|
+
|
|
44
|
+
return Number.isFinite(stored) && stored > 0 ? clampWidth(stored) : DEFAULT_WIDTH
|
|
45
|
+
} catch {
|
|
46
|
+
return DEFAULT_WIDTH
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function storeWidth(width: number): void {
|
|
51
|
+
try {
|
|
52
|
+
localStorage.setItem(WIDTH_STORAGE_KEY, String(width))
|
|
53
|
+
} catch {
|
|
54
|
+
// The width is a per-browser convenience. Not saving it is harmless.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function AiDrawerProvider({ children }: { readonly children: ReactNode }): React.JSX.Element {
|
|
59
|
+
const [activeTask, setActiveTask] = useState<AiDrawerTask | undefined>(undefined)
|
|
60
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
61
|
+
const [isPending, setIsPending] = useState(false)
|
|
62
|
+
const [busyNotice, setBusyNotice] = useState(false)
|
|
63
|
+
const activeRef = useRef<AiDrawerTask | undefined>(undefined)
|
|
64
|
+
const { session } = useSession()
|
|
65
|
+
const workspaceId = session?.workspaceId ?? null
|
|
66
|
+
const workspaceRef = useRef<string | null>(workspaceId)
|
|
67
|
+
|
|
68
|
+
const finish = useCallback((): void => {
|
|
69
|
+
activeRef.current = undefined
|
|
70
|
+
setActiveTask(undefined)
|
|
71
|
+
setIsOpen(false)
|
|
72
|
+
setIsPending(false)
|
|
73
|
+
setBusyNotice(false)
|
|
74
|
+
}, [])
|
|
75
|
+
|
|
76
|
+
const open = useCallback((task: AiDrawerTask): boolean => {
|
|
77
|
+
setIsOpen(true)
|
|
78
|
+
|
|
79
|
+
if (activeRef.current !== undefined) {
|
|
80
|
+
setBusyNotice(true)
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
activeRef.current = task
|
|
85
|
+
setActiveTask(task)
|
|
86
|
+
setBusyNotice(false)
|
|
87
|
+
return true
|
|
88
|
+
}, [])
|
|
89
|
+
|
|
90
|
+
const reopen = useCallback((): void => {
|
|
91
|
+
if (activeRef.current !== undefined) setIsOpen(true)
|
|
92
|
+
}, [])
|
|
93
|
+
|
|
94
|
+
const close = useCallback((): void => {
|
|
95
|
+
setIsOpen(false)
|
|
96
|
+
setBusyNotice(false)
|
|
97
|
+
}, [])
|
|
98
|
+
|
|
99
|
+
// A task belongs to one workspace. The switcher asks first when a request is
|
|
100
|
+
// pending; this is the backstop for any other way the session moves.
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (workspaceRef.current !== null && workspaceId !== null && workspaceRef.current !== workspaceId) {
|
|
103
|
+
finish()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (workspaceId !== null) workspaceRef.current = workspaceId
|
|
107
|
+
}, [workspaceId, finish])
|
|
108
|
+
|
|
109
|
+
const state = useMemo<AiDrawerState>(
|
|
110
|
+
() => ({ activeTask, isOpen, isPending, open, reopen, close, finish }),
|
|
111
|
+
[activeTask, isOpen, isPending, open, reopen, close, finish],
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<AiDrawerContext.Provider value={state}>
|
|
116
|
+
<AiDrawerBusyNoticeContext.Provider value={busyNotice}>
|
|
117
|
+
<AiDrawerPendingContext.Provider value={setIsPending}>{children}</AiDrawerPendingContext.Provider>
|
|
118
|
+
</AiDrawerBusyNoticeContext.Provider>
|
|
119
|
+
</AiDrawerContext.Provider>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The drawer itself. `Shell` places it after `<main>`: beside the page from the
|
|
125
|
+
* `md` breakpoint, so the page narrows; on top of it below that, with no
|
|
126
|
+
* backdrop, because a phone has no room to push.
|
|
127
|
+
*/
|
|
128
|
+
export function AiDrawerPanel(): React.JSX.Element | null {
|
|
129
|
+
const { activeTask, isOpen, close, finish, isPending } = useAiDrawer()
|
|
130
|
+
const busyNotice = useContext(AiDrawerBusyNoticeContext)
|
|
131
|
+
const setPending = useContext(AiDrawerPendingContext)
|
|
132
|
+
const [width, setWidth] = useState(readStoredWidth)
|
|
133
|
+
const widthRef = useRef(width)
|
|
134
|
+
const asideRef = useRef<HTMLElement>(null)
|
|
135
|
+
const [height, setHeight] = useState<number | undefined>(undefined)
|
|
136
|
+
|
|
137
|
+
// Beside the page, the drawer sticks to the top of the viewport and fills it
|
|
138
|
+
// down from its own top edge. Measured, not a fixed offset, because what sits
|
|
139
|
+
// above the shell (the header, an environment banner) varies by install.
|
|
140
|
+
useLayoutEffect(() => {
|
|
141
|
+
const aside = asideRef.current
|
|
142
|
+
|
|
143
|
+
if (aside === null || !isOpen) return
|
|
144
|
+
|
|
145
|
+
function measure(): void {
|
|
146
|
+
if (aside === null) return
|
|
147
|
+
setHeight(window.innerHeight - Math.max(0, aside.getBoundingClientRect().top))
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
measure()
|
|
151
|
+
window.addEventListener('scroll', measure, { passive: true })
|
|
152
|
+
window.addEventListener('resize', measure)
|
|
153
|
+
|
|
154
|
+
return () => {
|
|
155
|
+
window.removeEventListener('scroll', measure)
|
|
156
|
+
window.removeEventListener('resize', measure)
|
|
157
|
+
}
|
|
158
|
+
}, [isOpen, activeTask])
|
|
159
|
+
|
|
160
|
+
const controls = useMemo<AiDrawerControls>(() => ({ close, finish, setPending }), [close, finish, setPending])
|
|
161
|
+
|
|
162
|
+
if (activeTask === undefined) {
|
|
163
|
+
return null
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function startResize(event: React.PointerEvent<HTMLDivElement>): void {
|
|
167
|
+
event.preventDefault()
|
|
168
|
+
const handle = event.currentTarget
|
|
169
|
+
handle.setPointerCapture(event.pointerId)
|
|
170
|
+
|
|
171
|
+
function onMove(move: PointerEvent): void {
|
|
172
|
+
const next = clampWidth(window.innerWidth - move.clientX)
|
|
173
|
+
widthRef.current = next
|
|
174
|
+
setWidth(next)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function onUp(): void {
|
|
178
|
+
handle.removeEventListener('pointermove', onMove)
|
|
179
|
+
handle.removeEventListener('pointerup', onUp)
|
|
180
|
+
storeWidth(widthRef.current)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
handle.addEventListener('pointermove', onMove)
|
|
184
|
+
handle.addEventListener('pointerup', onUp)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<aside
|
|
189
|
+
ref={asideRef}
|
|
190
|
+
hidden={!isOpen}
|
|
191
|
+
aria-label={activeTask.title}
|
|
192
|
+
style={
|
|
193
|
+
{
|
|
194
|
+
'--ai-drawer-width': `${String(width)}px`,
|
|
195
|
+
'--ai-drawer-height': height === undefined ? '100vh' : `${String(height)}px`,
|
|
196
|
+
} as React.CSSProperties
|
|
197
|
+
}
|
|
198
|
+
onKeyDown={(event) => {
|
|
199
|
+
if (event.key === 'Escape') close()
|
|
200
|
+
}}
|
|
201
|
+
className="fixed inset-y-0 right-0 z-30 flex w-full flex-col border-l border-border bg-surface sm:w-[400px] md:sticky md:top-0 md:z-auto md:h-(--ai-drawer-height) md:w-(--ai-drawer-width) md:shrink-0 md:self-start"
|
|
202
|
+
>
|
|
203
|
+
<div
|
|
204
|
+
role="separator"
|
|
205
|
+
aria-orientation="vertical"
|
|
206
|
+
aria-label="Resize the drawer"
|
|
207
|
+
onPointerDown={startResize}
|
|
208
|
+
className="absolute inset-y-0 -left-1 hidden w-2 cursor-col-resize md:block"
|
|
209
|
+
/>
|
|
210
|
+
<div className="flex items-start justify-between gap-3 border-b border-border px-4 py-3">
|
|
211
|
+
<div className="min-w-0">
|
|
212
|
+
<div className="truncate text-[14px] font-semibold text-ink">{activeTask.title}</div>
|
|
213
|
+
{activeTask.description !== undefined && (
|
|
214
|
+
<div className="mt-0.5 text-[12px] text-ink-muted">{activeTask.description}</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
<div className="flex shrink-0 items-center gap-3">
|
|
218
|
+
<button
|
|
219
|
+
type="button"
|
|
220
|
+
className="text-[12px] font-medium text-ink-muted hover:text-danger"
|
|
221
|
+
onClick={() => {
|
|
222
|
+
if (!isPending || window.confirm('AI is still working on this task. Discard it?')) finish()
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
Discard
|
|
226
|
+
</button>
|
|
227
|
+
<button type="button" className="text-[12px] font-medium text-ink-muted hover:text-ink" onClick={close}>
|
|
228
|
+
Close
|
|
229
|
+
</button>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
{busyNotice && (
|
|
233
|
+
<p role="status" className="border-b border-border bg-surface-sunken px-4 py-2 text-[12px] text-ink-muted">
|
|
234
|
+
Finish or discard this task to start a new one.
|
|
235
|
+
</p>
|
|
236
|
+
)}
|
|
237
|
+
<div className="flex min-h-0 flex-1 flex-col">
|
|
238
|
+
<ErrorBoundary key={activeTask.id}>{activeTask.render(controls)}</ErrorBoundary>
|
|
239
|
+
</div>
|
|
240
|
+
</aside>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Header button for an active task while the drawer is hidden. */
|
|
245
|
+
export function AiDrawerLauncher(): React.JSX.Element | null {
|
|
246
|
+
const { activeTask, isOpen, isPending, reopen } = useAiDrawer()
|
|
247
|
+
|
|
248
|
+
if (activeTask === undefined || isOpen) {
|
|
249
|
+
return null
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<button
|
|
254
|
+
type="button"
|
|
255
|
+
onClick={reopen}
|
|
256
|
+
title={isPending ? `${activeTask.title}: working` : activeTask.title}
|
|
257
|
+
className="inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-ink transition hover:border-border-strong hover:bg-surface-sunken"
|
|
258
|
+
>
|
|
259
|
+
{isPending ? (
|
|
260
|
+
<span
|
|
261
|
+
aria-hidden="true"
|
|
262
|
+
className="h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-accent border-t-transparent"
|
|
263
|
+
/>
|
|
264
|
+
) : (
|
|
265
|
+
<span aria-hidden="true" className="text-accent">
|
|
266
|
+
✦
|
|
267
|
+
</span>
|
|
268
|
+
)}
|
|
269
|
+
<span className="truncate">{activeTask.title}</span>
|
|
270
|
+
</button>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
@@ -426,7 +426,7 @@ function ApiKeyTable({
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
return (
|
|
429
|
-
<div className="overflow-
|
|
429
|
+
<div className="overflow-x-auto rounded-md border border-border">
|
|
430
430
|
<table className="w-full text-left text-[13px]">
|
|
431
431
|
<thead>
|
|
432
432
|
<tr className="border-b border-border bg-surface text-[11px] font-semibold tracking-wide text-ink-muted uppercase">
|
|
@@ -167,7 +167,7 @@ export function DataTable<TRow>({
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
return (
|
|
170
|
-
<div className="overflow-
|
|
170
|
+
<div className="overflow-x-auto rounded-md border border-border">
|
|
171
171
|
<table className="w-full border-collapse text-left text-[13px]">
|
|
172
172
|
<thead>
|
|
173
173
|
<tr className="border-b border-border">
|
|
@@ -11,12 +11,18 @@ import {
|
|
|
11
11
|
import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core'
|
|
12
12
|
import { useEffect, useRef, useState } from 'react'
|
|
13
13
|
import type { ReactNode } from 'react'
|
|
14
|
-
import { useNavigate } from 'react-router'
|
|
14
|
+
import { Link, useNavigate } from 'react-router'
|
|
15
|
+
|
|
16
|
+
import { BELOW_MD_QUERY, useMediaQuery } from '../lib/mediaQuery.ts'
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* The pipeline board, ported from the mockup: one droppable column per stage,
|
|
18
20
|
* draggable cards, and an overlay following the pointer. Dropping a card calls
|
|
19
21
|
* `onMove`; what that persists is the page's business.
|
|
22
|
+
*
|
|
23
|
+
* Below `md` the board is a vertical list instead: one collapsible section per
|
|
24
|
+
* stage, and a stage menu on each card in place of drag. Dragging on a phone
|
|
25
|
+
* fights the page scroll, and the menu calls the same `onMove`.
|
|
20
26
|
*/
|
|
21
27
|
|
|
22
28
|
export interface KanbanStage {
|
|
@@ -48,7 +54,13 @@ function isStageDropData(data: unknown): data is { type: string; stageId: string
|
|
|
48
54
|
)
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
export function KanbanBoard(
|
|
57
|
+
export function KanbanBoard(props: KanbanBoardProps): React.JSX.Element {
|
|
58
|
+
const narrow = useMediaQuery(BELOW_MD_QUERY)
|
|
59
|
+
|
|
60
|
+
return narrow ? <KanbanList {...props} /> : <KanbanColumns {...props} />
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function KanbanColumns({ stages, cards, onMove }: KanbanBoardProps): React.JSX.Element {
|
|
52
64
|
const [activeId, setActiveId] = useState<string | null>(null)
|
|
53
65
|
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }))
|
|
54
66
|
|
|
@@ -232,3 +244,108 @@ function CardFace({ card }: { readonly card: KanbanCard }): React.JSX.Element {
|
|
|
232
244
|
</div>
|
|
233
245
|
)
|
|
234
246
|
}
|
|
247
|
+
|
|
248
|
+
function KanbanList({ stages, cards, onMove }: KanbanBoardProps): React.JSX.Element {
|
|
249
|
+
const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(new Set())
|
|
250
|
+
|
|
251
|
+
function toggle(stageId: string): void {
|
|
252
|
+
setCollapsed((current) => {
|
|
253
|
+
const next = new Set(current)
|
|
254
|
+
|
|
255
|
+
if (next.has(stageId)) {
|
|
256
|
+
next.delete(stageId)
|
|
257
|
+
} else {
|
|
258
|
+
next.add(stageId)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return next
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<div className="flex flex-col gap-3">
|
|
267
|
+
{stages.map((stage) => {
|
|
268
|
+
const stageCards = cards.filter((card) => card.stage === stage.id)
|
|
269
|
+
const open = !collapsed.has(stage.id)
|
|
270
|
+
const bodyId = `kanban-stage-${stage.id}`
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<section key={stage.id} className="rounded-md border border-border bg-surface-sunken/40">
|
|
274
|
+
<h3>
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
aria-expanded={open}
|
|
278
|
+
aria-controls={bodyId}
|
|
279
|
+
onClick={() => {
|
|
280
|
+
toggle(stage.id)
|
|
281
|
+
}}
|
|
282
|
+
className="flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left"
|
|
283
|
+
>
|
|
284
|
+
<span className="flex items-center gap-2 text-[12px] font-semibold text-ink">
|
|
285
|
+
<svg
|
|
286
|
+
viewBox="0 0 12 12"
|
|
287
|
+
aria-hidden
|
|
288
|
+
className={`h-2.5 w-2.5 shrink-0 text-ink-faint transition-transform ${open ? 'rotate-90' : ''}`}
|
|
289
|
+
>
|
|
290
|
+
<path d="M4 2l4 4-4 4" fill="none" stroke="currentColor" strokeWidth="1.5" />
|
|
291
|
+
</svg>
|
|
292
|
+
{stage.label}
|
|
293
|
+
</span>
|
|
294
|
+
<span className="font-mono text-[11px] text-ink-faint">{stageCards.length}</span>
|
|
295
|
+
</button>
|
|
296
|
+
</h3>
|
|
297
|
+
{open && (
|
|
298
|
+
<div id={bodyId} className="flex flex-col gap-2 px-2 pb-2">
|
|
299
|
+
{stageCards.length === 0 ? (
|
|
300
|
+
<div className="rounded-md border border-dashed border-border px-3 py-2 text-[11px] text-ink-faint">
|
|
301
|
+
No cards
|
|
302
|
+
</div>
|
|
303
|
+
) : (
|
|
304
|
+
stageCards.map((card) => (
|
|
305
|
+
<KanbanListCard key={card.id} card={card} stages={stages} onMove={onMove} />
|
|
306
|
+
))
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
)}
|
|
310
|
+
</section>
|
|
311
|
+
)
|
|
312
|
+
})}
|
|
313
|
+
</div>
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function KanbanListCard({
|
|
318
|
+
card,
|
|
319
|
+
stages,
|
|
320
|
+
onMove,
|
|
321
|
+
}: {
|
|
322
|
+
readonly card: KanbanCard
|
|
323
|
+
readonly stages: readonly KanbanStage[]
|
|
324
|
+
readonly onMove: (cardId: string, stageId: string) => void
|
|
325
|
+
}): React.JSX.Element {
|
|
326
|
+
return (
|
|
327
|
+
<div className="rounded-md border border-border bg-surface-raised">
|
|
328
|
+
<Link to={card.href} className="block">
|
|
329
|
+
<CardFace card={card} />
|
|
330
|
+
</Link>
|
|
331
|
+
<div className="border-t border-border px-3 py-2">
|
|
332
|
+
<select
|
|
333
|
+
aria-label={`Stage for ${card.title}`}
|
|
334
|
+
value={card.stage}
|
|
335
|
+
onChange={(event) => {
|
|
336
|
+
if (event.target.value !== card.stage) {
|
|
337
|
+
onMove(card.id, event.target.value)
|
|
338
|
+
}
|
|
339
|
+
}}
|
|
340
|
+
className="w-full rounded-md border border-border bg-surface px-2 py-1.5 text-[12px] text-ink outline-none focus:border-accent"
|
|
341
|
+
>
|
|
342
|
+
{stages.map((stage) => (
|
|
343
|
+
<option key={stage.id} value={stage.id}>
|
|
344
|
+
{stage.label}
|
|
345
|
+
</option>
|
|
346
|
+
))}
|
|
347
|
+
</select>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
)
|
|
351
|
+
}
|
|
@@ -215,16 +215,19 @@ function NoteItem({
|
|
|
215
215
|
target.highlighted ? FRAGMENT_HIGHLIGHT : ''
|
|
216
216
|
}`}
|
|
217
217
|
>
|
|
218
|
-
|
|
218
|
+
{/* Below md the label and buttons sit in a row above the note, so the note
|
|
219
|
+
has the full card width; there is no hover on a phone, so the buttons
|
|
220
|
+
stay visible there. */}
|
|
221
|
+
<div className="flex flex-col gap-2 md:flex-row md:items-start md:justify-between">
|
|
219
222
|
<div className="min-w-0 flex-1">
|
|
220
223
|
<MarkdownView source={note.body} references={note.references} />
|
|
221
224
|
</div>
|
|
222
|
-
<div className="flex shrink-0 flex-col items-end gap-1">
|
|
225
|
+
<div className="order-first flex shrink-0 items-center gap-2 md:order-none md:flex-col md:items-end md:gap-1">
|
|
223
226
|
{note.pinned && (
|
|
224
227
|
<span className="text-[10px] font-semibold tracking-wide text-accent uppercase">Pinned</span>
|
|
225
228
|
)}
|
|
226
229
|
{confirmingDelete ? (
|
|
227
|
-
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
230
|
+
<div className="ml-auto flex flex-wrap items-center justify-end gap-2 md:ml-0">
|
|
228
231
|
<span className="text-[11px] text-ink-muted">Delete this note?</span>
|
|
229
232
|
<button
|
|
230
233
|
type="button"
|
|
@@ -248,7 +251,7 @@ function NoteItem({
|
|
|
248
251
|
</button>
|
|
249
252
|
</div>
|
|
250
253
|
) : (
|
|
251
|
-
<span className="flex gap-1 opacity-0
|
|
254
|
+
<span className="ml-auto flex gap-1 transition-opacity md:ml-0 md:opacity-0 md:group-hover:opacity-100 md:focus-within:opacity-100">
|
|
252
255
|
<button
|
|
253
256
|
type="button"
|
|
254
257
|
onClick={() => {
|
|
@@ -25,7 +25,7 @@ export function PageHeader({
|
|
|
25
25
|
<p className="mt-0.5 text-[13px] text-ink-muted">{description}</p>
|
|
26
26
|
)}
|
|
27
27
|
</div>
|
|
28
|
-
<div className="flex items-center gap-2">
|
|
28
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
29
29
|
{actions}
|
|
30
30
|
{onAdd !== undefined && <AddButton onClick={onAdd} label={addLabel} />}
|
|
31
31
|
</div>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { PERSON_INTAKE_MAX_TEXT } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
import { useResolveAgentTask } from '../api/resources/agentTasks.ts'
|
|
6
|
+
import { useWorkspace } from '../api/resources/workspace.ts'
|
|
7
|
+
import type { AgentRunnerAvailability, PersonIntakeProvider } from '../registry/contributions.ts'
|
|
8
|
+
import { usePersonIntakeProvider } from '../registry/context.ts'
|
|
9
|
+
import { ErrorPanel, LoadingPanel } from './QueryState.tsx'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* People's **Add from notes**: a second way to add a person, from what the
|
|
13
|
+
* user already knows.
|
|
14
|
+
*
|
|
15
|
+
* Core owns the button and this panel, which runs in the AI drawer so the page
|
|
16
|
+
* stays usable while the model works. When a module provides a wizard and it
|
|
17
|
+
* is ready (Kelpie AI enabled, with a key), the panel renders it. Without one,
|
|
18
|
+
* the panel still works: it builds the `workspace.add_person` prompt
|
|
19
|
+
* with the user's notes appended, for the user to paste into their own agent.
|
|
20
|
+
* That is the same pattern as the Log transcript task.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const ADD_PERSON_TASK = 'workspace.add_person'
|
|
24
|
+
|
|
25
|
+
export function AddFromNotesButton({ onClick }: { readonly onClick: () => void }): React.JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
onClick={onClick}
|
|
30
|
+
title="Add a person from notes"
|
|
31
|
+
className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-[12px] font-medium text-ink transition hover:border-border-strong hover:bg-surface-sunken"
|
|
32
|
+
>
|
|
33
|
+
<span aria-hidden="true" className="text-accent">
|
|
34
|
+
✦
|
|
35
|
+
</span>
|
|
36
|
+
Add from notes
|
|
37
|
+
</button>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface PersonIntakePanelProps {
|
|
42
|
+
/** Ends the intake. */
|
|
43
|
+
readonly onClose: () => void
|
|
44
|
+
readonly onPendingChange: (pending: boolean) => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function PersonIntakePanel({ onClose, onPendingChange }: PersonIntakePanelProps): React.JSX.Element {
|
|
48
|
+
const provider = usePersonIntakeProvider()
|
|
49
|
+
|
|
50
|
+
return provider === undefined ? (
|
|
51
|
+
<CopyPromptIntake reason="The AI module is not part of this install." />
|
|
52
|
+
) : (
|
|
53
|
+
<ProvidedIntake provider={provider} onClose={onClose} onPendingChange={onPendingChange} />
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Split out so `useAvailability` is only called when a provider exists. */
|
|
58
|
+
function ProvidedIntake({
|
|
59
|
+
provider,
|
|
60
|
+
onClose,
|
|
61
|
+
onPendingChange,
|
|
62
|
+
}: {
|
|
63
|
+
readonly provider: PersonIntakeProvider
|
|
64
|
+
readonly onClose: () => void
|
|
65
|
+
readonly onPendingChange: (pending: boolean) => void
|
|
66
|
+
}): React.JSX.Element {
|
|
67
|
+
const availability: AgentRunnerAvailability = provider.useAvailability({ enabled: true })
|
|
68
|
+
|
|
69
|
+
if (availability.status === 'loading') {
|
|
70
|
+
return <LoadingPanel label="Checking AI…" />
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (availability.status === 'unavailable') {
|
|
74
|
+
return <CopyPromptIntake reason={availability.reason} />
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const Wizard = provider.Wizard
|
|
78
|
+
|
|
79
|
+
return <Wizard onClose={onClose} onPendingChange={onPendingChange} />
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The panel body and footer, the same frame the wizard's steps use. */
|
|
83
|
+
export function IntakeFrame({
|
|
84
|
+
children,
|
|
85
|
+
footer,
|
|
86
|
+
}: {
|
|
87
|
+
readonly children: ReactNode
|
|
88
|
+
readonly footer: ReactNode
|
|
89
|
+
}): React.JSX.Element {
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<div className="min-h-0 flex-1 overflow-y-auto px-4 py-3">{children}</div>
|
|
93
|
+
<div className="flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3">{footer}</div>
|
|
94
|
+
</>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function NotesField({
|
|
99
|
+
value,
|
|
100
|
+
onChange,
|
|
101
|
+
disabled = false,
|
|
102
|
+
}: {
|
|
103
|
+
readonly value: string
|
|
104
|
+
readonly onChange: (value: string) => void
|
|
105
|
+
readonly disabled?: boolean
|
|
106
|
+
}): React.JSX.Element {
|
|
107
|
+
return (
|
|
108
|
+
<label className="block text-[12px] font-medium text-ink-muted">
|
|
109
|
+
What do you know about this person?
|
|
110
|
+
<textarea
|
|
111
|
+
value={value}
|
|
112
|
+
onChange={(event) => {
|
|
113
|
+
onChange(event.target.value)
|
|
114
|
+
}}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
rows={9}
|
|
117
|
+
maxLength={PERSON_INTAKE_MAX_TEXT}
|
|
118
|
+
autoFocus
|
|
119
|
+
placeholder={'Names, emails, a LinkedIn URL, an email signature, meeting notes…\n\nDana Reyes, dana@brightline.health. Met at HLTH; asked about a pilot.'}
|
|
120
|
+
className="mt-1 block w-full resize-y rounded-md border border-border bg-surface px-2.5 py-2 text-[13px] font-normal text-ink outline-none placeholder:text-ink-faint focus:border-accent disabled:opacity-60"
|
|
121
|
+
/>
|
|
122
|
+
<span className="mt-1 block font-normal text-ink-faint">
|
|
123
|
+
LinkedIn pages cannot be read without signing in. For the full profile, open it in your own browser, select
|
|
124
|
+
all, copy, and paste it here.
|
|
125
|
+
</span>
|
|
126
|
+
</label>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The fallback: the add-person agent task's prompt with the notes appended. */
|
|
131
|
+
function CopyPromptIntake({ reason }: { readonly reason: string }): React.JSX.Element {
|
|
132
|
+
const { workspace } = useWorkspace()
|
|
133
|
+
const resolve = useResolveAgentTask()
|
|
134
|
+
const [text, setText] = useState('')
|
|
135
|
+
const [copied, setCopied] = useState(false)
|
|
136
|
+
const [clipboardFailed, setClipboardFailed] = useState(false)
|
|
137
|
+
|
|
138
|
+
async function copy(): Promise<void> {
|
|
139
|
+
if (workspace === undefined) return
|
|
140
|
+
|
|
141
|
+
setClipboardFailed(false)
|
|
142
|
+
const resolved = await resolve.runAsync({ taskId: ADD_PERSON_TASK, targetType: 'workspace', targetId: workspace.id })
|
|
143
|
+
const prompt = `${resolved.prompt}\n\n## Notes about the person\n\n${text.trim()}\n`
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
await navigator.clipboard.writeText(prompt)
|
|
147
|
+
setCopied(true)
|
|
148
|
+
} catch {
|
|
149
|
+
setClipboardFailed(true)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<IntakeFrame
|
|
155
|
+
footer={
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
disabled={text.trim().length === 0 || resolve.isPending || workspace === undefined}
|
|
159
|
+
onClick={() => {
|
|
160
|
+
void copy().catch(() => undefined)
|
|
161
|
+
}}
|
|
162
|
+
className="rounded-md bg-accent px-3 py-1.5 text-[12px] font-semibold text-accent-fg hover:bg-accent-hover disabled:opacity-50"
|
|
163
|
+
>
|
|
164
|
+
{resolve.isPending ? 'Preparing…' : copied ? 'Copied' : 'Copy prompt for your agent'}
|
|
165
|
+
</button>
|
|
166
|
+
}
|
|
167
|
+
>
|
|
168
|
+
<div className="mb-3 rounded-md border border-border bg-surface-sunken px-3 py-2 text-[12px] text-ink-muted">
|
|
169
|
+
<p className="font-medium text-ink">AI cannot run this for you now.</p>
|
|
170
|
+
<p className="mt-0.5">{reason}</p>
|
|
171
|
+
<p className="mt-1">
|
|
172
|
+
You can still copy a prompt with your notes in it. Paste it into an agent connected to Kelpie over MCP
|
|
173
|
+
(Claude, Cursor, …), and the agent creates the records.
|
|
174
|
+
</p>
|
|
175
|
+
</div>
|
|
176
|
+
<NotesField
|
|
177
|
+
value={text}
|
|
178
|
+
onChange={(value) => {
|
|
179
|
+
setText(value)
|
|
180
|
+
setCopied(false)
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
{resolve.error !== null && (
|
|
184
|
+
<div className="mt-3">
|
|
185
|
+
<ErrorPanel error={resolve.error} />
|
|
186
|
+
</div>
|
|
187
|
+
)}
|
|
188
|
+
{clipboardFailed && (
|
|
189
|
+
<p className="mt-2 text-[12px] text-danger">The browser did not allow Kelpie to copy to the clipboard.</p>
|
|
190
|
+
)}
|
|
191
|
+
</IntakeFrame>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
@@ -21,7 +21,7 @@ export function SegmentedControl<T extends string>({
|
|
|
21
21
|
<div
|
|
22
22
|
role="group"
|
|
23
23
|
aria-label={ariaLabel}
|
|
24
|
-
className="inline-flex rounded-md border border-border bg-surface-raised p-0.5"
|
|
24
|
+
className="inline-flex max-w-full overflow-x-auto rounded-md border border-border bg-surface-raised p-0.5"
|
|
25
25
|
>
|
|
26
26
|
{options.map((option) => {
|
|
27
27
|
const selected = value === option.id
|
|
@@ -35,7 +35,7 @@ export function SegmentedControl<T extends string>({
|
|
|
35
35
|
onChange(option.id)
|
|
36
36
|
}}
|
|
37
37
|
className={[
|
|
38
|
-
'rounded px-2.5 py-1 text-[12px] font-medium transition-colors',
|
|
38
|
+
'shrink-0 whitespace-nowrap rounded px-2.5 py-1 text-[12px] font-medium transition-colors',
|
|
39
39
|
selected ? 'bg-accent-soft text-accent-hover' : 'text-ink-muted hover:text-ink',
|
|
40
40
|
].join(' ')}
|
|
41
41
|
>
|