@bikdotai/bik-component-library 0.0.821 → 0.0.822-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +66 -90
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.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/MentionPicker.js +19 -19
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +14 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/charLimits.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-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.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/AgentListingFilters.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListingFilters.js.map +1 -1
- package/dist/cjs/components/dropdown/utils.js +2 -0
- package/dist/cjs/components/dropdown/utils.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/utils/arrayUtils.js +2 -0
- package/dist/cjs/utils/arrayUtils.js.map +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.js +67 -65
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +7 -0
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +117 -141
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +3 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +95 -96
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +4 -0
- package/dist/esm/components/agent-builder/components/MentionPicker.js +64 -69
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +10 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +161 -106
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/charLimits.d.ts +6 -0
- package/dist/esm/components/agent-builder/constants/charLimits.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +4 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +126 -120
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/steps/Step1About.js +6 -7
- package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +59 -59
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +114 -109
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +26 -27
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +6 -0
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +12 -7
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.js +91 -90
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListingFilters.js +31 -30
- package/dist/esm/components/agent-listing/AgentListingFilters.js.map +1 -1
- package/dist/esm/components/dropdown/index.d.ts +1 -0
- package/dist/esm/components/dropdown/utils.d.ts +9 -0
- package/dist/esm/components/dropdown/utils.js +5 -0
- package/dist/esm/components/dropdown/utils.js.map +1 -0
- package/dist/esm/index.js +10 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/arrayUtils.d.ts +7 -0
- package/dist/esm/utils/arrayUtils.js +5 -0
- package/dist/esm/utils/arrayUtils.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,78 +1,100 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as o, jsxs as i, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import X from "../../../assets/icons/delete.svg.js";
|
|
3
|
+
import Y from "../../../assets/icons/edit.svg.js";
|
|
4
|
+
import L from "../../../assets/icons/plus.svg.js";
|
|
5
|
+
import { useState as g, useRef as Z, useEffect as G } from "react";
|
|
6
|
+
import k from "styled-components";
|
|
7
|
+
import { TitleSmall as P, BodyCaption as D, BodySecondary as I } from "../../TypographyStyle.js";
|
|
8
|
+
import { COLORS as d } from "../../../constants/Theme.js";
|
|
9
|
+
import { SideSection as T, SideSectionHeader as O, AddIconButton as ee, SourceButtonRow as oe, SourceButton as ne, SelectableRow as te, RowText as le, RowActions as re, RowMenuButton as z, RowActionDivider as ce } from "../AgentBuilder.styled.js";
|
|
10
|
+
import { renderSourceIcon as W, SOURCE_ICONS as ie } from "../utils/sourceIcons.js";
|
|
11
|
+
import { MentionPicker as de } from "./MentionPicker.js";
|
|
12
|
+
import { Dropdown as x } from "../../dropdown/Dropdown.js";
|
|
13
|
+
import { unwrapDropdownValue as H } from "../../dropdown/utils.js";
|
|
14
|
+
import { Button as se } from "../../button/Button.js";
|
|
15
|
+
const M = "__bik_create_new__", _e = ({
|
|
16
|
+
title: u,
|
|
17
|
+
helper: C,
|
|
18
|
+
items: s,
|
|
19
|
+
addableOptions: h,
|
|
20
|
+
onAdd: f,
|
|
21
|
+
onRemove: j,
|
|
22
|
+
dataTestPrefix: l,
|
|
23
|
+
emptyText: F,
|
|
21
24
|
createOption: n,
|
|
22
25
|
onConfigure: w,
|
|
23
|
-
sourceGroups:
|
|
26
|
+
sourceGroups: S,
|
|
27
|
+
mentionItems: E
|
|
24
28
|
}) => {
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const [a, r] = g(!1), [K, v] = g(null), p = !!S && S.length > 0, y = S?.find((e) => e.source === K), t = E !== void 0, b = Z(null), [m, _] = g(null);
|
|
30
|
+
G(() => {
|
|
31
|
+
if (!t || !a)
|
|
32
|
+
return;
|
|
33
|
+
const e = ($) => {
|
|
34
|
+
b.current?.contains($.target) || r(!1);
|
|
35
|
+
}, c = ($) => {
|
|
36
|
+
$.key === "Escape" && r(!1);
|
|
37
|
+
};
|
|
38
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", c), () => {
|
|
39
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", c);
|
|
40
|
+
};
|
|
41
|
+
}, [t, a]);
|
|
42
|
+
const U = p ? s.length > 0 : (
|
|
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 = () => {
|
|
47
|
+
if (t) {
|
|
48
|
+
_(null), r((e) => !e);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (p) {
|
|
52
|
+
v(null), r((e) => !e);
|
|
28
53
|
return;
|
|
29
54
|
}
|
|
30
|
-
if (
|
|
55
|
+
if (h.length === 0 && n) {
|
|
31
56
|
n.onSelect();
|
|
32
57
|
return;
|
|
33
58
|
}
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
59
|
+
r((e) => !e);
|
|
60
|
+
}, Q = () => s.map((e) => /* @__PURE__ */ i(
|
|
61
|
+
te,
|
|
37
62
|
{
|
|
38
|
-
"data-test": `${
|
|
63
|
+
"data-test": `${l}-row-${e.id}`,
|
|
39
64
|
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ o(Y, { children: /* @__PURE__ */ o(_, { numberOfLines: 1, color: l.content.primary, children: e.label }) }),
|
|
45
|
-
/* @__PURE__ */ c(Z, { children: [
|
|
65
|
+
W(e.icon),
|
|
66
|
+
/* @__PURE__ */ o(le, { children: /* @__PURE__ */ o(I, { numberOfLines: 1, color: d.content.primary, children: e.label }) }),
|
|
67
|
+
/* @__PURE__ */ i(re, { children: [
|
|
46
68
|
w && // Configurable rows (sub-agents) get an always-visible edit icon.
|
|
47
69
|
/* @__PURE__ */ o(
|
|
48
|
-
|
|
70
|
+
z,
|
|
49
71
|
{
|
|
50
|
-
"data-test": `${
|
|
72
|
+
"data-test": `${l}-edit-${e.id}`,
|
|
51
73
|
"aria-label": `Edit ${e.label}`,
|
|
52
74
|
onClick: () => w(e.id),
|
|
53
75
|
children: /* @__PURE__ */ o(
|
|
54
|
-
|
|
76
|
+
Y,
|
|
55
77
|
{
|
|
56
78
|
width: 16,
|
|
57
79
|
height: 16,
|
|
58
|
-
color:
|
|
80
|
+
color: d.content.secondary
|
|
59
81
|
}
|
|
60
82
|
)
|
|
61
83
|
}
|
|
62
84
|
),
|
|
63
|
-
w && /* @__PURE__ */ o(
|
|
85
|
+
w && /* @__PURE__ */ o(ce, { "aria-hidden": !0 }),
|
|
64
86
|
/* @__PURE__ */ o(
|
|
65
|
-
|
|
87
|
+
z,
|
|
66
88
|
{
|
|
67
|
-
"data-test": `${
|
|
89
|
+
"data-test": `${l}-delete-${e.id}`,
|
|
68
90
|
"aria-label": `Delete ${e.label}`,
|
|
69
|
-
onClick: () =>
|
|
91
|
+
onClick: () => j(e.id),
|
|
70
92
|
children: /* @__PURE__ */ o(
|
|
71
|
-
|
|
93
|
+
X,
|
|
72
94
|
{
|
|
73
95
|
width: 16,
|
|
74
96
|
height: 16,
|
|
75
|
-
color:
|
|
97
|
+
color: d.content.secondary
|
|
76
98
|
}
|
|
77
99
|
)
|
|
78
100
|
}
|
|
@@ -81,11 +103,11 @@ const k = "__bik_create_new__", ae = ({
|
|
|
81
103
|
]
|
|
82
104
|
},
|
|
83
105
|
e.id
|
|
84
|
-
)),
|
|
85
|
-
...
|
|
106
|
+
)), A = n ? [
|
|
107
|
+
...h,
|
|
86
108
|
{
|
|
87
109
|
label: n.label,
|
|
88
|
-
value:
|
|
110
|
+
value: M,
|
|
89
111
|
searchKey: n.label,
|
|
90
112
|
customComponent: /* @__PURE__ */ o(
|
|
91
113
|
"div",
|
|
@@ -93,7 +115,7 @@ const k = "__bik_create_new__", ae = ({
|
|
|
93
115
|
style: {
|
|
94
116
|
width: "100%",
|
|
95
117
|
textAlign: "center",
|
|
96
|
-
color:
|
|
118
|
+
color: d.content.brand,
|
|
97
119
|
fontFamily: "Inter",
|
|
98
120
|
fontSize: 14,
|
|
99
121
|
fontWeight: 600
|
|
@@ -102,91 +124,124 @@ const k = "__bik_create_new__", ae = ({
|
|
|
102
124
|
}
|
|
103
125
|
)
|
|
104
126
|
}
|
|
105
|
-
] :
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
] : h, R = t ? /* @__PURE__ */ o(
|
|
128
|
+
de,
|
|
129
|
+
{
|
|
130
|
+
items: E ?? [],
|
|
131
|
+
query: "",
|
|
132
|
+
activeIndex: 0,
|
|
133
|
+
initialSource: m ?? void 0,
|
|
134
|
+
onSelect: (e) => {
|
|
135
|
+
r(!1), f(String(e.id));
|
|
136
|
+
},
|
|
137
|
+
onClose: () => r(!1),
|
|
138
|
+
onCreateSubAgent: n ? () => {
|
|
139
|
+
r(!1), n.onSelect();
|
|
140
|
+
} : void 0
|
|
141
|
+
},
|
|
142
|
+
m ?? "__root__"
|
|
143
|
+
) : null;
|
|
144
|
+
return /* @__PURE__ */ i(T, { children: [
|
|
145
|
+
/* @__PURE__ */ i(O, { children: [
|
|
146
|
+
/* @__PURE__ */ o(P, { color: d.content.primary, children: u }),
|
|
147
|
+
U && /* @__PURE__ */ i(ae, { ref: b, children: [
|
|
148
|
+
/* @__PURE__ */ o(
|
|
149
|
+
ee,
|
|
125
150
|
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
children:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
"data-test": `${l}-add`,
|
|
152
|
+
onClick: J,
|
|
153
|
+
"aria-label": `Add ${u}`,
|
|
154
|
+
children: /* @__PURE__ */ o(L, { width: 20, height: 20, color: d.content.brand })
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
t && a && m === null && /* @__PURE__ */ o(N, { "data-test": `${l}-picker`, children: R })
|
|
158
|
+
] })
|
|
159
|
+
] }),
|
|
160
|
+
C && /* @__PURE__ */ o(D, { color: d.content.secondary, children: C }),
|
|
161
|
+
q ? /* @__PURE__ */ i(ue, { ref: t ? b : void 0, children: [
|
|
162
|
+
/* @__PURE__ */ o(oe, { "data-test": `${l}-sources`, children: S?.map((e) => /* @__PURE__ */ i(
|
|
163
|
+
ne,
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
"data-test": `${l}-source-${e.source}`,
|
|
167
|
+
onClick: () => {
|
|
168
|
+
if (t) {
|
|
169
|
+
_(e.source), r(!0);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
v(e.source);
|
|
136
173
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
174
|
+
children: [
|
|
175
|
+
W(ie[e.source], -4),
|
|
176
|
+
/* @__PURE__ */ o(I, { color: d.content.primary, children: e.label })
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
e.source
|
|
180
|
+
)) }),
|
|
181
|
+
t && a && m !== null && /* @__PURE__ */ o(N, { $align: "left", "data-test": `${l}-picker`, children: R }),
|
|
182
|
+
!t && y && /* @__PURE__ */ o(
|
|
183
|
+
x,
|
|
142
184
|
{
|
|
143
|
-
"data-test": `${
|
|
185
|
+
"data-test": `${l}-dropdown`,
|
|
144
186
|
size: "small",
|
|
145
187
|
width: "100%",
|
|
146
188
|
isSearchable: !0,
|
|
147
|
-
placeHolder: `Search ${
|
|
148
|
-
options:
|
|
189
|
+
placeHolder: `Search ${y.label} tools`,
|
|
190
|
+
options: y.options,
|
|
149
191
|
onSelect: (e) => {
|
|
150
|
-
const
|
|
151
|
-
|
|
192
|
+
const c = H(e);
|
|
193
|
+
v(null), r(!1), c && f(c);
|
|
152
194
|
}
|
|
153
195
|
}
|
|
154
196
|
)
|
|
155
|
-
] }) : /* @__PURE__ */
|
|
156
|
-
|
|
157
|
-
|
|
197
|
+
] }) : /* @__PURE__ */ i(B, { children: [
|
|
198
|
+
!t && a && A.length > 0 && /* @__PURE__ */ o(
|
|
199
|
+
x,
|
|
158
200
|
{
|
|
159
|
-
"data-test": `${
|
|
201
|
+
"data-test": `${l}-dropdown`,
|
|
160
202
|
size: "small",
|
|
161
203
|
width: "100%",
|
|
162
204
|
isSearchable: !0,
|
|
163
|
-
placeHolder: `Select ${
|
|
164
|
-
options:
|
|
205
|
+
placeHolder: `Select ${u.toLowerCase()}`,
|
|
206
|
+
options: A,
|
|
165
207
|
onSelect: (e) => {
|
|
166
|
-
const
|
|
167
|
-
|
|
208
|
+
const c = H(e);
|
|
209
|
+
r(!1), c && (c === M ? n?.onSelect() : f(c));
|
|
168
210
|
}
|
|
169
211
|
}
|
|
170
212
|
),
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */ o(
|
|
173
|
-
|
|
174
|
-
|
|
213
|
+
s.length === 0 && !a ? /* @__PURE__ */ i(B, { children: [
|
|
214
|
+
/* @__PURE__ */ o(D, { color: d.content.placeholder, children: F }),
|
|
215
|
+
V && n && /* @__PURE__ */ o(
|
|
216
|
+
se,
|
|
175
217
|
{
|
|
176
|
-
"data-test": `${
|
|
218
|
+
"data-test": `${l}-create`,
|
|
177
219
|
buttonType: "secondary",
|
|
178
220
|
size: "small",
|
|
179
221
|
matchParentWidth: !0,
|
|
180
|
-
LeadingIcon:
|
|
222
|
+
LeadingIcon: L,
|
|
181
223
|
buttonText: n.label,
|
|
182
224
|
onClick: n.onSelect
|
|
183
225
|
}
|
|
184
226
|
)
|
|
185
|
-
] }) :
|
|
227
|
+
] }) : Q()
|
|
186
228
|
] })
|
|
187
229
|
] });
|
|
188
|
-
}
|
|
230
|
+
}, ae = k.div`
|
|
231
|
+
position: relative;
|
|
232
|
+
display: flex;
|
|
233
|
+
`, ue = k.div`
|
|
234
|
+
position: relative;
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
gap: 8px;
|
|
238
|
+
`, N = k.div`
|
|
239
|
+
position: absolute;
|
|
240
|
+
top: calc(100% + 4px);
|
|
241
|
+
${(u) => u.$align === "left" ? "left: 0;" : "right: 0;"}
|
|
242
|
+
z-index: 30;
|
|
243
|
+
`;
|
|
189
244
|
export {
|
|
190
|
-
|
|
245
|
+
_e as SelectableListSection
|
|
191
246
|
};
|
|
192
247
|
//# 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 React, { useState } from 'react';\nimport { Button } from '@src/components/button';\nimport { Dropdown } 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 { SOURCE_ICONS, SourceIcon } from '../utils/sourceIcons';\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}\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}) => {\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\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: addableOptions.length > 0 || (!!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.\n\tconst showEmptyCreate =\n\t\titems.length === 0 && !!createOption && !hasSourceGroups;\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 (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{item.icon &&\n\t\t\t\t\tReact.createElement(item.icon.Icon, {\n\t\t\t\t\t\twidth: item.icon.w,\n\t\t\t\t\t\theight: item.icon.h,\n\t\t\t\t\t})}\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\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<AddIconButton\n\t\t\t\t\t\tdata-test={`${dataTestPrefix}-add`}\n\t\t\t\t\t\tonClick={handleAddClick}\n\t\t\t\t\t\taria-label={`Add ${title}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PlusIcon width={20} height={20} color={COLORS.content.brand} />\n\t\t\t\t\t</AddIconButton>\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<>\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\tconst icon = SOURCE_ICONS[g.source];\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<SourceButton\n\t\t\t\t\t\t\t\t\tkey={g.source}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tdata-test={`${dataTestPrefix}-source-${g.source}`}\n\t\t\t\t\t\t\t\t\tonClick={() => setActiveSource(g.source)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{icon &&\n\t\t\t\t\t\t\t\t\t\tReact.createElement(icon.Icon, {\n\t\t\t\t\t\t\t\t\t\t\twidth: icon.w - 4,\n\t\t\t\t\t\t\t\t\t\t\theight: icon.h - 4,\n\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t\t{g.label}\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t</SourceButton>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</SourceButtonRow>\n\n\t\t\t\t\t{/* Chosen source → its searchable tool list. */}\n\t\t\t\t\t{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 single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\t\t\tconst v = (single as SingleOption)?.value;\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</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{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 single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\t\t\tconst v = (single as SingleOption)?.value;\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"],"names":["CREATE_OPTION_VALUE","SelectableListSection","title","helper","items","addableOptions","onAdd","onRemove","dataTestPrefix","emptyText","createOption","onConfigure","sourceGroups","adding","setAdding","useState","activeSource","setActiveSource","hasSourceGroups","activeGroup","g","showAddButton","showEmptyCreate","showSourceButtons","handleAddClick","v","renderChipRows","item","jsxs","SelectableRow","React","jsx","RowText","BodySecondary","COLORS","RowActions","RowMenuButton","EditIcon","RowActionDivider","DeleteIcon","dropdownOptions","SideSection","SideSectionHeader","TitleSmall","AddIconButton","PlusIcon","BodyCaption","Fragment","SourceButtonRow","icon","SOURCE_ICONS","SourceButton","Dropdown","opt","Button"],"mappings":";;;;;;;;;;;AA0CA,MAAMA,IAAsB,sBAmCfC,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;AACD,MAAM;AACL,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpC,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9DG,IAAkB,CAAC,CAACN,KAAgBA,EAAa,SAAS,GAC1DO,IAAcP,GAAc,KAAK,CAACQ,MAAMA,EAAE,WAAWJ,CAAY,GAMjEK,IAAgBH,IACnBd,EAAM,SAAS,IACfC,EAAe,SAAS,KAAM,CAAC,CAACK,KAAgBN,EAAM,SAAS,GAG5DkB,IACLlB,EAAM,WAAW,KAAK,CAAC,CAACM,KAAgB,CAACQ,GAGpCK,IAAoBL,KAAmBd,EAAM,WAAW,GAExDoB,IAAiB,MAAM;AAC5B,QAAIN,GAAiB;AACpB,MAAAD,EAAgB,IAAI,GACpBH,EAAU,CAACW,MAAM,CAACA,CAAC;AACnB;AAAA,IACD;AACA,QAAIpB,EAAe,WAAW,KAAKK,GAAc;AAChD,MAAAA,EAAa,SAAA;AACb;AAAA,IACD;AACA,IAAAI,EAAU,CAACW,MAAM,CAACA,CAAC;AAAA,EACpB,GAEMC,IAAiB,MACtBtB,EAAM,IAAI,CAACuB,MACV,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MAEA,aAAW,GAAGrB,CAAc,QAAQmB,EAAK,EAAE;AAAA,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;AAAA,MAAA;AAAA,MAIDrB,EAAM,WAAW,KAAK,CAACS,IACvB,gBAAAe,EAAAmB,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAhB,EAACe,GAAA,EAAY,OAAOZ,EAAO,QAAQ,aACjC,UAAAzB,GACF;AAAA,QACCa,KAAmBZ,KACnB,gBAAAqB;AAAA,UAACuB;AAAA,UAAA;AAAA,YACA,aAAW,GAAG9C,CAAc;AAAA,YAC5B,YAAW;AAAA,YACX,MAAK;AAAA,YACL,kBAAgB;AAAA,YAChB,aAAaqC;AAAAA,YACb,YAAYnC,EAAa;AAAA,YACzB,SAASA,EAAa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CAEF,IAEAgB,EAAA;AAAA,IAAe,EAAA,CAEjB;AAAA,EAAA,GAEF;AAEF;"}
|
|
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,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,IAAIF,EAAwB,IAAI,GAC9DG,IAAkB,CAAC,CAACP,KAAgBA,EAAa,SAAS,GAC1DQ,IAAcR,GAAc,KAAK,CAACS,MAAMA,EAAE,WAAWJ,CAAY,GAEjEK,IAAYT,MAAiB,QAC7BU,IAAgBC,EAAuB,IAAI,GAG3C,CAACC,GAAcC,CAAe,IAAIV,EAAwB,IAAI;AAGpE,EAAAW,EAAU,MAAM;AACf,QAAI,CAACL,KAAa,CAACR;AAClB;AAED,UAAMc,IAAi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-19,3 +19,9 @@ export declare const AGENT_CHAR_LIMITS: {
|
|
|
19
19
|
/** Step 4 — "Handover when". */
|
|
20
20
|
readonly handoverWhen: 1000;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Per-field character limits. The consumer can override any subset via
|
|
24
|
+
* `config.charLimits` on {@link AgentBuilder}; unset fields fall back to
|
|
25
|
+
* {@link AGENT_CHAR_LIMITS}.
|
|
26
|
+
*/
|
|
27
|
+
export type AgentCharLimits = Record<keyof typeof AGENT_CHAR_LIMITS, number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charLimits.js","sources":["../../../../../src/components/agent-builder/constants/charLimits.ts"],"sourcesContent":["/**\n * Character limits for AgentBuilder fields.\n *\n * `name` and `description` are taken directly from the Figma spec. The rest are\n * sized to match the 0/1000 counters shown on the response/handover steps; adjust\n * here if product changes them.\n */\nexport const AGENT_CHAR_LIMITS = {\n\t/** Step 1 — Agent name. */\n\tname: 60,\n\t/** Step 1 — \"What it does\". */\n\tdescription: 1000,\n\t/** Step 2 — custom intent free text. */\n\tcustom_intent: 1000,\n\t/** Step 3 — Instructions (BikEditor `maxCharacters`). */\n\tinstructions: 1000,\n\t/** Step 3 — Guardrails. */\n\tguardrail: 1000,\n\t/** Step 4 — \"Handover when\". */\n\thandoverWhen: 1000,\n} as const;\n"],"names":["AGENT_CHAR_LIMITS"],"mappings":"AAOO,MAAMA,IAAoB;AAAA;AAAA,EAEhC,MAAM;AAAA;AAAA,EAEN,aAAa;AAAA;AAAA,EAEb,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAEd,WAAW;AAAA;AAAA,EAEX,cAAc;AACf;"}
|
|
1
|
+
{"version":3,"file":"charLimits.js","sources":["../../../../../src/components/agent-builder/constants/charLimits.ts"],"sourcesContent":["/**\n * Character limits for AgentBuilder fields.\n *\n * `name` and `description` are taken directly from the Figma spec. The rest are\n * sized to match the 0/1000 counters shown on the response/handover steps; adjust\n * here if product changes them.\n */\nexport const AGENT_CHAR_LIMITS = {\n\t/** Step 1 — Agent name. */\n\tname: 60,\n\t/** Step 1 — \"What it does\". */\n\tdescription: 1000,\n\t/** Step 2 — custom intent free text. */\n\tcustom_intent: 1000,\n\t/** Step 3 — Instructions (BikEditor `maxCharacters`). */\n\tinstructions: 1000,\n\t/** Step 3 — Guardrails. */\n\tguardrail: 1000,\n\t/** Step 4 — \"Handover when\". */\n\thandoverWhen: 1000,\n} as const;\n\n/**\n * Per-field character limits. The consumer can override any subset via\n * `config.charLimits` on {@link AgentBuilder}; unset fields fall back to\n * {@link AGENT_CHAR_LIMITS}.\n */\nexport type AgentCharLimits = Record<keyof typeof AGENT_CHAR_LIMITS, number>;\n"],"names":["AGENT_CHAR_LIMITS"],"mappings":"AAOO,MAAMA,IAAoB;AAAA;AAAA,EAEhC,MAAM;AAAA;AAAA,EAEN,aAAa;AAAA;AAAA,EAEb,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAEd,WAAW;AAAA;AAAA,EAEX,cAAc;AACf;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { AgentTool, AgentValue, IntentOption, ModelOption, StepKey, StepValidation, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';
|
|
4
|
+
import { AgentCharLimits } from '../constants/charLimits';
|
|
4
5
|
/** Mention-capable text fields in Step 3 (both store firebase token text). */
|
|
5
6
|
export type MentionFieldKey = 'instructions' | 'guardrail';
|
|
6
7
|
type MentionInsertFn = (kind: 'tool' | 'subagent', id: string, label?: string) => void;
|
|
@@ -57,6 +58,8 @@ export interface AgentBuilderContextShape {
|
|
|
57
58
|
availableModels: ModelOption[];
|
|
58
59
|
/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */
|
|
59
60
|
applicationType?: ApplicationType;
|
|
61
|
+
/** Resolved per-field character limits (consumer overrides merged over defaults). */
|
|
62
|
+
charLimits: AgentCharLimits;
|
|
60
63
|
/** When true, step-rail items are not clickable (Back / Next only). */
|
|
61
64
|
disableStepNavigation: boolean;
|
|
62
65
|
/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */
|
|
@@ -87,6 +90,7 @@ interface ProviderProps {
|
|
|
87
90
|
availableModels: ModelOption[];
|
|
88
91
|
validation?: Partial<StepValidation>;
|
|
89
92
|
applicationType?: ApplicationType;
|
|
93
|
+
charLimits?: Partial<AgentCharLimits>;
|
|
90
94
|
disableStepNavigation?: boolean;
|
|
91
95
|
onCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;
|
|
92
96
|
onFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;
|