@epam/ai-dial-builder-form 1.2.0-dev.3 → 1.2.0-dev.300

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