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