@intlayer/design-system 9.3.2 → 9.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/api/hooks/auth.mjs +2 -0
- package/dist/esm/api/hooks/auth.mjs.map +1 -1
- package/dist/esm/api/index.mjs +2 -2
- package/dist/esm/api/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/api/useAuth/useSession.mjs +1 -1
- package/dist/esm/components/Browser/Browser.mjs +1 -1
- package/dist/esm/components/Browser/Browser.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
- package/dist/esm/components/CopyButton/index.mjs +2 -1
- package/dist/esm/components/CopyButton/index.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +4 -5
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +6 -10
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +6 -6
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -7
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs +19 -12
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/esm/components/HTMLRender/HTMLRender.mjs +2 -2
- package/dist/esm/components/HTMLRender/HTMLRender.mjs.map +1 -1
- package/dist/esm/components/IDE/Code.mjs +3 -3
- package/dist/esm/components/IDE/Code.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockClient.mjs +16 -4
- package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs +14 -5
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs +5 -3
- package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockShiki.mjs +18 -18
- package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
- package/dist/esm/components/IDE/IDE.mjs +2 -5
- package/dist/esm/components/IDE/IDE.mjs.map +1 -1
- package/dist/esm/components/IDE/MarkDownRender.mjs +1 -2
- package/dist/esm/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/IDE/index.mjs +2 -2
- package/dist/esm/components/IDE/shikiThemes.mjs +18 -0
- package/dist/esm/components/IDE/shikiThemes.mjs.map +1 -0
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs +105 -4
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs.map +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +16 -16
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/MaxHeightSmoother/index.mjs +1 -1
- package/dist/esm/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/esm/components/MaxWidthSmoother/index.mjs +1 -1
- package/dist/esm/components/MaxWidthSmoother/index.mjs.map +1 -1
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs +100 -15
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs.map +1 -1
- package/dist/esm/components/Popover/dynamic.mjs +5 -4
- package/dist/esm/components/Popover/dynamic.mjs.map +1 -1
- package/dist/esm/components/Popover/index.mjs +2 -2
- package/dist/esm/components/Popover/static.mjs +47 -18
- package/dist/esm/components/Popover/static.mjs.map +1 -1
- package/dist/esm/components/Tab/Tab.mjs +37 -16
- package/dist/esm/components/Tab/Tab.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs +3 -2
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/esm/components/index.mjs +3 -3
- package/dist/esm/hooks/useDevice.mjs +16 -6
- package/dist/esm/hooks/useDevice.mjs.map +1 -1
- package/dist/esm/hooks/useItemSelector.mjs +107 -112
- package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
- package/dist/esm/libs/auth.mjs +16 -3
- package/dist/esm/libs/auth.mjs.map +1 -1
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs +1 -1
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs.map +1 -1
- package/dist/types/api/hooks/auth.d.ts.map +1 -1
- package/dist/types/components/Browser/Browser.d.ts +7 -1
- package/dist/types/components/Browser/Browser.d.ts.map +1 -1
- package/dist/types/components/CopyButton/index.d.ts +9 -3
- package/dist/types/components/CopyButton/index.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/types/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/types/components/HTMLRender/HTMLRender.d.ts +1 -2
- package/dist/types/components/HTMLRender/HTMLRender.d.ts.map +1 -1
- package/dist/types/components/IDE/Code.d.ts +6 -1
- package/dist/types/components/IDE/Code.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockClient.d.ts +18 -2
- package/dist/types/components/IDE/CodeBlockClient.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts +3 -2
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts +0 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts +0 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
- package/dist/types/components/IDE/IDE.d.ts +0 -1
- package/dist/types/components/IDE/IDE.d.ts.map +1 -1
- package/dist/types/components/IDE/MarkDownRender.d.ts +0 -1
- package/dist/types/components/IDE/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/IDE/index.d.ts +2 -2
- package/dist/types/components/IDE/shikiThemes.d.ts +18 -0
- package/dist/types/components/IDE/shikiThemes.d.ts.map +1 -0
- package/dist/types/components/MarkDownRender/MarkDownIframe.d.ts.map +1 -1
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts +1 -2
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -1
- package/dist/types/components/Popover/dynamic.d.ts.map +1 -1
- package/dist/types/components/Popover/index.d.ts +2 -2
- package/dist/types/components/Popover/static.d.ts +6 -1
- package/dist/types/components/Popover/static.d.ts.map +1 -1
- package/dist/types/components/Tab/Tab.d.ts +2 -2
- package/dist/types/components/Tab/Tab.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/hooks/useItemSelector.d.ts.map +1 -1
- package/dist/types/libs/auth.d.ts +3 -0
- package/dist/types/libs/auth.d.ts.map +1 -1
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts +9 -3
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts.map +1 -1
- package/package.json +40 -35
- package/tailwind.css +27 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.mjs","names":["ContentEditorTextAreaBase","ContentEditorInputBase"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport { useAuditContentDeclarationField } from '@api/index';\nimport { Accordion } from '@components/Accordion';\nimport { Button } from '@components/Button';\nimport { Container } from '@components/Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '@components/ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '@components/ContentEditor/ContentEditorTextArea';\nimport { renameKey } from '@components/DictionaryFieldEditor/ContentEditorView/object';\nimport { Label } from '@components/Label';\nimport { Loader } from '@components/Loader';\nimport { useLocaleSwitcherContent } from '@components/LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n type SwitchSelectorProps,\n} from '@components/SwitchSelector';\nimport { camelCaseToSentence } from '@intlayer/config/client';\nimport {\n getEmptyNode,\n getNodeType,\n} from '@intlayer/core/dictionaryManipulator';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport type {\n ConditionContent,\n EnumerationContent,\n FileContent,\n GenderContent,\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n PluralContent,\n SelectContent,\n TranslationContent,\n} from '@intlayer/core/transpiler';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport type { ContentNode, Dictionary } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport {\n type FC,\n Fragment,\n lazy,\n memo,\n type ReactNode,\n Suspense,\n useState,\n} from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { SafeHtmlRenderer } from './SafeHtmlRenderer';\n\nconst LazyMarkdownRenderer = lazy(() =>\n import('@components/MarkDownRender').then((m) => ({\n default: m.MarkdownRenderer,\n }))\n);\n\n// Lazy-loaded so the Tiptap/Novel editor bundle is only fetched when a markdown\n// field is actually edited.\nconst LazyMarkdownEditor = lazy(() =>\n import('@components/MarkdownEditor').then((m) => ({\n default: m.MarkdownEditor,\n }))\n);\n\n// Renders children only after the accordion is first opened (mount-once pattern).\n// Prevents deeply nested sub-trees from mounting on initial render.\ntype CollapsibleEditorProps = TextEditorProps & { label: string };\nconst CollapsibleEditor = memo<CollapsibleEditorProps>(\n function CollapsibleEditor({ label, ...editorProps }) {\n const [hasOpened, setHasOpened] = useState(false);\n return (\n <Accordion\n header={label}\n label={label}\n onToggle={(isOpen) => {\n if (isOpen && !hasOpened) setHasOpened(true);\n }}\n >\n {hasOpened ? <TextEditor {...editorProps} /> : null}\n </Accordion>\n );\n }\n);\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { mutate: auditContentDeclarationField, isPending: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, 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 {\n fileContent: JSON.stringify({\n ...dictionary,\n ...(editedContent?.[dictionary.localId!] ?? {}),\n }),\n keyPath,\n locales: configuration?.internationalization.locales ?? [],\n aiOptions: {\n apiKey: configuration?.ai?.apiKey,\n model: configuration?.ai?.model,\n temperature: configuration?.ai?.temperature,\n },\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(\n dictionary.localId!,\n editedContent,\n keyPath\n );\n } catch (error) {\n console.error(error);\n }\n },\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.localId!, 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) =>\n addEditedContent(dictionary.localId!, value, keyPath)\n }\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 * Custom renderer for string leaves. Receives the leaf content and its full\n * key path so the renderer can write edits back to the right location.\n */\n renderSection?: (content: string, keyPath: KeyPath[]) => ReactNode;\n onContentChange?: (newValue: string) => void;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}: TextEditorProps) => {\n const { locale, defaultLocale } = useLocale();\n const { selectedLocales } = useLocaleSwitcherContent();\n\n const content: any = (section as TranslationContent<string>)[\n NodeTypes.TRANSLATION\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {selectedLocales.map((translationKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-translation-${translationKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td className=\"flex w-full\">\n {getLocaleName(translationKey, locale)}\n </td>\n </tr>\n <tr className=\"flex\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[translationKey] ??\n getEmptyNode(content[defaultLocale])\n }\n keyPath={[\n ...keyPath,\n { type: NodeTypes.TRANSLATION, key: translationKey },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration, removeEnumeration } =\n useIntlayer('navigation-view');\n\n const content = (section as EnumerationContent<string>)[\n NodeTypes.ENUMERATION\n ];\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>)[NodeTypes.ENUMERATION]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeTypes.ENUMERATION, key: enumKey },\n ] as KeyPath[];\n const uniqueKey = `${JSON.stringify(keyPath)}-enumeration-${enumKey}`;\n\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full\">\n <td className=\"flex w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n Icon={Trash}\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </td>\n </tr>\n <tr className=\"w-full p-2\">\n <td className=\"flex w-full\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeTypes.ENUMERATION];\n\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeTypes.ENUMERATION]: newValueContent,\n };\n\n console.log('newValue', newValue);\n\n addEditedContent(\n dictionary.localId!,\n newValue,\n keyPath\n );\n }}\n />\n </td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex 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 renderSection={renderSection}\n />\n </td>\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.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeTypes.ENUMERATION, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst SelectTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewSelectCase, removeSelectCase } = useIntlayer('navigation-view');\n\n const content = (section as SelectContent)[NodeTypes.SELECT] as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(content)[0];\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(content).map((caseKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeTypes.SELECT, key: caseKey },\n ] as KeyPath[];\n const uniqueKey = `${JSON.stringify(keyPath)}-select-${caseKey}`;\n\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full\">\n <td className=\"flex w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeSelectCase.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n Icon={Trash}\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeSelectCase.text}\n </Button>\n </div>\n </td>\n </tr>\n <tr className=\"w-full p-2\">\n <td className=\"flex w-full\">\n {/* Select cases are free-form strings, so the key is edited\n as plain text rather than through `EnumKeyInput`, which\n only builds numeric comparators. */}\n <ContentEditorInputBase\n aria-label=\"Edit case\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(value) => {\n const newValue = {\n ...(section as SelectContent),\n [NodeTypes.SELECT]: renameKey(\n content,\n caseKey,\n String(value)\n ),\n };\n\n addEditedContent(\n dictionary.localId!,\n newValue as ContentNode,\n keyPath\n );\n }}\n >\n {caseKey}\n </ContentEditorInputBase>\n </td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditor\n section={\n content[caseKey] ?? getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n\n <Button\n label={addNewSelectCase.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeTypes.SELECT, key: 'newCase' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewSelectCase.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeTypes.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 const uniqueKey = `${JSON.stringify(keyPath)}-condition-${condKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{String(condKey)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex 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: NodeTypes.CONDITION,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst GenderTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as GenderContent<string>)[NodeTypes.GENDER];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['male', 'female', 'fallback'].map((condKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-gender-${condKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{String(condKey)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.male)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.GENDER,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst PLURAL_CATEGORIES = ['zero', 'one', 'two', 'few', 'many', 'other'];\n\nconst PluralTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as PluralContent<string>)[NodeTypes.PLURAL];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {PLURAL_CATEGORIES.map((pluralKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-plural-${pluralKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{pluralKey}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[pluralKey as keyof typeof content] ??\n getEmptyNode(content.other)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.PLURAL,\n key: pluralKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement, removeElement } = useIntlayer('navigation-view');\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 const uniqueKey = `${JSON.stringify(keyPath)}-array-${index}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full p-2\">\n <td className=\"flex w-full\">\n <div className=\"flex w-full items-center justify-between gap-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeTypes.ARRAY,\n key: index, // Fixed: Use index instead of length\n },\n ];\n addEditedContent(\n dictionary.localId!,\n undefined,\n newKeyPath\n );\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </div>\n </td>\n </tr>\n\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.ARRAY,\n key: index,\n },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\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: NodeTypes.ARRAY,\n key: (section as unknown as ContentNode[]).length, // Keeps length for adding new items\n },\n ];\n addEditedContent(\n dictionary.localId!,\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 renderSection,\n}) => {\n const typedSection = section as unknown as Record<string, ContentNode>;\n const firstKey = Object.keys(typedSection)[0] as keyof typeof section;\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(typedSection).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeTypes.OBJECT, key },\n ];\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n const uniqueKey = `${JSON.stringify(keyPath)}-object-${key}`;\n // Collapse any object/array (typed or plain) — only true primitives render inline.\n // getIsEditableSection can't be used here: it inspects getNodeChildren(), which for\n // translation nodes returns the first locale value (a string), causing translation\n // subtrees to be mistakenly treated as leaves and mounted all at once.\n const isLeaf = subSection === null || typeof subSection !== 'object';\n\n if (isLeaf) {\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 p-2 text-xs\">\n <td className=\"flex w-full\">{String(key)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n }\n\n return (\n <tr\n key={uniqueKey}\n className=\"block w-full border-neutral/10 border-t py-1\"\n >\n <td className=\"flex w-full\">\n <CollapsibleEditor\n label={camelCaseToSentence(key)}\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nenum MarkdownViewMode {\n Edit,\n Raw,\n Preview,\n}\n\nenum HtmlViewMode {\n Edit,\n Preview,\n}\n\nconst HtmlTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const [mode, setMode] = useState(HtmlViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: HtmlViewMode.Edit,\n },\n {\n content: 'Preview',\n value: HtmlViewMode.Preview,\n },\n ] as SwitchSelectorChoices<HtmlViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.HTML }];\n\n const content = (section as HTMLContent<ContentNode>)[\n NodeTypes.HTML\n ] as ContentNode;\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\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === HtmlViewMode.Preview\n ? (rawContent) => <SafeHtmlRenderer rawContent={rawContent} />\n : undefined\n }\n />\n </div>\n );\n};\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const { addEditedContent } = useEditedContent();\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Raw',\n value: MarkdownViewMode.Raw,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.MARKDOWN }];\n\n const content = ((section as MarkdownContent<ContentNode>)[\n NodeTypes.MARKDOWN\n ] ?? '') as ContentNode;\n\n /**\n * WYSIWYG editor rendered on every markdown string leaf. When the markdown\n * node wraps another node (e.g. `md(t({ ... }))`), the recursive editor\n * walks the inner structure and calls this renderer once per string leaf,\n * so each locale/branch gets its own rich-text surface writing back to its\n * own key path.\n */\n const renderMarkdownEditor = (\n leafContent: string,\n leafKeyPath: KeyPath[]\n ): ReactNode => (\n <Suspense fallback={<Loader />}>\n <LazyMarkdownEditor\n key={JSON.stringify(leafKeyPath)}\n defaultValue={leafContent}\n onChange={(markdown) =>\n addEditedContent(dictionary.localId!, markdown, leafKeyPath)\n }\n />\n </Suspense>\n );\n\n const renderMarkdownPreview = (leafContent: string): ReactNode => (\n <Suspense fallback={<Loader />}>\n <LazyMarkdownRenderer isDarkMode={isDarkMode}>\n {leafContent}\n </LazyMarkdownRenderer>\n </Suspense>\n );\n\n const renderSectionByMode: TextEditorProps['renderSection'] =\n mode === MarkdownViewMode.Edit\n ? renderMarkdownEditor\n : mode === MarkdownViewMode.Preview\n ? renderMarkdownPreview\n : undefined;\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\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSectionByMode}\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.INSERTION }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeTypes.INSERTION\n ];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst FileTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.FILE }];\n\n const fileUrl = (section as FileContent)[NodeTypes.FILE];\n const { content } = section as FileContent;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <span className=\"text-neutral text-sm\">{fileUrl} </span>\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n renderSection,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as any)[NodeTypes.NESTED];\n const childrenKeyPath = [...keyPath, { type: NodeTypes.NESTED }] as KeyPath[];\n\n return (\n <div className=\"flex w-full flex-col gap-4 p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\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 {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor = memo<TextEditorProps>(function TextEditor({\n section,\n keyPath,\n dictionary,\n renderSection,\n isDarkMode,\n}) {\n const { tsxNotEditable } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n\n if (nodeType === NodeTypes.REACT_NODE) {\n return (\n <div className=\"flex w-full flex-col gap-2\">\n <span>(React Node)</span>\n <span className=\"flex text-neutral text-xs\">{tsxNotEditable}</span>\n </div>\n );\n }\n\n if (nodeType === NodeTypes.NESTED) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.TRANSLATION) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.ENUMERATION) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.CONDITION) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.SELECT) {\n return (\n <SelectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.GENDER) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.PLURAL) {\n return (\n <PluralTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.INSERTION) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.MARKDOWN) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeTypes.HTML) {\n return (\n <HtmlTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.FILE) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.ARRAY) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.OBJECT) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.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 === NodeTypes.TEXT) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string, keyPath)\n ) : (\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n )}\n </div>\n );\n }\n\n if (nodeType === NodeTypes.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 = memo<TextEditorProps>(\n function TextEditorContainer(props) {\n return (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col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U,UACzB,OACE,oBAAC,oBAAD;EACc;EACH;EACA;EACG;CACb;CAIL,IAAI,aAAa,UAAU,MACzB,OACE,oBAAC,gBAAD;EACc;EACH;EACA;CACV;CAIL,IAAI,aAAa,UAAU,MACzB,OACE,oBAAC,gBAAD;EACc;EACG;EACN;EACA;CACV;CAIL,IAAI,aAAa,UAAU,OACzB,OACE,oBAAC,iBAAD;EACc;EACG;EACN;EACA;CACV;CAIL,IAAI,aAAa,UAAU,QACzB,OACE,oBAAC,kBAAD;EACc;EACG;EACN;EACA;CACV;CAIL,IAAI,aAAa,UAAU,QACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,oBAAD;GACc;GACH;GACT,MAAK;GACL,cAAW;aAEV;EACiB;CACjB;CAIT,IAAI,aAAa,UAAU,MACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACZ,OAAO,kBAAkB,aACxB,cAAc,SAAmB,OAAO,IAExC,oBAAC,uBAAD;GACE,SAAQ;GACR,cAAW;GACF;GACG;aAEX;EACoB;CAEtB;CAIT,IAAI,aAAa,UAAU,SACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,qBAAD;GACc;GACH;GACT,OAAO;EACR;CACE;CAIT,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GAA4B;GAEzB,KAAK,UAAU,SAAS,MAAM,CAAC;GAC/B,KAAK,UAAU,SAAS,MAAM,CAAC;GAAE;GACtB;EACT;;AAET,CAAC;AAED,MAAa,sBAAsB,KACjC,SAAS,oBAAoB,OAAO;CAClC,OACE,oBAAC,WAAD;EACE;EACA,YAAW;EACX,WAAU;EACV,aAAY;YAEZ,oBAAC,YAAD,EAAY,GAAI,MAAQ;CACf;AAEf,CACF"}
|
|
1
|
+
{"version":3,"file":"TextEditor.mjs","names":["ContentEditorTextAreaBase","ContentEditorInputBase"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport { useAuditContentDeclarationField } from '@api/index';\nimport { Accordion } from '@components/Accordion';\nimport { Button } from '@components/Button';\nimport { Container } from '@components/Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '@components/ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '@components/ContentEditor/ContentEditorTextArea';\nimport { renameKey } from '@components/DictionaryFieldEditor/ContentEditorView/object';\nimport { Label } from '@components/Label';\nimport { Loader } from '@components/Loader';\nimport { useLocaleSwitcherContent } from '@components/LocaleSwitcherContentDropDown';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n type SwitchSelectorProps,\n} from '@components/SwitchSelector';\nimport { camelCaseToSentence } from '@intlayer/config/client';\nimport {\n getEmptyNode,\n getNodeType,\n} from '@intlayer/core/dictionaryManipulator';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport type {\n ConditionContent,\n EnumerationContent,\n FileContent,\n GenderContent,\n HTMLContent,\n InsertionContent,\n MarkdownContent,\n PluralContent,\n SelectContent,\n TranslationContent,\n} from '@intlayer/core/transpiler';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport type { ContentNode, Dictionary } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport {\n type FC,\n Fragment,\n lazy,\n memo,\n type ReactNode,\n Suspense,\n useState,\n} from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { SafeHtmlRenderer } from './SafeHtmlRenderer';\n\nconst LazyMarkdownRenderer = lazy(() =>\n import('@components/MarkDownRender').then((m) => ({\n default: m.MarkdownRenderer,\n }))\n);\n\n// Lazy-loaded so the Tiptap/Novel editor bundle is only fetched when a markdown\n// field is actually edited.\nconst LazyMarkdownEditor = lazy(() =>\n import('@components/MarkdownEditor').then((m) => ({\n default: m.MarkdownEditor,\n }))\n);\n\n// Renders children only after the accordion is first opened (mount-once pattern).\n// Prevents deeply nested sub-trees from mounting on initial render.\ntype CollapsibleEditorProps = TextEditorProps & { label: string };\nconst CollapsibleEditor = memo<CollapsibleEditorProps>(\n function CollapsibleEditor({ label, ...editorProps }) {\n const [hasOpened, setHasOpened] = useState(false);\n return (\n <Accordion\n header={label}\n label={label}\n onToggle={(isOpen) => {\n if (isOpen && !hasOpened) setHasOpened(true);\n }}\n >\n {hasOpened ? <TextEditor {...editorProps} /> : null}\n </Accordion>\n );\n }\n);\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const configuration = useConfiguration();\n const { mutate: auditContentDeclarationField, isPending: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, 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 {\n fileContent: JSON.stringify({\n ...dictionary,\n ...(editedContent?.[dictionary.localId!] ?? {}),\n }),\n keyPath,\n locales: configuration?.internationalization.locales ?? [],\n aiOptions: {\n apiKey: configuration?.ai?.apiKey,\n model: configuration?.ai?.model,\n temperature: configuration?.ai?.temperature,\n },\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(\n dictionary.localId!,\n editedContent,\n keyPath\n );\n } catch (error) {\n console.error(error);\n }\n },\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.localId!, 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) =>\n addEditedContent(dictionary.localId!, value, keyPath)\n }\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 * Custom renderer for string leaves. Receives the leaf content and its full\n * key path so the renderer can write edits back to the right location.\n */\n renderSection?: (content: string, keyPath: KeyPath[]) => ReactNode;\n onContentChange?: (newValue: string) => void;\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}: TextEditorProps) => {\n const { locale, defaultLocale } = useLocale();\n const { selectedLocales } = useLocaleSwitcherContent();\n\n const content: any = (section as TranslationContent<string>)[\n NodeTypes.TRANSLATION\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {selectedLocales.map((translationKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-translation-${translationKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td className=\"flex w-full\">\n {getLocaleName(translationKey, locale)}\n </td>\n </tr>\n <tr className=\"flex\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[translationKey] ??\n getEmptyNode(content[defaultLocale])\n }\n keyPath={[\n ...keyPath,\n { type: NodeTypes.TRANSLATION, key: translationKey },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration, removeEnumeration } =\n useIntlayer('navigation-view');\n\n const content = (section as EnumerationContent<string>)[\n NodeTypes.ENUMERATION\n ];\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>)[NodeTypes.ENUMERATION]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeTypes.ENUMERATION, key: enumKey },\n ] as KeyPath[];\n const uniqueKey = `${JSON.stringify(keyPath)}-enumeration-${enumKey}`;\n\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full\">\n <td className=\"flex w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n Icon={Trash}\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </td>\n </tr>\n <tr className=\"w-full p-2\">\n <td className=\"flex w-full\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeTypes.ENUMERATION];\n\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeTypes.ENUMERATION]: newValueContent,\n };\n\n console.log('newValue', newValue);\n\n addEditedContent(\n dictionary.localId!,\n newValue,\n keyPath\n );\n }}\n />\n </td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex 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 renderSection={renderSection}\n />\n </td>\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.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeTypes.ENUMERATION, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst SelectTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewSelectCase, removeSelectCase } = useIntlayer('navigation-view');\n\n const content = (section as SelectContent)[NodeTypes.SELECT] as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(content)[0];\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(content).map((caseKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeTypes.SELECT, key: caseKey },\n ] as KeyPath[];\n const uniqueKey = `${JSON.stringify(keyPath)}-select-${caseKey}`;\n\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full\">\n <td className=\"flex w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeSelectCase.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n Icon={Trash}\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeSelectCase.text}\n </Button>\n </div>\n </td>\n </tr>\n <tr className=\"w-full p-2\">\n <td className=\"flex w-full\">\n {/* Select cases are free-form strings, so the key is edited\n as plain text rather than through `EnumKeyInput`, which\n only builds numeric comparators. */}\n <ContentEditorInputBase\n aria-label=\"Edit case\"\n type=\"text\"\n variant=\"default\"\n onContentChange={(value) => {\n const newValue = {\n ...(section as SelectContent),\n [NodeTypes.SELECT]: renameKey(\n content,\n caseKey,\n String(value)\n ),\n };\n\n addEditedContent(\n dictionary.localId!,\n newValue as ContentNode,\n keyPath\n );\n }}\n >\n {caseKey}\n </ContentEditorInputBase>\n </td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditor\n section={\n content[caseKey] ?? getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n\n <Button\n label={addNewSelectCase.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeTypes.SELECT, key: 'newCase' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewSelectCase.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeTypes.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 const uniqueKey = `${JSON.stringify(keyPath)}-condition-${condKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{String(condKey)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex 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: NodeTypes.CONDITION,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst GenderTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as GenderContent<string>)[NodeTypes.GENDER];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['male', 'female', 'fallback'].map((condKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-gender-${condKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{String(condKey)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.male)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.GENDER,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst PLURAL_CATEGORIES = ['zero', 'one', 'two', 'few', 'many', 'other'];\n\nconst PluralTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as PluralContent<string>)[NodeTypes.PLURAL];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {PLURAL_CATEGORIES.map((pluralKey) => {\n const uniqueKey = `${JSON.stringify(keyPath)}-plural-${pluralKey}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"flex w-full\">{pluralKey}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n content[pluralKey as keyof typeof content] ??\n getEmptyNode(content.other)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.PLURAL,\n key: pluralKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement, removeElement } = useIntlayer('navigation-view');\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 const uniqueKey = `${JSON.stringify(keyPath)}-array-${index}`;\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 w-full p-2\">\n <td className=\"flex w-full\">\n <div className=\"flex w-full items-center justify-between gap-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant=\"hoverable\"\n size=\"sm\"\n color=\"error\"\n className=\"ml-auto text-neutral hover:text-error\"\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeTypes.ARRAY,\n key: index, // Fixed: Use index instead of length\n },\n ];\n addEditedContent(\n dictionary.localId!,\n undefined,\n newKeyPath\n );\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </div>\n </td>\n </tr>\n\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeTypes.ARRAY,\n key: index,\n },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\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: NodeTypes.ARRAY,\n key: (section as unknown as ContentNode[]).length, // Keeps length for adding new items\n },\n ];\n addEditedContent(\n dictionary.localId!,\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 renderSection,\n}) => {\n const typedSection = section as unknown as Record<string, ContentNode>;\n const firstKey = Object.keys(typedSection)[0] as keyof typeof section;\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(typedSection).map((key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeTypes.OBJECT, key },\n ];\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n const uniqueKey = `${JSON.stringify(keyPath)}-object-${key}`;\n // Collapse any object/array (typed or plain) — only true primitives render inline.\n // getIsEditableSection can't be used here: it inspects getNodeChildren(), which for\n // translation nodes returns the first locale value (a string), causing translation\n // subtrees to be mistakenly treated as leaves and mounted all at once.\n const isLeaf = subSection === null || typeof subSection !== 'object';\n\n if (isLeaf) {\n return (\n <Fragment key={uniqueKey}>\n <tr className=\"mt-2 p-2 text-xs\">\n <td className=\"flex w-full\">{String(key)}</td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"flex w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n </Fragment>\n );\n }\n\n return (\n <tr\n key={uniqueKey}\n className=\"block w-full border-neutral/10 border-t py-1\"\n >\n <td className=\"flex w-full\">\n <CollapsibleEditor\n label={camelCaseToSentence(key)}\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n};\n\nenum MarkdownViewMode {\n Edit,\n Raw,\n Preview,\n}\n\nenum HtmlViewMode {\n Edit,\n Preview,\n}\n\nconst HtmlTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const [mode, setMode] = useState(HtmlViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: HtmlViewMode.Edit,\n },\n {\n content: 'Preview',\n value: HtmlViewMode.Preview,\n },\n ] as SwitchSelectorChoices<HtmlViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.HTML }];\n\n const content = (section as HTMLContent<ContentNode>)[\n NodeTypes.HTML\n ] as ContentNode;\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\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === HtmlViewMode.Preview\n ? (rawContent) => <SafeHtmlRenderer rawContent={rawContent} />\n : undefined\n }\n />\n </div>\n );\n};\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const { addEditedContent } = useEditedContent();\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Raw',\n value: MarkdownViewMode.Raw,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.MARKDOWN }];\n\n const content = ((section as MarkdownContent<ContentNode>)[\n NodeTypes.MARKDOWN\n ] ?? '') as ContentNode;\n\n /**\n * WYSIWYG editor rendered on every markdown string leaf. When the markdown\n * node wraps another node (e.g. `md(t({ ... }))`), the recursive editor\n * walks the inner structure and calls this renderer once per string leaf,\n * so each locale/branch gets its own rich-text surface writing back to its\n * own key path.\n */\n const renderMarkdownEditor = (\n leafContent: string,\n leafKeyPath: KeyPath[]\n ): ReactNode => (\n <Suspense fallback={<Loader />}>\n <LazyMarkdownEditor\n key={JSON.stringify(leafKeyPath)}\n defaultValue={leafContent}\n onChange={(markdown) =>\n addEditedContent(dictionary.localId!, markdown, leafKeyPath)\n }\n />\n </Suspense>\n );\n\n const renderMarkdownPreview = (leafContent: string): ReactNode => (\n <Suspense fallback={<Loader />}>\n <LazyMarkdownRenderer>{leafContent}</LazyMarkdownRenderer>\n </Suspense>\n );\n\n const renderSectionByMode: TextEditorProps['renderSection'] =\n mode === MarkdownViewMode.Edit\n ? renderMarkdownEditor\n : mode === MarkdownViewMode.Preview\n ? renderMarkdownPreview\n : undefined;\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\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSectionByMode}\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.INSERTION }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeTypes.INSERTION\n ];\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst FileTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeTypes.FILE }];\n\n const fileUrl = (section as FileContent)[NodeTypes.FILE];\n const { content } = section as FileContent;\n\n return (\n <div className=\"flex w-full flex-col justify-center gap-6 p-2\">\n <span className=\"text-neutral text-sm\">{fileUrl} </span>\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n {...props}\n />\n </div>\n );\n};\n\nconst NestedTextEditor: FC<TextEditorProps> = ({\n keyPath,\n dictionary,\n renderSection,\n section,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n\n const content = (section as any)[NodeTypes.NESTED];\n const childrenKeyPath = [...keyPath, { type: NodeTypes.NESTED }] as KeyPath[];\n\n return (\n <div className=\"flex w-full flex-col gap-4 p-2\">\n <Label>Dictionary key</Label>\n <ContentEditorInputBase\n aria-label=\"Edit field\"\n type=\"text\"\n variant=\"default\"\n {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n dictionaryKey: String(newValue),\n },\n childrenKeyPath\n );\n }}\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 {...props}\n onContentChange={(newValue) => {\n addEditedContent(\n dictionary.localId!,\n {\n ...content,\n path: newValue !== '' ? newValue : undefined,\n },\n childrenKeyPath\n );\n }}\n >\n {content.path ?? ''}\n </ContentEditorInputBase>\n </div>\n );\n};\n\nexport const TextEditor = memo<TextEditorProps>(function TextEditor({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) {\n const { tsxNotEditable } = useIntlayer('navigation-view');\n const nodeType = getNodeType(section);\n\n if (nodeType === NodeTypes.REACT_NODE) {\n return (\n <div className=\"flex w-full flex-col gap-2\">\n <span>(React Node)</span>\n <span className=\"flex text-neutral text-xs\">{tsxNotEditable}</span>\n </div>\n );\n }\n\n if (nodeType === NodeTypes.NESTED) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.TRANSLATION) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.ENUMERATION) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.CONDITION) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.SELECT) {\n return (\n <SelectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.GENDER) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.PLURAL) {\n return (\n <PluralTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.INSERTION) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.MARKDOWN) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.HTML) {\n return (\n <HtmlTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.FILE) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.ARRAY) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.OBJECT) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeTypes.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 === NodeTypes.TEXT) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string, keyPath)\n ) : (\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n >\n {section as string}\n </ContentEditorTextArea>\n )}\n </div>\n );\n }\n\n if (nodeType === NodeTypes.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 = memo<TextEditorProps>(\n function TextEditorContainer(props) {\n return (\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=\"2xl\"\n >\n <TextEditor {...props} />\n </Container>\n );\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAM,uBAAuB,WAC3B,OAAO,iCAA6B,CAAC,MAAM,OAAO,EAChD,SAAS,EAAE,iBACb,EAAE,CACJ;AAIA,MAAM,qBAAqB,WACzB,OAAO,iCAA6B,CAAC,MAAM,OAAO,EAChD,SAAS,EAAE,eACb,EAAE,CACJ;AAK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V;CAIL,IAAI,aAAa,UAAU,QACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,oBAAD;GACc;GACH;GACT,MAAK;GACL,cAAW;aAEV;EACiB;CACjB;CAIT,IAAI,aAAa,UAAU,MACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACZ,OAAO,kBAAkB,aACxB,cAAc,SAAmB,OAAO,IAExC,oBAAC,uBAAD;GACE,SAAQ;GACR,cAAW;GACF;GACG;aAEX;EACoB;CAEtB;CAIT,IAAI,aAAa,UAAU,SACzB,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,qBAAD;GACc;GACH;GACT,OAAO;EACR;CACE;CAIT,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GAA4B;GAEzB,KAAK,UAAU,SAAS,MAAM,CAAC;GAC/B,KAAK,UAAU,SAAS,MAAM,CAAC;GAAE;GACtB;EACT;;AAET,CAAC;AAED,MAAa,sBAAsB,KACjC,SAAS,oBAAoB,OAAO;CAClC,OACE,oBAAC,WAAD;EACE;EACA,YAAW;EACX,WAAU;EACV,aAAY;YAEZ,oBAAC,YAAD,EAAY,GAAI,MAAQ;CACf;AAEf,CACF"}
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { Button } from "../../Button/Button.mjs";
|
|
3
4
|
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
4
5
|
import { useAddDictionary } from "../../../api/hooks/dictionary.mjs";
|
|
5
6
|
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
6
|
-
import { Button } from "../../Button/Button.mjs";
|
|
7
7
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
8
8
|
import { Select } from "../../Select/Select.mjs";
|
|
9
9
|
import { InputElement } from "../../Form/elements/InputElement.mjs";
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils/cn.mjs";
|
|
4
|
-
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
5
|
-
import { useAuditContentDeclarationMetadata } from "../../../api/hooks/ai.mjs";
|
|
6
|
-
import { useGetDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
7
|
-
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
8
|
-
import { useGetTags } from "../../../api/hooks/tag.mjs";
|
|
9
4
|
import { Loader } from "../../Loader/index.mjs";
|
|
10
5
|
import { Button } from "../../Button/Button.mjs";
|
|
11
6
|
import { Container } from "../../Container/index.mjs";
|
|
12
7
|
import { Checkbox } from "../../Input/Checkbox.mjs";
|
|
13
8
|
import { Input } from "../../Input/Input.mjs";
|
|
9
|
+
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
10
|
+
import { useAuditContentDeclarationMetadata } from "../../../api/hooks/ai.mjs";
|
|
11
|
+
import { useGetDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
12
|
+
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
13
|
+
import { useGetTags } from "../../../api/hooks/tag.mjs";
|
|
14
14
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
15
15
|
import { Select } from "../../Select/Select.mjs";
|
|
16
16
|
import { Pagination } from "../../Pagination/Pagination.mjs";
|
|
@@ -30,8 +30,8 @@ import { useDictionaryDetailsSchema } from "./useDictionaryDetailsSchema.mjs";
|
|
|
30
30
|
import { useEffect, useMemo, useState } from "react";
|
|
31
31
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
32
|
import { WandSparkles } from "lucide-react";
|
|
33
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
34
33
|
import { useIntlayer } from "react-intlayer";
|
|
34
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
35
35
|
import { useWatch } from "react-hook-form";
|
|
36
36
|
import { AnimatePresence, motion } from "framer-motion";
|
|
37
37
|
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryDetailsForm.mjs","names":["useForm","FormEditableFieldInput","FormEditableFieldTextArea","FormLabel","FormInput","FormSelect","FormMultiSelect","FormButton"],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport {\n useAuditContentDeclarationMetadata,\n useGetDictionaries,\n useGetProjects,\n useGetTags,\n} from '@api/index';\nimport { useSession } from '@api/useAuth';\n\nimport { Container } from '@components/Container';\nimport {\n Form,\n FormButton,\n FormDescription,\n FormEditableFieldInput,\n FormEditableFieldTextArea,\n FormField,\n FormInput,\n FormItem,\n FormLabel,\n FormMessage,\n FormMultiSelect,\n FormSelect,\n useForm,\n} from '@components/Form';\nimport { Checkbox, Input } from '@components/Input';\nimport { Loader } from '@components/Loader';\nimport { Pagination } from '@components/Pagination';\nimport { MultiSelect, Select } from '@components/Select';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport { cn } from '@utils/cn';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect, useMemo, useState } from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { useIntlayer } from 'react-intlayer';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onSelectSibling?: (dictionary: Dictionary) => void;\n isDarkMode?: boolean;\n};\n\ntype QualifierType = 'collection' | 'variant';\n\nconst QUALIFIER_TYPES: QualifierType[] = ['collection', 'variant'];\n\n/** Derive active qualifier types from dictionary qualifier fields. */\nconst deriveQualifierTypes = (dict: Dictionary): QualifierType[] => {\n const types: QualifierType[] = [];\n if (dict.item !== undefined) types.push('collection');\n if (dict.variant !== undefined) types.push('variant');\n return types;\n};\n\n/**\n * A variant can be a named string or a structured object. The CMS edits it as\n * text: a value starting with `{` is parsed as JSON (object variant), anything\n * else is kept as a named-variant string.\n */\nconst formatVariant = (\n variant: string | Record<string, string | number> | undefined\n): string =>\n variant !== null && typeof variant === 'object'\n ? JSON.stringify(variant)\n : (variant ?? '');\n\nconst parseVariantInput = (\n raw: string\n): { variant: string | Record<string, string | number>; error: boolean } => {\n if (raw.trim().startsWith('{')) {\n try {\n return {\n variant: JSON.parse(raw) as Record<string, string | number>,\n error: false,\n };\n } catch {\n return { variant: raw, error: true };\n }\n }\n return { variant: raw, error: false };\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n onSelectSibling,\n}) => {\n const { session } = useSession();\n const { project } = session ?? {};\n const { data: projectsData, isLoading: isLoadingProjects } =\n useGetProjects() as any;\n const { data: tagsData } = useGetTags() as any;\n\n const projects = (projectsData?.data ?? []) as any[];\n const allTags = (tagsData?.data ?? []) as any[];\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: {\n ...dictionary,\n location: dictionary.location ?? 'remote',\n },\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n projectInput,\n tagsSelect,\n locationSelect,\n importModeSelect,\n filePathInput,\n auditButton,\n qualifierSection,\n siblingDictionaries: siblingContent,\n typeSwitch,\n } = useIntlayer('dictionary-details');\n const { mutate: auditContentDeclaration, isPending: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary =\n editedContent?.[dictionary.localId as LocalDictionaryId];\n\n const { data: siblingsData, isLoading: isLoadingSiblings } =\n useGetDictionaries(\n { keys: [dictionary.key] },\n { enabled: !!dictionary.key }\n );\n\n const siblings = useMemo<Dictionary[]>(\n () =>\n ((siblingsData?.data ?? []) as unknown as Dictionary[]).filter(\n (d: Dictionary) => d.localId !== dictionary.localId\n ),\n [siblingsData, dictionary.localId]\n );\n\n const itemSiblings = useMemo(\n () =>\n siblings\n .filter((d) => d.item !== undefined)\n .sort((a, b) => (a.item ?? 0) - (b.item ?? 0)),\n [siblings]\n );\n\n const variantSiblings = useMemo(\n () => siblings.filter((d) => d.variant !== undefined),\n [siblings]\n );\n\n const allItemDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.item !== undefined) {\n const combined = [dictionary, ...itemSiblings].sort(\n (a, b) => (a.item ?? 0) - (b.item ?? 0)\n );\n return combined;\n }\n return itemSiblings;\n }, [dictionary, itemSiblings]);\n\n const allVariantDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.variant !== undefined) {\n return [dictionary, ...variantSiblings];\n }\n return variantSiblings;\n }, [dictionary, variantSiblings]);\n\n useEffect(() => {\n form.reset({\n ...dictionary,\n tags: dictionary.tags ?? [],\n location: dictionary.location ?? 'remote',\n });\n setSelectedTypes(deriveQualifierTypes(dictionary));\n setItemValue(dictionary.item ?? 1);\n setVariantValue(formatVariant(dictionary.variant));\n setVariantJsonError(false);\n setShowSiblingPicker(false);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset({\n ...dictionary,\n tags: dictionary.tags ?? [],\n location: dictionary.location ?? 'remote',\n });\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n auditContentDeclaration(\n {\n fileContent: JSON.stringify(dictionaryToAudit),\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n const auditedDictionary = response.data.fileContent;\n\n const merged = {\n ...dictionaryToAudit,\n ...auditedDictionary,\n tags: auditedDictionary.tags ?? dictionaryToAudit.tags ?? [],\n };\n\n setEditedDictionary(merged as Dictionary);\n form.reset(merged);\n },\n }\n );\n };\n\n const watchedLocation = useWatch({\n control: form.control,\n name: 'location',\n });\n const isLocalChecked =\n watchedLocation === 'local' || watchedLocation === 'hybrid';\n\n const hasSiblings = siblings.length > 0;\n\n const [selectedTypes, setSelectedTypes] = useState<QualifierType[]>(() =>\n deriveQualifierTypes(dictionary)\n );\n const [itemValue, setItemValue] = useState<number>(dictionary.item ?? 1);\n const [variantValue, setVariantValue] = useState<string>(\n formatVariant(dictionary.variant)\n );\n const [variantJsonError, setVariantJsonError] = useState(false);\n const [showSiblingPicker, setShowSiblingPicker] = useState(false);\n\n const allQualifiedSiblings = useMemo<Dictionary[]>(\n () => [...itemSiblings, ...variantSiblings],\n [itemSiblings, variantSiblings]\n );\n\n const handleTypesChange = (newTypes: string | string[]) => {\n const nextTypes = [newTypes].flat() as QualifierType[];\n const added = nextTypes.filter((t) => !selectedTypes.includes(t));\n const removed = selectedTypes.filter((t) => !nextTypes.includes(t));\n\n let base = { ...dictionary, ...(updatedDictionary ?? {}) };\n\n for (const qualifier of removed) {\n if (qualifier === 'collection') base = { ...base, item: undefined };\n if (qualifier === 'variant') base = { ...base, variant: undefined };\n }\n\n for (const qualifier of added) {\n if (qualifier === 'collection') {\n const nextItem =\n allItemDicts.length > 0\n ? Math.max(...allItemDicts.map((d) => d.item ?? 0)) + 1\n : 1;\n setItemValue(nextItem);\n base = { ...base, item: nextItem };\n } else if (qualifier === 'variant') {\n const newVariant = variantValue || 'default';\n setVariantValue(newVariant);\n base = { ...base, variant: parseVariantInput(newVariant).variant };\n }\n }\n\n setSelectedTypes(nextTypes);\n setEditedDictionary(base);\n setVariantJsonError(false);\n\n if (nextTypes.length === 0 && allQualifiedSiblings.length > 0) {\n setShowSiblingPicker(true);\n } else {\n setShowSiblingPicker(false);\n }\n };\n\n return (\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n >\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormEditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n key: value,\n });\n }}\n />\n <FormEditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n title: value,\n });\n }}\n />\n </div>\n <FormEditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n description: value,\n });\n }}\n />\n <div className=\"grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1\">\n <FormField\n control={form.control}\n name=\"location\"\n render={({ field }) => {\n const value = field.value;\n const isLocal = value === 'local' || value === 'hybrid';\n const isRemote = value === 'remote' || value === 'hybrid';\n\n const handleLocalToggle = (isChecked: boolean) => {\n if (!isChecked && !isRemote) return;\n\n const newValue: Dictionary['location'] = isChecked\n ? isRemote\n ? 'hybrid'\n : 'local'\n : 'remote';\n\n field.onChange(newValue);\n\n const newFilePath = isChecked\n ? (form.getValues('filePath') ?? dictionary.filePath)\n : undefined;\n\n if (!isChecked) {\n form.setValue('filePath', undefined);\n }\n\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n location: newValue,\n filePath: newFilePath,\n });\n };\n\n const handleRemoteToggle = (isChecked: boolean) => {\n if (!isChecked && !isLocal) return;\n\n const newValue: Dictionary['location'] = isChecked\n ? isLocal\n ? 'hybrid'\n : 'remote'\n : 'local';\n\n field.onChange(newValue);\n\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n location: newValue,\n });\n };\n\n return (\n <FormItem className=\"flex flex-col gap-2 px-1\">\n <FormLabel className=\"ml-1\">{locationSelect.label}</FormLabel>\n <div className=\"ml-2 flex items-center gap-4 py-2\">\n <Checkbox\n id=\"location-local\"\n name=\"location-local\"\n label={locationSelect.local.value}\n color=\"text\"\n checked={isLocal}\n disabled={\n !mode.includes('local') && !mode.includes('remote')\n }\n onChange={(e) => handleLocalToggle(e.target.checked)}\n />\n <Checkbox\n id=\"location-remote\"\n name=\"location-remote\"\n label={locationSelect.remote.value}\n color=\"text\"\n checked={isRemote}\n disabled={\n !mode.includes('remote') &&\n dictionary.location !== 'remote' &&\n dictionary.location !== 'hybrid'\n }\n onChange={(e) => handleRemoteToggle(e.target.checked)}\n />\n </div>\n <FormDescription>\n {locationSelect.testDescription}\n </FormDescription>\n <FormMessage />\n </FormItem>\n );\n }}\n />\n\n <AnimatePresence mode=\"wait\">\n {isLocalChecked && (\n <motion.div\n key=\"filePath-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.3 }}\n >\n <FormInput\n name=\"filePath\"\n label={filePathInput.label.value}\n placeholder={filePathInput.placeholder.value}\n description={filePathInput.description.value}\n disabled={isSubmitting || !isLocalChecked}\n onChange={(e) => {\n const value = e.target.value;\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n filePath: value,\n });\n }}\n />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormSelect\n name=\"importMode\"\n label={importModeSelect.label.value}\n description={importModeSelect.description.value}\n onValueChange={(value) => {\n form.setValue('importMode', value as any, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n importMode: value as any,\n });\n }}\n >\n <Select.Trigger>\n <Select.Value placeholder={importModeSelect.label.value} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"static\">\n {importModeSelect.static.value}\n </Select.Item>\n <Select.Item value=\"dynamic\">\n {importModeSelect.dynamic.value}\n </Select.Item>\n <Select.Item value=\"live\">\n {importModeSelect.live.value}\n </Select.Item>\n </Select.Content>\n </FormSelect>\n </div>\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormMultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n projectIds: valueArray,\n });\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.find((project: any) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.map((project: any) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </FormMultiSelect>\n\n <FormMultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('tags', valueArray, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n tags: valueArray,\n });\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n allTags?.find((tag: any) => String(tag.key) === value)?.name ??\n value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {allTags?.map((tag: any) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </FormMultiSelect>\n </div>\n\n {/* Type switcher */}\n <Container\n className=\"gap-4\"\n padding=\"md\"\n roundedSize=\"2xl\"\n background=\"none\"\n border\n borderColor=\"card\"\n >\n <div className=\"flex flex-col gap-1\">\n <p className=\"ml-1 font-semibold text-sm\">{typeSwitch.label}</p>\n <p className=\"ml-1 text-muted text-xs\">{typeSwitch.description}</p>\n </div>\n <MultiSelect\n values={selectedTypes}\n onValueChange={handleTypesChange}\n className=\"max-w-xs\"\n >\n <MultiSelect.Trigger\n getBadgeValue={(val) => {\n if (val === 'collection') return String(typeSwitch.collection);\n if (val === 'variant') return String(typeSwitch.variant);\n return val;\n }}\n >\n <MultiSelect.Input placeholder={typeSwitch.label.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {QUALIFIER_TYPES.map((qualifier) => (\n <MultiSelect.Item key={qualifier} value={qualifier}>\n {typeSwitch[qualifier].value}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </MultiSelect.Content>\n </MultiSelect>\n <AnimatePresence>\n {selectedTypes.includes('collection') && (\n <motion.div\n key=\"item-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <div className=\"flex flex-col gap-2 px-1\">\n <label\n htmlFor=\"qualifier-item-value\"\n className=\"ml-1 font-medium text-sm\"\n >\n {typeSwitch.itemValueLabel}\n </label>\n <Input\n id=\"qualifier-item-value\"\n type=\"number\"\n min={1}\n value={itemValue}\n placeholder={typeSwitch.itemValuePlaceholder.value}\n onChange={(e) => {\n const value = parseInt(e.target.value, 10);\n if (!Number.isNaN(value) && value >= 1) {\n setItemValue(value);\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n item: value,\n });\n }\n }}\n />\n </div>\n </motion.div>\n )}\n\n {selectedTypes.includes('variant') && (\n <motion.div\n key=\"variant-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <div className=\"flex flex-col gap-2 px-1\">\n <label\n htmlFor=\"qualifier-variant-value\"\n className=\"ml-1 font-medium text-sm\"\n >\n {typeSwitch.variantValueLabel}\n </label>\n <Input\n id=\"qualifier-variant-value\"\n type=\"text\"\n value={variantValue}\n placeholder={typeSwitch.variantValuePlaceholder.value}\n onChange={(e) => {\n const value = e.target.value;\n setVariantValue(value);\n const { variant, error } = parseVariantInput(value);\n setVariantJsonError(error);\n if (!error) {\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n variant,\n });\n }\n }}\n />\n {variantJsonError && (\n <p className=\"ml-1 text-destructive text-xs\">\n {typeSwitch.variantJsonError}\n </p>\n )}\n </div>\n </motion.div>\n )}\n\n {selectedTypes.length === 0 && showSiblingPicker && (\n <motion.div\n key=\"sibling-picker\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <Container\n background=\"none\"\n border\n borderColor=\"neutral\"\n roundedSize=\"xl\"\n padding=\"md\"\n className=\"gap-3\"\n >\n <p className=\"font-medium text-sm\">\n {typeSwitch.disablePickerTitle}\n </p>\n <p className=\"text-muted text-xs\">\n {typeSwitch.disablePickerDescription}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {allQualifiedSiblings.map((sibling) => (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => {\n onSelectSibling?.(sibling);\n setShowSiblingPicker(false);\n }}\n className=\"cursor-pointer rounded-lg border border-border px-3 py-1 text-xs transition-colors hover:bg-text/10\"\n >\n {sibling.variant !== undefined && (\n <span>\n {qualifierSection.variant}:{' '}\n {formatVariant(sibling.variant)}\n </span>\n )}\n {sibling.item !== undefined && (\n <span>\n {qualifierSection.item}: {sibling.item}\n </span>\n )}\n </button>\n ))}\n </div>\n </Container>\n </motion.div>\n )}\n </AnimatePresence>\n </Container>\n\n {/* Sibling dictionaries panel */}\n <Container\n className=\"gap-4\"\n padding=\"md\"\n roundedSize=\"2xl\"\n background=\"none\"\n border\n borderColor=\"neutral\"\n >\n <p className=\"font-semibold text-sm\">{siblingContent.title}</p>\n <Loader isLoading={isLoadingSiblings}>\n {!hasSiblings && (\n <p className=\"text-muted text-sm\">{siblingContent.noSiblings}</p>\n )}\n\n {allItemDicts.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n <p className=\"font-medium text-muted text-xs uppercase tracking-wide\">\n {siblingContent.collectionItems}\n </p>\n <Pagination\n currentPage={\n allItemDicts.findIndex(\n (dictionaryEl) =>\n dictionaryEl.localId === dictionary.localId\n ) + 1 || 1\n }\n totalPages={allItemDicts.length}\n onPageChange={(page) => {\n const target = allItemDicts[page - 1];\n if (target && onSelectSibling) {\n onSelectSibling(target);\n }\n }}\n showPrevNext\n />\n <div className=\"mt-1 flex flex-wrap gap-2\">\n {allItemDicts.map((sibling) => {\n const isActive = sibling.localId === dictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && onSelectSibling?.(sibling)}\n className={cn(\n 'rounded-lg px-3 py-1 text-xs transition-colors',\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n )}\n >\n {siblingContent.itemIndex} {sibling.item}\n </button>\n );\n })}\n </div>\n </div>\n )}\n\n {allVariantDicts.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n <p className=\"font-medium text-muted text-xs uppercase tracking-wide\">\n {siblingContent.variants}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {allVariantDicts.map((sibling) => {\n const isActive = sibling.localId === dictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && onSelectSibling?.(sibling)}\n className={cn(\n 'rounded-lg px-3 py-1 text-xs transition-colors',\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n )}\n >\n {formatVariant(sibling.variant)}\n </button>\n );\n })}\n </div>\n </div>\n )}\n </Loader>\n </Container>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <FormButton\n type=\"button\"\n size=\"icon-md\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n />\n </div>\n </Form>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAM,kBAAmC,CAAC,cAAc,SAAS;;AAGjE,MAAM,wBAAwB,SAAsC;CAClE,MAAM,QAAyB,CAAC;CAChC,IAAI,KAAK,SAAS,QAAW,MAAM,KAAK,YAAY;CACpD,IAAI,KAAK,YAAY,QAAW,MAAM,KAAK,SAAS;CACpD,OAAO;AACT;;;;;;AAOA,MAAM,iBACJ,YAEA,YAAY,QAAQ,OAAO,YAAY,WACnC,KAAK,UAAU,OAAO,IACrB,WAAW;AAElB,MAAM,qBACJ,QAC0E;CAC1E,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,GAC3B,IAAI;EACF,OAAO;GACL,SAAS,KAAK,MAAM,GAAG;GACvB,OAAO;EACT;CACF,QAAQ;EACN,OAAO;GAAE,SAAS;GAAK,OAAO;EAAK;CACrC;CAEF,OAAO;EAAE,SAAS;EAAK,OAAO;CAAM;AACtC;AAEA,MAAa,yBAAqD,EAChE,YACA,MACA,sBACI;CACJ,MAAM,EAAE,YAAY,WAAW;CAC/B,MAAM,EAAE,YAAY,WAAW,CAAC;CAChC,MAAM,EAAE,MAAM,cAAc,WAAW,sBACrC,eAAe;CACjB,MAAM,EAAE,MAAM,aAAa,WAAW;CAEtC,MAAM,WAAY,cA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K,YAAY;SAChC,MAAM,WAAW,QAAQ,YAAY,WAAW;SAChD,OACE,oBAAC,UAAD;UAEE,MAAK;UACL,eAAe,CAAC,YAAY,kBAAkB,OAAO;UACrD,WAAW,GACT,kDACA,WACI,6CACA,sDACN;oBAEC,cAAc,QAAQ,OAAO;SACxB,GAXD,QAAQ,OAWP;QAEZ,CAAC;OACE,EACF;;KAED;MACC;;GAEX,oBAAC,OAAD;IAAK,WAAU;cACb,oBAACC,QAAD;KACE,MAAK;KACL,MAAK;KACL,OAAO,YAAY,MAAM;KACzB,MAAM;KACN,SAAQ;KACR,OAAM;KACN,WAAU;KACV,SAAS;KACT,UAAU,gBAAgB;KAC1B,WAAW;IACZ;GACE;EACD;;AAEV"}
|
|
1
|
+
{"version":3,"file":"DictionaryDetailsForm.mjs","names":["useForm","FormEditableFieldInput","FormEditableFieldTextArea","FormLabel","FormInput","FormSelect","FormMultiSelect","FormButton"],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport {\n useAuditContentDeclarationMetadata,\n useGetDictionaries,\n useGetProjects,\n useGetTags,\n} from '@api/index';\nimport { useSession } from '@api/useAuth';\n\nimport { Container } from '@components/Container';\nimport {\n Form,\n FormButton,\n FormDescription,\n FormEditableFieldInput,\n FormEditableFieldTextArea,\n FormField,\n FormInput,\n FormItem,\n FormLabel,\n FormMessage,\n FormMultiSelect,\n FormSelect,\n useForm,\n} from '@components/Form';\nimport { Checkbox, Input } from '@components/Input';\nimport { Loader } from '@components/Loader';\nimport { Pagination } from '@components/Pagination';\nimport { MultiSelect, Select } from '@components/Select';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport { cn } from '@utils/cn';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { WandSparkles } from 'lucide-react';\nimport { type FC, useEffect, useMemo, useState } from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { useIntlayer } from 'react-intlayer';\nimport { useDictionaryDetailsSchema } from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onSelectSibling?: (dictionary: Dictionary) => void;\n};\n\ntype QualifierType = 'collection' | 'variant';\n\nconst QUALIFIER_TYPES: QualifierType[] = ['collection', 'variant'];\n\n/** Derive active qualifier types from dictionary qualifier fields. */\nconst deriveQualifierTypes = (dict: Dictionary): QualifierType[] => {\n const types: QualifierType[] = [];\n if (dict.item !== undefined) types.push('collection');\n if (dict.variant !== undefined) types.push('variant');\n return types;\n};\n\n/**\n * A variant can be a named string or a structured object. The CMS edits it as\n * text: a value starting with `{` is parsed as JSON (object variant), anything\n * else is kept as a named-variant string.\n */\nconst formatVariant = (\n variant: string | Record<string, string | number> | undefined\n): string =>\n variant !== null && typeof variant === 'object'\n ? JSON.stringify(variant)\n : (variant ?? '');\n\nconst parseVariantInput = (\n raw: string\n): { variant: string | Record<string, string | number>; error: boolean } => {\n if (raw.trim().startsWith('{')) {\n try {\n return {\n variant: JSON.parse(raw) as Record<string, string | number>,\n error: false,\n };\n } catch {\n return { variant: raw, error: true };\n }\n }\n return { variant: raw, error: false };\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n onSelectSibling,\n}) => {\n const { session } = useSession();\n const { project } = session ?? {};\n const { data: projectsData, isLoading: isLoadingProjects } =\n useGetProjects() as any;\n const { data: tagsData } = useGetTags() as any;\n\n const projects = (projectsData?.data ?? []) as any[];\n const allTags = (tagsData?.data ?? []) as any[];\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?.id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: {\n ...dictionary,\n location: dictionary.location ?? 'remote',\n },\n });\n const { editedContent, setEditedDictionary } = useEditedContent();\n const {\n titleInput,\n keyInput,\n descriptionInput,\n projectInput,\n tagsSelect,\n locationSelect,\n importModeSelect,\n filePathInput,\n auditButton,\n qualifierSection,\n siblingDictionaries: siblingContent,\n typeSwitch,\n } = useIntlayer('dictionary-details');\n const { mutate: auditContentDeclaration, isPending: isAuditing } =\n useAuditContentDeclarationMetadata();\n const updatedDictionary =\n editedContent?.[dictionary.localId as LocalDictionaryId];\n\n const { data: siblingsData, isLoading: isLoadingSiblings } =\n useGetDictionaries(\n { keys: [dictionary.key] },\n { enabled: !!dictionary.key }\n );\n\n const siblings = useMemo<Dictionary[]>(\n () =>\n ((siblingsData?.data ?? []) as unknown as Dictionary[]).filter(\n (d: Dictionary) => d.localId !== dictionary.localId\n ),\n [siblingsData, dictionary.localId]\n );\n\n const itemSiblings = useMemo(\n () =>\n siblings\n .filter((d) => d.item !== undefined)\n .sort((a, b) => (a.item ?? 0) - (b.item ?? 0)),\n [siblings]\n );\n\n const variantSiblings = useMemo(\n () => siblings.filter((d) => d.variant !== undefined),\n [siblings]\n );\n\n const allItemDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.item !== undefined) {\n const combined = [dictionary, ...itemSiblings].sort(\n (a, b) => (a.item ?? 0) - (b.item ?? 0)\n );\n return combined;\n }\n return itemSiblings;\n }, [dictionary, itemSiblings]);\n\n const allVariantDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.variant !== undefined) {\n return [dictionary, ...variantSiblings];\n }\n return variantSiblings;\n }, [dictionary, variantSiblings]);\n\n useEffect(() => {\n form.reset({\n ...dictionary,\n tags: dictionary.tags ?? [],\n location: dictionary.location ?? 'remote',\n });\n setSelectedTypes(deriveQualifierTypes(dictionary));\n setItemValue(dictionary.item ?? 1);\n setVariantValue(formatVariant(dictionary.variant));\n setVariantJsonError(false);\n setShowSiblingPicker(false);\n }, [dictionary, form?.reset]);\n\n useEffect(() => {\n if (typeof updatedDictionary === 'undefined') {\n form.reset({\n ...dictionary,\n tags: dictionary.tags ?? [],\n location: dictionary.location ?? 'remote',\n });\n }\n }, [updatedDictionary]);\n\n const handleOnAuditFile = () => {\n const dictionaryToAudit = {\n ...dictionary,\n ...updatedDictionary,\n };\n\n auditContentDeclaration(\n {\n fileContent: JSON.stringify(dictionaryToAudit),\n },\n {\n onSuccess: (response) => {\n if (!response?.data) return;\n\n const auditedDictionary = response.data.fileContent;\n\n const merged = {\n ...dictionaryToAudit,\n ...auditedDictionary,\n tags: auditedDictionary.tags ?? dictionaryToAudit.tags ?? [],\n };\n\n setEditedDictionary(merged as Dictionary);\n form.reset(merged);\n },\n }\n );\n };\n\n const watchedLocation = useWatch({\n control: form.control,\n name: 'location',\n });\n const isLocalChecked =\n watchedLocation === 'local' || watchedLocation === 'hybrid';\n\n const hasSiblings = siblings.length > 0;\n\n const [selectedTypes, setSelectedTypes] = useState<QualifierType[]>(() =>\n deriveQualifierTypes(dictionary)\n );\n const [itemValue, setItemValue] = useState<number>(dictionary.item ?? 1);\n const [variantValue, setVariantValue] = useState<string>(\n formatVariant(dictionary.variant)\n );\n const [variantJsonError, setVariantJsonError] = useState(false);\n const [showSiblingPicker, setShowSiblingPicker] = useState(false);\n\n const allQualifiedSiblings = useMemo<Dictionary[]>(\n () => [...itemSiblings, ...variantSiblings],\n [itemSiblings, variantSiblings]\n );\n\n const handleTypesChange = (newTypes: string | string[]) => {\n const nextTypes = [newTypes].flat() as QualifierType[];\n const added = nextTypes.filter((t) => !selectedTypes.includes(t));\n const removed = selectedTypes.filter((t) => !nextTypes.includes(t));\n\n let base = { ...dictionary, ...(updatedDictionary ?? {}) };\n\n for (const qualifier of removed) {\n if (qualifier === 'collection') base = { ...base, item: undefined };\n if (qualifier === 'variant') base = { ...base, variant: undefined };\n }\n\n for (const qualifier of added) {\n if (qualifier === 'collection') {\n const nextItem =\n allItemDicts.length > 0\n ? Math.max(...allItemDicts.map((d) => d.item ?? 0)) + 1\n : 1;\n setItemValue(nextItem);\n base = { ...base, item: nextItem };\n } else if (qualifier === 'variant') {\n const newVariant = variantValue || 'default';\n setVariantValue(newVariant);\n base = { ...base, variant: parseVariantInput(newVariant).variant };\n }\n }\n\n setSelectedTypes(nextTypes);\n setEditedDictionary(base);\n setVariantJsonError(false);\n\n if (nextTypes.length === 0 && allQualifiedSiblings.length > 0) {\n setShowSiblingPicker(true);\n } else {\n setShowSiblingPicker(false);\n }\n };\n\n return (\n <Form\n className=\"flex w-full flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n >\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormEditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n onSave={(value) => {\n form.setValue('key', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n key: value,\n });\n }}\n />\n <FormEditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('title', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n title: value,\n });\n }}\n />\n </div>\n <FormEditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n onSave={(value) => {\n form.setValue('description', value, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n description: value,\n });\n }}\n />\n <div className=\"grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1\">\n <FormField\n control={form.control}\n name=\"location\"\n render={({ field }) => {\n const value = field.value;\n const isLocal = value === 'local' || value === 'hybrid';\n const isRemote = value === 'remote' || value === 'hybrid';\n\n const handleLocalToggle = (isChecked: boolean) => {\n if (!isChecked && !isRemote) return;\n\n const newValue: Dictionary['location'] = isChecked\n ? isRemote\n ? 'hybrid'\n : 'local'\n : 'remote';\n\n field.onChange(newValue);\n\n const newFilePath = isChecked\n ? (form.getValues('filePath') ?? dictionary.filePath)\n : undefined;\n\n if (!isChecked) {\n form.setValue('filePath', undefined);\n }\n\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n location: newValue,\n filePath: newFilePath,\n });\n };\n\n const handleRemoteToggle = (isChecked: boolean) => {\n if (!isChecked && !isLocal) return;\n\n const newValue: Dictionary['location'] = isChecked\n ? isLocal\n ? 'hybrid'\n : 'remote'\n : 'local';\n\n field.onChange(newValue);\n\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n location: newValue,\n });\n };\n\n return (\n <FormItem className=\"flex flex-col gap-2 px-1\">\n <FormLabel className=\"ml-1\">{locationSelect.label}</FormLabel>\n <div className=\"ml-2 flex items-center gap-4 py-2\">\n <Checkbox\n id=\"location-local\"\n name=\"location-local\"\n label={locationSelect.local.value}\n color=\"text\"\n checked={isLocal}\n disabled={\n !mode.includes('local') && !mode.includes('remote')\n }\n onChange={(e) => handleLocalToggle(e.target.checked)}\n />\n <Checkbox\n id=\"location-remote\"\n name=\"location-remote\"\n label={locationSelect.remote.value}\n color=\"text\"\n checked={isRemote}\n disabled={\n !mode.includes('remote') &&\n dictionary.location !== 'remote' &&\n dictionary.location !== 'hybrid'\n }\n onChange={(e) => handleRemoteToggle(e.target.checked)}\n />\n </div>\n <FormDescription>\n {locationSelect.testDescription}\n </FormDescription>\n <FormMessage />\n </FormItem>\n );\n }}\n />\n\n <AnimatePresence mode=\"wait\">\n {isLocalChecked && (\n <motion.div\n key=\"filePath-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.3 }}\n >\n <FormInput\n name=\"filePath\"\n label={filePathInput.label.value}\n placeholder={filePathInput.placeholder.value}\n description={filePathInput.description.value}\n disabled={isSubmitting || !isLocalChecked}\n onChange={(e) => {\n const value = e.target.value;\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n filePath: value,\n });\n }}\n />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormSelect\n name=\"importMode\"\n label={importModeSelect.label.value}\n description={importModeSelect.description.value}\n onValueChange={(value) => {\n form.setValue('importMode', value as any, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n importMode: value as any,\n });\n }}\n >\n <Select.Trigger>\n <Select.Value placeholder={importModeSelect.label.value} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"static\">\n {importModeSelect.static.value}\n </Select.Item>\n <Select.Item value=\"dynamic\">\n {importModeSelect.dynamic.value}\n </Select.Item>\n <Select.Item value=\"live\">\n {importModeSelect.live.value}\n </Select.Item>\n </Select.Content>\n </FormSelect>\n </div>\n <div className=\"grid grid-cols-2 gap-8 max-md:grid-cols-1\">\n <FormMultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('projectIds', valueArray, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n projectIds: valueArray,\n });\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.find((project: any) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.map((project: any) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </FormMultiSelect>\n\n <FormMultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description}\n onValueChange={(value) => {\n const valueArray = [value].flat();\n form.setValue('tags', valueArray, { shouldDirty: true });\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n tags: valueArray,\n });\n }}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n allTags?.find((tag: any) => String(tag.key) === value)?.name ??\n value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {allTags?.map((tag: any) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </FormMultiSelect>\n </div>\n\n {/* Type switcher */}\n <Container\n className=\"gap-4\"\n padding=\"md\"\n roundedSize=\"2xl\"\n background=\"none\"\n border\n borderColor=\"card\"\n >\n <div className=\"flex flex-col gap-1\">\n <p className=\"ml-1 font-semibold text-sm\">{typeSwitch.label}</p>\n <p className=\"ml-1 text-muted text-xs\">{typeSwitch.description}</p>\n </div>\n <MultiSelect\n values={selectedTypes}\n onValueChange={handleTypesChange}\n className=\"max-w-xs\"\n >\n <MultiSelect.Trigger\n getBadgeValue={(val) => {\n if (val === 'collection') return String(typeSwitch.collection);\n if (val === 'variant') return String(typeSwitch.variant);\n return val;\n }}\n >\n <MultiSelect.Input placeholder={typeSwitch.label.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {QUALIFIER_TYPES.map((qualifier) => (\n <MultiSelect.Item key={qualifier} value={qualifier}>\n {typeSwitch[qualifier].value}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </MultiSelect.Content>\n </MultiSelect>\n <AnimatePresence>\n {selectedTypes.includes('collection') && (\n <motion.div\n key=\"item-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <div className=\"flex flex-col gap-2 px-1\">\n <label\n htmlFor=\"qualifier-item-value\"\n className=\"ml-1 font-medium text-sm\"\n >\n {typeSwitch.itemValueLabel}\n </label>\n <Input\n id=\"qualifier-item-value\"\n type=\"number\"\n min={1}\n value={itemValue}\n placeholder={typeSwitch.itemValuePlaceholder.value}\n onChange={(e) => {\n const value = parseInt(e.target.value, 10);\n if (!Number.isNaN(value) && value >= 1) {\n setItemValue(value);\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n item: value,\n });\n }\n }}\n />\n </div>\n </motion.div>\n )}\n\n {selectedTypes.includes('variant') && (\n <motion.div\n key=\"variant-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <div className=\"flex flex-col gap-2 px-1\">\n <label\n htmlFor=\"qualifier-variant-value\"\n className=\"ml-1 font-medium text-sm\"\n >\n {typeSwitch.variantValueLabel}\n </label>\n <Input\n id=\"qualifier-variant-value\"\n type=\"text\"\n value={variantValue}\n placeholder={typeSwitch.variantValuePlaceholder.value}\n onChange={(e) => {\n const value = e.target.value;\n setVariantValue(value);\n const { variant, error } = parseVariantInput(value);\n setVariantJsonError(error);\n if (!error) {\n setEditedDictionary({\n ...dictionary,\n ...(updatedDictionary ?? {}),\n variant,\n });\n }\n }}\n />\n {variantJsonError && (\n <p className=\"ml-1 text-destructive text-xs\">\n {typeSwitch.variantJsonError}\n </p>\n )}\n </div>\n </motion.div>\n )}\n\n {selectedTypes.length === 0 && showSiblingPicker && (\n <motion.div\n key=\"sibling-picker\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n >\n <Container\n background=\"none\"\n border\n borderColor=\"neutral\"\n roundedSize=\"xl\"\n padding=\"md\"\n className=\"gap-3\"\n >\n <p className=\"font-medium text-sm\">\n {typeSwitch.disablePickerTitle}\n </p>\n <p className=\"text-muted text-xs\">\n {typeSwitch.disablePickerDescription}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {allQualifiedSiblings.map((sibling) => (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => {\n onSelectSibling?.(sibling);\n setShowSiblingPicker(false);\n }}\n className=\"cursor-pointer rounded-lg border border-border px-3 py-1 text-xs transition-colors hover:bg-text/10\"\n >\n {sibling.variant !== undefined && (\n <span>\n {qualifierSection.variant}:{' '}\n {formatVariant(sibling.variant)}\n </span>\n )}\n {sibling.item !== undefined && (\n <span>\n {qualifierSection.item}: {sibling.item}\n </span>\n )}\n </button>\n ))}\n </div>\n </Container>\n </motion.div>\n )}\n </AnimatePresence>\n </Container>\n\n {/* Sibling dictionaries panel */}\n <Container\n className=\"gap-4\"\n padding=\"md\"\n roundedSize=\"2xl\"\n background=\"none\"\n border\n borderColor=\"neutral\"\n >\n <p className=\"font-semibold text-sm\">{siblingContent.title}</p>\n <Loader isLoading={isLoadingSiblings}>\n {!hasSiblings && (\n <p className=\"text-muted text-sm\">{siblingContent.noSiblings}</p>\n )}\n\n {allItemDicts.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n <p className=\"font-medium text-muted text-xs uppercase tracking-wide\">\n {siblingContent.collectionItems}\n </p>\n <Pagination\n currentPage={\n allItemDicts.findIndex(\n (dictionaryEl) =>\n dictionaryEl.localId === dictionary.localId\n ) + 1 || 1\n }\n totalPages={allItemDicts.length}\n onPageChange={(page) => {\n const target = allItemDicts[page - 1];\n if (target && onSelectSibling) {\n onSelectSibling(target);\n }\n }}\n showPrevNext\n />\n <div className=\"mt-1 flex flex-wrap gap-2\">\n {allItemDicts.map((sibling) => {\n const isActive = sibling.localId === dictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && onSelectSibling?.(sibling)}\n className={cn(\n 'rounded-lg px-3 py-1 text-xs transition-colors',\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n )}\n >\n {siblingContent.itemIndex} {sibling.item}\n </button>\n );\n })}\n </div>\n </div>\n )}\n\n {allVariantDicts.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n <p className=\"font-medium text-muted text-xs uppercase tracking-wide\">\n {siblingContent.variants}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {allVariantDicts.map((sibling) => {\n const isActive = sibling.localId === dictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && onSelectSibling?.(sibling)}\n className={cn(\n 'rounded-lg px-3 py-1 text-xs transition-colors',\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n )}\n >\n {formatVariant(sibling.variant)}\n </button>\n );\n })}\n </div>\n </div>\n )}\n </Loader>\n </Container>\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <FormButton\n type=\"button\"\n size=\"icon-md\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n />\n </div>\n </Form>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,kBAAmC,CAAC,cAAc,SAAS;;AAGjE,MAAM,wBAAwB,SAAsC;CAClE,MAAM,QAAyB,CAAC;CAChC,IAAI,KAAK,SAAS,QAAW,MAAM,KAAK,YAAY;CACpD,IAAI,KAAK,YAAY,QAAW,MAAM,KAAK,SAAS;CACpD,OAAO;AACT;;;;;;AAOA,MAAM,iBACJ,YAEA,YAAY,QAAQ,OAAO,YAAY,WACnC,KAAK,UAAU,OAAO,IACrB,WAAW;AAElB,MAAM,qBACJ,QAC0E;CAC1E,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,GAC3B,IAAI;EACF,OAAO;GACL,SAAS,KAAK,MAAM,GAAG;GACvB,OAAO;EACT;CACF,QAAQ;EACN,OAAO;GAAE,SAAS;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OAAO;WACrD,WAAW,GACT,kDACA,WACI,6CACA,sDACN;qBATF;YAWG,eAAe;YAAU;YAAE,QAAQ;WAC9B;aAXD,QAAQ,OAWP;SAEZ,CAAC;QACE;OACF;;MAGN,gBAAgB,SAAS,KACxB,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,KAAD;QAAG,WAAU;kBACV,eAAe;OACf,IACH,oBAAC,OAAD;QAAK,WAAU;kBACZ,gBAAgB,KAAK,YAAY;SAChC,MAAM,WAAW,QAAQ,YAAY,WAAW;SAChD,OACE,oBAAC,UAAD;UAEE,MAAK;UACL,eAAe,CAAC,YAAY,kBAAkB,OAAO;UACrD,WAAW,GACT,kDACA,WACI,6CACA,sDACN;oBAEC,cAAc,QAAQ,OAAO;SACxB,GAXD,QAAQ,OAWP;QAEZ,CAAC;OACE,EACF;;KAED;MACC;;GAEX,oBAAC,OAAD;IAAK,WAAU;cACb,oBAACC,QAAD;KACE,MAAK;KACL,MAAK;KACL,OAAO,YAAY,MAAM;KACzB,MAAM;KACN,SAAQ;KACR,OAAM;KACN,WAAU;KACV,SAAS;KACT,UAAU,gBAAgB;KAC1B,WAAW;IACZ;GACE;EACD;;AAEV"}
|
|
@@ -13,8 +13,8 @@ import { StructureEditor } from "./StructureEditor.mjs";
|
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { ArrowLeft } from "lucide-react";
|
|
16
|
-
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
17
16
|
import { useIntlayer } from "react-intlayer";
|
|
17
|
+
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
18
18
|
|
|
19
19
|
//#region src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx
|
|
20
20
|
const DictionaryFieldEditor = ({ dictionary, onClickDictionaryList, isDarkMode, mode, onDelete, onSave, showReturnButton = true, rightContent }) => {
|
|
@@ -94,14 +94,10 @@ const DictionaryFieldEditor = ({ dictionary, onClickDictionaryList, isDarkMode,
|
|
|
94
94
|
children: [
|
|
95
95
|
mode.includes("remote") && activeTab === "details" && /* @__PURE__ */ jsx(DictionaryDetailsForm, {
|
|
96
96
|
dictionary,
|
|
97
|
-
mode
|
|
98
|
-
isDarkMode
|
|
97
|
+
mode
|
|
99
98
|
}),
|
|
100
99
|
activeTab === "structure" && /* @__PURE__ */ jsx(StructureEditor, { dictionary }),
|
|
101
|
-
activeTab === "content" && /* @__PURE__ */ jsx(ContentEditor, {
|
|
102
|
-
dictionary,
|
|
103
|
-
isDarkMode
|
|
104
|
-
}),
|
|
100
|
+
activeTab === "content" && /* @__PURE__ */ jsx(ContentEditor, { dictionary }),
|
|
105
101
|
activeTab === "json" && /* @__PURE__ */ jsx(JSONEditor, {
|
|
106
102
|
dictionary,
|
|
107
103
|
isDarkMode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Container } from '@components/Container';\nimport { CopyToClipboard } from '@components/CopyToClipboard';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { ArrowLeft } from 'lucide-react';\nimport { type FC, type ReactNode, useEffect, useState } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { TabSelector } from '../TabSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n onSave?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n showReturnButton?: boolean;\n rightContent?: ReactNode;\n};\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n onSave,\n showReturnButton = true,\n rightContent,\n}) => {\n const config = useConfiguration();\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { focusedContent, setFocusedContent } = useFocusUnmergedDictionary();\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const [activeTab, setActiveTab] = useState<string>('content');\n\n useEffect(() => {\n setFocusedContent({\n ...(focusedContent ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n });\n setLocaleDictionary(dictionary);\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization?.locales ?? []}\n >\n <div className=\"relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden\">\n {showReturnButton && (\n <Button\n onClick={onClickDictionaryList}\n variant=\"hoverable\"\n className=\"z-10 mr-auto mb-6 ml-5 shrink-0\"\n color=\"text\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n )}\n\n <div className=\"mb-22 flex min-h-0 flex-1 flex-col overflow-hidden\">\n {/* Tab headers */}\n <div className=\"sticky top-0 z-10 flex shrink-0 gap-3 rounded-xl bg-background/20 p-3 pb-4\">\n <TabSelector\n selectedChoice={activeTab}\n tabs={[\n ...(mode.includes('remote')\n ? [\n <button\n key=\"details\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'details'}\n onClick={() => setActiveTab('details')}\n type=\"button\"\n >\n Details\n </button>,\n ]\n : []),\n <button\n key=\"structure\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'structure'}\n onClick={() => setActiveTab('structure')}\n type=\"button\"\n >\n Structure\n </button>,\n <button\n key=\"content\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'content'}\n onClick={() => setActiveTab('content')}\n type=\"button\"\n >\n Content\n </button>,\n <button\n key=\"json\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'json'}\n onClick={() => setActiveTab('json')}\n type=\"button\"\n >\n JSON\n </button>,\n ]}\n hoverable\n color=\"text\"\n />\n <div className=\"flex w-full items-center justify-end\">\n {rightContent}\n </div>\n </div>\n {/* Tab content — only active panel is mounted */}\n <div className=\"min-h-0 flex-1 overflow-y-auto p-6\">\n <div className=\"flex w-full min-w-0 flex-col items-stretch gap-6\">\n {mode.includes('remote') && activeTab === 'details' && (\n <DictionaryDetailsForm
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Container } from '@components/Container';\nimport { CopyToClipboard } from '@components/CopyToClipboard';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { ArrowLeft } from 'lucide-react';\nimport { type FC, type ReactNode, useEffect, useState } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { TabSelector } from '../TabSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n onDelete?: () => void;\n onSave?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n showReturnButton?: boolean;\n rightContent?: ReactNode;\n};\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n onDelete,\n onSave,\n showReturnButton = true,\n rightContent,\n}) => {\n const config = useConfiguration();\n const { returnToDictionaryList } = useIntlayer('dictionary-field-editor');\n const { focusedContent, setFocusedContent } = useFocusUnmergedDictionary();\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const [activeTab, setActiveTab] = useState<string>('content');\n\n useEffect(() => {\n setFocusedContent({\n ...(focusedContent ?? {}),\n dictionaryKey: dictionary.key,\n dictionaryLocalId: dictionary.localId,\n });\n setLocaleDictionary(dictionary);\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config?.internationalization?.locales ?? []}\n >\n <div className=\"relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden\">\n {showReturnButton && (\n <Button\n onClick={onClickDictionaryList}\n variant=\"hoverable\"\n className=\"z-10 mr-auto mb-6 ml-5 shrink-0\"\n color=\"text\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n )}\n\n <div className=\"mb-22 flex min-h-0 flex-1 flex-col overflow-hidden\">\n {/* Tab headers */}\n <div className=\"sticky top-0 z-10 flex shrink-0 gap-3 rounded-xl bg-background/20 p-3 pb-4\">\n <TabSelector\n selectedChoice={activeTab}\n tabs={[\n ...(mode.includes('remote')\n ? [\n <button\n key=\"details\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'details'}\n onClick={() => setActiveTab('details')}\n type=\"button\"\n >\n Details\n </button>,\n ]\n : []),\n <button\n key=\"structure\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'structure'}\n onClick={() => setActiveTab('structure')}\n type=\"button\"\n >\n Structure\n </button>,\n <button\n key=\"content\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'content'}\n onClick={() => setActiveTab('content')}\n type=\"button\"\n >\n Content\n </button>,\n <button\n key=\"json\"\n className=\"cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none\"\n data-active={activeTab === 'json'}\n onClick={() => setActiveTab('json')}\n type=\"button\"\n >\n JSON\n </button>,\n ]}\n hoverable\n color=\"text\"\n />\n <div className=\"flex w-full items-center justify-end\">\n {rightContent}\n </div>\n </div>\n {/* Tab content — only active panel is mounted */}\n <div className=\"min-h-0 flex-1 overflow-y-auto p-6\">\n <div className=\"flex w-full min-w-0 flex-col items-stretch gap-6\">\n {mode.includes('remote') && activeTab === 'details' && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n )}\n {activeTab === 'structure' && (\n <StructureEditor dictionary={dictionary} />\n )}\n {activeTab === 'content' && (\n <ContentEditor dictionary={dictionary} />\n )}\n {activeTab === 'json' && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n </div>\n </div>\n </div>\n\n <div className=\"absolute bottom-3 z-20 w-full p-2\">\n <Container\n color=\"card\"\n roundedSize=\"2xl\"\n padding=\"sm\"\n className=\"w-full shrink-0 flex-row flex-wrap items-center justify-end gap-10 bg-background/20 md:bottom-0\"\n >\n <CopyToClipboard\n text={dictionary.id!}\n className=\"text-nowrap text-neutral text-sm\"\n size={9}\n >\n {dictionary.id}\n </CopyToClipboard>\n <SaveForm\n dictionary={dictionary}\n mode={mode}\n onDelete={() => {\n setFocusedContent(null);\n onDelete?.();\n }}\n onSave={onSave}\n />\n </Container>\n </div>\n </div>\n </LocaleS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