@intlayer/design-system 7.5.12 → 7.5.14
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/_virtual/rolldown_runtime.mjs +2 -2
- package/dist/esm/components/Accordion/Accordion.mjs +1 -1
- package/dist/esm/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/esm/components/Avatar/index.mjs +1 -1
- package/dist/esm/components/Avatar/index.mjs.map +1 -1
- package/dist/esm/components/Badge/index.mjs.map +1 -1
- package/dist/esm/components/Breadcrumb/breadcrumb.content.mjs +2 -1
- package/dist/esm/components/Breadcrumb/breadcrumb.content.mjs.map +1 -1
- package/dist/esm/components/Breadcrumb/index.mjs +1 -1
- package/dist/esm/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/esm/components/Browser/Browser.mjs +1 -1
- package/dist/esm/components/Browser/browser.content.mjs +16 -8
- package/dist/esm/components/Browser/browser.content.mjs.map +1 -1
- package/dist/esm/components/Button/Button.mjs.map +1 -1
- package/dist/esm/components/Carousel/index.content.mjs +25 -14
- package/dist/esm/components/Carousel/index.content.mjs.map +1 -1
- package/dist/esm/components/Carousel/index.mjs +1 -1
- package/dist/esm/components/Carousel/index.mjs.map +1 -1
- package/dist/esm/components/ClickOutsideDiv/index.mjs.map +1 -1
- package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs +1 -1
- package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs.map +1 -1
- package/dist/esm/components/Command/index.mjs.map +1 -1
- package/dist/esm/components/Container/index.mjs +5 -5
- package/dist/esm/components/Container/index.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditor.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditor.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorInput.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +2 -2
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/esm/components/ContentSelector/ContentSelector.mjs.map +1 -1
- package/dist/esm/components/CopyButton/CopyButton.content.mjs +2 -1
- package/dist/esm/components/CopyButton/CopyButton.content.mjs.map +1 -1
- package/dist/esm/components/CopyButton/index.mjs +1 -1
- package/dist/esm/components/CopyButton/index.mjs.map +1 -1
- package/dist/esm/components/CopyToClipboard/index.mjs +1 -1
- package/dist/esm/components/CopyToClipboard/index.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/ConditionWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/FileWrapper.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/FileWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/InsertionWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/TranslationWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/index.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +3 -3
- 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/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +24 -12
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs +8 -4
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +4 -4
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +32 -16
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +24 -12
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/JSONEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +24 -12
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +6 -5
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -16
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/structureView.content.mjs +8 -4
- package/dist/esm/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +6 -3
- package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs +4 -2
- package/dist/esm/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs +30 -15
- package/dist/esm/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
- package/dist/esm/components/DropDown/index.mjs.map +1 -1
- package/dist/esm/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/esm/components/EditableField/EditableFieldLayout.mjs +1 -1
- package/dist/esm/components/EditableField/EditableFieldLayout.mjs.map +1 -1
- package/dist/esm/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/esm/components/ExpandCollapse/expandCollapse.content.mjs +4 -2
- package/dist/esm/components/ExpandCollapse/expandCollapse.content.mjs.map +1 -1
- package/dist/esm/components/Flags/Flag.mjs.map +1 -1
- package/dist/esm/components/Flags/flags.mjs +2 -2
- package/dist/esm/components/Footer/index.mjs.map +1 -1
- package/dist/esm/components/Form/FormControl.mjs.map +1 -1
- package/dist/esm/components/Form/FormDescription.mjs.map +1 -1
- package/dist/esm/components/Form/FormItem.mjs.map +1 -1
- package/dist/esm/components/Form/FormLabel.mjs.map +1 -1
- package/dist/esm/components/Form/FormMessage.mjs.map +1 -1
- package/dist/esm/components/Form/elements/AutoSizeTextAreaElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/CheckboxElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/FormElementWrapper.mjs.map +1 -1
- package/dist/esm/components/Form/elements/InputElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/InputPasswordElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
- package/dist/esm/components/Form/elements/SearchInputElement.mjs.map +1 -1
- package/dist/esm/components/Form/elements/TextAreaElement.mjs.map +1 -1
- package/dist/esm/components/Form/layout/FormItemLayout.mjs.map +1 -1
- package/dist/esm/components/Form/layout/FormLabelLayout.mjs.map +1 -1
- package/dist/esm/components/Form/layout/RequiredStar.mjs.map +1 -1
- package/dist/esm/components/Headers/index.mjs.map +1 -1
- package/dist/esm/components/HeightResizer/index.mjs.map +1 -1
- package/dist/esm/components/HideShow/index.mjs +1 -1
- package/dist/esm/components/HideShow/index.mjs.map +1 -1
- package/dist/esm/components/IDE/Code.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeConditionalRenderer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeContext.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeFormatSelector.mjs.map +1 -1
- package/dist/esm/components/IDE/ContentDeclarationFormatSelector.mjs.map +1 -1
- package/dist/esm/components/IDE/CopyCode.mjs.map +1 -1
- package/dist/esm/components/IDE/FileList.mjs.map +1 -1
- package/dist/esm/components/IDE/FileTree.mjs +1 -1
- package/dist/esm/components/IDE/FileTree.mjs.map +1 -1
- package/dist/esm/components/IDE/IDE.mjs.map +1 -1
- package/dist/esm/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/IDE/MonacoCode.mjs.map +1 -1
- package/dist/esm/components/IDE/PackageManagerSelector.mjs.map +1 -1
- package/dist/esm/components/IDE/code.content.mjs +4 -2
- package/dist/esm/components/IDE/code.content.mjs.map +1 -1
- package/dist/esm/components/IDE/copyCode.content.mjs +4 -2
- package/dist/esm/components/IDE/copyCode.content.mjs.map +1 -1
- package/dist/esm/components/IDE/createFileTree.mjs.map +1 -1
- package/dist/esm/components/IDE/selectors.content.mjs +12 -6
- package/dist/esm/components/IDE/selectors.content.mjs.map +1 -1
- package/dist/esm/components/InformationTag/index.mjs.map +1 -1
- package/dist/esm/components/Input/Checkbox.mjs.map +1 -1
- package/dist/esm/components/Input/Input.mjs.map +1 -1
- package/dist/esm/components/Input/InputPassword.mjs +1 -1
- package/dist/esm/components/Input/InputPassword.mjs.map +1 -1
- package/dist/esm/components/Input/OTPInput.mjs +1 -1
- package/dist/esm/components/Input/OTPInput.mjs.map +1 -1
- package/dist/esm/components/KeyboardScreenAdapter/index.mjs +1 -1
- package/dist/esm/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/esm/components/KeyboardShortcut/KeyboardShortcut.mjs +1 -1
- package/dist/esm/components/KeyboardShortcut/KeyboardShortcut.mjs.map +1 -1
- package/dist/esm/components/Label/index.mjs.map +1 -1
- package/dist/esm/components/LanguageBackground/index.mjs.map +1 -1
- package/dist/esm/components/Link/Link.mjs +1 -1
- package/dist/esm/components/Link/Link.mjs.map +1 -1
- package/dist/esm/components/Loader/index.content.mjs +2 -1
- package/dist/esm/components/Loader/index.content.mjs.map +1 -1
- package/dist/esm/components/Loader/index.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +16 -8
- package/dist/esm/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
- package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +12 -6
- package/dist/esm/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/esm/components/Logo/Logo.mjs.map +1 -1
- package/dist/esm/components/Logo/LogoTextOnly.mjs.map +1 -1
- package/dist/esm/components/Logo/LogoWithText.mjs.map +1 -1
- package/dist/esm/components/Logo/LogoWithTextBelow.mjs.map +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/MarkDownRender/processor.mjs.map +1 -1
- package/dist/esm/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/esm/components/Modal/Modal.mjs +4 -4
- package/dist/esm/components/Modal/Modal.mjs.map +1 -1
- package/dist/esm/components/Navbar/MobileNavbar.mjs +2 -2
- package/dist/esm/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/esm/components/Navbar/useNavigation.mjs.map +1 -1
- package/dist/esm/components/Pagination/NumberItemsSelector.mjs.map +1 -1
- package/dist/esm/components/Pagination/Pagination.mjs +2 -2
- package/dist/esm/components/Pagination/Pagination.mjs.map +1 -1
- package/dist/esm/components/Pagination/ShowingResultsNumberItems.mjs.map +1 -1
- package/dist/esm/components/Pagination/pagination.content.mjs +9 -4
- package/dist/esm/components/Pagination/pagination.content.mjs.map +1 -1
- package/dist/esm/components/Pattern/DotPattern.mjs.map +1 -1
- package/dist/esm/components/Pattern/GridPattern.mjs.map +1 -1
- package/dist/esm/components/Pattern/SpotLight.mjs.map +1 -1
- package/dist/esm/components/Popover/dynamic.mjs.map +1 -1
- package/dist/esm/components/Popover/static.mjs.map +1 -1
- package/dist/esm/components/PressableSpan/PressableSpan.mjs.map +1 -1
- package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
- package/dist/esm/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/esm/components/RightDrawer/rightDrawer.content.mjs +13 -3
- package/dist/esm/components/RightDrawer/rightDrawer.content.mjs.map +1 -1
- package/dist/esm/components/Select/Multiselect.mjs +1 -1
- package/dist/esm/components/Select/Multiselect.mjs.map +1 -1
- package/dist/esm/components/Select/Select.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/DiscordLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/FacebookLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/InstagramLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/LinkedInLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/ProductHuntLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/TiktokLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/XLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/YoutubeLogo.mjs.map +1 -1
- package/dist/esm/components/SocialNetworks/index.mjs.map +1 -1
- package/dist/esm/components/SwitchSelector/index.mjs +1 -1
- package/dist/esm/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/esm/components/Tab/Tab.mjs +1 -1
- package/dist/esm/components/Tab/Tab.mjs.map +1 -1
- package/dist/esm/components/Tab/TabContext.mjs.map +1 -1
- package/dist/esm/components/TabSelector/TabSelector.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/Table/table.content.mjs +2 -1
- package/dist/esm/components/Table/table.content.mjs.map +1 -1
- package/dist/esm/components/Tag/index.mjs.map +1 -1
- package/dist/esm/components/Terminal/Terminal.mjs.map +1 -1
- package/dist/esm/components/Terminal/terminal.content.mjs +14 -3
- package/dist/esm/components/Terminal/terminal.content.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs +1 -1
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/esm/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs.map +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs.map +1 -1
- package/dist/esm/components/Toaster/Toast.mjs +2 -2
- package/dist/esm/components/Toaster/Toast.mjs.map +1 -1
- package/dist/esm/components/Toaster/useToast.mjs.map +1 -1
- package/dist/esm/components/WithResizer/index.mjs.map +1 -1
- package/dist/esm/components/index.mjs +3 -3
- package/dist/esm/dist/esm/components/Container/index.mjs +5 -5
- package/dist/esm/dist/esm/components/Container/index.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +5 -5
- package/dist/esm/hooks/useHorizontalSwipe.mjs.map +1 -1
- package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
- package/dist/esm/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/esm/hooks/useScrollY.mjs.map +1 -1
- package/dist/esm/libs/auth.mjs.map +1 -1
- package/dist/esm/providers/ReactQueryProvider.mjs +1 -1
- package/dist/esm/providers/ReactQueryProvider.mjs.map +1 -1
- package/dist/esm/utils/object.mjs.map +1 -1
- package/dist/types/components/Badge/index.d.ts +2 -2
- package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts +5 -3
- package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -1
- package/dist/types/components/Breadcrumb/index.d.ts +2 -2
- package/dist/types/components/Browser/Browser.d.ts +2 -2
- package/dist/types/components/Browser/Browser.d.ts.map +1 -1
- package/dist/types/components/Browser/browser.content.d.ts +33 -17
- package/dist/types/components/Browser/browser.content.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +6 -6
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Carousel/index.content.d.ts +37 -28
- package/dist/types/components/Carousel/index.content.d.ts.map +1 -1
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +2 -2
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts.map +1 -1
- package/dist/types/components/Command/index.d.ts +17 -17
- package/dist/types/components/Command/index.d.ts.map +1 -1
- package/dist/types/components/Container/index.d.ts +7 -7
- package/dist/types/components/Container/index.d.ts.map +1 -1
- package/dist/types/components/CopyButton/CopyButton.content.d.ts +5 -3
- package/dist/types/components/CopyButton/CopyButton.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +49 -25
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +17 -9
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +65 -33
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +49 -25
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +49 -25
- package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +65 -33
- package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +17 -9
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +13 -7
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +9 -5
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +61 -31
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/types/components/EditableField/EditableFieldInput.d.ts.map +1 -1
- package/dist/types/components/ExpandCollapse/expandCollapse.content.d.ts +6 -4
- package/dist/types/components/Form/FormBase.d.ts +2 -2
- package/dist/types/components/Form/FormField.d.ts +2 -2
- package/dist/types/components/Form/FormItem.d.ts +2 -2
- package/dist/types/components/Form/FormItem.d.ts.map +1 -1
- package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts +2 -2
- package/dist/types/components/Form/elements/EditableFieldTextAreaElement.d.ts +2 -2
- package/dist/types/components/Form/elements/FormElement.d.ts +2 -2
- package/dist/types/components/Form/elements/MultiselectElement.d.ts +2 -2
- package/dist/types/components/Form/elements/OTPElement.d.ts +2 -2
- package/dist/types/components/Form/elements/SelectElement.d.ts +2 -2
- package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts +2 -2
- package/dist/types/components/IDE/CodeContext.d.ts +2 -2
- package/dist/types/components/IDE/CodeContext.d.ts.map +1 -1
- package/dist/types/components/IDE/FileTree.d.ts.map +1 -1
- package/dist/types/components/IDE/code.content.d.ts +9 -5
- package/dist/types/components/IDE/code.content.d.ts.map +1 -1
- package/dist/types/components/IDE/copyCode.content.d.ts +9 -5
- package/dist/types/components/IDE/copyCode.content.d.ts.map +1 -1
- package/dist/types/components/IDE/selectors.content.d.ts +25 -13
- package/dist/types/components/IDE/selectors.content.d.ts.map +1 -1
- package/dist/types/components/Input/Checkbox.d.ts +3 -3
- package/dist/types/components/Input/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Input/Input.d.ts +2 -2
- package/dist/types/components/Input/OTPInput.d.ts +6 -6
- package/dist/types/components/Input/OTPInput.d.ts.map +1 -1
- package/dist/types/components/Input/SearchInput.d.ts +2 -2
- package/dist/types/components/Link/Link.d.ts +5 -5
- package/dist/types/components/Link/Link.d.ts.map +1 -1
- package/dist/types/components/Loader/index.content.d.ts +5 -3
- package/dist/types/components/Loader/index.content.d.ts.map +1 -1
- package/dist/types/components/Loader/spinner.d.ts +2 -2
- package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +33 -17
- package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +25 -13
- package/dist/types/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/types/components/MaxWidthSmoother/index.d.ts +2 -2
- package/dist/types/components/MaxWidthSmoother/index.d.ts.map +1 -1
- package/dist/types/components/Modal/Modal.d.ts +1 -1
- package/dist/types/components/Modal/Modal.d.ts.map +1 -1
- package/dist/types/components/Navbar/Burger.d.ts +2 -2
- package/dist/types/components/Navbar/Burger.d.ts.map +1 -1
- package/dist/types/components/Navbar/DesktopNavbar.d.ts +2 -2
- package/dist/types/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/types/components/Navbar/MobileNavbar.d.ts +2 -2
- package/dist/types/components/Navbar/MobileNavbar.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +4 -4
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/pagination.content.d.ts +21 -11
- package/dist/types/components/RightDrawer/rightDrawer.content.d.ts +12 -5
- package/dist/types/components/RightDrawer/rightDrawer.content.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts +3 -3
- package/dist/types/components/SocialNetworks/index.d.ts +2 -2
- package/dist/types/components/SocialNetworks/index.d.ts.map +1 -1
- package/dist/types/components/SwitchSelector/index.d.ts +6 -6
- package/dist/types/components/SwitchSelector/index.d.ts.map +1 -1
- package/dist/types/components/Tab/Tab.d.ts +6 -6
- package/dist/types/components/Tab/Tab.d.ts.map +1 -1
- package/dist/types/components/Tab/TabContext.d.ts +2 -2
- package/dist/types/components/Tab/TabContext.d.ts.map +1 -1
- package/dist/types/components/TabSelector/TabSelector.d.ts +5 -5
- package/dist/types/components/TabSelector/TabSelector.d.ts.map +1 -1
- package/dist/types/components/Table/table.content.d.ts +5 -3
- package/dist/types/components/Table/table.content.d.ts.map +1 -1
- package/dist/types/components/Tag/index.d.ts +5 -5
- package/dist/types/components/Tag/index.d.ts.map +1 -1
- package/dist/types/components/Terminal/terminal.content.d.ts +12 -5
- package/dist/types/components/Terminal/terminal.content.d.ts.map +1 -1
- package/dist/types/components/Toaster/Toast.d.ts +2 -2
- package/dist/types/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/types/components/Toaster/Toaster.d.ts +2 -2
- package/dist/types/components/Toaster/Toaster.d.ts.map +1 -1
- package/package.json +31 -31
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
|
-
import { useState } from "react";
|
|
5
4
|
import { CopyCheck, CopyIcon } from "lucide-react";
|
|
5
|
+
import { useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/components/CopyToClipboard/index.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/CopyToClipboard/index.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport { CopyCheck, CopyIcon } from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MouseEvent,\n type PropsWithChildren,\n useState,\n} from 'react';\n\n/**\n * Props for the CopyToClipboard component\n */\nexport interface CopyToClipboardProps extends PropsWithChildren {\n /**\n * The text to copy to the clipboard when clicked\n * @example \"Hello World\"\n * @example \"npm install @intlayer/design-system\"\n */\n text: string;\n\n /**\n * Additional CSS classes for the wrapper element\n * @example \"bg-blue-100 text-blue-800\"\n */\n className?: string;\n\n /**\n * Accessible label for screen readers when copy operation is available\n * @default \"Copy to clipboard\"\n */\n 'aria-label'?: string;\n\n /**\n * Accessible label for screen readers when content has been copied\n * @default \"Copied to clipboard\"\n */\n 'aria-copied-label'?: string;\n\n /**\n * Duration in milliseconds to show the \"copied\" state\n * @default 2000\n */\n feedbackDuration?: number;\n\n /**\n * Callback function called when copy operation succeeds\n */\n onCopySuccess?: () => void;\n\n /**\n * Callback function called when copy operation fails\n */\n onCopyError?: (error: Error) => void;\n\n /**\n * Disable the copy to clipboard functionality and return the children\n * @default false\n */\n disable?: boolean;\n\n /**\n * Prevent the default behavior of the link when clicked\n * @default true\n */\n preventDefault?: boolean;\n}\n\nexport const useCopyToClipboard = (\n text?: string,\n feedbackDuration = 2000,\n onCopySuccess?: () => void,\n onCopyError?: (error: Error) => void\n) => {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async () => {\n if (!text) return;\n\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n } else {\n onCopyError?.(new Error('Clipboard API not supported in this browser'));\n return;\n }\n\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), feedbackDuration);\n onCopySuccess?.();\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to copy to clipboard';\n onCopyError?.(error instanceof Error ? error : new Error(errorMessage));\n }\n };\n\n return { isCopied, copy };\n};\n\n/**\n * CopyToClipboard Component\n *\n * A versatile component that allows users to copy text to their clipboard with visual feedback.\n * Provides accessibility features, customizable feedback duration, and error handling.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <CopyToClipboard text=\"Hello World\">\n * <span>Click to copy</span>\n * </CopyToClipboard>\n *\n * // With custom styling and callbacks\n * <CopyToClipboard\n * text=\"npm install @intlayer/design-system\"\n * className=\"bg-gray-100 p-2\"\n * feedbackDuration={3000}\n * onCopySuccess={() => console.log('Copied!')}\n * >\n * <code>npm install @intlayer/design-system</code>\n * </CopyToClipboard>\n * ```\n *\n * @component\n * @accessibility\n * - Uses proper ARIA labels for copy and copied states\n * - Supports keyboard navigation (Enter and Space keys)\n * - Announces state changes to screen readers\n * - Provides visual focus indicators\n */\nexport const CopyToClipboard: FC<CopyToClipboardProps> = ({\n text,\n children,\n className,\n 'aria-label': ariaLabel = 'Copy to clipboard',\n 'aria-copied-label': ariaCopiedLabel = 'Copied to clipboard',\n feedbackDuration = 2000,\n onCopySuccess,\n onCopyError,\n disable,\n preventDefault = true,\n}) => {\n const { isCopied, copy } = useCopyToClipboard(\n text,\n feedbackDuration,\n onCopySuccess,\n onCopyError\n );\n\n if (disable) return <span className={className}>{children}</span>;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleCopy(event);\n }\n };\n\n const handleCopy = (event: MouseEvent | KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n copy();\n };\n\n const currentAriaLabel = isCopied ? ariaCopiedLabel : ariaLabel;\n\n const IconComponent = isCopied ? CopyCheck : CopyIcon;\n\n return (\n <span\n className={cn(\n 'inline-flex max-w-full cursor-pointer items-center gap-2 rounded-md p-0.5 hover:bg-neutral/10',\n className\n )}\n onClick={handleCopy}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n aria-label={currentAriaLabel}\n aria-pressed={isCopied}\n data-testid=\"copy-to-clipboard\"\n >\n <span className=\"min-w-0 break-all\">{children}</span>\n\n {text && (\n <IconComponent\n className=\"ml-1 ml-auto size-4 min-w-4 shrink-0\"\n aria-hidden=\"true\"\n />\n )}\n </span>\n );\n};\n"],"mappings":";;;;;;;;AAsEA,MAAa,sBACX,MACA,mBAAmB,KACnB,eACA,gBACG;CACH,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;CAE/C,MAAM,OAAO,YAAY;AACvB,MAAI,CAAC,KAAM;AAEX,MAAI;AACF,OAAI,UAAU,WAAW,UACvB,OAAM,UAAU,UAAU,UAAU,KAAK;QACpC;AACL,kCAAc,IAAI,MAAM,8CAA8C,CAAC;AACvE;;AAGF,eAAY,KAAK;AACjB,oBAAiB,YAAY,MAAM,EAAE,iBAAiB;AACtD,oBAAiB;WACV,OAAO;GACd,MAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU;AAC3C,iBAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,aAAa,CAAC;;;AAI3E,QAAO;EAAE;EAAU;EAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkC3B,MAAa,mBAA6C,EACxD,MACA,UACA,WACA,cAAc,YAAY,qBAC1B,qBAAqB,kBAAkB,uBACvC,mBAAmB,KACnB,eACA,aACA,SACA,iBAAiB,WACb;CACJ,MAAM,EAAE,UAAU,SAAS,mBACzB,MACA,kBACA,eACA,YACD;AAED,KAAI,QAAS,QAAO,oBAAC;EAAgB;EAAY;GAAgB;CAEjE,MAAM,iBAAiB,UAAyB;AAC9C,MAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,IACzC,YAAW,MAAM;;CAIrB,MAAM,cAAc,UAAsC;AACxD,MAAI,eAAgB,OAAM,gBAAgB;AAE1C,QAAM;;CAGR,MAAM,mBAAmB,WAAW,kBAAkB;CAEtD,MAAM,gBAAgB,WAAW,YAAY;AAE7C,QACE,qBAAC;EACC,WAAW,GACT,iGACA,UACD;EACD,SAAS;EACT,WAAW;EACX,MAAK;EACL,UAAU;EACV,cAAY;EACZ,gBAAc;EACd,eAAY;aAEZ,oBAAC;GAAK,WAAU;GAAqB;IAAgB,EAEpD,QACC,oBAAC;GACC,WAAU;GACV,eAAY;IACZ;GAEC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { NodeWrapper } from "./NodeWrapper/index.mjs";
|
|
4
|
-
import { useEditedContent, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
5
4
|
import { createElement } from "react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useEditedContent, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
7
7
|
|
|
8
8
|
//#region src/components/DictionaryEditor/DictionaryEditor.tsx
|
|
9
9
|
const DictionaryEditor = ({ dictionary, ...props }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.mjs","names":[
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEditedContent,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locale;\n onDelete?: () => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } =\n useFocusUnmergedDictionary();\n\n return (\n <div className=\"flex flex-col gap-2\">\n <NodeWrapper\n {...props}\n keyPath={[]}\n dictionary={dictionary}\n key={JSON.stringify(\n (editedContent?.[dictionary.localId!] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.localId!]?.content}\n focusedKeyPath={focusedContent?.keyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(\n dictionary.localId!,\n content.newValue,\n content.keyPath\n );\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAgBA,MAAa,oBAA+C,EAC1D,YACA,GAAG,YACC;CACJ,MAAM,EAAE,eAAe,qBAAqB,kBAAkB;CAC9D,MAAM,EAAE,gBAAgB,6BACtB,4BAA4B;AAE9B,QACE,oBAAC;EAAI,WAAU;YACb,8BAAC;GACC,GAAI;GACJ,SAAS,EAAE;GACC;GACZ,KAAK,KAAK,WACP,gBAAgB,WAAW,YAAa,YAAY,QACtD;GACD,eAAe,gBAAgB,WAAW,UAAW;GACrD,gBAAgB,gBAAgB;GAChC,SAAS,WAAW;GACpB,kBAAkB,YAAY;AAC5B,qBACE,WAAW,SACX,QAAQ,UACR,QAAQ,QACT;;GAEH,gBAAgB;IAChB;GACE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemLayout.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ItemLayout.mjs","names":[],"sources":["../../../../src/components/DictionaryEditor/ItemLayout.tsx"],"sourcesContent":["import { cn } from '@utils/cn';\nimport type { FC, HTMLAttributes, ReactNode } from 'react';\nimport { Accordion } from '../Accordion';\n\ninterface ItemWrapperProps extends HTMLAttributes<HTMLDivElement> {\n level: number;\n children: ReactNode;\n title: string;\n description: string;\n rightParam?: ReactNode;\n isSelected: boolean;\n}\n\nexport const ItemLayout: FC<ItemWrapperProps> = ({\n level,\n title,\n description,\n children,\n rightParam,\n isSelected,\n ...props\n}) => (\n <div\n className={cn(\n 'rounded-md p-2 transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && '',\n isSelected === true && 'bg-card/40'\n )}\n {...props}\n >\n <Accordion\n isOpen={isSelected}\n label={title}\n header={\n <div className=\"flex w-full\">\n <div className=\"flex w-full items-center justify-between\">\n <span\n className={cn(\n level === 0 && 'text-lg',\n level === 1 && 'text-md',\n level === 2 && 'text-md',\n level >= 3 && 'text-base'\n )}\n >\n {title}\n </span>\n {rightParam && (\n <div className=\"flex w-auto items-center justify-between p-3\">\n {rightParam}\n </div>\n )}\n </div>\n {description && (\n <p className=\"pl-3 text-card text-sm\">{description}</p>\n )}\n </div>\n }\n >\n <div className=\"size-full px-2\">{children}</div>\n </Accordion>\n </div>\n);\n"],"mappings":";;;;;AAaA,MAAa,cAAoC,EAC/C,OACA,OACA,aACA,UACA,YACA,YACA,GAAG,YAEH,oBAAC;CACC,WAAW,GACT,6BACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,IACd,eAAe,QAAQ,aACxB;CACD,GAAI;WAEJ,oBAAC;EACC,QAAQ;EACR,OAAO;EACP,QACE,qBAAC;GAAI,WAAU;cACb,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,WAAW,GACT,UAAU,KAAK,WACf,UAAU,KAAK,WACf,UAAU,KAAK,WACf,SAAS,KAAK,YACf;eAEA;MACI,EACN,cACC,oBAAC;KAAI,WAAU;eACZ;MACG;KAEJ,EACL,eACC,oBAAC;IAAE,WAAU;cAA0B;KAAgB;IAErD;YAGR,oBAAC;GAAI,WAAU;GAAkB;IAAe;GACtC;EACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ArrayWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/ArrayWrapper.tsx"],"sourcesContent":["import { isSameKeyPath } from '@intlayer/core';\nimport type { ContentNode } from '@intlayer/types';\nimport { type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype ArrayWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: ContentNode[];\n};\n\nexport const ArrayWrapper: FC<ArrayWrapperProps> = (props) => {\n const { keyPath, section, onFocusKeyPath, focusedKeyPath = [] } = props;\n\n return section.map((subSection, key) => {\n const newKeyPathEl: KeyPath = {\n key,\n type: NodeType.Array,\n };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={JSON.stringify(subSection)}\n title={`${key}`}\n description=\"\"\n isSelected={isSameKeyPath(newKeyPath, focusedKeyPath)}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(newKeyPath);\n }}\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </ItemLayout>\n );\n });\n};\n"],"mappings":";;;;;;;AAWA,MAAa,gBAAuC,UAAU;CAC5D,MAAM,EAAE,SAAS,SAAS,gBAAgB,iBAAiB,EAAE,KAAK;AAElE,QAAO,QAAQ,KAAK,YAAY,QAAQ;EACtC,MAAM,eAAwB;GAC5B;GACA,MAAM,SAAS;GAChB;EACD,MAAM,aAAwB,CAAC,GAAG,SAAS,aAAa;AAExD,SACE,oBAAC;GACC,OAAO,QAAQ;GAEf,OAAO,GAAG;GACV,aAAY;GACZ,YAAY,cAAc,YAAY,eAAe;GACrD,UAAU,MAAM;AACd,MAAE,iBAAiB;AACnB,mBAAe,WAAW;;aAG5B,oBAAC;IAAY,GAAI;IAAO,SAAS;IAAY,SAAS;KAAc;KAT/D,KAAK,UAAU,WAAW,CAUpB;GAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ConditionWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/ConditionWrapper.tsx"],"sourcesContent":["import type { ConditionContent } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps, traceKeys } from './index';\n\ntype ConditionWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: ConditionContent<ContentNode>;\n};\n\nexport const ConditionWrapper: FC<ConditionWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n {Object.keys(section)\n .filter((key) => !traceKeys.includes(key))\n .map((key) => {\n const newKeyPathEl: KeyPath = {\n type: NodeType.Condition,\n key,\n };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const subSection =\n section[NodeType.Condition][\n key as keyof (typeof section)[NodeType.Condition]\n ]!;\n\n return (\n <>\n <span className=\"flex items-center font-bold\">{key}</span>\n <NodeWrapper\n {...props}\n key={key}\n keyPath={newKeyPath}\n section={subSection}\n />\n </>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;AASA,MAAa,oBAA+C,UAAU;CACpE,MAAM,EAAE,SAAS,YAAY;AAE7B,QACE,oBAAC;EAAI,WAAU;YACZ,OAAO,KAAK,QAAQ,CAClB,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAI,CAAC,CACzC,KAAK,QAAQ;GACZ,MAAM,eAAwB;IAC5B,MAAM,SAAS;IACf;IACD;GACD,MAAM,aAAwB,CAAC,GAAG,SAAS,aAAa;GAExD,MAAM,aACJ,QAAQ,SAAS,WACf;AAGJ,UACE,8CACE,oBAAC;IAAK,WAAU;cAA+B;KAAW,EAC1D,8BAAC;IACC,GAAI;IACC;IACL,SAAS;IACT,SAAS;KACT,IACD;IAEL;GACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumerationWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"EnumerationWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.tsx"],"sourcesContent":["import type { EnumerationContent } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps, traceKeys } from './index';\n\ntype EnumerationWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: EnumerationContent<ContentNode>;\n};\n\nexport const EnumerationWrapper: FC<EnumerationWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n {Object.keys(section)\n .filter((key) => !traceKeys.includes(key))\n .map((key) => {\n const newKeyPathEl: KeyPath = {\n type: NodeType.Enumeration,\n key,\n };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const subSection =\n section[NodeType.Enumeration][\n key as keyof (typeof section)[NodeType.Enumeration]\n ]!;\n\n return (\n <>\n <span className=\"flex items-center font-bold\">{key}</span>\n <NodeWrapper\n {...props}\n key={key}\n keyPath={newKeyPath}\n section={subSection}\n />\n </>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;AASA,MAAa,sBAAmD,UAAU;CACxE,MAAM,EAAE,SAAS,YAAY;AAE7B,QACE,oBAAC;EAAI,WAAU;YACZ,OAAO,KAAK,QAAQ,CAClB,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAI,CAAC,CACzC,KAAK,QAAQ;GACZ,MAAM,eAAwB;IAC5B,MAAM,SAAS;IACf;IACD;GACD,MAAM,aAAwB,CAAC,GAAG,SAAS,aAAa;GAExD,MAAM,aACJ,QAAQ,SAAS,aACf;AAGJ,UACE,8CACE,oBAAC;IAAK,WAAU;cAA+B;KAAW,EAC1D,8BAAC;IACC,GAAI;IACC;IACL,SAAS;IACT,SAAS;KACT,IACD;IAEL;GACA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StringWrapper } from "./StringWrapper.mjs";
|
|
2
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { getContentNodeByKeyPath } from "@intlayer/core";
|
|
4
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
5
5
|
import { NodeType } from "@intlayer/types";
|
|
6
6
|
|
|
7
7
|
//#region src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileWrapper.mjs","names":["
|
|
1
|
+
{"version":3,"file":"FileWrapper.mjs","names":["content"],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/FileWrapper.tsx"],"sourcesContent":["import { type FileContent, getContentNodeByKeyPath } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport {\n type KeyPath,\n type LocalDictionaryId,\n NodeType,\n} from '@intlayer/types';\nimport type { FC } from 'react';\nimport { StringWrapper, type StringWrapperProps } from './StringWrapper';\n\ntype FileWrapperProps = Omit<StringWrapperProps, 'section'> & {\n section: FileContent;\n};\n\nexport const FileWrapper: FC<FileWrapperProps> = (props) => {\n const { keyPath, section } = props;\n const { addEditedContent } = useEditedContent();\n const editedContentValue = getContentNodeByKeyPath(\n props.editedContent,\n keyPath\n ) as FileContent | undefined;\n\n const subSection = section[NodeType.File];\n const { content } = section;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.File,\n },\n ];\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <span className=\"text-neutral text-sm\">{subSection} </span>\n <StringWrapper\n {...props}\n keyPath={newKeyPath}\n section={content}\n editedContentValue={editedContentValue?.content}\n onContentChange={(content) => {\n addEditedContent(\n props.dictionary.localId as LocalDictionaryId,\n {\n ...section,\n content: content.newValue,\n } as FileContent,\n keyPath\n );\n }}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;AAcA,MAAa,eAAqC,UAAU;CAC1D,MAAM,EAAE,SAAS,YAAY;CAC7B,MAAM,EAAE,qBAAqB,kBAAkB;CAC/C,MAAM,qBAAqB,wBACzB,MAAM,eACN,QACD;CAED,MAAM,aAAa,QAAQ,SAAS;CACpC,MAAM,EAAE,YAAY;CAEpB,MAAM,aAAwB,CAC5B,GAAG,SACH,EACE,MAAM,SAAS,MAChB,CACF;AAED,QACE,qBAAC;EAAI,WAAU;aACb,qBAAC;GAAK,WAAU;cAAwB,YAAW;IAAQ,EAC3D,oBAAC;GACC,GAAI;GACJ,SAAS;GACT,SAAS;GACT,oBAAoB,oBAAoB;GACxC,kBAAkB,cAAY;AAC5B,qBACE,MAAM,WAAW,SACjB;KACE,GAAG;KACH,SAASA,UAAQ;KAClB,EACD,QACD;;IAEH;GACE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsertionWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"InsertionWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/InsertionWrapper.tsx"],"sourcesContent":["import type { InsertionContent } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype InsertionWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: InsertionContent<ContentNode>;\n};\n\nexport const InsertionWrapper: FC<InsertionWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Insertion,\n },\n ];\n\n const subSection = section[NodeType.Insertion];\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </div>\n );\n};\n"],"mappings":";;;;;AASA,MAAa,oBAA+C,UAAU;CACpE,MAAM,EAAE,SAAS,YAAY;CAE7B,MAAM,aAAwB,CAC5B,GAAG,SACH,EACE,MAAM,SAAS,WAChB,CACF;CAED,MAAM,aAAa,QAAQ,SAAS;AAEpC,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GAAY,GAAI;GAAO,SAAS;GAAY,SAAS;IAAc;GAChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"MarkdownWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.tsx"],"sourcesContent":["import type { MarkdownContent } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype MarkdownWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: MarkdownContent<ContentNode>;\n};\n\nexport const MarkdownWrapper: FC<MarkdownWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Markdown,\n },\n ];\n\n const subSection = section[NodeType.Markdown] as ContentNode;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </div>\n );\n};\n"],"mappings":";;;;;AASA,MAAa,mBAA6C,UAAU;CAClE,MAAM,EAAE,SAAS,YAAY;CAE7B,MAAM,aAAwB,CAC5B,GAAG,SACH,EACE,MAAM,SAAS,UAChB,CACF;CAED,MAAM,aAAa,QAAQ,SAAS;AAEpC,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GAAY,GAAI;GAAO,SAAS;GAAY,SAAS;IAAc;GAChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedObjectWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"NestedObjectWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx"],"sourcesContent":["import { camelCaseToSentence } from '@intlayer/config/client';\nimport { isSameKeyPath } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport { type FC, memo, useMemo } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, type NodeWrapperProps, traceKeys } from './index';\n\ntype NestedObjectWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: Record<string, ContentNode>;\n};\n\nexport const NestedObjectWrapper: FC<NestedObjectWrapperProps> = memo(\n (props) => {\n const { keyPath, section, focusedKeyPath = [], onFocusKeyPath } = props;\n\n const sectionKeys = useMemo(\n () =>\n Object.keys(section ?? {}).filter((key) => !traceKeys.includes(key)),\n [section]\n );\n\n return sectionKeys.map((key) => {\n const newKeyPathEl: KeyPath = { key, type: NodeType.Object };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const isSelected = isSameKeyPath(newKeyPath, focusedKeyPath);\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={key}\n title={camelCaseToSentence(key)}\n description=\"\"\n isSelected={isSelected}\n onClick={(e) => {\n e.stopPropagation();\n\n if (isSelected) {\n onFocusKeyPath([]);\n } else {\n onFocusKeyPath(newKeyPath);\n }\n }}\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={section[key]} />\n </ItemLayout>\n );\n });\n }\n);\n"],"mappings":";;;;;;;;;AAWA,MAAa,sBAAoD,MAC9D,UAAU;CACT,MAAM,EAAE,SAAS,SAAS,iBAAiB,EAAE,EAAE,mBAAmB;AAQlE,QANoB,cAEhB,OAAO,KAAK,WAAW,EAAE,CAAC,CAAC,QAAQ,QAAQ,CAAC,UAAU,SAAS,IAAI,CAAC,EACtE,CAAC,QAAQ,CACV,CAEkB,KAAK,QAAQ;EAC9B,MAAM,eAAwB;GAAE;GAAK,MAAM,SAAS;GAAQ;EAC5D,MAAM,aAAwB,CAAC,GAAG,SAAS,aAAa;EAExD,MAAM,aAAa,cAAc,YAAY,eAAe;AAE5D,SACE,oBAAC;GACC,OAAO,QAAQ;GAEf,OAAO,oBAAoB,IAAI;GAC/B,aAAY;GACA;GACZ,UAAU,MAAM;AACd,MAAE,iBAAiB;AAEnB,QAAI,WACF,gBAAe,EAAE,CAAC;QAElB,gBAAe,WAAW;;aAI9B,oBAAC;IAAY,GAAI;IAAO,SAAS;IAAY,SAAS,QAAQ;KAAQ;KAdjE,IAeM;GAEf;EAEL"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../../utils/cn.mjs";
|
|
2
2
|
import { EditableFieldTextArea } from "../../EditableField/EditableFieldTextArea.mjs";
|
|
3
|
-
import { useEditorLocale } from "@intlayer/editor-react";
|
|
4
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
4
|
import { getContentNodeByKeyPath } from "@intlayer/core";
|
|
5
|
+
import { useEditorLocale } from "@intlayer/editor-react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx
|
|
8
8
|
const StringWrapper = ({ keyPath, section, editedContent, editedContentValue: editedContentValueProp, onContentChange, onFocusKeyPath, renderSection }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"StringWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { EditableFieldTextArea } from '@components/EditableField';\nimport { getContentNodeByKeyPath } from '@intlayer/core';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport { cn } from '@utils/cn';\nimport type { FC } from 'react';\nimport type { NodeWrapperProps } from './index';\n\nexport type StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n editedContentValue?: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n editedContentValue: editedContentValueProp,\n onContentChange,\n onFocusKeyPath,\n renderSection,\n}) => {\n const currentLocale = useEditorLocale();\n const editedContentValue =\n editedContentValueProp ??\n getContentNodeByKeyPath(editedContent, keyPath, currentLocale);\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return (\n <>\n Error loading section - Edited content Incoherence with the original\n content format\n </>\n );\n }\n\n const level = keyPath.length;\n\n const content = String(editedContentValue ?? section);\n\n return (\n <span\n role=\"button\"\n tabIndex={0}\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n {typeof renderSection === 'function' ? (\n renderSection(content)\n ) : (\n <EditableFieldTextArea\n aria-label=\"Editable field\"\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n )}\n </span>\n );\n};\n"],"mappings":";;;;;;;AAYA,MAAa,iBAAyC,EACpD,SACA,SACA,eACA,oBAAoB,wBACpB,iBACA,gBACA,oBACI;CACJ,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,qBACJ,0BACA,wBAAwB,eAAe,SAAS,cAAc;AAEhE,KAAI,sBAAsB,OAAO,uBAAuB,SACtD,QACE,0CAAE,wFAGC;CAIP,MAAM,QAAQ,QAAQ;CAEtB,MAAM,UAAU,OAAO,sBAAsB,QAAQ;AAErD,QACE,oBAAC;EACC,MAAK;EACL,UAAU;EACV,WAAW,GACT,8CACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,GACf;EACD,UAAU,MAAM;AACd,KAAE,iBAAiB;AACnB,kBAAe,QAAQ;;YAGxB,OAAO,kBAAkB,aACxB,cAAc,QAAQ,GAEtB,oBAAC;GACC,cAAW;GACX,cAAc;GACd,SAAS,aAAa,gBAAgB;IAAE;IAAS;IAAU,CAAC;GAC5D,gBAAgB;IAChB;GAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationWrapper.mjs","names":[
|
|
1
|
+
{"version":3,"file":"TranslationWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/TranslationWrapper.tsx"],"sourcesContent":["import type { TranslationContent } from '@intlayer/core';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype TranslationWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: TranslationContent<ContentNode>;\n};\n\nexport const TranslationWrapper: FC<TranslationWrapperProps> = (props) => {\n const { keyPath, section, locale } = props;\n\n const newKeyPathEl: KeyPath = {\n type: NodeType.Translation,\n key: locale,\n };\n\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const subSection =\n section.translation[\n locale as unknown as keyof (typeof section)['translation']\n ]!;\n\n return <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />;\n};\n"],"mappings":";;;;;AASA,MAAa,sBAAmD,UAAU;CACxE,MAAM,EAAE,SAAS,SAAS,WAAW;CAErC,MAAM,eAAwB;EAC5B,MAAM,SAAS;EACf,KAAK;EACN;CAED,MAAM,aAAwB,CAAC,GAAG,SAAS,aAAa;CAExD,MAAM,aACJ,QAAQ,YACN;AAGJ,QAAO,oBAAC;EAAY,GAAI;EAAO,SAAS;EAAY,SAAS;GAAc"}
|
|
@@ -9,10 +9,10 @@ import { InsertionWrapper } from "./InsertionWrapper.mjs";
|
|
|
9
9
|
import { MarkdownWrapper } from "./MarkdownWrapper.mjs";
|
|
10
10
|
import { NestedObjectWrapper } from "./NestedObjectWrapper.mjs";
|
|
11
11
|
import { TranslationWrapper } from "./TranslationWrapper.mjs";
|
|
12
|
-
import { useEditorLocale } from "@intlayer/editor-react";
|
|
13
12
|
import { memo, useMemo } from "react";
|
|
14
13
|
import { jsx } from "react/jsx-runtime";
|
|
15
14
|
import { getContentNodeByKeyPath, getNodeType } from "@intlayer/core";
|
|
15
|
+
import { useEditorLocale } from "@intlayer/editor-react";
|
|
16
16
|
import { NodeType } from "@intlayer/types";
|
|
17
17
|
|
|
18
18
|
//#region src/components/DictionaryEditor/NodeWrapper/index.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ConditionContent,\n type EnumerationContent,\n type FileContent,\n getContentNodeByKeyPath,\n getNodeType,\n type InsertionContent,\n type MarkdownContent,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport {\n type ContentNode,\n type Dictionary,\n type KeyPath,\n type Locale,\n NodeType,\n} from '@intlayer/types';\nimport { type FC, memo, type ReactNode, useMemo } from 'react';\nimport { ArrayWrapper } from './ArrayWrapper';\nimport { ConditionWrapper } from './ConditionWrapper';\nimport { EnumerationWrapper } from './EnumerationWrapper';\nimport { FileWrapper } from './FileWrapper';\nimport { InsertionWrapper } from './InsertionWrapper';\nimport { MarkdownWrapper } from './MarkdownWrapper';\nimport { NestedObjectWrapper } from './NestedObjectWrapper';\nimport { StringWrapper } from './StringWrapper';\nimport { TranslationWrapper } from './TranslationWrapper';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nexport type NodeWrapperProps = {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n section: ContentNode;\n onContentChange: (content: { keyPath: KeyPath[]; newValue: string }) => void;\n locale: Locale;\n editedContent: ContentNode;\n focusedKeyPath: KeyPath[] | undefined;\n onFocusKeyPath: (keyPath: KeyPath[]) => void;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n renderSection?: (content: string) => ReactNode;\n};\n\nexport const NodeWrapper: FC<NodeWrapperProps> = memo((props) => {\n const currentLocale = useEditorLocale();\n const section = useMemo(() => {\n const editedContentValue = getContentNodeByKeyPath(\n props.editedContent,\n props.keyPath,\n currentLocale\n );\n return editedContentValue ?? props.section;\n }, [props.editedContent, props.keyPath, props.section]);\n\n const nodeType = useMemo(() => getNodeType(section), [section]);\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return (\n <span className=\"text-neutral text-xs\">React node not editable</span>\n );\n }\n\n if (nodeType === NodeType.Nested) {\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n [Nested] Dictionary\n </div>\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownWrapper\n {...props}\n section={section as MarkdownContent<ContentNode>}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationWrapper\n {...props}\n section={section as TranslationContent<ContentNode>}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationWrapper\n {...props}\n section={section as EnumerationContent<ContentNode>}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionWrapper\n {...props}\n section={section as ConditionContent<ContentNode>}\n />\n );\n }\n\n if (nodeType === NodeType.Insertion) {\n return (\n <InsertionWrapper\n {...props}\n section={section as InsertionContent<ContentNode>}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayWrapper\n {...props}\n section={section as unknown as ContentNode[]}\n />\n );\n }\n\n if (nodeType === NodeType.File) {\n return <FileWrapper {...props} section={section as FileContent} />;\n }\n\n return (\n <NestedObjectWrapper\n {...props}\n section={section as unknown as Record<string, ContentNode>}\n />\n );\n }\n\n if (typeof section === 'string') {\n return <StringWrapper {...props} section={section} />;\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAa,YAAsB;CAAC;CAAY;CAAM;CAAW;AAejE,MAAa,cAAoC,MAAM,UAAU;CAC/D,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,cAAc;AAM5B,SAL2B,wBACzB,MAAM,eACN,MAAM,SACN,cACD,IAC4B,MAAM;IAClC;EAAC,MAAM;EAAe,MAAM;EAAS,MAAM;EAAQ,CAAC;CAEvD,MAAM,WAAW,cAAc,YAAY,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAE/D,KAAI,OAAO,YAAY,UAAU;AAC/B,MAAI,aAAa,SAAS,UACxB,QACE,oBAAC;GAAK,WAAU;aAAuB;IAA8B;AAIzE,MAAI,aAAa,SAAS,OACxB,QACE,oBAAC;GAAI,WAAU;aAAuC;IAEhD;AAIV,MAAI,aAAa,SAAS,SACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,YACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,YACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,UACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,UACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,MACxB,QACE,oBAAC;GACC,GAAI;GACK;IACT;AAIN,MAAI,aAAa,SAAS,KACxB,QAAO,oBAAC;GAAY,GAAI;GAAgB;IAA0B;AAGpE,SACE,oBAAC;GACC,GAAI;GACK;IACT;;AAIN,KAAI,OAAO,YAAY,SACrB,QAAO,oBAAC;EAAc,GAAI;EAAgB;GAAW;EAEvD"}
|
|
@@ -6,10 +6,10 @@ import { TextEditorContainer } from "./ContentEditorView/TextEditor.mjs";
|
|
|
6
6
|
import { getIsEditableSection } from "./getIsEditableSection.mjs";
|
|
7
7
|
import { KeyPathBreadcrumb } from "./KeyPathBreadcrumb.mjs";
|
|
8
8
|
import { NavigationViewNode } from "./NavigationView/NavigationViewNode.mjs";
|
|
9
|
-
import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
10
9
|
import { useEffect } from "react";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import { getContentNodeByKeyPath } from "@intlayer/core";
|
|
12
|
+
import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
13
13
|
|
|
14
14
|
//#region src/components/DictionaryFieldEditor/ContentEditor.tsx
|
|
15
15
|
const ContentEditor = ({ dictionary, isDarkMode }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditor.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ContentEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core';\nimport {\n useEditedContent,\n useEditorLocale,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types';\nimport { type FC, useEffect } from 'react';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { content, key, localId } = dictionary;\n const { editedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } =\n useFocusUnmergedDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[localId as LocalDictionaryId]?.content ===\n 'undefined'\n ? content\n : editedContent?.[localId as LocalDictionaryId]?.content;\n\n const currentLocale = useEditorLocale();\n const focusedSection = getContentNodeByKeyPath(\n section,\n focusedKeyPath ?? [],\n currentLocale\n );\n const isEditableBaseSection = getIsEditableSection(section);\n const isEditableFocusedSection = getIsEditableSection(focusedSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n return (\n <div>\n <div className=\"mb-6 flex items-center justify-between gap-2\">\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex items-center gap-2\">\n <LocaleSwitcherContent />\n </div>\n </div>\n <div className=\"flex flex-1 gap-2 overflow-visible max-md:flex-col\">\n {typeof section === 'object' &&\n section &&\n !isEditableBaseSection &&\n Object.keys(section).length > 0 && (\n <Container\n border\n background=\"none\"\n className=\"top-30 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"xl\"\n transparency=\"sm\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionary={dictionary}\n />\n </Container>\n )}\n {(isEditableFocusedSection || (focusedKeyPath ?? []).length > 0) && (\n <TextEditorContainer\n keyPath={focusedKeyPath ?? []}\n section={focusedSection}\n dictionary={dictionary}\n isDarkMode={isDarkMode}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAa,iBAAsC,EACjD,YACA,iBACI;CACJ,MAAM,EAAE,SAAS,KAAK,YAAY;CAClC,MAAM,EAAE,kBAAkB,kBAAkB;CAC5C,MAAM,EAAE,gBAAgB,6BACtB,4BAA4B;CAE9B,MAAM,iBAAiB,gBAAgB;CACvC,MAAM,UACJ,OAAO,gBAAgB,UAA+B,YACtD,cACI,UACA,gBAAgB,UAA+B;CAErD,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,iBAAiB,wBACrB,SACA,kBAAkB,EAAE,EACpB,cACD;CACD,MAAM,wBAAwB,qBAAqB,QAAQ;CAC3D,MAAM,2BAA2B,qBAAqB,eAAe;AAErE,iBAAgB;AACd,MAAI,OAAO,mBAAmB,YAC5B,0BAAyB,gBAAgB,SAAS,MAAM,GAAG,GAAG,IAAI,EAAE,CAAC;IAEtE,EAAE,CAAC;AAEN,QACE,qBAAC,oBACC,qBAAC;EAAI,WAAU;aACb,oBAAC;GACC,eAAe;GACf,SAAS,kBAAkB,EAAE;GAC7B,gBAAgB;IAChB,EACF,oBAAC;GAAI,WAAU;aACb,oBAAC,0BAAwB;IACrB;GACF,EACN,qBAAC;EAAI,WAAU;aACZ,OAAO,YAAY,YAClB,WACA,CAAC,yBACD,OAAO,KAAK,QAAQ,CAAC,SAAS,KAC5B,oBAAC;GACC;GACA,YAAW;GACX,WAAU;GACV,aAAY;GACZ,cAAa;aAEb,oBAAC;IACC,SAAS,EAAE;IACF;IACG;KACZ;IACQ,GAEd,6BAA6B,kBAAkB,EAAE,EAAE,SAAS,MAC5D,oBAAC;GACC,SAAS,kBAAkB,EAAE;GAC7B,SAAS;GACG;GACA;IACZ;GAEA,IACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useAuditContentDeclarationField } from "../../../hooks/reactQuery.mjs";
|
|
4
3
|
import { Container } from "../../Container/index.mjs";
|
|
5
4
|
import { Button, ButtonColor, ButtonSize, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
|
|
6
5
|
import { InputVariant } from "../../Input/Input.mjs";
|
|
6
|
+
import { useAuditContentDeclarationField } from "../../../hooks/reactQuery.mjs";
|
|
7
7
|
import { SwitchSelector, SwitchSelectorColor, SwitchSelectorSize } from "../../SwitchSelector/index.mjs";
|
|
8
8
|
import { useLocaleSwitcherContent } from "../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
|
|
9
9
|
import { ContentEditorInput as ContentEditorInput$1 } from "../../ContentEditor/ContentEditorInput.mjs";
|
|
@@ -12,12 +12,12 @@ import { Label } from "../../Label/index.mjs";
|
|
|
12
12
|
import { MarkdownRenderer } from "../../MarkDownRender/MarkDownRender.mjs";
|
|
13
13
|
import { renameKey } from "../../../utils/object.mjs";
|
|
14
14
|
import { EnumKeyInput } from "../EnumKeyInput.mjs";
|
|
15
|
-
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
16
|
-
import { Fragment, useState } from "react";
|
|
17
15
|
import { Plus, Trash, WandSparkles } from "lucide-react";
|
|
16
|
+
import { Fragment, useState } from "react";
|
|
18
17
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
19
18
|
import { getEmptyNode, getLocaleName, getNodeType } from "@intlayer/core";
|
|
20
19
|
import { useIntlayer, useLocale } from "react-intlayer";
|
|
20
|
+
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
21
21
|
import { NodeType } from "@intlayer/types";
|
|
22
22
|
|
|
23
23
|
//#region src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.mjs","names":["traceKeys: string[]","ContentEditorTextArea: FC<ContentEditorTextAreaProps>","ContentEditorTextAreaBase","editedContent","ContentEditorInput: FC<ContentEditorInputProps>","ContentEditorInputBase","ContentEditorToggle: FC<ContentEditorToggleProps>","TranslationTextEditor: FC<TextEditorProps>","content: any","EnumerationTextEditor: FC<TextEditorProps>","ConditionTextEditor: FC<TextEditorProps>","GenderTextEditor: FC<TextEditorProps>","ArrayTextEditor: FC<TextEditorProps>","newKeyPath: KeyPath[]","ObjectTextEditor: FC<TextEditorProps>","childKeyPath: KeyPath[]","MarkdownTextEditor: FC<TextEditorProps>","toggleContent","content","InsertionTextEditor: FC<TextEditorProps>","FileTextEditor: FC<TextEditorProps>","NestedTextEditor: FC<TextEditorProps>","TextEditor: FC<TextEditorProps>","TextEditorContainer: FC<TextEditorProps>"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} 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 { InputVariant } from '@components/Input';\nimport { Label } from '@components/Label';\nimport { useLocaleSwitcherContent } from '@components/LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '@components/MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '@components/SwitchSelector';\nimport { useAuditContentDeclarationField } from '@hooks/reactQuery';\nimport {\n type ConditionContent,\n type EnumerationContent,\n type FileContent,\n type GenderContent,\n getEmptyNode,\n getLocaleName,\n getNodeType,\n type InsertionContent,\n type MarkdownContent,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport {\n type ContentNode,\n type Dictionary,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { renameKey } from '@utils/object';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { EnumKeyInput } from '../EnumKeyInput';\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={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant={ButtonVariant.HOVERABLE}\n size={ButtonSize.ICON_SM}\n color={ButtonColor.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={InputVariant.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={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n renderSection?: (content: string) => 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, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locale, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as LocalesValues[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n const content: any = (section as TranslationContent<string>)[\n NodeType.Translation\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {localesList.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: NodeType.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>)[NodeType.Enumeration];\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeType.Enumeration, 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 )[NodeType.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 [NodeType.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={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeType.Condition];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['true', 'false', 'fallback'].map((condKey) => {\n 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: NodeType.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>)[NodeType.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: NodeType.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 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: NodeType.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: NodeType.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={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.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 <>\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(section as unknown as Record<string, ContentNode>).map(\n (key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n const typedSection = section as unknown as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(\n typedSection\n )[0] as keyof typeof section;\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n const uniqueKey = `${JSON.stringify(keyPath)}-object-${key}`;\n\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 </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Markdown }];\n\n const content = (section as MarkdownContent<ContentNode>)[\n NodeType.Markdown\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={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"ml-auto\"\n />\n\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === MarkdownViewMode.Preview\n ? (content) => (\n <MarkdownRenderer isDarkMode={isDarkMode}>\n {content}\n </MarkdownRenderer>\n )\n : undefined\n }\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Insertion }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeType.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: NodeType.File }];\n\n const fileUrl = (section as FileContent)[NodeType.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)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.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={InputVariant.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={InputVariant.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: FC<TextEditorProps> = ({\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 === NodeType.ReactNode) {\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 === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Gender) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Insertion) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.File) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string)\n ) : (\n <ContentEditorTextArea\n variant={InputVariant.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 === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section, null, 2)}\n {JSON.stringify(keyPath, null, 2)}\n NodeType : {nodeType}\n </div>\n );\n};\n\nexport const TextEditorContainer: FC<TextEditorProps> = (props) => (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky\"\n roundedSize=\"xl\"\n >\n <TextEditor {...props} />\n </Container>\n);\n"],"mappings":";;;;;;;;;;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C;EAAI,WAAU;;GAAa;GAEzB,KAAK,UAAU,SAAS,MAAM,EAAE;GAChC,KAAK,UAAU,SAAS,MAAM,EAAE;GAAC;GACtB;;GACR;;AAIV,MAAaC,uBAA4C,UACvD,oBAAC;CACC;CACA,YAAW;CACX,WAAU;CACV,aAAY;WAEZ,oBAAC,cAAW,GAAI,QAAS;EACf"}
|
|
1
|
+
{"version":3,"file":"TextEditor.mjs","names":["ContentEditorTextAreaBase","editedContent","ContentEditorInputBase","toggleContent","content"],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"sourcesContent":["'use client';\n\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} 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 { InputVariant } from '@components/Input';\nimport { Label } from '@components/Label';\nimport { useLocaleSwitcherContent } from '@components/LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '@components/MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '@components/SwitchSelector';\nimport { useAuditContentDeclarationField } from '@hooks/reactQuery';\nimport {\n type ConditionContent,\n type EnumerationContent,\n type FileContent,\n type GenderContent,\n getEmptyNode,\n getLocaleName,\n getNodeType,\n type InsertionContent,\n type MarkdownContent,\n type TranslationContent,\n} from '@intlayer/core';\nimport { useConfiguration, useEditedContent } from '@intlayer/editor-react';\nimport {\n type ContentNode,\n type Dictionary,\n type KeyPath,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport { renameKey } from '@utils/object';\nimport { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { EnumKeyInput } from '../EnumKeyInput';\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={InputVariant.DEFAULT}\n onContentChange={(newValue) =>\n addEditedContent(dictionary.localId!, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant={ButtonVariant.HOVERABLE}\n size={ButtonSize.ICON_SM}\n color={ButtonColor.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={InputVariant.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={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n {...props}\n />\n );\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n isDarkMode?: boolean;\n renderSection?: (content: string) => 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, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locale, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as LocalesValues[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n const content: any = (section as TranslationContent<string>)[\n NodeType.Translation\n ];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {localesList.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: NodeType.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>)[NodeType.Enumeration];\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n\n return (\n <div className=\"flex flex-col gap-2\">\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => {\n const childrenKeyPath = [\n ...keyPath,\n { type: NodeType.Enumeration, 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 )[NodeType.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 [NodeType.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={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n getEmptyNode(content[firstKey]) ?? '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }]\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </div>\n );\n};\n\nconst ConditionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n renderSection,\n}) => {\n const content = (section as ConditionContent<string>)[NodeType.Condition];\n\n return (\n <table className=\"w-full\">\n <tbody className=\"flex w-full flex-col gap-2\">\n {['true', 'false', 'fallback'].map((condKey) => {\n 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: NodeType.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>)[NodeType.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: NodeType.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 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: NodeType.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: NodeType.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={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n textAlign={ButtonTextAlign.LEFT}\n isFullWidth\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.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 <>\n <table className=\"w-full\">\n <tbody className=\"flex flex-col gap-2\">\n {Object.keys(section as unknown as Record<string, ContentNode>).map(\n (key) => {\n const childKeyPath: KeyPath[] = [\n ...keyPath,\n { type: NodeType.Object, key },\n ];\n const typedSection = section as unknown as Record<\n string,\n ContentNode\n >;\n const firstKey = Object.keys(\n typedSection\n )[0] as keyof typeof section;\n const subSection =\n typedSection[key as keyof typeof section] ??\n getEmptyNode(typedSection[firstKey]);\n const uniqueKey = `${JSON.stringify(keyPath)}-object-${key}`;\n\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 </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Markdown }];\n\n const content = (section as MarkdownContent<ContentNode>)[\n NodeType.Markdown\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={SwitchSelectorColor.TEXT}\n size={SwitchSelectorSize.SM}\n className=\"ml-auto\"\n />\n\n <TextEditorContainer\n section={content}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={\n mode === MarkdownViewMode.Preview\n ? (content) => (\n <MarkdownRenderer isDarkMode={isDarkMode}>\n {content}\n </MarkdownRenderer>\n )\n : undefined\n }\n />\n </div>\n );\n};\n\nconst InsertionTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n ...props\n}) => {\n const childKeyPath: KeyPath[] = [...keyPath, { type: NodeType.Insertion }];\n\n const content = (section as InsertionContent<ContentNode>)[\n NodeType.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: NodeType.File }];\n\n const fileUrl = (section as FileContent)[NodeType.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)[NodeType.Nested];\n const childrenKeyPath = [...keyPath, { type: NodeType.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={InputVariant.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={InputVariant.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: FC<TextEditorProps> = ({\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 === NodeType.ReactNode) {\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 === NodeType.Nested) {\n return (\n <NestedTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Condition) {\n return (\n <ConditionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Gender) {\n return (\n <GenderTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Insertion) {\n return (\n <InsertionTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Markdown) {\n return (\n <MarkdownTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n isDarkMode={isDarkMode}\n />\n );\n }\n\n if (nodeType === NodeType.File) {\n return (\n <FileTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Object) {\n return (\n <ObjectTextEditor\n dictionary={dictionary}\n renderSection={renderSection}\n keyPath={keyPath}\n section={section}\n />\n );\n }\n\n if (nodeType === NodeType.Number) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorInput\n dictionary={dictionary}\n keyPath={keyPath}\n type=\"number\"\n aria-label=\"Edit field\"\n >\n {section as number}\n </ContentEditorInput>\n </div>\n );\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"w-full p-2\">\n {typeof renderSection === 'function' ? (\n renderSection(section as string)\n ) : (\n <ContentEditorTextArea\n variant={InputVariant.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 === NodeType.Boolean) {\n return (\n <div className=\"w-full p-2\">\n <ContentEditorToggle\n dictionary={dictionary}\n keyPath={keyPath}\n value={section as boolean}\n />\n </div>\n );\n }\n\n return (\n <div className=\"w-full p-2\">\n Error. Format not supported.\n {JSON.stringify(section, null, 2)}\n {JSON.stringify(keyPath, null, 2)}\n NodeType : {nodeType}\n </div>\n );\n};\n\nexport const TextEditorContainer: FC<TextEditorProps> = (props) => (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky\"\n roundedSize=\"xl\"\n >\n <TextEditor {...props} />\n </Container>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,YAAsB;CAAC;CAAY;CAAM;CAAW;AAUjE,MAAM,yBAAyD,EAC7D,SACA,YACA,GAAG,YACC;CACJ,MAAM,EAAE,eAAe,qBAAqB,kBAAkB;CAC9D,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,QAAQ,8BAA8B,WAAW,eACvD,iCAAiC;AAEnC,QACE,oBAACA;EACC,SAAS,aAAa;EACtB,kBAAkB,aAChB,iBAAiB,WAAW,SAAU,UAAU,QAAQ;EAE1D,mBACE,oBAAC;GACC,MAAM;GACN,OAAM;GACN,SAAS,cAAc;GACvB,MAAM,WAAW;GACjB,OAAO,YAAY;GACnB,WAAU;GACV,WAAW;GACX,eAAe;AACb,iCACE;KACE,aAAa,KAAK,UAAU;MAC1B,GAAG;MACH,GAAI,gBAAgB,WAAW,YAAa,EAAE;MAC/C,CAAC;KACF;KACA,SAAS,cAAc,qBAAqB,WAAW,EAAE;KACzD,WAAW;MACT,QAAQ,cAAc,IAAI;MAC1B,OAAO,cAAc,IAAI;MACzB,aAAa,cAAc,IAAI;MAChC;KACF,EACD,EACE,YAAY,aAAa;AACvB,SAAI,CAAC,UAAU,KAA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GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EACa;EACG;EACN;EACA;GACT;AAIN,KAAI,aAAa,SAAS,OACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACa;GACH;GACT,MAAK;GACL,cAAW;aAEV;IACkB;GACjB;AAIV,KAAI,aAAa,SAAS,KACxB,QACE,oBAAC;EAAI,WAAU;YACZ,OAAO,kBAAkB,aACxB,cAAc,QAAkB,GAEhC,oBAAC;GACC,SAAS,aAAa;GACtB,cAAW;GACF;GACG;aAEX;IACqB;GAEtB;AAIV,KAAI,aAAa,SAAS,QACxB,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GACa;GACH;GACT,OAAO;IACP;GACE;AAIV,QACE,qBAAC;EAAI,WAAU;;GAAa;GAEzB,KAAK,UAAU,SAAS,MAAM,EAAE;GAChC,KAAK,UAAU,SAAS,MAAM,EAAE;GAAC;GACtB;;GACR;;AAIV,MAAa,uBAA4C,UACvD,oBAAC;CACC;CACA,YAAW;CACX,WAAU;CACV,aAAY;WAEZ,oBAAC,cAAW,GAAI,QAAS;EACf"}
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { ButtonColor } from "../../Button/Button.mjs";
|
|
3
4
|
import { useSession } from "../../../hooks/useAuth/useSession.mjs";
|
|
4
5
|
import { useAddDictionary, useGetProjects } from "../../../hooks/reactQuery.mjs";
|
|
5
|
-
import { ButtonColor } from "../../Button/Button.mjs";
|
|
6
6
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
7
7
|
import { useForm } from "../../Form/FormBase.mjs";
|
|
8
8
|
import { Form } from "../../Form/Form.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.mjs","names":["
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.mjs","names":["project"],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { ButtonColor } from '@components/Button';\nimport { Form, useForm } from '@components/Form';\nimport { MultiSelect } from '@components/Select';\nimport { useAddDictionary, useGetProjects } from '@hooks/reactQuery';\nimport { useSession } from '@hooks/useAuth';\nimport type { FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport {\n type DictionaryFormData,\n useDictionarySchema,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useSession();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data: projectsData } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?.id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } =\n useIntlayer('dictionary-form');\n\n const onSubmitSuccess = (data: DictionaryFormData) => {\n addDictionary(\n { dictionary: data },\n {\n onSuccess: () => {\n onDictionaryCreated?.();\n },\n }\n );\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"m-auto w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projectsData?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {projectsData?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"mt-12 ml-auto\"\n type=\"submit\"\n color={ButtonColor.TEXT}\n isLoading={isSubmitting || isPending}\n label={createDictionaryButton.ariaLabel.value}\n isFullWidth\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAa,0BAA2D,EACtE,0BACI;CACJ,MAAM,EAAE,YAAY,YAAY;CAChC,MAAM,EAAE,YAAY,WAAW,EAAE;CACjC,MAAM,EAAE,QAAQ,eAAe,cAAc,kBAAkB;CAC/D,MAAM,EAAE,MAAM,iBAAiB,gBAAgB;CAC/C,MAAM,mBAAmB,oBAAoB,OAAO,SAAS,GAAG,CAAC;CACjE,MAAM,EAAE,MAAM,iBAAiB,QAAQ,iBAAiB;CACxD,MAAM,EAAE,UAAU,wBAAwB,iBACxC,YAAY,kBAAkB;CAEhC,MAAM,mBAAmB,SAA6B;AACpD,gBACE,EAAE,YAAY,MAAM,EACpB,EACE,iBAAiB;AACf,0BAAuB;KAE1B,CACF;;AAGH,QACE,qBAAC;EACC,QAAQ;EACS;EACjB,WAAU;EACV,GAAI;;GAEJ,oBAAC,KAAK;IACJ,MAAK;IACL,OAAO,SAAS,MAAM;IACtB,aAAa,SAAS,YAAY;IAClC;KACA;GAEF,qBAAC,KAAK;IAAY,MAAK;IAAa,OAAO,aAAa,MAAM;eAC5D,oBAAC,YAAY;KACX,gBAAgB,UACd,cAAc,MAAM,MAAM,cAAY,OAAOA,UAAQ,GAAG,KAAK,MAAM,EAC/D,QAAQ;eAGd,oBAAC,YAAY,SAAM,aAAa,aAAa,YAAY,QAAS;MAC9C,EACtB,oBAAC,YAAY,qBACX,oBAAC,YAAY,kBACV,cAAc,MAAM,KAAK,cACxB,oBAAC,YAAY;KAEX,OAAO,OAAOA,UAAQ,GAAG;eAExBA,UAAQ;OAHJ,OAAOA,UAAQ,GAAG,CAIN,CACnB,GACe,GACC;KACL;GAEnB,oBAAC,K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