@epam/ai-dial-ui-kit 0.16.0-dev.45 → 0.16.0-dev.46

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 (213) hide show
  1. package/README.md +7 -10
  2. package/dist/CHANGELOG.md +4 -1
  3. package/dist/DateCellRenderer-Bx79kGGv.cjs +63 -0
  4. package/dist/MarkdownEditor-BtLY7OVq.cjs +1 -0
  5. package/dist/components-manifest.json +518 -3034
  6. package/dist/constants/public-class-names.js +0 -7
  7. package/dist/dial-ui-kit.cjs +3 -3
  8. package/dist/dial-ui-kit.js +373 -456
  9. package/dist/editors.cjs +1 -1
  10. package/dist/editors.js +4 -10
  11. package/dist/grid.cjs +1 -1
  12. package/dist/grid.js +23 -31
  13. package/dist/{merge-classes-B0SnCG4i.cjs → icon-D93YIwGJ.cjs} +1 -1
  14. package/dist/index.css +1 -1
  15. package/dist/migration-guides/0.16.0/legacy-file-manager-removal.md +5 -3
  16. package/dist/migration-guides/0.16.0/unused-legacy-components-removal.md +128 -0
  17. package/dist/migration-guides/README.md +1 -0
  18. package/dist/node_modules/react-dnd/dist/internals/registration.js +5 -13
  19. package/dist/src/components/New/MarkdownEditor/lazy.d.ts +8 -2
  20. package/dist/src/components/New/SegmentedControl/SegmentedControl.d.ts +2 -2
  21. package/dist/src/constants/public-class-names.d.ts +0 -7
  22. package/dist/src/index.d.ts +2 -53
  23. package/dist/src/subpaths/editors.d.ts +9 -15
  24. package/dist/src/subpaths/grid.d.ts +2 -8
  25. package/dist/src/types/editor.d.ts +0 -6
  26. package/dist/src/utils/grid-registration.d.ts +6 -8
  27. package/package.json +1 -12
  28. package/dist/DateCellRenderer-DrDOIpWg.cjs +0 -63
  29. package/dist/IconButton-CsePS6PY.cjs +0 -1
  30. package/dist/JsonEditor-DQhHSm93.cjs +0 -1
  31. package/dist/MarkdownEditor-CvIPIbPq.cjs +0 -1
  32. package/dist/MarkdownEditor-TR6X_gdl.cjs +0 -1
  33. package/dist/MarkdownEditorContainer-JIn_VNUX.cjs +0 -1
  34. package/dist/Switch-HEL_aq23.cjs +0 -1
  35. package/dist/assets/icons/file/c.svg.js +0 -5
  36. package/dist/assets/icons/file/cpp.svg.js +0 -5
  37. package/dist/assets/icons/file/cs.svg.js +0 -5
  38. package/dist/assets/icons/file/ini.svg.js +0 -5
  39. package/dist/assets/icons/file/json.svg.js +0 -5
  40. package/dist/assets/icons/file/md.svg.js +0 -5
  41. package/dist/assets/icons/file/py.svg.js +0 -5
  42. package/dist/assets/icons/open-popup.svg.js +0 -5
  43. package/dist/components/AutocompleteInput/AutocompleteInputValue.js +0 -21
  44. package/dist/components/ButtonDropdown/ButtonDropdown.js +0 -33
  45. package/dist/components/ButtonDropdown/constants.js +0 -8
  46. package/dist/components/Checkbox/Checkbox.js +0 -64
  47. package/dist/components/Checkbox/constants.js +0 -4
  48. package/dist/components/CollapsibleSidebar/CollapsibleSidebar.js +0 -84
  49. package/dist/components/ConfirmationPopup/ConfirmationPopup.js +0 -75
  50. package/dist/components/ConfirmationPopup/constants.js +0 -32
  51. package/dist/components/DraggableItem/DraggableItem.js +0 -61
  52. package/dist/components/DraggableItem/constants.js +0 -6
  53. package/dist/components/DropdownIcon/DropdownIcon.js +0 -103
  54. package/dist/components/FileIcon/FileIcon.js +0 -37
  55. package/dist/components/FileIcon/constants.js +0 -60
  56. package/dist/components/FileName/FileName.js +0 -68
  57. package/dist/components/FolderName/FolderName.js +0 -57
  58. package/dist/components/FormItem/FormItem.js +0 -90
  59. package/dist/components/FormItem/constants.js +0 -9
  60. package/dist/components/FormPopup/FormPopup.js +0 -59
  61. package/dist/components/FormPopup/constants.js +0 -6
  62. package/dist/components/Grid/Grid.js +0 -333
  63. package/dist/components/Grid/constants.js +0 -33
  64. package/dist/components/Grid/renderers/DateCellRenderer.js +0 -27
  65. package/dist/components/Grid/renderers/constants.js +0 -25
  66. package/dist/components/InputPopup/InputPopup.js +0 -174
  67. package/dist/components/JsonEditor/JsonEditor.js +0 -65
  68. package/dist/components/JsonEditor/lazy.js +0 -4
  69. package/dist/components/MarkdownEditor/MarkdownEditor.js +0 -39
  70. package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +0 -82
  71. package/dist/components/MarkdownEditor/lazy.js +0 -4
  72. package/dist/components/Notification/Notification.js +0 -67
  73. package/dist/components/Notification/constants.js +0 -24
  74. package/dist/components/NumberInput/NumberInput.js +0 -41
  75. package/dist/components/Pagination/Pagination.js +0 -80
  76. package/dist/components/Pagination/utils.js +0 -10
  77. package/dist/components/PasswordInput/Icons/HideIcon.js +0 -16
  78. package/dist/components/PasswordInput/Icons/ShowIcon.js +0 -16
  79. package/dist/components/PasswordInput/PasswordInput.js +0 -21
  80. package/dist/components/Popup/Popup.js +0 -110
  81. package/dist/components/Popup/constants.js +0 -12
  82. package/dist/components/RadioButton/RadioButton.js +0 -103
  83. package/dist/components/RadioGroup/RadioGroup.js +0 -92
  84. package/dist/components/RadioGroup/constants.js +0 -10
  85. package/dist/components/RadioGroupPopupField/RadioGroupPopupField.js +0 -101
  86. package/dist/components/ResizableContainer/ConditionalResizableContainer.js +0 -6
  87. package/dist/components/ResizableContainer/ResizableContainer.js +0 -79
  88. package/dist/components/ResizableContainer/components/ResizeHandle.js +0 -20
  89. package/dist/components/ResizableContainer/components/ResizeIcon.js +0 -11
  90. package/dist/components/SchemaRenderer/SchemaRenderer.js +0 -151
  91. package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +0 -56
  92. package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +0 -74
  93. package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +0 -118
  94. package/dist/components/SchemaRenderer/components/SchemaField.js +0 -78
  95. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +0 -114
  96. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +0 -272
  97. package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +0 -36
  98. package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +0 -192
  99. package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +0 -161
  100. package/dist/components/SchemaRenderer/components/SchemaSection.js +0 -81
  101. package/dist/components/SchemaRenderer/context.js +0 -12
  102. package/dist/components/Search/Search.js +0 -63
  103. package/dist/components/Search/constants.js +0 -27
  104. package/dist/components/SegmentedControl/SegmentedControl.js +0 -87
  105. package/dist/components/SegmentedControl/constants.js +0 -8
  106. package/dist/components/Select/MultiSelectTags.js +0 -23
  107. package/dist/components/Select/Select.js +0 -435
  108. package/dist/components/Select/SelectSubMenuItem.js +0 -90
  109. package/dist/components/Select/constants.js +0 -15
  110. package/dist/components/SelectField/SelectField.js +0 -66
  111. package/dist/components/SharedEntityIndicator/SharedEntityIndicator.js +0 -34
  112. package/dist/components/Slider/Slider.js +0 -158
  113. package/dist/components/Switch/Switch.js +0 -70
  114. package/dist/components/TagInput/TagInput.js +0 -179
  115. package/dist/components/Textarea/Textarea.js +0 -43
  116. package/dist/constants/editor.js +0 -52
  117. package/dist/icon-CrGVkVpG.cjs +0 -1
  118. package/dist/icon-DhjrDQ8I.cjs +0 -1
  119. package/dist/lazy-kq-xfXXv.cjs +0 -1
  120. package/dist/node_modules/react-dnd/dist/hooks/useDrag/DragSourceImpl.js +0 -25
  121. package/dist/node_modules/react-dnd/dist/hooks/useDrag/connectors.js +0 -21
  122. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useDrag.js +0 -20
  123. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useDragSource.js +0 -19
  124. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useDragSourceConnector.js +0 -22
  125. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useDragSourceMonitor.js +0 -15
  126. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useDragType.js +0 -13
  127. package/dist/node_modules/react-dnd/dist/hooks/useDrag/useRegisteredDragSource.js +0 -23
  128. package/dist/node_modules/react-dnd/dist/internals/DragSourceMonitorImpl.js +0 -88
  129. package/dist/node_modules/react-dnd/dist/internals/SourceConnector.js +0 -87
  130. package/dist/src/components/AutocompleteInput/AutocompleteInputValue.d.ts +0 -34
  131. package/dist/src/components/ButtonDropdown/ButtonDropdown.d.ts +0 -24
  132. package/dist/src/components/ButtonDropdown/constants.d.ts +0 -2
  133. package/dist/src/components/Checkbox/Checkbox.d.ts +0 -36
  134. package/dist/src/components/Checkbox/constants.d.ts +0 -1
  135. package/dist/src/components/CollapsibleSidebar/CollapsibleSidebar.d.ts +0 -46
  136. package/dist/src/components/ConfirmationPopup/ConfirmationPopup.d.ts +0 -55
  137. package/dist/src/components/ConfirmationPopup/constants.d.ts +0 -18
  138. package/dist/src/components/DraggableItem/DraggableItem.d.ts +0 -33
  139. package/dist/src/components/DraggableItem/constants.d.ts +0 -3
  140. package/dist/src/components/DropdownIcon/DropdownIcon.d.ts +0 -38
  141. package/dist/src/components/FileIcon/FileIcon.d.ts +0 -33
  142. package/dist/src/components/FileIcon/constants.d.ts +0 -9
  143. package/dist/src/components/FileName/FileName.d.ts +0 -49
  144. package/dist/src/components/FolderName/FolderName.d.ts +0 -37
  145. package/dist/src/components/FormItem/FormItem.d.ts +0 -66
  146. package/dist/src/components/FormItem/constants.d.ts +0 -3
  147. package/dist/src/components/FormPopup/FormPopup.d.ts +0 -46
  148. package/dist/src/components/FormPopup/constants.d.ts +0 -3
  149. package/dist/src/components/Grid/Grid.d.ts +0 -120
  150. package/dist/src/components/Grid/comparators/base-column-comparator.d.ts +0 -1
  151. package/dist/src/components/Grid/constants.d.ts +0 -28
  152. package/dist/src/components/Grid/renderers/DateCellRenderer.d.ts +0 -34
  153. package/dist/src/components/Grid/renderers/constants.d.ts +0 -7
  154. package/dist/src/components/Grid/renderers/utils.d.ts +0 -1
  155. package/dist/src/components/InputPopup/InputPopup.d.ts +0 -61
  156. package/dist/src/components/JsonEditor/JsonEditor.d.ts +0 -25
  157. package/dist/src/components/JsonEditor/lazy.d.ts +0 -14
  158. package/dist/src/components/MarkdownEditor/MarkdownEditor.d.ts +0 -38
  159. package/dist/src/components/MarkdownEditor/MarkdownEditorContainer.d.ts +0 -51
  160. package/dist/src/components/MarkdownEditor/lazy.d.ts +0 -7
  161. package/dist/src/components/Notification/Notification.d.ts +0 -58
  162. package/dist/src/components/Notification/constants.d.ts +0 -8
  163. package/dist/src/components/NumberInput/NumberInput.d.ts +0 -34
  164. package/dist/src/components/Pagination/Pagination.d.ts +0 -11
  165. package/dist/src/components/Pagination/utils.d.ts +0 -9
  166. package/dist/src/components/PasswordInput/Icons/HideIcon.d.ts +0 -16
  167. package/dist/src/components/PasswordInput/Icons/ShowIcon.d.ts +0 -16
  168. package/dist/src/components/PasswordInput/PasswordInput.d.ts +0 -26
  169. package/dist/src/components/Popup/Popup.d.ts +0 -64
  170. package/dist/src/components/Popup/constants.d.ts +0 -5
  171. package/dist/src/components/RadioButton/RadioButton.d.ts +0 -54
  172. package/dist/src/components/RadioGroup/RadioGroup.d.ts +0 -66
  173. package/dist/src/components/RadioGroup/constants.d.ts +0 -5
  174. package/dist/src/components/RadioGroupPopupField/RadioGroupPopupField.d.ts +0 -74
  175. package/dist/src/components/ResizableContainer/ConditionalResizableContainer.d.ts +0 -35
  176. package/dist/src/components/ResizableContainer/ResizableContainer.d.ts +0 -72
  177. package/dist/src/components/ResizableContainer/components/ResizeHandle.d.ts +0 -10
  178. package/dist/src/components/ResizableContainer/components/ResizeIcon.d.ts +0 -8
  179. package/dist/src/components/SchemaRenderer/SchemaRenderer.d.ts +0 -30
  180. package/dist/src/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.d.ts +0 -20
  181. package/dist/src/components/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +0 -31
  182. package/dist/src/components/SchemaRenderer/components/SchemaArrayEditor.d.ts +0 -31
  183. package/dist/src/components/SchemaRenderer/components/SchemaField.d.ts +0 -29
  184. package/dist/src/components/SchemaRenderer/components/SchemaFieldContent.d.ts +0 -25
  185. package/dist/src/components/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +0 -33
  186. package/dist/src/components/SchemaRenderer/components/SchemaObjectEditor.d.ts +0 -31
  187. package/dist/src/components/SchemaRenderer/components/SchemaOneOfEditor.d.ts +0 -31
  188. package/dist/src/components/SchemaRenderer/components/SchemaPrimitiveField.d.ts +0 -31
  189. package/dist/src/components/SchemaRenderer/components/SchemaSection.d.ts +0 -33
  190. package/dist/src/components/SchemaRenderer/context.d.ts +0 -19
  191. package/dist/src/components/SchemaRenderer/types.d.ts +0 -62
  192. package/dist/src/components/SchemaRenderer/utils.d.ts +0 -1
  193. package/dist/src/components/Search/Search.d.ts +0 -35
  194. package/dist/src/components/Search/constants.d.ts +0 -8
  195. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +0 -40
  196. package/dist/src/components/SegmentedControl/constants.d.ts +0 -5
  197. package/dist/src/components/Select/MultiSelectTags.d.ts +0 -8
  198. package/dist/src/components/Select/Select.d.ts +0 -100
  199. package/dist/src/components/Select/SelectSubMenuItem.d.ts +0 -8
  200. package/dist/src/components/Select/constants.d.ts +0 -9
  201. package/dist/src/components/SelectField/SelectField.d.ts +0 -42
  202. package/dist/src/components/SharedEntityIndicator/SharedEntityIndicator.d.ts +0 -31
  203. package/dist/src/components/Slider/Slider.d.ts +0 -57
  204. package/dist/src/components/Switch/Switch.d.ts +0 -34
  205. package/dist/src/components/TagInput/TagInput.d.ts +0 -52
  206. package/dist/src/components/Textarea/Textarea.d.ts +0 -39
  207. package/dist/src/constants/editor.d.ts +0 -2
  208. package/dist/src/constants/storybook/form-item.d.ts +0 -3
  209. package/dist/src/models/segmented-control.d.ts +0 -7
  210. package/dist/src/types/form-item.d.ts +0 -31
  211. package/dist/src/types/select.d.ts +0 -8
  212. package/dist/types/form-item.js +0 -4
  213. package/dist/types/select.js +0 -5
@@ -1,118 +0,0 @@
1
- import { jsx as a, jsxs as x } from "react/jsx-runtime";
2
- import { useState as k, useMemo as p } from "react";
3
- import { IconPlus as w } from "@tabler/icons-react";
4
- import { DialSelect as B } from "../../Select/Select.js";
5
- import { DialGhostButton as E } from "../../Button/ButtonWrappers.js";
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/json-schema.js";
8
- import { SchemaSection as F } from "./SchemaSection.js";
9
- import { SchemaFieldContent as G } from "./SchemaFieldContent.js";
10
- const W = ({
11
- schema: I,
12
- value: h,
13
- onChange: f,
14
- path: u,
15
- level: y
16
- }) => {
17
- const {
18
- rootSchema: r,
19
- texts: m,
20
- readonly: v = !1,
21
- defaultExpanded: T = !0
22
- } = L(), n = Array.isArray(h) ? h : [], i = I.items, [S, N] = k(
23
- void 0
24
- );
25
- if (!i)
26
- return /* @__PURE__ */ a("p", { className: "dial-tiny-text text-secondary italic", children: m.noItemSchema });
27
- const l = p(
28
- () => g(i, r),
29
- [i, r]
30
- ), o = p(
31
- () => l.discriminator,
32
- [l]
33
- ), b = p(
34
- () => o?.propertyName,
35
- [o]
36
- ), c = p(
37
- () => o ? Object.keys(o.mapping).map((e) => ({
38
- value: e,
39
- label: e
40
- })) : [],
41
- [o]
42
- ), C = () => {
43
- const e = S ?? c[0]?.value;
44
- let t;
45
- if (o && e) {
46
- const s = g(
47
- { $ref: o.mapping[e] },
48
- r
49
- );
50
- t = { ...A(s, r) ?? {}, [o.propertyName]: e };
51
- } else
52
- t = A(l, r) ?? z(l);
53
- f([...n, t]);
54
- }, j = (e) => {
55
- f(n.filter((t, s) => s !== e));
56
- }, D = (e, t) => {
57
- f(n.map((s, d) => d === e ? t : s));
58
- };
59
- return /* @__PURE__ */ x("div", { className: "flex flex-col gap-3", children: [
60
- n.length === 0 && /* @__PURE__ */ a("p", { className: "dial-tiny-text text-secondary italic", children: m.noItemsYet }),
61
- n.map((e, t) => {
62
- const s = O(e, b, t), d = P(e, l, r), R = q(
63
- e,
64
- l,
65
- r,
66
- `${u.join(".")}[${t}]`
67
- );
68
- return /* @__PURE__ */ a(
69
- F,
70
- {
71
- title: s,
72
- level: y,
73
- summary: d,
74
- errorCount: R.length,
75
- onRemove: v ? void 0 : () => j(t),
76
- defaultExpanded: T,
77
- removeItemAriaLabel: m.removeItemAriaLabel,
78
- children: /* @__PURE__ */ a(
79
- G,
80
- {
81
- schema: i,
82
- value: e,
83
- onChange: ($) => D(t, $),
84
- path: [...u, String(t)],
85
- level: y + 1
86
- }
87
- )
88
- },
89
- t
90
- );
91
- }),
92
- !v && /* @__PURE__ */ x("div", { className: "flex items-center gap-2 pt-1", children: [
93
- c.length > 0 && /* @__PURE__ */ a("div", { className: "flex-1 max-w-[280px]", children: /* @__PURE__ */ a(
94
- B,
95
- {
96
- options: c,
97
- value: S ?? c[0]?.value,
98
- placeholder: m.selectTypeToAdd,
99
- onChange: (e) => {
100
- const t = typeof e == "string" ? e : e[0];
101
- N(t);
102
- }
103
- }
104
- ) }),
105
- /* @__PURE__ */ a(
106
- E,
107
- {
108
- label: m.addItem,
109
- iconBefore: /* @__PURE__ */ a(w, { size: 16, stroke: 2 }),
110
- onClick: C
111
- }
112
- )
113
- ] })
114
- ] });
115
- };
116
- export {
117
- W as SchemaArrayEditor
118
- };
@@ -1,78 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { DialFormItem as g } from "../../FormItem/FormItem.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";
6
- import { SchemaFieldContent as u } from "./SchemaFieldContent.js";
7
- import { JsonSchemaType as w } from "../../../types/json-schema.js";
8
- const B = ({
9
- schema: a,
10
- value: t,
11
- onChange: d,
12
- path: e,
13
- level: i = 0,
14
- required: r,
15
- label: n
16
- }) => {
17
- const {
18
- rootSchema: c,
19
- defaultExpanded: f = !0,
20
- touchedPaths: m = /* @__PURE__ */ new Set(),
21
- skipUntouched: h = !1
22
- } = A(), o = C(a, c), S = E(o), l = o.type === w.Array;
23
- if (S || l) {
24
- const j = I(t, o, c), x = M(
25
- t,
26
- o,
27
- c,
28
- e.join(".")
29
- ), p = e.join("."), T = p + ".", F = !h || m.has(p) || [...m].some((R) => R.startsWith(T));
30
- return /* @__PURE__ */ s(
31
- k,
32
- {
33
- title: n ?? o.title ?? e[e.length - 1] ?? "Section",
34
- description: o.description,
35
- level: i,
36
- summary: j,
37
- errorCount: F ? x.length : 0,
38
- defaultExpanded: f,
39
- children: /* @__PURE__ */ s(
40
- u,
41
- {
42
- schema: o,
43
- value: t,
44
- onChange: d,
45
- path: e,
46
- level: i + 1,
47
- required: r
48
- }
49
- )
50
- }
51
- );
52
- }
53
- const y = (!h || m.has(e.join("."))) && r && O(t) ? b(n ?? "Field") : void 0;
54
- return /* @__PURE__ */ s(
55
- g,
56
- {
57
- label: n,
58
- required: r,
59
- description: o.description,
60
- error: y,
61
- children: /* @__PURE__ */ s(
62
- u,
63
- {
64
- schema: o,
65
- value: t,
66
- onChange: d,
67
- path: e,
68
- level: i,
69
- required: r,
70
- suppressInlineError: !0
71
- }
72
- )
73
- }
74
- );
75
- };
76
- export {
77
- B as SchemaField
78
- };
@@ -1,114 +0,0 @@
1
- import { jsx as t, jsxs as O, Fragment as P } from "react/jsx-runtime";
2
- import { DialErrorText as x } from "../../CaptionText/CaptionText.js";
3
- import { useSchemaContext as F } from "../context.js";
4
- import { resolveRef as T, isObjectType as u, toRequiredMessage as A, isMissingRequiredValue as b } from "../../../utils/json-schema.js";
5
- import { SchemaObjectEditor as k } from "./SchemaObjectEditor.js";
6
- import { SchemaArrayEditor as M } from "./SchemaArrayEditor.js";
7
- import { SchemaOneOfEditor as R } from "./SchemaOneOfEditor.js";
8
- import { SchemaAnyOfEditor as q } from "./SchemaAnyOfEditor.js";
9
- import { SchemaKeyValueEditor as V } from "./SchemaKeyValueEditor.js";
10
- import { SchemaPrimitiveField as w } from "./SchemaPrimitiveField.js";
11
- import { SchemaAdditionalPropertiesEditor as D } from "./SchemaAdditionalPropertiesEditor.js";
12
- import { JsonSchemaType as c } from "../../../types/json-schema.js";
13
- const X = ({
14
- schema: h,
15
- value: i,
16
- onChange: f,
17
- path: r,
18
- level: m,
19
- required: p,
20
- suppressInlineError: l = !1
21
- }) => {
22
- const {
23
- rootSchema: g,
24
- renderField: d,
25
- markTouched: S = () => {
26
- },
27
- touchedPaths: y = /* @__PURE__ */ new Set(),
28
- skipUntouched: C = !1,
29
- jsonEditorTheme: E
30
- } = F(), e = T(h, g), s = (n) => {
31
- S(r.join(".")), f(n);
32
- }, j = !C || y.has(r.join("."));
33
- let o;
34
- if (e.oneOf)
35
- o = /* @__PURE__ */ t(
36
- R,
37
- {
38
- schema: e,
39
- value: i,
40
- onChange: s,
41
- path: r,
42
- level: m
43
- }
44
- );
45
- else if (e.anyOf && e.type !== c.Object)
46
- o = /* @__PURE__ */ t(
47
- q,
48
- {
49
- schema: e,
50
- value: i,
51
- onChange: s,
52
- path: r,
53
- level: m
54
- }
55
- );
56
- else if (u(e)) {
57
- const n = e.additionalProperties != null && e.additionalProperties !== !1, a = !e.properties || Object.keys(e.properties).length === 0;
58
- n && a ? o = /* @__PURE__ */ t(
59
- V,
60
- {
61
- schema: e,
62
- value: i,
63
- onChange: s,
64
- path: r,
65
- level: m
66
- }
67
- ) : a && e.additionalProperties !== !1 ? o = /* @__PURE__ */ t(
68
- D,
69
- {
70
- value: i,
71
- onChange: s,
72
- theme: E
73
- }
74
- ) : o = /* @__PURE__ */ t(
75
- k,
76
- {
77
- schema: e,
78
- value: i,
79
- onChange: s,
80
- path: r,
81
- level: m
82
- }
83
- );
84
- } else if (e.type === c.Array)
85
- o = /* @__PURE__ */ t(
86
- M,
87
- {
88
- schema: e,
89
- value: i,
90
- onChange: s,
91
- path: r,
92
- level: m
93
- }
94
- );
95
- else {
96
- const n = j && p && b(i), a = !l && n ? A(e.title ?? "Field") : void 0;
97
- o = /* @__PURE__ */ O(P, { children: [
98
- /* @__PURE__ */ t(
99
- w,
100
- {
101
- schema: e,
102
- value: i,
103
- onChange: s,
104
- invalid: n
105
- }
106
- ),
107
- /* @__PURE__ */ t(x, { text: a })
108
- ] });
109
- }
110
- return d ? d(r, e, o) : o;
111
- };
112
- export {
113
- X as SchemaFieldContent
114
- };
@@ -1,272 +0,0 @@
1
- import { jsxs as x, jsx as e } from "react/jsx-runtime";
2
- import { useState as R, useCallback as U, useMemo as M } from "react";
3
- import { IconPlus as V } from "@tabler/icons-react";
4
- import { DialInput as L } from "../../Input/Input.js";
5
- import { DialErrorText as ee } from "../../CaptionText/CaptionText.js";
6
- import { DialGhostButton as te } from "../../Button/ButtonWrappers.js";
7
- import { DialRemoveButton as oe } from "../../RemoveButton/RemoveButton.js";
8
- import { DialSelect as Y } from "../../Select/Select.js";
9
- import { DialTooltip as ne } from "../../Tooltip/Tooltip.js";
10
- import { ElementSize as re } from "../../../types/size.js";
11
- import { useSchemaContext as q } from "../context.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";
13
- import { SchemaPrimitiveField as ue } from "./SchemaPrimitiveField.js";
14
- import { SchemaSection as fe } from "./SchemaSection.js";
15
- import { SchemaFieldContent as he } from "./SchemaFieldContent.js";
16
- import { SchemaAdditionalPropertiesEditor as be } from "./SchemaAdditionalPropertiesEditor.js";
17
- import { JsonSchemaType as c } from "../../../types/json-schema.js";
18
- const _ = (l, d) => ({
19
- id: Math.random().toString(36).slice(2),
20
- key: l,
21
- value: d
22
- }), J = (l) => !!(l.oneOf || l.anyOf || l.type === c.Array || ae(l)), ve = {
23
- [c.String]: "entryTypeString",
24
- [c.Number]: "entryTypeNumber",
25
- [c.Boolean]: "entryTypeBoolean",
26
- [c.Null]: "entryTypeNull",
27
- [c.Object]: "entryTypeObject",
28
- [c.Array]: "entryTypeArray"
29
- }, xe = ({
30
- pairId: l,
31
- pairKey: d,
32
- pairValue: i,
33
- valueSchema: u,
34
- isUnschematizedValue: f,
35
- jsonEditorTheme: C,
36
- onKeyChange: m,
37
- onValueChange: p,
38
- onRemove: P,
39
- keyInputPlaceholder: O,
40
- removeFieldAriaLabel: T,
41
- path: h,
42
- level: N,
43
- readonly: s = !1,
44
- inputClassName: b
45
- }) => {
46
- const {
47
- rootSchema: v,
48
- texts: y,
49
- defaultExpanded: E = !0,
50
- touchedPaths: j = /* @__PURE__ */ new Set(),
51
- markTouched: w = () => {
52
- },
53
- skipUntouched: D = !1
54
- } = q(), [t, o] = R(d), a = J(u), [n, g] = R(
55
- () => ie(i)
56
- ), B = f && (n === c.Object || n === c.Array), $ = f && n === c.Null, F = a || B, I = [...h, l, "key"].join("."), S = (!D || j.has(I)) && d === "", z = U(
57
- (r) => {
58
- p(se(r)), g(r);
59
- },
60
- [p]
61
- ), G = M(
62
- () => ce.map((r) => ({
63
- value: r,
64
- label: y[ve[r]]
65
- })),
66
- [y]
67
- ), W = M(
68
- () => [
69
- { value: "true", label: y.booleanTrueOption },
70
- { value: "false", label: y.booleanFalseOption }
71
- ],
72
- [y]
73
- ), K = `${l}-key-error`, Q = f && n === c.Boolean, A = /* @__PURE__ */ x("div", { className: "flex gap-2 items-start", children: [
74
- /* @__PURE__ */ x("div", { className: F ? "flex-1 min-w-0" : "w-2/5 min-w-0", children: [
75
- /* @__PURE__ */ e(
76
- L,
77
- {
78
- value: t,
79
- disabled: s,
80
- invalid: S,
81
- "aria-describedby": S ? K : void 0,
82
- onChange: (r) => o(r ?? ""),
83
- onBlur: () => {
84
- w(I), t !== d && m(t);
85
- },
86
- placeholder: O,
87
- containerClassName: b
88
- }
89
- ),
90
- /* @__PURE__ */ e(
91
- ee,
92
- {
93
- id: K,
94
- text: S ? `${y.keyColumnHeader} is required` : void 0
95
- }
96
- )
97
- ] }),
98
- !a && !B && /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: $ ? /* @__PURE__ */ e(
99
- L,
100
- {
101
- value: "null",
102
- disabled: !0,
103
- onChange: void 0,
104
- className: "opacity-60"
105
- }
106
- ) : Q ? /* @__PURE__ */ e(
107
- Y,
108
- {
109
- options: W,
110
- value: i ? "true" : "false",
111
- disabled: s,
112
- onChange: (r) => {
113
- const k = typeof r == "string" ? r : r[0];
114
- k && p(k === "true");
115
- }
116
- }
117
- ) : /* @__PURE__ */ e(
118
- ue,
119
- {
120
- schema: f ? { type: n } : u,
121
- value: i,
122
- onChange: p
123
- }
124
- ) }),
125
- f && /* @__PURE__ */ e("div", { className: "w-28 shrink-0", children: /* @__PURE__ */ e(
126
- ne,
127
- {
128
- tooltip: y.entryTypeChangeWarning,
129
- triggerClassName: "block",
130
- children: /* @__PURE__ */ e(
131
- Y,
132
- {
133
- options: G,
134
- value: n,
135
- disabled: s,
136
- onChange: (r) => {
137
- const k = typeof r == "string" ? r : r[0];
138
- k && z(k);
139
- }
140
- }
141
- )
142
- }
143
- ) }),
144
- !s && /* @__PURE__ */ e(
145
- oe,
146
- {
147
- size: re.Small,
148
- onClick: P,
149
- "aria-label": T,
150
- className: "shrink-0 p-1"
151
- }
152
- )
153
- ] });
154
- if (!F) return A;
155
- if (B)
156
- return /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
157
- A,
158
- /* @__PURE__ */ e(
159
- be,
160
- {
161
- value: i,
162
- onChange: p,
163
- theme: C
164
- },
165
- n
166
- )
167
- ] });
168
- const H = [...h, d], X = de(i, u, v), Z = me(
169
- i,
170
- u,
171
- v,
172
- H.join(".")
173
- );
174
- return /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
175
- A,
176
- /* @__PURE__ */ e(
177
- fe,
178
- {
179
- title: d,
180
- level: N,
181
- summary: X,
182
- errorCount: Z.length + (S ? 1 : 0),
183
- defaultExpanded: E,
184
- children: /* @__PURE__ */ e(
185
- he,
186
- {
187
- schema: u,
188
- value: i,
189
- onChange: p,
190
- path: H,
191
- level: N + 1
192
- }
193
- )
194
- }
195
- )
196
- ] });
197
- }, He = ({
198
- schema: l,
199
- value: d,
200
- onChange: i,
201
- path: u,
202
- level: f
203
- }) => {
204
- const {
205
- rootSchema: C,
206
- texts: m,
207
- readonly: p = !1,
208
- inputClassName: P,
209
- jsonEditorTheme: O
210
- } = q(), T = l.additionalProperties === !0 || l.additionalProperties == null, h = T ? { type: "string" } : typeof l.additionalProperties == "object" ? le(l.additionalProperties, C) : { type: "string" }, N = J(h), [s, b] = R(
211
- () => Object.entries(d ?? {}).map(
212
- ([t, o]) => _(t, o)
213
- )
214
- ), v = (t) => Object.fromEntries(
215
- t.filter((o) => o.key !== "").map((o) => [o.key, o.value])
216
- ), y = (t, o) => {
217
- const a = s.map(
218
- (n, g) => g === t ? { ...n, key: o } : n
219
- );
220
- b(a), i(v(a));
221
- }, E = (t, o) => {
222
- const a = s.map(
223
- (n, g) => g === t ? { ...n, value: o } : n
224
- );
225
- b(a), i(v(a));
226
- }, j = () => N ? pe(h, C) ?? ye(h) : "", w = () => {
227
- b((t) => [...t, _("", j())]);
228
- }, D = (t) => {
229
- const o = s.filter((a, n) => n !== t);
230
- b(o), i(v(o));
231
- };
232
- return /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
233
- s.length === 0 && /* @__PURE__ */ e("p", { className: "dial-tiny-text text-secondary italic", children: m.noFieldsYet }),
234
- s.length > 0 && !N && /* @__PURE__ */ x("div", { className: "flex gap-2 mb-1 pr-7", children: [
235
- /* @__PURE__ */ e("span", { className: "w-2/5 dial-tiny-text text-secondary font-medium", children: m.keyColumnHeader }),
236
- /* @__PURE__ */ e("span", { className: "flex-1 dial-tiny-text text-secondary font-medium", children: m.valueColumnHeader }),
237
- T && /* @__PURE__ */ e("span", { className: "w-28 shrink-0 dial-tiny-text text-secondary font-medium", children: m.typeColumnHeader })
238
- ] }),
239
- s.map((t, o) => /* @__PURE__ */ e(
240
- xe,
241
- {
242
- pairId: t.id,
243
- pairKey: t.key,
244
- pairValue: t.value,
245
- valueSchema: h,
246
- isUnschematizedValue: T,
247
- jsonEditorTheme: O,
248
- onKeyChange: (a) => y(o, a),
249
- onValueChange: (a) => E(o, a),
250
- onRemove: () => D(o),
251
- keyInputPlaceholder: m.keyInputPlaceholder,
252
- removeFieldAriaLabel: m.removeFieldAriaLabel,
253
- path: u,
254
- level: f,
255
- readonly: p,
256
- inputClassName: P
257
- },
258
- t.id
259
- )),
260
- !p && /* @__PURE__ */ e("div", { className: "pt-1", children: /* @__PURE__ */ e(
261
- te,
262
- {
263
- label: m.addField,
264
- iconBefore: /* @__PURE__ */ e(V, { size: 16, stroke: 2 }),
265
- onClick: w
266
- }
267
- ) })
268
- ] });
269
- };
270
- export {
271
- He as SchemaKeyValueEditor
272
- };
@@ -1,36 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useSchemaContext as v } from "../context.js";
3
- import { resolveRef as i, sortByPropertyOrder as g, toFieldLabel as j } from "../../../utils/json-schema.js";
4
- import { SchemaField as q } from "./SchemaField.js";
5
- const N = ({
6
- schema: c,
7
- value: a,
8
- onChange: d,
9
- path: p,
10
- level: m
11
- }) => {
12
- const { rootSchema: r, texts: u } = v(), s = i(c, r), l = g(
13
- Object.entries(s.properties ?? {}).filter(
14
- ([, e]) => !i(e, r).isHidden
15
- )
16
- ), f = s.required ?? [], n = a ?? {};
17
- return l.length === 0 ? /* @__PURE__ */ o("p", { className: "dial-tiny-text text-secondary italic", children: u.noConfigurableProperties }) : /* @__PURE__ */ o("div", { className: "flex flex-col gap-4", children: l.map(([e, t]) => {
18
- const h = i(t, r).title ?? t.title ?? j(e), x = f.includes(e);
19
- return /* @__PURE__ */ o(
20
- q,
21
- {
22
- schema: t,
23
- value: n[e],
24
- onChange: (b) => d({ ...n, [e]: b }),
25
- path: [...p, e],
26
- level: m,
27
- required: x,
28
- label: h
29
- },
30
- e
31
- );
32
- }) });
33
- };
34
- export {
35
- N as SchemaObjectEditor
36
- };