@epam/ai-dial-prompt-editor 1.3.0-dev.246 → 1.3.0-dev.249

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":"PromptEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PromptEditor/PromptEditor.tsx"],"names":[],"mappings":"AAqCA,OAAO,0CAA0C,CAAC;AAClD,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAGL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,kCAAkC,CAAC;AA2C1C,uDAAuD;AACvD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA8a9C,CAAC"}
1
+ {"version":3,"file":"PromptEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PromptEditor/PromptEditor.tsx"],"names":[],"mappings":"AAuCA,OAAO,0CAA0C,CAAC;AAClD,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAGL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,kCAAkC,CAAC;AA2C1C,uDAAuD;AACvD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA2a9C,CAAC"}
package/index.js CHANGED
@@ -1,283 +1,280 @@
1
1
  import { DEFAULT_METADATA_FORM_LABELS as e, EntityEditor as t, MetadataField as n, MetadataForm as r } from "@epam/ai-dial-builder-form";
2
2
  import { ConfirmationDialog as i, MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME as a, MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as o, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as s, TextRefinementField as c, buildCssVars as l, mergeClasses as u, useAvailableHeightCap as d, useControlErrorAssociation as f, useTextRefinement as p, useUnsavedChangesGuard as ee } from "@epam/ai-dial-chat-shared";
3
- import { ConfirmationPopupVariant as m, DIAL_ICON_SIZE as h, DIAL_KIT_ICON_STROKE as g, ElementSize as _, ErrorMessageNotification as v, ErrorText as y, GhostIconButton as b, Input as x, Label as S, NeutralButton as C, Select as w, Spinner as T } from "@epam/ai-dial-ui-kit";
4
- import { LazyMarkdownEditor as E } from "@epam/ai-dial-ui-kit/editors";
5
- import { Suspense as te, lazy as D, useCallback as O, useEffect as k, useId as A, useMemo as j, useRef as ne, useState as M } from "react";
6
- import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
7
- import { IconFolderPlus as I, IconPencil as L, IconTrashX as R } from "@tabler/icons-react";
3
+ import { ConfirmationPopupVariant as m, DIAL_ICON_SIZE as h, DIAL_KIT_ICON_STROKE as g, ElementSize as _, ErrorMessageNotification as v, ErrorText as y, GhostIconButton as b, Input as x, Label as S, LiveRegion as te, LiveRegionElement as ne, NeutralButton as C, Select as w, Spinner as re } from "@epam/ai-dial-ui-kit";
4
+ import { LazyMarkdownEditor as T } from "@epam/ai-dial-ui-kit/editors";
5
+ import { Suspense as ie, lazy as E, useCallback as D, useEffect as O, useId as k, useMemo as A, useRef as ae, useState as j } from "react";
6
+ import { Fragment as oe, jsx as M, jsxs as N } from "react/jsx-runtime";
7
+ import { IconFolderPlus as P, IconPencil as F, IconTrashX as I } from "@tabler/icons-react";
8
8
  //#region src/constants/public-class-names.ts
9
- var re = {
9
+ var L = {
10
10
  form: "dial-prompt-editor-form",
11
11
  folderField: "dial-prompt-editor-folder-field"
12
- }, ie = {
12
+ }, R = {
13
13
  contentError: "_contentError_1qtel_1",
14
14
  contentInvalid: "_contentInvalid_1qtel_6"
15
- }, ae = D(async () => ({ default: (await E()).MarkdownEditor })), oe = {
15
+ }, se = E(async () => ({ default: (await T()).MarkdownEditor })), z = {
16
16
  name: "",
17
17
  description: "",
18
18
  content: ""
19
- }, se = [n.Name, n.Description], ce = 2e3, le = 5e4, ue = 10, de = "mx-auto w-full max-w-[1180px] gap-5 px-4 py-6 desktop:px-8 desktop:py-6", fe = 24, pe = 480, me = (e, t, n) => {
19
+ }, ce = [n.Name, n.Description], le = 2e3, ue = 5e4, de = 10, fe = "mx-auto w-full max-w-[1180px] gap-5 px-4 py-6 desktop:px-8 desktop:py-6", pe = 24, me = 480, he = (e, t, n) => {
20
20
  let r = t - e.length;
21
21
  return r <= n ? Math.max(r, 0) : null;
22
- }, z = ({ isEditMode: n = !1, initialValues: h, isLoading: _ = !1, hasLoadError: b = !1, isSaving: x = !1, errors: w, descriptionMaxLength: E = ce, contentMaxLength: D = le, counterAnnounceThreshold: I = ue, onSubmit: L, onFieldChange: R, onCancel: z, onBack: B = z, onDirtyChange: V, onRetry: H, onRefineDescription: U, onRefineInstructions: W, labels: G, markdownEditorTheme: he, styles: ge }) => {
23
- let { colors: _e, typography: ve } = ge ?? {}, ye = ve?.contentLabelClassName ?? "dial-tiny-semi-text", be = ve?.helperTextClassName ?? "dial-small-text", K = j(() => ({
24
- ...oe,
22
+ }, B = ({ isEditMode: n = !1, initialValues: h, isLoading: _ = !1, hasLoadError: b = !1, isSaving: x = !1, errors: w, descriptionMaxLength: T = le, contentMaxLength: E = ue, counterAnnounceThreshold: P = de, onSubmit: F, onFieldChange: I, onCancel: B, onBack: V = B, onDirtyChange: H, onRetry: U, onRefineDescription: W, onRefineInstructions: G, labels: K, markdownEditorTheme: ge, styles: _e }) => {
23
+ let { colors: ve, typography: ye } = _e ?? {}, be = ye?.contentLabelClassName ?? "dial-tiny-semi-text", xe = ye?.helperTextClassName ?? "dial-small-text", q = A(() => ({
24
+ ...z,
25
25
  ...h
26
- }), [h]), [q, xe] = M(K), Se = A(), J = A(), Ce = A();
27
- f(() => document.getElementById(J), Ce, !!w?.content);
28
- let we = d({
29
- bottomGap: fe,
30
- minHeight: pe
26
+ }), [h]), [J, Se] = j(q), Ce = k(), Y = k(), we = k();
27
+ f(() => document.getElementById(Y), we, !!w?.content);
28
+ let Te = d({
29
+ bottomGap: pe,
30
+ minHeight: me
31
31
  });
32
- k(() => {
33
- xe(K);
34
- }, [K]);
35
- let Te = O((e, t) => {
36
- xe((n) => ({
32
+ O(() => {
33
+ Se(q);
34
+ }, [q]);
35
+ let Ee = D((e, t) => {
36
+ Se((n) => ({
37
37
  ...n,
38
38
  [e]: t
39
- })), R?.(e, t);
40
- }, [R]), Ee = j(() => ({
41
- name: q.name,
42
- description: q.description,
39
+ })), I?.(e, t);
40
+ }, [I]), De = A(() => ({
41
+ name: J.name,
42
+ description: J.description,
43
43
  iconUrl: "",
44
44
  version: "",
45
45
  topics: [],
46
46
  otherLocales: []
47
- }), [q.name, q.description]), De = O((e) => {
48
- xe((t) => ({
47
+ }), [J.name, J.description]), Oe = D((e) => {
48
+ Se((t) => ({
49
49
  ...t,
50
50
  ...e.name !== void 0 && { name: e.name },
51
51
  ...e.description !== void 0 && { description: e.description }
52
- })), e.name !== void 0 && R?.("name", e.name), e.description !== void 0 && R?.("description", e.description);
53
- }, [R]), Oe = j(() => ({
52
+ })), e.name !== void 0 && I?.("name", e.name), e.description !== void 0 && I?.("description", e.description);
53
+ }, [I]), ke = A(() => ({
54
54
  name: w?.name,
55
55
  description: w?.description
56
- }), [w?.name, w?.description]), ke = j(() => ({ form: {
56
+ }), [w?.name, w?.description]), Ae = A(() => ({ form: {
57
57
  ...e,
58
58
  name: {
59
- label: G?.nameLabel ?? "Name",
60
- placeholder: G?.namePlaceholder ?? "Prompt name"
59
+ label: K?.nameLabel ?? "Name",
60
+ placeholder: K?.namePlaceholder ?? "Prompt name"
61
61
  },
62
62
  description: {
63
- label: G?.descriptionLabel ?? "Description",
64
- placeholder: G?.descriptionPlaceholder ?? "What this prompt is for"
63
+ label: K?.descriptionLabel ?? "Description",
64
+ placeholder: K?.descriptionPlaceholder ?? "What this prompt is for"
65
65
  },
66
66
  ariaLabel: void 0
67
67
  } }), [
68
- G?.nameLabel,
69
- G?.namePlaceholder,
70
- G?.descriptionLabel,
71
- G?.descriptionPlaceholder
72
- ]), Ae = p({
73
- value: q.description,
74
- onChange: (e) => Te("description", e),
75
- onRefine: U,
68
+ K?.nameLabel,
69
+ K?.namePlaceholder,
70
+ K?.descriptionLabel,
71
+ K?.descriptionPlaceholder
72
+ ]), je = p({
73
+ value: J.description,
74
+ onChange: (e) => Ee("description", e),
75
+ onRefine: W,
76
76
  disabled: x,
77
77
  resetKey: h
78
- }), je = p({
79
- value: q.content,
80
- onChange: (e) => Te("content", e),
81
- onRefine: W,
78
+ }), Me = p({
79
+ value: J.content,
80
+ onChange: (e) => Ee("content", e),
81
+ onRefine: G,
82
82
  disabled: x,
83
83
  resetKey: h
84
- }), Y = Ae.isPending || je.isPending, Me = U ? (e, t) => /* @__PURE__ */ P(c, {
84
+ }), X = je.isPending || Me.isPending, Ne = W ? (e, t) => /* @__PURE__ */ M(c, {
85
85
  isEnabled: !0,
86
86
  fieldId: t,
87
- label: G?.descriptionLabel ?? "Description",
88
- labels: G,
89
- refinement: Ae,
90
- disabled: Y || x,
87
+ label: K?.descriptionLabel ?? "Description",
88
+ labels: K,
89
+ refinement: je,
90
+ disabled: X || x,
91
91
  children: e
92
- }) : void 0, Ne = q.name !== K.name || q.description !== K.description || q.content !== K.content, X = ee(Ne && !V);
93
- k(() => {
94
- V?.(Ne);
95
- }, [Ne, V]);
96
- let { guard: Z } = X, { reset: Pe } = Ae, { reset: Fe } = je, Q = O(() => {
97
- Pe(), Fe();
98
- }, [Pe, Fe]), Ie = O(() => {
99
- Z(() => {
100
- Q(), B();
92
+ }) : void 0, Pe = J.name !== q.name || J.description !== q.description || J.content !== q.content, Z = ee(Pe && !H);
93
+ O(() => {
94
+ H?.(Pe);
95
+ }, [Pe, H]);
96
+ let { guard: Q } = Z, { reset: Fe } = je, { reset: Ie } = Me, $ = D(() => {
97
+ Fe(), Ie();
98
+ }, [Fe, Ie]), Le = D(() => {
99
+ Q(() => {
100
+ $(), V();
101
101
  });
102
102
  }, [
103
- Z,
104
103
  Q,
105
- B
106
- ]), Le = O(() => {
107
- Z(() => {
108
- Q(), z();
104
+ $,
105
+ V
106
+ ]), Re = D(() => {
107
+ Q(() => {
108
+ $(), B();
109
109
  });
110
110
  }, [
111
- Z,
112
111
  Q,
113
- z
114
- ]), Re = O(() => {
115
- x || Y || L(q);
112
+ $,
113
+ B
114
+ ]), ze = D(() => {
115
+ x || X || F(J);
116
116
  }, [
117
117
  x,
118
- Y,
119
- L,
120
- q
121
- ]), ze = w?.content != null && !w?.name && !w?.description, Be = ne(!1);
122
- k(() => {
123
- ze && !Be.current && document.getElementById(J)?.focus(), Be.current = ze;
124
- }, [ze, J]);
125
- let Ve = n ? G?.editTitle ?? "Edit prompt" : G?.createTitle ?? "Create prompt", He = n ? G?.saveLabel ?? "Save" : G?.createLabel ?? "Create", Ue = j(() => ({
126
- cancelLabel: G?.cancelLabel ?? "Cancel",
127
- backAriaLabel: G?.backButtonAriaLabel ?? "Back to prompts",
128
- savingStatusLabel: G?.savingStatusLabel ?? "Saving"
118
+ X,
119
+ F,
120
+ J
121
+ ]), Be = w?.content != null && !w?.name && !w?.description, Ve = ae(!1);
122
+ O(() => {
123
+ Be && !Ve.current && document.getElementById(Y)?.focus(), Ve.current = Be;
124
+ }, [Be, Y]);
125
+ let He = n ? K?.editTitle ?? "Edit prompt" : K?.createTitle ?? "Create prompt", Ue = n ? K?.saveLabel ?? "Save" : K?.createLabel ?? "Create", We = A(() => ({
126
+ cancelLabel: K?.cancelLabel ?? "Cancel",
127
+ backAriaLabel: K?.backButtonAriaLabel ?? "Back to prompts",
128
+ savingStatusLabel: K?.savingStatusLabel ?? "Saving"
129
129
  }), [
130
- G?.cancelLabel,
131
- G?.backButtonAriaLabel,
132
- G?.savingStatusLabel
133
- ]), We = l({
134
- "--pe-content-error": _e?.contentErrorText,
135
- "--pe-content-invalid-border": _e?.contentInvalidBorder
136
- }), $ = {
137
- title: Ve,
138
- onBack: B,
139
- onCancel: z,
140
- onSubmit: Re,
141
- submitLabel: He,
142
- labels: Ue,
130
+ K?.cancelLabel,
131
+ K?.backButtonAriaLabel,
132
+ K?.savingStatusLabel
133
+ ]), Ge = l({
134
+ "--pe-content-error": ve?.contentErrorText,
135
+ "--pe-content-invalid-border": ve?.contentInvalidBorder
136
+ }), Ke = {
137
+ title: He,
138
+ onBack: V,
139
+ onCancel: B,
140
+ onSubmit: ze,
141
+ submitLabel: Ue,
142
+ labels: We,
143
143
  metadataTitle: null
144
144
  };
145
- if (_) return /* @__PURE__ */ P(t, {
146
- ...$,
145
+ if (_) return /* @__PURE__ */ M(t, {
146
+ ...Ke,
147
147
  isSubmitting: x,
148
- metadata: /* @__PURE__ */ P("div", {
149
- role: "status",
150
- "aria-label": G?.loadingAriaLabel ?? "Loading prompt",
148
+ metadata: /* @__PURE__ */ M("div", {
151
149
  className: "flex flex-1 items-center justify-center p-8",
152
- children: /* @__PURE__ */ P(T, {})
150
+ children: /* @__PURE__ */ M(re, { ariaLabel: K?.loadingAriaLabel ?? "Loading prompt" })
153
151
  })
154
152
  });
155
- if (b) return /* @__PURE__ */ P(t, {
156
- ...$,
157
- metadata: /* @__PURE__ */ P(v, {
158
- message: G?.loadErrorMessage ?? "Couldn't load this prompt. Please try again.",
159
- textClassName: be,
153
+ if (b) return /* @__PURE__ */ M(t, {
154
+ ...Ke,
155
+ metadata: /* @__PURE__ */ M(v, {
156
+ message: K?.loadErrorMessage ?? "Couldn't load this prompt. Please try again.",
157
+ textClassName: xe,
160
158
  iconStroke: g,
161
- action: H != null && /* @__PURE__ */ P(C, {
162
- label: G?.retryLabel ?? "Retry",
163
- onClick: H
159
+ action: U != null && /* @__PURE__ */ M(C, {
160
+ label: K?.retryLabel ?? "Retry",
161
+ onClick: U
164
162
  })
165
163
  })
166
164
  });
167
- let Ge = me(q.description, E, I), Ke = me(q.content, D, I), qe = (e) => G?.charactersRemaining?.(e) ?? `${e} characters remaining`, Je = G?.contentLabel ?? "Instructions", Ye = /* @__PURE__ */ P("div", {
168
- ref: we,
169
- className: u(o, a, s, w?.content != null && ie.contentInvalid),
170
- children: /* @__PURE__ */ P(te, {
171
- fallback: /* @__PURE__ */ P(T, { ariaLabel: G?.contentLoadingAriaLabel ?? "Loading prompt editor" }),
172
- children: /* @__PURE__ */ P(ae, {
173
- id: J,
174
- value: q.content,
175
- onChange: (e) => Te("content", e),
165
+ let qe = he(J.description, T, P), Je = he(J.content, E, P), Ye = (e) => K?.charactersRemaining?.(e) ?? `${e} characters remaining`, Xe = K?.contentLabel ?? "Instructions", Ze = /* @__PURE__ */ M("div", {
166
+ ref: Te,
167
+ className: u(o, a, s, w?.content != null && R.contentInvalid),
168
+ children: /* @__PURE__ */ M(ie, {
169
+ fallback: /* @__PURE__ */ M(re, { ariaLabel: K?.contentLoadingAriaLabel ?? "Loading prompt editor" }),
170
+ children: /* @__PURE__ */ M(se, {
171
+ id: Y,
172
+ value: J.content,
173
+ onChange: (e) => Ee("content", e),
176
174
  height: 480,
177
- placeholder: G?.contentPlaceholder ?? "Write the prompt instructions",
178
- theme: he,
175
+ placeholder: K?.contentPlaceholder ?? "Write the prompt instructions",
176
+ theme: ge,
179
177
  showDragbar: !1
180
178
  })
181
179
  })
182
- }), Xe = /* @__PURE__ */ P(y, {
183
- id: Ce,
180
+ }), Qe = /* @__PURE__ */ M(y, {
181
+ id: we,
184
182
  text: w?.content,
185
- className: u(be, ie.contentError)
183
+ className: u(xe, R.contentError)
186
184
  });
187
- return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(t, {
188
- ...$,
189
- onBack: Ie,
190
- onCancel: Le,
185
+ return /* @__PURE__ */ N(oe, { children: [/* @__PURE__ */ M(t, {
186
+ ...Ke,
187
+ onBack: Le,
188
+ onCancel: Re,
191
189
  isSubmitting: x,
192
- isSubmitDisabled: Y,
193
- metadataSectionClassName: u(de, re.form),
194
- metadata: /* @__PURE__ */ F(N, { children: [
195
- /* @__PURE__ */ P(r, {
196
- values: Ee,
197
- errors: Oe,
198
- onChange: De,
199
- fields: se,
200
- renderDescription: Me,
201
- labels: ke,
202
- descriptionCaption: q.description ? `${q.description.length}/${E}` : void 0
190
+ isSubmitDisabled: X,
191
+ metadataSectionClassName: u(fe, L.form),
192
+ metadata: /* @__PURE__ */ N(oe, { children: [
193
+ /* @__PURE__ */ M(r, {
194
+ values: De,
195
+ errors: ke,
196
+ onChange: Oe,
197
+ fields: ce,
198
+ renderDescription: Ne,
199
+ labels: Ae,
200
+ descriptionCaption: J.description ? `${J.description.length}/${T}` : void 0
203
201
  }),
204
- W ? /* @__PURE__ */ P("div", {
202
+ G ? /* @__PURE__ */ M("div", {
205
203
  className: "flex flex-1 flex-col",
206
- style: We,
207
- children: /* @__PURE__ */ P(c, {
204
+ style: Ge,
205
+ children: /* @__PURE__ */ M(c, {
208
206
  isEnabled: !0,
209
- fieldId: J,
210
- label: Je,
211
- labelClassName: ye,
207
+ fieldId: Y,
208
+ label: Xe,
209
+ labelClassName: be,
212
210
  required: !0,
213
- labels: G,
214
- refinement: je,
215
- disabled: Y || x,
216
- children: /* @__PURE__ */ F("div", {
211
+ labels: K,
212
+ refinement: Me,
213
+ disabled: X || x,
214
+ children: /* @__PURE__ */ N("div", {
217
215
  className: "flex flex-col gap-2",
218
- children: [Ye, Xe]
216
+ children: [Ze, Qe]
219
217
  })
220
218
  })
221
- }) : /* @__PURE__ */ F("div", {
219
+ }) : /* @__PURE__ */ N("div", {
222
220
  role: "group",
223
- "aria-labelledby": Se,
221
+ "aria-labelledby": Ce,
224
222
  className: "flex flex-1 flex-col gap-2",
225
- style: We,
223
+ style: Ge,
226
224
  children: [
227
- /* @__PURE__ */ P(S, {
228
- id: Se,
229
- htmlFor: J,
230
- label: Je,
225
+ /* @__PURE__ */ M(S, {
226
+ id: Ce,
227
+ htmlFor: Y,
228
+ label: Xe,
231
229
  required: !0,
232
- className: ye
230
+ className: be
233
231
  }),
234
- Ye,
235
- Xe
232
+ Ze,
233
+ Qe
236
234
  ]
237
235
  }),
238
- /* @__PURE__ */ F("span", {
239
- role: "status",
240
- "aria-live": "polite",
241
- className: "sr-only",
242
- children: [Ge != null && qe(Ge), Ke != null && qe(Ke)]
236
+ /* @__PURE__ */ N(te, {
237
+ visuallyHidden: !0,
238
+ as: ne.Span,
239
+ children: [qe != null && Ye(qe), Je != null && Ye(Je)]
243
240
  })
244
241
  ] })
245
- }), X.isConfirmOpen && /* @__PURE__ */ P(i, {
242
+ }), Z.isConfirmOpen && /* @__PURE__ */ M(i, {
246
243
  open: !0,
247
- title: G?.discardTitle ?? "Discard unsaved changes?",
248
- message: G?.discardMessage ?? "You have unsaved changes. Leaving now will discard them.",
249
- confirmLabel: G?.discardConfirmLabel ?? "Discard",
250
- cancelLabel: G?.discardCancelLabel ?? "Keep editing",
244
+ title: K?.discardTitle ?? "Discard unsaved changes?",
245
+ message: K?.discardMessage ?? "You have unsaved changes. Leaving now will discard them.",
246
+ confirmLabel: K?.discardConfirmLabel ?? "Discard",
247
+ cancelLabel: K?.discardCancelLabel ?? "Keep editing",
251
248
  variant: m.Danger,
252
- onConfirm: X.confirm,
253
- onClose: X.dismiss
249
+ onConfirm: Z.confirm,
250
+ onClose: Z.dismiss
254
251
  })] });
255
- }, B = /* @__PURE__ */ function(e) {
252
+ }, V = /* @__PURE__ */ function(e) {
256
253
  return e.Create = "create", e.Rename = "rename", e.ConfirmDelete = "confirmDelete", e;
257
- }({}), V = "", H = "__root__", U = (e) => e.split("/").pop() ?? "", W = ({ value: e, folders: t, error: n, nameError: r, actions: i, disabled: a = !1, labels: o, helperTextClassName: s = "dial-small-text", onChange: c }) => {
258
- let [l, d] = M(null), [f, p] = M(""), [ee, m] = M(), [v, y] = M(!1), S = e === V, T = o?.folderRootOption ?? "Root", E = o?.folderEmptyState ?? "No folders yet", te = j(() => [{
259
- value: H,
260
- label: T
254
+ }({}), H = "", U = "__root__", W = (e) => e.split("/").pop() ?? "", G = ({ value: e, folders: t, error: n, nameError: r, actions: i, disabled: a = !1, labels: o, helperTextClassName: s = "dial-small-text", onChange: c }) => {
255
+ let [l, d] = j(null), [f, p] = j(""), [ee, m] = j(), [v, y] = j(!1), S = e === H, te = o?.folderRootOption ?? "Root", ne = o?.folderEmptyState ?? "No folders yet", re = A(() => [{
256
+ value: U,
257
+ label: te
261
258
  }, ...t.map((e) => ({
262
259
  value: e.id,
263
260
  label: e.id
264
- }))], [t, T]), D = O(() => {
261
+ }))], [t, te]), T = D(() => {
265
262
  d(null), p(""), m(void 0);
266
- }, []), k = O(async () => {
263
+ }, []), ie = D(async () => {
267
264
  if (v || i == null) return;
268
265
  let t = f.trim(), n = i.onValidateFolderName?.(t);
269
266
  if (n != null) m(n);
270
267
  else {
271
268
  m(void 0), y(!0);
272
269
  try {
273
- if (l === B.Create) {
270
+ if (l === V.Create) {
274
271
  let n = await i.onCreateFolder(t, S ? void 0 : e);
275
272
  typeof n == "string" && c(n);
276
273
  } else {
277
274
  let n = await i.onRenameFolder(e, t);
278
275
  typeof n == "string" && c(n);
279
276
  }
280
- D();
277
+ T();
281
278
  } catch {} finally {
282
279
  y(!1);
283
280
  }
@@ -290,12 +287,12 @@ var re = {
290
287
  S,
291
288
  e,
292
289
  c,
293
- D
294
- ]), A = O(async () => {
290
+ T
291
+ ]), E = D(async () => {
295
292
  if (!(v || i == null)) {
296
293
  y(!0);
297
294
  try {
298
- await i.onDeleteFolder(e), c(V), D();
295
+ await i.onDeleteFolder(e), c(H), T();
299
296
  } catch {} finally {
300
297
  y(!1);
301
298
  }
@@ -305,55 +302,55 @@ var re = {
305
302
  i,
306
303
  e,
307
304
  c,
308
- D
309
- ]), ne = O(() => {
310
- p(""), m(void 0), d(B.Create);
311
- }, []), ie = O(() => {
312
- p(U(e)), m(void 0), d(B.Rename);
313
- }, [e]), ae = O(() => {
314
- m(void 0), d(B.ConfirmDelete);
315
- }, []), oe = O((e) => {
305
+ T
306
+ ]), O = D(() => {
307
+ p(""), m(void 0), d(V.Create);
308
+ }, []), k = D(() => {
309
+ p(W(e)), m(void 0), d(V.Rename);
310
+ }, [e]), ae = D(() => {
311
+ m(void 0), d(V.ConfirmDelete);
312
+ }, []), R = D((e) => {
316
313
  let t = Array.isArray(e) ? e[0] : e;
317
- t != null && c(t === H ? V : t);
318
- }, [c]), se = l === B.Create || l === B.Rename, ce = ee ?? r;
319
- return /* @__PURE__ */ F("div", {
320
- className: u("flex flex-col gap-2", re.folderField),
314
+ t != null && c(t === U ? H : t);
315
+ }, [c]), se = l === V.Create || l === V.Rename, z = ee ?? r;
316
+ return /* @__PURE__ */ N("div", {
317
+ className: u("flex flex-col gap-2", L.folderField),
321
318
  children: [
322
- /* @__PURE__ */ F("div", {
319
+ /* @__PURE__ */ N("div", {
323
320
  className: "flex items-end gap-2",
324
- children: [/* @__PURE__ */ P(w, {
321
+ children: [/* @__PURE__ */ M(w, {
325
322
  id: "prompt-folder",
326
323
  className: "flex-1",
327
- options: te,
328
- value: S ? H : e,
324
+ options: re,
325
+ value: S ? U : e,
329
326
  labelProps: { label: o?.folderLabel ?? "Folder" },
330
327
  invalid: n != null,
331
328
  disabled: a,
332
329
  error: n,
333
- emptyStateTitle: E,
334
- onChange: oe
335
- }), i != null && !a && /* @__PURE__ */ F(N, { children: [
336
- /* @__PURE__ */ P(b, {
337
- icon: /* @__PURE__ */ P(I, {
330
+ emptyStateTitle: ne,
331
+ onChange: R
332
+ }), i != null && !a && /* @__PURE__ */ N(oe, { children: [
333
+ /* @__PURE__ */ M(b, {
334
+ icon: /* @__PURE__ */ M(P, {
338
335
  size: h.SM,
339
336
  "aria-hidden": !0,
340
337
  stroke: g
341
338
  }),
342
339
  "aria-label": o?.folderCreateLabel ?? "Create folder",
343
- onClick: ne
340
+ onClick: O
344
341
  }),
345
- /* @__PURE__ */ P(b, {
346
- icon: /* @__PURE__ */ P(L, {
342
+ /* @__PURE__ */ M(b, {
343
+ icon: /* @__PURE__ */ M(F, {
347
344
  size: h.SM,
348
345
  "aria-hidden": !0,
349
346
  stroke: g
350
347
  }),
351
348
  "aria-label": o?.folderRenameLabel ?? "Rename folder",
352
349
  disabled: S,
353
- onClick: ie
350
+ onClick: k
354
351
  }),
355
- /* @__PURE__ */ P(b, {
356
- icon: /* @__PURE__ */ P(R, {
352
+ /* @__PURE__ */ M(b, {
353
+ icon: /* @__PURE__ */ M(I, {
357
354
  size: h.SM,
358
355
  "aria-hidden": !0,
359
356
  stroke: g
@@ -364,16 +361,16 @@ var re = {
364
361
  })
365
362
  ] })]
366
363
  }),
367
- t.length === 0 && l == null && /* @__PURE__ */ P("p", {
364
+ t.length === 0 && l == null && /* @__PURE__ */ M("p", {
368
365
  className: u("m-0", s),
369
- children: E
366
+ children: ne
370
367
  }),
371
- se && /* @__PURE__ */ F("div", {
368
+ se && /* @__PURE__ */ N("div", {
372
369
  role: "group",
373
- "aria-label": l === B.Create ? o?.folderCreateLabel ?? "Create folder" : o?.folderRenameLabel ?? "Rename folder",
370
+ "aria-label": l === V.Create ? o?.folderCreateLabel ?? "Create folder" : o?.folderRenameLabel ?? "Rename folder",
374
371
  className: "flex items-end gap-2",
375
372
  children: [
376
- /* @__PURE__ */ P(x, {
373
+ /* @__PURE__ */ M(x, {
377
374
  id: "prompt-folder-name",
378
375
  className: "flex-1",
379
376
  value: f,
@@ -382,43 +379,43 @@ var re = {
382
379
  label: o?.folderNameLabel ?? "Folder name",
383
380
  required: !0
384
381
  },
385
- invalid: ce != null,
386
- error: ce,
382
+ invalid: z != null,
383
+ error: z,
387
384
  onChange: (e) => p(e ?? "")
388
385
  }),
389
- /* @__PURE__ */ P(C, {
386
+ /* @__PURE__ */ M(C, {
390
387
  size: _.Standard,
391
388
  label: o?.saveLabel ?? "Save",
392
389
  disabled: v,
393
- onClick: k
390
+ onClick: ie
394
391
  }),
395
- /* @__PURE__ */ P(C, {
392
+ /* @__PURE__ */ M(C, {
396
393
  size: _.Standard,
397
394
  label: o?.cancelLabel ?? "Cancel",
398
395
  disabled: v,
399
- onClick: D
396
+ onClick: T
400
397
  })
401
398
  ]
402
399
  }),
403
- l === B.ConfirmDelete && /* @__PURE__ */ F("div", {
400
+ l === V.ConfirmDelete && /* @__PURE__ */ N("div", {
404
401
  role: "alertdialog",
405
402
  "aria-label": o?.folderDeleteConfirmTitle ?? "Delete folder",
406
- children: [/* @__PURE__ */ P("p", {
403
+ children: [/* @__PURE__ */ M("p", {
407
404
  className: u("m-0 mb-2", s),
408
405
  children: o?.folderDeleteConfirmMessage?.(e) ?? `Delete "${e}" and every prompt inside it?`
409
- }), /* @__PURE__ */ F("div", {
406
+ }), /* @__PURE__ */ N("div", {
410
407
  className: "flex gap-2",
411
- children: [/* @__PURE__ */ P(C, {
408
+ children: [/* @__PURE__ */ M(C, {
412
409
  size: _.Standard,
413
410
  label: o?.folderDeleteLabel ?? "Delete folder",
414
411
  autoFocus: !0,
415
412
  disabled: v,
416
- onClick: A
417
- }), /* @__PURE__ */ P(C, {
413
+ onClick: E
414
+ }), /* @__PURE__ */ M(C, {
418
415
  size: _.Standard,
419
416
  label: o?.cancelLabel ?? "Cancel",
420
417
  disabled: v,
421
- onClick: D
418
+ onClick: T
422
419
  })]
423
420
  })]
424
421
  })
@@ -426,4 +423,4 @@ var re = {
426
423
  });
427
424
  };
428
425
  //#endregion
429
- export { B as FolderFormMode, re as PROMPT_EDITOR_CLASS, z as PromptEditor, W as PromptFolderField };
426
+ export { V as FolderFormMode, L as PROMPT_EDITOR_CLASS, B as PromptEditor, G as PromptFolderField };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-prompt-editor",
3
3
  "description": "Host-agnostic form for authoring a reusable prompt, with an inline folder picker",
4
- "version": "1.3.0-dev.246",
4
+ "version": "1.3.0-dev.249",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -20,11 +20,11 @@
20
20
  "@tabler/icons-react": "^3.44.0",
21
21
  "@uiw/react-markdown-preview": "^5.2.1",
22
22
  "@uiw/react-md-editor": "^4.1.1",
23
- "@epam/ai-dial-builder-form": "1.3.0-dev.246"
23
+ "@epam/ai-dial-builder-form": "1.3.0-dev.249"
24
24
  },
25
25
  "peerDependencies": {
26
- "@epam/ai-dial-chat-shared": "1.3.0-dev.246",
27
- "@epam/ai-dial-ui-kit": "^0.16.0-dev.45",
26
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.249",
27
+ "@epam/ai-dial-ui-kit": "^0.16.0-dev.56",
28
28
  "react": "^19.2.8"
29
29
  },
30
30
  "repository": {