@ai-matrx/chat 0.6.6 → 0.7.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/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/dist/agents/components/agent-widgets/AgentChatHistorySidebar.js +16 -55
- package/dist/agents/components/chat/chat-door.d.ts +67 -0
- package/dist/agents/components/chat/chat-door.js +100 -0
- package/dist/agents/components/conversation-history/AgentConversationList.d.ts +83 -0
- package/dist/agents/components/conversation-history/AgentConversationList.js +252 -0
- package/dist/agents/components/conversation-history/ConversationArchiveSection.d.ts +5 -1
- package/dist/agents/components/conversation-history/ConversationArchiveSection.js +22 -4
- package/dist/agents/components/conversation-history/ConversationHistorySidebar.js +20 -65
- package/dist/agents/components/inputs/input-components/TextareaInput.js +2 -0
- package/dist/agents/components/inputs/input-components/VariableInputComponent.js +7 -6
- package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.d.ts +3 -0
- package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.js +40 -0
- package/dist/agents/components/inputs/smart-input/ConversationContextRail.js +6 -29
- package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.d.ts +3 -0
- package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.js +35 -0
- package/dist/agents/components/inputs/smart-input/InboxQueueStrip.js +0 -8
- package/dist/agents/components/inputs/smart-input/RunToolPicker.js +15 -11
- package/dist/agents/components/inputs/smart-input/composer/ComposerPlusMenu.js +22 -0
- package/dist/agents/components/inputs/smart-input/rail-pill.d.ts +35 -0
- package/dist/agents/components/inputs/smart-input/rail-pill.js +30 -0
- package/dist/agents/components/inputs/variable-input-variations/AgentVariableForm.js +52 -48
- package/dist/agents/components/run-controls/panels/shared.d.ts +1 -1
- package/dist/agents/components/shared/AgentModeController.js +3 -2
- package/dist/agents/components/shell/AgentRunSidebarMenu.js +15 -54
- package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +1 -2
- package/dist/agents/engine.d.ts +15 -0
- package/dist/agents/engine.js +17 -0
- package/dist/agents/hooks/useModelControls.js +3 -175
- package/dist/agents/redux/agent-definition/selectors.d.ts +237 -237
- package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -50
- package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -147
- package/dist/agents/redux/conversation-history/thunks.js +6 -18
- package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +1 -73
- package/dist/agents/redux/conversation-list/conversation-list.selectors.js +2 -36
- package/dist/agents/redux/conversation-list/conversation-list.slice.d.ts +7 -22
- package/dist/agents/redux/conversation-list/conversation-list.slice.js +7 -62
- package/dist/agents/redux/conversation-list/conversation-list.thunks.d.ts +0 -25
- package/dist/agents/redux/conversation-list/conversation-list.thunks.js +2 -58
- package/dist/agents/redux/conversation-list/conversation-list.types.d.ts +0 -5
- package/dist/agents/redux/conversation-list/conversation-rows.d.ts +16 -0
- package/dist/agents/redux/conversation-list/conversation-rows.js +24 -0
- package/dist/agents/redux/conversation-list/conversation-trash.thunks.d.ts +1 -0
- package/dist/agents/redux/conversation-list/conversation-trash.thunks.js +13 -18
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -54
- package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -14
- package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -5
- package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -3
- package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -8
- package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -5
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -7
- package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -1
- package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -7
- package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -1
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -14
- package/dist/agents/redux/execution-system/thunks/create-instance.thunk.d.ts +10 -1
- package/dist/agents/redux/execution-system/thunks/create-instance.thunk.js +114 -265
- package/dist/agents/redux/execution-system/thunks/dispatch-matrx-extend-tool.thunk.js +18 -2
- package/dist/agents/redux/execution-system/thunks/dispatch-surface-client-tool.thunk.js +10 -28
- package/dist/agents/redux/execution-system/thunks/dispatch-surface-write.thunk.js +10 -25
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +20 -0
- package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +6 -1
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +58 -0
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +62 -0
- package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.d.ts +23 -0
- package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.js +37 -0
- package/dist/agents/redux/execution-system/thunks/resume-instance.thunk.js +10 -2
- package/dist/agents/redux/execution-system/utils/build-tool-injection.d.ts +7 -0
- package/dist/agents/redux/execution-system/utils/build-tool-injection.js +18 -6
- package/dist/agents/redux/execution-system/utils/host-turn.d.ts +45 -0
- package/dist/agents/redux/execution-system/utils/host-turn.js +119 -0
- package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -1
- package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.d.ts +50 -20
- package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.js +9 -101
- package/dist/agents/types/tool-injection.types.d.ts +18 -2
- package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -2
- package/dist/agents/ui-first-tools/redux/pending-asks.slice.d.ts +2 -1
- package/dist/agents/ui-first-tools/redux/resolve-asks-with-input.thunk.js +1 -1
- package/dist/agents/ui-first-tools/tools/ask-response.d.ts +29 -0
- package/dist/agents/ui-first-tools/tools/ask-response.js +15 -0
- package/dist/agents/ui-first-tools/tools/schemas.d.ts +3 -25
- package/dist/agents/ui-first-tools/tools/schemas.js +1 -12
- package/dist/agents/ui-first-tools/ui/ApprovalCard.js +1 -1
- package/dist/agents/ui-first-tools/ui/AskWizard.d.ts +1 -1
- package/dist/agents/ui-first-tools/ui/AskWizard.js +1 -1
- package/dist/cx-chat/_legacy-stubs.d.ts +5 -5
- package/dist/cx-chat/components/SsrSidebarChats.js +13 -15
- package/dist/cx-chat/components/messages/UserMessage.d.ts +2 -2
- package/dist/cx-chat/types/conversation.d.ts +6 -6
- package/dist/cx-chat/utils/buildContentBlocksForSave.d.ts +1 -1
- package/dist/cx-chat/utils/cx-content-converter.d.ts +1 -1
- package/dist/host/bare-host-chrome.js +9 -3
- package/dist/host/composer-extensions.d.ts +75 -0
- package/dist/host/composer-extensions.js +92 -0
- package/dist/host/configure.js +1 -0
- package/dist/host/contract.d.ts +105 -13
- package/dist/host/defaults/confirm.d.ts +15 -0
- package/dist/host/defaults/confirm.js +25 -0
- package/dist/host/defaults/files-ui.d.ts +85 -0
- package/dist/host/defaults/files-ui.js +158 -0
- package/dist/host/defaults/gates.d.ts +27 -0
- package/dist/host/defaults/gates.js +72 -0
- package/dist/host/defaults/media-client.d.ts +15 -0
- package/dist/host/defaults/media-client.js +40 -0
- package/dist/host/defaults/voice.d.ts +81 -0
- package/dist/host/defaults/voice.js +239 -0
- package/dist/host/device-tool-handoff.d.ts +26 -0
- package/dist/host/device-tool-handoff.js +45 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +4 -1
- package/dist/host/microphone.d.ts +11 -0
- package/dist/host/microphone.js +17 -0
- package/dist/host/ui-slots.d.ts +29 -74
- package/dist/host/ui-slots.js +40 -42
- package/dist/store/create-chat-store.d.ts +2 -2
- package/dist/store/middlewares.d.ts +5 -5
- package/dist/store/slices.d.ts +1 -1
- package/dist/surfaces/redux/selectors.d.ts +2 -2
- package/dist/tool-call-visualization/components/ToolCallVisualization.js +3 -2
- package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.d.ts +15 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.js +36 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.d.ts +40 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +296 -0
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.d.ts +23 -0
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +62 -0
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.d.ts +23 -0
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +147 -0
- package/dist/tool-call-visualization/configured-rows/field-components.d.ts +15 -0
- package/dist/tool-call-visualization/configured-rows/field-components.js +244 -0
- package/dist/tool-call-visualization/configured-rows/helpers.d.ts +39 -0
- package/dist/tool-call-visualization/configured-rows/helpers.js +110 -0
- package/dist/tool-call-visualization/configured-rows/register.d.ts +25 -0
- package/dist/tool-call-visualization/configured-rows/register.js +51 -0
- package/dist/tool-call-visualization/configured-rows/registries.d.ts +27 -0
- package/dist/tool-call-visualization/configured-rows/registries.js +14 -0
- package/dist/tool-call-visualization/configured-rows/to-row-entry.d.ts +8 -0
- package/dist/tool-call-visualization/configured-rows/to-row-entry.js +38 -0
- package/dist/tool-call-visualization/configured-rows/transforms.d.ts +14 -0
- package/dist/tool-call-visualization/configured-rows/transforms.js +30 -0
- package/dist/tool-call-visualization/configured-rows/types.d.ts +140 -0
- package/dist/tool-call-visualization/redux/selectors.d.ts +1 -1
- package/dist/tool-call-visualization/registry/registry.d.ts +1 -1
- package/dist/tool-call-visualization/registry/registry.js +8 -1
- package/dist/tool-call-visualization/types.d.ts +1 -1
- package/dist/ui/chat-protocol-types.d.ts +0 -1
- package/dist/ui/ownership.d.ts +25 -0
- package/dist/ui/ownership.js +18 -0
- package/dist/voice-agent/audio/audioCapture.js +11 -6
- package/dist/window-panels/windows/agents/AgentRunHistoryWindow.d.ts +1 -2
- package/dist/window-panels/windows/agents/AgentRunHistoryWindow.js +21 -181
- package/dist/window-panels/windows/agents/AgentRunWindow.js +26 -13
- package/package.json +4627 -125
- package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.d.ts +0 -7
- package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.js +0 -33
- package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.d.ts +0 -6
- package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.js +0 -21
- package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.d.ts +0 -6
- package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.js +0 -11
- package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.d.ts +0 -12
- package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.js +0 -7
- package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.d.ts +0 -4
- package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.js +0 -81
- package/dist/agents/components/run/run-sidebar/SidebarHeader.d.ts +0 -21
- package/dist/agents/components/run/run-sidebar/SidebarHeader.js +0 -50
- package/dist/agents/components/run-controls/AdvancedRunSettings/index.d.ts +0 -6
- package/dist/agents/components/run-controls/AdvancedRunSettings/index.js +0 -32
- package/dist/agents/components/run-controls/RunSettingsModal.d.ts +0 -5
- package/dist/agents/components/run-controls/RunSettingsModal.js +0 -22
- package/dist/agents/components/shell/AgentBuildSidebarExtras.d.ts +0 -6
- package/dist/agents/components/shell/AgentBuildSidebarExtras.js +0 -30
- package/dist/agents/constants/agent-system-competitors.d.ts +0 -9
- package/dist/agents/constants/agent-system-competitors.js +0 -125
- package/dist/agents/hooks/message-crud/useMessageActions.d.ts +0 -29
- package/dist/agents/hooks/message-crud/useMessageActions.js +0 -119
- package/dist/agents/hooks/useConversationPendingCalls.d.ts +0 -30
- package/dist/agents/hooks/useConversationPendingCalls.js +0 -42
- package/dist/agents/model-registry/model-classes.d.ts +0 -1
- package/dist/agents/model-registry/model-classes.js +0 -1
- package/dist/agents/redux/conversation-history/index.d.ts +0 -18
- package/dist/agents/redux/conversation-history/index.js +0 -4
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.d.ts +0 -38
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.js +0 -42
- package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.d.ts +0 -58
- package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.js +0 -50
- package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.d.ts +0 -76
- package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.js +0 -101
- package/dist/agents/redux/execution-system/thunks/attach-workflow-run.d.ts +0 -38
- package/dist/agents/redux/execution-system/thunks/attach-workflow-run.js +0 -25
- package/dist/agents/redux/execution-system/utils/source-slice-helpers.d.ts +0 -45
- package/dist/agents/redux/execution-system/utils/source-slice-helpers.js +0 -50
- package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.d.ts +0 -25
- package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.js +0 -15
- package/dist/agents/services/agentService.d.ts +0 -12
- package/dist/agents/services/agentService.js +0 -92
- package/dist/agents/utils/escape-code-fences.d.ts +0 -15
- package/dist/agents/utils/escape-code-fences.js +0 -9
- package/dist/agents/utils/normalize-managed-options.d.ts +0 -30
- package/dist/agents/utils/normalize-managed-options.js +0 -29
- package/dist/agents/utils/processedDocumentContext.d.ts +0 -51
- package/dist/agents/utils/processedDocumentContext.js +0 -51
- package/dist/agents/utils/variable-validation.d.ts +0 -28
- package/dist/agents/utils/variable-validation.js +0 -54
- package/dist/cx-chat/components/ChatConversationSkeleton.d.ts +0 -9
- package/dist/cx-chat/components/ChatConversationSkeleton.js +0 -45
- package/dist/cx-chat/components/ChatPanelBackButton.d.ts +0 -1
- package/dist/cx-chat/components/ChatPanelBackButton.js +0 -26
- package/dist/cx-chat/components/messages/MessageErrorBoundary.d.ts +0 -20
- package/dist/cx-chat/components/messages/MessageErrorBoundary.js +0 -40
- package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.js +0 -160
- package/dist/cx-chat/components/variable-inputs/NumberInput.d.ts +0 -15
- package/dist/cx-chat/components/variable-inputs/NumberInput.js +0 -79
- package/dist/cx-chat/components/variable-inputs/RadioGroupInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/RadioGroupInput.js +0 -125
- package/dist/cx-chat/components/variable-inputs/SelectInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/SelectInput.js +0 -92
- package/dist/cx-chat/components/variable-inputs/TextareaInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/TextareaInput.js +0 -46
- package/dist/cx-chat/components/variable-inputs/ToggleInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/ToggleInput.js +0 -46
- package/dist/cx-chat/hooks/useChatPersistence.d.ts +0 -28
- package/dist/cx-chat/hooks/useChatPersistence.js +0 -180
- package/dist/cx-chat/hooks/useInstanceBootstrap.d.ts +0 -1
- package/dist/cx-chat/hooks/useInstanceBootstrap.js +0 -115
- package/dist/cx-chat/types/content.d.ts +0 -184
- package/dist/cx-chat/types/content.js +0 -91
- package/dist/cx-chat/types/cx-tables.d.ts +0 -176
- package/dist/cx-chat/utils/settings-diff.d.ts +0 -13
- package/dist/cx-chat/utils/settings-diff.js +0 -25
- package/dist/public-chat/components/AgentSelector.d.ts +0 -22
- package/dist/public-chat/components/AgentSelector.js +0 -80
- package/dist/public-chat/components/GuidedVariableInputs.d.ts +0 -25
- package/dist/public-chat/components/GuidedVariableInputs.js +0 -623
- package/dist/public-chat/components/PublicVariableInputs.d.ts +0 -29
- package/dist/public-chat/components/PublicVariableInputs.js +0 -172
- package/dist/public-chat/types/content.d.ts +0 -184
- package/dist/public-chat/types/content.js +0 -91
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.d.ts +0 -15
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.js +0 -31
- package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.d.ts +0 -24
- package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.js +0 -26
- package/dist/ui/AudioOutputBlockSkeleton.d.ts +0 -17
- package/dist/ui/AudioOutputBlockSkeleton.js +0 -78
- package/dist/ui/lazy/PublicChatVariableInputs.d.ts +0 -2
- package/dist/ui/lazy/PublicChatVariableInputs.js +0 -16
- package/dist/utils/xml/readXmlTag.d.ts +0 -12
- package/dist/utils/xml/readXmlTag.js +0 -66
- /package/dist/{cx-chat/types/cx-tables.js → tool-call-visualization/configured-rows/types.js} +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { TriangleAlert } from "lucide-react";
|
|
5
|
-
import { captureReactRenderError } from "../../../host/diagnostics.js";
|
|
6
|
-
import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
|
|
7
|
-
class MessageErrorBoundary extends React.Component {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
this.state = { hasError: false };
|
|
11
|
-
}
|
|
12
|
-
static getDerivedStateFromError() {
|
|
13
|
-
return { hasError: true };
|
|
14
|
-
}
|
|
15
|
-
componentDidCatch(error, info) {
|
|
16
|
-
console.error("[MessageErrorBoundary] Render error in message", this.props.messageId, error, info);
|
|
17
|
-
captureReactRenderError(error, {
|
|
18
|
-
boundary: "MessageErrorBoundary",
|
|
19
|
-
componentStack: info.componentStack ?? null,
|
|
20
|
-
relation: this.props.messageId
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
if (this.state.hasError) {
|
|
25
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 rounded-lg bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800", children: [
|
|
26
|
-
/* @__PURE__ */ jsx(TriangleAlert, { className: "h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5" }),
|
|
27
|
-
/* @__PURE__ */ jsxs("p", { className: "text-xs text-amber-700 dark:text-amber-300", children: [
|
|
28
|
-
"This message could not be displayed. The data may be in an unexpected format.",
|
|
29
|
-
/* @__PURE__ */ jsx(ErrorAlchemyMenu, {})
|
|
30
|
-
] })
|
|
31
|
-
] });
|
|
32
|
-
}
|
|
33
|
-
return this.props.children;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
var MessageErrorBoundary_default = MessageErrorBoundary;
|
|
37
|
-
export {
|
|
38
|
-
MessageErrorBoundary,
|
|
39
|
-
MessageErrorBoundary_default as default
|
|
40
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface CheckboxGroupInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
options: string[];
|
|
6
|
-
variableName: string;
|
|
7
|
-
allowOther?: boolean;
|
|
8
|
-
compact?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Checkbox Group Input - Multi-select that returns selected options as newline-separated text
|
|
12
|
-
*/
|
|
13
|
-
export declare function CheckboxGroupInput({ value, onChange, options, variableName, allowOther, compact }: CheckboxGroupInputProps): React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Label } from "@ai-matrx/design-system";
|
|
4
|
-
import { Checkbox } from "../../../ui/checkbox.js";
|
|
5
|
-
import { Textarea } from "@ai-matrx/design-system";
|
|
6
|
-
const EMPTY_VALUE_PLACEHOLDER = "(empty)";
|
|
7
|
-
const isEmptyOrWhitespace = (value) => {
|
|
8
|
-
return !value || value.trim() === "";
|
|
9
|
-
};
|
|
10
|
-
const toDisplayValue = (value) => {
|
|
11
|
-
return isEmptyOrWhitespace(value) ? EMPTY_VALUE_PLACEHOLDER : value;
|
|
12
|
-
};
|
|
13
|
-
const fromDisplayValue = (displayValue) => {
|
|
14
|
-
return displayValue === EMPTY_VALUE_PLACEHOLDER ? "" : displayValue;
|
|
15
|
-
};
|
|
16
|
-
function CheckboxGroupInput({
|
|
17
|
-
value,
|
|
18
|
-
onChange,
|
|
19
|
-
options,
|
|
20
|
-
variableName,
|
|
21
|
-
allowOther = false,
|
|
22
|
-
compact = false
|
|
23
|
-
}) {
|
|
24
|
-
const selectedItems = value ? value.split("\n").filter(Boolean) : [];
|
|
25
|
-
const otherItem = selectedItems.find((item) => item.startsWith("Other: "));
|
|
26
|
-
const otherText = otherItem ? otherItem.substring(7) : "";
|
|
27
|
-
const isOtherChecked = !!otherItem;
|
|
28
|
-
const regularSelectedItems = selectedItems.filter((item) => !item.startsWith("Other: "));
|
|
29
|
-
const displayOptions = options.map(toDisplayValue);
|
|
30
|
-
const hasNonOptionValues = regularSelectedItems.some((item) => {
|
|
31
|
-
const displayItem = toDisplayValue(item);
|
|
32
|
-
return !displayOptions.includes(displayItem) && !options.includes(item);
|
|
33
|
-
});
|
|
34
|
-
const [customText, setCustomText] = useState(otherText);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (otherItem) {
|
|
37
|
-
setCustomText(otherItem.substring(7));
|
|
38
|
-
} else {
|
|
39
|
-
setCustomText("");
|
|
40
|
-
}
|
|
41
|
-
}, [otherItem]);
|
|
42
|
-
const handleToggle = (displayOption, checked) => {
|
|
43
|
-
const actualOption = fromDisplayValue(displayOption);
|
|
44
|
-
let newSelected;
|
|
45
|
-
if (checked) {
|
|
46
|
-
newSelected = [...selectedItems.filter((item) => item !== actualOption && !item.startsWith("Other: ")), actualOption];
|
|
47
|
-
if (isOtherChecked) {
|
|
48
|
-
newSelected.push(`Other: ${customText}`);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
newSelected = selectedItems.filter((item) => item !== actualOption);
|
|
52
|
-
}
|
|
53
|
-
onChange(newSelected.join("\n"));
|
|
54
|
-
};
|
|
55
|
-
const handleOtherToggle = (checked) => {
|
|
56
|
-
let newSelected;
|
|
57
|
-
if (checked) {
|
|
58
|
-
newSelected = [...regularSelectedItems, `Other: ${customText}`];
|
|
59
|
-
} else {
|
|
60
|
-
newSelected = regularSelectedItems;
|
|
61
|
-
}
|
|
62
|
-
onChange(newSelected.join("\n"));
|
|
63
|
-
};
|
|
64
|
-
const handleCustomTextChange = (text) => {
|
|
65
|
-
setCustomText(text);
|
|
66
|
-
const newSelected = [...regularSelectedItems, `Other: ${text}`];
|
|
67
|
-
onChange(newSelected.join("\n"));
|
|
68
|
-
};
|
|
69
|
-
return /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-4", children: [
|
|
70
|
-
value && hasNonOptionValues && /* @__PURE__ */ jsxs("div", { className: compact ? "p-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded" : "p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg", children: [
|
|
71
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] font-medium text-amber-800 dark:text-amber-300 mb-0.5" : "text-xs font-medium text-amber-800 dark:text-amber-300 mb-1", children: "Current values:" }),
|
|
72
|
-
/* @__PURE__ */ jsx("div", { className: compact ? "text-xs text-amber-900 dark:text-amber-200 space-y-0.5" : "text-sm text-amber-900 dark:text-amber-200 space-y-0.5", children: regularSelectedItems.map((item, idx) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
73
|
-
!options.includes(item) && /* @__PURE__ */ jsx("span", { className: compact ? "text-[11px] bg-amber-200 dark:bg-amber-800 px-1 rounded" : "text-xs bg-amber-200 dark:bg-amber-800 px-1 rounded", children: "Custom" }),
|
|
74
|
-
/* @__PURE__ */ jsx("span", { children: item })
|
|
75
|
-
] }, idx)) }),
|
|
76
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] text-amber-700 dark:text-amber-400 mt-0.5" : "text-xs text-amber-700 dark:text-amber-400 mt-1", children: "Select options below to replace" })
|
|
77
|
-
] }),
|
|
78
|
-
/* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-2", children: [
|
|
79
|
-
options.map((option, index) => {
|
|
80
|
-
const displayOption = toDisplayValue(option);
|
|
81
|
-
const actualOption = option;
|
|
82
|
-
const isChecked = regularSelectedItems.includes(actualOption);
|
|
83
|
-
const itemKey = isEmptyOrWhitespace(option) ? `empty-${index}` : option;
|
|
84
|
-
const itemId = `${variableName}-${displayOption}-${index}`;
|
|
85
|
-
return /* @__PURE__ */ jsxs(
|
|
86
|
-
"div",
|
|
87
|
-
{
|
|
88
|
-
className: compact ? "flex items-center space-x-2 p-1 bg-background rounded border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer" : "flex items-center space-x-3 p-3 bg-background rounded-lg border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer",
|
|
89
|
-
onClick: () => handleToggle(displayOption, !isChecked),
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ jsx(
|
|
92
|
-
Checkbox,
|
|
93
|
-
{
|
|
94
|
-
checked: isChecked,
|
|
95
|
-
onCheckedChange: (checked) => handleToggle(displayOption, checked),
|
|
96
|
-
id: itemId
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
Label,
|
|
101
|
-
{
|
|
102
|
-
htmlFor: itemId,
|
|
103
|
-
className: compact ? "flex-1 text-xs cursor-pointer" : "flex-1 text-sm cursor-pointer",
|
|
104
|
-
children: displayOption
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
itemKey
|
|
110
|
-
);
|
|
111
|
-
}),
|
|
112
|
-
allowOther && /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-2", children: [
|
|
113
|
-
/* @__PURE__ */ jsxs(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
className: compact ? "flex items-center space-x-2 p-1 bg-background rounded border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer" : "flex items-center space-x-3 p-3 bg-background rounded-lg border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer",
|
|
117
|
-
onClick: () => handleOtherToggle(!isOtherChecked),
|
|
118
|
-
children: [
|
|
119
|
-
/* @__PURE__ */ jsx(
|
|
120
|
-
Checkbox,
|
|
121
|
-
{
|
|
122
|
-
checked: isOtherChecked,
|
|
123
|
-
onCheckedChange: (checked) => handleOtherToggle(checked),
|
|
124
|
-
id: `${variableName}-other`
|
|
125
|
-
}
|
|
126
|
-
),
|
|
127
|
-
/* @__PURE__ */ jsx(
|
|
128
|
-
Label,
|
|
129
|
-
{
|
|
130
|
-
htmlFor: `${variableName}-other`,
|
|
131
|
-
className: compact ? "flex-1 text-xs cursor-pointer" : "flex-1 text-sm cursor-pointer",
|
|
132
|
-
children: "Other"
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
isOtherChecked && /* @__PURE__ */ jsx("div", { className: compact ? "ml-6 pl-2" : "ml-9 pl-3", children: /* @__PURE__ */ jsx(
|
|
139
|
-
Textarea,
|
|
140
|
-
{
|
|
141
|
-
value: customText,
|
|
142
|
-
onChange: (e) => handleCustomTextChange(e.target.value),
|
|
143
|
-
placeholder: "Enter custom value...",
|
|
144
|
-
className: compact ? "min-h-[60px] text-xs" : "min-h-[80px] text-sm",
|
|
145
|
-
autoFocus: true
|
|
146
|
-
}
|
|
147
|
-
) })
|
|
148
|
-
] })
|
|
149
|
-
] }),
|
|
150
|
-
!compact && selectedItems.length > 0 && /* @__PURE__ */ jsx("div", { className: "pt-2 border-t border-border", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
151
|
-
"Selected: ",
|
|
152
|
-
selectedItems.length,
|
|
153
|
-
" item",
|
|
154
|
-
selectedItems.length !== 1 ? "s" : ""
|
|
155
|
-
] }) })
|
|
156
|
-
] });
|
|
157
|
-
}
|
|
158
|
-
export {
|
|
159
|
-
CheckboxGroupInput
|
|
160
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface NumberInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
min?: number;
|
|
6
|
-
max?: number;
|
|
7
|
-
step?: number;
|
|
8
|
-
variableName: string;
|
|
9
|
-
compact?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Number Input - Returns number as text with optional min/max/step controls
|
|
13
|
-
*/
|
|
14
|
-
export declare function NumberInput({ value, onChange, min, max, step, variableName, compact }: NumberInputProps): React.JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Input } from "@ai-matrx/design-system/controls";
|
|
3
|
-
import { Button } from "@ai-matrx/design-system/controls";
|
|
4
|
-
import { Minus, Plus } from "lucide-react";
|
|
5
|
-
function NumberInput({
|
|
6
|
-
value,
|
|
7
|
-
onChange,
|
|
8
|
-
min,
|
|
9
|
-
max,
|
|
10
|
-
step = 1,
|
|
11
|
-
variableName,
|
|
12
|
-
compact = false
|
|
13
|
-
}) {
|
|
14
|
-
const numValue = parseFloat(value) || 0;
|
|
15
|
-
const isValidNumber = !isNaN(parseFloat(value));
|
|
16
|
-
const handleIncrement = () => {
|
|
17
|
-
const newValue = numValue + step;
|
|
18
|
-
if (max === void 0 || newValue <= max) {
|
|
19
|
-
onChange(newValue.toString());
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const handleDecrement = () => {
|
|
23
|
-
const newValue = numValue - step;
|
|
24
|
-
if (min === void 0 || newValue >= min) {
|
|
25
|
-
onChange(newValue.toString());
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const handleInputChange = (e) => {
|
|
29
|
-
const newValue = e.target.value;
|
|
30
|
-
if (newValue === "" || newValue === "-" || !isNaN(parseFloat(newValue))) {
|
|
31
|
-
onChange(newValue);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const canDecrement = min === void 0 || numValue > min;
|
|
35
|
-
const canIncrement = max === void 0 || numValue < max;
|
|
36
|
-
return /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-4", children: [
|
|
37
|
-
value && !isValidNumber && /* @__PURE__ */ jsxs("div", { className: compact ? "p-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded" : "p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg", children: [
|
|
38
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] font-medium text-amber-800 dark:text-amber-300 mb-0.5" : "text-xs font-medium text-amber-800 dark:text-amber-300 mb-1", children: "Current value:" }),
|
|
39
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-xs text-amber-900 dark:text-amber-200" : "text-sm text-amber-900 dark:text-amber-200", children: value }),
|
|
40
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] text-amber-700 dark:text-amber-400 mt-0.5" : "text-xs text-amber-700 dark:text-amber-400 mt-1", children: "Enter a valid number below to replace" })
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ jsxs("div", { className: compact ? "flex items-center gap-1" : "flex items-center gap-2", children: [
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
Button,
|
|
45
|
-
{
|
|
46
|
-
type: "button",
|
|
47
|
-
variant: "outline",
|
|
48
|
-
onClick: handleDecrement,
|
|
49
|
-
disabled: !canDecrement,
|
|
50
|
-
children: /* @__PURE__ */ jsx(Minus, { className: compact ? "w-3 h-3" : "w-4 h-4" })
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
54
|
-
Input,
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
value,
|
|
58
|
-
onChange: handleInputChange,
|
|
59
|
-
numeric: true,
|
|
60
|
-
align: "center",
|
|
61
|
-
placeholder: "0"
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
/* @__PURE__ */ jsx(
|
|
65
|
-
Button,
|
|
66
|
-
{
|
|
67
|
-
type: "button",
|
|
68
|
-
variant: "outline",
|
|
69
|
-
onClick: handleIncrement,
|
|
70
|
-
disabled: !canIncrement,
|
|
71
|
-
children: /* @__PURE__ */ jsx(Plus, { className: compact ? "w-3 h-3" : "w-4 h-4" })
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] })
|
|
75
|
-
] });
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
NumberInput
|
|
79
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface RadioGroupInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
options: string[];
|
|
6
|
-
variableName: string;
|
|
7
|
-
allowOther?: boolean;
|
|
8
|
-
compact?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Radio Group Input - Single select that returns selected option as text
|
|
12
|
-
*/
|
|
13
|
-
export declare function RadioGroupInput({ value, onChange, options, variableName, allowOther, compact }: RadioGroupInputProps): React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Label } from "@ai-matrx/design-system";
|
|
4
|
-
import { RadioGroup, RadioGroupItem } from "@ai-matrx/design-system";
|
|
5
|
-
import { Textarea } from "@ai-matrx/design-system";
|
|
6
|
-
const EMPTY_VALUE_PLACEHOLDER = "(empty)";
|
|
7
|
-
const isEmptyOrWhitespace = (value) => {
|
|
8
|
-
return !value || value.trim() === "";
|
|
9
|
-
};
|
|
10
|
-
const toDisplayValue = (value) => {
|
|
11
|
-
return isEmptyOrWhitespace(value) ? EMPTY_VALUE_PLACEHOLDER : value;
|
|
12
|
-
};
|
|
13
|
-
const fromDisplayValue = (displayValue) => {
|
|
14
|
-
return displayValue === EMPTY_VALUE_PLACEHOLDER ? "" : displayValue;
|
|
15
|
-
};
|
|
16
|
-
function RadioGroupInput({
|
|
17
|
-
value,
|
|
18
|
-
onChange,
|
|
19
|
-
options,
|
|
20
|
-
variableName,
|
|
21
|
-
allowOther = false,
|
|
22
|
-
compact = false
|
|
23
|
-
}) {
|
|
24
|
-
const displayOptions = options.map(toDisplayValue);
|
|
25
|
-
const displayValue = toDisplayValue(value);
|
|
26
|
-
const isValueInOptions = displayOptions.includes(displayValue);
|
|
27
|
-
const isOtherValue = value.startsWith("Other: ");
|
|
28
|
-
const otherText = isOtherValue ? value.substring(7) : "";
|
|
29
|
-
const [selectedOption, setSelectedOption] = useState(() => {
|
|
30
|
-
if (isValueInOptions) return displayValue;
|
|
31
|
-
if (isOtherValue) return "Other";
|
|
32
|
-
return "";
|
|
33
|
-
});
|
|
34
|
-
const [customText, setCustomText] = useState(otherText);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const newDisplayValue = toDisplayValue(value);
|
|
37
|
-
if (isValueInOptions) {
|
|
38
|
-
setSelectedOption(newDisplayValue);
|
|
39
|
-
setCustomText("");
|
|
40
|
-
} else if (isOtherValue) {
|
|
41
|
-
setSelectedOption("Other");
|
|
42
|
-
setCustomText(value.substring(7));
|
|
43
|
-
}
|
|
44
|
-
}, [value, isValueInOptions, isOtherValue]);
|
|
45
|
-
const handleOptionChange = (newDisplayValue) => {
|
|
46
|
-
setSelectedOption(newDisplayValue);
|
|
47
|
-
if (newDisplayValue === "Other") {
|
|
48
|
-
onChange(customText ? `Other: ${customText}` : "Other: ");
|
|
49
|
-
} else {
|
|
50
|
-
const actualValue = fromDisplayValue(newDisplayValue);
|
|
51
|
-
onChange(actualValue);
|
|
52
|
-
setCustomText("");
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const handleCustomTextChange = (text) => {
|
|
56
|
-
setCustomText(text);
|
|
57
|
-
onChange(`Other: ${text}`);
|
|
58
|
-
};
|
|
59
|
-
const showNonMatchingValue = value && !isValueInOptions && !isOtherValue;
|
|
60
|
-
return /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-0" : "space-y-4", children: [
|
|
61
|
-
showNonMatchingValue && /* @__PURE__ */ jsxs("div", { className: compact ? "p-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded" : "p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg", children: [
|
|
62
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] font-medium text-amber-800 dark:text-amber-300 mb-0.5" : "text-xs font-medium text-amber-800 dark:text-amber-300 mb-1", children: "Current value:" }),
|
|
63
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-xs text-amber-900 dark:text-amber-200" : "text-sm text-amber-900 dark:text-amber-200", children: value || "(empty)" }),
|
|
64
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] text-amber-700 dark:text-amber-400 mt-0.5" : "text-xs text-amber-700 dark:text-amber-400 mt-1", children: "Select an option below to replace" })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ jsx(RadioGroup, { value: selectedOption, onValueChange: handleOptionChange, children: /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-0" : "space-y-1", children: [
|
|
67
|
-
options.map((option, index) => {
|
|
68
|
-
const displayOption = toDisplayValue(option);
|
|
69
|
-
const itemKey = isEmptyOrWhitespace(option) ? `empty-${index}` : option;
|
|
70
|
-
return /* @__PURE__ */ jsxs(
|
|
71
|
-
"div",
|
|
72
|
-
{
|
|
73
|
-
className: compact ? "flex items-center space-x-2 p-1 bg-background rounded border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer" : "flex items-center space-x-3 p-3 bg-background rounded-lg border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer",
|
|
74
|
-
onClick: () => handleOptionChange(displayOption),
|
|
75
|
-
children: [
|
|
76
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: displayOption, id: `${variableName}-${displayOption}-${index}` }),
|
|
77
|
-
/* @__PURE__ */ jsx(
|
|
78
|
-
Label,
|
|
79
|
-
{
|
|
80
|
-
htmlFor: `${variableName}-${displayOption}-${index}`,
|
|
81
|
-
className: compact ? "flex-1 text-xs cursor-pointer" : "flex-1 text-sm cursor-pointer",
|
|
82
|
-
children: displayOption
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
itemKey
|
|
88
|
-
);
|
|
89
|
-
}),
|
|
90
|
-
allowOther && /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-2", children: [
|
|
91
|
-
/* @__PURE__ */ jsxs(
|
|
92
|
-
"div",
|
|
93
|
-
{
|
|
94
|
-
className: compact ? "flex items-center space-x-2 p-1 bg-background rounded border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer" : "flex items-center space-x-3 p-3 bg-background rounded-lg border-border hover:border-gray-300 dark:hover:border-gray-600 transition-colors cursor-pointer",
|
|
95
|
-
onClick: () => handleOptionChange("Other"),
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: "Other", id: `${variableName}-other` }),
|
|
98
|
-
/* @__PURE__ */ jsx(
|
|
99
|
-
Label,
|
|
100
|
-
{
|
|
101
|
-
htmlFor: `${variableName}-other`,
|
|
102
|
-
className: compact ? "flex-1 text-xs cursor-pointer" : "flex-1 text-sm cursor-pointer",
|
|
103
|
-
children: "Other"
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
selectedOption === "Other" && /* @__PURE__ */ jsx("div", { className: compact ? "ml-6 pl-2" : "ml-9 pl-3", children: /* @__PURE__ */ jsx(
|
|
110
|
-
Textarea,
|
|
111
|
-
{
|
|
112
|
-
value: customText,
|
|
113
|
-
onChange: (e) => handleCustomTextChange(e.target.value),
|
|
114
|
-
placeholder: "Enter custom value...",
|
|
115
|
-
className: compact ? "min-h-[60px] text-xs" : "min-h-[80px] text-sm",
|
|
116
|
-
autoFocus: true
|
|
117
|
-
}
|
|
118
|
-
) })
|
|
119
|
-
] })
|
|
120
|
-
] }) })
|
|
121
|
-
] });
|
|
122
|
-
}
|
|
123
|
-
export {
|
|
124
|
-
RadioGroupInput
|
|
125
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface SelectInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
options: string[];
|
|
6
|
-
variableName: string;
|
|
7
|
-
allowOther?: boolean;
|
|
8
|
-
compact?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Select Input - Dropdown single select that returns selected option as text
|
|
12
|
-
*/
|
|
13
|
-
export declare function SelectInput({ value, onChange, options, variableName, allowOther, compact }: SelectInputProps): React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ai-matrx/design-system";
|
|
4
|
-
import { Textarea } from "@ai-matrx/design-system";
|
|
5
|
-
const EMPTY_VALUE_PLACEHOLDER = "(empty)";
|
|
6
|
-
const isEmptyOrWhitespace = (value) => {
|
|
7
|
-
return !value || value.trim() === "";
|
|
8
|
-
};
|
|
9
|
-
const toDisplayValue = (value) => {
|
|
10
|
-
return isEmptyOrWhitespace(value) ? EMPTY_VALUE_PLACEHOLDER : value;
|
|
11
|
-
};
|
|
12
|
-
const fromDisplayValue = (displayValue) => {
|
|
13
|
-
return displayValue === EMPTY_VALUE_PLACEHOLDER ? "" : displayValue;
|
|
14
|
-
};
|
|
15
|
-
function SelectInput({
|
|
16
|
-
value,
|
|
17
|
-
onChange,
|
|
18
|
-
options,
|
|
19
|
-
variableName,
|
|
20
|
-
allowOther = false,
|
|
21
|
-
compact = false
|
|
22
|
-
}) {
|
|
23
|
-
const displayOptions = options.map(toDisplayValue);
|
|
24
|
-
const displayValue = toDisplayValue(value);
|
|
25
|
-
const isValueInOptions = displayOptions.includes(displayValue);
|
|
26
|
-
const isOtherValue = value.startsWith("Other: ");
|
|
27
|
-
const otherText = isOtherValue ? value.substring(7) : "";
|
|
28
|
-
const [selectedOption, setSelectedOption] = useState(() => {
|
|
29
|
-
if (isValueInOptions) return displayValue;
|
|
30
|
-
if (isOtherValue) return "Other";
|
|
31
|
-
return displayValue;
|
|
32
|
-
});
|
|
33
|
-
const [customText, setCustomText] = useState(otherText);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const newDisplayValue = toDisplayValue(value);
|
|
36
|
-
if (isValueInOptions) {
|
|
37
|
-
setSelectedOption(newDisplayValue);
|
|
38
|
-
setCustomText("");
|
|
39
|
-
} else if (isOtherValue) {
|
|
40
|
-
setSelectedOption("Other");
|
|
41
|
-
setCustomText(value.substring(7));
|
|
42
|
-
}
|
|
43
|
-
}, [value, isValueInOptions, isOtherValue]);
|
|
44
|
-
const handleSelectChange = (newDisplayValue) => {
|
|
45
|
-
setSelectedOption(newDisplayValue);
|
|
46
|
-
if (newDisplayValue === "Other") {
|
|
47
|
-
onChange(customText ? `Other: ${customText}` : "Other: ");
|
|
48
|
-
} else {
|
|
49
|
-
const actualValue = fromDisplayValue(newDisplayValue);
|
|
50
|
-
onChange(actualValue);
|
|
51
|
-
setCustomText("");
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const handleCustomTextChange = (text) => {
|
|
55
|
-
setCustomText(text);
|
|
56
|
-
onChange(`Other: ${text}`);
|
|
57
|
-
};
|
|
58
|
-
const showNonMatchingValue = value && !isValueInOptions && !isOtherValue;
|
|
59
|
-
return /* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-4", children: [
|
|
60
|
-
showNonMatchingValue && /* @__PURE__ */ jsxs("div", { className: compact ? "p-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded" : "p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg", children: [
|
|
61
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] font-medium text-amber-800 dark:text-amber-300 mb-0.5" : "text-xs font-medium text-amber-800 dark:text-amber-300 mb-1", children: "Current value:" }),
|
|
62
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-xs text-amber-900 dark:text-amber-200" : "text-sm text-amber-900 dark:text-amber-200", children: value || "(empty)" }),
|
|
63
|
-
/* @__PURE__ */ jsx("p", { className: compact ? "text-[11px] text-amber-700 dark:text-amber-400 mt-0.5" : "text-xs text-amber-700 dark:text-amber-400 mt-1", children: "Select an option below to replace" })
|
|
64
|
-
] }),
|
|
65
|
-
/* @__PURE__ */ jsxs("div", { className: compact ? "space-y-1" : "space-y-3", children: [
|
|
66
|
-
/* @__PURE__ */ jsxs(Select, { value: selectedOption, onValueChange: handleSelectChange, children: [
|
|
67
|
-
/* @__PURE__ */ jsx(SelectTrigger, { className: compact ? "w-full h-8 text-xs" : "w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Choose an option..." }) }),
|
|
68
|
-
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
69
|
-
options.map((option, index) => {
|
|
70
|
-
const displayOption = toDisplayValue(option);
|
|
71
|
-
const itemKey = isEmptyOrWhitespace(option) ? `empty-${index}` : option;
|
|
72
|
-
return /* @__PURE__ */ jsx(SelectItem, { value: displayOption, children: displayOption }, itemKey);
|
|
73
|
-
}),
|
|
74
|
-
allowOther && /* @__PURE__ */ jsx(SelectItem, { value: "Other", children: "Other" })
|
|
75
|
-
] })
|
|
76
|
-
] }),
|
|
77
|
-
selectedOption === "Other" && /* @__PURE__ */ jsx("div", { className: compact ? "pt-1" : "pt-2", children: /* @__PURE__ */ jsx(
|
|
78
|
-
Textarea,
|
|
79
|
-
{
|
|
80
|
-
value: customText,
|
|
81
|
-
onChange: (e) => handleCustomTextChange(e.target.value),
|
|
82
|
-
placeholder: "Enter custom value...",
|
|
83
|
-
className: compact ? "min-h-[60px] text-xs" : "min-h-[80px] text-sm",
|
|
84
|
-
autoFocus: true
|
|
85
|
-
}
|
|
86
|
-
) })
|
|
87
|
-
] })
|
|
88
|
-
] });
|
|
89
|
-
}
|
|
90
|
-
export {
|
|
91
|
-
SelectInput
|
|
92
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface TextareaInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
variableName: string;
|
|
6
|
-
onRequestClose?: () => void;
|
|
7
|
-
compact?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Textarea Input - Multi-line text input with voice input capability
|
|
11
|
-
* Protection against accidental transcription loss is built-in
|
|
12
|
-
*/
|
|
13
|
-
export declare function TextareaInput({ value, onChange, variableName, onRequestClose, compact }: TextareaInputProps): React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
3
|
-
import { VoiceTextarea } from "../../../host/ui-slots.js";
|
|
4
|
-
import { toast } from "../../../host/notify.js";
|
|
5
|
-
import { variableInputPlaceholder } from "../../../agents/components/inputs/input-components/variablePlaceholder.js";
|
|
6
|
-
function TextareaInput({
|
|
7
|
-
value,
|
|
8
|
-
onChange,
|
|
9
|
-
variableName,
|
|
10
|
-
onRequestClose,
|
|
11
|
-
compact = false
|
|
12
|
-
}) {
|
|
13
|
-
const hasSelectedRef = useRef(false);
|
|
14
|
-
const handleFocus = (e) => {
|
|
15
|
-
if (!hasSelectedRef.current && e.target.value) {
|
|
16
|
-
e.target.select();
|
|
17
|
-
hasSelectedRef.current = true;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
VoiceTextarea,
|
|
22
|
-
{
|
|
23
|
-
value,
|
|
24
|
-
onChange: (e) => onChange(e.target.value),
|
|
25
|
-
onFocus: handleFocus,
|
|
26
|
-
placeholder: variableInputPlaceholder(),
|
|
27
|
-
className: compact ? "min-h-[65px] text-xs" : "min-h-[200px] text-sm",
|
|
28
|
-
rows: compact ? 2 : void 0,
|
|
29
|
-
autoFocus: true,
|
|
30
|
-
appendTranscript: true,
|
|
31
|
-
onRequestClose,
|
|
32
|
-
protectTranscription: true,
|
|
33
|
-
onTranscriptionComplete: (text) => {
|
|
34
|
-
toast.success("Voice input added");
|
|
35
|
-
},
|
|
36
|
-
onTranscriptionError: (error) => {
|
|
37
|
-
toast.error("Voice input failed", {
|
|
38
|
-
description: error
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
TextareaInput
|
|
46
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface ToggleInputProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
offLabel?: string;
|
|
6
|
-
onLabel?: string;
|
|
7
|
-
variableName: string;
|
|
8
|
-
compact?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Toggle Input - Returns text value based on toggle state
|
|
12
|
-
*/
|
|
13
|
-
export declare function ToggleInput({ value, onChange, offLabel, onLabel, variableName, compact }: ToggleInputProps): React.JSX.Element;
|
|
14
|
-
export {};
|