@bikdotai/bik-component-library 0.0.841-beta.0 → 0.0.841
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/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +51 -39
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +22 -22
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
- package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +3 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +5 -3
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableShimmer.js +2 -0
- package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +1 -0
- package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
- package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/avatar/Avatar.styled.js +4 -12
- package/dist/cjs/components/avatar/Avatar.styled.js.map +1 -1
- package/dist/cjs/components/button/Button.styled.js +1 -0
- package/dist/cjs/components/button/Button.styled.js.map +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +97 -54
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/cjs/icons/Informational/Common UI/Shield.js +2 -0
- package/dist/cjs/icons/Informational/Common UI/Shield.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +106 -102
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -6
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +118 -106
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +11 -0
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -21
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +27 -26
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +24 -23
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +3 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.js +33 -24
- package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +23 -21
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +174 -144
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +2 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +111 -105
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +13 -4
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +161 -136
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
- package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js +6 -6
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +104 -103
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +101 -102
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +146 -144
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -79
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +35 -23
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.js +65 -65
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
- package/dist/esm/components/agent-listing/AgentTable.js +16 -15
- package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
- package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +12 -0
- package/dist/esm/components/agent-listing/AgentTableShimmer.js +20 -0
- package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +1 -0
- package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
- package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
- package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +3 -0
- package/dist/esm/components/avatar/Avatar.d.ts +1 -2
- package/dist/esm/components/avatar/Avatar.js +24 -34
- package/dist/esm/components/avatar/Avatar.js.map +1 -1
- package/dist/esm/components/avatar/Avatar.styled.d.ts +0 -1
- package/dist/esm/components/avatar/Avatar.styled.js +8 -17
- package/dist/esm/components/avatar/Avatar.styled.js.map +1 -1
- package/dist/esm/components/button/Button.styled.js +25 -19
- package/dist/esm/components/button/Button.styled.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +18 -13
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +173 -160
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.d.ts +20 -3
- package/dist/esm/editor/BikEditor.styles.js +102 -57
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +5 -8
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +87 -68
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/esm/icons/Informational/Common UI/Shield.d.ts +7 -0
- package/dist/esm/icons/Informational/Common UI/Shield.js +34 -0
- package/dist/esm/icons/Informational/Common UI/Shield.js.map +1 -0
- package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
- package/dist/esm/icons/index.d.ts +1 -1
- package/dist/esm/icons/index.js +156 -154
- package/dist/esm/icons/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,11 +13,11 @@ const it = ({
|
|
|
13
13
|
onChange: g,
|
|
14
14
|
maxLength: a,
|
|
15
15
|
placeholder: C,
|
|
16
|
-
minHeight:
|
|
16
|
+
minHeight: T = "200px",
|
|
17
17
|
resetKey: l,
|
|
18
18
|
mentionItems: n,
|
|
19
|
-
tools:
|
|
20
|
-
onMentionSelect:
|
|
19
|
+
tools: b,
|
|
20
|
+
onMentionSelect: x,
|
|
21
21
|
onFocus: E,
|
|
22
22
|
registerInsert: r,
|
|
23
23
|
onCreateSubAgent: k,
|
|
@@ -25,16 +25,16 @@ const it = ({
|
|
|
25
25
|
integrationStatus: O,
|
|
26
26
|
onConnectIntegration: R,
|
|
27
27
|
action: D,
|
|
28
|
-
...
|
|
28
|
+
...L
|
|
29
29
|
}) => {
|
|
30
|
-
const c = w(null), [
|
|
31
|
-
(t, o,
|
|
30
|
+
const c = w(null), [M, m] = F(e.length), s = N(
|
|
31
|
+
(t, o, A) => {
|
|
32
32
|
const f = c.current;
|
|
33
33
|
if (!f)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
35
|
+
const B = n.find(
|
|
36
36
|
(u) => String(u.id) === String(o) && u.meta?.kind === t
|
|
37
|
-
), j =
|
|
37
|
+
), j = A ?? B?.label ?? o;
|
|
38
38
|
f.insertInlineContent(
|
|
39
39
|
`${z(String(o), j, t)} `
|
|
40
40
|
);
|
|
@@ -43,34 +43,34 @@ const it = ({
|
|
|
43
43
|
);
|
|
44
44
|
p(() => {
|
|
45
45
|
if (r)
|
|
46
|
-
return r(
|
|
47
|
-
}, [r,
|
|
48
|
-
const
|
|
46
|
+
return r(s), () => r(null);
|
|
47
|
+
}, [r, s]);
|
|
48
|
+
const y = _(
|
|
49
49
|
() => Q(e, n),
|
|
50
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
51
|
[l]
|
|
52
52
|
);
|
|
53
53
|
return p(
|
|
54
|
-
() =>
|
|
54
|
+
() => m(e.length),
|
|
55
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
56
|
[l]
|
|
57
57
|
), /* @__PURE__ */ i(P, { children: [
|
|
58
58
|
/* @__PURE__ */ i(Y, { children: [
|
|
59
59
|
/* @__PURE__ */ d(G, { color: h.content.primary, children: S }),
|
|
60
60
|
/* @__PURE__ */ i(J, { color: h.content.secondary, children: [
|
|
61
|
-
|
|
61
|
+
M,
|
|
62
62
|
"/",
|
|
63
63
|
a
|
|
64
64
|
] })
|
|
65
65
|
] }),
|
|
66
|
-
/* @__PURE__ */ i($, { minHeight:
|
|
66
|
+
/* @__PURE__ */ i($, { minHeight: T, "data-test": L["data-test"], children: [
|
|
67
67
|
/* @__PURE__ */ d(
|
|
68
68
|
W,
|
|
69
69
|
{
|
|
70
70
|
ref: c,
|
|
71
|
-
initialContent:
|
|
71
|
+
initialContent: y,
|
|
72
72
|
placeholder: C,
|
|
73
|
-
|
|
73
|
+
characterLimit: a,
|
|
74
74
|
minHeight: "120px",
|
|
75
75
|
maxHeight: "320px",
|
|
76
76
|
style: { border: "none" },
|
|
@@ -91,13 +91,13 @@ const it = ({
|
|
|
91
91
|
),
|
|
92
92
|
onSelect: (t) => {
|
|
93
93
|
const o = t.meta?.kind;
|
|
94
|
-
o &&
|
|
94
|
+
o && x?.(o, String(t.id));
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
onChange: (t) => {
|
|
98
|
-
|
|
98
|
+
m(t.characterCount);
|
|
99
99
|
const o = c.current?.getJSON() ?? null;
|
|
100
|
-
g(U(o,
|
|
100
|
+
g(U(o, b));
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
l
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n} from '../utils/mentionSerialization';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind)} `,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => setCount(value.length),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\
|
|
1
|
+
{"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n} from '../utils/mentionSerialization';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind)} `,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => setCount(value.length),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t// Soft limit: blocks typing past the cap but lets a paste through\n\t\t\t\t\t// (overflow rendered grey) instead of rejecting the whole paste.\n\t\t\t\t\tcharacterLimit={maxLength}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"320px\"\n\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\teditorStyle={AGENT_EDITOR_STYLE}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tmentions={{\n\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\tonCreateSubAgent={onCreateSubAgent}\n\t\t\t\t\t\t\t\ttoolActions={toolActions}\n\t\t\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonSelect: (item) => {\n\t\t\t\t\t\t\tconst kind = (item.meta as unknown as MentionKindMeta | undefined)\n\t\t\t\t\t\t\t\t?.kind;\n\t\t\t\t\t\t\tif (kind) {\n\t\t\t\t\t\t\t\tonMentionSelect?.(kind, String(item.id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={(snapshot) => {\n\t\t\t\t\t\tsetCount(snapshot.characterCount);\n\t\t\t\t\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t\t\t\t\tonChange(editorDocToInstructions(doc, tools));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{action}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["MentionEditor","label","value","onChange","maxLength","placeholder","minHeight","resetKey","mentionItems","tools","onMentionSelect","onFocus","registerInsert","onCreateSubAgent","toolActions","integrationStatus","onConnectIntegration","action","rest","editorRef","useRef","count","setCount","useState","insert","useCallback","kind","id","overrideLabel","editor","item","m","finalLabel","buildMentionHtml","useEffect","initialHtml","useMemo","instructionsToEditorHtml","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","BikEditor","AGENT_EDITOR_STYLE","props","MentionPicker","snapshot","doc","editorDocToInstructions"],"mappings":"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"}
|
|
@@ -1,256 +1,286 @@
|
|
|
1
|
-
import { jsxs as m, jsx as u, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
1
|
+
import { jsxs as m, jsx as u, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import K from "../../../assets/icons/chevronRight.svg.js";
|
|
3
|
+
import H from "../../../assets/icons/searchIcon.svg.js";
|
|
4
|
+
import ee from "../../../icons/Arrows/Normal arrows/ArrowLeft.js";
|
|
5
|
+
import { useState as B, useMemo as x, useEffect as z, useRef as te } from "react";
|
|
6
6
|
import p from "styled-components";
|
|
7
|
-
import { TitleSmall as
|
|
8
|
-
import { COLORS as
|
|
9
|
-
import { CATEGORIES as
|
|
10
|
-
import { toolSourceLabel as
|
|
11
|
-
import { sourceIcon as
|
|
12
|
-
const
|
|
13
|
-
items:
|
|
14
|
-
onSelect:
|
|
15
|
-
registerKeyHandler:
|
|
16
|
-
onClose:
|
|
17
|
-
onCreateSubAgent:
|
|
18
|
-
initialSource:
|
|
19
|
-
toolActions:
|
|
20
|
-
integrationStatus:
|
|
21
|
-
onConnectIntegration:
|
|
7
|
+
import { TitleSmall as ne, BodySecondary as re } from "../../TypographyStyle.js";
|
|
8
|
+
import { COLORS as i } from "../../../constants/Theme.js";
|
|
9
|
+
import { CATEGORIES as oe, toolSourceRank as Q, CONFIG_TOOL_SOURCES as ie } from "../constants/tools.js";
|
|
10
|
+
import { toolSourceLabel as N } from "../utils/mentionSerialization.js";
|
|
11
|
+
import { sourceIcon as E, renderSourceIcon as V } from "../utils/sourceIcons.js";
|
|
12
|
+
const k = (l) => l.meta, I = (l) => k(l)?.plainLabel ?? l.label, le = "__bik_create_subagent__", Le = ({
|
|
13
|
+
items: l,
|
|
14
|
+
onSelect: S,
|
|
15
|
+
registerKeyHandler: C,
|
|
16
|
+
onClose: v,
|
|
17
|
+
onCreateSubAgent: y,
|
|
18
|
+
initialSource: U,
|
|
19
|
+
toolActions: b,
|
|
20
|
+
integrationStatus: j,
|
|
21
|
+
onConnectIntegration: F
|
|
22
22
|
}) => {
|
|
23
|
-
const [
|
|
24
|
-
() =>
|
|
25
|
-
[
|
|
26
|
-
),
|
|
27
|
-
() =>
|
|
28
|
-
[
|
|
29
|
-
),
|
|
23
|
+
const [W, _] = B(null), [c, O] = B(U ?? null), [A, h] = B(-1), [w, G] = B(""), g = x(
|
|
24
|
+
() => l.filter((e) => k(e)?.kind === "tool"),
|
|
25
|
+
[l]
|
|
26
|
+
), $ = x(
|
|
27
|
+
() => l.filter((e) => k(e)?.kind === "subagent"),
|
|
28
|
+
[l]
|
|
29
|
+
), T = x(() => {
|
|
30
30
|
const e = [];
|
|
31
|
-
return
|
|
32
|
-
const f =
|
|
31
|
+
return g.forEach((r) => {
|
|
32
|
+
const f = k(r)?.source ?? "other";
|
|
33
33
|
e.includes(f) || e.push(f);
|
|
34
34
|
}), e;
|
|
35
|
-
}, [
|
|
35
|
+
}, [g]), P = x(
|
|
36
36
|
() => new Map(
|
|
37
|
-
(
|
|
37
|
+
(b ?? []).map((e) => [e.source, e])
|
|
38
38
|
),
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
() =>
|
|
42
|
-
(e) => e.key === "tool" ?
|
|
39
|
+
[b]
|
|
40
|
+
), L = x(
|
|
41
|
+
() => oe.filter(
|
|
42
|
+
(e) => e.key === "tool" ? g.length > 0 || (b?.length ?? 0) > 0 : $.length > 0 || !!y
|
|
43
43
|
),
|
|
44
|
-
[
|
|
45
|
-
),
|
|
44
|
+
[g.length, $.length, y, b?.length]
|
|
45
|
+
), D = L.length === 1 ? L[0].key : null, s = W ?? D, d = s ? s === "subagent" ? (
|
|
46
46
|
// Always titled — with a back arrow only when the category chooser is above.
|
|
47
47
|
{
|
|
48
48
|
title: "Sub-agent",
|
|
49
|
-
onBack:
|
|
49
|
+
onBack: D ? void 0 : () => _(null)
|
|
50
50
|
}
|
|
51
51
|
) : c ? {
|
|
52
|
-
title:
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
title: N(c),
|
|
53
|
+
// Deep-linked to a source (opened from a right-panel source button):
|
|
54
|
+
// that source IS the root, so no back arrow. In the @-drill flow
|
|
55
|
+
// (no initialSource) back returns to the source chooser.
|
|
56
|
+
onBack: U ? void 0 : () => O(null),
|
|
57
|
+
icon: E(c)
|
|
55
58
|
} : (
|
|
56
59
|
// Always titled — matches the Sub-agent header; back arrow only when the
|
|
57
60
|
// category chooser is above (i.e. not the sole category).
|
|
58
61
|
{
|
|
59
62
|
title: "Tools",
|
|
60
|
-
onBack:
|
|
63
|
+
onBack: D ? void 0 : () => _(null)
|
|
61
64
|
}
|
|
62
|
-
) : null,
|
|
63
|
-
if (!
|
|
64
|
-
return
|
|
65
|
+
) : null, a = x(() => {
|
|
66
|
+
if (!s)
|
|
67
|
+
return L.map((n) => ({
|
|
65
68
|
id: n.key,
|
|
66
69
|
label: n.label,
|
|
67
70
|
drillsIn: !0,
|
|
68
71
|
onActivate: () => {
|
|
69
|
-
|
|
72
|
+
_(n.key), O(null);
|
|
70
73
|
}
|
|
71
74
|
}));
|
|
72
|
-
if (
|
|
73
|
-
const n =
|
|
74
|
-
id: String(
|
|
75
|
-
label:
|
|
75
|
+
if (s === "subagent") {
|
|
76
|
+
const n = w.trim().toLowerCase(), t = $.filter((o) => !n || I(o).toLowerCase().includes(n)).map((o) => ({
|
|
77
|
+
id: String(o.id),
|
|
78
|
+
label: I(o),
|
|
76
79
|
drillsIn: !1,
|
|
77
|
-
onActivate: () =>
|
|
80
|
+
onActivate: () => S(o)
|
|
78
81
|
}));
|
|
79
|
-
return
|
|
80
|
-
id:
|
|
82
|
+
return y && t.push({
|
|
83
|
+
id: le,
|
|
81
84
|
label: "Create new",
|
|
82
85
|
drillsIn: !1,
|
|
83
86
|
isCreate: !0,
|
|
84
87
|
onActivate: () => {
|
|
85
|
-
|
|
88
|
+
v?.(), y();
|
|
86
89
|
}
|
|
87
90
|
}), t;
|
|
88
91
|
}
|
|
89
92
|
if (!c) {
|
|
90
|
-
const n = (
|
|
91
|
-
return [...
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
const n = (b ?? []).map((t) => t.source).filter((t) => !T.includes(t));
|
|
94
|
+
return [...T, ...n].sort((t, o) => Q(t) - Q(o)).map((t) => {
|
|
95
|
+
const o = P.get(t);
|
|
96
|
+
if ((o !== void 0 ? o.connected : j?.[t]) === !1)
|
|
97
|
+
return {
|
|
98
|
+
id: t,
|
|
99
|
+
label: N(t),
|
|
100
|
+
drillsIn: !1,
|
|
101
|
+
icon: E(t) ?? o?.icon,
|
|
102
|
+
rightLabel: "Connect",
|
|
103
|
+
onActivate: () => {
|
|
104
|
+
v?.(), o?.onConnect ? o.onConnect() : F?.(t);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const J = g.filter(
|
|
108
|
+
(R) => (k(R)?.source ?? "other") === t
|
|
109
|
+
);
|
|
110
|
+
if (J.length + (o ? 1 : 0) === 1) {
|
|
111
|
+
const R = E(t) ?? o?.icon;
|
|
112
|
+
if (o)
|
|
113
|
+
return {
|
|
114
|
+
id: t,
|
|
115
|
+
label: o.label,
|
|
116
|
+
drillsIn: !1,
|
|
117
|
+
icon: R,
|
|
118
|
+
onActivate: () => {
|
|
119
|
+
v?.(), o.onSelect();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const M = J[0];
|
|
123
|
+
return {
|
|
124
|
+
id: String(M.id),
|
|
125
|
+
label: I(M),
|
|
126
|
+
drillsIn: !1,
|
|
127
|
+
icon: R,
|
|
128
|
+
onActivate: () => S(M)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
103
132
|
id: t,
|
|
104
|
-
label:
|
|
133
|
+
label: N(t),
|
|
105
134
|
drillsIn: !0,
|
|
106
|
-
icon:
|
|
107
|
-
onActivate: () =>
|
|
135
|
+
icon: E(t) ?? o?.icon,
|
|
136
|
+
onActivate: () => O(t)
|
|
108
137
|
};
|
|
109
138
|
});
|
|
110
139
|
}
|
|
111
|
-
const e =
|
|
140
|
+
const e = w.trim().toLowerCase(), r = g.filter((n) => (k(n)?.source ?? "other") === c).filter((n) => !e || I(n).toLowerCase().includes(e)).map((n) => ({
|
|
112
141
|
id: String(n.id),
|
|
113
|
-
label:
|
|
142
|
+
label: I(n),
|
|
114
143
|
drillsIn: !1,
|
|
115
|
-
onActivate: () =>
|
|
116
|
-
})), f =
|
|
144
|
+
onActivate: () => S(n)
|
|
145
|
+
})), f = P.get(c);
|
|
117
146
|
if (f) {
|
|
118
|
-
const n = c in
|
|
147
|
+
const n = c in ie;
|
|
119
148
|
r.push({
|
|
120
149
|
id: `create:${c}`,
|
|
121
150
|
label: f.label,
|
|
122
151
|
drillsIn: !1,
|
|
123
152
|
isCreate: !n,
|
|
124
153
|
onActivate: () => {
|
|
125
|
-
|
|
154
|
+
v?.(), f.onSelect();
|
|
126
155
|
}
|
|
127
156
|
});
|
|
128
157
|
}
|
|
129
158
|
return r;
|
|
130
159
|
}, [
|
|
131
|
-
|
|
132
|
-
|
|
160
|
+
s,
|
|
161
|
+
L,
|
|
133
162
|
c,
|
|
163
|
+
w,
|
|
164
|
+
g,
|
|
165
|
+
$,
|
|
166
|
+
T,
|
|
167
|
+
S,
|
|
134
168
|
v,
|
|
169
|
+
y,
|
|
135
170
|
b,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
I,
|
|
140
|
-
k,
|
|
141
|
-
h,
|
|
142
|
-
O,
|
|
143
|
-
M,
|
|
144
|
-
N
|
|
171
|
+
P,
|
|
172
|
+
j,
|
|
173
|
+
F
|
|
145
174
|
]);
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
151
|
-
const { rows: r, activeIndex: f, header: n } =
|
|
175
|
+
z(() => h(-1), [s, c, w, l]), z(() => G(""), [s, c]);
|
|
176
|
+
const q = te({ rows: a, activeIndex: A, header: d });
|
|
177
|
+
q.current = { rows: a, activeIndex: A, header: d }, z(() => {
|
|
178
|
+
if (C)
|
|
179
|
+
return C((e) => {
|
|
180
|
+
const { rows: r, activeIndex: f, header: n } = q.current;
|
|
152
181
|
switch (e.key) {
|
|
153
182
|
case "ArrowDown":
|
|
154
|
-
return r.length &&
|
|
183
|
+
return r.length && h((t) => (t + 1) % r.length), !0;
|
|
155
184
|
case "ArrowUp":
|
|
156
|
-
return r.length &&
|
|
185
|
+
return r.length && h((t) => (t + r.length - 1) % r.length), !0;
|
|
157
186
|
case "ArrowRight":
|
|
158
187
|
case "Enter":
|
|
159
|
-
return r[f]?.onActivate(), !0;
|
|
188
|
+
return (r[f] ?? r[0])?.onActivate(), !0;
|
|
160
189
|
case "ArrowLeft":
|
|
161
190
|
return n?.onBack ? (n.onBack(), !0) : !1;
|
|
162
191
|
default:
|
|
163
192
|
return !1;
|
|
164
193
|
}
|
|
165
|
-
}), () =>
|
|
166
|
-
}, [
|
|
167
|
-
const
|
|
168
|
-
return /* @__PURE__ */ m(
|
|
194
|
+
}), () => C(null);
|
|
195
|
+
}, [C]);
|
|
196
|
+
const X = s ? a.length && !a[0].drillsIn ? "items" : "sources" : "categories", Y = s === "tool" && !!c || s === "subagent";
|
|
197
|
+
return /* @__PURE__ */ m(ce, { className: `bik-mention-picker bik-mention-picker--${X}`, children: [
|
|
169
198
|
d && /* @__PURE__ */ m(
|
|
170
|
-
|
|
199
|
+
he,
|
|
171
200
|
{
|
|
172
201
|
type: "button",
|
|
173
202
|
onClick: d.onBack,
|
|
174
203
|
disabled: !d.onBack,
|
|
175
204
|
style: {
|
|
176
|
-
background:
|
|
205
|
+
background: i.surface.subdued,
|
|
177
206
|
cursor: d.onBack ? "pointer" : "default"
|
|
178
207
|
},
|
|
179
208
|
children: [
|
|
180
209
|
d.onBack && /* @__PURE__ */ u(
|
|
181
|
-
|
|
210
|
+
ee,
|
|
182
211
|
{
|
|
183
212
|
width: 20,
|
|
184
213
|
height: 20,
|
|
185
|
-
color:
|
|
214
|
+
color: i.content.primary
|
|
186
215
|
}
|
|
187
216
|
),
|
|
188
|
-
d.icon &&
|
|
189
|
-
/* @__PURE__ */ m(
|
|
217
|
+
d.icon && V(d.icon),
|
|
218
|
+
/* @__PURE__ */ m(ne, { children: [
|
|
190
219
|
" ",
|
|
191
220
|
d.title
|
|
192
221
|
] })
|
|
193
222
|
]
|
|
194
223
|
}
|
|
195
224
|
),
|
|
196
|
-
|
|
225
|
+
Y && /* @__PURE__ */ m(ae, { children: [
|
|
197
226
|
/* @__PURE__ */ u(
|
|
198
|
-
|
|
227
|
+
H,
|
|
199
228
|
{
|
|
200
229
|
width: 20,
|
|
201
230
|
height: 20,
|
|
202
|
-
color:
|
|
231
|
+
color: i.content.placeholder
|
|
203
232
|
}
|
|
204
233
|
),
|
|
205
234
|
/* @__PURE__ */ u(
|
|
206
|
-
|
|
235
|
+
se,
|
|
207
236
|
{
|
|
208
237
|
autoFocus: !0,
|
|
209
|
-
value:
|
|
238
|
+
value: w,
|
|
210
239
|
placeholder: "Search",
|
|
211
240
|
"data-test": "mention-picker-search",
|
|
212
|
-
onChange: (e) =>
|
|
241
|
+
onChange: (e) => G(e.target.value),
|
|
213
242
|
onKeyDown: (e) => {
|
|
214
|
-
|
|
243
|
+
a.length && (e.key === "ArrowDown" ? (e.preventDefault(), h((r) => (r + 1) % a.length)) : e.key === "ArrowUp" ? (e.preventDefault(), h((r) => (r + a.length - 1) % a.length)) : e.key === "Enter" && (e.preventDefault(), (a[A] ?? a[0])?.onActivate()));
|
|
215
244
|
}
|
|
216
245
|
}
|
|
217
246
|
)
|
|
218
247
|
] }),
|
|
219
|
-
|
|
220
|
-
|
|
248
|
+
a.length === 0 ? /* @__PURE__ */ u(ge, { children: s === "subagent" ? null : "No tools available" }) : a.map((e, r) => /* @__PURE__ */ u(
|
|
249
|
+
de,
|
|
221
250
|
{
|
|
222
251
|
type: "button",
|
|
223
|
-
$active: r ===
|
|
224
|
-
onMouseEnter: () =>
|
|
252
|
+
$active: r === A,
|
|
253
|
+
onMouseEnter: () => h(r),
|
|
254
|
+
onMouseLeave: () => h(-1),
|
|
225
255
|
onClick: e.onActivate,
|
|
226
|
-
children: e.isCreate ? /* @__PURE__ */ u(
|
|
227
|
-
/* @__PURE__ */ m(
|
|
228
|
-
|
|
229
|
-
/* @__PURE__ */ u(
|
|
256
|
+
children: e.isCreate ? /* @__PURE__ */ u(fe, { children: e.label }) : /* @__PURE__ */ m(Z, { children: [
|
|
257
|
+
/* @__PURE__ */ m(ue, { children: [
|
|
258
|
+
V(e.icon),
|
|
259
|
+
/* @__PURE__ */ u(re, { color: i.content.primary, children: e.label })
|
|
230
260
|
] }),
|
|
231
|
-
e.rightLabel ? /* @__PURE__ */ u(
|
|
261
|
+
e.rightLabel ? /* @__PURE__ */ u(pe, { children: e.rightLabel }) : e.drillsIn && /* @__PURE__ */ u(K, { width: 12, height: 12 })
|
|
232
262
|
] })
|
|
233
263
|
},
|
|
234
264
|
e.id
|
|
235
265
|
))
|
|
236
266
|
] });
|
|
237
|
-
},
|
|
267
|
+
}, ce = p.div`
|
|
238
268
|
display: flex;
|
|
239
269
|
flex-direction: column;
|
|
240
270
|
min-width: 240px;
|
|
241
271
|
max-height: 301px;
|
|
242
272
|
overflow-y: auto;
|
|
243
|
-
background: ${
|
|
244
|
-
border: 1px solid ${
|
|
273
|
+
background: ${i.surface.standard};
|
|
274
|
+
border: 1px solid ${i.stroke.primary};
|
|
245
275
|
border-radius: 4px;
|
|
246
276
|
box-shadow: 0px -2px 8px 0px #0000001f;
|
|
247
|
-
`,
|
|
277
|
+
`, ae = p.div`
|
|
248
278
|
display: flex;
|
|
249
279
|
align-items: center;
|
|
250
280
|
gap: 8px;
|
|
251
281
|
padding: 10px 12px;
|
|
252
|
-
border-bottom: 1px solid ${
|
|
253
|
-
`,
|
|
282
|
+
border-bottom: 1px solid ${i.stroke.primary};
|
|
283
|
+
`, se = p.input`
|
|
254
284
|
flex: 1;
|
|
255
285
|
min-width: 0;
|
|
256
286
|
border: none;
|
|
@@ -258,12 +288,12 @@ const y = (a) => a.meta, L = (a) => y(a)?.plainLabel ?? a.label, re = "__bik_cre
|
|
|
258
288
|
background: transparent;
|
|
259
289
|
font-family: Inter;
|
|
260
290
|
font-size: 14px;
|
|
261
|
-
color: ${
|
|
291
|
+
color: ${i.content.primary};
|
|
262
292
|
|
|
263
293
|
&::placeholder {
|
|
264
|
-
color: ${
|
|
294
|
+
color: ${i.content.placeholder};
|
|
265
295
|
}
|
|
266
|
-
`,
|
|
296
|
+
`, de = p.button`
|
|
267
297
|
display: flex;
|
|
268
298
|
justify-content: space-between;
|
|
269
299
|
align-items: center;
|
|
@@ -272,39 +302,39 @@ const y = (a) => a.meta, L = (a) => y(a)?.plainLabel ?? a.label, re = "__bik_cre
|
|
|
272
302
|
padding: 8px 10px;
|
|
273
303
|
height: 48px;
|
|
274
304
|
border: none;
|
|
275
|
-
border-bottom: 1px solid ${
|
|
276
|
-
background: ${(
|
|
305
|
+
border-bottom: 1px solid ${i.stroke.primary};
|
|
306
|
+
background: ${(l) => l.$active ? i.surface.subdued : "transparent"};
|
|
277
307
|
cursor: pointer;
|
|
278
308
|
text-align: left;
|
|
279
309
|
|
|
280
310
|
&:hover {
|
|
281
|
-
background: ${
|
|
311
|
+
background: ${i.surface.hovered};
|
|
282
312
|
}
|
|
283
|
-
`,
|
|
313
|
+
`, ue = p.div`
|
|
284
314
|
display: flex;
|
|
285
315
|
align-items: center;
|
|
286
316
|
gap: 12px;
|
|
287
317
|
min-width: 0;
|
|
288
|
-
`,
|
|
318
|
+
`, pe = p.span`
|
|
289
319
|
flex-shrink: 0;
|
|
290
|
-
color: ${
|
|
320
|
+
color: ${i.content.brand};
|
|
291
321
|
font-family: Inter;
|
|
292
322
|
font-size: 14px;
|
|
293
323
|
font-weight: 600;
|
|
294
324
|
white-space: nowrap;
|
|
295
|
-
`,
|
|
325
|
+
`, fe = p.div`
|
|
296
326
|
width: 100%;
|
|
297
327
|
text-align: center;
|
|
298
|
-
color: ${
|
|
328
|
+
color: ${i.content.brand};
|
|
299
329
|
font-family: Inter;
|
|
300
330
|
font-size: 14px;
|
|
301
331
|
font-weight: 600;
|
|
302
|
-
`,
|
|
332
|
+
`, he = p.button`
|
|
303
333
|
display: flex;
|
|
304
334
|
align-items: center;
|
|
305
335
|
padding: 12px 16px;
|
|
306
336
|
border: none;
|
|
307
|
-
border-bottom: 1px solid ${
|
|
337
|
+
border-bottom: 1px solid ${i.stroke.primary};
|
|
308
338
|
background: transparent;
|
|
309
339
|
cursor: pointer;
|
|
310
340
|
font-family: Inter;
|
|
@@ -312,13 +342,13 @@ const y = (a) => a.meta, L = (a) => y(a)?.plainLabel ?? a.label, re = "__bik_cre
|
|
|
312
342
|
font-weight: 600;
|
|
313
343
|
height: 48px;
|
|
314
344
|
gap: 4px;
|
|
315
|
-
`,
|
|
345
|
+
`, ge = p.div`
|
|
316
346
|
padding: 12px 10px;
|
|
317
347
|
font-family: Inter;
|
|
318
348
|
font-size: 13px;
|
|
319
|
-
color: ${
|
|
349
|
+
color: ${i.content.secondary};
|
|
320
350
|
`;
|
|
321
351
|
export {
|
|
322
|
-
|
|
352
|
+
Le as MentionPicker
|
|
323
353
|
};
|
|
324
354
|
//# sourceMappingURL=MentionPicker.js.map
|