@intlayer/design-system 4.0.3 → 4.0.4

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 (198) hide show
  1. package/dist/.vite/manifest.json +36 -45
  2. package/dist/components/Auth/AuthModal/index.cjs +1 -1
  3. package/dist/components/Auth/AuthModal/index.mjs +1 -1
  4. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +2 -1
  5. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
  6. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +2 -1
  7. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
  8. package/dist/components/Auth/useAuth/index.cjs +8 -4
  9. package/dist/components/Auth/useAuth/index.cjs.map +1 -1
  10. package/dist/components/Auth/useAuth/index.d.ts +3 -1
  11. package/dist/components/Auth/useAuth/index.d.ts.map +1 -1
  12. package/dist/components/Auth/useAuth/index.mjs +8 -4
  13. package/dist/components/Auth/useAuth/index.mjs.map +1 -1
  14. package/dist/components/Auth/useAuth/useCSRF.cjs +6 -3
  15. package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -1
  16. package/dist/components/Auth/useAuth/useCSRF.d.ts +2 -1
  17. package/dist/components/Auth/useAuth/useCSRF.d.ts.map +1 -1
  18. package/dist/components/Auth/useAuth/useCSRF.mjs +5 -2
  19. package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -1
  20. package/dist/components/Auth/useAuth/useOAuth2.cjs +6 -5
  21. package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -1
  22. package/dist/components/Auth/useAuth/useOAuth2.d.ts +2 -1
  23. package/dist/components/Auth/useAuth/useOAuth2.d.ts.map +1 -1
  24. package/dist/components/Auth/useAuth/useOAuth2.mjs +5 -4
  25. package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -1
  26. package/dist/components/Auth/useAuth/useSession.cjs +6 -3
  27. package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
  28. package/dist/components/Auth/useAuth/useSession.d.ts +2 -1
  29. package/dist/components/Auth/useAuth/useSession.d.ts.map +1 -1
  30. package/dist/components/Auth/useAuth/useSession.mjs +6 -3
  31. package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
  32. package/dist/components/Auth/useUser/index.cjs +1 -1
  33. package/dist/components/Auth/useUser/index.mjs +1 -1
  34. package/dist/components/Container/index.d.ts +2 -2
  35. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +1 -1
  36. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
  37. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.cjs +2 -1
  38. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.cjs.map +1 -1
  39. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts.map +1 -1
  40. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs +2 -1
  41. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs.map +1 -1
  42. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.cjs +1 -1
  43. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.mjs +1 -1
  44. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.cjs +2 -1
  45. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.cjs.map +1 -1
  46. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts.map +1 -1
  47. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs +2 -1
  48. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs.map +1 -1
  49. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +3 -3
  50. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
  51. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +2 -2
  52. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
  53. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.cjs +1 -1
  54. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.mjs +1 -1
  55. package/dist/components/DictionaryEditor/NodeWrapper/index.cjs +1 -1
  56. package/dist/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
  57. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +0 -1
  58. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  59. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +0 -1
  60. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +1 -1
  62. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +1 -1
  63. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +4 -2
  64. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  65. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +4 -2
  66. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +4 -2
  68. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +4 -2
  70. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -11
  72. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  74. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -12
  75. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  76. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +5 -5
  77. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  78. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  79. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +3 -3
  80. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  81. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +2 -2
  82. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  83. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  84. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +2 -2
  85. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  86. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +6 -5
  87. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  88. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  89. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -1
  90. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  91. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +0 -8
  92. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  93. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
  94. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +1 -9
  95. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  96. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +2 -1
  97. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  98. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  99. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -1
  100. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  101. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +7 -5
  102. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  103. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +7 -5
  104. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  105. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +2 -2
  106. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +2 -2
  107. package/dist/components/EditableField/EditableFieldLayout.cjs +7 -3
  108. package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
  109. package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
  110. package/dist/components/EditableField/EditableFieldLayout.mjs +7 -3
  111. package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
  112. package/dist/components/IDE/CodeContext.cjs +2 -2
  113. package/dist/components/IDE/CodeContext.mjs +2 -2
  114. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
  115. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
  116. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +2 -2
  117. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +2 -2
  118. package/dist/components/Modal/Modal.cjs +11 -7
  119. package/dist/components/Modal/Modal.cjs.map +1 -1
  120. package/dist/components/Modal/Modal.d.ts.map +1 -1
  121. package/dist/components/Modal/Modal.mjs +11 -7
  122. package/dist/components/Modal/Modal.mjs.map +1 -1
  123. package/dist/components/Navbar/MobileNavbar.cjs +2 -2
  124. package/dist/components/Navbar/MobileNavbar.mjs +2 -2
  125. package/dist/components/Navbar/index.cjs +2 -2
  126. package/dist/components/Navbar/index.mjs +2 -2
  127. package/dist/components/RightDrawer/RightDrawer.cjs +32 -15
  128. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  129. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  130. package/dist/components/RightDrawer/RightDrawer.mjs +32 -15
  131. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  132. package/dist/components/SwitchSelector/index.cjs +2 -2
  133. package/dist/components/SwitchSelector/index.mjs +2 -2
  134. package/dist/components/TabSelector/TabSelector.cjs +2 -2
  135. package/dist/components/TabSelector/TabSelector.mjs +2 -2
  136. package/dist/hooks/intlayerAPIHooks.cjs +5 -1
  137. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  138. package/dist/hooks/intlayerAPIHooks.d.ts +49 -49
  139. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  140. package/dist/hooks/intlayerAPIHooks.mjs +5 -1
  141. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  142. package/dist/hooks/useAsync/useAsync.cjs +14 -0
  143. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  144. package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
  145. package/dist/hooks/useAsync/useAsync.mjs +14 -0
  146. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  147. package/dist/hooks/useGetAllDictionaries.cjs +3 -2
  148. package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
  149. package/dist/hooks/useGetAllDictionaries.d.ts +2 -2
  150. package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
  151. package/dist/hooks/useGetAllDictionaries.mjs +3 -2
  152. package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
  153. package/dist/hooks/useIntlayerAPI.cjs +10 -7
  154. package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
  155. package/dist/hooks/useIntlayerAPI.d.ts +8 -2
  156. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  157. package/dist/hooks/useIntlayerAPI.mjs +10 -7
  158. package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
  159. package/dist/hooks/usePersistedStore.cjs +25 -18
  160. package/dist/hooks/usePersistedStore.cjs.map +1 -1
  161. package/dist/hooks/usePersistedStore.d.ts +2 -2
  162. package/dist/hooks/usePersistedStore.d.ts.map +1 -1
  163. package/dist/hooks/usePersistedStore.mjs +26 -19
  164. package/dist/hooks/usePersistedStore.mjs.map +1 -1
  165. package/dist/index-B-VAyQ9R.js +673 -0
  166. package/dist/index-B-VAyQ9R.js.map +1 -0
  167. package/dist/index-B-adg6xa.js +206 -0
  168. package/dist/index-B-adg6xa.js.map +1 -0
  169. package/dist/index-BIV0x_z2.js +206 -0
  170. package/dist/index-BIV0x_z2.js.map +1 -0
  171. package/dist/index-BNH9wXVj.cjs +205 -0
  172. package/dist/index-BNH9wXVj.cjs.map +1 -0
  173. package/dist/index-D69JRZcQ.js +206 -0
  174. package/dist/index-D69JRZcQ.js.map +1 -0
  175. package/dist/index-DAsui9u9.cjs +205 -0
  176. package/dist/index-DAsui9u9.cjs.map +1 -0
  177. package/dist/index-SOIahRpS.cjs +205 -0
  178. package/dist/index-SOIahRpS.cjs.map +1 -0
  179. package/dist/index-T-TjVQoD.js +671 -0
  180. package/dist/index-T-TjVQoD.js.map +1 -0
  181. package/dist/index-f8_VC6c8.cjs +672 -0
  182. package/dist/index-f8_VC6c8.cjs.map +1 -0
  183. package/dist/index-llGIfxqV.cjs +670 -0
  184. package/dist/index-llGIfxqV.cjs.map +1 -0
  185. package/dist/tailwind.css +1 -1
  186. package/dist/useGetAllDictionaries-B1sqs2IB.cjs +34 -0
  187. package/dist/useGetAllDictionaries-B1sqs2IB.cjs.map +1 -0
  188. package/dist/useGetAllDictionaries-BbH8vTkY.js +35 -0
  189. package/dist/useGetAllDictionaries-BbH8vTkY.js.map +1 -0
  190. package/dist/useGetAllDictionaries-Bgkytpa2.cjs +34 -0
  191. package/dist/useGetAllDictionaries-Bgkytpa2.cjs.map +1 -0
  192. package/dist/useGetAllDictionaries-D8ma3h41.cjs +33 -0
  193. package/dist/useGetAllDictionaries-D8ma3h41.cjs.map +1 -0
  194. package/dist/useGetAllDictionaries-DHgHEbD5.js +34 -0
  195. package/dist/useGetAllDictionaries-DHgHEbD5.js.map +1 -0
  196. package/dist/useGetAllDictionaries-DUzm0rIa.js +35 -0
  197. package/dist/useGetAllDictionaries-DUzm0rIa.js.map +1 -0
  198. package/package.json +21 -16
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
5
5
  const client = require("@intlayer/config/client");
6
6
  const core = require("@intlayer/core");
7
+ const editor = require("@intlayer/editor");
7
8
  const editorReact = require("@intlayer/editor-react");
8
9
  const require$$0 = require("react");
9
10
  const reactIntlayer = require("react-intlayer");
@@ -23,7 +24,7 @@ const NodeTypeSelector = ({
23
24
  enumeration,
24
25
  triggerPlaceHolder
25
26
  } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_nodeTypeSelector_content.nodeTypeSelectorContent);
26
- const nodeType = core.getSectionType(section);
27
+ const nodeType = editor.getSectionType(section);
27
28
  const [keyType, setKeyType] = require$$0.useState(nodeType);
28
29
  const { addEditedContent } = editorReact.useEditedContentActions();
29
30
  const { locales } = client.getConfiguration().internationalization;
@@ -1 +1 @@
1
- {"version":3,"file":"NodeTypeSelector.cjs","sources":["../../../src/components/DictionaryFieldEditor/NodeTypeSelector.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type DictionaryValue,\n type EnumerationContent,\n getSectionType,\n type KeyPath,\n NodeType,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport { type FC, useEffect, useState } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Select } from '../Select';\nimport { nodeTypeSelectorContent } from './nodeTypeSelector.content';\n\ntype NodeTypeSelectorProps = {\n keyPath: KeyPath[];\n dictionaryKey: string;\n section: DictionaryValue;\n};\n\nexport const NodeTypeSelector: FC<NodeTypeSelectorProps> = ({\n keyPath,\n dictionaryKey,\n section,\n}) => {\n const {\n multilingualText,\n text,\n node,\n array,\n enumeration,\n triggerPlaceHolder,\n } = useDictionary(nodeTypeSelectorContent);\n const nodeType = getSectionType(section);\n const [keyType, setKeyType] = useState<NodeType>(nodeType);\n const { addEditedContent } = useEditedContentActions();\n const { locales } = getConfiguration().internationalization;\n\n const onValueChange = (keyType: NodeType) => {\n setKeyType(keyType);\n\n switch (keyType) {\n case NodeType.Translation:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: '',\n }))\n ),\n } as TranslationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Enumeration:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': '',\n '>1': '',\n },\n } as EnumerationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Object:\n addEditedContent(dictionaryKey, {}, keyPath);\n break;\n case NodeType.Array:\n addEditedContent(dictionaryKey, [''], keyPath);\n break;\n case NodeType.Text:\n addEditedContent(dictionaryKey, '', keyPath);\n break;\n default:\n addEditedContent(dictionaryKey, {}, keyPath);\n }\n };\n\n useEffect(() => {\n setKeyType(nodeType);\n }, [nodeType]);\n\n return (\n <Select value={keyType} onValueChange={onValueChange}>\n <Select.Trigger className=\"w-40\">\n <Select.Value placeholder={triggerPlaceHolder} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value={NodeType.Translation}>\n {multilingualText}\n </Select.Item>\n <Select.Item value={NodeType.Text}>{text}</Select.Item>\n <Select.Item value={NodeType.Object}>{node}</Select.Item>\n <Select.Item value={NodeType.Array}>{array}</Select.Item>\n <Select.Item value={NodeType.Enumeration}>{enumeration}</Select.Item>\n </Select.Content>\n </Select>\n );\n};\n"],"names":["useDictionary","nodeTypeSelectorContent","getSectionType","useState","useEditedContentActions","getConfiguration","keyType","NodeType","useEffect","jsxs","Select","jsx"],"mappings":";;;;;;;;;;;;AAwBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEA,cAAAA,cAAcC,0DAAAA,uBAAuB;AACnC,QAAA,WAAWC,oBAAe,OAAO;AACvC,QAAM,CAAC,SAAS,UAAU,IAAIC,WAAAA,SAAmB,QAAQ;AACnD,QAAA,EAAE,iBAAiB,IAAIC,oCAAwB;AACrD,QAAM,EAAE,QAAA,IAAYC,OAAA,iBAAA,EAAmB;AAEjC,QAAA,gBAAgB,CAACC,aAAsB;AAC3C,eAAWA,QAAO;AAElB,YAAQA,UAAS;AAAA,MACf,KAAKC,KAAS,SAAA;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAUA,KAAS,SAAA;AAAA,YACnB,CAACA,KAAA,SAAS,WAAW,GAAG,OAAO;AAAA,cAC7B,CAAC;AAAA,cACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,gBAC1B,CAAC,MAAM,GAAG;AAAA,cAAA,EACV;AAAA,YAAA;AAAA,UAEN;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAKA,KAAS,SAAA;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAUA,KAAS,SAAA;AAAA,YACnB,CAACA,KAAAA,SAAS,WAAW,GAAG;AAAA,cACtB,KAAK;AAAA,cACL,MAAM;AAAA,YAAA;AAAA,UAEV;AAAA,UACA;AAAA,QACF;AACA;AAAA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import { getConfiguration } from '@intlayer/config/client';\nimport {\n type DictionaryValue,\n type EnumerationContent,\n type KeyPath,\n NodeType,\n type TranslationContent,\n} from '@intlayer/core';\nimport { getSectionType } from '@intlayer/editor';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport { type FC, useEffect, useState } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Select } from '../Select';\nimport { nodeTypeSelectorContent } from './nodeTypeSelector.content';\n\ntype NodeTypeSelectorProps = {\n keyPath: KeyPath[];\n dictionaryKey: string;\n section: DictionaryValue;\n};\n\nexport const NodeTypeSelector: FC<NodeTypeSelectorProps> = ({\n keyPath,\n dictionaryKey,\n section,\n}) => {\n const {\n multilingualText,\n text,\n node,\n array,\n enumeration,\n triggerPlaceHolder,\n } = useDictionary(nodeTypeSelectorContent);\n const nodeType = getSectionType(section);\n const [keyType, setKeyType] = useState<NodeType>(nodeType);\n const { addEditedContent } = useEditedContentActions();\n const { locales } = getConfiguration().internationalization;\n\n const onValueChange = (keyType: NodeType) => {\n setKeyType(keyType);\n\n switch (keyType) {\n case NodeType.Translation:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: '',\n }))\n ),\n } as TranslationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Enumeration:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': '',\n '>1': '',\n },\n } as EnumerationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Object:\n addEditedContent(dictionaryKey, {}, keyPath);\n break;\n case NodeType.Array:\n addEditedContent(dictionaryKey, [''], keyPath);\n break;\n case NodeType.Text:\n addEditedContent(dictionaryKey, '', keyPath);\n break;\n default:\n addEditedContent(dictionaryKey, {}, keyPath);\n }\n };\n\n useEffect(() => {\n setKeyType(nodeType);\n }, [nodeType]);\n\n return (\n <Select value={keyType} onValueChange={onValueChange}>\n <Select.Trigger className=\"w-40\">\n <Select.Value placeholder={triggerPlaceHolder} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value={NodeType.Translation}>\n {multilingualText}\n </Select.Item>\n <Select.Item value={NodeType.Text}>{text}</Select.Item>\n <Select.Item value={NodeType.Object}>{node}</Select.Item>\n <Select.Item value={NodeType.Array}>{array}</Select.Item>\n <Select.Item value={NodeType.Enumeration}>{enumeration}</Select.Item>\n </Select.Content>\n </Select>\n );\n};\n"],"names":["useDictionary","nodeTypeSelectorContent","getSectionType","useState","useEditedContentActions","getConfiguration","keyType","NodeType","useEffect","jsxs","Select","jsx"],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEA,cAAAA,cAAcC,0DAAAA,uBAAuB;AACnC,QAAA,WAAWC,sBAAe,OAAO;AACvC,QAAM,CAAC,SAAS,UAAU,IAAIC,WAAAA,SAAmB,QAAQ;AACnD,QAAA,EAAE,iBAAiB,IAAIC,oCAAwB;AACrD,QAAM,EAAE,QAAA,IAAYC,OAAA,iBAAA,EAAmB;AAEjC,QAAA,gBAAgB,CAACC,aAAsB;AAC3C,eAAWA,QAAO;AAElB,YAAQA,UAAS;AAAA,MACf,KAAKC,KAAS,SAAA;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAUA,KAAS,SAAA;AAAA,YACnB,CAACA,KAAA,SAAS,WAAW,GAAG,OAAO;AAAA,cAC7B,CAAC;AAAA,cACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,gBAC1B,CAAC,MAAM,GAAG;AAAA,cAAA,EACV;AAAA,YAAA;AAAA,UAEN;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAKA,KAAS,SAAA;AAC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AAAA,SAAS,aAAc,UAAY,YAAA,CAAA;AAAA,IAAA,EACzD,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NodeTypeSelector.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/NodeTypeSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,OAAO,EAGb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,EAAuB,MAAM,OAAO,CAAC;AAMrD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoFtD,CAAC"}
1
+ {"version":3,"file":"NodeTypeSelector.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/NodeTypeSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,OAAO,EAGb,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,EAAuB,MAAM,OAAO,CAAC;AAMrD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoFtD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
3
3
  import { getConfiguration } from "@intlayer/config/client";
4
- import { getSectionType, NodeType } from "@intlayer/core";
4
+ import { NodeType } from "@intlayer/core";
5
+ import { getSectionType } from "@intlayer/editor";
5
6
  import { useEditedContentActions } from "@intlayer/editor-react";
6
7
  import { useState, useEffect } from "react";
7
8
  import { useDictionary } from "react-intlayer";
@@ -1 +1 @@
1
- {"version":3,"file":"NodeTypeSelector.mjs","sources":["../../../src/components/DictionaryFieldEditor/NodeTypeSelector.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type DictionaryValue,\n type EnumerationContent,\n getSectionType,\n type KeyPath,\n NodeType,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport { type FC, useEffect, useState } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Select } from '../Select';\nimport { nodeTypeSelectorContent } from './nodeTypeSelector.content';\n\ntype NodeTypeSelectorProps = {\n keyPath: KeyPath[];\n dictionaryKey: string;\n section: DictionaryValue;\n};\n\nexport const NodeTypeSelector: FC<NodeTypeSelectorProps> = ({\n keyPath,\n dictionaryKey,\n section,\n}) => {\n const {\n multilingualText,\n text,\n node,\n array,\n enumeration,\n triggerPlaceHolder,\n } = useDictionary(nodeTypeSelectorContent);\n const nodeType = getSectionType(section);\n const [keyType, setKeyType] = useState<NodeType>(nodeType);\n const { addEditedContent } = useEditedContentActions();\n const { locales } = getConfiguration().internationalization;\n\n const onValueChange = (keyType: NodeType) => {\n setKeyType(keyType);\n\n switch (keyType) {\n case NodeType.Translation:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: '',\n }))\n ),\n } as TranslationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Enumeration:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': '',\n '>1': '',\n },\n } as EnumerationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Object:\n addEditedContent(dictionaryKey, {}, keyPath);\n break;\n case NodeType.Array:\n addEditedContent(dictionaryKey, [''], keyPath);\n break;\n case NodeType.Text:\n addEditedContent(dictionaryKey, '', keyPath);\n break;\n default:\n addEditedContent(dictionaryKey, {}, keyPath);\n }\n };\n\n useEffect(() => {\n setKeyType(nodeType);\n }, [nodeType]);\n\n return (\n <Select value={keyType} onValueChange={onValueChange}>\n <Select.Trigger className=\"w-40\">\n <Select.Value placeholder={triggerPlaceHolder} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value={NodeType.Translation}>\n {multilingualText}\n </Select.Item>\n <Select.Item value={NodeType.Text}>{text}</Select.Item>\n <Select.Item value={NodeType.Object}>{node}</Select.Item>\n <Select.Item value={NodeType.Array}>{array}</Select.Item>\n <Select.Item value={NodeType.Enumeration}>{enumeration}</Select.Item>\n </Select.Content>\n </Select>\n );\n};\n"],"names":["keyType","jsxs","jsx"],"mappings":";;;;;;;;;;AAwBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,uBAAuB;AACnC,QAAA,WAAW,eAAe,OAAO;AACvC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAmB,QAAQ;AACnD,QAAA,EAAE,iBAAiB,IAAI,wBAAwB;AACrD,QAAM,EAAE,QAAA,IAAY,iBAAA,EAAmB;AAEjC,QAAA,gBAAgB,CAACA,aAAsB;AAC3C,eAAWA,QAAO;AAElB,YAAQA,UAAS;AAAA,MACf,KAAK,SAAS;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAU,SAAS;AAAA,YACnB,CAAC,SAAS,WAAW,GAAG,OAAO;AAAA,cAC7B,CAAC;AAAA,cACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,gBAC1B,CAAC,MAAM,GAAG;AAAA,cAAA,EACV;AAAA,YAAA;AAAA,UAEN;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAK,SAAS;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAU,SAAS;AAAA,YACnB,CAAC,SAAS,WAAW,GAAG;AAAA,cACtB,KAAK;AAAA,cACL,MAAM;AAAA,YAAA;AAAA,UAEV;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAK,SAAS;AACK,yBAAA,eAAe,CAAC,GAAG,OAAO;AAC3C;AAAA,MACF,KAAK,SAAS;AACZ,yBAAiB,eAAe,CAAC,EAAE,GAAG,OAAO;AAC7C;AAAA,MACF,KAAK,SAAS;AACK,yBAAA,eAAe,IAAI,OAAO;AAC3C;AAAA,MACF;AACmB,yBAAA,eAAe,CAAC,GAAG,OAAO;AAAA,IAAA;AAAA,EAEjD;AAEA,YAAU,MAAM;AACd,eAAW,QAAQ;AAAA,EAAA,GAClB,CAAC,QAAQ,CAAC;AAEb,SACGC,kCAAAA,KAAA,QAAA,EAAO,OAAO,SAAS,eACtB,UAAA;AAAA,IAACC,kCAAAA,IAAA,OAAO,SAAP,EAAe,WAAU,QACxB,UAACA,sCAAA,OAAO,OAAP,EAAa,aAAa,mBAAA,CAAoB,EACjD,CAAA;AAAA,IACAD,kCAAAA,KAAC,OAAO,SAAP,EACC,UAAA;AAAA,MAAAC,sCAAC,OAAO,MAAP,EAAY,OAAO,SAAS,aAC1B,UACH,kBAAA;AAAA,4CACC,OAAO,MAAP,EAAY,OAAO,SAAS,MAAO,UAAK,MAAA;AAAA,4CACxC,OAAO,MAAP,EAAY,OAAO,SAAS,QAAS,UAAK,MAAA;AAAA,4CAC1C,OAAO,MAAP,EAAY,OAAO,SAAS,OAAQ,UAAM,OAAA;AAAA,4CAC1C,OAAO,MAAP,EAAY,OAAO,SAAS,aAAc,UAAY,YAAA,CAAA;AAAA,IAAA,EACzD,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"NodeTypeSelector.mjs","sources":["../../../src/components/DictionaryFieldEditor/NodeTypeSelector.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type DictionaryValue,\n type EnumerationContent,\n type KeyPath,\n NodeType,\n type TranslationContent,\n} from '@intlayer/core';\nimport { getSectionType } from '@intlayer/editor';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport { type FC, useEffect, useState } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Select } from '../Select';\nimport { nodeTypeSelectorContent } from './nodeTypeSelector.content';\n\ntype NodeTypeSelectorProps = {\n keyPath: KeyPath[];\n dictionaryKey: string;\n section: DictionaryValue;\n};\n\nexport const NodeTypeSelector: FC<NodeTypeSelectorProps> = ({\n keyPath,\n dictionaryKey,\n section,\n}) => {\n const {\n multilingualText,\n text,\n node,\n array,\n enumeration,\n triggerPlaceHolder,\n } = useDictionary(nodeTypeSelectorContent);\n const nodeType = getSectionType(section);\n const [keyType, setKeyType] = useState<NodeType>(nodeType);\n const { addEditedContent } = useEditedContentActions();\n const { locales } = getConfiguration().internationalization;\n\n const onValueChange = (keyType: NodeType) => {\n setKeyType(keyType);\n\n switch (keyType) {\n case NodeType.Translation:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Translation,\n [NodeType.Translation]: Object.assign(\n {},\n ...locales.map((locale) => ({\n [locale]: '',\n }))\n ),\n } as TranslationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Enumeration:\n addEditedContent(\n dictionaryKey,\n {\n nodeType: NodeType.Enumeration,\n [NodeType.Enumeration]: {\n '1': '',\n '>1': '',\n },\n } as EnumerationContent<DictionaryValue>,\n keyPath\n );\n break;\n case NodeType.Object:\n addEditedContent(dictionaryKey, {}, keyPath);\n break;\n case NodeType.Array:\n addEditedContent(dictionaryKey, [''], keyPath);\n break;\n case NodeType.Text:\n addEditedContent(dictionaryKey, '', keyPath);\n break;\n default:\n addEditedContent(dictionaryKey, {}, keyPath);\n }\n };\n\n useEffect(() => {\n setKeyType(nodeType);\n }, [nodeType]);\n\n return (\n <Select value={keyType} onValueChange={onValueChange}>\n <Select.Trigger className=\"w-40\">\n <Select.Value placeholder={triggerPlaceHolder} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value={NodeType.Translation}>\n {multilingualText}\n </Select.Item>\n <Select.Item value={NodeType.Text}>{text}</Select.Item>\n <Select.Item value={NodeType.Object}>{node}</Select.Item>\n <Select.Item value={NodeType.Array}>{array}</Select.Item>\n <Select.Item value={NodeType.Enumeration}>{enumeration}</Select.Item>\n </Select.Content>\n </Select>\n );\n};\n"],"names":["keyType","jsxs","jsx"],"mappings":";;;;;;;;;;;AAwBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,uBAAuB;AACnC,QAAA,WAAW,eAAe,OAAO;AACvC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAmB,QAAQ;AACnD,QAAA,EAAE,iBAAiB,IAAI,wBAAwB;AACrD,QAAM,EAAE,QAAA,IAAY,iBAAA,EAAmB;AAEjC,QAAA,gBAAgB,CAACA,aAAsB;AAC3C,eAAWA,QAAO;AAElB,YAAQA,UAAS;AAAA,MACf,KAAK,SAAS;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAU,SAAS;AAAA,YACnB,CAAC,SAAS,WAAW,GAAG,OAAO;AAAA,cAC7B,CAAC;AAAA,cACD,GAAG,QAAQ,IAAI,CAAC,YAAY;AAAA,gBAC1B,CAAC,MAAM,GAAG;AAAA,cAAA,EACV;AAAA,YAAA;AAAA,UAEN;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAK,SAAS;AACZ;AAAA,UACE;AAAA,UACA;AAAA,YACE,UAAU,SAAS;AAAA,YACnB,CAAC,SAAS,WAAW,GAAG;AAAA,cACtB,KAAK;AAAA,cACL,MAAM;AAAA,YAAA;AAAA,UAEV;AAAA,UACA;AAAA,QACF;AACA;AAAA,MACF,KAAK,SAAS;AACK,yBAAA,eAAe,CAAC,GAAG,OAAO;AAC3C;AAAA,MACF,KAAK,SAAS;AACZ,yBAAiB,eAAe,CAAC,EAAE,GAAG,OAAO;AAC7C;AAAA,MACF,KAAK,SAAS;AACK,yBAAA,eAAe,IAAI,OAAO;AAC3C;AAAA,MACF;AACmB,yBAAA,eAAe,CAAC,GAAG,OAAO;AAAA,IAAA;AAAA,EAEjD;AAEA,YAAU,MAAM;AACd,eAAW,QAAQ;AAAA,EAAA,GAClB,CAAC,QAAQ,CAAC;AAEb,SACGC,kCAAAA,KAAA,QAAA,EAAO,OAAO,SAAS,eACtB,UAAA;AAAA,IAACC,kCAAAA,IAAA,OAAO,SAAP,EAAe,WAAU,QACxB,UAACA,sCAAA,OAAO,OAAP,EAAa,aAAa,mBAAA,CAAoB,EACjD,CAAA;AAAA,IACAD,kCAAAA,KAAC,OAAO,SAAP,EACC,UAAA;AAAA,MAAAC,sCAAC,OAAO,MAAP,EAAY,OAAO,SAAS,aAC1B,UACH,kBAAA;AAAA,4CACC,OAAO,MAAP,EAAY,OAAO,SAAS,MAAO,UAAK,MAAA;AAAA,4CACxC,OAAO,MAAP,EAAY,OAAO,SAAS,QAAS,UAAK,MAAA;AAAA,4CAC1C,OAAO,MAAP,EAAY,OAAO,SAAS,OAAQ,UAAM,OAAA;AAAA,4CAC1C,OAAO,MAAP,EAAY,OAAO,SAAS,aAAc,UAAY,YAAA,CAAA;AAAA,IAAA,EACzD,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -7,7 +7,12 @@ const intlayer = require("intlayer");
7
7
  const lucideReact = require("lucide-react");
8
8
  const require$$0 = require("react");
9
9
  const reactIntlayer = require("react-intlayer");
10
- require("../../../index-DFc7og1d.cjs");
10
+ require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
11
+ require("../../../hooks/useAsync/useAsyncStateStore.cjs");
12
+ const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
13
+ const hooks_useGetAllDictionaries = require("../../../hooks/useGetAllDictionaries.cjs");
14
+ require("../../../index-f8_VC6c8.cjs");
15
+ require("@intlayer/config/client");
11
16
  require("../../Button/Button.cjs");
12
17
  require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
13
18
  const components_Form_FormBase = require("../../Form/FormBase.cjs");
@@ -17,10 +22,6 @@ require("../../Auth/SignInForm/signIn.content.cjs");
17
22
  require("zod");
18
23
  require("../../Auth/SignInForm/useSignInSchema.content.cjs");
19
24
  require("../../Auth/SignUpForm/useSignUpSchema.content.cjs");
20
- require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
21
- require("../../../hooks/useAsync/useAsyncStateStore.cjs");
22
- const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
23
- const hooks_useGetAllDictionaries = require("../../../hooks/useGetAllDictionaries.cjs");
24
25
  const components_Auth_useAuth_index = require("../../Auth/useAuth/index.cjs");
25
26
  require("../../Auth/ChangePasswordForm/changePasswordForm.content.cjs");
26
27
  require("../../Auth/ChangePasswordForm/useChangePasswordSchema.content.cjs");
@@ -29,6 +30,7 @@ require("../../Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs");
29
30
  require("../../Modal/Modal.cjs");
30
31
  require("clsx");
31
32
  require("tailwind-merge");
33
+ require("@intlayer/api");
32
34
  const components_DictionaryFieldEditor_SaveForm_saveForm_content = require("./saveForm.content.cjs");
33
35
  const components_DictionaryFieldEditor_SaveForm_SaveFormSchema = require("./SaveFormSchema.cjs");
34
36
  const SaveForm = ({ dictionary }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Locales } from 'intlayer';\nimport { ArrowUpFromLine, RotateCcw, Save, WandSparkles } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useAuth } from '../../../components/Auth';\nimport {\n useAuditContentDeclaration,\n useGetAllDictionaries,\n usePushDictionaries,\n} from '../../../hooks';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { session } = useAuth();\n const project = session?.project;\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n const { isLoading: isAuditing, auditContentDeclaration } =\n useAuditContentDeclaration();\n\n const { editedContent, restoreEditedContent, setEditedContent } =\n useEditedContent();\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { auditButton, resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n onlineDictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(onlineDictionary.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = useCallback(async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n }, [dictionary, editedContent, pushDictionaries]);\n\n const handleOnAuditFile = async () =>\n await auditContentDeclaration({\n defaultLocale: project?.defaultLocale ?? Locales.ENGLISH,\n locales: project?.locales ?? [Locales.ENGLISH],\n fileContent: JSON.stringify(editedDictionary ?? dictionary),\n }).then((response) => {\n if (!response.data) return;\n\n const editedDictionary = JSON.parse(\n response.data.fileContent\n ) as Dictionary;\n\n setEditedContent(dictionary.key, editedDictionary.content);\n });\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <Form.Button\n type=\"button\"\n label={auditButton.label}\n disabled={isSubmitting}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"ml-auto max-md:w-full\"\n isLoading={isAuditing}\n onClick={handleOnAuditFile}\n >\n {auditButton.text}\n </Form.Button>\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\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 {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\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 className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["useAuth","usePushDictionaries","getSaveFormSchema","useGetAllDictionaries","useAuditContentDeclaration","useEditedContent","useForm","useDictionary","saveDictionaryContent","useMemo","useCallback","Locales","editedDictionary","jsxs","Form","jsx","WandSparkles","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EA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,WAAU;AAAA,YACV,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEH,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMK,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAGN;AAEJ;;"}
1
+ {"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Locales } from 'intlayer';\nimport { ArrowUpFromLine, RotateCcw, Save, WandSparkles } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n usePushDictionaries,\n useGetAllDictionaries,\n useAuditContentDeclaration,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { session } = useAuth();\n const project = session?.project;\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n const { isLoading: isAuditing, auditContentDeclaration } =\n useAuditContentDeclaration();\n\n const { editedContent, restoreEditedContent, setEditedContent } =\n useEditedContent();\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { auditButton, resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n onlineDictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(onlineDictionary.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = useCallback(async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n }, [dictionary, editedContent, pushDictionaries]);\n\n const handleOnAuditFile = async () =>\n await auditContentDeclaration({\n defaultLocale: project?.defaultLocale ?? Locales.ENGLISH,\n locales: project?.locales ?? [Locales.ENGLISH],\n fileContent: JSON.stringify(editedDictionary ?? dictionary),\n }).then((response) => {\n if (!response.data) return;\n\n const editedDictionary = JSON.parse(\n response.data.fileContent\n ) as Dictionary;\n\n setEditedContent(dictionary.key, editedDictionary.content);\n });\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <Form.Button\n type=\"button\"\n label={auditButton.label}\n disabled={isSubmitting}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"ml-auto max-md:w-full\"\n isLoading={isAuditing}\n onClick={handleOnAuditFile}\n >\n {auditButton.text}\n </Form.Button>\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\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 {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\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 className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["useAuth","usePushDictionaries","getSaveFormSchema","useGetAllDictionaries","useAuditContentDeclaration","useEditedContent","useForm","useDictionary","saveDictionaryContent","useMemo","useCallback","Locales","editedDictionary","jsxs","Form","jsx","WandSparkles","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EAAE,QAAQ,IAAIA,sCAAQ;AAC5B,QAAM,UAAU,SAAS;AACnB,QAAA,EAAE,iBAAiB,IAAIC,2CAAoB;AACjD,QAAM,iBAAiBC,yDAAAA,kBAAkB;AACnC,QAAA,EAAE,OAAO,IAAIC,kDAAsB;AACzC,QAAM,EAAE,WAAW,YAAY,wBAAA,IAC7BC,uBAAAA,2BAA2B;AAE7B,QAAM,EAAE,eAAe,sBAAsB,iBAAA,IAC3CC,YAAAA,iBAAiB;AACnB,QAAM,EAAE,MAAM,iBAAiBC,yBAAAA,QAAQ,cAAc;AACrD,QAAM,EAAE,aAAa,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IAC9DC,2DAAAA;AAAAA,EACF;AAEA,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEM,QAAA,mBAAmBA,WAAAA,QAAQ,MAAM;AAC9B,WAAA,SAAS,WAAW,GAAG;AAAA,EAC7B,GAAA,CAAC,QAAQ,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AAW;AAAA,YACX,SAAS;AAAA,YAER,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QACC,YACCD,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,WAAU;AAAA,YACV,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCF,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMI,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEH,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMK,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAGN;AAEJ;;"}
@@ -5,7 +5,12 @@ import { Locales } from "intlayer";
5
5
  import { WandSparkles, RotateCcw, ArrowUpFromLine, Save } from "lucide-react";
6
6
  import { useMemo, useCallback } from "react";
7
7
  import { useDictionary } from "react-intlayer";
8
- import "../../../index-DcWYZrJW.js";
8
+ import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
9
+ import "../../../hooks/useAsync/useAsyncStateStore.mjs";
10
+ import { usePushDictionaries, useAuditContentDeclaration } from "../../../hooks/intlayerAPIHooks.mjs";
11
+ import { useGetAllDictionaries } from "../../../hooks/useGetAllDictionaries.mjs";
12
+ import "../../../index-B-VAyQ9R.js";
13
+ import "@intlayer/config/client";
9
14
  import "../../Button/Button.mjs";
10
15
  import "../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs";
11
16
  import { useForm } from "../../Form/FormBase.mjs";
@@ -15,10 +20,6 @@ import "../../Auth/SignInForm/signIn.content.mjs";
15
20
  import "zod";
16
21
  import "../../Auth/SignInForm/useSignInSchema.content.mjs";
17
22
  import "../../Auth/SignUpForm/useSignUpSchema.content.mjs";
18
- import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
19
- import "../../../hooks/useAsync/useAsyncStateStore.mjs";
20
- import { usePushDictionaries, useAuditContentDeclaration } from "../../../hooks/intlayerAPIHooks.mjs";
21
- import { useGetAllDictionaries } from "../../../hooks/useGetAllDictionaries.mjs";
22
23
  import { useAuth } from "../../Auth/useAuth/index.mjs";
23
24
  import "../../Auth/ChangePasswordForm/changePasswordForm.content.mjs";
24
25
  import "../../Auth/ChangePasswordForm/useChangePasswordSchema.content.mjs";
@@ -27,6 +28,7 @@ import "../../Auth/ResetPasswordForm/useResetPasswordSchema.content.mjs";
27
28
  import "../../Modal/Modal.mjs";
28
29
  import "clsx";
29
30
  import "tailwind-merge";
31
+ import "@intlayer/api";
30
32
  import { saveDictionaryContent } from "./saveForm.content.mjs";
31
33
  import { getSaveFormSchema } from "./SaveFormSchema.mjs";
32
34
  const SaveForm = ({ dictionary }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Locales } from 'intlayer';\nimport { ArrowUpFromLine, RotateCcw, Save, WandSparkles } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useAuth } from '../../../components/Auth';\nimport {\n useAuditContentDeclaration,\n useGetAllDictionaries,\n usePushDictionaries,\n} from '../../../hooks';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { session } = useAuth();\n const project = session?.project;\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n const { isLoading: isAuditing, auditContentDeclaration } =\n useAuditContentDeclaration();\n\n const { editedContent, restoreEditedContent, setEditedContent } =\n useEditedContent();\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { auditButton, resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n onlineDictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(onlineDictionary.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = useCallback(async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n }, [dictionary, editedContent, pushDictionaries]);\n\n const handleOnAuditFile = async () =>\n await auditContentDeclaration({\n defaultLocale: project?.defaultLocale ?? Locales.ENGLISH,\n locales: project?.locales ?? [Locales.ENGLISH],\n fileContent: JSON.stringify(editedDictionary ?? dictionary),\n }).then((response) => {\n if (!response.data) return;\n\n const editedDictionary = JSON.parse(\n response.data.fileContent\n ) as Dictionary;\n\n setEditedContent(dictionary.key, editedDictionary.content);\n });\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <Form.Button\n type=\"button\"\n label={auditButton.label}\n disabled={isSubmitting}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"ml-auto max-md:w-full\"\n isLoading={isAuditing}\n onClick={handleOnAuditFile}\n >\n {auditButton.text}\n </Form.Button>\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\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 {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\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 className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["editedDictionary","jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EAAE,QAAQ,IAAI,QAAQ;AAC5B,QAAM,UAAU,SAAS;AACnB,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AACjD,QAAM,iBAAiB,kBAAkB;AACnC,QAAA,EAAE,OAAO,IAAI,sBAAsB;AACzC,QAAM,EAAE,WAAW,YAAY,wBAAA,IAC7B,2BAA2B;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SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Locales } from 'intlayer';\nimport { ArrowUpFromLine, RotateCcw, Save, WandSparkles } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n usePushDictionaries,\n useGetAllDictionaries,\n useAuditContentDeclaration,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { session } = useAuth();\n const project = session?.project;\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n const { isLoading: isAuditing, auditContentDeclaration } =\n useAuditContentDeclaration();\n\n const { editedContent, restoreEditedContent, setEditedContent } =\n useEditedContent();\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { auditButton, resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n onlineDictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(onlineDictionary.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = useCallback(async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n }, [dictionary, editedContent, pushDictionaries]);\n\n const handleOnAuditFile = async () =>\n await auditContentDeclaration({\n defaultLocale: project?.defaultLocale ?? Locales.ENGLISH,\n locales: project?.locales ?? [Locales.ENGLISH],\n fileContent: JSON.stringify(editedDictionary ?? dictionary),\n }).then((response) => {\n if (!response.data) return;\n\n const editedDictionary = JSON.parse(\n response.data.fileContent\n ) as Dictionary;\n\n setEditedContent(dictionary.key, editedDictionary.content);\n });\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <Form.Button\n type=\"button\"\n label={auditButton.label}\n disabled={isSubmitting}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"ml-auto max-md:w-full\"\n isLoading={isAuditing}\n onClick={handleOnAuditFile}\n >\n {auditButton.text}\n </Form.Button>\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\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 {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\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 className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["editedDictionary","jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EAAE,QAAQ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AAAA,YACN,OAAM;AAAA,YACN,WAAU;AAAA,YACV,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAGN;AAEJ;"}
@@ -5,10 +5,10 @@ const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
5
5
  const require$$0 = require("react");
6
6
  require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
7
7
  require("../../../hooks/useAsync/useAsyncStateStore.cjs");
8
- require("../../../index-DFc7og1d.cjs");
8
+ require("@intlayer/editor-react");
9
+ require("@intlayer/api");
9
10
  require("@intlayer/config/client");
10
11
  require("../../Toaster/Toast.cjs");
11
- require("@intlayer/dictionaries-entry");
12
12
  require("deepmerge");
13
13
  const hooks_usePersistedStore = require("../../../hooks/usePersistedStore.cjs");
14
14
  const VersionSwitcherContext = require$$0.createContext({
@@ -3,10 +3,10 @@ import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
3
3
  import { createContext, useContext } from "react";
4
4
  import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
5
5
  import "../../../hooks/useAsync/useAsyncStateStore.mjs";
6
- import "../../../index-DcWYZrJW.js";
6
+ import "@intlayer/editor-react";
7
+ import "@intlayer/api";
7
8
  import "@intlayer/config/client";
8
9
  import "../../Toaster/Toast.mjs";
9
- import "@intlayer/dictionaries-entry";
10
10
  import "deepmerge";
11
11
  import { usePersistedStore } from "../../../hooks/usePersistedStore.mjs";
12
12
  const VersionSwitcherContext = createContext({
@@ -30,6 +30,10 @@ const EditableFieldLayout = ({
30
30
  const result = !value || value === "" ? "-" : value;
31
31
  const handleClickOutside = require$$0.useCallback(
32
32
  (e) => {
33
+ const selection = window.getSelection();
34
+ if (selection && selection.toString().trim() !== "") {
35
+ return;
36
+ }
33
37
  if (editableFieldRef.current && !editableFieldRef.current.contains(e.target)) {
34
38
  setIsEditing(false);
35
39
  onSave();
@@ -70,7 +74,7 @@ const EditableFieldLayout = ({
70
74
  label: "Save",
71
75
  variant: "hoverable",
72
76
  size: "icon-sm",
73
- color: "custom",
77
+ color: "text",
74
78
  Icon: lucideReact.Check,
75
79
  onClick: handleSave,
76
80
  disabled: isDisabled,
@@ -81,7 +85,7 @@ const EditableFieldLayout = ({
81
85
  components_Button_Button.Button,
82
86
  {
83
87
  label: "Cancel",
84
- color: "custom",
88
+ color: "text",
85
89
  variant: "hoverable",
86
90
  className: "!text-current",
87
91
  size: "icon-sm",
@@ -105,7 +109,7 @@ const EditableFieldLayout = ({
105
109
  {
106
110
  label: "Edit",
107
111
  Icon: lucideReact.Pencil,
108
- color: "custom",
112
+ color: "text",
109
113
  variant: "hoverable",
110
114
  size: "icon-sm",
111
115
  className: "invisible !text-current group-hover/editable-field:visible",
@@ -1 +1 @@
1
- {"version":3,"file":"EditableFieldLayout.cjs","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n\n'use client';\n\nimport { Pencil, Check, X } from 'lucide-react';\nimport {\n type FC,\n type ReactNode,\n useState,\n useEffect,\n useRef,\n useCallback,\n HTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\n\ntype EditableFieldLayoutProps = {\n value?: string | null | undefined;\n onCancel: () => void;\n onSave: () => void;\n children: ReactNode;\n isDisabled?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\nexport const EditableFieldLayout: FC<EditableFieldLayoutProps> = ({\n value = '',\n onCancel,\n onSave,\n onClick,\n children,\n isDisabled,\n ...props\n}) => {\n const [isEditing, setIsEditing] = useState(false);\n const editableFieldRef = useRef<HTMLSpanElement>(null);\n\n const handleSave = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onSave();\n };\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onCancel();\n };\n\n const result = !value || value === '' ? '-' : value;\n\n const handleClickOutside = useCallback(\n (e: MouseEvent) => {\n if (\n editableFieldRef.current &&\n !editableFieldRef.current.contains(e.target as Node)\n ) {\n setIsEditing(false);\n onSave();\n }\n },\n [onSave]\n );\n\n useEffect(() => {\n if (isEditing) {\n document.addEventListener('click', handleClickOutside);\n } else {\n document.removeEventListener('click', handleClickOutside);\n }\n\n return () => document.removeEventListener('click', handleClickOutside);\n }, [handleClickOutside, isEditing]);\n\n return (\n <span\n className=\"group/editable-field flex gap-2\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n setIsEditing(true);\n onClick?.(e);\n }}\n ref={editableFieldRef}\n {...props}\n >\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'display' : 'hidden')}\n key={String(isEditing)}\n >\n {children}\n <Button\n label=\"Save\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"custom\"\n Icon={Check}\n onClick={handleSave}\n disabled={isDisabled}\n className=\"!text-current\"\n />\n <Button\n label=\"Cancel\"\n color=\"custom\"\n variant=\"hoverable\"\n className=\"!text-current\"\n size=\"icon-sm\"\n Icon={X}\n onClick={handleCancel}\n disabled={isDisabled}\n />\n </div>\n\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'hidden' : 'display')}\n >\n <span className=\"ml-2 whitespace-pre-wrap p-1 text-sm leading-6\">\n {result}\n </span>\n <Button\n label=\"Edit\"\n Icon={Pencil}\n color=\"custom\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n className=\"invisible !text-current group-hover/editable-field:visible\"\n disabled={isDisabled}\n onClick={(e) => {\n e.stopPropagation();\n setIsEditing(true);\n }}\n />\n </div>\n </span>\n );\n};\n"],"names":["useState","useRef","useCallback","useEffect","jsxs","cn","jsx","Button","Check","X","Pencil"],"mappings":";;;;;;;;AAyBO,MAAM,sBAAoD,CAAC;AAAA,EAChE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,M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OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,OAAM;AAAA,kBACN,MAAMC,YAAA;AAAA,kBACN,SAAS;AAAA,kBACT,UAAU;AAAA,kBACV,WAAU;AAAA,gBAAA;AAAA,cACZ;AAAA,cACAF,2BAAA,kBAAA;AAAA,gBAACC,yBAAA;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,WAAU;AAAA,kBACV,MAAK;AAAA,kBACL,MAAME,YAAA;AAAA,kBACN,SAAS;AAAA,kBACT,UAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,UAtBK,OAAO,SAAS;AAAA,QAuBvB;AAAA,QAEAL,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC,SAAAA,GAAG,qBAAqB,YAAY,WAAW,SAAS;AAAA,YAEnE,UAAA;AAAA,cAACC,2BAAA,kBAAA,IAAA,QAAA,EAAK,WAAU,kDACb,UACH,QAAA;AAAA,cACAA,2BAAA,kBAAA;AAAA,gBAACC,yBAAA;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,MAAMG,YAAA;AAAA,kBACN,OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,UAAU;AAAA,kBACV,SAAS,CAAC,MAAM;AACd,sBAAE,gBAAgB;AAClB,iCAAa,IAAI;AAAA,kBAAA;AAAA,gBACnB;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
1
+ {"version":3,"file":"EditableFieldLayout.cjs","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n\n'use client';\n\nimport { Pencil, Check, X } from 'lucide-react';\nimport {\n type FC,\n type ReactNode,\n useState,\n useEffect,\n useRef,\n useCallback,\n HTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\n\ntype EditableFieldLayoutProps = {\n value?: string | null | undefined;\n onCancel: () => void;\n onSave: () => void;\n children: ReactNode;\n isDisabled?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\nexport const EditableFieldLayout: FC<EditableFieldLayoutProps> = ({\n value = '',\n onCancel,\n onSave,\n onClick,\n children,\n isDisabled,\n ...props\n}) => {\n const [isEditing, setIsEditing] = useState(false);\n const editableFieldRef = useRef<HTMLSpanElement>(null);\n\n const handleSave = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onSave();\n };\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onCancel();\n };\n\n const result = !value || value === '' ? '-' : value;\n\n const handleClickOutside = useCallback(\n (e: MouseEvent) => {\n // Check if there's any text selected\n const selection = window.getSelection();\n if (selection && selection.toString().trim() !== '') {\n // If there is a selection, do not trigger the save and exit early.\n return;\n }\n\n // Proceed if the click is truly outside the component.\n if (\n editableFieldRef.current &&\n !editableFieldRef.current.contains(e.target as Node)\n ) {\n setIsEditing(false);\n onSave();\n }\n },\n [onSave]\n );\n\n useEffect(() => {\n if (isEditing) {\n document.addEventListener('click', handleClickOutside);\n } else {\n document.removeEventListener('click', handleClickOutside);\n }\n\n return () => document.removeEventListener('click', handleClickOutside);\n }, [handleClickOutside, isEditing]);\n\n return (\n <span\n className=\"group/editable-field flex gap-2\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n setIsEditing(true);\n onClick?.(e);\n }}\n ref={editableFieldRef}\n {...props}\n >\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'display' : 'hidden')}\n key={String(isEditing)}\n >\n {children}\n <Button\n label=\"Save\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n Icon={Check}\n onClick={handleSave}\n disabled={isDisabled}\n className=\"!text-current\"\n />\n <Button\n label=\"Cancel\"\n color=\"text\"\n variant=\"hoverable\"\n className=\"!text-current\"\n size=\"icon-sm\"\n Icon={X}\n onClick={handleCancel}\n disabled={isDisabled}\n />\n </div>\n\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'hidden' : 'display')}\n >\n <span className=\"ml-2 whitespace-pre-wrap p-1 text-sm leading-6\">\n {result}\n </span>\n <Button\n label=\"Edit\"\n Icon={Pencil}\n color=\"text\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n className=\"invisible !text-current group-hover/editable-field:visible\"\n disabled={isDisabled}\n onClick={(e) => {\n e.stopPropagation();\n setIsEditing(true);\n }}\n />\n </div>\n </span>\n );\n};\n"],"names":["useState","useRef","useCallback","useEffect","jsxs","cn","jsx","Button","Check","X","Pencil"],"mappings":";;;;;;;;AAyBO,MAAM,sBAAoD,CAAC;AAAA,EAChE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,WAAW,YAAY,IAAIA,WAAAA,SAAS,KAAK;AAC1C,QAAA,mBAAmBC,kBAAwB,IAAI;AAE/C,QAAA,aAAa,CAAC,MAA2C;AAC7D,MAAE,gBAAgB;AAClB,iBAAa,KAAK;AACX,WAAA;AAAA,EACT;AAEM,QAAA,eAAe,CAAC,MAA2C;AAC/D,MAAE,gBAAgB;AAClB,iBAAa,KAAK;AACT,aAAA;AAAA,EACX;AAEA,QAAM,SAAS,CAAC,SAAS,UAAU,KAAK,MAAM;AAE9C,QAAM,qBAAqBC,WAAA;AAAA,IACzB,CAAC,MAAkB;AAEX,YAAA,YAAY,OAAO,aAAa;AACtC,UAAI,aAAa,UAAU,SAAW,EAAA,KAAA,MAAW,IAAI;AAEnD;AAAA,MAAA;AAKA,UAAA,iBAAiB,WACjB,CAAC,iBAAiB,QAAQ,SAAS,EAAE,MAAc,GACnD;AACA,qBAAa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QAEAL,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC,SAAAA,GAAG,qBAAqB,YAAY,WAAW,SAAS;AAAA,YAEnE,UAAA;AAAA,cAACC,2BAAA,kBAAA,IAAA,QAAA,EAAK,WAAU,kDACb,UACH,QAAA;AAAA,cACAA,2BAAA,kBAAA;AAAA,gBAACC,yBAAA;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,MAAMG,YAAA;AAAA,kBACN,OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,UAAU;AAAA,kBACV,SAAS,CAAC,MAAM;AACd,sBAAE,gBAAgB;AAClB,iCAAa,IAAI;AAAA,kBAAA;AAAA,gBACnB;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditableFieldLayout.d.ts","sourceRoot":"","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,SAAS,EAKd,cAAc,EACf,MAAM,OAAO,CAAC;AAIf,KAAK,wBAAwB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEpC,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CA8G5D,CAAC"}
1
+ {"version":3,"file":"EditableFieldLayout.d.ts","sourceRoot":"","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,SAAS,EAKd,cAAc,EACf,MAAM,OAAO,CAAC;AAIf,KAAK,wBAAwB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEpC,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAsH5D,CAAC"}
@@ -28,6 +28,10 @@ const EditableFieldLayout = ({
28
28
  const result = !value || value === "" ? "-" : value;
29
29
  const handleClickOutside = useCallback(
30
30
  (e) => {
31
+ const selection = window.getSelection();
32
+ if (selection && selection.toString().trim() !== "") {
33
+ return;
34
+ }
31
35
  if (editableFieldRef.current && !editableFieldRef.current.contains(e.target)) {
32
36
  setIsEditing(false);
33
37
  onSave();
@@ -68,7 +72,7 @@ const EditableFieldLayout = ({
68
72
  label: "Save",
69
73
  variant: "hoverable",
70
74
  size: "icon-sm",
71
- color: "custom",
75
+ color: "text",
72
76
  Icon: Check,
73
77
  onClick: handleSave,
74
78
  disabled: isDisabled,
@@ -79,7 +83,7 @@ const EditableFieldLayout = ({
79
83
  Button,
80
84
  {
81
85
  label: "Cancel",
82
- color: "custom",
86
+ color: "text",
83
87
  variant: "hoverable",
84
88
  className: "!text-current",
85
89
  size: "icon-sm",
@@ -103,7 +107,7 @@ const EditableFieldLayout = ({
103
107
  {
104
108
  label: "Edit",
105
109
  Icon: Pencil,
106
- color: "custom",
110
+ color: "text",
107
111
  variant: "hoverable",
108
112
  size: "icon-sm",
109
113
  className: "invisible !text-current group-hover/editable-field:visible",
@@ -1 +1 @@
1
- {"version":3,"file":"EditableFieldLayout.mjs","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n\n'use client';\n\nimport { Pencil, Check, X } from 'lucide-react';\nimport {\n type FC,\n type ReactNode,\n useState,\n useEffect,\n useRef,\n useCallback,\n HTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\n\ntype EditableFieldLayoutProps = {\n value?: string | null | undefined;\n onCancel: () => void;\n onSave: () => void;\n children: ReactNode;\n isDisabled?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\nexport const EditableFieldLayout: FC<EditableFieldLayoutProps> = ({\n value = '',\n onCancel,\n onSave,\n onClick,\n children,\n isDisabled,\n ...props\n}) => {\n const [isEditing, setIsEditing] = useState(false);\n const editableFieldRef = useRef<HTMLSpanElement>(null);\n\n const handleSave = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onSave();\n };\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onCancel();\n };\n\n const result = !value || value === '' ? '-' : value;\n\n const handleClickOutside = useCallback(\n (e: MouseEvent) => {\n if (\n editableFieldRef.current &&\n !editableFieldRef.current.contains(e.target as Node)\n ) {\n setIsEditing(false);\n onSave();\n }\n },\n [onSave]\n );\n\n useEffect(() => {\n if (isEditing) {\n document.addEventListener('click', handleClickOutside);\n } else {\n document.removeEventListener('click', handleClickOutside);\n }\n\n return () => document.removeEventListener('click', handleClickOutside);\n }, [handleClickOutside, isEditing]);\n\n return (\n <span\n className=\"group/editable-field flex gap-2\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n setIsEditing(true);\n onClick?.(e);\n }}\n ref={editableFieldRef}\n {...props}\n >\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'display' : 'hidden')}\n key={String(isEditing)}\n >\n {children}\n <Button\n label=\"Save\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"custom\"\n Icon={Check}\n onClick={handleSave}\n disabled={isDisabled}\n className=\"!text-current\"\n />\n <Button\n label=\"Cancel\"\n color=\"custom\"\n variant=\"hoverable\"\n className=\"!text-current\"\n size=\"icon-sm\"\n Icon={X}\n onClick={handleCancel}\n disabled={isDisabled}\n />\n </div>\n\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'hidden' : 'display')}\n >\n <span className=\"ml-2 whitespace-pre-wrap p-1 text-sm leading-6\">\n {result}\n </span>\n <Button\n label=\"Edit\"\n Icon={Pencil}\n color=\"custom\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n className=\"invisible !text-current group-hover/editable-field:visible\"\n disabled={isDisabled}\n onClick={(e) => {\n e.stopPropagation();\n setIsEditing(true);\n }}\n />\n </div>\n </span>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;AAyBO,MAAM,sBAAoD,CAAC;AAAA,EAChE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAC1C,QAAA,mBAAmB,OAAwB,IAAI;AAE/C,QAAA,aAAa,CAAC,MAA2C;AAC7D,MAAE,gBAAgB;AAClB,iBAAa,KAAK;AACX,WAAA;AAAA,EACT;AAEM,QAAA,eAAe,CAAC,MAA2C;AAC/D,MAAE,gBAAgB;AAClB,iBAAa,KAAK;AACT,aAAA;AAAA,EACX;AAEA,QAAM,SAAS,CAAC,SAAS,UAAU,KAAK,MAAM;AAE9C,QAAM,qBAAqB;AAAA,IACzB,CAAC,MAAkB;AAEf,UAAA,iBAAiB,WACjB,CAAC,iBAAiB,QAAQ,SAAS,EAAE,MAAc,GACnD;AACA,qBAAa,KAAK;AACX,eAAA;AAAA,MAAA;AAAA,IAEX;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AAEA,YAAU,MAAM;AACd,QAAI,WAAW;AACJ,eAAA,iBAAiB,SAAS,kBAAkB;AAAA,IAAA,OAChD;AACI,eAAA,oBAAoB,SAAS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OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,UAAU;AAAA,kBACV,SAAS,CAAC,MAAM;AACd,sBAAE,gBAAgB;AAClB,iCAAa,IAAI;AAAA,kBAAA;AAAA,gBACnB;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"EditableFieldLayout.mjs","sources":["../../../src/components/EditableField/EditableFieldLayout.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n\n'use client';\n\nimport { Pencil, Check, X } from 'lucide-react';\nimport {\n type FC,\n type ReactNode,\n useState,\n useEffect,\n useRef,\n useCallback,\n HTMLAttributes,\n} from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\n\ntype EditableFieldLayoutProps = {\n value?: string | null | undefined;\n onCancel: () => void;\n onSave: () => void;\n children: ReactNode;\n isDisabled?: boolean;\n} & HTMLAttributes<HTMLSpanElement>;\n\nexport const EditableFieldLayout: FC<EditableFieldLayoutProps> = ({\n value = '',\n onCancel,\n onSave,\n onClick,\n children,\n isDisabled,\n ...props\n}) => {\n const [isEditing, setIsEditing] = useState(false);\n const editableFieldRef = useRef<HTMLSpanElement>(null);\n\n const handleSave = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onSave();\n };\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setIsEditing(false);\n onCancel();\n };\n\n const result = !value || value === '' ? '-' : value;\n\n const handleClickOutside = useCallback(\n (e: MouseEvent) => {\n // Check if there's any text selected\n const selection = window.getSelection();\n if (selection && selection.toString().trim() !== '') {\n // If there is a selection, do not trigger the save and exit early.\n return;\n }\n\n // Proceed if the click is truly outside the component.\n if (\n editableFieldRef.current &&\n !editableFieldRef.current.contains(e.target as Node)\n ) {\n setIsEditing(false);\n onSave();\n }\n },\n [onSave]\n );\n\n useEffect(() => {\n if (isEditing) {\n document.addEventListener('click', handleClickOutside);\n } else {\n document.removeEventListener('click', handleClickOutside);\n }\n\n return () => document.removeEventListener('click', handleClickOutside);\n }, [handleClickOutside, isEditing]);\n\n return (\n <span\n className=\"group/editable-field flex gap-2\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n setIsEditing(true);\n onClick?.(e);\n }}\n ref={editableFieldRef}\n {...props}\n >\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'display' : 'hidden')}\n key={String(isEditing)}\n >\n {children}\n <Button\n label=\"Save\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n Icon={Check}\n onClick={handleSave}\n disabled={isDisabled}\n className=\"!text-current\"\n />\n <Button\n label=\"Cancel\"\n color=\"text\"\n variant=\"hoverable\"\n className=\"!text-current\"\n size=\"icon-sm\"\n Icon={X}\n onClick={handleCancel}\n disabled={isDisabled}\n />\n </div>\n\n <div\n className={cn('flex flex-1 gap-2', isEditing ? 'hidden' : 'display')}\n >\n <span className=\"ml-2 whitespace-pre-wrap p-1 text-sm leading-6\">\n {result}\n </span>\n <Button\n label=\"Edit\"\n Icon={Pencil}\n color=\"text\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n className=\"invisible !text-current group-hover/editable-field:visible\"\n disabled={isDisabled}\n onClick={(e) => {\n e.stopPropagation();\n setIsEditing(true);\n }}\n />\n </div>\n </span>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;AAyBO,MAAM,sBAAoD,CAAC;AAAA,EAChE,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAC1C,QAAA,mBAAmB,OAAwB,IAAI;AAE/C,QAAA,aAAa,CAAC,MAA2C;AAC7D,MAAE,gBAAgB;AAClB,iBAAa,KAAK;AACX,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,WAAU;AAAA,gBAAA;AAAA,cACZ;AAAA,cACAA,kCAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,WAAU;AAAA,kBACV,MAAK;AAAA,kBACL,MAAM;AAAA,kBACN,SAAS;AAAA,kBACT,UAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,UAtBK,OAAO,SAAS;AAAA,QAuBvB;AAAA,QAEAD,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,GAAG,qBAAqB,YAAY,WAAW,SAAS;AAAA,YAEnE,UAAA;AAAA,cAACC,kCAAA,IAAA,QAAA,EAAK,WAAU,kDACb,UACH,QAAA;AAAA,cACAA,kCAAA;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,MAAM;AAAA,kBACN,OAAM;AAAA,kBACN,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,UAAU;AAAA,kBACV,SAAS,CAAC,MAAM;AACd,sBAAE,gBAAgB;AAClB,iCAAa,IAAI;AAAA,kBAAA;AAAA,gBACnB;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -5,10 +5,10 @@ const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
5
5
  const require$$0 = require("react");
6
6
  require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
7
7
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
8
- require("../../index-DFc7og1d.cjs");
8
+ require("@intlayer/editor-react");
9
+ require("@intlayer/api");
9
10
  require("@intlayer/config/client");
10
11
  require("../Toaster/Toast.cjs");
11
- require("@intlayer/dictionaries-entry");
12
12
  require("deepmerge");
13
13
  const hooks_usePersistedStore = require("../../hooks/usePersistedStore.cjs");
14
14
  const CodeContext = require$$0.createContext({
@@ -3,10 +3,10 @@ import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
3
3
  import { createContext, useContext } from "react";
4
4
  import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
5
5
  import "../../hooks/useAsync/useAsyncStateStore.mjs";
6
- import "../../index-DcWYZrJW.js";
6
+ import "@intlayer/editor-react";
7
+ import "@intlayer/api";
7
8
  import "@intlayer/config/client";
8
9
  import "../Toaster/Toast.mjs";
9
- import "@intlayer/dictionaries-entry";
10
10
  import "deepmerge";
11
11
  import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
12
12
  const CodeContext = createContext({
@@ -10,9 +10,9 @@ const require$$0 = require("react");
10
10
  const reactIntlayer = require("react-intlayer");
11
11
  require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
12
12
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
13
- require("../../index-DFc7og1d.cjs");
13
+ require("@intlayer/editor-react");
14
+ require("@intlayer/api");
14
15
  require("../Toaster/Toast.cjs");
15
- require("@intlayer/dictionaries-entry");
16
16
  require("deepmerge");
17
17
  const hooks_usePersistedStore = require("../../hooks/usePersistedStore.cjs");
18
18
  const components_Button_Button = require("../Button/Button.cjs");
@@ -8,9 +8,9 @@ import { useRef, useMemo, useState, useCallback } from "react";
8
8
  import { useDictionary, useLocale } from "react-intlayer";
9
9
  import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
10
10
  import "../../hooks/useAsync/useAsyncStateStore.mjs";
11
- import "../../index-DcWYZrJW.js";
11
+ import "@intlayer/editor-react";
12
+ import "@intlayer/api";
12
13
  import "../Toaster/Toast.mjs";
13
- import "@intlayer/dictionaries-entry";
14
14
  import "deepmerge";
15
15
  import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
16
16
  import { Button } from "../Button/Button.mjs";
@@ -6,10 +6,10 @@ const require$$0 = require("react");
6
6
  const reactIntlayer = require("react-intlayer");
7
7
  require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
8
8
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
9
- require("../../index-DFc7og1d.cjs");
9
+ require("@intlayer/editor-react");
10
+ require("@intlayer/api");
10
11
  require("@intlayer/config/client");
11
12
  require("../Toaster/Toast.cjs");
12
- require("@intlayer/dictionaries-entry");
13
13
  require("deepmerge");
14
14
  const hooks_usePersistedStore = require("../../hooks/usePersistedStore.cjs");
15
15
  const LocaleSwitcherContentContext = require$$0.createContext({
@@ -4,10 +4,10 @@ import { createContext, useContext } from "react";
4
4
  import { useLocale } from "react-intlayer";
5
5
  import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
6
6
  import "../../hooks/useAsync/useAsyncStateStore.mjs";
7
- import "../../index-DcWYZrJW.js";
7
+ import "@intlayer/editor-react";
8
+ import "@intlayer/api";
8
9
  import "@intlayer/config/client";
9
10
  import "../Toaster/Toast.mjs";
10
- import "@intlayer/dictionaries-entry";
11
11
  import "deepmerge";
12
12
  import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
13
13
  const LocaleSwitcherContentContext = createContext({
@@ -10,12 +10,13 @@ require("react");
10
10
  const hooks_useGetElementOrWindow = require("../../hooks/useGetElementOrWindow.cjs");
11
11
  const hooks_useScrollBlockage_index = require("../../index-Cg-S9ry9.cjs");
12
12
  require("../../hooks/useAsync/useAsyncStateStore.cjs");
13
- require("../../index-DFc7og1d.cjs");
13
+ require("@intlayer/editor-react");
14
+ require("@intlayer/api");
14
15
  require("@intlayer/config/client");
15
16
  require("../Toaster/Toast.cjs");
16
- require("@intlayer/dictionaries-entry");
17
17
  require("deepmerge");
18
18
  const utils_cn = require("../../utils/cn.cjs");
19
+ const components_Button_Button = require("../Button/Button.cjs");
19
20
  const components_Container_index = require("../Container/index.cjs");
20
21
  const components_Headers_index = require("../Headers/index.cjs");
21
22
  const modalVariants = classVarianceAuthority.cva(
@@ -99,15 +100,18 @@ const Modal = ({
99
100
  children: [
100
101
  hasTitle && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(components_Headers_index.H3, { className: "flex items-center justify-center text-lg font-bold", children: title }),
101
102
  hasCloseButton && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
102
- lucideReact.X,
103
+ components_Button_Button.Button,
103
104
  {
104
- role: "button",
105
- "aria-label": "Close modal",
106
- className: "right-2 top-2 ml-auto cursor-pointer",
105
+ variant: "hoverable",
106
+ color: "text",
107
+ label: "Close modal",
108
+ className: "ml-auto",
107
109
  onClick: (e) => {
108
110
  e.stopPropagation();
109
111
  onClose?.();
110
- }
112
+ },
113
+ Icon: lucideReact.X,
114
+ size: "icon-md"
111
115
  }
112
116
  )
113
117
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.cjs","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport type { FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\ntype ModalProps = {\n children: React.ReactNode;\n isOpen: boolean;\n onClose?: () => void;\n container?: HTMLElement;\n disableScroll?: boolean;\n hasCloseButton?: boolean;\n title?: string;\n size?: Size;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\nconst modalVariants = cva(\n 'cursor-default overflow-auto p-3 shadow justify-center',\n {\n variants: {\n variant: {\n sm: 'max-h-[30vh] w-[95vw] max-w-xl',\n md: 'max-h-[50vh] w-[95vw] max-w-xl',\n lg: 'max-h-[70vh] w-[95vw] max-w-2xl',\n xl: 'max-h-[95vh] w-[95vw] max-w-3xl',\n unset: 'max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n variant: 'unset',\n },\n }\n);\n\ntype Size = 'sm' | 'md' | 'lg' | 'xl' | 'unset';\n\nconst MotionModal = m.create(Container);\n\n/**\n * Usage example:\n * ```jsx\n * <Modal isOpen={isOpen} onClose={onClose}>\n * Modal content\n * </Modal>\n * ```\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = false,\n onClose,\n hasCloseButton = false,\n title,\n size = 'md',\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 dark:bg-background-dark/40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n variant: size,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <X\n role=\"button\"\n aria-label=\"Close modal\"\n className=\"right-2 top-2 ml-auto cursor-pointer\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </m.div>,\n containerElement\n );\n};\n"],"names":["cva","m","Container","useGetElementOrWindow","useScrollBlockage","jsx","Fragment","createPortal","jsxs","cn","H3","X"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,gBAAgBA,uBAAA;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAIA,MAAM,cAAcC,aAAAA,EAAE,OAAOC,oCAAS;AAU/B,MAAM,QAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,MAAM;AACE,QAAA,mBAAmBC,kDAAsB,SAAS;AAExDC,gCAAA,kBAAkB,EAAE,KAAK,SAAS,eAAe,UAAU,eAAe;AAEtE,MAAA,CAAC,iBAAkB,QAASC,iDAAAC,WAAAA,kBAAAA,UAAA,CAAA,CAAA;AAE1B,QAAA,WAAW,OAAO,UAAU;AAE3B,SAAAC,SAAA;AAAA,IACLF,2BAAA,kBAAA;AAAA,MAACJ,aAAAA,EAAE;AAAA,MAAF;AAAA,QACC,WAAU;AAAA,QACV,SAAS,SAAS,YAAY;AAAA,QAC9B,UAAU;AAAA,UACR,SAAS;AAAA,YACP,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,YAAY,EAAE,UAAU,KAAK,MAAM,iBAAiB;AAAA,UACtD;AAAA,UACA,WAAW;AAAA,YACT,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,YAAY,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js","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["'use client';\n\nimport { cva } from 'class-variance-authority';\nimport { m } from 'framer-motion';\nimport { X } from 'lucide-react';\nimport type { FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useGetElementOrWindow, useScrollBlockage } from '../../hooks/index';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport { Container, type ContainerProps } from '../Container';\nimport { H3 } from '../Headers';\n\ntype ModalProps = {\n children: React.ReactNode;\n isOpen: boolean;\n onClose?: () => void;\n container?: HTMLElement;\n disableScroll?: boolean;\n hasCloseButton?: boolean;\n title?: string;\n size?: Size;\n} & Pick<\n ContainerProps,\n | 'className'\n | 'transparency'\n | 'border'\n | 'background'\n | 'roundedSize'\n | 'borderColor'\n | 'padding'\n | 'separator'\n | 'gap'\n>;\n\nconst modalVariants = cva(\n 'cursor-default overflow-auto p-3 shadow justify-center',\n {\n variants: {\n variant: {\n sm: 'max-h-[30vh] w-[95vw] max-w-xl',\n md: 'max-h-[50vh] w-[95vw] max-w-xl',\n lg: 'max-h-[70vh] w-[95vw] max-w-2xl',\n xl: 'max-h-[95vh] w-[95vw] max-w-3xl',\n unset: 'max-h-[95vh] w-[95vw]',\n },\n },\n defaultVariants: {\n variant: 'unset',\n },\n }\n);\n\ntype Size = 'sm' | 'md' | 'lg' | 'xl' | 'unset';\n\nconst MotionModal = m.create(Container);\n\n/**\n * Usage example:\n * ```jsx\n * <Modal isOpen={isOpen} onClose={onClose}>\n * Modal content\n * </Modal>\n * ```\n */\nexport const Modal: FC<ModalProps> = ({\n children,\n isOpen,\n container,\n disableScroll = false,\n onClose,\n hasCloseButton = false,\n title,\n size = 'md',\n ...props\n}) => {\n const containerElement = useGetElementOrWindow(container);\n\n useScrollBlockage({ key: 'modal', disableScroll: isOpen && disableScroll });\n\n if (!containerElement) return <></>;\n\n const hasTitle = typeof title === 'string';\n\n return createPortal(\n <m.div\n className=\"bg-background/40 dark:bg-background-dark/40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur\"\n animate={isOpen ? 'visible' : 'invisible'}\n variants={{\n visible: {\n opacity: 1,\n visibility: 'visible',\n transition: { duration: 0.1, when: 'beforeChildren' },\n },\n invisible: {\n opacity: 0,\n visibility: 'hidden',\n transition: { duration: 0.1, when: 'afterChildren' },\n },\n }}\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n aria-hidden={!isOpen}\n >\n <MotionModal\n onClick={(e) => e.stopPropagation()}\n initial={{ scale: isOpen ? 0.5 : 1 }}\n animate={{ scale: isOpen ? 1 : 0.5 }}\n transition={{ duration: 0.3 }}\n className={modalVariants({\n variant: size,\n })}\n role=\"dialog\"\n aria-modal\n roundedSize=\"2xl\"\n {...props}\n >\n <div\n className={cn(\n 'cursor-default',\n hasCloseButton && hasTitle\n ? `flex items-center justify-center`\n : hasCloseButton\n ? `flex items-center justify-end`\n : hasTitle\n ? `items-center`\n : `hidden`\n )}\n >\n {hasTitle && (\n <H3 className=\"flex items-center justify-center text-lg font-bold\">\n {title}\n </H3>\n )}\n {hasCloseButton && (\n <Button\n variant=\"hoverable\"\n color=\"text\"\n label=\"Close modal\"\n className=\"ml-auto\"\n onClick={(e) => {\n e.stopPropagation();\n onClose?.();\n }}\n Icon={X}\n size=\"icon-md\"\n />\n )}\n </div>\n <div className=\"flex flex-1 flex-col items-center overflow-auto\">\n {children}\n </div>\n </MotionModal>\n </m.div>,\n containerElement\n );\n};\n"],"names":["cva","m","Container","useGetElementOrWindow","useScrollBlockage","jsx","Fragment","createPortal","jsxs","cn","H3","Button","X"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,gBAAgBA,uBAAA;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IAEX;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