@epam/ai-dial-deployment-creation-form 1.1.0-dev.298 → 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":"AAcA,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,CA0NlE,CAAC"}
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, DangerIconButton as i, ElementSize as a, Input as o, LinkButton as s, Popup as c, Select as l, TagInput as u, Textarea as d } from "@epam/ai-dial-ui-kit";
3
- import { useEffect as f, useRef as p, useState as m } from "react";
4
- import { IconPencil as h, IconPlus as g, IconTrashX as _ } from "@tabler/icons-react";
5
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
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 x = (e, t, n) => ({
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
- }), S = ({ value: u, onChange: S, availableLocaleOptions: C = [], labels: w, className: T, summaryClassName: E = "dial-body-text text-secondary", rowLabelClassName: D = "dial-tiny-lead-text text-secondary", requiredMarkClassName: O = "text-error" }) => {
13
- let { summaryLabel: k, editLabel: A, popupTitle: j, addLocaleLabel: M, localeRowLabel: N = "Locale", languageLabel: P, nameLabel: F, namePlaceholder: I, descriptionLabel: L, descriptionPlaceholder: R, deleteAriaLabel: z, cancelLabel: B = "Cancel", saveLabel: V = "Save" } = w, [H, U] = m(!1), [W, G] = m([]), K = p(0);
14
- f(() => {
15
- H && G(u.length > 0 ? u : [x(`locale-row-${++K.current}`, /* @__PURE__ */ new Set(), C)]);
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
- H,
18
- u,
19
- C
17
+ U,
18
+ d,
19
+ w
20
20
  ]);
21
- let q = () => U(!0), J = () => U(!1), Y = () => {
22
- S(W.filter((e) => e.language && e.name)), U(!1);
23
- }, X = () => {
24
- let e = new Set(W.map((e) => e.language).filter(Boolean));
25
- G((t) => [...t, x(`locale-row-${++K.current}`, e, C)]);
26
- }, Z = (e, t) => {
27
- G((n) => n.map((n) => n.id === e ? {
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
- }, Q = (e) => {
32
- G((t) => t.filter((t) => t.id !== e));
33
- }, $ = (e) => C.find((t) => t.code === e)?.label ?? e.toUpperCase(), ee = W.some((e) => !e.language || !e.name);
34
- return /* @__PURE__ */ b("div", {
35
- className: e("flex items-center gap-2", T),
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__ */ y("span", {
38
- className: E,
39
- children: `${k}: ${u.length > 0 ? u.map((e) => `[${$(e.language)}]`).join(", ") : "—"}`
37
+ /* @__PURE__ */ b("span", {
38
+ className: D,
39
+ children: `${A}: ${d.length > 0 ? d.map((e) => `[${ee(e.language)}]`).join(", ") : "—"}`
40
40
  }),
41
- /* @__PURE__ */ y(s, {
42
- label: A,
43
- iconBefore: /* @__PURE__ */ y(h, {
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: q
49
+ onClick: J
49
50
  }),
50
- /* @__PURE__ */ y(c, {
51
- open: H,
52
- header: j,
53
- onClose: J,
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__ */ b("div", {
64
+ children: /* @__PURE__ */ x("div", {
64
65
  className: "flex flex-col gap-8 px-6 py-3",
65
- children: [W.map((e, n) => {
66
- let s = new Set(W.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
67
- return /* @__PURE__ */ b("div", {
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__ */ b("div", {
70
+ children: [/* @__PURE__ */ x("div", {
70
71
  className: "flex items-center justify-between",
71
- children: [/* @__PURE__ */ b("span", {
72
- className: D,
72
+ children: [/* @__PURE__ */ x("span", {
73
+ className: O,
73
74
  children: [
74
- N,
75
+ P,
75
76
  " ",
76
77
  n + 1
77
78
  ]
78
- }), /* @__PURE__ */ y(i, {
79
+ }), /* @__PURE__ */ b(a, {
79
80
  appearance: t.Ghost,
80
- size: a.Small,
81
- icon: /* @__PURE__ */ y(_, {
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": `${z} ${n + 1}`,
86
- onClick: () => Q(e.id)
87
+ "aria-label": `${B} ${n + 1}`,
88
+ onClick: () => $(e.id)
87
89
  })]
88
- }), /* @__PURE__ */ b("div", {
90
+ }), /* @__PURE__ */ x("div", {
89
91
  role: "group",
90
- "aria-label": `${N} ${n + 1}`,
92
+ "aria-label": `${P} ${n + 1}`,
91
93
  className: "flex flex-col gap-5",
92
- children: [/* @__PURE__ */ b("div", {
94
+ children: [/* @__PURE__ */ x("div", {
93
95
  className: "flex items-start gap-5",
94
- children: [/* @__PURE__ */ y(l, {
96
+ children: [/* @__PURE__ */ b(u, {
95
97
  id: `${e.id}-language`,
96
- labelProps: { label: P },
98
+ labelProps: { label: F },
97
99
  className: "shrink-0 basis-20",
98
- options: C.map((e) => ({
100
+ options: w.map((e) => ({
99
101
  value: e.code,
100
102
  label: e.label,
101
- disabled: s.has(e.code)
103
+ disabled: c.has(e.code)
102
104
  })),
103
105
  value: e.language,
104
- onChange: (t) => Z(e.id, { language: t })
105
- }), /* @__PURE__ */ y(o, {
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) => Z(e.id, { name: t ?? "" }),
111
- labelProps: { label: /* @__PURE__ */ b(v, { children: [F, /* @__PURE__ */ y("span", {
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: O,
115
+ className: k,
114
116
  children: "*"
115
117
  })] }) },
116
- placeholder: I
118
+ placeholder: L
117
119
  })]
118
- }), /* @__PURE__ */ y(d, {
120
+ }), /* @__PURE__ */ b(f, {
119
121
  id: `${e.id}-description`,
120
122
  resize: !0,
121
123
  value: e.description,
122
- onChange: (t) => Z(e.id, { description: t }),
123
- labelProps: { label: L },
124
- placeholder: R
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__ */ y(s, {
129
- label: M,
130
- iconBefore: /* @__PURE__ */ y(g, {
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: X,
136
- disabled: W.length >= C.length
138
+ onClick: Z,
139
+ disabled: G.length >= w.length
137
140
  })]
138
141
  })
139
142
  })
140
143
  ]
141
144
  });
142
- }, C = ({ values: t, errors: n, onChange: r, onNameBlur: i, onVersionBlur: a, labels: s, styles: c, availableLocaleOptions: l = [] }) => {
143
- let m = p(null), h = p(null), g = p(!1), _ = !!(n.name || n.version);
144
- return f(() => {
145
- _ && !g.current && (n.name ? m : h).current?.focus(), g.current = _;
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__ */ b("div", {
151
- role: s.ariaLabel ? "group" : void 0,
152
- "aria-label": s.ariaLabel,
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__ */ y(o, {
158
+ /* @__PURE__ */ b(s, {
156
159
  id: "deployment-creation-form-name",
157
- inputRef: m,
160
+ inputRef: u,
158
161
  value: t.name,
159
162
  onChange: (e) => r({ name: e ?? "" }),
160
163
  onBlur: i,
161
164
  labelProps: {
162
- label: s.name.label,
165
+ label: o.name.label,
163
166
  required: !0
164
167
  },
165
- placeholder: s.name.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__ */ y(d, {
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: s.description.label },
175
- placeholder: s.description.placeholder,
177
+ labelProps: { label: o.description.label },
178
+ placeholder: o.description.placeholder,
176
179
  containerClassName: c?.field
177
180
  }),
178
- /* @__PURE__ */ y(S, {
181
+ /* @__PURE__ */ b(C, {
179
182
  value: t.otherLocales,
180
183
  onChange: (e) => r({ otherLocales: e }),
181
184
  availableLocaleOptions: l,
182
- labels: s.otherLocales,
185
+ labels: o.otherLocales,
183
186
  className: c?.field
184
187
  }),
185
- /* @__PURE__ */ y(o, {
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: s.iconUrl.label },
190
- placeholder: s.iconUrl.placeholder,
192
+ labelProps: { label: o.iconUrl.label },
193
+ placeholder: o.iconUrl.placeholder,
191
194
  containerClassName: c?.field
192
195
  }),
193
- /* @__PURE__ */ y(o, {
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: s.version.label },
200
- placeholder: s.version.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__ */ y("div", {
208
+ /* @__PURE__ */ b("div", {
206
209
  className: c?.field,
207
- children: /* @__PURE__ */ y(u, {
210
+ children: /* @__PURE__ */ b(d, {
208
211
  id: "deployment-creation-form-topics",
209
- labelProps: { label: s.topics.label },
210
- placeholder: s.topics.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
- }, w = /* @__PURE__ */ function(e) {
220
+ }, T = /* @__PURE__ */ function(e) {
218
221
  return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e;
219
- }({}), T = /^[a-zA-Z0-9 _.-]+$/, E = /^[a-zA-Z0-9._-]+$/, D = (e, t = {}) => {
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 && !T.test(r) && (n.name = w.InvalidFormat) : n.name = w.Required;
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 && !E.test(i) && (n.version = w.InvalidFormat), n;
226
+ return t.validateVersionPattern && i && !D.test(i) && (n.version = T.InvalidFormat), n;
224
227
  };
225
228
  //#endregion
226
- export { w as DeploymentCreationFieldErrorCode, C as DeploymentCreationForm, S as DeploymentLocalesField, T as NAME_PATTERN, E as VERSION_PATTERN, D as validateDeploymentCreationFields };
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.298",
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.298",
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"