@bikdotai/bik-component-library 0.0.823-beta.2 → 0.0.823
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 +97 -66
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.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/CreateSubAgentPanel.js +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +4 -4
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/StepRail.js +1 -1
- package/dist/cjs/components/agent-builder/components/StepRail.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/Step1About.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +1 -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-listing/AgentListing.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.styled.js +32 -28
- package/dist/cjs/components/agent-listing/AgentListing.styled.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentListingHeader.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListingHeader.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/template-preview/models/TemplateMeta.js +1 -1
- package/dist/cjs/components/template-preview/models/TemplateMeta.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +82 -83
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +13 -5
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +141 -102
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.d.ts +0 -1
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +33 -46
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +135 -119
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +44 -45
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +91 -94
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/StepRail.js +28 -20
- package/dist/esm/components/agent-builder/components/StepRail.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +7 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +108 -98
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step1About.js +38 -35
- package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +118 -122
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +112 -110
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +72 -70
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.js +45 -43
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.model.d.ts +7 -0
- package/dist/esm/components/agent-listing/AgentListing.styled.js +28 -24
- package/dist/esm/components/agent-listing/AgentListing.styled.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListingHeader.d.ts +2 -0
- package/dist/esm/components/agent-listing/AgentListingHeader.js +14 -12
- package/dist/esm/components/agent-listing/AgentListingHeader.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableRow.js +102 -57
- package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +1 -2
- package/dist/esm/components/template-preview/models/TemplateMeta.js +11 -11
- package/dist/esm/components/template-preview/models/TemplateMeta.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useAgentBuilderContext as
|
|
4
|
-
import { buildAgentMentionItems as
|
|
5
|
-
import { MentionEditor as
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as T, useCallback as m } from "react";
|
|
3
|
+
import { useAgentBuilderContext as $ } from "../context/AgentBuilderContext.js";
|
|
4
|
+
import { buildAgentMentionItems as f, appTypeLabel as h } from "../utils/mentionSerialization.js";
|
|
5
|
+
import { MentionEditor as R } from "./MentionEditor.js";
|
|
6
6
|
const L = ({
|
|
7
7
|
fieldKey: e,
|
|
8
|
-
label:
|
|
9
|
-
placeholder:
|
|
8
|
+
label: u,
|
|
9
|
+
placeholder: p,
|
|
10
10
|
maxLength: c,
|
|
11
|
-
minHeight:
|
|
12
|
-
...
|
|
11
|
+
minHeight: l,
|
|
12
|
+
...b
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
|
-
value:
|
|
16
|
-
patch:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
value: n,
|
|
16
|
+
patch: g,
|
|
17
|
+
addReference: r,
|
|
18
|
+
availableTools: o,
|
|
19
|
+
availableSubAgents: a,
|
|
20
|
+
applicationType: s,
|
|
20
21
|
mentionResetKey: M,
|
|
21
|
-
registerMentionField:
|
|
22
|
-
notifyMentionFocus:
|
|
23
|
-
onCreateSubAgent:
|
|
24
|
-
requestCreateSubAgent:
|
|
25
|
-
} =
|
|
26
|
-
() =>
|
|
22
|
+
registerMentionField: i,
|
|
23
|
+
notifyMentionFocus: d,
|
|
24
|
+
onCreateSubAgent: A,
|
|
25
|
+
requestCreateSubAgent: C
|
|
26
|
+
} = $(), v = T(
|
|
27
|
+
() => f(
|
|
28
|
+
o,
|
|
27
29
|
a,
|
|
28
|
-
|
|
29
|
-
$(i)
|
|
30
|
+
h(s)
|
|
30
31
|
),
|
|
31
|
-
[
|
|
32
|
-
),
|
|
33
|
-
(
|
|
34
|
-
[
|
|
35
|
-
), F =
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
[n, t.tools, t.subagents]
|
|
32
|
+
[o, a, s]
|
|
33
|
+
), S = m(
|
|
34
|
+
(t) => i(e, t),
|
|
35
|
+
[i, e]
|
|
36
|
+
), F = m(
|
|
37
|
+
(t, x) => r(t, x),
|
|
38
|
+
[r]
|
|
40
39
|
);
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
40
|
+
return /* @__PURE__ */ I(
|
|
41
|
+
R,
|
|
43
42
|
{
|
|
44
|
-
label:
|
|
45
|
-
value:
|
|
46
|
-
onChange: (
|
|
43
|
+
label: u,
|
|
44
|
+
value: n[e] ?? "",
|
|
45
|
+
onChange: (t) => g({ [e]: t }),
|
|
47
46
|
maxLength: c,
|
|
48
|
-
placeholder:
|
|
49
|
-
minHeight:
|
|
50
|
-
resetKey: `${
|
|
51
|
-
mentionItems:
|
|
52
|
-
tools:
|
|
47
|
+
placeholder: p,
|
|
48
|
+
minHeight: l,
|
|
49
|
+
resetKey: `${n.id}:${e}:${M}`,
|
|
50
|
+
mentionItems: v,
|
|
51
|
+
tools: o,
|
|
53
52
|
onMentionSelect: F,
|
|
54
|
-
onFocus: () =>
|
|
55
|
-
registerInsert:
|
|
56
|
-
onCreateSubAgent:
|
|
57
|
-
"data-test":
|
|
53
|
+
onFocus: () => d(e),
|
|
54
|
+
registerInsert: S,
|
|
55
|
+
onCreateSubAgent: A ? C : void 0,
|
|
56
|
+
"data-test": b["data-test"]
|
|
58
57
|
}
|
|
59
58
|
);
|
|
60
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n} from '../utils/mentionSerialization';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t} = useAgentBuilderContext();\n\n\tconst mentionItems = useMemo(\n\t\t() =>\n\t\t\tbuildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t[availableTools, availableSubAgents, applicationType],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\
|
|
1
|
+
{"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n} from '../utils/mentionSerialization';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\taddReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t} = useAgentBuilderContext();\n\n\tconst mentionItems = useMemo(\n\t\t() =>\n\t\t\tbuildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t[availableTools, availableSubAgents, applicationType],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\t// Route through the context's ref-backed `addReference`: BikEditor captures\n\t// this handler at mount, so reading `value.tools` here would keep only the last\n\t// pick. `addReference` always appends against the latest lists.\n\tconst onMentionSelect = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => addReference(kind, id),\n\t\t[addReference],\n\t);\n\n\treturn (\n\t\t<MentionEditor\n\t\t\tlabel={label}\n\t\t\tvalue={(value[fieldKey] as string | undefined) ?? ''}\n\t\t\tonChange={(text) => patch({ [fieldKey]: text } as Partial<AgentValue>)}\n\t\t\tmaxLength={maxLength}\n\t\t\tplaceholder={placeholder}\n\t\t\tminHeight={minHeight}\n\t\t\tresetKey={`${value.id}:${fieldKey}:${mentionResetKey}`}\n\t\t\tmentionItems={mentionItems}\n\t\t\ttools={availableTools}\n\t\t\tonMentionSelect={onMentionSelect}\n\t\t\tonFocus={() => notifyMentionFocus(fieldKey)}\n\t\t\tregisterInsert={registerInsert}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? requestCreateSubAgent : undefined}\n\t\t\tdata-test={rest['data-test']}\n\t\t/>\n\t);\n};\n"],"names":["MentionField","fieldKey","label","placeholder","maxLength","minHeight","rest","value","patch","addReference","availableTools","availableSubAgents","applicationType","mentionResetKey","registerMentionField","notifyMentionFocus","onCreateSubAgent","requestCreateSubAgent","useAgentBuilderContext","mentionItems","useMemo","buildAgentMentionItems","appTypeLabel","registerInsert","useCallback","fn","onMentionSelect","kind","id","jsx","MentionEditor","text"],"mappings":";;;;;AA4BO,MAAMA,IAA4C,CAAC;AAAA,EACzD,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA,IACGC,EAAA,GAEEC,IAAeC;AAAA,IACpB,MACCC;AAAA,MACCX;AAAA,MACAC;AAAA,MACAW,EAAaV,CAAe;AAAA,IAAA;AAAA,IAE9B,CAACF,GAAgBC,GAAoBC,CAAe;AAAA,EAAA,GAG/CW,IAAiBC;AAAA,IACtB,CAACC,MACAX,EAAqBb,GAAUwB,CAAE;AAAA,IAClC,CAACX,GAAsBb,CAAQ;AAAA,EAAA,GAM1ByB,IAAkBF;AAAA,IACvB,CAACG,GAA2BC,MAAenB,EAAakB,GAAMC,CAAE;AAAA,IAChE,CAACnB,CAAY;AAAA,EAAA;AAGd,SACC,gBAAAoB;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,OAAA5B;AAAA,MACA,OAAQK,EAAMN,CAAQ,KAA4B;AAAA,MAClD,UAAU,CAAC8B,MAASvB,EAAM,EAAE,CAACP,CAAQ,GAAG8B,GAA6B;AAAA,MACrE,WAAA3B;AAAA,MACA,aAAAD;AAAA,MACA,WAAAE;AAAA,MACA,UAAU,GAAGE,EAAM,EAAE,IAAIN,CAAQ,IAAIY,CAAe;AAAA,MACpD,cAAAM;AAAA,MACA,OAAOT;AAAA,MACP,iBAAAgB;AAAA,MACA,SAAS,MAAMX,EAAmBd,CAAQ;AAAA,MAC1C,gBAAAsB;AAAA,MACA,kBAAkBP,IAAmBC,IAAwB;AAAA,MAC7D,aAAWX,EAAK,WAAW;AAAA,IAAA;AAAA,EAAA;AAG9B;"}
|
|
@@ -1,79 +1,76 @@
|
|
|
1
|
-
import { jsx as o, jsxs as i, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
6
|
-
import
|
|
7
|
-
import { TitleSmall as
|
|
1
|
+
import { jsx as o, jsxs as i, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import Z from "../../../assets/icons/delete.svg.js";
|
|
3
|
+
import G from "../../../assets/icons/edit.svg.js";
|
|
4
|
+
import I from "../../../assets/icons/plus.svg.js";
|
|
5
|
+
import { useState as $, useRef as z, useEffect as T } from "react";
|
|
6
|
+
import g from "styled-components";
|
|
7
|
+
import { TitleSmall as O, BodyCaption as x, BodySecondary as H } from "../../TypographyStyle.js";
|
|
8
8
|
import { COLORS as d } from "../../../constants/Theme.js";
|
|
9
|
-
import { SideSection as
|
|
10
|
-
import { renderSourceIcon as
|
|
11
|
-
import { MentionPicker as
|
|
12
|
-
import { Dropdown as
|
|
13
|
-
import { unwrapDropdownValue as
|
|
14
|
-
import { Button as
|
|
15
|
-
const
|
|
9
|
+
import { SideSection as ee, SideSectionHeader as oe, AddIconButton as ne, SourceButtonRow as te, SourceButton as re, SelectableRow as le, RowText as ce, RowActions as ie, RowMenuButton as M, RowActionDivider as de } from "../AgentBuilder.styled.js";
|
|
10
|
+
import { renderSourceIcon as N, SOURCE_ICONS as se } from "../utils/sourceIcons.js";
|
|
11
|
+
import { MentionPicker as ae } from "./MentionPicker.js";
|
|
12
|
+
import { Dropdown as W } from "../../dropdown/Dropdown.js";
|
|
13
|
+
import { unwrapDropdownValue as j } from "../../dropdown/utils.js";
|
|
14
|
+
import { Button as ue } from "../../button/Button.js";
|
|
15
|
+
const F = "__bik_create_new__", Ae = ({
|
|
16
16
|
title: u,
|
|
17
|
-
helper:
|
|
17
|
+
helper: k,
|
|
18
18
|
items: s,
|
|
19
19
|
addableOptions: h,
|
|
20
|
-
onAdd:
|
|
21
|
-
onRemove:
|
|
22
|
-
dataTestPrefix:
|
|
23
|
-
emptyText:
|
|
20
|
+
onAdd: p,
|
|
21
|
+
onRemove: U,
|
|
22
|
+
dataTestPrefix: r,
|
|
23
|
+
emptyText: V,
|
|
24
24
|
createOption: n,
|
|
25
25
|
onConfigure: w,
|
|
26
26
|
sourceGroups: S,
|
|
27
|
-
mentionItems:
|
|
27
|
+
mentionItems: C
|
|
28
28
|
}) => {
|
|
29
|
-
const [a,
|
|
30
|
-
|
|
29
|
+
const [a, l] = $(!1), [q, v] = $(null), f = !!S && S.length > 0, y = S?.find((e) => e.source === q), t = C !== void 0, E = z(null), R = z(null), [m, _] = $(null);
|
|
30
|
+
T(() => {
|
|
31
31
|
if (!t || !a)
|
|
32
32
|
return;
|
|
33
|
-
const e = (
|
|
34
|
-
b.
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const e = (b) => {
|
|
34
|
+
const L = b.target;
|
|
35
|
+
!E.current?.contains(L) && !R.current?.contains(L) && l(!1);
|
|
36
|
+
}, c = (b) => {
|
|
37
|
+
b.key === "Escape" && l(!1);
|
|
37
38
|
};
|
|
38
39
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", c), () => {
|
|
39
40
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", c);
|
|
40
41
|
};
|
|
41
42
|
}, [t, a]);
|
|
42
|
-
const
|
|
43
|
-
// Picker mode (sub-agents) always shows the header "+", even when empty —
|
|
44
|
-
// the empty state is just the title + helper + "+" (create lives in the picker).
|
|
45
|
-
t || h.length > 0 || !!n && s.length > 0
|
|
46
|
-
), V = s.length === 0 && !!n && !p && !t, q = p && s.length === 0, J = () => {
|
|
43
|
+
const P = f ? t || s.length > 0 : t || h.length > 0 || !!n && s.length > 0, J = s.length === 0 && !!n && !f && !t, Q = f && s.length === 0, X = () => {
|
|
47
44
|
if (t) {
|
|
48
|
-
_(null),
|
|
45
|
+
_(null), l((e) => !e);
|
|
49
46
|
return;
|
|
50
47
|
}
|
|
51
|
-
if (
|
|
52
|
-
v(null),
|
|
48
|
+
if (f) {
|
|
49
|
+
v(null), l((e) => !e);
|
|
53
50
|
return;
|
|
54
51
|
}
|
|
55
52
|
if (h.length === 0 && n) {
|
|
56
53
|
n.onSelect();
|
|
57
54
|
return;
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
56
|
+
l((e) => !e);
|
|
57
|
+
}, Y = () => s.map((e) => /* @__PURE__ */ i(
|
|
58
|
+
le,
|
|
62
59
|
{
|
|
63
|
-
"data-test": `${
|
|
60
|
+
"data-test": `${r}-row-${e.id}`,
|
|
64
61
|
children: [
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */ o(
|
|
67
|
-
/* @__PURE__ */ i(
|
|
62
|
+
N(e.icon),
|
|
63
|
+
/* @__PURE__ */ o(ce, { children: /* @__PURE__ */ o(H, { numberOfLines: 1, color: d.content.primary, children: e.label }) }),
|
|
64
|
+
/* @__PURE__ */ i(ie, { children: [
|
|
68
65
|
w && // Configurable rows (sub-agents) get an always-visible edit icon.
|
|
69
66
|
/* @__PURE__ */ o(
|
|
70
|
-
|
|
67
|
+
M,
|
|
71
68
|
{
|
|
72
|
-
"data-test": `${
|
|
69
|
+
"data-test": `${r}-edit-${e.id}`,
|
|
73
70
|
"aria-label": `Edit ${e.label}`,
|
|
74
71
|
onClick: () => w(e.id),
|
|
75
72
|
children: /* @__PURE__ */ o(
|
|
76
|
-
|
|
73
|
+
G,
|
|
77
74
|
{
|
|
78
75
|
width: 16,
|
|
79
76
|
height: 16,
|
|
@@ -82,15 +79,15 @@ const M = "__bik_create_new__", _e = ({
|
|
|
82
79
|
)
|
|
83
80
|
}
|
|
84
81
|
),
|
|
85
|
-
w && /* @__PURE__ */ o(
|
|
82
|
+
w && /* @__PURE__ */ o(de, { "aria-hidden": !0 }),
|
|
86
83
|
/* @__PURE__ */ o(
|
|
87
|
-
|
|
84
|
+
M,
|
|
88
85
|
{
|
|
89
|
-
"data-test": `${
|
|
86
|
+
"data-test": `${r}-delete-${e.id}`,
|
|
90
87
|
"aria-label": `Delete ${e.label}`,
|
|
91
|
-
onClick: () =>
|
|
88
|
+
onClick: () => U(e.id),
|
|
92
89
|
children: /* @__PURE__ */ o(
|
|
93
|
-
|
|
90
|
+
Z,
|
|
94
91
|
{
|
|
95
92
|
width: 16,
|
|
96
93
|
height: 16,
|
|
@@ -107,7 +104,7 @@ const M = "__bik_create_new__", _e = ({
|
|
|
107
104
|
...h,
|
|
108
105
|
{
|
|
109
106
|
label: n.label,
|
|
110
|
-
value:
|
|
107
|
+
value: F,
|
|
111
108
|
searchKey: n.label,
|
|
112
109
|
customComponent: /* @__PURE__ */ o(
|
|
113
110
|
"div",
|
|
@@ -124,124 +121,124 @@ const M = "__bik_create_new__", _e = ({
|
|
|
124
121
|
}
|
|
125
122
|
)
|
|
126
123
|
}
|
|
127
|
-
] : h,
|
|
128
|
-
|
|
124
|
+
] : h, B = t ? /* @__PURE__ */ o(
|
|
125
|
+
ae,
|
|
129
126
|
{
|
|
130
|
-
items:
|
|
127
|
+
items: C ?? [],
|
|
131
128
|
query: "",
|
|
132
129
|
activeIndex: 0,
|
|
133
130
|
initialSource: m ?? void 0,
|
|
134
131
|
onSelect: (e) => {
|
|
135
|
-
|
|
132
|
+
l(!1), p(String(e.id));
|
|
136
133
|
},
|
|
137
|
-
onClose: () =>
|
|
134
|
+
onClose: () => l(!1),
|
|
138
135
|
onCreateSubAgent: n ? () => {
|
|
139
|
-
|
|
136
|
+
l(!1), n.onSelect();
|
|
140
137
|
} : void 0
|
|
141
138
|
},
|
|
142
139
|
m ?? "__root__"
|
|
143
140
|
) : null;
|
|
144
|
-
return /* @__PURE__ */ i(
|
|
145
|
-
/* @__PURE__ */ i(
|
|
146
|
-
/* @__PURE__ */ o(
|
|
147
|
-
|
|
141
|
+
return /* @__PURE__ */ i(ee, { children: [
|
|
142
|
+
/* @__PURE__ */ i(oe, { children: [
|
|
143
|
+
/* @__PURE__ */ o(O, { color: d.content.primary, children: u }),
|
|
144
|
+
P && /* @__PURE__ */ i(he, { ref: E, children: [
|
|
148
145
|
/* @__PURE__ */ o(
|
|
149
|
-
|
|
146
|
+
ne,
|
|
150
147
|
{
|
|
151
|
-
"data-test": `${
|
|
152
|
-
onClick:
|
|
148
|
+
"data-test": `${r}-add`,
|
|
149
|
+
onClick: X,
|
|
153
150
|
"aria-label": `Add ${u}`,
|
|
154
|
-
children: /* @__PURE__ */ o(
|
|
151
|
+
children: /* @__PURE__ */ o(I, { width: 20, height: 20, color: d.content.brand })
|
|
155
152
|
}
|
|
156
153
|
),
|
|
157
|
-
t && a && m === null && /* @__PURE__ */ o(
|
|
154
|
+
t && a && m === null && /* @__PURE__ */ o(K, { "data-test": `${r}-picker`, children: B })
|
|
158
155
|
] })
|
|
159
156
|
] }),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
/* @__PURE__ */ o(
|
|
163
|
-
|
|
157
|
+
k && /* @__PURE__ */ o(x, { color: d.content.secondary, children: k }),
|
|
158
|
+
Q ? /* @__PURE__ */ i(Se, { ref: t ? R : void 0, children: [
|
|
159
|
+
/* @__PURE__ */ o(te, { "data-test": `${r}-sources`, children: S?.map((e) => /* @__PURE__ */ i(
|
|
160
|
+
re,
|
|
164
161
|
{
|
|
165
162
|
type: "button",
|
|
166
|
-
"data-test": `${
|
|
163
|
+
"data-test": `${r}-source-${e.source}`,
|
|
167
164
|
onClick: () => {
|
|
168
165
|
if (t) {
|
|
169
|
-
_(e.source),
|
|
166
|
+
_(e.source), l(!0);
|
|
170
167
|
return;
|
|
171
168
|
}
|
|
172
169
|
v(e.source);
|
|
173
170
|
},
|
|
174
171
|
children: [
|
|
175
|
-
|
|
176
|
-
/* @__PURE__ */ o(
|
|
172
|
+
N(se[e.source], -4),
|
|
173
|
+
/* @__PURE__ */ o(H, { color: d.content.primary, children: e.label })
|
|
177
174
|
]
|
|
178
175
|
},
|
|
179
176
|
e.source
|
|
180
177
|
)) }),
|
|
181
|
-
t && a && m !== null && /* @__PURE__ */ o(
|
|
178
|
+
t && a && m !== null && /* @__PURE__ */ o(K, { $align: "left", "data-test": `${r}-picker`, children: B }),
|
|
182
179
|
!t && y && /* @__PURE__ */ o(
|
|
183
|
-
|
|
180
|
+
W,
|
|
184
181
|
{
|
|
185
|
-
"data-test": `${
|
|
182
|
+
"data-test": `${r}-dropdown`,
|
|
186
183
|
size: "small",
|
|
187
184
|
width: "100%",
|
|
188
185
|
isSearchable: !0,
|
|
189
186
|
placeHolder: `Search ${y.label} tools`,
|
|
190
187
|
options: y.options,
|
|
191
188
|
onSelect: (e) => {
|
|
192
|
-
const c =
|
|
193
|
-
v(null),
|
|
189
|
+
const c = j(e);
|
|
190
|
+
v(null), l(!1), c && p(c);
|
|
194
191
|
}
|
|
195
192
|
}
|
|
196
193
|
)
|
|
197
|
-
] }) : /* @__PURE__ */ i(
|
|
194
|
+
] }) : /* @__PURE__ */ i(D, { children: [
|
|
198
195
|
!t && a && A.length > 0 && /* @__PURE__ */ o(
|
|
199
|
-
|
|
196
|
+
W,
|
|
200
197
|
{
|
|
201
|
-
"data-test": `${
|
|
198
|
+
"data-test": `${r}-dropdown`,
|
|
202
199
|
size: "small",
|
|
203
200
|
width: "100%",
|
|
204
201
|
isSearchable: !0,
|
|
205
202
|
placeHolder: `Select ${u.toLowerCase()}`,
|
|
206
203
|
options: A,
|
|
207
204
|
onSelect: (e) => {
|
|
208
|
-
const c =
|
|
209
|
-
|
|
205
|
+
const c = j(e);
|
|
206
|
+
l(!1), c && (c === F ? n?.onSelect() : p(c));
|
|
210
207
|
}
|
|
211
208
|
}
|
|
212
209
|
),
|
|
213
|
-
s.length === 0 && !a ? /* @__PURE__ */ i(
|
|
214
|
-
/* @__PURE__ */ o(
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
s.length === 0 && !a ? /* @__PURE__ */ i(D, { children: [
|
|
211
|
+
/* @__PURE__ */ o(x, { color: d.content.placeholder, children: V }),
|
|
212
|
+
J && n && /* @__PURE__ */ o(
|
|
213
|
+
ue,
|
|
217
214
|
{
|
|
218
|
-
"data-test": `${
|
|
215
|
+
"data-test": `${r}-create`,
|
|
219
216
|
buttonType: "secondary",
|
|
220
217
|
size: "small",
|
|
221
218
|
matchParentWidth: !0,
|
|
222
|
-
LeadingIcon:
|
|
219
|
+
LeadingIcon: I,
|
|
223
220
|
buttonText: n.label,
|
|
224
221
|
onClick: n.onSelect
|
|
225
222
|
}
|
|
226
223
|
)
|
|
227
|
-
] }) :
|
|
224
|
+
] }) : Y()
|
|
228
225
|
] })
|
|
229
226
|
] });
|
|
230
|
-
},
|
|
227
|
+
}, he = g.div`
|
|
231
228
|
position: relative;
|
|
232
229
|
display: flex;
|
|
233
|
-
`,
|
|
230
|
+
`, Se = g.div`
|
|
234
231
|
position: relative;
|
|
235
232
|
display: flex;
|
|
236
233
|
flex-direction: column;
|
|
237
234
|
gap: 8px;
|
|
238
|
-
`,
|
|
235
|
+
`, K = g.div`
|
|
239
236
|
position: absolute;
|
|
240
237
|
top: calc(100% + 4px);
|
|
241
238
|
${(u) => u.$align === "left" ? "left: 0;" : "right: 0;"}
|
|
242
239
|
z-index: 30;
|
|
243
240
|
`;
|
|
244
241
|
export {
|
|
245
|
-
|
|
242
|
+
Ae as SelectableListSection
|
|
246
243
|
};
|
|
247
244
|
//# sourceMappingURL=SelectableListSection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableListSection.js","sources":["../../../../../src/components/agent-builder/components/SelectableListSection.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { MentionItem } from '@src/editor';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAddIconButton,\n\tRowActionDivider,\n\tRowActions,\n\tRowMenuButton,\n\tRowText,\n\tSelectableRow,\n\tSideSection,\n\tSideSectionHeader,\n\tSourceButton,\n\tSourceButtonRow,\n} from '../AgentBuilder.styled';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tSourceIcon,\n} from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\nexport interface SelectableItem {\n\tid: string;\n\tlabel: string;\n\t/** Leading brand glyph (e.g. a tool's source icon). */\n\ticon?: SourceIcon;\n}\n\n/** A tool source for the empty-state picker (Tools): a button → its searchable list. */\nexport interface SourceGroup {\n\tsource: string;\n\tlabel: string;\n\toptions: SingleOption[];\n}\n\n/** Sentinel value for the \"create new\" entry in the add dropdown. */\nconst CREATE_OPTION_VALUE = '__bik_create_new__';\n\ninterface SelectableListSectionProps {\n\ttitle: string;\n\thelper?: string;\n\titems: SelectableItem[];\n\t/**\n\t * Options shown in the add dropdown. Pass ALL items (not just unselected\n\t * ones) when re-picking an already-added item is allowed (e.g. to insert its\n\t * mention again) — the chip list still shows each item only once.\n\t */\n\taddableOptions: SingleOption[];\n\tonAdd: (id: string) => void;\n\tonRemove: (id: string) => void;\n\tdataTestPrefix: string;\n\temptyText: string;\n\t/**\n\t * Adds a \"create new\" entry at the top of the add dropdown (e.g. \"Create\n\t * sub-agent\"). Selecting it calls `onSelect` instead of `onAdd`.\n\t */\n\tcreateOption?: { label: string; onSelect: () => void };\n\t/**\n\t * When provided, each row shows an edit (Configure) icon next to Delete.\n\t * Omit for tools (Delete only).\n\t */\n\tonConfigure?: (id: string) => void;\n\t/**\n\t * Tool sources (e.g. Manifest / Shopify). When set, the empty state shows a\n\t * button per source; clicking one reveals a searchable dropdown of just that\n\t * source's options. Selecting calls `onAdd`. Takes precedence over the plain\n\t * `addableOptions` dropdown.\n\t */\n\tsourceGroups?: SourceGroup[];\n\t/**\n\t * When provided, the header \"+\" opens the same `@` reference picker used in the\n\t * Instructions editor (a {@link MentionPicker} popover) instead of the inline\n\t * select dropdown. Pass the items for THIS section only (tools OR sub-agents) —\n\t * the picker auto-drills into the single category. Selecting a row calls\n\t * `onAdd(id)`; the picker's \"Create new\" row (sub-agents) calls\n\t * `createOption.onSelect`.\n\t */\n\tmentionItems?: MentionItem[];\n}\n\nexport const SelectableListSection: React.FC<SelectableListSectionProps> = ({\n\ttitle,\n\thelper,\n\titems,\n\taddableOptions,\n\tonAdd,\n\tonRemove,\n\tdataTestPrefix,\n\temptyText,\n\tcreateOption,\n\tonConfigure,\n\tsourceGroups,\n\tmentionItems,\n}) => {\n\tconst [adding, setAdding] = useState(false);\n\t// Tools: which source's searchable list is open (null = just show the buttons).\n\tconst [activeSource, setActiveSource] = useState<string | null>(null);\n\tconst hasSourceGroups = !!sourceGroups && sourceGroups.length > 0;\n\tconst activeGroup = sourceGroups?.find((g) => g.source === activeSource);\n\t// When set, \"+\" opens the `@` MentionPicker popover instead of a select input.\n\tconst usePicker = mentionItems !== undefined;\n\tconst pickerWrapRef = useRef<HTMLDivElement>(null);\n\t// Source (Shopify / Manifest) the empty-state button opened the picker into;\n\t// null when \"+\" opened it at the root source list.\n\tconst [pickerSource, setPickerSource] = useState<string | null>(null);\n\n\t// Dismiss the picker popover on outside click / Escape.\n\tuseEffect(() => {\n\t\tif (!usePicker || !adding) {\n\t\t\treturn;\n\t\t}\n\t\tconst onDocMouseDown = (e: MouseEvent) => {\n\t\t\tif (!pickerWrapRef.current?.contains(e.target as Node)) {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\tdocument.removeEventListener('keydown', onKeyDown);\n\t\t};\n\t}, [usePicker, adding]);\n\n\t// Header \"+\" picks an EXISTING item (and, once some exist, re-creates via the\n\t// dropdown's footer row). With an empty list + a createOption the body shows a\n\t// dedicated \"Create new\" button instead, so the header \"+\" would be redundant.\n\t// With sourceGroups the empty state IS the source buttons, so \"+\" only adds more.\n\tconst showAddButton = hasSourceGroups\n\t\t? items.length > 0\n\t\t: // Picker mode (sub-agents) always shows the header \"+\", even when empty —\n\t\t // the empty state is just the title + helper + \"+\" (create lives in the picker).\n\t\t usePicker ||\n\t\t addableOptions.length > 0 ||\n\t\t (!!createOption && items.length > 0);\n\t// Empty state offers a one-click \"Create new\" (sub-agents) rather than burying\n\t// it behind a single-item dropdown. In picker mode the \"+\" opens the picker\n\t// (with its own \"Create new\" row) instead, so skip the standalone button.\n\tconst showEmptyCreate =\n\t\titems.length === 0 && !!createOption && !hasSourceGroups && !usePicker;\n\t// Source buttons ONLY while no tool is added. Once one exists, adding more uses\n\t// the header \"+\" → all-tools dropdown (the buttons never come back).\n\tconst showSourceButtons = hasSourceGroups && items.length === 0;\n\t// Nothing existing to pick → skip the 1-item dropdown and create directly.\n\tconst handleAddClick = () => {\n\t\tif (usePicker) {\n\t\t\t// Toggle the `@` reference-picker popover (rendered under the \"+\"), opened\n\t\t\t// at the root source list (no pre-drilled source).\n\t\t\tsetPickerSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (hasSourceGroups) {\n\t\t\tsetActiveSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (addableOptions.length === 0 && createOption) {\n\t\t\tcreateOption.onSelect();\n\t\t\treturn;\n\t\t}\n\t\tsetAdding((v) => !v);\n\t};\n\n\tconst renderChipRows = () =>\n\t\titems.map((item) => (\n\t\t\t<SelectableRow\n\t\t\t\tkey={item.id}\n\t\t\t\tdata-test={`${dataTestPrefix}-row-${item.id}`}\n\t\t\t>\n\t\t\t\t{renderSourceIcon(item.icon)}\n\t\t\t\t<RowText>\n\t\t\t\t\t<BodySecondary numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t\t{item.label}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</RowText>\n\t\t\t\t<RowActions>\n\t\t\t\t\t{onConfigure && (\n\t\t\t\t\t\t// Configurable rows (sub-agents) get an always-visible edit icon.\n\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-edit-${item.id}`}\n\t\t\t\t\t\t\taria-label={`Edit ${item.label}`}\n\t\t\t\t\t\t\tonClick={() => onConfigure(item.id)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t)}\n\t\t\t\t\t{onConfigure && <RowActionDivider aria-hidden />}\n\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-${item.id}`}\n\t\t\t\t\t\taria-label={`Delete ${item.label}`}\n\t\t\t\t\t\tonClick={() => onRemove(item.id)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</RowMenuButton>\n\t\t\t\t</RowActions>\n\t\t\t</SelectableRow>\n\t\t));\n\t// \"Create new\" is a brand-coloured footer row at the BOTTOM of the dropdown,\n\t// separated from the selectable items by a divider.\n\tconst dropdownOptions: SingleOption[] = createOption\n\t\t? [\n\t\t\t\t...addableOptions,\n\t\t\t\t{\n\t\t\t\t\tlabel: createOption.label,\n\t\t\t\t\tvalue: CREATE_OPTION_VALUE,\n\t\t\t\t\tsearchKey: createOption.label,\n\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\tcolor: COLORS.content.brand,\n\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\tfontWeight: 600,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{createOption.label}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t ]\n\t\t: addableOptions;\n\n\t// One picker instance reused by the header \"+\" and the empty-state source\n\t// buttons. `key` remounts it so a source button re-drills into its own tools\n\t// (the initial drill-in level is read once, on mount).\n\tconst pickerNode = usePicker ? (\n\t\t<MentionPicker\n\t\t\tkey={pickerSource ?? '__root__'}\n\t\t\titems={mentionItems ?? []}\n\t\t\tquery=\"\"\n\t\t\tactiveIndex={0}\n\t\t\tinitialSource={pickerSource ?? undefined}\n\t\t\tonSelect={(item) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tonAdd(String(item.id));\n\t\t\t}}\n\t\t\tonClose={() => setAdding(false)}\n\t\t\tonCreateSubAgent={\n\t\t\t\tcreateOption\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\tcreateOption.onSelect();\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<SideSection>\n\t\t\t<SideSectionHeader>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{title}</TitleSmall>\n\t\t\t\t{showAddButton && (\n\t\t\t\t\t<AddButtonWrap ref={pickerWrapRef}>\n\t\t\t\t\t\t<AddIconButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-add`}\n\t\t\t\t\t\t\tonClick={handleAddClick}\n\t\t\t\t\t\t\taria-label={`Add ${title}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PlusIcon width={20} height={20} color={COLORS.content.brand} />\n\t\t\t\t\t\t</AddIconButton>\n\t\t\t\t\t\t{usePicker && adding && pickerSource === null && (\n\t\t\t\t\t\t\t<PickerPopover data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</AddButtonWrap>\n\t\t\t\t)}\n\t\t\t</SideSectionHeader>\n\n\t\t\t{helper && (\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{helper}</BodyCaption>\n\t\t\t)}\n\n\t\t\t{showSourceButtons ? (\n\t\t\t\t<SourcePickerAnchor ref={usePicker ? pickerWrapRef : undefined}>\n\t\t\t\t\t{/* No tools yet: one button per source (never shown once a tool exists). */}\n\t\t\t\t\t<SourceButtonRow data-test={`${dataTestPrefix}-sources`}>\n\t\t\t\t\t\t{sourceGroups?.map((g) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={g.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-source-${g.source}`}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tif (usePicker) {\n\t\t\t\t\t\t\t\t\t\t// Open the `@` picker drilled straight into this source's tools.\n\t\t\t\t\t\t\t\t\t\tsetPickerSource(g.source);\n\t\t\t\t\t\t\t\t\t\tsetAdding(true);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetActiveSource(g.source);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(SOURCE_ICONS[g.source], -4)}\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{g.label}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SourceButtonRow>\n\n\t\t\t\t\t{/* Picker mode: clicking a source opens its tools in the `@` picker. */}\n\t\t\t\t\t{usePicker && adding && pickerSource !== null && (\n\t\t\t\t\t\t<PickerPopover $align=\"left\" data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Legacy (non-picker) mode: chosen source → its searchable tool list. */}\n\t\t\t\t\t{!usePicker && activeGroup && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Search ${activeGroup.label} tools`}\n\t\t\t\t\t\t\toptions={activeGroup.options}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetActiveSource(null);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\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</SourcePickerAnchor>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{!usePicker && adding && dropdownOptions.length > 0 && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Select ${title.toLowerCase()}`}\n\t\t\t\t\t\t\toptions={dropdownOptions}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (!v) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v === CREATE_OPTION_VALUE) {\n\t\t\t\t\t\t\t\t\tcreateOption?.onSelect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{items.length === 0 && !adding ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t{emptyText}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t{showEmptyCreate && createOption && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-create`}\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\t\t\t\tbuttonText={createOption.label}\n\t\t\t\t\t\t\t\t\tonClick={createOption.onSelect}\n\t\t\t\t\t\t\t\t/>\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\t\trenderChipRows()\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</SideSection>\n\t);\n};\n\n// Anchors the `@`-picker popover to the header \"+\" button.\nconst AddButtonWrap = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n`;\n\n// Anchors the `@`-picker popover to the empty-state source buttons.\nconst SourcePickerAnchor = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\n// Floating card under the trigger. Aligns to the \"+\" (right) or the source\n// buttons (left) so it stays inside the side panel.\nconst PickerPopover = styled.div<{ $align?: 'left' | 'right' }>`\n\tposition: absolute;\n\ttop: calc(100% + 4px);\n\t${(p) => (p.$align === 'left' ? 'left: 0;' : 'right: 0;')}\n\tz-index: 30;\n`;\n"],"names":["CREATE_OPTION_VALUE","SelectableListSection","title","helper","items","addableOptions","onAdd","onRemove","dataTestPrefix","emptyText","createOption","onConfigure","sourceGroups","mentionItems","adding","setAdding","useState","activeSource","setActiveSource","hasSourceGroups","activeGroup","g","usePicker","pickerWrapRef","useRef","pickerSource","setPickerSource","useEffect","onDocMouseDown","e","onKeyDown","showAddButton","showEmptyCreate","showSourceButtons","handleAddClick","v","renderChipRows","item","jsxs","SelectableRow","renderSourceIcon","jsx","RowText","BodySecondary","COLORS","RowActions","RowMenuButton","EditIcon","RowActionDivider","DeleteIcon","dropdownOptions","pickerNode","MentionPicker","SideSection","SideSectionHeader","TitleSmall","AddButtonWrap","AddIconButton","PlusIcon","PickerPopover","BodyCaption","SourcePickerAnchor","SourceButtonRow","SourceButton","SOURCE_ICONS","Dropdown","opt","unwrapDropdownValue","Fragment","Button","styled","p"],"mappings":";;;;;;;;;;;;;;AAiDA,MAAMA,I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A8B,GAAA,EACC,UAAA;AAAA,QAAA,gBAAA3B,EAACmB,GAAA,EAAY,OAAOhB,EAAO,QAAQ,aACjC,UAAAnC,GACF;AAAA,QACCuB,KAAmBtB,KACnB,gBAAA+B;AAAA,UAAC4B;AAAA,UAAA;AAAA,YACA,aAAW,GAAG7D,CAAc;AAAA,YAC5B,YAAW;AAAA,YACX,MAAK;AAAA,YACL,kBAAgB;AAAA,YAChB,aAAakD;AAAAA,YACb,YAAYhD,EAAa;AAAA,YACzB,SAASA,EAAa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CAEF,IAEA0B,EAAA;AAAA,IAAe,EAAA,CAEjB;AAAA,EAAA,GAEF;AAEF,GAGMoB,KAAgBc,EAAO;AAAA;AAAA;AAAA,GAMvBT,KAAqBS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAS5BX,IAAgBW,EAAO;AAAA;AAAA;AAAA,GAG1B,CAACC,MAAOA,EAAE,WAAW,SAAS,aAAa,WAAY;AAAA;AAAA;"}
|
|
1
|
+
{"version":3,"file":"SelectableListSection.js","sources":["../../../../../src/components/agent-builder/components/SelectableListSection.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport EditIcon from '@src/assets/icons/edit.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { MentionItem } from '@src/editor';\nimport React, { useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAddIconButton,\n\tRowActionDivider,\n\tRowActions,\n\tRowMenuButton,\n\tRowText,\n\tSelectableRow,\n\tSideSection,\n\tSideSectionHeader,\n\tSourceButton,\n\tSourceButtonRow,\n} from '../AgentBuilder.styled';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tSourceIcon,\n} from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\nexport interface SelectableItem {\n\tid: string;\n\tlabel: string;\n\t/** Leading brand glyph (e.g. a tool's source icon). */\n\ticon?: SourceIcon;\n}\n\n/** A tool source for the empty-state picker (Tools): a button → its searchable list. */\nexport interface SourceGroup {\n\tsource: string;\n\tlabel: string;\n\toptions: SingleOption[];\n}\n\n/** Sentinel value for the \"create new\" entry in the add dropdown. */\nconst CREATE_OPTION_VALUE = '__bik_create_new__';\n\ninterface SelectableListSectionProps {\n\ttitle: string;\n\thelper?: string;\n\titems: SelectableItem[];\n\t/**\n\t * Options shown in the add dropdown. Pass ALL items (not just unselected\n\t * ones) when re-picking an already-added item is allowed (e.g. to insert its\n\t * mention again) — the chip list still shows each item only once.\n\t */\n\taddableOptions: SingleOption[];\n\tonAdd: (id: string) => void;\n\tonRemove: (id: string) => void;\n\tdataTestPrefix: string;\n\temptyText: string;\n\t/**\n\t * Adds a \"create new\" entry at the top of the add dropdown (e.g. \"Create\n\t * sub-agent\"). Selecting it calls `onSelect` instead of `onAdd`.\n\t */\n\tcreateOption?: { label: string; onSelect: () => void };\n\t/**\n\t * When provided, each row shows an edit (Configure) icon next to Delete.\n\t * Omit for tools (Delete only).\n\t */\n\tonConfigure?: (id: string) => void;\n\t/**\n\t * Tool sources (e.g. Manifest / Shopify). When set, the empty state shows a\n\t * button per source; clicking one reveals a searchable dropdown of just that\n\t * source's options. Selecting calls `onAdd`. Takes precedence over the plain\n\t * `addableOptions` dropdown.\n\t */\n\tsourceGroups?: SourceGroup[];\n\t/**\n\t * When provided, the header \"+\" opens the same `@` reference picker used in the\n\t * Instructions editor (a {@link MentionPicker} popover) instead of the inline\n\t * select dropdown. Pass the items for THIS section only (tools OR sub-agents) —\n\t * the picker auto-drills into the single category. Selecting a row calls\n\t * `onAdd(id)`; the picker's \"Create new\" row (sub-agents) calls\n\t * `createOption.onSelect`.\n\t */\n\tmentionItems?: MentionItem[];\n}\n\nexport const SelectableListSection: React.FC<SelectableListSectionProps> = ({\n\ttitle,\n\thelper,\n\titems,\n\taddableOptions,\n\tonAdd,\n\tonRemove,\n\tdataTestPrefix,\n\temptyText,\n\tcreateOption,\n\tonConfigure,\n\tsourceGroups,\n\tmentionItems,\n}) => {\n\tconst [adding, setAdding] = useState(false);\n\t// Tools: which source's searchable list is open (null = just show the buttons).\n\tconst [activeSource, setActiveSource] = useState<string | null>(null);\n\tconst hasSourceGroups = !!sourceGroups && sourceGroups.length > 0;\n\tconst activeGroup = sourceGroups?.find((g) => g.source === activeSource);\n\t// When set, \"+\" opens the `@` MentionPicker popover instead of a select input.\n\tconst usePicker = mentionItems !== undefined;\n\t// Separate anchors for the header \"+\" popover and the empty-state source-button\n\t// popover — when empty both render at once, so a shared ref would misfire the\n\t// outside-click check (closing the header picker when a source row is clicked).\n\tconst headerPickerRef = useRef<HTMLDivElement>(null);\n\tconst sourcePickerRef = useRef<HTMLDivElement>(null);\n\t// Source (Shopify / Manifest) the empty-state button opened the picker into;\n\t// null when \"+\" opened it at the root source list.\n\tconst [pickerSource, setPickerSource] = useState<string | null>(null);\n\n\t// Dismiss the picker popover on outside click / Escape.\n\tuseEffect(() => {\n\t\tif (!usePicker || !adding) {\n\t\t\treturn;\n\t\t}\n\t\tconst onDocMouseDown = (e: MouseEvent) => {\n\t\t\tconst target = e.target as Node;\n\t\t\tif (\n\t\t\t\t!headerPickerRef.current?.contains(target) &&\n\t\t\t\t!sourcePickerRef.current?.contains(target)\n\t\t\t) {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\tsetAdding(false);\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\tdocument.removeEventListener('keydown', onKeyDown);\n\t\t};\n\t}, [usePicker, adding]);\n\n\t// Header \"+\" picks an EXISTING item (and, once some exist, re-creates via the\n\t// dropdown's footer row). With an empty list + a createOption the body shows a\n\t// dedicated \"Create new\" button instead, so the header \"+\" would be redundant.\n\t// In picker mode the \"+\" always shows (even empty) — for tools it sits next to\n\t// the empty-state source buttons; the create flow lives inside the picker.\n\tconst showAddButton = hasSourceGroups\n\t\t? usePicker || items.length > 0\n\t\t: usePicker ||\n\t\t addableOptions.length > 0 ||\n\t\t (!!createOption && items.length > 0);\n\t// Empty state offers a one-click \"Create new\" (sub-agents) rather than burying\n\t// it behind a single-item dropdown. In picker mode the \"+\" opens the picker\n\t// (with its own \"Create new\" row) instead, so skip the standalone button.\n\tconst showEmptyCreate =\n\t\titems.length === 0 && !!createOption && !hasSourceGroups && !usePicker;\n\t// Source buttons ONLY while no tool is added. Once one exists, adding more uses\n\t// the header \"+\" → all-tools dropdown (the buttons never come back).\n\tconst showSourceButtons = hasSourceGroups && items.length === 0;\n\t// Nothing existing to pick → skip the 1-item dropdown and create directly.\n\tconst handleAddClick = () => {\n\t\tif (usePicker) {\n\t\t\t// Toggle the `@` reference-picker popover (rendered under the \"+\"), opened\n\t\t\t// at the root source list (no pre-drilled source).\n\t\t\tsetPickerSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (hasSourceGroups) {\n\t\t\tsetActiveSource(null);\n\t\t\tsetAdding((v) => !v);\n\t\t\treturn;\n\t\t}\n\t\tif (addableOptions.length === 0 && createOption) {\n\t\t\tcreateOption.onSelect();\n\t\t\treturn;\n\t\t}\n\t\tsetAdding((v) => !v);\n\t};\n\n\tconst renderChipRows = () =>\n\t\titems.map((item) => (\n\t\t\t<SelectableRow\n\t\t\t\tkey={item.id}\n\t\t\t\tdata-test={`${dataTestPrefix}-row-${item.id}`}\n\t\t\t>\n\t\t\t\t{renderSourceIcon(item.icon)}\n\t\t\t\t<RowText>\n\t\t\t\t\t<BodySecondary numberOfLines={1} color={COLORS.content.primary}>\n\t\t\t\t\t\t{item.label}\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</RowText>\n\t\t\t\t<RowActions>\n\t\t\t\t\t{onConfigure && (\n\t\t\t\t\t\t// Configurable rows (sub-agents) get an always-visible edit icon.\n\t\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-edit-${item.id}`}\n\t\t\t\t\t\t\taria-label={`Edit ${item.label}`}\n\t\t\t\t\t\t\tonClick={() => onConfigure(item.id)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RowMenuButton>\n\t\t\t\t\t)}\n\t\t\t\t\t{onConfigure && <RowActionDivider aria-hidden />}\n\t\t\t\t\t<RowMenuButton\n\t\t\t\t\t\tdata-test={`${dataTestPrefix}-delete-${item.id}`}\n\t\t\t\t\t\taria-label={`Delete ${item.label}`}\n\t\t\t\t\t\tonClick={() => onRemove(item.id)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</RowMenuButton>\n\t\t\t\t</RowActions>\n\t\t\t</SelectableRow>\n\t\t));\n\t// \"Create new\" is a brand-coloured footer row at the BOTTOM of the dropdown,\n\t// separated from the selectable items by a divider.\n\tconst dropdownOptions: SingleOption[] = createOption\n\t\t? [\n\t\t\t\t...addableOptions,\n\t\t\t\t{\n\t\t\t\t\tlabel: createOption.label,\n\t\t\t\t\tvalue: CREATE_OPTION_VALUE,\n\t\t\t\t\tsearchKey: createOption.label,\n\t\t\t\t\tcustomComponent: (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\tcolor: COLORS.content.brand,\n\t\t\t\t\t\t\t\tfontFamily: 'Inter',\n\t\t\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\t\t\tfontWeight: 600,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{createOption.label}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t ]\n\t\t: addableOptions;\n\n\t// One picker instance reused by the header \"+\" and the empty-state source\n\t// buttons. `key` remounts it so a source button re-drills into its own tools\n\t// (the initial drill-in level is read once, on mount).\n\tconst pickerNode = usePicker ? (\n\t\t<MentionPicker\n\t\t\tkey={pickerSource ?? '__root__'}\n\t\t\titems={mentionItems ?? []}\n\t\t\tquery=\"\"\n\t\t\tactiveIndex={0}\n\t\t\tinitialSource={pickerSource ?? undefined}\n\t\t\tonSelect={(item) => {\n\t\t\t\tsetAdding(false);\n\t\t\t\tonAdd(String(item.id));\n\t\t\t}}\n\t\t\tonClose={() => setAdding(false)}\n\t\t\tonCreateSubAgent={\n\t\t\t\tcreateOption\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\tcreateOption.onSelect();\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<SideSection>\n\t\t\t<SideSectionHeader>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{title}</TitleSmall>\n\t\t\t\t{showAddButton && (\n\t\t\t\t\t<AddButtonWrap ref={headerPickerRef}>\n\t\t\t\t\t\t<AddIconButton\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-add`}\n\t\t\t\t\t\t\tonClick={handleAddClick}\n\t\t\t\t\t\t\taria-label={`Add ${title}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PlusIcon width={20} height={20} color={COLORS.content.brand} />\n\t\t\t\t\t\t</AddIconButton>\n\t\t\t\t\t\t{usePicker && adding && pickerSource === null && (\n\t\t\t\t\t\t\t<PickerPopover data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</AddButtonWrap>\n\t\t\t\t)}\n\t\t\t</SideSectionHeader>\n\n\t\t\t{helper && (\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{helper}</BodyCaption>\n\t\t\t)}\n\n\t\t\t{showSourceButtons ? (\n\t\t\t\t<SourcePickerAnchor ref={usePicker ? sourcePickerRef : undefined}>\n\t\t\t\t\t{/* No tools yet: one button per source (never shown once a tool exists). */}\n\t\t\t\t\t<SourceButtonRow data-test={`${dataTestPrefix}-sources`}>\n\t\t\t\t\t\t{sourceGroups?.map((g) => (\n\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\tkey={g.source}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-source-${g.source}`}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tif (usePicker) {\n\t\t\t\t\t\t\t\t\t\t// Open the `@` picker drilled straight into this source's tools.\n\t\t\t\t\t\t\t\t\t\tsetPickerSource(g.source);\n\t\t\t\t\t\t\t\t\t\tsetAdding(true);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetActiveSource(g.source);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{renderSourceIcon(SOURCE_ICONS[g.source], -4)}\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{g.label}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SourceButtonRow>\n\n\t\t\t\t\t{/* Picker mode: clicking a source opens its tools in the `@` picker. */}\n\t\t\t\t\t{usePicker && adding && pickerSource !== null && (\n\t\t\t\t\t\t<PickerPopover $align=\"left\" data-test={`${dataTestPrefix}-picker`}>\n\t\t\t\t\t\t\t{pickerNode}\n\t\t\t\t\t\t</PickerPopover>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Legacy (non-picker) mode: chosen source → its searchable tool list. */}\n\t\t\t\t\t{!usePicker && activeGroup && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Search ${activeGroup.label} tools`}\n\t\t\t\t\t\t\toptions={activeGroup.options}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetActiveSource(null);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\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</SourcePickerAnchor>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{!usePicker && adding && dropdownOptions.length > 0 && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-dropdown`}\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\tplaceHolder={`Select ${title.toLowerCase()}`}\n\t\t\t\t\t\t\toptions={dropdownOptions}\n\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\tsetAdding(false);\n\t\t\t\t\t\t\t\tif (!v) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v === CREATE_OPTION_VALUE) {\n\t\t\t\t\t\t\t\t\tcreateOption?.onSelect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonAdd(v);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{items.length === 0 && !adding ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t{emptyText}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t{showEmptyCreate && createOption && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-create`}\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\t\t\t\tbuttonText={createOption.label}\n\t\t\t\t\t\t\t\t\tonClick={createOption.onSelect}\n\t\t\t\t\t\t\t\t/>\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\t\trenderChipRows()\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</SideSection>\n\t);\n};\n\n// Anchors the `@`-picker popover to the header \"+\" button.\nconst AddButtonWrap = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n`;\n\n// Anchors the `@`-picker popover to the empty-state source buttons.\nconst SourcePickerAnchor = styled.div`\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\n// Floating card under the trigger. Aligns to the \"+\" (right) or the source\n// buttons (left) so it stays inside the side panel.\nconst PickerPopover = styled.div<{ $align?: 'left' | 'right' }>`\n\tposition: absolute;\n\ttop: calc(100% + 4px);\n\t${(p) => (p.$align === 'left' ? 'left: 0;' : 'right: 0;')}\n\tz-index: 30;\n`;\n"],"names":["CREATE_OPTION_VALUE","SelectableListSection","title","helper","items","addableOptions","onAdd","onRemove","dataTestPrefix","emptyText","createOption","onConfigure","sourceGroups","mentionItems","adding","setAdding","useState","activeSource","setActiveSource","hasSourceGroups","activeGroup","g","usePicker","headerPickerRef","useRef","sourcePickerRef","pickerSource","setPickerSource","useEffect","onDocMouseDown","e","target","onKeyDown","showAddButton","showEmptyCreate","showSourceButtons","handleAddClick","v","renderChipRows","item","jsxs","SelectableRow","renderSourceIcon","jsx","RowText","BodySecondary","COLORS","RowActions","RowMenuButton","EditIcon","RowActionDivider","DeleteIcon","dropdownOptions","pickerNode","MentionPicker","SideSection","SideSectionHeader","TitleSmall","AddButtonWrap","AddIconButton","PlusIcon","PickerPopover","BodyCaption","SourcePickerAnchor","SourceButtonRow","SourceButton","SOURCE_ICONS","Dropdown","opt","unwrapDropdownValue","Fragment","Button","styled","p"],"mappings":";;;;;;;;;;;;;;AAiDA,MAAMA,IAAsB,sBA4CfC,KAA8D,CAAC;AAAA,EAC3E,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpC,CAACC,GAAcC,CAAe,IAA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aoD;AAAAA,YACb,YAAYlD,EAAa;AAAA,YACzB,SAASA,EAAa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CAEF,IAEA4B,EAAA;AAAA,IAAe,EAAA,CAEjB;AAAA,EAAA,GAEF;AAEF,GAGMoB,KAAgBc,EAAO;AAAA;AAAA;AAAA,GAMvBT,KAAqBS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAS5BX,IAAgBW,EAAO;AAAA;AAAA;AAAA,GAG1B,CAACC,MAAOA,EAAE,WAAW,SAAS,aAAa,WAAY;AAAA;AAAA;"}
|
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import S from "../../../assets/icons/tick.svg.js";
|
|
3
|
+
import { TitleSmall as v, BodySecondary as y } from "../../TypographyStyle.js";
|
|
4
|
+
import { COLORS as n } from "../../../constants/Theme.js";
|
|
5
|
+
import { RailList as g, RailItem as f, StepBadge as h } from "../AgentBuilder.styled.js";
|
|
6
|
+
import { STEP_DEFINITIONS as k } from "../constants/steps.js";
|
|
7
|
+
import { useAgentBuilderContext as x } from "../context/AgentBuilderContext.js";
|
|
8
|
+
const L = () => {
|
|
8
9
|
const {
|
|
9
10
|
activeStep: a,
|
|
10
|
-
activeIndex:
|
|
11
|
-
validation:
|
|
12
|
-
goToStep:
|
|
11
|
+
activeIndex: c,
|
|
12
|
+
validation: l,
|
|
13
|
+
goToStep: m,
|
|
13
14
|
disableStepNavigation: i
|
|
14
|
-
} =
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
const o =
|
|
15
|
+
} = x();
|
|
16
|
+
return /* @__PURE__ */ e(g, { children: k.map((t) => {
|
|
17
|
+
const o = t.key === a, r = t.index - 1 < c && l[t.key], d = o ? "active" : r ? "complete" : "inactive", p = o ? v : y;
|
|
17
18
|
return /* @__PURE__ */ s(
|
|
18
|
-
|
|
19
|
+
f,
|
|
19
20
|
{
|
|
20
|
-
"data-test": `agent-step-${
|
|
21
|
+
"data-test": `agent-step-${t.key}`,
|
|
21
22
|
disabled: i,
|
|
22
|
-
onClick: i ? void 0 : () =>
|
|
23
|
+
onClick: i ? void 0 : () => m(t.key),
|
|
23
24
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
25
|
+
/* @__PURE__ */ e(h, { state: d, children: r ? /* @__PURE__ */ e(
|
|
26
|
+
S,
|
|
27
|
+
{
|
|
28
|
+
width: 11,
|
|
29
|
+
height: 8,
|
|
30
|
+
color: n.content.primaryInverse
|
|
31
|
+
}
|
|
32
|
+
) : t.index }),
|
|
33
|
+
/* @__PURE__ */ e(p, { color: n.content.primary, children: t.title })
|
|
26
34
|
]
|
|
27
35
|
},
|
|
28
|
-
|
|
36
|
+
t.key
|
|
29
37
|
);
|
|
30
38
|
}) });
|
|
31
39
|
};
|
|
32
40
|
export {
|
|
33
|
-
|
|
41
|
+
L as StepRail
|
|
34
42
|
};
|
|
35
43
|
//# sourceMappingURL=StepRail.js.map
|