@intlayer/design-system 5.1.4 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +34 -88
- package/dist/Form-BZUDRfoN.js.map +1 -1
- package/dist/Form-yi0CMK-a.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
- package/dist/components/Command/index.d.ts +1 -1
- package/dist/components/Container/index.cjs +5 -6
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +5 -6
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +33 -20
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +34 -21
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +10 -7
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +10 -7
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +92 -120
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +94 -122
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +0 -143
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +0 -3
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +51 -70
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +52 -103
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +3 -3
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +56 -107
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +0 -32
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -0
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -0
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.cjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts +0 -1
- package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/index.mjs +0 -2
- package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +0 -1
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.d.ts +1 -4
- package/dist/components/Form/FormBase.d.ts.map +1 -1
- package/dist/components/Form/FormBase.mjs +0 -1
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.cjs +0 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.mjs +0 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts +3 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs +25 -0
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -0
- package/dist/components/MaxHeightSmoother/index.cjs +2 -0
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs +2 -0
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +15 -13
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +15 -13
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs +0 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/Select/Multiselect.mjs +1 -2
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs +0 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.mjs +0 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.cjs +2 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +8 -14
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useKeyboardDetector.cjs +27 -0
- package/dist/hooks/useKeyboardDetector.cjs.map +1 -0
- package/dist/hooks/useKeyboardDetector.d.ts +5 -0
- package/dist/hooks/useKeyboardDetector.d.ts.map +1 -0
- package/dist/hooks/useKeyboardDetector.mjs +27 -0
- package/dist/hooks/useKeyboardDetector.mjs.map +1 -0
- package/dist/{index-BTDHuTxL.js → index-B1w5h_6-.js} +7 -7
- package/dist/index-B1w5h_6-.js.map +1 -0
- package/dist/{index-Db5Dym4h.cjs → index-U1U6ySIn.cjs} +7 -7
- package/dist/index-U1U6ySIn.cjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/package.json +17 -17
- package/dist/index-BTDHuTxL.js.map +0 -1
- package/dist/index-Db5Dym4h.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Container/index.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport {\n type PropsWithChildren,\n type HTMLAttributes,\n type FC,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst containerVariants = cva(\n 'flex flex-col
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Container/index.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport {\n type PropsWithChildren,\n type HTMLAttributes,\n type FC,\n type DetailedHTMLProps,\n} from 'react';\nimport { cn } from '../../utils/cn';\n\nconst containerVariants = cva(\n 'flex text-text flex-col backdrop-blur dark:text-text-dark',\n {\n variants: {\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n transparency: {\n none: '',\n full: 'bg-none',\n sm: 'bg-opacity-90 dark:bg-opacity-90',\n md: 'bg-opacity-70 dark:bg-opacity-70',\n lg: 'bg-opacity-40 dark:bg-opacity-40',\n xl: 'bg-opacity-20 dark:bg-opacity-20',\n },\n backgroundColor: {\n none: 'bg-card dark:bg-card-dark',\n primary: 'bg-primary dark:bg-primary-dark',\n secondary: 'bg-secondary dark:bg-secondary-dark',\n neutral: 'bg-neutral dark:bg-neutral-dark',\n text: 'bg-text dark:bg-text-dark',\n card: 'bg-card dark:bg-card-dark',\n contrast: 'bg-background-dark dark:bg-background',\n },\n padding: {\n none: 'p-0',\n sm: 'p-1',\n md: 'p-2',\n lg: 'p-3',\n xl: 'p-4',\n },\n separator: {\n without: '',\n x: 'divide-x divide-dashed divide-text/20 dark:divide-text-dark/20',\n y: 'divide-y divide-dashed divide-text/20 dark:divide-text-dark/20',\n both: 'divide-x divide-y divide-dashed divide-text/20 dark:divide-text-dark/20',\n },\n border: {\n none: '',\n with: 'border-[1.5px]',\n },\n borderColor: {\n primary: 'border-primary dark:border-primary-dark',\n secondary: 'border-secondary dark:border-secondary-dark',\n neutral: 'border-neutral dark:border-neutral-dark',\n text: 'border-text dark:border-text-dark',\n error: 'border-error dark:border-error-dark',\n warning: 'border-warning dark:border-warning-dark',\n success: 'border-success dark:border-success-dark',\n },\n background: {\n none: 'bg-inherit dark:bg-inherit',\n hoverable:\n '!bg-opacity-5 backdrop-blur-0 hover:!bg-opacity-10 hover:backdrop-blur focus:!bg-opacity-10 focus:backdrop-blur aria-selected:!bg-opacity-15 aria-selected:backdrop-blur',\n with: '',\n },\n gap: {\n none: 'gap-0',\n sm: 'gap-1',\n md: 'gap-3',\n lg: 'gap-5',\n xl: 'gap-8',\n '2xl': 'gap-10',\n },\n },\n\n defaultVariants: {\n roundedSize: 'md',\n border: 'none',\n borderColor: 'text',\n backgroundColor: 'card',\n transparency: 'md',\n padding: 'none',\n separator: 'without',\n gap: 'none',\n },\n }\n);\n\nexport type ContainerProps = PropsWithChildren<\n Omit<VariantProps<typeof containerVariants>, 'border'>\n> &\n DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {\n border?: boolean;\n };\n\nexport const Container: FC<ContainerProps> = ({\n children,\n roundedSize,\n padding,\n transparency,\n separator,\n className,\n border,\n borderColor,\n backgroundColor,\n background,\n ...props\n}) => (\n <div\n className={cn(\n containerVariants({\n roundedSize,\n transparency,\n padding,\n separator,\n border:\n typeof border === 'boolean' ? (border ? 'with' : 'none') : undefined,\n background,\n backgroundColor,\n borderColor,\n className,\n })\n )}\n {...props}\n >\n {children}\n </div>\n);\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,MACA,iBAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,QACN,UAAU;AAAA,MACZ;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,MACA,WAAW;AAAA,QACT,SAAS;AAAA,QACT,GAAG;AAAA,QACH,GAAG;AAAA,QACH,MAAM;AAAA,MACR;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA,aAAa;AAAA,QACX,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,WACE;AAAA,QACF,MAAM;AAAA,MACR;AAAA,MACA,KAAK;AAAA,QACH,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,IAEA,iBAAiB;AAAA,MACf,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,SAAS;AAAA,MACT,WAAW;AAAA,MACX,KAAK;AAAA,IAAA;AAAA,EACP;AAEJ;AASO,MAAM,YAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW;AAAA,MACT,kBAAkB;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QACE,OAAO,WAAW,YAAa,SAAS,SAAS,SAAU;AAAA,QAC7D;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAA;AAAA,IACH;AAAA,IACC,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const ReactExports = require("react");
|
|
6
6
|
const editorReact = require("@intlayer/editor-react");
|
|
7
|
+
const components_DictionaryFieldEditor_SaveForm_SaveForm = require("../DictionaryFieldEditor/SaveForm/SaveForm.cjs");
|
|
7
8
|
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-cg9H6eBs.cjs");
|
|
8
|
-
const components_DictionaryEditor_ValidDictionaryChangeButtons = require("./ValidDictionaryChangeButtons.cjs");
|
|
9
9
|
const DictionaryEditor = ({
|
|
10
10
|
dictionary,
|
|
11
11
|
mode,
|
|
@@ -14,7 +14,7 @@ const DictionaryEditor = ({
|
|
|
14
14
|
const { editedContent, addEditedContent } = editorReact.useEditedContent();
|
|
15
15
|
const { focusedContent, setFocusedContentKeyPath } = editorReact.useFocusDictionary();
|
|
16
16
|
const focusedKeyPath = focusedContent?.keyPath;
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col justify-between gap-2", children: [
|
|
18
18
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ ReactExports.createElement(
|
|
19
19
|
components_DictionaryEditor_NodeWrapper_ArrayWrapper.NodeWrapper,
|
|
20
20
|
{
|
|
@@ -32,7 +32,7 @@ const DictionaryEditor = ({
|
|
|
32
32
|
onFocusKeyPath: setFocusedContentKeyPath
|
|
33
33
|
}
|
|
34
34
|
) }),
|
|
35
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode, className: "mb-4 flex-col" })
|
|
36
36
|
] });
|
|
37
37
|
};
|
|
38
38
|
exports.DictionaryEditor = DictionaryEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm dictionary={dictionary} mode={mode} className=\"mb-4 flex-col\" />\n </div>\n );\n};\n"],"names":["useEditedContent","useFocusDictionary","jsxs","jsx","createElement","NodeWrapper","SaveForm"],"mappings":";;;;;;;;AAeO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAIA,6BAAiB;AAC7D,QAAM,EAAE,gBAAgB,yBAAyB,IAAIC,+BAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AAGrC,SAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAAC,+BAAC,OACC,EAAA,UAAAC,6BAAA;AAAA,MAACC,qDAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACCF,2BAAA,IAAAG,mDAAA,UAAA,EAAS,YAAwB,MAAY,WAAU,gBAAgB,CAAA;AAAA,EAAA,GAC1E;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA+BtD,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import { useEditedContent, useFocusDictionary } from "@intlayer/editor-react";
|
|
5
|
+
import { SaveForm } from "../DictionaryFieldEditor/SaveForm/SaveForm.mjs";
|
|
5
6
|
import { N as NodeWrapper } from "../../index-BUe-qmA0.js";
|
|
6
|
-
import { ValidDictionaryChangeButtons } from "./ValidDictionaryChangeButtons.mjs";
|
|
7
7
|
const DictionaryEditor = ({
|
|
8
8
|
dictionary,
|
|
9
9
|
mode,
|
|
@@ -12,7 +12,7 @@ const DictionaryEditor = ({
|
|
|
12
12
|
const { editedContent, addEditedContent } = useEditedContent();
|
|
13
13
|
const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();
|
|
14
14
|
const focusedKeyPath = focusedContent?.keyPath;
|
|
15
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col justify-between gap-2", children: [
|
|
16
16
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ createElement(
|
|
17
17
|
NodeWrapper,
|
|
18
18
|
{
|
|
@@ -30,7 +30,7 @@ const DictionaryEditor = ({
|
|
|
30
30
|
onFocusKeyPath: setFocusedContentKeyPath
|
|
31
31
|
}
|
|
32
32
|
) }),
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
33
|
+
/* @__PURE__ */ jsx(SaveForm, { dictionary, mode, className: "mb-4 flex-col" })
|
|
34
34
|
] });
|
|
35
35
|
};
|
|
36
36
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport type { FC } from 'react';\nimport { SaveForm } from '../DictionaryFieldEditor/SaveForm/SaveForm';\nimport { NodeWrapper } from './NodeWrapper';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n mode: ('local' | 'remote')[];\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n mode,\n ...props\n}) => {\n const { editedContent, addEditedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex flex-1 flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n key={JSON.stringify(\n (editedContent?.[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent?.[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <SaveForm dictionary={dictionary} mode={mode} className=\"mb-4 flex-col\" />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,eAAe,iBAAiB,IAAI,iBAAiB;AAC7D,QAAM,EAAE,gBAAgB,yBAAyB,IAAI,mBAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AAGrC,SAAA,qBAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAA,oBAAC,OACC,EAAA,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV,KAAK,KAAK;AAAA,WACP,gBAAgB,WAAW,GAAG,KAAK,YAAY;AAAA,QAClD;AAAA,QACA,eAAe,gBAAgB,WAAW,GAAG,GAAG;AAAA,QAChD;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACC,oBAAA,UAAA,EAAS,YAAwB,MAAY,WAAU,gBAAgB,CAAA;AAAA,EAAA,GAC1E;AAEJ;"}
|
|
@@ -19,8 +19,9 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
19
19
|
const ValidDictionaryChangeButtonsSchemaSchema = components_DictionaryEditor_validDictionaryChangeButtonsSchema.getValidDictionaryChangeButtonsSchemaSchema();
|
|
20
20
|
const { resetButton, saveButton, publishButton, downloadButton } = reactIntlayer.useDictionary(components_DictionaryEditor_validDictionaryChangeButtons_content.validDictionaryChangeButtonsContent);
|
|
21
21
|
const { setLocaleDictionary } = editorReact.useDictionariesRecordActions();
|
|
22
|
-
const { writeDictionary } = hooks_intlayerAPIHooks.useWriteDictionary();
|
|
23
|
-
const { pushDictionaries } = hooks_intlayerAPIHooks.usePushDictionaries();
|
|
22
|
+
const { writeDictionary, isLoading: isWriting } = hooks_intlayerAPIHooks.useWriteDictionary();
|
|
23
|
+
const { pushDictionaries, isLoading: isPushing } = hooks_intlayerAPIHooks.usePushDictionaries();
|
|
24
|
+
const isLoading = isWriting || isPushing;
|
|
24
25
|
const { editedContent, restoreEditedContent } = editorReact.useEditedContent();
|
|
25
26
|
const { form, isSubmitting } = components_Form_FormBase.useForm(
|
|
26
27
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
@@ -37,34 +38,41 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
37
38
|
() => typeof dictionary?._id === "undefined",
|
|
38
39
|
[dictionary]
|
|
39
40
|
);
|
|
40
|
-
const
|
|
41
|
+
const handleSaveDictionary = ReactExports.useCallback(async () => {
|
|
41
42
|
if (!editedContent?.[dictionary.key]) return;
|
|
42
43
|
const updatedDictionary = {
|
|
43
44
|
...dictionary,
|
|
44
45
|
...editedContent?.[dictionary.key]
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
await writeDictionary(updatedDictionary).then(() => {
|
|
48
|
+
setLocaleDictionary(editedContent?.[dictionary.key]);
|
|
49
|
+
restoreEditedContent(dictionary.key);
|
|
50
|
+
});
|
|
51
|
+
}, [dictionary, editedContent, mode]);
|
|
52
|
+
const handlePushDictionary = ReactExports.useCallback(async () => {
|
|
53
|
+
if (!editedContent?.[dictionary.key]) return;
|
|
54
|
+
const updatedDictionary = {
|
|
55
|
+
...dictionary,
|
|
56
|
+
...editedContent?.[dictionary.key]
|
|
57
|
+
};
|
|
58
|
+
await pushDictionaries([updatedDictionary]).then(() => {
|
|
59
|
+
setLocaleDictionary(editedContent?.[dictionary.key]);
|
|
60
|
+
restoreEditedContent(dictionary.key);
|
|
61
|
+
});
|
|
53
62
|
}, [dictionary, editedContent, mode]);
|
|
54
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
55
64
|
components_Form_layout_FormItemLayout.Form,
|
|
56
65
|
{
|
|
57
66
|
className: "flex w-full flex-row flex-wrap justify-end gap-3",
|
|
58
67
|
...form,
|
|
59
68
|
schema: ValidDictionaryChangeButtonsSchemaSchema,
|
|
60
|
-
onSubmitSuccess,
|
|
61
69
|
children: [
|
|
62
70
|
isEdited && /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
71
|
components_Form_layout_FormItemLayout.Form.Button,
|
|
64
72
|
{
|
|
65
73
|
type: "button",
|
|
66
74
|
label: resetButton.label.value,
|
|
67
|
-
disabled: !isEdited || isSubmitting,
|
|
75
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
68
76
|
className: "ml-auto",
|
|
69
77
|
Icon: lucideReact.RotateCcw,
|
|
70
78
|
variant: "outline",
|
|
@@ -75,46 +83,51 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
75
83
|
children: resetButton.text
|
|
76
84
|
}
|
|
77
85
|
),
|
|
78
|
-
mode === "remote"
|
|
86
|
+
mode === "remote" && isLocalDictionary && /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
87
|
components_Form_layout_FormItemLayout.Form.Button,
|
|
80
88
|
{
|
|
81
89
|
type: "submit",
|
|
82
90
|
label: publishButton.label.value,
|
|
83
|
-
disabled:
|
|
91
|
+
disabled: isSubmitting || isLoading,
|
|
84
92
|
Icon: lucideReact.ArrowUpFromLine,
|
|
85
93
|
color: "text",
|
|
86
94
|
isFullWidth: true,
|
|
87
95
|
isLoading: isSubmitting,
|
|
96
|
+
onClick: handlePushDictionary,
|
|
88
97
|
children: publishButton.text
|
|
89
98
|
}
|
|
90
|
-
)
|
|
99
|
+
),
|
|
100
|
+
mode === "remote" && isEdited && /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
101
|
components_Form_layout_FormItemLayout.Form.Button,
|
|
92
102
|
{
|
|
93
103
|
type: "submit",
|
|
94
104
|
label: saveButton.label.value,
|
|
95
|
-
disabled: !isEdited || isSubmitting,
|
|
105
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
96
106
|
Icon: lucideReact.Save,
|
|
97
107
|
color: "text",
|
|
98
108
|
isFullWidth: true,
|
|
99
109
|
isLoading: isSubmitting,
|
|
110
|
+
onClick: handleSaveDictionary,
|
|
100
111
|
children: saveButton.text
|
|
101
112
|
}
|
|
102
|
-
)
|
|
113
|
+
),
|
|
114
|
+
mode === "local" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
103
115
|
components_Form_layout_FormItemLayout.Form.Button,
|
|
104
116
|
{
|
|
105
117
|
type: "submit",
|
|
106
118
|
label: downloadButton.label.value,
|
|
107
|
-
disabled: !isEdited || isSubmitting,
|
|
119
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
108
120
|
Icon: lucideReact.Download,
|
|
109
121
|
color: "text",
|
|
110
122
|
isFullWidth: true,
|
|
111
123
|
isLoading: isSubmitting,
|
|
124
|
+
onClick: handlePushDictionary,
|
|
112
125
|
children: downloadButton.text
|
|
113
126
|
}
|
|
114
127
|
)
|
|
115
128
|
]
|
|
116
129
|
}
|
|
117
|
-
)
|
|
130
|
+
);
|
|
118
131
|
};
|
|
119
132
|
exports.ValidDictionaryChangeButtons = ValidDictionaryChangeButtons;
|
|
120
133
|
//# sourceMappingURL=ValidDictionaryChangeButtons.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, RotateCcw, Save } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries, useWriteDictionary } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary, mode }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton, downloadButton } =\n useDictionary(validDictionaryChangeButtonsContent);\n\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary } = useWriteDictionary();\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, RotateCcw, Save } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries, useWriteDictionary } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary, mode }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton, downloadButton } =\n useDictionary(validDictionaryChangeButtonsContent);\n\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const handleSaveDictionary = useCallback(async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n }, [dictionary, editedContent, mode]);\n\n const handlePushDictionary = useCallback(async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n }, [dictionary, editedContent, mode]);\n\n return (\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode === 'remote' && isLocalDictionary && (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={isSubmitting || isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode === 'remote' && isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handleSaveDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n {mode === 'local' && (\n <Form.Button\n type=\"submit\"\n label={downloadButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n Icon={Download}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handlePushDictionary}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n </Form>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","useDictionariesRecordActions","useWriteDictionary","usePushDictionaries","useEditedContent","useForm","useMemo","useCallback","jsxs","Form","jsx","RotateCcw","ArrowUpFromLine","Save","Download"],"mappings":";;;;;;;;;;;;;;;;;AAqBO,MAAM,+BAET,CAAC,EAAE,YAAY,WAAW;AAC5B,QAAM,2CACJA,+DAAAA,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,eAAe,eAAe,IAC7DC,4BAAcC,oGAAmC;AAE7C,QAAA,EAAE,oBAAoB,IAAIC,yCAA6B;AAC7D,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAcC,uBAAAA,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAcC,uBAAAA,oBAAoB;AACvE,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;A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AAA,IAAA;AAAA,EAEJ;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,EAAwB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAOtD,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,EAAwB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAOtD,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,CAkIlC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useDictionariesRecordActions, useEditedContent } from "@intlayer/editor-react";
|
|
4
4
|
import { RotateCcw, ArrowUpFromLine, Save, Download } from "lucide-react";
|
|
5
5
|
import { useMemo, useCallback } from "react";
|
|
@@ -17,8 +17,9 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
17
17
|
const ValidDictionaryChangeButtonsSchemaSchema = getValidDictionaryChangeButtonsSchemaSchema();
|
|
18
18
|
const { resetButton, saveButton, publishButton, downloadButton } = useDictionary(validDictionaryChangeButtonsContent);
|
|
19
19
|
const { setLocaleDictionary } = useDictionariesRecordActions();
|
|
20
|
-
const { writeDictionary } = useWriteDictionary();
|
|
21
|
-
const { pushDictionaries } = usePushDictionaries();
|
|
20
|
+
const { writeDictionary, isLoading: isWriting } = useWriteDictionary();
|
|
21
|
+
const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();
|
|
22
|
+
const isLoading = isWriting || isPushing;
|
|
22
23
|
const { editedContent, restoreEditedContent } = useEditedContent();
|
|
23
24
|
const { form, isSubmitting } = useForm(
|
|
24
25
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
@@ -35,34 +36,41 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
35
36
|
() => typeof dictionary?._id === "undefined",
|
|
36
37
|
[dictionary]
|
|
37
38
|
);
|
|
38
|
-
const
|
|
39
|
+
const handleSaveDictionary = useCallback(async () => {
|
|
39
40
|
if (!editedContent?.[dictionary.key]) return;
|
|
40
41
|
const updatedDictionary = {
|
|
41
42
|
...dictionary,
|
|
42
43
|
...editedContent?.[dictionary.key]
|
|
43
44
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
await writeDictionary(updatedDictionary).then(() => {
|
|
46
|
+
setLocaleDictionary(editedContent?.[dictionary.key]);
|
|
47
|
+
restoreEditedContent(dictionary.key);
|
|
48
|
+
});
|
|
49
|
+
}, [dictionary, editedContent, mode]);
|
|
50
|
+
const handlePushDictionary = useCallback(async () => {
|
|
51
|
+
if (!editedContent?.[dictionary.key]) return;
|
|
52
|
+
const updatedDictionary = {
|
|
53
|
+
...dictionary,
|
|
54
|
+
...editedContent?.[dictionary.key]
|
|
55
|
+
};
|
|
56
|
+
await pushDictionaries([updatedDictionary]).then(() => {
|
|
57
|
+
setLocaleDictionary(editedContent?.[dictionary.key]);
|
|
58
|
+
restoreEditedContent(dictionary.key);
|
|
59
|
+
});
|
|
51
60
|
}, [dictionary, editedContent, mode]);
|
|
52
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
53
62
|
Form,
|
|
54
63
|
{
|
|
55
64
|
className: "flex w-full flex-row flex-wrap justify-end gap-3",
|
|
56
65
|
...form,
|
|
57
66
|
schema: ValidDictionaryChangeButtonsSchemaSchema,
|
|
58
|
-
onSubmitSuccess,
|
|
59
67
|
children: [
|
|
60
68
|
isEdited && /* @__PURE__ */ jsx(
|
|
61
69
|
Form.Button,
|
|
62
70
|
{
|
|
63
71
|
type: "button",
|
|
64
72
|
label: resetButton.label.value,
|
|
65
|
-
disabled: !isEdited || isSubmitting,
|
|
73
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
66
74
|
className: "ml-auto",
|
|
67
75
|
Icon: RotateCcw,
|
|
68
76
|
variant: "outline",
|
|
@@ -73,46 +81,51 @@ const ValidDictionaryChangeButtons = ({ dictionary, mode }) => {
|
|
|
73
81
|
children: resetButton.text
|
|
74
82
|
}
|
|
75
83
|
),
|
|
76
|
-
mode === "remote"
|
|
84
|
+
mode === "remote" && isLocalDictionary && /* @__PURE__ */ jsx(
|
|
77
85
|
Form.Button,
|
|
78
86
|
{
|
|
79
87
|
type: "submit",
|
|
80
88
|
label: publishButton.label.value,
|
|
81
|
-
disabled:
|
|
89
|
+
disabled: isSubmitting || isLoading,
|
|
82
90
|
Icon: ArrowUpFromLine,
|
|
83
91
|
color: "text",
|
|
84
92
|
isFullWidth: true,
|
|
85
93
|
isLoading: isSubmitting,
|
|
94
|
+
onClick: handlePushDictionary,
|
|
86
95
|
children: publishButton.text
|
|
87
96
|
}
|
|
88
|
-
)
|
|
97
|
+
),
|
|
98
|
+
mode === "remote" && isEdited && /* @__PURE__ */ jsx(
|
|
89
99
|
Form.Button,
|
|
90
100
|
{
|
|
91
101
|
type: "submit",
|
|
92
102
|
label: saveButton.label.value,
|
|
93
|
-
disabled: !isEdited || isSubmitting,
|
|
103
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
94
104
|
Icon: Save,
|
|
95
105
|
color: "text",
|
|
96
106
|
isFullWidth: true,
|
|
97
107
|
isLoading: isSubmitting,
|
|
108
|
+
onClick: handleSaveDictionary,
|
|
98
109
|
children: saveButton.text
|
|
99
110
|
}
|
|
100
|
-
)
|
|
111
|
+
),
|
|
112
|
+
mode === "local" && /* @__PURE__ */ jsx(
|
|
101
113
|
Form.Button,
|
|
102
114
|
{
|
|
103
115
|
type: "submit",
|
|
104
116
|
label: downloadButton.label.value,
|
|
105
|
-
disabled: !isEdited || isSubmitting,
|
|
117
|
+
disabled: !isEdited || isSubmitting || isLoading,
|
|
106
118
|
Icon: Download,
|
|
107
119
|
color: "text",
|
|
108
120
|
isFullWidth: true,
|
|
109
121
|
isLoading: isSubmitting,
|
|
122
|
+
onClick: handlePushDictionary,
|
|
110
123
|
children: downloadButton.text
|
|
111
124
|
}
|
|
112
125
|
)
|
|
113
126
|
]
|
|
114
127
|
}
|
|
115
|
-
)
|
|
128
|
+
);
|
|
116
129
|
};
|
|
117
130
|
export {
|
|
118
131
|
ValidDictionaryChangeButtons
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, RotateCcw, Save } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries, useWriteDictionary } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary, mode }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton, downloadButton } =\n useDictionary(validDictionaryChangeButtonsContent);\n\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary } = useWriteDictionary();\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, RotateCcw, Save } from 'lucide-react';\nimport { useCallback, useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries, useWriteDictionary } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary, mode }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton, downloadButton } =\n useDictionary(validDictionaryChangeButtonsContent);\n\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { writeDictionary, isLoading: isWriting } = useWriteDictionary();\n const { pushDictionaries, isLoading: isPushing } = usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const handleSaveDictionary = useCallback(async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await writeDictionary(updatedDictionary).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n }, [dictionary, editedContent, mode]);\n\n const handlePushDictionary = useCallback(async () => {\n if (!editedContent?.[dictionary.key]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.key],\n };\n\n await pushDictionaries([updatedDictionary]).then(() => {\n setLocaleDictionary(editedContent?.[dictionary.key]);\n restoreEditedContent(dictionary.key);\n });\n }, [dictionary, editedContent, mode]);\n\n return (\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode === 'remote' && isLocalDictionary && (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={isSubmitting || isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode === 'remote' && isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handleSaveDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n {mode === 'local' && (\n <Form.Button\n type=\"submit\"\n label={downloadButton.label.value}\n disabled={!isEdited || isSubmitting || isLoading}\n Icon={Download}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={handlePushDictionary}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n </Form>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqBO,MAAM,+BAET,CAAC,EAAE,YAAY,WAAW;AAC5B,QAAM,2CACJ,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,eAAe,eAAe,IAC7D,cAAc,mCAAmC;AAE7C,QAAA,EAAE,oBAAoB,IAAI,6BAA6B;AAC7D,QAAM,EAAE,iBAAiB,WAAW,UAAA,IAAc,mBAAmB;AACrE,QAAM,EAAE,kBAAkB,WAAW,UAAA,IAAc,oBAAoB;AACvE,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC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ath(focusedContent?.keyPath?.slice(0, -1) ?? []);
|
|
29
29
|
}
|
|
30
30
|
}, []);
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 flex items-center justify-between gap-2", children: [
|
|
33
33
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
34
34
|
components_DictionaryFieldEditor_KeyPathBreadcrumb.KeyPathBreadcrumb,
|
|
35
35
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, type Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport { useEffect, type FC } from 'react';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { content, key } = dictionary;\n const { editedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[dictionary.key]?.content === 'undefined'\n ? content\n : editedContent?.[key]?.content;\n\n const focusedSection = getContentNodeByKeyPath(section, focusedKeyPath ?? []);\n const isEditableFocusedSection = getIsEditableSection(focusedSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n return (\n
|
|
1
|
+
{"version":3,"file":"ContentEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, type Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport { useEffect, type FC } from 'react';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { content, key } = dictionary;\n const { editedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[dictionary.key]?.content === 'undefined'\n ? content\n : editedContent?.[key]?.content;\n\n const focusedSection = getContentNodeByKeyPath(section, focusedKeyPath ?? []);\n const isEditableFocusedSection = getIsEditableSection(focusedSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n return (\n <div>\n <div className=\"mb-6 flex items-center justify-between gap-2\">\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex items-center gap-2\">\n <LocaleSwitcherContent />\n </div>\n </div>\n <div className=\"flex gap-2 max-md:flex-col\">\n {typeof section === 'object' &&\n section &&\n Object.keys(section).length > 0 && (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"xl\"\n transparency=\"sm\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionaryKey={key}\n />\n </Container>\n )}\n {(isEditableFocusedSection || (focusedKeyPath ?? []).length > 0) && (\n <TextEditorContainer\n keyPath={focusedKeyPath ?? []}\n section={focusedSection}\n dictionary={dictionary}\n isDarkMode={isDarkMode}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":["useEditedContent","useFocusDictionary","getContentNodeByKeyPath","getIsEditableSection","useEffect","jsxs","jsx","KeyPathBreadcrumb","LocaleSwitcherContent","Container","NavigationViewNode","TextEditorContainer"],"mappings":";;;;;;;;;;;;;;AAiBO,MAAM,gBAAqC,CAAC;AAAA,EACjD;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,SAAS,IAAA,IAAQ;AACnB,QAAA,EAAE,cAAc,IAAIA,6BAAiB;AAC3C,QAAM,EAAE,gBAAgB,yBAAyB,IAAIC,+BAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AACjC,QAAA,UACJ,OAAO,gBAAgB,WAAW,GAAG,GAAG,YAAY,cAChD,UACA,gBAAgB,GAAG,GAAG;AAE5B,QAAM,iBAAiBC,KAAA,wBAAwB,SAAS,kBAAkB,CAAA,CAAE;AACtE,QAAA,2BAA2BC,2EAAqB,cAAc;AAEpEC,eAAAA,UAAU,MAAM;AACV,QAAA,OAAO,mBAAmB,aAAa;AACzC,+BAAyB,gBAAgB,SAAS,MAAM,GAAG,EAAE,KAAK,EAAE;AAAA,IAAA;AAAA,EAExE,GAAG,EAAE;AAEL,yCACG,OACC,EAAA,UAAA;AAAA,IAACC,2BAAAA,KAAA,OAAA,EAAI,WAAU,gDACb,UAAA;AAAA,MAAAC,2BAAA;AAAA,QAACC,mDAAA;AAAA,QAAA;AAAA,UACC,eAAe;AAAA,UACf,SAAS,kBAAkB,CAAC;AAAA,UAC5B,gBAAgB;AAAA,QAAA;AAAA,MAClB;AAAA,qCACC,OAAI,EAAA,WAAU,2BACb,UAAAD,2BAAA,IAACE,wFAAsB,EACzB,CAAA;AAAA,IAAA,GACF;AAAA,IACAH,2BAAAA,KAAC,OAAI,EAAA,WAAU,8BACZ,UAAA;AAAA,MAAO,OAAA,YAAY,YAClB,WACA,OAAO,KAAK,OAAO,EAAE,SAAS,KAC5BC,2BAAA;AAAA,QAACG,2BAAA;AAAA,QAAA;AAAA,UACC,QAAM;AAAA,UACN,YAAW;AAAA,UACX,WAAU;AAAA,UACV,aAAY;AAAA,UACZ,cAAa;AAAA,UAEb,UAAAH,2BAAA;AAAA,YAACI,mEAAA;AAAA,YAAA;AAAA,cACC,SAAS,CAAC;AAAA,cACV;AAAA,cACA,eAAe;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MACF;AAAA,OAEF,6BAA6B,kBAAkB,CAAC,GAAG,SAAS,MAC5DJ,2BAAA;AAAA,QAACK,8DAAA;AAAA,QAAA;AAAA,UACC,SAAS,kBAAkB,CAAC;AAAA,UAC5B,SAAS;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs,
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { getContentNodeByKeyPath } from "@intlayer/core";
|
|
4
4
|
import { useEditedContent, useFocusDictionary } from "@intlayer/editor-react";
|
|
5
5
|
import { useEffect } from "react";
|
|
@@ -26,8 +26,8 @@ const ContentEditor = ({
|
|
|
26
26
|
setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);
|
|
27
27
|
}
|
|
28
28
|
}, []);
|
|
29
|
-
return /* @__PURE__ */ jsxs(
|
|
30
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-6 flex items-center justify-between gap-2", children: [
|
|
31
31
|
/* @__PURE__ */ jsx(
|
|
32
32
|
KeyPathBreadcrumb,
|
|
33
33
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, type Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport { useEffect, type FC } from 'react';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { content, key } = dictionary;\n const { editedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[dictionary.key]?.content === 'undefined'\n ? content\n : editedContent?.[key]?.content;\n\n const focusedSection = getContentNodeByKeyPath(section, focusedKeyPath ?? []);\n const isEditableFocusedSection = getIsEditableSection(focusedSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n return (\n
|
|
1
|
+
{"version":3,"file":"ContentEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath, type Dictionary } from '@intlayer/core';\nimport { useEditedContent, useFocusDictionary } from '@intlayer/editor-react';\nimport { useEffect, type FC } from 'react';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { content, key } = dictionary;\n const { editedContent } = useEditedContent();\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[dictionary.key]?.content === 'undefined'\n ? content\n : editedContent?.[key]?.content;\n\n const focusedSection = getContentNodeByKeyPath(section, focusedKeyPath ?? []);\n const isEditableFocusedSection = getIsEditableSection(focusedSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n return (\n <div>\n <div className=\"mb-6 flex items-center justify-between gap-2\">\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex items-center gap-2\">\n <LocaleSwitcherContent />\n </div>\n </div>\n <div className=\"flex gap-2 max-md:flex-col\">\n {typeof section === 'object' &&\n section &&\n Object.keys(section).length > 0 && (\n <Container\n border\n background=\"none\"\n className=\"top-6 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"xl\"\n transparency=\"sm\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionaryKey={key}\n />\n </Container>\n )}\n {(isEditableFocusedSection || (focusedKeyPath ?? []).length > 0) && (\n <TextEditorContainer\n keyPath={focusedKeyPath ?? []}\n section={focusedSection}\n dictionary={dictionary}\n isDarkMode={isDarkMode}\n />\n )}\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAiBO,MAAM,gBAAqC,CAAC;AAAA,EACjD;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,SAAS,IAAA,IAAQ;AACnB,QAAA,EAAE,cAAc,IAAI,iBAAiB;AAC3C,QAAM,EAAE,gBAAgB,yBAAyB,IAAI,mBAAmB;AAExE,QAAM,iBAAiB,gBAAgB;AACjC,QAAA,UACJ,OAAO,gBAAgB,WAAW,GAAG,GAAG,YAAY,cAChD,UACA,gBAAgB,GAAG,GAAG;AAE5B,QAAM,iBAAiB,wBAAwB,SAAS,kBAAkB,CAAA,CAAE;AACtE,QAAA,2BAA2B,qBAAqB,cAAc;AAEpE,YAAU,MAAM;AACV,QAAA,OAAO,mBAAmB,aAAa;AACzC,+BAAyB,gBAAgB,SAAS,MAAM,GAAG,EAAE,KAAK,EAAE;AAAA,IAAA;AAAA,EAExE,GAAG,EAAE;AAEL,8BACG,OACC,EAAA,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAU,gDACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,eAAe;AAAA,UACf,SAAS,kBAAkB,CAAC;AAAA,UAC5B,gBAAgB;AAAA,QAAA;AAAA,MAClB;AAAA,0BACC,OAAI,EAAA,WAAU,2BACb,UAAA,oBAAC,yBAAsB,EACzB,CAAA;AAAA,IAAA,GACF;AAAA,IACA,qBAAC,OAAI,EAAA,WAAU,8BACZ,UAAA;AAAA,MAAO,OAAA,YAAY,YAClB,WACA,OAAO,KAAK,OAAO,EAAE,SAAS,KAC5B;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,QAAM;AAAA,UACN,YAAW;AAAA,UACX,WAAU;AAAA,UACV,aAAY;AAAA,UACZ,cA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