@intlayer/design-system 5.3.4 → 5.3.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 (44) hide show
  1. package/dist/.vite/manifest.json +20 -20
  2. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +1 -1
  3. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
  4. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.cjs +1 -1
  5. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs +1 -1
  6. package/dist/components/DictionaryEditor/NodeWrapper/ConditionWrapper.cjs +1 -1
  7. package/dist/components/DictionaryEditor/NodeWrapper/ConditionWrapper.mjs +1 -1
  8. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.cjs +1 -1
  9. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.mjs +1 -1
  10. package/dist/components/DictionaryEditor/NodeWrapper/InsertionWrapper.cjs +4 -18
  11. package/dist/components/DictionaryEditor/NodeWrapper/InsertionWrapper.cjs.map +1 -1
  12. package/dist/components/DictionaryEditor/NodeWrapper/InsertionWrapper.mjs +4 -18
  13. package/dist/components/DictionaryEditor/NodeWrapper/InsertionWrapper.mjs.map +1 -1
  14. package/dist/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.cjs +1 -1
  15. package/dist/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.mjs +1 -1
  16. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.cjs +1 -1
  17. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs +1 -1
  18. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.cjs +1 -1
  19. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.mjs +1 -1
  20. package/dist/components/DictionaryEditor/NodeWrapper/index.cjs +1 -1
  21. package/dist/components/DictionaryEditor/NodeWrapper/index.d.ts.map +1 -1
  22. package/dist/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
  23. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +116 -77
  24. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  25. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  26. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +119 -80
  27. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  28. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +108 -0
  29. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  30. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +231 -0
  31. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +108 -0
  33. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  34. package/dist/index-BCuMWKyy.js.map +1 -1
  35. package/dist/index-BYzBot7l.cjs.map +1 -1
  36. package/dist/{index-Au2tP3vA.js → index-CEoL1j7H.js} +23 -2
  37. package/dist/index-CEoL1j7H.js.map +1 -0
  38. package/dist/{index-DbyCRREy.cjs → index-s_Ar0FDw.cjs} +23 -2
  39. package/dist/index-s_Ar0FDw.cjs.map +1 -0
  40. package/dist/zod-BV4nCGJE.js.map +1 -1
  41. package/dist/zod-DSrtTSD_.cjs.map +1 -1
  42. package/package.json +15 -15
  43. package/dist/index-Au2tP3vA.js.map +0 -1
  44. package/dist/index-DbyCRREy.cjs.map +0 -1
@@ -47,15 +47,6 @@
47
47
  "src/components/Form/FormMessage.tsx"
48
48
  ]
49
49
  },
50
- "_index-Au2tP3vA.js": {
51
- "file": "index-Au2tP3vA.js",
52
- "name": "index",
53
- "imports": [
54
- "src/components/DictionaryEditor/ItemLayout.tsx",
55
- "src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx",
56
- "src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx"
57
- ]
58
- },
59
50
  "_index-BCuMWKyy.js": {
60
51
  "file": "index-BCuMWKyy.js",
61
52
  "name": "index",
@@ -72,8 +63,17 @@
72
63
  "src/hooks/useScrollBlockage/useScrollBlockageStore.ts"
73
64
  ]
74
65
  },
75
- "_index-DbyCRREy.cjs": {
76
- "file": "index-DbyCRREy.cjs",
66
+ "_index-CEoL1j7H.js": {
67
+ "file": "index-CEoL1j7H.js",
68
+ "name": "index",
69
+ "imports": [
70
+ "src/components/DictionaryEditor/ItemLayout.tsx",
71
+ "src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx",
72
+ "src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx"
73
+ ]
74
+ },
75
+ "_index-s_Ar0FDw.cjs": {
76
+ "file": "index-s_Ar0FDw.cjs",
77
77
  "name": "index",
78
78
  "imports": [
79
79
  "src/components/DictionaryEditor/ItemLayout.tsx",
@@ -716,7 +716,7 @@
716
716
  "isEntry": true,
717
717
  "imports": [
718
718
  "src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx",
719
- "_index-DbyCRREy.cjs"
719
+ "_index-s_Ar0FDw.cjs"
720
720
  ]
721
721
  },
722
722
  "src/components/DictionaryEditor/ItemLayout.tsx": {
@@ -736,7 +736,7 @@
736
736
  "isEntry": true,
737
737
  "imports": [
738
738
  "src/components/DictionaryEditor/ItemLayout.tsx",
739
- "_index-DbyCRREy.cjs"
739
+ "_index-s_Ar0FDw.cjs"
740
740
  ]
741
741
  },
742
742
  "src/components/DictionaryEditor/NodeWrapper/ConditionWrapper.tsx": {
@@ -745,7 +745,7 @@
745
745
  "src": "src/components/DictionaryEditor/NodeWrapper/ConditionWrapper.tsx",
746
746
  "isEntry": true,
747
747
  "imports": [
748
- "_index-DbyCRREy.cjs"
748
+ "_index-s_Ar0FDw.cjs"
749
749
  ]
750
750
  },
751
751
  "src/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.tsx": {
@@ -754,7 +754,7 @@
754
754
  "src": "src/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.tsx",
755
755
  "isEntry": true,
756
756
  "imports": [
757
- "_index-DbyCRREy.cjs"
757
+ "_index-s_Ar0FDw.cjs"
758
758
  ]
759
759
  },
760
760
  "src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx": {
@@ -772,7 +772,7 @@
772
772
  "src": "src/components/DictionaryEditor/NodeWrapper/InsertionWrapper.tsx",
773
773
  "isEntry": true,
774
774
  "imports": [
775
- "_index-DbyCRREy.cjs"
775
+ "_index-s_Ar0FDw.cjs"
776
776
  ]
777
777
  },
778
778
  "src/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.tsx": {
@@ -781,7 +781,7 @@
781
781
  "src": "src/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.tsx",
782
782
  "isEntry": true,
783
783
  "imports": [
784
- "_index-DbyCRREy.cjs"
784
+ "_index-s_Ar0FDw.cjs"
785
785
  ]
786
786
  },
787
787
  "src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx": {
@@ -791,7 +791,7 @@
791
791
  "isEntry": true,
792
792
  "imports": [
793
793
  "src/components/DictionaryEditor/ItemLayout.tsx",
794
- "_index-DbyCRREy.cjs"
794
+ "_index-s_Ar0FDw.cjs"
795
795
  ]
796
796
  },
797
797
  "src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx": {
@@ -813,7 +813,7 @@
813
813
  "src": "src/components/DictionaryEditor/NodeWrapper/TranslationWrapper.tsx",
814
814
  "isEntry": true,
815
815
  "imports": [
816
- "_index-DbyCRREy.cjs"
816
+ "_index-s_Ar0FDw.cjs"
817
817
  ]
818
818
  },
819
819
  "src/components/DictionaryEditor/NodeWrapper/index.tsx": {
@@ -822,7 +822,7 @@
822
822
  "src": "src/components/DictionaryEditor/NodeWrapper/index.tsx",
823
823
  "isEntry": true,
824
824
  "imports": [
825
- "_index-DbyCRREy.cjs",
825
+ "_index-s_Ar0FDw.cjs",
826
826
  "src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx",
827
827
  "src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx"
828
828
  ]
@@ -5,7 +5,7 @@ const jsxRuntime = require("react/jsx-runtime");
5
5
  const ReactExports = require("react");
6
6
  const editorReact = require("@intlayer/editor-react");
7
7
  const components_DictionaryFieldEditor_SaveForm_SaveForm = require("../DictionaryFieldEditor/SaveForm/SaveForm.cjs");
8
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-DbyCRREy.cjs");
8
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-s_Ar0FDw.cjs");
9
9
  const DictionaryEditor = ({
10
10
  dictionary,
11
11
  mode,
@@ -3,7 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { createElement } from "react";
4
4
  import { useEditedContent, useFocusDictionary } from "@intlayer/editor-react";
5
5
  import { SaveForm } from "../DictionaryFieldEditor/SaveForm/SaveForm.mjs";
6
- import { N as NodeWrapper } from "../../index-Au2tP3vA.js";
6
+ import { N as NodeWrapper } from "../../index-CEoL1j7H.js";
7
7
  const DictionaryEditor = ({
8
8
  dictionary,
9
9
  mode,
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("@intlayer/core");
5
5
  require("../ItemLayout.cjs");
6
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
6
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
7
7
  exports.ArrayWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.ArrayWrapper;
8
8
  //# sourceMappingURL=ArrayWrapper.cjs.map
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@intlayer/core";
3
3
  import "../ItemLayout.mjs";
4
- import { A } from "../../../index-Au2tP3vA.js";
4
+ import { A } from "../../../index-CEoL1j7H.js";
5
5
  export {
6
6
  A as ArrayWrapper
7
7
  };
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("react");
5
5
  require("@intlayer/core");
6
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
6
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
7
7
  exports.ConditionWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.ConditionWrapper;
8
8
  //# sourceMappingURL=ConditionWrapper.cjs.map
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@intlayer/core";
4
- import { C } from "../../../index-Au2tP3vA.js";
4
+ import { C } from "../../../index-CEoL1j7H.js";
5
5
  export {
6
6
  C as ConditionWrapper
7
7
  };
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("react");
5
5
  require("@intlayer/core");
6
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
6
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
7
7
  exports.EnumerationWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.EnumerationWrapper;
8
8
  //# sourceMappingURL=EnumerationWrapper.cjs.map
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@intlayer/core";
4
- import { E } from "../../../index-Au2tP3vA.js";
4
+ import { E } from "../../../index-CEoL1j7H.js";
5
5
  export {
6
6
  E as EnumerationWrapper
7
7
  };
@@ -1,21 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const core = require("@intlayer/core");
5
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
6
- const InsertionWrapper = (props) => {
7
- const { keyPath, section } = props;
8
- const newKeyPath = [
9
- ...keyPath,
10
- {
11
- type: core.NodeType.Insertion
12
- }
13
- ];
14
- const subSection = section[core.NodeType.Insertion];
15
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 grid grid-cols-[auto,1fr] gap-2", children: [
16
- /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryEditor_NodeWrapper_ArrayWrapper.NodeWrapper, { ...props, keyPath: newKeyPath, section: subSection }),
17
- ";"
18
- ] });
19
- };
20
- exports.InsertionWrapper = InsertionWrapper;
3
+ require("react/jsx-runtime");
4
+ require("@intlayer/core");
5
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
6
+ exports.InsertionWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.InsertionWrapper;
21
7
  //# sourceMappingURL=InsertionWrapper.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"InsertionWrapper.cjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/InsertionWrapper.tsx"],"sourcesContent":["import {\n type KeyPath,\n NodeType,\n type InsertionContent,\n type ContentNode,\n} from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype InsertionWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: InsertionContent<ContentNode>;\n};\n\nexport const InsertionWrapper: FC<InsertionWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const subSection = section[NodeType.Insertion];\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />;\n </div>\n );\n};\n"],"names":["NodeType","jsxs","jsx","NodeWrapper"],"mappings":";;;;;AAaa,MAAA,mBAA8C,CAAC,UAAU;AAC9D,QAAA,EAAE,SAAS,QAAA,IAAY;AAE7B,QAAM,aAAwB;AAAA,IAC5B,GAAG;AAAA,IACH;AAAA,MACE,MAAMA,KAAAA,SAAS;AAAA,IAAA;AAAA,EAEnB;AAEM,QAAA,aAAa,QAAQA,KAAA,SAAS,SAAS;AAG3C,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,wCACb,UAAA;AAAA,IAAAC,+BAACC,qDAAAA,eAAa,GAAG,OAAO,SAAS,YAAY,SAAS,YAAY;AAAA,IAAE;AAAA,EAAA,GACtE;AAEJ;;"}
1
+ {"version":3,"file":"InsertionWrapper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,21 +1,7 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { NodeType } from "@intlayer/core";
3
- import { N as NodeWrapper } from "../../../index-Au2tP3vA.js";
4
- const InsertionWrapper = (props) => {
5
- const { keyPath, section } = props;
6
- const newKeyPath = [
7
- ...keyPath,
8
- {
9
- type: NodeType.Insertion
10
- }
11
- ];
12
- const subSection = section[NodeType.Insertion];
13
- return /* @__PURE__ */ jsxs("div", { className: "ml-2 grid grid-cols-[auto,1fr] gap-2", children: [
14
- /* @__PURE__ */ jsx(NodeWrapper, { ...props, keyPath: newKeyPath, section: subSection }),
15
- ";"
16
- ] });
17
- };
1
+ import "react/jsx-runtime";
2
+ import "@intlayer/core";
3
+ import { I } from "../../../index-CEoL1j7H.js";
18
4
  export {
19
- InsertionWrapper
5
+ I as InsertionWrapper
20
6
  };
21
7
  //# sourceMappingURL=InsertionWrapper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"InsertionWrapper.mjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/InsertionWrapper.tsx"],"sourcesContent":["import {\n type KeyPath,\n NodeType,\n type InsertionContent,\n type ContentNode,\n} from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype InsertionWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: InsertionContent<ContentNode>;\n};\n\nexport const InsertionWrapper: FC<InsertionWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const subSection = section[NodeType.Insertion];\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />;\n </div>\n );\n};\n"],"names":[],"mappings":";;;AAaa,MAAA,mBAA8C,CAAC,UAAU;AAC9D,QAAA,EAAE,SAAS,QAAA,IAAY;AAE7B,QAAM,aAAwB;AAAA,IAC5B,GAAG;AAAA,IACH;AAAA,MACE,MAAM,SAAS;AAAA,IAAA;AAAA,EAEnB;AAEM,QAAA,aAAa,QAAQ,SAAS,SAAS;AAG3C,SAAA,qBAAC,OAAI,EAAA,WAAU,wCACb,UAAA;AAAA,IAAA,oBAAC,eAAa,GAAG,OAAO,SAAS,YAAY,SAAS,YAAY;AAAA,IAAE;AAAA,EAAA,GACtE;AAEJ;"}
1
+ {"version":3,"file":"InsertionWrapper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("@intlayer/core");
5
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
5
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
6
6
  exports.MarkdownWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.MarkdownWrapper;
7
7
  //# sourceMappingURL=MarkdownWrapper.cjs.map
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@intlayer/core";
3
- import { M } from "../../../index-Au2tP3vA.js";
3
+ import { M } from "../../../index-CEoL1j7H.js";
4
4
  export {
5
5
  M as MarkdownWrapper
6
6
  };
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("@intlayer/core");
5
5
  require("../ItemLayout.cjs");
6
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
6
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
7
7
  exports.NestedObjectWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.NestedObjectWrapper;
8
8
  //# sourceMappingURL=NestedObjectWrapper.cjs.map
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@intlayer/core";
3
3
  import "../ItemLayout.mjs";
4
- import { a } from "../../../index-Au2tP3vA.js";
4
+ import { a } from "../../../index-CEoL1j7H.js";
5
5
  export {
6
6
  a as NestedObjectWrapper
7
7
  };
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("@intlayer/core");
5
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
5
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
6
6
  exports.TranslationWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.TranslationWrapper;
7
7
  //# sourceMappingURL=TranslationWrapper.cjs.map
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@intlayer/core";
3
- import { T } from "../../../index-Au2tP3vA.js";
3
+ import { T } from "../../../index-CEoL1j7H.js";
4
4
  export {
5
5
  T as TranslationWrapper
6
6
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("react/jsx-runtime");
4
4
  require("@intlayer/core");
5
- const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DbyCRREy.cjs");
5
+ const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-s_Ar0FDw.cjs");
6
6
  require("./StringWrapper.cjs");
7
7
  require("./FileWrapper.cjs");
8
8
  exports.NodeWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.NodeWrapper;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAU3C,eAAO,MAAM,SAAS,EAAE,MAAM,EAAmC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7E,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,WAAW,CAAC;IAC3B,cAAc,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAqF5C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAQL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAW3C,eAAO,MAAM,SAAS,EAAE,MAAM,EAAmC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7E,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,WAAW,CAAC;IAC3B,cAAc,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwF5C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@intlayer/core";
3
- import { N, t } from "../../../index-Au2tP3vA.js";
3
+ import { N, t } from "../../../index-CEoL1j7H.js";
4
4
  import "./StringWrapper.mjs";
5
5
  import "./FileWrapper.mjs";
6
6
  export {
@@ -28,7 +28,7 @@ require("../../Auth/ChangePasswordForm/changePasswordForm.content.cjs");
28
28
  require("../../Auth/ChangePasswordForm/useChangePasswordSchema.content.cjs");
29
29
  require("../../Auth/ResetPasswordForm/resetPasswordContent.content.cjs");
30
30
  require("../../Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs");
31
- require("../../Modal/Modal.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");
@@ -40,26 +40,25 @@ const SaveForm = ({
40
40
  className,
41
41
  ...props
42
42
  }) => {
43
+ const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = ReactExports.useState(false);
43
44
  const { setLocaleDictionary } = editorReact.useDictionariesRecordActions();
44
45
  const { writeDictionary, isLoading: isWriting } = hooks_intlayerAPIHooks.useWriteDictionary();
45
46
  const { pushDictionaries, isLoading: isPushing } = hooks_intlayerAPIHooks.usePushDictionaries();
46
47
  const isLoading = isWriting || isPushing;
48
+ const isJsonFormat = mode.includes("local") && dictionary.filePath?.endsWith(".json");
47
49
  const { editedContent, restoreEditedContent } = editorReact.useEditedContent();
48
- const { resetButton, saveButton, publishButton, downloadButton } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_SaveForm_saveForm_content.saveDictionaryContent);
50
+ const {
51
+ resetButton,
52
+ saveButton,
53
+ publishButton,
54
+ downloadButton,
55
+ confirmation
56
+ } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_SaveForm_saveForm_content.saveDictionaryContent);
49
57
  const { isAuthenticated } = components_Auth_useAuth_index.useAuth();
50
- const editedDictionary = ReactExports.useMemo(
51
- () => editedContent?.[dictionary.key],
52
- [editedContent, dictionary.key]
53
- );
54
- const isEdited = ReactExports.useMemo(
55
- () => editedDictionary && JSON.stringify(editedDictionary) !== JSON.stringify(dictionary),
56
- [editedDictionary, dictionary, mode]
57
- );
58
- const isLocalDictionary = ReactExports.useMemo(
59
- () => typeof dictionary?._id === "undefined",
60
- [dictionary]
61
- );
62
- const handleSaveDictionary = async () => {
58
+ const editedDictionary = editedContent?.[dictionary.key];
59
+ const isEdited = editedDictionary && JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);
60
+ const isLocalDictionary = typeof dictionary?._id === "undefined";
61
+ const handleSaveDictionaryConfirmation = async () => {
63
62
  if (!editedContent?.[dictionary.key]) return;
64
63
  const updatedDictionary = {
65
64
  ...dictionary,
@@ -83,68 +82,108 @@ const SaveForm = ({
83
82
  }
84
83
  });
85
84
  };
86
- return /* @__PURE__ */ jsxRuntime.jsxs(
87
- "form",
88
- {
89
- className: utils_cn.cn("flex justify-end gap-2 max-md:flex-col", className),
90
- ...props,
91
- children: [
92
- isEdited && /* @__PURE__ */ jsxRuntime.jsx(
93
- components_Form_layout_FormItemLayout.Form.Button,
94
- {
95
- label: resetButton.label.value,
96
- disabled: !isEdited,
97
- Icon: lucideReact.RotateCcw,
98
- variant: "outline",
99
- color: "text",
100
- className: "max-md:w-full",
101
- onClick: () => restoreEditedContent(dictionary.key),
102
- children: resetButton.text
103
- }
104
- ),
105
- mode.includes("local") && /* @__PURE__ */ jsxRuntime.jsx(
106
- components_Form_layout_FormItemLayout.Form.Button,
107
- {
108
- label: downloadButton.label.value,
109
- disabled: !isEdited || isLoading,
110
- Icon: lucideReact.Download,
111
- color: "text",
112
- variant: isAuthenticated ? "outline" : "default",
113
- className: "max-md:w-full",
114
- isLoading: isWriting,
115
- onClick: handleSaveDictionary,
116
- children: downloadButton.text
117
- }
118
- ),
119
- mode.includes("remote") && isAuthenticated && isLocalDictionary && /* @__PURE__ */ jsxRuntime.jsx(
120
- components_Form_layout_FormItemLayout.Form.Button,
121
- {
122
- label: publishButton.label.value,
123
- disabled: isLoading,
124
- Icon: lucideReact.ArrowUpFromLine,
125
- color: "text",
126
- className: "max-md:w-full",
127
- isLoading: isPushing,
128
- onClick: handlePushDictionary,
129
- children: publishButton.text
130
- }
131
- ),
132
- mode.includes("remote") && isAuthenticated && !isLocalDictionary && isEdited && /* @__PURE__ */ jsxRuntime.jsx(
133
- components_Form_layout_FormItemLayout.Form.Button,
134
- {
135
- label: saveButton.label.value,
136
- disabled: !isEdited || isLoading,
137
- Icon: lucideReact.Save,
138
- color: "text",
139
- className: "max-md:w-full",
140
- isLoading: isPushing,
141
- onClick: handlePushDictionary,
142
- children: saveButton.text
143
- }
144
- )
145
- ]
146
- }
147
- );
85
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ components_Modal_Modal.Modal,
88
+ {
89
+ isOpen: isFormatAlertModalOpen,
90
+ title: confirmation.title.value,
91
+ size: "md",
92
+ children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "size-full px-3", children: [
93
+ isJsonFormat ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-neutral py-4 text-sm", children: confirmation.message }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-neutral py-4 text-sm", children: confirmation.differentFormatMessage }),
94
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-12 flex justify-end gap-2 max-md:flex-col", children: [
95
+ /* @__PURE__ */ jsxRuntime.jsx(
96
+ components_Form_layout_FormItemLayout.Form.Button,
97
+ {
98
+ label: confirmation.cancelButton.label.value,
99
+ disabled: !isEdited || isLoading,
100
+ color: "text",
101
+ className: "max-md:w-full",
102
+ variant: "outline",
103
+ onClick: () => setIsFormatAlertModalOpen(false),
104
+ children: confirmation.cancelButton.text
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsxRuntime.jsx(
108
+ components_Form_layout_FormItemLayout.Form.Button,
109
+ {
110
+ label: confirmation.confirmButton.label.value,
111
+ disabled: !isEdited || isLoading,
112
+ Icon: lucideReact.Save,
113
+ color: "text",
114
+ className: "max-md:w-full",
115
+ isLoading: isPushing,
116
+ onClick: handleSaveDictionaryConfirmation,
117
+ children: confirmation.confirmButton.text
118
+ }
119
+ )
120
+ ] })
121
+ ] })
122
+ }
123
+ ),
124
+ /* @__PURE__ */ jsxRuntime.jsxs(
125
+ "form",
126
+ {
127
+ className: utils_cn.cn("flex justify-end gap-2 max-md:flex-col", className),
128
+ ...props,
129
+ children: [
130
+ isEdited && /* @__PURE__ */ jsxRuntime.jsx(
131
+ components_Form_layout_FormItemLayout.Form.Button,
132
+ {
133
+ label: resetButton.label.value,
134
+ disabled: !isEdited,
135
+ Icon: lucideReact.RotateCcw,
136
+ variant: "outline",
137
+ color: "text",
138
+ className: "max-md:w-full",
139
+ onClick: () => restoreEditedContent(dictionary.key),
140
+ children: resetButton.text
141
+ }
142
+ ),
143
+ mode.includes("local") && /* @__PURE__ */ jsxRuntime.jsx(
144
+ components_Form_layout_FormItemLayout.Form.Button,
145
+ {
146
+ label: downloadButton.label.value,
147
+ disabled: !isEdited || isLoading,
148
+ Icon: lucideReact.Download,
149
+ color: "text",
150
+ variant: isAuthenticated ? "outline" : "default",
151
+ className: "max-md:w-full",
152
+ isLoading: isWriting,
153
+ onClick: () => setIsFormatAlertModalOpen(true),
154
+ children: downloadButton.text
155
+ }
156
+ ),
157
+ mode.includes("remote") && isAuthenticated && isLocalDictionary && /* @__PURE__ */ jsxRuntime.jsx(
158
+ components_Form_layout_FormItemLayout.Form.Button,
159
+ {
160
+ label: publishButton.label.value,
161
+ disabled: isLoading,
162
+ Icon: lucideReact.ArrowUpFromLine,
163
+ color: "text",
164
+ className: "max-md:w-full",
165
+ isLoading: isPushing,
166
+ onClick: handlePushDictionary,
167
+ children: publishButton.text
168
+ }
169
+ ),
170
+ mode.includes("remote") && isAuthenticated && !isLocalDictionary && isEdited && /* @__PURE__ */ jsxRuntime.jsx(
171
+ components_Form_layout_FormItemLayout.Form.Button,
172
+ {
173
+ label: saveButton.label.value,
174
+ disabled: !isEdited || isLoading,
175
+ Icon: lucideReact.Save,
176
+ color: "text",
177
+ className: "max-md:w-full",
178
+ isLoading: isPushing,
179
+ onClick: handlePushDictionary,
180
+ children: saveButton.text
181
+ }
182
+ )
183
+ ]
184
+ }
185
+ )
186
+ ] });
148
187
  };
149
188
  exports.SaveForm = SaveForm;
150
189
  //# sourceMappingURL=SaveForm.cjs.map
@@ -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 useMemo,\n type FC,\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';\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 { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { resetButton, saveButton, publishButton, downloadButton } =\n useDictionary(saveDictionaryContent);\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary),\n [editedDictionary, dictionary, mode]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const handleSaveDictionary = 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 <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={handleSaveDictionary}\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"],"names":["useDictionariesRecordActions","useWriteDictionary","usePushDictionaries","useEditedContent","useDictionary","saveDictionaryContent","useAuth","useMemo","jsxs","cn","jsx","Form","RotateCcw","Download","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,oBAAoB,IAAIA,yCAA6B;AAC7D,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAcC,uBAAAA,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAcC,uBAAAA,oBAAoB;AACvE,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AACjE,QAAM,EAAE,aAAa,YAAY,eAAe,eAAe,IAC7DC,4BAAcC,gFAAqB;AAC/B,QAAA,EAAE,gBAAgB,IAAIC,sCAAQ;AAEpC,QAAM,mBAAmBC,aAAA;AAAA,IACvB,MAAM,gBAAgB,WAAW,GAAG;AAAA,IACpC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAWA,aAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,gBAAgB,MAAM,KAAK,UAAU,UAAU;AAAA,IAChE,CAAC,kBAAkB,YAAY,IAAI;AAAA,EACrC;AAEA,QAAM,oBAAoBA,aAAA;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,uBAAuB,YAAY;AACvC,QAAI,CAAC,gBAAgB,WAAW,GAAG,EAAG;AAEtC,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,GAAG,gBAAgB,WAAW,GAAG;AAAA,IACn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K,SAAS,QAAQ,KAAK,mBAAmB,qBAC7CH,2BAAA;AAAA,UAACC,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,OAAO,cAAc,MAAM;AAAA,YAC3B,UAAU;AAAA,YACV,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YACX,SAAS;AAAA,YAER,UAAc,cAAA;AAAA,UAAA;AAAA,QACjB;AAAA,QAED,KAAK,SAAS,QAAQ,KACrB,mBACA,CAAC,qBACD,YACEJ,2BAAA;AAAA,UAACC,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,OAAO,WAAW,MAAM;AAAA,YACxB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMI,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YACX,SAAS;AAAA,YAER,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAEN;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 { 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;AAEjD,QAAA,WACJ,oBACA,KAAK,UAAU,gBAAgB,MAAM,KAAK,UAAU,UAAU;AAE1D,QAAA,oBACJ,OAAQ,YAAkC,QAAQ;AAEpD,QAAM,mCAAmC,YAAY;AACnD,QAAI,CAAC,gBAAgB,WAAW,GAAG,EAAG;AAEtC,UAAM,oBAAoB;AAAA,MACxB,GAAG;AAAA,MACH,GAAG,gBAAgB,WAAW,GAAG;AAAA,IACnC;AAEA,UAAM,gBAAgB,iBAAiB,EAAE,KAAK,MAAM;AAC9B,0BAAA,gBAAgB,WAAW,GAAG,CAAC;AACnD,2BAAqB,WAAW,GAAG;AAAA,IAAA,CACpC;AAAA,EACH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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 +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,EAEvB,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAQf,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,CA8H/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;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"}