@mcp-b/react-components 0.47.0 → 0.49.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/AgentChatQueue-C_Jaw3Ia.d.ts +48 -0
- package/dist/AgentToolRunsContext-GMe_hSnD.d.ts +35 -0
- package/dist/Avatar-o2NO1fCG.d.ts +124 -0
- package/dist/{Button-CZt3yywF.d.ts → Button-DjONW5UW.d.ts} +1 -1
- package/dist/{CodeBlock-C380GD5t.d.ts → CodeBlock--r6GS8YV.d.ts} +8 -2
- package/dist/{CodeBlock-DMHZiw86.js → CodeBlock-g8sADidM.js} +7 -7
- package/dist/Correspondent-7K6uNLUm.d.ts +64 -0
- package/dist/{FileTree-BHebfvkK.js → FileTree-H8mMg4rV.js} +20 -29
- package/dist/{IconButton-BAUFhUk8.d.ts → IconButton-ByiyjkYE.d.ts} +2 -2
- package/dist/{Message-D_vCVEGB.d.ts → Message-DyaTBiV7.d.ts} +17 -4
- package/dist/MessageScrollerVirtual-D4afYwVB.d.ts +84 -0
- package/dist/{PromptInput-DtJHyp0S.d.ts → PromptInput-C4Mofitz.d.ts} +44 -31
- package/dist/PromptInputApproval-D2hpn54U.d.ts +44 -0
- package/dist/Separator-CzhtLYE1.d.ts +41 -0
- package/dist/Toolbar-CGY004u0.d.ts +155 -0
- package/dist/{Workspace-C_zHq9KZ.d.ts → Workspace-HzGrWDX3.d.ts} +14 -3
- package/dist/{WorkspaceFile-Dq-GC0_T.d.ts → WorkspaceFile-Bouauobc.d.ts} +1 -1
- package/dist/{WorkspaceFileView-ChIJz-fl.js → WorkspaceFileView-DYPtRVpM.js} +4 -3
- package/dist/{WorkspaceLink-B1d2GIGl.js → WorkspaceLink-BYZG-V_I.js} +8 -91
- package/dist/{WorkspaceMessageResponse-Dg_aNpoj.js → WorkspaceMessageResponse-CUJk9_P5.js} +6 -3
- package/dist/components/agents-sdk/AgentChat.d.ts +198 -2
- package/dist/components/agents-sdk/AgentChat.js +525 -670
- package/dist/components/agents-sdk/AgentChatQueue.d.ts +2 -0
- package/dist/components/agents-sdk/AgentChatQueue.js +206 -0
- package/dist/components/agents-sdk/AgentEvent.js +1 -1
- package/dist/components/agents-sdk/AgentToolRunsContext.d.ts +2 -2
- package/dist/components/agents-sdk/AgentToolRunsContext.js +1 -36
- package/dist/components/agents-sdk/BrowserLiveScreen.js +21 -13
- package/dist/components/agents-sdk/BrowserReplay.d.ts +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +3 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +31 -30
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +212 -0
- package/dist/components/agents-sdk/EmployeeChrome.js +555 -0
- package/dist/components/agents-sdk/ManagerOffice.d.ts +115 -85
- package/dist/components/agents-sdk/ManagerOffice.js +545 -1154
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +4 -4
- package/dist/components/agents-sdk/McpConnectionRequest.js +3 -2
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +38 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +93 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +3 -2
- package/dist/components/agents-sdk/McpServerIcon.d.ts +17 -0
- package/dist/components/agents-sdk/McpServerIcon.js +25 -0
- package/dist/components/agents-sdk/McpServerPicker.d.ts +4 -3
- package/dist/components/agents-sdk/McpServerPicker.js +2 -1
- package/dist/components/agents-sdk/ModelSelector.d.ts +4 -4
- package/dist/components/agents-sdk/ModelSelector.js +3 -3
- package/dist/components/agents-sdk/PromptInputApproval.d.ts +1 -43
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +1 -2
- package/dist/components/agents-sdk/SessionCompaction.d.ts +88 -1
- package/dist/components/agents-sdk/SessionCompaction.js +2 -2
- package/dist/components/agents-sdk/SubagentRunDetails.d.ts +30 -1
- package/dist/components/agents-sdk/SubagentRunDetails.js +57 -1
- package/dist/components/agents-sdk/SubagentRunIndicator.d.ts +9 -9
- package/dist/components/agents-sdk/SubagentRunIndicator.js +18 -23
- package/dist/components/agents-sdk/SubagentRunList.d.ts +6 -3
- package/dist/components/agents-sdk/SubagentRunList.js +4 -2
- package/dist/components/agents-sdk/SubagentRunPanel.d.ts +60 -0
- package/dist/components/agents-sdk/SubagentRunPanel.js +255 -0
- package/dist/components/agents-sdk/SubagentRunSelector.d.ts +8 -4
- package/dist/components/agents-sdk/SubagentRunSelector.js +4 -2
- package/dist/components/agents-sdk/ThinkChat.d.ts +102 -2
- package/dist/components/agents-sdk/ThinkChat.js +233 -2
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +76 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +17 -9
- package/dist/components/agents-sdk/ThinkChatContext.d.ts +27 -1
- package/dist/components/agents-sdk/ThinkChatContext.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +23 -18
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +85 -28
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +158 -101
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +40 -158
- package/dist/components/agents-sdk/ThinkFullApp.js +71 -285
- package/dist/components/agents-sdk/ThinkRecoveryNotice.d.ts +18 -1
- package/dist/components/agents-sdk/ThinkRoutineActions.d.ts +51 -0
- package/dist/components/agents-sdk/ThinkRoutineActions.js +201 -0
- package/dist/components/agents-sdk/ThinkRoutineBrowser.d.ts +4 -1
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +16 -14
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +12 -12
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +2 -1
- package/dist/components/agents-sdk/ThinkRoutineForm.js +11 -11
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +6 -6
- package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +90 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +2 -2
- package/dist/components/agents-sdk/Workspace.d.ts +2 -2
- package/dist/components/agents-sdk/Workspace.js +20 -23
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceConcept.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceConcept.js +3 -3
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +15 -10
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +43 -40
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +31 -31
- package/dist/components/agents-sdk/WorkspaceExecution.js +115 -192
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +5 -2
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -2
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +60 -1
- package/dist/components/agents-sdk/WorkspaceLive.js +33 -5
- package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +47 -1
- package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
- package/dist/components/agents-sdk/WorkspaceMountManager.d.ts +3 -2
- package/dist/components/agents-sdk/WorkspaceMountManager.js +5 -8
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.d.ts +38 -0
- package/dist/components/agents-sdk/WorkspaceNavigationRestoration.js +86 -0
- package/dist/components/agents-sdk/WorkspaceProject.d.ts +44 -15
- package/dist/components/agents-sdk/WorkspaceProject.js +74 -51
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +5 -2
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/AgentAttention.d.ts +2 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.d.ts +89 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.js +63 -42
- package/dist/components/ai-sdk/AgentMessageParts.d.ts +45 -1
- package/dist/components/ai-sdk/Approval.d.ts +1 -1
- package/dist/components/ai-sdk/Artifact.d.ts +2 -2
- package/dist/components/ai-sdk/Artifact.js +2 -2
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -2
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +16 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +69 -94
- package/dist/components/ai-sdk/Context.d.ts +7 -3
- package/dist/components/ai-sdk/Context.js +7 -17
- package/dist/components/ai-sdk/Conversation.d.ts +2 -2
- package/dist/components/ai-sdk/Correspondent.d.ts +2 -0
- package/dist/components/ai-sdk/Correspondent.js +145 -0
- package/dist/components/ai-sdk/Goal.d.ts +3 -3
- package/dist/components/ai-sdk/Goal.js +2 -2
- package/dist/components/ai-sdk/InlineCitation.d.ts +1 -1
- package/dist/components/ai-sdk/InlineCitation.js +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/Message.d.ts +2 -2
- package/dist/components/ai-sdk/Message.js +11 -2
- package/dist/components/ai-sdk/MessageScroller.d.ts +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.d.ts +2 -76
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +38 -4
- package/dist/components/ai-sdk/Plan.d.ts +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +170 -226
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +32 -9
- package/dist/components/ai-sdk/Queue.d.ts +28 -5
- package/dist/components/ai-sdk/Queue.js +19 -4
- package/dist/components/ai-sdk/Reasoning.d.ts +1 -1
- package/dist/components/ai-sdk/Reasoning.js +4 -4
- package/dist/components/ai-sdk/Sources.d.ts +1 -1
- package/dist/components/ai-sdk/Task.d.ts +1 -1
- package/dist/components/extension/ChatGptSignInScreen.d.ts +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +5 -0
- package/dist/components/extension/ConversationTabPicker.d.ts +1 -0
- package/dist/components/extension/ConversationTabPicker.js +1 -1
- package/dist/components/foundations/AlertDialog.d.ts +1 -1
- package/dist/components/foundations/AppIcon.d.ts +3 -2
- package/dist/components/foundations/Autocomplete.js +6 -1
- package/dist/components/foundations/Avatar.d.ts +1 -121
- package/dist/components/foundations/Button.d.ts +1 -1
- package/dist/components/foundations/Card.d.ts +22 -27
- package/dist/components/foundations/Card.js +51 -32
- package/dist/components/foundations/CheckboxGroup.d.ts +1 -1
- package/dist/components/foundations/Collapsible.d.ts +1 -1
- package/dist/components/foundations/Combobox.js +6 -1
- package/dist/components/foundations/Dialog.d.ts +106 -1
- package/dist/components/foundations/EmptyState.d.ts +1 -1
- package/dist/components/foundations/Field.d.ts +2 -1
- package/dist/components/foundations/Fieldset.d.ts +1 -1
- package/dist/components/foundations/Form.d.ts +4 -4
- package/dist/components/foundations/IconButton.d.ts +1 -1
- package/dist/components/foundations/Label.d.ts +1 -1
- package/dist/components/foundations/LinkButton.d.ts +2 -2
- package/dist/components/foundations/Meter.d.ts +1 -1
- package/dist/components/foundations/NumberField.d.ts +1 -1
- package/dist/components/foundations/ScrollArea.d.ts +1 -1
- package/dist/components/foundations/SearchField.d.ts +1 -1
- package/dist/components/foundations/Select.js +6 -1
- package/dist/components/foundations/Separator.d.ts +1 -40
- package/dist/components/foundations/Stepper.d.ts +1 -1
- package/dist/components/foundations/Textarea.d.ts +1 -1
- package/dist/components/foundations/Toast.d.ts +5 -1
- package/dist/components/foundations/Toggle.d.ts +70 -1
- package/dist/components/foundations/ToggleGroup.d.ts +3 -2
- package/dist/components/foundations/Toolbar.d.ts +1 -151
- package/dist/components/foundations/TransitionSurface.d.ts +1 -1
- package/dist/components/general-purpose/ActionGuide.d.ts +10 -26
- package/dist/components/general-purpose/ActionGuide.js +4 -18
- package/dist/components/general-purpose/AppTopBar.d.ts +4 -2
- package/dist/components/general-purpose/Commit.d.ts +2 -2
- package/dist/components/general-purpose/Commit.js +1 -1
- package/dist/components/general-purpose/EnvironmentVariables.d.ts +2 -2
- package/dist/components/general-purpose/FileTree.d.ts +1 -7
- package/dist/components/general-purpose/FileTree.js +1 -1
- package/dist/components/general-purpose/PricingBillingToggle.js +1 -1
- package/dist/components/general-purpose/PricingPlanCard.d.ts +4 -0
- package/dist/components/general-purpose/PricingUsageCalculator.js +1 -1
- package/dist/components/general-purpose/ResizableSidePanel.d.ts +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +128 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +119 -101
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +14 -27
- package/dist/components/general-purpose/SettingsFormDialog.js +40 -70
- package/dist/components/general-purpose/SetupChecklist.d.ts +1 -0
- package/dist/components/general-purpose/SetupChecklist.js +76 -1
- package/dist/components/general-purpose/Terminal.d.ts +3 -3
- package/dist/components/general-purpose/Terminal.js +10 -5
- package/dist/components/general-purpose/TestResults.d.ts +23 -11
- package/dist/components/general-purpose/TestResults.js +48 -50
- package/dist/components/general-purpose/ThemeModeControl.d.ts +2 -0
- package/dist/components/general-purpose/WebPreview.d.ts +29 -4
- package/dist/components/general-purpose/WebPreview.js +37 -12
- package/dist/components/nanites/AgentConnection.js +1 -1
- package/dist/components/nanites/AgentToolDetail.d.ts +13 -11
- package/dist/components/nanites/AgentToolDetail.js +20 -41
- package/dist/{copy-button-C0JyjClr.d.ts → copy-button-OUwOdgEm.d.ts} +1 -1
- package/dist/mcp-server-mAErsxHU.js +27 -0
- package/dist/styles/activity.css +1 -96
- package/dist/styles/agent-chat.css +75 -102
- package/dist/styles/agent-tool-detail.css +0 -16
- package/dist/styles/base.css +3 -3
- package/dist/styles/browser-run-panel.css +1 -15
- package/dist/styles/button.css +7 -1
- package/dist/styles/code-block.css +12 -0
- package/dist/styles/composition-motion.css +0 -2
- package/dist/styles/correspondent.css +73 -0
- package/dist/styles/employee-chrome.css +43 -0
- package/dist/styles/file-tree.css +5 -0
- package/dist/styles/index.css +5 -2
- package/dist/styles/manager-office.css +380 -1086
- package/dist/styles/message.css +2 -10
- package/dist/styles/queue.css +71 -0
- package/dist/styles/subagent-run.css +122 -6
- package/dist/styles/test-results.css +2 -5
- package/dist/styles/think-chat-activity.css +13 -0
- package/dist/styles/think-chat-tool-panels.css +81 -0
- package/dist/styles/think-execution-workbench.css +2 -8
- package/dist/styles/think-full-app.css +42 -251
- package/dist/styles/{think-routine-library.css → think-routine.css} +64 -80
- package/dist/styles/web-preview.css +15 -1
- package/dist/utils/mcp-server-catalog.d.ts +1112 -2
- package/dist/utils/mcp-server-catalog.js +28 -9
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/{workspace-assets-CxpEHsac.js → workspace-assets-Bg7XhPsk.js} +16 -2
- package/package.json +7 -3
- package/dist/AgentChat-BLmQghkt.d.ts +0 -327
- package/dist/AgentChatStartScreen-Bkv7Avni.d.ts +0 -84
- package/dist/AgentMessageParts-C7L-Mv9U.d.ts +0 -46
- package/dist/AgentToolRunsContext-jtmveaRE.d.ts +0 -57
- package/dist/Dialog-B_FhRWaz.d.ts +0 -107
- package/dist/McpConnectorForm-CeYNY0MI.d.ts +0 -39
- package/dist/McpPluginCatalog-3qWu8oK1.d.ts +0 -92
- package/dist/ResponsiveSidebarShell-BTVPxLJK.d.ts +0 -123
- package/dist/SessionCompaction-CmTJFpzj.d.ts +0 -89
- package/dist/SetupChecklist-CwRjIDH4.js +0 -77
- package/dist/ThinkChat-CwMdEum8.d.ts +0 -185
- package/dist/ThinkChat-DLDta57t.js +0 -332
- package/dist/ThinkChatActivity-B3lGVS-6.d.ts +0 -77
- package/dist/ThinkChatContext-COIgzkYp.d.ts +0 -28
- package/dist/ThinkRecoveryNotice-DGWr94rk.d.ts +0 -19
- package/dist/ThinkThreadPicker-yFz4vvIf.d.ts +0 -91
- package/dist/Toggle-DLrIf5YH.d.ts +0 -69
- package/dist/WorkspaceLive-DLGhtIly.d.ts +0 -49
- package/dist/WorkspaceMessageResponse-kJYU8Onj.d.ts +0 -48
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.d.ts +0 -31
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +0 -34
- package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +0 -80
- package/dist/components/agents-sdk/ThinkRoutineLibrary.js +0 -159
- package/dist/components/agents-sdk/ThinkSidepanel.d.ts +0 -200
- package/dist/components/agents-sdk/ThinkSidepanel.js +0 -775
- package/dist/mcp-server-7NR24ASj.js +0 -69
- package/dist/mcp-server-catalog-C_g7C-9o.d.ts +0 -1108
- package/dist/styles/think-sidepanel.css +0 -78
- package/dist/think-agent-Cip5KAPj.d.ts +0 -7
|
@@ -15,6 +15,13 @@ const sidebarMaxWidth = 384;
|
|
|
15
15
|
const sidebarKeyboardStep = 24;
|
|
16
16
|
/** Matches --sigvelo-layout-break-compact. */
|
|
17
17
|
const compactSidebarWidthRem = 56;
|
|
18
|
+
const SidebarShellContext = React.createContext(null);
|
|
19
|
+
/** Reuse the shell's measured layout and drawer controls instead of observing it again. */
|
|
20
|
+
function useResponsiveSidebarShell() {
|
|
21
|
+
const controls = React.useContext(SidebarShellContext);
|
|
22
|
+
if (!controls) throw new Error("useResponsiveSidebarShell must be inside ResponsiveSidebarShell.");
|
|
23
|
+
return controls;
|
|
24
|
+
}
|
|
18
25
|
function useControllableSidebar({ sidebarOpen, defaultSidebarOpen, onSidebarOpenChange }) {
|
|
19
26
|
const [innerOpen, setInnerOpen] = React.useState(defaultSidebarOpen ?? true);
|
|
20
27
|
return [
|
|
@@ -44,6 +51,7 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
44
51
|
const mainRef = React.useRef(null);
|
|
45
52
|
const openerRef = React.useRef(null);
|
|
46
53
|
const compactRef = React.useRef(null);
|
|
54
|
+
const [compact, setCompact] = React.useState(true);
|
|
47
55
|
const restoreSidebarOnWideRef = React.useRef(true);
|
|
48
56
|
const [isSidebarOpen, setSidebarOpen, primeSidebarOpen] = useControllableSidebar({
|
|
49
57
|
sidebarOpen,
|
|
@@ -59,6 +67,7 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
59
67
|
const compact = isCompactSidebar(root);
|
|
60
68
|
const wasCompact = compactRef.current;
|
|
61
69
|
compactRef.current = compact;
|
|
70
|
+
setCompact(compact);
|
|
62
71
|
if (wasCompact === null) {
|
|
63
72
|
if (wantsBuiltInDefault && compact) primeSidebarOpen(false);
|
|
64
73
|
return;
|
|
@@ -103,10 +112,16 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
103
112
|
const dismissSidebar = React.useCallback(() => {
|
|
104
113
|
updateSidebar(() => setSidebarOpen(false), () => openerRef.current?.focus({ preventScroll: true }));
|
|
105
114
|
}, [setSidebarOpen, updateSidebar]);
|
|
106
|
-
const
|
|
115
|
+
const controls = React.useMemo(() => ({
|
|
116
|
+
compact,
|
|
117
|
+
closeSidebar,
|
|
118
|
+
closeSidebarOnCompact
|
|
119
|
+
}), [
|
|
120
|
+
compact,
|
|
107
121
|
closeSidebar,
|
|
108
122
|
closeSidebarOnCompact
|
|
109
|
-
|
|
123
|
+
]);
|
|
124
|
+
const sidebarContent = typeof sidebar === "function" ? sidebar(controls) : sidebar;
|
|
110
125
|
const hasCustomLeading = bar?.leading != null;
|
|
111
126
|
const hasAppLeading = bar?.back != null || hasCustomLeading;
|
|
112
127
|
const hasTitleTrigger = hasSidebar && bar?.compactTitleTrigger != null && bar?.compactLeading == null;
|
|
@@ -138,107 +153,110 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
138
153
|
const mainSidebarToggle = sidebarTogglePlacement === "sidebar" || sidebarTogglePlacement === "main" && !hasCustomLeading ? renderSidebarToggle(sidebarTogglePlacement === "sidebar" ? "responsive-sidebar-shell__toggle--sidebar-fallback" : hasTitleTrigger ? "responsive-sidebar-shell__toggle--replaced-by-title" : bar?.compactLeading != null ? "responsive-sidebar-shell__toggle--replaced-by-compact-leading" : void 0) : null;
|
|
139
154
|
const hasTopBar = !bar?.hidden && (hasSidebar || bar?.back != null || bar?.leading != null || bar?.compactLeading != null || bar?.title != null || bar?.actions != null || bar?.primary != null);
|
|
140
155
|
const compactLeadingMode = hasTitleTrigger ? "trigger" : !hasAppLeading && bar?.compactLeading != null ? "custom" : void 0;
|
|
141
|
-
return /* @__PURE__ */ jsx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
children: sidebarToggle
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
156
|
+
return /* @__PURE__ */ jsx(SidebarShellContext.Provider, {
|
|
157
|
+
value: controls,
|
|
158
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
159
|
+
ref: mergeRefs(rootRef, ref),
|
|
160
|
+
className: cx("responsive-sidebar-shell", className),
|
|
161
|
+
"data-recipe": "fill-host",
|
|
162
|
+
style,
|
|
163
|
+
...props,
|
|
164
|
+
"data-sidebar-open": hasSidebar && isSidebarOpen ? "true" : "false",
|
|
165
|
+
"data-sidebar-toggle-placement": sidebarTogglePlacement,
|
|
166
|
+
onKeyDown: (event) => {
|
|
167
|
+
props.onKeyDown?.(event);
|
|
168
|
+
if (!event.defaultPrevented && event.key === "Escape" && hasSidebar && isSidebarOpen && rootRef.current && isCompactSidebar(rootRef.current)) {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
dismissSidebar();
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
children: /* @__PURE__ */ jsxs(ResizableSidePanel.Root, {
|
|
174
|
+
className: "responsive-sidebar-shell__frame",
|
|
175
|
+
label: sidebarLabel,
|
|
176
|
+
side: "start",
|
|
177
|
+
sizeVariable: "--responsive-sidebar-shell-sidebar-size",
|
|
178
|
+
defaultSize: defaultSidebarWidth,
|
|
179
|
+
minSize: sidebarMinWidth,
|
|
180
|
+
maxSize: sidebarMaxWidth,
|
|
181
|
+
keyboardStep: sidebarKeyboardStep,
|
|
182
|
+
children: [
|
|
183
|
+
hasSidebar && isSidebarOpen ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "responsive-sidebar-shell__resizer" }) : null,
|
|
184
|
+
hasSidebar ? /* @__PURE__ */ jsxs("div", {
|
|
185
|
+
id: sidebarId,
|
|
186
|
+
className: "responsive-sidebar-shell__sidebar",
|
|
187
|
+
"aria-hidden": isSidebarOpen ? void 0 : true,
|
|
188
|
+
inert: isSidebarOpen ? void 0 : true,
|
|
189
|
+
children: [sidebarToggle ? /* @__PURE__ */ jsx("div", {
|
|
190
|
+
className: "responsive-sidebar-shell__sidebar-leading",
|
|
191
|
+
children: sidebarToggle
|
|
192
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: "responsive-sidebar-shell__sidebar-content",
|
|
194
|
+
children: sidebarContent
|
|
195
|
+
})]
|
|
196
|
+
}) : null,
|
|
197
|
+
/* @__PURE__ */ jsxs("div", {
|
|
198
|
+
ref: mainRef,
|
|
199
|
+
className: "responsive-sidebar-shell__main",
|
|
200
|
+
tabIndex: -1,
|
|
201
|
+
children: [
|
|
202
|
+
hasTopBar ? /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
203
|
+
"aria-label": bar?.label ?? "Application controls",
|
|
204
|
+
className: bar?.className,
|
|
205
|
+
"data-compact-leading": compactLeadingMode,
|
|
206
|
+
children: [
|
|
207
|
+
hasSidebar || hasAppLeading || bar?.compactLeading != null ? /* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [
|
|
208
|
+
bar?.back ? /* @__PURE__ */ jsx(AppTopBar.Link, {
|
|
209
|
+
label: bar.back.label,
|
|
210
|
+
render: bar.back.link,
|
|
211
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
212
|
+
}) : null,
|
|
213
|
+
bar?.leading,
|
|
214
|
+
!hasCustomLeading ? mainSidebarToggle : null,
|
|
215
|
+
compactLeadingMode === "custom" ? /* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "responsive-sidebar-shell__compact-leading",
|
|
217
|
+
children: bar?.compactLeading
|
|
218
|
+
}) : null
|
|
219
|
+
] }) : null,
|
|
220
|
+
bar?.title != null || hasTitleTrigger ? /* @__PURE__ */ jsxs(AppTopBar.Title, {
|
|
221
|
+
render: bar?.titleRender,
|
|
222
|
+
children: [bar?.title != null ? /* @__PURE__ */ jsx("span", {
|
|
223
|
+
className: "responsive-sidebar-shell__title-text",
|
|
224
|
+
children: bar.title
|
|
225
|
+
}) : null, hasTitleTrigger ? /* @__PURE__ */ jsxs(Button, {
|
|
226
|
+
type: "button",
|
|
227
|
+
variant: "ghost",
|
|
228
|
+
color: "neutral",
|
|
229
|
+
size: "sm",
|
|
230
|
+
className: "responsive-sidebar-shell__title-trigger",
|
|
231
|
+
"aria-controls": sidebarId,
|
|
232
|
+
"aria-expanded": isSidebarOpen,
|
|
233
|
+
onClick: (event) => toggleSidebar(event.currentTarget),
|
|
234
|
+
children: [bar?.compactTitleTrigger, /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": "true" })]
|
|
235
|
+
}) : null]
|
|
195
236
|
}) : null,
|
|
196
|
-
bar?.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
children: [bar?.compactTitleTrigger, /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": "true" })]
|
|
218
|
-
}) : null]
|
|
219
|
-
}) : null,
|
|
220
|
-
bar?.actions != null || bar?.primary != null ? /* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [bar.actions, bar.primary] }) : null
|
|
221
|
-
]
|
|
222
|
-
}) : null,
|
|
223
|
-
error != null ? /* @__PURE__ */ jsxs("div", {
|
|
224
|
-
className: "responsive-sidebar-shell__error",
|
|
225
|
-
role: "alert",
|
|
226
|
-
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
227
|
-
}) : null,
|
|
228
|
-
children
|
|
229
|
-
]
|
|
230
|
-
}),
|
|
231
|
-
hasSidebar && isSidebarOpen ? /* @__PURE__ */ jsx(Button, {
|
|
232
|
-
type: "button",
|
|
233
|
-
variant: "ghost",
|
|
234
|
-
color: "neutral",
|
|
235
|
-
className: "responsive-sidebar-shell__peek",
|
|
236
|
-
"aria-label": showMainLabel,
|
|
237
|
-
onClick: closeSidebar
|
|
238
|
-
}) : null
|
|
239
|
-
]
|
|
237
|
+
bar?.actions != null || bar?.primary != null ? /* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [bar.actions, bar.primary] }) : null
|
|
238
|
+
]
|
|
239
|
+
}) : null,
|
|
240
|
+
error != null ? /* @__PURE__ */ jsxs("div", {
|
|
241
|
+
className: "responsive-sidebar-shell__error",
|
|
242
|
+
role: "alert",
|
|
243
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
244
|
+
}) : null,
|
|
245
|
+
children
|
|
246
|
+
]
|
|
247
|
+
}),
|
|
248
|
+
hasSidebar && isSidebarOpen ? /* @__PURE__ */ jsx(Button, {
|
|
249
|
+
type: "button",
|
|
250
|
+
variant: "ghost",
|
|
251
|
+
color: "neutral",
|
|
252
|
+
className: "responsive-sidebar-shell__peek",
|
|
253
|
+
"aria-label": showMainLabel,
|
|
254
|
+
onClick: closeSidebar
|
|
255
|
+
}) : null
|
|
256
|
+
]
|
|
257
|
+
})
|
|
240
258
|
})
|
|
241
259
|
});
|
|
242
260
|
}
|
|
243
261
|
//#endregion
|
|
244
|
-
export { ResponsiveSidebarShell };
|
|
262
|
+
export { ResponsiveSidebarShell, useResponsiveSidebarShell };
|
|
@@ -1,48 +1,35 @@
|
|
|
1
|
+
import { Dialog } from "../foundations/Dialog.js";
|
|
2
|
+
import { FormProps } from "../foundations/Form.js";
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
|
|
3
5
|
//#region src/components/general-purpose/SettingsFormDialog.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A checked box submits this, an unchecked one submits the empty string, so
|
|
7
|
-
* `SettingsFormValues` stays all-strings for every field type.
|
|
8
|
-
*/
|
|
9
|
-
declare const SETTINGS_FORM_CHECKED = "true";
|
|
10
|
-
interface SettingsFormField {
|
|
11
|
-
name: string;
|
|
12
|
-
label: string;
|
|
13
|
-
description?: React.ReactNode;
|
|
14
|
-
type?: SettingsFormFieldType;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
autoComplete?: string;
|
|
17
|
-
required?: boolean;
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
}
|
|
20
|
-
type SettingsFormValues<Fields extends readonly SettingsFormField[]> = Readonly<Record<Fields[number]["name"], string>>;
|
|
21
|
-
interface SettingsFormDialogProps<Fields extends readonly SettingsFormField[]> {
|
|
6
|
+
interface SettingsFormDialogProps<Values extends Record<string, unknown> = Record<string, unknown>> {
|
|
22
7
|
open: boolean;
|
|
23
|
-
|
|
8
|
+
/** Base UI owns dismissal reasons and cancellation, including successful submission. */
|
|
9
|
+
onOpenChange: NonNullable<React.ComponentProps<typeof Dialog.Root>["onOpenChange"]>;
|
|
24
10
|
title: React.ReactNode;
|
|
25
11
|
description: React.ReactNode;
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
/** Compose labeled Field/control children with their own defaults and validation. */
|
|
13
|
+
children: React.ReactNode;
|
|
28
14
|
submitLabel: string;
|
|
29
15
|
submittingLabel?: string;
|
|
30
16
|
removeLabel?: string;
|
|
31
17
|
removingLabel?: string;
|
|
32
18
|
externalError?: string;
|
|
33
|
-
|
|
19
|
+
/** Receives Base UI values and event details unchanged; the host owns parsing and normalization. */
|
|
20
|
+
onFormSubmit: NonNullable<FormProps<Values>["onFormSubmit"]>;
|
|
34
21
|
onRemove?: () => void | Promise<void>;
|
|
35
22
|
}
|
|
36
23
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
24
|
+
* Settings dialog with caller-composed controls and shared async submit/remove
|
|
25
|
+
* feedback. Base UI owns validation and values; product schemas stay in the host.
|
|
39
26
|
*/
|
|
40
|
-
declare function SettingsFormDialog<
|
|
27
|
+
declare function SettingsFormDialog<Values extends Record<string, unknown> = Record<string, unknown>>({
|
|
41
28
|
open,
|
|
42
29
|
onOpenChange,
|
|
43
30
|
title,
|
|
44
31
|
description,
|
|
45
32
|
...contentProps
|
|
46
|
-
}: SettingsFormDialogProps<
|
|
33
|
+
}: SettingsFormDialogProps<Values>): React.JSX.Element;
|
|
47
34
|
//#endregion
|
|
48
|
-
export {
|
|
35
|
+
export { SettingsFormDialog, SettingsFormDialogProps };
|
|
@@ -3,125 +3,95 @@ import { Dialog } from "../foundations/Dialog.js";
|
|
|
3
3
|
import { a as formatErrorMessage } from "../../format-COCyV98Z.js";
|
|
4
4
|
import { Field } from "../foundations/Field.js";
|
|
5
5
|
import { Form } from "../foundations/Form.js";
|
|
6
|
-
import { Checkbox } from "../foundations/Checkbox.js";
|
|
7
6
|
import * as React from "react";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
//#region src/components/general-purpose/SettingsFormDialog.tsx
|
|
10
|
-
|
|
11
|
-
* A checked box submits this, an unchecked one submits the empty string, so
|
|
12
|
-
* `SettingsFormValues` stays all-strings for every field type.
|
|
13
|
-
*/
|
|
14
|
-
const SETTINGS_FORM_CHECKED = "true";
|
|
15
|
-
function readSettingsValues(data, fields) {
|
|
16
|
-
return Object.fromEntries(fields.map((field) => {
|
|
17
|
-
const value = data[field.name];
|
|
18
|
-
if (field.type === "checkbox") return [field.name, value === true ? SETTINGS_FORM_CHECKED : ""];
|
|
19
|
-
return [field.name, typeof value === "string" ? value.trim() : ""];
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
function SettingsFormDialogContent({ fields, initialValues, submitLabel, submittingLabel = "Saving…", removeLabel, removingLabel = "Removing…", externalError, onSubmit, onRemove, onOpenChange }) {
|
|
9
|
+
function SettingsFormDialogContent({ children, submitLabel, submittingLabel = "Saving…", removeLabel, removingLabel = "Removing…", externalError, onFormSubmit, onRemove, close }) {
|
|
23
10
|
const [submission, setSubmission] = React.useState(null);
|
|
24
11
|
const active = React.useRef(true);
|
|
12
|
+
const inFlight = React.useRef(false);
|
|
25
13
|
const pending = submission === "submit" || submission === "remove";
|
|
26
14
|
const error = submission && typeof submission === "object" ? submission.error : null;
|
|
27
|
-
const initialValueByName = initialValues ?? {};
|
|
28
15
|
React.useEffect(() => {
|
|
29
16
|
active.current = true;
|
|
30
17
|
return () => {
|
|
31
18
|
active.current = false;
|
|
32
19
|
};
|
|
33
20
|
}, []);
|
|
34
|
-
async function submit(
|
|
21
|
+
async function submit(...args) {
|
|
22
|
+
if (inFlight.current) return;
|
|
23
|
+
inFlight.current = true;
|
|
35
24
|
setSubmission("submit");
|
|
36
25
|
try {
|
|
37
|
-
await
|
|
26
|
+
await Promise.resolve(onFormSubmit(...args));
|
|
38
27
|
if (!active.current) return;
|
|
39
28
|
setSubmission(null);
|
|
40
|
-
|
|
29
|
+
close();
|
|
41
30
|
} catch (cause) {
|
|
42
31
|
if (!active.current) return;
|
|
43
32
|
setSubmission({ error: formatErrorMessage(cause) });
|
|
33
|
+
} finally {
|
|
34
|
+
inFlight.current = false;
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
async function remove() {
|
|
47
|
-
if (!onRemove) return;
|
|
38
|
+
if (!onRemove || inFlight.current) return;
|
|
39
|
+
inFlight.current = true;
|
|
48
40
|
setSubmission("remove");
|
|
49
41
|
try {
|
|
50
42
|
await onRemove();
|
|
51
43
|
if (!active.current) return;
|
|
52
44
|
setSubmission(null);
|
|
53
|
-
|
|
45
|
+
close();
|
|
54
46
|
} catch (cause) {
|
|
55
47
|
if (!active.current) return;
|
|
56
48
|
setSubmission({ error: formatErrorMessage(cause) });
|
|
49
|
+
} finally {
|
|
50
|
+
inFlight.current = false;
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
53
|
return /* @__PURE__ */ jsxs(Form, {
|
|
60
54
|
onFormSubmit: submit,
|
|
61
55
|
children: [
|
|
62
|
-
|
|
63
|
-
name: field.name,
|
|
64
|
-
orientation: "horizontal",
|
|
65
|
-
children: [/* @__PURE__ */ jsx(Checkbox.Root, {
|
|
66
|
-
defaultChecked: initialValueByName[field.name] === SETTINGS_FORM_CHECKED,
|
|
67
|
-
disabled: field.readOnly,
|
|
68
|
-
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {})
|
|
69
|
-
}), /* @__PURE__ */ jsxs(Field.Content, { children: [/* @__PURE__ */ jsx(Field.Label, { children: field.label }), field.description ? /* @__PURE__ */ jsx(Field.Description, { children: field.description }) : null] })]
|
|
70
|
-
}, field.name) : /* @__PURE__ */ jsxs(Field.Root, {
|
|
71
|
-
name: field.name,
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ jsx(Field.Label, { children: field.label }),
|
|
74
|
-
/* @__PURE__ */ jsx(Field.Control, {
|
|
75
|
-
autoComplete: field.autoComplete,
|
|
76
|
-
defaultValue: initialValueByName[field.name],
|
|
77
|
-
placeholder: field.placeholder,
|
|
78
|
-
readOnly: field.readOnly,
|
|
79
|
-
required: field.required,
|
|
80
|
-
type: field.type
|
|
81
|
-
}),
|
|
82
|
-
field.description ? /* @__PURE__ */ jsx(Field.Description, { children: field.description }) : null,
|
|
83
|
-
field.required ? /* @__PURE__ */ jsxs(Field.Error, {
|
|
84
|
-
match: "valueMissing",
|
|
85
|
-
children: [field.label, " is required."]
|
|
86
|
-
}) : null,
|
|
87
|
-
field.type === "url" ? /* @__PURE__ */ jsx(Field.Error, {
|
|
88
|
-
match: "typeMismatch",
|
|
89
|
-
children: "Enter a valid URL."
|
|
90
|
-
}) : null
|
|
91
|
-
]
|
|
92
|
-
}, field.name)),
|
|
56
|
+
children,
|
|
93
57
|
error ? /* @__PURE__ */ jsx(Field.Errors, { errors: [error] }) : externalError ? /* @__PURE__ */ jsx(Field.Errors, { errors: [externalError] }) : null,
|
|
94
|
-
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
58
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
59
|
+
onRemove && removeLabel ? /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
type: "button",
|
|
61
|
+
variant: "ghost",
|
|
62
|
+
color: "destructive",
|
|
63
|
+
disabled: pending,
|
|
64
|
+
focusableWhenDisabled: pending,
|
|
65
|
+
onClick: () => void remove(),
|
|
66
|
+
children: submission === "remove" ? removingLabel : removeLabel
|
|
67
|
+
}) : null,
|
|
68
|
+
/* @__PURE__ */ jsx(Dialog.Close, { children: "Cancel" }),
|
|
69
|
+
/* @__PURE__ */ jsx(Button, {
|
|
70
|
+
type: "submit",
|
|
71
|
+
color: "primary",
|
|
72
|
+
disabled: pending,
|
|
73
|
+
focusableWhenDisabled: pending,
|
|
74
|
+
children: submission === "submit" ? submittingLabel : submitLabel
|
|
75
|
+
})
|
|
76
|
+
] })
|
|
109
77
|
]
|
|
110
78
|
});
|
|
111
79
|
}
|
|
112
80
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
81
|
+
* Settings dialog with caller-composed controls and shared async submit/remove
|
|
82
|
+
* feedback. Base UI owns validation and values; product schemas stay in the host.
|
|
115
83
|
*/
|
|
116
84
|
function SettingsFormDialog({ open, onOpenChange, title, description, ...contentProps }) {
|
|
85
|
+
const actionsRef = React.useRef(null);
|
|
117
86
|
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
118
87
|
open,
|
|
119
88
|
onOpenChange,
|
|
89
|
+
actionsRef,
|
|
120
90
|
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Viewport, { children: /* @__PURE__ */ jsxs(Dialog.Popup, { children: [/* @__PURE__ */ jsxs(Dialog.Header, { children: [/* @__PURE__ */ jsx(Dialog.Title, { children: title }), /* @__PURE__ */ jsx(Dialog.Description, { children: description })] }), /* @__PURE__ */ jsx(SettingsFormDialogContent, {
|
|
121
91
|
...contentProps,
|
|
122
|
-
|
|
92
|
+
close: () => actionsRef.current?.close()
|
|
123
93
|
}, open ? "open" : "closed")] }) })] })
|
|
124
94
|
});
|
|
125
95
|
}
|
|
126
96
|
//#endregion
|
|
127
|
-
export {
|
|
97
|
+
export { SettingsFormDialog };
|
|
@@ -14,6 +14,7 @@ interface SetupChecklistEntry<Id extends string = string> {
|
|
|
14
14
|
interface SetupChecklistGroupProps<Id extends string = string> {
|
|
15
15
|
/** Quiet visible heading above the checklist rows. */
|
|
16
16
|
label: React.ReactNode;
|
|
17
|
+
/** Host-owned setup tasks and their current completion state. */
|
|
17
18
|
entries: readonly SetupChecklistEntry<Id>[];
|
|
18
19
|
/** Whether rows are visible when the containing menu first opens. */
|
|
19
20
|
defaultOpen?: boolean;
|
|
@@ -1,2 +1,77 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as mergeBaseClassName } from "../../class-names-BiMDVpUo.js";
|
|
2
|
+
import { B as PlusIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon } from "../../icons-cuEtsgj9.js";
|
|
3
|
+
import { Button } from "../foundations/Button.js";
|
|
4
|
+
import { Menu } from "../foundations/Menu.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/_internal/menu-disclosure-group.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A menu-native disclosure: its trigger stays in the menu roving-focus model,
|
|
10
|
+
* while its rows mount only after the user expands the section.
|
|
11
|
+
*/
|
|
12
|
+
function MenuDisclosureGroup({ children, className, defaultOpen = false, label, triggerClassName, ...props }) {
|
|
13
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
14
|
+
return /* @__PURE__ */ jsxs(Menu.Group, {
|
|
15
|
+
className: mergeBaseClassName("menu-disclosure-group", className),
|
|
16
|
+
...props,
|
|
17
|
+
children: [/* @__PURE__ */ jsxs(Menu.Item, {
|
|
18
|
+
"aria-expanded": open,
|
|
19
|
+
className: mergeBaseClassName("menu-disclosure-group__trigger", triggerClassName),
|
|
20
|
+
closeOnClick: false,
|
|
21
|
+
onClick: () => setOpen((current) => !current),
|
|
22
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "sigvelo-truncate-grow",
|
|
24
|
+
children: label
|
|
25
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": "true" })]
|
|
26
|
+
}), open ? /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: "menu-disclosure-group__items",
|
|
28
|
+
children
|
|
29
|
+
}) : null]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/general-purpose/SetupChecklist.tsx
|
|
34
|
+
/** Checklist rows for any Menu surface (composer plus menu, tray menu). */
|
|
35
|
+
function SetupChecklistGroup({ label, entries, defaultOpen = false, onSelect }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(MenuDisclosureGroup, {
|
|
37
|
+
label,
|
|
38
|
+
defaultOpen,
|
|
39
|
+
children: entries.map((entry) => /* @__PURE__ */ jsxs(Menu.Item, {
|
|
40
|
+
"aria-label": `${entry.name}, ${entry.complete ? "complete" : "not set up"}`,
|
|
41
|
+
onClick: () => onSelect(entry.id),
|
|
42
|
+
children: [
|
|
43
|
+
entry.icon,
|
|
44
|
+
/* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: "sigvelo-truncate-grow",
|
|
46
|
+
children: entry.description
|
|
47
|
+
}),
|
|
48
|
+
entry.complete ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": "true" })
|
|
49
|
+
]
|
|
50
|
+
}, entry.id))
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Progress-aware tray trigger opening the checklist in its own menu. */
|
|
54
|
+
function SetupChecklistAction({ actionLabel, label, entries, onSelect }) {
|
|
55
|
+
const completed = entries.filter((entry) => entry.complete).length;
|
|
56
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
57
|
+
type: "button",
|
|
58
|
+
variant: "ghost",
|
|
59
|
+
color: "neutral",
|
|
60
|
+
size: "sm",
|
|
61
|
+
"aria-label": `${actionLabel} — ${completed} of ${entries.length} set up`,
|
|
62
|
+
render: /* @__PURE__ */ jsx(Menu.Trigger, { unstyled: true }),
|
|
63
|
+
children: [completed === entries.length ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: actionLabel })]
|
|
64
|
+
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
65
|
+
side: "bottom",
|
|
66
|
+
align: "start",
|
|
67
|
+
sideOffset: 4,
|
|
68
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, { children: /* @__PURE__ */ jsx(SetupChecklistGroup, {
|
|
69
|
+
defaultOpen: true,
|
|
70
|
+
label,
|
|
71
|
+
entries,
|
|
72
|
+
onSelect
|
|
73
|
+
}) })
|
|
74
|
+
}) })] });
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
2
77
|
export { SetupChecklistAction, SetupChecklistGroup };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as IconButtonProps } from "../../IconButton-
|
|
2
|
-
import { t as CopyButtonProps } from "../../copy-button-
|
|
1
|
+
import { n as IconButtonProps } from "../../IconButton-ByiyjkYE.js";
|
|
2
|
+
import { t as CopyButtonProps } from "../../copy-button-OUwOdgEm.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/general-purpose/Terminal.d.ts
|
|
@@ -42,7 +42,7 @@ declare function Terminal({
|
|
|
42
42
|
ref,
|
|
43
43
|
...props
|
|
44
44
|
}: TerminalProps & {
|
|
45
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
45
|
+
/** Ref forwarded to the component's rendered root element. */ref?: React.Ref<HTMLDivElement>;
|
|
46
46
|
}): React.JSX.Element;
|
|
47
47
|
interface TerminalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
48
48
|
declare function TerminalHeader({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
2
|
import { Z as TerminalIcon, nt as XIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { IconButton } from "../foundations/IconButton.js";
|
|
4
|
-
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
5
4
|
import { t as CopyButton } from "../../copy-button-CSDuDfdP.js";
|
|
5
|
+
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import Anser from "anser";
|
|
@@ -56,6 +56,15 @@ function parseAnsi(input) {
|
|
|
56
56
|
dim: c.decorations?.includes("dim") ?? false
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
|
+
const ANSI_ESCAPE_SEQUENCE = /\u001b\[[0-9;?]*[a-zA-Z]/g;
|
|
60
|
+
/**
|
|
61
|
+
* The same text with every escape sequence removed, for surfaces that need the
|
|
62
|
+
* plain characters instead of {@link parseAnsi}'s formatted segments — copying
|
|
63
|
+
* terminal output, measuring it, or searching it.
|
|
64
|
+
*/
|
|
65
|
+
function stripAnsi(input) {
|
|
66
|
+
return input.replace(ANSI_ESCAPE_SEQUENCE, "");
|
|
67
|
+
}
|
|
59
68
|
//#endregion
|
|
60
69
|
//#region src/components/general-purpose/Terminal.tsx
|
|
61
70
|
const TerminalContext = React.createContext(null);
|
|
@@ -219,9 +228,5 @@ function TerminalClearButton({ className, label = "Clear terminal", onClick, ...
|
|
|
219
228
|
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
220
229
|
});
|
|
221
230
|
}
|
|
222
|
-
const ANSI_REGEX = /\u001b\[[0-9;?]*[a-zA-Z]/g;
|
|
223
|
-
function stripAnsi(input) {
|
|
224
|
-
return input.replace(ANSI_REGEX, "");
|
|
225
|
-
}
|
|
226
231
|
//#endregion
|
|
227
232
|
export { Terminal, TerminalActions, TerminalClearButton, TerminalContent, TerminalCopyButton, TerminalHeader, TerminalStatus, TerminalTitle };
|