@epam/ai-dial-builder-form 1.2.0-dev.98 → 1.2.0-rc.0

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.
Files changed (46) hide show
  1. package/components/AvatarPickerModal/AvatarPickerModal.d.ts.map +1 -1
  2. package/components/BuilderFormBody/BuilderFormBody.d.ts +1 -1
  3. package/components/BuilderFormBody/BuilderFormBody.d.ts.map +1 -1
  4. package/components/BuilderFormContainer/BuilderFormContainer.d.ts +1 -1
  5. package/components/BuilderFormContainer/BuilderFormContainer.d.ts.map +1 -1
  6. package/components/DeploymentCreationForm/DeploymentCreationForm.d.ts +5 -1
  7. package/components/DeploymentCreationForm/DeploymentCreationForm.d.ts.map +1 -1
  8. package/components/EditorLayout/EditorLayout.d.ts +3 -1
  9. package/components/EditorLayout/EditorLayout.d.ts.map +1 -1
  10. package/components/EntityEditor/EntityEditor.d.ts +4 -0
  11. package/components/EntityEditor/EntityEditor.d.ts.map +1 -0
  12. package/components/MetadataForm/MetadataForm.d.ts +4 -0
  13. package/components/MetadataForm/MetadataForm.d.ts.map +1 -0
  14. package/constants/metadata-form.d.ts +7 -0
  15. package/constants/metadata-form.d.ts.map +1 -0
  16. package/constants/public-class-names.d.ts +6 -0
  17. package/constants/public-class-names.d.ts.map +1 -1
  18. package/hooks/useMetadataForm.d.ts +13 -0
  19. package/hooks/useMetadataForm.d.ts.map +1 -0
  20. package/index.css +2 -2
  21. package/index.d.ts +8 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +568 -329
  24. package/models/avatar-picker-modal.d.ts +2 -10
  25. package/models/avatar-picker-modal.d.ts.map +1 -1
  26. package/models/builder-form-body-props.d.ts +1 -1
  27. package/models/builder-form-body-props.d.ts.map +1 -1
  28. package/models/deployment-creation-form.d.ts +31 -16
  29. package/models/deployment-creation-form.d.ts.map +1 -1
  30. package/models/editor-layout-props.d.ts +10 -2
  31. package/models/editor-layout-props.d.ts.map +1 -1
  32. package/models/entity-editor-props.d.ts +84 -0
  33. package/models/entity-editor-props.d.ts.map +1 -0
  34. package/models/metadata-field.d.ts +18 -0
  35. package/models/metadata-field.d.ts.map +1 -0
  36. package/models/metadata-form-props.d.ts +62 -0
  37. package/models/metadata-form-props.d.ts.map +1 -0
  38. package/models/use-metadata-form.d.ts +36 -0
  39. package/models/use-metadata-form.d.ts.map +1 -0
  40. package/models/validation.d.ts +6 -2
  41. package/models/validation.d.ts.map +1 -1
  42. package/package.json +3 -3
  43. package/utils/metadata-form.d.ts +7 -0
  44. package/utils/metadata-form.d.ts.map +1 -0
  45. package/utils/validate-deployment-creation-fields.d.ts +6 -1
  46. package/utils/validate-deployment-creation-fields.d.ts.map +1 -1
package/index.js CHANGED
@@ -1,294 +1,290 @@
1
- import { RESIZABLE_TEXTAREA_CLASS_NAME as e, TAG_INPUT_TAG_CLASS_NAME as t, buildCssVars as n, mergeClasses as r } from "@epam/ai-dial-chat-shared";
2
- import { ButtonAppearance as i, ButtonVariant as a, DIAL_ICON_SIZE as o, DIAL_KIT_ICON_STROKE as s, DangerIconButton as c, ElementSize as l, GhostIconButton as u, Input as d, Label as f, LinkButton as p, NeutralButton as m, Popup as h, PrimaryButton as g, Select as _, Spinner as v, TagInput as y, Textarea as b, TextareaResize as x } from "@epam/ai-dial-ui-kit";
3
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
4
- import { IconArrowLeft as ee, IconArrowNarrowLeft as T, IconPhoto as E, IconPlus as D, IconTrashX as te } from "@tabler/icons-react";
5
- import { Suspense as O, useCallback as k, useEffect as A, useId as j, useRef as M, useState as N } from "react";
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, 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 T, TextareaResize as E } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
4
+ import { IconArrowLeft as A, IconArrowNarrowLeft as j, IconPhoto as M, IconPlus as N, IconTrashX as P } from "@tabler/icons-react";
5
+ import { Suspense as ee, memo as F, useCallback as I, useEffect as te, useId as ne, useLayoutEffect as L, useMemo as R, useRef as z, useState as B } from "react";
6
6
  //#region src/components/BuilderFormActions/BuilderFormActions.tsx
7
- var P = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubmitDisabled: i = !1, isSubmitting: a = !1, buttonClassName: s }) => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(m, {
7
+ var V = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubmitDisabled: i = !1, isSubmitting: a = !1, buttonClassName: o }) => /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(y, {
8
8
  label: e.cancelButtonLabel,
9
9
  onClick: t,
10
10
  disabled: r,
11
- className: s
12
- }), /* @__PURE__ */ C(g, {
11
+ className: o
12
+ }), /* @__PURE__ */ O(x, {
13
13
  label: e.submitButtonLabel,
14
14
  onClick: n,
15
15
  disabled: i,
16
16
  "aria-busy": a,
17
- className: s,
18
- iconBefore: a ? /* @__PURE__ */ C("span", {
17
+ className: o,
18
+ iconBefore: a ? /* @__PURE__ */ O("span", {
19
19
  "aria-hidden": !0,
20
- children: /* @__PURE__ */ C(v, { size: o.SM })
20
+ children: /* @__PURE__ */ O(C, { size: u.SM })
21
21
  }) : void 0
22
- })] }), F = {
23
- body: "_body_m2y60_2",
24
- sideColumn: "_sideColumn_m2y60_6",
25
- reservedColumn: "_reservedColumn_m2y60_10"
26
- }, I = r("flex flex-col", F.sideColumn), L = ({ left: e, children: t, metadata: n, layout: i }) => {
27
- let a = e != null && n == null && i?.reserveEndColumn !== !1, o = i ? {
28
- flex: `0 1 ${i.sideColumnWidth ?? "400px"}`,
29
- width: "100%",
30
- minWidth: `min(100%, ${i.sideColumnWidth ?? "400px"})`,
31
- maxWidth: "100%"
32
- } : void 0, s = i ? {
33
- flexDirection: "row",
34
- flexWrap: "wrap",
35
- columnGap: i.columnGap ?? "0px",
36
- alignItems: "stretch"
37
- } : void 0;
38
- return /* @__PURE__ */ w("div", {
39
- className: r("flex min-w-0 flex-1", F.body),
40
- style: s,
22
+ })] }), H = {
23
+ body: "_body_1xd7h_2",
24
+ sideColumn: "_sideColumn_1xd7h_6",
25
+ reservedColumn: "_reservedColumn_1xd7h_10"
26
+ }, U = s("flex flex-col desktop:min-h-0 desktop:overflow-y-auto", H.sideColumn), re = ({ left: e, children: t, metadata: n, layout: r }) => {
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
+ return /* @__PURE__ */ k("div", {
29
+ className: s("flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden", H.body),
30
+ style: o,
41
31
  children: [
42
- e != null && /* @__PURE__ */ C("div", {
43
- className: I,
44
- style: o,
32
+ e != null && /* @__PURE__ */ O("div", {
33
+ className: U,
34
+ style: a,
45
35
  children: e
46
36
  }),
47
- /* @__PURE__ */ C("div", {
48
- className: "flex w-full min-w-0 flex-1 flex-col",
49
- style: i ? {
50
- flex: "1 1 320px",
51
- minWidth: "min(100%, 320px)"
52
- } : void 0,
37
+ /* @__PURE__ */ O("div", {
38
+ className: "flex w-full min-w-0 flex-1 flex-col desktop:min-h-0 desktop:overflow-y-auto",
53
39
  children: t
54
40
  }),
55
- n != null && /* @__PURE__ */ C("div", {
56
- className: I,
57
- style: o,
41
+ n != null && /* @__PURE__ */ O("div", {
42
+ className: U,
43
+ style: a,
58
44
  children: n
59
45
  }),
60
- a && /* @__PURE__ */ C("div", {
46
+ i && /* @__PURE__ */ O("div", {
61
47
  "aria-hidden": !0,
62
- style: o,
63
- className: r(F.reservedColumn, F.sideColumn)
48
+ style: a,
49
+ className: s(H.reservedColumn, H.sideColumn)
64
50
  })
65
51
  ]
66
52
  });
67
- }, R = {
68
- header: "_header_oo757_4",
69
- actions: "_actions_oo757_20",
70
- title: "_title_oo757_29"
71
- }, z = ({ labels: e, onBack: t, onCancel: i, onSubmit: a, isCancelDisabled: c = !1, isSubmitDisabled: l = !1, isSubmitting: d = !1, backIcon: f, styles: p }) => {
72
- let { colors: m, typography: h } = p ?? {}, g = h?.fontClassName ?? "dial-h1-text", _ = !!h?.fontClassName;
73
- return /* @__PURE__ */ w("div", {
74
- style: n({
75
- "--bfh-border": m?.borderColor,
76
- "--bfh-font-family": _ ? void 0 : h?.fontFamily
53
+ }, W = {
54
+ header: "_header_lon83_4",
55
+ actions: "_actions_lon83_18",
56
+ title: "_title_lon83_27"
57
+ }, ie = ({ 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
+ return /* @__PURE__ */ k("div", {
60
+ style: i({
61
+ "--bfh-border": p?.borderColor,
62
+ "--bfh-font-family": _ ? void 0 : m?.fontFamily
77
63
  }),
78
- className: r("flex h-16 items-center justify-between gap-6", R.header),
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", W.header),
79
65
  children: [
80
- /* @__PURE__ */ w("div", {
66
+ /* @__PURE__ */ k("div", {
81
67
  className: "flex min-w-0 flex-1 items-center gap-2",
82
- children: [/* @__PURE__ */ C(u, {
83
- icon: f === void 0 ? /* @__PURE__ */ C(ee, {
84
- size: o.LG,
68
+ children: [/* @__PURE__ */ O(h, {
69
+ icon: l === void 0 ? /* @__PURE__ */ O(A, {
70
+ size: u.LG,
85
71
  className: "rtl:scale-x-[-1]",
86
72
  "aria-hidden": !0,
87
- stroke: s
88
- }) : f,
73
+ stroke: d
74
+ }) : l,
89
75
  "aria-label": e.backButtonLabel,
90
76
  onClick: t
91
- }), /* @__PURE__ */ C("h1", {
92
- className: r("truncate", R.title, g),
77
+ }), /* @__PURE__ */ O("h1", {
78
+ className: s("truncate", W.title, g),
93
79
  children: e.title
94
80
  })]
95
81
  }),
96
- /* @__PURE__ */ C("div", {
97
- className: r("items-center gap-2", R.actions),
98
- children: /* @__PURE__ */ C(P, {
82
+ /* @__PURE__ */ O("div", {
83
+ className: s("items-center gap-2", W.actions),
84
+ children: /* @__PURE__ */ O(V, {
99
85
  labels: e,
100
- onCancel: i,
101
- onSubmit: a,
102
- isCancelDisabled: c,
103
- isSubmitDisabled: l,
104
- isSubmitting: d
86
+ onCancel: n,
87
+ onSubmit: r,
88
+ isCancelDisabled: a,
89
+ isSubmitDisabled: o,
90
+ isSubmitting: c
105
91
  })
106
92
  }),
107
- /* @__PURE__ */ C("span", {
93
+ /* @__PURE__ */ O("span", {
108
94
  role: "status",
109
95
  "aria-live": "polite",
110
96
  className: "sr-only",
111
- children: d ? e.submittingLabel ?? "Submitting" : ""
97
+ children: c ? e.submittingLabel ?? "Submitting" : ""
112
98
  })
113
99
  ]
114
100
  });
115
- }, B = {
116
- container: "_container_k1awi_1",
117
- footer: "_footer_k1awi_10"
118
- }, V = ({ labels: e, onBack: t, onCancel: i, onSubmit: a, isCancelDisabled: o = !1, isSubmitDisabled: s = !1, isSubmitting: c = !1, backIcon: l, className: u, left: d, children: f, metadata: p, layout: m, styles: h }) => {
101
+ }, G = {
102
+ container: "_container_14mfe_1",
103
+ footer: "_footer_14mfe_10"
104
+ }, K = ({ 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 }) => {
119
105
  let { colors: g, header: _, cssVars: v } = h ?? {};
120
- return /* @__PURE__ */ w("div", {
106
+ return /* @__PURE__ */ k("div", {
121
107
  style: {
122
- ...n({ "--bfc-bg": g?.background }),
108
+ ...i({ "--bfc-bg": g?.background }),
123
109
  ...v
124
110
  },
125
- className: r("flex h-full w-full flex-col overflow-y-auto", u, B.container),
111
+ className: s("flex h-full min-h-0 w-full flex-col overflow-hidden", u, G.container),
126
112
  children: [
127
- /* @__PURE__ */ C(z, {
113
+ /* @__PURE__ */ O(ie, {
128
114
  labels: e,
129
115
  onBack: t,
130
- onCancel: i,
131
- onSubmit: a,
132
- isCancelDisabled: o,
133
- isSubmitDisabled: s,
116
+ onCancel: n,
117
+ onSubmit: r,
118
+ isCancelDisabled: a,
119
+ isSubmitDisabled: o,
134
120
  isSubmitting: c,
135
121
  backIcon: l,
136
122
  styles: _
137
123
  }),
138
- /* @__PURE__ */ C(L, {
124
+ /* @__PURE__ */ O(re, {
139
125
  left: d,
140
126
  metadata: p,
141
127
  layout: m,
142
128
  children: f
143
129
  }),
144
- /* @__PURE__ */ C("div", {
145
- className: r("sticky bottom-0 z-10 items-center gap-2 p-3", B.footer),
146
- children: /* @__PURE__ */ C(P, {
130
+ /* @__PURE__ */ O("div", {
131
+ className: s("sticky bottom-0 z-10 items-center gap-2 p-3 shadow-sm", G.footer),
132
+ children: /* @__PURE__ */ O(V, {
147
133
  labels: e,
148
- onCancel: i,
149
- onSubmit: a,
150
- isCancelDisabled: o,
151
- isSubmitDisabled: s,
134
+ onCancel: n,
135
+ onSubmit: r,
136
+ isCancelDisabled: a,
137
+ isSubmitDisabled: o,
152
138
  isSubmitting: c,
153
139
  buttonClassName: "flex-1"
154
140
  })
155
141
  })
156
142
  ]
157
143
  });
158
- }, H = {
144
+ }, q = {
159
145
  layout: "dial-builder-form-layout",
160
- section: "dial-builder-form-section"
161
- }, U = {
146
+ section: "dial-builder-form-section",
147
+ metadataSection: "dial-builder-form-metadata-section",
148
+ setupSection: "dial-builder-form-setup-section",
149
+ asideSection: "dial-builder-form-aside-section"
150
+ }, J = {
162
151
  section: "_section_l1mnx_1",
163
152
  title: "_title_l1mnx_5"
164
- }, W = ({ title: e, children: t, styles: i, className: a }) => {
165
- let o = n({
166
- "--es-border-color": i?.colors?.borderColor,
167
- "--es-title-color": i?.colors?.titleColor
153
+ }, Y = ({ title: e, children: t, styles: n, className: r }) => {
154
+ let a = i({
155
+ "--es-border-color": n?.colors?.borderColor,
156
+ "--es-title-color": n?.colors?.titleColor
168
157
  });
169
- return /* @__PURE__ */ w("section", {
170
- className: r("flex flex-col gap-4 rounded border p-6", U.section, a, H.section),
171
- style: o,
172
- children: [e != null && /* @__PURE__ */ C("h2", {
173
- className: r("dial-h3-text", U.title),
158
+ return /* @__PURE__ */ k("section", {
159
+ className: s("flex h-full flex-col gap-4 rounded border p-6", J.section, r, q.section),
160
+ style: a,
161
+ children: [e != null && /* @__PURE__ */ O("h2", {
162
+ className: s("dial-h3-text", J.title),
174
163
  children: e
175
164
  }), t]
176
165
  });
177
- }, G = {
178
- headerBorder: "_headerBorder_1kidu_1",
179
- footerBorder: "_footerBorder_1kidu_5",
180
- sidebarBorder: "_sidebarBorder_1kidu_9"
181
- }, K = ({ title: e, onBack: t, backAriaLabel: i = "Back", actions: a, leftContent: c, rightContent: l, isSaving: d = !1, labels: f, styles: p, dir: m }) => {
182
- let h = j(), g = d ? f?.savingStatusLabel ?? "Saving" : "", _ = n({
166
+ }, X = {
167
+ headerBorder: "_headerBorder_1adw2_1",
168
+ footerBorder: "_footerBorder_1adw2_5",
169
+ columnBorder: "_columnBorder_1adw2_10"
170
+ }, ae = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: a, centerContent: o, rightContent: c, isSaving: l = !1, labels: f, styles: p, dir: m }) => {
171
+ let g = ne(), _ = l ? f?.savingStatusLabel ?? "Saving" : "", v = i({
183
172
  "--el-header-border-color": p?.colors?.headerBorderColor,
184
173
  "--el-sidebar-border-color": p?.colors?.sidebarBorderColor
185
174
  });
186
- return /* @__PURE__ */ w("div", {
175
+ return /* @__PURE__ */ k("div", {
187
176
  dir: m,
188
- className: r("flex min-h-0 flex-1 flex-col", H.layout),
189
- style: _,
177
+ className: s("flex min-h-0 flex-1 flex-col", q.layout),
178
+ style: v,
190
179
  children: [
191
- /* @__PURE__ */ C("span", {
180
+ /* @__PURE__ */ O("span", {
192
181
  role: "status",
193
182
  "aria-live": "polite",
194
183
  className: "sr-only",
195
- id: h,
196
- children: g
184
+ id: g,
185
+ children: _
197
186
  }),
198
- /* @__PURE__ */ w("div", {
199
- className: r("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", G.headerBorder),
200
- children: [/* @__PURE__ */ w("div", {
187
+ /* @__PURE__ */ k("div", {
188
+ className: s("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", X.headerBorder),
189
+ children: [/* @__PURE__ */ k("div", {
201
190
  className: "flex min-w-0 flex-1 items-center gap-2",
202
- children: [/* @__PURE__ */ C(u, {
203
- icon: /* @__PURE__ */ C(T, {
204
- size: o.LG,
205
- stroke: s,
191
+ children: [/* @__PURE__ */ O(h, {
192
+ icon: /* @__PURE__ */ O(j, {
193
+ size: u.LG,
194
+ stroke: d,
206
195
  "aria-hidden": !0,
207
196
  className: "rtl:scale-x-[-1]"
208
197
  }),
209
- "aria-label": i,
198
+ "aria-label": n,
210
199
  onClick: t
211
- }), /* @__PURE__ */ C("h1", {
200
+ }), /* @__PURE__ */ O("h1", {
212
201
  className: "dial-h2-text min-w-0 truncate",
213
202
  children: e
214
203
  })]
215
- }), a != null && /* @__PURE__ */ C("div", {
204
+ }), r != null && /* @__PURE__ */ O("div", {
216
205
  className: "hidden shrink-0 items-center gap-2 desktop:flex",
217
- children: a
206
+ children: r
218
207
  })]
219
208
  }),
220
- /* @__PURE__ */ w("div", {
209
+ /* @__PURE__ */ k("div", {
221
210
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
222
- children: [/* @__PURE__ */ C("div", {
223
- className: r(l == null ? "desktop:flex-1" : "desktop:w-[360px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", l == null ? void 0 : G.sidebarBorder),
224
- children: c
225
- }), l != null && /* @__PURE__ */ C("div", {
226
- className: "desktop:flex-1 desktop:overflow-y-auto",
227
- children: l
228
- })]
211
+ children: [
212
+ /* @__PURE__ */ O("div", {
213
+ className: s(o == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", o == null ? void 0 : X.columnBorder),
214
+ children: a
215
+ }),
216
+ o != null && /* @__PURE__ */ O("div", {
217
+ className: "desktop:flex desktop:min-h-0 desktop:flex-1 desktop:flex-col desktop:overflow-y-auto",
218
+ children: o
219
+ }),
220
+ c != null && /* @__PURE__ */ O("div", {
221
+ className: s("desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-s", X.columnBorder),
222
+ children: c
223
+ })
224
+ ]
229
225
  }),
230
- a != null && /* @__PURE__ */ C("div", {
231
- className: r("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", G.footerBorder),
232
- children: a
226
+ r != null && /* @__PURE__ */ O("div", {
227
+ className: s("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", X.footerBorder),
228
+ children: r
233
229
  })
234
230
  ]
235
231
  });
236
- }, q = {
232
+ }, Z = {
237
233
  box: "_box_c9as8_1",
238
234
  icon: "_icon_c9as8_6",
239
235
  caption: "_caption_c9as8_10"
240
- }, J = ({ label: e, avatarUrl: t, avatarAlt: i = "", addAvatarLabel: a = "Add avatar", captionText: c = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: u, styles: d, className: m }) => {
241
- let h = n({
242
- "--aa-box-bg": d?.colors?.boxBackgroundColor,
243
- "--aa-box-border": d?.colors?.boxBorderColor,
244
- "--aa-icon": d?.colors?.placeholderIconColor,
245
- "--aa-caption": d?.colors?.captionColor
236
+ }, oe = ({ 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 }) => {
237
+ let f = i({
238
+ "--aa-box-bg": c?.colors?.boxBackgroundColor,
239
+ "--aa-box-border": c?.colors?.boxBorderColor,
240
+ "--aa-icon": c?.colors?.placeholderIconColor,
241
+ "--aa-caption": c?.colors?.captionColor
246
242
  });
247
- return /* @__PURE__ */ w("div", {
248
- className: r("flex flex-col gap-2", m),
249
- style: h,
250
- children: [/* @__PURE__ */ C(f, { label: e }), /* @__PURE__ */ w("div", {
243
+ return /* @__PURE__ */ k("div", {
244
+ className: s("flex flex-col gap-2", l),
245
+ style: f,
246
+ children: [/* @__PURE__ */ O(_, { label: e }), /* @__PURE__ */ k("div", {
251
247
  className: "flex items-start gap-3",
252
- children: [/* @__PURE__ */ C("div", {
253
- className: r("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", q.box),
254
- children: t ? /* @__PURE__ */ C("img", {
248
+ children: [/* @__PURE__ */ O("div", {
249
+ className: s("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Z.box),
250
+ children: t ? /* @__PURE__ */ O("img", {
255
251
  src: t,
256
- alt: i,
252
+ alt: n,
257
253
  className: "h-16 w-16 object-cover"
258
- }) : /* @__PURE__ */ C(E, {
259
- size: o.LG,
260
- stroke: s,
254
+ }) : /* @__PURE__ */ O(M, {
255
+ size: u.LG,
256
+ stroke: d,
261
257
  "aria-hidden": !0,
262
- className: q.icon
258
+ className: Z.icon
263
259
  })
264
- }), /* @__PURE__ */ w("div", {
260
+ }), /* @__PURE__ */ k("div", {
265
261
  className: "flex flex-col gap-3",
266
- children: [/* @__PURE__ */ C(p, {
267
- size: l.Small,
268
- iconBefore: /* @__PURE__ */ C(D, {
269
- size: o.SM,
270
- stroke: s,
262
+ children: [/* @__PURE__ */ O(m, {
263
+ size: p.Small,
264
+ iconBefore: /* @__PURE__ */ O(N, {
265
+ size: u.SM,
266
+ stroke: d,
271
267
  "aria-hidden": !0
272
268
  }),
273
269
  className: "w-fit",
274
- label: a,
275
- onClick: u
276
- }), /* @__PURE__ */ C("span", {
277
- className: r("dial-tiny-text", q.caption),
278
- children: c
270
+ label: r,
271
+ onClick: o
272
+ }), /* @__PURE__ */ O("span", {
273
+ className: s("dial-tiny-text", Z.caption),
274
+ children: a
279
275
  })]
280
276
  })]
281
277
  })]
282
278
  });
283
- }, Y = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
284
- let c = k((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = k((e) => /* @__PURE__ */ C("div", {
279
+ }, se = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
280
+ let c = I((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = I((e) => /* @__PURE__ */ O("div", {
285
281
  className: "dial-small-text px-6 py-3",
286
- children: /* @__PURE__ */ C("p", {
282
+ children: /* @__PURE__ */ O("p", {
287
283
  className: "mb-3 text-secondary",
288
- children: e.length === 1 ? /* @__PURE__ */ w(S, { children: [
284
+ children: e.length === 1 ? /* @__PURE__ */ k(D, { children: [
289
285
  s.deleteConfirmSingleText,
290
286
  " ",
291
- /* @__PURE__ */ w("span", {
287
+ /* @__PURE__ */ k("span", {
292
288
  className: "break-words text-primary",
293
289
  children: [
294
290
  "\"",
@@ -296,10 +292,10 @@ var P = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
296
292
  "\"?"
297
293
  ]
298
294
  })
299
- ] }) : /* @__PURE__ */ w(S, { children: [
295
+ ] }) : /* @__PURE__ */ k(D, { children: [
300
296
  s.deleteConfirmMultipleText,
301
297
  " ",
302
- /* @__PURE__ */ w("span", {
298
+ /* @__PURE__ */ k("span", {
303
299
  className: "text-primary",
304
300
  children: [
305
301
  e.length,
@@ -314,9 +310,9 @@ var P = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
314
310
  s.deleteConfirmMultipleText,
315
311
  s.deleteConfirmItemsLabel
316
312
  ]);
317
- return /* @__PURE__ */ C(O, {
313
+ return /* @__PURE__ */ O(ee, {
318
314
  fallback: null,
319
- children: e && /* @__PURE__ */ C(i, {
315
+ children: e && /* @__PURE__ */ O(i, {
320
316
  isOpen: e,
321
317
  onClose: t,
322
318
  onAttach: n,
@@ -344,239 +340,482 @@ var P = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
344
340
  deleteConfirmTitle: c,
345
341
  deleteConfirmBody: l,
346
342
  deleteConfirmLabel: s.deleteConfirmLabel,
347
- deleteCancelLabel: s.deleteCancelLabel,
348
- uploadProgressTitle: s.uploadProgressTitle,
349
- cancelLabel: s.cancelLabel
343
+ deleteCancelLabel: s.deleteCancelLabel
350
344
  })
351
345
  });
352
- }, X = (e, t, n) => ({
346
+ }, Q = /* @__PURE__ */ function(e) {
347
+ return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
348
+ }({}), ce = [
349
+ "avatar",
350
+ "name",
351
+ "version",
352
+ "description",
353
+ "locales",
354
+ "tags"
355
+ ], le = (e, t, n) => ({
353
356
  id: e,
354
357
  language: n.find((e) => !t.has(e.code))?.code ?? "",
355
358
  name: "",
356
359
  description: ""
357
- }), Z = ({ value: t, onChange: n, availableLocaleOptions: u = [], labels: f, className: m, summaryClassName: g = "dial-body-text text-secondary", rowLabelClassName: v = "dial-tiny-lead-text text-secondary" }) => {
358
- let { summaryLabel: y, addLabel: S, editLabel: ee, popupTitle: T, addLocaleLabel: E, localeRowLabel: O = "Locale", languageLabel: k, nameLabel: j, namePlaceholder: P, descriptionLabel: F, descriptionPlaceholder: I, deleteAriaLabel: L, cancelLabel: R = "Cancel", saveLabel: z = "Save" } = f, [B, V] = N(!1), [H, U] = N([]), W = M(0);
359
- A(() => {
360
- B && U(t.length > 0 ? t : [X(`locale-row-${++W.current}`, /* @__PURE__ */ new Set(), u)]);
360
+ }), ue = ({ 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" }) => {
361
+ let { summaryLabel: h, addLabel: _, editLabel: y, popupTitle: x, addLocaleLabel: C, localeRowLabel: w = "Locale", languageLabel: D, nameLabel: A, namePlaceholder: j, descriptionLabel: M, descriptionPlaceholder: ee, deleteAriaLabel: F, cancelLabel: I = "Cancel", saveLabel: ne = "Save" } = i, [L, R] = B(!1), [V, H] = B([]), U = z(0);
362
+ te(() => {
363
+ L && H(e.length > 0 ? e : [le(`locale-row-${++U.current}`, /* @__PURE__ */ new Set(), r)]);
361
364
  }, [
362
- B,
363
- t,
364
- u
365
+ L,
366
+ e,
367
+ r
365
368
  ]);
366
- let G = () => V(!0), K = () => V(!1), q = () => {
367
- n(H.filter((e) => e.language && e.name)), V(!1);
368
- }, J = () => {
369
- let e = new Set(H.map((e) => e.language).filter(Boolean));
370
- U((t) => [...t, X(`locale-row-${++W.current}`, e, u)]);
371
- }, Y = (e, t) => {
372
- U((n) => n.map((n) => n.id === e ? {
369
+ let re = () => R(!0), W = () => R(!1), ie = () => {
370
+ t(V.filter((e) => e.language && e.name)), R(!1);
371
+ }, G = () => {
372
+ let e = new Set(V.map((e) => e.language).filter(Boolean));
373
+ H((t) => [...t, le(`locale-row-${++U.current}`, e, r)]);
374
+ }, K = (e, t) => {
375
+ H((n) => n.map((n) => n.id === e ? {
373
376
  ...n,
374
377
  ...t
375
378
  } : n));
376
- }, Z = (e) => {
377
- U((t) => t.filter((t) => t.id !== e));
378
- }, Q = (e) => u.find((t) => t.code === e)?.label ?? e.toUpperCase(), $ = H.some((e) => !e.language || !e.name);
379
- return u.length === 0 ? null : /* @__PURE__ */ w("div", {
380
- className: r("flex items-center gap-2", m),
379
+ }, q = (e) => {
380
+ H((t) => t.filter((t) => t.id !== e));
381
+ }, J = (e) => r.find((t) => t.code === e)?.label ?? e.toUpperCase(), Y = V.some((e) => !e.language || !e.name);
382
+ return r.length === 0 ? null : /* @__PURE__ */ k("div", {
383
+ className: s("flex items-center gap-2", a),
381
384
  children: [
382
- t.length > 0 && /* @__PURE__ */ C("span", {
383
- className: g,
384
- children: `${y}: ${t.map((e) => `[${Q(e.language)}]`).join(", ")}`
385
+ e.length > 0 && /* @__PURE__ */ O("span", {
386
+ className: o,
387
+ children: `${h}: ${e.map((e) => `[${J(e.language)}]`).join(", ")}`
385
388
  }),
386
- /* @__PURE__ */ C(p, {
387
- label: t.length > 0 ? ee : S,
388
- iconBefore: /* @__PURE__ */ C(D, {
389
- size: o.SM,
389
+ /* @__PURE__ */ O(v, {
390
+ label: e.length > 0 ? y : _,
391
+ iconBefore: /* @__PURE__ */ O(N, {
392
+ size: u.SM,
390
393
  "aria-hidden": !0,
391
- stroke: s
394
+ stroke: d
392
395
  }),
393
396
  className: "!px-0",
394
- onClick: G
397
+ onClick: re
395
398
  }),
396
- /* @__PURE__ */ C(h, {
397
- open: B,
398
- header: T,
399
- onClose: K,
399
+ /* @__PURE__ */ O(b, {
400
+ open: L,
401
+ header: x,
402
+ onClose: W,
400
403
  mainButtons: [{
401
- label: R,
402
- onClick: K
404
+ label: I,
405
+ onClick: W
403
406
  }, {
404
- label: z,
405
- variant: a.Primary,
406
- disabled: $,
407
- onClick: q
407
+ label: ne,
408
+ variant: l.Primary,
409
+ disabled: Y,
410
+ onClick: ie
408
411
  }],
409
- children: /* @__PURE__ */ w("div", {
412
+ children: /* @__PURE__ */ k("div", {
410
413
  className: "flex flex-col gap-8 px-6 py-3",
411
- children: [H.map((t, n) => {
412
- let r = new Set(H.filter((e) => e.id !== t.id).map((e) => e.language).filter(Boolean));
413
- return /* @__PURE__ */ w("div", {
414
+ children: [V.map((e, t) => {
415
+ let i = new Set(V.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
416
+ return /* @__PURE__ */ k("div", {
414
417
  className: "flex flex-col gap-2",
415
- children: [/* @__PURE__ */ w("div", {
418
+ children: [/* @__PURE__ */ k("div", {
416
419
  className: "flex items-center justify-between",
417
- children: [/* @__PURE__ */ w("span", {
418
- className: v,
420
+ children: [/* @__PURE__ */ k("span", {
421
+ className: m,
419
422
  children: [
420
- O,
423
+ w,
421
424
  " ",
422
- n + 1
425
+ t + 1
423
426
  ]
424
- }), /* @__PURE__ */ C(c, {
425
- appearance: i.Ghost,
426
- size: l.Small,
427
- icon: /* @__PURE__ */ C(te, {
428
- size: o.SM,
427
+ }), /* @__PURE__ */ O(f, {
428
+ appearance: c.Ghost,
429
+ size: p.Small,
430
+ icon: /* @__PURE__ */ O(P, {
431
+ size: u.SM,
429
432
  "aria-hidden": !0,
430
- stroke: s
433
+ stroke: d
431
434
  }),
432
- "aria-label": `${L} ${n + 1}`,
433
- onClick: () => Z(t.id)
435
+ "aria-label": `${F} ${t + 1}`,
436
+ onClick: () => q(e.id)
434
437
  })]
435
- }), /* @__PURE__ */ w("div", {
438
+ }), /* @__PURE__ */ k("div", {
436
439
  role: "group",
437
- "aria-label": `${O} ${n + 1}`,
440
+ "aria-label": `${w} ${t + 1}`,
438
441
  className: "flex flex-col gap-5",
439
- children: [/* @__PURE__ */ w("div", {
442
+ children: [/* @__PURE__ */ k("div", {
440
443
  className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
441
- children: [/* @__PURE__ */ C(_, {
442
- id: `${t.id}-language`,
444
+ children: [/* @__PURE__ */ O(S, {
445
+ id: `${e.id}-language`,
443
446
  labelProps: {
444
- label: k,
447
+ label: D,
445
448
  required: !0
446
449
  },
447
450
  className: "desktop:shrink-0 desktop:basis-40",
448
- options: u.map((e) => ({
451
+ options: r.map((e) => ({
449
452
  value: e.code,
450
453
  label: e.label,
451
- disabled: r.has(e.code)
454
+ disabled: i.has(e.code)
452
455
  })),
453
- value: t.language,
454
- onChange: (e) => Y(t.id, { language: e })
455
- }), /* @__PURE__ */ C(d, {
456
- id: `${t.id}-name`,
456
+ value: e.language,
457
+ onChange: (t) => K(e.id, { language: t })
458
+ }), /* @__PURE__ */ O(g, {
459
+ id: `${e.id}-name`,
457
460
  containerClassName: "min-w-0 flex-1",
458
461
  required: !0,
459
- value: t.name,
460
- onChange: (e) => Y(t.id, { name: e ?? "" }),
462
+ value: e.name,
463
+ onChange: (t) => K(e.id, { name: t ?? "" }),
461
464
  labelProps: {
462
- label: j,
465
+ label: A,
463
466
  required: !0
464
467
  },
465
- placeholder: P
468
+ placeholder: j
466
469
  })]
467
- }), /* @__PURE__ */ C(b, {
468
- id: `${t.id}-description`,
469
- className: e,
470
- resize: x.Vertical,
471
- value: t.description,
472
- onChange: (e) => Y(t.id, { description: e }),
473
- labelProps: { label: F },
474
- placeholder: I
470
+ }), /* @__PURE__ */ O(T, {
471
+ id: `${e.id}-description`,
472
+ className: n,
473
+ resize: E.Vertical,
474
+ value: e.description,
475
+ onChange: (t) => K(e.id, { description: t }),
476
+ labelProps: { label: M },
477
+ placeholder: ee
475
478
  })]
476
479
  })]
477
- }, t.id);
478
- }), /* @__PURE__ */ C(p, {
479
- label: E,
480
- iconBefore: /* @__PURE__ */ C(D, {
481
- size: o.SM,
480
+ }, e.id);
481
+ }), /* @__PURE__ */ O(v, {
482
+ label: C,
483
+ iconBefore: /* @__PURE__ */ O(N, {
484
+ size: u.SM,
482
485
  "aria-hidden": !0,
483
- stroke: s
486
+ stroke: d
484
487
  }),
485
488
  className: "self-start",
486
- onClick: J,
487
- disabled: H.length >= u.length
489
+ onClick: G,
490
+ disabled: V.length >= r.length
488
491
  })]
489
492
  })
490
493
  })
491
494
  ]
492
495
  });
493
- }, Q = ({ values: n, errors: i, onChange: a, onNameBlur: o, onVersionBlur: s, iconPreviewUrl: c, onAddAvatarClick: l, labels: u, styles: f, availableLocaleOptions: p = [] }) => {
494
- let m = M(null), h = M(null), g = M(!1), _ = !!(i.name || i.version);
495
- return A(() => {
496
- _ && !g.current && (i.name ? m : h).current?.focus(), g.current = _;
496
+ }, de = "Add tags, comma separated", fe = "deployment-creation-form-description", pe = ({ values: e, errors: t, onChange: i, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: c, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], fields: p = ce, isNameReadOnly: m = !1, nameCaption: h, isDescriptionRequired: _ = !1, renderDescription: v, focusRequestKey: y }) => {
497
+ let b = z(null), x = z(null), S = z(null), C = z(!1), D = (e) => p.includes(e), A = D(Q.Name), j = D(Q.Version), M = !!(t.name || t.version || t.description), N = z(y);
498
+ te(() => {
499
+ let e = () => {
500
+ t.name ? b.current?.focus() : t.version ? x.current?.focus() : t.description && S.current?.focus();
501
+ };
502
+ if (y !== void 0) {
503
+ y !== N.current && (N.current = y, e());
504
+ return;
505
+ }
506
+ M && !C.current && e(), C.current = M;
497
507
  }, [
498
- _,
499
- i.name,
500
- i.version
501
- ]), /* @__PURE__ */ w("div", {
508
+ y,
509
+ M,
510
+ t.name,
511
+ t.version,
512
+ t.description
513
+ ]);
514
+ let P = /* @__PURE__ */ O(T, {
515
+ id: fe,
516
+ ref: S,
517
+ value: e.description,
518
+ onChange: (e) => i({ description: e }),
519
+ "aria-required": _ || void 0,
520
+ labelProps: v ? void 0 : {
521
+ label: u.description.label,
522
+ required: _
523
+ },
524
+ placeholder: u.description.placeholder,
525
+ error: t.description || void 0,
526
+ invalid: !!t.description,
527
+ containerClassName: v ? void 0 : d?.field,
528
+ className: n,
529
+ resize: E.Vertical
530
+ });
531
+ return /* @__PURE__ */ k("div", {
502
532
  role: u.ariaLabel ? "group" : void 0,
503
533
  "aria-label": u.ariaLabel,
504
- className: r("flex flex-col gap-4", f?.root),
534
+ className: s("flex flex-col gap-4", d?.root),
505
535
  children: [
506
- /* @__PURE__ */ C(J, {
536
+ D(Q.Avatar) && /* @__PURE__ */ O(oe, {
507
537
  label: u.iconUrl.label,
508
538
  avatarUrl: c,
509
539
  addAvatarLabel: u.iconUrl.addAvatarLabel,
510
540
  captionText: u.iconUrl.captionText,
511
541
  onAddAvatarClick: l,
512
- className: f?.field
542
+ className: d?.field
513
543
  }),
514
- /* @__PURE__ */ w("div", {
515
- className: r("flex items-start gap-4", f?.field),
516
- children: [/* @__PURE__ */ C(d, {
544
+ (A || j) && /* @__PURE__ */ k("div", {
545
+ className: s("flex items-start gap-4", d?.field),
546
+ children: [A && /* @__PURE__ */ O(g, {
517
547
  id: "deployment-creation-form-name",
518
- inputRef: m,
519
- value: n.name,
520
- onChange: (e) => a({ name: e ?? "" }),
521
- onBlur: o,
548
+ inputRef: b,
549
+ value: e.name,
550
+ onChange: (e) => i({ name: e ?? "" }),
551
+ onBlur: a,
552
+ readOnly: m,
522
553
  labelProps: {
523
554
  label: u.name.label,
524
555
  required: !0
525
556
  },
526
557
  placeholder: u.name.placeholder,
527
- error: i.name || void 0,
528
- invalid: !!i.name,
529
- containerClassName: "min-w-0 basis-0 grow-[2]"
530
- }), /* @__PURE__ */ C(d, {
558
+ caption: h,
559
+ error: t.name || void 0,
560
+ invalid: !!t.name,
561
+ containerClassName: j ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
562
+ }), j && /* @__PURE__ */ O(g, {
531
563
  id: "deployment-creation-form-version",
532
- inputRef: h,
533
- value: n.version,
534
- onChange: (e) => a({ version: e ?? "" }),
535
- onBlur: s,
564
+ inputRef: x,
565
+ value: e.version,
566
+ onChange: (e) => i({ version: e ?? "" }),
567
+ onBlur: o,
536
568
  labelProps: { label: u.version.label },
537
569
  placeholder: u.version.placeholder,
538
- error: i.version || void 0,
539
- invalid: !!i.version,
540
- containerClassName: "min-w-0 basis-0 grow-[1]"
570
+ error: t.version || void 0,
571
+ invalid: !!t.version,
572
+ containerClassName: A ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
541
573
  })]
542
574
  }),
543
- /* @__PURE__ */ C(b, {
544
- id: "deployment-creation-form-description",
545
- value: n.description,
546
- onChange: (e) => a({ description: e }),
547
- labelProps: { label: u.description.label },
548
- placeholder: u.description.placeholder,
549
- containerClassName: f?.field,
550
- className: e,
551
- resize: x.Vertical
552
- }),
553
- /* @__PURE__ */ C(Z, {
554
- value: n.otherLocales,
555
- onChange: (e) => a({ otherLocales: e }),
556
- availableLocaleOptions: p,
575
+ D(Q.Description) && (v ? /* @__PURE__ */ O("div", {
576
+ className: d?.field,
577
+ children: v(P, fe)
578
+ }) : P),
579
+ D(Q.Locales) && /* @__PURE__ */ O(ue, {
580
+ value: e.otherLocales,
581
+ onChange: (e) => i({ otherLocales: e }),
582
+ availableLocaleOptions: f,
557
583
  labels: u.otherLocales,
558
- className: f?.field
584
+ className: d?.field
559
585
  }),
560
- /* @__PURE__ */ C("div", {
561
- className: f?.field,
562
- children: /* @__PURE__ */ C(y, {
586
+ D(Q.Tags) && /* @__PURE__ */ O("div", {
587
+ className: d?.field,
588
+ children: /* @__PURE__ */ O(w, {
563
589
  id: "deployment-creation-form-topics",
564
590
  labelProps: { label: u.topics.label },
565
- placeholder: u.topics.placeholder,
566
- value: n.topics,
567
- onChange: (e) => a({ topics: e }),
568
- tagClassName: t
591
+ placeholder: u.topics.placeholder ?? de,
592
+ value: e.topics,
593
+ onChange: (e) => i({ topics: e }),
594
+ tagClassName: r
569
595
  })
570
596
  })
571
597
  ]
572
598
  });
573
- }, $ = /* @__PURE__ */ function(e) {
574
- return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e;
575
- }({}), ne = /^[a-zA-Z0-9 _.-]+$/, re = /^[a-zA-Z0-9._-]+$/, ie = /^\d+(\.\d+)*$/, ae = (e, t = {}) => {
576
- let n = {}, r = e.name.trim();
577
- r ? t.validateNamePattern && !ne.test(r) && (n.name = $.InvalidFormat) : n.name = $.Required;
578
- let i = e.version.trim();
579
- return t.validateVersionPattern && i && ((t.validateVersionPattern instanceof RegExp ? t.validateVersionPattern : re).test(i) || (n.version = $.InvalidFormat)), n;
599
+ }, me = "border-0 p-4 desktop:p-8", he = "desktop:flex-1", ge = "px-4 pt-4 desktop:px-6 desktop:pt-6", _e = F(({ 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, asideData: h, asideTitle: g, asideSectionClassName: _, alert: v, metadataSectionClassName: b, setupSectionClassName: S, labels: C, styles: w, dir: T }) => {
600
+ let E = v == null ? null : /* @__PURE__ */ O("div", {
601
+ role: "alert",
602
+ className: ge,
603
+ children: v
604
+ }), A = p != null;
605
+ return /* @__PURE__ */ O(ae, {
606
+ title: e,
607
+ onBack: t,
608
+ backAriaLabel: C?.backAriaLabel ?? "Back",
609
+ isSaving: a,
610
+ labels: { savingStatusLabel: C?.savingStatusLabel ?? "Saving" },
611
+ rightContent: h == null ? void 0 : /* @__PURE__ */ O(Y, {
612
+ title: g,
613
+ styles: w?.section,
614
+ className: s(me, _, q.asideSection),
615
+ children: h
616
+ }),
617
+ styles: w?.layout,
618
+ dir: T,
619
+ actions: /* @__PURE__ */ k(D, { children: [c, !l && /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(y, {
620
+ label: C?.cancelLabel ?? "Cancel",
621
+ disabled: a,
622
+ onClick: n
623
+ }), /* @__PURE__ */ O(x, {
624
+ label: i,
625
+ disabled: a || o,
626
+ onClick: r
627
+ })] })] }),
628
+ leftContent: /* @__PURE__ */ k(D, { children: [
629
+ !A && E,
630
+ /* @__PURE__ */ O(Y, {
631
+ title: d === null ? void 0 : d ?? C?.metadataTitle ?? "Metadata",
632
+ styles: w?.section,
633
+ className: s(me, b, q.metadataSection),
634
+ children: u
635
+ }),
636
+ f
637
+ ] }),
638
+ centerContent: A ? /* @__PURE__ */ k(D, { children: [E, /* @__PURE__ */ O(Y, {
639
+ title: m === null ? void 0 : m ?? C?.setupTitle ?? "Setup",
640
+ styles: w?.section,
641
+ className: s(me, he, S, q.setupSection),
642
+ children: p
643
+ })] }) : void 0
644
+ });
645
+ }), ve = {
646
+ name: {
647
+ label: "Name",
648
+ placeholder: "Enter name"
649
+ },
650
+ description: {
651
+ label: "Description",
652
+ placeholder: "Enter description"
653
+ },
654
+ iconUrl: {
655
+ label: "Avatar",
656
+ addAvatarLabel: "Add avatar",
657
+ captionText: "PNG, JPG or SVG (max 1 MB)"
658
+ },
659
+ version: {
660
+ label: "Version",
661
+ placeholder: "e.g. 1.0.0"
662
+ },
663
+ topics: {
664
+ label: "Tags",
665
+ placeholder: "Add tags, comma separated"
666
+ },
667
+ otherLocales: {
668
+ summaryLabel: "Locales",
669
+ addLabel: "Add locales",
670
+ editLabel: "Edit locales",
671
+ popupTitle: "Add locale",
672
+ addLocaleLabel: "Add locale",
673
+ localeRowLabel: "Locale",
674
+ languageLabel: "Language",
675
+ nameLabel: "Name",
676
+ namePlaceholder: "Enter name",
677
+ descriptionLabel: "About",
678
+ descriptionPlaceholder: "Enter brief description",
679
+ deleteAriaLabel: "Delete locale",
680
+ cancelLabel: "Cancel",
681
+ saveLabel: "Save"
682
+ },
683
+ ariaLabel: "Metadata"
684
+ }, ye = {
685
+ title: "Add avatar",
686
+ attachLabel: "Attach",
687
+ emptyTitle: "This folder is empty",
688
+ emptyDescription: "",
689
+ errorMessage: "Failed to load files",
690
+ retryLabel: "Retry",
691
+ hiddenFilesLabel: "Hidden files",
692
+ showHiddenFilesLabel: "Show hidden files",
693
+ hideHiddenFilesLabel: "Hide hidden files",
694
+ getSelectionLabel: (e) => e === 1 ? "item selected" : "items selected",
695
+ uploadFilesLabel: "Files",
696
+ newFolderLabel: "Folder",
697
+ downloadLabel: "Download",
698
+ downloadingLabel: "Preparing download…",
699
+ deleteLabel: "Delete",
700
+ deletingLabel: "Deleting…",
701
+ deleteConfirmTitleSingle: "Confirm deleting",
702
+ deleteConfirmTitleMultiple: "Confirm deleting items",
703
+ deleteConfirmSingleText: "Are you sure you want to delete",
704
+ deleteConfirmMultipleText: "Do you want to delete following",
705
+ deleteConfirmItemsLabel: "items?",
706
+ deleteConfirmLabel: "Delete",
707
+ deleteCancelLabel: "Cancel"
708
+ }, be = F(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = ce, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
709
+ let [m, h] = B(!1), g = R(() => a ? s : s.filter((e) => e !== Q.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = R(() => v ? v(_) : void 0, [_, v]), b = I(() => h(!0), []), x = I(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = I((e) => {
710
+ let t = S?.(e);
711
+ t && n({ iconUrl: t }), h(!1);
712
+ }, [n, S]);
713
+ return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(pe, {
714
+ values: e,
715
+ errors: t,
716
+ onChange: n,
717
+ onNameBlur: r,
718
+ onVersionBlur: i,
719
+ iconPreviewUrl: y,
720
+ onAddAvatarClick: b,
721
+ labels: p?.form ?? ve,
722
+ availableLocaleOptions: o,
723
+ fields: g,
724
+ isNameReadOnly: c,
725
+ nameCaption: l,
726
+ isDescriptionRequired: u,
727
+ renderDescription: d,
728
+ focusRequestKey: f
729
+ }), a && /* @__PURE__ */ O(se, {
730
+ isOpen: m,
731
+ onClose: x,
732
+ onAttach: C,
733
+ bucket: a.bucket,
734
+ FileManagerModal: a.FileManagerModal,
735
+ allowedMimeTypes: a.allowedMimeTypes,
736
+ maxFileSizeBytes: a.maxFileSizeBytes,
737
+ labels: p?.avatarPicker ?? ye
738
+ })] });
739
+ }), $ = /* @__PURE__ */ function(e) {
740
+ return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
741
+ }({}), xe = (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), Se = (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]) && xe(e.otherLocales, t.otherLocales), Ce = (e) => Object.values(e).every((e) => e == null), we = /^[a-zA-Z0-9 _.-]+$/, Te = /^[a-zA-Z0-9._-]+$/, Ee = /^(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-]+)*)?$/, De = (n, r = {}) => {
742
+ let i = {}, s = n.name.trim();
743
+ s ? a(s, t) ? i.name = $.TooLong : r.validateNamePattern && !we.test(s) ? i.name = $.InvalidFormat : o(s) && (i.name = $.ControlCharacters) : i.name = $.Required, a(n.description, e) && (i.description = $.TooLong);
744
+ let c = n.version.trim();
745
+ return r.validateVersionPattern && c && ((r.validateVersionPattern instanceof RegExp ? r.validateVersionPattern : Te).test(c) || (i.version = $.InvalidFormat)), i;
746
+ }, Oe = new Set([$.TooLong, $.ControlCharacters]), ke = (e, t) => ({
747
+ reseedKey: t,
748
+ values: e,
749
+ baseline: e,
750
+ touched: {},
751
+ hasAttemptedSubmit: !1,
752
+ submitAttemptCount: 0
753
+ }), Ae = ({ initialValues: e, validationOptions: t, reseedKey: n }) => {
754
+ let [r, i] = B(() => ke(e, n));
755
+ r.reseedKey !== n && i(ke(e, n));
756
+ let a = t?.validateNamePattern, o = t?.validateVersionPattern, s = R(() => De(r.values, {
757
+ validateNamePattern: a,
758
+ validateVersionPattern: o
759
+ }), [
760
+ r.values,
761
+ a,
762
+ o
763
+ ]), c = R(() => {
764
+ if (r.hasAttemptedSubmit) return s;
765
+ let e = (e, t) => e && (t || Oe.has(e)) ? e : void 0;
766
+ return {
767
+ name: e(s.name, r.touched[Q.Name]),
768
+ version: e(s.version, r.touched[Q.Version]),
769
+ description: e(s.description, r.touched[Q.Description])
770
+ };
771
+ }, [
772
+ s,
773
+ r.hasAttemptedSubmit,
774
+ r.touched
775
+ ]), l = z(s), u = z(e);
776
+ L(() => {
777
+ l.current = s, u.current = e;
778
+ });
779
+ let d = I((e) => i((t) => ({
780
+ ...t,
781
+ values: {
782
+ ...t.values,
783
+ ...e
784
+ }
785
+ })), []), f = I((e) => i((t) => t.touched[e] ? t : {
786
+ ...t,
787
+ touched: {
788
+ ...t.touched,
789
+ [e]: !0
790
+ }
791
+ }), []), p = I(() => (i((e) => ({
792
+ ...e,
793
+ hasAttemptedSubmit: !0,
794
+ submitAttemptCount: e.submitAttemptCount + 1
795
+ })), Ce(l.current)), []), m = I((e) => i((t) => ke(e ?? u.current, t.reseedKey)), []), h = R(() => !Se(r.values, r.baseline), [r.values, r.baseline]);
796
+ return R(() => ({
797
+ values: r.values,
798
+ setValues: d,
799
+ touched: r.touched,
800
+ markTouched: f,
801
+ errorCodes: s,
802
+ visibleErrorCodes: c,
803
+ attemptSubmit: p,
804
+ submitAttemptCount: r.submitAttemptCount,
805
+ isDirty: h,
806
+ reset: m
807
+ }), [
808
+ r.submitAttemptCount,
809
+ r.values,
810
+ d,
811
+ r.touched,
812
+ f,
813
+ s,
814
+ c,
815
+ p,
816
+ h,
817
+ m
818
+ ]);
580
819
  };
581
820
  //#endregion
582
- export { J as AddAvatar, Y as AvatarPickerModal, H as BUILDER_FORM_CLASS, V as BuilderFormContainer, $ as DeploymentCreationFieldErrorCode, Q as DeploymentCreationForm, Z as DeploymentLocalesField, K as EditorLayout, W as EditorSection, ne as NAME_PATTERN, ie as SEMVER_VERSION_PATTERN, re as VERSION_PATTERN, ae as validateDeploymentCreationFields };
821
+ export { oe as AddAvatar, se as AvatarPickerModal, q as BUILDER_FORM_CLASS, K as BuilderFormContainer, ve as DEFAULT_METADATA_FORM_LABELS, $ as DeploymentCreationFieldErrorCode, pe as DeploymentCreationForm, ue as DeploymentLocalesField, ae as EditorLayout, Y as EditorSection, _e as EntityEditor, Q as MetadataField, be as MetadataForm, we as NAME_PATTERN, Ee as SEMVER_VERSION_PATTERN, Te as VERSION_PATTERN, Ae as useMetadataForm, De as validateDeploymentCreationFields };