@bikdotai/bik-component-library 0.0.849-beta.5 → 0.0.849-beta.6
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/components/ConfigToolPanel.js +10 -10
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -2
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +49 -25
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +9 -8
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js +56 -0
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +5 -10
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +164 -149
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +15 -13
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +199 -165
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +3 -2
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +160 -197
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +26 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js +142 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +13 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +75 -66
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsxs as v, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useMemo as c, useCallback as h } from "react";
|
|
3
|
+
import p from "styled-components";
|
|
4
|
+
import { TitleSmall as k } from "../../TypographyStyle.js";
|
|
5
|
+
import { COLORS as n } from "../../../constants/Theme.js";
|
|
6
|
+
import { buildVariableMentionItems as I, instructionsToEditorHtml as S, variableTokenName as u, buildMentionHtml as m, editorDocToInstructions as T } from "../utils/mentionSerialization.js";
|
|
7
|
+
import { MentionPicker as C } from "./MentionPicker.js";
|
|
8
|
+
import { VariableTriggerArea as M } from "./VariableTriggerArea.js";
|
|
9
|
+
import { BikEditor as E } from "../../../editor/BikEditor.js";
|
|
10
|
+
const H = (l) => u(l).replace(/^variable:/, ""), _ = ({
|
|
11
|
+
value: l,
|
|
12
|
+
onChange: d,
|
|
13
|
+
label: a,
|
|
14
|
+
placeholder: w,
|
|
15
|
+
variablesData: i,
|
|
16
|
+
...f
|
|
17
|
+
}) => {
|
|
18
|
+
const o = y(null), s = c(
|
|
19
|
+
() => I(i),
|
|
20
|
+
[i]
|
|
21
|
+
), g = c(
|
|
22
|
+
() => S(l, s),
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
[]
|
|
25
|
+
), b = h((e) => {
|
|
26
|
+
const r = u(e.actualValue);
|
|
27
|
+
o.current?.insertInlineContent(
|
|
28
|
+
m(r, `{{${r}}}`, "variable")
|
|
29
|
+
);
|
|
30
|
+
}, []), x = h(() => {
|
|
31
|
+
const e = o.current?.getJSON() ?? null;
|
|
32
|
+
d(T(e, []).replace(/\n+/g, ""));
|
|
33
|
+
}, [d]);
|
|
34
|
+
return /* @__PURE__ */ v(O, { children: [
|
|
35
|
+
a && /* @__PURE__ */ t(k, { color: n.content.primary, children: a }),
|
|
36
|
+
/* @__PURE__ */ t(
|
|
37
|
+
M,
|
|
38
|
+
{
|
|
39
|
+
variablesData: i,
|
|
40
|
+
addDataButton: !0,
|
|
41
|
+
skipNativeBoundaries: !0,
|
|
42
|
+
onInsert: (e) => {
|
|
43
|
+
const r = H(e);
|
|
44
|
+
o.current?.insertInlineContent(
|
|
45
|
+
m(r, `{{${r}}}`, "variable")
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
children: /* @__PURE__ */ t(V, { "data-test": f["data-test"], children: /* @__PURE__ */ t(
|
|
49
|
+
E,
|
|
50
|
+
{
|
|
51
|
+
ref: o,
|
|
52
|
+
initialContent: g,
|
|
53
|
+
placeholder: w,
|
|
54
|
+
minHeight: "20px",
|
|
55
|
+
maxHeight: "20px",
|
|
56
|
+
style: { border: "none" },
|
|
57
|
+
editorStyle: N,
|
|
58
|
+
onSend: () => {
|
|
59
|
+
},
|
|
60
|
+
sendShortcut: { key: "Enter" },
|
|
61
|
+
mentions: {
|
|
62
|
+
agents: s,
|
|
63
|
+
removeTriggerOnDismiss: !0,
|
|
64
|
+
renderDropdown: (e) => /* @__PURE__ */ t(
|
|
65
|
+
C,
|
|
66
|
+
{
|
|
67
|
+
...e,
|
|
68
|
+
variablesData: i,
|
|
69
|
+
onSelectVariable: b
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
onChange: x
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
79
|
+
}, N = {
|
|
80
|
+
padding: 0,
|
|
81
|
+
fontFamily: "Inter",
|
|
82
|
+
fontSize: "14px",
|
|
83
|
+
lineHeight: "20px"
|
|
84
|
+
}, O = p.div`
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: 4px;
|
|
88
|
+
width: 100%;
|
|
89
|
+
/* In a flex row (header key/value pairs) share the space and allow
|
|
90
|
+
shrinking below content width — long values scroll inside the field
|
|
91
|
+
instead of widening the row / drawer. */
|
|
92
|
+
flex: 1 1 0%;
|
|
93
|
+
min-width: 0;
|
|
94
|
+
`, V = p.div`
|
|
95
|
+
/* No global reset in every host — without this, width:100% + padding
|
|
96
|
+
overflows the drawer by the padding + border (the reported overflow). */
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
width: 100%;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
padding: 6px 12px;
|
|
104
|
+
background: ${n.surface.standard};
|
|
105
|
+
border: 1px solid ${n.stroke.primary};
|
|
106
|
+
border-radius: 4px;
|
|
107
|
+
|
|
108
|
+
/* The editor root is width:100% — cap it so a long value scrolls inside
|
|
109
|
+
the ProseMirror line rather than stretching the shell. */
|
|
110
|
+
> div {
|
|
111
|
+
width: 100%;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:focus-within {
|
|
116
|
+
border-color: ${n.stroke.brand};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Keep the editor to one visual line; long values scroll horizontally the
|
|
120
|
+
way a native input does. */
|
|
121
|
+
.ProseMirror {
|
|
122
|
+
width: 100%;
|
|
123
|
+
max-width: 100%;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
overflow-x: auto;
|
|
126
|
+
overflow-y: hidden;
|
|
127
|
+
word-break: normal;
|
|
128
|
+
scrollbar-width: none;
|
|
129
|
+
|
|
130
|
+
&::-webkit-scrollbar {
|
|
131
|
+
display: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.ProseMirror p {
|
|
136
|
+
display: inline;
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
export {
|
|
140
|
+
_ as VariableInlineField
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=VariableInlineField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariableInlineField.js","sources":["../../../../../src/components/agent-builder/components/VariableInlineField.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef } from '@src/editor';\nimport React, { useCallback, useMemo, useRef } from 'react';\nimport styled from 'styled-components';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type {\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport {\n\tbuildMentionHtml,\n\tbuildVariableMentionItems,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tvariableTokenName,\n} from '../utils/mentionSerialization';\nimport { MentionPicker } from './MentionPicker';\nimport { VariableTriggerArea } from './VariableTriggerArea';\n\ninterface VariableInlineFieldProps {\n\t/** Stored string, `{{variable:<name>}}` tokens inline (e.g. a URL). */\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tlabel?: string;\n\tplaceholder?: string;\n\t/** Variable catalog. Absent / empty → behaves as a plain single-line input. */\n\tvariablesData?: VariableListInterfaceV3[];\n\t'data-test'?: string;\n}\n\n/** `{{variable:a.b}}` / `{{a.b}}` → `a.b`. */\nconst nameOf = (token: string): string =>\n\tvariableTokenName(token).replace(/^variable:/, '');\n\n/**\n * Single-line text field whose `{{variable:<name>}}` tokens render as the\n * SAME purple `{{<name>}}` chips as the Instructions / Guardrails editors —\n * BikEditor under the hood, styled like the small `Input`. Used for tool\n * params that mix free text with variables (Request URL, header values).\n *\n * `@` opens the variable panel: after whitespace / at the start via the\n * editor's native mention trigger, after URL/JSON delimiters (`https://@`)\n * via the {@link VariableTriggerArea} wrapper — both render the same\n * {@link MentionPicker}. Enter is swallowed (single-line), and any pasted\n * newlines are dropped on serialize.\n */\nexport const VariableInlineField: React.FC<VariableInlineFieldProps> = ({\n\tvalue,\n\tonChange,\n\tlabel,\n\tplaceholder,\n\tvariablesData,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\n\tconst mentionItems = useMemo(\n\t\t() => buildVariableMentionItems(variablesData),\n\t\t[variablesData],\n\t);\n\n\t// Mount-only initial HTML — the field is uncontrolled after mount (the\n\t// drawers key their fields per open, so `value` is fresh when it matters).\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[],\n\t);\n\n\t// Insert the purple `{{<name>}}` chip; serialization emits the stored\n\t// `{{variable:<name>}}` token (same path as the instructions editors).\n\tconst insertChip = useCallback((variable: VariableV3) => {\n\t\tconst name = variableTokenName(variable.actualValue);\n\t\teditorRef.current?.insertInlineContent(\n\t\t\tbuildMentionHtml(name, `{{${name}}}`, 'variable'),\n\t\t);\n\t}, []);\n\n\tconst emitChange = useCallback(() => {\n\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t// Single-line: pasted newlines have no meaning in a URL / header value.\n\t\tonChange(editorDocToInstructions(doc, []).replace(/\\n+/g, ''));\n\t}, [onChange]);\n\n\treturn (\n\t\t<FieldBlockCol>\n\t\t\t{label && <TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>}\n\t\t\t<VariableTriggerArea\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\taddDataButton\n\t\t\t\tskipNativeBoundaries\n\t\t\t\tonInsert={(token) => {\n\t\t\t\t\tconst name = nameOf(token);\n\t\t\t\t\teditorRef.current?.insertInlineContent(\n\t\t\t\t\t\tbuildMentionHtml(name, `{{${name}}}`, 'variable'),\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<InputShell data-test={rest['data-test']}>\n\t\t\t\t\t<BikEditor\n\t\t\t\t\t\tref={editorRef}\n\t\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tminHeight=\"20px\"\n\t\t\t\t\t\tmaxHeight=\"20px\"\n\t\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\t\teditorStyle={INLINE_EDITOR_STYLE}\n\t\t\t\t\t\t// Single-line: Enter is a no-op \"send\".\n\t\t\t\t\t\tonSend={() => undefined}\n\t\t\t\t\t\tsendShortcut={{ key: 'Enter' }}\n\t\t\t\t\t\tmentions={{\n\t\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t\t\t\tonSelectVariable={insertChip}\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\tonChange={emitChange}\n\t\t\t\t\t/>\n\t\t\t\t</InputShell>\n\t\t\t</VariableTriggerArea>\n\t\t</FieldBlockCol>\n\t);\n};\n\nconst INLINE_EDITOR_STYLE: React.CSSProperties = {\n\tpadding: 0,\n\tfontFamily: 'Inter',\n\tfontSize: '14px',\n\tlineHeight: '20px',\n};\n\nconst FieldBlockCol = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\twidth: 100%;\n\t/* In a flex row (header key/value pairs) share the space and allow\n\t shrinking below content width — long values scroll inside the field\n\t instead of widening the row / drawer. */\n\tflex: 1 1 0%;\n\tmin-width: 0;\n`;\n\n// Mirrors the small Input's box (border, radius, padding, focus ring) around\n// the single-line editor.\nconst InputShell = styled.div`\n\t/* No global reset in every host — without this, width:100% + padding\n\t overflows the drawer by the padding + border (the reported overflow). */\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\talign-items: center;\n\twidth: 100%;\n\tmin-width: 0;\n\toverflow: hidden;\n\tpadding: 6px 12px;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\n\t/* The editor root is width:100% — cap it so a long value scrolls inside\n\t the ProseMirror line rather than stretching the shell. */\n\t> div {\n\t\twidth: 100%;\n\t\tmin-width: 0;\n\t}\n\n\t&:focus-within {\n\t\tborder-color: ${COLORS.stroke.brand};\n\t}\n\n\t/* Keep the editor to one visual line; long values scroll horizontally the\n\t way a native input does. */\n\t.ProseMirror {\n\t\twidth: 100%;\n\t\tmax-width: 100%;\n\t\twhite-space: nowrap;\n\t\toverflow-x: auto;\n\t\toverflow-y: hidden;\n\t\tword-break: normal;\n\t\tscrollbar-width: none;\n\n\t\t&::-webkit-scrollbar {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t.ProseMirror p {\n\t\tdisplay: inline;\n\t}\n`;\n"],"names":["nameOf","token","variableTokenName","VariableInlineField","value","onChange","label","placeholder","variablesData","rest","editorRef","useRef","mentionItems","useMemo","buildVariableMentionItems","initialHtml","instructionsToEditorHtml","insertChip","useCallback","variable","name","buildMentionHtml","emitChange","doc","editorDocToInstructions","FieldBlockCol","TitleSmall","COLORS","jsx","VariableTriggerArea","InputShell","BikEditor","INLINE_EDITOR_STYLE","props","MentionPicker","styled"],"mappings":";;;;;;;;;AA+BA,MAAMA,IAAS,CAACC,MACfC,EAAkBD,CAAK,EAAE,QAAQ,cAAc,EAAE,GAcrCE,IAA0D,CAAC;AAAA,EACvE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAMC,IAAYC,EAAqB,IAAI,GAErCC,IAAeC;AAAA,IACpB,MAAMC,EAA0BN,CAAa;AAAA,IAC7C,CAACA,CAAa;AAAA,EAAA,GAKTO,IAAcF;AAAA,IACnB,MAAMG,EAAyBZ,GAAOQ,CAAY;AAAA;AAAA,IAElD,CAAA;AAAA,EAAC,GAKIK,IAAaC,EAAY,CAACC,MAAyB;AACxD,UAAMC,IAAOlB,EAAkBiB,EAAS,WAAW;AACnD,IAAAT,EAAU,SAAS;AAAA,MA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UAAA;AAAA,QAAA,EACX,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EACD,GACD;AAEF,GAEMU,IAA2C;AAAA,EAChD,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YAAY;AACb,GAEMP,IAAgBU,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAcvBL,IAAaK,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAUXR,EAAO,QAAQ,QAAQ;AAAA,qBACjBA,EAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAWxBA,EAAO,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -26,6 +26,19 @@ interface VariableTriggerAreaProps {
|
|
|
26
26
|
* button equivalent of typing `@`.
|
|
27
27
|
*/
|
|
28
28
|
addDataButton?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The wrapped field is a BikEditor whose OWN `@` mention trigger already
|
|
31
|
+
* fires after whitespace / at the start — this wrapper then only handles
|
|
32
|
+
* the delimiter boundaries the native trigger misses (`https://@`, `"@`…),
|
|
33
|
+
* so the two never open a panel for the same keystroke.
|
|
34
|
+
*/
|
|
35
|
+
skipNativeBoundaries?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Observes the panel's open state. Fields that commit on blur (the email
|
|
38
|
+
* chips entry) use this to hold off while focus is bouncing through the
|
|
39
|
+
* panel — blur-time focus targets are unreliable mid-transition.
|
|
40
|
+
*/
|
|
41
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
42
|
children: React.ReactNode;
|
|
30
43
|
}
|
|
31
44
|
/**
|
|
@@ -1,102 +1,116 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import { COLORS as h } from "../../../constants/Theme.js";
|
|
5
|
-
import { PickerType as F } from "../../variable-picker-v3/model.js";
|
|
1
|
+
import { jsxs as F, jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as B, useState as k, useCallback as $, useEffect as A } from "react";
|
|
3
|
+
import T from "styled-components";
|
|
6
4
|
import { variableTokenName as L } from "../utils/mentionSerialization.js";
|
|
7
|
-
import { AddDataPill as
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
5
|
+
import { AddDataPill as N } from "./AddDataPill.js";
|
|
6
|
+
import { MentionPicker as P } from "./MentionPicker.js";
|
|
7
|
+
const S = (t) => `{{variable:${L(t.actualValue)}}}`, E = /[\s,;:/?&=({[<"']/, C = /[,;:/?&=({[<"']/, R = (t, f, a) => {
|
|
10
8
|
if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) {
|
|
11
|
-
const
|
|
9
|
+
const c = t.selectionStart ?? t.value.length, u = c === 0, g = u ? " " : t.value[c - 1] ?? " ";
|
|
12
10
|
return {
|
|
13
|
-
ok:
|
|
14
|
-
caret:
|
|
15
|
-
textBefore: t.value.slice(0,
|
|
11
|
+
ok: u ? !a : f.test(g),
|
|
12
|
+
caret: c,
|
|
13
|
+
textBefore: t.value.slice(0, c)
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
|
-
const
|
|
16
|
+
const d = window.getSelection(), i = d?.anchorNode?.textContent ?? "", r = d?.anchorOffset ?? 0, p = r === 0, l = p ? " " : i[r - 1] ?? " ";
|
|
19
17
|
return {
|
|
20
|
-
ok:
|
|
18
|
+
ok: p ? !a : f.test(l),
|
|
21
19
|
caret: null,
|
|
22
|
-
textBefore:
|
|
20
|
+
textBefore: i.slice(0, r)
|
|
23
21
|
};
|
|
24
|
-
},
|
|
22
|
+
}, W = ({
|
|
25
23
|
variablesData: t,
|
|
26
|
-
onInsert:
|
|
27
|
-
transformToken:
|
|
28
|
-
addDataButton:
|
|
29
|
-
|
|
24
|
+
onInsert: f,
|
|
25
|
+
transformToken: a,
|
|
26
|
+
addDataButton: d,
|
|
27
|
+
skipNativeBoundaries: i,
|
|
28
|
+
onOpenChange: r,
|
|
29
|
+
children: p
|
|
30
30
|
}) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const l = B(null), [c, u] = k(!1), g = B(null), [n, w] = k(null), v = (t?.length ?? 0) > 0, b = (e) => {
|
|
32
|
+
w(e), r?.(!0);
|
|
33
|
+
}, m = () => {
|
|
34
|
+
w(null), r?.(!1);
|
|
35
|
+
}, h = () => {
|
|
36
|
+
const e = l.current?.getBoundingClientRect();
|
|
33
37
|
return {
|
|
34
38
|
above: !!e && window.innerHeight - e.bottom < 340,
|
|
35
39
|
alignRight: !!e && window.innerWidth - e.left < 360
|
|
36
40
|
};
|
|
37
|
-
}, y =
|
|
41
|
+
}, y = $(
|
|
38
42
|
(e) => {
|
|
39
|
-
if (!
|
|
43
|
+
if (!v || e.key !== "@")
|
|
40
44
|
return;
|
|
41
|
-
const o =
|
|
42
|
-
|
|
45
|
+
const o = R(
|
|
46
|
+
e.target,
|
|
47
|
+
i ? C : E,
|
|
48
|
+
!!i
|
|
49
|
+
);
|
|
50
|
+
o.ok && (e.preventDefault(), e.stopPropagation(), b({
|
|
43
51
|
caret: o.caret,
|
|
44
52
|
textBefore: o.textBefore,
|
|
45
|
-
...
|
|
53
|
+
...h()
|
|
46
54
|
}));
|
|
47
55
|
},
|
|
48
56
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
-
[
|
|
50
|
-
),
|
|
51
|
-
const e =
|
|
52
|
-
|
|
57
|
+
[v]
|
|
58
|
+
), D = () => {
|
|
59
|
+
const e = R(g.current, E, !1);
|
|
60
|
+
b({
|
|
53
61
|
caret: e.caret,
|
|
54
62
|
textBefore: e.textBefore,
|
|
55
|
-
...
|
|
63
|
+
...h()
|
|
56
64
|
});
|
|
57
65
|
};
|
|
58
|
-
return
|
|
59
|
-
if (!
|
|
66
|
+
return A(() => {
|
|
67
|
+
if (!n)
|
|
60
68
|
return;
|
|
61
69
|
const e = (s) => {
|
|
62
|
-
s.key === "Escape" && (s.stopPropagation(),
|
|
70
|
+
s.key === "Escape" && (s.stopPropagation(), m());
|
|
63
71
|
}, o = (s) => {
|
|
64
|
-
|
|
72
|
+
l.current?.contains(s.target) || m();
|
|
65
73
|
};
|
|
66
74
|
return document.addEventListener("keydown", e, !0), document.addEventListener("mousedown", o), () => {
|
|
67
75
|
document.removeEventListener("keydown", e, !0), document.removeEventListener("mousedown", o);
|
|
68
76
|
};
|
|
69
|
-
}, [
|
|
70
|
-
|
|
77
|
+
}, [n]), /* @__PURE__ */ F(
|
|
78
|
+
M,
|
|
71
79
|
{
|
|
72
|
-
ref:
|
|
80
|
+
ref: l,
|
|
73
81
|
onKeyDownCapture: y,
|
|
74
82
|
onFocus: (e) => {
|
|
75
83
|
e.target.closest?.(
|
|
76
84
|
'[data-test="variable-trigger-panel"]'
|
|
77
|
-
) || (g.current = e.target,
|
|
85
|
+
) || (g.current = e.target, u(!0));
|
|
78
86
|
},
|
|
79
|
-
onBlur: () =>
|
|
87
|
+
onBlur: () => u(!1),
|
|
80
88
|
children: [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
p,
|
|
90
|
+
d && v && (c || n) && /* @__PURE__ */ x(N, { onOpen: D }),
|
|
91
|
+
n && /* @__PURE__ */ x(
|
|
92
|
+
O,
|
|
85
93
|
{
|
|
86
|
-
$above:
|
|
87
|
-
$right:
|
|
94
|
+
$above: n.above,
|
|
95
|
+
$right: n.alignRight,
|
|
88
96
|
"data-test": "variable-trigger-panel",
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
onMouseDown: (e) => {
|
|
98
|
+
e.target.closest("input") || e.preventDefault();
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ x(
|
|
101
|
+
P,
|
|
91
102
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
items: [],
|
|
104
|
+
query: "",
|
|
105
|
+
activeIndex: -1,
|
|
106
|
+
onSelect: () => {
|
|
107
|
+
},
|
|
108
|
+
onClose: m,
|
|
109
|
+
variablesData: t,
|
|
110
|
+
onSelectVariable: (e) => {
|
|
111
|
+
m();
|
|
112
|
+
const o = S(e), s = a ? a(o, { textBefore: n.textBefore }) : o;
|
|
113
|
+
f(s, n.caret);
|
|
100
114
|
}
|
|
101
115
|
}
|
|
102
116
|
)
|
|
@@ -105,22 +119,17 @@ const A = (t) => `{{variable:${L(t.actualValue)}}}`, w = /[\s,;:/?&=(){}[\]"'<>]
|
|
|
105
119
|
]
|
|
106
120
|
}
|
|
107
121
|
);
|
|
108
|
-
},
|
|
122
|
+
}, M = T.div`
|
|
109
123
|
position: relative;
|
|
110
|
-
`,
|
|
124
|
+
`, O = T.div`
|
|
111
125
|
position: absolute;
|
|
112
126
|
z-index: 1000;
|
|
113
127
|
width: 344px;
|
|
114
|
-
background: ${h.surface.standard};
|
|
115
|
-
border: 1px solid ${h.stroke.primary};
|
|
116
|
-
border-radius: 4px;
|
|
117
|
-
box-shadow: 0px -2px 8px 0px #0000001f;
|
|
118
|
-
overflow: hidden;
|
|
119
128
|
${(t) => t.$right ? "right: 0;" : "left: 0;"}
|
|
120
129
|
${(t) => t.$above ? "bottom: calc(100% + 4px);" : "top: calc(100% + 4px);"}
|
|
121
130
|
`;
|
|
122
131
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
W as VariableTriggerArea,
|
|
133
|
+
S as variableToken
|
|
125
134
|
};
|
|
126
135
|
//# sourceMappingURL=VariableTriggerArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableTriggerArea.js","sources":["../../../../../src/components/agent-builder/components/VariableTriggerArea.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariablePicker } from '../../variable-picker-v3';\nimport { PickerType } from '../../variable-picker-v3/model';\nimport type {\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport { variableTokenName } from '../utils/mentionSerialization';\nimport { AddDataPill } from './AddDataPill';\n\n/** The persisted form of a picked variable (`{{variable:<name>}}`). */\nexport const variableToken = (variable: VariableV3): string =>\n\t`{{variable:${variableTokenName(variable.actualValue)}}}`;\n\n/**\n * Boundary test for the `@` trigger: an `@` typed at the start of the field or\n * after a separator opens the picker. The separator set covers URL and JSON\n * delimiters too (`https://@`, `Bearer=@`, `\"@`, `[@`) — an email address's `@`\n * always follows a letter / digit / dot, so `john@acme.com` still types\n * through untouched. Returns the caret index for input / textarea targets\n * (where the caller can splice the token in), null for contenteditable ones.\n */\nconst BOUNDARY = /[\\s,;:/?&=(){}[\\]\"'<>]/;\n\nconst triggerContext = (\n\ttarget: EventTarget | null,\n): { ok: boolean; caret: number | null; textBefore: string } => {\n\tif (\n\t\ttarget instanceof HTMLInputElement ||\n\t\ttarget instanceof HTMLTextAreaElement\n\t) {\n\t\tconst caret = target.selectionStart ?? target.value.length;\n\t\tconst prev = caret === 0 ? ' ' : target.value[caret - 1] ?? ' ';\n\t\treturn {\n\t\t\tok: BOUNDARY.test(prev),\n\t\t\tcaret,\n\t\t\ttextBefore: target.value.slice(0, caret),\n\t\t};\n\t}\n\t// Rich editor (ProseMirror contenteditable): read the character before the\n\t// selection. `textBefore` is only the current text-node fragment (fine for\n\t// the token transforms, which just look at nearby characters).\n\tconst sel = window.getSelection();\n\tconst text = sel?.anchorNode?.textContent ?? '';\n\tconst offset = sel?.anchorOffset ?? 0;\n\tconst prev = offset === 0 ? ' ' : text[offset - 1] ?? ' ';\n\treturn {\n\t\tok: BOUNDARY.test(prev),\n\t\tcaret: null,\n\t\ttextBefore: text.slice(0, offset),\n\t};\n};\n\ninterface VariableTriggerAreaProps {\n\t/** Variable catalog. Absent / empty → the wrapper is inert (children only). */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/**\n\t * Insert `token` into the wrapped field. `caret` is the character index the\n\t * `@` was typed at (input / textarea targets — splice the token in there);\n\t * null for rich-editor targets (insert at the editor's own cursor).\n\t */\n\tonInsert: (token: string, caret: number | null) => void;\n\t/**\n\t * Rewrite the token before it's handed to `onInsert` — e.g. the Rest API\n\t * JSON editors wrap it in quotes. `textBefore` is the text preceding the\n\t * `@` (for input targets the whole value up to the caret; for rich-editor\n\t * targets just the current text-node fragment).\n\t */\n\ttransformToken?: (token: string, ctx: { textBefore: string }) => string;\n\t/**\n\t * Show the floating \"+ Add data\" pill while the wrapped field is focused.\n\t * Clicking it opens this same variable panel at the field's caret — the\n\t * button equivalent of typing `@`.\n\t */\n\taddDataButton?: boolean;\n\tchildren: React.ReactNode;\n}\n\n/**\n * Wraps any plain field (input / textarea / chips entry / BikEditor) and opens\n * the shared {@link VariablePicker} as a floating panel when `@` is typed at a\n * word boundary. The `@` keystroke itself is swallowed (never reaches the\n * field); picking a variable calls `onInsert` with the `{{variable:<name>}}`\n * token, and Escape / click-outside / the panel's ✕ just closes the panel.\n *\n * Purely presentational wrapper — it renders a `position: relative` block, so\n * the wrapped field must be happy inside a plain block container.\n */\nexport const VariableTriggerArea: React.FC<VariableTriggerAreaProps> = ({\n\tvariablesData,\n\tonInsert,\n\ttransformToken,\n\taddDataButton,\n\tchildren,\n}) => {\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\t// Whether the wrapped field (any focusable inside) currently has focus, and\n\t// the element that had it — the pill inserts at that element's caret.\n\tconst [fieldFocused, setFieldFocused] = useState(false);\n\tconst lastFocusedRef = useRef<EventTarget | null>(null);\n\t// Non-null while the panel is open: where to put the token when picked, and\n\t// which way the panel flips to stay on screen (above when there's no room\n\t// below, right-aligned when the field sits too close to the right edge —\n\t// e.g. header-value inputs in the Rest API drawer).\n\tconst [trigger, setTrigger] = useState<{\n\t\tcaret: number | null;\n\t\ttextBefore: string;\n\t\tabove: boolean;\n\t\talignRight: boolean;\n\t} | null>(null);\n\n\tconst enabled = (variablesData?.length ?? 0) > 0;\n\n\t// Panel is ~344px wide / ~340px tall, anchored to the field's left edge —\n\t// flip above / right-align when it would spill past the viewport (avoids\n\t// the drawer growing scrollbars).\n\tconst placement = () => {\n\t\tconst rect = containerRef.current?.getBoundingClientRect();\n\t\treturn {\n\t\t\tabove: !!rect && window.innerHeight - rect.bottom < 340,\n\t\t\talignRight: !!rect && window.innerWidth - rect.left < 360,\n\t\t};\n\t};\n\n\tconst onKeyDownCapture = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (!enabled || e.key !== '@') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ctx = triggerContext(e.target);\n\t\t\tif (!ctx.ok) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Swallow the `@` so the field's value stays untouched while picking.\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tsetTrigger({\n\t\t\t\tcaret: ctx.caret,\n\t\t\t\ttextBefore: ctx.textBefore,\n\t\t\t\t...placement(),\n\t\t\t});\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[enabled],\n\t);\n\n\t// The pill's click — same panel, anchored at the focused field's caret (no\n\t// boundary rule: an explicit button click is always intentional).\n\tconst openFromButton = () => {\n\t\tconst ctx = triggerContext(lastFocusedRef.current);\n\t\tsetTrigger({\n\t\t\tcaret: ctx.caret,\n\t\t\ttextBefore: ctx.textBefore,\n\t\t\t...placement(),\n\t\t});\n\t};\n\n\t// Escape / click-outside dismiss, active only while open.\n\tuseEffect(() => {\n\t\tif (!trigger) {\n\t\t\treturn;\n\t\t}\n\t\tconst onKey = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\te.stopPropagation();\n\t\t\t\tsetTrigger(null);\n\t\t\t}\n\t\t};\n\t\tconst onDown = (e: MouseEvent) => {\n\t\t\tif (!containerRef.current?.contains(e.target as Node)) {\n\t\t\t\tsetTrigger(null);\n\t\t\t}\n\t\t};\n\t\t// Capture phase so an Escape meant for the panel never also closes the\n\t\t// drawer underneath.\n\t\tdocument.addEventListener('keydown', onKey, true);\n\t\tdocument.addEventListener('mousedown', onDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('keydown', onKey, true);\n\t\t\tdocument.removeEventListener('mousedown', onDown);\n\t\t};\n\t}, [trigger]);\n\n\treturn (\n\t\t<TriggerWrap\n\t\t\tref={containerRef}\n\t\t\tonKeyDownCapture={onKeyDownCapture}\n\t\t\t// React's focus/blur bubble — this tracks any focusable child (the\n\t\t\t// input, a chips entry, the ProseMirror contenteditable).\n\t\t\tonFocus={(e) => {\n\t\t\t\t// Focus landing inside the floating panel (its search box) is not\n\t\t\t\t// the field — inserting at \"its caret\" would target the wrong input.\n\t\t\t\tif (\n\t\t\t\t\t(e.target as HTMLElement).closest?.(\n\t\t\t\t\t\t'[data-test=\"variable-trigger-panel\"]',\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlastFocusedRef.current = e.target;\n\t\t\t\tsetFieldFocused(true);\n\t\t\t}}\n\t\t\tonBlur={() => setFieldFocused(false)}\n\t\t>\n\t\t\t{children}\n\t\t\t{addDataButton && enabled && (fieldFocused || trigger) && (\n\t\t\t\t<AddDataPill onOpen={openFromButton} />\n\t\t\t)}\n\t\t\t{trigger && (\n\t\t\t\t<FloaterBox\n\t\t\t\t\t$above={trigger.above}\n\t\t\t\t\t$right={trigger.alignRight}\n\t\t\t\t\tdata-test=\"variable-trigger-panel\"\n\t\t\t\t>\n\t\t\t\t\t<VariablePicker\n\t\t\t\t\t\ttype={PickerType.FLOATER}\n\t\t\t\t\t\tdata={variablesData ?? []}\n\t\t\t\t\t\tshowRecommendedBar={false}\n\t\t\t\t\t\tonClose={() => setTrigger(null)}\n\t\t\t\t\t\tonSelect={(variable: VariableV3) => {\n\t\t\t\t\t\t\tsetTrigger(null);\n\t\t\t\t\t\t\tconst raw = variableToken(variable);\n\t\t\t\t\t\t\tconst token = transformToken\n\t\t\t\t\t\t\t\t? transformToken(raw, { textBefore: trigger.textBefore })\n\t\t\t\t\t\t\t\t: raw;\n\t\t\t\t\t\t\tonInsert(token, trigger.caret);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</FloaterBox>\n\t\t\t)}\n\t\t</TriggerWrap>\n\t);\n};\n\nconst TriggerWrap = styled.div`\n\tposition: relative;\n`;\n\n// Floats under (or over) the wrapped field. The picker is EMBEDDED (no close\n// cross — Escape / click-outside dismiss instead, matching the Instructions /\n// Guardrails @ menu), so this box provides the card chrome the mention picker\n// normally would. High z-index: these fields live inside side-modal drawers.\nconst FloaterBox = styled.div<{ $above: boolean; $right: boolean }>`\n\tposition: absolute;\n\tz-index: 1000;\n\twidth: 344px;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbox-shadow: 0px -2px 8px 0px #0000001f;\n\toverflow: hidden;\n\t${(p) => (p.$right ? 'right: 0;' : 'left: 0;')}\n\t${(p) => (p.$above ? 'bottom: calc(100% + 4px);' : 'top: calc(100% + 4px);')}\n`;\n"],"names":["variableToken","variable","variableTokenName","BOUNDARY","triggerContext","target","caret","prev","sel","text","offset","VariableTriggerArea","variablesData","onInsert","transformToken","addDataButton","children","containerRef","useRef","fieldFocused","setFieldFocused","useState","lastFocusedRef","trigger","setTrigger","enabled","placement","rect","onKeyDownCapture","useCallback","ctx","openFromButton","useEffect","onKey","e","onDown","jsxs","TriggerWrap","jsx","AddDataPill","FloaterBox","VariablePicker","PickerType","raw","token","styled","COLORS","p"],"mappings":";;;;;;;;AAaO,MAAMA,IAAgB,CAACC,MAC7B,cAAcC,EAAkBD,EAAS,WAAW,CAAC,MAUhDE,IAAW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AAAe,EAACC,GAAA,EAAY,QAAQR,GAAgB;AAAA,QAErCR,KACA,gBAAAe;AAAA,UAACE;AAAA,UAAA;AAAA,YACA,QAAQjB,EAAQ;AAAA,YAChB,QAAQA,EAAQ;AAAA,YAChB,aAAU;AAAA,YAEV,UAAA,gBAAAe;AAAA,cAACG;AAAA,cAAA;AAAA,gBACA,MAAMC,EAAW;AAAA,gBACjB,MAAM9B,KAAiB,CAAA;AAAA,gBACvB,oBAAoB;AAAA,gBACpB,SAAS,MAAMY,EAAW,IAAI;AAAA,gBAC9B,UAAU,CAACvB,MAAyB;AACnC,kBAAAuB,EAAW,IAAI;AACf,wBAAMmB,IAAM3C,EAAcC,CAAQ,GAC5B2C,IAAQ9B,IACXA,EAAe6B,GAAK,EAAE,YAAYpB,EAAQ,WAAA,CAAY,IACtDoB;AACH,kBAAA9B,EAAS+B,GAAOrB,EAAQ,KAAK;AAAA,gBAC9B;AAAA,cAAA;AAAA,YAAA;AAAA,UACD;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ,GAEMc,IAAcQ,EAAO;AAAA;AAAA,GAQrBL,IAAaK,EAAO;AAAA;AAAA;AAAA;AAAA,eAIXC,EAAO,QAAQ,QAAQ;AAAA,qBACjBA,EAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,GAIvC,CAACC,MAAOA,EAAE,SAAS,cAAc,UAAW;AAAA,GAC5C,CAACA,MAAOA,EAAE,SAAS,8BAA8B,wBAAyB;AAAA;"}
|
|
1
|
+
{"version":3,"file":"VariableTriggerArea.js","sources":["../../../../../src/components/agent-builder/components/VariableTriggerArea.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport type {\n\tVariableListInterfaceV3,\n\tVariableV3,\n} from '../../variable-picker-v3/model';\nimport { variableTokenName } from '../utils/mentionSerialization';\nimport { AddDataPill } from './AddDataPill';\nimport { MentionPicker } from './MentionPicker';\n\n/** The persisted form of a picked variable (`{{variable:<name>}}`). */\nexport const variableToken = (variable: VariableV3): string =>\n\t`{{variable:${variableTokenName(variable.actualValue)}}}`;\n\n/**\n * Boundary test for the `@` trigger: an `@` typed at the start of the field or\n * after a separator opens the picker. The separator set covers URL and JSON\n * delimiters too (`https://@`, `Bearer=@`, `\"@`, `[@`) — an email address's `@`\n * always follows a letter / digit / dot, so `john@acme.com` still types\n * through untouched. Returns the caret index for input / textarea targets\n * (where the caller can splice the token in), null for contenteditable ones.\n */\n// Opening delimiters trigger; closing ones (`}` `)` `]` `>`) deliberately do\n// NOT — typing a literal `@` right after an inserted `{{token}}` (e.g.\n// `{{store_name}}@acme.com`) must stay literal.\nconst BOUNDARY = /[\\s,;:/?&=({[<\"']/;\n// The subset the editor's own `@` mention trigger does NOT handle (it only\n// fires after whitespace / at the start) — used by `skipNativeBoundaries`\n// fields so the two triggers never fire for the same keystroke.\nconst NON_NATIVE_BOUNDARY = /[,;:/?&=({[<\"']/;\n\nconst triggerContext = (\n\ttarget: EventTarget | null,\n\tboundary: RegExp,\n\tskipStart: boolean,\n): { ok: boolean; caret: number | null; textBefore: string } => {\n\tif (\n\t\ttarget instanceof HTMLInputElement ||\n\t\ttarget instanceof HTMLTextAreaElement\n\t) {\n\t\tconst caret = target.selectionStart ?? target.value.length;\n\t\tconst atStart = caret === 0;\n\t\tconst prev = atStart ? ' ' : target.value[caret - 1] ?? ' ';\n\t\treturn {\n\t\t\tok: atStart ? !skipStart : boundary.test(prev),\n\t\t\tcaret,\n\t\t\ttextBefore: target.value.slice(0, caret),\n\t\t};\n\t}\n\t// Rich editor (ProseMirror contenteditable): read the character before the\n\t// selection. `textBefore` is only the current text-node fragment (fine for\n\t// the token transforms, which just look at nearby characters).\n\tconst sel = window.getSelection();\n\tconst text = sel?.anchorNode?.textContent ?? '';\n\tconst offset = sel?.anchorOffset ?? 0;\n\tconst atStart = offset === 0;\n\tconst prev = atStart ? ' ' : text[offset - 1] ?? ' ';\n\treturn {\n\t\tok: atStart ? !skipStart : boundary.test(prev),\n\t\tcaret: null,\n\t\ttextBefore: text.slice(0, offset),\n\t};\n};\n\ninterface VariableTriggerAreaProps {\n\t/** Variable catalog. Absent / empty → the wrapper is inert (children only). */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/**\n\t * Insert `token` into the wrapped field. `caret` is the character index the\n\t * `@` was typed at (input / textarea targets — splice the token in there);\n\t * null for rich-editor targets (insert at the editor's own cursor).\n\t */\n\tonInsert: (token: string, caret: number | null) => void;\n\t/**\n\t * Rewrite the token before it's handed to `onInsert` — e.g. the Rest API\n\t * JSON editors wrap it in quotes. `textBefore` is the text preceding the\n\t * `@` (for input targets the whole value up to the caret; for rich-editor\n\t * targets just the current text-node fragment).\n\t */\n\ttransformToken?: (token: string, ctx: { textBefore: string }) => string;\n\t/**\n\t * Show the floating \"+ Add data\" pill while the wrapped field is focused.\n\t * Clicking it opens this same variable panel at the field's caret — the\n\t * button equivalent of typing `@`.\n\t */\n\taddDataButton?: boolean;\n\t/**\n\t * The wrapped field is a BikEditor whose OWN `@` mention trigger already\n\t * fires after whitespace / at the start — this wrapper then only handles\n\t * the delimiter boundaries the native trigger misses (`https://@`, `\"@`…),\n\t * so the two never open a panel for the same keystroke.\n\t */\n\tskipNativeBoundaries?: boolean;\n\t/**\n\t * Observes the panel's open state. Fields that commit on blur (the email\n\t * chips entry) use this to hold off while focus is bouncing through the\n\t * panel — blur-time focus targets are unreliable mid-transition.\n\t */\n\tonOpenChange?: (open: boolean) => void;\n\tchildren: React.ReactNode;\n}\n\n/**\n * Wraps any plain field (input / textarea / chips entry / BikEditor) and opens\n * the shared {@link VariablePicker} as a floating panel when `@` is typed at a\n * word boundary. The `@` keystroke itself is swallowed (never reaches the\n * field); picking a variable calls `onInsert` with the `{{variable:<name>}}`\n * token, and Escape / click-outside / the panel's ✕ just closes the panel.\n *\n * Purely presentational wrapper — it renders a `position: relative` block, so\n * the wrapped field must be happy inside a plain block container.\n */\nexport const VariableTriggerArea: React.FC<VariableTriggerAreaProps> = ({\n\tvariablesData,\n\tonInsert,\n\ttransformToken,\n\taddDataButton,\n\tskipNativeBoundaries,\n\tonOpenChange,\n\tchildren,\n}) => {\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\t// Whether the wrapped field (any focusable inside) currently has focus, and\n\t// the element that had it — the pill inserts at that element's caret.\n\tconst [fieldFocused, setFieldFocused] = useState(false);\n\tconst lastFocusedRef = useRef<EventTarget | null>(null);\n\t// Non-null while the panel is open: where to put the token when picked, and\n\t// which way the panel flips to stay on screen (above when there's no room\n\t// below, right-aligned when the field sits too close to the right edge —\n\t// e.g. header-value inputs in the Rest API drawer).\n\tconst [trigger, setTrigger] = useState<{\n\t\tcaret: number | null;\n\t\ttextBefore: string;\n\t\tabove: boolean;\n\t\talignRight: boolean;\n\t} | null>(null);\n\n\tconst enabled = (variablesData?.length ?? 0) > 0;\n\n\tconst openPanel = (t: NonNullable<typeof trigger>) => {\n\t\tsetTrigger(t);\n\t\tonOpenChange?.(true);\n\t};\n\tconst closePanel = () => {\n\t\tsetTrigger(null);\n\t\tonOpenChange?.(false);\n\t};\n\n\t// Panel is ~344px wide / ~340px tall, anchored to the field's left edge —\n\t// flip above / right-align when it would spill past the viewport (avoids\n\t// the drawer growing scrollbars).\n\tconst placement = () => {\n\t\tconst rect = containerRef.current?.getBoundingClientRect();\n\t\treturn {\n\t\t\tabove: !!rect && window.innerHeight - rect.bottom < 340,\n\t\t\talignRight: !!rect && window.innerWidth - rect.left < 360,\n\t\t};\n\t};\n\n\tconst onKeyDownCapture = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (!enabled || e.key !== '@') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst ctx = triggerContext(\n\t\t\t\te.target,\n\t\t\t\tskipNativeBoundaries ? NON_NATIVE_BOUNDARY : BOUNDARY,\n\t\t\t\t!!skipNativeBoundaries,\n\t\t\t);\n\t\t\tif (!ctx.ok) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Swallow the `@` so the field's value stays untouched while picking.\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\topenPanel({\n\t\t\t\tcaret: ctx.caret,\n\t\t\t\ttextBefore: ctx.textBefore,\n\t\t\t\t...placement(),\n\t\t\t});\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[enabled],\n\t);\n\n\t// The pill's click — same panel, anchored at the focused field's caret (no\n\t// boundary rule: an explicit button click is always intentional).\n\tconst openFromButton = () => {\n\t\tconst ctx = triggerContext(lastFocusedRef.current, BOUNDARY, false);\n\t\topenPanel({\n\t\t\tcaret: ctx.caret,\n\t\t\ttextBefore: ctx.textBefore,\n\t\t\t...placement(),\n\t\t});\n\t};\n\n\t// Escape / click-outside dismiss, active only while open.\n\tuseEffect(() => {\n\t\tif (!trigger) {\n\t\t\treturn;\n\t\t}\n\t\tconst onKey = (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\te.stopPropagation();\n\t\t\t\tclosePanel();\n\t\t\t}\n\t\t};\n\t\tconst onDown = (e: MouseEvent) => {\n\t\t\tif (!containerRef.current?.contains(e.target as Node)) {\n\t\t\t\tclosePanel();\n\t\t\t}\n\t\t};\n\t\t// Capture phase so an Escape meant for the panel never also closes the\n\t\t// drawer underneath.\n\t\tdocument.addEventListener('keydown', onKey, true);\n\t\tdocument.addEventListener('mousedown', onDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('keydown', onKey, true);\n\t\t\tdocument.removeEventListener('mousedown', onDown);\n\t\t};\n\t}, [trigger]);\n\n\treturn (\n\t\t<TriggerWrap\n\t\t\tref={containerRef}\n\t\t\tonKeyDownCapture={onKeyDownCapture}\n\t\t\t// React's focus/blur bubble — this tracks any focusable child (the\n\t\t\t// input, a chips entry, the ProseMirror contenteditable).\n\t\t\tonFocus={(e) => {\n\t\t\t\t// Focus landing inside the floating panel (its search box) is not\n\t\t\t\t// the field — inserting at \"its caret\" would target the wrong input.\n\t\t\t\tif (\n\t\t\t\t\t(e.target as HTMLElement).closest?.(\n\t\t\t\t\t\t'[data-test=\"variable-trigger-panel\"]',\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlastFocusedRef.current = e.target;\n\t\t\t\tsetFieldFocused(true);\n\t\t\t}}\n\t\t\tonBlur={() => setFieldFocused(false)}\n\t\t>\n\t\t\t{children}\n\t\t\t{addDataButton && enabled && (fieldFocused || trigger) && (\n\t\t\t\t<AddDataPill onOpen={openFromButton} />\n\t\t\t)}\n\t\t\t{trigger && (\n\t\t\t\t<FloaterBox\n\t\t\t\t\t$above={trigger.above}\n\t\t\t\t\t$right={trigger.alignRight}\n\t\t\t\t\tdata-test=\"variable-trigger-panel\"\n\t\t\t\t\t// Keep the field focused while clicking rows (a blur mid-pick\n\t\t\t\t\t// would e.g. commit a half-typed email chip). The panel's own\n\t\t\t\t\t// inputs (search) still take focus normally.\n\t\t\t\t\tonMouseDown={(e) => {\n\t\t\t\t\t\tconst t = e.target as HTMLElement;\n\t\t\t\t\t\tif (!t.closest('input')) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{/* The EXACT panel the Instructions / Guardrails @ opens: with no\n\t\t\t\t\t tools / sub-agents, Variables is its sole category, so it\n\t\t\t\t\t renders the \"Variables\" header + variable list directly. */}\n\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\titems={[]}\n\t\t\t\t\t\tquery=\"\"\n\t\t\t\t\t\tactiveIndex={-1}\n\t\t\t\t\t\tonSelect={() => undefined}\n\t\t\t\t\t\tonClose={closePanel}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\tonSelectVariable={(variable: VariableV3) => {\n\t\t\t\t\t\t\tclosePanel();\n\t\t\t\t\t\t\tconst raw = variableToken(variable);\n\t\t\t\t\t\t\tconst token = transformToken\n\t\t\t\t\t\t\t\t? transformToken(raw, { textBefore: trigger.textBefore })\n\t\t\t\t\t\t\t\t: raw;\n\t\t\t\t\t\t\tonInsert(token, trigger.caret);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</FloaterBox>\n\t\t\t)}\n\t\t</TriggerWrap>\n\t);\n};\n\nconst TriggerWrap = styled.div`\n\tposition: relative;\n`;\n\n// Floats under (or over) the wrapped field; the MentionPicker inside brings\n// its own card chrome (same as the Instructions / Guardrails @ menu). High\n// z-index: these fields live inside side-modal drawers.\nconst FloaterBox = styled.div<{ $above: boolean; $right: boolean }>`\n\tposition: absolute;\n\tz-index: 1000;\n\twidth: 344px;\n\t${(p) => (p.$right ? 'right: 0;' : 'left: 0;')}\n\t${(p) => (p.$above ? 'bottom: calc(100% + 4px);' : 'top: calc(100% + 4px);')}\n`;\n"],"names":["variableToken","variable","variableTokenName","BOUNDARY","NON_NATIVE_BOUNDARY","triggerContext","target","boundary","skipStart","caret","atStart","prev","sel","text","offset","VariableTriggerArea","variablesData","onInsert","transformToken","addDataButton","skipNativeBoundaries","onOpenChange","children","containerRef","useRef","fieldFocused","setFieldFocused","useState","lastFocusedRef","trigger","setTrigger","enabled","openPanel","t","closePanel","placement","rect","onKeyDownCapture","useCallback","ctx","openFromButton","useEffect","onKey","e","onDown","jsxs","TriggerWrap","jsx","AddDataPill","FloaterBox","MentionPicker","raw","token","styled","p"],"mappings":";;;;;;AAWO,MAAMA,IAAgB,CAACC,MAC7B,cAAcC,EAAkBD,EAAS,WAAW,CAAC,MAahDE,IAAW,qBAIXC,IAAsB,mBAEtBC,IAAiB,CACtBC,GACAC,GACAC,MAC+D;AAC/D,MACCF,aAAkB,oBAClBA,aAAkB,qBACjB;AACD,UAAMG,IAAQH,EAAO,kBAAkBA,EAAO,MAAM,QAC9CI,IAAUD,MAAU,GACpBE,IAAOD,IAAU,MAAMJ,EAAO,MAAMG,IAAQ,CAAC,KAAK;AACxD,WAAO;AAAA,MACN,IAAIC,IAAU,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,MAAMA,EAAgB,EAAK;AAAA,MAElC,UAAA;AAAA,QAAAJ;AAAA,QACAH,KAAiBY,MAAYN,KAAgBI,MAC7C,gBAAAkB,EAACC,GAAA,EAAY,QAAQR,GAAgB;AAAA,QAErCX,KACA,gBAAAkB;AAAA,UAACE;AAAA,UAAA;AAAA,YACA,QAAQpB,EAAQ;AAAA,YAChB,QAAQA,EAAQ;AAAA,YAChB,aAAU;AAAA,YAIV,aAAa,CAAC,MAAM;AAEnB,cADU,EAAE,OACL,QAAQ,OAAO,KACrB,EAAE,eAAA;AAAA,YAEJ;AAAA,YAKA,UAAA,gBAAAkB;AAAA,cAACG;AAAA,cAAA;AAAA,gBACA,OAAO,CAAA;AAAA,gBACP,OAAM;AAAA,gBACN,aAAa;AAAA,gBACb,UAAU,MAAA;AAAA;AAAA,gBACV,SAAShB;AAAA,gBACT,eAAAlB;AAAA,gBACA,kBAAkB,CAACf,MAAyB;AAC3C,kBAAAiC,EAAA;AACA,wBAAMiB,IAAMnD,EAAcC,CAAQ,GAC5BmD,IAAQlC,IACXA,EAAeiC,GAAK,EAAE,YAAYtB,EAAQ,WAAA,CAAY,IACtDsB;AACH,kBAAAlC,EAASmC,GAAOvB,EAAQ,KAAK;AAAA,gBAC9B;AAAA,cAAA;AAAA,YAAA;AAAA,UACD;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ,GAEMiB,IAAcO,EAAO;AAAA;AAAA,GAOrBJ,IAAaI,EAAO;AAAA;AAAA;AAAA;AAAA,GAIvB,CAACC,MAAOA,EAAE,SAAS,cAAc,UAAW;AAAA,GAC5C,CAACA,MAAOA,EAAE,SAAS,8BAA8B,wBAAyB;AAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bikdotai/bik-component-library",
|
|
3
|
-
"version": "0.0.849-beta.
|
|
3
|
+
"version": "0.0.849-beta.6",
|
|
4
4
|
"description": "Bik Component Library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build --config vite.config.lib.ts",
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
37
38
|
"dev": "LIB_DEV=true vite build --config vite.config.lib.ts --watch",
|
|
38
39
|
"build:storybook": "storybook build -o storybook-static",
|
|
39
40
|
"generate:icons": "npx @svgr/cli --config-file svgr.generate.cjs --out-dir src/icons svgs/",
|