@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
@@ -1,14 +1,15 @@
1
1
  import { jsx as i, jsxs as f } from "react/jsx-runtime";
2
2
  import { useMemo as b, useState as q, useCallback as J, useEffect as Q } from "react";
3
3
  import { mergeClasses as U } from "../../utils/merge-classes.js";
4
- import { DEFAULT_SCHEMA_TEXTS as Y, SchemaRendererVariant as m } from "./types.js";
5
- import { SchemaRendererContext as Z } from "./context.js";
6
- import { extractDefaults as $, sortByPropertyOrder as y, resolveRef as R, toFieldLabel as F, validateRequired as k, isMissingRequiredValue as ee } from "./utils.js";
4
+ import { SchemaRendererContext as Y } from "./context.js";
5
+ import { extractDefaults as Z, sortByPropertyOrder as $, resolveRef as R, toFieldLabel as F, validateRequired as y, isMissingRequiredValue as k } from "../../utils/json-schema.js";
7
6
  import { SchemaSection as L } from "./components/SchemaSection.js";
8
7
  import { SchemaFieldContent as T } from "./components/SchemaFieldContent.js";
9
- import { SchemaField as te } from "./components/SchemaField.js";
10
- import { SchemaAdditionalPropertiesEditor as re } from "./components/SchemaAdditionalPropertiesEditor.js";
11
- const he = ({
8
+ import { SchemaField as ee } from "./components/SchemaField.js";
9
+ import { SchemaAdditionalPropertiesEditor as te } from "./components/SchemaAdditionalPropertiesEditor.js";
10
+ import { DEFAULT_SCHEMA_TEXTS as re } from "../../constants/schema-renderer.js";
11
+ import { SchemaRendererVariant as m } from "../../types/json-schema.js";
12
+ const pe = ({
12
13
  schema: r,
13
14
  defaultValue: v,
14
15
  texts: x,
@@ -26,9 +27,9 @@ const he = ({
26
27
  acceptableResourceTypes: w
27
28
  }) => {
28
29
  const E = b(
29
- () => ({ ...Y, ...x }),
30
+ () => ({ ...re, ...x }),
30
31
  [x]
31
- ), C = b(() => v || ($(r, r) ?? {}), []), [a, H] = q(C), [p, K] = q(
32
+ ), C = b(() => v || (Z(r, r) ?? {}), []), [a, H] = q(C), [p, K] = q(
32
33
  /* @__PURE__ */ new Set()
33
34
  ), _ = J((e) => {
34
35
  K((t) => t.has(e) ? t : /* @__PURE__ */ new Set([...t, e]));
@@ -41,13 +42,13 @@ const he = ({
41
42
  H(o), O?.(o), A?.(e, t);
42
43
  }, B = new Set(Object.keys(r.properties ?? {})), W = Object.keys(a).filter(
43
44
  (e) => !B.has(e)
44
- ), X = y(
45
+ ), X = $(
45
46
  Object.entries(r.properties ?? {}).filter(
46
47
  ([, e]) => !R(e, r).isHidden
47
48
  )
48
49
  ), z = r.required ?? [];
49
50
  return /* @__PURE__ */ i(
50
- Z.Provider,
51
+ Y.Provider,
51
52
  {
52
53
  value: {
53
54
  rootSchema: r,
@@ -67,7 +68,7 @@ const he = ({
67
68
  const o = R(t, r), s = o.title ?? t.title ?? F(e), d = z.includes(e), n = a[e];
68
69
  if (h === m.Flat)
69
70
  return /* @__PURE__ */ i(
70
- te,
71
+ ee,
71
72
  {
72
73
  schema: t,
73
74
  value: n,
@@ -94,7 +95,7 @@ const he = ({
94
95
  }
95
96
  )
96
97
  ] }, e);
97
- const P = k(n, o, r, e), G = e + ".", I = !S || p.has(e) || [...p].some((l) => l.startsWith(G));
98
+ const P = y(n, o, r, e), G = e + ".", I = !S || p.has(e) || [...p].some((l) => l.startsWith(G));
98
99
  return /* @__PURE__ */ i(
99
100
  L,
100
101
  {
@@ -102,7 +103,7 @@ const he = ({
102
103
  description: o.description,
103
104
  level: 0,
104
105
  defaultExpanded: u,
105
- errorCount: I ? d && ee(n) ? Math.max(P.length, 1) : P.length : 0,
106
+ errorCount: I ? d && k(n) ? Math.max(P.length, 1) : P.length : 0,
106
107
  children: /* @__PURE__ */ i(
107
108
  T,
108
109
  {
@@ -120,7 +121,7 @@ const he = ({
120
121
  }),
121
122
  W.map((e) => {
122
123
  const t = F(e), o = /* @__PURE__ */ i(
123
- re,
124
+ te,
124
125
  {
125
126
  value: a[e],
126
127
  onChange: (s) => c(e, s),
@@ -146,5 +147,5 @@ const he = ({
146
147
  );
147
148
  };
148
149
  export {
149
- he as DialSchemaRenderer
150
+ pe as DialSchemaRenderer
150
151
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as v, jsx as c } from "react/jsx-runtime";
2
2
  import { DialSelect as x } from "../../Select/Select.js";
3
- import { JsonSchemaType as a } from "../types.js";
4
3
  import { useSchemaContext as N } from "../context.js";
5
- import { getOptionLabel as k, detectAnyOfVariant as O, resolveRef as d, extractDefaults as w } from "../utils.js";
4
+ import { getOptionLabel as k, detectAnyOfVariant as O, resolveRef as d, extractDefaults as w } from "../../../utils/json-schema.js";
6
5
  import { SchemaFieldContent as A } from "./SchemaFieldContent.js";
6
+ import { JsonSchemaType as a } from "../../../types/json-schema.js";
7
7
  const J = ({
8
8
  schema: f,
9
9
  value: n,
@@ -4,7 +4,7 @@ import { IconPlus as w } from "@tabler/icons-react";
4
4
  import { DialSelect as B } from "../../Select/Select.js";
5
5
  import { DialGhostButton as E } from "../../Button/ButtonWrappers.js";
6
6
  import { useSchemaContext as L } from "../context.js";
7
- import { resolveRef as g, getItemTitle as O, buildSummary as P, validateRequired as q, extractDefaults as A, getSchemaDefault as z } from "../utils.js";
7
+ import { resolveRef as g, getItemTitle as O, buildSummary as P, validateRequired as q, extractDefaults as A, getSchemaDefault as z } from "../../../utils/json-schema.js";
8
8
  import { SchemaSection as F } from "./SchemaSection.js";
9
9
  import { SchemaFieldContent as G } from "./SchemaFieldContent.js";
10
10
  const W = ({
@@ -1,10 +1,10 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import { DialFormItem as g } from "../../FormItem/FormItem.js";
3
- import { JsonSchemaType as A } from "../types.js";
4
- import { useSchemaContext as C } from "../context.js";
5
- import { resolveRef as E, isObjectType as I, buildSummary as M, validateRequired as O, isMissingRequiredValue as b, toRequiredMessage as k } from "../utils.js";
6
- import { SchemaSection as w } from "./SchemaSection.js";
3
+ import { useSchemaContext as A } from "../context.js";
4
+ import { resolveRef as C, isObjectType as E, buildSummary as I, validateRequired as M, isMissingRequiredValue as O, toRequiredMessage as b } from "../../../utils/json-schema.js";
5
+ import { SchemaSection as k } from "./SchemaSection.js";
7
6
  import { SchemaFieldContent as u } from "./SchemaFieldContent.js";
7
+ import { JsonSchemaType as w } from "../../../types/json-schema.js";
8
8
  const B = ({
9
9
  schema: a,
10
10
  value: t,
@@ -19,16 +19,16 @@ const B = ({
19
19
  defaultExpanded: f = !0,
20
20
  touchedPaths: m = /* @__PURE__ */ new Set(),
21
21
  skipUntouched: h = !1
22
- } = C(), o = E(a, c), S = I(o), l = o.type === A.Array;
22
+ } = A(), o = C(a, c), S = E(o), l = o.type === w.Array;
23
23
  if (S || l) {
24
- const j = M(t, o, c), x = O(
24
+ const j = I(t, o, c), x = M(
25
25
  t,
26
26
  o,
27
27
  c,
28
28
  e.join(".")
29
29
  ), p = e.join("."), T = p + ".", F = !h || m.has(p) || [...m].some((R) => R.startsWith(T));
30
30
  return /* @__PURE__ */ s(
31
- w,
31
+ k,
32
32
  {
33
33
  title: n ?? o.title ?? e[e.length - 1] ?? "Section",
34
34
  description: o.description,
@@ -50,7 +50,7 @@ const B = ({
50
50
  }
51
51
  );
52
52
  }
53
- const y = (!h || m.has(e.join("."))) && r && b(t) ? k(n ?? "Field") : void 0;
53
+ const y = (!h || m.has(e.join("."))) && r && O(t) ? b(n ?? "Field") : void 0;
54
54
  return /* @__PURE__ */ s(
55
55
  g,
56
56
  {
@@ -1,8 +1,7 @@
1
1
  import { jsx as t, jsxs as O, Fragment as P } from "react/jsx-runtime";
2
2
  import { DialErrorText as x } from "../../CaptionText/CaptionText.js";
3
- import { JsonSchemaType as c } from "../types.js";
4
3
  import { useSchemaContext as F } from "../context.js";
5
- import { resolveRef as T, isObjectType as u, toRequiredMessage as A, isMissingRequiredValue as b } from "../utils.js";
4
+ import { resolveRef as T, isObjectType as u, toRequiredMessage as A, isMissingRequiredValue as b } from "../../../utils/json-schema.js";
6
5
  import { SchemaObjectEditor as k } from "./SchemaObjectEditor.js";
7
6
  import { SchemaArrayEditor as M } from "./SchemaArrayEditor.js";
8
7
  import { SchemaOneOfEditor as R } from "./SchemaOneOfEditor.js";
@@ -10,6 +9,7 @@ import { SchemaAnyOfEditor as q } from "./SchemaAnyOfEditor.js";
10
9
  import { SchemaKeyValueEditor as V } from "./SchemaKeyValueEditor.js";
11
10
  import { SchemaPrimitiveField as w } from "./SchemaPrimitiveField.js";
12
11
  import { SchemaAdditionalPropertiesEditor as D } from "./SchemaAdditionalPropertiesEditor.js";
12
+ import { JsonSchemaType as c } from "../../../types/json-schema.js";
13
13
  const X = ({
14
14
  schema: h,
15
15
  value: i,
@@ -8,13 +8,13 @@ import { DialRemoveButton as oe } from "../../RemoveButton/RemoveButton.js";
8
8
  import { DialSelect as Y } from "../../Select/Select.js";
9
9
  import { DialTooltip as ne } from "../../Tooltip/Tooltip.js";
10
10
  import { ElementSize as re } from "../../../types/size.js";
11
- import { JsonSchemaType as c } from "../types.js";
12
11
  import { useSchemaContext as q } from "../context.js";
13
- import { resolveRef as le, isObjectType as ae, inferEntryType as ie, getEntryTypeDefault as se, ENTRY_TYPE_OPTIONS as ce, buildSummary as de, validateRequired as me, extractDefaults as pe, getSchemaDefault as ye } from "../utils.js";
12
+ import { resolveRef as le, isObjectType as ae, inferEntryType as ie, getEntryTypeDefault as se, ENTRY_TYPE_OPTIONS as ce, buildSummary as de, validateRequired as me, extractDefaults as pe, getSchemaDefault as ye } from "../../../utils/json-schema.js";
14
13
  import { SchemaPrimitiveField as ue } from "./SchemaPrimitiveField.js";
15
14
  import { SchemaSection as fe } from "./SchemaSection.js";
16
15
  import { SchemaFieldContent as he } from "./SchemaFieldContent.js";
17
16
  import { SchemaAdditionalPropertiesEditor as be } from "./SchemaAdditionalPropertiesEditor.js";
17
+ import { JsonSchemaType as c } from "../../../types/json-schema.js";
18
18
  const _ = (l, d) => ({
19
19
  id: Math.random().toString(36).slice(2),
20
20
  key: l,
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useSchemaContext as v } from "../context.js";
3
- import { resolveRef as i, sortByPropertyOrder as g, toFieldLabel as j } from "../utils.js";
3
+ import { resolveRef as i, sortByPropertyOrder as g, toFieldLabel as j } from "../../../utils/json-schema.js";
4
4
  import { SchemaField as q } from "./SchemaField.js";
5
5
  const N = ({
6
6
  schema: c,
@@ -2,11 +2,11 @@ import { jsxs as v, jsx as o } from "react/jsx-runtime";
2
2
  import { useId as q } from "react";
3
3
  import { DialSelect as y } from "../../Select/Select.js";
4
4
  import { DialRadioButton as j } from "../../RadioButton/RadioButton.js";
5
- import { SchemaDisplayMode as P, SchemaOrientation as B } from "../types.js";
6
- import { useSchemaContext as G } from "../context.js";
7
- import { resolveRef as a, getOptionLabel as L, extractDefaults as _ } from "../utils.js";
5
+ import { useSchemaContext as B } from "../context.js";
6
+ import { resolveRef as a, getOptionLabel as G, extractDefaults as P } from "../../../utils/json-schema.js";
8
7
  import { SchemaObjectEditor as w } from "./SchemaObjectEditor.js";
9
- import { SchemaFieldContent as C } from "./SchemaFieldContent.js";
8
+ import { SchemaFieldContent as _ } from "./SchemaFieldContent.js";
9
+ import { SchemaDisplayMode as C, SchemaOrientation as L } from "../../../types/json-schema.js";
10
10
  const Z = ({
11
11
  schema: x,
12
12
  value: c,
@@ -14,17 +14,17 @@ const Z = ({
14
14
  path: u,
15
15
  level: S
16
16
  }) => {
17
- const { rootSchema: i, texts: A, readonly: b = !1 } = G(), p = q(), O = x.discriminator;
17
+ const { rootSchema: i, texts: A, readonly: b = !1 } = B(), p = q(), O = x.discriminator;
18
18
  if (O) {
19
19
  const r = O.propertyName, e = O.mapping, n = Object.keys(e).map((s) => ({
20
20
  value: s,
21
21
  label: s
22
22
  })), l = typeof c == "object" && c !== null ? c[r] : void 0, g = l ? a({ $ref: e[l] }, i) : void 0, I = (s) => {
23
- const m = a({ $ref: e[s] }, i), t = _(m, i) ?? {};
23
+ const m = a({ $ref: e[s] }, i), t = P(m, i) ?? {};
24
24
  d({ ...t, [r]: s });
25
25
  };
26
- if (x.discriminatorDisplay === P.Radio) {
27
- const s = x.discriminatorOrientation === B.Row, m = l ? (() => {
26
+ if (x.discriminatorDisplay === C.Radio) {
27
+ const s = x.discriminatorOrientation === L.Row, m = l ? (() => {
28
28
  const t = a(
29
29
  { $ref: e[l] },
30
30
  i
@@ -127,12 +127,12 @@ const Z = ({
127
127
  }
128
128
  return 0;
129
129
  })(), D = (r) => {
130
- const e = a(f[r], i), n = _(e, i);
130
+ const e = a(f[r], i), n = P(e, i);
131
131
  d(n ?? null);
132
132
  }, R = f[$];
133
- if (x.discriminatorDisplay === P.Radio)
133
+ if (x.discriminatorDisplay === C.Radio)
134
134
  return /* @__PURE__ */ o("div", { role: "radiogroup", className: "flex flex-col gap-2", children: f.map((r, e) => {
135
- const n = a(r, i), l = L(r, i) ?? `Option ${e + 1}`, g = $ === e;
135
+ const n = a(r, i), l = G(r, i) ?? `Option ${e + 1}`, g = $ === e;
136
136
  return /* @__PURE__ */ v("div", { className: "flex flex-col", children: [
137
137
  /* @__PURE__ */ o(
138
138
  j,
@@ -147,7 +147,7 @@ const Z = ({
147
147
  }
148
148
  ),
149
149
  g && n && /* @__PURE__ */ o("div", { className: "ml-6 mt-2", children: /* @__PURE__ */ o(
150
- C,
150
+ _,
151
151
  {
152
152
  schema: n,
153
153
  value: c,
@@ -176,7 +176,7 @@ const Z = ({
176
176
  }
177
177
  ) }),
178
178
  R && /* @__PURE__ */ o("div", { className: "pl-3 border-l-2 border-secondary", children: /* @__PURE__ */ o(
179
- C,
179
+ _,
180
180
  {
181
181
  schema: R,
182
182
  value: c,
@@ -6,8 +6,8 @@ import { DialNumberInput as b } from "../../NumberInput/NumberInput.js";
6
6
  import { DialSwitch as C } from "../../Switch/Switch.js";
7
7
  import { DialSelect as y } from "../../Select/Select.js";
8
8
  import { DialRadioButton as P } from "../../RadioButton/RadioButton.js";
9
- import { JsonSchemaType as c, SchemaDisplayMode as w, SchemaOrientation as D } from "../types.js";
10
- import { useSchemaContext as x } from "../context.js";
9
+ import { useSchemaContext as w } from "../context.js";
10
+ import { JsonSchemaType as c, SchemaDisplayMode as D, SchemaOrientation as x } from "../../../types/json-schema.js";
11
11
  const E = ({
12
12
  schema: t,
13
13
  value: e,
@@ -19,7 +19,7 @@ const E = ({
19
19
  readonly: l = !1,
20
20
  inputClassName: p,
21
21
  acceptableResourceTypes: h
22
- } = x(), N = t.const !== void 0, g = Array.isArray(t.enum) && t.enum.length > 0;
22
+ } = w(), N = t.const !== void 0, g = Array.isArray(t.enum) && t.enum.length > 0;
23
23
  if (t["dial:resource"] === !0 && Array.isArray(t.acceptableResourceTypes) && t.acceptableResourceTypes.length > 0 && (t.type === c.String || t.type === void 0)) {
24
24
  const r = (t.acceptableResourceTypes ?? []).flatMap(
25
25
  (o) => {
@@ -53,8 +53,8 @@ const E = ({
53
53
  className: "opacity-60"
54
54
  }
55
55
  );
56
- if (g && t.enumDisplay === w.Radio) {
57
- const r = t.enumOrientation === D.Row;
56
+ if (g && t.enumDisplay === D.Radio) {
57
+ const r = t.enumOrientation === x.Row;
58
58
  return /* @__PURE__ */ i(
59
59
  "div",
60
60
  {