@intlayer/design-system 6.1.5 → 6.1.6

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 (336) hide show
  1. package/dist/.vite/manifest.json +13 -9
  2. package/dist/Form-CriPBaZk.js.map +1 -1
  3. package/dist/Form-DJrUK3mm.cjs.map +1 -1
  4. package/dist/components/Accordion/Accordion.cjs +51 -15
  5. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  6. package/dist/components/Accordion/Accordion.d.ts +44 -5
  7. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  8. package/dist/components/Accordion/Accordion.mjs +52 -16
  9. package/dist/components/Accordion/Accordion.mjs.map +1 -1
  10. package/dist/components/Avatar/index.cjs +114 -31
  11. package/dist/components/Avatar/index.cjs.map +1 -1
  12. package/dist/components/Avatar/index.d.ts +46 -2
  13. package/dist/components/Avatar/index.d.ts.map +1 -1
  14. package/dist/components/Avatar/index.mjs +115 -32
  15. package/dist/components/Avatar/index.mjs.map +1 -1
  16. package/dist/components/Badge/index.cjs +88 -9
  17. package/dist/components/Badge/index.cjs.map +1 -1
  18. package/dist/components/Badge/index.d.ts +80 -2
  19. package/dist/components/Badge/index.d.ts.map +1 -1
  20. package/dist/components/Badge/index.mjs +89 -10
  21. package/dist/components/Badge/index.mjs.map +1 -1
  22. package/dist/components/Breadcrumb/index.cjs +124 -59
  23. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  24. package/dist/components/Breadcrumb/index.d.ts +89 -5
  25. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  26. package/dist/components/Breadcrumb/index.mjs +124 -59
  27. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  28. package/dist/components/Button/Button.cjs +44 -25
  29. package/dist/components/Button/Button.cjs.map +1 -1
  30. package/dist/components/Button/Button.d.ts +95 -1
  31. package/dist/components/Button/Button.d.ts.map +1 -1
  32. package/dist/components/Button/Button.mjs +44 -25
  33. package/dist/components/Button/Button.mjs.map +1 -1
  34. package/dist/components/ClickOutsideDiv/index.cjs +38 -7
  35. package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
  36. package/dist/components/ClickOutsideDiv/index.d.ts +13 -0
  37. package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -1
  38. package/dist/components/ClickOutsideDiv/index.mjs +39 -8
  39. package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
  40. package/dist/components/Container/index.cjs +2 -0
  41. package/dist/components/Container/index.cjs.map +1 -1
  42. package/dist/components/Container/index.d.ts +42 -0
  43. package/dist/components/Container/index.d.ts.map +1 -1
  44. package/dist/components/Container/index.mjs +2 -0
  45. package/dist/components/Container/index.mjs.map +1 -1
  46. package/dist/components/ContentEditor/ContentEditor.cjs +80 -33
  47. package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
  48. package/dist/components/ContentEditor/ContentEditor.d.ts +29 -0
  49. package/dist/components/ContentEditor/ContentEditor.d.ts.map +1 -1
  50. package/dist/components/ContentEditor/ContentEditor.mjs +80 -33
  51. package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
  52. package/dist/components/ContentEditor/ContentEditorInput.cjs +58 -31
  53. package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
  54. package/dist/components/ContentEditor/ContentEditorInput.d.ts +33 -0
  55. package/dist/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
  56. package/dist/components/ContentEditor/ContentEditorInput.mjs +58 -31
  57. package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
  58. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +58 -30
  59. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  60. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +35 -0
  61. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
  62. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +59 -31
  63. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  64. package/dist/components/ContentEditor/index.cjs +4 -0
  65. package/dist/components/ContentEditor/index.cjs.map +1 -1
  66. package/dist/components/ContentEditor/index.d.ts +2 -0
  67. package/dist/components/ContentEditor/index.d.ts.map +1 -1
  68. package/dist/components/ContentEditor/index.mjs +5 -1
  69. package/dist/components/ContentEditor/index.mjs.map +1 -1
  70. package/dist/components/ContentSelector/ContentSelector.cjs +9 -1
  71. package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
  72. package/dist/components/ContentSelector/ContentSelector.d.ts +167 -0
  73. package/dist/components/ContentSelector/ContentSelector.d.ts.map +1 -1
  74. package/dist/components/ContentSelector/ContentSelector.mjs +9 -1
  75. package/dist/components/ContentSelector/ContentSelector.mjs.map +1 -1
  76. package/dist/components/CopyButton/index.cjs +23 -8
  77. package/dist/components/CopyButton/index.cjs.map +1 -1
  78. package/dist/components/CopyButton/index.d.ts +78 -0
  79. package/dist/components/CopyButton/index.d.ts.map +1 -1
  80. package/dist/components/CopyButton/index.mjs +23 -8
  81. package/dist/components/CopyButton/index.mjs.map +1 -1
  82. package/dist/components/CopyToClipboard/index.cjs +58 -22
  83. package/dist/components/CopyToClipboard/index.cjs.map +1 -1
  84. package/dist/components/CopyToClipboard/index.d.ts +68 -2
  85. package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
  86. package/dist/components/CopyToClipboard/index.mjs +59 -23
  87. package/dist/components/CopyToClipboard/index.mjs.map +1 -1
  88. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +4 -2
  89. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  90. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -0
  91. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  92. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +4 -2
  93. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  94. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +2 -2
  95. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  96. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -2
  97. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  98. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +3 -0
  99. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  100. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +1 -0
  101. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  102. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +3 -0
  103. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  104. package/dist/components/DropDown/index.cjs +6 -4
  105. package/dist/components/DropDown/index.cjs.map +1 -1
  106. package/dist/components/DropDown/index.d.ts +92 -15
  107. package/dist/components/DropDown/index.d.ts.map +1 -1
  108. package/dist/components/DropDown/index.mjs +6 -4
  109. package/dist/components/DropDown/index.mjs.map +1 -1
  110. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  111. package/dist/components/EditableField/EditableFieldInput.d.ts +38 -0
  112. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  113. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  114. package/dist/components/EditableField/EditableFieldLayout.cjs +10 -2
  115. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  116. package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
  117. package/dist/components/EditableField/EditableFieldLayout.mjs +10 -2
  118. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  119. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  120. package/dist/components/EditableField/EditableFieldTextArea.d.ts +42 -0
  121. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  122. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  123. package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
  124. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +58 -0
  125. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  126. package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
  127. package/dist/components/Footer/index.cjs.map +1 -1
  128. package/dist/components/Footer/index.d.ts +101 -0
  129. package/dist/components/Footer/index.d.ts.map +1 -1
  130. package/dist/components/Footer/index.mjs.map +1 -1
  131. package/dist/components/Form/elements/MultiselectElement.d.ts.map +1 -1
  132. package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
  133. package/dist/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
  134. package/dist/components/Headers/index.cjs.map +1 -1
  135. package/dist/components/Headers/index.d.ts +69 -2
  136. package/dist/components/Headers/index.d.ts.map +1 -1
  137. package/dist/components/Headers/index.mjs.map +1 -1
  138. package/dist/components/HeightResizer/index.cjs +10 -7
  139. package/dist/components/HeightResizer/index.cjs.map +1 -1
  140. package/dist/components/HeightResizer/index.d.ts +89 -0
  141. package/dist/components/HeightResizer/index.d.ts.map +1 -1
  142. package/dist/components/HeightResizer/index.mjs +10 -7
  143. package/dist/components/HeightResizer/index.mjs.map +1 -1
  144. package/dist/components/InformationTag/index.cjs.map +1 -1
  145. package/dist/components/InformationTag/index.d.ts +72 -0
  146. package/dist/components/InformationTag/index.d.ts.map +1 -1
  147. package/dist/components/InformationTag/index.mjs.map +1 -1
  148. package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
  149. package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
  150. package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
  151. package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
  152. package/dist/components/Label/index.cjs +25 -3
  153. package/dist/components/Label/index.cjs.map +1 -1
  154. package/dist/components/Label/index.d.ts +65 -1
  155. package/dist/components/Label/index.d.ts.map +1 -1
  156. package/dist/components/Label/index.mjs +26 -4
  157. package/dist/components/Label/index.mjs.map +1 -1
  158. package/dist/components/Link/Link.cjs +0 -4
  159. package/dist/components/Link/Link.cjs.map +1 -1
  160. package/dist/components/Link/Link.d.ts +169 -0
  161. package/dist/components/Link/Link.d.ts.map +1 -1
  162. package/dist/components/Link/Link.mjs +0 -4
  163. package/dist/components/Link/Link.mjs.map +1 -1
  164. package/dist/components/Loader/index.cjs.map +1 -1
  165. package/dist/components/Loader/index.d.ts +82 -11
  166. package/dist/components/Loader/index.d.ts.map +1 -1
  167. package/dist/components/Loader/index.mjs.map +1 -1
  168. package/dist/components/Loader/spinner.cjs.map +1 -1
  169. package/dist/components/Loader/spinner.d.ts +56 -0
  170. package/dist/components/Loader/spinner.d.ts.map +1 -1
  171. package/dist/components/Loader/spinner.mjs.map +1 -1
  172. package/dist/components/MarkDownRender/MarkDownRender.cjs +0 -1
  173. package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
  174. package/dist/components/MarkDownRender/MarkDownRender.d.ts +147 -0
  175. package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  176. package/dist/components/MarkDownRender/MarkDownRender.mjs +0 -1
  177. package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  178. package/dist/components/MarkDownRender/processor.cjs +12 -9
  179. package/dist/components/MarkDownRender/processor.cjs.map +1 -1
  180. package/dist/components/MarkDownRender/processor.d.ts.map +1 -1
  181. package/dist/components/MarkDownRender/processor.mjs +12 -9
  182. package/dist/components/MarkDownRender/processor.mjs.map +1 -1
  183. package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
  184. package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
  185. package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
  186. package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
  187. package/dist/components/Modal/Modal.cjs +5 -0
  188. package/dist/components/Modal/Modal.cjs.map +1 -1
  189. package/dist/components/Modal/Modal.d.ts +81 -3
  190. package/dist/components/Modal/Modal.d.ts.map +1 -1
  191. package/dist/components/Modal/Modal.mjs +5 -0
  192. package/dist/components/Modal/Modal.mjs.map +1 -1
  193. package/dist/components/Navbar/Burger.cjs.map +1 -1
  194. package/dist/components/Navbar/Burger.d.ts +54 -0
  195. package/dist/components/Navbar/Burger.d.ts.map +1 -1
  196. package/dist/components/Navbar/Burger.mjs.map +1 -1
  197. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  198. package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
  199. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  200. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  201. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  202. package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
  203. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  204. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  205. package/dist/components/Navbar/index.cjs.map +1 -1
  206. package/dist/components/Navbar/index.d.ts +69 -0
  207. package/dist/components/Navbar/index.d.ts.map +1 -1
  208. package/dist/components/Navbar/index.mjs.map +1 -1
  209. package/dist/components/Navbar/useNavigation.cjs +8 -1
  210. package/dist/components/Navbar/useNavigation.cjs.map +1 -1
  211. package/dist/components/Navbar/useNavigation.d.ts +83 -0
  212. package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
  213. package/dist/components/Navbar/useNavigation.mjs +8 -1
  214. package/dist/components/Navbar/useNavigation.mjs.map +1 -1
  215. package/dist/components/Pattern/DotPattern.cjs.map +1 -1
  216. package/dist/components/Pattern/DotPattern.d.ts +101 -0
  217. package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
  218. package/dist/components/Pattern/DotPattern.mjs.map +1 -1
  219. package/dist/components/Pattern/GridPattern.cjs.map +1 -1
  220. package/dist/components/Pattern/GridPattern.d.ts +114 -0
  221. package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
  222. package/dist/components/Pattern/GridPattern.mjs.map +1 -1
  223. package/dist/components/Pattern/SpotLight.cjs.map +1 -1
  224. package/dist/components/Pattern/SpotLight.d.ts +125 -0
  225. package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
  226. package/dist/components/Pattern/SpotLight.mjs.map +1 -1
  227. package/dist/components/Popover/index.cjs +10 -10
  228. package/dist/components/Popover/index.cjs.map +1 -1
  229. package/dist/components/Popover/index.d.ts +110 -15
  230. package/dist/components/Popover/index.d.ts.map +1 -1
  231. package/dist/components/Popover/index.mjs +10 -10
  232. package/dist/components/Popover/index.mjs.map +1 -1
  233. package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
  234. package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
  235. package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
  236. package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
  237. package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
  238. package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
  239. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  240. package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
  241. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  242. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  243. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
  244. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
  245. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
  246. package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
  247. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  248. package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
  249. package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
  250. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  251. package/dist/components/Select/Multiselect.cjs.map +1 -1
  252. package/dist/components/Select/Multiselect.d.ts +125 -18
  253. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  254. package/dist/components/Select/Multiselect.mjs.map +1 -1
  255. package/dist/components/Select/Select.cjs.map +1 -1
  256. package/dist/components/Select/Select.d.ts +214 -7
  257. package/dist/components/Select/Select.d.ts.map +1 -1
  258. package/dist/components/Select/Select.mjs.map +1 -1
  259. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  260. package/dist/components/SwitchSelector/index.d.ts +157 -8
  261. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  262. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  263. package/dist/components/Table/Table.cjs.map +1 -1
  264. package/dist/components/Table/Table.d.ts +184 -0
  265. package/dist/components/Table/Table.d.ts.map +1 -1
  266. package/dist/components/Table/Table.mjs.map +1 -1
  267. package/dist/components/Tag/index.cjs.map +1 -1
  268. package/dist/components/Tag/index.d.ts +223 -0
  269. package/dist/components/Tag/index.d.ts.map +1 -1
  270. package/dist/components/Tag/index.mjs.map +1 -1
  271. package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
  272. package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
  273. package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
  274. package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
  275. package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
  276. package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
  277. package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
  278. package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  279. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  280. package/dist/components/TextArea/TextArea.d.ts +74 -0
  281. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  282. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  283. package/dist/components/Toaster/Toast.cjs +4 -0
  284. package/dist/components/Toaster/Toast.cjs.map +1 -1
  285. package/dist/components/Toaster/Toast.d.ts +148 -2
  286. package/dist/components/Toaster/Toast.d.ts.map +1 -1
  287. package/dist/components/Toaster/Toast.mjs +4 -0
  288. package/dist/components/Toaster/Toast.mjs.map +1 -1
  289. package/dist/components/Toaster/Toaster.cjs.map +1 -1
  290. package/dist/components/Toaster/Toaster.d.ts +42 -0
  291. package/dist/components/Toaster/Toaster.d.ts.map +1 -1
  292. package/dist/components/Toaster/Toaster.mjs.map +1 -1
  293. package/dist/components/Toaster/useToast.cjs.map +1 -1
  294. package/dist/components/Toaster/useToast.d.ts +199 -2
  295. package/dist/components/Toaster/useToast.d.ts.map +1 -1
  296. package/dist/components/Toaster/useToast.mjs.map +1 -1
  297. package/dist/components/WithResizer/index.cjs.map +1 -1
  298. package/dist/components/WithResizer/index.d.ts +143 -0
  299. package/dist/components/WithResizer/index.d.ts.map +1 -1
  300. package/dist/components/WithResizer/index.mjs.map +1 -1
  301. package/dist/components/index.cjs +2 -2
  302. package/dist/components/index.d.ts +0 -1
  303. package/dist/components/index.d.ts.map +1 -1
  304. package/dist/components/index.mjs +4 -4
  305. package/dist/components/index.mjs.map +1 -1
  306. package/dist/hooks/auth.cjs +2 -2
  307. package/dist/hooks/auth.cjs.map +1 -1
  308. package/dist/hooks/auth.mjs +2 -2
  309. package/dist/hooks/auth.mjs.map +1 -1
  310. package/dist/hooks/reactQuery.cjs +2 -1
  311. package/dist/hooks/reactQuery.cjs.map +1 -1
  312. package/dist/hooks/reactQuery.d.ts +1 -1
  313. package/dist/hooks/reactQuery.d.ts.map +1 -1
  314. package/dist/hooks/reactQuery.mjs +2 -1
  315. package/dist/hooks/reactQuery.mjs.map +1 -1
  316. package/dist/hooks/useAuth/useOAuth2.cjs +3 -3
  317. package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
  318. package/dist/hooks/useAuth/useOAuth2.mjs +3 -3
  319. package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
  320. package/dist/hooks/useAuth/useSession.cjs +3 -3
  321. package/dist/hooks/useAuth/useSession.cjs.map +1 -1
  322. package/dist/hooks/useAuth/useSession.mjs +3 -3
  323. package/dist/hooks/useAuth/useSession.mjs.map +1 -1
  324. package/dist/utils/image.cjs +30 -0
  325. package/dist/utils/image.cjs.map +1 -0
  326. package/dist/utils/image.d.ts +37 -0
  327. package/dist/utils/image.d.ts.map +1 -0
  328. package/dist/utils/image.mjs +30 -0
  329. package/dist/utils/image.mjs.map +1 -0
  330. package/package.json +20 -18
  331. package/dist/utils/capitalize.cjs +0 -10
  332. package/dist/utils/capitalize.cjs.map +0 -1
  333. package/dist/utils/capitalize.d.ts +0 -2
  334. package/dist/utils/capitalize.d.ts.map +0 -1
  335. package/dist/utils/capitalize.mjs +0 -10
  336. package/dist/utils/capitalize.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport { type FC, type PropsWithChildren, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CopyToClipboardProps = PropsWithChildren<{\n text: string;\n className?: string;\n}>;\n\nexport const CopyToClipboard: FC<CopyToClipboardProps> = ({\n text,\n children,\n className,\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n\n const handleCopy = () => {\n navigator.clipboard.writeText(text).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 1000);\n });\n };\n\n return (\n <span\n className={cn(\n 'inline-block gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5',\n className\n )}\n onClick={handleCopy}\n >\n {children}\n\n <span className=\"inline-flex\">\n {text &&\n (isCopied ? (\n <CopyCheck\n size={12}\n aria-label=\"copied\"\n role=\"button\"\n data-testid=\"copy-to-clipboard\"\n className=\"ml-1 mt-1\"\n />\n ) : (\n <CopyIcon\n size={12}\n aria-label=\"copy\"\n role=\"button\"\n data-testid=\"copy-to-clipboard\"\n className=\"ml-1 mt-1 cursor-pointer\"\n />\n ))}\n </span>\n </span>\n );\n};\n"],"names":["useState","jsxs","cn","jsx","CopyCheck","CopyIcon"],"mappings":";;;;;;;AAWO,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,UAAU,WAAW,IAAIA,aAAAA,SAAS,KAAK;AAE9C,QAAM,aAAa,MAAM;AACvB,cAAU,UAAU,UAAU,IAAI,EAAE,KAAK,MAAM;AAC7C,kBAAY,IAAI;AAChB,iBAAW,MAAM,YAAY,KAAK,GAAG,GAAI;AAAA,IAC3C,CAAC;AAAA,EACH;AAEA,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,MAER,UAAA;AAAA,QAAA;AAAA,QAEDC,2BAAAA,IAAC,QAAA,EAAK,WAAU,eACb,mBACE,WACCA,2BAAAA;AAAAA,UAACC,YAAAA;AAAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,cAAW;AAAA,YACX,MAAK;AAAA,YACL,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA,IAGZD,2BAAAA;AAAAA,UAACE,YAAAA;AAAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,cAAW;AAAA,YACX,MAAK;AAAA,YACL,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA,GACZ,CAEN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport { type FC, type PropsWithChildren, useState } 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/**\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}) => {\n const [isCopied, setIsCopied] = useState(false);\n const [copyError, setCopyError] = useState<string | null>(null);\n\n const handleCopy = async () => {\n if (!text) return;\n\n try {\n setCopyError(null);\n\n if (navigator.clipboard && 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.execCommand('copy');\n document.body.removeChild(textArea);\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 setCopyError(errorMessage);\n onCopyError?.(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear error after feedback duration\n setTimeout(() => setCopyError(null), feedbackDuration);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleCopy();\n }\n };\n\n const currentAriaLabel = copyError\n ? `Error copying to clipboard: ${copyError}`\n : isCopied\n ? ariaCopiedLabel\n : ariaLabel;\n\n const IconComponent = copyError ? CopyIcon : isCopied ? CopyCheck : CopyIcon;\n\n return (\n <span\n className={cn(\n 'inline-flex gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5',\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 {children}\n\n {text && (\n <IconComponent\n size={12}\n className={cn(\n 'ml-1 transition-colors duration-200',\n copyError && 'text-destructive',\n isCopied && 'text-success',\n !copyError &&\n !isCopied &&\n 'text-muted-foreground hover:text-foreground'\n )}\n aria-hidden=\"true\"\n />\n )}\n </span>\n );\n};\n"],"names":["useState","CopyIcon","CopyCheck","jsxs","cn","jsx"],"mappings":";;;;;;;AAmFO,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,qBAAqB,kBAAkB;AAAA,EACvC,mBAAmB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AA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,MACT,WAAW;AAAA,MACX,MAAK;AAAA,MACL,UAAU;AAAA,MACV,cAAY;AAAA,MACZ,gBAAc;AAAA,MACd,eAAY;AAAA,MAEX,UAAA;AAAA,QAAA;AAAA,QAEA,QACCC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA,aAAa;AAAA,cACb,YAAY;AAAA,cACZ,CAAC,aACC,CAAC,YACD;AAAA,YAAA;AAAA,YAEJ,eAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA;AAIR;;"}
@@ -1,7 +1,73 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- export type CopyToClipboardProps = PropsWithChildren<{
2
+ /**
3
+ * Props for the CopyToClipboard component
4
+ */
5
+ export interface CopyToClipboardProps extends PropsWithChildren {
6
+ /**
7
+ * The text to copy to the clipboard when clicked
8
+ * @example "Hello World"
9
+ * @example "npm install @intlayer/design-system"
10
+ */
3
11
  text: string;
12
+ /**
13
+ * Additional CSS classes for the wrapper element
14
+ * @example "bg-blue-100 text-blue-800"
15
+ */
4
16
  className?: string;
5
- }>;
17
+ /**
18
+ * Accessible label for screen readers when copy operation is available
19
+ * @default "Copy to clipboard"
20
+ */
21
+ 'aria-label'?: string;
22
+ /**
23
+ * Accessible label for screen readers when content has been copied
24
+ * @default "Copied to clipboard"
25
+ */
26
+ 'aria-copied-label'?: string;
27
+ /**
28
+ * Duration in milliseconds to show the "copied" state
29
+ * @default 2000
30
+ */
31
+ feedbackDuration?: number;
32
+ /**
33
+ * Callback function called when copy operation succeeds
34
+ */
35
+ onCopySuccess?: () => void;
36
+ /**
37
+ * Callback function called when copy operation fails
38
+ */
39
+ onCopyError?: (error: Error) => void;
40
+ }
41
+ /**
42
+ * CopyToClipboard Component
43
+ *
44
+ * A versatile component that allows users to copy text to their clipboard with visual feedback.
45
+ * Provides accessibility features, customizable feedback duration, and error handling.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // Basic usage
50
+ * <CopyToClipboard text="Hello World">
51
+ * <span>Click to copy</span>
52
+ * </CopyToClipboard>
53
+ *
54
+ * // With custom styling and callbacks
55
+ * <CopyToClipboard
56
+ * text="npm install @intlayer/design-system"
57
+ * className="bg-gray-100 p-2"
58
+ * feedbackDuration={3000}
59
+ * onCopySuccess={() => console.log('Copied!')}
60
+ * >
61
+ * <code>npm install @intlayer/design-system</code>
62
+ * </CopyToClipboard>
63
+ * ```
64
+ *
65
+ * @component
66
+ * @accessibility
67
+ * - Uses proper ARIA labels for copy and copied states
68
+ * - Supports keyboard navigation (Enter and Space keys)
69
+ * - Announces state changes to screen readers
70
+ * - Provides visual focus indicators
71
+ */
6
72
  export declare const CopyToClipboard: FC<CopyToClipboardProps>;
7
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CopyToClipboard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAGlE,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA8CpD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CopyToClipboard/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAGlE;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAgGpD,CAAC"}
@@ -1,49 +1,85 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
- import { CopyCheck, CopyIcon } from "lucide-react";
3
+ import { CopyIcon, CopyCheck } from "lucide-react";
4
4
  import { useState } from "react";
5
5
  import { cn } from "../../utils/cn.mjs";
6
6
  const CopyToClipboard = ({
7
7
  text,
8
8
  children,
9
- className
9
+ className,
10
+ "aria-label": ariaLabel = "Copy to clipboard",
11
+ "aria-copied-label": ariaCopiedLabel = "Copied to clipboard",
12
+ feedbackDuration = 2e3,
13
+ onCopySuccess,
14
+ onCopyError
10
15
  }) => {
11
16
  const [isCopied, setIsCopied] = useState(false);
12
- const handleCopy = () => {
13
- navigator.clipboard.writeText(text).then(() => {
17
+ const [copyError, setCopyError] = useState(null);
18
+ const handleCopy = async () => {
19
+ if (!text) return;
20
+ try {
21
+ setCopyError(null);
22
+ if (navigator.clipboard && navigator.clipboard.writeText) {
23
+ await navigator.clipboard.writeText(text);
24
+ } else {
25
+ const textArea = document.createElement("textarea");
26
+ textArea.value = text;
27
+ textArea.style.position = "fixed";
28
+ textArea.style.left = "-999999px";
29
+ textArea.style.top = "-999999px";
30
+ document.body.appendChild(textArea);
31
+ textArea.focus();
32
+ textArea.select();
33
+ document.execCommand("copy");
34
+ document.body.removeChild(textArea);
35
+ }
14
36
  setIsCopied(true);
15
- setTimeout(() => setIsCopied(false), 1e3);
16
- });
37
+ setTimeout(() => setIsCopied(false), feedbackDuration);
38
+ onCopySuccess?.();
39
+ } catch (error) {
40
+ const errorMessage = error instanceof Error ? error.message : "Failed to copy to clipboard";
41
+ setCopyError(errorMessage);
42
+ onCopyError?.(error instanceof Error ? error : new Error(errorMessage));
43
+ setTimeout(() => setCopyError(null), feedbackDuration);
44
+ }
45
+ };
46
+ const handleKeyDown = (event) => {
47
+ if (event.key === "Enter" || event.key === " ") {
48
+ event.preventDefault();
49
+ handleCopy();
50
+ }
17
51
  };
52
+ const currentAriaLabel = copyError ? `Error copying to clipboard: ${copyError}` : isCopied ? ariaCopiedLabel : ariaLabel;
53
+ const IconComponent = copyError ? CopyIcon : isCopied ? CopyCheck : CopyIcon;
18
54
  return /* @__PURE__ */ jsxs(
19
55
  "span",
20
56
  {
21
57
  className: cn(
22
- "inline-block gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5",
58
+ "inline-flex gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5",
23
59
  className
24
60
  ),
25
61
  onClick: handleCopy,
62
+ onKeyDown: handleKeyDown,
63
+ role: "button",
64
+ tabIndex: 0,
65
+ "aria-label": currentAriaLabel,
66
+ "aria-pressed": isCopied,
67
+ "data-testid": "copy-to-clipboard",
26
68
  children: [
27
69
  children,
28
- /* @__PURE__ */ jsx("span", { className: "inline-flex", children: text && (isCopied ? /* @__PURE__ */ jsx(
29
- CopyCheck,
30
- {
31
- size: 12,
32
- "aria-label": "copied",
33
- role: "button",
34
- "data-testid": "copy-to-clipboard",
35
- className: "ml-1 mt-1"
36
- }
37
- ) : /* @__PURE__ */ jsx(
38
- CopyIcon,
70
+ text && /* @__PURE__ */ jsx(
71
+ IconComponent,
39
72
  {
40
73
  size: 12,
41
- "aria-label": "copy",
42
- role: "button",
43
- "data-testid": "copy-to-clipboard",
44
- className: "ml-1 mt-1 cursor-pointer"
74
+ className: cn(
75
+ "ml-1 transition-colors duration-200",
76
+ copyError && "text-destructive",
77
+ isCopied && "text-success",
78
+ !copyError && !isCopied && "text-muted-foreground hover:text-foreground"
79
+ ),
80
+ "aria-hidden": "true"
45
81
  }
46
- )) })
82
+ )
47
83
  ]
48
84
  }
49
85
  );
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport { type FC, type PropsWithChildren, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CopyToClipboardProps = PropsWithChildren<{\n text: string;\n className?: string;\n}>;\n\nexport const CopyToClipboard: FC<CopyToClipboardProps> = ({\n text,\n children,\n className,\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n\n const handleCopy = () => {\n navigator.clipboard.writeText(text).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 1000);\n });\n };\n\n return (\n <span\n className={cn(\n 'inline-block gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5',\n className\n )}\n onClick={handleCopy}\n >\n {children}\n\n <span className=\"inline-flex\">\n {text &&\n (isCopied ? (\n <CopyCheck\n size={12}\n aria-label=\"copied\"\n role=\"button\"\n data-testid=\"copy-to-clipboard\"\n className=\"ml-1 mt-1\"\n />\n ) : (\n <CopyIcon\n size={12}\n aria-label=\"copy\"\n role=\"button\"\n data-testid=\"copy-to-clipboard\"\n className=\"ml-1 mt-1 cursor-pointer\"\n />\n ))}\n </span>\n </span>\n );\n};\n"],"names":[],"mappings":";;;;;AAWO,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,QAAM,aAAa,MAAM;AACvB,cAAU,UAAU,UAAU,IAAI,EAAE,KAAK,MAAM;AAC7C,kBAAY,IAAI;AAChB,iBAAW,MAAM,YAAY,KAAK,GAAG,GAAI;AAAA,IAC3C,CAAC;AAAA,EACH;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,MAER,UAAA;AAAA,QAAA;AAAA,QAED,oBAAC,QAAA,EAAK,WAAU,eACb,mBACE,WACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,cAAW;AAAA,YACX,MAAK;AAAA,YACL,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA,IAGZ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,cAAW;AAAA,YACX,MAAK;AAAA,YACL,eAAY;AAAA,YACZ,WAAU;AAAA,UAAA;AAAA,QAAA,GACZ,CAEN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport { type FC, type PropsWithChildren, useState } 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/**\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}) => {\n const [isCopied, setIsCopied] = useState(false);\n const [copyError, setCopyError] = useState<string | null>(null);\n\n const handleCopy = async () => {\n if (!text) return;\n\n try {\n setCopyError(null);\n\n if (navigator.clipboard && 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.execCommand('copy');\n document.body.removeChild(textArea);\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 setCopyError(errorMessage);\n onCopyError?.(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear error after feedback duration\n setTimeout(() => setCopyError(null), feedbackDuration);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleCopy();\n }\n };\n\n const currentAriaLabel = copyError\n ? `Error copying to clipboard: ${copyError}`\n : isCopied\n ? ariaCopiedLabel\n : ariaLabel;\n\n const IconComponent = copyError ? CopyIcon : isCopied ? CopyCheck : CopyIcon;\n\n return (\n <span\n className={cn(\n 'inline-flex gap-2 hover:cursor-pointer hover:bg-neutral/10 rounded-md p-0.5',\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 {children}\n\n {text && (\n <IconComponent\n size={12}\n className={cn(\n 'ml-1 transition-colors duration-200',\n copyError && 'text-destructive',\n isCopied && 'text-success',\n !copyError &&\n !isCopied &&\n 'text-muted-foreground hover:text-foreground'\n )}\n aria-hidden=\"true\"\n />\n )}\n </span>\n );\n};\n"],"names":[],"mappings":";;;;;AAmFO,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,qBAAqB,kBAAkB;AAAA,EACvC,mBAAmB;AAAA,EACnB;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAE9D,QAAM,aAAa,YAAY;AAC7B,QAAI,CAAC,KAAM;AAEX,QAAI;AACF,mBAAa,IAAI;AAEjB,UAAI,UAAU,aAAa,UAAU,UAAU,WAAW;AACxD,cAAM,UAAU,UAAU,UAAU,IAAI;AAAA,MAC1C,OAAO;AAEL,cAAM,WAAW,SAAS,cAAc,UAAU;AAClD,iBAAS,QAAQ;AACjB,iBAAS,MAAM,WAAW;AAC1B,iBAAS,MAAM,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({
31
31
  onClickDictionaryList,
32
32
  isDarkMode,
33
33
  mode,
34
- onDelete
34
+ onDelete,
35
+ onSave
35
36
  }) => {
36
37
  const config = editorReact.useConfiguration();
37
38
  const [editorView, setEditorView] = ReactExports.useState(
@@ -115,7 +116,8 @@ const DictionaryFieldEditor = ({
115
116
  onDelete: () => {
116
117
  setFocusedContent(null);
117
118
  onDelete?.();
118
- }
119
+ },
120
+ onSave
119
121
  }
120
122
  )
121
123
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.localId!]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useIntlayer","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ButtonVariant","ButtonColor","ArrowLeft","SwitchSelector","SwitchSelectorColor","SwitchSelectorSize","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAA;AACf,QAAM,CAAC,YAAY,aAAa,IAAIC,aAAAA;AAAAA,IAClC;AAAA;AAAA,EAAA;AAEF,QAAM,EAAE,uBAAA,IAA2BC,cAAAA,YAAY,yBAAyB;AACxE,QAAM,EAAE,kBAAA,IAAsBC,sCAAA;AAC9B,QAAM,EAAE,sBAAA,IAA0BC,yCAAA;AAElCC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAA;AAAA,MACZ,eAAe,WAAW;AAAA,MAC1B,mBAAmB,WAAW;AAAA,IAAA,EAC9B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,OAAQ,GAAG;AAAA,IAAA,EACvB;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,SACEC,2BAAAA;AAAAA,IAACC,sEAAAA;AAAAA,IAAA;AAAA,MACC,kBAAkB,QAAQ,qBAAqB,WAAW,CAAA;AAAA,MAE1D,UAAAC,2BAAAA,KAAC,OAAA,EAAI,WAAU,sCACb,UAAA;AAAA,QAAAF,2BAAAA;AAAAA,UAACG,yBAAAA;AAAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,SAASC,yBAAAA,cAAc;AAAA,YACvB,WAAU;AAAA,YAC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A,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n onSave?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n onSave,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.localId!]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n onSave={onSave}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useIntlayer","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ButtonVariant","ButtonColor","ArrowLeft","SwitchSelector","SwitchSelectorColor","SwitchSelectorSize","DictionaryDetail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UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,YACxC,OAAOC,gCAAAA,oBAAoB;AAAA,YAC3B,MAAMC,gCAAAA,mBAAmB;AAAA,YACzB,WAAU;AAAA,YACV,SAAS;AAAA,cACP;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MAAA,MACD,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QAAA;AAAA,QAGD,eAAe,KACdT,2BAAAA,IAACU,yEAAAA,uBAAA,EAAsB,WAAA,CAAwB;AAAA,QAEhD,eAAe,KACdV,2BAAAA,IAACW,iDAAAA,iBAAA,EAAgB,WAAA,CAAwB;AAAA,QAE1C,eAAe,KACdX,2BAAAA,IAACY,+CAAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACdZ,2BAAAA,IAACa,4CAAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9Db,2BAAAA;AAAAA,UAACc,mDAAAA;AAAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
@@ -4,6 +4,7 @@ type DictionaryFieldEditorProps = {
4
4
  dictionary: Dictionary;
5
5
  onClickDictionaryList?: () => void;
6
6
  onDelete?: () => void;
7
+ onSave?: () => void;
7
8
  isDarkMode?: boolean;
8
9
  mode: ('local' | 'remote')[];
9
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAerD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoGhE,CAAC"}
1
+ {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAerD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAsGhE,CAAC"}
@@ -29,7 +29,8 @@ const DictionaryFieldEditor = ({
29
29
  onClickDictionaryList,
30
30
  isDarkMode,
31
31
  mode,
32
- onDelete
32
+ onDelete,
33
+ onSave
33
34
  }) => {
34
35
  const config = useConfiguration();
35
36
  const [editorView, setEditorView] = useState(
@@ -113,7 +114,8 @@ const DictionaryFieldEditor = ({
113
114
  onDelete: () => {
114
115
  setFocusedContent(null);
115
116
  onDelete?.();
116
- }
117
+ },
118
+ onSave
117
119
  }
118
120
  )
119
121
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.localId!]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n </LocaleSwitcherContentProvider>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AAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MAAA,MACD,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QAAA;AAAA,QAGD,eAAe,KACd,oBAAC,uBAAA,EAAsB,WAAA,CAAwB;AAAA,QAEhD,eAAe,KACd,oBAAC,iBAAA,EAAgB,WAAA,CAAwB;AAAA,QAE1C,eAAe,KACd,oBAAC,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACd,oBAAC,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n onSave?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n onSave,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.localId!]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n onSave={onSave}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,iBAAA;AACf,QAAM,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EAAA;AAEF,QAAM,EAAE,uBAAA,IAA2B,YAAY,yBAAyB;AACxE,QAAM,EAAE,kBAAA,IAAsB,0BAAA;AAC9B,QAAM,EAAE,sBAAA,IAA0B,6BAAA;AAElC,YAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAA;AAAA,MACZ,eAAe,WAAW;AAAA,MAC1B,mBAAmB,WAAW;AAAA,IAAA,EAC9B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,OAAQ,GAAG;AAAA,IAAA,EACvB;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,SACE;AAAA,IAA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kB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const configuration = require("@intlayer/config/built");
4
+ const defaultConfiguration = require("@intlayer/config/built");
5
5
  const core = require("@intlayer/core");
6
6
  const editorReact = require("@intlayer/editor-react");
7
7
  const lucideReact = require("lucide-react");
@@ -16,7 +16,7 @@ const NavigationViewNode = ({
16
16
  keyPath,
17
17
  dictionaryKey
18
18
  }) => {
19
- const { locales } = configuration?.internationalization;
19
+ const { locales } = defaultConfiguration?.internationalization;
20
20
  const section = core.getContentNodeByKeyPath(sectionProp, keyPath);
21
21
  const { addEditedContent } = editorReact.useEditedContentActions();
22
22
  const { setFocusedContentKeyPath, focusedContent } = editorReact.useFocusDictionary();
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationViewNode.cjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\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 const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["getContentNodeByKeyPath","useEditedContentActions","useFocusDictionary","useIntlayer","getNodeType","keyPath","isSameKeyPath","getIsEditableSection","jsx","Fragment","Button","ButtonVariant","ButtonColor","ChevronRight","NodeType","jsxs","ButtonTextAlign","sectionArray","getEmptyNode","Plus","isEditableSubSection","Accordion","camelCaseToSentence"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAY,eAAe;AACnC,QAAM,UAAUA,KAAAA,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqBC,oCAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmBC,+BAAA;AACrD,QAAM,EAAE,eAAe,cAAcC,cAAAA,YAAY,iBAAiB;AAClE,QAAM,WAAWC,KAAAA,YAAY,OAAO;AACpC,QAAM,gBAAgB,CAACC,cACpB,gBAAgB,SAAS,UAAU,KAAK,KACzCC,KAAAA,cAAcD,UAAS,gBAAgB,WAAW,CAAA,CAAE;AACtD,QAAM,uBAAuBE,sDAAAA,qBAAqB,OAAO;AAEz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AC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,SAAS;AAAA,cACT;AAAA,YAAA;AAAA,UAAA,GAEJ,EAAA,CACF;AAAA,QAAA;AAAA,QAdK;AAAA,MAAA;AAAA,IAiBX,CAAC,EAAA,CACH;AAAA,EAEJ;AAEA,SACEO,2BAAAA,KAAAN,qBAAA,EAAE,UAAA;AAAA,IAAA;AAAA,IAEC;AAAA,IAAS;AAAA,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;;;"}
1
+ {"version":3,"file":"NavigationViewNode.cjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\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 const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["configuration","getContentNodeByKeyPath","useEditedContentActions","useFocusDictionary","useIntlayer","getNodeType","keyPath","isSameKeyPath","getIsEditableSection","jsx","Fragment","Button","ButtonVariant","ButtonColor","ChevronRight","NodeType","jsxs","ButtonTextAlign","sectionArray","getEmptyNode","Plus","isEditableSubSection","Accordion","camelCaseToSentence"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAYA,sBAAe;AACnC,QAAM,UAAUC,KAAAA,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqBC,oCAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmBC,+BAAA;AACrD,QAAM,EAAE,eAAe,cAAcC,cAAAA,YAAY,iBAAiB;AAClE,QAAM,WAAWC,KAAAA,YAAY,OAAO;AACpC,QAAM,gBAAgB,CAACC,cACpB,gBAAgB,SAAS,UAAU,KAAK,KACzCC,KAAAA,cAAcD,UAAS,gBAAgB,WAAW,CAAA,CAAE;AACtD,QAAM,uBAAuBE,sDAAAA,qBAAqB,OAAO;AAEzD,MAAI,CAAC,QAAS,QAAOC,+BAAAC,WAAAA,UAAA,CAAA,CAAE;AAEvB,MAAI,sBAAsB;AACxB,WACED,2BAAAA;AAAAA,MAACE,yBAAAA;AAAAA,MAAA;AAAA,QACC,OAAO,UAAU,MAAM;AAAA,QACvB,SAASC,yBAAAA,cAAc;AAAA,QACvB,OAAOC,yBAAAA,YAAY;AAAA,QACnB,WAAU;AAAA,QACV,SAAS,M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A,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import configuration from "@intlayer/config/built";
2
+ import defaultConfiguration from "@intlayer/config/built";
3
3
  import { getContentNodeByKeyPath, getNodeType, NodeType, getEmptyNode, isSameKeyPath } from "@intlayer/core";
4
4
  import { useEditedContentActions, useFocusDictionary } from "@intlayer/editor-react";
5
5
  import { ChevronRight, Plus } from "lucide-react";
@@ -14,7 +14,7 @@ const NavigationViewNode = ({
14
14
  keyPath,
15
15
  dictionaryKey
16
16
  }) => {
17
- const { locales } = configuration?.internationalization;
17
+ const { locales } = defaultConfiguration?.internationalization;
18
18
  const section = getContentNodeByKeyPath(sectionProp, keyPath);
19
19
  const { addEditedContent } = useEditedContentActions();
20
20
  const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationViewNode.mjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\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 const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["keyPath","sectionArray","isEditableSubSection"],"mappings":";;;;;;;;;;AA4BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAY,eAAe;AACnC,QAAM,UAAU,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqB,wBAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmB,mBAAA;AACrD,QAAM,EAAE,eAAe,cAAc,YAAY,iBAAiB;AAClE,QAAM,WAAW,YAAY,OAAO;AACpC,QAAM,gBAAgB,CAACA,cACpB,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAcA,UAAS,gBAAgB,WAAW,CAAA,CAAE;AACtD,QAAM,uBAAuB,qBAAqB,OAAO;AAEzD,MAAI,CAAC,QAAS,QAAO,oBAAA,UAAA,CAAA,CAAE;AAEvB,MAAI,sBAAsB;AACxB,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO,UAAU,MAAM;AAAA,QACvB,SAAS,cAAc;AAAA,QACvB,OAAO,YAAY;AAAA,QACnB,WAAU;AAAA,QACV,SAAS,MAAM,yBAAyB,OAAO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;AAE5D,UAAIA,uBAAsB;AACxB,eACE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO,GAAG,UAAU,MAAM,KAAK,IAAI,GAAG;AAAA,YAEtC,UAAU,cAAc,YAAY;AAAA,YACpC,SAAS,cAAc;AAAA,YACvB,OAAO,YAAY;AAAA,YACnB,WAAU;AAAA,YACV,SAAS,MAAM,yBAAyB,YAAY;AAAA,YACpD,WAAW;AAAA,YAEV,8BAAoB,GAAG;AAAA,UAAA;AAAA,UARnB;AAAA,QAAA;AAAA,MAWX;AAEA,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,OAAO,GAAG,UAAU,MAAM,KAAK,IAAI,GAAG;AAAA,UACtC,UAAU,cAAc,YAAY;AAAA,UACpC,SAAS,MAAM,yBAAyB,YAAY;AAAA,UACpD,QAAQ,oBAAoB,GAAG;AAAA,UAE/B,8BAAC,OAAA,EAAI,WAAU,+BACb,UAAA,oBAAC,OAAA,EAAI,WAAU,gBACb,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,SAAS;AAAA,cACT;AAAA,YAAA;AAAA,UAAA,GAEJ,EAAA,CACF;AAAA,QAAA;AAAA,QAdK;AAAA,MAAA;AAAA,IAiBX,CAAC,EAAA,CACH;AAAA,EAEJ;AAEA,SACE,qBAAA,UAAA,EAAE,UAAA;AAAA,IAAA;AAAA,IAEC;AAAA,IAAS;AAAA,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;"}
1
+ {"version":3,"file":"NavigationViewNode.mjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\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 const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["configuration","keyPath","sectionArray","isEditableSubSection"],"mappings":";;;;;;;;;;AA4BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAYA,sBAAe;AACnC,QAAM,UAAU,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqB,wBAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmB,mBAAA;AACrD,QAAM,EAAE,eAAe,cAAc,YAAY,iBAAiB;AAClE,QAAM,WAAW,YAAY,OAAO;AACpC,QAAM,gBAAgB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;AAAA,IAAS;AAAA,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;"}
@@ -25,6 +25,7 @@ const SaveForm = ({
25
25
  mode,
26
26
  className,
27
27
  onDelete,
28
+ onSave,
28
29
  ...props
29
30
  }) => {
30
31
  const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = ReactExports.useState(false);
@@ -60,6 +61,7 @@ const SaveForm = ({
60
61
  onSuccess: () => {
61
62
  setLocaleDictionary(editedContent?.[dictionary.localId]);
62
63
  restoreEditedContent(dictionary.localId);
64
+ onSave?.();
63
65
  }
64
66
  }
65
67
  );
@@ -75,6 +77,7 @@ const SaveForm = ({
75
77
  if (res) {
76
78
  setLocaleDictionary(editedContent?.[dictionary.localId]);
77
79
  restoreEditedContent(dictionary.localId);
80
+ onSave?.();
78
81
  }
79
82
  }
80
83
  });