@epam/ai-dial-skill-editor 1.1.0-dev.293 → 1.1.0-dev.296

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