@intlayer/design-system 4.0.0 → 4.0.3

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 (104) hide show
  1. package/README.md +39 -21
  2. package/dist/.vite/manifest.json +26 -156
  3. package/dist/components/Accordion/Accordion.cjs +1 -1
  4. package/dist/components/Accordion/Accordion.cjs.map +1 -1
  5. package/dist/components/Accordion/Accordion.mjs +1 -1
  6. package/dist/components/Accordion/Accordion.mjs.map +1 -1
  7. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -15
  8. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  9. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  10. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -15
  11. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  12. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +2 -2
  13. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
  14. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts.map +1 -1
  15. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +1 -1
  16. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
  17. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +2 -8
  18. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  19. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  20. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +2 -8
  21. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  22. package/dist/components/DictionaryEditor/index.cjs +0 -8
  23. package/dist/components/DictionaryEditor/index.cjs.map +1 -1
  24. package/dist/components/DictionaryEditor/index.d.ts +0 -2
  25. package/dist/components/DictionaryEditor/index.d.ts.map +1 -1
  26. package/dist/components/DictionaryEditor/index.mjs +1 -9
  27. package/dist/components/DictionaryEditor/index.mjs.map +1 -1
  28. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +1 -1
  29. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +2 -20
  30. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  31. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +2 -20
  33. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  34. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +7 -24
  35. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  36. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  37. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +7 -24
  38. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  39. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +6 -35
  40. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  41. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  42. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +4 -33
  43. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  44. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +5 -23
  45. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  46. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  47. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +5 -23
  48. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  49. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -29
  50. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  51. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -29
  53. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  54. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +8 -33
  55. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  56. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +4 -29
  58. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +6 -38
  60. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
  62. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +6 -38
  63. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  64. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +3 -27
  65. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  66. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +3 -27
  68. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -14
  70. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  72. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -14
  73. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  74. package/dist/components/Modal/Modal.cjs +1 -1
  75. package/dist/components/Modal/Modal.mjs +1 -1
  76. package/dist/components/Navbar/MobileNavbar.cjs +1 -1
  77. package/dist/components/Navbar/MobileNavbar.mjs +1 -1
  78. package/dist/components/RightDrawer/RightDrawer.cjs +2 -3
  79. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  80. package/dist/components/RightDrawer/RightDrawer.mjs +1 -2
  81. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  82. package/dist/components/index.cjs +0 -8
  83. package/dist/components/index.cjs.map +1 -1
  84. package/dist/components/index.mjs +0 -8
  85. package/dist/components/index.mjs.map +1 -1
  86. package/dist/hooks/index.cjs +1 -1
  87. package/dist/hooks/index.mjs +2 -2
  88. package/dist/hooks/usePersistedStore.cjs +8 -5
  89. package/dist/hooks/usePersistedStore.cjs.map +1 -1
  90. package/dist/hooks/usePersistedStore.d.ts +2 -1
  91. package/dist/hooks/usePersistedStore.d.ts.map +1 -1
  92. package/dist/hooks/usePersistedStore.mjs +8 -5
  93. package/dist/hooks/usePersistedStore.mjs.map +1 -1
  94. package/dist/hooks/useScrollBlockage/index.cjs +5 -31
  95. package/dist/hooks/useScrollBlockage/index.cjs.map +1 -1
  96. package/dist/hooks/useScrollBlockage/index.mjs +5 -31
  97. package/dist/hooks/useScrollBlockage/index.mjs.map +1 -1
  98. package/dist/hooks/useScrollDetection.cjs +1 -1
  99. package/dist/hooks/useScrollDetection.mjs +1 -1
  100. package/dist/index-Cg-S9ry9.cjs +77 -0
  101. package/dist/index-Cg-S9ry9.cjs.map +1 -0
  102. package/dist/index-O_7rYrbW.js +78 -0
  103. package/dist/index-O_7rYrbW.js.map +1 -0
  104. package/package.json +18 -15
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
4
+ const core = require("@intlayer/core");
4
5
  require("../../EditableField/EditableFieldInput.cjs");
5
6
  const components_EditableField_EditableFieldTextArea = require("../../EditableField/EditableFieldTextArea.cjs");
6
7
  const utils_cn = require("../../../utils/cn.cjs");
7
- const utils_dictionary = require("../../../utils/dictionary.cjs");
8
8
  const StringWrapper = ({
9
9
  keyPath,
10
10
  section,
@@ -12,7 +12,7 @@ const StringWrapper = ({
12
12
  onContentChange,
13
13
  onFocusKeyPath
14
14
  }) => {
15
- const editedContentValue = utils_dictionary.getDictionaryValueByKeyPath(
15
+ const editedContentValue = core.getDictionaryValueByKeyPath(
16
16
  editedContent,
17
17
  keyPath
18
18
  );
@@ -1 +1 @@
1
- {"version":3,"file":"StringWrapper.cjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { EditableFieldTextArea } from '../..//EditableField';\nimport { cn } from '../../../utils/cn';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["getDictionaryValueByKeyPath","jsx","cn","EditableFieldTextArea"],"mappings":";;;;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqBA,iBAAA;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,qGAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAD,2BAAA,kBAAA;AAAA,QAACE,+CAAA;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;;"}
1
+ {"version":3,"file":"StringWrapper.cjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { EditableFieldTextArea } from '../..//EditableField';\nimport { cn } from '../../../utils/cn';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["getDictionaryValueByKeyPath","jsx","cn","EditableFieldTextArea"],"mappings":";;;;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqBA,KAAA;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,qGAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAD,2BAAA,kBAAA;AAAA,QAACE,+CAAA;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StringWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,KAAK,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IAC5D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAwChD,CAAC"}
1
+ {"version":3,"file":"StringWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,KAAK,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IAC5D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAwChD,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
2
+ import { getDictionaryValueByKeyPath } from "@intlayer/core";
2
3
  import "../../EditableField/EditableFieldInput.mjs";
3
4
  import { EditableFieldTextArea } from "../../EditableField/EditableFieldTextArea.mjs";
4
5
  import { cn } from "../../../utils/cn.mjs";
5
- import { getDictionaryValueByKeyPath } from "../../../utils/dictionary.mjs";
6
6
  const StringWrapper = ({
7
7
  keyPath,
8
8
  section,
@@ -1 +1 @@
1
- {"version":3,"file":"StringWrapper.mjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { EditableFieldTextArea } from '../..//EditableField';\nimport { cn } from '../../../utils/cn';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["jsx"],"mappings":";;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqB;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,+EAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"StringWrapper.mjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { EditableFieldTextArea } from '../..//EditableField';\nimport { cn } from '../../../utils/cn';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["jsx"],"mappings":";;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqB;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,+EAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;"}
@@ -2,10 +2,10 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
5
+ const editorReact = require("@intlayer/editor-react");
5
6
  const lucideReact = require("lucide-react");
6
7
  const require$$0 = require("react");
7
8
  const reactIntlayer = require("react-intlayer");
8
- const shallow = require("../../shallow-lhDIFtEp.cjs");
9
9
  require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
10
10
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
11
11
  const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
@@ -14,7 +14,6 @@ require("deepmerge");
14
14
  const components_Form_FormBase = require("../Form/FormBase.cjs");
15
15
  require("../Form/FormField.cjs");
16
16
  const components_Form_layout_FormItemLayout = require("../../Form-CSMiPnjC.cjs");
17
- const components_DictionaryEditor_useEditedContentStore = require("./useEditedContentStore.cjs");
18
17
  const components_DictionaryEditor_validDictionaryChangeButtons_content = require("./validDictionaryChangeButtons.content.cjs");
19
18
  const components_DictionaryEditor_validDictionaryChangeButtonsSchema = require("./validDictionaryChangeButtonsSchema.cjs");
20
19
  const ValidDictionaryChangeButtons = ({ dictionary }) => {
@@ -23,12 +22,7 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
23
22
  components_DictionaryEditor_validDictionaryChangeButtons_content.validDictionaryChangeButtonsContent
24
23
  );
25
24
  const { pushDictionaries } = hooks_intlayerAPIHooks.usePushDictionaries();
26
- const { editedContent, restoreEditedContent } = components_DictionaryEditor_useEditedContentStore.useEditedContentStore(
27
- shallow.useShallow((s) => ({
28
- editedContent: s.editedContent,
29
- restoreEditedContent: s.restoreEditedContent
30
- }))
31
- );
25
+ const { editedContent, restoreEditedContent } = editorReact.useEditedContent();
32
26
  const { form, isSubmitting } = components_Form_FormBase.useForm(
33
27
  ValidDictionaryChangeButtonsSchemaSchema
34
28
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n }))\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\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?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContentStore","useShallow","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJA,+DAAAA,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,iEAAAA;AAAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAIC,2CAAoB;AAE3C,QAAA,EAAE,eAAe,qBAAA,IAAyBC,kDAAA;AAAA,IAC9CC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,MACjB,sBAAsB,EAAE;AAAA,IAAA,EACxB;AAAA,EACJ;AACM,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAWA,WAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoBA,WAAA;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IACjC,CACD;AAAA,EACH;AAGE,SAAAC,2BAAAA,kBAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,2BAAA,kBAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAF,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAMC,YAAA;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCH,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAME,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEJ,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;;"}
1
+ {"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\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?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContent","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJA,+DAAAA,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,iEAAAA;AAAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAIC,2CAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAWA,WAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoBA,WAAA;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;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A,EAAA,GAIR;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAUzC,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,CAsGlC,CAAC"}
1
+ {"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQzC,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,CAiGlC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
3
+ import { useEditedContent } from "@intlayer/editor-react";
3
4
  import { RotateCcw, ArrowUpFromLine, Save } from "lucide-react";
4
5
  import { useMemo } from "react";
5
6
  import { useDictionary } from "react-intlayer";
6
- import { u as useShallow } from "../../shallow-m9BpCkKh.js";
7
7
  import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
8
8
  import "../../hooks/useAsync/useAsyncStateStore.mjs";
9
9
  import { usePushDictionaries } from "../../hooks/intlayerAPIHooks.mjs";
@@ -12,7 +12,6 @@ import "deepmerge";
12
12
  import { useForm } from "../Form/FormBase.mjs";
13
13
  import "../Form/FormField.mjs";
14
14
  import { F as Form } from "../../Form-DlqjTz3u.js";
15
- import { useEditedContentStore } from "./useEditedContentStore.mjs";
16
15
  import { validDictionaryChangeButtonsContent } from "./validDictionaryChangeButtons.content.mjs";
17
16
  import { getValidDictionaryChangeButtonsSchemaSchema } from "./validDictionaryChangeButtonsSchema.mjs";
18
17
  const ValidDictionaryChangeButtons = ({ dictionary }) => {
@@ -21,12 +20,7 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
21
20
  validDictionaryChangeButtonsContent
22
21
  );
23
22
  const { pushDictionaries } = usePushDictionaries();
24
- const { editedContent, restoreEditedContent } = useEditedContentStore(
25
- useShallow((s) => ({
26
- editedContent: s.editedContent,
27
- restoreEditedContent: s.restoreEditedContent
28
- }))
29
- );
23
+ const { editedContent, restoreEditedContent } = useEditedContent();
30
24
  const { form, isSubmitting } = useForm(
31
25
  ValidDictionaryChangeButtonsSchemaSchema
32
26
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n }))\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\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?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >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,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAM;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;"}
1
+ {"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\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?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJ,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAA;AAAA,IACjD;AAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmB;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAW;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IACjC,CACD;AAAA,EACH;AAGE,SAAAA,kCAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAD,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAM;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;"}
@@ -1,13 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const components_DictionaryEditor_useEditedContentStore = require("./useEditedContentStore.cjs");
4
- const components_DictionaryEditor_useEditionPanelStore = require("./useEditionPanelStore.cjs");
5
3
  const components_DictionaryEditor_DictionaryEditor = require("./DictionaryEditor.cjs");
6
- const utils_dictionary = require("../../utils/dictionary.cjs");
7
- exports.useEditedContentStore = components_DictionaryEditor_useEditedContentStore.useEditedContentStore;
8
- exports.useEditionPanelStore = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore;
9
4
  exports.DictionaryEditor = components_DictionaryEditor_DictionaryEditor.DictionaryEditor;
10
- exports.editDictionaryByKeyPath = utils_dictionary.editDictionaryByKeyPath;
11
- exports.getDictionaryValueByKeyPath = utils_dictionary.getDictionaryValueByKeyPath;
12
- exports.renameDictionaryValueByKeyPath = utils_dictionary.renameDictionaryValueByKeyPath;
13
5
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,4 +1,2 @@
1
- export * from './useEditedContentStore';
2
- export * from './useEditionPanelStore';
3
1
  export * from './DictionaryEditor';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/index.tsx"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1,13 +1,5 @@
1
- import { useEditedContentStore } from "./useEditedContentStore.mjs";
2
- import { useEditionPanelStore } from "./useEditionPanelStore.mjs";
3
1
  import { DictionaryEditor } from "./DictionaryEditor.mjs";
4
- import { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath } from "../../utils/dictionary.mjs";
5
2
  export {
6
- DictionaryEditor,
7
- editDictionaryByKeyPath,
8
- getDictionaryValueByKeyPath,
9
- renameDictionaryValueByKeyPath,
10
- useEditedContentStore,
11
- useEditionPanelStore
3
+ DictionaryEditor
12
4
  };
13
5
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +1,5 @@
1
1
  import { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';
2
- export { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath, } from '../../utils/dictionary';
2
+ export { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath, } from '../../../../core/src/dictionaryUtils';
3
3
  export type DictionaryContent = Record<Dictionary['key'], Dictionary>;
4
4
  type EditedContentStore = {
5
5
  dictionariesRecord: DictionaryContent;
@@ -2,29 +2,15 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
5
+ const editorReact = require("@intlayer/editor-react");
5
6
  const require$$0 = require("react");
6
7
  const reactIntlayer = require("react-intlayer");
7
- const shallow = require("../../../shallow-lhDIFtEp.cjs");
8
8
  require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
9
9
  require("../../../hooks/useAsync/useAsyncStateStore.cjs");
10
10
  require("../../../index-DFc7og1d.cjs");
11
11
  require("@intlayer/config/client");
12
12
  require("../../Toaster/Toast.cjs");
13
13
  const hooks_useGetAllDictionaries = require("../../../hooks/useGetAllDictionaries.cjs");
14
- require("../../DictionaryEditor/useEditedContentStore.cjs");
15
- const components_DictionaryEditor_useEditionPanelStore = require("../../DictionaryEditor/useEditionPanelStore.cjs");
16
- require("@intlayer/core");
17
- require("lucide-react");
18
- require("clsx");
19
- require("tailwind-merge");
20
- require("../../Button/Button.cjs");
21
- require("../../EditableField/EditableFieldInput.cjs");
22
- require("../../EditableField/EditableFieldTextArea.cjs");
23
- require("../../Form/FormBase.cjs");
24
- require("../../Form/FormField.cjs");
25
- require("../../../Form-CSMiPnjC.cjs");
26
- require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
27
- require("zod");
28
14
  const components_Loader_index = require("../../Loader/index.cjs");
29
15
  const components_DictionaryFieldEditor_DictionaryFieldEditor = require("../DictionaryFieldEditor.cjs");
30
16
  const components_DictionaryFieldEditor_DictionariesSelector_dictionariesSelector_content = require("./dictionariesSelector.content.cjs");
@@ -34,11 +20,7 @@ const DictionariesSelector = ({
34
20
  availableLocales
35
21
  }) => {
36
22
  const { online, locale, isLoading } = hooks_useGetAllDictionaries.useGetAllDictionaries();
37
- const { focusedContent } = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore(
38
- shallow.useShallow((s) => ({
39
- focusedContent: s.focusedContent
40
- }))
41
- );
23
+ const { focusedContent } = editorReact.useFocusDictionary();
42
24
  const { noDictionaryMessage, dictionaryNotFoundMessage } = reactIntlayer.useDictionary(
43
25
  components_DictionaryFieldEditor_DictionariesSelector_dictionariesSelector_content.dictionariesSelectorContent
44
26
  );
@@ -1 +1 @@
1
- {"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { useEditionPanelStore } from '../../DictionaryEditor';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n }))\n );\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useEditionPanelStore","useShallow","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAcA,4BAAAA,sBAAsB;AACtD,QAAA,EAAE,mBAAmBC,iDAAA;AAAA,IACzBC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EACJ;AACM,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAAA;AAAAA,EACF;AACA,QAAM,aAAaC,WAAA;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAC,iDAACC,wBAAAA,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA,kBAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
1
+ {"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useFocusDictionary","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAcA,4BAAAA,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAIC,+BAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAAA;AAAAA,EACF;AACA,QAAM,aAAaC,WAAA;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAC,iDAACC,wBAAAA,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA,kBAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAUzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAqC9D,CAAC"}
1
+ {"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAiC9D,CAAC"}
@@ -1,28 +1,14 @@
1
1
  "use client";
2
2
  import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
3
+ import { useFocusDictionary } from "@intlayer/editor-react";
3
4
  import { useMemo } from "react";
4
5
  import { useDictionary } from "react-intlayer";
5
- import { u as useShallow } from "../../../shallow-m9BpCkKh.js";
6
6
  import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
7
7
  import "../../../hooks/useAsync/useAsyncStateStore.mjs";
8
8
  import "../../../index-DcWYZrJW.js";
9
9
  import "@intlayer/config/client";
10
10
  import "../../Toaster/Toast.mjs";
11
11
  import { useGetAllDictionaries } from "../../../hooks/useGetAllDictionaries.mjs";
12
- import "../../DictionaryEditor/useEditedContentStore.mjs";
13
- import { useEditionPanelStore } from "../../DictionaryEditor/useEditionPanelStore.mjs";
14
- import "@intlayer/core";
15
- import "lucide-react";
16
- import "clsx";
17
- import "tailwind-merge";
18
- import "../../Button/Button.mjs";
19
- import "../../EditableField/EditableFieldInput.mjs";
20
- import "../../EditableField/EditableFieldTextArea.mjs";
21
- import "../../Form/FormBase.mjs";
22
- import "../../Form/FormField.mjs";
23
- import "../../../Form-DlqjTz3u.js";
24
- import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
25
- import "zod";
26
12
  import { Loader } from "../../Loader/index.mjs";
27
13
  import { DictionaryFieldEditor } from "../DictionaryFieldEditor.mjs";
28
14
  import { dictionariesSelectorContent } from "./dictionariesSelector.content.mjs";
@@ -32,11 +18,7 @@ const DictionariesSelector = ({
32
18
  availableLocales
33
19
  }) => {
34
20
  const { online, locale, isLoading } = useGetAllDictionaries();
35
- const { focusedContent } = useEditionPanelStore(
36
- useShallow((s) => ({
37
- focusedContent: s.focusedContent
38
- }))
39
- );
21
+ const { focusedContent } = useFocusDictionary();
40
22
  const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(
41
23
  dictionariesSelectorContent
42
24
  );
@@ -1 +1 @@
1
- {"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { useEditionPanelStore } from '../../DictionaryEditor';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n }))\n );\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAc,sBAAsB;AACtD,QAAA,EAAE,mBAAmB;AAAA,IACzB,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EACJ;AACM,QAAA,EAAE,qBAAqB,0BAAA,IAA8B;AAAA,IACzD;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAA,sCAAC,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["jsx"],"mappings":";;;;;;;;;;;;;;AAkBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAc,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAI,mBAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8B;AAAA,IACzD;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAA,sCAAC,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -2,33 +2,22 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
5
+ const editorReact = require("@intlayer/editor-react");
5
6
  const lucideReact = require("lucide-react");
6
7
  const require$$0 = require("react");
7
8
  const reactIntlayer = require("react-intlayer");
8
- const shallow = require("../../shallow-lhDIFtEp.cjs");
9
9
  const components_Button_Button = require("../Button/Button.cjs");
10
10
  const components_Container_index = require("../Container/index.cjs");
11
- const components_DictionaryEditor_useEditedContentStore = require("../DictionaryEditor/useEditedContentStore.cjs");
12
- require("../DictionaryEditor/useEditionPanelStore.cjs");
11
+ const components_Headers_index = require("../Headers/index.cjs");
12
+ require("@intlayer/config/client");
13
13
  require("@intlayer/core");
14
- require("clsx");
15
- require("tailwind-merge");
16
- require("../EditableField/EditableFieldInput.cjs");
17
- require("../EditableField/EditableFieldTextArea.cjs");
14
+ require("fuse.js");
18
15
  require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
19
16
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
20
17
  require("../../index-DFc7og1d.cjs");
21
- require("@intlayer/config/client");
22
18
  require("../Toaster/Toast.cjs");
23
19
  require("@intlayer/dictionaries-entry");
24
20
  require("deepmerge");
25
- require("../Form/FormBase.cjs");
26
- require("../Form/FormField.cjs");
27
- require("../../Form-CSMiPnjC.cjs");
28
- require("../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
29
- require("zod");
30
- const components_Headers_index = require("../Headers/index.cjs");
31
- require("fuse.js");
32
21
  require("../DropDown/index.cjs");
33
22
  require("../Input/Input.cjs");
34
23
  require("../Input/InputPassword.cjs");
@@ -52,20 +41,14 @@ const DictionaryFieldEditor = ({
52
41
  0
53
42
  /* NodeEditor */
54
43
  );
55
- const { dictionaryRecord, setDictionariesRecord } = components_DictionaryEditor_useEditedContentStore.useEditedContentStore(
56
- shallow.useShallow((s) => ({
57
- editedContent: s.editedContent,
58
- dictionaryRecord: s.dictionariesRecord,
59
- setDictionariesRecord: s.setDictionariesRecord
60
- }))
61
- );
44
+ const { dictionariesRecord, setDictionariesRecord } = editorReact.useDictionariesRecord();
62
45
  const { returnToDictionaryList, titleContent, titleInformation } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_dictionaryFieldEditor_content.dictionaryFieldEditorContent);
63
46
  require$$0.useEffect(() => {
64
- if (dictionaryRecord[key]) return;
47
+ if (dictionariesRecord[key]) return;
65
48
  setDictionariesRecord({
66
49
  [key]: dictionary
67
50
  });
68
- }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);
51
+ }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);
69
52
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.LocaleSwitcherContentProvider, { availableLocales, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex size-full flex-1 flex-col gap-10", children: [
70
53
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
71
54
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { useEditedContentStore } from '../DictionaryEditor';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionaryRecord, setDictionariesRecord } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n dictionaryRecord: s.dictionariesRecord,\n setDictionariesRecord: s.setDictionariesRecord,\n }))\n );\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionaryRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useState","useEditedContentStore","useShallow","useDictionary","dictionaryFieldEditorContent","useEffect","LocaleSwitcherContentProvider","jsxs","jsx","Button","ArrowLeft","Container","H2","DictionaryDetailsForm","SwitchSelector","NodeEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ;AACV,QAAA,CAAC,YAAY,aAAa,IAAIA,WAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,kBAAkB,sBAAA,IAA0BC,kDAAA;AAAA,IAClDC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,MACjB,kBAAkB,EAAE;AAAA,MACpB,uBAAuB,EAAE;AAAA,IAAA,EACzB;AAAA,EACJ;AACA,QAAM,EAAE,wBAAwB,cAAc,iBAAiB,IAC7DC,cAAAA,cAAcC,+DAAAA,4BAA4B;AAE5CC,aAAAA,UAAU,MAAM;AACV,QAAA,iBAAiB,GAAG,EAAG;AAEL,0BAAA;AAAA,MACpB,CAAC,GAAG,GAAG;AAAA,IAAA,CACR;AAAA,KACA,CAAC,YAAY,KAAK,uBAAuB,gBAAgB,CAAC;AAE7D,0DACGC,sEAAAA,+BAA8B,EAAA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kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdN,iDAACO,4CAAAA,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbP,2BAAA,kBAAA,IAAAQ,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DR,iDAACS,mDAAAA,YAAS,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EACF,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionariesRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useState","useDictionariesRecord","useDictionary","dictionaryFieldEditorContent","useEffect","LocaleSwitcherContentProvider","jsxs","jsx","Button","ArrowLeft","Container","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AAA,UAAAH,2BAAAA,kBAAAA,IAACI,+BAAI,UAAiB,iBAAA,CAAA;AAAA,UAEtBJ,iDAACK,yEAAAA,yBAAsB,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACjD;AAAA,IAEAN,2BAAA,kBAAA;AAAA,MAACI,2BAAA;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,aAAY;AAAA,QAEZ,UAAA;AAAA,UAAAH,2BAAAA,kBAAAA,IAACI,+BAAI,UAAa,aAAA,CAAA;AAAA,UAClBJ,2BAAA,kBAAA;AAAA,YAACM,gCAAA;AAAA,YAAA;AAAA,cACC,cAAc;AAAA,cACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,cACxC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdN,iDAACO,4CAAAA,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbP,2BAAA,kBAAA,IAAAQ,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DR,iDAACS,mDAAAA,YAAS,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgBrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAOF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CA2FhE,CAAC"}
1
+ {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAcrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAOF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAqFhE,CAAC"}
@@ -1,32 +1,21 @@
1
1
  "use client";
2
2
  import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
3
+ import { useDictionariesRecord } from "@intlayer/editor-react";
3
4
  import { ArrowLeft } from "lucide-react";
4
5
  import { useState, useEffect } from "react";
5
6
  import { useDictionary } from "react-intlayer";
6
- import { u as useShallow } from "../../shallow-m9BpCkKh.js";
7
7
  import { Button } from "../Button/Button.mjs";
8
8
  import { Container } from "../Container/index.mjs";
9
- import { useEditedContentStore } from "../DictionaryEditor/useEditedContentStore.mjs";
10
- import "../DictionaryEditor/useEditionPanelStore.mjs";
9
+ import { H2 } from "../Headers/index.mjs";
10
+ import "@intlayer/config/client";
11
11
  import "@intlayer/core";
12
- import "clsx";
13
- import "tailwind-merge";
14
- import "../EditableField/EditableFieldInput.mjs";
15
- import "../EditableField/EditableFieldTextArea.mjs";
12
+ import "fuse.js";
16
13
  import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
17
14
  import "../../hooks/useAsync/useAsyncStateStore.mjs";
18
15
  import "../../index-DcWYZrJW.js";
19
- import "@intlayer/config/client";
20
16
  import "../Toaster/Toast.mjs";
21
17
  import "@intlayer/dictionaries-entry";
22
18
  import "deepmerge";
23
- import "../Form/FormBase.mjs";
24
- import "../Form/FormField.mjs";
25
- import "../../Form-DlqjTz3u.js";
26
- import "../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
27
- import "zod";
28
- import { H2 } from "../Headers/index.mjs";
29
- import "fuse.js";
30
19
  import "../DropDown/index.mjs";
31
20
  import "../Input/Input.mjs";
32
21
  import "../Input/InputPassword.mjs";
@@ -50,20 +39,14 @@ const DictionaryFieldEditor = ({
50
39
  0
51
40
  /* NodeEditor */
52
41
  );
53
- const { dictionaryRecord, setDictionariesRecord } = useEditedContentStore(
54
- useShallow((s) => ({
55
- editedContent: s.editedContent,
56
- dictionaryRecord: s.dictionariesRecord,
57
- setDictionariesRecord: s.setDictionariesRecord
58
- }))
59
- );
42
+ const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();
60
43
  const { returnToDictionaryList, titleContent, titleInformation } = useDictionary(dictionaryFieldEditorContent);
61
44
  useEffect(() => {
62
- if (dictionaryRecord[key]) return;
45
+ if (dictionariesRecord[key]) return;
63
46
  setDictionariesRecord({
64
47
  [key]: dictionary
65
48
  });
66
- }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);
49
+ }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);
67
50
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LocaleSwitcherContentProvider, { availableLocales, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex size-full flex-1 flex-col gap-10", children: [
68
51
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
69
52
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { useEditedContentStore } from '../DictionaryEditor';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionaryRecord, setDictionariesRecord } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n dictionaryRecord: s.dictionariesRecord,\n setDictionariesRecord: s.setDictionariesRecord,\n }))\n );\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionaryRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ;AACV,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA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A,QAEZ,UAAA;AAAA,UAAAC,kCAAAA,IAAC,MAAI,UAAa,aAAA,CAAA;AAAA,UAClBA,kCAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,cAAc;AAAA,cACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,cACxC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdA,sCAAC,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbA,kCAAA,IAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DA,sCAAC,YAAS,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EACF,CAAA;AAEJ;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionariesRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ;AACV,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EACF;AACA,QAAM,EAAE,oBAAoB,sBAAsB,IAAI,sBAAsB;AAC5E,QAAM,EAAE,wBAAwB,cAAc,iBAAiB,IAC7D,cAAc,4BAA4B;AAE5C,YAAU,MAAM;AACV,QAAA,mBAAmB,GAAG,EAAG;AAEP,0BAAA;AAAA,MACpB,CAAC,GAAG,GAAG;AAAA,IAAA,CACR;AAAA,KACA,CAAC,YAAY,KAAK,uBAAuB,kBAAkB,CAAC;AAE/D,+CACG,+BAA8B,EAAA,kBAC7B,UAACA,uCAAA,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,IAACA,kCAAAA,KAAA,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,MAAAC,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAS,MAAM,wBAAwB;AAAA,UACvC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UACN,IAAG;AAAA,UACH,MAAM;AAAA,UACN,OAAO,uBAAuB;AAAA,QAAA;AAAA,MAChC;AAAA,MACAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAQ;AAAA,UAEP,UAAuB,uBAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC1B,GACF;AAAA,IAEAD,kCAAA;AAA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