@intlayer/design-system 7.5.5 → 7.5.7
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/components/Accordion/Accordion.mjs +1 -1
- package/dist/esm/components/Avatar/index.mjs +1 -1
- package/dist/esm/components/Breadcrumb/index.mjs +29 -3
- package/dist/esm/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/esm/components/Browser/Browser.mjs +30 -41
- package/dist/esm/components/Browser/Browser.mjs.map +1 -1
- package/dist/esm/components/Browser/{Browser.content.mjs → browser.content.mjs} +42 -4
- package/dist/esm/components/Browser/{Browser.content.mjs.map → browser.content.mjs.map} +1 -1
- package/dist/esm/components/Button/Button.mjs +6 -2
- package/dist/esm/components/Button/Button.mjs.map +1 -1
- package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditor.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorInput.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +2 -2
- package/dist/esm/components/CopyButton/index.mjs +1 -1
- package/dist/esm/components/CopyToClipboard/index.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/FileWrapper.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +113 -83
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +4 -4
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/JSONEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs +7 -6
- 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/SaveForm/SaveForm.mjs +4 -4
- package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/index.mjs +4 -1
- package/dist/esm/components/DropDown/index.mjs +19 -4
- package/dist/esm/components/DropDown/index.mjs.map +1 -1
- package/dist/esm/components/EditableField/EditableFieldLayout.mjs +1 -1
- package/dist/esm/components/Flags/Flag.mjs +55 -2
- package/dist/esm/components/Flags/Flag.mjs.map +1 -1
- package/dist/esm/components/Flags/bw.mjs +35 -0
- package/dist/esm/components/Flags/bw.mjs.map +1 -0
- package/dist/esm/components/Flags/cu.mjs +45 -0
- package/dist/esm/components/Flags/cu.mjs.map +1 -0
- package/dist/esm/components/Flags/cv.mjs +45 -0
- package/dist/esm/components/Flags/cv.mjs.map +1 -0
- package/dist/esm/components/Flags/dj.mjs +45 -0
- package/dist/esm/components/Flags/dj.mjs.map +1 -0
- package/dist/esm/components/Flags/flags.mjs +242 -7
- package/dist/esm/components/Flags/flags.mjs.map +1 -1
- package/dist/esm/components/Flags/gh.mjs +38 -0
- package/dist/esm/components/Flags/gh.mjs.map +1 -0
- package/dist/esm/components/Flags/gw.mjs +69 -0
- package/dist/esm/components/Flags/gw.mjs.map +1 -0
- package/dist/esm/components/Flags/km.mjs +54 -0
- package/dist/esm/components/Flags/km.mjs.map +1 -0
- package/dist/esm/components/Flags/lk.mjs +75 -0
- package/dist/esm/components/Flags/lk.mjs.map +1 -0
- package/dist/esm/components/Flags/md.mjs +319 -0
- package/dist/esm/components/Flags/md.mjs.map +1 -0
- package/dist/esm/components/Flags/mr.mjs +39 -0
- package/dist/esm/components/Flags/mr.mjs.map +1 -0
- package/dist/esm/components/Flags/mz.mjs +94 -0
- package/dist/esm/components/Flags/mz.mjs.map +1 -0
- package/dist/esm/components/Flags/ps.mjs +47 -0
- package/dist/esm/components/Flags/ps.mjs.map +1 -0
- package/dist/esm/components/Flags/sd.mjs +46 -0
- package/dist/esm/components/Flags/sd.mjs.map +1 -0
- package/dist/esm/components/Flags/so.mjs +39 -0
- package/dist/esm/components/Flags/so.mjs.map +1 -0
- package/dist/esm/components/Flags/st.mjs +75 -0
- package/dist/esm/components/Flags/st.mjs.map +1 -0
- package/dist/esm/components/Flags/td.mjs +35 -0
- package/dist/esm/components/Flags/td.mjs.map +1 -0
- package/dist/esm/components/Flags/tl.mjs +45 -0
- package/dist/esm/components/Flags/tl.mjs.map +1 -0
- package/dist/esm/components/Flags/tz.mjs +46 -0
- package/dist/esm/components/Flags/tz.mjs.map +1 -0
- package/dist/esm/components/Flags/ug.mjs +147 -0
- package/dist/esm/components/Flags/ug.mjs.map +1 -0
- package/dist/esm/components/Form/elements/OTPElement.mjs +2 -2
- package/dist/esm/components/Form/elements/OTPElement.mjs.map +1 -1
- package/dist/esm/components/HideShow/index.mjs +1 -1
- package/dist/esm/components/IDE/FileTree.mjs +1 -1
- package/dist/esm/components/Input/Input.mjs +3 -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/OTPInput.mjs +3 -3
- package/dist/esm/components/Input/OTPInput.mjs.map +1 -1
- package/dist/esm/components/Input/SearchInput.mjs +1 -1
- package/dist/esm/components/Input/SearchInput.mjs.map +1 -1
- package/dist/esm/components/KeyboardScreenAdapter/index.mjs +1 -1
- package/dist/esm/components/KeyboardShortcut/KeyboardShortcut.mjs +1 -1
- package/dist/esm/components/Link/Link.mjs +11 -3
- package/dist/esm/components/Link/Link.mjs.map +1 -1
- package/dist/esm/components/Link/index.mjs +2 -2
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +19 -13
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
- package/dist/esm/components/Modal/Modal.mjs +3 -3
- package/dist/esm/components/Navbar/MobileNavbar.mjs +2 -2
- package/dist/esm/components/Pagination/Pagination.mjs +2 -2
- package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
- package/dist/esm/components/Select/Multiselect.mjs +1 -1
- package/dist/esm/components/SwitchSelector/index.mjs +1 -1
- package/dist/esm/components/Tab/Tab.mjs +1 -1
- package/dist/esm/components/TabSelector/TabSelector.mjs +1 -1
- package/dist/esm/components/Table/Table.mjs +1 -1
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs +3 -30
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs +1 -1
- package/dist/esm/components/index.mjs +12 -9
- package/dist/esm/hooks/index.mjs +2 -2
- package/dist/esm/hooks/reactQuery.mjs +32 -3
- package/dist/esm/hooks/reactQuery.mjs.map +1 -1
- package/dist/esm/hooks/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/hooks/useAuth/useSession.mjs +1 -1
- package/dist/esm/hooks/usePersistedStore.mjs +1 -1
- package/dist/esm/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/esm/libs/auth.mjs +1 -1
- package/dist/esm/providers/ReactQueryProvider.mjs +1 -1
- package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts +3 -3
- package/dist/types/components/Breadcrumb/index.d.ts.map +1 -1
- 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 → browser.content.d.ts} +97 -15
- package/dist/types/components/Browser/browser.content.d.ts.map +1 -0
- 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/CollapsibleTable/CollapsibleTable.d.ts +3 -3
- 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 +3 -3
- package/dist/types/components/CopyButton/CopyButton.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +25 -25
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +9 -9
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +33 -33
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +25 -25
- package/dist/types/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +5 -1
- package/dist/types/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +25 -25
- package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +33 -33
- package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +9 -9
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +7 -7
- package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +5 -5
- package/dist/types/components/DictionaryFieldEditor/index.d.ts +4 -1
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +31 -31
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/types/components/DropDown/index.d.ts +16 -2
- package/dist/types/components/DropDown/index.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 +3 -3
- package/dist/types/components/Flags/Flag.d.ts.map +1 -1
- package/dist/types/components/Flags/flags.d.ts +169 -7
- package/dist/types/components/Flags/flags.d.ts.map +1 -1
- 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/MultiselectElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/OTPElement.d.ts +2 -2
- package/dist/types/components/Form/elements/OTPElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SelectElement.d.ts +2 -2
- package/dist/types/components/Form/elements/SelectElement.d.ts.map +1 -1
- 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/copyCode.content.d.ts +5 -5
- package/dist/types/components/IDE/selectors.content.d.ts +7 -7
- 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 +5 -8
- package/dist/types/components/Input/Input.d.ts.map +1 -1
- 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/Input/SearchInput.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +8 -7
- package/dist/types/components/Link/Link.d.ts.map +1 -1
- package/dist/types/components/Link/index.d.ts +2 -2
- package/dist/types/components/Loader/index.content.d.ts +3 -3
- package/dist/types/components/Loader/index.content.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +17 -17
- package/dist/types/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +13 -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/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/Navbar/index.d.ts +2 -2
- 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 +11 -11
- package/dist/types/components/Select/Select.d.ts +3 -3
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/index.d.ts +2 -2
- package/dist/types/components/SwitchSelector/index.d.ts +6 -6
- 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 +3 -3
- package/dist/types/components/Tag/index.d.ts +3 -3
- package/dist/types/components/Terminal/terminal.content.d.ts +5 -5
- package/dist/types/components/Toaster/Toast.d.ts +1 -1
- package/dist/types/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +6 -3
- package/dist/types/hooks/index.d.ts +2 -2
- package/dist/types/hooks/reactQuery.d.ts +2 -1
- package/dist/types/hooks/reactQuery.d.ts.map +1 -1
- package/package.json +14 -14
- package/dist/types/components/Browser/Browser.content.d.ts.map +0 -1
|
@@ -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 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 { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { Container } from '../../Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { InputVariant } from '../../Input';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '../../SwitchSelector';\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 <Fragment key={translationKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td className=\"w-full\">\n {getLocaleName(translationKey, locale)}\n </td>\n </tr>\n <tr className=\"flex\">\n <td className=\"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 </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 },\n ] as KeyPath[];\n return (\n <Fragment key={enumKey}>\n <tr className=\"mt-2 w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n Icon={Trash}\n className=\"ml-auto\"\n onClick={() =>\n addEditedContent(\n dictionary.localId!,\n undefined,\n childrenKeyPath\n )\n }\n >\n {removeEnumeration.text}\n </Button>\n </div>\n </tr>\n <tr className=\"w-full p-2\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.localId!, newValue, keyPath);\n }}\n />\n </tr>\n <tr className=\"block w-full\">\n <TextEditor\n section={\n content[enumKey as keyof typeof content] ??\n getEmptyNode(content[firstKey])\n }\n keyPath={childrenKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\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 <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <TextEditorContainer\n section={\n content[condKey as keyof typeof content] ??\n getEmptyNode(content.true)\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Condition,\n key: condKey,\n } as KeyPath,\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\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 <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block 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 </tr>\n </Fragment>\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 <Fragment key={JSON.stringify(subSection)}>\n <tr className=\"mt-2 flex w-full items-center justify-between gap-2 p-2\">\n <span className=\"text-xs\">{String(index)}</span>\n <Button\n label={removeElement.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n className=\"ml-auto\"\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\n dictionary.localId!,\n undefined,\n newKeyPath\n );\n }}\n Icon={Trash}\n >\n {removeElement.text}\n </Button>\n </tr>\n\n <tr className=\"block w-full\">\n <TextEditorContainer\n section={\n subSection ??\n getEmptyNode((section as unknown as ContentNode[])[0])\n }\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\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,\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\n return (\n <Fragment key={key}>\n <tr\n key={JSON.stringify(subSection)}\n className=\"mt-2 p-2 text-xs\"\n >\n <td className=\"w-full\">{String(key)}</td>\n </tr>\n <tr key={JSON.stringify(subSection)} className=\"block w-full\">\n <TextEditor\n section={subSection}\n keyPath={childKeyPath}\n dictionary={dictionary}\n renderSection={renderSection}\n />\n </tr>\n </Fragment>\n );\n }\n )}\n </tbody>\n </table>\n </>\n);\n\nenum MarkdownViewMode {\n Edit,\n Preview,\n}\n\nconst MarkdownTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n isDarkMode,\n}) => {\n const [mode, setMode] = useState(MarkdownViewMode.Edit);\n const toggleContent = [\n {\n content: 'Edit',\n value: MarkdownViewMode.Edit,\n },\n {\n content: 'Preview',\n value: MarkdownViewMode.Preview,\n },\n ] as SwitchSelectorChoices<MarkdownViewMode>;\n 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 <>\n <span>[React Node]</span>\n <span className=\"text-neutral text-xs\">{tsxNotEditable}</span>\n </>\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,MAAaA,YAAsB;CAAC;CAAY;CAAM;CAAW;AAUjE,MAAMC,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,oBAACC;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,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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,MAAaC,uBAA4C,UACvD,oBAAC;CACC;CACA,YAAW;CACX,WAAU;CACV,aAAY;WAEZ,oBAAC,cAAW,GAAI,QAAS;EACf"}
|
|
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 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 { Plus, Trash, WandSparkles } from 'lucide-react';\nimport { type FC, Fragment, type ReactNode, useState } from 'react';\nimport { useIntlayer, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport {\n Button,\n ButtonColor,\n ButtonSize,\n ButtonTextAlign,\n ButtonVariant,\n} from '../../Button';\nimport { Container } from '../../Container';\nimport {\n ContentEditorInput as ContentEditorInputBase,\n type ContentEditorInputProps as ContentEditorInputPropsBase,\n} from '../../ContentEditor/ContentEditorInput';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n type ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { InputVariant } from '../../Input';\nimport { Label } from '../../Label';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { MarkdownRenderer } from '../../MarkDownRender';\nimport {\n SwitchSelector,\n type SwitchSelectorChoices,\n SwitchSelectorColor,\n type SwitchSelectorProps,\n SwitchSelectorSize,\n} from '../../SwitchSelector';\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 <Fragment key={translationKey}>\n <tr className=\"mt-2 w-full p-2 text-xs\">\n <td className=\"w-full\">\n {getLocaleName(translationKey, locale)}\n </td>\n </tr>\n <tr className=\"flex\">\n <td className=\"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 </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 },\n ] as KeyPath[];\n return (\n <Fragment key={enumKey}>\n <tr className=\"mt-2 w-full\">\n <td className=\"w-full\">\n <div className=\"flex flex-1\">\n <Button\n label={removeEnumeration.label.value}\n variant={ButtonVariant.HOVERABLE}\n color={ButtonColor.TEXT}\n Icon={Trash}\n className=\"ml-auto\"\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=\"w-full\">\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(\n dictionary.localId!,\n newValue,\n keyPath\n );\n }}\n />\n </td>\n </tr>\n <tr className=\"block w-full\">\n <td className=\"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 <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <td className=\"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 </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 <Fragment key={condKey}>\n <tr key={condKey} className=\"mt-2 block w-full p-2 text-xs\">\n <td className=\"w-full\">{String(condKey)}</td>\n </tr>\n <tr key={condKey} className=\"block w-full\">\n <td className=\"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 </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 <Fragment key={JSON.stringify(subSection)}>\n <tr className=\"mt-2 w-full p-2\">\n <td className=\"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={ButtonVariant.HOVERABLE}\n color={ButtonColor.NEUTRAL}\n className=\"ml-auto\"\n textAlign={ButtonTextAlign.LEFT}\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(\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=\"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 </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,\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\n return (\n <Fragment key={key}>\n <tr\n key={JSON.stringify(subSection)}\n className=\"mt-2 p-2 text-xs\"\n >\n <td className=\"w-full\">{String(key)}</td>\n </tr>\n <tr key={JSON.stringify(subSection)} className=\"block w-full\">\n <td className=\"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,MAAaA,YAAsB;CAAC;CAAY;CAAM;CAAW;AAUjE,MAAMC,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,oBAACC;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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C;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,MAAaC,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";
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useSession } from "../../../hooks/useAuth/useSession.mjs";
|
|
4
|
-
import { useAuditContentDeclarationMetadata, useGetProjects, useGetTags } from "../../../hooks/reactQuery.mjs";
|
|
5
3
|
import { Container } from "../../Container/index.mjs";
|
|
6
4
|
import { Loader } from "../../Loader/index.mjs";
|
|
7
5
|
import { ButtonColor, ButtonSize, ButtonVariant } from "../../Button/Button.mjs";
|
|
6
|
+
import { useSession } from "../../../hooks/useAuth/useSession.mjs";
|
|
7
|
+
import { useAuditContentDeclarationMetadata, useGetProjects, useGetTags } from "../../../hooks/reactQuery.mjs";
|
|
8
8
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
9
9
|
import { useForm } from "../../Form/FormBase.mjs";
|
|
10
10
|
import { Form } from "../../Form/Form.mjs";
|
|
11
11
|
import { useDictionaryDetailsSchema } from "./useDictionaryDetailsSchema.mjs";
|
|
12
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
13
|
-
import { useEffect } from "react";
|
|
14
12
|
import { WandSparkles } from "lucide-react";
|
|
13
|
+
import { useEffect } from "react";
|
|
15
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
15
|
import { useIntlayer } from "react-intlayer";
|
|
16
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
17
17
|
|
|
18
18
|
//#region src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx
|
|
19
19
|
const DictionaryDetailsForm = ({ dictionary }) => {
|
|
@@ -8,11 +8,11 @@ import { ContentEditor } from "./ContentEditor.mjs";
|
|
|
8
8
|
import { DictionaryDetailsForm } from "./DictionaryDetails/DictionaryDetailsForm.mjs";
|
|
9
9
|
import { JSONEditor } from "./JSONEditor.mjs";
|
|
10
10
|
import { StructureEditor } from "./StructureEditor.mjs";
|
|
11
|
-
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
12
|
-
import { useEffect, useState } from "react";
|
|
13
11
|
import { ArrowLeft } from "lucide-react";
|
|
12
|
+
import { useEffect, useState } from "react";
|
|
14
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
14
|
import { useIntlayer } from "react-intlayer";
|
|
15
|
+
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
16
16
|
|
|
17
17
|
//#region src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx
|
|
18
18
|
var EditorViewType = /* @__PURE__ */ function(EditorViewType$1) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Container } from "../Container/index.mjs";
|
|
2
2
|
import { MonacoCode } from "../IDE/MonacoCode.mjs";
|
|
3
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
4
3
|
import { useMemo } from "react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/DictionaryFieldEditor/JSONEditor.tsx
|
|
8
8
|
const JSONEditor = ({ dictionary, isDarkMode }) => {
|
|
@@ -3,17 +3,18 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { camelCaseToSentence } from "@intlayer/config/client";
|
|
4
4
|
|
|
5
5
|
//#region src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx
|
|
6
|
-
const KeyPathBreadcrumb = ({ keyPath, dictionaryKey, onClickKeyPath, locale }) => {
|
|
6
|
+
const KeyPathBreadcrumb = ({ keyPath, dictionaryKey, onClickKeyPath, locale, color, showDictionaryKey = true }) => {
|
|
7
7
|
return /* @__PURE__ */ jsx(Breadcrumb, {
|
|
8
|
-
links: [{
|
|
8
|
+
links: [...showDictionaryKey ? [{
|
|
9
9
|
text: camelCaseToSentence(dictionaryKey),
|
|
10
|
-
onClick: () => onClickKeyPath([])
|
|
11
|
-
}, ...keyPath.map((el, index) => ({
|
|
12
|
-
onClick: () => onClickKeyPath(keyPath.slice(0, index + 1)),
|
|
10
|
+
onClick: onClickKeyPath ? () => onClickKeyPath([]) : void 0
|
|
11
|
+
}] : [], ...keyPath.map((el, index) => ({
|
|
12
|
+
onClick: onClickKeyPath ? () => onClickKeyPath?.(keyPath.slice(0, index + 1)) : void 0,
|
|
13
13
|
text: el.key?.toString() ?? ""
|
|
14
14
|
}))],
|
|
15
15
|
locale,
|
|
16
|
-
elementType: "location"
|
|
16
|
+
elementType: "location",
|
|
17
|
+
color
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyPathBreadcrumb.mjs","names":["KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps>"],"sources":["../../../../src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx"],"sourcesContent":["import { camelCaseToSentence } from '@intlayer/config/client';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { Breadcrumb, type BreadcrumbLink } from '../Breadcrumb';\n\ntype KeyPathBreadcrumbProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n onClickKeyPath
|
|
1
|
+
{"version":3,"file":"KeyPathBreadcrumb.mjs","names":["KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps>"],"sources":["../../../../src/components/DictionaryFieldEditor/KeyPathBreadcrumb.tsx"],"sourcesContent":["import { camelCaseToSentence } from '@intlayer/config/client';\nimport type { KeyPath, Locale } from '@intlayer/types';\nimport type { FC } from 'react';\nimport { Breadcrumb, type BreadcrumbLink } from '../Breadcrumb';\nimport type { LinkColor } from '../Link';\n\ntype KeyPathBreadcrumbProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n onClickKeyPath?: (keyPath: KeyPath[]) => void;\n locale?: Locale;\n color?: LinkColor | `${LinkColor}`;\n showDictionaryKey?: boolean;\n};\n\nexport const KeyPathBreadcrumb: FC<KeyPathBreadcrumbProps> = ({\n keyPath,\n dictionaryKey,\n onClickKeyPath,\n locale,\n color,\n showDictionaryKey = true,\n}) => {\n const formattedKeyPath: BreadcrumbLink[] = [\n ...(showDictionaryKey\n ? [\n {\n text: camelCaseToSentence(dictionaryKey),\n onClick: onClickKeyPath ? () => onClickKeyPath([]) : undefined,\n },\n ]\n : []),\n ...keyPath.map((el, index) => ({\n onClick: onClickKeyPath\n ? () =>\n // With keyPath = [{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}, {type: NodeType.Object, key: '1'}]\n // If index is 0 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}])\n // If index is 1 -> onFocusKeyPath([{type: NodeType.Object, key: '0'}, {type: NodeType.Array, key: '0'}])\n onClickKeyPath?.(keyPath.slice(0, index + 1))\n : undefined,\n\n text: el.key?.toString() ?? '',\n })),\n ];\n\n return (\n <Breadcrumb\n links={formattedKeyPath}\n locale={locale}\n elementType=\"location\"\n color={color}\n />\n );\n};\n"],"mappings":";;;;;AAeA,MAAaA,qBAAiD,EAC5D,SACA,eACA,gBACA,QACA,OACA,oBAAoB,WAChB;AAuBJ,QACE,oBAAC;EACC,OAxBuC,CACzC,GAAI,oBACA,CACE;GACE,MAAM,oBAAoB,cAAc;GACxC,SAAS,uBAAuB,eAAe,EAAE,CAAC,GAAG;GACtD,CACF,GACD,EAAE,EACN,GAAG,QAAQ,KAAK,IAAI,WAAW;GAC7B,SAAS,uBAKH,iBAAiB,QAAQ,MAAM,GAAG,QAAQ,EAAE,CAAC,GAC/C;GAEJ,MAAM,GAAG,KAAK,UAAU,IAAI;GAC7B,EAAE,CACJ;EAKW;EACR,aAAY;EACL;GACP"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Button, ButtonColor, ButtonTextAlign, ButtonVariant } from "../../Button/Button.mjs";
|
|
2
2
|
import { Accordion } from "../../Accordion/Accordion.mjs";
|
|
3
3
|
import { getIsEditableSection } from "../getIsEditableSection.mjs";
|
|
4
|
-
import configuration from "@intlayer/config/built";
|
|
5
|
-
import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
6
4
|
import { ChevronRight, Plus } from "lucide-react";
|
|
7
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
6
|
import { getContentNodeByKeyPath, getEmptyNode, getNodeType, isSameKeyPath } from "@intlayer/core";
|
|
9
7
|
import { useIntlayer } from "react-intlayer";
|
|
8
|
+
import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
9
|
+
import configuration from "@intlayer/config/built";
|
|
10
10
|
import { NodeType } from "@intlayer/types";
|
|
11
11
|
import { camelCaseToSentence } from "@intlayer/config/client";
|
|
12
12
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useAuth } from "../../../hooks/useAuth/useAuth.mjs";
|
|
4
|
-
import { useDeleteDictionary, usePushDictionaries, useWriteDictionary } from "../../../hooks/reactQuery.mjs";
|
|
5
3
|
import { cn } from "../../../utils/cn.mjs";
|
|
6
4
|
import { ButtonColor, ButtonVariant } from "../../Button/Button.mjs";
|
|
5
|
+
import { useAuth } from "../../../hooks/useAuth/useAuth.mjs";
|
|
6
|
+
import { useDeleteDictionary, usePushDictionaries, useWriteDictionary } from "../../../hooks/reactQuery.mjs";
|
|
7
7
|
import { Modal, ModalSize } from "../../Modal/Modal.mjs";
|
|
8
8
|
import { Form } from "../../Form/Form.mjs";
|
|
9
|
-
import { useDictionariesRecordActions, useEditedContent } from "@intlayer/editor-react";
|
|
10
|
-
import { useState } from "react";
|
|
11
9
|
import { ArrowUpFromLine, Download, RotateCcw, Save, Trash } from "lucide-react";
|
|
10
|
+
import { useState } from "react";
|
|
12
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { useIntlayer } from "react-intlayer";
|
|
13
|
+
import { useDictionariesRecordActions, useEditedContent } from "@intlayer/editor-react";
|
|
14
14
|
|
|
15
15
|
//#region src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx
|
|
16
16
|
const SaveForm = ({ dictionary, mode, className, onDelete, onSave, ...props }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { NodeView } from "./StructureView/StructureView.mjs";
|
|
4
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/DictionaryFieldEditor/StructureEditor.tsx
|
|
8
8
|
const StructureEditor = ({ dictionary }) => {
|
|
@@ -5,11 +5,11 @@ import { Button, ButtonColor, ButtonSize, ButtonVariant } from "../../Button/But
|
|
|
5
5
|
import { InputVariant } from "../../Input/Input.mjs";
|
|
6
6
|
import { EditableFieldInput } from "../../EditableField/EditableFieldInput.mjs";
|
|
7
7
|
import { NodeTypeSelector } from "../NodeTypeSelector.mjs";
|
|
8
|
-
import { useConfiguration, useEditedContentActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
9
8
|
import { Plus, Trash } from "lucide-react";
|
|
10
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { getDefaultNode, getNodeChildren, getNodeType, isSameKeyPath } from "@intlayer/core";
|
|
12
11
|
import { useIntlayer } from "react-intlayer";
|
|
12
|
+
import { useConfiguration, useEditedContentActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
13
13
|
import { NodeType } from "@intlayer/types";
|
|
14
14
|
import { camelCaseToSentence } from "@intlayer/config/client";
|
|
15
15
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { TextEditor, TextEditorContainer, traceKeys } from "./ContentEditorView/TextEditor.mjs";
|
|
2
|
+
import { KeyPathBreadcrumb } from "./KeyPathBreadcrumb.mjs";
|
|
3
|
+
import { ContentEditor } from "./ContentEditor.mjs";
|
|
1
4
|
import { DictionaryCreationForm } from "./DictionaryCreationForm/DictionaryCreationForm.mjs";
|
|
2
5
|
import { DictionaryFieldEditor } from "./DictionaryFieldEditor.mjs";
|
|
3
6
|
import { VersionSwitcherProvider, useVersionSwitcher } from "./VersionSwitcherDropDown/VersionSwitcherContext.mjs";
|
|
4
7
|
import { VersionSwitcher } from "./VersionSwitcherDropDown/VersionSwitcher.mjs";
|
|
5
8
|
|
|
6
|
-
export { DictionaryCreationForm, DictionaryFieldEditor, VersionSwitcher, VersionSwitcherProvider, useVersionSwitcher };
|
|
9
|
+
export { ContentEditor, DictionaryCreationForm, DictionaryFieldEditor, KeyPathBreadcrumb, TextEditor, TextEditorContainer, VersionSwitcher, VersionSwitcherProvider, traceKeys, useVersionSwitcher };
|
|
@@ -97,7 +97,7 @@ const Trigger = ({ children, identifier, className, label, ...props }) => /* @__
|
|
|
97
97
|
children
|
|
98
98
|
});
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* Horizontal alignment options for the dropdown panel relative to the trigger
|
|
101
101
|
*/
|
|
102
102
|
let DropDownAlign = /* @__PURE__ */ function(DropDownAlign$1) {
|
|
103
103
|
/** Align panel to the start (left in LTR, right in RTL) of the trigger */
|
|
@@ -107,6 +107,16 @@ let DropDownAlign = /* @__PURE__ */ function(DropDownAlign$1) {
|
|
|
107
107
|
return DropDownAlign$1;
|
|
108
108
|
}({});
|
|
109
109
|
/**
|
|
110
|
+
* Vertical alignment options for the dropdown panel relative to the trigger
|
|
111
|
+
*/
|
|
112
|
+
let DropDownYAlign = /* @__PURE__ */ function(DropDownYAlign$1) {
|
|
113
|
+
/** Position panel below the trigger (default) */
|
|
114
|
+
DropDownYAlign$1["BELOW"] = "below";
|
|
115
|
+
/** Position panel above the trigger */
|
|
116
|
+
DropDownYAlign$1["ABOVE"] = "above";
|
|
117
|
+
return DropDownYAlign$1;
|
|
118
|
+
}({});
|
|
119
|
+
/**
|
|
110
120
|
* DropDown.Panel Component
|
|
111
121
|
*
|
|
112
122
|
* The content area that appears when the dropdown is triggered.
|
|
@@ -133,6 +143,11 @@ let DropDownAlign = /* @__PURE__ */ function(DropDownAlign$1) {
|
|
|
133
143
|
* <DropDown.Panel identifier="menu" align={DropDownAlign.END} isOverable>
|
|
134
144
|
* <div>Right-aligned content</div>
|
|
135
145
|
* </DropDown.Panel>
|
|
146
|
+
*
|
|
147
|
+
* // Panel opening above the trigger
|
|
148
|
+
* <DropDown.Panel identifier="menu" yAlign={DropDownYAlign.ABOVE} isOverable>
|
|
149
|
+
* <div>Content appears above</div>
|
|
150
|
+
* </DropDown.Panel>
|
|
136
151
|
* ```
|
|
137
152
|
*
|
|
138
153
|
* @component
|
|
@@ -142,8 +157,8 @@ let DropDownAlign = /* @__PURE__ */ function(DropDownAlign$1) {
|
|
|
142
157
|
* - Keyboard navigation support when isFocusable is enabled
|
|
143
158
|
* - Screen reader announcements for state changes
|
|
144
159
|
*/
|
|
145
|
-
const Panel = ({ children, isHidden = void 0, isOverable = false, isFocusable = false, align = DropDownAlign.START, identifier, className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
146
|
-
className: cn("absolute
|
|
160
|
+
const Panel = ({ children, isHidden = void 0, isOverable = false, isFocusable = false, align = DropDownAlign.START, yAlign = DropDownYAlign.BELOW, identifier, className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
161
|
+
className: cn("absolute z-100 min-w-full", align === DropDownAlign.START && "left-0", align === DropDownAlign.END && "right-0", yAlign === DropDownYAlign.BELOW && "top-[calc(100%+0.5rem)]", yAlign === DropDownYAlign.ABOVE && "bottom-[calc(100%+0.5rem)]", className),
|
|
147
162
|
"aria-hidden": isHidden,
|
|
148
163
|
role: "region",
|
|
149
164
|
"aria-labelledby": `dropdown-trigger-${identifier}`,
|
|
@@ -159,5 +174,5 @@ DropDown.Trigger = Trigger;
|
|
|
159
174
|
DropDown.Panel = Panel;
|
|
160
175
|
|
|
161
176
|
//#endregion
|
|
162
|
-
export { DropDown, DropDownAlign };
|
|
177
|
+
export { DropDown, DropDownAlign, DropDownYAlign };
|
|
163
178
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["DropDown: DropDownType","Trigger: FC<TriggerProps>","Panel: FC<PanelProps>"],"sources":["../../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../Button';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\n\n/**\n * Props for the DropDown component\n */\nexport interface DropDownProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Unique identifier that links the trigger and panel for accessibility.\n * This is used to generate proper ARIA attributes.\n * @example \"user-menu\"\n * @example \"language-selector\"\n */\n identifier: string;\n}\n\nexport type DropDownType = FC<DropDownProps> & {\n Trigger: FC<TriggerProps>;\n Panel: FC<PanelProps>;\n};\n\n/**\n * DropDown Component\n *\n * A compound component that provides dropdown/popover functionality with flexible trigger mechanisms.\n * Supports hover, focus, and controlled visibility states with proper accessibility features.\n *\n * @example\n * ```tsx\n * // Basic hover dropdown\n * <DropDown identifier=\"menu\">\n * <DropDown.Trigger identifier=\"menu\">\n * Open Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"menu\" isOverable>\n * <div>Menu content</div>\n * </DropDown.Panel>\n * </DropDown>\n *\n * // Focus-based dropdown for accessibility\n * <DropDown identifier=\"accessible-menu\">\n * <DropDown.Trigger identifier=\"accessible-menu\">\n * Keyboard Accessible Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"accessible-menu\" isFocusable>\n * <div>Accessible content</div>\n * </DropDown.Panel>\n * </DropDown>\n *\n * // Controlled dropdown\n * <DropDown identifier=\"controlled\">\n * <DropDown.Trigger identifier=\"controlled\">\n * Controlled Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"controlled\" isHidden={!isOpen}>\n * <div>Controlled content</div>\n * </DropDown.Panel>\n * </DropDown>\n * ```\n *\n * @component\n * @accessibility\n * - Uses proper ARIA attributes (aria-haspopup, aria-labelledby, etc.)\n * - Supports keyboard navigation with focus management\n * - Screen reader compatible with proper role and labeling\n * - Maintains focus trap within dropdown when needed\n */\nexport const DropDown: DropDownType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn(`group/dropdown relative flex`, className)}\n aria-label={`DropDown ${identifier}`}\n id={`dropdown-container-${identifier}`}\n {...props}\n >\n {children}\n </div>\n);\n\n/**\n * Props for the DropDown.Trigger component\n */\nexport interface TriggerProps extends Partial<ButtonProps> {\n /**\n * Unique identifier that matches the parent DropDown identifier\n * @example \"user-menu\"\n */\n identifier: string;\n}\n\n/**\n * DropDown.Trigger Component\n *\n * The clickable/focusable element that controls the dropdown panel visibility.\n * Built on top of the Button component with enhanced dropdown-specific behaviors.\n *\n * @example\n * ```tsx\n * <DropDown.Trigger identifier=\"menu\">\n * <div>Click to open</div>\n * </DropDown.Trigger>\n * ```\n *\n * @component\n * @accessibility\n * - Automatically generates appropriate ARIA attributes\n * - Maintains proper focus management across browsers\n * - Works with keyboard navigation (Tab, Enter, Space)\n * - Announces dropdown state to screen readers\n *\n * @note Don't nest Button components inside the Trigger - it's already a button\n */\nconst Trigger: FC<TriggerProps> = ({\n children,\n identifier,\n className,\n label,\n ...props\n}) => (\n <Button\n className={cn([\n 'w-full cursor-pointer',\n 'group-focus-within/dropdown:bg-current/20 group-focus-within/dropdown:ring-4',\n className,\n ])}\n label={label ?? `Open panel ${identifier}`}\n aria-haspopup=\"true\"\n aria-controls={`dropdown-panel-${identifier}`}\n id={`dropdown-trigger-${identifier}`}\n onClick={(e) => {\n // Ensure focus behavior is consistent across all mobile browsers\n (e.currentTarget as HTMLButtonElement).focus();\n }}\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n);\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["DropDown: DropDownType","Trigger: FC<TriggerProps>","Panel: FC<PanelProps>"],"sources":["../../../../src/components/DropDown/index.tsx"],"sourcesContent":["import type { FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button, type ButtonProps } from '../Button';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\n\n/**\n * Props for the DropDown component\n */\nexport interface DropDownProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Unique identifier that links the trigger and panel for accessibility.\n * This is used to generate proper ARIA attributes.\n * @example \"user-menu\"\n * @example \"language-selector\"\n */\n identifier: string;\n}\n\nexport type DropDownType = FC<DropDownProps> & {\n Trigger: FC<TriggerProps>;\n Panel: FC<PanelProps>;\n};\n\n/**\n * DropDown Component\n *\n * A compound component that provides dropdown/popover functionality with flexible trigger mechanisms.\n * Supports hover, focus, and controlled visibility states with proper accessibility features.\n *\n * @example\n * ```tsx\n * // Basic hover dropdown\n * <DropDown identifier=\"menu\">\n * <DropDown.Trigger identifier=\"menu\">\n * Open Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"menu\" isOverable>\n * <div>Menu content</div>\n * </DropDown.Panel>\n * </DropDown>\n *\n * // Focus-based dropdown for accessibility\n * <DropDown identifier=\"accessible-menu\">\n * <DropDown.Trigger identifier=\"accessible-menu\">\n * Keyboard Accessible Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"accessible-menu\" isFocusable>\n * <div>Accessible content</div>\n * </DropDown.Panel>\n * </DropDown>\n *\n * // Controlled dropdown\n * <DropDown identifier=\"controlled\">\n * <DropDown.Trigger identifier=\"controlled\">\n * Controlled Menu\n * </DropDown.Trigger>\n * <DropDown.Panel identifier=\"controlled\" isHidden={!isOpen}>\n * <div>Controlled content</div>\n * </DropDown.Panel>\n * </DropDown>\n * ```\n *\n * @component\n * @accessibility\n * - Uses proper ARIA attributes (aria-haspopup, aria-labelledby, etc.)\n * - Supports keyboard navigation with focus management\n * - Screen reader compatible with proper role and labeling\n * - Maintains focus trap within dropdown when needed\n */\nexport const DropDown: DropDownType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn(`group/dropdown relative flex`, className)}\n aria-label={`DropDown ${identifier}`}\n id={`dropdown-container-${identifier}`}\n {...props}\n >\n {children}\n </div>\n);\n\n/**\n * Props for the DropDown.Trigger component\n */\nexport interface TriggerProps extends Partial<ButtonProps> {\n /**\n * Unique identifier that matches the parent DropDown identifier\n * @example \"user-menu\"\n */\n identifier: string;\n}\n\n/**\n * DropDown.Trigger Component\n *\n * The clickable/focusable element that controls the dropdown panel visibility.\n * Built on top of the Button component with enhanced dropdown-specific behaviors.\n *\n * @example\n * ```tsx\n * <DropDown.Trigger identifier=\"menu\">\n * <div>Click to open</div>\n * </DropDown.Trigger>\n * ```\n *\n * @component\n * @accessibility\n * - Automatically generates appropriate ARIA attributes\n * - Maintains proper focus management across browsers\n * - Works with keyboard navigation (Tab, Enter, Space)\n * - Announces dropdown state to screen readers\n *\n * @note Don't nest Button components inside the Trigger - it's already a button\n */\nconst Trigger: FC<TriggerProps> = ({\n children,\n identifier,\n className,\n label,\n ...props\n}) => (\n <Button\n className={cn([\n 'w-full cursor-pointer',\n 'group-focus-within/dropdown:bg-current/20 group-focus-within/dropdown:ring-4',\n className,\n ])}\n label={label ?? `Open panel ${identifier}`}\n aria-haspopup=\"true\"\n aria-controls={`dropdown-panel-${identifier}`}\n id={`dropdown-trigger-${identifier}`}\n onClick={(e) => {\n // Ensure focus behavior is consistent across all mobile browsers\n (e.currentTarget as HTMLButtonElement).focus();\n }}\n variant=\"none\"\n {...props}\n >\n {children}\n </Button>\n);\n\n/**\n * Horizontal alignment options for the dropdown panel relative to the trigger\n */\nexport enum DropDownAlign {\n /** Align panel to the start (left in LTR, right in RTL) of the trigger */\n START = 'start',\n /** Align panel to the end (right in LTR, left in RTL) of the trigger */\n END = 'end',\n}\n\n/**\n * Vertical alignment options for the dropdown panel relative to the trigger\n */\nexport enum DropDownYAlign {\n /** Position panel below the trigger (default) */\n BELOW = 'below',\n /** Position panel above the trigger */\n ABOVE = 'above',\n}\n\n/**\n * Props for the DropDown.Panel component\n */\nexport interface PanelProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Whether the panel should be visible when the trigger is focused.\n * Enables keyboard accessibility for the dropdown.\n * @default false\n */\n isFocusable?: boolean;\n\n /**\n * Controls panel visibility explicitly.\n * - `true`: Panel is hidden\n * - `false`: Panel is visible\n * - `undefined`: Panel visibility controlled by hover/focus states\n * @default undefined\n */\n isHidden?: boolean;\n\n /**\n * Whether the panel should be visible when hovering over the trigger.\n * Provides quick access via mouse interaction.\n * @default false\n */\n isOverable?: boolean;\n\n /**\n * Unique identifier that matches the parent DropDown identifier\n * @example \"user-menu\"\n */\n identifier: string;\n\n /**\n * Horizontal alignment of the panel relative to the trigger\n * @default DropDownAlign.START\n */\n align?: DropDownAlign | `${DropDownAlign}`;\n\n /**\n * Vertical alignment of the panel relative to the trigger\n * @default DropDownYAlign.BELOW\n */\n yAlign?: DropDownYAlign | `${DropDownYAlign}`;\n}\n\n/**\n * DropDown.Panel Component\n *\n * The content area that appears when the dropdown is triggered.\n * Supports multiple trigger methods (hover, focus, controlled) with smooth animations.\n *\n * @example\n * ```tsx\n * // Hover-triggered panel\n * <DropDown.Panel identifier=\"menu\" isOverable>\n * <div>Content appears on hover</div>\n * </DropDown.Panel>\n *\n * // Focus-triggered panel (accessible)\n * <DropDown.Panel identifier=\"menu\" isFocusable>\n * <div>Content appears on focus</div>\n * </DropDown.Panel>\n *\n * // Controlled panel\n * <DropDown.Panel identifier=\"menu\" isHidden={!isOpen}>\n * <div>Content visibility controlled externally</div>\n * </DropDown.Panel>\n *\n * // Right-aligned panel\n * <DropDown.Panel identifier=\"menu\" align={DropDownAlign.END} isOverable>\n * <div>Right-aligned content</div>\n * </DropDown.Panel>\n *\n * // Panel opening above the trigger\n * <DropDown.Panel identifier=\"menu\" yAlign={DropDownYAlign.ABOVE} isOverable>\n * <div>Content appears above</div>\n * </DropDown.Panel>\n * ```\n *\n * @component\n * @accessibility\n * - Proper ARIA attributes (role, aria-labelledby, aria-hidden)\n * - Smooth height transitions with MaxHeightSmoother\n * - Keyboard navigation support when isFocusable is enabled\n * - Screen reader announcements for state changes\n */\nconst Panel: FC<PanelProps> = ({\n children,\n isHidden = undefined,\n isOverable = false,\n isFocusable = false,\n align = DropDownAlign.START,\n yAlign = DropDownYAlign.BELOW,\n identifier,\n className,\n ...props\n}) => (\n <div\n className={cn(\n 'absolute z-100 min-w-full',\n /* Horizontal positioning */\n align === DropDownAlign.START && 'left-0',\n align === DropDownAlign.END && 'right-0',\n /* Vertical positioning */\n yAlign === DropDownYAlign.BELOW && 'top-[calc(100%+0.5rem)]',\n yAlign === DropDownYAlign.ABOVE && 'bottom-[calc(100%+0.5rem)]',\n className\n )}\n aria-hidden={isHidden}\n role=\"region\"\n aria-labelledby={`dropdown-trigger-${identifier}`}\n id={`dropdown-panel-${identifier}`}\n >\n <MaxHeightSmoother\n isHidden={isHidden}\n className={cn(\n 'overflow-x-visible',\n isHidden === false && 'invisible',\n isHidden === true && 'visible',\n isOverable &&\n 'group-hover/dropdown:visible group-hover/dropdown:grid-rows-[1fr]',\n isFocusable &&\n 'group-focus-within/dropdown:visible group-focus-within/dropdown:grid-rows-[1fr]'\n )}\n {...props}\n >\n {children}\n </MaxHeightSmoother>\n </div>\n);\n\nDropDown.Trigger = Trigger;\nDropDown.Panel = Panel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,MAAaA,YAA0B,EACrC,UACA,WACA,YACA,GAAG,YAEH,oBAAC;CACC,WAAW,GAAG,gCAAgC,UAAU;CACxD,cAAY,YAAY;CACxB,IAAI,sBAAsB;CAC1B,GAAI;CAEH;EACG;;;;;;;;;;;;;;;;;;;;;;;AAoCR,MAAMC,WAA6B,EACjC,UACA,YACA,WACA,OACA,GAAG,YAEH,oBAAC;CACC,WAAW,GAAG;EACZ;EACA;EACA;EACD,CAAC;CACF,OAAO,SAAS,cAAc;CAC9B,iBAAc;CACd,iBAAe,kBAAkB;CACjC,IAAI,oBAAoB;CACxB,UAAU,MAAM;AAEd,EAAC,EAAE,cAAoC,OAAO;;CAEhD,SAAQ;CACR,GAAI;CAEH;EACM;;;;AAMX,IAAY,0DAAL;;AAEL;;AAEA;;;;;;AAMF,IAAY,4DAAL;;AAEL;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FF,MAAMC,SAAyB,EAC7B,UACA,WAAW,QACX,aAAa,OACb,cAAc,OACd,QAAQ,cAAc,OACtB,SAAS,eAAe,OACxB,YACA,WACA,GAAG,YAEH,oBAAC;CACC,WAAW,GACT,6BAEA,UAAU,cAAc,SAAS,UACjC,UAAU,cAAc,OAAO,WAE/B,WAAW,eAAe,SAAS,2BACnC,WAAW,eAAe,SAAS,8BACnC,UACD;CACD,eAAa;CACb,MAAK;CACL,mBAAiB,oBAAoB;CACrC,IAAI,kBAAkB;WAEtB,oBAAC;EACW;EACV,WAAW,GACT,sBACA,aAAa,SAAS,aACtB,aAAa,QAAQ,WACrB,cACE,qEACF,eACE,kFACH;EACD,GAAI;EAEH;GACiB;EAChB;AAGR,SAAS,UAAU;AACnB,SAAS,QAAQ"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
4
|
import { Button, ButtonColor, ButtonSize, ButtonVariant } from "../Button/Button.mjs";
|
|
5
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
5
|
import { Check, Pencil, X } from "lucide-react";
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/components/EditableField/EditableFieldLayout.tsx
|
|
@@ -131,7 +131,7 @@ const flagRecord = {
|
|
|
131
131
|
[Locales.ENGLISH_AUSTRALIA]: dynamicFlag(() => import("./au.mjs")),
|
|
132
132
|
[Locales.ENGLISH_BELIZE]: dynamicFlag(() => import("./bz.mjs")),
|
|
133
133
|
[Locales.ENGLISH_CANADA]: dynamicFlag(() => import("./ca.mjs")),
|
|
134
|
-
[Locales.ENGLISH_CARIBBEAN]: dynamicFlag(() => import("./
|
|
134
|
+
[Locales.ENGLISH_CARIBBEAN]: dynamicFlag(() => import("./jm.mjs")),
|
|
135
135
|
[Locales.ENGLISH_UNITED_KINGDOM]: dynamicFlag(() => import("./gb.mjs")),
|
|
136
136
|
[Locales.ENGLISH_IRELAND]: dynamicFlag(() => import("./ie.mjs")),
|
|
137
137
|
[Locales.ENGLISH_JAMAICA]: dynamicFlag(() => import("./jm.mjs")),
|
|
@@ -259,7 +259,60 @@ const flagRecord = {
|
|
|
259
259
|
[Locales.AMHARIC]: dynamicFlag(() => import("./et.mjs")),
|
|
260
260
|
[Locales.AMHARIC_ETHIOPIA]: dynamicFlag(() => import("./et.mjs")),
|
|
261
261
|
[Locales.NEPALI]: dynamicFlag(() => import("./np.mjs")),
|
|
262
|
-
[Locales.NEPALI_NEPAL]: dynamicFlag(() => import("./np.mjs"))
|
|
262
|
+
[Locales.NEPALI_NEPAL]: dynamicFlag(() => import("./np.mjs")),
|
|
263
|
+
[Locales.IRISH]: dynamicFlag(() => import("./ie.mjs")),
|
|
264
|
+
[Locales.IRISH_IRELAND]: dynamicFlag(() => import("./ie.mjs")),
|
|
265
|
+
[Locales.SCOTTISH_GAELIC]: dynamicFlag(() => import("./gb.mjs")),
|
|
266
|
+
[Locales.SCOTTISH_GAELIC_UNITED_KINGDOM]: dynamicFlag(() => import("./gb.mjs")),
|
|
267
|
+
[Locales.KURDISH]: dynamicFlag(() => import("./tr.mjs")),
|
|
268
|
+
[Locales.KURDISH_TURKEY]: dynamicFlag(() => import("./tr.mjs")),
|
|
269
|
+
[Locales.MALAYALAM]: dynamicFlag(() => import("./in.mjs")),
|
|
270
|
+
[Locales.MALAYALAM_INDIA]: dynamicFlag(() => import("./in.mjs")),
|
|
271
|
+
[Locales.NORWEGIAN]: dynamicFlag(() => import("./no.mjs")),
|
|
272
|
+
[Locales.NORWEGIAN_NYNORSK]: dynamicFlag(() => import("./no.mjs")),
|
|
273
|
+
[Locales.ROMANIAN_MOLDOVA]: dynamicFlag(() => import("./md.mjs")),
|
|
274
|
+
[Locales.ROMANSH]: dynamicFlag(() => import("./ch.mjs")),
|
|
275
|
+
[Locales.ROMANSH_SWITZERLAND]: dynamicFlag(() => import("./ch.mjs")),
|
|
276
|
+
[Locales.RUSSIAN_MOLDOVA]: dynamicFlag(() => import("./md.mjs")),
|
|
277
|
+
[Locales.UPPER_SORBIAN]: dynamicFlag(() => import("./de.mjs")),
|
|
278
|
+
[Locales.UPPER_SORBIAN_GERMANY]: dynamicFlag(() => import("./de.mjs")),
|
|
279
|
+
[Locales.LOWER_SORBIAN]: dynamicFlag(() => import("./de.mjs")),
|
|
280
|
+
[Locales.LOWER_SORBIAN_GERMANY]: dynamicFlag(() => import("./de.mjs")),
|
|
281
|
+
[Locales.VENDA]: dynamicFlag(() => import("./za.mjs")),
|
|
282
|
+
[Locales.VENDA_SOUTH_AFRICA]: dynamicFlag(() => import("./za.mjs")),
|
|
283
|
+
[Locales.YIDDISH]: dynamicFlag(() => import("./il.mjs")),
|
|
284
|
+
[Locales.YIDDISH_WORLD]: dynamicFlag(() => import("./il.mjs")),
|
|
285
|
+
[Locales.SINHALA]: dynamicFlag(() => import("./lk.mjs")),
|
|
286
|
+
[Locales.SINHALA_SRI_LANKA]: dynamicFlag(() => import("./lk.mjs")),
|
|
287
|
+
[Locales.SERBIAN_CYRILLIC]: dynamicFlag(() => import("./rs.mjs")),
|
|
288
|
+
[Locales.SERBIAN_CYRILLIC_SERBIA]: dynamicFlag(() => import("./rs.mjs")),
|
|
289
|
+
[Locales.ENGLISH_INDIA]: dynamicFlag(() => import("./in.mjs")),
|
|
290
|
+
[Locales.ENGLISH_SINGAPORE]: dynamicFlag(() => import("./sg.mjs")),
|
|
291
|
+
[Locales.ENGLISH_HONG_KONG]: dynamicFlag(() => import("./hk.mjs")),
|
|
292
|
+
[Locales.ENGLISH_NIGERIA]: dynamicFlag(() => import("./ng.mjs")),
|
|
293
|
+
[Locales.ENGLISH_PAKISTAN]: dynamicFlag(() => import("./pk.mjs")),
|
|
294
|
+
[Locales.ENGLISH_MALAYSIA]: dynamicFlag(() => import("./my.mjs")),
|
|
295
|
+
[Locales.ENGLISH_BOTSWANA]: dynamicFlag(() => import("./bw.mjs")),
|
|
296
|
+
[Locales.ENGLISH_KENYA]: dynamicFlag(() => import("./ke.mjs")),
|
|
297
|
+
[Locales.ENGLISH_TANZANIA]: dynamicFlag(() => import("./tz.mjs")),
|
|
298
|
+
[Locales.ENGLISH_GHANA]: dynamicFlag(() => import("./gh.mjs")),
|
|
299
|
+
[Locales.ENGLISH_UGANDA]: dynamicFlag(() => import("./ug.mjs")),
|
|
300
|
+
[Locales.SPANISH_CUBA]: dynamicFlag(() => import("./cu.mjs")),
|
|
301
|
+
[Locales.SPANISH_UNITED_STATES]: dynamicFlag(() => import("./us.mjs")),
|
|
302
|
+
[Locales.PORTUGUESE_GUINEA_BISSAU]: dynamicFlag(() => import("./gw.mjs")),
|
|
303
|
+
[Locales.PORTUGUESE_MOZAMBIQUE]: dynamicFlag(() => import("./mz.mjs")),
|
|
304
|
+
[Locales.PORTUGUESE_SAO_TOME_AND_PRINCIPE]: dynamicFlag(() => import("./st.mjs")),
|
|
305
|
+
[Locales.PORTUGUESE_CAPE_VERDE]: dynamicFlag(() => import("./cv.mjs")),
|
|
306
|
+
[Locales.PORTUGUESE_TIMOR_LESTE]: dynamicFlag(() => import("./tl.mjs")),
|
|
307
|
+
[Locales.PORTUGUESE_MACAU]: dynamicFlag(() => import("./mo.mjs")),
|
|
308
|
+
[Locales.CHINESE_TAIWAN]: dynamicFlag(() => import("./tw.mjs")),
|
|
309
|
+
[Locales.ARABIC_MAURITANIA]: dynamicFlag(() => import("./mr.mjs")),
|
|
310
|
+
[Locales.ARABIC_PALESTINE]: dynamicFlag(() => import("./ps.mjs")),
|
|
311
|
+
[Locales.ARABIC_SUDAN]: dynamicFlag(() => import("./sd.mjs")),
|
|
312
|
+
[Locales.ARABIC_DJIBOUTI]: dynamicFlag(() => import("./dj.mjs")),
|
|
313
|
+
[Locales.ARABIC_SOMALIA]: dynamicFlag(() => import("./so.mjs")),
|
|
314
|
+
[Locales.ARABIC_CHAD]: dynamicFlag(() => import("./td.mjs")),
|
|
315
|
+
[Locales.ARABIC_COMOROS]: dynamicFlag(() => import("./km.mjs"))
|
|
263
316
|
};
|
|
264
317
|
const Flag = ({ locale, alt, ...props }) => {
|
|
265
318
|
return /* @__PURE__ */ jsx(Suspense, {
|