@epam/ai-dial-skill-editor 1.1.0-dev.297 → 1.1.0-dev.299

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