@intlayer/design-system 5.8.0-canary.0 → 5.8.1

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 (168) hide show
  1. package/dist/.vite/manifest.json +45 -37
  2. package/dist/components/Breadcrumb/index.cjs +2 -3
  3. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  4. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  5. package/dist/components/Breadcrumb/index.mjs +3 -4
  6. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  7. package/dist/components/CopyButton/CopyButton.content.cjs.map +1 -0
  8. package/dist/components/CopyButton/CopyButton.content.d.ts.map +1 -0
  9. package/dist/components/CopyButton/CopyButton.content.mjs.map +1 -0
  10. package/dist/components/CopyButton/index.cjs +1 -2
  11. package/dist/components/CopyButton/index.cjs.map +1 -1
  12. package/dist/components/CopyButton/index.d.ts.map +1 -1
  13. package/dist/components/CopyButton/index.mjs +2 -3
  14. package/dist/components/CopyButton/index.mjs.map +1 -1
  15. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +3 -7
  16. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
  17. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
  18. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +4 -8
  19. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
  20. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -4
  21. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  22. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  23. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +2 -5
  24. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  25. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -2
  26. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs.map +1 -1
  27. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
  28. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +2 -3
  29. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
  30. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -2
  31. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  33. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +2 -3
  34. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  35. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +2 -24
  36. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  37. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -2
  38. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
  39. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
  40. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +2 -3
  41. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
  42. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +1 -5
  43. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  44. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  45. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -6
  46. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  47. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +1 -2
  48. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  49. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  50. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -3
  51. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +1 -2
  53. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  54. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  55. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -3
  56. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +1 -2
  58. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  60. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -3
  61. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  62. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +2 -24
  63. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  64. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -3
  65. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
  66. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +3 -4
  68. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs +1 -1
  70. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs +1 -1
  72. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +1 -4
  74. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts.map +1 -1
  76. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +2 -5
  77. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
  78. package/dist/components/ExpandCollapse/ExpandCollapse.cjs +56 -0
  79. package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -0
  80. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +9 -0
  81. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -0
  82. package/dist/components/ExpandCollapse/ExpandCollapse.mjs +56 -0
  83. package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -0
  84. package/dist/components/ExpandCollapse/expandCollapse.content.cjs +41 -0
  85. package/dist/components/ExpandCollapse/expandCollapse.content.cjs.map +1 -0
  86. package/dist/components/ExpandCollapse/expandCollapse.content.d.ts +40 -0
  87. package/dist/components/ExpandCollapse/expandCollapse.content.d.ts.map +1 -0
  88. package/dist/components/ExpandCollapse/expandCollapse.content.mjs +42 -0
  89. package/dist/components/ExpandCollapse/expandCollapse.content.mjs.map +1 -0
  90. package/dist/components/ExpandCollapse/index.cjs +5 -0
  91. package/dist/components/ExpandCollapse/index.cjs.map +1 -0
  92. package/dist/components/ExpandCollapse/index.d.ts +2 -0
  93. package/dist/components/ExpandCollapse/index.d.ts.map +1 -0
  94. package/dist/components/ExpandCollapse/index.mjs +5 -0
  95. package/dist/components/ExpandCollapse/index.mjs.map +1 -0
  96. package/dist/components/IDE/Code.cjs +12 -1
  97. package/dist/components/IDE/Code.cjs.map +1 -1
  98. package/dist/components/IDE/Code.d.ts +1 -0
  99. package/dist/components/IDE/Code.d.ts.map +1 -1
  100. package/dist/components/IDE/Code.mjs +12 -1
  101. package/dist/components/IDE/Code.mjs.map +1 -1
  102. package/dist/components/IDE/CopyCode.cjs +1 -2
  103. package/dist/components/IDE/CopyCode.cjs.map +1 -1
  104. package/dist/components/IDE/CopyCode.d.ts.map +1 -1
  105. package/dist/components/IDE/CopyCode.mjs +2 -3
  106. package/dist/components/IDE/CopyCode.mjs.map +1 -1
  107. package/dist/components/Loader/index.content.d.ts +2 -24
  108. package/dist/components/Loader/index.content.d.ts.map +1 -1
  109. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -2
  110. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
  111. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts.map +1 -1
  112. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -3
  113. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
  114. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +1 -2
  115. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
  116. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
  117. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +2 -3
  118. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
  119. package/dist/components/MarkDownRender/index.cjs +7 -0
  120. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  121. package/dist/components/MarkDownRender/index.d.ts.map +1 -1
  122. package/dist/components/MarkDownRender/index.mjs +7 -0
  123. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  124. package/dist/components/Modal/Modal.cjs +1 -1
  125. package/dist/components/Modal/Modal.cjs.map +1 -1
  126. package/dist/components/Modal/Modal.mjs +1 -1
  127. package/dist/components/Modal/Modal.mjs.map +1 -1
  128. package/dist/components/Navbar/DesktopNavbar.cjs +1 -1
  129. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  130. package/dist/components/Navbar/DesktopNavbar.mjs +1 -1
  131. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  132. package/dist/components/Navbar/index.cjs +1 -1
  133. package/dist/components/Navbar/index.cjs.map +1 -1
  134. package/dist/components/Navbar/index.mjs +1 -1
  135. package/dist/components/Navbar/index.mjs.map +1 -1
  136. package/dist/components/Popover/index.cjs.map +1 -1
  137. package/dist/components/Popover/index.d.ts +2 -2
  138. package/dist/components/Popover/index.d.ts.map +1 -1
  139. package/dist/components/Popover/index.mjs.map +1 -1
  140. package/dist/components/SocialNetworks/index.cjs +1 -1
  141. package/dist/components/SocialNetworks/index.cjs.map +1 -1
  142. package/dist/components/SocialNetworks/index.mjs +1 -1
  143. package/dist/components/SocialNetworks/index.mjs.map +1 -1
  144. package/dist/components/Table/Table.cjs +4 -50
  145. package/dist/components/Table/Table.cjs.map +1 -1
  146. package/dist/components/Table/Table.d.ts +3 -1
  147. package/dist/components/Table/Table.d.ts.map +1 -1
  148. package/dist/components/Table/Table.mjs +5 -51
  149. package/dist/components/Table/Table.mjs.map +1 -1
  150. package/dist/components/Table/table.content.cjs +0 -30
  151. package/dist/components/Table/table.content.cjs.map +1 -1
  152. package/dist/components/Table/table.content.d.ts +0 -66
  153. package/dist/components/Table/table.content.d.ts.map +1 -1
  154. package/dist/components/Table/table.content.mjs +0 -30
  155. package/dist/components/Table/table.content.mjs.map +1 -1
  156. package/dist/components/index.cjs +2 -0
  157. package/dist/components/index.cjs.map +1 -1
  158. package/dist/components/index.d.ts +1 -0
  159. package/dist/components/index.d.ts.map +1 -1
  160. package/dist/components/index.mjs +2 -0
  161. package/dist/components/index.mjs.map +1 -1
  162. package/package.json +19 -18
  163. package/dist/components/IDE/CopyButton.content.cjs.map +0 -1
  164. package/dist/components/IDE/CopyButton.content.d.ts.map +0 -1
  165. package/dist/components/IDE/CopyButton.content.mjs.map +0 -1
  166. /package/dist/components/{IDE → CopyButton}/CopyButton.content.cjs +0 -0
  167. /package/dist/components/{IDE → CopyButton}/CopyButton.content.d.ts +0 -0
  168. /package/dist/components/{IDE → CopyButton}/CopyButton.content.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryFormSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.ts"],"sourcesContent":["import { useDictionary } from 'react-intlayer';\nimport { z } from 'zod/v4';\nimport { dictionaryFormSchemaContent } from './useDictionaryFormSchema.content';\n\nexport const useDictionarySchema = (projectId: string) => {\n const {\n requiredErrorName,\n invalidTypeErrorName,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n } = useDictionary(dictionaryFormSchemaContent);\n\n return z.object({\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorName.value\n : invalidTypeErrorName.value,\n })\n .min(1, { error: invalidTypeErrorName.value })\n .default(''),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n });\n};\n\nexport type DictionaryFormData = z.infer<\n ReturnType<typeof useDictionarySchema>\n>;\n"],"names":["z.object","z.string","z.array"],"mappings":";;;AAIO,MAAM,sBAAsB,CAAC,cAAsB;AACxD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,2BAA2B;AAE7C,SAAOA,OAAS;AAAA,IACd,KAAKC,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,kBAAkB,QAClB,qBAAqB;AAAA,IAAA,CAC5B,EACA,IAAI,GAAG,EAAE,OAAO,qBAAqB,MAAA,CAAO,EAC5C,QAAQ,EAAE;AAAA,IACb,YAAYC;AAAAA,MAERD,OAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,EAAA,CACvB;AACH;"}
1
+ {"version":3,"file":"useDictionaryFormSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.ts"],"sourcesContent":["import { useIntlayer } from 'react-intlayer';\nimport { z } from 'zod/v4';\n\nexport const useDictionarySchema = (projectId: string) => {\n const {\n requiredErrorName,\n invalidTypeErrorName,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n } = useIntlayer('dictionary-form-schema');\n\n return z.object({\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorName.value\n : invalidTypeErrorName.value,\n })\n .min(1, { error: invalidTypeErrorName.value })\n .default(''),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n });\n};\n\nexport type DictionaryFormData = z.infer<\n ReturnType<typeof useDictionarySchema>\n>;\n"],"names":["z.object","z.string","z.array"],"mappings":";;AAGO,MAAM,sBAAsB,CAAC,cAAsB;AACxD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,YAAY,wBAAwB;AAExC,SAAOA,OAAS;AAAA,IACd,KAAKC,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,kBAAkB,QAClB,qBAAqB;AAAA,IAAA,CAC5B,EACA,IAAI,GAAG,EAAE,OAAO,qBAAqB,MAAA,CAAO,EAC5C,QAAQ,EAAE;AAAA,IACb,YAAYC;AAAAA,MAERD,OAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,EAAA,CACvB;AACH;"}
@@ -22,7 +22,6 @@ const components_Form_layout_FormItemLayout = require("../../../Form-DJrUK3mm.cj
22
22
  const components_Loader_index = require("../../Loader/index.cjs");
23
23
  const components_Select_Multiselect = require("../../Select/Multiselect.cjs");
24
24
  require("../../Select/Select.cjs");
25
- const components_DictionaryFieldEditor_DictionaryDetails_dictionaryDetails_content = require("./dictionaryDetails.content.cjs");
26
25
  const components_DictionaryFieldEditor_DictionaryDetails_useDictionaryDetailsSchema = require("./useDictionaryDetailsSchema.cjs");
27
26
  const DictionaryDetailsForm = ({
28
27
  dictionary
@@ -45,7 +44,7 @@ const DictionaryDetailsForm = ({
45
44
  projectInput,
46
45
  tagsSelect,
47
46
  auditButton
48
- } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_DictionaryDetails_dictionaryDetails_content.dictionaryDetailsContent);
47
+ } = reactIntlayer.useIntlayer("dictionary-details");
49
48
  const { auditContentDeclaration, isLoading: isAuditing } = hooks_intlayerAPIHooks.useAuditContentDeclarationMetadata();
50
49
  const updatedDictionary = editedContent?.[dictionary.key];
51
50
  ReactExports.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryDetailsForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n} from '../../../hooks';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Container } from '../../Container';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryDetailsContent } from './dictionaryDetails.content';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags } = useGetTags();\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionary,\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n\n projectInput,\n tagsSelect,\n auditButton,\n } = useDictionary(dictionaryDetailsContent);\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary = editedContent?.[dictionary.key];\n\n useEffect(() => {\n form.reset(dictionary);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset(dictionary);\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = async () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n await auditContentDeclaration({\n fileContent: JSON.stringify(dictionaryToAudit),\n }).then((response) => {\n if (!response?.data) return;\n\n try {\n const auditedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n setEditedDictionary((prev) => ({\n ...prev,\n ...dictionaryToAudit,\n ...auditedDictionary,\n }));\n form.reset({\n ...dictionaryToAudit,\n ...auditedDictionary,\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n return (\n <Container\n background=\"none\"\n border\n roundedSize=\"2xl\"\n className=\"w-full px-5 pb-3 pt-5\"\n >\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onChange={(data) =>\n setEditedDictionary((prev) => ({\n ...prev,\n ...data,\n }))\n }\n >\n <div className=\"flex w-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n key: value,\n }));\n }}\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n title: value,\n }));\n }}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n description: value,\n }));\n }}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description.value}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n projectIds: valueArray,\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description.value}\n onValueChange={(value) => {\n form.setValue('tags', [value].flat());\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n tags: [value].flat(),\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n </div>\n </Form>\n </Container>\n );\n};\n"],"names":["useAuth","useGetProjects","useGetTags","useDictionaryDetailsSchema","useForm","useEditedContent","useDictionary","dictionaryDetailsContent","useAuditContentDeclarationMetadata","useEffect","jsx","Container","jsxs","Form","MultiSelect","project","Loader","WandSparkles","ButtonVariant","ButtonColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AACF,MAAM;AACJ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8BAAAA,YAAY,SAAZ,EACC,UAAAJ,2BAAAA,IAACM,wBAAAA,UAAO,WAAW,mBACjB,UAAAN,2BAAAA,IAACI,8BAAAA,YAAY,MAAZ,EACE,UAAA,MAAM,MAAM,IAAI,CAAC,QAChBJ,2BAAAA;AAAAA,sBAACI,8BAAAA,YAAY;AAAA,sBAAZ;AAAA,wBAEC,OAAO,OAAO,IAAI,GAAG;AAAA,wBAEpB,UAAA,IAAI,QAAQ,IAAI;AAAA,sBAAA;AAAA,sBAHZ,OAAO,IAAI,GAAG;AAAA,oBAAA,CAKtB,EAAA,CACH,EAAA,CACF,EAAA,CACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,GACF;AAAA,YAEAJ,2BAAAA,IAAC,OAAA,EAAI,WAAU,iEACb,UAAAA,2BAAAA;AAAAA,cAACG,sCAAAA,KAAK;AAAA,cAAL;AAAA,gBACC,MAAK;AAAA,gBACL,OAAO,YAAY,MAAM;AAAA,gBACzB,MAAMI,YAAAA;AAAAA,gBACN,SAASC,yBAAAA,cAAc;AAAA,gBACvB,OAAOC,yBAAAA,YAAY;AAAA,gBACnB,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,UAAU,gBAAgB;AAAA,gBAC1B,WAAW;AAAA,gBAEV,UAAA,YAAY;AAAA,cAAA;AAAA,YAAA,EACf,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"DictionaryDetailsForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n} from '../../../hooks';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Container } from '../../Container';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect } from '../../Select';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags } = useGetTags();\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionary,\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n\n projectInput,\n tagsSelect,\n auditButton,\n } = useIntlayer('dictionary-details');\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary = editedContent?.[dictionary.key];\n\n useEffect(() => {\n form.reset(dictionary);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset(dictionary);\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = async () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n await auditContentDeclaration({\n fileContent: JSON.stringify(dictionaryToAudit),\n }).then((response) => {\n if (!response?.data) return;\n\n try {\n const auditedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n setEditedDictionary((prev) => ({\n ...prev,\n ...dictionaryToAudit,\n ...auditedDictionary,\n }));\n form.reset({\n ...dictionaryToAudit,\n ...auditedDictionary,\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n return (\n <Container\n background=\"none\"\n border\n roundedSize=\"2xl\"\n className=\"w-full px-5 pb-3 pt-5\"\n >\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onChange={(data) =>\n setEditedDictionary((prev) => ({\n ...prev,\n ...data,\n }))\n }\n >\n <div className=\"flex w-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n key: value,\n }));\n }}\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n title: value,\n }));\n }}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n description: value,\n }));\n }}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description.value}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n projectIds: valueArray,\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description.value}\n onValueChange={(value) => {\n form.setValue('tags', [value].flat());\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n tags: [value].flat(),\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n </div>\n </Form>\n </Container>\n );\n};\n"],"names":["useAuth","useGetProjects","useGetTags","useDictionaryDetailsSchema","useForm","useEditedContent","useIntlayer","useAuditContentDeclarationMetadata","useEffect","jsx","Container","jsxs","Form","MultiSelect","project","Loader","WandSparkles","ButtonVariant","ButtonColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AACF,MAAM;AACJ,QAAM,EAAE,QAAA,IAAYA,8BAAA;AACpB,QAAM,EAAE,YAAY,WAAW,CAAA;AAC/B,QAAM,EAAE,MAAM,UAAU,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MAAZ,EACE,UAAA,MAAM,MAAM,IAAI,CAAC,QAChBJ,2BAAAA;AAAAA,sBAACI,8BAAAA,YAAY;AAAA,sBAAZ;AAAA,wBAEC,OAAO,OAAO,IAAI,GAAG;AAAA,wBAEpB,UAAA,IAAI,QAAQ,IAAI;AAAA,sBAAA;AAAA,sBAHZ,OAAO,IAAI,GAAG;AAAA,oBAAA,CAKtB,EAAA,CACH,EAAA,CACF,EAAA,CACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,GACF;AAAA,YAEAJ,2BAAAA,IAAC,OAAA,EAAI,WAAU,iEACb,UAAAA,2BAAAA;AAAAA,cAACG,sCAAAA,KAAK;AAAA,cAAL;AAAA,gBACC,MAAK;AAAA,gBACL,OAAO,YAAY,MAAM;AAAA,gBACzB,MAAMI,YAAAA;AAAAA,gBACN,SAASC,yBAAAA,cAAc;AAAA,gBACvB,OAAOC,yBAAAA,YAAY;AAAA,gBACnB,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,UAAU,gBAAgB;AAAA,gBAC1B,WAAW;AAAA,gBAEV,UAAA,YAAY;AAAA,cAAA;AAAA,YAAA,EACf,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryDetailsForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,EAAa,MAAM,OAAO,CAAC;AAgB3C,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,sBAAsB,CAsO5D,CAAC"}
1
+ {"version":3,"file":"DictionaryDetailsForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,EAAa,MAAM,OAAO,CAAC;AAe3C,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,sBAAsB,CAsO5D,CAAC"}
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useEditedContent } from "@intlayer/editor-react";
4
4
  import { WandSparkles } from "lucide-react";
5
5
  import { useEffect } from "react";
6
- import { useDictionary } from "react-intlayer";
6
+ import { useIntlayer } from "react-intlayer";
7
7
  import "@intlayer/config/built";
8
8
  import "../../../better-auth.CMQ3rA-I-7umXOENE.js";
9
9
  import { useGetProjects, useGetTags, useAuditContentDeclarationMetadata } from "../../../hooks/intlayerAPIHooks.mjs";
@@ -20,7 +20,6 @@ import { F as Form } from "../../../Form-CriPBaZk.js";
20
20
  import { Loader } from "../../Loader/index.mjs";
21
21
  import { MultiSelect } from "../../Select/Multiselect.mjs";
22
22
  import "../../Select/Select.mjs";
23
- import { dictionaryDetailsContent } from "./dictionaryDetails.content.mjs";
24
23
  import { useDictionaryDetailsSchema } from "./useDictionaryDetailsSchema.mjs";
25
24
  const DictionaryDetailsForm = ({
26
25
  dictionary
@@ -43,7 +42,7 @@ const DictionaryDetailsForm = ({
43
42
  projectInput,
44
43
  tagsSelect,
45
44
  auditButton
46
- } = useDictionary(dictionaryDetailsContent);
45
+ } = useIntlayer("dictionary-details");
47
46
  const { auditContentDeclaration, isLoading: isAuditing } = useAuditContentDeclarationMetadata();
48
47
  const updatedDictionary = editedContent?.[dictionary.key];
49
48
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryDetailsForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n} from '../../../hooks';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Container } from '../../Container';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryDetailsContent } from './dictionaryDetails.content';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags } = useGetTags();\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionary,\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n\n projectInput,\n tagsSelect,\n auditButton,\n } = useDictionary(dictionaryDetailsContent);\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary = editedContent?.[dictionary.key];\n\n useEffect(() => {\n form.reset(dictionary);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset(dictionary);\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = async () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n await auditContentDeclaration({\n fileContent: JSON.stringify(dictionaryToAudit),\n }).then((response) => {\n if (!response?.data) return;\n\n try {\n const auditedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n setEditedDictionary((prev) => ({\n ...prev,\n ...dictionaryToAudit,\n ...auditedDictionary,\n }));\n form.reset({\n ...dictionaryToAudit,\n ...auditedDictionary,\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n return (\n <Container\n background=\"none\"\n border\n roundedSize=\"2xl\"\n className=\"w-full px-5 pb-3 pt-5\"\n >\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onChange={(data) =>\n setEditedDictionary((prev) => ({\n ...prev,\n ...data,\n }))\n }\n >\n <div className=\"flex w-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n key: value,\n }));\n }}\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n title: value,\n }));\n }}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n description: value,\n }));\n }}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description.value}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n projectIds: valueArray,\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description.value}\n onValueChange={(value) => {\n form.setValue('tags', [value].flat());\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n tags: [value].flat(),\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n </div>\n </Form>\n </Container>\n );\n};\n"],"names":["project"],"mappings":";;;;;;;;;;;;;;;;;;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B,EAAA,CACH,EAAA,CACF,EAAA,CACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,GACF;AAAA,YAEA,oBAAC,OAAA,EAAI,WAAU,iEACb,UAAA;AAAA,cAAC,KAAK;AAAA,cAAL;AAAA,gBACC,MAAK;AAAA,gBACL,OAAO,YAAY,MAAM;AAAA,gBACzB,MAAM;AAAA,gBACN,SAAS,cAAc;AAAA,gBACvB,OAAO,YAAY;AAAA,gBACnB,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,UAAU,gBAAgB;AAAA,gBAC1B,WAAW;AAAA,gBAEV,UAAA,YAAY;AAAA,cAAA;AAAA,YAAA,EACf,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"DictionaryDetailsForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n} from '../../../hooks';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Container } from '../../Container';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect } from '../../Select';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags } = useGetTags();\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionary,\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n\n projectInput,\n tagsSelect,\n auditButton,\n } = useIntlayer('dictionary-details');\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary = editedContent?.[dictionary.key];\n\n useEffect(() => {\n form.reset(dictionary);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset(dictionary);\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = async () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n await auditContentDeclaration({\n fileContent: JSON.stringify(dictionaryToAudit),\n }).then((response) => {\n if (!response?.data) return;\n\n try {\n const auditedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n setEditedDictionary((prev) => ({\n ...prev,\n ...dictionaryToAudit,\n ...auditedDictionary,\n }));\n form.reset({\n ...dictionaryToAudit,\n ...auditedDictionary,\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n return (\n <Container\n background=\"none\"\n border\n roundedSize=\"2xl\"\n className=\"w-full px-5 pb-3 pt-5\"\n >\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onChange={(data) =>\n setEditedDictionary((prev) => ({\n ...prev,\n ...data,\n }))\n }\n >\n <div className=\"flex w-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n key: value,\n }));\n }}\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n title: value,\n }));\n }}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n description: value,\n }));\n }}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description.value}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray);\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n projectIds: valueArray,\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description.value}\n onValueChange={(value) => {\n form.setValue('tags', [value].flat());\n setEditedDictionary((prev) => ({\n ...dictionary,\n ...(prev ?? {}),\n tags: [value].flat(),\n }));\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n </div>\n </Form>\n </Container>\n );\n};\n"],"names":["project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AACF,MAAM;AACJ,QAAM,EAAE,QAAA,IAAY,QAAA;AACpB,QAAM,EAAE,YAAY,WAAW,CAAA;AAC/B,QAAM,EAAE,MAAM,UAAU,WAAW,kBAAA,IAAsB,eAAA;AACzD,QAAM,EAAE,MAAM,KAAA,IAAS,WAAA;AAEvB,QAAM,0BAA0B;AAAA,IAC9B,OAAO,SAAS,EAAE;AAAA,EAAA;AAEpB,QAAM,EAAE,MAAM,iBAAiB,QAAQ,yBAAyB;AAAA,IAC9D,eAAe;AAAA,EAAA,CAChB;AACD,QAAM,EAAE,eAAe,oBAAA,IAAwB,iBAAA;AAC/C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,YAAY,oBAAoB;AACpC,QAAM,EAAE,yBAAyB,WAAW,WAAA,IAC1C,mCAAA;AACF,QAAM,oBAAoB,gBAAgB,WAAW,GAAG;AAExD,YAAU,MAAM;AACd,SAAK,MAAM,UAAU;AAAA,EACvB,GAAG,CAAC,YAAY,MAAM,KAAK,CAAC;AAE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AA,wBACC,eAAe,CAAC,UACd,UAAU,MAAM,KAAK,CAACA,aAAY,OAAOA,SAAQ,EAAE,MAAM,KAAK,GAC1D,QAAQ;AAAA,wBAGd,8BAAC,YAAY,OAAZ,EAAkB,aAAa,WAAW,YAAY,MAAA,CAAO;AAAA,sBAAA;AAAA,oBAAA;AAAA,wCAE/D,YAAY,SAAZ,EACC,UAAA,oBAAC,UAAO,WAAW,mBACjB,UAAA,oBAAC,YAAY,MAAZ,EACE,UAAA,MAAM,MAAM,IAAI,CAAC,QAChB;AAAA,sBAAC,YAAY;AAAA,sBAAZ;AAAA,wBAEC,OAAO,OAAO,IAAI,GAAG;AAAA,wBAEpB,UAAA,IAAI,QAAQ,IAAI;AAAA,sBAAA;AAAA,sBAHZ,OAAO,IAAI,GAAG;AAAA,oBAAA,CAKtB,EAAA,CACH,EAAA,CACF,EAAA,CACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,GACF;AAAA,YAEA,oBAAC,OAAA,EAAI,WAAU,iEACb,UAAA;AAAA,cAAC,KAAK;AAAA,cAAL;AAAA,gBACC,MAAK;AAAA,gBACL,OAAO,YAAY,MAAM;AAAA,gBACzB,MAAM;AAAA,gBACN,SAAS,cAAc;AAAA,gBACvB,OAAO,YAAY;AAAA,gBACnB,WAAU;AAAA,gBACV,SAAS;AAAA,gBACT,UAAU,gBAAgB;AAAA,gBAC1B,WAAW;AAAA,gBAEV,UAAA,YAAY;AAAA,cAAA;AAAA,YAAA,EACf,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -439,32 +439,10 @@ export declare const dictionaryDetailsContent: {
439
439
  ru: string;
440
440
  };
441
441
  }>;
442
- description: import('@intlayer/core').TypedNodeModel<import("@intlayer/core").NodeType.Translation, {
443
- en: string;
444
- 'en-GB': string;
445
- fr: string;
446
- es: string;
447
- de: string;
448
- ja: string;
449
- ko: string;
450
- zh: string;
451
- it: string;
452
- pt: string;
453
- }, {
442
+ description: import('@intlayer/core').TypedNodeModel<import("@intlayer/core").NodeType.Translation, import('intlayer').IConfigLocales<unknown>, {
454
443
  nodeType: import("@intlayer/core").NodeType.Translation | "translation";
455
444
  } & {
456
- translation: {
457
- en: string;
458
- 'en-GB': string;
459
- fr: string;
460
- es: string;
461
- de: string;
462
- ja: string;
463
- ko: string;
464
- zh: string;
465
- it: string;
466
- pt: string;
467
- };
445
+ translation: import('intlayer').IConfigLocales<unknown>;
468
446
  }>;
469
447
  placeholder: import('@intlayer/core').TypedNodeModel<import("@intlayer/core").NodeType.Translation, {
470
448
  en: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dictionaryDetails.content.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqRf,CAAC;AAEvB,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"dictionaryDetails.content.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqRf,CAAC;AAEvB,eAAe,wBAAwB,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const reactIntlayer = require("react-intlayer");
4
- const components_DictionaryFieldEditor_DictionaryDetails_useDictionaryDetailsSchema_content = require("./useDictionaryDetailsSchema.content.cjs");
5
4
  const schemas = require("../../../schemas-lh5OFOvX.cjs");
6
5
  const useDictionaryDetailsSchema = (projectId) => {
7
6
  const {
@@ -17,7 +16,7 @@ const useDictionaryDetailsSchema = (projectId) => {
17
16
  requiredErrorProjectId,
18
17
  invalidTypeErrorProjectId,
19
18
  invalidTypeErrorTags
20
- } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_DictionaryDetails_useDictionaryDetailsSchema_content.useDictionaryDetailsSchemaContent);
19
+ } = reactIntlayer.useIntlayer("dictionary-detail-schema");
21
20
  return schemas.object({
22
21
  title: schemas.string({
23
22
  error: (issue) => issue.input === void 0 ? titleRequiredError.value : titleInvalidTypeError.value
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDetailsSchema.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useDictionary } from 'react-intlayer';\nimport { z } from 'zod/v4';\nimport { useDictionaryDetailsSchemaContent } from './useDictionaryDetailsSchema.content';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useDictionary(useDictionaryDetailsSchemaContent);\n\n return z.object({\n title: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? titleRequiredError.value\n : titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n error: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? keyRequiredError.value\n : keyInvalidTypeError.value,\n })\n .min(4, { error: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { error: keySpaceError.value })\n .default(''),\n description: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? descriptionRequiredError.value\n : descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n error: () => invalidTypeErrorTags.value,\n })\n )\n .default([]),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":["useDictionary","useDictionaryDetailsSchemaContent","z.object","z.string","z.array"],"mappings":";;;;;AAIO,MAAM,6BAA6B,CAAC,cAAsB;AAC/D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEA,cAAAA,cAAcC,sFAAAA,iCAAiC;AAEnD,SAAOC,eAAS;AAAA,IACd,OAAOC,QAAAA,OACG;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,mBAAmB,QACnB,sBAAsB;AAAA,IAAA,CAC7B,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,OAAO,oBAAoB;AAAA,IAAA,CAC5B,EACA,SAAA;AAAA,IACH,KAAKA,QAAAA,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,iBAAiB,QACjB,oBAAoB;AAAA,IAAA,CAC3B,EACA,IAAI,GAAG,EAAE,OAAO,kBAAkB,OAAO,EAUzC,MAAM,oBAAoB,EAAE,OAAO,cAAc,OAAO,EACxD,QAAQ,EAAE;AAAA,IACb,aAAaA,QAAAA,OACH;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,yBAAyB,QACzB,4BAA4B;AAAA,IAAA,CACnC,EACA,SAAA;AAAA,IACH,YAAYC,QAAAA;AAAAA,MAERD,eAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAMC,QAAAA;AAAAA,MAEFD,eAAS;AAAA,QACP,OAAO,MAAM,qBAAqB;AAAA,MAAA,CACnC;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,EAAA,CACd;AACH;;"}
1
+ {"version":3,"file":"useDictionaryDetailsSchema.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useIntlayer } from 'react-intlayer';\nimport { z } from 'zod/v4';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useIntlayer('dictionary-detail-schema');\n\n return z.object({\n title: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? titleRequiredError.value\n : titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n error: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? keyRequiredError.value\n : keyInvalidTypeError.value,\n })\n .min(4, { error: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { error: keySpaceError.value })\n .default(''),\n description: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? descriptionRequiredError.value\n : descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n error: () => invalidTypeErrorTags.value,\n })\n )\n .default([]),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":["useIntlayer","z.object","z.string","z.array"],"mappings":";;;;AAGO,MAAM,6BAA6B,CAAC,cAAsB;AAC/D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEA,cAAAA,YAAY,0BAA0B;AAE1C,SAAOC,eAAS;AAAA,IACd,OAAOC,QAAAA,OACG;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,mBAAmB,QACnB,sBAAsB;AAAA,IAAA,CAC7B,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,OAAO,oBAAoB;AAAA,IAAA,CAC5B,EACA,SAAA;AAAA,IACH,KAAKA,QAAAA,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,iBAAiB,QACjB,oBAAoB;AAAA,IAAA,CAC3B,EACA,IAAI,GAAG,EAAE,OAAO,kBAAkB,OAAO,EAUzC,MAAM,oBAAoB,EAAE,OAAO,cAAc,OAAO,EACxD,QAAQ,EAAE;AAAA,IACb,aAAaA,QAAAA,OACH;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,yBAAyB,QACzB,4BAA4B;AAAA,IAAA,CACnC,EACA,SAAA;AAAA,IACH,YAAYC,QAAAA;AAAAA,MAERD,eAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAMC,QAAAA;AAAAA,MAEFD,eAAS;AAAA,QACP,OAAO,MAAM,qBAAqB;AAAA,MAAA,CACnC;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,EAAA,CACd;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDetailsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,eAAO,MAAM,0BAA0B,GAAI,WAAW,MAAM;;;;;;iBA0E3D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAC9C,CAAC"}
1
+ {"version":3,"file":"useDictionaryDetailsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,eAAO,MAAM,0BAA0B,GAAI,WAAW,MAAM;;;;;;iBA0E3D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAC9C,CAAC"}
@@ -1,5 +1,4 @@
1
- import { useDictionary } from "react-intlayer";
2
- import { useDictionaryDetailsSchemaContent } from "./useDictionaryDetailsSchema.content.mjs";
1
+ import { useIntlayer } from "react-intlayer";
3
2
  import { o as object, a as array, s as string } from "../../../schemas-DEXdAbCK.js";
4
3
  const useDictionaryDetailsSchema = (projectId) => {
5
4
  const {
@@ -15,7 +14,7 @@ const useDictionaryDetailsSchema = (projectId) => {
15
14
  requiredErrorProjectId,
16
15
  invalidTypeErrorProjectId,
17
16
  invalidTypeErrorTags
18
- } = useDictionary(useDictionaryDetailsSchemaContent);
17
+ } = useIntlayer("dictionary-detail-schema");
19
18
  return object({
20
19
  title: string({
21
20
  error: (issue) => issue.input === void 0 ? titleRequiredError.value : titleInvalidTypeError.value
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryDetailsSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useDictionary } from 'react-intlayer';\nimport { z } from 'zod/v4';\nimport { useDictionaryDetailsSchemaContent } from './useDictionaryDetailsSchema.content';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useDictionary(useDictionaryDetailsSchemaContent);\n\n return z.object({\n title: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? titleRequiredError.value\n : titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n error: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? keyRequiredError.value\n : keyInvalidTypeError.value,\n })\n .min(4, { error: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { error: keySpaceError.value })\n .default(''),\n description: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? descriptionRequiredError.value\n : descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n error: () => invalidTypeErrorTags.value,\n })\n )\n .default([]),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":["z.object","z.string","z.array"],"mappings":";;;AAIO,MAAM,6BAA6B,CAAC,cAAsB;AAC/D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,iCAAiC;AAEnD,SAAOA,OAAS;AAAA,IACd,OAAOC,OACG;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,mBAAmB,QACnB,sBAAsB;AAAA,IAAA,CAC7B,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,OAAO,oBAAoB;AAAA,IAAA,CAC5B,EACA,SAAA;AAAA,IACH,KAAKA,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,iBAAiB,QACjB,oBAAoB;AAAA,IAAA,CAC3B,EACA,IAAI,GAAG,EAAE,OAAO,kBAAkB,OAAO,EAUzC,MAAM,oBAAoB,EAAE,OAAO,cAAc,OAAO,EACxD,QAAQ,EAAE;AAAA,IACb,aAAaA,OACH;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,yBAAyB,QACzB,4BAA4B;AAAA,IAAA,CACnC,EACA,SAAA;AAAA,IACH,YAAYC;AAAAA,MAERD,OAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAMC;AAAAA,MAEFD,OAAS;AAAA,QACP,OAAO,MAAM,qBAAqB;AAAA,MAAA,CACnC;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,EAAA,CACd;AACH;"}
1
+ {"version":3,"file":"useDictionaryDetailsSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useIntlayer } from 'react-intlayer';\nimport { z } from 'zod/v4';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useIntlayer('dictionary-detail-schema');\n\n return z.object({\n title: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? titleRequiredError.value\n : titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n error: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? keyRequiredError.value\n : keyInvalidTypeError.value,\n })\n .min(4, { error: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { error: keySpaceError.value })\n .default(''),\n description: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? descriptionRequiredError.value\n : descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n error: () => invalidTypeErrorTags.value,\n })\n )\n .default([]),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":["z.object","z.string","z.array"],"mappings":";;AAGO,MAAM,6BAA6B,CAAC,cAAsB;AAC/D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,YAAY,0BAA0B;AAE1C,SAAOA,OAAS;AAAA,IACd,OAAOC,OACG;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,mBAAmB,QACnB,sBAAsB;AAAA,IAAA,CAC7B,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,OAAO,oBAAoB;AAAA,IAAA,CAC5B,EACA,SAAA;AAAA,IACH,KAAKA,OACK;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,iBAAiB,QACjB,oBAAoB;AAAA,IAAA,CAC3B,EACA,IAAI,GAAG,EAAE,OAAO,kBAAkB,OAAO,EAUzC,MAAM,oBAAoB,EAAE,OAAO,cAAc,OAAO,EACxD,QAAQ,EAAE;AAAA,IACb,aAAaA,OACH;AAAA,MACN,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,yBAAyB,QACzB,4BAA4B;AAAA,IAAA,CACnC,EACA,SAAA;AAAA,IACH,YAAYC;AAAAA,MAERD,OAAS;AAAA,QACP,OAAO,CAAC,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B;AAAA,MAAA,CACjC;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAMC;AAAAA,MAEFD,OAAS;AAAA,QACP,OAAO,MAAM,qBAAqB;AAAA,MAAA,CACnC;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,EAAA,CACd;AACH;"}
@@ -22,11 +22,9 @@ require("../DropDown/index.cjs");
22
22
  require("../Input/Input.cjs");
23
23
  require("../Input/Checkbox.cjs");
24
24
  const components_SwitchSelector_index = require("../SwitchSelector/index.cjs");
25
- require("../LocaleSwitcherContentDropDown/localeSwitcher.content.cjs");
26
25
  const components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext = require("../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs");
27
26
  const components_DictionaryFieldEditor_ContentEditor = require("./ContentEditor.cjs");
28
27
  const components_DictionaryFieldEditor_DictionaryDetails_DictionaryDetailsForm = require("./DictionaryDetails/DictionaryDetailsForm.cjs");
29
- const components_DictionaryFieldEditor_dictionaryFieldEditor_content = require("./dictionaryFieldEditor.content.cjs");
30
28
  const components_DictionaryFieldEditor_JSONEditor = require("./JSONEditor.cjs");
31
29
  const components_DictionaryFieldEditor_SaveForm_SaveForm = require("./SaveForm/SaveForm.cjs");
32
30
  const components_DictionaryFieldEditor_StructureEditor = require("./StructureEditor.cjs");
@@ -42,9 +40,7 @@ const DictionaryFieldEditor = ({
42
40
  1
43
41
  /* ContentEditor */
44
42
  );
45
- const { returnToDictionaryList } = reactIntlayer.useDictionary(
46
- components_DictionaryFieldEditor_dictionaryFieldEditor_content.dictionaryFieldEditorContent
47
- );
43
+ const { returnToDictionaryList } = reactIntlayer.useIntlayer("dictionary-field-editor");
48
44
  const { setFocusedContent } = editorReact.useFocusDictionaryActions();
49
45
  const { setLocaleDictionaries } = editorReact.useDictionariesRecordActions();
50
46
  ReactExports.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ButtonVariant","ButtonColor","ArrowLeft","SwitchSelector","SwitchSelectorColor","SwitchSelectorSize","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAA;AACf,QAAM,CAAC,YAAY,aAAa,IAAIC,aAAAA;AAAAA,IAClC;AAAA;AAAA,EAAA;AAEF,QAAM,EAAE,2BAA2BC,cAAAA;AAAAA,IACjCC,+DAAAA;AAAAA,EAAA;AAEF,QAAM,EAAE,kBAAA,IAAsBC,sCAAA;AAC9B,QAAM,EAAE,sBAAA,IAA0BC,yCAAA;AAElCC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAA;AAAA,MACZ,eAAe,WAAW;AAAA,IAAA,EAC1B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,GAAG,GAAG;AAAA,IA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wB;AAAA,QAE1C,eAAe,KACdX,2BAAAA,IAACY,+CAAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACdZ,2BAAAA,IAACa,4CAAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9Db,2BAAAA;AAAAA,UAACc,mDAAAA;AAAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useIntlayer","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ButtonVariant","ButtonColor","ArrowLeft","SwitchSelector","SwitchSelectorColor","SwitchSelectorSize","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAA;AACf,QAAM,CAAC,YAAY,aAAa,IAAIC,aAAAA;AAAAA,IAClC;AAAA;AAAA,EAAA;AAEF,QAAM,EAAE,uBAAA,IAA2BC,cAAAA,YAAY,yBAAyB;AACxE,QAAM,EAAE,kBAAA,IAAsBC,sCAAA;AAC9B,QAAM,EAAE,sBAAA,IAA0BC,yCAAA;AAElCC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAA;AAAA,MACZ,eAAe,WAAW;AAAA,IAAA,EAC1B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,GAAG,GAAG;AAAA,IAAA,EAClB;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,SACEC,2BAAAA;AAAAA,IAACC,sEAAAA;AAAAA,IAAA;AAAA,MACC,kBAAkB,QAAQ,qBAAqB,WAAW,CAAA;AAAA,MAE1D,UAAAC,2BAAAA,KAAC,OAAA,EAAI,WAAU,sCACb,UAAA;AAAA,QAAAF,2BAAAA;AAAAA,UAACG,yBAAAA;AAAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,SAASC,yBAAAA,cAAc;AAAA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,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgBrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAqGhE,CAAC"}
1
+ {"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAerD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmGhE,CAAC"}
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useConfiguration, useFocusDictionaryActions, useDictionariesRecordActions } from "@intlayer/editor-react";
4
4
  import { ArrowLeft } from "lucide-react";
5
5
  import { useState, useEffect } from "react";
6
- import { useDictionary } from "react-intlayer";
6
+ import { useIntlayer } from "react-intlayer";
7
7
  import { Button, ButtonColor, ButtonVariant } from "../Button/Button.mjs";
8
8
  import "@intlayer/config/client";
9
9
  import "@intlayer/core";
@@ -20,11 +20,9 @@ import "../DropDown/index.mjs";
20
20
  import "../Input/Input.mjs";
21
21
  import "../Input/Checkbox.mjs";
22
22
  import { SwitchSelector, SwitchSelectorSize, SwitchSelectorColor } from "../SwitchSelector/index.mjs";
23
- import "../LocaleSwitcherContentDropDown/localeSwitcher.content.mjs";
24
23
  import { LocaleSwitcherContentProvider } from "../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
25
24
  import { ContentEditor } from "./ContentEditor.mjs";
26
25
  import { DictionaryDetailsForm } from "./DictionaryDetails/DictionaryDetailsForm.mjs";
27
- import { dictionaryFieldEditorContent } from "./dictionaryFieldEditor.content.mjs";
28
26
  import { JSONEditor } from "./JSONEditor.mjs";
29
27
  import { SaveForm } from "./SaveForm/SaveForm.mjs";
30
28
  import { StructureEditor } from "./StructureEditor.mjs";
@@ -40,9 +38,7 @@ const DictionaryFieldEditor = ({
40
38
  1
41
39
  /* ContentEditor */
42
40
  );
43
- const { returnToDictionaryList } = useDictionary(
44
- dictionaryFieldEditorContent
45
- );
41
+ const { returnToDictionaryList } = useIntlayer("dictionary-field-editor");
46
42
  const { setFocusedContent } = useFocusDictionaryActions();
47
43
  const { setLocaleDictionaries } = useDictionariesRecordActions();
48
44
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,iBAAA;AACf,QAAM,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EAAA;AAEF,QAAM,EAAE,2BAA2B;AAAA,IACjC;AAAA,EAAA;AAEF,QAAM,EAAE,kBAAA,IAAsB,0BAAA;AAC9B,QAAM,EAAE,sBAAA,IAA0B,6BAAA;AAElC,YAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAA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WAAA,CAAwB;AAAA,QAE1C,eAAe,KACd,oBAAC,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACd,oBAAC,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button, ButtonColor, ButtonVariant } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n SwitchSelectorColor,\n SwitchSelectorSize,\n} from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant={ButtonVariant.HOVERABLE}\n className=\"z-10 ml-5 mr-auto\"\n color={ButtonColor.TEXT}\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocus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E,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MAAA,MACD,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QAAA;AAAA,QAGD,eAAe,KACd,oBAAC,uBAAA,EAAsB,WAAA,CAAwB;AAAA,QAEhD,eAAe,KACd,oBAAC,iBAAA,EAAgB,WAAA,CAAwB;AAAA,QAE1C,eAAe,KACd,oBAAC,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACd,oBAAC,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,MAAM;AACd,gCAAkB,IAAI;AACtB,yBAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -10,7 +10,6 @@ const utils_camelCase = require("../../../utils/camelCase.cjs");
10
10
  const components_Accordion_Accordion = require("../../Accordion/Accordion.cjs");
11
11
  const components_Button_Button = require("../../Button/Button.cjs");
12
12
  const components_DictionaryFieldEditor_getIsEditableSection = require("../getIsEditableSection.cjs");
13
- const components_DictionaryFieldEditor_NavigationView_navigationViewNode_content = require("./navigationViewNode.content.cjs");
14
13
  const traceKeys = ["filePath", "id", "nodeType"];
15
14
  const NavigationViewNode = ({
16
15
  section: sectionProp,
@@ -21,7 +20,7 @@ const NavigationViewNode = ({
21
20
  const section = core.getContentNodeByKeyPath(sectionProp, keyPath);
22
21
  const { addEditedContent } = editorReact.useEditedContentActions();
23
22
  const { setFocusedContentKeyPath, focusedContent } = editorReact.useFocusDictionary();
24
- const { addNewElement, goToField } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
23
+ const { addNewElement, goToField } = reactIntlayer.useIntlayer("navigation-view");
25
24
  const nodeType = core.getNodeType(section);
26
25
  const getIsSelected = (keyPath2) => (focusedContent?.keyPath?.length ?? 0) > 0 && core.isSameKeyPath(keyPath2, focusedContent?.keyPath ?? []);
27
26
  const isEditableSubSection = components_DictionaryFieldEditor_getIsEditableSection.getIsEditableSection(section);
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationViewNode.cjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { navigationViewContent } from './navigationViewNode.content';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useDictionary(navigationViewContent);\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["getContentNodeByKeyPath","useEditedContentActions","useFocusDictionary","useDictionary","navigationViewContent","getNodeType","keyPath","isSameKeyPath","getIsEditableSection","jsx","Fragment","Button","ButtonVariant","ButtonColor","ChevronRight","NodeType","jsxs","ButtonTextAlign","sectionArray","getEmptyNode","Plus","isEditableSubSection","Accordion","camelCaseToSentence"],"mappings":";;;;;;;;;;;;;AA6BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAY,eAAe;AACnC,QAAM,UAAUA,KAAAA,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqBC,oCAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmBC,+BAAA;AACrD,QAAM,EAAE,eAAe,cAAcC,cAAAA,cAAcC,2EAAAA,qBAAqB;AACxE,QAAM,WAAWC,KAAAA,YAAY,OAAO;AACpC,QAAM,gBAAgB,CAACC,cACpB,gBAAgB,SAAS,UAAU,KAAK,KACzCC,KAAAA,cAAcD,UAAS,gBAAgB,WAAW,CAAA,CAAE;AACtD,QAAM,uBAAuBE,sDAAAA,qBAAqB,OAAO;AAEzD,MAAI,CAAC,QAAS,QAAOC,+BAAAC,WAAAA,UAAA,CAAA,CAAE;AAEvB,MAAI,sBAAsB;AACxB,WACED,2BAAAA;AAAAA,MAACE,yBAAAA;AAAAA,MAAA;AAAA,QACC,OAAO,UAAU,MAAM;AAAA,QACvB,SAASC,yBAAAA,cAAc;AAAA,QAC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AN,qBAAA,EAAE,UAAA;AAAA,IAAA;AAAA,IAEC;AAAA,IAAS;AAAA,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;;;"}
1
+ {"version":3,"file":"NavigationViewNode.cjs","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"sourcesContent":["import configuration from '@intlayer/config/built';\n\nimport {\n getContentNodeByKeyPath,\n getEmptyNode,\n getNodeType,\n isSameKeyPath,\n NodeType,\n type ContentNode,\n type KeyPath,\n} from '@intlayer/core';\nimport {\n useEditedContentActions,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { ChevronRight, Plus } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { camelCaseToSentence } from '../../../utils/camelCase';\nimport { Accordion } from '../../Accordion';\nimport {\n Button,\n ButtonColor,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { getIsEditableSection } from '../getIsEditableSection';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n section: ContentNode;\n};\n\nexport const NavigationViewNode: FC<NodeWrapperProps> = ({\n section: sectionProp,\n keyPath,\n dictionaryKey,\n}) => {\n const { locales } = configuration?.internationalization;\n const section = getContentNodeByKeyPath(sectionProp, keyPath);\n const { addEditedContent } = useEditedContentActions();\n const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();\n const { addNewElement, goToField } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n const getIsSelected = (keyPath: KeyPath[]) =>\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(keyPath, focusedContent?.keyPath ?? []);\n const isEditableSubSection = getIsEditableSection(section);\n\n if (!section) return <></>;\n\n if (isEditableSubSection) {\n return (\n <Button\n label={goToField.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(keyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(keyPath[keyPath.length - 1].key as string)}\n </Button>\n );\n }\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return <>React Node</>;\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {locales.map((translationKey) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ];\n\n return (\n <NavigationViewNode\n key={translationKey}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Enumeration || nodeType === NodeType.Condition) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {Object.keys(\n (section as any)[nodeType as unknown as keyof typeof section]\n ).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: nodeType, key },\n ];\n\n return (\n <NavigationViewNode\n key={key}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n </div>\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <div className=\"flex flex-col justify-between gap-2\">\n {(section as unknown as ContentNode[]).map((_, index) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Array, key: index },\n ];\n\n return (\n <NavigationViewNode\n key={JSON.stringify(childKeyPath)}\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n })}\n\n <Button\n label={addNewElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n const sectionArray = section as unknown as ContentNode[];\n const emptySectionEl =\n getEmptyNode(\n sectionArray[\n (sectionArray.length - 1) as keyof typeof sectionArray\n ] as ContentNode\n ) ?? '';\n addEditedContent(\n dictionaryKey,\n emptySectionEl,\n newKeyPath,\n false\n );\n setFocusedContentKeyPath(newKeyPath);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n }\n\n if (typeof section.nodeType === 'string') {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: section.nodeType } as KeyPath,\n ];\n\n return (\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n );\n }\n\n const sectionArray = Object.keys(section);\n return (\n <div className=\"flex w-full max-w-full flex-col justify-between gap-2\">\n {sectionArray.map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n\n const subSection = getContentNodeByKeyPath(sectionProp, childKeyPath);\n const isEditableSubSection = getIsEditableSection(subSection);\n\n if (isEditableSubSection) {\n return (\n <Button\n label={`${goToField.label.value} ${key}`}\n key={key}\n isActive={getIsSelected(childKeyPath)}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n className=\"w-full\"\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n IconRight={ChevronRight}\n >\n {camelCaseToSentence(key)}\n </Button>\n );\n }\n\n return (\n <Accordion\n key={key}\n label={`${goToField.label.value} ${key}`}\n isActive={getIsSelected(childKeyPath)}\n onClick={() => setFocusedContentKeyPath(childKeyPath)}\n header={camelCaseToSentence(key)}\n >\n <div className=\"mt-2 flex w-full max-w-full\">\n <div className=\"flex-1 pl-10\">\n <NavigationViewNode\n keyPath={childKeyPath}\n section={sectionProp}\n dictionaryKey={dictionaryKey}\n />\n </div>\n </div>\n </Accordion>\n );\n })}\n </div>\n );\n }\n\n return (\n <>\n Error loading section --\n {nodeType}\n --\n {JSON.stringify(section)}\n --\n {JSON.stringify(keyPath)}\n </>\n );\n};\n"],"names":["getContentNodeByKeyPath","useEditedContentActions","useFocusDictionary","useIntlayer","getNodeType","keyPath","isSameKeyPath","getIsEditableSection","jsx","Fragment","Button","ButtonVariant","ButtonColor","ChevronRight","NodeType","jsxs","ButtonTextAlign","sectionArray","getEmptyNode","Plus","isEditableSubSection","Accordion","camelCaseToSentence"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAQzD,MAAM,qBAA2C,CAAC;AAAA,EACvD,SAAS;AAAA,EACT;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,YAAY,eAAe;AACnC,QAAM,UAAUA,KAAAA,wBAAwB,aAAa,OAAO;AAC5D,QAAM,EAAE,iBAAA,IAAqBC,oCAAA;AAC7B,QAAM,EAAE,0BAA0B,eAAA,IAAmBC,+BAAA;AACrD,QAAM,EAAE,eAAe,cAAcC,cAAAA,YAAY,iBAAiB;AAClE,QAAM,WAAWC,KAAAA,YAAY,OAAO;AACpC,QAAM,gBAAgB,CAACC,cACpB,gBAAgB,SAAS,UAAU,KAAK,KACzCC,KAAAA,cAAcD,UAAS,gBAAgB,WAAW,CAAA,CAAE;AACtD,QAAM,uBAAuBE,sDAAAA,qBAAqB,OAAO;AAEzD,MAAI,CAAC,QAAS,QAAOC,+BAAAC,WAAAA,UAAA,CAAA,CAAE;AAEvB,MAAI,sBAAsB;AACxB,WACED,2BAAAA;AAAAA,MAACE,yBAAAA;AAAAA,MAAA;AAAA,QACC,OAAO,UAAU,MAAM;AAAA,QACvB,SAASC,yBAAAA,cAAc;AAAA,QACvB,OAAOC,yBAAAA,YAAY;AAAA,QACnB,WAAU;AAAA,QACV,SAAS,MAAM,yBAAyB,OAAO;AAAA,QAC/C,WAAWC,YAAAA;AAAAA,QAEV,8CAAoB,QAAQ,QAAQ,SAAS,CAAC,EAAE,GAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAGpE;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,QAAI,aAAaC,KAAAA,SAAS,WAAW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uBb,sDAAAA,qBAAqB,UAAU;AAE5D,UAAIa,uBAAsB;AACxB,eACEZ,2BAAAA;AAAAA,UAACE,yBAAAA;AAAAA,UAAA;AAAA,YACC,OAAO,GAAG,UAAU,MAAM,KAAK,IAAI,GAAG;AAAA,YAEtC,UAAU,cAAc,YAAY;AAAA,YACpC,SAASC,yBAAAA,cAAc;AAAA,YACvB,OAAOC,yBAAAA,YAAY;AAAA,YACnB,WAAU;AAAA,YACV,SAAS,MAAM,yBAAyB,YAAY;AAAA,YACpD,WAAWC,YAAAA;AAAAA,YAEV,8CAAoB,GAAG;AAAA,UAAA;AAAA,UARnB;AAAA,QAAA;AAAA,MAWX;AAEA,aACEL,2BAAAA;AAAAA,QAACa,+BAAAA;AAAAA,QAAA;AAAA,UAEC,OAAO,GAAG,UAAU,MAAM,KAAK,IAAI,GAAG;AAAA,UACtC,UAAU,cAAc,YAAY;AAAA,UACpC,SAAS,MAAM,yBAAyB,YAAY;AAAA,UACpD,QAAQC,gBAAAA,oBAAoB,GAAG;AAAA,UAE/B,yCAAC,OAAA,EAAI,WAAU,+BACb,UAAAd,2BAAAA,IAAC,OAAA,EAAI,WAAU,gBACb,UAAAA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,SAAS;AAAA,cACT;AAAA,YAAA;AAAA,UAAA,GAEJ,EAAA,CACF;AAAA,QAAA;AAAA,QAdK;AAAA,MAAA;AAAA,IAiBX,CAAC,EAAA,CACH;AAAA,EAEJ;AAEA,SACEO,2BAAAA,KAAAN,qBAAA,EAAE,UAAA;AAAA,IAAA;AAAA,IAEC;AAAA,IAAS;AAAA,IAET,KAAK,UAAU,OAAO;AAAA,IAAE;AAAA,IAExB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationViewNode.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAahC,eAAO,MAAM,SAAS,EAAE,MAAM,EAAmC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,gBAAgB,CAyNnD,CAAC"}
1
+ {"version":3,"file":"NavigationViewNode.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,eAAO,MAAM,SAAS,EAAE,MAAM,EAAmC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,gBAAgB,CAyNnD,CAAC"}
@@ -3,12 +3,11 @@ import configuration from "@intlayer/config/built";
3
3
  import { getContentNodeByKeyPath, getNodeType, NodeType, getEmptyNode, isSameKeyPath } from "@intlayer/core";
4
4
  import { useEditedContentActions, useFocusDictionary } from "@intlayer/editor-react";
5
5
  import { ChevronRight, Plus } from "lucide-react";
6
- import { useDictionary } from "react-intlayer";
6
+ import { useIntlayer } from "react-intlayer";
7
7
  import { camelCaseToSentence } from "../../../utils/camelCase.mjs";
8
8
  import { Accordion } from "../../Accordion/Accordion.mjs";
9
9
  import { Button, ButtonColor, ButtonVariant, ButtonTextAlign } from "../../Button/Button.mjs";
10
10
  import { getIsEditableSection } from "../getIsEditableSection.mjs";
11
- import { navigationViewContent } from "./navigationViewNode.content.mjs";
12
11
  const traceKeys = ["filePath", "id", "nodeType"];
13
12
  const NavigationViewNode = ({
14
13
  section: sectionProp,
@@ -19,7 +18,7 @@ const NavigationViewNode = ({
19
18
  const section = getContentNodeByKeyPath(sectionProp, keyPath);
20
19
  const { addEditedContent } = useEditedContentActions();
21
20
  const { setFocusedContentKeyPath, focusedContent } = useFocusDictionary();
22
- const { addNewElement, goToField } = useDictionary(navigationViewContent);
21
+ const { addNewElement, goToField } = useIntlayer("navigation-view");
23
22
  const nodeType = getNodeType(section);
24
23
  const getIsSelected = (keyPath2) => (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(keyPath2, focusedContent?.keyPath ?? []);
25
24
  const isEditableSubSection = getIsEditableSection(section);