@intlayer/design-system 5.4.2 → 5.5.0-canary.0

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 (152) hide show
  1. package/dist/.vite/manifest.json +21 -67
  2. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +14 -2
  3. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  4. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -0
  5. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  6. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +14 -2
  7. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  8. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +13 -2
  9. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  10. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -0
  11. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  12. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +13 -2
  13. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  14. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +30 -4
  15. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  16. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +2 -1
  17. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  18. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +32 -6
  19. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  20. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -0
  21. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  22. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +68 -0
  23. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  24. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -0
  25. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  26. package/dist/components/Footer/index.cjs +3 -3
  27. package/dist/components/Footer/index.cjs.map +1 -1
  28. package/dist/components/Footer/index.mjs +3 -3
  29. package/dist/components/Footer/index.mjs.map +1 -1
  30. package/dist/components/Link/Link.cjs +2 -2
  31. package/dist/components/Link/Link.cjs.map +1 -1
  32. package/dist/components/Link/Link.d.ts +1 -1
  33. package/dist/components/Link/Link.d.ts.map +1 -1
  34. package/dist/components/Link/Link.mjs +2 -2
  35. package/dist/components/Link/Link.mjs.map +1 -1
  36. package/dist/components/Logo/Logo.cjs +43 -0
  37. package/dist/components/Logo/Logo.cjs.map +1 -0
  38. package/dist/components/Logo/Logo.d.ts +6 -0
  39. package/dist/components/Logo/Logo.d.ts.map +1 -0
  40. package/dist/components/Logo/Logo.mjs +43 -0
  41. package/dist/components/Logo/Logo.mjs.map +1 -0
  42. package/dist/components/Logo/LogoTextOnly.cjs +14 -82
  43. package/dist/components/Logo/LogoTextOnly.cjs.map +1 -1
  44. package/dist/components/Logo/LogoTextOnly.d.ts +2 -3
  45. package/dist/components/Logo/LogoTextOnly.d.ts.map +1 -1
  46. package/dist/components/Logo/LogoTextOnly.mjs +14 -82
  47. package/dist/components/Logo/LogoTextOnly.mjs.map +1 -1
  48. package/dist/components/Logo/LogoWithText.cjs +43 -0
  49. package/dist/components/Logo/LogoWithText.cjs.map +1 -0
  50. package/dist/components/Logo/LogoWithText.d.ts +3 -0
  51. package/dist/components/Logo/LogoWithText.d.ts.map +1 -0
  52. package/dist/components/Logo/LogoWithText.mjs +43 -0
  53. package/dist/components/Logo/LogoWithText.mjs.map +1 -0
  54. package/dist/components/Logo/LogoWithTextBelow.cjs +43 -0
  55. package/dist/components/Logo/LogoWithTextBelow.cjs.map +1 -0
  56. package/dist/components/Logo/LogoWithTextBelow.d.ts +6 -0
  57. package/dist/components/Logo/LogoWithTextBelow.d.ts.map +1 -0
  58. package/dist/components/Logo/LogoWithTextBelow.mjs +43 -0
  59. package/dist/components/Logo/LogoWithTextBelow.mjs.map +1 -0
  60. package/dist/components/Logo/index.cjs +7 -63
  61. package/dist/components/Logo/index.cjs.map +1 -1
  62. package/dist/components/Logo/index.d.ts +4 -19
  63. package/dist/components/Logo/index.d.ts.map +1 -1
  64. package/dist/components/Logo/index.mjs +7 -63
  65. package/dist/components/Logo/index.mjs.map +1 -1
  66. package/dist/components/SocialNetworks/index.cjs +1 -1
  67. package/dist/components/SocialNetworks/index.cjs.map +1 -1
  68. package/dist/components/SocialNetworks/index.mjs +1 -1
  69. package/dist/components/SocialNetworks/index.mjs.map +1 -1
  70. package/dist/components/SwitchSelector/index.cjs +1 -1
  71. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  72. package/dist/components/SwitchSelector/index.d.ts +1 -1
  73. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  74. package/dist/components/SwitchSelector/index.mjs +1 -1
  75. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  76. package/dist/components/index.cjs +8 -2
  77. package/dist/components/index.cjs.map +1 -1
  78. package/dist/components/index.mjs +7 -1
  79. package/dist/components/index.mjs.map +1 -1
  80. package/dist/hooks/index.cjs +1 -0
  81. package/dist/hooks/index.cjs.map +1 -1
  82. package/dist/hooks/index.mjs +2 -1
  83. package/dist/hooks/intlayerAPIHooks.cjs +6 -0
  84. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  85. package/dist/hooks/intlayerAPIHooks.d.ts +2 -1
  86. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  87. package/dist/hooks/intlayerAPIHooks.mjs +6 -0
  88. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  89. package/dist/hooks/useIntlayerAPI.d.ts +2 -1
  90. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  91. package/dist/tailwind.css +1 -1
  92. package/package.json +18 -18
  93. package/dist/components/Logo/LogoCircle.cjs +0 -28
  94. package/dist/components/Logo/LogoCircle.cjs.map +0 -1
  95. package/dist/components/Logo/LogoCircle.d.ts +0 -4
  96. package/dist/components/Logo/LogoCircle.d.ts.map +0 -1
  97. package/dist/components/Logo/LogoCircle.mjs +0 -28
  98. package/dist/components/Logo/LogoCircle.mjs.map +0 -1
  99. package/dist/components/Logo/LogoNoFrame.cjs +0 -111
  100. package/dist/components/Logo/LogoNoFrame.cjs.map +0 -1
  101. package/dist/components/Logo/LogoNoFrame.d.ts +0 -4
  102. package/dist/components/Logo/LogoNoFrame.d.ts.map +0 -1
  103. package/dist/components/Logo/LogoNoFrame.mjs +0 -111
  104. package/dist/components/Logo/LogoNoFrame.mjs.map +0 -1
  105. package/dist/components/Logo/LogoSquare.cjs +0 -28
  106. package/dist/components/Logo/LogoSquare.cjs.map +0 -1
  107. package/dist/components/Logo/LogoSquare.d.ts +0 -4
  108. package/dist/components/Logo/LogoSquare.d.ts.map +0 -1
  109. package/dist/components/Logo/LogoSquare.mjs +0 -28
  110. package/dist/components/Logo/LogoSquare.mjs.map +0 -1
  111. package/dist/components/Logo/LogoSquircle.cjs +0 -65
  112. package/dist/components/Logo/LogoSquircle.cjs.map +0 -1
  113. package/dist/components/Logo/LogoSquircle.d.ts +0 -4
  114. package/dist/components/Logo/LogoSquircle.d.ts.map +0 -1
  115. package/dist/components/Logo/LogoSquircle.mjs +0 -65
  116. package/dist/components/Logo/LogoSquircle.mjs.map +0 -1
  117. package/dist/components/Logo/LogoWithTextBelowCircle.cjs +0 -115
  118. package/dist/components/Logo/LogoWithTextBelowCircle.cjs.map +0 -1
  119. package/dist/components/Logo/LogoWithTextBelowCircle.d.ts +0 -4
  120. package/dist/components/Logo/LogoWithTextBelowCircle.d.ts.map +0 -1
  121. package/dist/components/Logo/LogoWithTextBelowCircle.mjs +0 -115
  122. package/dist/components/Logo/LogoWithTextBelowCircle.mjs.map +0 -1
  123. package/dist/components/Logo/LogoWithTextBelowNoFrame.cjs +0 -114
  124. package/dist/components/Logo/LogoWithTextBelowNoFrame.cjs.map +0 -1
  125. package/dist/components/Logo/LogoWithTextBelowNoFrame.d.ts +0 -4
  126. package/dist/components/Logo/LogoWithTextBelowNoFrame.d.ts.map +0 -1
  127. package/dist/components/Logo/LogoWithTextBelowNoFrame.mjs +0 -114
  128. package/dist/components/Logo/LogoWithTextBelowNoFrame.mjs.map +0 -1
  129. package/dist/components/Logo/LogoWithTextBelowSquircle.cjs +0 -68
  130. package/dist/components/Logo/LogoWithTextBelowSquircle.cjs.map +0 -1
  131. package/dist/components/Logo/LogoWithTextBelowSquircle.d.ts +0 -4
  132. package/dist/components/Logo/LogoWithTextBelowSquircle.d.ts.map +0 -1
  133. package/dist/components/Logo/LogoWithTextBelowSquircle.mjs +0 -68
  134. package/dist/components/Logo/LogoWithTextBelowSquircle.mjs.map +0 -1
  135. package/dist/components/Logo/LogoWithTextCircle.cjs +0 -202
  136. package/dist/components/Logo/LogoWithTextCircle.cjs.map +0 -1
  137. package/dist/components/Logo/LogoWithTextCircle.d.ts +0 -4
  138. package/dist/components/Logo/LogoWithTextCircle.d.ts.map +0 -1
  139. package/dist/components/Logo/LogoWithTextCircle.mjs +0 -202
  140. package/dist/components/Logo/LogoWithTextCircle.mjs.map +0 -1
  141. package/dist/components/Logo/LogoWithTextNoFrame.cjs +0 -114
  142. package/dist/components/Logo/LogoWithTextNoFrame.cjs.map +0 -1
  143. package/dist/components/Logo/LogoWithTextNoFrame.d.ts +0 -4
  144. package/dist/components/Logo/LogoWithTextNoFrame.d.ts.map +0 -1
  145. package/dist/components/Logo/LogoWithTextNoFrame.mjs +0 -114
  146. package/dist/components/Logo/LogoWithTextNoFrame.mjs.map +0 -1
  147. package/dist/components/Logo/LogoWithTextSquircle.cjs +0 -68
  148. package/dist/components/Logo/LogoWithTextSquircle.cjs.map +0 -1
  149. package/dist/components/Logo/LogoWithTextSquircle.d.ts +0 -4
  150. package/dist/components/Logo/LogoWithTextSquircle.d.ts.map +0 -1
  151. package/dist/components/Logo/LogoWithTextSquircle.mjs +0 -68
  152. package/dist/components/Logo/LogoWithTextSquircle.mjs.map +0 -1
@@ -1079,6 +1079,7 @@
1079
1079
  "src": "src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx",
1080
1080
  "isEntry": true,
1081
1081
  "imports": [
1082
+ "src/components/Modal/Modal.tsx",
1082
1083
  "src/hooks/useScrollBlockage/useScrollBlockageStore.ts",
1083
1084
  "src/hooks/useAsync/useAsyncStateStore.tsx",
1084
1085
  "src/hooks/intlayerAPIHooks.ts",
@@ -1096,7 +1097,6 @@
1096
1097
  "src/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.ts",
1097
1098
  "src/components/Auth/ResetPasswordForm/resetPasswordContent.content.ts",
1098
1099
  "src/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.ts",
1099
- "src/components/Modal/Modal.tsx",
1100
1100
  "src/components/Auth/VerifyEmailForm/index.content.ts",
1101
1101
  "src/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.ts",
1102
1102
  "src/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.ts",
@@ -1295,7 +1295,7 @@
1295
1295
  "src": "src/components/Footer/index.tsx",
1296
1296
  "isEntry": true,
1297
1297
  "imports": [
1298
- "src/components/Logo/index.tsx",
1298
+ "src/components/Logo/LogoWithTextBelow.tsx",
1299
1299
  "src/components/SocialNetworks/index.tsx"
1300
1300
  ]
1301
1301
  },
@@ -1938,28 +1938,10 @@
1938
1938
  "src": "src/components/LocaleSwitcherDropDown/localeSwitcher.content.ts",
1939
1939
  "isEntry": true
1940
1940
  },
1941
- "src/components/Logo/LogoCircle.tsx": {
1942
- "file": "components/Logo/LogoCircle.cjs",
1943
- "name": "components/Logo/LogoCircle",
1944
- "src": "src/components/Logo/LogoCircle.tsx",
1945
- "isEntry": true
1946
- },
1947
- "src/components/Logo/LogoNoFrame.tsx": {
1948
- "file": "components/Logo/LogoNoFrame.cjs",
1949
- "name": "components/Logo/LogoNoFrame",
1950
- "src": "src/components/Logo/LogoNoFrame.tsx",
1951
- "isEntry": true
1952
- },
1953
- "src/components/Logo/LogoSquare.tsx": {
1954
- "file": "components/Logo/LogoSquare.cjs",
1955
- "name": "components/Logo/LogoSquare",
1956
- "src": "src/components/Logo/LogoSquare.tsx",
1957
- "isEntry": true
1958
- },
1959
- "src/components/Logo/LogoSquircle.tsx": {
1960
- "file": "components/Logo/LogoSquircle.cjs",
1961
- "name": "components/Logo/LogoSquircle",
1962
- "src": "src/components/Logo/LogoSquircle.tsx",
1941
+ "src/components/Logo/Logo.tsx": {
1942
+ "file": "components/Logo/Logo.cjs",
1943
+ "name": "components/Logo/Logo",
1944
+ "src": "src/components/Logo/Logo.tsx",
1963
1945
  "isEntry": true
1964
1946
  },
1965
1947
  "src/components/Logo/LogoTextOnly.tsx": {
@@ -1968,40 +1950,16 @@
1968
1950
  "src": "src/components/Logo/LogoTextOnly.tsx",
1969
1951
  "isEntry": true
1970
1952
  },
1971
- "src/components/Logo/LogoWithTextBelowCircle.tsx": {
1972
- "file": "components/Logo/LogoWithTextBelowCircle.cjs",
1973
- "name": "components/Logo/LogoWithTextBelowCircle",
1974
- "src": "src/components/Logo/LogoWithTextBelowCircle.tsx",
1953
+ "src/components/Logo/LogoWithText.tsx": {
1954
+ "file": "components/Logo/LogoWithText.cjs",
1955
+ "name": "components/Logo/LogoWithText",
1956
+ "src": "src/components/Logo/LogoWithText.tsx",
1975
1957
  "isEntry": true
1976
1958
  },
1977
- "src/components/Logo/LogoWithTextBelowNoFrame.tsx": {
1978
- "file": "components/Logo/LogoWithTextBelowNoFrame.cjs",
1979
- "name": "components/Logo/LogoWithTextBelowNoFrame",
1980
- "src": "src/components/Logo/LogoWithTextBelowNoFrame.tsx",
1981
- "isEntry": true
1982
- },
1983
- "src/components/Logo/LogoWithTextBelowSquircle.tsx": {
1984
- "file": "components/Logo/LogoWithTextBelowSquircle.cjs",
1985
- "name": "components/Logo/LogoWithTextBelowSquircle",
1986
- "src": "src/components/Logo/LogoWithTextBelowSquircle.tsx",
1987
- "isEntry": true
1988
- },
1989
- "src/components/Logo/LogoWithTextCircle.tsx": {
1990
- "file": "components/Logo/LogoWithTextCircle.cjs",
1991
- "name": "components/Logo/LogoWithTextCircle",
1992
- "src": "src/components/Logo/LogoWithTextCircle.tsx",
1993
- "isEntry": true
1994
- },
1995
- "src/components/Logo/LogoWithTextNoFrame.tsx": {
1996
- "file": "components/Logo/LogoWithTextNoFrame.cjs",
1997
- "name": "components/Logo/LogoWithTextNoFrame",
1998
- "src": "src/components/Logo/LogoWithTextNoFrame.tsx",
1999
- "isEntry": true
2000
- },
2001
- "src/components/Logo/LogoWithTextSquircle.tsx": {
2002
- "file": "components/Logo/LogoWithTextSquircle.cjs",
2003
- "name": "components/Logo/LogoWithTextSquircle",
2004
- "src": "src/components/Logo/LogoWithTextSquircle.tsx",
1959
+ "src/components/Logo/LogoWithTextBelow.tsx": {
1960
+ "file": "components/Logo/LogoWithTextBelow.cjs",
1961
+ "name": "components/Logo/LogoWithTextBelow",
1962
+ "src": "src/components/Logo/LogoWithTextBelow.tsx",
2005
1963
  "isEntry": true
2006
1964
  },
2007
1965
  "src/components/Logo/index.tsx": {
@@ -2010,17 +1968,10 @@
2010
1968
  "src": "src/components/Logo/index.tsx",
2011
1969
  "isEntry": true,
2012
1970
  "imports": [
2013
- "src/components/Logo/LogoCircle.tsx",
2014
- "src/components/Logo/LogoNoFrame.tsx",
2015
- "src/components/Logo/LogoSquare.tsx",
2016
- "src/components/Logo/LogoSquircle.tsx",
1971
+ "src/components/Logo/Logo.tsx",
2017
1972
  "src/components/Logo/LogoTextOnly.tsx",
2018
- "src/components/Logo/LogoWithTextBelowCircle.tsx",
2019
- "src/components/Logo/LogoWithTextBelowNoFrame.tsx",
2020
- "src/components/Logo/LogoWithTextBelowSquircle.tsx",
2021
- "src/components/Logo/LogoWithTextCircle.tsx",
2022
- "src/components/Logo/LogoWithTextNoFrame.tsx",
2023
- "src/components/Logo/LogoWithTextSquircle.tsx"
1973
+ "src/components/Logo/LogoWithText.tsx",
1974
+ "src/components/Logo/LogoWithTextBelow.tsx"
2024
1975
  ]
2025
1976
  },
2026
1977
  "src/components/MarkDownRender/index.tsx": {
@@ -2556,7 +2507,10 @@
2556
2507
  "src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.tsx",
2557
2508
  "src/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.tsx",
2558
2509
  "src/components/LocaleSwitcherDropDown/LocaleSwitcher.tsx",
2559
- "src/components/Logo/index.tsx",
2510
+ "src/components/Logo/Logo.tsx",
2511
+ "src/components/Logo/LogoTextOnly.tsx",
2512
+ "src/components/Logo/LogoWithText.tsx",
2513
+ "src/components/Logo/LogoWithTextBelow.tsx",
2560
2514
  "src/components/MarkDownRender/index.tsx",
2561
2515
  "src/components/MaxHeightSmoother/index.tsx",
2562
2516
  "src/components/MaxWidthSmoother/index.tsx",
@@ -9,10 +9,11 @@ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../inde
9
9
  const DictionaryEditor = ({
10
10
  dictionary,
11
11
  mode,
12
+ onDelete,
12
13
  ...props
13
14
  }) => {
14
15
  const { editedContent, addEditedContent } = editorReact.useEditedContent();
15
- const { focusedContent, setFocusedContentKeyPath } = editorReact.useFocusDictionary();
16
+ const { focusedContent, setFocusedContentKeyPath, setFocusedContent } = editorReact.useFocusDictionary();
16
17
  const focusedKeyPath = focusedContent?.keyPath;
17
18
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col justify-between gap-2", children: [
18
19
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ ReactExports.createElement(
@@ -33,7 +34,18 @@ const DictionaryEditor = ({
33
34
  onFocusKeyPath: setFocusedContentKeyPath
34
35
  }
35
36
  ) }),
36
- /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode, className: "mb-4 flex-col" })
37
+ /* @__PURE__ */ jsxRuntime.jsx(
38
+ components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm,
39
+ {
40
+ dictionary,
41
+ mode,
42
+ className: "mb-4 flex-col",
43
+ onDelete: () => {
44
+ setFocusedContent(null);
45
+ onDelete?.();
46
+ }
47
+ }
48
+ )
37
49
  ] });
38
50
  };
39
51
  exports.DictionaryEditor = DictionaryEditor;
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm dictionary={dictionary} mode={mode} className=\"mb-4 flex-col\" />\n </div>\n );\n};\n"],"names":["useEditedContent","useFocusDictionary","jsxs","jsx","createElement","NodeWrapper","SaveForm"],"mappings":";;;;;;;;AAeO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAIA,6BAAiB;AAC7D,QAAM,EAAE,gBAAgB,yBAAyB,IAAIC,+BAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AAGrC,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAAC,+BAAC,OACC,EAAA,UAAAC,6BAAA;AAAA,MAACC,qDAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV;AAAA,QACA,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACCF,2BAAA,IAAAG,mDAAA,UAAA,EAAS,YAAwB,MAAY,WAAU,gBAAgB,CAAA;AAAA,EAAA,GAC1E;AAEJ;;"}
1
+ {"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n onDelete,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath, setFocusedContent } =\n useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n className=\"mb-4 flex-col\"\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n );\n};\n"],"names":["useEditedContent","useFocusDictionary","jsxs","jsx","createElement","NodeWrapper","SaveForm"],"mappings":";;;;;;;;AAgBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAIA,6BAAiB;AAC7D,QAAM,EAAE,gBAAgB,0BAA0B,kBAAA,IAChDC,YAAAA,mBAAmB;AAErB,QAAM,iBAAiB,gBAAgB;AAGrC,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAAC,+BAAC,OACC,EAAA,UAAAC,6BAAA;AAAA,MAACC,qDAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV;AAAA,QACA,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACAF,2BAAA;AAAA,MAACG,mDAAA;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,WAAU;AAAA,QACV,UAAU,MAAM;AACd,4BAAkB,IAAI;AACX,qBAAA;AAAA,QAAA;AAAA,MACb;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
@@ -5,6 +5,7 @@ type DictionaryEditorProps = {
5
5
  dictionary: Dictionary;
6
6
  locale: Locales;
7
7
  mode: ('local' | 'remote')[];
8
+ onDelete?: () => void;
8
9
  };
9
10
  export declare const DictionaryEditor: FC<DictionaryEditorProps>;
10
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAgCtD,CAAC"}
1
+ {"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA0CtD,CAAC"}
@@ -7,10 +7,11 @@ import { N as NodeWrapper } from "../../index-aPP3MzPT.js";
7
7
  const DictionaryEditor = ({
8
8
  dictionary,
9
9
  mode,
10
+ onDelete,
10
11
  ...props
11
12
  }) => {
12
13
  const { editedContent, addEditedContent } = useEditedContent();
13
- const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();
14
+ const { focusedContent, setFocusedContentKeyPath, setFocusedContent } = useFocusDictionary();
14
15
  const focusedKeyPath = focusedContent?.keyPath;
15
16
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col justify-between gap-2", children: [
16
17
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ createElement(
@@ -31,7 +32,18 @@ const DictionaryEditor = ({
31
32
  onFocusKeyPath: setFocusedContentKeyPath
32
33
  }
33
34
  ) }),
34
- /* @__PURE__ */ jsx(SaveForm, { dictionary, mode, className: "mb-4 flex-col" })
35
+ /* @__PURE__ */ jsx(
36
+ SaveForm,
37
+ {
38
+ dictionary,
39
+ mode,
40
+ className: "mb-4 flex-col",
41
+ onDelete: () => {
42
+ setFocusedContent(null);
43
+ onDelete?.();
44
+ }
45
+ }
46
+ )
35
47
  ] });
36
48
  };
37
49
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm dictionary={dictionary} mode={mode} className=\"mb-4 flex-col\" />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAI,iBAAiB;AAC7D,QAAM,EAAE,gBAAgB,yBAAyB,IAAI,mBAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AAGrC,SAAA,qBAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAA,oBAAC,OACC,EAAA,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV;AAAA,QACA,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACC,oBAAA,UAAA,EAAS,YAAwB,MAAY,WAAU,gBAAgB,CAAA;AAAA,EAAA,GAC1E;AAEJ;"}
1
+ {"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n onDelete,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath, setFocusedContent } =\n useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n className=\"mb-4 flex-col\"\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAgBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAI,iBAAiB;AAC7D,QAAM,EAAE,gBAAgB,0BAA0B,kBAAA,IAChD,mBAAmB;AAErB,QAAM,iBAAiB,gBAAgB;AAGrC,SAAA,qBAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAA,oBAAC,OACC,EAAA,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV;AAAA,QACA,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,WAAU;AAAA,QACV,UAAU,MAAM;AACd,4BAAkB,IAAI;AACX,qBAAA;AAAA,QAAA;AAAA,MACb;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
@@ -33,7 +33,8 @@ const DictionaryFieldEditor = ({
33
33
  dictionary,
34
34
  onClickDictionaryList,
35
35
  isDarkMode,
36
- mode
36
+ mode,
37
+ onDelete
37
38
  }) => {
38
39
  const config = editorReact.useConfiguration();
39
40
  const [editorView, setEditorView] = ReactExports.useState(
@@ -110,7 +111,17 @@ const DictionaryFieldEditor = ({
110
111
  editorView === 2 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_StructureEditor.StructureEditor, { dictionary }),
111
112
  editorView === 1 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_ContentEditor.ContentEditor, { dictionary, isDarkMode }),
112
113
  editorView === 3 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_JSONEditor.JSONEditor, { dictionary, isDarkMode }),
113
- /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode })
114
+ /* @__PURE__ */ jsxRuntime.jsx(
115
+ components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm,
116
+ {
117
+ dictionary,
118
+ mode,
119
+ onDelete: () => {
120
+ setFocusedContent(null);
121
+ onDelete?.();
122
+ }
123
+ }
124
+ )
114
125
  ] })
115
126
  }
116
127
  );
@@ -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 { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => 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}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\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 }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: 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=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"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=\"text\"\n size=\"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 dictionary={dictionary} mode={mode} />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ArrowLeft","SwitchSelector","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2BC,cAAA;AAAA,IACjCC,+DAAAA;AAAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAIC,sCAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAIC,yCAA6B;AAE/DC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAC;AAAA,MACb,eAAe,WAAW;AAAA,IAAA,EAC1B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,GAAG,GAAG;AAAA,IAAA,EAClB;AAAA,EACJ,GAAG,EAAE;AAGH,SAAAC,2BAAA;AAAA,IAACC,sEAAA;AAAA,IAAA;AAAA,MACC,kBAAkB,QAAQ,qBAAqB,WAAW,CAAC;AAAA,MAE3D,UAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,sCACb,UAAA;AAAA,QAAAF,2BAAA;AAAA,UAACG,yBAAA;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,OAAM;AAAA,YACN,MAAMC,YAAA;AAAA,YACN,OAAO,uBAAuB,MAAM;AAAA,YAEnC,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAC1B;AAAA,QAEAJ,2BAAA;AAAA,UAACK,gCAAA;AAAA,UAAA;AAAA,YACC,cAAc;AAAA,YACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,YACxC,OAAM;AAAA,YACN,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,cACP;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MACD,MAAA,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF;AAAA,QAEC,eAAe,KACbL,2BAAAA,IAAAM,yEAAAA,uBAAA,EAAsB,WAAwB,CAAA;AAAA,QAEhD,eAAe,KACbN,2BAAAA,IAAAO,iDAAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACbP,2BAAA,IAAAQ,+CAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACbR,2BAAA,IAAAS,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9DT,2BAAAA,IAACU,mDAAS,UAAA,EAAA,YAAwB,KAAY,CAAA;AAAA,MAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
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 { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\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 } = useDictionary(\n dictionaryFieldEditorContent\n );\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 }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: 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=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"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=\"text\"\n size=\"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","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ArrowLeft","SwitchSelector","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC;AAA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,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MACD,MAAA,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF;AAAA,QAEC,eAAe,KACbL,2BAAAA,IAAAM,yEAAAA,uBAAA,EAAsB,WAAwB,CAAA;AAAA,QAEhD,eAAe,KACbN,2BAAAA,IAAAO,iDAAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACbP,2BAAA,IAAAQ,+CAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACbR,2BAAA,IAAAS,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9DT,2BAAA;AAAA,UAACU,mDAAA;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACX,yBAAA;AAAA,YAAA;AAAA,UACb;AAAA,QAAA;AAAA,MACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
@@ -3,6 +3,7 @@ import { FC } from 'react';
3
3
  type DictionaryFieldEditorProps = {
4
4
  dictionary: Dictionary;
5
5
  onClickDictionaryList?: () => void;
6
+ onDelete?: () => void;
6
7
  isDarkMode?: boolean;
7
8
  mode: ('local' | 'remote')[];
8
9
  };
@@ -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;AAYrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,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,CA6FhE,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;AAYrD,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,CAqGhE,CAAC"}
@@ -31,7 +31,8 @@ const DictionaryFieldEditor = ({
31
31
  dictionary,
32
32
  onClickDictionaryList,
33
33
  isDarkMode,
34
- mode
34
+ mode,
35
+ onDelete
35
36
  }) => {
36
37
  const config = useConfiguration();
37
38
  const [editorView, setEditorView] = useState(
@@ -108,7 +109,17 @@ const DictionaryFieldEditor = ({
108
109
  editorView === 2 && /* @__PURE__ */ jsx(StructureEditor, { dictionary }),
109
110
  editorView === 1 && /* @__PURE__ */ jsx(ContentEditor, { dictionary, isDarkMode }),
110
111
  editorView === 3 && /* @__PURE__ */ jsx(JSONEditor, { dictionary, isDarkMode }),
111
- /* @__PURE__ */ jsx(SaveForm, { dictionary, mode })
112
+ /* @__PURE__ */ jsx(
113
+ SaveForm,
114
+ {
115
+ dictionary,
116
+ mode,
117
+ onDelete: () => {
118
+ setFocusedContent(null);
119
+ onDelete?.();
120
+ }
121
+ }
122
+ )
112
123
  ] })
113
124
  }
114
125
  );
@@ -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 { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => 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}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\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 }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: 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=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"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=\"text\"\n size=\"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 dictionary={dictionary} mode={mode} />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2B;AAAA,IACjC;AAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAI,0BAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAI,6BAA6B;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AgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACb,oBAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACb,oBAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D,oBAAC,UAAS,EAAA,YAAwB,KAAY,CAAA;AAAA,MAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
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 { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\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 } = useDictionary(\n dictionaryFieldEditorContent\n );\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 }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: 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=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"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=\"text\"\n size=\"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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CA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AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MACD,MAAA,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF;AAAA,QAEC,eAAe,KACb,oBAAA,uBAAA,EAAsB,WAAwB,CAAA;AAAA,QAEhD,eAAe,KACb,oBAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACb,oBAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACb,oBAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACX,yBAAA;AAAA,YAAA;AAAA,UACb;AAAA,QAAA;AAAA,MACF,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -6,6 +6,7 @@ const editorReact = require("@intlayer/editor-react");
6
6
  const lucideReact = require("lucide-react");
7
7
  const ReactExports = require("react");
8
8
  const reactIntlayer = require("react-intlayer");
9
+ const components_Modal_Modal = require("../../Modal/Modal.cjs");
9
10
  require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
10
11
  require("../../../hooks/useAsync/useAsyncStateStore.cjs");
11
12
  const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
@@ -28,7 +29,6 @@ require("../../Auth/ChangePasswordForm/changePasswordForm.content.cjs");
28
29
  require("../../Auth/ChangePasswordForm/useChangePasswordSchema.content.cjs");
29
30
  require("../../Auth/ResetPasswordForm/resetPasswordContent.content.cjs");
30
31
  require("../../Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs");
31
- const components_Modal_Modal = require("../../Modal/Modal.cjs");
32
32
  require("@intlayer/config/built");
33
33
  require("../../Auth/VerifyEmailForm/index.content.cjs");
34
34
  require("../../Auth/DefineNewPasswordForm/defineNewPasswordForm.content.cjs");
@@ -38,16 +38,19 @@ const SaveForm = ({
38
38
  dictionary,
39
39
  mode,
40
40
  className,
41
+ onDelete,
41
42
  ...props
42
43
  }) => {
43
44
  const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = ReactExports.useState(false);
44
45
  const { setLocaleDictionary } = editorReact.useDictionariesRecordActions();
46
+ const { deleteDictionary, isLoading: isDeleting } = hooks_intlayerAPIHooks.useDeleteDictionary();
45
47
  const { writeDictionary, isLoading: isWriting } = hooks_intlayerAPIHooks.useWriteDictionary();
46
48
  const { pushDictionaries, isLoading: isPushing } = hooks_intlayerAPIHooks.usePushDictionaries();
47
49
  const isLoading = isWriting || isPushing;
48
50
  const isJsonFormat = mode.includes("local") && dictionary.filePath?.endsWith(".json");
49
51
  const { editedContent, restoreEditedContent } = editorReact.useEditedContent();
50
52
  const {
53
+ deleteButton,
51
54
  resetButton,
52
55
  saveButton,
53
56
  publishButton,
@@ -57,7 +60,7 @@ const SaveForm = ({
57
60
  const { isAuthenticated } = components_Auth_useAuth_index.useAuth();
58
61
  const editedDictionary = editedContent?.[dictionary.key];
59
62
  const isEdited = editedDictionary && JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);
60
- const isLocalDictionary = typeof dictionary?._id === "undefined";
63
+ const isDistantDictionary = typeof dictionary?._id !== "undefined";
61
64
  const handleSaveDictionaryConfirmation = async () => {
62
65
  if (!editedContent?.[dictionary.key]) return;
63
66
  const updatedDictionary = {
@@ -82,6 +85,16 @@ const SaveForm = ({
82
85
  }
83
86
  });
84
87
  };
88
+ const handleDeleteDictionary = async () => {
89
+ if (!dictionary._id) return;
90
+ await deleteDictionary(
91
+ dictionary._id.toString()
92
+ ).then((res) => {
93
+ if (res) {
94
+ onDelete?.();
95
+ }
96
+ });
97
+ };
85
98
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
86
99
  /* @__PURE__ */ jsxRuntime.jsx(
87
100
  components_Modal_Modal.Modal,
@@ -127,6 +140,19 @@ const SaveForm = ({
127
140
  className: utils_cn.cn("flex justify-end gap-2 max-md:flex-col", className),
128
141
  ...props,
129
142
  children: [
143
+ mode.includes("remote") && isDistantDictionary && onDelete && isAuthenticated && /* @__PURE__ */ jsxRuntime.jsx(
144
+ components_Form_layout_FormItemLayout.Form.Button,
145
+ {
146
+ label: deleteButton.label.value,
147
+ Icon: lucideReact.Trash,
148
+ color: "error",
149
+ variant: "outline",
150
+ className: "max-md:w-full",
151
+ isLoading: isDeleting,
152
+ onClick: handleDeleteDictionary,
153
+ children: deleteButton.text
154
+ }
155
+ ),
130
156
  isEdited && /* @__PURE__ */ jsxRuntime.jsx(
131
157
  components_Form_layout_FormItemLayout.Form.Button,
132
158
  {
@@ -154,7 +180,7 @@ const SaveForm = ({
154
180
  children: downloadButton.text
155
181
  }
156
182
  ),
157
- mode.includes("remote") && isAuthenticated && isLocalDictionary && /* @__PURE__ */ jsxRuntime.jsx(
183
+ mode.includes("remote") && isAuthenticated && !isDistantDictionary && /* @__PURE__ */ jsxRuntime.jsx(
158
184
  components_Form_layout_FormItemLayout.Form.Button,
159
185
  {
160
186
  label: publishButton.label.value,
@@ -167,7 +193,7 @@ const SaveForm = ({
167
193
  children: publishButton.text
168
194
  }
169
195
  ),
170
- mode.includes("remote") && isAuthenticated && !isLocalDictionary && isEdited && /* @__PURE__ */ jsxRuntime.jsx(
196
+ mode.includes("remote") && isAuthenticated && isDistantDictionary && isEdited && /* @__PURE__ */ jsxRuntime.jsx(
171
197
  components_Form_layout_FormItemLayout.Form.Button,
172
198
  {
173
199
  label: saveButton.label.value,
@@ -1 +1 @@
1
- {"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, RotateCcw, Save } from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FormHTMLAttributes,\n type FC,\n useState,\n} from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries, useWriteDictionary } from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { useAuth } from '../../Auth';\nimport { Form } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { Modal } from '../../../components/Modal';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n const isJsonFormat =\n mode.includes('local') && dictionary.filePath?.endsWith('.json');\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useDictionary(saveDictionaryContent);\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.key];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isLocalDictionary =\n typeof (dictionary as DistantDictionary)?._id === 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n };\n\n const handlePushDictionary = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then((res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n }\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size=\"md\"\n >\n <form className=\"size-full px-3\">\n {isJsonFormat ? (\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n ) : (\n <p className=\"text-neutral py-4 text-sm\">\n {confirmation.differentFormatMessage}\n </p>\n )}\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color=\"text\"\n className=\"max-md:w-full\"\n variant=\"outline\"\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color=\"text\"\n variant={isAuthenticated ? 'outline' : 'default'}\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && isLocalDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n !isLocalDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":["useState","useDictionariesRecordActions","useWriteDictionary","usePushDictionaries","useEditedContent","useDictionary","saveDictionaryContent","useAuth","jsxs","Fragment","jsx","Modal","Form","Save","cn","RotateCcw","Download","ArrowUpFromLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAIA,aAAAA,SAAS,KAAK;AACpE,QAAA,EAAE,oBAAoB,IAAIC,yCAA6B;AAC7D,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAcC,uBAAAA,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAcC,uBAAAA,oBAAoB;AACvE,QAAM,YAAY,aAAa;AACzB,QAAA,eACJ,KAAK,SAAS,OAAO,KAAK,WAAW,UAAU,SAAS,OAAO;AAEjE,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AAC3D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEC,cAAAA,cAAcC,2DAAAA,qBAAqB;AACjC,QAAA,EAAE,gBAAgB,IAAIC,sCAAQ;AAE9B,QAAA,mBAAmB,gBAAgB,WAAW,GAAG;AAEj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,WAAW;AAAA,cACX,SAAS,MAAM,0BAA0B,IAAI;AAAA,cAE5C,UAAe,eAAA;AAAA,YAAA;AAAA,UAClB;AAAA,UAED,KAAK,SAAS,QAAQ,KAAK,mBAAmB,qBAC7CN,2BAAA;AAAA,YAACE,sCAAAA,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,cAAc,MAAM;AAAA,cAC3B,UAAU;AAAA,cACV,MAAMK,YAAA;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAc,cAAA;AAAA,YAAA;AAAA,UACjB;AAAA,UAED,KAAK,SAAS,QAAQ,KACrB,mBACA,CAAC,qBACD,YACEP,2BAAA;AAAA,YAACE,sCAAAA,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAMC,YAAA;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAW,WAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;;"}
1
+ {"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Modal } from '../../../components/Modal';\nimport {\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { useAuth } from '../../Auth';\nimport { Form } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { deleteDictionary, isLoading: isDeleting } = useDeleteDictionary();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n const isJsonFormat =\n mode.includes('local') && dictionary.filePath?.endsWith('.json');\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useDictionary(saveDictionaryContent);\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.key];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as DistantDictionary)?._id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n };\n\n const handlePushDictionary = async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then((res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n }\n });\n };\n\n const handleDeleteDictionary = async () => {\n if (!(dictionary as DistantDictionary)._id) return;\n\n await deleteDictionary(\n (dictionary as DistantDictionary)._id.toString()\n ).then((res) => {\n if (res) {\n onDelete?.();\n }\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size=\"md\"\n >\n <form className=\"size-full px-3\">\n {isJsonFormat ? (\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n ) : (\n <p className=\"text-neutral py-4 text-sm\">\n {confirmation.differentFormatMessage}\n </p>\n )}\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color=\"text\"\n className=\"max-md:w-full\"\n variant=\"outline\"\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color=\"error\"\n variant=\"outline\"\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color=\"text\"\n variant={isAuthenticated ? 'outline' : 'default'}\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":["useState","useDictionariesRecordActions","useDeleteDictionary","useWriteDictionary","usePushDictionaries","useEditedContent","useDictionary","saveDictionaryContent","useAuth","jsxs","Fragment","jsx","Modal","Form","Save","cn","Trash","RotateCcw","Download","ArrowUpFromLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAIA,aAAAA,SAAS,KAAK;AACpE,QAAA,EAAE,oBAAoB,IAAIC,yCAA6B;AAC7D,QAAM,EAAE,kBAAkB,WAAW,WAAA,IAAeC,uBAAAA,oBAAoB;AACxE,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAcC,uBAAAA,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAcC,uBAAAA,oBAAoB;AACvE,QAAM,YAAY,aAAa;AACzB,QAAA,eACJ,KAAK,SAAS,OAAO,KAAK,WAAW,UAAU,SAAS,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AA,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAMC,YAAA;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAW,WAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;;"}
@@ -1,8 +1,9 @@
1
1
  import { Dictionary } from '@intlayer/core';
2
- import { DetailedHTMLProps, FormHTMLAttributes, FC } from 'react';
2
+ import { DetailedHTMLProps, FC, FormHTMLAttributes } from 'react';
3
3
  type DictionaryDetailsProps = {
4
4
  dictionary: Dictionary;
5
5
  mode: ('local' | 'remote')[];
6
+ onDelete?: () => void;
6
7
  } & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
7
8
  export declare const SaveForm: FC<DictionaryDetailsProps>;
8
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AASf,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,sBAAsB,CAsK/C,CAAC"}
1
+ {"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAYjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,kBAAkB,EAExB,MAAM,OAAO,CAAC;AAaf,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,sBAAsB,CAqM/C,CAAC"}