@epam/ai-dial-deployment-creation-form 1.1.0-dev.297 → 1.1.0-dev.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentLocalesField.d.ts","sourceRoot":"","sources":["../../../src/components/DeploymentLocalesField/DeploymentLocalesField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeploymentLocalesField.d.ts","sourceRoot":"","sources":["../../../src/components/DeploymentLocalesField/DeploymentLocalesField.tsx"],"names":[],"mappings":"AAeA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EACV,iCAAiC,EACjC,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,uCAAuC,CAAC;AAE/C,gEAAgE;AAChE,MAAM,WAAW,2BAA2B;IAC1C,+DAA+D;IAC/D,KAAK,EAAE,iCAAiC,EAAE,CAAC;IAC3C,kFAAkF;IAClF,QAAQ,EAAE,CAAC,OAAO,EAAE,iCAAiC,EAAE,KAAK,IAAI,CAAC;IACjE,yGAAyG;IACzG,sBAAsB,CAAC,EAAE,kCAAkC,EAAE,CAAC;IAC9D,2DAA2D;IAC3D,MAAM,EAAE,kCAAkC,CAAC;IAC3C,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6GAA6G;IAC7G,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uJAAuJ;IACvJ,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mHAAmH;IACnH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAeD,4HAA4H;AAC5H,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA4OlE,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,226 +1,229 @@
|
|
|
1
1
|
import { mergeClasses as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { ButtonAppearance as t, ButtonVariant as n, DIAL_ICON_SIZE as r,
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { IconPencil as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { ButtonAppearance as t, ButtonVariant as n, DIAL_ICON_SIZE as r, DIAL_KIT_ICON_STROKE as i, DangerIconButton as a, ElementSize as o, Input as s, LinkButton as c, Popup as l, Select as u, TagInput as d, Textarea as f } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { useEffect as p, useRef as m, useState as h } from "react";
|
|
4
|
+
import { IconPencil as g, IconPlus as _, IconTrashX as v } from "@tabler/icons-react";
|
|
5
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/DeploymentLocalesField/DeploymentLocalesField.tsx
|
|
7
|
-
var
|
|
7
|
+
var S = (e, t, n) => ({
|
|
8
8
|
id: e,
|
|
9
9
|
language: n.find((e) => !t.has(e.code))?.code ?? "",
|
|
10
10
|
name: "",
|
|
11
11
|
description: ""
|
|
12
|
-
}),
|
|
13
|
-
let { summaryLabel:
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}), C = ({ value: d, onChange: C, availableLocaleOptions: w = [], labels: T, className: E, summaryClassName: D = "dial-body-text text-secondary", rowLabelClassName: O = "dial-tiny-lead-text text-secondary", requiredMarkClassName: k = "text-error" }) => {
|
|
13
|
+
let { summaryLabel: A, editLabel: j, popupTitle: M, addLocaleLabel: N, localeRowLabel: P = "Locale", languageLabel: F, nameLabel: I, namePlaceholder: L, descriptionLabel: R, descriptionPlaceholder: z, deleteAriaLabel: B, cancelLabel: V = "Cancel", saveLabel: H = "Save" } = T, [U, W] = h(!1), [G, K] = h([]), q = m(0);
|
|
14
|
+
p(() => {
|
|
15
|
+
U && K(d.length > 0 ? d : [S(`locale-row-${++q.current}`, /* @__PURE__ */ new Set(), w)]);
|
|
16
16
|
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
U,
|
|
18
|
+
d,
|
|
19
|
+
w
|
|
20
20
|
]);
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
let e = new Set(
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
21
|
+
let J = () => W(!0), Y = () => W(!1), X = () => {
|
|
22
|
+
C(G.filter((e) => e.language && e.name)), W(!1);
|
|
23
|
+
}, Z = () => {
|
|
24
|
+
let e = new Set(G.map((e) => e.language).filter(Boolean));
|
|
25
|
+
K((t) => [...t, S(`locale-row-${++q.current}`, e, w)]);
|
|
26
|
+
}, Q = (e, t) => {
|
|
27
|
+
K((n) => n.map((n) => n.id === e ? {
|
|
28
28
|
...n,
|
|
29
29
|
...t
|
|
30
30
|
} : n));
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
className: e("flex items-center gap-2",
|
|
31
|
+
}, $ = (e) => {
|
|
32
|
+
K((t) => t.filter((t) => t.id !== e));
|
|
33
|
+
}, ee = (e) => w.find((t) => t.code === e)?.label ?? e.toUpperCase(), te = G.some((e) => !e.language || !e.name);
|
|
34
|
+
return /* @__PURE__ */ x("div", {
|
|
35
|
+
className: e("flex items-center gap-2", E),
|
|
36
36
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
className:
|
|
39
|
-
children: `${
|
|
37
|
+
/* @__PURE__ */ b("span", {
|
|
38
|
+
className: D,
|
|
39
|
+
children: `${A}: ${d.length > 0 ? d.map((e) => `[${ee(e.language)}]`).join(", ") : "—"}`
|
|
40
40
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
label:
|
|
43
|
-
iconBefore: /* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ b(c, {
|
|
42
|
+
label: j,
|
|
43
|
+
iconBefore: /* @__PURE__ */ b(g, {
|
|
44
44
|
size: r.SM,
|
|
45
|
-
"aria-hidden": !0
|
|
45
|
+
"aria-hidden": !0,
|
|
46
|
+
stroke: i
|
|
46
47
|
}),
|
|
47
48
|
className: "!px-0",
|
|
48
|
-
onClick:
|
|
49
|
+
onClick: J
|
|
49
50
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
open:
|
|
52
|
-
header:
|
|
53
|
-
onClose:
|
|
51
|
+
/* @__PURE__ */ b(l, {
|
|
52
|
+
open: U,
|
|
53
|
+
header: M,
|
|
54
|
+
onClose: Y,
|
|
54
55
|
mainButtons: [{
|
|
55
|
-
label: B,
|
|
56
|
-
onClick: J
|
|
57
|
-
}, {
|
|
58
56
|
label: V,
|
|
59
|
-
variant: n.Primary,
|
|
60
|
-
disabled: ee,
|
|
61
57
|
onClick: Y
|
|
58
|
+
}, {
|
|
59
|
+
label: H,
|
|
60
|
+
variant: n.Primary,
|
|
61
|
+
disabled: te,
|
|
62
|
+
onClick: X
|
|
62
63
|
}],
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ x("div", {
|
|
64
65
|
className: "flex flex-col gap-8 px-6 py-3",
|
|
65
|
-
children: [
|
|
66
|
-
let
|
|
67
|
-
return /* @__PURE__ */
|
|
66
|
+
children: [G.map((e, n) => {
|
|
67
|
+
let c = new Set(G.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
|
|
68
|
+
return /* @__PURE__ */ x("div", {
|
|
68
69
|
className: "flex flex-col gap-2",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ x("div", {
|
|
70
71
|
className: "flex items-center justify-between",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
-
className:
|
|
72
|
+
children: [/* @__PURE__ */ x("span", {
|
|
73
|
+
className: O,
|
|
73
74
|
children: [
|
|
74
|
-
|
|
75
|
+
P,
|
|
75
76
|
" ",
|
|
76
77
|
n + 1
|
|
77
78
|
]
|
|
78
|
-
}), /* @__PURE__ */
|
|
79
|
+
}), /* @__PURE__ */ b(a, {
|
|
79
80
|
appearance: t.Ghost,
|
|
80
|
-
size:
|
|
81
|
-
icon: /* @__PURE__ */
|
|
81
|
+
size: o.Small,
|
|
82
|
+
icon: /* @__PURE__ */ b(v, {
|
|
82
83
|
size: r.SM,
|
|
83
|
-
"aria-hidden": !0
|
|
84
|
+
"aria-hidden": !0,
|
|
85
|
+
stroke: i
|
|
84
86
|
}),
|
|
85
|
-
"aria-label": `${
|
|
86
|
-
onClick: () =>
|
|
87
|
+
"aria-label": `${B} ${n + 1}`,
|
|
88
|
+
onClick: () => $(e.id)
|
|
87
89
|
})]
|
|
88
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ x("div", {
|
|
89
91
|
role: "group",
|
|
90
|
-
"aria-label": `${
|
|
92
|
+
"aria-label": `${P} ${n + 1}`,
|
|
91
93
|
className: "flex flex-col gap-5",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ x("div", {
|
|
93
95
|
className: "flex items-start gap-5",
|
|
94
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ b(u, {
|
|
95
97
|
id: `${e.id}-language`,
|
|
96
|
-
labelProps: { label:
|
|
98
|
+
labelProps: { label: F },
|
|
97
99
|
className: "shrink-0 basis-20",
|
|
98
|
-
options:
|
|
100
|
+
options: w.map((e) => ({
|
|
99
101
|
value: e.code,
|
|
100
102
|
label: e.label,
|
|
101
|
-
disabled:
|
|
103
|
+
disabled: c.has(e.code)
|
|
102
104
|
})),
|
|
103
105
|
value: e.language,
|
|
104
|
-
onChange: (t) =>
|
|
105
|
-
}), /* @__PURE__ */
|
|
106
|
+
onChange: (t) => Q(e.id, { language: t })
|
|
107
|
+
}), /* @__PURE__ */ b(s, {
|
|
106
108
|
id: `${e.id}-name`,
|
|
107
109
|
containerClassName: "min-w-0 flex-1",
|
|
108
110
|
required: !0,
|
|
109
111
|
value: e.name,
|
|
110
|
-
onChange: (t) =>
|
|
111
|
-
labelProps: { label: /* @__PURE__ */
|
|
112
|
+
onChange: (t) => Q(e.id, { name: t ?? "" }),
|
|
113
|
+
labelProps: { label: /* @__PURE__ */ x(y, { children: [I, /* @__PURE__ */ b("span", {
|
|
112
114
|
"aria-hidden": !0,
|
|
113
|
-
className:
|
|
115
|
+
className: k,
|
|
114
116
|
children: "*"
|
|
115
117
|
})] }) },
|
|
116
|
-
placeholder:
|
|
118
|
+
placeholder: L
|
|
117
119
|
})]
|
|
118
|
-
}), /* @__PURE__ */
|
|
120
|
+
}), /* @__PURE__ */ b(f, {
|
|
119
121
|
id: `${e.id}-description`,
|
|
120
122
|
resize: !0,
|
|
121
123
|
value: e.description,
|
|
122
|
-
onChange: (t) =>
|
|
123
|
-
labelProps: { label:
|
|
124
|
-
placeholder:
|
|
124
|
+
onChange: (t) => Q(e.id, { description: t }),
|
|
125
|
+
labelProps: { label: R },
|
|
126
|
+
placeholder: z
|
|
125
127
|
})]
|
|
126
128
|
})]
|
|
127
129
|
}, e.id);
|
|
128
|
-
}), /* @__PURE__ */
|
|
129
|
-
label:
|
|
130
|
-
iconBefore: /* @__PURE__ */
|
|
130
|
+
}), /* @__PURE__ */ b(c, {
|
|
131
|
+
label: N,
|
|
132
|
+
iconBefore: /* @__PURE__ */ b(_, {
|
|
131
133
|
size: r.SM,
|
|
132
|
-
"aria-hidden": !0
|
|
134
|
+
"aria-hidden": !0,
|
|
135
|
+
stroke: i
|
|
133
136
|
}),
|
|
134
137
|
className: "self-start",
|
|
135
|
-
onClick:
|
|
136
|
-
disabled:
|
|
138
|
+
onClick: Z,
|
|
139
|
+
disabled: G.length >= w.length
|
|
137
140
|
})]
|
|
138
141
|
})
|
|
139
142
|
})
|
|
140
143
|
]
|
|
141
144
|
});
|
|
142
|
-
},
|
|
143
|
-
let
|
|
144
|
-
return
|
|
145
|
-
_ && !g.current && (n.name ?
|
|
145
|
+
}, w = ({ values: t, errors: n, onChange: r, onNameBlur: i, onVersionBlur: a, labels: o, styles: c, availableLocaleOptions: l = [] }) => {
|
|
146
|
+
let u = m(null), h = m(null), g = m(!1), _ = !!(n.name || n.version);
|
|
147
|
+
return p(() => {
|
|
148
|
+
_ && !g.current && (n.name ? u : h).current?.focus(), g.current = _;
|
|
146
149
|
}, [
|
|
147
150
|
_,
|
|
148
151
|
n.name,
|
|
149
152
|
n.version
|
|
150
|
-
]), /* @__PURE__ */
|
|
151
|
-
role:
|
|
152
|
-
"aria-label":
|
|
153
|
+
]), /* @__PURE__ */ x("div", {
|
|
154
|
+
role: o.ariaLabel ? "group" : void 0,
|
|
155
|
+
"aria-label": o.ariaLabel,
|
|
153
156
|
className: e("flex flex-col gap-4", c?.root),
|
|
154
157
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ b(s, {
|
|
156
159
|
id: "deployment-creation-form-name",
|
|
157
|
-
inputRef:
|
|
160
|
+
inputRef: u,
|
|
158
161
|
value: t.name,
|
|
159
162
|
onChange: (e) => r({ name: e ?? "" }),
|
|
160
163
|
onBlur: i,
|
|
161
164
|
labelProps: {
|
|
162
|
-
label:
|
|
165
|
+
label: o.name.label,
|
|
163
166
|
required: !0
|
|
164
167
|
},
|
|
165
|
-
placeholder:
|
|
168
|
+
placeholder: o.name.placeholder,
|
|
166
169
|
error: n.name || void 0,
|
|
167
170
|
invalid: !!n.name,
|
|
168
171
|
containerClassName: c?.field
|
|
169
172
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ b(f, {
|
|
171
174
|
id: "deployment-creation-form-description",
|
|
172
175
|
value: t.description,
|
|
173
176
|
onChange: (e) => r({ description: e }),
|
|
174
|
-
labelProps: { label:
|
|
175
|
-
placeholder:
|
|
177
|
+
labelProps: { label: o.description.label },
|
|
178
|
+
placeholder: o.description.placeholder,
|
|
176
179
|
containerClassName: c?.field
|
|
177
180
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ b(C, {
|
|
179
182
|
value: t.otherLocales,
|
|
180
183
|
onChange: (e) => r({ otherLocales: e }),
|
|
181
184
|
availableLocaleOptions: l,
|
|
182
|
-
labels:
|
|
185
|
+
labels: o.otherLocales,
|
|
183
186
|
className: c?.field
|
|
184
187
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ b(s, {
|
|
186
189
|
id: "deployment-creation-form-icon-url",
|
|
187
190
|
value: t.iconUrl,
|
|
188
191
|
onChange: (e) => r({ iconUrl: e ?? "" }),
|
|
189
|
-
labelProps: { label:
|
|
190
|
-
placeholder:
|
|
192
|
+
labelProps: { label: o.iconUrl.label },
|
|
193
|
+
placeholder: o.iconUrl.placeholder,
|
|
191
194
|
containerClassName: c?.field
|
|
192
195
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ b(s, {
|
|
194
197
|
id: "deployment-creation-form-version",
|
|
195
198
|
inputRef: h,
|
|
196
199
|
value: t.version,
|
|
197
200
|
onChange: (e) => r({ version: e ?? "" }),
|
|
198
201
|
onBlur: a,
|
|
199
|
-
labelProps: { label:
|
|
200
|
-
placeholder:
|
|
202
|
+
labelProps: { label: o.version.label },
|
|
203
|
+
placeholder: o.version.placeholder,
|
|
201
204
|
error: n.version || void 0,
|
|
202
205
|
invalid: !!n.version,
|
|
203
206
|
containerClassName: c?.field
|
|
204
207
|
}),
|
|
205
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ b("div", {
|
|
206
209
|
className: c?.field,
|
|
207
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ b(d, {
|
|
208
211
|
id: "deployment-creation-form-topics",
|
|
209
|
-
labelProps: { label:
|
|
210
|
-
placeholder:
|
|
212
|
+
labelProps: { label: o.topics.label },
|
|
213
|
+
placeholder: o.topics.placeholder,
|
|
211
214
|
value: t.topics,
|
|
212
215
|
onChange: (e) => r({ topics: e })
|
|
213
216
|
})
|
|
214
217
|
})
|
|
215
218
|
]
|
|
216
219
|
});
|
|
217
|
-
},
|
|
220
|
+
}, T = /* @__PURE__ */ function(e) {
|
|
218
221
|
return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e;
|
|
219
|
-
}({}),
|
|
222
|
+
}({}), E = /^[a-zA-Z0-9 _.-]+$/, D = /^[a-zA-Z0-9._-]+$/, O = (e, t = {}) => {
|
|
220
223
|
let n = {}, r = e.name.trim();
|
|
221
|
-
r ? t.validateNamePattern && !
|
|
224
|
+
r ? t.validateNamePattern && !E.test(r) && (n.name = T.InvalidFormat) : n.name = T.Required;
|
|
222
225
|
let i = e.version.trim();
|
|
223
|
-
return t.validateVersionPattern && i && !
|
|
226
|
+
return t.validateVersionPattern && i && !D.test(i) && (n.version = T.InvalidFormat), n;
|
|
224
227
|
};
|
|
225
228
|
//#endregion
|
|
226
|
-
export {
|
|
229
|
+
export { T as DeploymentCreationFieldErrorCode, w as DeploymentCreationForm, C as DeploymentLocalesField, E as NAME_PATTERN, D as VERSION_PATTERN, O as validateDeploymentCreationFields };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-deployment-creation-form",
|
|
3
3
|
"description": "Shared General-step field set for creating and editing a DIAL deployment",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.299",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
19
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.299",
|
|
20
20
|
"@epam/ai-dial-ui-kit": "*",
|
|
21
21
|
"@tabler/icons-react": "*",
|
|
22
22
|
"react": "^19.0.0"
|