@bikdotai/bik-component-library 0.0.852 → 0.0.853-beta.0
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/add-variableV2/AddDataPill.js +10 -0
- package/dist/cjs/components/add-variableV2/AddDataPill.js.map +1 -0
- 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/components/ConfigToolPanel.js +11 -11
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +7 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +41 -14
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +6 -5
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js +65 -0
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +10 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +11 -3
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/add-variableV2/AddDataPill.d.ts +24 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js +33 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js.map +1 -0
- package/dist/esm/components/add-variableV2/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.js +71 -69
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +182 -136
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.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 +214 -207
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +12 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +144 -103
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +48 -45
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +14 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +276 -208
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +184 -168
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +9 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +67 -48
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.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 +149 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +46 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +118 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js +13 -12
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +7 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +99 -96
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +160 -156
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +14 -4
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +54 -36
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +16 -15
- package/dist/esm/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +70 -64
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +12 -4
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +9 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js +28 -28
- package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +23 -19
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.js +543 -541
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import { forwardRef as A, useState as I, useRef as
|
|
1
|
+
import { jsx as t, Fragment as x, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as A, useState as I, useRef as g, useCallback as k, useImperativeHandle as v, useEffect as C } from "react";
|
|
3
3
|
import { DropdownContainer as D, DropdownItem as R, MentionAvatar as U, MentionAvatarFallback as E, MentionLabel as H, MentionPresenceDot as K } from "../editorDropdown.styles.js";
|
|
4
4
|
const S = A(
|
|
5
|
-
({ items: r, query:
|
|
6
|
-
const [
|
|
5
|
+
({ items: r, query: u, command: i, renderItem: f, renderDropdown: o, dismiss: w }, M) => {
|
|
6
|
+
const [c, a] = I(0), d = g(null), s = g(null), b = k(
|
|
7
7
|
(n) => {
|
|
8
8
|
s.current = n;
|
|
9
9
|
},
|
|
10
10
|
[]
|
|
11
|
-
),
|
|
12
|
-
const e =
|
|
11
|
+
), h = k((n) => {
|
|
12
|
+
const e = d.current;
|
|
13
13
|
if (!e) return;
|
|
14
14
|
e.children[n]?.scrollIntoView({ block: "nearest" });
|
|
15
|
-
}, []),
|
|
16
|
-
r[n] &&
|
|
15
|
+
}, []), p = (n) => {
|
|
16
|
+
r[n] && i(r[n]);
|
|
17
17
|
};
|
|
18
|
-
return v(
|
|
19
|
-
onKeyDown: ({ event: n }) =>
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}), !0) : n.key === "ArrowDown" ? (
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
}), !0) : n.key === "Enter" ? (
|
|
26
|
-
})), C(() =>
|
|
18
|
+
return v(M, () => ({
|
|
19
|
+
onKeyDown: ({ event: n }) => o && s.current ? s.current(n) : r.length ? n.key === "ArrowUp" ? (a((e) => {
|
|
20
|
+
const l = (e + r.length - 1) % r.length;
|
|
21
|
+
return h(l), l;
|
|
22
|
+
}), !0) : n.key === "ArrowDown" ? (a((e) => {
|
|
23
|
+
const l = (e + 1) % r.length;
|
|
24
|
+
return h(l), l;
|
|
25
|
+
}), !0) : n.key === "Enter" ? (p(c), !0) : !1 : !1
|
|
26
|
+
})), C(() => a(0), [r]), !r.length && (!o || u) ? null : o ? /* @__PURE__ */ t(x, { children: o({
|
|
27
27
|
items: r,
|
|
28
|
-
query:
|
|
29
|
-
activeIndex:
|
|
30
|
-
onSelect: (n) =>
|
|
31
|
-
registerKeyHandler:
|
|
32
|
-
onClose:
|
|
33
|
-
}) }) : /* @__PURE__ */ t(D, { ref:
|
|
28
|
+
query: u,
|
|
29
|
+
activeIndex: c,
|
|
30
|
+
onSelect: (n) => i(n),
|
|
31
|
+
registerKeyHandler: b,
|
|
32
|
+
onClose: w
|
|
33
|
+
}) }) : /* @__PURE__ */ t(D, { ref: d, children: r.map((n, e) => /* @__PURE__ */ t(
|
|
34
34
|
R,
|
|
35
35
|
{
|
|
36
|
-
$isActive: e ===
|
|
37
|
-
onMouseEnter: () =>
|
|
38
|
-
onClick: () =>
|
|
39
|
-
children:
|
|
36
|
+
$isActive: e === c,
|
|
37
|
+
onMouseEnter: () => a(e),
|
|
38
|
+
onClick: () => p(e),
|
|
39
|
+
children: f ? f(n, e === c) : /* @__PURE__ */ y(x, { children: [
|
|
40
40
|
n.avatarUrl ? /* @__PURE__ */ t(U, { src: n.avatarUrl, alt: "" }) : /* @__PURE__ */ t(E, { children: n.label.charAt(0).toUpperCase() }),
|
|
41
41
|
/* @__PURE__ */ t(H, { children: n.label }),
|
|
42
42
|
n.isOnline !== void 0 && /* @__PURE__ */ t(K, { $online: n.isOnline })
|
|
43
43
|
] })
|
|
44
44
|
},
|
|
45
45
|
n.id
|
|
46
|
-
)) })
|
|
46
|
+
)) });
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
S.displayName = "MentionDropdown";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionDropdown.js","sources":["../../../../../src/editor/extensions/mention/MentionDropdown.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tMentionAvatar,\n\tMentionAvatarFallback,\n\tMentionLabel,\n\tMentionPresenceDot,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: MentionItem[];\n\tquery: string;\n\tcommand: (item: MentionItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: MentionItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: MentionDropdownRenderProps) => React.ReactNode;\n\t/** Close the menu without selecting (strips the typed trigger). Injected by the extension. */\n\tdismiss?: () => void;\n}\n\nexport const MentionDropdown = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown, dismiss }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\t// A custom dropdown (renderDropdown) can claim keyboard nav for itself.\n\t\tconst customKeyHandlerRef = useRef<\n\t\t\t((event: KeyboardEvent) => boolean) | null\n\t\t>(null);\n\n\t\tconst registerKeyHandler = useCallback(\n\t\t\t(handler: ((event: KeyboardEvent) => boolean) | null) => {\n\t\t\t\tcustomKeyHandlerRef.current = handler;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\t// A custom dropdown that registered a handler owns navigation.\n\t\t\t\tif (renderDropdown && customKeyHandlerRef.current) {\n\t\t\t\t\treturn customKeyHandlerRef.current(event);\n\t\t\t\t}\n\t\t\t\tif (!items.length) return false;\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t\tregisterKeyHandler,\n\t\t\t\t\t\tonClose: dismiss,\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{item.avatarUrl ? (\n\t\t\t\t\t\t\t\t\t<MentionAvatar src={item.avatarUrl} alt=\"\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<MentionAvatarFallback>\n\t\t\t\t\t\t\t\t\t\t{item.label.charAt(0).toUpperCase()}\n\t\t\t\t\t\t\t\t\t</MentionAvatarFallback>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<MentionLabel>{item.label}</MentionLabel>\n\t\t\t\t\t\t\t\t{item.isOnline !== undefined && (\n\t\t\t\t\t\t\t\t\t<MentionPresenceDot $online={item.isOnline} />\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</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nMentionDropdown.displayName = 'MentionDropdown';\n"],"names":["MentionDropdown","forwardRef","items","query","command","renderItem","renderDropdown","dismiss","ref","selectedIndex","setSelectedIndex","useState","containerRef","useRef","customKeyHandlerRef","registerKeyHandler","useCallback","handler","scrollToIndex","index","container","select","i","useImperativeHandle","event","prev","next","useEffect","item","jsx","DropdownContainer","DropdownItem","jsxs","Fragment","MentionAvatar","MentionAvatarFallback","MentionLabel","MentionPresenceDot"],"mappings":";;;AAoCO,MAAMA,IAAkBC;AAAA,EAC9B,CAAC,EAAE,OAAAC,GAAO,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,gBAAAC,GAAgB,SAAAC,EAAA,GAAWC,MAAQ;AACxE,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,CAAC,GAC9CC,IAAeC,EAAuB,IAAI,GAE1CC,IAAsBD,EAE1B,IAAI,GAEAE,IAAqBC;AAAA,MAC1B,CAACC,MAAwD;AACxD,QAAAH,EAAoB,UAAUG;AAAA,MAC/B;AAAA,MACA,CAAA;AAAA,IAAC,GAGIC,IAAgBF,EAAY,CAACG,MAAkB;AACpD,YAAMC,IAAYR,EAAa;AAC/B,UAAI,CAACQ,EAAW;AAEhB,MADaA,EAAU,SAASD,CAAK,GAC/B,eAAe,EAAE,OAAO,UAAA,CAAW;AAAA,IAC1C,GAAG,CAAA,CAAE,GAECE,IAAS,CAACC,MAAc;AAC7B,MAAIpB,EAAMoB,CAAC,KAAGlB,EAAQF,EAAMoB,CAAC,CAAC;AAAA,IAC/B;
|
|
1
|
+
{"version":3,"file":"MentionDropdown.js","sources":["../../../../../src/editor/extensions/mention/MentionDropdown.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tMentionAvatar,\n\tMentionAvatarFallback,\n\tMentionLabel,\n\tMentionPresenceDot,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: MentionItem[];\n\tquery: string;\n\tcommand: (item: MentionItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: MentionItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: MentionDropdownRenderProps) => React.ReactNode;\n\t/** Close the menu without selecting (strips the typed trigger). Injected by the extension. */\n\tdismiss?: () => void;\n}\n\nexport const MentionDropdown = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown, dismiss }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\t// A custom dropdown (renderDropdown) can claim keyboard nav for itself.\n\t\tconst customKeyHandlerRef = useRef<\n\t\t\t((event: KeyboardEvent) => boolean) | null\n\t\t>(null);\n\n\t\tconst registerKeyHandler = useCallback(\n\t\t\t(handler: ((event: KeyboardEvent) => boolean) | null) => {\n\t\t\t\tcustomKeyHandlerRef.current = handler;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\t// A custom dropdown that registered a handler owns navigation.\n\t\t\t\tif (renderDropdown && customKeyHandlerRef.current) {\n\t\t\t\t\treturn customKeyHandlerRef.current(event);\n\t\t\t\t}\n\t\t\t\tif (!items.length) return false;\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\t// A custom dropdown owns its own empty state — it can have content even\n\t\t// with zero mention items (e.g. the agent-builder's variables-only mode) —\n\t\t// but only while the query is empty. Once a typed query filters to zero,\n\t\t// bail (unmounting the custom dropdown unregisters its key handler, so\n\t\t// Enter / arrows reach the editor again). Mirrors MentionExtension's\n\t\t// popup.hide() rule.\n\t\tif (!items.length && (!renderDropdown || query)) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t\tregisterKeyHandler,\n\t\t\t\t\t\tonClose: dismiss,\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{item.avatarUrl ? (\n\t\t\t\t\t\t\t\t\t<MentionAvatar src={item.avatarUrl} alt=\"\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<MentionAvatarFallback>\n\t\t\t\t\t\t\t\t\t\t{item.label.charAt(0).toUpperCase()}\n\t\t\t\t\t\t\t\t\t</MentionAvatarFallback>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<MentionLabel>{item.label}</MentionLabel>\n\t\t\t\t\t\t\t\t{item.isOnline !== undefined && (\n\t\t\t\t\t\t\t\t\t<MentionPresenceDot $online={item.isOnline} />\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</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nMentionDropdown.displayName = 'MentionDropdown';\n"],"names":["MentionDropdown","forwardRef","items","query","command","renderItem","renderDropdown","dismiss","ref","selectedIndex","setSelectedIndex","useState","containerRef","useRef","customKeyHandlerRef","registerKeyHandler","useCallback","handler","scrollToIndex","index","container","select","i","useImperativeHandle","event","prev","next","useEffect","item","jsx","DropdownContainer","DropdownItem","jsxs","Fragment","MentionAvatar","MentionAvatarFallback","MentionLabel","MentionPresenceDot"],"mappings":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AACR,CAAK,CAAC,GAQxC,CAACA,EAAM,WAAW,CAACI,KAAkBH,KAAe,OAGpDG,2BAGA,UAAAA,EAAe;AAAA,MACf,OAAAJ;AAAA,MACA,OAAAC;AAAA,MACA,aAAaM;AAAA,MACb,UAAU,CAACmB,MAASxB,EAAQwB,CAAI;AAAA,MAChC,oBAAAb;AAAA,MACA,SAASR;AAAA,IAAA,CACT,GACF,IAKD,gBAAAsB,EAACC,KAAkB,KAAKlB,GACtB,YAAM,IAAI,CAACgB,GAAMN,MACjB,gBAAAO;AAAA,MAACE;AAAA,MAAA;AAAA,QAEA,WAAWT,MAAMb;AAAA,QACjB,cAAc,MAAMC,EAAiBY,CAAC;AAAA,QACtC,SAAS,MAAMD,EAAOC,CAAC;AAAA,QAEtB,cACAjB,EAAWuB,GAAMN,MAAMb,CAAa,IAEpC,gBAAAuB,EAAAC,GAAA,EACE,UAAA;AAAA,UAAAL,EAAK,YACL,gBAAAC,EAACK,GAAA,EAAc,KAAKN,EAAK,WAAW,KAAI,GAAA,CAAG,IAE3C,gBAAAC,EAACM,KACC,UAAAP,EAAK,MAAM,OAAO,CAAC,EAAE,eACvB;AAAA,UAED,gBAAAC,EAACO,GAAA,EAAc,UAAAR,EAAK,MAAA,CAAM;AAAA,UACzBA,EAAK,aAAa,4BACjBS,GAAA,EAAmB,SAAST,EAAK,SAAA,CAAU;AAAA,QAAA,EAAA,CAE9C;AAAA,MAAA;AAAA,MApBIA,EAAK;AAAA,IAAA,CAuBX,GACF;AAAA,EAEF;AACD;AACA5B,EAAgB,cAAc;"}
|
|
@@ -2,10 +2,10 @@ import { mergeAttributes as f } from "../../../node_modules/@tiptap/core/dist/in
|
|
|
2
2
|
import k from "@tiptap/extension-mention";
|
|
3
3
|
import { ReactNodeViewRenderer as b, ReactRenderer as w } from "@tiptap/react";
|
|
4
4
|
import { createSuggestionPopup as h } from "../suggestionPopup.js";
|
|
5
|
-
import { buildMentionChipNodeView as
|
|
6
|
-
import { MentionDropdown as
|
|
7
|
-
function T(
|
|
8
|
-
const { renderItem: d, renderDropdown:
|
|
5
|
+
import { buildMentionChipNodeView as M } from "./MentionChipNodeView.js";
|
|
6
|
+
import { MentionDropdown as p } from "./MentionDropdown.js";
|
|
7
|
+
function T(a, r) {
|
|
8
|
+
const { renderItem: d, renderDropdown: u, removeTriggerOnDismiss: c } = a;
|
|
9
9
|
return () => {
|
|
10
10
|
let i, o, e, t = null;
|
|
11
11
|
const s = () => {
|
|
@@ -16,8 +16,8 @@ function T(u, r) {
|
|
|
16
16
|
};
|
|
17
17
|
return {
|
|
18
18
|
onStart: (n) => {
|
|
19
|
-
e = n, r.picked = !1, i = new w(
|
|
20
|
-
props: { ...n, renderItem: d, renderDropdown:
|
|
19
|
+
e = n, r.picked = !1, i = new w(p, {
|
|
20
|
+
props: { ...n, renderItem: d, renderDropdown: u, dismiss: s },
|
|
21
21
|
editor: n.editor
|
|
22
22
|
}), o = h(i.element, n.clientRect), t = (l) => {
|
|
23
23
|
const m = l.target;
|
|
@@ -28,9 +28,9 @@ function T(u, r) {
|
|
|
28
28
|
if (e = n, i.updateProps({
|
|
29
29
|
...n,
|
|
30
30
|
renderItem: d,
|
|
31
|
-
renderDropdown:
|
|
31
|
+
renderDropdown: u,
|
|
32
32
|
dismiss: s
|
|
33
|
-
}), !n.items?.length) {
|
|
33
|
+
}), !n.items?.length && (!u || n.query)) {
|
|
34
34
|
o.hide();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -48,10 +48,10 @@ function T(u, r) {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function g(
|
|
51
|
+
function g(a, r, d, u, c, i) {
|
|
52
52
|
const o = { picked: !1 };
|
|
53
53
|
return k.extend({
|
|
54
|
-
name:
|
|
54
|
+
name: a,
|
|
55
55
|
addAttributes() {
|
|
56
56
|
return {
|
|
57
57
|
...this.parent?.(),
|
|
@@ -73,7 +73,7 @@ function g(u, r, d, a, c, i) {
|
|
|
73
73
|
...i.renderChipIcon ? {
|
|
74
74
|
addNodeView() {
|
|
75
75
|
return b(
|
|
76
|
-
|
|
76
|
+
M({
|
|
77
77
|
cssClass: r,
|
|
78
78
|
char: d,
|
|
79
79
|
renderChipIcon: i.renderChipIcon
|
|
@@ -96,12 +96,16 @@ function g(u, r, d, a, c, i) {
|
|
|
96
96
|
suggestion: {
|
|
97
97
|
char: d,
|
|
98
98
|
allowSpaces: !0,
|
|
99
|
-
|
|
99
|
+
// Chips are always followed by a ` ` (see MentionEditor's inserts),
|
|
100
|
+
// so U+00A0 must count as a valid prefix or an `@` typed / injected
|
|
101
|
+
// right after a chip never activates the suggestion (default: [' ']).
|
|
102
|
+
allowedPrefixes: [" ", " "],
|
|
103
|
+
items: ({ query: e }) => u.current.filter(
|
|
100
104
|
(t) => t.label.toLowerCase().includes(e.toLowerCase())
|
|
101
105
|
),
|
|
102
106
|
command: ({ editor: e, range: t, props: s }) => {
|
|
103
107
|
o.picked = !0, e.chain().focus().deleteRange(t).insertContent({
|
|
104
|
-
type:
|
|
108
|
+
type: a,
|
|
105
109
|
attrs: {
|
|
106
110
|
id: s.id,
|
|
107
111
|
label: s.label,
|
|
@@ -114,24 +118,24 @@ function g(u, r, d, a, c, i) {
|
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
function H(
|
|
121
|
+
function H(a, r, d, u, c, i) {
|
|
118
122
|
return g(
|
|
119
123
|
"mentionAgent",
|
|
120
124
|
"bik-mention bik-mention--agent",
|
|
121
125
|
"@",
|
|
122
|
-
|
|
126
|
+
a,
|
|
123
127
|
r,
|
|
124
|
-
{ renderItem: d, renderDropdown:
|
|
128
|
+
{ renderItem: d, renderDropdown: u, removeTriggerOnDismiss: c, renderChipIcon: i }
|
|
125
129
|
);
|
|
126
130
|
}
|
|
127
|
-
function S(
|
|
131
|
+
function S(a, r, d, u, c) {
|
|
128
132
|
return g(
|
|
129
133
|
"mentionTeam",
|
|
130
134
|
"bik-mention bik-mention--team",
|
|
131
135
|
"#",
|
|
132
|
-
|
|
136
|
+
a,
|
|
133
137
|
r,
|
|
134
|
-
{ renderItem: d, renderDropdown:
|
|
138
|
+
{ renderItem: d, renderDropdown: u, removeTriggerOnDismiss: c }
|
|
135
139
|
);
|
|
136
140
|
}
|
|
137
141
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactNodeViewRenderer, ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { buildMentionChipNodeView } from './MentionChipNodeView';\nimport { MentionDropdown } from './MentionDropdown';\n\ninterface MentionBuildOptions {\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\t/** Remove the typed trigger char + query if the menu closes without a selection. */\n\tremoveTriggerOnDismiss?: boolean;\n\t/**\n\t * Leading glyph rendered inside the chip (e.g. a tool's source icon). Supplying\n\t * it switches the chip to a React node view; omit to keep the plain chip.\n\t */\n\trenderChipIcon?: (source: string | null, kind: string | null) => ReactNode;\n}\n\nfunction buildRender(\n\toptions: MentionBuildOptions,\n\tpickedRef: { picked: boolean },\n) {\n\tconst { renderItem, renderDropdown, removeTriggerOnDismiss } = options;\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\t\tlet latestProps: any;\n\t\t// Closes the menu when the user clicks anywhere outside it. The `@` popup\n\t\t// lives on document.body (not inside the editor), so nothing dismisses it on\n\t\t// an outside click otherwise — only Escape / moving the cursor did.\n\t\tlet onDocMouseDown: ((event: MouseEvent) => void) | null = null;\n\n\t\t// Close the menu without a selection: drop the typed \"@query\" so no orphan\n\t\t// trigger is left, and mark as picked so onExit doesn't delete it twice.\n\t\tconst dismiss = () => {\n\t\t\tpickedRef.picked = true;\n\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tpickedRef.picked = false;\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown, dismiss },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t\tonDocMouseDown = (event: MouseEvent) => {\n\t\t\t\t\tconst target = event.target as Node | null;\n\t\t\t\t\tif (!target) return;\n\t\t\t\t\t// Inside the picker → keep open (row clicks fire on `click`).\n\t\t\t\t\tif (popup.element.contains(target)) return;\n\t\t\t\t\t// Inside the editor → the suggestion plugin already closes it.\n\t\t\t\t\tconst editorDom = latestProps?.editor?.view?.dom as\n\t\t\t\t\t\t| HTMLElement\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (editorDom?.contains(target)) return;\n\t\t\t\t\t// Anywhere else → drop the typed \"@query\" (no refocus — clicking\n\t\t\t\t\t// away shouldn't yank focus back) and close.\n\t\t\t\t\tpickedRef.picked = true;\n\t\t\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\t\t\tlatestProps.editor.chain().deleteRange(latestProps.range).run();\n\t\t\t\t\t}\n\t\t\t\t\tpopup.hide();\n\t\t\t\t};\n\t\t\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tcomponent.updateProps({\n\t\t\t\t\t...props,\n\t\t\t\t\trenderItem,\n\t\t\t\t\trenderDropdown,\n\t\t\t\t\tdismiss,\n\t\t\t\t});\n\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tif (onDocMouseDown) {\n\t\t\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\t\t\tonDocMouseDown = null;\n\t\t\t\t}\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t\t// Nothing was picked → strip the orphan \"@query\" the user typed.\n\t\t\t\tif (\n\t\t\t\t\tremoveTriggerOnDismiss &&\n\t\t\t\t\t!pickedRef.picked &&\n\t\t\t\t\tlatestProps?.editor &&\n\t\t\t\t\tlatestProps?.range\n\t\t\t\t) {\n\t\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (!editor.isDestroyed) {\n\t\t\t\t\t\t\teditor.chain().deleteRange(range).run();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n}\n\n/**\n * Builds a TipTap Mention extension.\n *\n * Each inserted node carries an optional `kind` attribute. When set, the chip is\n * rendered WITHOUT the trigger char (the `label` already encodes the full text)\n * and a `data-kind` attribute is emitted so CSS can colour it per kind. When\n * `kind` is null the legacy `${char}${label}` chip is rendered (back-compatible).\n */\nfunction buildMentionExtension(\n\tname: 'mentionAgent' | 'mentionTeam',\n\tcssClass: string,\n\tchar: '@' | '#',\n\titemsRef: { current: MentionItem[] },\n\tonSelect: ((item: MentionItem, char: '@' | '#') => void) | undefined,\n\toptions: MentionBuildOptions,\n) {\n\tconst pickedRef = { picked: false };\n\n\treturn Mention.extend({\n\t\tname,\n\t\taddAttributes() {\n\t\t\treturn {\n\t\t\t\t...this.parent?.(),\n\t\t\t\tkind: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-kind'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['kind'] ? { 'data-kind': String(attrs['kind']) } : {},\n\t\t\t\t},\n\t\t\t\t// Tool source bucket (manifest / shopify / …); drives the chip icon.\n\t\t\t\tsource: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-source'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['source'] ? { 'data-source': String(attrs['source']) } : {},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t// A React chip (with the leading source icon) only when the consumer asks for\n\t\t// it — otherwise the plain renderHTML chip is kept (unchanged for CRM etc.).\n\t\t...(options.renderChipIcon\n\t\t\t? {\n\t\t\t\t\taddNodeView() {\n\t\t\t\t\t\treturn ReactNodeViewRenderer(\n\t\t\t\t\t\t\tbuildMentionChipNodeView({\n\t\t\t\t\t\t\t\tcssClass,\n\t\t\t\t\t\t\t\tchar,\n\t\t\t\t\t\t\t\trenderChipIcon: options.renderChipIcon,\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 }\n\t\t\t: {}),\n\t}).configure({\n\t\tHTMLAttributes: { class: cssClass },\n\t\trenderText: ({ options: opt, node }: any) =>\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options: opt, node }: any) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(\n\t\t\t\topt.HTMLAttributes,\n\t\t\t\tnode.attrs['kind'] ? { 'data-kind': String(node.attrs['kind']) } : {},\n\t\t\t\tnode.attrs['source']\n\t\t\t\t\t? { 'data-source': String(node.attrs['source']) }\n\t\t\t\t\t: {},\n\t\t\t),\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar,\n\t\t\tallowSpaces: true,\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\titemsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\tpickedRef.picked = true;\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\tid: props.id,\n\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\tkind: props.meta?.kind ?? null,\n\t\t\t\t\t\t\tsource: props.meta?.source ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, char);\n\t\t\t},\n\t\t\trender: buildRender(options, pickedRef),\n\t\t},\n\t});\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n\trenderChipIcon?: (source: string | null, kind: string | null) => ReactNode,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionAgent',\n\t\t'bik-mention bik-mention--agent',\n\t\t'@',\n\t\tagentsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss, renderChipIcon },\n\t);\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionTeam',\n\t\t'bik-mention bik-mention--team',\n\t\t'#',\n\t\tteamsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n"],"names":["buildRender","options","pickedRef","renderItem","renderDropdown","removeTriggerOnDismiss","component","popup","latestProps","onDocMouseDown","dismiss","editor","range","props","ReactRenderer","MentionDropdown","createSuggestionPopup","event","target","buildMentionExtension","name","cssClass","char","itemsRef","onSelect","Mention","el","attrs","ReactNodeViewRenderer","buildMentionChipNodeView","opt","node","mergeAttributes","query","a","buildAgentMentionExtension","agentsRef","renderChipIcon","buildTeamMentionExtension","teamsRef"],"mappings":";;;;;;AA2BA,SAASA,EACRC,GACAC,GACC;AACD,QAAM,EAAE,YAAAC,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA,IAA2BJ;AAC/D,SAAO,MAAM;AACZ,QAAIK,GACAC,GACAC,GAIAC,IAAuD;AAI3D,UAAMC,IAAU,MAAM;AAErB,UADAR,EAAU,SAAS,IACfM,GAAa,UAAUA,GAAa,OAAO;AAC9C,cAAM,EAAE,QAAAG,GAAQ,OAAAC,EAAA,IAAUJ;AAC1B,QAAAG,EAAO,QAAQ,MAAA,EAAQ,YAAYC,CAAK,EAAE,IAAA;AAAA,MAC3C;AAAA,IACD;AAEA,WAAO;AAAA,MACN,SAAS,CAACC,MAAe;AACxB,QAAAL,IAAcK,GACdX,EAAU,SAAS,IACnBI,IAAY,IAAIQ,EAAcC,GAAiB;AAAA,UAC9C,OAAO,EAAE,GAAGF,GAAO,YAAAV,GAAY,gBAAAC,GAAgB,SAAAM,EAAA;AAAA,UAC/C,QAAQG,EAAM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A;AAAA,EAAuB;AAEvD;"}
|
|
1
|
+
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactNodeViewRenderer, ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { buildMentionChipNodeView } from './MentionChipNodeView';\nimport { MentionDropdown } from './MentionDropdown';\n\ninterface MentionBuildOptions {\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\t/** Remove the typed trigger char + query if the menu closes without a selection. */\n\tremoveTriggerOnDismiss?: boolean;\n\t/**\n\t * Leading glyph rendered inside the chip (e.g. a tool's source icon). Supplying\n\t * it switches the chip to a React node view; omit to keep the plain chip.\n\t */\n\trenderChipIcon?: (source: string | null, kind: string | null) => ReactNode;\n}\n\nfunction buildRender(\n\toptions: MentionBuildOptions,\n\tpickedRef: { picked: boolean },\n) {\n\tconst { renderItem, renderDropdown, removeTriggerOnDismiss } = options;\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\t\tlet latestProps: any;\n\t\t// Closes the menu when the user clicks anywhere outside it. The `@` popup\n\t\t// lives on document.body (not inside the editor), so nothing dismisses it on\n\t\t// an outside click otherwise — only Escape / moving the cursor did.\n\t\tlet onDocMouseDown: ((event: MouseEvent) => void) | null = null;\n\n\t\t// Close the menu without a selection: drop the typed \"@query\" so no orphan\n\t\t// trigger is left, and mark as picked so onExit doesn't delete it twice.\n\t\tconst dismiss = () => {\n\t\t\tpickedRef.picked = true;\n\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tpickedRef.picked = false;\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown, dismiss },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t\tonDocMouseDown = (event: MouseEvent) => {\n\t\t\t\t\tconst target = event.target as Node | null;\n\t\t\t\t\tif (!target) return;\n\t\t\t\t\t// Inside the picker → keep open (row clicks fire on `click`).\n\t\t\t\t\tif (popup.element.contains(target)) return;\n\t\t\t\t\t// Inside the editor → the suggestion plugin already closes it.\n\t\t\t\t\tconst editorDom = latestProps?.editor?.view?.dom as\n\t\t\t\t\t\t| HTMLElement\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (editorDom?.contains(target)) return;\n\t\t\t\t\t// Anywhere else → drop the typed \"@query\" (no refocus — clicking\n\t\t\t\t\t// away shouldn't yank focus back) and close.\n\t\t\t\t\tpickedRef.picked = true;\n\t\t\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\t\t\tlatestProps.editor.chain().deleteRange(latestProps.range).run();\n\t\t\t\t\t}\n\t\t\t\t\tpopup.hide();\n\t\t\t\t};\n\t\t\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tcomponent.updateProps({\n\t\t\t\t\t...props,\n\t\t\t\t\trenderItem,\n\t\t\t\t\trenderDropdown,\n\t\t\t\t\tdismiss,\n\t\t\t\t});\n\t\t\t\t// Empty result list closes the dropdown — EXCEPT a custom dropdown\n\t\t\t\t// (renderDropdown) with an empty QUERY: it may have content of its\n\t\t\t\t// own with zero items (the agent-builder's variables-only mode).\n\t\t\t\t// Once the user has typed a query that matches nothing, hide — the\n\t\t\t\t// picker must not float over (and steal keys from) ordinary typing.\n\t\t\t\tif (!props.items?.length && (!renderDropdown || props.query)) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tif (onDocMouseDown) {\n\t\t\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\t\t\tonDocMouseDown = null;\n\t\t\t\t}\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t\t// Nothing was picked → strip the orphan \"@query\" the user typed.\n\t\t\t\tif (\n\t\t\t\t\tremoveTriggerOnDismiss &&\n\t\t\t\t\t!pickedRef.picked &&\n\t\t\t\t\tlatestProps?.editor &&\n\t\t\t\t\tlatestProps?.range\n\t\t\t\t) {\n\t\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (!editor.isDestroyed) {\n\t\t\t\t\t\t\teditor.chain().deleteRange(range).run();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n}\n\n/**\n * Builds a TipTap Mention extension.\n *\n * Each inserted node carries an optional `kind` attribute. When set, the chip is\n * rendered WITHOUT the trigger char (the `label` already encodes the full text)\n * and a `data-kind` attribute is emitted so CSS can colour it per kind. When\n * `kind` is null the legacy `${char}${label}` chip is rendered (back-compatible).\n */\nfunction buildMentionExtension(\n\tname: 'mentionAgent' | 'mentionTeam',\n\tcssClass: string,\n\tchar: '@' | '#',\n\titemsRef: { current: MentionItem[] },\n\tonSelect: ((item: MentionItem, char: '@' | '#') => void) | undefined,\n\toptions: MentionBuildOptions,\n) {\n\tconst pickedRef = { picked: false };\n\n\treturn Mention.extend({\n\t\tname,\n\t\taddAttributes() {\n\t\t\treturn {\n\t\t\t\t...this.parent?.(),\n\t\t\t\tkind: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-kind'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['kind'] ? { 'data-kind': String(attrs['kind']) } : {},\n\t\t\t\t},\n\t\t\t\t// Tool source bucket (manifest / shopify / …); drives the chip icon.\n\t\t\t\tsource: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-source'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['source'] ? { 'data-source': String(attrs['source']) } : {},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t// A React chip (with the leading source icon) only when the consumer asks for\n\t\t// it — otherwise the plain renderHTML chip is kept (unchanged for CRM etc.).\n\t\t...(options.renderChipIcon\n\t\t\t? {\n\t\t\t\t\taddNodeView() {\n\t\t\t\t\t\treturn ReactNodeViewRenderer(\n\t\t\t\t\t\t\tbuildMentionChipNodeView({\n\t\t\t\t\t\t\t\tcssClass,\n\t\t\t\t\t\t\t\tchar,\n\t\t\t\t\t\t\t\trenderChipIcon: options.renderChipIcon,\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 }\n\t\t\t: {}),\n\t}).configure({\n\t\tHTMLAttributes: { class: cssClass },\n\t\trenderText: ({ options: opt, node }: any) =>\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options: opt, node }: any) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(\n\t\t\t\topt.HTMLAttributes,\n\t\t\t\tnode.attrs['kind'] ? { 'data-kind': String(node.attrs['kind']) } : {},\n\t\t\t\tnode.attrs['source']\n\t\t\t\t\t? { 'data-source': String(node.attrs['source']) }\n\t\t\t\t\t: {},\n\t\t\t),\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar,\n\t\t\tallowSpaces: true,\n\t\t\t// Chips are always followed by a ` ` (see MentionEditor's inserts),\n\t\t\t// so U+00A0 must count as a valid prefix or an `@` typed / injected\n\t\t\t// right after a chip never activates the suggestion (default: [' ']).\n\t\t\tallowedPrefixes: [' ', '\\u00a0'],\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\titemsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\tpickedRef.picked = true;\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\tid: props.id,\n\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\tkind: props.meta?.kind ?? null,\n\t\t\t\t\t\t\tsource: props.meta?.source ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, char);\n\t\t\t},\n\t\t\trender: buildRender(options, pickedRef),\n\t\t},\n\t});\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n\trenderChipIcon?: (source: string | null, kind: string | null) => ReactNode,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionAgent',\n\t\t'bik-mention bik-mention--agent',\n\t\t'@',\n\t\tagentsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss, renderChipIcon },\n\t);\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionTeam',\n\t\t'bik-mention bik-mention--team',\n\t\t'#',\n\t\tteamsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n"],"names":["buildRender","options","pickedRef","renderItem","renderDropdown","removeTriggerOnDismiss","component","popup","latestProps","onDocMouseDown","dismiss","editor","range","props","ReactRenderer","MentionDropdown","createSuggestionPopup","event","target","buildMentionExtension","name","cssClass","char","itemsRef","onSelect","Mention","el","attrs","ReactNodeViewRenderer","buildMentionChipNodeView","opt","node","mergeAttributes","query","a","buildAgentMentionExtension","agentsRef","renderChipIcon","buildTeamMentionExtension","teamsRef"],"mappings":";;;;;;AA2BA,SAASA,EACRC,GACAC,GACC;AACD,QAAM,EAAE,YAAAC,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA,IAA2BJ;AAC/D,SAAO,MAAM;AACZ,QAAIK,GACAC,GACAC,GAIAC,IAAuD;AAI3D,UAAMC,IAAU,MAAM;AAErB,UADAR,EAAU,SAAS,IACfM,GAAa,UAAUA,GAAa,OAAO;AAC9C,cAAM,EAAE,QAAAG,GAAQ,OAAAC,EAAA,IAAUJ;AAC1B,QAAAG,EAAO,QAAQ,MAAA,EAAQ,YAAYC,CAAK,EAAE,IAAA;AAAA,MAC3C;AAAA,IACD;AAEA,WAAO;AAAA,MACN,SAAS,CAACC,M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;AAAA,IACA,EAAE,YAAArB,GAAY,gBAAAC,GAAgB,wBAAAC,GAAwB,gBAAAgC,EAAA;AAAA,EAAe;AAEvE;AAEO,SAASC,EACfC,GACAf,GACArB,GACAC,GACAC,GACC;AACD,SAAOc;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACAoB;AAAA,IACAf;AAAA,IACA,EAAE,YAAArB,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA;AAAA,EAAuB;AAEvD;"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export { Send, Activate, Code, Cross, Deactivate, Delete, Edit, Forward, Fullscreen, LinkSimpleHorizontal, Minus, Plus, ProductTour, RestApi, Save, SendAirplane, ShareAndroid, Shortcut, Task } from './Actions/Common actions';
|
|
2
|
-
export { CheckboxIcon, Copy, DecreaseIndent, Dropdown, IncreaseIndent, MultiLine, MultiSelect, Number, NumberList, Quotes, Subscript, Superscript, TextBold, Text, TextAlignCenter, TextAlignLeft, TextAlignRight, TextItalics, TextJustify, TextStrikethrough, TextUnderline, Textbox } from './Actions/Formatting';
|
|
3
|
-
export { ArrowRedo, ArrowUndo, LogIn, LogOut, OpenNewWindow, Refresh, Rewind, Sync, Whatsapp } from './Actions/Navigation';
|
|
1
|
+
export { Send, Activate, Code, Cross, Deactivate, Delete, Edit, Forward, Fullscreen, LinkSimpleHorizontal, Minus, Plus, ProductTour, RestApi, Save, SendAirplane, ShareAndroid, Shortcut, Task, } from './Actions/Common actions';
|
|
2
|
+
export { CheckboxIcon, Copy, DecreaseIndent, Dropdown, IncreaseIndent, MultiLine, MultiSelect, Number, NumberList, Quotes, Subscript, Superscript, TextBold, Text, TextAlignCenter, TextAlignLeft, TextAlignRight, TextItalics, TextJustify, TextStrikethrough, TextUnderline, Textbox, } from './Actions/Formatting';
|
|
3
|
+
export { ArrowRedo, ArrowUndo, LogIn, LogOut, OpenNewWindow, Refresh, Rewind, Sync, Whatsapp, } from './Actions/Navigation';
|
|
4
4
|
export { HandleDrag, SingleChoice } from './Actions/Selection';
|
|
5
5
|
export { CaratDown, CaratLeft, CaratRight, CaratUp } from './Arrows/Carat';
|
|
6
|
-
export { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from './Arrows/Chevron';
|
|
7
|
-
export { ChevronDoubleDown, ChevronDoubleLeft, ChevronDoubleRight, ChevronDoubleUp } from './Arrows/Double chevron';
|
|
8
|
-
export { ArrowDown, ArrowDownLeft, ArrowDownRight, ArrowLeft, ArrowRight, ArrowUp, ArrowUpLeft, ArrowUpRight } from './Arrows/Normal arrows';
|
|
6
|
+
export { ChevronDown, ChevronLeft, ChevronRight, ChevronUp, } from './Arrows/Chevron';
|
|
7
|
+
export { ChevronDoubleDown, ChevronDoubleLeft, ChevronDoubleRight, ChevronDoubleUp, } from './Arrows/Double chevron';
|
|
8
|
+
export { ArrowDown, ArrowDownLeft, ArrowDownRight, ArrowLeft, ArrowRight, ArrowUp, ArrowUpLeft, ArrowUpRight, } from './Arrows/Normal arrows';
|
|
9
9
|
export { ArrowSwitch } from './Arrows/Special';
|
|
10
|
-
export { AiVoice, AiIcon, Webhook, AiAgent, AiEmoji, AiRobot, Expand, Frame27389, Frame27597, Frame27598, Frame27599, GeminiSparkle, ManifestSparkle, PricePlease, Shape, Shorter, Sparkling2Line, WandSparkles, Write } from './BIK AI specific';
|
|
11
|
-
export { Shield, ShieldOutline, Bell, BellSync, Bulb, Forms, MenuHamburger, MessageSearch, MoreHorizontal, MoreVertical, Placeholder, Search, Settings, Training } from './Informational/Common UI';
|
|
12
|
-
export { Chat, ChatCheck, ChatQuestion, ChatStar, Email, LiveChat, Phone } from './Informational/Communication';
|
|
13
|
-
export { ClipboardCheck, Experimental, Help, Percent, Purchase, Services, ShoppingCart, Unsatisfactory, UserSound } from './Informational/Customer intent';
|
|
10
|
+
export { AiVoice, AiIcon, Webhook, AiAgent, AiEmoji, AiRobot, Expand, Frame27389, Frame27597, Frame27598, Frame27599, GeminiSparkle, ManifestSparkle, PricePlease, Shape, Shorter, Sparkling2Line, WandSparkles, Write, } from './BIK AI specific';
|
|
11
|
+
export { Shield, ShieldOutline, Bell, BellSync, Bulb, Forms, MenuHamburger, MessageSearch, MoreHorizontal, MoreVertical, Placeholder, Search, Settings, Training, } from './Informational/Common UI';
|
|
12
|
+
export { Chat, ChatCheck, ChatQuestion, ChatStar, Email, LiveChat, Phone, } from './Informational/Communication';
|
|
13
|
+
export { ClipboardCheck, Experimental, Help, Percent, Purchase, Services, ShoppingCart, Unsatisfactory, UserSound, } from './Informational/Customer intent';
|
|
14
14
|
export { SingleChoice as SingleChoice2 } from './Informational/Customer intent';
|
|
15
|
-
export { CalendarCheck, Calendar, CalendarAdd, Clock, HourGlass, WorkingHours } from './Informational/Date and time';
|
|
16
|
-
export { AddLabel, Click, Filter, Gift1, GiftMinus, GiftPlus, Promocode, Receipt, ShieldCheck, ShoppingBag, ShoppingBasket } from './Informational/eCommerce';
|
|
15
|
+
export { CalendarCheck, Calendar, CalendarAdd, Clock, HourGlass, WorkingHours, } from './Informational/Date and time';
|
|
16
|
+
export { AddLabel, Click, Filter, Gift1, GiftMinus, GiftPlus, Promocode, Receipt, ShieldCheck, ShoppingBag, ShoppingBasket, } from './Informational/eCommerce';
|
|
17
17
|
export { ShoppingCart as ShoppingCart2 } from './Informational/eCommerce';
|
|
18
|
-
export { Archive1, Excel, File, FileCsv, FilePage, FilePdf, Folder, MediaMessage, Move, OrderHistory, PrivateNote, TextMessage, Unarchive } from './Informational/Files and folders';
|
|
19
|
-
export { Bank, CashOnDelivery, ChartLine, CreditCard, Growth, Money1, NoCredits, Rupee, TablerTicket, Wallet } from './Informational/Finance';
|
|
18
|
+
export { Archive1, Excel, File, FileCsv, FilePage, FilePdf, Folder, MediaMessage, Move, OrderHistory, PrivateNote, TextMessage, Unarchive, } from './Informational/Files and folders';
|
|
19
|
+
export { Bank, CashOnDelivery, ChartLine, CreditCard, Growth, Money1, NoCredits, Rupee, TablerTicket, Wallet, } from './Informational/Finance';
|
|
20
20
|
export { Percent as Percent2 } from './Informational/Finance';
|
|
21
|
-
export { BookOpenText, TicketV2, AlertTriangle, Check, CheckDouble, CloseTicket1, Error, FailDoc, HourglassFilled, IcList, Info, Merge, NewTicket, RoundCheck, Slash } from './Informational/General';
|
|
21
|
+
export { BookOpenText, TicketV2, AlertTriangle, Check, CheckDouble, CloseTicket1, Error, FailDoc, HourglassFilled, IcList, Info, Merge, NewTicket, RoundCheck, Slash, } from './Informational/General';
|
|
22
22
|
export { Help as Help2 } from './Informational/General';
|
|
23
|
-
export { PuzzlePiece, User, Chatbot, Contacts, Group, IdCard, Person, Robot, Union, Union1, UserMinus1, UserPlus } from './Informational/Identity';
|
|
24
|
-
export { Address, LanguageChange, MapPin, Truck } from './Informational/Location';
|
|
25
|
-
export { AllProduct, Clipboard, CustomerReport, Head112, InventoryReport, LegalBalance, OrderReport, PaymentReport, Store, StoreSync, TicketForm } from './Informational/Store related';
|
|
23
|
+
export { PuzzlePiece, User, Chatbot, Contacts, Group, IdCard, Person, Robot, Union, Union1, UserMinus1, UserPlus, } from './Informational/Identity';
|
|
24
|
+
export { Address, LanguageChange, MapPin, Truck, } from './Informational/Location';
|
|
25
|
+
export { AllProduct, Clipboard, CustomerReport, Head112, InventoryReport, LegalBalance, OrderReport, PaymentReport, Store, StoreSync, TicketForm, } from './Informational/Store related';
|
|
26
26
|
export { ClipboardCheck as ClipboardCheck2 } from './Informational/Store related';
|
|
27
27
|
export { Box, Box2 } from './Legacy - Bikayi specific/Categories';
|
|
28
28
|
export { Journeys } from './Legacy - Bikayi specific/Navigation';
|
|
29
29
|
export { Services as Services2 } from './Legacy - Bikayi specific/Navigation';
|
|
30
30
|
export { PlanUltimate } from './Legacy - Bikayi specific/Plans';
|
|
31
|
-
export { Businesscard, Customdomain, LoudSpeaker, Marketing, PaymentLink, Theme } from './Legacy - Bikayi specific/Services';
|
|
32
|
-
export { Microphone, Pause, Play, Sleep, VolumeMute, VolumeOneline, VolumeTwoline } from './Media/Audio';
|
|
31
|
+
export { Businesscard, Customdomain, LoudSpeaker, Marketing, PaymentLink, Theme, } from './Legacy - Bikayi specific/Services';
|
|
32
|
+
export { Microphone, Pause, Play, Sleep, VolumeMute, VolumeOneline, VolumeTwoline, } from './Media/Audio';
|
|
33
33
|
export { Desktop, Smartphone } from './Media/Devices';
|
|
34
|
-
export { BarcodeScan, Download, EmojiSmile, Paperclip, Upload } from './Media/Others';
|
|
35
|
-
export { Frame26086263, Camera, CameraAdd, Crop, FlashOff, FlashOn, FormkitHappy, FormkitNeutral, FormkitSad, IconTrailing, Image, ImageAdd, Images, Maximize, RotateAnticlockwise, RotateClockwise, VideoCamcorder, VideoFilm } from './Media/Visual';
|
|
36
|
-
export { EmailMarketingV2, EmailV2, FacebookCommentV2, FacebookV2, GmailV2, InstagramCommentV2, InstagramV2, MessengerV2, PhoneV2, RcsV2, SmsV2, TaskV2, WebpushV2, WhatsAppCallV2, WhatsAppV2, Bigcommerce, EmailMarketing, Facebook, FacebookComment, FreshdeskApp, Instagram, InstagramIcon, Messenger, MonoFacebookComment, MonoFacebook, MonoInstagram, MonoInstagramComment, MonoMail, MonoMessenger, MonoPhone, MonoTasks, MonoWhatsapp, ShopifyBrand, Tasks, WebPush, WhatsApp } from './Social/Channels';
|
|
34
|
+
export { BarcodeScan, Download, EmojiSmile, Paperclip, Upload, } from './Media/Others';
|
|
35
|
+
export { Frame26086263, Camera, CameraAdd, Crop, FlashOff, FlashOn, FormkitHappy, FormkitNeutral, FormkitSad, IconTrailing, Image, ImageAdd, Images, Maximize, RotateAnticlockwise, RotateClockwise, VideoCamcorder, VideoFilm, } from './Media/Visual';
|
|
36
|
+
export { EmailMarketingV2, EmailV2, FacebookCommentV2, FacebookV2, GmailV2, InstagramCommentV2, InstagramV2, MessengerV2, PhoneV2, RcsV2, SmsV2, TaskV2, WebpushV2, WhatsAppCallV2, WhatsAppV2, Bigcommerce, EmailMarketing, Facebook, FacebookComment, FreshdeskApp, Instagram, InstagramIcon, Messenger, MonoFacebookComment, MonoFacebook, MonoInstagram, MonoInstagramComment, MonoMail, MonoMessenger, MonoPhone, MonoTasks, MonoWhatsapp, ShopifyBrand, Tasks, WebPush, WhatsApp, } from './Social/Channels';
|
|
37
37
|
export { Email as Email2 } from './Social/Channels';
|
|
38
|
-
export { SlackIcon, BigCommerce, Google, Gorgias, Kustomer, Rcs, ShopifyDefault, Twitter, Website, WooCommerce, Youtube, Zendesk } from './Social/Social';
|
|
38
|
+
export { SlackIcon, BigCommerce, Google, Gorgias, Kustomer, Rcs, ShopifyDefault, Twitter, Website, WooCommerce, Youtube, Zendesk, } from './Social/Social';
|
|
39
39
|
export { EmailMarketing as EmailMarketing2 } from './Social/Social';
|
|
40
40
|
export { Facebook as Facebook2 } from './Social/Social';
|
|
41
41
|
export { Instagram as Instagram2 } from './Social/Social';
|
|
42
42
|
export { Messenger as Messenger2 } from './Social/Social';
|
|
43
43
|
export { Whatsapp as Whatsapp2 } from './Social/Social';
|
|
44
|
-
export { Eye, EyeClosed, EyeOff, HeartEmpty, HeartFilled, Lock, StarEmpty, StarFilled, StarHalf, Unlock } from './Toggles/General';
|
|
44
|
+
export { Eye, EyeClosed, EyeOff, HeartEmpty, HeartFilled, Lock, StarEmpty, StarFilled, StarHalf, Unlock, } from './Toggles/General';
|