@epam/ai-dial-ui-kit 0.15.0-dev.7 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/CHANGELOG.md +86 -0
- package/dist/DateCellRenderer-BdUMSg-E.cjs +1 -0
- package/dist/{DateCellRenderer-4iMidqal.cjs → DateCellRenderer-CZNa4jVJ.cjs} +30 -30
- package/dist/IconButton-DHOFapLo.cjs +1 -0
- package/dist/JsonEditor-Bxui5wJH.cjs +1 -0
- package/dist/{MarkdownEditor-C9-ZMRVi.cjs → MarkdownEditor-BKtFs714.cjs} +1 -1
- package/dist/MarkdownEditor-Bapd1ycU.cjs +1 -0
- package/dist/MarkdownEditorContainer-B5aHwoYF.cjs +1 -0
- package/dist/{Switch-CUKClcEz.cjs → Switch-DE6MrcqJ.cjs} +1 -1
- package/dist/components/Button/constants.js +9 -8
- package/dist/components/Dropdown/Dropdown.js +2 -2
- package/dist/components/Dropdown/DropdownSubMenuItem.js +1 -1
- package/dist/components/Dropdown/constants.js +7 -7
- package/dist/components/DropdownIcon/DropdownIcon.js +4 -4
- package/dist/components/FileManager/FileManager.js +373 -372
- package/dist/components/FileManager/FileManagerProvider.js +266 -264
- package/dist/components/FileManager/hooks/use-grid-context-menu.js +59 -59
- package/dist/components/MarkdownEditor/MarkdownEditor.js +23 -21
- package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +27 -27
- package/dist/components/New/Accordion/Accordion.js +86 -72
- package/dist/components/New/AutocompleteTagInput/AutocompleteTagInput.js +214 -0
- package/dist/components/New/AutocompleteTagInput/utils.js +11 -0
- package/dist/components/New/Avatar/Avatar.js +70 -0
- package/dist/components/New/Badge/Badge.js +45 -0
- package/dist/components/New/BottomSheet/BottomSheet.js +128 -0
- package/dist/components/New/Breadcrumbs/Breadcrumbs.js +159 -0
- package/dist/components/New/Breadcrumbs/constants.js +41 -0
- package/dist/components/New/Button/Button.js +32 -32
- package/dist/components/New/Button/ButtonWrappers.js +103 -37
- package/dist/components/New/Button/constants.js +3 -0
- package/dist/components/New/Button/utils.js +18 -8
- package/dist/components/New/ButtonDropdown/ButtonDropdown.js +27 -18
- package/dist/components/New/Calendar/Calendar.js +6 -6
- package/dist/components/New/Calendar/constants.js +5 -5
- package/dist/components/New/CaptionText/CaptionText.js +3 -3
- package/dist/components/New/CardShell/CardShell.js +2 -2
- package/dist/components/New/Checkbox/Checkbox.js +2 -2
- package/dist/components/New/Checkbox/CheckboxBox.js +2 -2
- package/dist/components/New/CloseButton/CloseButton.js +1 -1
- package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +2 -2
- package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +21 -25
- package/dist/components/New/ConfirmationPopup/constants.js +8 -11
- package/dist/components/New/Dropdown/Dropdown.js +99 -98
- package/dist/components/New/Dropdown/DropdownSubMenuItem.js +17 -17
- package/dist/components/New/Dropdown/constants.js +22 -17
- package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +2 -2
- package/dist/components/New/EntityIdentity/EntityIdentity.js +135 -0
- package/dist/components/New/FileDropzone/FileDropzone.js +2 -2
- package/dist/components/New/FileIcon/FileIcon.js +55 -0
- package/dist/components/New/FileIcon/constants.js +134 -0
- package/dist/components/New/FileIcon/icons/FileGlyph.js +150 -0
- package/dist/components/New/FileIcon/icons/FolderGlyph.js +50 -0
- package/dist/components/New/FileName/FileName.js +78 -0
- package/dist/components/New/FilterChips/FilterChips.js +43 -0
- package/dist/components/New/FilterChips/constants.js +5 -0
- package/dist/components/New/FolderName/FolderName.js +16 -0
- package/dist/components/New/FolderPath/FolderPath.js +1 -1
- package/dist/components/New/Grid/constants.js +14 -5
- package/dist/components/New/Highlight/Highlight.js +2 -2
- package/dist/components/New/IconButton/IconButton.js +30 -28
- package/dist/components/New/InfoButton/InfoButton.js +2 -2
- package/dist/components/New/InlineSelect/InlineSelect.js +75 -59
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +70 -66
- package/dist/components/New/InteractiveTooltip/constants.js +2 -2
- package/dist/components/New/Label/Label.js +2 -2
- package/dist/components/New/MarkdownEditor/MarkdownEditor.js +29 -27
- package/dist/components/New/MenuItem/MenuItem.js +2 -2
- package/dist/components/New/MenuItem/constants.js +1 -1
- package/dist/components/New/NoDataContent/NoDataContent.js +2 -2
- package/dist/components/New/Notification/Notification.js +37 -35
- package/dist/components/New/NumberInput/NumberInput.js +2 -2
- package/dist/components/New/PasswordInput/PasswordInput.js +2 -2
- package/dist/components/New/Popup/Popup.js +59 -57
- package/dist/components/New/Popup/constants.js +3 -3
- package/dist/components/New/Radio/Radio.js +2 -2
- package/dist/components/New/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +2 -2
- package/dist/components/New/ResizableContainer/ResizableContainer.js +2 -2
- package/dist/components/New/SchemaRenderer/SchemaRenderer.js +164 -0
- package/dist/components/New/SchemaRenderer/components/SchemaAnyOfEditor.js +65 -0
- package/dist/components/New/SchemaRenderer/components/SchemaArrayEditor.js +109 -0
- package/dist/components/New/SchemaRenderer/components/SchemaField.js +83 -0
- package/dist/components/New/SchemaRenderer/components/SchemaFieldContent.js +72 -0
- package/dist/components/New/SchemaRenderer/components/SchemaJsonEditor.js +41 -0
- package/dist/components/New/SchemaRenderer/components/SchemaKeyValueEditor.js +250 -0
- package/dist/components/New/SchemaRenderer/components/SchemaObjectEditor.js +36 -0
- package/dist/components/New/SchemaRenderer/components/SchemaOneOfEditor.js +163 -0
- package/dist/components/New/SchemaRenderer/components/SchemaPrimitiveField.js +150 -0
- package/dist/components/New/SchemaRenderer/components/SchemaSection.js +135 -0
- package/dist/components/New/SchemaRenderer/context.js +17 -0
- package/dist/components/New/Search/Search.js +2 -2
- package/dist/components/New/SegmentedControl/SegmentedControl.js +4 -4
- package/dist/components/New/Select/CollapsedSelectTags.js +127 -0
- package/dist/components/New/Select/MultiSelectTags.js +18 -15
- package/dist/components/New/Select/Select.js +184 -173
- package/dist/components/New/Select/constants.js +23 -20
- package/dist/components/New/SharedEntityIndicator/SharedEntityIndicator.js +34 -0
- package/dist/components/New/SideDrawer/SideDrawer.js +148 -0
- package/dist/components/New/Slider/Slider.js +184 -91
- package/dist/components/New/Slider/utils.js +20 -0
- package/dist/components/New/Switch/Switch.js +2 -2
- package/dist/components/New/Tabs/Tabs.js +124 -66
- package/dist/components/New/Tag/Tag.js +2 -2
- package/dist/components/New/TagInput/TagInput.js +5 -3
- package/dist/components/New/Textarea/Textarea.js +21 -20
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +2 -2
- package/dist/components/New/Tooltip/TooltipContent.js +2 -2
- package/dist/components/New/Tooltip/constants.js +1 -1
- package/dist/components/New/TransferQueue/TransferQueue.js +124 -0
- package/dist/components/New/TransferQueue/TransferQueueHeader.js +71 -0
- package/dist/components/New/TransferQueue/TransferQueueRow.js +119 -0
- package/dist/components/New/TransferQueue/constants.js +24 -0
- package/dist/components/New/constants/overlay.js +17 -9
- package/dist/components/Popup/constants.js +8 -8
- package/dist/components/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/SchemaRenderer/SchemaRenderer.js +16 -15
- package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
- package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +2 -2
- package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +1 -1
- package/dist/components/SchemaRenderer/components/SchemaField.js +23 -23
- package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +19 -19
- package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
- package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +1 -1
- package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +13 -13
- package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +5 -5
- package/dist/components/Skeleton/Skeleton.js +2 -2
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/Tooltip/TooltipContent.js +11 -11
- package/dist/components-manifest.json +1873 -78
- package/dist/constants/public-class-names.js +69 -3
- package/dist/constants/schema-renderer.js +33 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +358 -310
- package/dist/editors.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/index.css +2 -2
- package/dist/lazy-_W6FYhKg.cjs +1 -0
- package/dist/merge-classes-BEJXjzkx.cjs +1 -0
- package/dist/migration-guides/0.15.0/legacy-theme-variable-fallbacks-removal.md +69 -0
- package/dist/migration-guides/0.15.0/slider-redesign.md +110 -0
- package/dist/migration-guides/README.md +2 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +419 -399
- package/dist/src/components/FileManager/FileManager.d.ts +2 -0
- package/dist/src/components/FileManager/FileManagerContext.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +2 -1
- package/dist/src/components/MarkdownEditor/MarkdownEditor.d.ts +2 -0
- package/dist/src/components/MarkdownEditor/MarkdownEditorContainer.d.ts +2 -0
- package/dist/src/components/New/Accordion/Accordion.d.ts +6 -1
- package/dist/src/components/New/AutocompleteTagInput/AutocompleteTagInput.d.ts +108 -0
- package/dist/src/components/New/AutocompleteTagInput/utils.d.ts +17 -0
- package/dist/src/components/New/AutocompleteTagInput/utils.spec.d.ts +1 -0
- package/dist/src/components/New/Avatar/Avatar.d.ts +55 -0
- package/dist/src/components/New/Badge/Badge.d.ts +47 -0
- package/dist/src/components/New/BottomSheet/BottomSheet.d.ts +84 -0
- package/dist/src/components/New/Breadcrumbs/Breadcrumbs.d.ts +94 -0
- package/dist/src/components/New/Breadcrumbs/constants.d.ts +60 -0
- package/dist/src/components/New/Button/Button.d.ts +4 -1
- package/dist/src/components/New/Button/ButtonWrappers.d.ts +21 -0
- package/dist/src/components/New/Button/utils.d.ts +15 -0
- package/dist/src/components/New/ButtonDropdown/ButtonDropdown.d.ts +4 -0
- package/dist/src/components/New/Calendar/constants.d.ts +1 -1
- package/dist/src/components/New/ConfirmationPopup/constants.d.ts +0 -1
- package/dist/src/components/New/Dropdown/Dropdown.d.ts +9 -1
- package/dist/src/components/New/Dropdown/constants.d.ts +3 -0
- package/dist/src/components/New/EntityIdentity/EntityIdentity.d.ts +85 -0
- package/dist/src/components/New/FileIcon/FileIcon.d.ts +61 -0
- package/dist/src/components/New/FileIcon/constants.d.ts +16 -0
- package/dist/src/components/New/FileIcon/icons/FileGlyph.d.ts +18 -0
- package/dist/src/components/New/FileIcon/icons/FolderGlyph.d.ts +17 -0
- package/dist/src/components/New/FileName/FileName.d.ts +79 -0
- package/dist/src/components/New/FilterChips/FilterChips.d.ts +69 -0
- package/dist/src/components/New/FilterChips/constants.d.ts +13 -0
- package/dist/src/components/New/FolderName/FolderName.d.ts +37 -0
- package/dist/src/components/New/Grid/constants.d.ts +6 -4
- package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +16 -1
- package/dist/src/components/New/InteractiveTooltip/InteractiveTooltip.d.ts +13 -2
- package/dist/src/components/New/InteractiveTooltip/constants.d.ts +5 -4
- package/dist/src/components/New/MarkdownEditor/MarkdownEditor.d.ts +3 -0
- package/dist/src/components/New/Notification/Notification.d.ts +18 -0
- package/dist/src/components/New/Popup/Popup.d.ts +8 -1
- package/dist/src/components/New/Popup/constants.d.ts +1 -1
- package/dist/src/components/New/SchemaRenderer/SchemaRenderer.d.ts +38 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +37 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaArrayEditor.d.ts +35 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaField.d.ts +33 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaFieldContent.d.ts +30 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaJsonEditor.d.ts +29 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +37 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaObjectEditor.d.ts +32 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaOneOfEditor.d.ts +39 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaPrimitiveField.d.ts +38 -0
- package/dist/src/components/New/SchemaRenderer/components/SchemaSection.d.ts +39 -0
- package/dist/src/components/New/SchemaRenderer/context.d.ts +8 -0
- package/dist/src/components/New/SchemaRenderer/types.d.ts +76 -0
- package/dist/src/components/New/Select/CollapsedSelectTags.d.ts +22 -0
- package/dist/src/components/New/Select/MultiSelectTags.d.ts +5 -0
- package/dist/src/components/New/Select/Select.d.ts +9 -0
- package/dist/src/components/New/Select/constants.d.ts +3 -2
- package/dist/src/components/New/SharedEntityIndicator/SharedEntityIndicator.d.ts +35 -0
- package/dist/src/components/New/SideDrawer/SideDrawer.d.ts +100 -0
- package/dist/src/components/New/Slider/Slider.d.ts +29 -1
- package/dist/src/components/New/Slider/utils.d.ts +14 -0
- package/dist/src/components/New/Slider/utils.spec.d.ts +1 -0
- package/dist/src/components/New/Tabs/Tabs.d.ts +54 -6
- package/dist/src/components/New/Tooltip/constants.d.ts +5 -3
- package/dist/src/components/New/TransferQueue/TransferQueue.d.ts +139 -0
- package/dist/src/components/New/TransferQueue/TransferQueueHeader.d.ts +16 -0
- package/dist/src/components/New/TransferQueue/TransferQueueRow.d.ts +10 -0
- package/dist/src/components/New/TransferQueue/constants.d.ts +6 -0
- package/dist/src/components/New/constants/overlay.d.ts +13 -0
- package/dist/src/components/Popup/constants.d.ts +1 -1
- package/dist/src/components/SchemaRenderer/types.d.ts +5 -82
- package/dist/src/components/SchemaRenderer/utils.d.ts +1 -13
- package/dist/src/constants/public-class-names.d.ts +69 -3
- package/dist/src/constants/schema-renderer.d.ts +2 -0
- package/dist/src/index.d.ts +39 -3
- package/dist/src/models/json-schema.d.ts +71 -0
- package/dist/src/types/accordion.d.ts +7 -0
- package/dist/src/types/avatar.d.ts +7 -0
- package/dist/src/types/badge.d.ts +16 -0
- package/dist/src/types/breadcrumbs.d.ts +9 -0
- package/dist/src/types/button.d.ts +1 -0
- package/dist/src/types/entity-type.d.ts +9 -0
- package/dist/src/types/json-schema.d.ts +22 -0
- package/dist/src/types/tooltip.d.ts +4 -0
- package/dist/src/types/transfer-queue.d.ts +10 -0
- package/dist/src/utils/__tests__/avatar.spec.d.ts +1 -0
- package/dist/src/utils/avatar.d.ts +12 -0
- package/dist/src/utils/json-schema.d.ts +23 -0
- package/dist/src/utils/sub-menu-floating.d.ts +7 -4
- package/dist/types/accordion.js +4 -0
- package/dist/types/avatar.js +4 -0
- package/dist/types/badge.js +5 -0
- package/dist/types/breadcrumbs.js +4 -0
- package/dist/types/button.js +3 -3
- package/dist/types/entity-type.js +4 -0
- package/dist/types/json-schema.js +7 -0
- package/dist/types/tooltip.js +3 -2
- package/dist/types/transfer-queue.js +4 -0
- package/dist/use-file-manager-tabs-Bzzwwcgk.cjs +3 -0
- package/dist/utils/avatar.js +22 -0
- package/dist/{components/SchemaRenderer/utils.js → utils/json-schema.js} +122 -95
- package/dist/utils/merge-classes.js +12 -5
- package/dist/utils/sub-menu-floating.js +99 -54
- package/package.json +4 -9
- package/dist/DateCellRenderer-CTTAnQjB.cjs +0 -1
- package/dist/IconButton-DWqoaBWf.cjs +0 -1
- package/dist/JsonEditor-D2jSlRFi.cjs +0 -1
- package/dist/MarkdownEditor-BzEbdj7R.cjs +0 -1
- package/dist/MarkdownEditorContainer-BvwJjkiZ.cjs +0 -1
- package/dist/components/SchemaRenderer/types.js +0 -27
- package/dist/editor-_174x-qy.cjs +0 -1
- package/dist/lazy-DM-7dL0Y.cjs +0 -1
- package/dist/merge-classes-Dipy1Ih1.cjs +0 -1
- package/dist/use-file-manager-tabs-DKmWaOlC.cjs +0 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as a, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { useState as O } from "react";
|
|
3
|
+
import { IconPlus as R } from "@tabler/icons-react";
|
|
4
|
+
import { GhostButton as $ } from "../../Button/ButtonWrappers.js";
|
|
5
|
+
import { DIAL_KIT_ICON_STROKE as j } from "../../constants/icon.js";
|
|
6
|
+
import { Select as D } from "../../Select/Select.js";
|
|
7
|
+
import { DIAL_ICON_SIZE as E } from "../../../../constants/icon.js";
|
|
8
|
+
import { resolveRef as x, getItemTitle as k, validateRequired as w, buildSummary as B, extractDefaults as v, getSchemaDefault as K } from "../../../../utils/json-schema.js";
|
|
9
|
+
import { useSchemaContext as q } from "../context.js";
|
|
10
|
+
import { SchemaFieldContent as z } from "./SchemaFieldContent.js";
|
|
11
|
+
import { SchemaSection as F } from "./SchemaSection.js";
|
|
12
|
+
const X = ({
|
|
13
|
+
schema: A,
|
|
14
|
+
value: h,
|
|
15
|
+
onChange: i,
|
|
16
|
+
path: u,
|
|
17
|
+
level: S
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
rootSchema: o,
|
|
21
|
+
texts: m,
|
|
22
|
+
readonly: y = !1,
|
|
23
|
+
defaultExpanded: g = !0
|
|
24
|
+
} = q(), [T, N] = O(), s = Array.isArray(h) ? h : [], d = A.items;
|
|
25
|
+
if (!d)
|
|
26
|
+
return /* @__PURE__ */ a("p", { className: "dial-small-text text-secondary", children: m.noItemSchema });
|
|
27
|
+
const n = x(d, o), l = n.discriminator, p = l ? Object.keys(l.mapping).map((e) => ({ value: e, label: e })) : [], c = T ?? p[0]?.value, b = () => {
|
|
28
|
+
let e;
|
|
29
|
+
if (l && c) {
|
|
30
|
+
const t = x(
|
|
31
|
+
{ $ref: l.mapping[c] },
|
|
32
|
+
o
|
|
33
|
+
);
|
|
34
|
+
e = { ...v(t, o) ?? {}, [l.propertyName]: c };
|
|
35
|
+
} else
|
|
36
|
+
e = v(n, o) ?? K(n);
|
|
37
|
+
i([...s, e]);
|
|
38
|
+
}, C = (e) => {
|
|
39
|
+
i(s.filter((t, r) => r !== e));
|
|
40
|
+
}, L = (e, t) => {
|
|
41
|
+
i(s.map((r, f) => f === e ? t : r));
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ I("div", { className: "flex flex-col gap-3", children: [
|
|
44
|
+
s.length === 0 && /* @__PURE__ */ a("p", { className: "dial-small-text text-secondary", children: m.noItemsYet }),
|
|
45
|
+
s.map((e, t) => {
|
|
46
|
+
const r = k(e, l?.propertyName, t), f = w(
|
|
47
|
+
e,
|
|
48
|
+
n,
|
|
49
|
+
o,
|
|
50
|
+
`${u.join(".")}[${t}]`
|
|
51
|
+
);
|
|
52
|
+
return /* @__PURE__ */ a(
|
|
53
|
+
F,
|
|
54
|
+
{
|
|
55
|
+
title: r,
|
|
56
|
+
level: S,
|
|
57
|
+
summary: B(e, n, o),
|
|
58
|
+
errorCount: f.length,
|
|
59
|
+
onRemove: y ? void 0 : () => C(t),
|
|
60
|
+
defaultExpanded: g,
|
|
61
|
+
removeItemAriaLabel: `${m.removeItemAriaLabel}: ${r}`,
|
|
62
|
+
children: /* @__PURE__ */ a(
|
|
63
|
+
z,
|
|
64
|
+
{
|
|
65
|
+
schema: d,
|
|
66
|
+
value: e,
|
|
67
|
+
onChange: (_) => L(t, _),
|
|
68
|
+
path: [...u, String(t)],
|
|
69
|
+
level: S + 1,
|
|
70
|
+
ariaLabel: r
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
t
|
|
75
|
+
);
|
|
76
|
+
}),
|
|
77
|
+
!y && /* @__PURE__ */ I("div", { className: "flex items-center gap-2 pt-1", children: [
|
|
78
|
+
p.length > 0 && /* @__PURE__ */ a(
|
|
79
|
+
D,
|
|
80
|
+
{
|
|
81
|
+
ariaLabel: m.selectTypeToAdd,
|
|
82
|
+
options: p,
|
|
83
|
+
value: c,
|
|
84
|
+
placeholder: m.selectTypeToAdd,
|
|
85
|
+
onChange: (e) => N(typeof e == "string" ? e : e[0]),
|
|
86
|
+
className: "max-w-[280px] flex-1"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ a(
|
|
90
|
+
$,
|
|
91
|
+
{
|
|
92
|
+
label: m.addItem,
|
|
93
|
+
iconBefore: /* @__PURE__ */ a(
|
|
94
|
+
R,
|
|
95
|
+
{
|
|
96
|
+
size: E.SM,
|
|
97
|
+
stroke: j,
|
|
98
|
+
"aria-hidden": "true"
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
onClick: b
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] })
|
|
105
|
+
] });
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
X as SchemaArrayEditor
|
|
109
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useId as F } from "react";
|
|
3
|
+
import { ErrorText as R } from "../../CaptionText/CaptionText.js";
|
|
4
|
+
import { Label as T } from "../../Label/Label.js";
|
|
5
|
+
import { JsonSchemaType as E } from "../../../../types/json-schema.js";
|
|
6
|
+
import { resolveRef as I, isObjectType as L, validateRequired as b, buildSummary as C, isMissingRequiredValue as M, toRequiredMessage as N } from "../../../../utils/json-schema.js";
|
|
7
|
+
import { useSchemaContext as P, isPathTouched as u } from "../context.js";
|
|
8
|
+
import { SchemaFieldContent as x } from "./SchemaFieldContent.js";
|
|
9
|
+
import { SchemaSection as k } from "./SchemaSection.js";
|
|
10
|
+
const B = ({
|
|
11
|
+
schema: S,
|
|
12
|
+
value: r,
|
|
13
|
+
onChange: d,
|
|
14
|
+
path: o,
|
|
15
|
+
level: c = 0,
|
|
16
|
+
required: i,
|
|
17
|
+
label: s
|
|
18
|
+
}) => {
|
|
19
|
+
const a = F(), {
|
|
20
|
+
rootSchema: m,
|
|
21
|
+
defaultExpanded: y = !0,
|
|
22
|
+
touchedPaths: p,
|
|
23
|
+
skipUntouched: l
|
|
24
|
+
} = P(), e = I(S, m), n = o.join(".");
|
|
25
|
+
if (L(e) || e.type === E.Array) {
|
|
26
|
+
const j = b(r, e, m, n), f = s ?? e.title ?? o[o.length - 1] ?? "Section";
|
|
27
|
+
return /* @__PURE__ */ t(
|
|
28
|
+
k,
|
|
29
|
+
{
|
|
30
|
+
title: f,
|
|
31
|
+
description: e.description,
|
|
32
|
+
level: c,
|
|
33
|
+
summary: C(r, e, m),
|
|
34
|
+
errorCount: u(n, p, l, !0) ? j.length : 0,
|
|
35
|
+
defaultExpanded: y,
|
|
36
|
+
children: /* @__PURE__ */ t(
|
|
37
|
+
x,
|
|
38
|
+
{
|
|
39
|
+
schema: e,
|
|
40
|
+
value: r,
|
|
41
|
+
onChange: d,
|
|
42
|
+
path: o,
|
|
43
|
+
level: c + 1,
|
|
44
|
+
required: i,
|
|
45
|
+
ariaLabel: f
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const g = u(n, p, l) && i && M(r) ? N(s ?? "Field") : void 0;
|
|
52
|
+
return /* @__PURE__ */ h("div", { className: "flex flex-col gap-2", children: [
|
|
53
|
+
/* @__PURE__ */ t(
|
|
54
|
+
T,
|
|
55
|
+
{
|
|
56
|
+
htmlFor: a,
|
|
57
|
+
label: s,
|
|
58
|
+
required: i,
|
|
59
|
+
caption: e.description
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col gap-1", children: [
|
|
63
|
+
/* @__PURE__ */ t(
|
|
64
|
+
x,
|
|
65
|
+
{
|
|
66
|
+
schema: e,
|
|
67
|
+
value: r,
|
|
68
|
+
onChange: d,
|
|
69
|
+
path: o,
|
|
70
|
+
level: c,
|
|
71
|
+
required: i,
|
|
72
|
+
suppressInlineError: !0,
|
|
73
|
+
fieldId: a,
|
|
74
|
+
ariaLabel: s
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ t(R, { text: g })
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
B as SchemaField
|
|
83
|
+
};
|
|
@@ -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
|
+
};
|