@dbx-tools/ui-mastra 0.9.214 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,7 +28,7 @@ Package contents:
28
28
  reload, and the final persisted history is refreshed when recovery completes.
29
29
  - Headless `useMastraChat()` driver for apps that want the same transport logic
30
30
  with custom layout.
31
- - Persistent `MastraAssistant` application shell with a floating launcher,
31
+ - Persistent `MastraAssistant` application shell with a docked, resizable panel,
32
32
  dock/overlay modes, every edge, optional resizing, external controls, and
33
33
  route-stable chat state.
34
34
  - Controlled `ChatView` for hosts that own messages, streaming, model state, and
@@ -108,6 +108,13 @@ The stylesheet imports the shared `@dbx-tools/ui` foundation and registers
108
108
  this package's React files with Tailwind. It does not define design tokens. The
109
109
  chat UI uses AppKit semantic tokens from the host app.
110
110
 
111
+ Keep the imports in that order. The Mastra stylesheet consumes the optional
112
+ semantic typography and density variables published by `BrandProvider` or
113
+ `applyBrandContext()`. Its public `data-slot` selectors have enough specificity
114
+ to survive broad host resets such as `button { font: inherit }`; hosts should
115
+ style the documented brand variables or public component props instead of
116
+ targeting internal Tailwind class combinations.
117
+
111
118
  ## Add a persistent assistant
112
119
 
113
120
  Mount `MastraAssistant` inside the app's existing authentication gate and above
@@ -129,12 +136,18 @@ const AskAboutStore = ({ storeId }: { storeId: string }) => {
129
136
  export function App() {
130
137
  return (
131
138
  <MastraAssistant
132
- mode="overlay"
133
139
  side="right"
134
140
  resizable={{ defaultSize: 480, minSize: 360, storageKey: "assistant-size" }}
135
141
  title="Workflow assistant"
142
+ icon={false}
143
+ toolbarHeight={48}
136
144
  launcher={{ position: "bottom-right", label: "Open assistant" }}
137
- chat={{ showModelPicker: true, enableExport: true, threadPlacement: "top" }}
145
+ chat={{
146
+ showModelPicker: true,
147
+ enableExport: true,
148
+ threadPlacement: "top",
149
+ emptyState: false,
150
+ }}
138
151
  >
139
152
  <RouterAndAuthenticatedApplication />
140
153
  </MastraAssistant>
@@ -142,15 +155,28 @@ export function App() {
142
155
  }
143
156
  ```
144
157
 
145
- `mode="dock"` reflows the child application. `mode="overlay"` overlaps it.
158
+ The desktop default is `mode="dock"`, which reflows the child application and
159
+ keeps its controls visible. Use `mode="overlay"` only when covering application
160
+ content is intentional.
161
+
162
+ The built-in icon-only launcher uses the official monochrome Databricks Genie
163
+ glyph and follows the host theme through the button's foreground color. Keep
164
+ `launcher.label` as its accessible name, or replace the glyph with
165
+ `launcher.icon`.
166
+
146
167
  `side` accepts `top`, `right`, `bottom`, or `left`. Set `resizable={false}` to
147
168
  lock size, `launcher={false}` when every launch comes from
148
169
  `useMastraAssistant()`, `header={false}` to place New, History, and Close beside
149
170
  the conversation pills. With the header enabled those controls move into it and
150
171
  the conversation pills remain on their own second row. Replace `icon`, `closeIcon`,
151
- `newConversationIcon`, `historyIcon`, and `launcher.icon`. Below
152
- `mobileBreakpoint` the panel becomes a focus-contained modal overlay with Escape
153
- dismissal while the covered application is inert. A `storageKey` retains
172
+ `newConversationIcon`, `historyIcon`, and `launcher.icon`; set `icon={false}` for
173
+ a title-and-actions header and `toolbarHeight` to align it with the host toolbar.
174
+
175
+ Set `chat.emptyState={false}` to omit the welcome block while keeping starter
176
+ suggestions and the composer, or pass a React node to replace it.
177
+
178
+ Below `mobileBreakpoint` the panel becomes a focus-contained modal overlay with
179
+ Escape dismissal while the covered application is inert. A `storageKey` retains
154
180
  horizontal and vertical sizes independently.
155
181
 
156
182
  `MastraAssistant` remains mounted when closed, which preserves drafts, scroll
@@ -383,15 +409,12 @@ Set `showComposer={false}` when a parent surface owns one shared input, such as
383
409
  side-by-side model comparison.
384
410
 
385
411
  `MastraChat` shows a spinner in the model control while its live default model
386
- is being resolved. The picker groups endpoints into
387
- model-family submenus. Its compact first popup shows only the current
388
- model, host-owned actions such as Genie Agent Mode, and a reasoning slider when
389
- the selected endpoint supports it. The current model opens the family picker,
390
- so the long endpoint catalog stays out of the primary control popup. Family
391
- and model menus use the same compact utility type as the composer actions,
392
- omit repeated headers, and omit the already-selected model. The model menu puts
393
- `Default (<resolved model>)` first, keeps `Other` last, and makes a one-model
394
- family directly selectable instead of opening another submenu.
412
+ is being resolved. The picker opens directly to the model families, with
413
+ `Default (<resolved model>)` first and `Other` last. Selecting a multi-model
414
+ family replaces that list with its endpoints and a Back action; a one-model
415
+ family is directly selectable. The menu uses the same compact utility type as
416
+ the composer actions, omits the already-selected model, and shows host-owned
417
+ actions plus the reasoning slider below the family list when applicable.
395
418
 
396
419
  ## Call plugin routes directly
397
420
 
@@ -447,6 +470,13 @@ server planner provides the series palette and font stack. The browser resolves
447
470
  axis, grid, title, legend, and tooltip colors from AppKit semantic tokens at
448
471
  render time.
449
472
 
473
+ When the active `BrandContext` supplies semantic body/title typography, charts
474
+ apply it to titles, axes, and legends. Optional `colors.chart` values lead the
475
+ series cycle as baseline, expected, and range; when omitted, the existing
476
+ primary/accent plus AppKit categorical cycle remains unchanged. Long titles
477
+ wrap within narrow assistant panels, and the complete title remains available
478
+ as the chart frame's accessible label and browser tooltip.
479
+
450
480
  - Theme tokens are read from the chart element, so a theme scoped to a chat
451
481
  subtree takes precedence over the document theme. Charts update when the
452
482
  document's `.dark` or `.light` class changes or when the operating-system
package/index.react.ts CHANGED
@@ -39,18 +39,18 @@ export { ChatThreadLayout } from "./src/react/chat-thread-layout.tsx";
39
39
  export { TRANSCRIPT_FOLLOW_CANCEL_EVENTS, latestVisibleAssistantIndexInTurn, useChatTranscriptController, ChatTranscript } from "./src/react/chat-transcript.tsx";
40
40
  export type { ChatTranscriptController } from "./src/react/chat-transcript.tsx";
41
41
  export { ChatView } from "./src/react/chat-view.tsx";
42
- export { colorizeDelta, renderDataCell, humanizeLabel, TABLE_WRAPPER_CLASSES, DataGrid } from "./src/react/data-grid.tsx";
42
+ export { colorizeDelta, humanizeLabel, TABLE_WRAPPER_CLASSES, DataGrid } from "./src/react/data-grid.tsx";
43
43
  export type { DataRow } from "./src/react/data-grid.tsx";
44
44
  export { MarkdownWithEmbeds } from "./src/react/embed-slots.tsx";
45
45
  export { ExportMenu } from "./src/react/export-menu.tsx";
46
46
  export { FeedbackControls } from "./src/react/feedback-controls.tsx";
47
47
  export { CHAT_LINK_SAFETY, AssistantMarkdown, ToolMarkdown, SqlBlock, SourceBlock } from "./src/react/markdown.tsx";
48
- export { useMastraAssistant, MastraAssistant } from "./src/react/mastra-assistant.tsx";
48
+ export { GenieLauncherIcon, useMastraAssistant, MastraAssistant } from "./src/react/mastra-assistant.tsx";
49
49
  export type { MastraAssistantMode, MastraAssistantSide, MastraAssistantLauncherPosition, MastraAssistantResizeOptions, MastraAssistantLauncherOptions, MastraAssistantController, MastraAssistantProps } from "./src/react/mastra-assistant.tsx";
50
50
  export { useMastraChat, MastraChat } from "./src/react/mastra-chat.tsx";
51
51
  export type { ThreadIdChangeReason, BrowserConversationPersistenceOptions, UseMastraChatOptions, UseMastraChatResult, MastraChatProps } from "./src/react/mastra-chat.tsx";
52
- export { selectedModelActivity, selectedModelRoute, normalizeChatMetrics, selectedModelTurnMetrics, SelectedModelPill } from "./src/react/selected-model-pill.tsx";
53
- export type { SelectedModelActivity, SelectedModelMessage, SelectedModelTurnMetrics } from "./src/react/selected-model-pill.tsx";
52
+ export { selectedModelActivity, selectedModelRoute, normalizeChatMetrics, formatChatMetricValue, selectedModelTurnMetrics, SelectedModelPill } from "./src/react/selected-model-pill.tsx";
53
+ export type { SelectedModelActivity, SelectedModelMessage, SelectedModelTurnMetrics, ChatMetricFormatOptions } from "./src/react/selected-model-pill.tsx";
54
54
  export { SuggestionPills } from "./src/react/suggestion-pills.tsx";
55
55
  export type { SuggestionPillsProps } from "./src/react/suggestion-pills.tsx";
56
56
  export { dedupeSuggestions, collectSuggestions } from "./src/react/suggestions.ts";
@@ -58,7 +58,7 @@ export { ThreadSidebar } from "./src/react/thread-sidebar.tsx";
58
58
  export type { ThreadSidebarProps } from "./src/react/thread-sidebar.tsx";
59
59
  export { ThreadActions, ThreadTabs } from "./src/react/thread-tabs.tsx";
60
60
  export type { ThreadTabsProps, ThreadActionsProps } from "./src/react/thread-tabs.tsx";
61
- export { humanizeToolName, formatRawToolPayload, structuredToolPayload, detectToolSourceLanguage, toolInputPresentation, toolOutputPresentation, webSearchProgressGroups, webSearchQueryLabel, webSearchResultLabel, ToolSessionPill } from "./src/react/tool-pill.tsx";
61
+ export { humanizeToolName, formatRawToolPayload, structuredToolPayload, toolInputPresentation, toolOutputPresentation, webSearchProgressGroups, webSearchQueryLabel, webSearchResultLabel, ToolSessionPill } from "./src/react/tool-pill.tsx";
62
62
  export type { ToolInputPresentation, WebSearchProgressGroup } from "./src/react/tool-pill.tsx";
63
63
  export { isActiveChatStatus, isRespondingChatStatus } from "./src/react/types.ts";
64
64
  export type { ChatStatus, ChatMetric, ChatMetrics, ToolEvent, ToolProgress, ChatModelOption, ChatInputMessage, QueuedSteer, FeedbackValue, FeedbackSubmission, MessageFeedback, ThreadSummary, ThreadPlacement, ChatViewProps, ApprovalDecision, PendingApproval } from "./src/react/types.ts";
package/index.support.ts CHANGED
@@ -18,11 +18,11 @@ export * as threadPersistence from "./src/support/thread-persistence.ts";
18
18
  export * as threadSessions from "./src/support/thread-sessions.ts";
19
19
  export * as threadTabs from "./src/support/thread-tabs.ts";
20
20
  export * as toolEvents from "./src/support/tool-events.ts";
21
- export { StoredActiveRunSchema, activeRunStorageKey, readStoredActiveRuns, storeActiveRun, removeStoredActiveRun } from "./src/support/active-runs.ts";
21
+ export { activeRunStorageKey, readStoredActiveRuns, storeActiveRun, removeStoredActiveRun } from "./src/support/active-runs.ts";
22
22
  export type { StoredActiveRun } from "./src/support/active-runs.ts";
23
- export { BrowserMessageTimestampsSchema, browserTranscriptStorageKey, readStoredBrowserTranscript, readBrowserMessageTimestamps, withBrowserMessageTimestamps, storeBrowserTranscript } from "./src/support/browser-transcript.ts";
23
+ export { browserTranscriptStorageKey, readStoredBrowserTranscript, readBrowserMessageTimestamps, withBrowserMessageTimestamps, storeBrowserTranscript } from "./src/support/browser-transcript.ts";
24
24
  export type { BrowserMessageTimestamps } from "./src/support/browser-transcript.ts";
25
- export { normalizeChartOption } from "./src/support/chart-option.ts";
25
+ export { chartTitleText, normalizeChartOption } from "./src/support/chart-option.ts";
26
26
  export { LIGHT_CHART_CHROME, resolveChartChrome, useChartChrome } from "./src/support/chart-theme.ts";
27
27
  export type { ChartChrome } from "./src/support/chart-theme.ts";
28
28
  export { downloadFile } from "./src/support/download.ts";
@@ -41,5 +41,5 @@ export { threadTitle, relativeTime } from "./src/support/thread-labels.ts";
41
41
  export { threadStorageKey } from "./src/support/thread-persistence.ts";
42
42
  export { DEFAULT_THREAD_SESSION_KEY, createThreadSession, isSessionRunning, lastUserMessage, interruptedTurnMessages, conversationRequestMessages, enqueueSteer, removeSteer, reorderSteers, sessionKey } from "./src/support/thread-sessions.ts";
43
43
  export type { SessionQueuedSteer, SessionRun, ConversationHistorySource, ThreadSession } from "./src/support/thread-sessions.ts";
44
- export { THREAD_TAB_SEED_MAX, syncThreadTabs, closeThreadTab, nextActiveThreadTab } from "./src/support/thread-tabs.ts";
44
+ export { syncThreadTabs, closeThreadTab, nextActiveThreadTab } from "./src/support/thread-tabs.ts";
45
45
  export { compactReasoningText, genieOutputReasoningSections, toolReasoningSections, genieReasoningText, toolEventsFromParts, mergeToolEvents } from "./src/support/tool-events.ts";
package/index.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  // Hand edits are overwritten on the next generation; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/ui-mastra";
6
- export const PACKAGE_VERSION = "0.9.214";
6
+ export const PACKAGE_VERSION = "0.11.3";
package/package.json CHANGED
@@ -20,14 +20,14 @@
20
20
  "devDependencies": {
21
21
  "@types/react": "^19.2.2",
22
22
  "@types/react-dom": "^19.2.2",
23
- "react": "~19.2.4",
24
- "react-dom": "~19.2.4",
23
+ "react": "19.3.1",
24
+ "react-dom": "19.3.1",
25
25
  "react-router-dom": "^7.6.2",
26
26
  "typescript": "^5.9.3"
27
27
  },
28
28
  "peerDependencies": {
29
- "react": "~19.2.4",
30
- "react-dom": "~19.2.4",
29
+ "react": "19.3.1",
30
+ "react-dom": "19.3.1",
31
31
  "react-router-dom": "^7.6.2"
32
32
  },
33
33
  "peerDependenciesMeta": {
@@ -36,32 +36,32 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@databricks/appkit-ui": "0.81.0",
40
- "@dbx-tools/shared-auth": "0.9.214",
41
- "@dbx-tools/shared-core": "0.9.214",
42
- "@dbx-tools/shared-genie": "0.9.214",
43
- "@dbx-tools/shared-mastra": "0.9.214",
44
- "@dbx-tools/shared-model": "0.9.214",
45
- "@dbx-tools/shared-model-gateway": "0.9.214",
46
- "@dbx-tools/ui": "0.9.214",
47
- "@mastra/client-js": "1.50.0",
48
- "@mastra/core": "1.71.0",
39
+ "@databricks/appkit-ui": "0.106.0",
40
+ "@dbx-tools/shared-auth": "0.11.3",
41
+ "@dbx-tools/shared-core": "0.11.3",
42
+ "@dbx-tools/shared-genie": "0.11.3",
43
+ "@dbx-tools/shared-mastra": "0.11.3",
44
+ "@dbx-tools/shared-model": "0.11.3",
45
+ "@dbx-tools/shared-model-gateway": "0.11.3",
46
+ "@dbx-tools/ui": "0.11.3",
47
+ "@mastra/client-js": "1.62.0",
48
+ "@mastra/core": "1.86.0",
49
49
  "@tanstack/react-table": "^8.21.3",
50
- "ai": "^7.0.0",
50
+ "ai": "7.0.183",
51
51
  "echarts": "^6.0.0",
52
52
  "echarts-for-react": "^3.0.2",
53
53
  "lucide-react": "^0.554.0",
54
54
  "marked": "^18.0.5",
55
55
  "sql-formatter": "^15.6.9",
56
56
  "streamdown": "^2.5.0",
57
- "zod": "4.3.6"
57
+ "zod": "4.6.7"
58
58
  },
59
59
  "main": "index.ts",
60
60
  "license": "Apache-2.0",
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "version": "0.9.214",
64
+ "version": "0.11.3",
65
65
  "types": "index.ts",
66
66
  "dbxToolsConfig": {
67
67
  "tags": [
@@ -1,17 +1,7 @@
1
- import {
2
- AlertDialog,
3
- AlertDialogAction,
4
- AlertDialogCancel,
5
- AlertDialogContent,
6
- AlertDialogDescription,
7
- AlertDialogFooter,
8
- AlertDialogHeader,
9
- AlertDialogTitle,
10
- Button,
11
- } from "@databricks/appkit-ui/react";
12
- import { copyText } from "@dbx-tools/ui/react";
1
+ import { Button } from "@databricks/appkit-ui/react";
2
+ import { ConfirmDialog, useCopyFeedback } from "@dbx-tools/ui/react";
13
3
  import { CheckIcon, CopyIcon, ExternalLinkIcon } from "lucide-react";
14
- import { useEffect, useMemo, useRef, useState } from "react";
4
+ import { useMemo } from "react";
15
5
  import type { LinkSafetyModalProps } from "streamdown";
16
6
 
17
7
  /** Display and clipboard values for one confirmed chat link. */
@@ -61,59 +51,51 @@ export function resolveLinkPresentation(url: string, baseUrl?: string): LinkPres
61
51
  /** AppKit-styled confirmation shown before opening a link from assistant markdown. */
62
52
  export const ExternalLinkDialog = ({ isOpen, onClose, onConfirm, url }: LinkSafetyModalProps) => {
63
53
  const link = useMemo(() => resolveLinkPresentation(url), [url]);
64
- const [copied, setCopied] = useState(false);
65
- const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
66
-
67
- useEffect(
68
- () => () => {
69
- if (copiedTimer.current) clearTimeout(copiedTimer.current);
70
- },
71
- [],
72
- );
73
-
74
- const copyLink = () => {
75
- void copyText(link.absoluteUrl).then((ok) => {
76
- if (!ok) return;
77
- setCopied(true);
78
- if (copiedTimer.current) clearTimeout(copiedTimer.current);
79
- copiedTimer.current = setTimeout(() => setCopied(false), 1500);
80
- });
81
- };
54
+ const { copied, copy } = useCopyFeedback();
82
55
 
83
56
  return (
84
- <AlertDialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
85
- <AlertDialogContent className="max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-lg gap-5 overflow-y-auto border-border/60 p-5 shadow-2xl dark:border-white/10 sm:w-full sm:p-6">
86
- <AlertDialogHeader className="text-left">
87
- <AlertDialogTitle className="flex items-center gap-2.5">
88
- <ExternalLinkIcon className="size-5 shrink-0" aria-hidden="true" />
89
- Open external link?
90
- </AlertDialogTitle>
91
- <AlertDialogDescription>
92
- You&apos;re about to visit a link outside this chat.
93
- </AlertDialogDescription>
94
- </AlertDialogHeader>
95
- <div
96
- className="max-h-32 overflow-y-auto break-all rounded-md border border-border/50 bg-muted/70 px-3 py-2.5 font-mono text-sm leading-5"
97
- title={link.absoluteUrl}
57
+ <ConfirmDialog
58
+ open={isOpen}
59
+ onOpenChange={(open) => !open && onClose()}
60
+ title={
61
+ <span className="flex items-center gap-2.5">
62
+ <ExternalLinkIcon className="size-5 shrink-0" aria-hidden="true" />
63
+ Open external link?
64
+ </span>
65
+ }
66
+ description="You're about to visit a link outside this chat."
67
+ className="max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-lg gap-5 overflow-y-auto border-border/60 p-5 shadow-2xl dark:border-white/10 sm:w-full sm:p-6"
68
+ headerClassName="text-left"
69
+ cancelProps={{ className: "w-full sm:w-auto" }}
70
+ confirmLabel={
71
+ <>
72
+ <ExternalLinkIcon className="size-4" aria-hidden="true" />
73
+ Open link
74
+ </>
75
+ }
76
+ confirmProps={{ className: "w-full sm:w-auto", onClick: onConfirm }}
77
+ additionalActions={
78
+ <Button
79
+ className="w-full sm:w-auto"
80
+ type="button"
81
+ variant="outline"
82
+ onClick={() => void copy(link.absoluteUrl)}
98
83
  >
99
- {link.displayUrl}
100
- </div>
101
- <AlertDialogFooter>
102
- <AlertDialogCancel className="w-full sm:w-auto">Cancel</AlertDialogCancel>
103
- <Button className="w-full sm:w-auto" type="button" variant="outline" onClick={copyLink}>
104
- {copied ? (
105
- <CheckIcon className="size-4" aria-hidden="true" />
106
- ) : (
107
- <CopyIcon className="size-4" aria-hidden="true" />
108
- )}
109
- {copied ? "Copied" : "Copy link"}
110
- </Button>
111
- <AlertDialogAction className="w-full sm:w-auto" onClick={onConfirm}>
112
- <ExternalLinkIcon className="size-4" aria-hidden="true" />
113
- Open link
114
- </AlertDialogAction>
115
- </AlertDialogFooter>
116
- </AlertDialogContent>
117
- </AlertDialog>
84
+ {copied ? (
85
+ <CheckIcon className="size-4" aria-hidden="true" />
86
+ ) : (
87
+ <CopyIcon className="size-4" aria-hidden="true" />
88
+ )}
89
+ {copied ? "Copied" : "Copy link"}
90
+ </Button>
91
+ }
92
+ >
93
+ <div
94
+ className="max-h-32 overflow-y-auto break-all rounded-md border border-border/50 bg-muted/70 px-3 py-2.5 font-mono text-sm leading-5"
95
+ title={link.absoluteUrl}
96
+ >
97
+ {link.displayUrl}
98
+ </div>
99
+ </ConfirmDialog>
118
100
  );
119
101
  };
@@ -0,0 +1,20 @@
1
+ /** Databricks Genie glyph used by the built-in assistant launcher. */
2
+ export function GenieLauncherIcon({ className = "size-6 shrink-0" }: { className?: string }) {
3
+ return (
4
+ <svg
5
+ data-mastra-assistant-genie-glyph
6
+ data-mastra-assistant-genie-lamp
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 16 16"
9
+ fill="none"
10
+ aria-hidden="true"
11
+ focusable="false"
12
+ className={className}
13
+ >
14
+ <path
15
+ fill="currentColor"
16
+ d="M0 9V8.256C0 7.286.786 6.5 1.756 6.5h1.1c.372 0 .712.21.878.543l.595 1.188a4.105 4.105 0 0 0 7.342 0l.595-1.188a.981.981 0 0 1 .878-.543H16V8h-2.536l-.451.902a5.605 5.605 0 0 1-10.026 0L2.537 8h-.781a.256.256 0 0 0-.256.256V9a.5.5 0 0 0 .5.5V11a2 2 0 0 1-2-2Zm10.5 4v1.5h-5V13h5ZM8 2a.75.75 0 0 1 .74.621l.226 1.303a.75.75 0 0 0 .61.61l1.303.227a.75.75 0 0 1 0 1.478l-1.303.227a.75.75 0 0 0-.61.61L8.739 8.38a.75.75 0 0 1-1.478 0l-.227-1.303a.75.75 0 0 0-.61-.61L5.12 6.239a.75.75 0 0 1 0-1.478l1.303-.227a.75.75 0 0 0 .61-.61l.227-1.303A.75.75 0 0 1 8 2Z"
17
+ />
18
+ </svg>
19
+ );
20
+ }
@@ -4,17 +4,12 @@ import {
4
4
  DropdownMenuContent,
5
5
  DropdownMenuItem,
6
6
  DropdownMenuLabel,
7
- DropdownMenuPortal,
8
7
  DropdownMenuRadioGroup,
9
8
  DropdownMenuRadioItem,
10
9
  DropdownMenuSeparator,
11
- DropdownMenuSub,
12
- DropdownMenuSubContent,
13
- DropdownMenuSubTrigger,
14
10
  DropdownMenuTrigger,
15
11
  Slider,
16
12
  Spinner,
17
- useIsMobile,
18
13
  } from "@databricks/appkit-ui/react";
19
14
  import { toLabel } from "@dbx-tools/shared-core";
20
15
  import type { ReasoningEffort } from "@dbx-tools/shared-model";
@@ -77,7 +72,7 @@ const ReasoningControl = ({
77
72
  );
78
73
  };
79
74
 
80
- /** Family menu that opens one scoped endpoint submenu at a time. */
75
+ /** Family menu that shows one scoped endpoint list at a time. */
81
76
  const FamilyPicker = ({
82
77
  families,
83
78
  selectedModelId,
@@ -172,8 +167,7 @@ const FamilyPicker = ({
172
167
  };
173
168
 
174
169
  /**
175
- * Family-first model picker with fixed model controls above the scrollable
176
- * family submenus.
170
+ * Family-first model picker with one menu for models and controls.
177
171
  */
178
172
  export const ModelSelector = ({
179
173
  models,
@@ -186,9 +180,7 @@ export const ModelSelector = ({
186
180
  onModelChange,
187
181
  actions,
188
182
  }: ModelSelectorProps) => {
189
- const isMobile = useIsMobile();
190
183
  const [open, setOpen] = useState(false);
191
- const [modelPickerOpen, setModelPickerOpen] = useState(false);
192
184
  const [activeFamily, setActiveFamily] = useState<string>();
193
185
  const selectedModelId = model || defaultModelId;
194
186
  const selectedModel = models.find((option) => option.name === selectedModelId);
@@ -217,10 +209,7 @@ export const ModelSelector = ({
217
209
  open={open}
218
210
  onOpenChange={(next) => {
219
211
  setOpen(next);
220
- if (!next) {
221
- setModelPickerOpen(false);
222
- setActiveFamily(undefined);
223
- }
212
+ if (!next) setActiveFamily(undefined);
224
213
  }}
225
214
  >
226
215
  <DropdownMenuTrigger asChild>
@@ -247,87 +236,20 @@ export const ModelSelector = ({
247
236
  <DropdownMenuContent
248
237
  align="end"
249
238
  collisionPadding={8}
250
- className="w-48 max-w-[calc(100vw_-_1rem)]"
239
+ className="max-h-[min(32rem,calc(100dvh-1rem))] w-48 max-w-[calc(100vw_-_1rem)] overflow-y-auto"
251
240
  >
252
- {isMobile && modelPickerOpen ? (
241
+ <FamilyPicker
242
+ families={families}
243
+ selectedModelId={selectedModelId}
244
+ model={model}
245
+ defaultModelName={defaultModelName}
246
+ showLoading={showLoading}
247
+ activeFamily={activeFamily}
248
+ onActiveFamilyChange={setActiveFamily}
249
+ onModelChange={onModelChange}
250
+ />
251
+ {!activeFamily ? (
253
252
  <>
254
- {!activeFamily && (
255
- <>
256
- <button
257
- type="button"
258
- className="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs font-medium outline-none hover:bg-accent focus-visible:bg-accent"
259
- onClick={() => setModelPickerOpen(false)}
260
- >
261
- <ChevronLeftIcon className="size-3" />
262
- Options
263
- </button>
264
- <DropdownMenuSeparator />
265
- </>
266
- )}
267
- <FamilyPicker
268
- families={families}
269
- selectedModelId={selectedModelId}
270
- model={model}
271
- defaultModelName={defaultModelName}
272
- showLoading={showLoading}
273
- activeFamily={activeFamily}
274
- onActiveFamilyChange={setActiveFamily}
275
- onModelChange={onModelChange}
276
- />
277
- </>
278
- ) : (
279
- <>
280
- {isMobile ? (
281
- <button
282
- type="button"
283
- className="mx-1 flex w-[calc(100%_-_0.5rem)] items-center rounded-lg bg-accent/60 px-3 py-2 text-xs font-medium outline-none hover:bg-accent focus-visible:bg-accent"
284
- onClick={() => setModelPickerOpen(true)}
285
- >
286
- {showLoading ? (
287
- <>
288
- <Spinner className="size-3 shrink-0" />
289
- <span className="sr-only">Loading default model</span>
290
- </>
291
- ) : (
292
- <span className="truncate">{triggerLabel}</span>
293
- )}
294
- <ChevronRightIcon className="ml-auto size-3 shrink-0 text-muted-foreground" />
295
- </button>
296
- ) : (
297
- <DropdownMenuSub
298
- open={modelPickerOpen}
299
- onOpenChange={(next) => {
300
- if (!next && open) return;
301
- setModelPickerOpen(next);
302
- if (!next) setActiveFamily(undefined);
303
- }}
304
- >
305
- <DropdownMenuSubTrigger className="mx-1 justify-center rounded-lg bg-accent/60 px-3 py-2 text-xs font-medium">
306
- {showLoading ? (
307
- <>
308
- <Spinner className="size-3 shrink-0" />
309
- <span className="sr-only">Loading default model</span>
310
- </>
311
- ) : (
312
- triggerLabel
313
- )}
314
- </DropdownMenuSubTrigger>
315
- <DropdownMenuPortal>
316
- <DropdownMenuSubContent collisionPadding={8} className="w-48">
317
- <FamilyPicker
318
- families={families}
319
- selectedModelId={selectedModelId}
320
- model={model}
321
- defaultModelName={defaultModelName}
322
- showLoading={showLoading}
323
- activeFamily={activeFamily}
324
- onActiveFamilyChange={setActiveFamily}
325
- onModelChange={onModelChange}
326
- />
327
- </DropdownMenuSubContent>
328
- </DropdownMenuPortal>
329
- </DropdownMenuSub>
330
- )}
331
253
  {(actions || (reasoningEfforts.length > 0 && onReasoningEffortChange)) && (
332
254
  <DropdownMenuSeparator />
333
255
  )}
@@ -340,7 +262,7 @@ export const ModelSelector = ({
340
262
  />
341
263
  )}
342
264
  </>
343
- )}
265
+ ) : null}
344
266
  </DropdownMenuContent>
345
267
  </DropdownMenu>
346
268
  );