@intlayer/design-system 5.1.2 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +12 -23
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
- package/dist/components/Container/index.cjs +5 -2
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.d.ts +1 -1
- package/dist/components/Container/index.d.ts.map +1 -1
- package/dist/components/Container/index.mjs +5 -2
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +27 -6
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +27 -6
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +278 -214
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +2 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +281 -217
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +5 -3
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts +5 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +5 -3
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
- 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 -13
- 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 -14
- 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 +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +6 -16
- 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 +7 -17
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +8 -7
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts +7 -0
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +11 -10
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.cjs +2 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/getIsEditableSection.mjs.map +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.d.ts +1 -1
- package/dist/components/MarkDownRender/index.d.ts.map +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.cjs +1 -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 +1 -1
- package/dist/components/MaxHeightSmoother/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/index-BCuMWKyy.js.map +1 -1
- package/dist/{index-BKE0uywA.js → index-BTDHuTxL.js} +2 -2
- package/dist/index-BTDHuTxL.js.map +1 -0
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/{index-CsenS2hX.cjs → index-Db5Dym4h.cjs} +2 -2
- package/dist/index-Db5Dym4h.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 -44
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts +0 -9
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs +0 -44
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs.map +0 -1
- package/dist/index-BKE0uywA.js.map +0 -1
- package/dist/index-CsenS2hX.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 { 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 {\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};\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\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[...keyPath, { type: NodeType.Markdown }]}\n dictionary={dictionary}\n >\n {(section as MarkdownContent)[NodeType.Markdown]}\n </ContentEditorTextArea>\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}) => {\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 />\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,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,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,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 { 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, 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 <>\n <ObjectTextEditor\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, 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","ContentEditorInputBase","Fragment","toggleContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CO,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;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AAA,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/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-Db5Dym4h.cjs");
|
|
8
8
|
require("@intlayer/config/client");
|
|
9
9
|
require("../../Button/Button.cjs");
|
|
10
10
|
require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
|
|
@@ -36,7 +36,9 @@ const components_Select_Multiselect = require("../../Select/Multiselect.cjs");
|
|
|
36
36
|
require("../../Select/Select.cjs");
|
|
37
37
|
const components_DictionaryFieldEditor_DictionaryCreationForm_dictionaryCreationForm_content = require("./dictionaryCreationForm.content.cjs");
|
|
38
38
|
const components_DictionaryFieldEditor_DictionaryCreationForm_useDictionaryFormSchema = require("./useDictionaryFormSchema.cjs");
|
|
39
|
-
const DictionaryCreationForm = (
|
|
39
|
+
const DictionaryCreationForm = ({
|
|
40
|
+
onDictionaryCreated
|
|
41
|
+
}) => {
|
|
40
42
|
const { session } = components_Auth_useAuth_index.useAuth();
|
|
41
43
|
const { project } = session ?? {};
|
|
42
44
|
const { addDictionary } = hooks_intlayerAPIHooks.useAddDictionary();
|
|
@@ -47,7 +49,7 @@ const DictionaryCreationForm = () => {
|
|
|
47
49
|
components_DictionaryFieldEditor_DictionaryCreationForm_dictionaryCreationForm_content.dictionaryFormContent
|
|
48
50
|
);
|
|
49
51
|
const onSubmitSuccess = async (data) => {
|
|
50
|
-
await addDictionary(data);
|
|
52
|
+
await addDictionary(data).then(() => onDictionaryCreated?.());
|
|
51
53
|
};
|
|
52
54
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
53
55
|
components_Form_layout_FormItemLayout.Form,
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\nexport const DictionaryCreationForm: FC = () => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data);\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\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 <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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel.value}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["useAuth","useAddDictionary","useGetProjects","useDictionarySchema","useForm","useDictionary","dictionaryFormContent","jsxs","Form","jsx","MultiSelect","project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data).then(() => onDictionaryCreated?.());\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\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 <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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel.value}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["useAuth","useAddDictionary","useGetProjects","useDictionarySchema","useForm","useDictionary","dictionaryFormContent","jsxs","Form","jsx","MultiSelect","project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM;AACE,QAAA,EAAE,QAAQ,IAAIA,sCAAQ;AAC5B,QAAM,EAAE,YAAY,WAAW,CAAC;AAC1B,QAAA,EAAE,cAAc,IAAIC,wCAAiB;AAC3C,QAAM,EAAE,MAAM,SAAS,IAAIC,sCAAe;AAC1C,QAAM,mBAAmBC,gFAAA,oBAAoB,O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AA,UAK1B,CAAA,EACH,CAAA,EACF,CAAA;AAAA,QAAA,GACF;AAAA,QAEAF,2BAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,WAAU;AAAA,YACV,MAAK;AAAA,YACL,OAAM;AAAA,YACN,WAAW;AAAA,YACX,OAAO,uBAAuB,UAAU;AAAA,YAEvC,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
|
|
2
|
+
type DictionaryCreationFormProps = {
|
|
3
|
+
onDictionaryCreated?: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const DictionaryCreationForm: FC<DictionaryCreationFormProps>;
|
|
6
|
+
export {};
|
|
3
7
|
//# sourceMappingURL=DictionaryCreationForm.d.ts.map
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAehC,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAehC,KAAK,2BAA2B,GAAG;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAiElE,CAAC"}
|
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-BTDHuTxL.js";
|
|
6
6
|
import "@intlayer/config/client";
|
|
7
7
|
import "../../Button/Button.mjs";
|
|
8
8
|
import "../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs";
|
|
@@ -34,7 +34,9 @@ import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
|
34
34
|
import "../../Select/Select.mjs";
|
|
35
35
|
import { dictionaryFormContent } from "./dictionaryCreationForm.content.mjs";
|
|
36
36
|
import { useDictionarySchema } from "./useDictionaryFormSchema.mjs";
|
|
37
|
-
const DictionaryCreationForm = (
|
|
37
|
+
const DictionaryCreationForm = ({
|
|
38
|
+
onDictionaryCreated
|
|
39
|
+
}) => {
|
|
38
40
|
const { session } = useAuth();
|
|
39
41
|
const { project } = session ?? {};
|
|
40
42
|
const { addDictionary } = useAddDictionary();
|
|
@@ -45,7 +47,7 @@ const DictionaryCreationForm = () => {
|
|
|
45
47
|
dictionaryFormContent
|
|
46
48
|
);
|
|
47
49
|
const onSubmitSuccess = async (data) => {
|
|
48
|
-
await addDictionary(data);
|
|
50
|
+
await addDictionary(data).then(() => onDictionaryCreated?.());
|
|
49
51
|
};
|
|
50
52
|
return /* @__PURE__ */ jsxs(
|
|
51
53
|
Form,
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\nexport const DictionaryCreationForm: FC = () => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data);\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\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 <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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel.value}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data).then(() => onDictionaryCreated?.());\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\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 <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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel.value}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM;AACE,QAAA,EAAE,QAAQ,IAAI,QAAQ;AAC5B,QAAM,EAAE,YAAY,WAAW,CAAC;AAC1B,QAAA,EAAE,cAAc,IAAI,iBAAiB;AAC3C,QAAM,EAAE,MAAM,SAAS,IAAI,eAAe;AAC1C,QAAM,mBAAmB,oBAAoB,OAAO,SAAS,GAAG,CAAC;AACjE,QAAM,EAAE,MAAM,iBAAiB,QAAQ,gBAAgB;AACvD,QAAM,EAAE,UAAU,wBAAwB,aAAiB,IAAA;AAAA,IACzD;AAAA,EACF;AAEM,QAAA,kBAAkB,OAAO,SAA6B;AAC1D,UAAM,cAAc,IAAI,EAAE,KAAK,MAAM,uBAAuB;AAAA,EAC9D;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA,WAAU;AAAA,MACT,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,SAAS,MAAM;AAAA,YACtB,aAAa,SAAS,YAAY;AAAA,YAClC,YAAU;AAAA,UAAA;AAAA,QACZ;AAAA,QAEA,qBAAC,KAAK,aAAL,EAAiB,MAAK,cAAa,OAAO,aAAa,MAAM,OAC5D,UAAA;AAAA,UAAA;AAAA,YAAC,YAAY;AAAA,YAAZ;AAAA,cACC,eAAe,CAAC,UACd,UAAU,MAAM,KAAK,CAACA,aAAY,OAAOA,SAAQ,GAAG,MAAM,KAAK,GAC3D,QAAQ;AAAA,cAGd,8BAAC,YAAY,OAAZ,EAAkB,aAAa,aAAa,YAAY,MAAO,CAAA;AAAA,YAAA;AAAA,UAClE;AAAA,UACC,oBAAA,YAAY,SAAZ,EACC,UAAC,oBAAA,YAAY,MAAZ,EACE,UAAU,UAAA,MAAM,IAAI,CAACA,aACpB;AAAA,YAAC,YAAY;AAAA,YAAZ;AAAA,cAEC,OAAO,OAAOA,SAAQ,GAAG;AAAA,cAExB,UAAAA,SAAQ;AAAA,YAAA;AAAA,YAHJ,OAAOA,SAAQ,GAAG;AAAA,UAK1B,CAAA,EACH,CAAA,EACF,CAAA;AAAA,QAAA,GACF;AAAA,QAEA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,WAAU;AAAA,YACV,MAAK;AAAA,YACL,OAAM;AAAA,YACN,WAAW;AAAA,YACX,OAAO,uBAAuB,UAAU;AAAA,YAEvC,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -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-Db5Dym4h.cjs");
|
|
14
14
|
require("@intlayer/config/client");
|
|
15
15
|
require("../../Button/Button.cjs");
|
|
16
16
|
require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
|
|
@@ -8,7 +8,7 @@ import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
|
8
8
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
9
|
import { usePushDictionaries, useGetProjects, useGetTags, useAuditContentDeclarationMetadata, useWriteDictionary } from "../../../hooks/intlayerAPIHooks.mjs";
|
|
10
10
|
import "deepmerge";
|
|
11
|
-
import "../../../index-
|
|
11
|
+
import "../../../index-BTDHuTxL.js";
|
|
12
12
|
import "@intlayer/config/client";
|
|
13
13
|
import "../../Button/Button.mjs";
|
|
14
14
|
import "../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs";
|
|
@@ -123,7 +123,7 @@ const DictionaryFieldEditor = ({
|
|
|
123
123
|
),
|
|
124
124
|
editorView === 0 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_DictionaryDetails_DictionaryDetailsForm.DictionaryDetailsForm, { dictionary, mode }),
|
|
125
125
|
editorView === 2 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_StructureEditor.StructureEditor, { dictionary }),
|
|
126
|
-
editorView === 1 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_ContentEditor.ContentEditor, { dictionary }),
|
|
126
|
+
editorView === 1 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_ContentEditor.ContentEditor, { dictionary, isDarkMode }),
|
|
127
127
|
editorView === 3 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_JSONEditor.JSONEditor, { dictionary, isDarkMode }),
|
|
128
128
|
/* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode })
|
|
129
129
|
]
|
|
@@ -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 } from '../Button';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } 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 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}) => {\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-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"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 !(mode === 'local' && value === EditorViewType.DetailsEditor)\n )}\n />\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ArrowLeft","Container","SwitchSelector","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2BC,cAAA;AAAA,IACjCC,+DAAAA;AAAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAIC,sCAA0B;AAClD,QAAA,EAAE,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AAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBACT;AAAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBACT;AAAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBAAA;AAAA,kBACT,EACA;AAAA,oBACA,CAAC,EAAE,MAAA,MACD,EAAE,SAAS,WAAW,UAAU;AAAA,kBAAA;AAAA,gBACpC;AAAA,cACF;AAAA,cACC,eAAe,KACbN,2BAAA,IAAAO,yEAAA,uBAAA,EAAsB,YAAwB,MAAY;AAAA,cAE5D,eAAe,KACbP,2BAAAA,IAAAQ,iDAAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,cAE1C,eAAe,KACbR,
|
|
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 } from '../Button';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } 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 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}) => {\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-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"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 !(mode === 'local' && value === EditorViewType.DetailsEditor)\n )}\n />\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\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 <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ArrowLeft","Container","SwitchSelector","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2BC,cAAA;AAAA,IACjCC,+DAAAA;AAAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAIC,sCAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAIC,yCAA6B;AAE/DC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAC;AAAA,MACb,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,EAAE;AAGH,SAAAC,2BAAA;AAAA,IAACC,sEAAA;AAAA,IAAA;AAAA,MACC,kBAAkB,OAAO,qBAAqB,WAAW,CAAC;AAAA,MAE1D,UAAAC,2BAAA,KAAC,OAAI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BAAAA,IAAAQ,iDAAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,cAE1C,eAAe,KACbR,2BAAA,IAAAS,+CAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,cAEhE,eAAe,KACbT,2BAAA,IAAAU,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,cAE9DV,2BAAAA,IAACW,mDAAS,UAAA,EAAA,YAAwB,KAAY,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAChD,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
|
@@ -121,7 +121,7 @@ const DictionaryFieldEditor = ({
|
|
|
121
121
|
),
|
|
122
122
|
editorView === 0 && /* @__PURE__ */ jsx(DictionaryDetailsForm, { dictionary, mode }),
|
|
123
123
|
editorView === 2 && /* @__PURE__ */ jsx(StructureEditor, { dictionary }),
|
|
124
|
-
editorView === 1 && /* @__PURE__ */ jsx(ContentEditor, { dictionary }),
|
|
124
|
+
editorView === 1 && /* @__PURE__ */ jsx(ContentEditor, { dictionary, isDarkMode }),
|
|
125
125
|
editorView === 3 && /* @__PURE__ */ jsx(JSONEditor, { dictionary, isDarkMode }),
|
|
126
126
|
/* @__PURE__ */ jsx(SaveForm, { dictionary, mode })
|
|
127
127
|
]
|
|
@@ -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 } from '../Button';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } 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 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}) => {\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-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"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 !(mode === 'local' && value === EditorViewType.DetailsEditor)\n )}\n />\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2B;AAAA,IACjC;AAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAI,0BAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAI,6BAA6B;AAE/D,YAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAC;AAAA,MACb,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,EAAE;AAGH,SAAA;AAAA,IAAC;AAAA,IAAA;AAA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AAgB,WAAwB,CAAA;AAAA,cAE1C,eAAe,KACb,oBAAA,eAAA,EAAc,
|
|
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 } from '../Button';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } 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 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}) => {\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-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"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 !(mode === 'local' && value === EditorViewType.DetailsEditor)\n )}\n />\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\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 <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM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AAA,kBACV,SAAS;AAAA,oBACP;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBACT;AAAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBACT;AAAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBACT;AAAA,oBACA;AAAA,sBACE,SAAS;AAAA,sBACT,OAAO;AAAA;AAAA,oBAAA;AAAA,kBACT,EACA;AAAA,oBACA,CAAC,EAAE,MAAA,MACD,EAAE,SAAS,WAAW,UAAU;AAAA,kBAAA;AAAA,gBACpC;AAAA,cACF;AAAA,cACC,eAAe,KACb,oBAAA,uBAAA,EAAsB,YAAwB,MAAY;AAAA,cAE5D,eAAe,KACb,oBAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,cAE1C,eAAe,KACb,oBAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,cAEhE,eAAe,KACb,oBAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,cAE9D,oBAAC,UAAS,EAAA,YAAwB,KAAY,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAChD,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumKeyInput.cjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"w-
|
|
1
|
+
{"version":3,"file":"EnumKeyInput.cjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"min-w-4\"\n />\n </div>\n );\n};\n"],"names":["useMemo","useState","useEffect","jsxs","Select","jsx","Input"],"mappings":";;;;;;;;;;AAMA,MAAM,sBAAsB,CAC1B,UACwE;AACpE,MAAA;AACA,MAAA;AAEA,MAAA,OAAO,UAAU,YAAY,CAAC,MAAM,OAAO,KAAK,CAAC,GAAG;AAEzC,iBAAA;AACb,kBAAc,MAAM,SAAS;AAAA,EAAA,WACpB,OAAO,UAAU,UAAU;AAEpC,UAAM,cAAc,CAAC,MAAM,MAAM,KAAK,KAAK,GAAG;AAE9C,UAAM,oBAAoB,YAAY;AAAA,MAAK,CAAC,SAC1C,MAAM,WAAW,IAAI;AAAA,IACvB;AACA,QAAI,mBAAmB;AACR,mBAAA;AACC,oBAAA,MAAM,MAAM,kBAAkB,MAAM;AAAA,IAAA;AAAA,EACpD;AAGK,SAAA,EAAE,YAAY,YAAY;AACnC;AAkBO,MAAM,eAAsC,CAAC,EAAE,OAAO,eAAe;AAC1E,QAAM,EAAE,YAAY,mBAAmB,aAAa,mBAAmB,IACrEA,qBAAQ,MAAM,oBAAoB,KAAK,GAAG,CAAC,KAAK,CAAC;AAC7C,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC,qBAAqB;AAAA,EACvB;AACM,QAAA,CAAC,aAAa,cAAc,IAAIA,aAAA;AAAA,IACpC,sBAAsB;AAAA,EACxB;AAEAC,eAAAA,UAAU,MAAM;AACd,QACE,cACA,gBACC,eAAe,qBAAqB,gBAAgB,qBACrD;AACA,YAAM,WAAW,GAAG,UAAU,GAAG,WAAW;AAE5C,eAAS,QAAQ;AAAA,IAAA;AAAA,EACnB,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGC,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,IAAAA,2BAAA,KAACC,yBAAO,QAAA,EAAA,eAAe,eAAe,cAAc,mBAClD,UAAA;AAAA,MAACC,2BAAAA,IAAAD,yBAAAA,OAAO,SAAP,EAAe,WAAU,QACxB,UAACC,+BAAAD,yBAAAA,OAAO,OAAP,EAAa,aAAY,sBAAA,CAAsB,EAClD,CAAA;AAAA,MACAD,2BAAAA,KAACC,yBAAO,OAAA,SAAP,EACC,UAAA;AAAA,QAAAC,+BAACD,yBAAAA,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,uCAC3BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,uCAC7BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,uCAC3BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,uCAC7BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,IAAA,CAAA;AAAA,MAAA,EAC9B,CAAA;AAAA,IAAA,GACF;AAAA,IACAC,2BAAA;AAAA,MAACC,uBAAA;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAc,eAAe;AAAA,QAC7B,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,QAC9C,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumKeyInput.mjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"w-
|
|
1
|
+
{"version":3,"file":"EnumKeyInput.mjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"min-w-4\"\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,sBAAsB,CAC1B,UACwE;AACpE,MAAA;AACA,MAAA;AAEA,MAAA,OAAO,UAAU,YAAY,CAAC,MAAM,OAAO,KAAK,CAAC,GAAG;AAEzC,iBAAA;AACb,kBAAc,MAAM,SAAS;AAAA,EAAA,WACpB,OAAO,UAAU,UAAU;AAEpC,UAAM,cAAc,CAAC,MAAM,MAAM,KAAK,KAAK,GAAG;AAE9C,UAAM,oBAAoB,YAAY;AAAA,MAAK,CAAC,SAC1C,MAAM,WAAW,IAAI;AAAA,IACvB;AACA,QAAI,mBAAmB;AACR,mBAAA;AACC,oBAAA,MAAM,MAAM,kBAAkB,MAAM;AAAA,IAAA;AAAA,EACpD;AAGK,SAAA,EAAE,YAAY,YAAY;AACnC;AAkBO,MAAM,eAAsC,CAAC,EAAE,OAAO,eAAe;AAC1E,QAAM,EAAE,YAAY,mBAAmB,aAAa,mBAAmB,IACrE,QAAQ,MAAM,oBAAoB,KAAK,GAAG,CAAC,KAAK,CAAC;AAC7C,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,qBAAqB;AAAA,EACvB;AACM,QAAA,CAAC,aAAa,cAAc,IAAI;AAAA,IACpC,sBAAsB;AAAA,EACxB;AAEA,YAAU,MAAM;AACd,QACE,cACA,gBACC,eAAe,qBAAqB,gBAAgB,qBACrD;AACA,YAAM,WAAW,GAAG,UAAU,GAAG,WAAW;AAE5C,eAAS,QAAQ;AAAA,IAAA;AAAA,EACnB,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGC,SAAA,qBAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,IAAA,qBAAC,QAAO,EAAA,eAAe,eAAe,cAAc,mBAClD,UAAA;AAAA,MAAC,oBAAA,OAAO,SAAP,EAAe,WAAU,QACxB,UAAC,oBAAA,OAAO,OAAP,EAAa,aAAY,sBAAA,CAAsB,EAClD,CAAA;AAAA,MACA,qBAAC,OAAO,SAAP,EACC,UAAA;AAAA,QAAA,oBAAC,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,4BAC3B,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,4BAC7B,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,4BAC3B,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,4BAC7B,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,IAAA,CAAA;AAAA,MAAA,EAC9B,CAAA;AAAA,IAAA,GACF;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAc,eAAe;AAAA,QAC7B,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,QAC9C,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
|
|
@@ -30,13 +30,11 @@ const NavigationViewNode = ({
|
|
|
30
30
|
goToTranslation
|
|
31
31
|
} = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
|
|
32
32
|
const nodeType = core.getNodeType(section);
|
|
33
|
-
const isEditableSection = components_DictionaryFieldEditor_getIsEditableSection.getIsEditableSection(section);
|
|
34
33
|
const getIsSelected = ReactExports.useCallback(
|
|
35
34
|
(keyPath2) => (focusedContent?.keyPath?.length ?? 0) > 0 && core.isSameKeyPath(keyPath2, focusedContent?.keyPath ?? []),
|
|
36
35
|
[focusedContent?.keyPath]
|
|
37
36
|
);
|
|
38
|
-
if (
|
|
39
|
-
if (!section) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" });
|
|
37
|
+
if (!section) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
40
38
|
if (typeof section === "object") {
|
|
41
39
|
if (nodeType === core.NodeType.ReactNode) {
|
|
42
40
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "React Node" });
|
|
@@ -56,7 +54,7 @@ const NavigationViewNode = ({
|
|
|
56
54
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
55
|
components_Button_Button.Button,
|
|
58
56
|
{
|
|
59
|
-
label: `${goToTranslation.label} ${translationKey}`,
|
|
57
|
+
label: `${goToTranslation.label.value} ${translationKey}`,
|
|
60
58
|
isActive: getIsSelected(childKeyPath),
|
|
61
59
|
variant: "hoverable",
|
|
62
60
|
color: "text",
|
|
@@ -71,7 +69,7 @@ const NavigationViewNode = ({
|
|
|
71
69
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
70
|
components_Accordion_Accordion.Accordion,
|
|
73
71
|
{
|
|
74
|
-
label: `${goToTranslation.label} ${translationKey}`,
|
|
72
|
+
label: `${goToTranslation.label.value} ${translationKey}`,
|
|
75
73
|
isActive: getIsSelected(childKeyPath),
|
|
76
74
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
77
75
|
header: translationKey,
|
|
@@ -105,7 +103,7 @@ const NavigationViewNode = ({
|
|
|
105
103
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
104
|
components_Button_Button.Button,
|
|
107
105
|
{
|
|
108
|
-
label: `${goToEnumeration.label} ${key}`,
|
|
106
|
+
label: `${goToEnumeration.label.value} ${key}`,
|
|
109
107
|
isActive: getIsSelected(childKeyPath),
|
|
110
108
|
variant: "hoverable",
|
|
111
109
|
color: "text",
|
|
@@ -120,7 +118,7 @@ const NavigationViewNode = ({
|
|
|
120
118
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
119
|
components_Accordion_Accordion.Accordion,
|
|
122
120
|
{
|
|
123
|
-
label: `${goToEnumeration.label} ${key}`,
|
|
121
|
+
label: `${goToEnumeration.label.value} ${key}`,
|
|
124
122
|
isActive: getIsSelected(childKeyPath),
|
|
125
123
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
126
124
|
header: key,
|
|
@@ -149,7 +147,7 @@ const NavigationViewNode = ({
|
|
|
149
147
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
150
148
|
components_Button_Button.Button,
|
|
151
149
|
{
|
|
152
|
-
label: `${goToElement.label} ${index}`,
|
|
150
|
+
label: `${goToElement.label.value} ${index}`,
|
|
153
151
|
isActive: getIsSelected(childKeyPath),
|
|
154
152
|
variant: "hoverable",
|
|
155
153
|
color: "text",
|
|
@@ -164,7 +162,7 @@ const NavigationViewNode = ({
|
|
|
164
162
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
163
|
components_Accordion_Accordion.Accordion,
|
|
166
164
|
{
|
|
167
|
-
label: `${goToElement.label} ${index}`,
|
|
165
|
+
label: `${goToElement.label.value} ${index}`,
|
|
168
166
|
isActive: getIsSelected(childKeyPath),
|
|
169
167
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
170
168
|
header: index,
|
|
@@ -196,8 +194,15 @@ const NavigationViewNode = ({
|
|
|
196
194
|
}
|
|
197
195
|
];
|
|
198
196
|
const sectionArray2 = section;
|
|
199
|
-
const
|
|
200
|
-
|
|
197
|
+
const emptySectionEl = core.getEmptyNode(
|
|
198
|
+
sectionArray2[sectionArray2.length - 1]
|
|
199
|
+
) ?? "";
|
|
200
|
+
addEditedContent(
|
|
201
|
+
dictionaryKey,
|
|
202
|
+
emptySectionEl,
|
|
203
|
+
newKeyPath,
|
|
204
|
+
false
|
|
205
|
+
);
|
|
201
206
|
setFocusedContentKeyPath(newKeyPath);
|
|
202
207
|
},
|
|
203
208
|
Icon: lucideReact.Plus,
|
|
@@ -218,7 +223,7 @@ const NavigationViewNode = ({
|
|
|
218
223
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
219
224
|
components_Button_Button.Button,
|
|
220
225
|
{
|
|
221
|
-
label: `${goToField.label} ${key}`,
|
|
226
|
+
label: `${goToField.label.value} ${key}`,
|
|
222
227
|
isActive: getIsSelected(childKeyPath),
|
|
223
228
|
variant: "hoverable",
|
|
224
229
|
color: "text",
|
|
@@ -233,7 +238,7 @@ const NavigationViewNode = ({
|
|
|
233
238
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
234
239
|
components_Accordion_Accordion.Accordion,
|
|
235
240
|
{
|
|
236
|
-
label: `${goToField.label} ${key}`,
|
|
241
|
+
label: `${goToField.label.value} ${key}`,
|
|
237
242
|
isActive: getIsSelected(childKeyPath),
|
|
238
243
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
239
244
|
header: utils_camelCase.camelCaseToSentence(key),
|