@intlayer/design-system 9.0.0-canary.0 → 9.0.0-canary.2
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/ai.mjs +20 -1
- package/dist/esm/api/hooks/ai.mjs.map +1 -1
- package/dist/esm/api/hooks/asset.mjs +78 -0
- package/dist/esm/api/hooks/asset.mjs.map +1 -0
- package/dist/esm/api/index.mjs +6 -5
- package/dist/esm/api/useIntlayerAPI.mjs +6 -1
- package/dist/esm/api/useIntlayerAPI.mjs.map +1 -1
- package/dist/esm/components/Command/index.mjs +8 -8
- package/dist/esm/components/Command/index.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +132 -35
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +33 -11
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +146 -35
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +308 -0
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +12 -2
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +460 -20
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +506 -0
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +10 -6
- 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 +9 -9
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/contentEditor.content.mjs +79 -0
- package/dist/esm/components/DictionaryFieldEditor/contentEditor.content.mjs.map +1 -0
- package/dist/esm/components/Form/Form.mjs +3 -43
- package/dist/esm/components/Form/Form.mjs.map +1 -1
- package/dist/esm/components/Form/elements/FormElement.mjs +2 -3
- package/dist/esm/components/Form/elements/FormElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/MultiselectElement.mjs +2 -3
- package/dist/esm/components/Form/elements/MultiselectElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/OTPElement.mjs +3 -4
- package/dist/esm/components/Form/elements/OTPElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/SelectElement.mjs +2 -3
- package/dist/esm/components/Form/elements/SelectElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/SwitchSelectorElement.mjs +2 -3
- package/dist/esm/components/Form/elements/SwitchSelectorElement.mjs.map +1 -1
- package/dist/esm/components/Form/index.mjs +21 -2
- package/dist/esm/components/Form/layout/FormItemLayout.mjs +8 -5
- package/dist/esm/components/Form/layout/FormItemLayout.mjs.map +1 -1
- package/dist/esm/components/LanguageBackground/LanguageBackground.mjs +3 -8
- package/dist/esm/components/LanguageBackground/LanguageBackground.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/MarkdownEditor/MarkdownEditor.mjs +113 -0
- package/dist/esm/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/extensions.mjs +103 -0
- package/dist/esm/components/MarkdownEditor/extensions.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/generative/AICompletionCommands.mjs +51 -0
- package/dist/esm/components/MarkdownEditor/generative/AICompletionCommands.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/generative/AISelector.mjs +100 -0
- package/dist/esm/components/MarkdownEditor/generative/AISelector.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/generative/AISelectorCommands.mjs +81 -0
- package/dist/esm/components/MarkdownEditor/generative/AISelectorCommands.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/generative/GenerativeMenuSwitch.mjs +47 -0
- package/dist/esm/components/MarkdownEditor/generative/GenerativeMenuSwitch.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/generative/useAICompletion.mjs +83 -0
- package/dist/esm/components/MarkdownEditor/generative/useAICompletion.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/imageUpload.mjs +47 -0
- package/dist/esm/components/MarkdownEditor/imageUpload.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/index.mjs +4 -0
- package/dist/esm/components/MarkdownEditor/markdownEditor.content.mjs +1140 -0
- package/dist/esm/components/MarkdownEditor/markdownEditor.content.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-bubble-item.mjs +20 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-bubble-item.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-bubble.mjs +39 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-bubble.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-command-item.mjs +25 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-command-item.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-command.mjs +61 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor-command.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor.mjs +27 -0
- package/dist/esm/components/MarkdownEditor/novel/components/editor.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/components/index.mjs +8 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/ai-highlight.mjs +74 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/ai-highlight.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/custom-keymap.mjs +37 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/custom-keymap.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/image-resizer.mjs +49 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/image-resizer.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/index.mjs +51 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/index.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/slash-command.mjs +79 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/slash-command.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/updated-image.mjs +17 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/updated-image.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/index.mjs +17 -0
- package/dist/esm/components/MarkdownEditor/novel/plugins/index.mjs +3 -0
- package/dist/esm/components/MarkdownEditor/novel/plugins/upload-images.mjs +92 -0
- package/dist/esm/components/MarkdownEditor/novel/plugins/upload-images.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/utils/atoms.mjs +39 -0
- package/dist/esm/components/MarkdownEditor/novel/utils/atoms.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/utils/index.mjs +38 -0
- package/dist/esm/components/MarkdownEditor/novel/utils/index.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/selectors/ColorSelector.mjs +176 -0
- package/dist/esm/components/MarkdownEditor/selectors/ColorSelector.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/selectors/LinkSelector.mjs +95 -0
- package/dist/esm/components/MarkdownEditor/selectors/LinkSelector.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/selectors/NodeSelector.mjs +139 -0
- package/dist/esm/components/MarkdownEditor/selectors/NodeSelector.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/selectors/TextButtons.mjs +81 -0
- package/dist/esm/components/MarkdownEditor/selectors/TextButtons.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/slashCommand.mjs +161 -0
- package/dist/esm/components/MarkdownEditor/slashCommand.mjs.map +1 -0
- package/dist/esm/components/Modal/Modal.mjs +2 -2
- package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/esm/components/Pagination/Pagination.mjs +1 -1
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs +275 -0
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs.map +1 -0
- package/dist/esm/components/Pattern/index.mjs +2 -1
- package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
- package/dist/esm/components/Tab/Tab.mjs +1 -1
- package/dist/esm/components/Table/Table.mjs +1 -1
- package/dist/esm/components/Table/Table.mjs.map +1 -1
- package/dist/esm/components/Tag/index.mjs +0 -9
- package/dist/esm/components/Tag/index.mjs.map +1 -1
- package/dist/esm/components/Toaster/Toast.mjs +1 -1
- package/dist/esm/components/Toaster/Toast.mjs.map +1 -1
- package/dist/esm/components/index.mjs +27 -6
- package/dist/esm/hooks/index.mjs +8 -8
- package/dist/esm/hooks/useIsMounted.mjs +4 -2
- package/dist/esm/hooks/useIsMounted.mjs.map +1 -1
- package/dist/esm/routes.mjs +2 -1
- package/dist/esm/routes.mjs.map +1 -1
- package/dist/types/api/hooks/ai.d.ts +5 -1
- package/dist/types/api/hooks/ai.d.ts.map +1 -1
- package/dist/types/api/hooks/asset.d.ts +27 -0
- package/dist/types/api/hooks/asset.d.ts.map +1 -0
- package/dist/types/api/hooks/audit.d.ts +1 -1
- package/dist/types/api/index.d.ts +4 -3
- package/dist/types/api/useIntlayerAPI.d.ts +15 -3
- package/dist/types/api/useIntlayerAPI.d.ts.map +1 -1
- package/dist/types/components/Badge/index.d.ts +1 -1
- package/dist/types/components/Breadcrumb/index.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +3 -3
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +2 -2
- package/dist/types/components/Command/index.d.ts.map +1 -1
- package/dist/types/components/Container/index.d.ts +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +308 -0
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +12 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +2 -0
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +506 -0
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +2 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/contentEditor.content.d.ts +80 -0
- package/dist/types/components/DictionaryFieldEditor/contentEditor.content.d.ts.map +1 -0
- package/dist/types/components/Form/Form.d.ts +27 -47
- package/dist/types/components/Form/Form.d.ts.map +1 -1
- package/dist/types/components/Form/elements/FormElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/MultiselectElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/OTPElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SelectElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
- package/dist/types/components/Form/index.d.ts +22 -3
- package/dist/types/components/Form/layout/FormItemLayout.d.ts.map +1 -1
- package/dist/types/components/Input/Checkbox.d.ts +3 -3
- package/dist/types/components/Input/Input.d.ts +1 -1
- package/dist/types/components/Input/Radio.d.ts +3 -3
- package/dist/types/components/LanguageBackground/LanguageBackground.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +31 -0
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/extensions.d.ts +11 -0
- package/dist/types/components/MarkdownEditor/extensions.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/generative/AICompletionCommands.d.ts +18 -0
- package/dist/types/components/MarkdownEditor/generative/AICompletionCommands.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts +22 -0
- package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/generative/AISelectorCommands.d.ts +17 -0
- package/dist/types/components/MarkdownEditor/generative/AISelectorCommands.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts +26 -0
- package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/generative/useAICompletion.d.ts +30 -0
- package/dist/types/components/MarkdownEditor/generative/useAICompletion.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/imageUpload.d.ts +29 -0
- package/dist/types/components/MarkdownEditor/imageUpload.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/index.d.ts +3 -0
- package/dist/types/components/MarkdownEditor/markdownEditor.content.d.ts +1135 -0
- package/dist/types/components/MarkdownEditor/markdownEditor.content.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble-item.d.ts +14 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble-item.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble.d.ts +18 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-command-item.d.ts +28 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-command-item.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-command.d.ts +34 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor-command.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor.d.ts +23 -0
- package/dist/types/components/MarkdownEditor/novel/components/editor.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/components/index.d.ts +8 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/ai-highlight.d.ts +36 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/ai-highlight.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/custom-keymap.d.ts +17 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/custom-keymap.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/image-resizer.d.ts +7 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/image-resizer.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/index.d.ts +30 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/index.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/slash-command.d.ts +38 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/slash-command.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/updated-image.d.ts +8 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/updated-image.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/index.d.ts +16 -0
- package/dist/types/components/MarkdownEditor/novel/plugins/index.d.ts +2 -0
- package/dist/types/components/MarkdownEditor/novel/plugins/upload-images.d.ts +22 -0
- package/dist/types/components/MarkdownEditor/novel/plugins/upload-images.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/utils/atoms.d.ts +21 -0
- package/dist/types/components/MarkdownEditor/novel/utils/atoms.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/utils/index.d.ts +10 -0
- package/dist/types/components/MarkdownEditor/novel/utils/index.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/selectors/ColorSelector.d.ts +17 -0
- package/dist/types/components/MarkdownEditor/selectors/ColorSelector.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/selectors/LinkSelector.d.ts +15 -0
- package/dist/types/components/MarkdownEditor/selectors/LinkSelector.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/selectors/NodeSelector.d.ts +22 -0
- package/dist/types/components/MarkdownEditor/selectors/NodeSelector.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/selectors/TextButtons.d.ts +11 -0
- package/dist/types/components/MarkdownEditor/selectors/TextButtons.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/slashCommand.d.ts +29 -0
- package/dist/types/components/MarkdownEditor/slashCommand.d.ts.map +1 -0
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts +15 -0
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -0
- package/dist/types/components/Pattern/index.d.ts +2 -1
- package/dist/types/components/SwitchSelector/SwitchSelector.d.ts +1 -1
- package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts +1 -1
- package/dist/types/components/Tag/index.d.ts +2 -2
- package/dist/types/components/Tag/index.d.ts.map +1 -1
- package/dist/types/components/Toaster/Toast.d.ts +1 -1
- package/dist/types/components/index.d.ts +24 -3
- package/dist/types/routes.d.ts +2 -1
- package/dist/types/routes.d.ts.map +1 -1
- package/package.json +63 -32
- package/src/components/MarkdownEditor/markdown-editor.css +297 -0
package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs
CHANGED
|
@@ -1,26 +1,56 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { cn } from "../../../utils/cn.mjs";
|
|
4
|
+
import { Loader } from "../../Loader/index.mjs";
|
|
5
|
+
import { Button } from "../../Button/Button.mjs";
|
|
6
|
+
import { Container } from "../../Container/index.mjs";
|
|
7
|
+
import { Checkbox } from "../../Input/Checkbox.mjs";
|
|
8
|
+
import { Input } from "../../Input/Input.mjs";
|
|
3
9
|
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
4
10
|
import { useAuditContentDeclarationMetadata } from "../../../api/hooks/ai.mjs";
|
|
11
|
+
import { useGetDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
5
12
|
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
6
13
|
import { useGetTags } from "../../../api/hooks/tag.mjs";
|
|
7
|
-
import { Loader } from "../../Loader/index.mjs";
|
|
8
|
-
import { Checkbox } from "../../Input/Checkbox.mjs";
|
|
9
14
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
10
15
|
import { Select } from "../../Select/Select.mjs";
|
|
16
|
+
import { Pagination } from "../../Pagination/Pagination.mjs";
|
|
17
|
+
import { FormItem } from "../../Form/FormItem.mjs";
|
|
18
|
+
import { FormField } from "../../Form/FormField.mjs";
|
|
19
|
+
import { FormDescription } from "../../Form/FormDescription.mjs";
|
|
20
|
+
import { FormMessage } from "../../Form/FormMessage.mjs";
|
|
21
|
+
import { FormLabelLayout } from "../../Form/layout/FormLabelLayout.mjs";
|
|
22
|
+
import { EditableFieldInputElement } from "../../Form/elements/EditableFieldInputElement.mjs";
|
|
23
|
+
import { EditableFieldTextAreaElement } from "../../Form/elements/EditableFieldTextAreaElement.mjs";
|
|
24
|
+
import { InputElement } from "../../Form/elements/InputElement.mjs";
|
|
25
|
+
import { MultiSelectElement } from "../../Form/elements/MultiselectElement.mjs";
|
|
26
|
+
import { SelectElement } from "../../Form/elements/SelectElement.mjs";
|
|
11
27
|
import { useForm as useForm$1 } from "../../Form/FormBase.mjs";
|
|
12
28
|
import { Form } from "../../Form/Form.mjs";
|
|
29
|
+
import { MonacoCode } from "../../IDE/MonacoCode.mjs";
|
|
13
30
|
import { useDictionaryDetailsSchema } from "./useDictionaryDetailsSchema.mjs";
|
|
14
|
-
import { useEffect } from "react";
|
|
31
|
+
import { useEffect, useMemo, useState } from "react";
|
|
15
32
|
import { WandSparkles } from "lucide-react";
|
|
16
33
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
18
34
|
import { useIntlayer } from "react-intlayer";
|
|
35
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
19
36
|
import { useWatch } from "react-hook-form";
|
|
20
37
|
import { AnimatePresence, motion } from "framer-motion";
|
|
21
38
|
|
|
22
39
|
//#region src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx
|
|
23
|
-
const
|
|
40
|
+
const QUALIFIER_TYPES = [
|
|
41
|
+
"collection",
|
|
42
|
+
"variant",
|
|
43
|
+
"meta"
|
|
44
|
+
];
|
|
45
|
+
/** Derive active qualifier types from dictionary qualifier fields. */
|
|
46
|
+
const deriveQualifierTypes = (dict) => {
|
|
47
|
+
const types = [];
|
|
48
|
+
if (dict.item !== void 0) types.push("collection");
|
|
49
|
+
if (dict.variant !== void 0) types.push("variant");
|
|
50
|
+
if (dict.meta !== void 0) types.push("meta");
|
|
51
|
+
return types;
|
|
52
|
+
};
|
|
53
|
+
const DictionaryDetailsForm = ({ dictionary, mode, onSelectSibling, isDarkMode }) => {
|
|
24
54
|
const { session } = useSession();
|
|
25
55
|
const { project } = session ?? {};
|
|
26
56
|
const { data: projectsData, isLoading: isLoadingProjects } = useGetProjects();
|
|
@@ -33,15 +63,38 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
33
63
|
location: dictionary.location ?? "remote"
|
|
34
64
|
} });
|
|
35
65
|
const { editedContent, setEditedDictionary } = useEditedContent();
|
|
36
|
-
const { titleInput, keyInput, descriptionInput, projectInput, tagsSelect, locationSelect, importModeSelect, filePathInput, auditButton } = useIntlayer("dictionary-details");
|
|
66
|
+
const { titleInput, keyInput, descriptionInput, projectInput, tagsSelect, locationSelect, importModeSelect, filePathInput, auditButton, qualifierSection, siblingDictionaries: siblingContent, typeSwitch } = useIntlayer("dictionary-details");
|
|
37
67
|
const { mutate: auditContentDeclaration, isPending: isAuditing } = useAuditContentDeclarationMetadata();
|
|
38
68
|
const updatedDictionary = editedContent?.[dictionary.localId];
|
|
69
|
+
const { data: siblingsData, isLoading: isLoadingSiblings } = useGetDictionaries({ keys: [dictionary.key] }, { enabled: !!dictionary.key });
|
|
70
|
+
const siblings = useMemo(() => (siblingsData?.data ?? []).filter((d) => d.localId !== dictionary.localId), [siblingsData, dictionary.localId]);
|
|
71
|
+
const itemSiblings = useMemo(() => siblings.filter((d) => d.item !== void 0).sort((a, b) => (a.item ?? 0) - (b.item ?? 0)), [siblings]);
|
|
72
|
+
const variantSiblings = useMemo(() => siblings.filter((d) => d.variant !== void 0), [siblings]);
|
|
73
|
+
const metaSiblings = useMemo(() => siblings.filter((d) => d.meta !== void 0), [siblings]);
|
|
74
|
+
const allItemDicts = useMemo(() => {
|
|
75
|
+
if (dictionary.item !== void 0) return [dictionary, ...itemSiblings].sort((a, b) => (a.item ?? 0) - (b.item ?? 0));
|
|
76
|
+
return itemSiblings;
|
|
77
|
+
}, [dictionary, itemSiblings]);
|
|
78
|
+
const allVariantDicts = useMemo(() => {
|
|
79
|
+
if (dictionary.variant !== void 0) return [dictionary, ...variantSiblings];
|
|
80
|
+
return variantSiblings;
|
|
81
|
+
}, [dictionary, variantSiblings]);
|
|
82
|
+
const allMetaDicts = useMemo(() => {
|
|
83
|
+
if (dictionary.meta !== void 0) return [dictionary, ...metaSiblings];
|
|
84
|
+
return metaSiblings;
|
|
85
|
+
}, [dictionary, metaSiblings]);
|
|
39
86
|
useEffect(() => {
|
|
40
87
|
form.reset({
|
|
41
88
|
...dictionary,
|
|
42
89
|
tags: dictionary.tags ?? [],
|
|
43
90
|
location: dictionary.location ?? "remote"
|
|
44
91
|
});
|
|
92
|
+
setSelectedTypes(deriveQualifierTypes(dictionary));
|
|
93
|
+
setItemValue(dictionary.item ?? 1);
|
|
94
|
+
setVariantValue(dictionary.variant ?? "");
|
|
95
|
+
setMetaJsonValue(dictionary.meta ? JSON.stringify(dictionary.meta, null, 2) : "");
|
|
96
|
+
setMetaJsonError(false);
|
|
97
|
+
setShowSiblingPicker(false);
|
|
45
98
|
}, [dictionary, form?.reset]);
|
|
46
99
|
useEffect(() => {
|
|
47
100
|
if (typeof updatedDictionary === "undefined") form.reset({
|
|
@@ -72,6 +125,72 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
72
125
|
name: "location"
|
|
73
126
|
});
|
|
74
127
|
const isLocalChecked = watchedLocation === "local" || watchedLocation === "hybrid";
|
|
128
|
+
const hasSiblings = siblings.length > 0;
|
|
129
|
+
const [selectedTypes, setSelectedTypes] = useState(() => deriveQualifierTypes(dictionary));
|
|
130
|
+
const [itemValue, setItemValue] = useState(dictionary.item ?? 1);
|
|
131
|
+
const [variantValue, setVariantValue] = useState(dictionary.variant ?? "");
|
|
132
|
+
const [metaJsonValue, setMetaJsonValue] = useState(dictionary.meta ? JSON.stringify(dictionary.meta, null, 2) : "");
|
|
133
|
+
const [metaJsonError, setMetaJsonError] = useState(false);
|
|
134
|
+
const [showSiblingPicker, setShowSiblingPicker] = useState(false);
|
|
135
|
+
const allQualifiedSiblings = useMemo(() => [
|
|
136
|
+
...itemSiblings,
|
|
137
|
+
...variantSiblings,
|
|
138
|
+
...metaSiblings
|
|
139
|
+
], [
|
|
140
|
+
itemSiblings,
|
|
141
|
+
variantSiblings,
|
|
142
|
+
metaSiblings
|
|
143
|
+
]);
|
|
144
|
+
const handleTypesChange = (newTypes) => {
|
|
145
|
+
const nextTypes = [newTypes].flat();
|
|
146
|
+
const added = nextTypes.filter((t) => !selectedTypes.includes(t));
|
|
147
|
+
const removed = selectedTypes.filter((t) => !nextTypes.includes(t));
|
|
148
|
+
let base = {
|
|
149
|
+
...dictionary,
|
|
150
|
+
...updatedDictionary ?? {}
|
|
151
|
+
};
|
|
152
|
+
for (const qualifier of removed) {
|
|
153
|
+
if (qualifier === "collection") base = {
|
|
154
|
+
...base,
|
|
155
|
+
item: void 0
|
|
156
|
+
};
|
|
157
|
+
if (qualifier === "variant") base = {
|
|
158
|
+
...base,
|
|
159
|
+
variant: void 0
|
|
160
|
+
};
|
|
161
|
+
if (qualifier === "meta") base = {
|
|
162
|
+
...base,
|
|
163
|
+
meta: void 0
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
for (const qualifier of added) if (qualifier === "collection") {
|
|
167
|
+
const nextItem = allItemDicts.length > 0 ? Math.max(...allItemDicts.map((d) => d.item ?? 0)) + 1 : 1;
|
|
168
|
+
setItemValue(nextItem);
|
|
169
|
+
base = {
|
|
170
|
+
...base,
|
|
171
|
+
item: nextItem
|
|
172
|
+
};
|
|
173
|
+
} else if (qualifier === "variant") {
|
|
174
|
+
const newVariant = variantValue || "default";
|
|
175
|
+
setVariantValue(newVariant);
|
|
176
|
+
base = {
|
|
177
|
+
...base,
|
|
178
|
+
variant: newVariant
|
|
179
|
+
};
|
|
180
|
+
} else if (qualifier === "meta") {
|
|
181
|
+
const initialMeta = { id: "" };
|
|
182
|
+
setMetaJsonValue(JSON.stringify(initialMeta, null, 2));
|
|
183
|
+
base = {
|
|
184
|
+
...base,
|
|
185
|
+
meta: initialMeta
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
setSelectedTypes(nextTypes);
|
|
189
|
+
setEditedDictionary(base);
|
|
190
|
+
setMetaJsonError(false);
|
|
191
|
+
if (nextTypes.length === 0 && allQualifiedSiblings.length > 0) setShowSiblingPicker(true);
|
|
192
|
+
else setShowSiblingPicker(false);
|
|
193
|
+
};
|
|
75
194
|
return /* @__PURE__ */ jsxs(Form, {
|
|
76
195
|
className: "flex w-full flex-col gap-8",
|
|
77
196
|
...form,
|
|
@@ -79,7 +198,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
79
198
|
children: [
|
|
80
199
|
/* @__PURE__ */ jsxs("div", {
|
|
81
200
|
className: "grid grid-cols-2 gap-8 max-md:grid-cols-1",
|
|
82
|
-
children: [/* @__PURE__ */ jsx(
|
|
201
|
+
children: [/* @__PURE__ */ jsx(EditableFieldInputElement, {
|
|
83
202
|
name: "key",
|
|
84
203
|
label: keyInput.label,
|
|
85
204
|
placeholder: keyInput.label.value,
|
|
@@ -94,7 +213,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
94
213
|
key: value
|
|
95
214
|
});
|
|
96
215
|
}
|
|
97
|
-
}), /* @__PURE__ */ jsx(
|
|
216
|
+
}), /* @__PURE__ */ jsx(EditableFieldInputElement, {
|
|
98
217
|
name: "title",
|
|
99
218
|
label: titleInput.label,
|
|
100
219
|
placeholder: titleInput.placeholder.value,
|
|
@@ -110,7 +229,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
110
229
|
}
|
|
111
230
|
})]
|
|
112
231
|
}),
|
|
113
|
-
/* @__PURE__ */ jsx(
|
|
232
|
+
/* @__PURE__ */ jsx(EditableFieldTextAreaElement, {
|
|
114
233
|
name: "description",
|
|
115
234
|
label: descriptionInput.label,
|
|
116
235
|
placeholder: descriptionInput.placeholder.value,
|
|
@@ -127,7 +246,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
127
246
|
}),
|
|
128
247
|
/* @__PURE__ */ jsxs("div", {
|
|
129
248
|
className: "grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1",
|
|
130
|
-
children: [/* @__PURE__ */ jsx(
|
|
249
|
+
children: [/* @__PURE__ */ jsx(FormField, {
|
|
131
250
|
control: form.control,
|
|
132
251
|
name: "location",
|
|
133
252
|
render: ({ field }) => {
|
|
@@ -157,10 +276,10 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
157
276
|
location: newValue
|
|
158
277
|
});
|
|
159
278
|
};
|
|
160
|
-
return /* @__PURE__ */ jsxs(
|
|
279
|
+
return /* @__PURE__ */ jsxs(FormItem, {
|
|
161
280
|
className: "flex flex-col gap-2 px-1",
|
|
162
281
|
children: [
|
|
163
|
-
/* @__PURE__ */ jsx(
|
|
282
|
+
/* @__PURE__ */ jsx(FormLabelLayout, {
|
|
164
283
|
className: "ml-1",
|
|
165
284
|
children: locationSelect.label
|
|
166
285
|
}),
|
|
@@ -184,8 +303,8 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
184
303
|
onChange: (e) => handleRemoteToggle(e.target.checked)
|
|
185
304
|
})]
|
|
186
305
|
}),
|
|
187
|
-
/* @__PURE__ */ jsx(
|
|
188
|
-
/* @__PURE__ */ jsx(
|
|
306
|
+
/* @__PURE__ */ jsx(FormDescription, { children: locationSelect.testDescription }),
|
|
307
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
189
308
|
]
|
|
190
309
|
});
|
|
191
310
|
}
|
|
@@ -205,8 +324,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
205
324
|
height: 0
|
|
206
325
|
},
|
|
207
326
|
transition: { duration: .3 },
|
|
208
|
-
|
|
209
|
-
children: /* @__PURE__ */ jsx(Form.Input, {
|
|
327
|
+
children: /* @__PURE__ */ jsx(InputElement, {
|
|
210
328
|
name: "filePath",
|
|
211
329
|
label: filePathInput.label.value,
|
|
212
330
|
placeholder: filePathInput.placeholder.value,
|
|
@@ -226,7 +344,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
226
344
|
}),
|
|
227
345
|
/* @__PURE__ */ jsx("div", {
|
|
228
346
|
className: "grid grid-cols-2 gap-8 max-md:grid-cols-1",
|
|
229
|
-
children: /* @__PURE__ */ jsxs(
|
|
347
|
+
children: /* @__PURE__ */ jsxs(SelectElement, {
|
|
230
348
|
name: "importMode",
|
|
231
349
|
label: importModeSelect.label.value,
|
|
232
350
|
description: importModeSelect.description.value,
|
|
@@ -256,7 +374,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
256
374
|
}),
|
|
257
375
|
/* @__PURE__ */ jsxs("div", {
|
|
258
376
|
className: "grid grid-cols-2 gap-8 max-md:grid-cols-1",
|
|
259
|
-
children: [/* @__PURE__ */ jsxs(
|
|
377
|
+
children: [/* @__PURE__ */ jsxs(MultiSelectElement, {
|
|
260
378
|
name: "projectIds",
|
|
261
379
|
label: projectInput.label.value,
|
|
262
380
|
description: projectInput.description,
|
|
@@ -279,7 +397,7 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
279
397
|
children: project.name
|
|
280
398
|
}, String(project.id))) })
|
|
281
399
|
}) })]
|
|
282
|
-
}), /* @__PURE__ */ jsxs(
|
|
400
|
+
}), /* @__PURE__ */ jsxs(MultiSelectElement, {
|
|
283
401
|
name: "tags",
|
|
284
402
|
label: tagsSelect.label.value,
|
|
285
403
|
description: tagsSelect.description,
|
|
@@ -304,9 +422,331 @@ const DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
304
422
|
}) })]
|
|
305
423
|
})]
|
|
306
424
|
}),
|
|
425
|
+
/* @__PURE__ */ jsxs(Container, {
|
|
426
|
+
className: "gap-4",
|
|
427
|
+
padding: "md",
|
|
428
|
+
roundedSize: "2xl",
|
|
429
|
+
background: "none",
|
|
430
|
+
border: true,
|
|
431
|
+
borderColor: "card",
|
|
432
|
+
children: [
|
|
433
|
+
/* @__PURE__ */ jsxs("div", {
|
|
434
|
+
className: "flex flex-col gap-1",
|
|
435
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
436
|
+
className: "ml-1 font-semibold text-sm",
|
|
437
|
+
children: typeSwitch.label
|
|
438
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
439
|
+
className: "ml-1 text-muted text-xs",
|
|
440
|
+
children: typeSwitch.description
|
|
441
|
+
})]
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsxs(MultiSelect, {
|
|
444
|
+
values: selectedTypes,
|
|
445
|
+
onValueChange: handleTypesChange,
|
|
446
|
+
className: "max-w-xs",
|
|
447
|
+
children: [/* @__PURE__ */ jsx(MultiSelect.Trigger, {
|
|
448
|
+
getBadgeValue: (val) => {
|
|
449
|
+
if (val === "collection") return String(typeSwitch.collection);
|
|
450
|
+
if (val === "variant") return String(typeSwitch.variant);
|
|
451
|
+
if (val === "meta") return String(typeSwitch.meta);
|
|
452
|
+
return val;
|
|
453
|
+
},
|
|
454
|
+
children: /* @__PURE__ */ jsx(MultiSelect.Input, { placeholder: typeSwitch.label.value })
|
|
455
|
+
}), /* @__PURE__ */ jsx(MultiSelect.Content, { children: /* @__PURE__ */ jsx(MultiSelect.List, { children: QUALIFIER_TYPES.map((qualifier) => /* @__PURE__ */ jsx(MultiSelect.Item, {
|
|
456
|
+
value: qualifier,
|
|
457
|
+
children: typeSwitch[qualifier].value
|
|
458
|
+
}, qualifier)) }) })]
|
|
459
|
+
}),
|
|
460
|
+
/* @__PURE__ */ jsxs(AnimatePresence, { children: [
|
|
461
|
+
selectedTypes.includes("collection") && /* @__PURE__ */ jsx(motion.div, {
|
|
462
|
+
initial: {
|
|
463
|
+
opacity: 0,
|
|
464
|
+
height: 0
|
|
465
|
+
},
|
|
466
|
+
animate: {
|
|
467
|
+
opacity: 1,
|
|
468
|
+
height: "auto"
|
|
469
|
+
},
|
|
470
|
+
exit: {
|
|
471
|
+
opacity: 0,
|
|
472
|
+
height: 0
|
|
473
|
+
},
|
|
474
|
+
transition: { duration: .2 },
|
|
475
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
476
|
+
className: "flex flex-col gap-2 px-1",
|
|
477
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
478
|
+
htmlFor: "qualifier-item-value",
|
|
479
|
+
className: "ml-1 font-medium text-sm",
|
|
480
|
+
children: typeSwitch.itemValueLabel
|
|
481
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
482
|
+
id: "qualifier-item-value",
|
|
483
|
+
type: "number",
|
|
484
|
+
min: 1,
|
|
485
|
+
value: itemValue,
|
|
486
|
+
placeholder: typeSwitch.itemValuePlaceholder.value,
|
|
487
|
+
onChange: (e) => {
|
|
488
|
+
const value = parseInt(e.target.value, 10);
|
|
489
|
+
if (!Number.isNaN(value) && value >= 1) {
|
|
490
|
+
setItemValue(value);
|
|
491
|
+
setEditedDictionary({
|
|
492
|
+
...dictionary,
|
|
493
|
+
...updatedDictionary ?? {},
|
|
494
|
+
item: value
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
})]
|
|
499
|
+
})
|
|
500
|
+
}, "item-input"),
|
|
501
|
+
selectedTypes.includes("variant") && /* @__PURE__ */ jsx(motion.div, {
|
|
502
|
+
initial: {
|
|
503
|
+
opacity: 0,
|
|
504
|
+
height: 0
|
|
505
|
+
},
|
|
506
|
+
animate: {
|
|
507
|
+
opacity: 1,
|
|
508
|
+
height: "auto"
|
|
509
|
+
},
|
|
510
|
+
exit: {
|
|
511
|
+
opacity: 0,
|
|
512
|
+
height: 0
|
|
513
|
+
},
|
|
514
|
+
transition: { duration: .2 },
|
|
515
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
516
|
+
className: "flex flex-col gap-2 px-1",
|
|
517
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
518
|
+
htmlFor: "qualifier-variant-value",
|
|
519
|
+
className: "ml-1 font-medium text-sm",
|
|
520
|
+
children: typeSwitch.variantValueLabel
|
|
521
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
522
|
+
id: "qualifier-variant-value",
|
|
523
|
+
type: "text",
|
|
524
|
+
value: variantValue,
|
|
525
|
+
placeholder: typeSwitch.variantValuePlaceholder.value,
|
|
526
|
+
onChange: (e) => {
|
|
527
|
+
const value = e.target.value;
|
|
528
|
+
setVariantValue(value);
|
|
529
|
+
setEditedDictionary({
|
|
530
|
+
...dictionary,
|
|
531
|
+
...updatedDictionary ?? {},
|
|
532
|
+
variant: value
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
})]
|
|
536
|
+
})
|
|
537
|
+
}, "variant-input"),
|
|
538
|
+
selectedTypes.includes("meta") && /* @__PURE__ */ jsx(motion.div, {
|
|
539
|
+
initial: {
|
|
540
|
+
opacity: 0,
|
|
541
|
+
height: 0
|
|
542
|
+
},
|
|
543
|
+
animate: {
|
|
544
|
+
opacity: 1,
|
|
545
|
+
height: "auto"
|
|
546
|
+
},
|
|
547
|
+
exit: {
|
|
548
|
+
opacity: 0,
|
|
549
|
+
height: 0
|
|
550
|
+
},
|
|
551
|
+
transition: { duration: .2 },
|
|
552
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
553
|
+
className: "flex flex-col gap-2 px-1",
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ jsx("label", {
|
|
556
|
+
htmlFor: "qualifier-meta-value",
|
|
557
|
+
className: "ml-1 font-medium text-sm",
|
|
558
|
+
children: typeSwitch.metaValueLabel
|
|
559
|
+
}),
|
|
560
|
+
/* @__PURE__ */ jsx("div", {
|
|
561
|
+
id: "qualifier-meta-value",
|
|
562
|
+
className: "overflow-hidden rounded-xl border border-input bg-background",
|
|
563
|
+
children: /* @__PURE__ */ jsx(MonacoCode, {
|
|
564
|
+
language: "json",
|
|
565
|
+
showCopyButton: false,
|
|
566
|
+
showLineNumbers: false,
|
|
567
|
+
isDarkMode,
|
|
568
|
+
onChange: (value) => {
|
|
569
|
+
const raw = value ?? "";
|
|
570
|
+
setMetaJsonValue(raw);
|
|
571
|
+
try {
|
|
572
|
+
const parsed = JSON.parse(raw);
|
|
573
|
+
setMetaJsonError(false);
|
|
574
|
+
setEditedDictionary({
|
|
575
|
+
...dictionary,
|
|
576
|
+
...updatedDictionary ?? {},
|
|
577
|
+
meta: parsed
|
|
578
|
+
});
|
|
579
|
+
} catch {
|
|
580
|
+
setMetaJsonError(true);
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
children: metaJsonValue
|
|
584
|
+
})
|
|
585
|
+
}),
|
|
586
|
+
metaJsonError && /* @__PURE__ */ jsx("p", {
|
|
587
|
+
className: "ml-1 text-destructive text-xs",
|
|
588
|
+
children: typeSwitch.metaJsonError
|
|
589
|
+
})
|
|
590
|
+
]
|
|
591
|
+
})
|
|
592
|
+
}, "meta-input"),
|
|
593
|
+
selectedTypes.length === 0 && showSiblingPicker && /* @__PURE__ */ jsx(motion.div, {
|
|
594
|
+
initial: {
|
|
595
|
+
opacity: 0,
|
|
596
|
+
height: 0
|
|
597
|
+
},
|
|
598
|
+
animate: {
|
|
599
|
+
opacity: 1,
|
|
600
|
+
height: "auto"
|
|
601
|
+
},
|
|
602
|
+
exit: {
|
|
603
|
+
opacity: 0,
|
|
604
|
+
height: 0
|
|
605
|
+
},
|
|
606
|
+
transition: { duration: .2 },
|
|
607
|
+
children: /* @__PURE__ */ jsxs(Container, {
|
|
608
|
+
background: "none",
|
|
609
|
+
border: true,
|
|
610
|
+
borderColor: "neutral",
|
|
611
|
+
roundedSize: "xl",
|
|
612
|
+
padding: "md",
|
|
613
|
+
className: "gap-3",
|
|
614
|
+
children: [
|
|
615
|
+
/* @__PURE__ */ jsx("p", {
|
|
616
|
+
className: "font-medium text-sm",
|
|
617
|
+
children: typeSwitch.disablePickerTitle
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ jsx("p", {
|
|
620
|
+
className: "text-muted text-xs",
|
|
621
|
+
children: typeSwitch.disablePickerDescription
|
|
622
|
+
}),
|
|
623
|
+
/* @__PURE__ */ jsx("div", {
|
|
624
|
+
className: "flex flex-wrap gap-2",
|
|
625
|
+
children: allQualifiedSiblings.map((sibling) => /* @__PURE__ */ jsxs("button", {
|
|
626
|
+
type: "button",
|
|
627
|
+
onClick: () => {
|
|
628
|
+
onSelectSibling?.(sibling);
|
|
629
|
+
setShowSiblingPicker(false);
|
|
630
|
+
},
|
|
631
|
+
className: "cursor-pointer rounded-lg border border-border px-3 py-1 text-xs transition-colors hover:bg-text/10",
|
|
632
|
+
children: [
|
|
633
|
+
sibling.variant !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
634
|
+
qualifierSection.variant,
|
|
635
|
+
": ",
|
|
636
|
+
sibling.variant
|
|
637
|
+
] }),
|
|
638
|
+
sibling.item !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
639
|
+
qualifierSection.item,
|
|
640
|
+
": ",
|
|
641
|
+
sibling.item
|
|
642
|
+
] }),
|
|
643
|
+
sibling.meta !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
644
|
+
qualifierSection.meta,
|
|
645
|
+
": ",
|
|
646
|
+
String(sibling.meta.id)
|
|
647
|
+
] })
|
|
648
|
+
]
|
|
649
|
+
}, sibling.localId))
|
|
650
|
+
})
|
|
651
|
+
]
|
|
652
|
+
})
|
|
653
|
+
}, "sibling-picker")
|
|
654
|
+
] })
|
|
655
|
+
]
|
|
656
|
+
}),
|
|
657
|
+
/* @__PURE__ */ jsxs(Container, {
|
|
658
|
+
className: "gap-4",
|
|
659
|
+
padding: "md",
|
|
660
|
+
roundedSize: "2xl",
|
|
661
|
+
background: "none",
|
|
662
|
+
border: true,
|
|
663
|
+
borderColor: "neutral",
|
|
664
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
665
|
+
className: "font-semibold text-sm",
|
|
666
|
+
children: siblingContent.title
|
|
667
|
+
}), /* @__PURE__ */ jsxs(Loader, {
|
|
668
|
+
isLoading: isLoadingSiblings,
|
|
669
|
+
children: [
|
|
670
|
+
!hasSiblings && /* @__PURE__ */ jsx("p", {
|
|
671
|
+
className: "text-muted text-sm",
|
|
672
|
+
children: siblingContent.noSiblings
|
|
673
|
+
}),
|
|
674
|
+
allItemDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
675
|
+
className: "flex flex-col gap-2",
|
|
676
|
+
children: [
|
|
677
|
+
/* @__PURE__ */ jsx("p", {
|
|
678
|
+
className: "font-medium text-muted text-xs uppercase tracking-wide",
|
|
679
|
+
children: siblingContent.collectionItems
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ jsx(Pagination, {
|
|
682
|
+
currentPage: allItemDicts.findIndex((dictionaryEl) => dictionaryEl.localId === dictionary.localId) + 1 || 1,
|
|
683
|
+
totalPages: allItemDicts.length,
|
|
684
|
+
onPageChange: (page) => {
|
|
685
|
+
const target = allItemDicts[page - 1];
|
|
686
|
+
if (target && onSelectSibling) onSelectSibling(target);
|
|
687
|
+
},
|
|
688
|
+
showPrevNext: true
|
|
689
|
+
}),
|
|
690
|
+
/* @__PURE__ */ jsx("div", {
|
|
691
|
+
className: "mt-1 flex flex-wrap gap-2",
|
|
692
|
+
children: allItemDicts.map((sibling) => {
|
|
693
|
+
const isActive = sibling.localId === dictionary.localId;
|
|
694
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
695
|
+
type: "button",
|
|
696
|
+
onClick: () => !isActive && onSelectSibling?.(sibling),
|
|
697
|
+
className: cn("rounded-lg px-3 py-1 text-xs transition-colors", isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"),
|
|
698
|
+
children: [
|
|
699
|
+
siblingContent.itemIndex,
|
|
700
|
+
" ",
|
|
701
|
+
sibling.item
|
|
702
|
+
]
|
|
703
|
+
}, sibling.localId);
|
|
704
|
+
})
|
|
705
|
+
})
|
|
706
|
+
]
|
|
707
|
+
}),
|
|
708
|
+
allVariantDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
709
|
+
className: "flex flex-col gap-2",
|
|
710
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
711
|
+
className: "font-medium text-muted text-xs uppercase tracking-wide",
|
|
712
|
+
children: siblingContent.variants
|
|
713
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
714
|
+
className: "flex flex-wrap gap-2",
|
|
715
|
+
children: allVariantDicts.map((sibling) => {
|
|
716
|
+
const isActive = sibling.localId === dictionary.localId;
|
|
717
|
+
return /* @__PURE__ */ jsx("button", {
|
|
718
|
+
type: "button",
|
|
719
|
+
onClick: () => !isActive && onSelectSibling?.(sibling),
|
|
720
|
+
className: cn("rounded-lg px-3 py-1 text-xs transition-colors", isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"),
|
|
721
|
+
children: sibling.variant
|
|
722
|
+
}, sibling.localId);
|
|
723
|
+
})
|
|
724
|
+
})]
|
|
725
|
+
}),
|
|
726
|
+
allMetaDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
727
|
+
className: "flex flex-col gap-2",
|
|
728
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
729
|
+
className: "font-medium text-muted text-xs uppercase tracking-wide",
|
|
730
|
+
children: siblingContent.metaRecords
|
|
731
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
732
|
+
className: "flex flex-wrap gap-2",
|
|
733
|
+
children: allMetaDicts.map((sibling) => {
|
|
734
|
+
const isActive = sibling.localId === dictionary.localId;
|
|
735
|
+
return /* @__PURE__ */ jsx("button", {
|
|
736
|
+
type: "button",
|
|
737
|
+
onClick: () => !isActive && onSelectSibling?.(sibling),
|
|
738
|
+
className: cn("rounded-lg px-3 py-1 text-xs transition-colors", isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"),
|
|
739
|
+
children: sibling.meta?.id
|
|
740
|
+
}, sibling.localId);
|
|
741
|
+
})
|
|
742
|
+
})]
|
|
743
|
+
})
|
|
744
|
+
]
|
|
745
|
+
})]
|
|
746
|
+
}),
|
|
307
747
|
/* @__PURE__ */ jsx("div", {
|
|
308
748
|
className: "flex flex-wrap items-center justify-end gap-2 max-md:flex-col",
|
|
309
|
-
children: /* @__PURE__ */ jsx(
|
|
749
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
310
750
|
type: "button",
|
|
311
751
|
size: "icon-md",
|
|
312
752
|
label: auditButton.label.value,
|