@epam/ai-dial-ui-kit 0.15.0-dev.5 → 0.15.0-dev.51
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 +194 -1
- package/dist/CHANGELOG.md +88 -0
- package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-CZNa4jVJ.cjs} +31 -31
- package/dist/DateCellRenderer-CmgeZvYm.cjs +1 -0
- 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 +70 -65
- package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
- package/dist/components/Dropdown/constants.js +16 -14
- package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
- 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 +87 -71
- package/dist/components/New/AutocompleteTagInput/AutocompleteTagInput.js +207 -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 +26 -16
- package/dist/components/New/Calendar/Calendar.js +253 -222
- package/dist/components/New/Calendar/constants.js +5 -5
- package/dist/components/New/CaptionText/CaptionText.js +18 -15
- package/dist/components/New/CardShell/CardShell.js +5 -3
- package/dist/components/New/Checkbox/Checkbox.js +67 -56
- package/dist/components/New/Checkbox/CheckboxBox.js +5 -3
- package/dist/components/New/CloseButton/CloseButton.js +18 -16
- package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +39 -34
- package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +38 -37
- package/dist/components/New/ConfirmationPopup/constants.js +8 -11
- package/dist/components/New/Dropdown/Dropdown.js +112 -105
- 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 +20 -18
- package/dist/components/New/EntityIdentity/EntityIdentity.js +135 -0
- package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
- 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 +29 -28
- package/dist/components/New/Highlight/Highlight.js +23 -30
- package/dist/components/New/IconButton/IconButton.js +30 -28
- package/dist/components/New/InfoButton/InfoButton.js +13 -11
- package/dist/components/New/InlineSelect/InlineSelect.js +74 -56
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +67 -61
- package/dist/components/New/InteractiveTooltip/constants.js +2 -2
- package/dist/components/New/Label/Label.js +13 -8
- package/dist/components/New/MarkdownEditor/MarkdownEditor.js +29 -27
- package/dist/components/New/MenuItem/MenuItem.js +29 -27
- package/dist/components/New/MenuItem/constants.js +9 -8
- package/dist/components/New/NoDataContent/NoDataContent.js +21 -19
- package/dist/components/New/Notification/Notification.js +33 -29
- package/dist/components/New/NumberInput/NumberInput.js +42 -33
- package/dist/components/New/PasswordInput/PasswordInput.js +41 -35
- package/dist/components/New/Popup/Popup.js +46 -44
- package/dist/components/New/Popup/constants.js +3 -3
- package/dist/components/New/Radio/Radio.js +75 -64
- package/dist/components/New/RadioGroup/RadioGroup.js +76 -65
- package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +117 -106
- package/dist/components/New/ResizableContainer/ResizableContainer.js +42 -40
- 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 +29 -27
- package/dist/components/New/SegmentedControl/SegmentedControl.js +29 -23
- 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 +219 -197
- 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 +151 -90
- package/dist/components/New/Slider/utils.js +12 -0
- package/dist/components/New/Switch/Switch.js +69 -58
- package/dist/components/New/Tabs/Tabs.js +125 -61
- package/dist/components/New/Tag/Tag.js +42 -40
- package/dist/components/New/TagInput/TagInput.js +48 -44
- package/dist/components/New/Textarea/Textarea.js +21 -20
- package/dist/components/New/ToggleIconButton/ToggleIconButton.js +26 -24
- package/dist/components/New/Tooltip/TooltipContent.js +11 -9
- 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 +45 -33
- 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 +25 -19
- package/dist/components/Spinner/Spinner.js +7 -5
- package/dist/components/Tooltip/TooltipContent.js +11 -11
- package/dist/components-manifest.json +1851 -77
- package/dist/constants/public-class-names.js +218 -0
- package/dist/constants/schema-renderer.js +33 -0
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/dial-ui-kit.js +357 -307
- 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 +97 -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/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/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 +20 -1
- package/dist/src/components/New/Slider/utils.d.ts +6 -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 +209 -0
- package/dist/src/constants/schema-renderer.d.ts +2 -0
- package/dist/src/index.d.ts +40 -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-ssp7eaZY.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-DjdR_mYM.cjs +0 -3
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b, useState as L, useCallback as Q, useEffect as U } from "react";
|
|
3
|
+
import { DEFAULT_SCHEMA_TEXTS as W } from "../../../constants/schema-renderer.js";
|
|
4
|
+
import { DIAL_KIT_CLASS as Y } from "../../../constants/public-class-names.js";
|
|
5
|
+
import { SchemaRendererVariant as c } from "../../../types/json-schema.js";
|
|
6
|
+
import { extractDefaults as Z, sortByPropertyOrder as $, resolveRef as P, toFieldLabel as R, validateRequired as y, isMissingRequiredValue as k } from "../../../utils/json-schema.js";
|
|
7
|
+
import { mergeClasses as ee } from "../../../utils/merge-classes.js";
|
|
8
|
+
import { SchemaField as re } from "./components/SchemaField.js";
|
|
9
|
+
import { SchemaFieldContent as q } from "./components/SchemaFieldContent.js";
|
|
10
|
+
import { SchemaJsonEditor as te } from "./components/SchemaJsonEditor.js";
|
|
11
|
+
import { SchemaSection as T } from "./components/SchemaSection.js";
|
|
12
|
+
import { SchemaRendererContext as oe, isPathTouched as le } from "./context.js";
|
|
13
|
+
const F = "dial-small-semi-text text-primary", ge = ({
|
|
14
|
+
schema: t,
|
|
15
|
+
defaultValue: f,
|
|
16
|
+
texts: p,
|
|
17
|
+
className: N,
|
|
18
|
+
readonly: j = !1,
|
|
19
|
+
defaultExpanded: m = !0,
|
|
20
|
+
inputClassName: A,
|
|
21
|
+
variant: d = c.Sections,
|
|
22
|
+
onChange: M,
|
|
23
|
+
onPropertyChange: O,
|
|
24
|
+
onDefaultValues: _,
|
|
25
|
+
renderField: D,
|
|
26
|
+
skipUntouched: S = !1,
|
|
27
|
+
acceptableResourceTypes: E
|
|
28
|
+
}) => {
|
|
29
|
+
const H = b(
|
|
30
|
+
() => ({ ...W, ...p }),
|
|
31
|
+
[p]
|
|
32
|
+
), g = b(() => f || (Z(t, t) ?? {}), []), [n, K] = L(g), [C, V] = L(
|
|
33
|
+
() => /* @__PURE__ */ new Set()
|
|
34
|
+
), w = Q((e) => {
|
|
35
|
+
V(
|
|
36
|
+
(r) => r.has(e) ? r : /* @__PURE__ */ new Set([...r, e])
|
|
37
|
+
);
|
|
38
|
+
}, []);
|
|
39
|
+
U(() => {
|
|
40
|
+
_?.(g);
|
|
41
|
+
}, []);
|
|
42
|
+
const v = (e, r) => {
|
|
43
|
+
const o = { ...n, [e]: r };
|
|
44
|
+
K(o), M?.(o), O?.(e, r);
|
|
45
|
+
}, I = new Set(Object.keys(t.properties ?? {})), B = Object.keys(n).filter(
|
|
46
|
+
(e) => !I.has(e)
|
|
47
|
+
), J = $(
|
|
48
|
+
Object.entries(t.properties ?? {}).filter(
|
|
49
|
+
([, e]) => !P(e, t).isHidden
|
|
50
|
+
)
|
|
51
|
+
), X = t.required ?? [];
|
|
52
|
+
return /* @__PURE__ */ l(
|
|
53
|
+
oe.Provider,
|
|
54
|
+
{
|
|
55
|
+
value: {
|
|
56
|
+
rootSchema: t,
|
|
57
|
+
texts: H,
|
|
58
|
+
readonly: j,
|
|
59
|
+
defaultExpanded: m,
|
|
60
|
+
inputClassName: A,
|
|
61
|
+
acceptableResourceTypes: E,
|
|
62
|
+
renderField: D,
|
|
63
|
+
touchedPaths: C,
|
|
64
|
+
markTouched: w,
|
|
65
|
+
skipUntouched: S
|
|
66
|
+
},
|
|
67
|
+
children: /* @__PURE__ */ h(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: ee(
|
|
71
|
+
"flex flex-col gap-4",
|
|
72
|
+
N,
|
|
73
|
+
Y.schemaRenderer
|
|
74
|
+
),
|
|
75
|
+
children: [
|
|
76
|
+
J.map(([e, r]) => {
|
|
77
|
+
const o = P(r, t), s = o.title ?? r.title ?? R(e), a = X.includes(e), i = n[e], u = (G) => v(e, G);
|
|
78
|
+
if (d === c.Flat)
|
|
79
|
+
return /* @__PURE__ */ l(
|
|
80
|
+
re,
|
|
81
|
+
{
|
|
82
|
+
schema: r,
|
|
83
|
+
value: i,
|
|
84
|
+
onChange: u,
|
|
85
|
+
path: [e],
|
|
86
|
+
level: 0,
|
|
87
|
+
required: a,
|
|
88
|
+
label: s
|
|
89
|
+
},
|
|
90
|
+
e
|
|
91
|
+
);
|
|
92
|
+
if (d === c.FlatSections)
|
|
93
|
+
return /* @__PURE__ */ h("section", { className: "flex flex-col gap-3", children: [
|
|
94
|
+
/* @__PURE__ */ l("h2", { className: F, children: s }),
|
|
95
|
+
/* @__PURE__ */ l(
|
|
96
|
+
q,
|
|
97
|
+
{
|
|
98
|
+
schema: r,
|
|
99
|
+
value: i,
|
|
100
|
+
onChange: u,
|
|
101
|
+
path: [e],
|
|
102
|
+
level: 0,
|
|
103
|
+
required: a,
|
|
104
|
+
ariaLabel: s
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] }, e);
|
|
108
|
+
const x = y(i, o, t, e), z = a && k(i) ? Math.max(x.length, 1) : x.length;
|
|
109
|
+
return /* @__PURE__ */ l(
|
|
110
|
+
T,
|
|
111
|
+
{
|
|
112
|
+
title: s,
|
|
113
|
+
description: o.description,
|
|
114
|
+
level: 0,
|
|
115
|
+
defaultExpanded: m,
|
|
116
|
+
errorCount: le(e, C, S, !0) ? z : 0,
|
|
117
|
+
children: /* @__PURE__ */ l(
|
|
118
|
+
q,
|
|
119
|
+
{
|
|
120
|
+
schema: r,
|
|
121
|
+
value: i,
|
|
122
|
+
onChange: u,
|
|
123
|
+
path: [e],
|
|
124
|
+
level: 1,
|
|
125
|
+
required: a,
|
|
126
|
+
ariaLabel: s
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
},
|
|
130
|
+
e
|
|
131
|
+
);
|
|
132
|
+
}),
|
|
133
|
+
B.map((e) => {
|
|
134
|
+
const r = R(e), o = /* @__PURE__ */ l(
|
|
135
|
+
te,
|
|
136
|
+
{
|
|
137
|
+
value: n[e],
|
|
138
|
+
onChange: (s) => v(e, s),
|
|
139
|
+
ariaLabel: r
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
return d === c.Sections ? /* @__PURE__ */ l(
|
|
143
|
+
T,
|
|
144
|
+
{
|
|
145
|
+
title: r,
|
|
146
|
+
level: 0,
|
|
147
|
+
defaultExpanded: m,
|
|
148
|
+
children: o
|
|
149
|
+
},
|
|
150
|
+
e
|
|
151
|
+
) : /* @__PURE__ */ h("section", { className: "flex flex-col gap-3", children: [
|
|
152
|
+
/* @__PURE__ */ l("h2", { className: F, children: r }),
|
|
153
|
+
o
|
|
154
|
+
] }, e);
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
export {
|
|
163
|
+
ge as SchemaRenderer
|
|
164
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs as v, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Select as O } from "../../Select/Select.js";
|
|
3
|
+
import { JsonSchemaType as t } from "../../../../types/json-schema.js";
|
|
4
|
+
import { detectAnyOfVariant as A, resolveRef as d, getOptionLabel as E, extractDefaults as T } from "../../../../utils/json-schema.js";
|
|
5
|
+
import { useSchemaContext as P } from "../context.js";
|
|
6
|
+
import { SchemaFieldContent as Y } from "./SchemaFieldContent.js";
|
|
7
|
+
const y = {
|
|
8
|
+
[t.Array]: [],
|
|
9
|
+
[t.String]: "",
|
|
10
|
+
[t.Boolean]: !1,
|
|
11
|
+
[t.Integer]: 0,
|
|
12
|
+
[t.Number]: 0
|
|
13
|
+
}, V = ({
|
|
14
|
+
schema: u,
|
|
15
|
+
value: c,
|
|
16
|
+
onChange: l,
|
|
17
|
+
path: h,
|
|
18
|
+
level: S,
|
|
19
|
+
ariaLabel: m
|
|
20
|
+
}) => {
|
|
21
|
+
const { rootSchema: o, texts: x, readonly: N = !1 } = P(), s = u.anyOf ?? [], i = A(c, s, o), a = s[i], b = !a || d(a, o).type === t.Null, g = (e) => {
|
|
22
|
+
const r = d(s[e], o);
|
|
23
|
+
if (r.type === t.Null) {
|
|
24
|
+
l(null);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const p = T(r, o);
|
|
28
|
+
if (p !== void 0) {
|
|
29
|
+
l(p);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const f = typeof r.type == "string" ? r.type : "";
|
|
33
|
+
l(f in y ? y[f] : {});
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ v("div", { className: "flex flex-col gap-3", children: [
|
|
36
|
+
/* @__PURE__ */ n(
|
|
37
|
+
O,
|
|
38
|
+
{
|
|
39
|
+
ariaLabel: m ?? x.selectTypePlaceholder,
|
|
40
|
+
options: s.map((e, r) => ({
|
|
41
|
+
value: String(r),
|
|
42
|
+
label: E(e, o)
|
|
43
|
+
})),
|
|
44
|
+
value: String(i),
|
|
45
|
+
disabled: N,
|
|
46
|
+
onChange: (e) => g(Number(typeof e == "string" ? e : e[0])),
|
|
47
|
+
className: "max-w-[280px]"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
!b && /* @__PURE__ */ n("div", { className: "border-l-2 border-tertiary pl-3", children: /* @__PURE__ */ n(
|
|
51
|
+
Y,
|
|
52
|
+
{
|
|
53
|
+
schema: a,
|
|
54
|
+
value: c,
|
|
55
|
+
onChange: l,
|
|
56
|
+
path: h,
|
|
57
|
+
level: S,
|
|
58
|
+
ariaLabel: m
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
] });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
V as SchemaAnyOfEditor
|
|
65
|
+
};
|
|
@@ -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
|
+
};
|