@epam/ai-dial-skill-editor 1.0.0 → 1.0.2

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":"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":"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 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, 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 A = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
9
- let [t, n] = E(!1), r = T(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: x((e) => {
14
- A(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: x((e) => {
17
- A(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: x((e) => {
20
- A(e) && e.preventDefault();
19
+ onDragOver: C((e) => {
20
+ M(e) && e.preventDefault();
21
21
  }, []),
22
- onDrop: x((t) => {
23
- if (!A(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
- }, j = "SKILL.md", M = /* @__PURE__ */ function(e) {
30
+ }, N = "SKILL.md", P = /* @__PURE__ */ function(e) {
31
31
  return e.File = "file", e.Folder = "folder", e;
32
- }({}), N = (e) => {
32
+ }({}), F = (e) => {
33
33
  let t = e.lastIndexOf("/");
34
34
  return t === -1 ? null : e.slice(0, t);
35
- }, P = (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 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: I(e),
45
45
  nodeType: r.FOLDER,
46
- parentPath: N(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 === M.Folder) {
53
+ if (i.kind === P.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: F(i.path),
62
+ folderId: F(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 = 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,385 +79,369 @@ 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__ */ 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__ */ k("div", {
86
+ children: /* @__PURE__ */ j("div", {
87
87
  className: "flex flex-col items-center text-center",
88
88
  children: [
89
- /* @__PURE__ */ O(v, {
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__ */ O("span", {
95
+ /* @__PURE__ */ A("span", {
95
96
  className: "dial-h3-text mt-5",
96
97
  children: r.dropOverlayTitle ?? "Upload files"
97
98
  }),
98
- /* @__PURE__ */ O("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
- }, F = /* @__PURE__ */ function(e) {
106
+ }, L = /* @__PURE__ */ function(e) {
106
107
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
107
- }({}), I = /* @__PURE__ */ function(e) {
108
+ }({}), R = /* @__PURE__ */ function(e) {
108
109
  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) => {
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: L(e)
115
+ path: z(e)
115
116
  }));
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) => ({
122
- id: z(),
117
+ S(void 0), l((e) => [...e, ...t]);
118
+ }, ae = (e) => {
119
+ l((t) => t.filter((t) => t.id !== e));
120
+ };
121
+ w(() => {
122
+ e && (l((i ?? []).map((e) => ({
123
+ id: B(),
123
124
  file: e,
124
- path: L(e)
125
- }))), g(/* @__PURE__ */ new Map()), y([]), D(void 0));
126
- }, [e]), S(() => {
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
- if (u.length === 0) {
130
- g(/* @__PURE__ */ new Map()), y([]);
130
+ if (s.length === 0) {
131
+ m(/* @__PURE__ */ new Map()), y([]);
131
132
  return;
132
133
  }
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)));
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 || x(!1);
137
+ t || b(!1);
137
138
  }), () => {
138
139
  t = !0;
139
140
  };
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);
141
+ }, [s, e]);
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);
146
144
  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);
145
+ let { results: e, batchErrors: t } = await r.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
146
+ if (m(i), y(t.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === R.Invalid) || t.length > 0) return;
147
+ let a = await r.commitBatch(s);
150
148
  if (a.error) {
151
- D(a.error);
149
+ S(a.error);
152
150
  return;
153
151
  }
154
- r();
152
+ n();
155
153
  } finally {
156
- j(!1);
154
+ E(!1);
157
155
  }
158
156
  };
159
- return /* @__PURE__ */ O(ne, {
157
+ return /* @__PURE__ */ A(g, {
160
158
  open: e,
161
159
  header: o.uploadDialogTitle ?? "Upload files from device",
162
- size: p.Sm,
160
+ size: te.Sm,
163
161
  closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
164
- onClose: r,
165
- footer: /* @__PURE__ */ k("div", {
162
+ onClose: n,
163
+ footer: /* @__PURE__ */ j("div", {
166
164
  className: "flex min-h-[44px] items-center justify-end gap-2 px-6 py-4",
167
- children: [/* @__PURE__ */ O(l, {
165
+ children: [/* @__PURE__ */ A(d, {
168
166
  label: o.uploadCancelLabel ?? "Cancel",
169
- onClick: r
170
- }), /* @__PURE__ */ O(m, {
167
+ onClick: n
168
+ }), /* @__PURE__ */ A(_, {
171
169
  label: o.uploadConfirmLabel ?? "Add",
172
- iconBefore: A ? /* @__PURE__ */ O(h, {
170
+ iconBefore: C ? /* @__PURE__ */ A(v, {
173
171
  size: 16,
174
172
  ariaLabel: ""
175
173
  }) : void 0,
176
- onClick: () => void V(),
177
- disabled: !le
174
+ onClick: () => void I(),
175
+ disabled: !F
178
176
  })]
179
177
  }),
180
- children: /* @__PURE__ */ k("div", {
178
+ children: /* @__PURE__ */ j("div", {
181
179
  className: "flex flex-col gap-4 px-6 py-4",
182
180
  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-primary", 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",
181
+ /* @__PURE__ */ A(ee, {
182
+ label: /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A("span", {
183
+ className: "desktop:hidden",
184
+ children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
185
+ }), /* @__PURE__ */ A("span", {
186
+ className: "hidden desktop:inline",
187
+ children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
188
+ })] }),
189
+ ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
210
190
  multiple: !0,
211
- className: "hidden",
212
- onChange: R
191
+ className: P ? "border-error hover:border-error" : void 0,
192
+ onChange: M
213
193
  }),
214
- /* @__PURE__ */ O("span", {
194
+ /* @__PURE__ */ A("span", {
215
195
  role: "status",
216
196
  "aria-live": "polite",
217
197
  className: "sr-only",
218
- id: M,
219
- children: _.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
198
+ id: D,
199
+ children: h.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
220
200
  }),
221
- _.map((e) => /* @__PURE__ */ O(c, { text: e }, e)),
222
- u.length > 0 && /* @__PURE__ */ O("ul", {
201
+ h.map((e) => /* @__PURE__ */ A(u, { text: e }, e)),
202
+ s.length > 0 && /* @__PURE__ */ A("ul", {
223
203
  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", {
204
+ children: s.map((e) => {
205
+ let n = p.get(e.id), r = n?.kind === L.Manifest, i = n?.status === R.Invalid;
206
+ return /* @__PURE__ */ j("li", {
227
207
  className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
228
208
  children: [
229
- /* @__PURE__ */ O(re, {
209
+ /* @__PURE__ */ A(ne, {
230
210
  size: 20,
231
- "aria-hidden": !0
211
+ "aria-hidden": !0,
212
+ stroke: c
232
213
  }),
233
- /* @__PURE__ */ k("div", {
214
+ /* @__PURE__ */ j("div", {
234
215
  className: "flex min-w-0 flex-1 flex-col",
235
216
  children: [
236
- /* @__PURE__ */ O("span", {
217
+ /* @__PURE__ */ A("span", {
237
218
  className: "dial-small-text truncate",
238
219
  children: e.path
239
220
  }),
240
- /* @__PURE__ */ O("span", {
221
+ /* @__PURE__ */ A("span", {
241
222
  className: "dial-tiny-text text-secondary",
242
223
  children: t(e.file.size)
243
224
  }),
244
- i && n?.error && /* @__PURE__ */ O(c, { text: n.error }),
245
- r && !i && /* @__PURE__ */ O("span", {
225
+ i && n?.error && /* @__PURE__ */ A(u, { text: n.error }),
226
+ r && !i && /* @__PURE__ */ A("span", {
246
227
  className: "dial-tiny-text text-secondary",
247
228
  children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
248
229
  })
249
230
  ]
250
231
  }),
251
- /* @__PURE__ */ O(te, {
252
- icon: /* @__PURE__ */ O(ie, {
232
+ /* @__PURE__ */ A(f, {
233
+ icon: /* @__PURE__ */ A(ie, {
253
234
  size: 16,
254
- "aria-hidden": !0
235
+ "aria-hidden": !0,
236
+ stroke: c
255
237
  }),
256
238
  "aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
257
- onClick: () => P(e.id)
239
+ onClick: () => ae(e.id)
258
240
  })
259
241
  ]
260
242
  }, e.id);
261
243
  })
262
244
  }),
263
- w && /* @__PURE__ */ O(c, { text: w })
245
+ x && /* @__PURE__ */ A(u, { text: x })
264
246
  ]
265
247
  })
266
248
  });
267
- }, B = {
249
+ }, V = {
268
250
  title: "_title_l82ak_1",
269
251
  helperText: "_helperText_l82ak_5",
270
252
  headerBorder: "_headerBorder_l82ak_9",
271
253
  sidebarBorder: "_sidebarBorder_l82ak_13",
272
254
  actionBarBorder: "_actionBarBorder_l82ak_17"
273
- }, le = b(async () => {
274
- let { MarkdownEditor: e } = await d();
255
+ }, ue = S(async () => {
256
+ let { MarkdownEditor: e } = await m();
275
257
  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({
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({
278
260
  name: t?.name ?? "",
279
261
  description: t?.description ?? "",
280
262
  instructions: t?.instructions ?? ""
281
- }), ge = T(t), _e = ge.current !== t, ve = T(r);
282
- S(() => {
283
- ge.current = t, W({
263
+ }), _e = D(t), ve = _e.current !== t, ye = D(r);
264
+ w(() => {
265
+ _e.current = t, W({
284
266
  name: t?.name ?? "",
285
267
  description: t?.description ?? "",
286
268
  instructions: t?.instructions ?? ""
287
- }), ve.current = r;
269
+ }), ye.current = r;
288
270
  }, [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;
271
+ let be = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), xe = D(!1);
272
+ w(() => {
273
+ if (ve) return;
292
274
  let e = {
293
275
  name: t?.name ?? "",
294
276
  description: t?.description ?? "",
295
277
  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));
278
+ }, n = JSON.stringify(U) !== JSON.stringify(e) || be(r) !== be(ye.current);
279
+ n !== xe.current && (xe.current = n, R?.(n));
298
280
  }, [
299
281
  U,
300
282
  r,
301
283
  t,
302
- _e,
303
- L
284
+ ve,
285
+ R
304
286
  ]);
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) => {
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) => {
308
290
  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) => {
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) => {
311
293
  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({
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({
313
295
  "--se-title-color": Z?.title,
314
296
  "--se-helper-text-color": Z?.helperText,
315
297
  "--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) => {
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) => {
321
303
  K(e.path);
322
- }, [K]), ze = x((e) => {
323
- R.onRemoveNode(e), G === e && K(j);
304
+ }, [K]), Be = C((e) => {
305
+ z.onRemoveNode(e), G === e && K(N);
324
306
  }, [
325
- R,
307
+ z,
326
308
  G,
327
309
  K
328
- ]), Be = x((e) => e.path === "SKILL.md" ? [] : [{
310
+ ]), Ve = C((e) => e.path === "SKILL.md" ? [] : [{
329
311
  key: "remove",
330
312
  label: X.removeLabel ?? "Remove",
331
- icon: /* @__PURE__ */ O(ie, {
332
- size: o.SM,
333
- className: Fe,
334
- "aria-hidden": !0
313
+ icon: /* @__PURE__ */ A(ie, {
314
+ size: s.SM,
315
+ className: Ie,
316
+ "aria-hidden": !0,
317
+ stroke: c
335
318
  }),
336
- onClick: () => ze(e.path)
319
+ onClick: () => Be(e.path)
337
320
  }], [
338
321
  X.removeLabel,
339
- Fe,
340
- ze
341
- ]), Ve = C(), He = C(), Ue = /* @__PURE__ */ k("div", {
322
+ Ie,
323
+ Be
324
+ ]), He = T(), Ue = T(), We = /* @__PURE__ */ j("div", {
342
325
  className: "flex flex-col gap-2 desktop:gap-5",
343
- children: [/* @__PURE__ */ k("div", {
326
+ children: [/* @__PURE__ */ j("div", {
344
327
  className: "flex items-center justify-between",
345
- children: [/* @__PURE__ */ O("span", {
346
- className: n(B.title, Ne),
328
+ children: [/* @__PURE__ */ A("span", {
329
+ className: n(V.title, Pe),
347
330
  children: X.filesHeading ?? "Files"
348
- }), /* @__PURE__ */ O(f, {
331
+ }), /* @__PURE__ */ A(h, {
349
332
  label: X.addUploadLabel ?? "Upload from device",
350
- iconBefore: /* @__PURE__ */ O(_, {
333
+ iconBefore: /* @__PURE__ */ A(re, {
351
334
  size: 16,
352
- "aria-hidden": !0
335
+ "aria-hidden": !0,
336
+ stroke: c
353
337
  }),
354
338
  onClick: () => {
355
339
  Y(void 0), J(!0);
356
340
  }
357
341
  })]
358
- }), /* @__PURE__ */ O("div", {
359
- id: Ve,
342
+ }), /* @__PURE__ */ A("div", {
343
+ id: He,
360
344
  role: "tree",
361
345
  "aria-label": X.filesTreeAriaLabel ?? "Skill files",
362
- children: /* @__PURE__ */ O(i, {
363
- items: Le,
346
+ children: /* @__PURE__ */ A(i, {
347
+ items: Re,
364
348
  showFiles: !0,
365
349
  selectedPath: G,
366
- expandedPaths: Ee,
367
- onExpandedPathsChange: De,
368
- onItemClick: Re,
369
- getContextMenuItems: Be,
350
+ expandedPaths: De,
351
+ onExpandedPathsChange: Oe,
352
+ onItemClick: ze,
353
+ getContextMenuItems: Ve,
370
354
  rootItemPath: ""
371
355
  })
372
356
  })]
373
- }), We = b ? X.savingStatusLabel ?? "Saving" : "", Ge = /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(l, {
357
+ }), Ge = b ? X.savingStatusLabel ?? "Saving" : "", Ke = /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(d, {
374
358
  label: X.cancelLabel ?? "Cancel",
375
- onClick: de,
359
+ onClick: fe,
376
360
  disabled: b
377
- }), /* @__PURE__ */ O(m, {
361
+ }), /* @__PURE__ */ A(_, {
378
362
  label: X.createLabel ?? "Create",
379
- iconBefore: b ? /* @__PURE__ */ O(h, {
363
+ iconBefore: b ? /* @__PURE__ */ A(v, {
380
364
  size: 16,
381
365
  ariaLabel: ""
382
366
  }) : void 0,
383
- onClick: () => ue(U),
367
+ onClick: () => de(U),
384
368
  disabled: b
385
369
  })] });
386
- return re ? /* @__PURE__ */ O("div", {
370
+ return te ? /* @__PURE__ */ A("div", {
387
371
  className: "flex h-full items-center justify-center",
388
- children: /* @__PURE__ */ O(h, { ariaLabel: X.loadingAriaLabel ?? "Loading skill" })
389
- }) : v ? /* @__PURE__ */ k("div", {
372
+ children: /* @__PURE__ */ A(v, { ariaLabel: X.loadingAriaLabel ?? "Loading skill" })
373
+ }) : ne ? /* @__PURE__ */ j("div", {
390
374
  role: "alert",
391
375
  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, {
376
+ children: [/* @__PURE__ */ A(u, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ A(_, {
393
377
  label: X.retryLabel ?? "Retry",
394
- onClick: fe
378
+ onClick: pe
395
379
  })]
396
- }) : /* @__PURE__ */ k("div", {
397
- dir: me,
380
+ }) : /* @__PURE__ */ j("div", {
381
+ dir: he,
398
382
  className: "relative flex h-full flex-col",
399
- style: Ie,
400
- ...Me,
383
+ style: Le,
384
+ ...Ne,
401
385
  children: [
402
- /* @__PURE__ */ O(se, {
403
- isVisible: je && !q,
386
+ /* @__PURE__ */ A(se, {
387
+ isVisible: Me && !q,
404
388
  labels: H
405
389
  }),
406
- /* @__PURE__ */ O("span", {
390
+ /* @__PURE__ */ A("span", {
407
391
  role: "status",
408
392
  "aria-live": "polite",
409
393
  className: "sr-only",
410
- id: He,
411
- children: We
394
+ id: Ue,
395
+ children: Ge
412
396
  }),
413
- N && /* @__PURE__ */ O("div", {
397
+ M && /* @__PURE__ */ A("div", {
414
398
  role: "alert",
415
399
  className: "px-4 pt-2",
416
- children: /* @__PURE__ */ O(c, { text: N })
400
+ children: /* @__PURE__ */ A(u, { text: M })
417
401
  }),
418
- P && /* @__PURE__ */ k("div", {
402
+ F && /* @__PURE__ */ j("div", {
419
403
  role: "alert",
420
404
  className: "flex items-center gap-2 px-4 pt-2",
421
- children: [/* @__PURE__ */ O(c, { text: P.message }), /* @__PURE__ */ O(l, {
405
+ children: [/* @__PURE__ */ A(u, { text: F.message }), /* @__PURE__ */ A(d, {
422
406
  label: X.reloadLatestLabel ?? "Reload latest",
423
- onClick: F
407
+ onClick: I
424
408
  })]
425
409
  }),
426
- /* @__PURE__ */ k("div", {
427
- 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", {
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", {
429
413
  className: "flex min-w-0 flex-1 items-center gap-2",
430
- children: z
431
- }), /* @__PURE__ */ O("div", {
414
+ children: ce
415
+ }), /* @__PURE__ */ A("div", {
432
416
  className: "flex shrink-0 items-center gap-2",
433
- children: Ge
417
+ children: Ke
434
418
  })]
435
419
  }),
436
- /* @__PURE__ */ k("div", {
420
+ /* @__PURE__ */ j("div", {
437
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",
438
422
  children: [
439
- /* @__PURE__ */ O("div", {
423
+ /* @__PURE__ */ A("div", {
440
424
  className: "desktop:hidden",
441
- children: /* @__PURE__ */ O(a, {
425
+ children: /* @__PURE__ */ A(a, {
442
426
  title: X.editingFileLabel ?? "Editing file",
443
427
  description: $?.name ?? "SKILL.md",
444
- expanded: ke,
445
- onToggle: Ae,
428
+ expanded: Ae,
429
+ onToggle: je,
446
430
  ariaLabel: X.editingFileLabel ?? "Editing file",
447
- children: Ue
431
+ children: We
448
432
  })
449
433
  }),
450
- /* @__PURE__ */ O("div", {
451
- className: n("hidden border-e desktop:block desktop:w-[360px] desktop:shrink-0 desktop:px-8 desktop:py-6", B.sidebarBorder),
452
- children: Ue
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
453
437
  }),
454
- /* @__PURE__ */ k("div", {
438
+ /* @__PURE__ */ j("div", {
455
439
  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, {
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, {
461
445
  labelProps: {
462
446
  label: X.nameLabel ?? "Name",
463
447
  required: !0
@@ -468,12 +452,12 @@ var A = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
468
452
  name: e ?? ""
469
453
  })),
470
454
  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,
474
- disabled: I
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
475
459
  }),
476
- /* @__PURE__ */ O(g, {
460
+ /* @__PURE__ */ A(y, {
477
461
  labelProps: {
478
462
  label: X.descriptionLabel ?? "Description",
479
463
  required: !0
@@ -484,56 +468,56 @@ var A = (e) => !!e.dataTransfer?.types.includes("Files"), ae = (e) => {
484
468
  ...t,
485
469
  description: e
486
470
  })),
487
- error: A?.description,
488
- invalid: !!A?.description
471
+ error: S?.description,
472
+ invalid: !!S?.description
489
473
  }),
490
- /* @__PURE__ */ k("div", {
474
+ /* @__PURE__ */ j("div", {
491
475
  className: "flex flex-1 flex-col gap-2",
492
476
  children: [
493
- /* @__PURE__ */ k("span", {
477
+ /* @__PURE__ */ j("span", {
494
478
  className: "flex items-center gap-0.5",
495
- children: [/* @__PURE__ */ O("span", {
496
- className: n(B.helperText, Pe),
479
+ children: [/* @__PURE__ */ A("span", {
480
+ className: n(V.helperText, Fe),
497
481
  children: X.instructionsLabel ?? "Instructions"
498
- }), /* @__PURE__ */ O("span", {
482
+ }), /* @__PURE__ */ A("span", {
499
483
  className: "dial-tiny-text text-error",
500
484
  children: "*"
501
485
  })]
502
486
  }),
503
- /* @__PURE__ */ O(y, {
504
- fallback: /* @__PURE__ */ O(h, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
505
- children: /* @__PURE__ */ O(le, {
487
+ /* @__PURE__ */ A(x, {
488
+ fallback: /* @__PURE__ */ A(v, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
489
+ children: /* @__PURE__ */ A(ue, {
506
490
  value: U.instructions,
507
491
  onChange: (e) => W((t) => ({
508
492
  ...t,
509
493
  instructions: e
510
494
  })),
511
- theme: he,
495
+ theme: ge,
512
496
  placeholder: X.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
513
497
  })
514
498
  }),
515
- A?.instructions && /* @__PURE__ */ O(c, { text: A.instructions })
499
+ S?.instructions && /* @__PURE__ */ A(u, { text: S.instructions })
516
500
  ]
517
501
  })
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." }))]
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." }))]
519
503
  })
520
504
  ]
521
505
  }),
522
- /* @__PURE__ */ O("div", {
523
- className: n("fixed inset-x-0 bottom-0 flex items-center gap-2 border-t p-3 desktop:hidden", B.actionBarBorder),
524
- 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
525
509
  }),
526
- /* @__PURE__ */ O(ce, {
510
+ /* @__PURE__ */ A(le, {
527
511
  isOpen: q,
528
512
  onClose: () => {
529
513
  J(!1), Y(void 0);
530
514
  },
531
- fileActions: R,
532
- initialFiles: Oe,
515
+ fileActions: z,
516
+ initialFiles: ke,
533
517
  labels: H
534
518
  })
535
519
  ]
536
520
  });
537
521
  };
538
522
  //#endregion
539
- export { V as SkillEditor, F as SkillFileCandidateKind, M as SkillFileNodeKind, I 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.0.0",
4
+ "version": "1.0.2",
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.0.0",
19
+ "@epam/ai-dial-chat-shared": "1.0.2",
20
20
  "@epam/ai-dial-ui-kit": "*",
21
- "@epam/ai-dial-react-file-manager": "^0.2.0-dev.3",
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
  },