@intlayer/design-system 7.0.8 → 7.0.9-canary.2

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 (363) hide show
  1. package/README.md +4 -4
  2. package/dist/esm/components/Accordion/Accordion.mjs +1 -1
  3. package/dist/esm/components/Accordion/Accordion.mjs.map +1 -1
  4. package/dist/esm/components/Avatar/index.mjs +2 -2
  5. package/dist/esm/components/Avatar/index.mjs.map +1 -1
  6. package/dist/esm/components/Badge/index.mjs +1 -1
  7. package/dist/esm/components/Badge/index.mjs.map +1 -1
  8. package/dist/esm/components/Breadcrumb/index.mjs +4 -4
  9. package/dist/esm/components/Breadcrumb/index.mjs.map +1 -1
  10. package/dist/esm/components/Button/Button.mjs +99 -88
  11. package/dist/esm/components/Button/Button.mjs.map +1 -1
  12. package/dist/esm/components/Button/index.mjs +2 -2
  13. package/dist/esm/components/ClickOutsideDiv/index.mjs +1 -1
  14. package/dist/esm/components/ClickOutsideDiv/index.mjs.map +1 -1
  15. package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs +1 -1
  16. package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs.map +1 -1
  17. package/dist/esm/components/Command/index.mjs +8 -8
  18. package/dist/esm/components/Command/index.mjs.map +1 -1
  19. package/dist/esm/components/Container/index.mjs +14 -13
  20. package/dist/esm/components/Container/index.mjs.map +1 -1
  21. package/dist/esm/components/ContentEditor/ContentEditor.mjs +1 -1
  22. package/dist/esm/components/ContentEditor/ContentEditor.mjs.map +1 -1
  23. package/dist/esm/components/ContentEditor/ContentEditorInput.mjs +1 -1
  24. package/dist/esm/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
  25. package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
  26. package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  27. package/dist/esm/components/CopyButton/index.mjs +1 -1
  28. package/dist/esm/components/CopyButton/index.mjs.map +1 -1
  29. package/dist/esm/components/CopyToClipboard/index.mjs +29 -27
  30. package/dist/esm/components/CopyToClipboard/index.mjs.map +1 -1
  31. package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
  32. package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  33. package/dist/esm/components/DictionaryEditor/ItemLayout.mjs +6 -3
  34. package/dist/esm/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
  35. package/dist/esm/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs +2 -1
  36. package/dist/esm/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs.map +1 -1
  37. package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +40 -22
  38. package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
  39. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
  40. package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs +2 -1
  41. package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
  42. package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
  43. package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  44. package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
  45. package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  46. package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
  47. package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
  48. package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +1 -1
  49. package/dist/esm/components/DropDown/index.mjs +3 -3
  50. package/dist/esm/components/DropDown/index.mjs.map +1 -1
  51. package/dist/esm/components/EditableField/EditableFieldInput.mjs +1 -1
  52. package/dist/esm/components/EditableField/EditableFieldInput.mjs.map +1 -1
  53. package/dist/esm/components/EditableField/EditableFieldLayout.mjs +1 -1
  54. package/dist/esm/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  55. package/dist/esm/components/EditableField/EditableFieldTextArea.mjs +1 -1
  56. package/dist/esm/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  57. package/dist/esm/components/Flags/Flag.mjs +1 -1
  58. package/dist/esm/components/Flags/Flag.mjs.map +1 -1
  59. package/dist/esm/components/Form/Form.mjs +4 -0
  60. package/dist/esm/components/Form/Form.mjs.map +1 -1
  61. package/dist/esm/components/Form/FormBase.mjs +1 -1
  62. package/dist/esm/components/Form/FormBase.mjs.map +1 -1
  63. package/dist/esm/components/Form/FormItem.mjs +1 -1
  64. package/dist/esm/components/Form/FormItem.mjs.map +1 -1
  65. package/dist/esm/components/Form/FormLabel.mjs +1 -1
  66. package/dist/esm/components/Form/FormLabel.mjs.map +1 -1
  67. package/dist/esm/components/Form/FormMessage.mjs +1 -1
  68. package/dist/esm/components/Form/FormMessage.mjs.map +1 -1
  69. package/dist/esm/components/Form/elements/AutoSizeTextAreaElement.mjs.map +1 -1
  70. package/dist/esm/components/Form/elements/CheckboxElement.mjs +2 -2
  71. package/dist/esm/components/Form/elements/CheckboxElement.mjs.map +1 -1
  72. package/dist/esm/components/Form/elements/CodeInputElement.mjs +40 -0
  73. package/dist/esm/components/Form/elements/CodeInputElement.mjs.map +1 -0
  74. package/dist/esm/components/Form/elements/FormElement.mjs +2 -2
  75. package/dist/esm/components/Form/elements/FormElement.mjs.map +1 -1
  76. package/dist/esm/components/Form/elements/FormElementWrapper.mjs +1 -1
  77. package/dist/esm/components/Form/elements/FormElementWrapper.mjs.map +1 -1
  78. package/dist/esm/components/Form/elements/InputPasswordElement.mjs +1 -1
  79. package/dist/esm/components/Form/elements/InputPasswordElement.mjs.map +1 -1
  80. package/dist/esm/components/Form/elements/MultiselectElement.mjs +30 -19
  81. package/dist/esm/components/Form/elements/MultiselectElement.mjs.map +1 -1
  82. package/dist/esm/components/Form/elements/OTPElement.mjs +114 -0
  83. package/dist/esm/components/Form/elements/OTPElement.mjs.map +1 -0
  84. package/dist/esm/components/Form/elements/SearchInputElement.mjs +17 -0
  85. package/dist/esm/components/Form/elements/SearchInputElement.mjs.map +1 -0
  86. package/dist/esm/components/Form/elements/SelectElement.mjs +30 -19
  87. package/dist/esm/components/Form/elements/SelectElement.mjs.map +1 -1
  88. package/dist/esm/components/Form/elements/SwitchSelectorElement.mjs +29 -18
  89. package/dist/esm/components/Form/elements/SwitchSelectorElement.mjs.map +1 -1
  90. package/dist/esm/components/Form/elements/index.mjs +3 -1
  91. package/dist/esm/components/Form/layout/FormItemLayout.mjs +1 -2
  92. package/dist/esm/components/Form/layout/FormItemLayout.mjs.map +1 -1
  93. package/dist/esm/components/Headers/index.mjs +19 -19
  94. package/dist/esm/components/Headers/index.mjs.map +1 -1
  95. package/dist/esm/components/HeightResizer/index.mjs +1 -1
  96. package/dist/esm/components/HeightResizer/index.mjs.map +1 -1
  97. package/dist/esm/components/HideShow/index.mjs +2 -1
  98. package/dist/esm/components/HideShow/index.mjs.map +1 -1
  99. package/dist/esm/components/IDE/Code.mjs +1 -1
  100. package/dist/esm/components/IDE/Code.mjs.map +1 -1
  101. package/dist/esm/components/IDE/CodeBlockClient.mjs +1 -1
  102. package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
  103. package/dist/esm/components/IDE/CodeBlockServer.mjs +3 -3
  104. package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
  105. package/dist/esm/components/IDE/CodeConditionalRenderer.mjs +1 -1
  106. package/dist/esm/components/IDE/CodeConditionalRenderer.mjs.map +1 -1
  107. package/dist/esm/components/IDE/CodeFormatSelector.mjs +4 -1
  108. package/dist/esm/components/IDE/CodeFormatSelector.mjs.map +1 -1
  109. package/dist/esm/components/IDE/ContentDeclarationFormatSelector.mjs +4 -1
  110. package/dist/esm/components/IDE/ContentDeclarationFormatSelector.mjs.map +1 -1
  111. package/dist/esm/components/IDE/FileList.mjs +1 -1
  112. package/dist/esm/components/IDE/FileList.mjs.map +1 -1
  113. package/dist/esm/components/IDE/IDE.mjs +1 -1
  114. package/dist/esm/components/IDE/IDE.mjs.map +1 -1
  115. package/dist/esm/components/IDE/PackageManagerSelector.mjs +4 -1
  116. package/dist/esm/components/IDE/PackageManagerSelector.mjs.map +1 -1
  117. package/dist/esm/components/InformationTag/index.mjs +1 -1
  118. package/dist/esm/components/InformationTag/index.mjs.map +1 -1
  119. package/dist/esm/components/Input/Checkbox.mjs +22 -15
  120. package/dist/esm/components/Input/Checkbox.mjs.map +1 -1
  121. package/dist/esm/components/Input/CodeInput.mjs +84 -0
  122. package/dist/esm/components/Input/CodeInput.mjs.map +1 -0
  123. package/dist/esm/components/Input/Input.mjs +25 -14
  124. package/dist/esm/components/Input/Input.mjs.map +1 -1
  125. package/dist/esm/components/Input/InputPassword.mjs +1 -1
  126. package/dist/esm/components/Input/InputPassword.mjs.map +1 -1
  127. package/dist/esm/components/Input/OTPInput/Input.mjs +426 -0
  128. package/dist/esm/components/Input/OTPInput/Input.mjs.map +1 -0
  129. package/dist/esm/components/Input/OTPInput/index.mjs +495 -0
  130. package/dist/esm/components/Input/OTPInput/index.mjs.map +1 -0
  131. package/dist/esm/components/Input/OTPInput.mjs +495 -0
  132. package/dist/esm/components/Input/OTPInput.mjs.map +1 -0
  133. package/dist/esm/components/Input/SearchInput.mjs +1 -1
  134. package/dist/esm/components/Input/SearchInput.mjs.map +1 -1
  135. package/dist/esm/components/Input/index.mjs +2 -1
  136. package/dist/esm/components/KeyboardScreenAdapter/index.mjs +1 -1
  137. package/dist/esm/components/KeyboardScreenAdapter/index.mjs.map +1 -1
  138. package/dist/esm/components/Label/index.mjs +1 -1
  139. package/dist/esm/components/Label/index.mjs.map +1 -1
  140. package/dist/esm/components/Link/Link.mjs +1 -1
  141. package/dist/esm/components/Link/Link.mjs.map +1 -1
  142. package/dist/esm/components/Loader/index.mjs +1 -1
  143. package/dist/esm/components/Loader/index.mjs.map +1 -1
  144. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
  145. package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
  146. package/dist/esm/components/Logo/Logo.mjs +1 -1
  147. package/dist/esm/components/Logo/Logo.mjs.map +1 -1
  148. package/dist/esm/components/Logo/LogoWithTextBelow.mjs +1 -1
  149. package/dist/esm/components/Logo/LogoWithTextBelow.mjs.map +1 -1
  150. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +16 -11
  151. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  152. package/dist/esm/components/MarkDownRender/processor.mjs +1 -1
  153. package/dist/esm/components/MarkDownRender/processor.mjs.map +1 -1
  154. package/dist/esm/components/MaxHeightSmoother/index.mjs +1 -1
  155. package/dist/esm/components/MaxHeightSmoother/index.mjs.map +1 -1
  156. package/dist/esm/components/MaxWidthSmoother/index.mjs +1 -1
  157. package/dist/esm/components/MaxWidthSmoother/index.mjs.map +1 -1
  158. package/dist/esm/components/Modal/Modal.mjs +48 -41
  159. package/dist/esm/components/Modal/Modal.mjs.map +1 -1
  160. package/dist/esm/components/Navbar/Burger.mjs +1 -1
  161. package/dist/esm/components/Navbar/Burger.mjs.map +1 -1
  162. package/dist/esm/components/Pagination/Pagination.mjs +1 -1
  163. package/dist/esm/components/Pagination/Pagination.mjs.map +1 -1
  164. package/dist/esm/components/Pagination/ShowingResultsNumberItems.mjs +5 -2
  165. package/dist/esm/components/Pagination/ShowingResultsNumberItems.mjs.map +1 -1
  166. package/dist/esm/components/Pattern/DotPattern.mjs +1 -1
  167. package/dist/esm/components/Pattern/DotPattern.mjs.map +1 -1
  168. package/dist/esm/components/Pattern/GridPattern.mjs +1 -1
  169. package/dist/esm/components/Pattern/GridPattern.mjs.map +1 -1
  170. package/dist/esm/components/Pattern/SpotLight.mjs +1 -1
  171. package/dist/esm/components/Pattern/SpotLight.mjs.map +1 -1
  172. package/dist/esm/components/Popover/dynamic.mjs +1 -1
  173. package/dist/esm/components/Popover/dynamic.mjs.map +1 -1
  174. package/dist/esm/components/Popover/static.mjs +2 -2
  175. package/dist/esm/components/Popover/static.mjs.map +1 -1
  176. package/dist/esm/components/PressableSpan/PressableSpan.mjs +1 -1
  177. package/dist/esm/components/PressableSpan/PressableSpan.mjs.map +1 -1
  178. package/dist/esm/components/RightDrawer/RightDrawer.mjs +1 -1
  179. package/dist/esm/components/Select/Multiselect.mjs +7 -7
  180. package/dist/esm/components/Select/Multiselect.mjs.map +1 -1
  181. package/dist/esm/components/Select/Select.mjs +12 -12
  182. package/dist/esm/components/Select/Select.mjs.map +1 -1
  183. package/dist/esm/components/SocialNetworks/index.mjs +3 -8
  184. package/dist/esm/components/SocialNetworks/index.mjs.map +1 -1
  185. package/dist/esm/components/SwitchSelector/index.mjs +35 -27
  186. package/dist/esm/components/SwitchSelector/index.mjs.map +1 -1
  187. package/dist/esm/components/Tab/Tab.mjs +2 -2
  188. package/dist/esm/components/Tab/Tab.mjs.map +1 -1
  189. package/dist/esm/components/TabSelector/TabSelector.mjs +1 -1
  190. package/dist/esm/components/TabSelector/TabSelector.mjs.map +1 -1
  191. package/dist/esm/components/Table/Table.mjs +1 -1
  192. package/dist/esm/components/Table/Table.mjs.map +1 -1
  193. package/dist/esm/components/Tag/index.mjs +1 -1
  194. package/dist/esm/components/Tag/index.mjs.map +1 -1
  195. package/dist/esm/components/TextArea/AutoSizeTextArea.mjs +1 -1
  196. package/dist/esm/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  197. package/dist/esm/components/TextArea/AutocompleteTextArea.mjs +1 -1
  198. package/dist/esm/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  199. package/dist/esm/components/TextArea/TextArea.mjs +1 -1
  200. package/dist/esm/components/TextArea/TextArea.mjs.map +1 -1
  201. package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs +2 -2
  202. package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs.map +1 -1
  203. package/dist/esm/components/Toaster/Toast.mjs +7 -7
  204. package/dist/esm/components/Toaster/Toast.mjs.map +1 -1
  205. package/dist/esm/components/Toaster/Toaster.mjs +1 -1
  206. package/dist/esm/components/Toaster/Toaster.mjs.map +1 -1
  207. package/dist/esm/components/index.mjs +6 -5
  208. package/dist/esm/hooks/index.mjs +4 -3
  209. package/dist/esm/hooks/reactQuery.mjs +66 -3
  210. package/dist/esm/hooks/reactQuery.mjs.map +1 -1
  211. package/dist/esm/hooks/useAuth/useSession.mjs +5 -3
  212. package/dist/esm/hooks/useAuth/useSession.mjs.map +1 -1
  213. package/dist/esm/hooks/useDevice.mjs +16 -2
  214. package/dist/esm/hooks/useDevice.mjs.map +1 -1
  215. package/dist/esm/hooks/useItemSelector.mjs +4 -1
  216. package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
  217. package/dist/esm/libs/auth.mjs +77 -32
  218. package/dist/esm/libs/auth.mjs.map +1 -1
  219. package/dist/types/Checkbox.d.ts +2 -0
  220. package/dist/types/Input.d.ts +16 -0
  221. package/dist/types/Input.d.ts.map +1 -0
  222. package/dist/types/InputPassword.d.ts +2 -0
  223. package/dist/types/OTPElement.d.ts +30 -0
  224. package/dist/types/OTPElement.d.ts.map +1 -0
  225. package/dist/types/OTPInput.d.ts +3 -0
  226. package/dist/types/SearchInput.d.ts +1 -0
  227. package/dist/types/components/Badge/index.d.ts +2 -2
  228. package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts +3 -3
  229. package/dist/types/components/Breadcrumb/index.d.ts +2 -2
  230. package/dist/types/components/Breadcrumb/index.d.ts.map +1 -1
  231. package/dist/types/components/Browser/Browser.content.d.ts +11 -11
  232. package/dist/types/components/Button/Button.d.ts +10 -18
  233. package/dist/types/components/Button/Button.d.ts.map +1 -1
  234. package/dist/types/components/Button/index.d.ts +2 -2
  235. package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +5 -5
  236. package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts.map +1 -1
  237. package/dist/types/components/Command/index.d.ts +13 -13
  238. package/dist/types/components/Container/index.d.ts +9 -9
  239. package/dist/types/components/Container/index.d.ts.map +1 -1
  240. package/dist/types/components/CopyToClipboard/index.d.ts +7 -3
  241. package/dist/types/components/CopyToClipboard/index.d.ts.map +1 -1
  242. package/dist/types/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts.map +1 -1
  243. package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
  244. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +25 -25
  245. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +9 -9
  246. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
  247. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +33 -33
  248. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +25 -25
  249. package/dist/types/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts.map +1 -1
  250. package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +25 -25
  251. package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +33 -33
  252. package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +9 -9
  253. package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +7 -7
  254. package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +5 -5
  255. package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +31 -31
  256. package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
  257. package/dist/types/components/ExpandCollapse/expandCollapse.content.d.ts +3 -3
  258. package/dist/types/components/Form/Form.d.ts +4 -0
  259. package/dist/types/components/Form/Form.d.ts.map +1 -1
  260. package/dist/types/components/Form/FormBase.d.ts +2 -2
  261. package/dist/types/components/Form/FormBase.d.ts.map +1 -1
  262. package/dist/types/components/Form/FormField.d.ts +2 -2
  263. package/dist/types/components/Form/FormField.d.ts.map +1 -1
  264. package/dist/types/components/Form/FormItem.d.ts +2 -2
  265. package/dist/types/components/Form/FormItem.d.ts.map +1 -1
  266. package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts +2 -2
  267. package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts.map +1 -1
  268. package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts +2 -2
  269. package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
  270. package/dist/types/components/Form/elements/FormElement.d.ts +2 -2
  271. package/dist/types/components/Form/elements/MultiselectElement.d.ts +2 -2
  272. package/dist/types/components/Form/elements/MultiselectElement.d.ts.map +1 -1
  273. package/dist/types/components/Form/elements/OTPElement.d.ts +30 -0
  274. package/dist/types/components/Form/elements/OTPElement.d.ts.map +1 -0
  275. package/dist/types/components/Form/elements/SearchInputElement.d.ts +13 -0
  276. package/dist/types/components/Form/elements/SearchInputElement.d.ts.map +1 -0
  277. package/dist/types/components/Form/elements/SelectElement.d.ts +2 -2
  278. package/dist/types/components/Form/elements/SelectElement.d.ts.map +1 -1
  279. package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts +2 -2
  280. package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
  281. package/dist/types/components/Form/elements/index.d.ts +3 -1
  282. package/dist/types/components/HideShow/index.d.ts.map +1 -1
  283. package/dist/types/components/IDE/FileTree.d.ts.map +1 -1
  284. package/dist/types/components/IDE/code.content.d.ts +5 -5
  285. package/dist/types/components/IDE/code.content.d.ts.map +1 -1
  286. package/dist/types/components/IDE/copyCode.content.d.ts +5 -5
  287. package/dist/types/components/IDE/copyCode.content.d.ts.map +1 -1
  288. package/dist/types/components/Input/Checkbox.d.ts +5 -5
  289. package/dist/types/components/Input/Checkbox.d.ts.map +1 -1
  290. package/dist/types/components/Input/Input.d.ts +3 -3
  291. package/dist/types/components/Input/Input.d.ts.map +1 -1
  292. package/dist/types/components/Input/OTPInput/Input.d.ts +57 -0
  293. package/dist/types/components/Input/OTPInput/Input.d.ts.map +1 -0
  294. package/dist/types/components/Input/OTPInput/index.d.ts +78 -0
  295. package/dist/types/components/Input/OTPInput/index.d.ts.map +1 -0
  296. package/dist/types/components/Input/OTPInput.d.ts +78 -0
  297. package/dist/types/components/Input/OTPInput.d.ts.map +1 -0
  298. package/dist/types/components/Input/SearchInput.d.ts +2 -2
  299. package/dist/types/components/Input/index.d.ts +2 -1
  300. package/dist/types/components/Link/Link.d.ts +4 -4
  301. package/dist/types/components/Loader/index.content.d.ts +3 -3
  302. package/dist/types/components/Loader/spinner.d.ts +2 -2
  303. package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +17 -17
  304. package/dist/types/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +13 -13
  305. package/dist/types/components/MaxWidthSmoother/index.d.ts +2 -2
  306. package/dist/types/components/MaxWidthSmoother/index.d.ts.map +1 -1
  307. package/dist/types/components/Modal/Modal.d.ts.map +1 -1
  308. package/dist/types/components/Navbar/Burger.d.ts +2 -2
  309. package/dist/types/components/Navbar/Burger.d.ts.map +1 -1
  310. package/dist/types/components/Navbar/DesktopNavbar.d.ts +2 -2
  311. package/dist/types/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  312. package/dist/types/components/Navbar/MobileNavbar.d.ts +2 -2
  313. package/dist/types/components/Navbar/MobileNavbar.d.ts.map +1 -1
  314. package/dist/types/components/Navbar/index.d.ts +2 -2
  315. package/dist/types/components/Navbar/index.d.ts.map +1 -1
  316. package/dist/types/components/Pagination/Pagination.d.ts +4 -4
  317. package/dist/types/components/Pagination/pagination.content.d.ts +11 -11
  318. package/dist/types/components/Popover/static.d.ts +3 -3
  319. package/dist/types/components/RightDrawer/useRightDrawerStore.d.ts +2 -2
  320. package/dist/types/components/Select/Multiselect.d.ts.map +1 -1
  321. package/dist/types/components/Select/Select.d.ts +3 -3
  322. package/dist/types/components/Select/Select.d.ts.map +1 -1
  323. package/dist/types/components/SocialNetworks/index.d.ts +2 -2
  324. package/dist/types/components/SocialNetworks/index.d.ts.map +1 -1
  325. package/dist/types/components/SwitchSelector/index.d.ts +10 -8
  326. package/dist/types/components/SwitchSelector/index.d.ts.map +1 -1
  327. package/dist/types/components/Tab/Tab.d.ts +5 -5
  328. package/dist/types/components/Tab/Tab.d.ts.map +1 -1
  329. package/dist/types/components/Tab/TabContext.d.ts +2 -2
  330. package/dist/types/components/TabSelector/TabSelector.d.ts +5 -5
  331. package/dist/types/components/TabSelector/TabSelector.d.ts.map +1 -1
  332. package/dist/types/components/Table/table.content.d.ts +3 -3
  333. package/dist/types/components/Table/table.content.d.ts.map +1 -1
  334. package/dist/types/components/Tag/index.d.ts +5 -5
  335. package/dist/types/components/Toaster/Toast.d.ts +2 -2
  336. package/dist/types/components/Toaster/Toaster.d.ts +2 -2
  337. package/dist/types/components/index.d.ts +4 -3
  338. package/dist/types/hooks/index.d.ts +5 -4
  339. package/dist/types/hooks/reactQuery.d.ts +1258 -65
  340. package/dist/types/hooks/reactQuery.d.ts.map +1 -1
  341. package/dist/types/hooks/useAuth/index.d.ts +2 -2
  342. package/dist/types/hooks/useAuth/useOAuth2.d.ts +2 -1
  343. package/dist/types/hooks/useAuth/useOAuth2.d.ts.map +1 -1
  344. package/dist/types/hooks/useAuth/useSession.d.ts +9 -4
  345. package/dist/types/hooks/useAuth/useSession.d.ts.map +1 -1
  346. package/dist/types/hooks/useDevice.d.ts +7 -1
  347. package/dist/types/hooks/useDevice.d.ts.map +1 -1
  348. package/dist/types/hooks/useItemSelector.d.ts +8 -1
  349. package/dist/types/hooks/useItemSelector.d.ts.map +1 -1
  350. package/dist/types/hooks/useScrollBlockage/useScrollBlockageStore.d.ts +2 -2
  351. package/dist/types/hooks/useUser/index.d.ts +18 -1
  352. package/dist/types/hooks/useUser/index.d.ts.map +1 -1
  353. package/dist/types/index.d.ts +5 -0
  354. package/dist/types/libs/auth.d.ts +3375 -2
  355. package/dist/types/libs/auth.d.ts.map +1 -1
  356. package/package.json +51 -45
  357. package/tailwind.css +55 -34
  358. package/dist/esm/components/Popover/index.mjs.map +0 -1
  359. package/dist/esm/utils/camelCase.mjs +0 -12
  360. package/dist/esm/utils/camelCase.mjs.map +0 -1
  361. package/dist/types/components/Popover/index.d.ts.map +0 -1
  362. package/dist/types/utils/camelCase.d.ts +0 -6
  363. package/dist/types/utils/camelCase.d.ts.map +0 -1
@@ -7,6 +7,29 @@ import { useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
 
9
9
  //#region src/components/CopyToClipboard/index.tsx
10
+ const useCopyToClipboard = (text, feedbackDuration = 2e3, onCopySuccess, onCopyError) => {
11
+ const [isCopied, setIsCopied] = useState(false);
12
+ const copy = async () => {
13
+ if (!text) return;
14
+ try {
15
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(text);
16
+ else {
17
+ onCopyError?.(/* @__PURE__ */ new Error("Clipboard API not supported in this browser"));
18
+ return;
19
+ }
20
+ setIsCopied(true);
21
+ setTimeout(() => setIsCopied(false), feedbackDuration);
22
+ onCopySuccess?.();
23
+ } catch (error) {
24
+ const errorMessage = error instanceof Error ? error.message : "Failed to copy to clipboard";
25
+ onCopyError?.(error instanceof Error ? error : new Error(errorMessage));
26
+ }
27
+ };
28
+ return {
29
+ isCopied,
30
+ copy
31
+ };
32
+ };
10
33
  /**
11
34
  * CopyToClipboard Component
12
35
  *
@@ -39,39 +62,18 @@ import { jsx, jsxs } from "react/jsx-runtime";
39
62
  * - Provides visual focus indicators
40
63
  */
41
64
  const CopyToClipboard = ({ text, children, className, "aria-label": ariaLabel = "Copy to clipboard", "aria-copied-label": ariaCopiedLabel = "Copied to clipboard", feedbackDuration = 2e3, onCopySuccess, onCopyError, disable, preventDefault = true }) => {
42
- const [isCopied, setIsCopied] = useState(false);
65
+ const { isCopied, copy } = useCopyToClipboard(text, feedbackDuration, onCopySuccess, onCopyError);
43
66
  if (disable) return /* @__PURE__ */ jsx("span", {
44
67
  className,
45
68
  children
46
69
  });
47
- const handleCopy = async (e) => {
48
- e.preventDefault();
49
- if (!text) return;
50
- try {
51
- if (preventDefault) e.preventDefault();
52
- if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(text);
53
- else {
54
- const textArea = document.createElement("textarea");
55
- textArea.value = text;
56
- textArea.style.position = "fixed";
57
- textArea.style.left = "-999999px";
58
- textArea.style.top = "-999999px";
59
- document.body.appendChild(textArea);
60
- textArea.focus();
61
- textArea.select();
62
- document.body.removeChild(textArea);
63
- }
64
- setIsCopied(true);
65
- setTimeout(() => setIsCopied(false), feedbackDuration);
66
- onCopySuccess?.(e);
67
- } catch (error) {
68
- const errorMessage = error instanceof Error ? error.message : "Failed to copy to clipboard";
69
- onCopyError?.(error instanceof Error ? error : new Error(errorMessage));
70
- }
71
- };
72
70
  const handleKeyDown = (event) => {
73
71
  if (event.key === "Enter" || event.key === " ") handleCopy(event);
74
72
  };
73
+ const handleCopy = (event) => {
74
+ if (preventDefault) event.preventDefault();
75
+ copy();
76
+ };
75
77
  const currentAriaLabel = isCopied ? ariaCopiedLabel : ariaLabel;
76
78
  const IconComponent = isCopied ? CopyCheck : CopyIcon;
77
79
  return /* @__PURE__ */ jsxs("span", {
@@ -94,5 +96,5 @@ const CopyToClipboard = ({ text, children, className, "aria-label": ariaLabel =
94
96
  };
95
97
 
96
98
  //#endregion
97
- export { CopyToClipboard };
99
+ export { CopyToClipboard, useCopyToClipboard };
98
100
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["CopyToClipboard: FC<CopyToClipboardProps>"],"sources":["../../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MouseEvent,\n type PropsWithChildren,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the CopyToClipboard component\n */\nexport interface CopyToClipboardProps extends PropsWithChildren {\n /**\n * The text to copy to the clipboard when clicked\n * @example \"Hello World\"\n * @example \"npm install @intlayer/design-system\"\n */\n text: string;\n\n /**\n * Additional CSS classes for the wrapper element\n * @example \"bg-blue-100 text-blue-800\"\n */\n className?: string;\n\n /**\n * Accessible label for screen readers when copy operation is available\n * @default \"Copy to clipboard\"\n */\n 'aria-label'?: string;\n\n /**\n * Accessible label for screen readers when content has been copied\n * @default \"Copied to clipboard\"\n */\n 'aria-copied-label'?: string;\n\n /**\n * Duration in milliseconds to show the \"copied\" state\n * @default 2000\n */\n feedbackDuration?: number;\n\n /**\n * Callback function called when copy operation succeeds\n */\n onCopySuccess?: (e: MouseEvent | KeyboardEvent) => void;\n\n /**\n * Callback function called when copy operation fails\n */\n onCopyError?: (error: Error) => void;\n\n /**\n * Disable the copy to clipboard functionality and return the children\n * @default false\n */\n disable?: boolean;\n\n /**\n * Prevent the default behavior of the link when clicked\n * @default true\n */\n preventDefault?: boolean;\n}\n\n/**\n * CopyToClipboard Component\n *\n * A versatile component that allows users to copy text to their clipboard with visual feedback.\n * Provides accessibility features, customizable feedback duration, and error handling.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <CopyToClipboard text=\"Hello World\">\n * <span>Click to copy</span>\n * </CopyToClipboard>\n *\n * // With custom styling and callbacks\n * <CopyToClipboard\n * text=\"npm install @intlayer/design-system\"\n * className=\"bg-gray-100 p-2\"\n * feedbackDuration={3000}\n * onCopySuccess={() => console.log('Copied!')}\n * >\n * <code>npm install @intlayer/design-system</code>\n * </CopyToClipboard>\n * ```\n *\n * @component\n * @accessibility\n * - Uses proper ARIA labels for copy and copied states\n * - Supports keyboard navigation (Enter and Space keys)\n * - Announces state changes to screen readers\n * - Provides visual focus indicators\n */\nexport const CopyToClipboard: FC<CopyToClipboardProps> = ({\n text,\n children,\n className,\n 'aria-label': ariaLabel = 'Copy to clipboard',\n 'aria-copied-label': ariaCopiedLabel = 'Copied to clipboard',\n feedbackDuration = 2000,\n onCopySuccess,\n onCopyError,\n disable,\n preventDefault = true,\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n\n if (disable) return <span className={className}>{children}</span>;\n\n const handleCopy = async (e: MouseEvent | KeyboardEvent) => {\n e.preventDefault();\n\n if (!text) return;\n\n try {\n if (preventDefault) {\n e.preventDefault();\n }\n\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n } else {\n // Fallback for older browsers\n const textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.style.position = 'fixed';\n textArea.style.left = '-999999px';\n textArea.style.top = '-999999px';\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n document.body.removeChild(textArea);\n }\n\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), feedbackDuration);\n onCopySuccess?.(e);\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to copy to clipboard';\n onCopyError?.(error instanceof Error ? error : new Error(errorMessage));\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleCopy(event);\n }\n };\n\n const currentAriaLabel = isCopied ? ariaCopiedLabel : ariaLabel;\n\n const IconComponent = isCopied ? CopyCheck : CopyIcon;\n\n return (\n <span\n className={cn(\n 'inline-flex max-w-full cursor-pointer items-center gap-2 rounded-md p-0.5 hover:bg-neutral/10',\n className\n )}\n onClick={handleCopy}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n aria-label={currentAriaLabel}\n aria-pressed={isCopied}\n data-testid=\"copy-to-clipboard\"\n >\n <span className=\"min-w-0 break-all\">{children}</span>\n\n {text && (\n <IconComponent\n className=\"ml-1 ml-auto size-4 min-w-4 shrink-0\"\n aria-hidden=\"true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AAU;GAAqB;IAAgB,EAEpD,QACC,oBAAC;GACC,WAAU;GACV,eAAY;IACZ;GAEC"}
1
+ {"version":3,"file":"index.mjs","names":["CopyToClipboard: FC<CopyToClipboardProps>"],"sources":["../../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MouseEvent,\n type PropsWithChildren,\n useState,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Props for the CopyToClipboard component\n */\nexport interface CopyToClipboardProps extends PropsWithChildren {\n /**\n * The text to copy to the clipboard when clicked\n * @example \"Hello World\"\n * @example \"npm install @intlayer/design-system\"\n */\n text: string;\n\n /**\n * Additional CSS classes for the wrapper element\n * @example \"bg-blue-100 text-blue-800\"\n */\n className?: string;\n\n /**\n * Accessible label for screen readers when copy operation is available\n * @default \"Copy to clipboard\"\n */\n 'aria-label'?: string;\n\n /**\n * Accessible label for screen readers when content has been copied\n * @default \"Copied to clipboard\"\n */\n 'aria-copied-label'?: string;\n\n /**\n * Duration in milliseconds to show the \"copied\" state\n * @default 2000\n */\n feedbackDuration?: number;\n\n /**\n * Callback function called when copy operation succeeds\n */\n onCopySuccess?: () => void;\n\n /**\n * Callback function called when copy operation fails\n */\n onCopyError?: (error: Error) => void;\n\n /**\n * Disable the copy to clipboard functionality and return the children\n * @default false\n */\n disable?: boolean;\n\n /**\n * Prevent the default behavior of the link when clicked\n * @default true\n */\n preventDefault?: boolean;\n}\n\nexport const useCopyToClipboard = (\n text?: string,\n feedbackDuration = 2000,\n onCopySuccess?: () => void,\n onCopyError?: (error: Error) => void\n) => {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async () => {\n if (!text) return;\n\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n } else {\n onCopyError?.(new Error('Clipboard API not supported in this browser'));\n return;\n }\n\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), feedbackDuration);\n onCopySuccess?.();\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to copy to clipboard';\n onCopyError?.(error instanceof Error ? error : new Error(errorMessage));\n }\n };\n\n return { isCopied, copy };\n};\n\n/**\n * CopyToClipboard Component\n *\n * A versatile component that allows users to copy text to their clipboard with visual feedback.\n * Provides accessibility features, customizable feedback duration, and error handling.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <CopyToClipboard text=\"Hello World\">\n * <span>Click to copy</span>\n * </CopyToClipboard>\n *\n * // With custom styling and callbacks\n * <CopyToClipboard\n * text=\"npm install @intlayer/design-system\"\n * className=\"bg-gray-100 p-2\"\n * feedbackDuration={3000}\n * onCopySuccess={() => console.log('Copied!')}\n * >\n * <code>npm install @intlayer/design-system</code>\n * </CopyToClipboard>\n * ```\n *\n * @component\n * @accessibility\n * - Uses proper ARIA labels for copy and copied states\n * - Supports keyboard navigation (Enter and Space keys)\n * - Announces state changes to screen readers\n * - Provides visual focus indicators\n */\nexport const CopyToClipboard: FC<CopyToClipboardProps> = ({\n text,\n children,\n className,\n 'aria-label': ariaLabel = 'Copy to clipboard',\n 'aria-copied-label': ariaCopiedLabel = 'Copied to clipboard',\n feedbackDuration = 2000,\n onCopySuccess,\n onCopyError,\n disable,\n preventDefault = true,\n}) => {\n const { isCopied, copy } = useCopyToClipboard(\n text,\n feedbackDuration,\n onCopySuccess,\n onCopyError\n );\n\n if (disable) return <span className={className}>{children}</span>;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleCopy(event);\n }\n };\n\n const handleCopy = (event: MouseEvent | KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n copy();\n };\n\n const currentAriaLabel = isCopied ? ariaCopiedLabel : ariaLabel;\n\n const IconComponent = isCopied ? CopyCheck : CopyIcon;\n\n return (\n <span\n className={cn(\n 'inline-flex max-w-full cursor-pointer items-center gap-2 rounded-md p-0.5 hover:bg-neutral/10',\n className\n )}\n onClick={handleCopy}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n aria-label={currentAriaLabel}\n aria-pressed={isCopied}\n data-testid=\"copy-to-clipboard\"\n >\n <span className=\"min-w-0 break-all\">{children}</span>\n\n {text && (\n <IconComponent\n className=\"ml-1 ml-auto size-4 min-w-4 shrink-0\"\n aria-hidden=\"true\"\n />\n )}\n </span>\n );\n};\n"],"mappings":";;;;;;;;;AAsEA,MAAa,sBACX,MACA,mBAAmB,KACnB,eACA,gBACG;CACH,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;CAE/C,MAAM,OAAO,YAAY;AACvB,MAAI,CAAC,KAAM;AAEX,MAAI;AACF,OAAI,UAAU,WAAW,UACvB,OAAM,UAAU,UAAU,UAAU,KAAK;QACpC;AACL,kCAAc,IAAI,MAAM,8CAA8C,CAAC;AACvE;;AAGF,eAAY,KAAK;AACjB,oBAAiB,YAAY,MAAM,EAAE,iBAAiB;AACtD,oBAAiB;WACV,OAAO;GACd,MAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU;AAC3C,iBAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,aAAa,CAAC;;;AAI3E,QAAO;EAAE;EAAU;EAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkC3B,MAAaA,mBAA6C,EACxD,MACA,UACA,WACA,cAAc,YAAY,qBAC1B,qBAAqB,kBAAkB,uBACvC,mBAAmB,KACnB,eACA,aACA,SACA,iBAAiB,WACb;CACJ,MAAM,EAAE,UAAU,SAAS,mBACzB,MACA,kBACA,eACA,YACD;AAED,KAAI,QAAS,QAAO,oBAAC;EAAgB;EAAY;GAAgB;CAEjE,MAAM,iBAAiB,UAAyB;AAC9C,MAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,IACzC,YAAW,MAAM;;CAIrB,MAAM,cAAc,UAAsC;AACxD,MAAI,eAAgB,OAAM,gBAAgB;AAE1C,QAAM;;CAGR,MAAM,mBAAmB,WAAW,kBAAkB;CAEtD,MAAM,gBAAgB,WAAW,YAAY;AAE7C,QACE,qBAAC;EACC,WAAW,GACT,iGACA,UACD;EACD,SAAS;EACT,WAAW;EACX,MAAK;EACL,UAAU;EACV,cAAY;EACZ,gBAAc;EACd,eAAY;aAEZ,oBAAC;GAAK,WAAU;GAAqB;IAAgB,EAEpD,QACC,oBAAC;GACC,WAAU;GACV,eAAY;IACZ;GAEC"}
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useEditedContent, useFocusUnmergedDictionary } from "@intlayer/editor-react";
9
9
 
10
10
  //#region src/components/DictionaryEditor/DictionaryEditor.tsx
11
- const DictionaryEditor = ({ dictionary, mode, onDelete,...props }) => {
11
+ const DictionaryEditor = ({ dictionary, mode, onDelete, ...props }) => {
12
12
  const { editedContent, addEditedContent } = useEditedContent();
13
13
  const { focusedContent, setFocusedContentKeyPath, setFocusedContent } = useFocusUnmergedDictionary();
14
14
  const focusedKeyPath = useMemo(() => focusedContent?.keyPath, [focusedContent?.keyPath]);
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditor.mjs","names":["DictionaryEditor: FC<DictionaryEditorProps>"],"sources":["../../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEditedContent,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, Locale } from '@intlayer/types';\nimport { type FC, useMemo } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locale;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n onDelete,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath, setFocusedContent } =\n useFocusUnmergedDictionary();\n\n const focusedKeyPath = useMemo(\n () => focusedContent?.keyPath,\n [focusedContent?.keyPath]\n );\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.localId!] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.localId!]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(\n dictionary.localId!,\n content.newValue,\n content.keyPath\n );\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n className=\"mb-4 flex-col\"\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAaA,oBAA+C,EAC1D,YACA,MACA,SACA,GAAG,YACC;CACJ,MAAM,EAAE,eAAe,qBAAqB,kBAAkB;CAC9D,MAAM,EAAE,gBAAgB,0BAA0B,sBAChD,4BAA4B;CAE9B,MAAM,iBAAiB,cACf,gBAAgB,SACtB,CAAC,gBAAgB,QAAQ,CAC1B;AAED,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC,mBACC,8BAAC;GACC,GAAI;GACJ,SAAS,EAAE;GACC;GACZ,KAAK,KAAK,WACP,gBAAgB,WAAW,YAAa,YAAY,QACtD;GACD,eAAe,gBAAgB,WAAW,UAAW;GACrC;GAChB,SAAS,WAAW;GACpB,kBAAkB,YAAY;AAC5B,qBACE,WAAW,SACX,QAAQ,UACR,QAAQ,QACT;;GAEH,gBAAgB;IAChB,GACE,EACN,oBAAC;GACa;GACN;GACN,WAAU;GACV,gBAAgB;AACd,sBAAkB,KAAK;AACvB,gBAAY;;IAEd;GACE"}
1
+ {"version":3,"file":"DictionaryEditor.mjs","names":["DictionaryEditor: FC<DictionaryEditorProps>"],"sources":["../../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEditedContent,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, Locale } from '@intlayer/types';\nimport { type FC, useMemo } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locale;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n onDelete,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath, setFocusedContent } =\n useFocusUnmergedDictionary();\n\n const focusedKeyPath = useMemo(\n () => focusedContent?.keyPath,\n [focusedContent?.keyPath]\n );\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.localId!] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.localId!]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(\n dictionary.localId!,\n content.newValue,\n content.keyPath\n );\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n className=\"mb-4 flex-col\"\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAaA,oBAA+C,EAC1D,YACA,MACA,UACA,GAAG,YACC;CACJ,MAAM,EAAE,eAAe,qBAAqB,kBAAkB;CAC9D,MAAM,EAAE,gBAAgB,0BAA0B,sBAChD,4BAA4B;CAE9B,MAAM,iBAAiB,cACf,gBAAgB,SACtB,CAAC,gBAAgB,QAAQ,CAC1B;AAED,QACE,qBAAC;EAAI,WAAU;aACb,oBAAC,mBACC,8BAAC;GACC,GAAI;GACJ,SAAS,EAAE;GACC;GACZ,KAAK,KAAK,WACP,gBAAgB,WAAW,YAAa,YAAY,QACtD;GACD,eAAe,gBAAgB,WAAW,UAAW;GACrC;GAChB,SAAS,WAAW;GACpB,kBAAkB,YAAY;AAC5B,qBACE,WAAW,SACX,QAAQ,UACR,QAAQ,QACT;;GAEH,gBAAgB;IAChB,GACE,EACN,oBAAC;GACa;GACN;GACN,WAAU;GACV,gBAAgB;AACd,sBAAkB,KAAK;AACvB,gBAAY;;IAEd;GACE"}
@@ -3,7 +3,7 @@ import { Accordion } from "../Accordion/Accordion.mjs";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/DictionaryEditor/ItemLayout.tsx
6
- const ItemLayout = ({ level, title, description, children, rightParam, isSelected,...props }) => /* @__PURE__ */ jsx("div", {
6
+ const ItemLayout = ({ level, title, description, children, rightParam, isSelected, ...props }) => /* @__PURE__ */ jsx("div", {
7
7
  className: cn("rounded-md p-2 transition", "hover:bg-card/30 [&:has(.section:hover)]:bg-transparent", level === 2 && "hover:bg-card/30", level >= 3 && "", isSelected === true && "bg-card/40"),
8
8
  ...props,
9
9
  children: /* @__PURE__ */ jsx(Accordion, {
@@ -14,7 +14,7 @@ const ItemLayout = ({ level, title, description, children, rightParam, isSelecte
14
14
  children: [/* @__PURE__ */ jsxs("div", {
15
15
  className: "flex w-full items-center justify-between",
16
16
  children: [/* @__PURE__ */ jsx("span", {
17
- className: cn(level === 0 && "text-2xl", level === 1 && "text-xl", level === 2 && "text-lg", level >= 3 && "text-base"),
17
+ className: cn(level === 0 && "text-lg", level === 1 && "text-md", level === 2 && "text-md", level >= 3 && "text-base"),
18
18
  children: title
19
19
  }), rightParam && /* @__PURE__ */ jsx("div", {
20
20
  className: "flex w-auto items-center justify-between p-3",
@@ -25,7 +25,10 @@ const ItemLayout = ({ level, title, description, children, rightParam, isSelecte
25
25
  children: description
26
26
  })]
27
27
  }),
28
- children
28
+ children: /* @__PURE__ */ jsx("div", {
29
+ className: "size-full px-2",
30
+ children
31
+ })
29
32
  })
30
33
  });
31
34
 
@@ -1 +1 @@
1
- {"version":3,"file":"ItemLayout.mjs","names":["ItemLayout: FC<ItemWrapperProps>"],"sources":["../../../../src/components/DictionaryEditor/ItemLayout.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Accordion } from '../Accordion';\n\ninterface ItemWrapperProps extends HTMLAttributes<HTMLDivElement> {\n level: number;\n children: ReactNode;\n title: string;\n description: string;\n rightParam?: ReactNode;\n isSelected: boolean;\n}\n\nexport const ItemLayout: FC<ItemWrapperProps> = ({\n level,\n title,\n description,\n children,\n rightParam,\n isSelected,\n ...props\n}) => (\n <div\n className={cn(\n 'rounded-md p-2 transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && '',\n isSelected === true && 'bg-card/40'\n )}\n {...props}\n >\n <Accordion\n isOpen={isSelected}\n label={title}\n header={\n <div className=\"flex w-full\">\n <div className=\"flex w-full items-center justify-between\">\n <span\n className={cn(\n level === 0 && 'text-2xl',\n level === 1 && 'text-xl',\n level === 2 && 'text-lg',\n level >= 3 && 'text-base'\n )}\n >\n {title}\n </span>\n {rightParam && (\n <div className=\"flex w-auto items-center justify-between p-3\">\n {rightParam}\n </div>\n )}\n </div>\n {description && (\n <p className=\"pl-3 text-card text-sm\">{description}</p>\n )}\n </div>\n }\n >\n {children}\n </Accordion>\n </div>\n);\n"],"mappings":";;;;;AAaA,MAAaA,cAAoC,EAC/C,OACA,OACA,aACA,UACA,YACA,WACA,GAAG,YAEH,oBAAC;CACC,WAAW,GACT,6BACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,IACd,eAAe,QAAQ,aACxB;CACD,GAAI;WAEJ,oBAAC;EACC,QAAQ;EACR,OAAO;EACP,QACE,qBAAC;GAAI,WAAU;cACb,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,WAAW,GACT,UAAU,KAAK,YACf,UAAU,KAAK,WACf,UAAU,KAAK,WACf,SAAS,KAAK,YACf;eAEA;MACI,EACN,cACC,oBAAC;KAAI,WAAU;eACZ;MACG;KAEJ,EACL,eACC,oBAAC;IAAE,WAAU;cAA0B;KAAgB;IAErD;EAGP;GACS;EACR"}
1
+ {"version":3,"file":"ItemLayout.mjs","names":["ItemLayout: FC<ItemWrapperProps>"],"sources":["../../../../src/components/DictionaryEditor/ItemLayout.tsx"],"sourcesContent":["import type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Accordion } from '../Accordion';\n\ninterface ItemWrapperProps extends HTMLAttributes<HTMLDivElement> {\n level: number;\n children: ReactNode;\n title: string;\n description: string;\n rightParam?: ReactNode;\n isSelected: boolean;\n}\n\nexport const ItemLayout: FC<ItemWrapperProps> = ({\n level,\n title,\n description,\n children,\n rightParam,\n isSelected,\n ...props\n}) => (\n <div\n className={cn(\n 'rounded-md p-2 transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && '',\n isSelected === true && 'bg-card/40'\n )}\n {...props}\n >\n <Accordion\n isOpen={isSelected}\n label={title}\n header={\n <div className=\"flex w-full\">\n <div className=\"flex w-full items-center justify-between\">\n <span\n className={cn(\n level === 0 && 'text-lg',\n level === 1 && 'text-md',\n level === 2 && 'text-md',\n level >= 3 && 'text-base'\n )}\n >\n {title}\n </span>\n {rightParam && (\n <div className=\"flex w-auto items-center justify-between p-3\">\n {rightParam}\n </div>\n )}\n </div>\n {description && (\n <p className=\"pl-3 text-card text-sm\">{description}</p>\n )}\n </div>\n }\n >\n <div className=\"size-full px-2\">{children}</div>\n </Accordion>\n </div>\n);\n"],"mappings":";;;;;AAaA,MAAaA,cAAoC,EAC/C,OACA,OACA,aACA,UACA,YACA,YACA,GAAG,YAEH,oBAAC;CACC,WAAW,GACT,6BACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,IACd,eAAe,QAAQ,aACxB;CACD,GAAI;WAEJ,oBAAC;EACC,QAAQ;EACR,OAAO;EACP,QACE,qBAAC;GAAI,WAAU;cACb,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,WAAW,GACT,UAAU,KAAK,WACf,UAAU,KAAK,WACf,UAAU,KAAK,WACf,SAAS,KAAK,YACf;eAEA;MACI,EACN,cACC,oBAAC;KAAI,WAAU;eACZ;MACG;KAEJ,EACL,eACC,oBAAC;IAAE,WAAU;cAA0B;KAAgB;IAErD;YAGR,oBAAC;GAAI,WAAU;GAAkB;IAAe;GACtC;EACR"}
@@ -4,6 +4,7 @@ import { memo, useMemo } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { isSameKeyPath } from "@intlayer/core";
6
6
  import { NodeType } from "@intlayer/types";
7
+ import { camelCaseToSentence } from "@intlayer/config/client";
7
8
 
8
9
  //#region src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx
9
10
  const NestedObjectWrapper = memo((props) => {
@@ -17,7 +18,7 @@ const NestedObjectWrapper = memo((props) => {
17
18
  const isSelected = isSameKeyPath(newKeyPath, focusedKeyPath);
18
19
  return /* @__PURE__ */ jsx(ItemLayout, {
19
20
  level: keyPath.length,
20
- title: key,
21
+ title: camelCaseToSentence(key),
21
22
  description: "",
22
23
  isSelected,
23
24
  onClick: (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"NestedObjectWrapper.mjs","names":["NestedObjectWrapper: FC<NestedObjectWrapperProps>","newKeyPathEl: KeyPath","newKeyPath: KeyPath[]"],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx"],"sourcesContent":["import { isSameKeyPath } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport { type FC, memo, useMemo } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, type NodeWrapperProps, traceKeys } from './index';\n\ntype NestedObjectWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: Record<string, ContentNode>;\n};\n\nexport const NestedObjectWrapper: FC<NestedObjectWrapperProps> = memo(\n (props) => {\n const { keyPath, section, focusedKeyPath = [], onFocusKeyPath } = props;\n\n const sectionKeys = useMemo(\n () =>\n Object.keys(section ?? {}).filter((key) => !traceKeys.includes(key)),\n [section]\n );\n\n return sectionKeys.map((key) => {\n const newKeyPathEl: KeyPath = { key, type: NodeType.Object };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const isSelected = isSameKeyPath(newKeyPath, focusedKeyPath);\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={key}\n title={key}\n description=\"\"\n isSelected={isSelected}\n onClick={(e) => {\n e.stopPropagation();\n\n if (isSelected) {\n onFocusKeyPath([]);\n } else {\n onFocusKeyPath(newKeyPath);\n }\n }}\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={section[key]} />\n </ItemLayout>\n );\n });\n }\n);\n"],"mappings":";;;;;;;;AAUA,MAAaA,sBAAoD,MAC9D,UAAU;CACT,MAAM,EAAE,SAAS,SAAS,iBAAiB,EAAE,EAAE,mBAAmB;AAQlE,QANoB,cAEhB,OAAO,KAAK,WAAW,EAAE,CAAC,CAAC,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAI,CAAC,EACtE,CAAC,QAAQ,CACV,CAEkB,KAAK,QAAQ;EAC9B,MAAMC,eAAwB;GAAE;GAAK,MAAM,SAAS;GAAQ;EAC5D,MAAMC,aAAwB,CAAC,GAAG,SAAS,aAAa;EAExD,MAAM,aAAa,cAAc,YAAY,eAAe;AAE5D,SACE,oBAAC;GACC,OAAO,QAAQ;GAEf,OAAO;GACP,aAAY;GACA;GACZ,UAAU,MAAM;AACd,MAAE,iBAAiB;AAEnB,QAAI,WACF,gBAAe,EAAE,CAAC;QAElB,gBAAe,WAAW;;aAI9B,oBAAC;IAAY,GAAI;IAAO,SAAS;IAAY,SAAS,QAAQ;KAAQ;KAdjE,IAeM;GAEf;EAEL"}
1
+ {"version":3,"file":"NestedObjectWrapper.mjs","names":["NestedObjectWrapper: FC<NestedObjectWrapperProps>","newKeyPathEl: KeyPath","newKeyPath: KeyPath[]"],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx"],"sourcesContent":["import { camelCaseToSentence } from '@intlayer/config/client';\nimport { isSameKeyPath } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport { type FC, memo, useMemo } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, type NodeWrapperProps, traceKeys } from './index';\n\ntype NestedObjectWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: Record<string, ContentNode>;\n};\n\nexport const NestedObjectWrapper: FC<NestedObjectWrapperProps> = memo(\n (props) => {\n const { keyPath, section, focusedKeyPath = [], onFocusKeyPath } = props;\n\n const sectionKeys = useMemo(\n () =>\n Object.keys(section ?? {}).filter((key) => !traceKeys.includes(key)),\n [section]\n );\n\n return sectionKeys.map((key) => {\n const newKeyPathEl: KeyPath = { key, type: NodeType.Object };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const isSelected = isSameKeyPath(newKeyPath, focusedKeyPath);\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={key}\n title={camelCaseToSentence(key)}\n description=\"\"\n isSelected={isSelected}\n onClick={(e) => {\n e.stopPropagation();\n\n if (isSelected) {\n onFocusKeyPath([]);\n } else {\n onFocusKeyPath(newKeyPath);\n }\n }}\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={section[key]} />\n </ItemLayout>\n );\n });\n }\n);\n"],"mappings":";;;;;;;;;AAWA,MAAaA,sBAAoD,MAC9D,UAAU;CACT,MAAM,EAAE,SAAS,SAAS,iBAAiB,EAAE,EAAE,mBAAmB;AAQlE,QANoB,cAEhB,OAAO,KAAK,WAAW,EAAE,CAAC,CAAC,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAI,CAAC,EACtE,CAAC,QAAQ,CACV,CAEkB,KAAK,QAAQ;EAC9B,MAAMC,eAAwB;GAAE;GAAK,MAAM,SAAS;GAAQ;EAC5D,MAAMC,aAAwB,CAAC,GAAG,SAAS,aAAa;EAExD,MAAM,aAAa,cAAc,YAAY,eAAe;AAE5D,SACE,oBAAC;GACC,OAAO,QAAQ;GAEf,OAAO,oBAAoB,IAAI;GAC/B,aAAY;GACA;GACZ,UAAU,MAAM;AACd,MAAE,iBAAiB;AAEnB,QAAI,WACF,gBAAe,EAAE,CAAC;QAElB,gBAAe,WAAW;;aAI9B,oBAAC;IAAY,GAAI;IAAO,SAAS;IAAY,SAAS,QAAQ;KAAQ;KAdjE,IAeM;GAEf;EAEL"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
 
4
- import { Button, ButtonColor, ButtonSize, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
5
4
  import { Container } from "../../Container/index.mjs";
5
+ import { Button, ButtonColor, ButtonSize, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
6
6
  import { useAuditContentDeclarationField } from "../../../hooks/reactQuery.mjs";
7
7
  import { InputVariant } from "../../Input/Input.mjs";
8
8
  import { Label } from "../../Label/index.mjs";
@@ -27,7 +27,7 @@ const traceKeys = [
27
27
  "id",
28
28
  "nodeType"
29
29
  ];
30
- const ContentEditorTextArea$1 = ({ keyPath, dictionary,...props }) => {
30
+ const ContentEditorTextArea$1 = ({ keyPath, dictionary, ...props }) => {
31
31
  const { editedContent, addEditedContent } = useEditedContent();
32
32
  const configuration = useConfiguration();
33
33
  const { mutate: auditContentDeclarationField, isPending: isAuditing } = useAuditContentDeclarationField();
@@ -69,7 +69,7 @@ const ContentEditorTextArea$1 = ({ keyPath, dictionary,...props }) => {
69
69
  ...props
70
70
  });
71
71
  };
72
- const ContentEditorInput$1 = ({ keyPath, dictionary,...props }) => {
72
+ const ContentEditorInput$1 = ({ keyPath, dictionary, ...props }) => {
73
73
  const { addEditedContent } = useEditedContent();
74
74
  return /* @__PURE__ */ jsx(ContentEditorInput, {
75
75
  variant: InputVariant.DEFAULT,
@@ -84,7 +84,7 @@ const toggleContent = [{
84
84
  content: "True",
85
85
  value: true
86
86
  }];
87
- const ContentEditorToggle = ({ dictionary, keyPath,...props }) => {
87
+ const ContentEditorToggle = ({ dictionary, keyPath, ...props }) => {
88
88
  const { addEditedContent } = useEditedContent();
89
89
  return /* @__PURE__ */ jsx(SwitchSelector, {
90
90
  choices: toggleContent,
@@ -108,16 +108,25 @@ const TranslationTextEditor = ({ section, keyPath, dictionary, renderSection })
108
108
  className: "flex w-full flex-col gap-2",
109
109
  children: localesList.map((translationKey) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
110
110
  className: "mt-2 w-full p-2 text-xs",
111
- children: /* @__PURE__ */ jsx("td", { children: getLocaleName(translationKey, locale) })
112
- }), /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(TextEditorContainer, {
113
- section: content[translationKey] ?? getEmptyNode(content[defaultLocale]),
114
- keyPath: [...keyPath, {
115
- type: NodeType.Translation,
116
- key: translationKey
117
- }],
118
- dictionary,
119
- renderSection
120
- }) }) })] }, translationKey))
111
+ children: /* @__PURE__ */ jsx("td", {
112
+ className: "w-full",
113
+ children: getLocaleName(translationKey, locale)
114
+ })
115
+ }), /* @__PURE__ */ jsx("tr", {
116
+ className: "flex",
117
+ children: /* @__PURE__ */ jsx("td", {
118
+ className: "w-full",
119
+ children: /* @__PURE__ */ jsx(TextEditorContainer, {
120
+ section: content[translationKey] ?? getEmptyNode(content[defaultLocale]),
121
+ keyPath: [...keyPath, {
122
+ type: NodeType.Translation,
123
+ key: translationKey
124
+ }],
125
+ dictionary,
126
+ renderSection
127
+ })
128
+ })
129
+ })] }, translationKey))
121
130
  })
122
131
  });
123
132
  };
@@ -205,7 +214,10 @@ const ConditionTextEditor = ({ section, keyPath, dictionary, renderSection }) =>
205
214
  "fallback"
206
215
  ].map((condKey) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
207
216
  className: "mt-2 block w-full p-2 text-xs",
208
- children: /* @__PURE__ */ jsx("td", { children: String(condKey) })
217
+ children: /* @__PURE__ */ jsx("td", {
218
+ className: "w-full",
219
+ children: String(condKey)
220
+ })
209
221
  }, condKey), /* @__PURE__ */ jsx("tr", {
210
222
  className: "block w-full",
211
223
  children: /* @__PURE__ */ jsx(TextEditorContainer, {
@@ -233,7 +245,10 @@ const GenderTextEditor = ({ section, keyPath, dictionary, renderSection }) => {
233
245
  "fallback"
234
246
  ].map((condKey) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
235
247
  className: "mt-2 block w-full p-2 text-xs",
236
- children: /* @__PURE__ */ jsx("td", { children: String(condKey) })
248
+ children: /* @__PURE__ */ jsx("td", {
249
+ className: "w-full",
250
+ children: String(condKey)
251
+ })
237
252
  }, condKey), /* @__PURE__ */ jsx("tr", {
238
253
  className: "block w-full",
239
254
  children: /* @__PURE__ */ jsx(TextEditorContainer, {
@@ -259,7 +274,7 @@ const ArrayTextEditor = ({ section, keyPath, dictionary, renderSection }) => {
259
274
  children: /* @__PURE__ */ jsx("tbody", {
260
275
  className: "flex w-full flex-col gap-2",
261
276
  children: section.map((subSection, index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
262
- className: "mt-2 flex w-full justify-between gap-2 p-2",
277
+ className: "mt-2 flex w-full items-center justify-between gap-2 p-2",
263
278
  children: [/* @__PURE__ */ jsx("span", {
264
279
  className: "text-xs",
265
280
  children: String(index)
@@ -324,7 +339,10 @@ const ObjectTextEditor = ({ section, keyPath, dictionary, renderSection }) => /*
324
339
  const subSection = typedSection[key] ?? getEmptyNode(typedSection[firstKey]);
325
340
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
326
341
  className: "mt-2 p-2 text-xs",
327
- children: /* @__PURE__ */ jsx("td", { children: String(key) })
342
+ children: /* @__PURE__ */ jsx("td", {
343
+ className: "w-full",
344
+ children: String(key)
345
+ })
328
346
  }, JSON.stringify(subSection)), /* @__PURE__ */ jsx("tr", {
329
347
  className: "block w-full",
330
348
  children: /* @__PURE__ */ jsx(TextEditor, {
@@ -373,7 +391,7 @@ const MarkdownTextEditor = ({ section, keyPath, dictionary, isDarkMode }) => {
373
391
  })]
374
392
  });
375
393
  };
376
- const InsertionTextEditor = ({ section, keyPath,...props }) => {
394
+ const InsertionTextEditor = ({ section, keyPath, ...props }) => {
377
395
  const childKeyPath = [...keyPath, { type: NodeType.Insertion }];
378
396
  const content = section[NodeType.Insertion];
379
397
  return /* @__PURE__ */ jsx("div", {
@@ -385,7 +403,7 @@ const InsertionTextEditor = ({ section, keyPath,...props }) => {
385
403
  })
386
404
  });
387
405
  };
388
- const FileTextEditor = ({ section, keyPath,...props }) => {
406
+ const FileTextEditor = ({ section, keyPath, ...props }) => {
389
407
  const childKeyPath = [...keyPath, { type: NodeType.File }];
390
408
  const fileUrl = section[NodeType.File];
391
409
  const { content } = section;
@@ -401,12 +419,12 @@ const FileTextEditor = ({ section, keyPath,...props }) => {
401
419
  })]
402
420
  });
403
421
  };
404
- const NestedTextEditor = ({ keyPath, dictionary, renderSection, section,...props }) => {
422
+ const NestedTextEditor = ({ keyPath, dictionary, renderSection, section, ...props }) => {
405
423
  const { addEditedContent } = useEditedContent();
406
424
  const content = section[NodeType.Nested];
407
425
  const childrenKeyPath = [...keyPath, { type: NodeType.Nested }];
408
426
  return /* @__PURE__ */ jsxs("div", {
409
- className: "w-full p-2",
427
+ className: "flex w-full flex-col gap-4 p-2",
410
428
  children: [
411
429
  /* @__PURE__ */ jsx(Label, { children: "Dictionary key" }),
412
430
  /* @__PURE__ */ jsx(ContentEditorInput, {
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.mjs","names":["traceKeys: string[]","ContentEditorTextArea: FC<ContentEditorTextAreaProps>","ContentEditorTextAreaBase","editedContent","ContentEditorInput: FC<ContentEditorInputProps>","ContentEditorInputBase","ContentEditorToggle: FC<ContentEditorToggleProps>","TranslationTextEditor: FC<TextEditorProps>","content: any","EnumerationTextEditor: FC<TextEditorProps>","ConditionTextEditor: FC<TextEditorProps>","GenderTextEditor: FC<TextEditorProps>","ArrayTextEditor: FC<TextEditorProps>","newKeyPath: KeyPath[]","ObjectTextEditor: FC<TextEditorProps>","childKeyPath: KeyPath[]","MarkdownTextEditor: FC<TextEditorProps>","toggleContent","content","InsertionTextEditor: FC<TextEditorProps>","FileTextEditor: FC<TextEditorProps>","NestedTextEditor: FC<TextEditorProps>","TextEditor: FC<TextEditorProps>","ContentEditorInput","ContentEditorTextArea","TextEditorContainer: FC<TextEditorProps>"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ConditionContent,\n type EnumerationContent,\n type FileContent,\n type GenderContent,\n getEmptyNode,\n getLocaleName,\n getNodeType,\n type InsertionContent,\n type MarkdownContent,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport {\n type ContentNode,\n type Dictionary,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { Container } from '../../Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { InputVariant } from '../../Input';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '../../SwitchSelector';\nimport { EnumKeyInput } from '../EnumKeyInput';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { mutate: auditContentDeclarationField, isPending: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant={ButtonVariant.HOVERABLE}\n size={ButtonSize.ICON_SM}\n color={ButtonColor.TEXT}\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField(\n {\n fileContent: JSON.stringify({\n ...dictionary,\n ...(editedContent?.[dictionary.localId!] ?? {}),\n }),\n keyPath,\n locales: configuration.internationalization.locales ?? [],\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(\n dictionary.localId!,\n editedContent,\n keyPath\n );\n } catch (error) {\n console.error(error);\n }\n },\n }\n );\n }}\n />\n }\n {...props}\n />\n );\n};\n\ntype ContentEditorInputProps = Omit<\n ContentEditorInputPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorInput: FC<ContentEditorInputProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <ContentEditorInputBase\n variant={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n {...props}\n />\n );\n};\n\nconst toggleContent = [\n {\n content: 'False',\n value: false,\n },\n {\n content: 'True',\n value: true,\n },\n] as SwitchSelectorChoices<boolean>;\n\ntype ContentEditorToggleProps = SwitchSelectorProps & {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n};\n\nconst ContentEditorToggle: FC<ContentEditorToggleProps> = ({\n dictionary,\n keyPath,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <SwitchSelector\n choices={toggleContent}\n value={true}\n onChange={(value) =>\n addEditedContent(dictionary.localId!, value, keyPath)\n }\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n renderSection?: (content: string) => ReactNode;\n onContentChange?: (newValue: string) => void;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}: TextEditorProps) => {\n const { locale, defaultLocale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locale, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as LocalesValues[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n const content: any = (section as TranslationContent<string>)[\n NodeType.Translation\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {localesList.map((translationKey) => (\n <Fragment key={translationKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td>{getLocaleName(translationKey, locale)}</td>\n </tr>\n <tr>\n <td>\n <TextEditorContainer\n section={\n content[translationKey] ??\n getEmptyNode(content[defaultLocale])\n }\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration, removeEnumeration } =\n useIntlayer('navigation-view');\n\n const content = (section as EnumerationContent<string>)[NodeType.Enumeration];\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeType.Enumeration },\n ] as KeyPath[];\n return (\n <Fragment key={enumKey}>\n <tr className=\"mt-2 w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n Icon={Trash}\n className=\"ml-auto\"\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </tr>\n <tr className=\"w-full p-2\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.localId!, newValue, keyPath);\n }}\n />\n </tr>\n <tr className=\"block w-full\">\n <TextEditor\n section={\n content[enumKey as keyof typeof content] ??\n getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n\n <Button\n label={addNewEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeType.Condition];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['true', 'false', 'fallback'].map((condKey) => (\n <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td>{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.true)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Condition,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst GenderTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as GenderContent<string>)[NodeType.Gender];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['male', 'female', 'fallback'].map((condKey) => (\n <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td>{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.male)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Gender,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement, removeElement } = useIntlayer('navigation-view');\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {(section as unknown as ContentNode[]).map((subSection, index) => (\n <Fragment key={JSON.stringify(subSection)}>\n <tr className=\"mt-2 flex w-full justify-between gap-2 p-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n className=\"ml-auto\"\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.localId!,\n undefined,\n newKeyPath\n );\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </tr>\n\n <tr className=\"block w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.localId!,\n getEmptyNode((section as unknown as ContentNode[])[0]) ?? '',\n newKeyPath,\n false\n );\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n};\n\nconst ObjectTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => (\n <>\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(section as unknown as Record<string, ContentNode>).map(\n (key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n const typedSection = section as unknown as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(\n typedSection\n )[0] as keyof typeof section;\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n\n return (\n <Fragment key={key}>\n <tr\n key={JSON.stringify(subSection)}\n className=\"mt-2 p-2 text-xs\"\n >\n <td>{String(key)}</td>\n </tr>\n <tr key={JSON.stringify(subSection)} className=\"block w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n );\n }\n )}\n </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Markdown }];\n\n const content = (section as MarkdownContent<ContentNode>)[\n NodeType.Markdown\n ] as ContentNode;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <SwitchSelector\n choices={toggleContent}\n value={mode}\n onChange={setMode}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"ml-auto\"\n />\n\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === MarkdownViewMode.Preview\n ? (content) => (\n <MarkdownRenderer isDarkMode={isDarkMode}>\n {content}\n </MarkdownRenderer>\n )\n : undefined\n }\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Insertion }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeType.Insertion\n ];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst FileTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.File }];\n\n const fileUrl = (section as FileContent)[NodeType.File];\n const { content } = section as FileContent;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <span className=\"text-neutral text-sm\">{fileUrl} </span>\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n renderSection,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as any)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.Nested }] as KeyPath[];\n\n return (\n <div className=\"w-full p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant={InputVariant.DEFAULT}\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\n >\n {content.dictionaryKey ?? ''}\n </ContentEditorInputBase>\n\n <Label>Path (optional)</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant={InputVariant.DEFAULT}\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n isDarkMode,\n}) => {\n const { tsxNotEditable } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n <span>[React Node]</span>\n <span className=\"text-neutral text-xs\">{tsxNotEditable}</span>\n </>\n );\n }\n\n if (nodeType === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Gender) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Insertion) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.File) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string)\n ) : (\n <ContentEditorTextArea\n variant={InputVariant.DEFAULT}\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n )}\n </div>\n );\n }\n\n if (nodeType === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section, null, 2)}\n {JSON.stringify(keyPath, null, 2)}\n NodeType : {nodeType}\n </div>\n );\n};\n\nexport const TextEditorContainer: FC<TextEditorProps> = (props) => (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 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GACT;AAIN,KAAI,aAAa,SAAS,SACxB,QACE,oBAAC;EACa;EACH;EACA;EACG;GACZ;AAIN,KAAI,aAAa,SAAS,KACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,MACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAACC;GACa;GACH;GACT,MAAK;GACL,cAAW;aAEV;IACkB;GACjB;AAIV,KAAI,aAAa,SAAS,KACxB,QACE,oBAAC;EAAI,WAAU;YACZ,OAAO,kBAAkB,aACxB,cAAc,QAAkB,GAEhC,oBAACC;GACC,SAAS,aAAa;GACtB,cAAW;GACF;GACG;aAEX;IACqB;GAEtB;AAIV,KAAI,aAAa,SAAS,QACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACa;GACH;GACT,OAAO;IACP;GACE;AAIV,QACE,qBAAC;EAAI,WAAU;;GAAa;GAEzB,KAAK,UAAU,SAAS,MAAM,EAAE;GAChC,KAAK,UAAU,SAAS,MAAM,EAAE;GAAC;GACtB;;GACR;;AAIV,MAAaC,uBAA4C,UACvD,oBAAC;CACC;CACA,YAAW;CACX,WAAU;CACV,aAAY;WAEZ,oBAAC,cAAW,GAAI,QAAS;EACf"}
1
+ {"version":3,"file":"TextEditor.mjs","names":["traceKeys: string[]","ContentEditorTextArea: FC<ContentEditorTextAreaProps>","ContentEditorTextAreaBase","editedContent","ContentEditorInput: FC<ContentEditorInputProps>","ContentEditorInputBase","ContentEditorToggle: FC<ContentEditorToggleProps>","TranslationTextEditor: FC<TextEditorProps>","content: any","EnumerationTextEditor: FC<TextEditorProps>","ConditionTextEditor: FC<TextEditorProps>","GenderTextEditor: FC<TextEditorProps>","ArrayTextEditor: FC<TextEditorProps>","newKeyPath: KeyPath[]","ObjectTextEditor: FC<TextEditorProps>","childKeyPath: KeyPath[]","MarkdownTextEditor: FC<TextEditorProps>","toggleContent","content","InsertionTextEditor: FC<TextEditorProps>","FileTextEditor: FC<TextEditorProps>","NestedTextEditor: FC<TextEditorProps>","TextEditor: FC<TextEditorProps>","ContentEditorInput","ContentEditorTextArea","TextEditorContainer: FC<TextEditorProps>"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ConditionContent,\n type EnumerationContent,\n type FileContent,\n type GenderContent,\n getEmptyNode,\n getLocaleName,\n getNodeType,\n type InsertionContent,\n type MarkdownContent,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport {\n type ContentNode,\n type Dictionary,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { Container } from '../../Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { InputVariant } from '../../Input';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '../../SwitchSelector';\nimport { EnumKeyInput } from '../EnumKeyInput';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { mutate: auditContentDeclarationField, isPending: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant={ButtonVariant.HOVERABLE}\n size={ButtonSize.ICON_SM}\n color={ButtonColor.TEXT}\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField(\n {\n fileContent: JSON.stringify({\n ...dictionary,\n ...(editedContent?.[dictionary.localId!] ?? {}),\n }),\n keyPath,\n locales: configuration.internationalization.locales ?? [],\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(\n dictionary.localId!,\n editedContent,\n keyPath\n );\n } catch (error) {\n console.error(error);\n }\n },\n }\n );\n }}\n />\n }\n {...props}\n />\n );\n};\n\ntype ContentEditorInputProps = Omit<\n ContentEditorInputPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorInput: FC<ContentEditorInputProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <ContentEditorInputBase\n variant={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n {...props}\n />\n );\n};\n\nconst toggleContent = [\n {\n content: 'False',\n value: false,\n },\n {\n content: 'True',\n value: true,\n },\n] as SwitchSelectorChoices<boolean>;\n\ntype ContentEditorToggleProps = SwitchSelectorProps & {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n};\n\nconst ContentEditorToggle: FC<ContentEditorToggleProps> = ({\n dictionary,\n keyPath,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <SwitchSelector\n choices={toggleContent}\n value={true}\n onChange={(value) =>\n addEditedContent(dictionary.localId!, value, keyPath)\n }\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n renderSection?: (content: string) => ReactNode;\n onContentChange?: (newValue: string) => void;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}: TextEditorProps) => {\n const { locale, defaultLocale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locale, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as LocalesValues[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n const content: any = (section as TranslationContent<string>)[\n NodeType.Translation\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {localesList.map((translationKey) => (\n <Fragment key={translationKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td className=\"w-full\">\n {getLocaleName(translationKey, locale)}\n </td>\n </tr>\n <tr className=\"flex\">\n <td className=\"w-full\">\n <TextEditorContainer\n section={\n content[translationKey] ??\n getEmptyNode(content[defaultLocale])\n }\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration, removeEnumeration } =\n useIntlayer('navigation-view');\n\n const content = (section as EnumerationContent<string>)[NodeType.Enumeration];\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeType.Enumeration },\n ] as KeyPath[];\n return (\n <Fragment key={enumKey}>\n <tr className=\"mt-2 w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n Icon={Trash}\n className=\"ml-auto\"\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </tr>\n <tr className=\"w-full p-2\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.localId!, newValue, keyPath);\n }}\n />\n </tr>\n <tr className=\"block w-full\">\n <TextEditor\n section={\n content[enumKey as keyof typeof content] ??\n getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n\n <Button\n label={addNewEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeType.Condition];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['true', 'false', 'fallback'].map((condKey) => (\n <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.true)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Condition,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst GenderTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as GenderContent<string>)[NodeType.Gender];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['male', 'female', 'fallback'].map((condKey) => (\n <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.male)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Gender,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement, removeElement } = useIntlayer('navigation-view');\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {(section as unknown as ContentNode[]).map((subSection, index) => (\n <Fragment key={JSON.stringify(subSection)}>\n <tr className=\"mt-2 flex w-full items-center justify-between gap-2 p-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n className=\"ml-auto\"\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.localId!,\n undefined,\n newKeyPath\n );\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </tr>\n\n <tr className=\"block w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.localId!,\n getEmptyNode((section as unknown as ContentNode[])[0]) ?? '',\n newKeyPath,\n false\n );\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n};\n\nconst ObjectTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => (\n <>\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(section as unknown as Record<string, ContentNode>).map(\n (key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n const typedSection = section as unknown as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(\n typedSection\n )[0] as keyof typeof section;\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n\n return (\n <Fragment key={key}>\n <tr\n key={JSON.stringify(subSection)}\n className=\"mt-2 p-2 text-xs\"\n >\n <td className=\"w-full\">{String(key)}</td>\n </tr>\n <tr key={JSON.stringify(subSection)} className=\"block w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n );\n }\n )}\n </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Markdown }];\n\n const content = (section as MarkdownContent<ContentNode>)[\n NodeType.Markdown\n ] as ContentNode;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <SwitchSelector\n choices={toggleContent}\n value={mode}\n onChange={setMode}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"ml-auto\"\n />\n\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === MarkdownViewMode.Preview\n ? (content) => (\n <MarkdownRenderer isDarkMode={isDarkMode}>\n {content}\n </MarkdownRenderer>\n )\n : undefined\n }\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Insertion }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeType.Insertion\n ];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst FileTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.File }];\n\n const fileUrl = (section as FileContent)[NodeType.File];\n const { content } = section as FileContent;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <span className=\"text-neutral text-sm\">{fileUrl} </span>\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n renderSection,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as any)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.Nested }] as KeyPath[];\n\n return (\n <div className=\"flex w-full flex-col gap-4 p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant={InputVariant.DEFAULT}\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\n >\n {content.dictionaryKey ?? ''}\n </ContentEditorInputBase>\n\n <Label>Path (optional)</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant={InputVariant.DEFAULT}\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n isDarkMode,\n}) => {\n const { tsxNotEditable } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n <span>[React Node]</span>\n <span className=\"text-neutral text-xs\">{tsxNotEditable}</span>\n </>\n );\n }\n\n if (nodeType === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Gender) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Insertion) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.File) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string)\n ) : (\n <ContentEditorTextArea\n variant={InputVariant.DEFAULT}\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n )}\n </div>\n );\n }\n\n if (nodeType === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section, null, 2)}\n {JSON.stringify(keyPath, null, 2)}\n NodeType : {nodeType}\n </div>\n );\n};\n\nexport const TextEditorContainer: FC<TextEditorProps> = (props) => (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky\"\n roundedSize=\"xl\"\n >\n <TextEditor {...props} />\n </Container>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAaA,YAAsB;CAAC;CAAY;CAAM;CAAW;AAUjE,MAAMC,2BAAyD,EAC7D,SACA,YACA,GAAG,YACC;CACJ,MAAM,EAAE,eA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,aAAa,SAAS,MACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAACC;GACa;GACH;GACT,MAAK;GACL,cAAW;aAEV;IACkB;GACjB;AAIV,KAAI,aAAa,SAAS,KACxB,QACE,oBAAC;EAAI,WAAU;YACZ,OAAO,kBAAkB,aACxB,cAAc,QAAkB,GAEhC,oBAACC;GACC,SAAS,aAAa;GACtB,cAAW;GACF;GACG;aAEX;IACqB;GAEtB;AAIV,KAAI,aAAa,SAAS,QACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACa;GACH;GACT,OAAO;IACP;GACE;AAIV,QACE,qBAAC;EAAI,WAAU;;GAAa;GAEzB,KAAK,UAAU,SAAS,MAAM,EAAE;GAChC,KAAK,UAAU,SAAS,MAAM,EAAE;GAAC;GACtB;;GACR;;AAIV,MAAaC,uBAA4C,UACvD,oBAAC;CACC;CACA,YAAW;CACX,WAAU;CACV,aAAY;WAEZ,oBAAC,cAAW,GAAI,QAAS;EACf"}
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
 
4
+ import { Container } from "../../Container/index.mjs";
4
5
  import { Loader } from "../../Loader/index.mjs";
5
6
  import { ButtonColor, ButtonSize, ButtonVariant } from "../../Button/Button.mjs";
6
- import { Container } from "../../Container/index.mjs";
7
7
  import { useSession } from "../../../hooks/useAuth/useSession.mjs";
8
8
  import { useAuditContentDeclarationMetadata, useGetProjects, useGetTags } from "../../../hooks/reactQuery.mjs";
9
9
  import { MultiSelect } from "../../Select/Multiselect.mjs";
@@ -1,11 +1,12 @@
1
1
  import { Breadcrumb } from "../Breadcrumb/index.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { camelCaseToSentence } from "@intlayer/config/client";
3
4
 
4
5
  //#region src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx
5
6
  const KeyPathBreadcrumb = ({ keyPath, dictionaryKey, onClickKeyPath, locale }) => {
6
7
  return /* @__PURE__ */ jsx(Breadcrumb, {
7
8
  links: [{
8
- text: dictionaryKey,
9
+ text: camelCaseToSentence(dictionaryKey),
9
10
  onClick: () => onClickKeyPath([])
10
11
  }, ...keyPath.map((el, index) => ({
11
12
  onClick: () => onClickKeyPath(keyPath.slice(0, index + 1)),
@@ -1 +1 @@
1
- {"version":3,"file":"KeyPathBreadcrumb.mjs","names":["KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps>"],"sources":["../../../../src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx"],"sourcesContent":["import type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { Breadcrumb, type BreadcrumbLink } from '../Breadcrumb';\n\ntype KeyPathBreadcrumbProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n onClickKeyPath: (keyPath: KeyPath[]) => void;\n locale?: Locale;\n};\n\nexport const KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps> = ({\n keyPath,\n dictionaryKey,\n onClickKeyPath,\n locale,\n}) => {\n const formattedKeyPath: BreadcrumbLink[] = [\n { text: dictionaryKey, onClick: () => onClickKeyPath([]) },\n ...keyPath.map((el, index) => ({\n onClick: () =>\n onClickKeyPath(\n keyPath\n // With keyPath = [{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}, {type: NodeType.Object, key: '1'}]\n // If index is 0 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}])\n // If index is 1 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}])\n .slice(0, index + 1)\n ),\n text: el.key?.toString() ?? '',\n })),\n ];\n\n return (\n <Breadcrumb\n links={formattedKeyPath}\n locale={locale}\n elementType=\"location\"\n />\n );\n};\n"],"mappings":";;;;AAWA,MAAaA,qBAAiD,EAC5D,SACA,eACA,gBACA,aACI;AAgBJ,QACE,oBAAC;EACC,OAjBuC,CACzC;GAAE,MAAM;GAAe,eAAe,eAAe,EAAE,CAAC;GAAE,EAC1D,GAAG,QAAQ,KAAK,IAAI,WAAW;GAC7B,eACE,eACE,QAIG,MAAM,GAAG,QAAQ,EAAE,CACvB;GACH,MAAM,GAAG,KAAK,UAAU,IAAI;GAC7B,EAAE,CACJ;EAKW;EACR,aAAY;GACZ"}
1
+ {"version":3,"file":"KeyPathBreadcrumb.mjs","names":["KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps>"],"sources":["../../../../src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx"],"sourcesContent":["import { camelCaseToSentence } from '@intlayer/config/client';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { Breadcrumb, type BreadcrumbLink } from '../Breadcrumb';\n\ntype KeyPathBreadcrumbProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n onClickKeyPath: (keyPath: KeyPath[]) => void;\n locale?: Locale;\n};\n\nexport const KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps> = ({\n keyPath,\n dictionaryKey,\n onClickKeyPath,\n locale,\n}) => {\n const formattedKeyPath: BreadcrumbLink[] = [\n {\n text: camelCaseToSentence(dictionaryKey),\n onClick: () => onClickKeyPath([]),\n },\n ...keyPath.map((el, index) => ({\n onClick: () =>\n onClickKeyPath(\n keyPath\n // With keyPath = [{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}, {type: NodeType.Object, key: '1'}]\n // If index is 0 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}])\n // If index is 1 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}])\n .slice(0, index + 1)\n ),\n text: el.key?.toString() ?? '',\n })),\n ];\n\n return (\n <Breadcrumb\n links={formattedKeyPath}\n locale={locale}\n elementType=\"location\"\n />\n );\n};\n"],"mappings":";;;;;AAYA,MAAaA,qBAAiD,EAC5D,SACA,eACA,gBACA,aACI;AAmBJ,QACE,oBAAC;EACC,OApBuC,CACzC;GACE,MAAM,oBAAoB,cAAc;GACxC,eAAe,eAAe,EAAE,CAAC;GAClC,EACD,GAAG,QAAQ,KAAK,IAAI,WAAW;GAC7B,eACE,eACE,QAIG,MAAM,GAAG,QAAQ,EAAE,CACvB;GACH,MAAM,GAAG,KAAK,UAAU,IAAI;GAC7B,EAAE,CACJ;EAKW;EACR,aAAY;GACZ"}
@@ -1,7 +1,6 @@
1
1
  import { Button, ButtonColor, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
2
2
  import { Accordion } from "../../Accordion/Accordion.mjs";
3
3
  import { getIsEditableSection } from "../getIsEditableSection.mjs";
4
- import { camelCaseToSentence } from "../../../utils/camelCase.mjs";
5
4
  import { ChevronRight, Plus } from "lucide-react";
6
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
6
  import { getContentNodeByKeyPath, getEmptyNode, getNodeType, isSameKeyPath } from "@intlayer/core";
@@ -9,6 +8,7 @@ import { useIntlayer } from "react-intlayer";
9
8
  import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
10
9
  import configuration from "@intlayer/config/built";
11
10
  import { NodeType } from "@intlayer/types";
11
+ import { camelCaseToSentence } from "@intlayer/config/client";
12
12
 
13
13
  //#region src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx
14
14
  const traceKeys = [