@epam/ai-dial-skill-editor 1.1.15 → 1.1.17
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/index.js +206 -216
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, buildCssVars as n, formatFileSize as r, mergeClasses as i, useAvailableHeightCap as a } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { Accordion as o, CaptionText as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, EditorThemes as u, ErrorText as d, FileDropzone as f, GhostButton as ee, GhostIconButton as te, Input as p, NeutralButton as m, Popup as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { IconArrowNarrowLeft as
|
|
5
|
-
import { Suspense as
|
|
6
|
-
import { DialFileNodeType as
|
|
7
|
-
import { LazyMarkdownEditor as
|
|
8
|
-
var
|
|
2
|
+
import { Accordion as o, CaptionText as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, EditorThemes as u, ErrorText as d, FileDropzone as f, GhostButton as ee, GhostIconButton as te, Input as p, NeutralButton as m, Popup as h, PopupSize as ne, PrimaryButton as re, Spinner as g, Textarea as _ } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
4
|
+
import { IconArrowNarrowLeft as x, IconFileText as ie, IconPlus as S, IconTrashX as ae, IconUpload as C } from "@tabler/icons-react";
|
|
5
|
+
import { Suspense as w, lazy as T, useCallback as E, useEffect as D, useId as O, useMemo as k, useRef as A, useState as j } from "react";
|
|
6
|
+
import { DialFileNodeType as M, DialFoldersTree as oe } from "@epam/ai-dial-react-file-manager";
|
|
7
|
+
import { LazyMarkdownEditor as N } from "@epam/ai-dial-ui-kit/editors";
|
|
8
|
+
var P = {
|
|
9
9
|
headerBorder: "_headerBorder_1kidu_1",
|
|
10
10
|
footerBorder: "_footerBorder_1kidu_5",
|
|
11
11
|
sidebarBorder: "_sidebarBorder_1kidu_9"
|
|
12
|
-
},
|
|
13
|
-
let p =
|
|
14
|
-
|
|
12
|
+
}, F = ({ title: e, onBack: t, backAriaLabel: r = "Back", actions: a, leftContent: o, rightContent: s, isSaving: u = !1, labels: d, styles: f, dir: ee }) => {
|
|
13
|
+
let p = O(), m = u ? d?.savingStatusLabel ?? "Saving" : "", h = n({
|
|
14
|
+
"--el-header-border-color": f?.colors?.headerBorderColor,
|
|
15
|
+
"--el-sidebar-border-color": f?.colors?.sidebarBorderColor
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ b("div", {
|
|
15
18
|
dir: ee,
|
|
16
19
|
className: "flex min-h-0 flex-1 flex-col",
|
|
17
|
-
style:
|
|
18
|
-
"--el-header-border-color": f?.colors?.headerBorderColor,
|
|
19
|
-
"--el-sidebar-border-color": f?.colors?.sidebarBorderColor
|
|
20
|
-
}),
|
|
20
|
+
style: h,
|
|
21
21
|
children: [
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ y("span", {
|
|
23
23
|
role: "status",
|
|
24
24
|
"aria-live": "polite",
|
|
25
25
|
className: "sr-only",
|
|
26
26
|
id: p,
|
|
27
27
|
children: m
|
|
28
28
|
}),
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
className: i("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3",
|
|
31
|
-
children: [/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ b("div", {
|
|
30
|
+
className: i("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", P.headerBorder),
|
|
31
|
+
children: [/* @__PURE__ */ b("div", {
|
|
32
32
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
33
|
-
children: [/* @__PURE__ */
|
|
34
|
-
icon: /* @__PURE__ */
|
|
33
|
+
children: [/* @__PURE__ */ y(te, {
|
|
34
|
+
icon: /* @__PURE__ */ y(x, {
|
|
35
35
|
size: c.LG,
|
|
36
36
|
stroke: l,
|
|
37
37
|
"aria-hidden": !0,
|
|
@@ -39,91 +39,85 @@ var M = {
|
|
|
39
39
|
}),
|
|
40
40
|
"aria-label": r,
|
|
41
41
|
onClick: t
|
|
42
|
-
}), /* @__PURE__ */
|
|
42
|
+
}), /* @__PURE__ */ y("h1", {
|
|
43
43
|
className: "dial-h2-text min-w-0 truncate",
|
|
44
44
|
children: e
|
|
45
45
|
})]
|
|
46
|
-
}), a != null && /* @__PURE__ */
|
|
46
|
+
}), a != null && /* @__PURE__ */ y("div", {
|
|
47
47
|
className: "hidden shrink-0 items-center gap-2 desktop:flex",
|
|
48
48
|
children: a
|
|
49
49
|
})]
|
|
50
50
|
}),
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ b("div", {
|
|
52
52
|
className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
54
|
-
className: i(s == null ? "desktop:flex-1" : "desktop:w-[360px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", s == null ? void 0 :
|
|
53
|
+
children: [/* @__PURE__ */ y("div", {
|
|
54
|
+
className: i(s == null ? "desktop:flex-1" : "desktop:w-[360px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", s == null ? void 0 : P.sidebarBorder),
|
|
55
55
|
children: o
|
|
56
|
-
}), s != null && /* @__PURE__ */
|
|
56
|
+
}), s != null && /* @__PURE__ */ y("div", {
|
|
57
57
|
className: "desktop:flex-1 desktop:overflow-y-auto",
|
|
58
58
|
children: s
|
|
59
59
|
})]
|
|
60
60
|
}),
|
|
61
|
-
a != null && /* @__PURE__ */
|
|
62
|
-
className: i("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1",
|
|
61
|
+
a != null && /* @__PURE__ */ y("div", {
|
|
62
|
+
className: i("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", P.footerBorder),
|
|
63
63
|
children: a
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
});
|
|
67
|
-
},
|
|
68
|
-
let [t, n] =
|
|
67
|
+
}, I = (e) => !!e.dataTransfer?.types.includes("Files"), se = (e) => {
|
|
68
|
+
let [t, n] = j(!1), r = A(0);
|
|
69
69
|
return {
|
|
70
70
|
isDragActive: t,
|
|
71
71
|
dropZoneHandlers: {
|
|
72
|
-
onDragEnter:
|
|
73
|
-
|
|
72
|
+
onDragEnter: E((e) => {
|
|
73
|
+
I(e) && (e.preventDefault(), r.current += 1, n(!0));
|
|
74
74
|
}, []),
|
|
75
|
-
onDragLeave:
|
|
76
|
-
|
|
75
|
+
onDragLeave: E((e) => {
|
|
76
|
+
I(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
|
|
77
77
|
}, []),
|
|
78
|
-
onDragOver:
|
|
79
|
-
|
|
78
|
+
onDragOver: E((e) => {
|
|
79
|
+
I(e) && e.preventDefault();
|
|
80
80
|
}, []),
|
|
81
|
-
onDrop:
|
|
82
|
-
if (!
|
|
81
|
+
onDrop: E((t) => {
|
|
82
|
+
if (!I(t)) return;
|
|
83
83
|
t.preventDefault(), r.current = 0, n(!1);
|
|
84
84
|
let i = Array.from(t.dataTransfer?.files ?? []);
|
|
85
85
|
i.length > 0 && e(i);
|
|
86
86
|
}, [e])
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
},
|
|
89
|
+
}, L = "SKILL.md", R = /* @__PURE__ */ function(e) {
|
|
90
90
|
return e.File = "file", e.Folder = "folder", e;
|
|
91
|
-
}({}),
|
|
91
|
+
}({}), z = (e) => {
|
|
92
92
|
let t = e.lastIndexOf("/");
|
|
93
93
|
return t === -1 ? null : e.slice(0, t);
|
|
94
|
-
},
|
|
94
|
+
}, B = (e) => {
|
|
95
95
|
let t = e.lastIndexOf("/");
|
|
96
96
|
return t === -1 ? e : e.slice(t + 1);
|
|
97
|
-
},
|
|
97
|
+
}, ce = (e) => {
|
|
98
98
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
99
99
|
let n = t.get(e);
|
|
100
100
|
if (n) return n;
|
|
101
101
|
let r = {
|
|
102
102
|
path: e,
|
|
103
|
-
name:
|
|
104
|
-
nodeType:
|
|
105
|
-
parentPath:
|
|
103
|
+
name: B(e),
|
|
104
|
+
nodeType: M.FOLDER,
|
|
105
|
+
parentPath: z(e),
|
|
106
106
|
folderId: e,
|
|
107
107
|
items: []
|
|
108
108
|
};
|
|
109
109
|
return t.set(e, r), r;
|
|
110
110
|
};
|
|
111
|
-
for (let r of e) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
name: r.name,
|
|
119
|
-
nodeType: A.ITEM,
|
|
120
|
-
parentPath: L(r.path),
|
|
121
|
-
folderId: L(r.path) ?? ""
|
|
122
|
-
});
|
|
123
|
-
}
|
|
111
|
+
for (let r of e) r.kind === R.Folder ? n(r.path) : t.set(r.path, {
|
|
112
|
+
path: r.path,
|
|
113
|
+
name: r.name,
|
|
114
|
+
nodeType: M.ITEM,
|
|
115
|
+
parentPath: z(r.path),
|
|
116
|
+
folderId: z(r.path) ?? ""
|
|
117
|
+
});
|
|
124
118
|
for (let t of [...e]) {
|
|
125
|
-
let e =
|
|
126
|
-
for (; e != null;) n(e), e =
|
|
119
|
+
let e = z(t.path);
|
|
120
|
+
for (; e != null;) n(e), e = z(e);
|
|
127
121
|
}
|
|
128
122
|
let r = [];
|
|
129
123
|
for (let e of t.values()) {
|
|
@@ -135,217 +129,214 @@ var M = {
|
|
|
135
129
|
n ? n.items = [...n.items ?? [], e] : r.push(e);
|
|
136
130
|
}
|
|
137
131
|
return r;
|
|
138
|
-
},
|
|
132
|
+
}, le = ({ isVisible: e, labels: t }) => {
|
|
139
133
|
if (!e) return null;
|
|
140
134
|
let n = t ?? {};
|
|
141
|
-
return /* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ y("div", {
|
|
142
136
|
role: "status",
|
|
143
137
|
"aria-live": "polite",
|
|
144
138
|
className: i("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
|
|
145
|
-
children: /* @__PURE__ */
|
|
139
|
+
children: /* @__PURE__ */ b("div", {
|
|
146
140
|
className: "flex flex-col items-center text-center",
|
|
147
141
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ y(C, {
|
|
149
143
|
size: 100,
|
|
150
144
|
className: "text-accent-primary",
|
|
151
145
|
"aria-hidden": !0,
|
|
152
146
|
stroke: l
|
|
153
147
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ y("span", {
|
|
155
149
|
className: "dial-h3-text mt-5",
|
|
156
150
|
children: n.dropOverlayTitle ?? "Upload files"
|
|
157
151
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ y("span", {
|
|
159
153
|
className: "dial-small-text mt-4",
|
|
160
154
|
children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
|
|
161
155
|
})
|
|
162
156
|
]
|
|
163
157
|
})
|
|
164
158
|
});
|
|
165
|
-
},
|
|
159
|
+
}, ue = /* @__PURE__ */ function(e) {
|
|
166
160
|
return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
|
|
167
|
-
}({}),
|
|
161
|
+
}({}), V = /* @__PURE__ */ function(e) {
|
|
168
162
|
return e.Valid = "valid", e.Invalid = "invalid", e;
|
|
169
|
-
}({}),
|
|
170
|
-
let o = a ?? {}, [s, c] =
|
|
163
|
+
}({}), de = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), H = 0, U = () => `skill-file-candidate-${++H}`, fe = ({ isOpen: e, onClose: t, fileActions: n, initialFiles: i, labels: a }) => {
|
|
164
|
+
let o = a ?? {}, [s, c] = j([]), [u, p] = j(/* @__PURE__ */ new Map()), [m, _] = j([]), [x, S] = j(!1), [C, w] = j(), [T, E] = j(!1), k = O(), A = (e) => {
|
|
171
165
|
let t = e.map((e) => ({
|
|
172
|
-
id:
|
|
166
|
+
id: U(),
|
|
173
167
|
file: e,
|
|
174
|
-
path:
|
|
168
|
+
path: de(e)
|
|
175
169
|
}));
|
|
176
|
-
|
|
177
|
-
},
|
|
170
|
+
w(void 0), c((e) => [...e, ...t]);
|
|
171
|
+
}, M = (e) => {
|
|
178
172
|
c((t) => t.filter((t) => t.id !== e));
|
|
179
173
|
};
|
|
180
|
-
|
|
174
|
+
D(() => {
|
|
181
175
|
e && (c((i ?? []).map((e) => ({
|
|
182
|
-
id:
|
|
176
|
+
id: U(),
|
|
183
177
|
file: e,
|
|
184
|
-
path:
|
|
185
|
-
}))), p(/* @__PURE__ */ new Map()),
|
|
186
|
-
}, [e]),
|
|
178
|
+
path: de(e)
|
|
179
|
+
}))), p(/* @__PURE__ */ new Map()), _([]), w(void 0));
|
|
180
|
+
}, [e]), D(() => {
|
|
187
181
|
if (!e) return;
|
|
188
182
|
let t = !1;
|
|
189
|
-
if (s.length === 0)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
return oe(!0), n.validateBatch(s).then(({ results: e, batchErrors: n }) => {
|
|
194
|
-
t || (p(new Map(e.map((e) => [e.candidateId, e]))), g(n.map((e) => e.message)));
|
|
183
|
+
if (s.length === 0) p(/* @__PURE__ */ new Map()), _([]);
|
|
184
|
+
else return S(!0), n.validateBatch(s).then(({ results: e, batchErrors: n }) => {
|
|
185
|
+
t || (p(new Map(e.map((e) => [e.candidateId, e]))), _(n.map((e) => e.message)));
|
|
195
186
|
}).finally(() => {
|
|
196
|
-
t ||
|
|
187
|
+
t || S(!1);
|
|
197
188
|
}), () => {
|
|
198
189
|
t = !0;
|
|
199
190
|
};
|
|
200
191
|
}, [s, e]);
|
|
201
|
-
let
|
|
202
|
-
|
|
192
|
+
let oe = s.some((e) => u.get(e.id)?.status === V.Invalid), N = s.length > 0 && s.every((e) => u.get(e.id)?.status === V.Invalid), P = s.length > 0 && !oe && m.length === 0 && !x && !T, F = async () => {
|
|
193
|
+
E(!0), w(void 0);
|
|
203
194
|
try {
|
|
204
195
|
let { results: e, batchErrors: r } = await n.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
|
|
205
|
-
if (p(i),
|
|
196
|
+
if (p(i), _(r.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === V.Invalid) || r.length > 0) return;
|
|
206
197
|
let a = await n.commitBatch(s);
|
|
207
198
|
if (a.error) {
|
|
208
|
-
|
|
199
|
+
w(a.error);
|
|
209
200
|
return;
|
|
210
201
|
}
|
|
211
202
|
t();
|
|
212
203
|
} finally {
|
|
213
|
-
|
|
204
|
+
E(!1);
|
|
214
205
|
}
|
|
215
206
|
};
|
|
216
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ y(h, {
|
|
217
208
|
open: e,
|
|
218
209
|
header: o.uploadDialogTitle ?? "Upload files from device",
|
|
219
|
-
size:
|
|
210
|
+
size: ne.Sm,
|
|
220
211
|
closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
|
|
221
212
|
onClose: t,
|
|
222
|
-
footer: /* @__PURE__ */
|
|
213
|
+
footer: /* @__PURE__ */ b("div", {
|
|
223
214
|
className: "flex min-h-[44px] items-center justify-end gap-2 px-6 py-4",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
215
|
+
children: [/* @__PURE__ */ y(ee, {
|
|
225
216
|
label: o.uploadCancelLabel ?? "Cancel",
|
|
226
217
|
onClick: t
|
|
227
|
-
}), /* @__PURE__ */
|
|
218
|
+
}), /* @__PURE__ */ y(re, {
|
|
228
219
|
label: o.uploadConfirmLabel ?? "Add",
|
|
229
|
-
iconBefore:
|
|
220
|
+
iconBefore: T ? /* @__PURE__ */ y(g, {
|
|
230
221
|
size: 16,
|
|
231
222
|
ariaLabel: ""
|
|
232
223
|
}) : void 0,
|
|
233
|
-
onClick: () => void
|
|
234
|
-
disabled: !
|
|
224
|
+
onClick: () => void F(),
|
|
225
|
+
disabled: !P
|
|
235
226
|
})]
|
|
236
227
|
}),
|
|
237
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ b("div", {
|
|
238
229
|
className: "flex flex-col gap-4 px-6 py-4",
|
|
239
230
|
children: [
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
label: /* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ y(f, {
|
|
232
|
+
label: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("span", {
|
|
242
233
|
className: "desktop:hidden",
|
|
243
234
|
children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
|
|
244
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ y("span", {
|
|
245
236
|
className: "hidden desktop:inline",
|
|
246
237
|
children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
|
|
247
238
|
})] }),
|
|
248
239
|
ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
|
|
249
240
|
multiple: !0,
|
|
250
|
-
className:
|
|
251
|
-
onChange:
|
|
241
|
+
className: N ? "border-error hover:border-error" : void 0,
|
|
242
|
+
onChange: A
|
|
252
243
|
}),
|
|
253
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ y("span", {
|
|
254
245
|
role: "status",
|
|
255
246
|
"aria-live": "polite",
|
|
256
247
|
className: "sr-only",
|
|
257
|
-
id:
|
|
248
|
+
id: k,
|
|
258
249
|
children: m.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
|
|
259
250
|
}),
|
|
260
|
-
m.map((e) => /* @__PURE__ */
|
|
261
|
-
s.length > 0 && /* @__PURE__ */
|
|
251
|
+
m.map((e) => /* @__PURE__ */ y(d, { text: e }, e)),
|
|
252
|
+
s.length > 0 && /* @__PURE__ */ y("ul", {
|
|
262
253
|
className: "flex flex-col gap-2",
|
|
263
254
|
children: s.map((e) => {
|
|
264
|
-
let t = u.get(e.id), n = t?.kind ===
|
|
265
|
-
return /* @__PURE__ */
|
|
255
|
+
let t = u.get(e.id), n = t?.kind === ue.Manifest, i = t?.status === V.Invalid;
|
|
256
|
+
return /* @__PURE__ */ b("li", {
|
|
266
257
|
className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
|
|
267
258
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ y(ie, {
|
|
269
260
|
size: 20,
|
|
270
261
|
"aria-hidden": !0,
|
|
271
262
|
stroke: l
|
|
272
263
|
}),
|
|
273
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ b("div", {
|
|
274
265
|
className: "flex min-w-0 flex-1 flex-col",
|
|
275
266
|
children: [
|
|
276
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ y("span", {
|
|
277
268
|
className: "dial-small-text truncate",
|
|
278
269
|
children: e.path
|
|
279
270
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ y("span", {
|
|
281
272
|
className: "dial-tiny-text text-secondary",
|
|
282
273
|
children: r(e.file.size)
|
|
283
274
|
}),
|
|
284
|
-
i && t?.error && /* @__PURE__ */
|
|
285
|
-
n && !i && /* @__PURE__ */
|
|
275
|
+
i && t?.error && /* @__PURE__ */ y(d, { text: t.error }),
|
|
276
|
+
n && !i && /* @__PURE__ */ y("span", {
|
|
286
277
|
className: "dial-tiny-text text-secondary",
|
|
287
278
|
children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
|
|
288
279
|
})
|
|
289
280
|
]
|
|
290
281
|
}),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
icon: /* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ y(te, {
|
|
283
|
+
icon: /* @__PURE__ */ y(ae, {
|
|
293
284
|
size: 16,
|
|
294
285
|
"aria-hidden": !0,
|
|
295
286
|
stroke: l
|
|
296
287
|
}),
|
|
297
288
|
"aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
|
|
298
|
-
onClick: () =>
|
|
289
|
+
onClick: () => M(e.id)
|
|
299
290
|
})
|
|
300
291
|
]
|
|
301
292
|
}, e.id);
|
|
302
293
|
})
|
|
303
294
|
}),
|
|
304
|
-
|
|
295
|
+
C && /* @__PURE__ */ y(d, { text: C })
|
|
305
296
|
]
|
|
306
297
|
})
|
|
307
298
|
});
|
|
308
|
-
},
|
|
299
|
+
}, pe = {
|
|
309
300
|
title: "_title_65glc_1",
|
|
310
301
|
helperText: "_helperText_65glc_5"
|
|
311
|
-
}, me =
|
|
312
|
-
let { MarkdownEditor: e } = await
|
|
302
|
+
}, me = T(async () => {
|
|
303
|
+
let { MarkdownEditor: e } = await N();
|
|
313
304
|
return { default: e };
|
|
314
|
-
}), W = ({ initialValues: r, files: f, selectedPath: te, onSelectedPathChange:
|
|
315
|
-
let [G, K] =
|
|
305
|
+
}), W = ({ initialValues: r, files: f, selectedPath: te, onSelectedPathChange: h, expandedPaths: ne, onExpandedPathsChange: x, isLoading: ie = !1, hasLoadError: C = !1, isSubmitting: T = !1, errors: O, submitError: M, conflict: N, onReloadLatest: P, isNameReadOnly: I = !1, onDirtyChange: z, fileActions: B, supportingFileContent: ue, onSubmit: V, onCancel: de, onBack: H, backAriaLabel: U, title: W, onRetry: he, labels: ge, styles: _e, dir: ve, instructionsEditorTheme: ye = u.light }) => {
|
|
306
|
+
let [G, K] = j({
|
|
316
307
|
name: r?.name ?? "",
|
|
317
308
|
description: r?.description ?? "",
|
|
318
309
|
instructions: r?.instructions ?? ""
|
|
319
|
-
}), be = a(), xe =
|
|
320
|
-
|
|
310
|
+
}), be = a(), xe = A(r), Se = xe.current !== r, Ce = A(f);
|
|
311
|
+
D(() => {
|
|
321
312
|
xe.current = r, K({
|
|
322
313
|
name: r?.name ?? "",
|
|
323
314
|
description: r?.description ?? "",
|
|
324
315
|
instructions: r?.instructions ?? ""
|
|
325
316
|
}), Ce.current = f;
|
|
326
317
|
}, [r]);
|
|
327
|
-
let we = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), Te =
|
|
328
|
-
|
|
318
|
+
let we = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), Te = A(!1);
|
|
319
|
+
D(() => {
|
|
329
320
|
if (Se) return;
|
|
330
321
|
let e = {
|
|
331
322
|
name: r?.name ?? "",
|
|
332
323
|
description: r?.description ?? "",
|
|
333
324
|
instructions: r?.instructions ?? ""
|
|
334
325
|
}, t = JSON.stringify(G) !== JSON.stringify(e) || we(f) !== we(Ce.current);
|
|
335
|
-
t !== Te.current && (Te.current = t,
|
|
326
|
+
t !== Te.current && (Te.current = t, z?.(t));
|
|
336
327
|
}, [
|
|
337
328
|
G,
|
|
338
329
|
f,
|
|
339
330
|
r,
|
|
340
331
|
Se,
|
|
341
|
-
|
|
332
|
+
z
|
|
342
333
|
]);
|
|
343
|
-
let [Ee, De] =
|
|
344
|
-
De(e),
|
|
345
|
-
}, [
|
|
334
|
+
let [Ee, De] = j(L), q = te ?? Ee, J = E((e) => {
|
|
335
|
+
De(e), h?.(e);
|
|
336
|
+
}, [h]), [Oe, ke] = j([]), Ae = ne ?? Oe, je = k(() => new Set(Ae), [Ae]), Me = E((e) => {
|
|
346
337
|
let t = [...e];
|
|
347
|
-
ke(t),
|
|
348
|
-
}, [
|
|
338
|
+
ke(t), x?.(t);
|
|
339
|
+
}, [x]), [Y, Ne] = j(!1), [Pe, Fe] = j(), [Ie, Le] = j(!1), { isDragActive: Re, dropZoneHandlers: ze } = se(E((e) => {
|
|
349
340
|
Y || (Fe(e), Ne(!0));
|
|
350
341
|
}, [Y])), X = ge ?? {}, Z = _e?.colors, Q = _e?.typography ?? {}, Be = Q.titleClassName ?? "dial-body-semi-text", Ve = Q.helperTextClassName ?? "dial-tiny-semi-text", He = Q.removeIconClassName ?? "text-secondary", Ue = n({
|
|
351
342
|
"--se-title-color": Z?.title,
|
|
@@ -353,22 +344,22 @@ var M = {
|
|
|
353
344
|
}), We = Z?.border ? { colors: {
|
|
354
345
|
headerBorderColor: Z.border,
|
|
355
346
|
sidebarBorderColor: Z.border
|
|
356
|
-
} } : void 0, Ge =
|
|
357
|
-
path:
|
|
358
|
-
name:
|
|
359
|
-
kind:
|
|
360
|
-
}, ...f]), [f]), $ =
|
|
347
|
+
} } : void 0, Ge = k(() => ce([{
|
|
348
|
+
path: L,
|
|
349
|
+
name: L,
|
|
350
|
+
kind: R.File
|
|
351
|
+
}, ...f]), [f]), $ = k(() => f.find((e) => e.path === q), [f, q]), Ke = E((e) => {
|
|
361
352
|
J(e.path);
|
|
362
|
-
}, [J]), qe =
|
|
363
|
-
|
|
353
|
+
}, [J]), qe = E((e) => {
|
|
354
|
+
B.onRemoveNode(e), q === e && J(L);
|
|
364
355
|
}, [
|
|
365
|
-
|
|
356
|
+
B,
|
|
366
357
|
q,
|
|
367
358
|
J
|
|
368
|
-
]), Je =
|
|
359
|
+
]), Je = E((e) => e.path === "SKILL.md" ? [] : [{
|
|
369
360
|
key: "remove",
|
|
370
361
|
label: X.removeLabel ?? "Remove",
|
|
371
|
-
icon: /* @__PURE__ */
|
|
362
|
+
icon: /* @__PURE__ */ y(ae, {
|
|
372
363
|
size: c.SM,
|
|
373
364
|
className: He,
|
|
374
365
|
"aria-hidden": !0,
|
|
@@ -379,16 +370,16 @@ var M = {
|
|
|
379
370
|
X.removeLabel,
|
|
380
371
|
He,
|
|
381
372
|
qe
|
|
382
|
-
]), Ye = /* @__PURE__ */
|
|
373
|
+
]), Ye = /* @__PURE__ */ b("div", {
|
|
383
374
|
className: "flex flex-col gap-2 desktop:gap-5",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
375
|
+
children: [/* @__PURE__ */ b("div", {
|
|
385
376
|
className: "flex items-center justify-between",
|
|
386
|
-
children: [/* @__PURE__ */
|
|
387
|
-
className: i(
|
|
377
|
+
children: [/* @__PURE__ */ y("span", {
|
|
378
|
+
className: i(pe.title, Be),
|
|
388
379
|
children: X.filesHeading ?? "Files"
|
|
389
|
-
}), /* @__PURE__ */
|
|
380
|
+
}), /* @__PURE__ */ y(m, {
|
|
390
381
|
label: X.addUploadLabel ?? "Upload from device",
|
|
391
|
-
iconBefore: /* @__PURE__ */
|
|
382
|
+
iconBefore: /* @__PURE__ */ y(S, {
|
|
392
383
|
size: 16,
|
|
393
384
|
"aria-hidden": !0,
|
|
394
385
|
stroke: l
|
|
@@ -397,10 +388,10 @@ var M = {
|
|
|
397
388
|
Fe(void 0), Ne(!0);
|
|
398
389
|
}
|
|
399
390
|
})]
|
|
400
|
-
}), /* @__PURE__ */
|
|
391
|
+
}), /* @__PURE__ */ y("div", {
|
|
401
392
|
role: "tree",
|
|
402
393
|
"aria-label": X.filesTreeAriaLabel ?? "Skill files",
|
|
403
|
-
children: /* @__PURE__ */
|
|
394
|
+
children: /* @__PURE__ */ y(oe, {
|
|
404
395
|
items: Ge,
|
|
405
396
|
showFiles: !0,
|
|
406
397
|
selectedPath: q,
|
|
@@ -411,78 +402,78 @@ var M = {
|
|
|
411
402
|
rootItemPath: ""
|
|
412
403
|
})
|
|
413
404
|
})]
|
|
414
|
-
}), Xe = /* @__PURE__ */
|
|
405
|
+
}), Xe = /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(m, {
|
|
415
406
|
label: X.cancelLabel ?? "Cancel",
|
|
416
|
-
onClick:
|
|
417
|
-
disabled:
|
|
418
|
-
}), /* @__PURE__ */
|
|
407
|
+
onClick: de,
|
|
408
|
+
disabled: T
|
|
409
|
+
}), /* @__PURE__ */ y(re, {
|
|
419
410
|
label: X.createLabel ?? "Create",
|
|
420
|
-
iconBefore:
|
|
411
|
+
iconBefore: T ? /* @__PURE__ */ y(g, {
|
|
421
412
|
size: 16,
|
|
422
413
|
ariaLabel: ""
|
|
423
414
|
}) : void 0,
|
|
424
|
-
onClick: () =>
|
|
425
|
-
disabled:
|
|
415
|
+
onClick: () => V(G),
|
|
416
|
+
disabled: T
|
|
426
417
|
})] });
|
|
427
|
-
return
|
|
418
|
+
return ie ? /* @__PURE__ */ y("div", {
|
|
428
419
|
dir: ve,
|
|
429
420
|
className: "relative flex min-h-0 flex-1 flex-col",
|
|
430
|
-
children: /* @__PURE__ */
|
|
421
|
+
children: /* @__PURE__ */ y(F, {
|
|
431
422
|
title: W,
|
|
432
|
-
onBack:
|
|
433
|
-
backAriaLabel:
|
|
423
|
+
onBack: H,
|
|
424
|
+
backAriaLabel: U,
|
|
434
425
|
actions: Xe,
|
|
435
426
|
isSaving: !1,
|
|
436
427
|
labels: { savingStatusLabel: X.savingStatusLabel },
|
|
437
428
|
styles: We,
|
|
438
|
-
leftContent: /* @__PURE__ */
|
|
429
|
+
leftContent: /* @__PURE__ */ y("div", {
|
|
439
430
|
role: "status",
|
|
440
431
|
"aria-label": X.loadingAriaLabel ?? "Loading skill",
|
|
441
432
|
className: "flex flex-1 items-center justify-center p-8",
|
|
442
|
-
children: /* @__PURE__ */
|
|
433
|
+
children: /* @__PURE__ */ y(g, {})
|
|
443
434
|
})
|
|
444
435
|
})
|
|
445
|
-
}) :
|
|
436
|
+
}) : C ? /* @__PURE__ */ y("div", {
|
|
446
437
|
dir: ve,
|
|
447
438
|
className: "relative flex min-h-0 flex-1 flex-col",
|
|
448
|
-
children: /* @__PURE__ */
|
|
439
|
+
children: /* @__PURE__ */ y(F, {
|
|
449
440
|
title: W,
|
|
450
|
-
onBack:
|
|
451
|
-
backAriaLabel:
|
|
441
|
+
onBack: H,
|
|
442
|
+
backAriaLabel: U,
|
|
452
443
|
actions: Xe,
|
|
453
444
|
isSaving: !1,
|
|
454
445
|
labels: { savingStatusLabel: X.savingStatusLabel },
|
|
455
446
|
styles: We,
|
|
456
|
-
leftContent: /* @__PURE__ */
|
|
447
|
+
leftContent: /* @__PURE__ */ b("div", {
|
|
457
448
|
role: "alert",
|
|
458
449
|
className: "flex flex-col items-center gap-4 p-8",
|
|
459
|
-
children: [/* @__PURE__ */
|
|
450
|
+
children: [/* @__PURE__ */ y(d, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ y(re, {
|
|
460
451
|
label: X.retryLabel ?? "Retry",
|
|
461
452
|
onClick: he
|
|
462
453
|
})]
|
|
463
454
|
})
|
|
464
455
|
})
|
|
465
|
-
}) : /* @__PURE__ */
|
|
456
|
+
}) : /* @__PURE__ */ b("div", {
|
|
466
457
|
dir: ve,
|
|
467
458
|
className: "relative flex min-h-0 flex-1 flex-col",
|
|
468
459
|
style: Ue,
|
|
469
460
|
...ze,
|
|
470
461
|
children: [
|
|
471
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ y(le, {
|
|
472
463
|
isVisible: Re && !Y,
|
|
473
464
|
labels: ge
|
|
474
465
|
}),
|
|
475
|
-
/* @__PURE__ */
|
|
466
|
+
/* @__PURE__ */ y(F, {
|
|
476
467
|
title: W,
|
|
477
|
-
onBack:
|
|
478
|
-
backAriaLabel:
|
|
468
|
+
onBack: H,
|
|
469
|
+
backAriaLabel: U,
|
|
479
470
|
actions: Xe,
|
|
480
|
-
isSaving:
|
|
471
|
+
isSaving: T,
|
|
481
472
|
labels: { savingStatusLabel: X.savingStatusLabel },
|
|
482
473
|
styles: We,
|
|
483
|
-
leftContent: /* @__PURE__ */
|
|
474
|
+
leftContent: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("div", {
|
|
484
475
|
className: "px-4 py-4 desktop:hidden",
|
|
485
|
-
children: /* @__PURE__ */
|
|
476
|
+
children: /* @__PURE__ */ y(o, {
|
|
486
477
|
title: X.editingFileLabel ?? "Editing file",
|
|
487
478
|
description: $?.name ?? "SKILL.md",
|
|
488
479
|
expanded: Ie,
|
|
@@ -490,31 +481,31 @@ var M = {
|
|
|
490
481
|
ariaLabel: X.editingFileLabel ?? "Editing file",
|
|
491
482
|
children: Ye
|
|
492
483
|
})
|
|
493
|
-
}), /* @__PURE__ */
|
|
484
|
+
}), /* @__PURE__ */ y("div", {
|
|
494
485
|
className: "hidden px-8 py-6 desktop:block",
|
|
495
486
|
children: Ye
|
|
496
487
|
})] }),
|
|
497
|
-
rightContent: /* @__PURE__ */
|
|
488
|
+
rightContent: /* @__PURE__ */ b("div", {
|
|
498
489
|
className: "flex flex-1 flex-col gap-4 px-4 py-6 desktop:gap-5 desktop:px-8",
|
|
499
490
|
children: [
|
|
500
|
-
|
|
491
|
+
M != null && /* @__PURE__ */ y("div", {
|
|
501
492
|
role: "alert",
|
|
502
|
-
children: /* @__PURE__ */
|
|
493
|
+
children: /* @__PURE__ */ y(d, { text: M })
|
|
503
494
|
}),
|
|
504
|
-
|
|
495
|
+
N != null && /* @__PURE__ */ b("div", {
|
|
505
496
|
role: "alert",
|
|
506
497
|
className: "flex items-center gap-2",
|
|
507
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ y(d, { text: N.message }), /* @__PURE__ */ y(ee, {
|
|
508
499
|
label: X.reloadLatestLabel ?? "Reload latest",
|
|
509
|
-
onClick:
|
|
500
|
+
onClick: P
|
|
510
501
|
})]
|
|
511
502
|
}),
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
className: i(
|
|
514
|
-
children: q === "SKILL.md" ?
|
|
503
|
+
/* @__PURE__ */ y("h2", {
|
|
504
|
+
className: i(pe.title, Be),
|
|
505
|
+
children: q === "SKILL.md" ? L : X.selectedFileHeading?.($?.name ?? q) ?? $?.name ?? q
|
|
515
506
|
}),
|
|
516
|
-
q === "SKILL.md" ? /* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
507
|
+
q === "SKILL.md" ? /* @__PURE__ */ b(v, { children: [
|
|
508
|
+
/* @__PURE__ */ y(p, {
|
|
518
509
|
labelProps: {
|
|
519
510
|
label: X.nameLabel ?? "Name",
|
|
520
511
|
required: !0
|
|
@@ -525,12 +516,12 @@ var M = {
|
|
|
525
516
|
name: e ?? ""
|
|
526
517
|
})),
|
|
527
518
|
placeholder: X.namePlaceholder ?? "good-morning-breakfast",
|
|
528
|
-
caption:
|
|
529
|
-
error:
|
|
530
|
-
invalid: !!
|
|
531
|
-
disabled:
|
|
519
|
+
caption: O?.name ? void 0 : X.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
|
|
520
|
+
error: O?.name,
|
|
521
|
+
invalid: !!O?.name,
|
|
522
|
+
disabled: I
|
|
532
523
|
}),
|
|
533
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ y(_, {
|
|
534
525
|
labelProps: {
|
|
535
526
|
label: X.descriptionLabel ?? "Description",
|
|
536
527
|
required: !0
|
|
@@ -541,28 +532,28 @@ var M = {
|
|
|
541
532
|
...t,
|
|
542
533
|
description: e
|
|
543
534
|
})),
|
|
544
|
-
error:
|
|
545
|
-
invalid: !!
|
|
535
|
+
error: O?.description,
|
|
536
|
+
invalid: !!O?.description
|
|
546
537
|
}),
|
|
547
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ b("div", {
|
|
548
539
|
className: "flex flex-1 flex-col gap-2",
|
|
549
540
|
children: [
|
|
550
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ b("span", {
|
|
551
542
|
className: "flex items-center gap-0.5",
|
|
552
|
-
children: [/* @__PURE__ */
|
|
553
|
-
className: i(
|
|
543
|
+
children: [/* @__PURE__ */ y("span", {
|
|
544
|
+
className: i(pe.helperText, Ve),
|
|
554
545
|
children: X.instructionsLabel ?? "Instructions"
|
|
555
|
-
}), /* @__PURE__ */
|
|
546
|
+
}), /* @__PURE__ */ y("span", {
|
|
556
547
|
className: "dial-tiny-text text-error",
|
|
557
548
|
children: "*"
|
|
558
549
|
})]
|
|
559
550
|
}),
|
|
560
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ y("div", {
|
|
561
552
|
ref: be,
|
|
562
553
|
className: i(e, t),
|
|
563
|
-
children: /* @__PURE__ */
|
|
564
|
-
fallback: /* @__PURE__ */
|
|
565
|
-
children: /* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ y(w, {
|
|
555
|
+
fallback: /* @__PURE__ */ y(g, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
|
|
556
|
+
children: /* @__PURE__ */ y(me, {
|
|
566
557
|
value: G.instructions,
|
|
567
558
|
onChange: (e) => K((t) => ({
|
|
568
559
|
...t,
|
|
@@ -573,24 +564,23 @@ var M = {
|
|
|
573
564
|
})
|
|
574
565
|
})
|
|
575
566
|
}),
|
|
576
|
-
|
|
567
|
+
O?.instructions != null && /* @__PURE__ */ y(d, { text: O.instructions })
|
|
577
568
|
]
|
|
578
569
|
})
|
|
579
|
-
] }) : $?.kind ===
|
|
570
|
+
] }) : $?.kind === R.File && (ue ?? /* @__PURE__ */ y(s, { text: X.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))
|
|
580
571
|
]
|
|
581
572
|
})
|
|
582
573
|
}),
|
|
583
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ y(fe, {
|
|
584
575
|
isOpen: Y,
|
|
585
576
|
onClose: () => {
|
|
586
577
|
Ne(!1), Fe(void 0);
|
|
587
578
|
},
|
|
588
|
-
fileActions:
|
|
579
|
+
fileActions: B,
|
|
589
580
|
initialFiles: Pe,
|
|
590
581
|
labels: ge
|
|
591
582
|
})
|
|
592
583
|
]
|
|
593
584
|
});
|
|
594
585
|
};
|
|
595
|
-
|
|
596
|
-
export { W as SkillEditor, fe as SkillFileCandidateKind, I as SkillFileNodeKind, z as SkillFileValidationStatus };
|
|
586
|
+
export { W as SkillEditor, ue as SkillFileCandidateKind, R as SkillFileNodeKind, V as SkillFileValidationStatus };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-skill-editor",
|
|
3
3
|
"description": "Host-agnostic form for authoring a DIAL Skill, with an inline supporting-file tree",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.17",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"@uiw/react-markdown-preview": "^5.2.1",
|
|
22
22
|
"@uiw/react-md-editor": "^4.1.1",
|
|
23
|
-
"@epam/ai-dial-builder-form": "1.1.
|
|
23
|
+
"@epam/ai-dial-builder-form": "1.1.17"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.1.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.1.17",
|
|
27
27
|
"@epam/ai-dial-ui-kit": "^0.14.2",
|
|
28
28
|
"@epam/ai-dial-react-file-manager": "^0.2.0",
|
|
29
29
|
"react": "^19.2.8"
|