@epam/ai-dial-builder-form 1.2.0-dev.284 → 1.2.0-dev.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +133 -133
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ENTITY_DESCRIPTION_MAX_LENGTH as e, ENTITY_NAME_MAX_LENGTH as t, RESIZABLE_TEXTAREA_CLASS_NAME as n, TAG_INPUT_TAG_CLASS_NAME as r, buildCssVars as i, exceedsMaxLength as a, hasControlCharacters as o, mergeClasses as s } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { ButtonAppearance as c, ButtonVariant as l, DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, DangerIconButton as f, ElementSize as p,
|
|
2
|
+
import { ButtonAppearance as c, ButtonVariant as l, DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, DangerIconButton as f, ElementSize as p, GhostButton as m, GhostIconButton as h, Input as g, Label as _, LinkButton as v, NeutralButton as y, Popup as b, PrimaryButton as x, Select as S, Spinner as C, TagInput as w, Textarea as ee, TextareaResize as te } from "@epam/ai-dial-ui-kit";
|
|
3
3
|
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
4
4
|
import { IconArrowLeft as O, IconArrowNarrowLeft as k, IconPhoto as A, IconPlus as j, IconTrashX as M } from "@tabler/icons-react";
|
|
5
|
-
import { Suspense as N, memo as P, useCallback as F, useEffect as
|
|
5
|
+
import { Suspense as N, memo as P, useCallback as F, useEffect as ne, useId as re, useLayoutEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
6
6
|
//#region src/components/BuilderFormActions/BuilderFormActions.tsx
|
|
7
|
-
var
|
|
7
|
+
var B = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubmitDisabled: i = !1, isSubmitting: a = !1, buttonClassName: o }) => /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(y, {
|
|
8
8
|
label: e.cancelButtonLabel,
|
|
9
9
|
onClick: t,
|
|
10
10
|
disabled: r,
|
|
11
11
|
className: o
|
|
12
|
-
}), /* @__PURE__ */ E(
|
|
12
|
+
}), /* @__PURE__ */ E(x, {
|
|
13
13
|
label: e.submitButtonLabel,
|
|
14
14
|
onClick: n,
|
|
15
15
|
disabled: i,
|
|
@@ -17,20 +17,20 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
17
17
|
className: o,
|
|
18
18
|
iconBefore: a ? /* @__PURE__ */ E("span", {
|
|
19
19
|
"aria-hidden": !0,
|
|
20
|
-
children: /* @__PURE__ */ E(
|
|
20
|
+
children: /* @__PURE__ */ E(C, { size: u.SM })
|
|
21
21
|
}) : void 0
|
|
22
|
-
})] }),
|
|
22
|
+
})] }), V = {
|
|
23
23
|
body: "_body_1xd7h_2",
|
|
24
24
|
sideColumn: "_sideColumn_1xd7h_6",
|
|
25
25
|
reservedColumn: "_reservedColumn_1xd7h_10"
|
|
26
|
-
},
|
|
26
|
+
}, H = s("flex flex-col desktop:min-h-0 desktop:overflow-y-auto", V.sideColumn), ie = ({ left: e, children: t, metadata: n, layout: r }) => {
|
|
27
27
|
let i = e != null && n == null && r?.reserveEndColumn !== !1, a = r ? { "--bfb-side-column-width": r.sideColumnWidth ?? "400px" } : void 0, o = r ? { columnGap: r.columnGap ?? "0px" } : void 0;
|
|
28
28
|
return /* @__PURE__ */ D("div", {
|
|
29
|
-
className: s("flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
|
|
29
|
+
className: s("flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden", V.body),
|
|
30
30
|
style: o,
|
|
31
31
|
children: [
|
|
32
32
|
e != null && /* @__PURE__ */ E("div", {
|
|
33
|
-
className:
|
|
33
|
+
className: H,
|
|
34
34
|
style: a,
|
|
35
35
|
children: e
|
|
36
36
|
}),
|
|
@@ -39,14 +39,14 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
39
39
|
children: t
|
|
40
40
|
}),
|
|
41
41
|
n != null && /* @__PURE__ */ E("div", {
|
|
42
|
-
className:
|
|
42
|
+
className: H,
|
|
43
43
|
style: a,
|
|
44
44
|
children: n
|
|
45
45
|
}),
|
|
46
46
|
i && /* @__PURE__ */ E("div", {
|
|
47
47
|
"aria-hidden": !0,
|
|
48
48
|
style: a,
|
|
49
|
-
className: s(
|
|
49
|
+
className: s(V.reservedColumn, V.sideColumn)
|
|
50
50
|
})
|
|
51
51
|
]
|
|
52
52
|
});
|
|
@@ -54,18 +54,18 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
54
54
|
header: "_header_lon83_4",
|
|
55
55
|
actions: "_actions_lon83_18",
|
|
56
56
|
title: "_title_lon83_27"
|
|
57
|
-
},
|
|
58
|
-
let { colors: p, typography:
|
|
57
|
+
}, ae = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, styles: f }) => {
|
|
58
|
+
let { colors: p, typography: m } = f ?? {}, g = m?.fontClassName ?? "dial-h1-text", _ = !!m?.fontClassName;
|
|
59
59
|
return /* @__PURE__ */ D("div", {
|
|
60
60
|
style: i({
|
|
61
61
|
"--bfh-border": p?.borderColor,
|
|
62
|
-
"--bfh-font-family": _ ? void 0 :
|
|
62
|
+
"--bfh-font-family": _ ? void 0 : m?.fontFamily
|
|
63
63
|
}),
|
|
64
64
|
className: s("flex min-h-16 shrink-0 items-center justify-between gap-2 px-4 py-2 desktop:h-16 desktop:flex-nowrap desktop:px-8 desktop:py-0", U.header),
|
|
65
65
|
children: [
|
|
66
66
|
/* @__PURE__ */ D("div", {
|
|
67
67
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
68
|
-
children: [/* @__PURE__ */ E(
|
|
68
|
+
children: [/* @__PURE__ */ E(h, {
|
|
69
69
|
icon: l === void 0 ? /* @__PURE__ */ E(O, {
|
|
70
70
|
size: u.LG,
|
|
71
71
|
className: "rtl:scale-x-[-1]",
|
|
@@ -81,7 +81,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
81
81
|
}),
|
|
82
82
|
/* @__PURE__ */ E("div", {
|
|
83
83
|
className: s("items-center gap-2", U.actions),
|
|
84
|
-
children: /* @__PURE__ */ E(
|
|
84
|
+
children: /* @__PURE__ */ E(B, {
|
|
85
85
|
labels: e,
|
|
86
86
|
onCancel: n,
|
|
87
87
|
onSubmit: r,
|
|
@@ -98,19 +98,19 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
98
98
|
})
|
|
99
99
|
]
|
|
100
100
|
});
|
|
101
|
-
},
|
|
101
|
+
}, W = {
|
|
102
102
|
container: "_container_k1awi_1",
|
|
103
103
|
footer: "_footer_k1awi_10"
|
|
104
|
-
},
|
|
104
|
+
}, G = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, className: u, left: d, children: f, metadata: p, layout: m, styles: h }) => {
|
|
105
105
|
let { colors: g, header: _, cssVars: v } = h ?? {};
|
|
106
106
|
return /* @__PURE__ */ D("div", {
|
|
107
107
|
style: {
|
|
108
108
|
...i({ "--bfc-bg": g?.background }),
|
|
109
109
|
...v
|
|
110
110
|
},
|
|
111
|
-
className: s("flex h-full min-h-0 w-full flex-col overflow-hidden", u,
|
|
111
|
+
className: s("flex h-full min-h-0 w-full flex-col overflow-hidden", u, W.container),
|
|
112
112
|
children: [
|
|
113
|
-
/* @__PURE__ */ E(
|
|
113
|
+
/* @__PURE__ */ E(ae, {
|
|
114
114
|
labels: e,
|
|
115
115
|
onBack: t,
|
|
116
116
|
onCancel: n,
|
|
@@ -121,15 +121,15 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
121
121
|
backIcon: l,
|
|
122
122
|
styles: _
|
|
123
123
|
}),
|
|
124
|
-
/* @__PURE__ */ E(
|
|
124
|
+
/* @__PURE__ */ E(ie, {
|
|
125
125
|
left: d,
|
|
126
126
|
metadata: p,
|
|
127
127
|
layout: m,
|
|
128
128
|
children: f
|
|
129
129
|
}),
|
|
130
130
|
/* @__PURE__ */ E("div", {
|
|
131
|
-
className: s("sticky bottom-0 z-10 items-center gap-2 p-3",
|
|
132
|
-
children: /* @__PURE__ */ E(
|
|
131
|
+
className: s("sticky bottom-0 z-10 items-center gap-2 p-3", W.footer),
|
|
132
|
+
children: /* @__PURE__ */ E(B, {
|
|
133
133
|
labels: e,
|
|
134
134
|
onCancel: n,
|
|
135
135
|
onSubmit: r,
|
|
@@ -166,8 +166,8 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
166
166
|
headerBorder: "_headerBorder_1kidu_1",
|
|
167
167
|
footerBorder: "_footerBorder_1kidu_5",
|
|
168
168
|
sidebarBorder: "_sidebarBorder_1kidu_9"
|
|
169
|
-
},
|
|
170
|
-
let
|
|
169
|
+
}, oe = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: a, rightContent: o, isSaving: c = !1, labels: l, styles: f, dir: p }) => {
|
|
170
|
+
let m = re(), g = c ? l?.savingStatusLabel ?? "Saving" : "", _ = i({
|
|
171
171
|
"--el-header-border-color": f?.colors?.headerBorderColor,
|
|
172
172
|
"--el-sidebar-border-color": f?.colors?.sidebarBorderColor
|
|
173
173
|
});
|
|
@@ -180,14 +180,14 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
180
180
|
role: "status",
|
|
181
181
|
"aria-live": "polite",
|
|
182
182
|
className: "sr-only",
|
|
183
|
-
id:
|
|
183
|
+
id: m,
|
|
184
184
|
children: g
|
|
185
185
|
}),
|
|
186
186
|
/* @__PURE__ */ D("div", {
|
|
187
187
|
className: s("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", Y.headerBorder),
|
|
188
188
|
children: [/* @__PURE__ */ D("div", {
|
|
189
189
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
190
|
-
children: [/* @__PURE__ */ E(
|
|
190
|
+
children: [/* @__PURE__ */ E(h, {
|
|
191
191
|
icon: /* @__PURE__ */ E(k, {
|
|
192
192
|
size: u.LG,
|
|
193
193
|
stroke: d,
|
|
@@ -225,7 +225,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
225
225
|
box: "_box_c9as8_1",
|
|
226
226
|
icon: "_icon_c9as8_6",
|
|
227
227
|
caption: "_caption_c9as8_10"
|
|
228
|
-
},
|
|
228
|
+
}, se = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: a = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: o, styles: c, className: l }) => {
|
|
229
229
|
let f = i({
|
|
230
230
|
"--aa-box-bg": c?.colors?.boxBackgroundColor,
|
|
231
231
|
"--aa-box-border": c?.colors?.boxBorderColor,
|
|
@@ -235,7 +235,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
235
235
|
return /* @__PURE__ */ D("div", {
|
|
236
236
|
className: s("flex flex-col gap-2", l),
|
|
237
237
|
style: f,
|
|
238
|
-
children: [/* @__PURE__ */ E(
|
|
238
|
+
children: [/* @__PURE__ */ E(_, { label: e }), /* @__PURE__ */ D("div", {
|
|
239
239
|
className: "flex items-start gap-3",
|
|
240
240
|
children: [/* @__PURE__ */ E("div", {
|
|
241
241
|
className: s("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", X.box),
|
|
@@ -251,7 +251,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
251
251
|
})
|
|
252
252
|
}), /* @__PURE__ */ D("div", {
|
|
253
253
|
className: "flex flex-col gap-3",
|
|
254
|
-
children: [/* @__PURE__ */ E(
|
|
254
|
+
children: [/* @__PURE__ */ E(m, {
|
|
255
255
|
size: p.Small,
|
|
256
256
|
iconBefore: /* @__PURE__ */ E(j, {
|
|
257
257
|
size: u.SM,
|
|
@@ -268,7 +268,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
268
268
|
})]
|
|
269
269
|
})]
|
|
270
270
|
});
|
|
271
|
-
},
|
|
271
|
+
}, ce = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
|
|
272
272
|
let c = F((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = F((e) => /* @__PURE__ */ E("div", {
|
|
273
273
|
className: "dial-small-text px-6 py-3",
|
|
274
274
|
children: /* @__PURE__ */ E("p", {
|
|
@@ -337,69 +337,69 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
337
337
|
});
|
|
338
338
|
}, Z = /* @__PURE__ */ function(e) {
|
|
339
339
|
return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
|
|
340
|
-
}({}),
|
|
340
|
+
}({}), le = [
|
|
341
341
|
"avatar",
|
|
342
342
|
"name",
|
|
343
343
|
"version",
|
|
344
344
|
"description",
|
|
345
345
|
"locales",
|
|
346
346
|
"tags"
|
|
347
|
-
],
|
|
347
|
+
], ue = (e, t, n) => ({
|
|
348
348
|
id: e,
|
|
349
349
|
language: n.find((e) => !t.has(e.code))?.code ?? "",
|
|
350
350
|
name: "",
|
|
351
351
|
description: ""
|
|
352
|
-
}),
|
|
353
|
-
let { summaryLabel:
|
|
354
|
-
|
|
355
|
-
I && V(e.length > 0 ? e : [
|
|
352
|
+
}), de = ({ value: e, onChange: t, availableLocaleOptions: r = [], labels: i, className: a, summaryClassName: o = "dial-body-text text-secondary", rowLabelClassName: m = "dial-tiny-lead-text text-secondary" }) => {
|
|
353
|
+
let { summaryLabel: h, addLabel: _, editLabel: y, popupTitle: x, addLocaleLabel: C, localeRowLabel: w = "Locale", languageLabel: T, nameLabel: O, namePlaceholder: k, descriptionLabel: A, descriptionPlaceholder: N, deleteAriaLabel: P, cancelLabel: F = "Cancel", saveLabel: re = "Save" } = i, [I, L] = z(!1), [B, V] = z([]), H = R(0);
|
|
354
|
+
ne(() => {
|
|
355
|
+
I && V(e.length > 0 ? e : [ue(`locale-row-${++H.current}`, /* @__PURE__ */ new Set(), r)]);
|
|
356
356
|
}, [
|
|
357
357
|
I,
|
|
358
358
|
e,
|
|
359
359
|
r
|
|
360
360
|
]);
|
|
361
|
-
let
|
|
362
|
-
t(B.filter((e) => e.language && e.name)),
|
|
363
|
-
},
|
|
361
|
+
let ie = () => L(!0), U = () => L(!1), ae = () => {
|
|
362
|
+
t(B.filter((e) => e.language && e.name)), L(!1);
|
|
363
|
+
}, W = () => {
|
|
364
364
|
let e = new Set(B.map((e) => e.language).filter(Boolean));
|
|
365
|
-
V((t) => [...t,
|
|
366
|
-
},
|
|
365
|
+
V((t) => [...t, ue(`locale-row-${++H.current}`, e, r)]);
|
|
366
|
+
}, G = (e, t) => {
|
|
367
367
|
V((n) => n.map((n) => n.id === e ? {
|
|
368
368
|
...n,
|
|
369
369
|
...t
|
|
370
370
|
} : n));
|
|
371
|
-
},
|
|
371
|
+
}, K = (e) => {
|
|
372
372
|
V((t) => t.filter((t) => t.id !== e));
|
|
373
|
-
},
|
|
373
|
+
}, q = (e) => r.find((t) => t.code === e)?.label ?? e.toUpperCase(), J = B.some((e) => !e.language || !e.name);
|
|
374
374
|
return r.length === 0 ? null : /* @__PURE__ */ D("div", {
|
|
375
375
|
className: s("flex items-center gap-2", a),
|
|
376
376
|
children: [
|
|
377
377
|
e.length > 0 && /* @__PURE__ */ E("span", {
|
|
378
378
|
className: o,
|
|
379
|
-
children: `${
|
|
379
|
+
children: `${h}: ${e.map((e) => `[${q(e.language)}]`).join(", ")}`
|
|
380
380
|
}),
|
|
381
|
-
/* @__PURE__ */ E(
|
|
382
|
-
label: e.length > 0 ?
|
|
381
|
+
/* @__PURE__ */ E(v, {
|
|
382
|
+
label: e.length > 0 ? y : _,
|
|
383
383
|
iconBefore: /* @__PURE__ */ E(j, {
|
|
384
384
|
size: u.SM,
|
|
385
385
|
"aria-hidden": !0,
|
|
386
386
|
stroke: d
|
|
387
387
|
}),
|
|
388
388
|
className: "!px-0",
|
|
389
|
-
onClick:
|
|
389
|
+
onClick: ie
|
|
390
390
|
}),
|
|
391
|
-
/* @__PURE__ */ E(
|
|
391
|
+
/* @__PURE__ */ E(b, {
|
|
392
392
|
open: I,
|
|
393
|
-
header:
|
|
394
|
-
onClose:
|
|
393
|
+
header: x,
|
|
394
|
+
onClose: U,
|
|
395
395
|
mainButtons: [{
|
|
396
|
-
label:
|
|
397
|
-
onClick:
|
|
396
|
+
label: F,
|
|
397
|
+
onClick: U
|
|
398
398
|
}, {
|
|
399
399
|
label: re,
|
|
400
400
|
variant: l.Primary,
|
|
401
|
-
disabled:
|
|
402
|
-
onClick:
|
|
401
|
+
disabled: J,
|
|
402
|
+
onClick: ae
|
|
403
403
|
}],
|
|
404
404
|
children: /* @__PURE__ */ D("div", {
|
|
405
405
|
className: "flex flex-col gap-8 px-6 py-3",
|
|
@@ -412,7 +412,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
412
412
|
children: [/* @__PURE__ */ D("span", {
|
|
413
413
|
className: m,
|
|
414
414
|
children: [
|
|
415
|
-
|
|
415
|
+
w,
|
|
416
416
|
" ",
|
|
417
417
|
t + 1
|
|
418
418
|
]
|
|
@@ -424,19 +424,19 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
424
424
|
"aria-hidden": !0,
|
|
425
425
|
stroke: d
|
|
426
426
|
}),
|
|
427
|
-
"aria-label": `${
|
|
428
|
-
onClick: () =>
|
|
427
|
+
"aria-label": `${P} ${t + 1}`,
|
|
428
|
+
onClick: () => K(e.id)
|
|
429
429
|
})]
|
|
430
430
|
}), /* @__PURE__ */ D("div", {
|
|
431
431
|
role: "group",
|
|
432
|
-
"aria-label": `${
|
|
432
|
+
"aria-label": `${w} ${t + 1}`,
|
|
433
433
|
className: "flex flex-col gap-5",
|
|
434
434
|
children: [/* @__PURE__ */ D("div", {
|
|
435
435
|
className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
|
|
436
|
-
children: [/* @__PURE__ */ E(
|
|
436
|
+
children: [/* @__PURE__ */ E(S, {
|
|
437
437
|
id: `${e.id}-language`,
|
|
438
438
|
labelProps: {
|
|
439
|
-
label:
|
|
439
|
+
label: T,
|
|
440
440
|
required: !0
|
|
441
441
|
},
|
|
442
442
|
className: "desktop:shrink-0 desktop:basis-40",
|
|
@@ -446,31 +446,31 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
446
446
|
disabled: i.has(e.code)
|
|
447
447
|
})),
|
|
448
448
|
value: e.language,
|
|
449
|
-
onChange: (t) =>
|
|
450
|
-
}), /* @__PURE__ */ E(
|
|
449
|
+
onChange: (t) => G(e.id, { language: t })
|
|
450
|
+
}), /* @__PURE__ */ E(g, {
|
|
451
451
|
id: `${e.id}-name`,
|
|
452
452
|
containerClassName: "min-w-0 flex-1",
|
|
453
453
|
required: !0,
|
|
454
454
|
value: e.name,
|
|
455
|
-
onChange: (t) =>
|
|
455
|
+
onChange: (t) => G(e.id, { name: t ?? "" }),
|
|
456
456
|
labelProps: {
|
|
457
|
-
label:
|
|
457
|
+
label: O,
|
|
458
458
|
required: !0
|
|
459
459
|
},
|
|
460
|
-
placeholder:
|
|
460
|
+
placeholder: k
|
|
461
461
|
})]
|
|
462
|
-
}), /* @__PURE__ */ E(
|
|
462
|
+
}), /* @__PURE__ */ E(ee, {
|
|
463
463
|
id: `${e.id}-description`,
|
|
464
464
|
className: n,
|
|
465
|
-
resize:
|
|
465
|
+
resize: te.Vertical,
|
|
466
466
|
value: e.description,
|
|
467
|
-
onChange: (t) =>
|
|
468
|
-
labelProps: { label:
|
|
469
|
-
placeholder:
|
|
467
|
+
onChange: (t) => G(e.id, { description: t }),
|
|
468
|
+
labelProps: { label: A },
|
|
469
|
+
placeholder: N
|
|
470
470
|
})]
|
|
471
471
|
})]
|
|
472
472
|
}, e.id);
|
|
473
|
-
}), /* @__PURE__ */ E(
|
|
473
|
+
}), /* @__PURE__ */ E(v, {
|
|
474
474
|
label: C,
|
|
475
475
|
iconBefore: /* @__PURE__ */ E(j, {
|
|
476
476
|
size: u.SM,
|
|
@@ -478,33 +478,33 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
478
478
|
stroke: d
|
|
479
479
|
}),
|
|
480
480
|
className: "self-start",
|
|
481
|
-
onClick:
|
|
481
|
+
onClick: W,
|
|
482
482
|
disabled: B.length >= r.length
|
|
483
483
|
})]
|
|
484
484
|
})
|
|
485
485
|
})
|
|
486
486
|
]
|
|
487
487
|
});
|
|
488
|
-
},
|
|
489
|
-
let b =
|
|
490
|
-
|
|
488
|
+
}, fe = "Add tags, comma separated", pe = "deployment-creation-form-description", me = ({ values: e, errors: t, onChange: i, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: c, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], fields: p = le, isNameReadOnly: m = !1, nameCaption: h, isDescriptionRequired: _ = !1, renderDescription: v, focusRequestKey: y }) => {
|
|
489
|
+
let b = R(null), x = R(null), S = R(null), C = R(!1), T = (e) => p.includes(e), O = T(Z.Name), k = T(Z.Version), A = !!(t.name || t.version || t.description), j = R(y);
|
|
490
|
+
ne(() => {
|
|
491
491
|
let e = () => {
|
|
492
492
|
t.name ? b.current?.focus() : t.version ? x.current?.focus() : t.description && S.current?.focus();
|
|
493
493
|
};
|
|
494
494
|
if (y !== void 0) {
|
|
495
|
-
y !==
|
|
495
|
+
y !== j.current && (j.current = y, e());
|
|
496
496
|
return;
|
|
497
497
|
}
|
|
498
|
-
|
|
498
|
+
A && !C.current && e(), C.current = A;
|
|
499
499
|
}, [
|
|
500
500
|
y,
|
|
501
|
-
|
|
501
|
+
A,
|
|
502
502
|
t.name,
|
|
503
503
|
t.version,
|
|
504
504
|
t.description
|
|
505
505
|
]);
|
|
506
|
-
let
|
|
507
|
-
id:
|
|
506
|
+
let M = /* @__PURE__ */ E(ee, {
|
|
507
|
+
id: pe,
|
|
508
508
|
ref: S,
|
|
509
509
|
value: e.description,
|
|
510
510
|
onChange: (e) => i({ description: e }),
|
|
@@ -518,14 +518,14 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
518
518
|
invalid: !!t.description,
|
|
519
519
|
containerClassName: v ? void 0 : d?.field,
|
|
520
520
|
className: n,
|
|
521
|
-
resize:
|
|
521
|
+
resize: te.Vertical
|
|
522
522
|
});
|
|
523
523
|
return /* @__PURE__ */ D("div", {
|
|
524
524
|
role: u.ariaLabel ? "group" : void 0,
|
|
525
525
|
"aria-label": u.ariaLabel,
|
|
526
526
|
className: s("flex flex-col gap-4", d?.root),
|
|
527
527
|
children: [
|
|
528
|
-
|
|
528
|
+
T(Z.Avatar) && /* @__PURE__ */ E(se, {
|
|
529
529
|
label: u.iconUrl.label,
|
|
530
530
|
avatarUrl: c,
|
|
531
531
|
addAvatarLabel: u.iconUrl.addAvatarLabel,
|
|
@@ -533,9 +533,9 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
533
533
|
onAddAvatarClick: l,
|
|
534
534
|
className: d?.field
|
|
535
535
|
}),
|
|
536
|
-
(
|
|
536
|
+
(O || k) && /* @__PURE__ */ D("div", {
|
|
537
537
|
className: s("flex items-start gap-4", d?.field),
|
|
538
|
-
children: [
|
|
538
|
+
children: [O && /* @__PURE__ */ E(g, {
|
|
539
539
|
id: "deployment-creation-form-name",
|
|
540
540
|
inputRef: b,
|
|
541
541
|
value: e.name,
|
|
@@ -547,11 +547,11 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
547
547
|
required: !0
|
|
548
548
|
},
|
|
549
549
|
placeholder: u.name.placeholder,
|
|
550
|
-
caption:
|
|
550
|
+
caption: h,
|
|
551
551
|
error: t.name || void 0,
|
|
552
552
|
invalid: !!t.name,
|
|
553
|
-
containerClassName:
|
|
554
|
-
}),
|
|
553
|
+
containerClassName: k ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
|
|
554
|
+
}), k && /* @__PURE__ */ E(g, {
|
|
555
555
|
id: "deployment-creation-form-version",
|
|
556
556
|
inputRef: x,
|
|
557
557
|
value: e.version,
|
|
@@ -561,26 +561,26 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
561
561
|
placeholder: u.version.placeholder,
|
|
562
562
|
error: t.version || void 0,
|
|
563
563
|
invalid: !!t.version,
|
|
564
|
-
containerClassName:
|
|
564
|
+
containerClassName: O ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
|
|
565
565
|
})]
|
|
566
566
|
}),
|
|
567
|
-
|
|
567
|
+
T(Z.Description) && (v ? /* @__PURE__ */ E("div", {
|
|
568
568
|
className: d?.field,
|
|
569
|
-
children: v(
|
|
570
|
-
}) :
|
|
571
|
-
|
|
569
|
+
children: v(M, pe)
|
|
570
|
+
}) : M),
|
|
571
|
+
T(Z.Locales) && /* @__PURE__ */ E(de, {
|
|
572
572
|
value: e.otherLocales,
|
|
573
573
|
onChange: (e) => i({ otherLocales: e }),
|
|
574
574
|
availableLocaleOptions: f,
|
|
575
575
|
labels: u.otherLocales,
|
|
576
576
|
className: d?.field
|
|
577
577
|
}),
|
|
578
|
-
|
|
578
|
+
T(Z.Tags) && /* @__PURE__ */ E("div", {
|
|
579
579
|
className: d?.field,
|
|
580
|
-
children: /* @__PURE__ */ E(
|
|
580
|
+
children: /* @__PURE__ */ E(w, {
|
|
581
581
|
id: "deployment-creation-form-topics",
|
|
582
582
|
labelProps: { label: u.topics.label },
|
|
583
|
-
placeholder: u.topics.placeholder ??
|
|
583
|
+
placeholder: u.topics.placeholder ?? fe,
|
|
584
584
|
value: e.topics,
|
|
585
585
|
onChange: (e) => i({ topics: e }),
|
|
586
586
|
tagClassName: r
|
|
@@ -588,25 +588,25 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
588
588
|
})
|
|
589
589
|
]
|
|
590
590
|
});
|
|
591
|
-
},
|
|
591
|
+
}, he = "border-0 p-4 desktop:p-6", ge = "desktop:flex-1", _e = "px-4 pt-4 desktop:px-6 desktop:pt-6", ve = P(({ title: e, onBack: t, onCancel: n, onSubmit: r, submitLabel: i, isSubmitting: a = !1, isSubmitDisabled: o = !1, extraActions: c, hideStandardActions: l = !1, metadata: u, metadataTitle: d, metadataFooter: f, setup: p, setupTitle: m, alert: h, metadataSectionClassName: g, setupSectionClassName: _, labels: v, styles: b, dir: S }) => {
|
|
592
592
|
let C = h == null ? null : /* @__PURE__ */ E("div", {
|
|
593
593
|
role: "alert",
|
|
594
|
-
className:
|
|
594
|
+
className: _e,
|
|
595
595
|
children: h
|
|
596
596
|
}), w = p != null;
|
|
597
|
-
return /* @__PURE__ */ E(
|
|
597
|
+
return /* @__PURE__ */ E(oe, {
|
|
598
598
|
title: e,
|
|
599
599
|
onBack: t,
|
|
600
|
-
backAriaLabel:
|
|
600
|
+
backAriaLabel: v?.backAriaLabel ?? "Back",
|
|
601
601
|
isSaving: a,
|
|
602
|
-
labels: { savingStatusLabel:
|
|
603
|
-
styles:
|
|
602
|
+
labels: { savingStatusLabel: v?.savingStatusLabel ?? "Saving" },
|
|
603
|
+
styles: b?.layout,
|
|
604
604
|
dir: S,
|
|
605
|
-
actions: /* @__PURE__ */ D(T, { children: [c, !l && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(
|
|
606
|
-
label:
|
|
605
|
+
actions: /* @__PURE__ */ D(T, { children: [c, !l && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(y, {
|
|
606
|
+
label: v?.cancelLabel ?? "Cancel",
|
|
607
607
|
disabled: a,
|
|
608
608
|
onClick: n
|
|
609
|
-
}), /* @__PURE__ */ E(
|
|
609
|
+
}), /* @__PURE__ */ E(x, {
|
|
610
610
|
label: i,
|
|
611
611
|
disabled: a || o,
|
|
612
612
|
onClick: r
|
|
@@ -614,21 +614,21 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
614
614
|
leftContent: /* @__PURE__ */ D(T, { children: [
|
|
615
615
|
!w && C,
|
|
616
616
|
/* @__PURE__ */ E(J, {
|
|
617
|
-
title: d === null ? void 0 : d ??
|
|
618
|
-
styles:
|
|
619
|
-
className: s(
|
|
617
|
+
title: d === null ? void 0 : d ?? v?.metadataTitle ?? "Metadata",
|
|
618
|
+
styles: b?.section,
|
|
619
|
+
className: s(he, g, K.metadataSection),
|
|
620
620
|
children: u
|
|
621
621
|
}),
|
|
622
622
|
f
|
|
623
623
|
] }),
|
|
624
624
|
rightContent: w ? /* @__PURE__ */ D(T, { children: [C, /* @__PURE__ */ E(J, {
|
|
625
|
-
title: m ??
|
|
626
|
-
styles:
|
|
627
|
-
className: s(
|
|
625
|
+
title: m ?? v?.setupTitle ?? "Setup",
|
|
626
|
+
styles: b?.section,
|
|
627
|
+
className: s(he, ge, _, K.setupSection),
|
|
628
628
|
children: p
|
|
629
629
|
})] }) : void 0
|
|
630
630
|
});
|
|
631
|
-
}),
|
|
631
|
+
}), ye = {
|
|
632
632
|
name: {
|
|
633
633
|
label: "Name",
|
|
634
634
|
placeholder: "Enter name"
|
|
@@ -667,7 +667,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
667
667
|
saveLabel: "Save"
|
|
668
668
|
},
|
|
669
669
|
ariaLabel: "Metadata"
|
|
670
|
-
},
|
|
670
|
+
}, be = {
|
|
671
671
|
title: "Add avatar",
|
|
672
672
|
attachLabel: "Attach",
|
|
673
673
|
emptyTitle: "This folder is empty",
|
|
@@ -691,12 +691,12 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
691
691
|
deleteConfirmItemsLabel: "items?",
|
|
692
692
|
deleteConfirmLabel: "Delete",
|
|
693
693
|
deleteCancelLabel: "Cancel"
|
|
694
|
-
},
|
|
695
|
-
let [m, h] =
|
|
694
|
+
}, xe = P(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = le, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
|
|
695
|
+
let [m, h] = z(!1), g = L(() => a ? s : s.filter((e) => e !== Z.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = L(() => v ? v(_) : void 0, [_, v]), b = F(() => h(!0), []), x = F(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = F((e) => {
|
|
696
696
|
let t = S?.(e);
|
|
697
697
|
t && n({ iconUrl: t }), h(!1);
|
|
698
698
|
}, [n, S]);
|
|
699
|
-
return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(
|
|
699
|
+
return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(me, {
|
|
700
700
|
values: e,
|
|
701
701
|
errors: t,
|
|
702
702
|
onChange: n,
|
|
@@ -704,7 +704,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
704
704
|
onVersionBlur: i,
|
|
705
705
|
iconPreviewUrl: y,
|
|
706
706
|
onAddAvatarClick: b,
|
|
707
|
-
labels: p?.form ??
|
|
707
|
+
labels: p?.form ?? ye,
|
|
708
708
|
availableLocaleOptions: o,
|
|
709
709
|
fields: g,
|
|
710
710
|
isNameReadOnly: c,
|
|
@@ -712,7 +712,7 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
712
712
|
isDescriptionRequired: u,
|
|
713
713
|
renderDescription: d,
|
|
714
714
|
focusRequestKey: f
|
|
715
|
-
}), a && /* @__PURE__ */ E(
|
|
715
|
+
}), a && /* @__PURE__ */ E(ce, {
|
|
716
716
|
isOpen: m,
|
|
717
717
|
onClose: x,
|
|
718
718
|
onAttach: C,
|
|
@@ -720,35 +720,35 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
720
720
|
FileManagerModal: a.FileManagerModal,
|
|
721
721
|
allowedMimeTypes: a.allowedMimeTypes,
|
|
722
722
|
maxFileSizeBytes: a.maxFileSizeBytes,
|
|
723
|
-
labels: p?.avatarPicker ??
|
|
723
|
+
labels: p?.avatarPicker ?? be
|
|
724
724
|
})] });
|
|
725
725
|
}), Q = /* @__PURE__ */ function(e) {
|
|
726
726
|
return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
|
|
727
|
-
}({}),
|
|
727
|
+
}({}), Se = (e, t) => e.length === t.length && e.every((e, n) => e.id === t[n].id && e.language === t[n].language && e.name === t[n].name && e.description === t[n].description), Ce = (e, t) => e.name === t.name && e.description === t.description && e.iconUrl === t.iconUrl && e.version === t.version && e.topics.length === t.topics.length && e.topics.every((e, n) => e === t.topics[n]) && Se(e.otherLocales, t.otherLocales), we = (e) => Object.values(e).every((e) => e == null), Te = /^[a-zA-Z0-9 _.-]+$/, Ee = /^[a-zA-Z0-9._-]+$/, De = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/, Oe = (n, r = {}) => {
|
|
728
728
|
let i = {}, s = n.name.trim();
|
|
729
|
-
s ? a(s, t) ? i.name = Q.TooLong : r.validateNamePattern && !
|
|
729
|
+
s ? a(s, t) ? i.name = Q.TooLong : r.validateNamePattern && !Te.test(s) ? i.name = Q.InvalidFormat : o(s) && (i.name = Q.ControlCharacters) : i.name = Q.Required, a(n.description, e) && (i.description = Q.TooLong);
|
|
730
730
|
let c = n.version.trim();
|
|
731
|
-
return r.validateVersionPattern && c && ((r.validateVersionPattern instanceof RegExp ? r.validateVersionPattern :
|
|
732
|
-
},
|
|
731
|
+
return r.validateVersionPattern && c && ((r.validateVersionPattern instanceof RegExp ? r.validateVersionPattern : Ee).test(c) || (i.version = Q.InvalidFormat)), i;
|
|
732
|
+
}, ke = new Set([Q.TooLong, Q.ControlCharacters]), $ = (e, t) => ({
|
|
733
733
|
reseedKey: t,
|
|
734
734
|
values: e,
|
|
735
735
|
baseline: e,
|
|
736
736
|
touched: {},
|
|
737
737
|
hasAttemptedSubmit: !1,
|
|
738
738
|
submitAttemptCount: 0
|
|
739
|
-
}),
|
|
740
|
-
let [r, i] =
|
|
739
|
+
}), Ae = ({ initialValues: e, validationOptions: t, reseedKey: n }) => {
|
|
740
|
+
let [r, i] = z(() => $(e, n));
|
|
741
741
|
r.reseedKey !== n && i($(e, n));
|
|
742
|
-
let a = t?.validateNamePattern, o = t?.validateVersionPattern, s =
|
|
742
|
+
let a = t?.validateNamePattern, o = t?.validateVersionPattern, s = L(() => Oe(r.values, {
|
|
743
743
|
validateNamePattern: a,
|
|
744
744
|
validateVersionPattern: o
|
|
745
745
|
}), [
|
|
746
746
|
r.values,
|
|
747
747
|
a,
|
|
748
748
|
o
|
|
749
|
-
]), c =
|
|
749
|
+
]), c = L(() => {
|
|
750
750
|
if (r.hasAttemptedSubmit) return s;
|
|
751
|
-
let e = (e, t) => e && (t ||
|
|
751
|
+
let e = (e, t) => e && (t || ke.has(e)) ? e : void 0;
|
|
752
752
|
return {
|
|
753
753
|
name: e(s.name, r.touched[Z.Name]),
|
|
754
754
|
version: e(s.version, r.touched[Z.Version]),
|
|
@@ -758,8 +758,8 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
758
758
|
s,
|
|
759
759
|
r.hasAttemptedSubmit,
|
|
760
760
|
r.touched
|
|
761
|
-
]), l =
|
|
762
|
-
|
|
761
|
+
]), l = R(s), u = R(e);
|
|
762
|
+
I(() => {
|
|
763
763
|
l.current = s, u.current = e;
|
|
764
764
|
});
|
|
765
765
|
let d = F((e) => i((t) => ({
|
|
@@ -778,8 +778,8 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
778
778
|
...e,
|
|
779
779
|
hasAttemptedSubmit: !0,
|
|
780
780
|
submitAttemptCount: e.submitAttemptCount + 1
|
|
781
|
-
})),
|
|
782
|
-
return
|
|
781
|
+
})), we(l.current)), []), m = F((e) => i((t) => $(e ?? u.current, t.reseedKey)), []), h = L(() => !Ce(r.values, r.baseline), [r.values, r.baseline]);
|
|
782
|
+
return L(() => ({
|
|
783
783
|
values: r.values,
|
|
784
784
|
setValues: d,
|
|
785
785
|
touched: r.touched,
|
|
@@ -804,4 +804,4 @@ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
|
|
|
804
804
|
]);
|
|
805
805
|
};
|
|
806
806
|
//#endregion
|
|
807
|
-
export {
|
|
807
|
+
export { se as AddAvatar, ce as AvatarPickerModal, K as BUILDER_FORM_CLASS, G as BuilderFormContainer, ye as DEFAULT_METADATA_FORM_LABELS, Q as DeploymentCreationFieldErrorCode, me as DeploymentCreationForm, de as DeploymentLocalesField, oe as EditorLayout, J as EditorSection, ve as EntityEditor, Z as MetadataField, xe as MetadataForm, Te as NAME_PATTERN, De as SEMVER_VERSION_PATTERN, Ee as VERSION_PATTERN, Ae as useMetadataForm, Oe as validateDeploymentCreationFields };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-builder-form",
|
|
3
3
|
"description": "Presentational builder form shells, editor layouts, and shared deployment field sets for composing and editing DIAL entities",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.287",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tabler/icons-react": "^3.44.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.287",
|
|
24
24
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.36",
|
|
25
25
|
"react": "^19.2.8"
|
|
26
26
|
},
|