@intlayer/design-system 5.1.3 → 5.1.5
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.
- package/dist/.vite/manifest.json +37 -102
- package/dist/Form-BZUDRfoN.js.map +1 -1
- package/dist/Form-yi0CMK-a.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
- package/dist/components/Command/index.d.ts +1 -1
- package/dist/components/Container/index.cjs +6 -7
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +6 -7
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +33 -20
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +34 -21
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +20 -9
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +21 -10
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +241 -209
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +245 -213
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +92 -120
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +94 -122
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +0 -3
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +19 -13
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +52 -103
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +3 -3
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +56 -107
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +3 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.cjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts +0 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.mjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +0 -1
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.d.ts +1 -4
- package/dist/components/Form/FormBase.d.ts.map +1 -1
- package/dist/components/Form/FormBase.mjs +0 -1
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.cjs +0 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.mjs +0 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts +3 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -0
- package/dist/components/MaxHeightSmoother/index.cjs +3 -1
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs +3 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +15 -13
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +15 -13
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs +0 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/Select/Multiselect.mjs +1 -2
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs +0 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.mjs +0 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useKeyboardDetector.cjs +27 -0
- package/dist/hooks/useKeyboardDetector.cjs.map +1 -0
- package/dist/hooks/useKeyboardDetector.d.ts +5 -0
- package/dist/hooks/useKeyboardDetector.d.ts.map +1 -0
- package/dist/hooks/useKeyboardDetector.mjs +27 -0
- package/dist/hooks/useKeyboardDetector.mjs.map +1 -0
- package/dist/{index-BTDHuTxL.js → index-B1w5h_6-.js} +7 -7
- package/dist/index-B1w5h_6-.js.map +1 -0
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/{index-Db5Dym4h.cjs → index-U1U6ySIn.cjs} +7 -7
- package/dist/index-U1U6ySIn.cjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/dist/zod-BV4nCGJE.js.map +1 -1
- package/dist/zod-DSrtTSD_.cjs.map +1 -1
- package/package.json +19 -19
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts +0 -10
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs.map +0 -1
- package/dist/index-BTDHuTxL.js.map +0 -1
- package/dist/index-Db5Dym4h.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.mjs","sources":["../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config';\nimport {\n type Dictionary,\n type MarkdownContent,\n type NestedContent,\n type EnumerationContent,\n type TranslationContent,\n NodeType,\n type KeyPath,\n type ContentNode,\n getLocaleName,\n getNodeType,\n type ConditionContent,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport { Plus, WandSparkles, X } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport { Button } from '../../Button';\nimport {\n ContentEditorInputProps as ContentEditorInputPropsBase,\n ContentEditorInput as ContentEditorInputBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n ContentEditorTextArea as ContentEditorTextAreaBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n type SwitchSelectorChoices,\n type SwitchSelectorProps,\n SwitchSelector,\n} from '../../SwitchSelector';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { navigationViewContent } from '../NavigationView/navigationViewNode.content';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { auditContentDeclarationField, isLoading: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField({\n fileContent: JSON.stringify(dictionary),\n keyPath,\n locales: configuration.internationalization.locales ?? [],\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(dictionary.key, editedContent, keyPath);\n } catch (error) {\n console.error(error);\n }\n });\n }}\n />\n }\n {...props}\n />\n );\n};\n\ntype ContentEditorInputProps = Omit<\n ContentEditorInputPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorInput: FC<ContentEditorInputProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <ContentEditorInputBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n {...props}\n />\n );\n};\n\nconst toggleContent = [\n {\n content: 'False',\n value: false,\n },\n {\n content: 'True',\n value: true,\n },\n] as SwitchSelectorChoices<boolean>;\n\ntype ContentEditorToggleProps = SwitchSelectorProps & {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n};\n\nconst ContentEditorToggle: FC<ContentEditorToggleProps> = ({\n dictionary,\n keyPath,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <SwitchSelector\n choices={toggleContent}\n value={true}\n onChange={(value) => addEditedContent(dictionary.key, value, keyPath)}\n color=\"text\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}: TextEditorProps) => {\n const { locale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locales, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as Locales[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {localesList.map((translationKey) => (\n <tr key={translationKey} className=\"w-full\" lang={translationKey}>\n <td className=\"flex w-full flex-col p-2\">\n {selectedLocales.length > 1 && (\n <span className=\"w-full p-2 text-xs\">\n {getLocaleName(translationKey, locale)}\n </span>\n )}\n <TextEditor\n section={\n (section as TranslationContent<string>)[NodeType.Translation][\n translationKey\n ] as string\n }\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full table-fixed gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => (\n <tr key={enumKey} className=\"w-full\">\n <td className=\"w-44 p-2\">\n <div className=\"flex gap-1\">\n <Button\n label=\"Remove\"\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n Icon={X}\n className=\"w-16\"\n onClick={() =>\n addEditedContent(dictionary.key, undefined, [\n ...keyPath,\n {\n type: NodeType.Enumeration,\n key: enumKey,\n },\n ])\n }\n />\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.key, newValue, keyPath);\n }}\n />\n </div>\n </td>\n <td className=\"w-full p-2\">\n <TextEditor\n section={\n (section as EnumerationContent<string>)[NodeType.Enumeration][\n enumKey as any\n ] as string\n }\n keyPath={[\n ...keyPath,\n { type: NodeType.Enumeration, key: enumKey },\n ]}\n dictionary={dictionary}\n />\n </td>\n </tr>\n ))}\n </tbody>\n\n <tfoot>\n <Button\n label={addNewEnumeration.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() =>\n addEditedContent(\n dictionary.key,\n '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }],\n false\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full table-fixed gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {['true', 'false', 'fallback'].map((condKey) => (\n <tr key={condKey} className=\"w-full\">\n <td className=\"w-44 p-2\">\n <div className=\"flex gap-1\">\n <Button\n label=\"Remove\"\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n Icon={X}\n className=\"w-16\"\n onClick={() =>\n addEditedContent(dictionary.key, undefined, [\n ...keyPath,\n {\n type: NodeType.Condition,\n key: condKey,\n },\n ])\n }\n />\n <EnumKeyInput\n value={condKey}\n onChange={(value) => {\n const preValueContent = (\n section as ConditionContent<string>\n )[NodeType.Condition];\n const newValueContent = renameKey(\n preValueContent,\n condKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as ConditionContent<string>),\n [NodeType.Condition]: newValueContent,\n };\n\n addEditedContent(dictionary.key, newValue, keyPath);\n }}\n />\n </div>\n </td>\n <td className=\"w-full p-2\">\n <TextEditor\n section={\n (section as EnumerationContent<string>)[NodeType.Enumeration][\n condKey as any\n ] as string\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: parseInt(condKey),\n } as KeyPath,\n ]}\n dictionary={dictionary}\n />\n </td>\n </tr>\n ))}\n </tbody>\n\n <tfoot>\n <Button\n label={addNewEnumeration.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() =>\n addEditedContent(\n dictionary.key,\n '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }],\n false\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {(section as unknown as ContentNode[]).map((subSection, index) => (\n <tr key={JSON.stringify(subSection)} className=\"w-full\">\n <td className=\"p-2\">{index}</td>\n <td className=\"w-full p-2\">\n <TextEditor\n section={subSection}\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n />\n </td>\n </tr>\n ))}\n </tbody>\n <tfoot>\n <Button\n label={addNewElement.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"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 addEditedContent(dictionary.key, '', newKeyPath, false);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n\n const content = (section as MarkdownContent)[NodeType.Markdown];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <SwitchSelector\n choices={toggleContent}\n value={mode}\n onChange={setMode}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n />\n {mode === MarkdownViewMode.Edit && (\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[...keyPath, { type: NodeType.Markdown }]}\n dictionary={dictionary}\n >\n {content}\n </ContentEditorTextArea>\n )}\n {mode === MarkdownViewMode.Preview && (\n <MarkdownRenderer isDarkMode={isDarkMode}>{content}</MarkdownRenderer>\n )}\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as NestedContent)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.Nested }] as KeyPath[];\n\n return (\n <div className=\"w-full p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.key,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\n {...props}\n >\n {content.dictionaryKey ?? ''}\n </ContentEditorInputBase>\n\n <Label>Path (optional)</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.key,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n {...props}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const { tsxNotEditable } = useDictionary(navigationViewContent);\n const nodeType = getNodeType(section);\n const isEditableSection = getIsEditableSection(section);\n\n if (!isEditableSection) return <></>;\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n <span>[React Node]</span>\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {tsxNotEditable}\n </span>\n </>\n );\n }\n\n if (nodeType === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n </div>\n );\n }\n\n if (nodeType === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section)}\n </div>\n );\n};\n"],"names":["ContentEditorTextAreaBase","ContentEditorInputBase","toggleContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAUhE,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,iBAAiB,IAAI,iBAAiB;AAC9C,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,EAAE,8BAA8B,WAAW,WAAA,IAC/C,gCAAgC;AAGhC,SAAA;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,iBAAiB,CAAC,aAChB,iBAAiB,WAAW,KAAK,UAAU,OAAO;AAAA,MAEpD,mBACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UACN,WAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS,MAAM;AACgB,yCAAA;AAAA,cAC3B,aAAa,KAAK,UAAU,UAAU;AAAA,cACtC;AAAA,cACA,SAAS,cAAc,qBAAqB,WAAW,CAAA;AAAA,YAAC,CACzD,EAAE,KAAK,CAAC,aAAa;AAChB,kBAAA,CAAC,SAAS,KAAM;AAEhB,kBAAA;AACI,sBAAA,gBAAgB,SAA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,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAGE,MAAA,aAAa,SAAS,QAAQ;AAE9B,WAAA,oBAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL,cAAW;AAAA,QAEV,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAAA;AAIA,MAAA,aAAa,SAAS,MAAM;AAE5B,WAAA,oBAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,cAAW;AAAA,QACX;AAAA,QACA;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAAA;AAIA,MAAA,aAAa,SAAS,SAAS;AAE/B,WAAA,oBAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,MAAA;AAAA,IAAA,GAEX;AAAA,EAAA;AAKF,SAAA,qBAAC,OAAI,EAAA,WAAU,cAAa,UAAA;AAAA,IAAA;AAAA,IAEzB,KAAK,UAAU,OAAO;AAAA,EAAA,GACzB;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"TextEditor.mjs","sources":["../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config';\nimport {\n type Dictionary,\n type MarkdownContent,\n type NestedContent,\n type EnumerationContent,\n type TranslationContent,\n NodeType,\n type KeyPath,\n type ContentNode,\n getLocaleName,\n getNodeType,\n type ConditionContent,\n getEmptyNode,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { Fragment, useState, type FC } from 'react';\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport { Button } from '../../Button';\nimport { Container } from '../../Container';\nimport {\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n ContentEditorInput as ContentEditorInputBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n ContentEditorTextArea as ContentEditorTextAreaBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n type SwitchSelectorChoices,\n type SwitchSelectorProps,\n SwitchSelector,\n} from '../../SwitchSelector';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { navigationViewContent } from '../NavigationView/navigationViewNode.content';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { auditContentDeclarationField, isLoading: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField({\n fileContent: JSON.stringify({\n ...dictionary,\n ...(editedContent?.[dictionary.key] ?? {}),\n }),\n keyPath,\n locales: configuration.internationalization.locales ?? [],\n }).then((response) => {\n if (!response?.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(dictionary.key, editedContent, keyPath);\n } catch (error) {\n console.error(error);\n }\n });\n }}\n />\n }\n {...props}\n />\n );\n};\n\ntype ContentEditorInputProps = Omit<\n ContentEditorInputPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorInput: FC<ContentEditorInputProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <ContentEditorInputBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n {...props}\n />\n );\n};\n\nconst toggleContent = [\n {\n content: 'False',\n value: false,\n },\n {\n content: 'True',\n value: true,\n },\n] as SwitchSelectorChoices<boolean>;\n\ntype ContentEditorToggleProps = SwitchSelectorProps & {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n};\n\nconst ContentEditorToggle: FC<ContentEditorToggleProps> = ({\n dictionary,\n keyPath,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n return (\n <SwitchSelector\n choices={toggleContent}\n value={true}\n onChange={(value) => addEditedContent(dictionary.key, value, keyPath)}\n color=\"text\"\n size=\"sm\"\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}: TextEditorProps) => {\n const { locale, defaultLocale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locales, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as Locales[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n const content = (section as TranslationContent<string>)[NodeType.Translation];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {localesList.map((translationKey) => (\n <Fragment key={translationKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n {getLocaleName(translationKey, locale)}\n </tr>\n <tr>\n <TextEditorContainer\n section={\n content[translationKey] ??\n getEmptyNode(content[defaultLocale])\n }\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration, removeEnumeration } = useDictionary(\n navigationViewContent\n );\n\n const content = (section as EnumerationContent<string>)[NodeType.Enumeration];\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeType.Enumeration },\n ] as KeyPath[];\n return (\n <Fragment key={enumKey}>\n <tr className=\"mt-2 w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant=\"hoverable\"\n color=\"text\"\n Icon={Trash}\n className=\"ml-auto\"\n onClick={() =>\n addEditedContent(\n dictionary.key,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </tr>\n <tr className=\"w-full p-2\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.key, newValue, keyPath);\n }}\n />\n </tr>\n <tr className=\"block w-full\">\n <TextEditor\n section={\n content[enumKey as keyof typeof content] ??\n getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n />\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n\n <Button\n label={addNewEnumeration.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.key,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const content = (section as ConditionContent<string>)[NodeType.Condition];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['true', 'false', 'fallback'].map((condKey) => (\n <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n {String(condKey)}\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content['true'])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Condition,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement, removeElement } = useDictionary(navigationViewContent);\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {(section as unknown as ContentNode[]).map((subSection, index) => (\n <Fragment key={JSON.stringify(subSection)}>\n <tr className=\"mt-2 flex w-full justify-between gap-2 p-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n className=\"ml-auto\"\n textAlign=\"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 addEditedContent(dictionary.key, undefined, newKeyPath);\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </tr>\n\n <tr className=\"block w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n />\n </tr>\n </Fragment>\n ))}\n </tbody>\n </table>\n <Button\n label={addNewElement.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n isFullWidth\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.key,\n getEmptyNode((section as unknown as ContentNode[])[0]) ?? '',\n newKeyPath,\n false\n );\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </div>\n );\n};\n\nconst ObjectTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => (\n <>\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(section as unknown as Record<string, ContentNode>).map(\n (key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n const typedSection = section as unknown as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(\n typedSection\n )[0] as keyof typeof section;\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n\n return (\n <Fragment key={key}>\n <tr\n key={JSON.stringify(subSection)}\n className=\"mt-2 p-2 text-xs\"\n >\n {String(key)}\n </tr>\n <tr key={JSON.stringify(subSection)} className=\"block w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n />\n </tr>\n </Fragment>\n );\n }\n )}\n </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n\n const content = (section as MarkdownContent)[NodeType.Markdown];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <SwitchSelector\n choices={toggleContent}\n value={mode}\n onChange={setMode}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n />\n {mode === MarkdownViewMode.Edit && (\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[...keyPath, { type: NodeType.Markdown }]}\n dictionary={dictionary}\n >\n {content}\n </ContentEditorTextArea>\n )}\n {mode === MarkdownViewMode.Preview && (\n <MarkdownRenderer isDarkMode={isDarkMode}>{content}</MarkdownRenderer>\n )}\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as NestedContent)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.Nested }] as KeyPath[];\n\n return (\n <div className=\"w-full p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.key,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\n {...props}\n >\n {content.dictionaryKey ?? ''}\n </ContentEditorInputBase>\n\n <Label>Path (optional)</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.key,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n {...props}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const { tsxNotEditable } = useDictionary(navigationViewContent);\n const nodeType = getNodeType(section);\n\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n <span>[React Node]</span>\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {tsxNotEditable}\n </span>\n </>\n );\n }\n\n if (nodeType === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n </div>\n );\n }\n\n if (nodeType === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section, null, 2)}\n {JSON.stringify(keyPath, null, 2)}\n NodeType : {nodeType}\n </div>\n );\n};\n\nexport const TextEditorContainer: FC<TextEditorProps> = (props) => (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky\"\n roundedSize=\"xl\"\n >\n <TextEditor {...props} />\n </Container>\n);\n"],"names":["ContentEditorTextAreaBase","editedContent","ContentEditorInputBase","Fragment","toggleContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAUhE,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAI,iBAAiB;AAC7D,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,EAAE,8BAA8B,WAAW,WAAA,IAC/C,gCAAgC;AAGhC,SAAA;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,iBAAiB,CAAC,aAChB,iBAAiB,WAAW,KAAK,UAAU,OAAO;AAAA,MAEpD,mBACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN,OAAM;AAAA,UACN,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QACC,SAAQ;AAAA,QACR,cAAW;AAAA,QACX;AAAA,QACA;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAAA;AAIA,MAAA,aAAa,SAAS,SAAS;AAE/B,WAAA,oBAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,MAAA;AAAA,IAAA,GAEX;AAAA,EAAA;AAKF,SAAA,qBAAC,OAAI,EAAA,WAAU,cAAa,UAAA;AAAA,IAAA;AAAA,IAEzB,KAAK,UAAU,SAAS,MAAM,CAAC;AAAA,IAC/B,KAAK,UAAU,SAAS,MAAM,CAAC;AAAA,IAAE;AAAA,IACtB;AAAA,EAAA,GACd;AAEJ;AAEa,MAAA,sBAA2C,CAAC,UACvD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,QAAM;AAAA,IACN,YAAW;AAAA,IACX,WAAU;AAAA,IACV,aAAY;AAAA,IAEZ,UAAA,oBAAC,YAAY,EAAA,GAAG,MAAO,CAAA;AAAA,EAAA;AACzB;"}
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n mode: 'local' | 'remote';\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n mode={mode}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useFocusDictionary","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAcA,4BAAAA,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAIC,+BAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAAA;AAAAA,EACF;AACA,QAAM,aAAaC,aAAA;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAC,+BAACC,wBAAAA,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n mode={mode}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useFocusDictionary","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAcA,4BAAAA,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAIC,+BAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAAA;AAAAA,EACF;AACA,QAAM,aAAaC,aAAA;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAC,+BAACC,wBAAAA,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
type DictionariesSelectorProps = {
|
|
3
3
|
onClickDictionaryList: () => void;
|
|
4
4
|
isDarkMode?: boolean;
|
|
5
|
-
mode: 'local' | 'remote';
|
|
5
|
+
mode: ('local' | 'remote')[];
|
|
6
6
|
};
|
|
7
7
|
export declare const DictionariesSelector: FC<DictionariesSelectorProps>;
|
|
8
8
|
export {};
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAOzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAOzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAiC9D,CAAC"}
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n mode: 'local' | 'remote';\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n mode={mode}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAc,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAI,mBAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8B;AAAA,IACzD;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAA,oBAAC,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n mode={mode}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAc,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAI,mBAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8B;AAAA,IACzD;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAA,oBAAC,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const reactIntlayer = require("react-intlayer");
|
|
6
6
|
const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
|
|
7
|
-
require("../../../index-
|
|
7
|
+
require("../../../index-U1U6ySIn.cjs");
|
|
8
8
|
require("@intlayer/config/client");
|
|
9
9
|
require("../../Button/Button.cjs");
|
|
10
10
|
require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useDictionary } from "react-intlayer";
|
|
4
4
|
import { useAddDictionary, useGetProjects } from "../../../hooks/intlayerAPIHooks.mjs";
|
|
5
|
-
import "../../../index-
|
|
5
|
+
import "../../../index-B1w5h_6-.js";
|
|
6
6
|
import "@intlayer/config/client";
|
|
7
7
|
import "../../Button/Button.mjs";
|
|
8
8
|
import "../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs";
|
|
@@ -10,7 +10,7 @@ require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
|
10
10
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
11
|
const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
|
|
12
12
|
require("deepmerge");
|
|
13
|
-
require("../../../index-
|
|
13
|
+
require("../../../index-U1U6ySIn.cjs");
|
|
14
14
|
require("@intlayer/config/client");
|
|
15
15
|
require("../../Button/Button.cjs");
|
|
16
16
|
require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
|
|
@@ -35,7 +35,7 @@ require("tailwind-merge");
|
|
|
35
35
|
require("../../Auth/VerifyEmailForm/index.content.cjs");
|
|
36
36
|
const components_Container_index = require("../../Container/index.cjs");
|
|
37
37
|
const components_Select_Multiselect = require("../../Select/Multiselect.cjs");
|
|
38
|
-
|
|
38
|
+
require("../../Select/Select.cjs");
|
|
39
39
|
const components_DictionaryFieldEditor_DictionaryDetails_dictionaryDetails_content = require("./dictionaryDetails.content.cjs");
|
|
40
40
|
const components_DictionaryFieldEditor_DictionaryDetails_useDictionaryDetailsSchema = require("./useDictionaryDetailsSchema.cjs");
|
|
41
41
|
const DictionaryDetailsForm = ({
|
|
@@ -47,41 +47,35 @@ const DictionaryDetailsForm = ({
|
|
|
47
47
|
const { setLocaleDictionary } = editorReact.useDictionariesRecordActions();
|
|
48
48
|
const { pushDictionaries } = hooks_intlayerAPIHooks.usePushDictionaries();
|
|
49
49
|
const { data: projects, isLoading: isLoadingProjects } = hooks_intlayerAPIHooks.useGetProjects();
|
|
50
|
-
const { data: tags
|
|
51
|
-
const dictionaryValue = {
|
|
52
|
-
...dictionary,
|
|
53
|
-
version: dictionary.version ?? "-1"
|
|
54
|
-
};
|
|
50
|
+
const { data: tags } = hooks_intlayerAPIHooks.useGetTags();
|
|
55
51
|
const DictionaryDetailsSchema = components_DictionaryFieldEditor_DictionaryDetails_useDictionaryDetailsSchema.useDictionaryDetailsSchema(
|
|
56
52
|
String(project?._id)
|
|
57
53
|
);
|
|
58
54
|
const { form, isSubmitting } = components_Form_FormBase.useForm(DictionaryDetailsSchema, {
|
|
59
|
-
defaultValues:
|
|
55
|
+
defaultValues: dictionary
|
|
60
56
|
});
|
|
57
|
+
const { editedContent, setEditedDictionary } = editorReact.useEditedContent();
|
|
61
58
|
const {
|
|
62
59
|
titleInput,
|
|
63
60
|
keyInput,
|
|
64
61
|
descriptionInput,
|
|
65
|
-
publishedVersionSelect,
|
|
66
|
-
publishButton,
|
|
67
|
-
saveButton,
|
|
68
62
|
projectInput,
|
|
69
63
|
tagsSelect,
|
|
70
|
-
auditButton
|
|
71
|
-
downloadButton
|
|
64
|
+
auditButton
|
|
72
65
|
} = reactIntlayer.useDictionary(components_DictionaryFieldEditor_DictionaryDetails_dictionaryDetails_content.dictionaryDetailsContent);
|
|
73
66
|
const { auditContentDeclaration, isLoading: isAuditing } = hooks_intlayerAPIHooks.useAuditContentDeclarationMetadata();
|
|
74
67
|
const { writeDictionary } = hooks_intlayerAPIHooks.useWriteDictionary();
|
|
68
|
+
const updatedDictionary = editedContent?.[dictionary.key];
|
|
75
69
|
ReactExports.useEffect(() => {
|
|
76
|
-
form.reset(
|
|
70
|
+
form.reset(dictionary);
|
|
77
71
|
}, [dictionary, form?.reset]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
ReactExports.useEffect(() => {
|
|
73
|
+
if (typeof updatedDictionary === "undefined") {
|
|
74
|
+
form.reset(dictionary);
|
|
75
|
+
}
|
|
76
|
+
}, [updatedDictionary]);
|
|
77
|
+
const onSubmitSuccess = async () => {
|
|
78
|
+
if (!updatedDictionary) return;
|
|
85
79
|
if (mode === "remote") {
|
|
86
80
|
await pushDictionaries([updatedDictionary]);
|
|
87
81
|
} else {
|
|
@@ -90,33 +84,30 @@ const DictionaryDetailsForm = ({
|
|
|
90
84
|
setLocaleDictionary(updatedDictionary);
|
|
91
85
|
};
|
|
92
86
|
const handleOnAuditFile = async () => {
|
|
93
|
-
const
|
|
87
|
+
const dictionaryToAudit = {
|
|
88
|
+
...dictionary,
|
|
89
|
+
...updatedDictionary
|
|
90
|
+
};
|
|
94
91
|
await auditContentDeclaration({
|
|
95
|
-
fileContent: JSON.stringify(
|
|
92
|
+
fileContent: JSON.stringify(dictionaryToAudit)
|
|
96
93
|
}).then((response) => {
|
|
97
|
-
if (!response
|
|
94
|
+
if (!response?.data) return;
|
|
98
95
|
try {
|
|
99
|
-
const
|
|
96
|
+
const auditedDictionary = JSON.parse(response.data.fileContent);
|
|
97
|
+
setEditedDictionary((prev) => ({
|
|
98
|
+
...prev,
|
|
99
|
+
...dictionaryToAudit,
|
|
100
|
+
...auditedDictionary
|
|
101
|
+
}));
|
|
100
102
|
form.reset({
|
|
101
|
-
...
|
|
102
|
-
...
|
|
103
|
-
publishedVersion: updatedDictionary.publishedVersion ?? "-1"
|
|
103
|
+
...dictionaryToAudit,
|
|
104
|
+
...auditedDictionary
|
|
104
105
|
});
|
|
105
106
|
} catch (error) {
|
|
106
107
|
console.error(error);
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
110
|
};
|
|
110
|
-
const isLoading = isSubmitting || isLoadingTags;
|
|
111
|
-
const { editedContent } = editorReact.useEditedContent();
|
|
112
|
-
const editedDictionary = ReactExports.useMemo(
|
|
113
|
-
() => editedContent?.[dictionary.key],
|
|
114
|
-
[editedContent, dictionary.key]
|
|
115
|
-
);
|
|
116
|
-
const isEdited = ReactExports.useMemo(
|
|
117
|
-
() => editedDictionary && dictionary && JSON.stringify(editedDictionary.content) !== JSON.stringify(dictionary.content),
|
|
118
|
-
[dictionary, editedDictionary]
|
|
119
|
-
);
|
|
120
111
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
112
|
components_Container_index.Container,
|
|
122
113
|
{
|
|
@@ -130,6 +121,10 @@ const DictionaryDetailsForm = ({
|
|
|
130
121
|
className: "flex w-full flex-col gap-8",
|
|
131
122
|
...form,
|
|
132
123
|
schema: DictionaryDetailsSchema,
|
|
124
|
+
onChange: (data) => setEditedDictionary((prev) => ({
|
|
125
|
+
...prev,
|
|
126
|
+
...data
|
|
127
|
+
})),
|
|
133
128
|
onSubmitSuccess,
|
|
134
129
|
children: [
|
|
135
130
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-1 gap-8 max-md:flex-col", children: [
|
|
@@ -141,7 +136,15 @@ const DictionaryDetailsForm = ({
|
|
|
141
136
|
placeholder: keyInput.label.value,
|
|
142
137
|
description: keyInput.description,
|
|
143
138
|
disabled: isSubmitting,
|
|
144
|
-
isRequired: true
|
|
139
|
+
isRequired: true,
|
|
140
|
+
onSave: (value) => {
|
|
141
|
+
form.setValue("key", value);
|
|
142
|
+
setEditedDictionary((prev) => ({
|
|
143
|
+
...dictionary,
|
|
144
|
+
...prev ?? {},
|
|
145
|
+
key: value
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
145
148
|
}
|
|
146
149
|
),
|
|
147
150
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -151,7 +154,15 @@ const DictionaryDetailsForm = ({
|
|
|
151
154
|
label: titleInput.label,
|
|
152
155
|
placeholder: titleInput.placeholder.value,
|
|
153
156
|
description: titleInput.description,
|
|
154
|
-
disabled: isSubmitting
|
|
157
|
+
disabled: isSubmitting,
|
|
158
|
+
onSave: (value) => {
|
|
159
|
+
form.setValue("title", value);
|
|
160
|
+
setEditedDictionary((prev) => ({
|
|
161
|
+
...dictionary,
|
|
162
|
+
...prev ?? {},
|
|
163
|
+
title: value
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
155
166
|
}
|
|
156
167
|
)
|
|
157
168
|
] }),
|
|
@@ -162,7 +173,15 @@ const DictionaryDetailsForm = ({
|
|
|
162
173
|
label: descriptionInput.label,
|
|
163
174
|
placeholder: descriptionInput.placeholder.value,
|
|
164
175
|
description: descriptionInput.description,
|
|
165
|
-
disabled: isSubmitting
|
|
176
|
+
disabled: isSubmitting,
|
|
177
|
+
onSave: (value) => {
|
|
178
|
+
form.setValue("description", value);
|
|
179
|
+
setEditedDictionary((prev) => ({
|
|
180
|
+
...dictionary,
|
|
181
|
+
...prev ?? {},
|
|
182
|
+
description: value
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
166
185
|
}
|
|
167
186
|
),
|
|
168
187
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-1 gap-8 max-md:flex-col", children: [
|
|
@@ -172,6 +191,15 @@ const DictionaryDetailsForm = ({
|
|
|
172
191
|
name: "projectIds",
|
|
173
192
|
label: projectInput.label.value,
|
|
174
193
|
description: projectInput.description.value,
|
|
194
|
+
onValueChange: (value) => {
|
|
195
|
+
const valueArray = [value].flat();
|
|
196
|
+
form.setValue("projectIds", valueArray);
|
|
197
|
+
setEditedDictionary((prev) => ({
|
|
198
|
+
...dictionary,
|
|
199
|
+
...prev ?? {},
|
|
200
|
+
projectIds: valueArray
|
|
201
|
+
}));
|
|
202
|
+
},
|
|
175
203
|
children: [
|
|
176
204
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
177
205
|
components_Select_Multiselect.MultiSelect.Trigger,
|
|
@@ -197,6 +225,14 @@ const DictionaryDetailsForm = ({
|
|
|
197
225
|
name: "tags",
|
|
198
226
|
label: tagsSelect.label.value,
|
|
199
227
|
description: tagsSelect.description.value,
|
|
228
|
+
onValueChange: (value) => {
|
|
229
|
+
form.setValue("tags", [value].flat());
|
|
230
|
+
setEditedDictionary((prev) => ({
|
|
231
|
+
...dictionary,
|
|
232
|
+
...prev ?? {},
|
|
233
|
+
tags: [value].flat()
|
|
234
|
+
}));
|
|
235
|
+
},
|
|
200
236
|
children: [
|
|
201
237
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
202
238
|
components_Select_Multiselect.MultiSelect.Trigger,
|
|
@@ -217,85 +253,21 @@ const DictionaryDetailsForm = ({
|
|
|
217
253
|
}
|
|
218
254
|
)
|
|
219
255
|
] }),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_Select_Select.Select.Item, { value: "-1", children: "LTS" }),
|
|
236
|
-
dictionary.availableVersions?.map(
|
|
237
|
-
(version) => /* @__PURE__ */ jsxRuntime.jsx(components_Select_Select.Select.Item, { value: version, children: version }, version)
|
|
238
|
-
)
|
|
239
|
-
] })
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full" })
|
|
244
|
-
] }),
|
|
245
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 max-md:flex-col", children: [
|
|
246
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
247
|
-
components_Form_layout_FormItemLayout.Form.Button,
|
|
248
|
-
{
|
|
249
|
-
type: "button",
|
|
250
|
-
label: auditButton.label.value,
|
|
251
|
-
Icon: lucideReact.WandSparkles,
|
|
252
|
-
variant: "outline",
|
|
253
|
-
color: "text",
|
|
254
|
-
className: "max-md:w-full",
|
|
255
|
-
onClick: handleOnAuditFile,
|
|
256
|
-
disabled: isSubmitting || isAuditing,
|
|
257
|
-
isLoading: isAuditing,
|
|
258
|
-
children: auditButton.text
|
|
259
|
-
}
|
|
260
|
-
),
|
|
261
|
-
mode === "remote" ? isLocalDictionary ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
262
|
-
components_Form_layout_FormItemLayout.Form.Button,
|
|
263
|
-
{
|
|
264
|
-
type: "submit",
|
|
265
|
-
label: publishButton.label.value,
|
|
266
|
-
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
267
|
-
Icon: lucideReact.ArrowUpFromLine,
|
|
268
|
-
color: "text",
|
|
269
|
-
className: "max-md:w-full",
|
|
270
|
-
isLoading: isSubmitting,
|
|
271
|
-
children: publishButton.text
|
|
272
|
-
}
|
|
273
|
-
) : isEdited && /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
|
-
components_Form_layout_FormItemLayout.Form.Button,
|
|
275
|
-
{
|
|
276
|
-
type: "submit",
|
|
277
|
-
label: saveButton.label.value,
|
|
278
|
-
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
279
|
-
Icon: lucideReact.Save,
|
|
280
|
-
color: "text",
|
|
281
|
-
className: "max-md:w-full",
|
|
282
|
-
isLoading: isSubmitting,
|
|
283
|
-
children: saveButton.text
|
|
284
|
-
}
|
|
285
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
-
components_Form_layout_FormItemLayout.Form.Button,
|
|
287
|
-
{
|
|
288
|
-
type: "submit",
|
|
289
|
-
label: downloadButton.label.value,
|
|
290
|
-
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
291
|
-
Icon: lucideReact.Download,
|
|
292
|
-
color: "text",
|
|
293
|
-
className: "max-md:w-full",
|
|
294
|
-
isLoading: isSubmitting,
|
|
295
|
-
children: downloadButton.text
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] })
|
|
256
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center justify-end gap-2 max-md:flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
257
|
+
components_Form_layout_FormItemLayout.Form.Button,
|
|
258
|
+
{
|
|
259
|
+
type: "button",
|
|
260
|
+
label: auditButton.label.value,
|
|
261
|
+
Icon: lucideReact.WandSparkles,
|
|
262
|
+
variant: "outline",
|
|
263
|
+
color: "text",
|
|
264
|
+
className: "max-md:w-full",
|
|
265
|
+
onClick: handleOnAuditFile,
|
|
266
|
+
disabled: isSubmitting || isAuditing,
|
|
267
|
+
isLoading: isAuditing,
|
|
268
|
+
children: auditButton.text
|
|
269
|
+
}
|
|
270
|
+
) })
|
|
299
271
|
]
|
|
300
272
|
}
|
|
301
273
|
)
|
package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryDetailsForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type {\n DictionaryAPI,\n Dictionary as DistantDictionary,\n} from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, Save, WandSparkles } from 'lucide-react';\nimport { type FC, useEffect, useMemo } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\nimport { Container } from '../../Container';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect, Select } from '../../Select';\nimport { dictionaryDetailsContent } from './dictionaryDetails.content';\nimport {\n type DictionaryDetailsFormData,\n useDictionaryDetailsSchema,\n} from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { pushDictionaries } = usePushDictionaries();\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags, isLoading: isLoadingTags } = useGetTags();\n const dictionaryValue = {\n ...dictionary,\n version: dictionary.version ?? '-1',\n };\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?._id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionaryValue,\n });\n const {\n titleInput,\n keyInput,\n descriptionInput,\n publishedVersionSelect,\n publishButton,\n saveButton,\n projectInput,\n tagsSelect,\n auditButton,\n downloadButton,\n } = useDictionary(dictionaryDetailsContent);\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const { writeDictionary } = useWriteDictionary();\n\n useEffect(() => {\n form.reset(dictionaryValue);\n }, [dictionary, form?.reset]);\n\n const isFormEdited = form.formState.isDirty;\n const isLocalDictionary =\n typeof (dictionary as DistantDictionary)?._id === 'undefined';\n\n const onSubmitSuccess = async (data: DictionaryDetailsFormData) => {\n const updatedDictionary = {\n ...dictionary,\n ...data,\n };\n\n if (mode === 'remote') {\n await pushDictionaries([updatedDictionary]);\n } else {\n await writeDictionary(updatedDictionary);\n }\n\n setLocaleDictionary(updatedDictionary);\n };\n\n const handleOnAuditFile = async () => {\n const updatedDictionary = form.getValues();\n await auditContentDeclaration({\n fileContent: JSON.stringify({ ...dictionary, ...updatedDictionary }),\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n form.reset({\n ...updatedDictionary,\n ...editedDictionary,\n publishedVersion: updatedDictionary.publishedVersion ?? '-1',\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n const isLoading = isSubmitting || isLoadingTags;\n\n const { editedContent } = useEditedContent();\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n dictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(dictionary.content),\n [dictionary, editedDictionary]\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 onSubmitSuccess={onSubmitSuccess}\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 />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\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 />\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 >\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 >\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 {((dictionary as DictionaryAPI).availableVersions?.length ?? 0) > 1 && (\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.Select\n name=\"publishedVersion\"\n description={publishedVersionSelect.description.value}\n label={publishedVersionSelect.label}\n >\n <Select.Trigger>\n <Select.Value\n placeholder={publishedVersionSelect.placeholder.value}\n />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"-1\">LTS</Select.Item>\n {(dictionary as DictionaryAPI).availableVersions?.map(\n (version) => (\n <Select.Item value={version} key={version}>\n {version}\n </Select.Item>\n )\n )}\n </Select.Content>\n </Form.Select>\n <div className=\"w-full\" />\n </div>\n )}\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=\"outline\"\n color=\"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\n {mode === 'remote' ? (\n isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )\n ) : (\n <Form.Button\n type=\"submit\"\n label={downloadButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Download}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n </div>\n </Form>\n </Container>\n );\n};\n"],"names":["useAuth","useDictionariesRecordActions","usePushDictionaries","useGetProjects","useGetTags","useDictionaryDetailsSchema","useForm","useDictionary","dictionaryDetailsContent","useAuditContentDeclarationMetadata","useWriteDictionary","useEffect","editedDictionary","useEditedContent","useMemo","jsx","Container","jsxs","Form","MultiSelect","project","Loader","Select","WandSparkles","ArrowUpFromLine","Save","Download"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ,IAAIA,sCAAQ;A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;AAAA,kBAC3C,MAAMM,YAAA;AAAA,kBACN,OAAM;AAAA,kBACN,WAAU;AAAA,kBACV,WAAW;AAAA,kBAEV,UAAc,cAAA;AAAA,gBAAA;AAAA,kBAGjB,YACET,2BAAA;AAAA,gBAACG,sCAAAA,KAAK;AAAA,gBAAL;AAAA,kBACC,MAAK;AAAA,kBACL,OAAO,WAAW,MAAM;AAAA,kBACxB,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,kBAC3C,MAAMO,YAAA;AAAA,kBACN,OAAM;AAAA,kBACN,WAAU;AAAA,kBACV,WAAW;AAAA,kBAEV,UAAW,WAAA;AAAA,gBAAA;AAAA,cAAA,IAKlBV,2BAAA;AAAA,gBAACG,sCAAAA,KAAK;AAAA,gBAAL;AAAA,kBACC,MAAK;AAAA,kBACL,OAAO,eAAe,MAAM;AAAA,kBAC5B,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,kBAC3C,MAAMQ,YAAA;AAAA,kBACN,OAAM;AAAA,kBACN,WAAU;AAAA,kBACV,WAAW;AAAA,kBAEV,UAAe,eAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAClB,EAEJ,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"DictionaryDetailsForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} 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 usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\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 mode: ('local' | 'remote')[];\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { pushDictionaries } = usePushDictionaries();\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 { writeDictionary } = useWriteDictionary();\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 onSubmitSuccess = async () => {\n if (!updatedDictionary) return;\n\n if (mode === 'remote') {\n await pushDictionaries([updatedDictionary]);\n } else {\n await writeDictionary(updatedDictionary);\n }\n\n setLocaleDictionary(updatedDictionary);\n };\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 onSubmitSuccess={onSubmitSuccess}\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=\"outline\"\n color=\"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","useDictionariesRecordActions","usePushDictionaries","useGetProjects","useGetTags","useDictionaryDetailsSchema","useForm","useEditedContent","useDictionary","dictionaryDetailsContent","useAuditContentDeclarationMetadata","useWriteDictionary","useEffect","jsx","Container","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