@epam/ai-dial-ui-kit 0.15.0-dev.45 → 0.15.0-dev.47

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 (66) hide show
  1. package/README.md +2 -0
  2. package/dist/CHANGELOG.md +9 -0
  3. package/dist/{DateCellRenderer-Cl_mNbi1.cjs → DateCellRenderer-CZNa4jVJ.cjs} +1 -1
  4. package/dist/{DateCellRenderer-ChqbDlQ2.cjs → DateCellRenderer-X6vXPDIG.cjs} +1 -1
  5. package/dist/components/New/SchemaRenderer/SchemaRenderer.js +164 -0
  6. package/dist/components/New/SchemaRenderer/components/SchemaAnyOfEditor.js +65 -0
  7. package/dist/components/New/SchemaRenderer/components/SchemaArrayEditor.js +109 -0
  8. package/dist/components/New/SchemaRenderer/components/SchemaField.js +83 -0
  9. package/dist/components/New/SchemaRenderer/components/SchemaFieldContent.js +72 -0
  10. package/dist/components/New/SchemaRenderer/components/SchemaJsonEditor.js +41 -0
  11. package/dist/components/New/SchemaRenderer/components/SchemaKeyValueEditor.js +250 -0
  12. package/dist/components/New/SchemaRenderer/components/SchemaObjectEditor.js +36 -0
  13. package/dist/components/New/SchemaRenderer/components/SchemaOneOfEditor.js +163 -0
  14. package/dist/components/New/SchemaRenderer/components/SchemaPrimitiveField.js +150 -0
  15. package/dist/components/New/SchemaRenderer/components/SchemaSection.js +135 -0
  16. package/dist/components/New/SchemaRenderer/context.js +17 -0
  17. package/dist/components/New/Slider/Slider.js +151 -90
  18. package/dist/components/New/Slider/utils.js +12 -0
  19. package/dist/components/New/Textarea/Textarea.js +21 -20
  20. package/dist/components/SchemaRenderer/SchemaRenderer.js +16 -15
  21. package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +2 -2
  22. package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +1 -1
  23. package/dist/components/SchemaRenderer/components/SchemaField.js +8 -8
  24. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +2 -2
  25. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +2 -2
  26. package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +1 -1
  27. package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +13 -13
  28. package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +5 -5
  29. package/dist/components-manifest.json +175 -12
  30. package/dist/constants/public-class-names.js +8 -0
  31. package/dist/{components/SchemaRenderer/types.js → constants/schema-renderer.js} +2 -7
  32. package/dist/dial-ui-kit.cjs +2 -2
  33. package/dist/dial-ui-kit.js +241 -239
  34. package/dist/file-manager.cjs +1 -1
  35. package/dist/grid.cjs +1 -1
  36. package/dist/index.css +2 -2
  37. package/dist/migration-guides/0.15.0/slider-redesign.md +110 -0
  38. package/dist/migration-guides/README.md +1 -0
  39. package/dist/src/components/New/SchemaRenderer/SchemaRenderer.d.ts +38 -0
  40. package/dist/src/components/New/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +37 -0
  41. package/dist/src/components/New/SchemaRenderer/components/SchemaArrayEditor.d.ts +35 -0
  42. package/dist/src/components/New/SchemaRenderer/components/SchemaField.d.ts +33 -0
  43. package/dist/src/components/New/SchemaRenderer/components/SchemaFieldContent.d.ts +30 -0
  44. package/dist/src/components/New/SchemaRenderer/components/SchemaJsonEditor.d.ts +29 -0
  45. package/dist/src/components/New/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +37 -0
  46. package/dist/src/components/New/SchemaRenderer/components/SchemaObjectEditor.d.ts +32 -0
  47. package/dist/src/components/New/SchemaRenderer/components/SchemaOneOfEditor.d.ts +39 -0
  48. package/dist/src/components/New/SchemaRenderer/components/SchemaPrimitiveField.d.ts +38 -0
  49. package/dist/src/components/New/SchemaRenderer/components/SchemaSection.d.ts +39 -0
  50. package/dist/src/components/New/SchemaRenderer/context.d.ts +8 -0
  51. package/dist/src/components/New/SchemaRenderer/types.d.ts +76 -0
  52. package/dist/src/components/New/Slider/Slider.d.ts +20 -1
  53. package/dist/src/components/New/Slider/utils.d.ts +6 -0
  54. package/dist/src/components/New/Slider/utils.spec.d.ts +1 -0
  55. package/dist/src/components/SchemaRenderer/types.d.ts +5 -93
  56. package/dist/src/components/SchemaRenderer/utils.d.ts +1 -22
  57. package/dist/src/constants/public-class-names.d.ts +8 -0
  58. package/dist/src/constants/schema-renderer.d.ts +2 -0
  59. package/dist/src/index.d.ts +3 -1
  60. package/dist/src/models/json-schema.d.ts +71 -0
  61. package/dist/src/types/json-schema.d.ts +22 -0
  62. package/dist/src/utils/json-schema.d.ts +23 -0
  63. package/dist/types/json-schema.js +7 -0
  64. package/dist/{use-file-manager-tabs-C-dMqEFy.cjs → use-file-manager-tabs-Bzzwwcgk.cjs} +1 -1
  65. package/dist/{components/SchemaRenderer/utils.js → utils/json-schema.js} +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,72 @@
1
+ import { jsx as t, jsxs as j } from "react/jsx-runtime";
2
+ import { ErrorText as v } from "../../CaptionText/CaptionText.js";
3
+ import { JsonSchemaType as f } from "../../../../types/json-schema.js";
4
+ import { resolveRef as C, isObjectType as F, isMissingRequiredValue as T, toRequiredMessage as A } from "../../../../utils/json-schema.js";
5
+ import { useSchemaContext as k, isPathTouched as M } from "../context.js";
6
+ import { SchemaAnyOfEditor as R } from "./SchemaAnyOfEditor.js";
7
+ import { SchemaArrayEditor as q } from "./SchemaArrayEditor.js";
8
+ import { SchemaJsonEditor as J } from "./SchemaJsonEditor.js";
9
+ import { SchemaKeyValueEditor as N } from "./SchemaKeyValueEditor.js";
10
+ import { SchemaObjectEditor as V } from "./SchemaObjectEditor.js";
11
+ import { SchemaOneOfEditor as B } from "./SchemaOneOfEditor.js";
12
+ import { SchemaPrimitiveField as K } from "./SchemaPrimitiveField.js";
13
+ const Z = ({
14
+ schema: h,
15
+ value: m,
16
+ onChange: S,
17
+ path: d,
18
+ level: y,
19
+ required: P,
20
+ suppressInlineError: g = !1,
21
+ fieldId: a,
22
+ ariaLabel: r
23
+ }) => {
24
+ const { rootSchema: u, renderField: l, markTouched: x, touchedPaths: E, skipUntouched: O } = k(), e = C(h, u), p = d.join("."), c = (i) => {
25
+ x?.(p), S(i);
26
+ }, s = {
27
+ schema: e,
28
+ value: m,
29
+ onChange: c,
30
+ path: d,
31
+ level: y
32
+ };
33
+ let o;
34
+ if (e.oneOf)
35
+ o = /* @__PURE__ */ t(B, { ...s, ariaLabel: r });
36
+ else if (e.anyOf && e.type !== f.Object)
37
+ o = /* @__PURE__ */ t(R, { ...s, ariaLabel: r });
38
+ else if (F(e)) {
39
+ const i = e.additionalProperties != null && e.additionalProperties !== !1, n = !e.properties || Object.keys(e.properties).length === 0;
40
+ i && n ? o = /* @__PURE__ */ t(N, { ...s }) : n && e.additionalProperties !== !1 ? o = /* @__PURE__ */ t(
41
+ J,
42
+ {
43
+ value: m,
44
+ onChange: c,
45
+ id: a,
46
+ ariaLabel: r
47
+ }
48
+ ) : o = /* @__PURE__ */ t(V, { ...s });
49
+ } else if (e.type === f.Array)
50
+ o = /* @__PURE__ */ t(q, { ...s });
51
+ else {
52
+ const i = M(p, E, O) && !!P && T(m), n = !g && i ? A(e.title ?? r ?? "Field") : void 0;
53
+ o = /* @__PURE__ */ j("div", { className: "flex flex-col gap-1", children: [
54
+ /* @__PURE__ */ t(
55
+ K,
56
+ {
57
+ schema: e,
58
+ value: m,
59
+ onChange: c,
60
+ invalid: i,
61
+ id: a,
62
+ ariaLabel: r
63
+ }
64
+ ),
65
+ /* @__PURE__ */ t(v, { text: n })
66
+ ] });
67
+ }
68
+ return l ? l(d, e, o) : o;
69
+ };
70
+ export {
71
+ Z as SchemaFieldContent
72
+ };
@@ -0,0 +1,41 @@
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { useState as p } from "react";
3
+ import { Textarea as d, TextareaResize as f } from "../../Textarea/Textarea.js";
4
+ import { useSchemaContext as u } from "../context.js";
5
+ const t = (e) => {
6
+ try {
7
+ return JSON.parse(e), !0;
8
+ } catch {
9
+ return !1;
10
+ }
11
+ }, x = ({
12
+ value: e,
13
+ onChange: s,
14
+ id: n,
15
+ ariaLabel: i
16
+ }) => {
17
+ const { readonly: l, texts: c } = u(), [a, m] = p(
18
+ () => JSON.stringify(e, null, 2) ?? ""
19
+ ), o = !t(a);
20
+ return /* @__PURE__ */ h(
21
+ d,
22
+ {
23
+ id: n,
24
+ "aria-label": i,
25
+ value: a,
26
+ onChange: (r) => {
27
+ m(r), t(r) && s(JSON.parse(r));
28
+ },
29
+ readOnly: l,
30
+ invalid: o,
31
+ error: o ? c.invalidJsonError : void 0,
32
+ spellCheck: !1,
33
+ rows: 10,
34
+ resize: f.Vertical,
35
+ className: "font-mono !whitespace-pre"
36
+ }
37
+ );
38
+ };
39
+ export {
40
+ x as SchemaJsonEditor
41
+ };
@@ -0,0 +1,250 @@
1
+ import { jsxs as b, jsx as t } from "react/jsx-runtime";
2
+ import { useState as I, useMemo as A } from "react";
3
+ import { IconPlus as Z, IconTrash as Q } from "@tabler/icons-react";
4
+ import { GhostButton as X } from "../../Button/ButtonWrappers.js";
5
+ import { DIAL_KIT_ICON_STROKE as F } from "../../constants/icon.js";
6
+ import { DangerIconButton as U } from "../../IconButton/IconButtonWrappers.js";
7
+ import { Input as B } from "../../Input/Input.js";
8
+ import { Select as D } from "../../Select/Select.js";
9
+ import { Tooltip as ee } from "../../Tooltip/Tooltip.js";
10
+ import { DIAL_ICON_SIZE as H } from "../../../../constants/icon.js";
11
+ import { JsonSchemaType as n } from "../../../../types/json-schema.js";
12
+ import { ElementSize as te } from "../../../../types/size.js";
13
+ import { resolveRef as oe, isObjectType as ae, inferEntryType as le, ENTRY_TYPE_OPTIONS as re, validateRequired as ne, buildSummary as ie, extractDefaults as se, getSchemaDefault as ce, getEntryTypeDefault as me } from "../../../../utils/json-schema.js";
14
+ import { useSchemaContext as M, isPathTouched as de } from "../context.js";
15
+ import { SchemaFieldContent as ue } from "./SchemaFieldContent.js";
16
+ import { SchemaJsonEditor as ye } from "./SchemaJsonEditor.js";
17
+ import { SchemaPrimitiveField as pe } from "./SchemaPrimitiveField.js";
18
+ import { SchemaSection as fe } from "./SchemaSection.js";
19
+ const K = (e, s) => ({
20
+ id: Math.random().toString(36).slice(2),
21
+ key: e,
22
+ value: s
23
+ }), R = (e) => !!(e.oneOf || e.anyOf || e.type === n.Array || ae(e)), he = {
24
+ [n.String]: "entryTypeString",
25
+ [n.Number]: "entryTypeNumber",
26
+ [n.Boolean]: "entryTypeBoolean",
27
+ [n.Null]: "entryTypeNull",
28
+ [n.Object]: "entryTypeObject",
29
+ [n.Array]: "entryTypeArray"
30
+ }, _ = (e) => typeof e == "string" ? e : e[0], ve = ({
31
+ pair: e,
32
+ valueSchema: s,
33
+ isUnschematizedValue: m,
34
+ onKeyChange: g,
35
+ onValueChange: d,
36
+ onRemove: x,
37
+ path: c,
38
+ level: k
39
+ }) => {
40
+ const {
41
+ rootSchema: p,
42
+ texts: o,
43
+ readonly: u = !1,
44
+ inputClassName: y,
45
+ defaultExpanded: T = !0,
46
+ touchedPaths: C,
47
+ markTouched: N,
48
+ skipUntouched: S
49
+ } = M(), [l, a] = I(e.key), [r, f] = I(
50
+ () => le(e.value)
51
+ ), J = R(s), j = m && (r === n.Object || r === n.Array), Y = m && r === n.Null, $ = m && r === n.Boolean, O = J || j, w = [...c, e.id, "key"].join("."), P = de(w, C, S) && e.key === "", h = e.key || o.valueColumnHeader, q = (i) => {
52
+ d(me(i)), f(i);
53
+ }, V = A(
54
+ () => re.map((i) => ({
55
+ value: i,
56
+ label: o[he[i]]
57
+ })),
58
+ [o]
59
+ ), z = A(
60
+ () => [
61
+ { value: "true", label: o.booleanTrueOption },
62
+ { value: "false", label: o.booleanFalseOption }
63
+ ],
64
+ [o]
65
+ ), G = () => Y ? /* @__PURE__ */ t(B, { "aria-label": h, value: "null", disabled: !0 }) : $ ? /* @__PURE__ */ t(
66
+ D,
67
+ {
68
+ ariaLabel: h,
69
+ options: z,
70
+ value: e.value ? "true" : "false",
71
+ disabled: u,
72
+ onChange: (i) => {
73
+ const v = _(i);
74
+ v && d(v === "true");
75
+ }
76
+ }
77
+ ) : /* @__PURE__ */ t(
78
+ pe,
79
+ {
80
+ schema: m ? { type: r } : s,
81
+ value: e.value,
82
+ onChange: d,
83
+ ariaLabel: h
84
+ }
85
+ ), E = /* @__PURE__ */ b("div", { className: "flex items-start gap-2", children: [
86
+ /* @__PURE__ */ t("div", { className: O ? "min-w-0 flex-1" : "w-2/5 min-w-0", children: /* @__PURE__ */ t(
87
+ B,
88
+ {
89
+ "aria-label": o.keyColumnHeader,
90
+ value: l,
91
+ disabled: u,
92
+ invalid: P,
93
+ error: P ? `${o.keyColumnHeader} is required` : void 0,
94
+ onChange: (i) => a(i ?? ""),
95
+ onBlur: () => {
96
+ N?.(w), l !== e.key && g(l);
97
+ },
98
+ placeholder: o.keyInputPlaceholder,
99
+ containerClassName: y
100
+ }
101
+ ) }),
102
+ !O && /* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: G() }),
103
+ m && /* @__PURE__ */ t("div", { className: "w-28 shrink-0", children: /* @__PURE__ */ t(
104
+ ee,
105
+ {
106
+ tooltip: o.entryTypeChangeWarning,
107
+ triggerClassName: "block",
108
+ children: /* @__PURE__ */ t(
109
+ D,
110
+ {
111
+ ariaLabel: o.typeColumnHeader,
112
+ options: V,
113
+ value: r,
114
+ disabled: u,
115
+ onChange: (i) => {
116
+ const v = _(i);
117
+ v && q(v);
118
+ }
119
+ }
120
+ )
121
+ }
122
+ ) }),
123
+ !u && // The controls in this row are 40px tall; a 24px button keeps the row
124
+ // dense, and the margin centres it on the first line of the row.
125
+ /* @__PURE__ */ t(
126
+ U,
127
+ {
128
+ size: te.Small,
129
+ icon: /* @__PURE__ */ t(
130
+ Q,
131
+ {
132
+ size: H.SM,
133
+ stroke: F,
134
+ "aria-hidden": "true"
135
+ }
136
+ ),
137
+ "aria-label": e.key ? `${o.removeFieldAriaLabel}: ${e.key}` : o.removeFieldAriaLabel,
138
+ onClick: x,
139
+ className: "mt-2 shrink-0"
140
+ }
141
+ )
142
+ ] });
143
+ if (!O) return E;
144
+ if (j)
145
+ return /* @__PURE__ */ b("div", { className: "flex flex-col gap-2", children: [
146
+ E,
147
+ /* @__PURE__ */ t(
148
+ ye,
149
+ {
150
+ value: e.value,
151
+ onChange: d,
152
+ ariaLabel: h
153
+ },
154
+ r
155
+ )
156
+ ] });
157
+ const L = [...c, e.key], W = ne(
158
+ e.value,
159
+ s,
160
+ p,
161
+ L.join(".")
162
+ );
163
+ return /* @__PURE__ */ b("div", { className: "flex flex-col gap-2", children: [
164
+ E,
165
+ /* @__PURE__ */ t(
166
+ fe,
167
+ {
168
+ title: e.key,
169
+ level: k,
170
+ summary: ie(e.value, s, p),
171
+ errorCount: W.length + (P ? 1 : 0),
172
+ defaultExpanded: T,
173
+ children: /* @__PURE__ */ t(
174
+ ue,
175
+ {
176
+ schema: s,
177
+ value: e.value,
178
+ onChange: d,
179
+ path: L,
180
+ level: k + 1,
181
+ ariaLabel: h
182
+ }
183
+ )
184
+ }
185
+ )
186
+ ] });
187
+ }, Ke = ({
188
+ schema: e,
189
+ value: s,
190
+ onChange: m,
191
+ path: g,
192
+ level: d
193
+ }) => {
194
+ const { rootSchema: x, texts: c, readonly: k = !1 } = M(), p = e.additionalProperties === !0 || e.additionalProperties == null, o = !p && typeof e.additionalProperties == "object" ? oe(e.additionalProperties, x) : { type: n.String }, u = R(o), [y, T] = I(
195
+ () => Object.entries(s ?? {}).map(
196
+ ([l, a]) => K(l, a)
197
+ )
198
+ ), C = (l) => {
199
+ T(l), m(
200
+ Object.fromEntries(
201
+ l.filter((a) => a.key !== "").map((a) => [a.key, a.value])
202
+ )
203
+ );
204
+ }, N = (l, a) => C(y.map((r, f) => f === l ? { ...r, ...a } : r)), S = () => {
205
+ const l = u ? se(o, x) ?? ce(o) : "";
206
+ T((a) => [...a, K("", l)]);
207
+ };
208
+ return /* @__PURE__ */ b("div", { className: "flex flex-col gap-2", children: [
209
+ y.length === 0 && /* @__PURE__ */ t("p", { className: "dial-small-text text-secondary", children: c.noFieldsYet }),
210
+ y.length > 0 && !u && // Column headings for sighted users; each control carries its own
211
+ // accessible name, so the headings are hidden from assistive tech.
212
+ /* @__PURE__ */ b("div", { "aria-hidden": "true", className: "flex gap-2 pr-8", children: [
213
+ /* @__PURE__ */ t("span", { className: "w-2/5 dial-tiny-semi-text text-secondary", children: c.keyColumnHeader }),
214
+ /* @__PURE__ */ t("span", { className: "flex-1 dial-tiny-semi-text text-secondary", children: c.valueColumnHeader }),
215
+ p && /* @__PURE__ */ t("span", { className: "w-28 shrink-0 dial-tiny-semi-text text-secondary", children: c.typeColumnHeader })
216
+ ] }),
217
+ y.map((l, a) => /* @__PURE__ */ t(
218
+ ve,
219
+ {
220
+ pair: l,
221
+ valueSchema: o,
222
+ isUnschematizedValue: p,
223
+ onKeyChange: (r) => N(a, { key: r }),
224
+ onValueChange: (r) => N(a, { value: r }),
225
+ onRemove: () => C(y.filter((r, f) => f !== a)),
226
+ path: g,
227
+ level: d
228
+ },
229
+ l.id
230
+ )),
231
+ !k && /* @__PURE__ */ t("div", { className: "pt-1", children: /* @__PURE__ */ t(
232
+ X,
233
+ {
234
+ label: c.addField,
235
+ iconBefore: /* @__PURE__ */ t(
236
+ Z,
237
+ {
238
+ size: H.SM,
239
+ stroke: F,
240
+ "aria-hidden": "true"
241
+ }
242
+ ),
243
+ onClick: S
244
+ }
245
+ ) })
246
+ ] });
247
+ };
248
+ export {
249
+ Ke as SchemaKeyValueEditor
250
+ };
@@ -0,0 +1,36 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { resolveRef as s, sortByPropertyOrder as b, toFieldLabel as v } from "../../../../utils/json-schema.js";
3
+ import { useSchemaContext as g } from "../context.js";
4
+ import { SchemaField as j } from "./SchemaField.js";
5
+ const F = ({
6
+ schema: c,
7
+ value: a,
8
+ onChange: d,
9
+ path: m,
10
+ level: p
11
+ }) => {
12
+ const { rootSchema: r, texts: f } = g(), i = s(c, r), l = b(
13
+ Object.entries(i.properties ?? {}).filter(
14
+ ([, e]) => !s(e, r).isHidden
15
+ )
16
+ ), u = i.required ?? [], n = a ?? {};
17
+ return l.length === 0 ? /* @__PURE__ */ o("p", { className: "dial-small-text text-secondary", children: f.noConfigurableProperties }) : /* @__PURE__ */ o("div", { className: "flex flex-col gap-4", children: l.map(([e, t]) => {
18
+ const h = s(t, r);
19
+ return /* @__PURE__ */ o(
20
+ j,
21
+ {
22
+ schema: t,
23
+ value: n[e],
24
+ onChange: (x) => d({ ...n, [e]: x }),
25
+ path: [...m, e],
26
+ level: p,
27
+ required: u.includes(e),
28
+ label: h.title ?? t.title ?? v(e)
29
+ },
30
+ e
31
+ );
32
+ }) });
33
+ };
34
+ export {
35
+ F as SchemaObjectEditor
36
+ };
@@ -0,0 +1,163 @@
1
+ import { jsx as n, jsxs as N } from "react/jsx-runtime";
2
+ import { useId as _ } from "react";
3
+ import { RadioGroup as D } from "../../RadioGroup/RadioGroup.js";
4
+ import { Select as E } from "../../Select/Select.js";
5
+ import { SchemaDisplayMode as q, SchemaOrientation as F } from "../../../../types/json-schema.js";
6
+ import { RadioGroupOrientation as G } from "../../../../types/radio-group.js";
7
+ import { resolveRef as f, getOptionLabel as M, extractDefaults as T } from "../../../../utils/json-schema.js";
8
+ import { useSchemaContext as z } from "../context.js";
9
+ import { SchemaFieldContent as V } from "./SchemaFieldContent.js";
10
+ import { SchemaObjectEditor as $ } from "./SchemaObjectEditor.js";
11
+ const A = (i) => typeof i == "string" ? i : i[0], B = (i, t) => {
12
+ const { [t]: s, ...l } = i.properties ?? {};
13
+ return { ...i, properties: l };
14
+ }, te = ({
15
+ schema: i,
16
+ value: t,
17
+ onChange: s,
18
+ path: l,
19
+ level: u,
20
+ ariaLabel: g
21
+ }) => {
22
+ const { rootSchema: a, texts: v, readonly: b = !1 } = z(), R = _(), h = g ?? v.selectTypePlaceholder, j = i.discriminatorDisplay === q.Radio, y = i.discriminator;
23
+ if (y) {
24
+ const e = y.propertyName, o = y.mapping, m = (r) => f({ $ref: o[r] }, a), x = typeof t == "object" && t !== null ? t[e] : void 0, S = x ? m(x) : void 0, P = (r) => {
25
+ const c = T(m(r), a) ?? {};
26
+ s({ ...c, [e]: r });
27
+ };
28
+ if (j) {
29
+ const r = i.discriminatorOrientation === F.Row, c = (p) => /* @__PURE__ */ n(
30
+ $,
31
+ {
32
+ schema: B(p, e),
33
+ value: t,
34
+ onChange: s,
35
+ path: l,
36
+ level: u
37
+ }
38
+ ), C = /* @__PURE__ */ n(
39
+ D,
40
+ {
41
+ id: R,
42
+ ariaLabel: h,
43
+ value: x,
44
+ onChange: P,
45
+ disabled: b,
46
+ orientation: r ? G.Row : G.Column,
47
+ items: Object.keys(o).map((p) => {
48
+ const L = m(p);
49
+ return {
50
+ value: p,
51
+ label: L.title ?? p,
52
+ content: r ? void 0 : c(L)
53
+ };
54
+ })
55
+ }
56
+ );
57
+ return r ? /* @__PURE__ */ N("div", { className: "flex flex-col gap-3", children: [
58
+ C,
59
+ S && c(S)
60
+ ] }) : C;
61
+ }
62
+ return /* @__PURE__ */ N("div", { className: "flex flex-col gap-3", children: [
63
+ /* @__PURE__ */ n(
64
+ E,
65
+ {
66
+ ariaLabel: h,
67
+ options: Object.keys(o).map((r) => ({
68
+ value: r,
69
+ label: r
70
+ })),
71
+ value: x,
72
+ placeholder: v.selectTypePlaceholder,
73
+ disabled: b,
74
+ onChange: (r) => {
75
+ const c = A(r);
76
+ c && P(c);
77
+ },
78
+ className: "max-w-[280px]"
79
+ }
80
+ ),
81
+ S && /* @__PURE__ */ n("div", { className: "pl-3", children: /* @__PURE__ */ n(
82
+ $,
83
+ {
84
+ schema: S,
85
+ value: t,
86
+ onChange: s,
87
+ path: l,
88
+ level: u
89
+ }
90
+ ) })
91
+ ] });
92
+ }
93
+ const d = i.oneOf ?? [], O = (() => {
94
+ if (typeof t != "object" || t === null || Array.isArray(t))
95
+ return 0;
96
+ const e = d.findIndex(
97
+ (o) => f(o, a).required?.every(
98
+ (m) => m in t
99
+ )
100
+ );
101
+ return e >= 0 ? e : 0;
102
+ })(), I = d[O], w = (e) => {
103
+ const o = T(
104
+ f(d[e], a),
105
+ a
106
+ );
107
+ s(o ?? null);
108
+ };
109
+ return j ? /* @__PURE__ */ n(
110
+ D,
111
+ {
112
+ id: R,
113
+ ariaLabel: h,
114
+ value: String(O),
115
+ onChange: (e) => w(Number(e)),
116
+ disabled: b,
117
+ items: d.map((e, o) => ({
118
+ value: String(o),
119
+ label: M(e, a) ?? `Option ${o + 1}`,
120
+ content: /* @__PURE__ */ n(
121
+ V,
122
+ {
123
+ schema: f(e, a),
124
+ value: t,
125
+ onChange: s,
126
+ path: l,
127
+ level: u,
128
+ ariaLabel: g
129
+ }
130
+ )
131
+ }))
132
+ }
133
+ ) : /* @__PURE__ */ N("div", { className: "flex flex-col gap-3", children: [
134
+ /* @__PURE__ */ n(
135
+ E,
136
+ {
137
+ ariaLabel: h,
138
+ options: d.map((e, o) => ({
139
+ value: String(o),
140
+ label: f(e, a).title ?? `Option ${o + 1}`
141
+ })),
142
+ value: String(O),
143
+ disabled: b,
144
+ onChange: (e) => w(Number(A(e))),
145
+ className: "max-w-[280px]"
146
+ }
147
+ ),
148
+ I && /* @__PURE__ */ n("div", { className: "border-l-2 border-tertiary pl-3", children: /* @__PURE__ */ n(
149
+ V,
150
+ {
151
+ schema: I,
152
+ value: t,
153
+ onChange: s,
154
+ path: l,
155
+ level: u,
156
+ ariaLabel: g
157
+ }
158
+ ) })
159
+ ] });
160
+ };
161
+ export {
162
+ te as SchemaOneOfEditor
163
+ };