@intlayer/design-system 5.1.3 → 5.1.5
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/dist/.vite/manifest.json +37 -102
- package/dist/Form-BZUDRfoN.js.map +1 -1
- package/dist/Form-yi0CMK-a.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
- package/dist/components/Command/index.d.ts +1 -1
- package/dist/components/Container/index.cjs +6 -7
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +6 -7
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +33 -20
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +34 -21
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +20 -9
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +21 -10
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +241 -209
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +245 -213
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +92 -120
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +94 -122
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +0 -3
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +19 -13
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +52 -103
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +3 -3
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +56 -107
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +3 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.cjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts +0 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.mjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +0 -1
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.d.ts +1 -4
- package/dist/components/Form/FormBase.d.ts.map +1 -1
- package/dist/components/Form/FormBase.mjs +0 -1
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.cjs +0 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.mjs +0 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts +3 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -0
- package/dist/components/MaxHeightSmoother/index.cjs +3 -1
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs +3 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +15 -13
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +15 -13
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs +0 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/Select/Multiselect.mjs +1 -2
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs +0 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.mjs +0 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useKeyboardDetector.cjs +27 -0
- package/dist/hooks/useKeyboardDetector.cjs.map +1 -0
- package/dist/hooks/useKeyboardDetector.d.ts +5 -0
- package/dist/hooks/useKeyboardDetector.d.ts.map +1 -0
- package/dist/hooks/useKeyboardDetector.mjs +27 -0
- package/dist/hooks/useKeyboardDetector.mjs.map +1 -0
- package/dist/{index-BTDHuTxL.js → index-B1w5h_6-.js} +7 -7
- package/dist/index-B1w5h_6-.js.map +1 -0
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/{index-Db5Dym4h.cjs → index-U1U6ySIn.cjs} +7 -7
- package/dist/index-U1U6ySIn.cjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/dist/zod-BV4nCGJE.js.map +1 -1
- package/dist/zod-DSrtTSD_.cjs.map +1 -1
- package/package.json +19 -19
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts +0 -10
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs.map +0 -1
- package/dist/index-BTDHuTxL.js.map +0 -1
- package/dist/index-Db5Dym4h.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx,
|
|
3
|
-
import { getNodeType, NodeType, getLocaleName } from "@intlayer/core";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { getNodeType, NodeType, getLocaleName, getEmptyNode } from "@intlayer/core";
|
|
4
4
|
import { useEditedContent, useConfiguration } from "@intlayer/editor-react";
|
|
5
|
-
import {
|
|
6
|
-
import { useState } from "react";
|
|
5
|
+
import { Trash, Plus, WandSparkles } from "lucide-react";
|
|
6
|
+
import { Fragment as Fragment$1, useState } from "react";
|
|
7
7
|
import { useDictionary, useLocale } from "react-intlayer";
|
|
8
8
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
9
9
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
@@ -11,12 +11,12 @@ import { useAuditContentDeclarationField } from "../../../hooks/intlayerAPIHooks
|
|
|
11
11
|
import "deepmerge";
|
|
12
12
|
import { renameKey } from "../../../utils/object.mjs";
|
|
13
13
|
import { Button } from "../../Button/Button.mjs";
|
|
14
|
+
import { Container } from "../../Container/index.mjs";
|
|
14
15
|
import { ContentEditorInput as ContentEditorInput$1 } from "../../ContentEditor/ContentEditorInput.mjs";
|
|
15
16
|
import { ContentEditorTextArea as ContentEditorTextArea$1 } from "../../ContentEditor/ContentEditorTextArea.mjs";
|
|
16
17
|
import { Label } from "../../Label/index.mjs";
|
|
17
18
|
import "@intlayer/config/client";
|
|
18
19
|
import "fuse.js";
|
|
19
|
-
import "../../Container/index.mjs";
|
|
20
20
|
import "../../DropDown/index.mjs";
|
|
21
21
|
import "../../Input/Input.mjs";
|
|
22
22
|
import "../../Input/Checkbox.mjs";
|
|
@@ -25,7 +25,6 @@ import "../../LocaleSwitcherContentDropDown/localeSwitcher.content.mjs";
|
|
|
25
25
|
import { useLocaleSwitcherContent } from "../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
|
|
26
26
|
import { MarkdownRenderer } from "../../MarkDownRender/index.mjs";
|
|
27
27
|
import { EnumKeyInput } from "../EnumKeyInput.mjs";
|
|
28
|
-
import { getIsEditableSection } from "../getIsEditableSection.mjs";
|
|
29
28
|
import { navigationViewContent } from "../NavigationView/navigationViewNode.content.mjs";
|
|
30
29
|
const traceKeys = ["filePath", "id", "nodeType"];
|
|
31
30
|
const ContentEditorTextArea = ({
|
|
@@ -33,7 +32,7 @@ const ContentEditorTextArea = ({
|
|
|
33
32
|
dictionary,
|
|
34
33
|
...props
|
|
35
34
|
}) => {
|
|
36
|
-
const { addEditedContent } = useEditedContent();
|
|
35
|
+
const { editedContent, addEditedContent } = useEditedContent();
|
|
37
36
|
const configuration = useConfiguration();
|
|
38
37
|
const { auditContentDeclarationField, isLoading: isAuditing } = useAuditContentDeclarationField();
|
|
39
38
|
return /* @__PURE__ */ jsx(
|
|
@@ -53,14 +52,17 @@ const ContentEditorTextArea = ({
|
|
|
53
52
|
isLoading: isAuditing,
|
|
54
53
|
onClick: () => {
|
|
55
54
|
auditContentDeclarationField({
|
|
56
|
-
fileContent: JSON.stringify(
|
|
55
|
+
fileContent: JSON.stringify({
|
|
56
|
+
...dictionary,
|
|
57
|
+
...editedContent?.[dictionary.key] ?? {}
|
|
58
|
+
}),
|
|
57
59
|
keyPath,
|
|
58
60
|
locales: configuration.internationalization.locales ?? []
|
|
59
61
|
}).then((response) => {
|
|
60
|
-
if (!response
|
|
62
|
+
if (!response?.data) return;
|
|
61
63
|
try {
|
|
62
|
-
const
|
|
63
|
-
addEditedContent(dictionary.key,
|
|
64
|
+
const editedContent2 = response.data.fileContent;
|
|
65
|
+
addEditedContent(dictionary.key, editedContent2, keyPath);
|
|
64
66
|
} catch (error) {
|
|
65
67
|
console.error(error);
|
|
66
68
|
}
|
|
@@ -120,7 +122,7 @@ const TranslationTextEditor = ({
|
|
|
120
122
|
keyPath,
|
|
121
123
|
dictionary
|
|
122
124
|
}) => {
|
|
123
|
-
const { locale } = useLocale();
|
|
125
|
+
const { locale, defaultLocale } = useLocale();
|
|
124
126
|
const { selectedLocales, availableLocales } = useLocaleSwitcherContent();
|
|
125
127
|
const sectionContent = section[NodeType.Translation];
|
|
126
128
|
const sectionContentKeys = Object.keys(sectionContent);
|
|
@@ -129,20 +131,21 @@ const TranslationTextEditor = ({
|
|
|
129
131
|
// If the translation include content in other locales, we display all of them
|
|
130
132
|
[.../* @__PURE__ */ new Set([...availableLocales, ...sectionContentKeys])]
|
|
131
133
|
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ jsx(
|
|
135
|
-
|
|
134
|
+
const content = section[NodeType.Translation];
|
|
135
|
+
return /* @__PURE__ */ jsx("table", { className: "w-full", children: /* @__PURE__ */ jsx("tbody", { className: "flex w-full flex-col gap-2", children: localesList.map((translationKey) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
136
|
+
/* @__PURE__ */ jsx("tr", { className: "mt-2 w-full p-2 text-xs", children: getLocaleName(translationKey, locale) }),
|
|
137
|
+
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
138
|
+
TextEditorContainer,
|
|
136
139
|
{
|
|
137
|
-
section:
|
|
140
|
+
section: content[translationKey] ?? getEmptyNode(content[defaultLocale]),
|
|
138
141
|
keyPath: [
|
|
139
142
|
...keyPath,
|
|
140
143
|
{ type: NodeType.Translation, key: translationKey }
|
|
141
144
|
],
|
|
142
145
|
dictionary
|
|
143
146
|
}
|
|
144
|
-
)
|
|
145
|
-
] }
|
|
147
|
+
) })
|
|
148
|
+
] }, translationKey)) }) });
|
|
146
149
|
};
|
|
147
150
|
const EnumerationTextEditor = ({
|
|
148
151
|
section,
|
|
@@ -150,31 +153,37 @@ const EnumerationTextEditor = ({
|
|
|
150
153
|
dictionary
|
|
151
154
|
}) => {
|
|
152
155
|
const { addEditedContent } = useEditedContent();
|
|
153
|
-
const { addNewEnumeration } = useDictionary(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
const { addNewEnumeration, removeEnumeration } = useDictionary(
|
|
157
|
+
navigationViewContent
|
|
158
|
+
);
|
|
159
|
+
const content = section[NodeType.Enumeration];
|
|
160
|
+
const firstKey = Object.keys(content)[0];
|
|
161
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ jsx("table", { className: "w-full", children: /* @__PURE__ */ jsx("tbody", { className: "flex w-full flex-col gap-2", children: Object.keys(
|
|
156
163
|
section[NodeType.Enumeration]
|
|
157
|
-
).map((enumKey) =>
|
|
158
|
-
|
|
159
|
-
|
|
164
|
+
).map((enumKey) => {
|
|
165
|
+
const childrenKeyPath = [
|
|
166
|
+
...keyPath,
|
|
167
|
+
{ type: NodeType.Enumeration }
|
|
168
|
+
];
|
|
169
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx("tr", { className: "mt-2 w-full", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1", children: /* @__PURE__ */ jsx(
|
|
160
171
|
Button,
|
|
161
172
|
{
|
|
162
|
-
label:
|
|
173
|
+
label: removeEnumeration.label.value,
|
|
163
174
|
variant: "hoverable",
|
|
164
|
-
size: "icon-md",
|
|
165
175
|
color: "text",
|
|
166
|
-
Icon:
|
|
167
|
-
className: "
|
|
168
|
-
onClick: () => addEditedContent(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
])
|
|
176
|
+
Icon: Trash,
|
|
177
|
+
className: "ml-auto",
|
|
178
|
+
onClick: () => addEditedContent(
|
|
179
|
+
dictionary.key,
|
|
180
|
+
void 0,
|
|
181
|
+
childrenKeyPath
|
|
182
|
+
),
|
|
183
|
+
children: removeEnumeration.text
|
|
175
184
|
}
|
|
176
|
-
),
|
|
177
|
-
/* @__PURE__ */ jsx(
|
|
185
|
+
) }) }),
|
|
186
|
+
/* @__PURE__ */ jsx("tr", { className: "w-full p-2", children: /* @__PURE__ */ jsx(
|
|
178
187
|
EnumKeyInput,
|
|
179
188
|
{
|
|
180
189
|
value: enumKey,
|
|
@@ -192,38 +201,35 @@ const EnumerationTextEditor = ({
|
|
|
192
201
|
addEditedContent(dictionary.key, newValue, keyPath);
|
|
193
202
|
}
|
|
194
203
|
}
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
) })
|
|
208
|
-
] }, enumKey)) }),
|
|
209
|
-
/* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsx(
|
|
204
|
+
) }),
|
|
205
|
+
/* @__PURE__ */ jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsx(
|
|
206
|
+
TextEditor,
|
|
207
|
+
{
|
|
208
|
+
section: content[enumKey] ?? getEmptyNode(content[firstKey]),
|
|
209
|
+
keyPath: childrenKeyPath,
|
|
210
|
+
dictionary
|
|
211
|
+
}
|
|
212
|
+
) })
|
|
213
|
+
] }, enumKey);
|
|
214
|
+
}) }) }),
|
|
215
|
+
/* @__PURE__ */ jsx(
|
|
210
216
|
Button,
|
|
211
217
|
{
|
|
212
218
|
label: addNewEnumeration.label.value,
|
|
213
219
|
variant: "hoverable",
|
|
214
220
|
color: "neutral",
|
|
215
221
|
textAlign: "left",
|
|
222
|
+
isFullWidth: true,
|
|
216
223
|
onClick: () => addEditedContent(
|
|
217
224
|
dictionary.key,
|
|
218
|
-
"",
|
|
219
|
-
[...keyPath, { type: NodeType.Enumeration, key: "unknown" }]
|
|
220
|
-
false
|
|
225
|
+
getEmptyNode(content[firstKey]) ?? "",
|
|
226
|
+
[...keyPath, { type: NodeType.Enumeration, key: "unknown" }]
|
|
221
227
|
),
|
|
222
228
|
Icon: Plus,
|
|
223
229
|
className: "m-2",
|
|
224
230
|
children: addNewEnumeration.text
|
|
225
231
|
}
|
|
226
|
-
)
|
|
232
|
+
)
|
|
227
233
|
] });
|
|
228
234
|
};
|
|
229
235
|
const ConditionTextEditor = ({
|
|
@@ -231,83 +237,24 @@ const ConditionTextEditor = ({
|
|
|
231
237
|
keyPath,
|
|
232
238
|
dictionary
|
|
233
239
|
}) => {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
/* @__PURE__ */ jsx("
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
const content = section[NodeType.Condition];
|
|
241
|
+
return /* @__PURE__ */ jsx("table", { className: "w-full", children: /* @__PURE__ */ jsx("tbody", { className: "flex w-full flex-col gap-2", children: ["true", "false", "fallback"].map((condKey) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
242
|
+
/* @__PURE__ */ jsx("tr", { className: "mt-2 block w-full p-2 text-xs", children: String(condKey) }, condKey),
|
|
243
|
+
/* @__PURE__ */ jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsx(
|
|
244
|
+
TextEditorContainer,
|
|
245
|
+
{
|
|
246
|
+
section: content[condKey] ?? getEmptyNode(content["true"]),
|
|
247
|
+
keyPath: [
|
|
248
|
+
...keyPath,
|
|
241
249
|
{
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
size: "icon-md",
|
|
245
|
-
color: "text",
|
|
246
|
-
Icon: X,
|
|
247
|
-
className: "w-16",
|
|
248
|
-
onClick: () => addEditedContent(dictionary.key, void 0, [
|
|
249
|
-
...keyPath,
|
|
250
|
-
{
|
|
251
|
-
type: NodeType.Condition,
|
|
252
|
-
key: condKey
|
|
253
|
-
}
|
|
254
|
-
])
|
|
250
|
+
type: NodeType.Condition,
|
|
251
|
+
key: condKey
|
|
255
252
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
EnumKeyInput,
|
|
259
|
-
{
|
|
260
|
-
value: condKey,
|
|
261
|
-
onChange: (value) => {
|
|
262
|
-
const preValueContent = section[NodeType.Condition];
|
|
263
|
-
const newValueContent = renameKey(
|
|
264
|
-
preValueContent,
|
|
265
|
-
condKey,
|
|
266
|
-
value
|
|
267
|
-
);
|
|
268
|
-
const newValue = {
|
|
269
|
-
...section,
|
|
270
|
-
[NodeType.Condition]: newValueContent
|
|
271
|
-
};
|
|
272
|
-
addEditedContent(dictionary.key, newValue, keyPath);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
] }) }),
|
|
277
|
-
/* @__PURE__ */ jsx("td", { className: "w-full p-2", children: /* @__PURE__ */ jsx(
|
|
278
|
-
TextEditor,
|
|
279
|
-
{
|
|
280
|
-
section: section[NodeType.Enumeration][condKey],
|
|
281
|
-
keyPath: [
|
|
282
|
-
...keyPath,
|
|
283
|
-
{
|
|
284
|
-
type: NodeType.Array,
|
|
285
|
-
key: parseInt(condKey)
|
|
286
|
-
}
|
|
287
|
-
],
|
|
288
|
-
dictionary
|
|
289
|
-
}
|
|
290
|
-
) })
|
|
291
|
-
] }, condKey)) }),
|
|
292
|
-
/* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsx(
|
|
293
|
-
Button,
|
|
294
|
-
{
|
|
295
|
-
label: addNewEnumeration.label.value,
|
|
296
|
-
variant: "hoverable",
|
|
297
|
-
color: "neutral",
|
|
298
|
-
textAlign: "left",
|
|
299
|
-
onClick: () => addEditedContent(
|
|
300
|
-
dictionary.key,
|
|
301
|
-
"",
|
|
302
|
-
[...keyPath, { type: NodeType.Enumeration, key: "unknown" }],
|
|
303
|
-
false
|
|
304
|
-
),
|
|
305
|
-
Icon: Plus,
|
|
306
|
-
className: "m-2",
|
|
307
|
-
children: addNewEnumeration.text
|
|
253
|
+
],
|
|
254
|
+
dictionary
|
|
308
255
|
}
|
|
309
|
-
) })
|
|
310
|
-
] });
|
|
256
|
+
) }, condKey)
|
|
257
|
+
] }, condKey)) }) });
|
|
311
258
|
};
|
|
312
259
|
const ArrayTextEditor = ({
|
|
313
260
|
section,
|
|
@@ -315,14 +262,38 @@ const ArrayTextEditor = ({
|
|
|
315
262
|
dictionary
|
|
316
263
|
}) => {
|
|
317
264
|
const { addEditedContent } = useEditedContent();
|
|
318
|
-
const { addNewElement } = useDictionary(navigationViewContent);
|
|
319
|
-
return /* @__PURE__ */ jsxs("
|
|
320
|
-
/* @__PURE__ */ jsx("tbody", { className: "
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
-
|
|
323
|
-
|
|
265
|
+
const { addNewElement, removeElement } = useDictionary(navigationViewContent);
|
|
266
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
267
|
+
/* @__PURE__ */ jsx("table", { className: "w-full", children: /* @__PURE__ */ jsx("tbody", { className: "flex w-full flex-col gap-2", children: section.map((subSection, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
268
|
+
/* @__PURE__ */ jsxs("tr", { className: "mt-2 flex w-full justify-between gap-2 p-2", children: [
|
|
269
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs", children: String(index) }),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
Button,
|
|
272
|
+
{
|
|
273
|
+
label: removeElement.label.value,
|
|
274
|
+
variant: "hoverable",
|
|
275
|
+
color: "neutral",
|
|
276
|
+
className: "ml-auto",
|
|
277
|
+
textAlign: "left",
|
|
278
|
+
onClick: () => {
|
|
279
|
+
const newKeyPath = [
|
|
280
|
+
...keyPath,
|
|
281
|
+
{
|
|
282
|
+
type: NodeType.Array,
|
|
283
|
+
key: section.length
|
|
284
|
+
}
|
|
285
|
+
];
|
|
286
|
+
addEditedContent(dictionary.key, void 0, newKeyPath);
|
|
287
|
+
},
|
|
288
|
+
Icon: Trash,
|
|
289
|
+
children: removeElement.text
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsx(
|
|
294
|
+
TextEditorContainer,
|
|
324
295
|
{
|
|
325
|
-
section: subSection,
|
|
296
|
+
section: subSection ?? getEmptyNode(section[0]),
|
|
326
297
|
keyPath: [
|
|
327
298
|
...keyPath,
|
|
328
299
|
{
|
|
@@ -333,14 +304,15 @@ const ArrayTextEditor = ({
|
|
|
333
304
|
dictionary
|
|
334
305
|
}
|
|
335
306
|
) })
|
|
336
|
-
] }, JSON.stringify(subSection))) }),
|
|
337
|
-
/* @__PURE__ */ jsx(
|
|
307
|
+
] }, JSON.stringify(subSection))) }) }),
|
|
308
|
+
/* @__PURE__ */ jsx(
|
|
338
309
|
Button,
|
|
339
310
|
{
|
|
340
311
|
label: addNewElement.label.value,
|
|
341
312
|
variant: "hoverable",
|
|
342
313
|
color: "neutral",
|
|
343
314
|
textAlign: "left",
|
|
315
|
+
isFullWidth: true,
|
|
344
316
|
onClick: () => {
|
|
345
317
|
const newKeyPath = [
|
|
346
318
|
...keyPath,
|
|
@@ -349,14 +321,54 @@ const ArrayTextEditor = ({
|
|
|
349
321
|
key: section.length
|
|
350
322
|
}
|
|
351
323
|
];
|
|
352
|
-
addEditedContent(
|
|
324
|
+
addEditedContent(
|
|
325
|
+
dictionary.key,
|
|
326
|
+
getEmptyNode(section[0]) ?? "",
|
|
327
|
+
newKeyPath,
|
|
328
|
+
false
|
|
329
|
+
);
|
|
353
330
|
},
|
|
354
331
|
Icon: Plus,
|
|
355
332
|
children: addNewElement.text
|
|
356
333
|
}
|
|
357
|
-
)
|
|
334
|
+
)
|
|
358
335
|
] });
|
|
359
336
|
};
|
|
337
|
+
const ObjectTextEditor = ({
|
|
338
|
+
section,
|
|
339
|
+
keyPath,
|
|
340
|
+
dictionary
|
|
341
|
+
}) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("table", { className: "w-full", children: /* @__PURE__ */ jsx("tbody", { className: "flex flex-col gap-2", children: Object.keys(section).map(
|
|
342
|
+
(key) => {
|
|
343
|
+
const childKeyPath = [
|
|
344
|
+
...keyPath,
|
|
345
|
+
{ type: NodeType.Object, key }
|
|
346
|
+
];
|
|
347
|
+
const typedSection = section;
|
|
348
|
+
const firstKey = Object.keys(
|
|
349
|
+
typedSection
|
|
350
|
+
)[0];
|
|
351
|
+
const subSection = typedSection[key] ?? getEmptyNode(typedSection[firstKey]);
|
|
352
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
353
|
+
/* @__PURE__ */ jsx(
|
|
354
|
+
"tr",
|
|
355
|
+
{
|
|
356
|
+
className: "mt-2 p-2 text-xs",
|
|
357
|
+
children: String(key)
|
|
358
|
+
},
|
|
359
|
+
JSON.stringify(subSection)
|
|
360
|
+
),
|
|
361
|
+
/* @__PURE__ */ jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsx(
|
|
362
|
+
TextEditor,
|
|
363
|
+
{
|
|
364
|
+
section: subSection,
|
|
365
|
+
keyPath: childKeyPath,
|
|
366
|
+
dictionary
|
|
367
|
+
}
|
|
368
|
+
) }, JSON.stringify(subSection))
|
|
369
|
+
] }, key);
|
|
370
|
+
}
|
|
371
|
+
) }) }) });
|
|
360
372
|
const MarkdownTextEditor = ({
|
|
361
373
|
section,
|
|
362
374
|
keyPath,
|
|
@@ -467,76 +479,82 @@ const TextEditor = ({
|
|
|
467
479
|
}) => {
|
|
468
480
|
const { tsxNotEditable } = useDictionary(navigationViewContent);
|
|
469
481
|
const nodeType = getNodeType(section);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
482
|
+
if (nodeType === NodeType.ReactNode) {
|
|
483
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
484
|
+
/* @__PURE__ */ jsx("span", { children: "[React Node]" }),
|
|
485
|
+
/* @__PURE__ */ jsx("span", { className: "text-neutral dark:text-neutral-dark text-xs", children: tsxNotEditable })
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
488
|
+
if (nodeType === NodeType.Nested) {
|
|
489
|
+
return /* @__PURE__ */ jsx(
|
|
490
|
+
NestedTextEditor,
|
|
491
|
+
{
|
|
492
|
+
dictionary,
|
|
493
|
+
keyPath,
|
|
494
|
+
section
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
if (nodeType === NodeType.Translation) {
|
|
499
|
+
return /* @__PURE__ */ jsx(
|
|
500
|
+
TranslationTextEditor,
|
|
501
|
+
{
|
|
502
|
+
dictionary,
|
|
503
|
+
keyPath,
|
|
504
|
+
section
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
if (nodeType === NodeType.Enumeration) {
|
|
509
|
+
return /* @__PURE__ */ jsx(
|
|
510
|
+
EnumerationTextEditor,
|
|
511
|
+
{
|
|
512
|
+
dictionary,
|
|
513
|
+
keyPath,
|
|
514
|
+
section
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
if (nodeType === NodeType.Condition) {
|
|
519
|
+
return /* @__PURE__ */ jsx(
|
|
520
|
+
ConditionTextEditor,
|
|
521
|
+
{
|
|
522
|
+
dictionary,
|
|
523
|
+
keyPath,
|
|
524
|
+
section
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
if (nodeType === NodeType.Markdown) {
|
|
529
|
+
return /* @__PURE__ */ jsx(
|
|
530
|
+
MarkdownTextEditor,
|
|
531
|
+
{
|
|
532
|
+
dictionary,
|
|
533
|
+
keyPath,
|
|
534
|
+
section,
|
|
535
|
+
isDarkMode
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
if (nodeType === NodeType.Array) {
|
|
540
|
+
return /* @__PURE__ */ jsx(
|
|
541
|
+
ArrayTextEditor,
|
|
542
|
+
{
|
|
543
|
+
dictionary,
|
|
544
|
+
keyPath,
|
|
545
|
+
section
|
|
546
|
+
}
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
if (nodeType === NodeType.Object) {
|
|
550
|
+
return /* @__PURE__ */ jsx(
|
|
551
|
+
ObjectTextEditor,
|
|
552
|
+
{
|
|
553
|
+
dictionary,
|
|
554
|
+
keyPath,
|
|
555
|
+
section
|
|
556
|
+
}
|
|
557
|
+
);
|
|
540
558
|
}
|
|
541
559
|
if (nodeType === NodeType.Number) {
|
|
542
560
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-2", children: /* @__PURE__ */ jsx(
|
|
@@ -574,11 +592,25 @@ const TextEditor = ({
|
|
|
574
592
|
}
|
|
575
593
|
return /* @__PURE__ */ jsxs("div", { className: "w-full p-2", children: [
|
|
576
594
|
"Error. Format not supported.",
|
|
577
|
-
JSON.stringify(section)
|
|
595
|
+
JSON.stringify(section, null, 2),
|
|
596
|
+
JSON.stringify(keyPath, null, 2),
|
|
597
|
+
"NodeType : ",
|
|
598
|
+
nodeType
|
|
578
599
|
] });
|
|
579
600
|
};
|
|
601
|
+
const TextEditorContainer = (props) => /* @__PURE__ */ jsx(
|
|
602
|
+
Container,
|
|
603
|
+
{
|
|
604
|
+
border: true,
|
|
605
|
+
background: "none",
|
|
606
|
+
className: "top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky",
|
|
607
|
+
roundedSize: "xl",
|
|
608
|
+
children: /* @__PURE__ */ jsx(TextEditor, { ...props })
|
|
609
|
+
}
|
|
610
|
+
);
|
|
580
611
|
export {
|
|
581
612
|
TextEditor,
|
|
613
|
+
TextEditorContainer,
|
|
582
614
|
traceKeys
|
|
583
615
|
};
|
|
584
616
|
//# sourceMappingURL=TextEditor.mjs.map
|