@mcp-b/react-components 0.48.0 → 0.49.1
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-v5890eA1.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-BSJl682D.js → CodeBlock-g8sADidM.js} +8 -8
- package/dist/{FileTree-DvE0hNZu.js → FileTree-DruTQ-oa.js} +38 -36
- package/dist/{IconButton-BAUFhUk8.d.ts → IconButton-ByiyjkYE.d.ts} +2 -2
- package/dist/{Menu-yb6QXWA3.d.ts → Menu-CgfUZhZd.d.ts} +1 -1
- 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-4kCz3T9P.d.ts} +45 -32
- 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-LIoU30n7.d.ts → Workspace-HzGrWDX3.d.ts} +1 -1
- package/dist/{WorkspaceFile-Dq-GC0_T.d.ts → WorkspaceFile-Bouauobc.d.ts} +1 -1
- package/dist/{WorkspaceFileView-C_WnYm-a.js → WorkspaceFileView-DYPtRVpM.js} +5 -4
- package/dist/{WorkspaceLink-B1d2GIGl.js → WorkspaceLink-BYZG-V_I.js} +8 -91
- package/dist/{WorkspaceMessageResponse-BqOezptB.js → WorkspaceMessageResponse-CUJk9_P5.js} +2 -2
- package/dist/components/agents-sdk/AgentActivity.js +1 -1
- package/dist/components/agents-sdk/AgentChat.d.ts +198 -2
- package/dist/components/agents-sdk/AgentChat.js +527 -672
- 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 +2 -2
- 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 +22 -14
- package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
- package/dist/components/agents-sdk/BrowserReplay.d.ts +1 -1
- package/dist/components/agents-sdk/BrowserReplay.js +1 -1
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +3 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +32 -31
- 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 +79 -40
- package/dist/components/agents-sdk/ManagerOffice.js +291 -281
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +4 -4
- package/dist/components/agents-sdk/McpConnectionRequest.js +4 -3
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +38 -1
- package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +93 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +5 -4
- 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 +5 -4
- package/dist/components/agents-sdk/McpServerPicker.js +4 -3
- package/dist/components/agents-sdk/ModelSelector.d.ts +4 -4
- package/dist/components/agents-sdk/ModelSelector.js +4 -4
- package/dist/components/agents-sdk/PromptInputApproval.d.ts +1 -43
- package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.js +2 -3
- 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 +19 -24
- 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 +5 -3
- 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 +18 -10
- 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 +24 -19
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +2 -2
- package/dist/components/agents-sdk/ThinkExecutionStatus.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +85 -28
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +159 -102
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +40 -158
- package/dist/components/agents-sdk/ThinkFullApp.js +71 -290
- package/dist/components/agents-sdk/ThinkRecoveryNotice.d.ts +18 -1
- package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -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 +17 -15
- package/dist/components/agents-sdk/ThinkRoutineDetail.js +11 -11
- package/dist/components/agents-sdk/ThinkRoutineForm.d.ts +2 -1
- package/dist/components/agents-sdk/ThinkRoutineForm.js +14 -14
- package/dist/components/agents-sdk/ThinkRoutineRuns.js +7 -7
- package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +90 -1
- package/dist/components/agents-sdk/ThinkThreadPicker.js +3 -3
- package/dist/components/agents-sdk/Workspace.d.ts +1 -1
- package/dist/components/agents-sdk/Workspace.js +7 -13
- 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 +1 -1
- package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +10 -1
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +10 -7
- package/dist/components/agents-sdk/WorkspaceExecution.d.ts +5 -14
- package/dist/components/agents-sdk/WorkspaceExecution.js +24 -38
- 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/WorkspaceHeader.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/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 +6 -9
- 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 +5 -14
- package/dist/components/agents-sdk/WorkspaceProject.js +21 -35
- package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +8 -5
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/Activity.js +1 -1
- package/dist/components/ai-sdk/AgentAttention.d.ts +2 -2
- package/dist/components/ai-sdk/AgentChatMessageEditor.js +5 -1
- package/dist/components/ai-sdk/AgentChatStartScreen.d.ts +89 -2
- package/dist/components/ai-sdk/AgentChatStartScreen.js +64 -43
- 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/Approval.js +2 -2
- package/dist/components/ai-sdk/Artifact.d.ts +2 -2
- package/dist/components/ai-sdk/Artifact.js +1 -1
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/ChainOfThought.js +1 -1
- package/dist/components/ai-sdk/Checkpoint.js +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 +2 -3
- package/dist/components/ai-sdk/ConnectedAppCards.d.ts +9 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +28 -21
- 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/Conversation.js +1 -1
- package/dist/components/ai-sdk/Goal.d.ts +3 -3
- package/dist/components/ai-sdk/Goal.js +3 -3
- package/dist/components/ai-sdk/InlineCitation.d.ts +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.d.ts +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/Message.d.ts +2 -2
- package/dist/components/ai-sdk/Message.js +12 -3
- package/dist/components/ai-sdk/MessageScroller.d.ts +1 -1
- package/dist/components/ai-sdk/MessageScroller.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.d.ts +2 -76
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +40 -5
- package/dist/components/ai-sdk/Plan.d.ts +1 -1
- package/dist/components/ai-sdk/Plan.js +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +175 -231
- 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 +20 -5
- package/dist/components/ai-sdk/Reasoning.d.ts +1 -1
- package/dist/components/ai-sdk/Reasoning.js +5 -5
- package/dist/components/ai-sdk/Sources.d.ts +1 -1
- package/dist/components/ai-sdk/Sources.js +1 -1
- package/dist/components/ai-sdk/Task.d.ts +1 -1
- package/dist/components/ai-sdk/Task.js +1 -1
- package/dist/components/extension/ChatGptSignInScreen.d.ts +1 -1
- package/dist/components/extension/ChatGptSignInScreen.js +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +6 -1
- package/dist/components/extension/CodexModelSelector.js +3 -3
- package/dist/components/extension/ConversationTabPicker.d.ts +1 -0
- package/dist/components/extension/ConversationTabPicker.js +2 -2
- 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/Checkbox.js +1 -1
- package/dist/components/foundations/CheckboxGroup.d.ts +1 -1
- package/dist/components/foundations/Collapsible.d.ts +1 -1
- package/dist/components/foundations/Collapsible.js +1 -1
- package/dist/components/foundations/Combobox.js +6 -1
- package/dist/components/foundations/ContextMenu.d.ts +10 -23
- package/dist/components/foundations/ContextMenu.js +3 -2
- 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/Menu.d.ts +1 -1
- package/dist/components/foundations/Menubar.d.ts +1 -1
- package/dist/components/foundations/Menubar.js +1 -1
- package/dist/components/foundations/Meter.d.ts +1 -1
- package/dist/components/foundations/NumberField.d.ts +1 -1
- package/dist/components/foundations/PreviewCard.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/SearchField.js +1 -1
- package/dist/components/foundations/Select.js +7 -2
- package/dist/components/foundations/Separator.d.ts +1 -40
- package/dist/components/foundations/Stepper.d.ts +1 -1
- package/dist/components/foundations/Stepper.js +1 -1
- package/dist/components/foundations/Textarea.d.ts +1 -1
- package/dist/components/foundations/Toast.d.ts +5 -1
- package/dist/components/foundations/Toast.js +1 -1
- package/dist/components/foundations/Toggle.d.ts +70 -1
- package/dist/components/foundations/ToggleGroup.d.ts +4 -3
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/foundations/Toolbar.d.ts +1 -151
- package/dist/components/foundations/Tooltip.d.ts +1 -1
- package/dist/components/foundations/TransitionSurface.d.ts +1 -1
- package/dist/components/foundations/icons.js +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 +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.d.ts +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.js +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/PricingPlanCard.d.ts +4 -0
- package/dist/components/general-purpose/PricingPlanCard.js +2 -2
- package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
- 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 +120 -102
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +14 -27
- package/dist/components/general-purpose/SettingsFormDialog.js +42 -72
- 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 +11 -6
- package/dist/components/general-purpose/TestResults.d.ts +23 -11
- package/dist/components/general-purpose/TestResults.js +49 -51
- package/dist/components/general-purpose/ThemeModeControl.d.ts +2 -0
- package/dist/components/general-purpose/ThemeModeControl.js +2 -2
- package/dist/components/general-purpose/WebPreview.d.ts +29 -4
- package/dist/components/general-purpose/WebPreview.js +39 -14
- package/dist/components/nanites/AgentConnection.js +2 -2
- package/dist/components/nanites/AgentToolDetail.d.ts +13 -11
- package/dist/components/nanites/AgentToolDetail.js +21 -42
- package/dist/{copy-button-Dk2vRe9j.js → copy-button-CSDuDfdP.js} +1 -1
- 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/accessibility.css +20 -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 +1 -9
- 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/codex-model-selector.css +4 -0
- package/dist/styles/color-contrast.test.ts +212 -0
- package/dist/styles/composition-motion.css +0 -2
- package/dist/styles/employee-chrome.css +43 -0
- package/dist/styles/file-tree.css +10 -1
- package/dist/styles/index.css +4 -2
- package/dist/styles/manager-office.css +5 -5
- package/dist/styles/message.css +2 -10
- package/dist/styles/queue.css +71 -0
- package/dist/styles/responsive-sidebar-shell.css +1 -1
- 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/codex-model-catalog.d.ts +25 -6
- package/dist/utils/codex-model-catalog.js +22 -5
- 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-GqsCYxqT.js → workspace-assets-Bg7XhPsk.js} +2 -2
- package/package.json +8 -4
- 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-DeTU9YpW.js +0 -77
- package/dist/ThinkChat-CwMdEum8.d.ts +0 -185
- package/dist/ThinkChat-DiI6hhDP.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-DfjH1Ypm.d.ts +0 -61
- 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
- package/dist/{icons-CeGfXO21.js → icons-cuEtsgj9.js} +1 -1
|
@@ -1,2 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { AppTopBarTitleProps } from "./AppTopBar.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/general-purpose/ResponsiveSidebarShell.d.ts
|
|
5
|
+
interface ResponsiveSidebarShellControls {
|
|
6
|
+
/** The shell's current container layout, shared by in-shell and portalled controls. */
|
|
7
|
+
compact: boolean;
|
|
8
|
+
/** Close the sidebar and move focus to the main content. */
|
|
9
|
+
closeSidebar: () => void;
|
|
10
|
+
/** Close only when the shell is currently using its compact drawer layout. */
|
|
11
|
+
closeSidebarOnCompact: () => void;
|
|
12
|
+
}
|
|
13
|
+
/** Reuse the shell's measured layout and drawer controls instead of observing it again. */
|
|
14
|
+
declare function useResponsiveSidebarShell(): ResponsiveSidebarShellControls;
|
|
15
|
+
/**
|
|
16
|
+
* Bar slot content shared by every shell-owning surface's `bar` prop, so an
|
|
17
|
+
* app writes one shape whether it is configuring ThinkFullApp, the routine
|
|
18
|
+
* library, or the shell directly.
|
|
19
|
+
*/
|
|
20
|
+
interface AppBarSlots {
|
|
21
|
+
/**
|
|
22
|
+
* App-owned route element rendered as a labelled back control. Back owns
|
|
23
|
+
* the leading slot the same way `leading` does: the shell's own sidebar
|
|
24
|
+
* toggle stands down and compact sidebars stay reachable through
|
|
25
|
+
* `compactTitleTrigger`.
|
|
26
|
+
*/
|
|
27
|
+
back?: {
|
|
28
|
+
label: string;
|
|
29
|
+
link: React.ReactElement;
|
|
30
|
+
};
|
|
31
|
+
/** App-owned leading navigation that owns the leading slot at every width. */
|
|
32
|
+
leading?: React.ReactNode;
|
|
33
|
+
/** Compact-only navigation that replaces the drawer trigger without hiding the wide rail toggle. */
|
|
34
|
+
compactLeading?: React.ReactNode;
|
|
35
|
+
/** Bar title content. Hidden at compact widths when `compactTitleTrigger` stands in. */
|
|
36
|
+
title?: React.ReactNode;
|
|
37
|
+
/** Trailing group, before `primary`. Overflow menus and secondary icon controls. */
|
|
38
|
+
actions?: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Rightmost trailing control. Sits after `actions` so a host can keep a
|
|
41
|
+
* single primary action (new thread, new schedule) on the trailing edge
|
|
42
|
+
* without fighting whatever else the surface puts in the bar.
|
|
43
|
+
*/
|
|
44
|
+
primary?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
interface ResponsiveSidebarShellBar extends AppBarSlots {
|
|
47
|
+
/** Native title render contract, including element and render-function composition. */
|
|
48
|
+
titleRender?: AppTopBarTitleProps["render"];
|
|
49
|
+
/**
|
|
50
|
+
* Label content for a compact-width drawer trigger that replaces the plain
|
|
51
|
+
* title and the icon toggle: the title itself becomes the control that opens
|
|
52
|
+
* the sidebar. The shell renders the button and the disclosure chevron.
|
|
53
|
+
*/
|
|
54
|
+
compactTitleTrigger?: React.ReactNode;
|
|
55
|
+
/** Accessible name for the bar toolbar. Defaults to "Application controls". */
|
|
56
|
+
label?: string;
|
|
57
|
+
/** Class for the bar root, the owning surface's styling hook. */
|
|
58
|
+
className?: string;
|
|
59
|
+
/**
|
|
60
|
+
* No bar row at all — for content that brings its own application bar.
|
|
61
|
+
* Distinct from passing no slots: an empty shell with a sidebar still shows
|
|
62
|
+
* a bar carrying the toggle.
|
|
63
|
+
*/
|
|
64
|
+
hidden?: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface ResponsiveSidebarShellProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "title"> {
|
|
67
|
+
/**
|
|
68
|
+
* Navigation or other secondary surface shown beside the selected content.
|
|
69
|
+
* Omit for a shell that is only a bar row over content — the app bar then
|
|
70
|
+
* has one mount point whether or not a sidebar exists.
|
|
71
|
+
*
|
|
72
|
+
* Open/closed is shell-internal: it is ephemeral presentation state, not a
|
|
73
|
+
* route, so no host controls it and no resize ever writes into a router.
|
|
74
|
+
*/
|
|
75
|
+
sidebar?: React.ReactNode | ((controls: ResponsiveSidebarShellControls) => React.ReactNode);
|
|
76
|
+
/** Main content. */
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
/** Short noun used by the toggle and resize control, such as “threads” or “schedules”. */
|
|
79
|
+
sidebarLabel?: string;
|
|
80
|
+
/** Whether the sidebar is open. Omit for internal state. */
|
|
81
|
+
sidebarOpen?: boolean;
|
|
82
|
+
/** Move the wide-layout toggle into the sidebar while it is open. */
|
|
83
|
+
sidebarTogglePlacement?: "main" | "sidebar";
|
|
84
|
+
/** Initial sidebar state when `sidebarOpen` is uncontrolled. */
|
|
85
|
+
defaultSidebarOpen?: boolean;
|
|
86
|
+
/** Called when the sidebar is opened or closed. */
|
|
87
|
+
onSidebarOpenChange?: (open: boolean) => void;
|
|
88
|
+
/** Initial desktop sidebar width in CSS pixels. */
|
|
89
|
+
defaultSidebarWidth?: number;
|
|
90
|
+
/** Shell-owned application bar composed from slots. */
|
|
91
|
+
bar?: ResponsiveSidebarShellBar;
|
|
92
|
+
/**
|
|
93
|
+
* Host-owned error shown in the main column above the content, without
|
|
94
|
+
* replacing it. The shell renders the alert anatomy; pass the message.
|
|
95
|
+
*/
|
|
96
|
+
error?: React.ReactNode;
|
|
97
|
+
/** Accessible name for the mobile peek target that returns to the main content. */
|
|
98
|
+
showMainLabel?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The one application shell: responsive master-detail with a resizable desktop
|
|
102
|
+
* sidebar, a compact floating drawer that leaves the main content in place as
|
|
103
|
+
* a dismiss target, and a shell-owned application bar composed from slots.
|
|
104
|
+
* The root exposes `data-sidebar-open="true" | "false"` as its public styling
|
|
105
|
+
* hook, and its container name `responsive-sidebar-shell` is public contract:
|
|
106
|
+
* surfaces that compose the shell size themselves against it.
|
|
107
|
+
*/
|
|
108
|
+
declare function ResponsiveSidebarShell({
|
|
109
|
+
sidebar,
|
|
110
|
+
sidebarLabel,
|
|
111
|
+
sidebarOpen,
|
|
112
|
+
sidebarTogglePlacement,
|
|
113
|
+
defaultSidebarOpen,
|
|
114
|
+
defaultSidebarWidth,
|
|
115
|
+
onSidebarOpenChange,
|
|
116
|
+
bar,
|
|
117
|
+
error,
|
|
118
|
+
showMainLabel,
|
|
119
|
+
className,
|
|
120
|
+
children,
|
|
121
|
+
ref,
|
|
122
|
+
style,
|
|
123
|
+
...props
|
|
124
|
+
}: ResponsiveSidebarShellProps & {
|
|
125
|
+
/** Ref forwarded to the component's rendered root element. */ref?: React.Ref<HTMLDivElement>;
|
|
126
|
+
}): React.JSX.Element;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { AppBarSlots, ResponsiveSidebarShell, ResponsiveSidebarShellBar, ResponsiveSidebarShellControls, ResponsiveSidebarShellProps, useResponsiveSidebarShell };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { W as SidebarIcon, et as WarningIcon, f as ChevronDownIcon, r as ArrowLeftIcon } from "../../icons-
|
|
2
|
+
import { W as SidebarIcon, et as WarningIcon, f as ChevronDownIcon, r as ArrowLeftIcon } from "../../icons-cuEtsgj9.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { t as capitalize } from "../../format-COCyV98Z.js";
|
|
5
5
|
import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
|
|
@@ -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 };
|
|
@@ -1,127 +1,97 @@
|
|
|
1
1
|
import { Button } from "../foundations/Button.js";
|
|
2
|
-
import { Field } from "../foundations/Field.js";
|
|
3
|
-
import { Form } from "../foundations/Form.js";
|
|
4
2
|
import { Dialog } from "../foundations/Dialog.js";
|
|
5
3
|
import { a as formatErrorMessage } from "../../format-COCyV98Z.js";
|
|
6
|
-
import {
|
|
4
|
+
import { Field } from "../foundations/Field.js";
|
|
5
|
+
import { Form } from "../foundations/Form.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;
|