@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
package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts
CHANGED
|
@@ -5,12 +5,10 @@ export declare const useDictionaryDetailsSchema: (projectId: string) => z.ZodObj
|
|
|
5
5
|
description: z.ZodOptional<z.ZodString>;
|
|
6
6
|
projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
7
7
|
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
-
publishedVersion: z.ZodDefault<z.ZodString>;
|
|
9
8
|
}, "strip", z.ZodTypeAny, {
|
|
10
9
|
key: string;
|
|
11
10
|
projectIds: string[];
|
|
12
11
|
tags: string[];
|
|
13
|
-
publishedVersion: string;
|
|
14
12
|
title?: string | undefined;
|
|
15
13
|
description?: string | undefined;
|
|
16
14
|
}, {
|
|
@@ -19,7 +17,6 @@ export declare const useDictionaryDetailsSchema: (projectId: string) => z.ZodObj
|
|
|
19
17
|
description?: string | undefined;
|
|
20
18
|
projectIds?: string[] | undefined;
|
|
21
19
|
tags?: string[] | undefined;
|
|
22
|
-
publishedVersion?: string | undefined;
|
|
23
20
|
}>;
|
|
24
21
|
export type DictionaryDetailsFormData = z.infer<ReturnType<typeof useDictionaryDetailsSchema>>;
|
|
25
22
|
//# sourceMappingURL=useDictionaryDetailsSchema.d.ts.map
|
package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDetailsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B,cAAe,MAAM
|
|
1
|
+
{"version":3,"file":"useDictionaryDetailsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B,cAAe,MAAM;;;;;;;;;;;;;;;;;;EAkE3D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAC9C,CAAC"}
|
package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDetailsSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useDictionary } from 'react-intlayer';\nimport { z } from 'zod';\nimport { useDictionaryDetailsSchemaContent } from './useDictionaryDetailsSchema.content';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useDictionary(useDictionaryDetailsSchemaContent);\n\n return z.object({\n title: z\n .string({\n required_error: titleRequiredError.value,\n invalid_type_error: titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n message: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n required_error: keyRequiredError.value,\n invalid_type_error: keyInvalidTypeError.value,\n })\n .min(4, { message: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { message: keySpaceError.value })\n .default(''),\n description: z\n .string({\n required_error: descriptionRequiredError.value,\n invalid_type_error: descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n required_error: requiredErrorProjectId.value,\n invalid_type_error: invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n invalid_type_error: invalidTypeErrorTags.value,\n })\n )\n .default([]),\n
|
|
1
|
+
{"version":3,"file":"useDictionaryDetailsSchema.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["import { useDictionary } from 'react-intlayer';\nimport { z } from 'zod';\nimport { useDictionaryDetailsSchemaContent } from './useDictionaryDetailsSchema.content';\n\nexport const useDictionaryDetailsSchema = (projectId: string) => {\n const {\n titleRequiredError,\n titleInvalidTypeError,\n titleMinLengthError,\n keyRequiredError,\n keyInvalidTypeError,\n keySpaceError,\n keyMinLengthError,\n descriptionRequiredError,\n descriptionInvalidTypeError,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n invalidTypeErrorTags,\n } = useDictionary(useDictionaryDetailsSchemaContent);\n\n return z.object({\n title: z\n .string({\n required_error: titleRequiredError.value,\n invalid_type_error: titleInvalidTypeError.value,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n message: titleMinLengthError.value,\n })\n .optional(),\n key: z\n .string({\n required_error: keyRequiredError.value,\n invalid_type_error: keyInvalidTypeError.value,\n })\n .min(4, { message: keyMinLengthError.value })\n /**\n * Valid :\n * my-key\n * my_key\n *\n * Invalid :\n * my key\n * my.key\n */\n .regex(/^[a-zA-Z0-9-_]+$/, { message: keySpaceError.value })\n .default(''),\n description: z\n .string({\n required_error: descriptionRequiredError.value,\n invalid_type_error: descriptionInvalidTypeError.value,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n required_error: requiredErrorProjectId.value,\n invalid_type_error: invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n invalid_type_error: invalidTypeErrorTags.value,\n })\n )\n .default([]),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":[],"mappings":";;;AAIa,MAAA,6BAA6B,CAAC,cAAsB;AACzD,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,iCAAiC;AAEnD,SAAO,EAAE,OAAO;AAAA,IACd,OAAO,EACJ,OAAO;AAAA,MACN,gBAAgB,mBAAmB;AAAA,MACnC,oBAAoB,sBAAsB;AAAA,IAAA,CAC3C,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,SAAS,oBAAoB;AAAA,IAC9B,CAAA,EACA,SAAS;AAAA,IACZ,KAAK,EACF,OAAO;AAAA,MACN,gBAAgB,iBAAiB;AAAA,MACjC,oBAAoB,oBAAoB;AAAA,IAAA,CACzC,EACA,IAAI,GAAG,EAAE,SAAS,kBAAkB,OAAO,EAU3C,MAAM,oBAAoB,EAAE,SAAS,cAAc,OAAO,EAC1D,QAAQ,EAAE;AAAA,IACb,aAAa,EACV,OAAO;AAAA,MACN,gBAAgB,yBAAyB;AAAA,MACzC,oBAAoB,4BAA4B;AAAA,IACjD,CAAA,EACA,SAAS;AAAA,IACZ,YAAY,EACT;AAAA,MACC,EAAE,OAAO;AAAA,QACP,gBAAgB,uBAAuB;AAAA,QACvC,oBAAoB,0BAA0B;AAAA,MAC/C,CAAA;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAM,EACH;AAAA,MACC,EAAE,OAAO;AAAA,QACP,oBAAoB,qBAAqB;AAAA,MAC1C,CAAA;AAAA,IACH,EACC,QAAQ,CAAE,CAAA;AAAA,EAAA,CACd;AACH;"}
|
|
@@ -7,7 +7,6 @@ const lucideReact = require("lucide-react");
|
|
|
7
7
|
const ReactExports = require("react");
|
|
8
8
|
const reactIntlayer = require("react-intlayer");
|
|
9
9
|
const components_Button_Button = require("../Button/Button.cjs");
|
|
10
|
-
const components_Container_index = require("../Container/index.cjs");
|
|
11
10
|
require("@intlayer/config/client");
|
|
12
11
|
require("@intlayer/core");
|
|
13
12
|
require("fuse.js");
|
|
@@ -16,6 +15,7 @@ require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
|
16
15
|
require("@intlayer/api");
|
|
17
16
|
require("../Toaster/Toast.cjs");
|
|
18
17
|
require("deepmerge");
|
|
18
|
+
require("../Container/index.cjs");
|
|
19
19
|
require("../DropDown/index.cjs");
|
|
20
20
|
require("../Input/Input.cjs");
|
|
21
21
|
require("../Input/Checkbox.cjs");
|
|
@@ -58,77 +58,58 @@ const DictionaryFieldEditor = ({
|
|
|
58
58
|
components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.LocaleSwitcherContentProvider,
|
|
59
59
|
{
|
|
60
60
|
availableLocales: config.internationalization.locales ?? [],
|
|
61
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-
|
|
62
|
-
/* @__PURE__ */ jsxRuntime.
|
|
63
|
-
|
|
64
|
-
components_Button_Button.Button,
|
|
65
|
-
{
|
|
66
|
-
onClick: () => onClickDictionaryList?.(),
|
|
67
|
-
variant: "hoverable",
|
|
68
|
-
size: "icon-md",
|
|
69
|
-
color: "text",
|
|
70
|
-
id: "return-to-dictionary-list",
|
|
71
|
-
Icon: lucideReact.ArrowLeft,
|
|
72
|
-
label: returnToDictionaryList.label.value
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
76
|
-
"label",
|
|
77
|
-
{
|
|
78
|
-
className: "cursor-pointer text-xs hover:underline",
|
|
79
|
-
htmlFor: "return-to-dictionary-list",
|
|
80
|
-
children: returnToDictionaryList.text
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
] }),
|
|
84
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
85
|
-
components_Container_index.Container,
|
|
61
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-col gap-6 px-2", children: [
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
+
components_Button_Button.Button,
|
|
86
64
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onChange: (value) => setEditorView(value),
|
|
95
|
-
color: "text",
|
|
96
|
-
size: "sm",
|
|
97
|
-
className: "m-auto w-full max-w-xl",
|
|
98
|
-
choices: [
|
|
99
|
-
{
|
|
100
|
-
content: "Details",
|
|
101
|
-
value: 0
|
|
102
|
-
/* DetailsEditor */
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
content: "Structure",
|
|
106
|
-
value: 2
|
|
107
|
-
/* StructureEditor */
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
content: "Content",
|
|
111
|
-
value: 1
|
|
112
|
-
/* ContentEditor */
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
content: "JSON",
|
|
116
|
-
value: 3
|
|
117
|
-
/* JSONEditor */
|
|
118
|
-
}
|
|
119
|
-
].filter(
|
|
120
|
-
({ value }) => !(mode === "local" && value === 0)
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
editorView === 0 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_DictionaryDetails_DictionaryDetailsForm.DictionaryDetailsForm, { dictionary, mode }),
|
|
125
|
-
editorView === 2 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_StructureEditor.StructureEditor, { dictionary }),
|
|
126
|
-
editorView === 1 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_ContentEditor.ContentEditor, { dictionary, isDarkMode }),
|
|
127
|
-
editorView === 3 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_JSONEditor.JSONEditor, { dictionary, isDarkMode }),
|
|
128
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode })
|
|
129
|
-
]
|
|
65
|
+
onClick: onClickDictionaryList,
|
|
66
|
+
variant: "hoverable",
|
|
67
|
+
className: "z-10 ml-5 mr-auto",
|
|
68
|
+
color: "text",
|
|
69
|
+
Icon: lucideReact.ArrowLeft,
|
|
70
|
+
label: returnToDictionaryList.label.value,
|
|
71
|
+
children: returnToDictionaryList.text
|
|
130
72
|
}
|
|
131
|
-
)
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
+
components_SwitchSelector_index.SwitchSelector,
|
|
76
|
+
{
|
|
77
|
+
defaultValue: editorView,
|
|
78
|
+
onChange: (value) => setEditorView(value),
|
|
79
|
+
color: "text",
|
|
80
|
+
size: "sm",
|
|
81
|
+
className: "m-auto w-full max-w-xl",
|
|
82
|
+
choices: [
|
|
83
|
+
{
|
|
84
|
+
content: "Details",
|
|
85
|
+
value: 0
|
|
86
|
+
/* DetailsEditor */
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
content: "Structure",
|
|
90
|
+
value: 2
|
|
91
|
+
/* StructureEditor */
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
content: "Content",
|
|
95
|
+
value: 1
|
|
96
|
+
/* ContentEditor */
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
content: "JSON",
|
|
100
|
+
value: 3
|
|
101
|
+
/* JSONEditor */
|
|
102
|
+
}
|
|
103
|
+
].filter(
|
|
104
|
+
({ value }) => !(!mode.includes("remote") && value === 0)
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
editorView === 0 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_DictionaryDetails_DictionaryDetailsForm.DictionaryDetailsForm, { dictionary, mode }),
|
|
109
|
+
editorView === 2 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_StructureEditor.StructureEditor, { dictionary }),
|
|
110
|
+
editorView === 1 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_ContentEditor.ContentEditor, { dictionary, isDarkMode }),
|
|
111
|
+
editorView === 3 && /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_JSONEditor.JSONEditor, { dictionary, isDarkMode }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_SaveForm_SaveForm.SaveForm, { dictionary, mode })
|
|
132
113
|
] })
|
|
133
114
|
}
|
|
134
115
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"text\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm dictionary={dictionary} mode={mode} />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useConfiguration","useState","useDictionary","dictionaryFieldEditorContent","useFocusDictionaryActions","useDictionariesRecordActions","useEffect","jsx","LocaleSwitcherContentProvider","jsxs","Button","ArrowLeft","SwitchSelector","DictionaryDetailsForm","StructureEditor","ContentEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAASA,YAAAA,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAIC,aAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2BC,cAAA;AAAA,IACjCC,+DAAAA;AAAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAIC,sCAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAIC,yCAA6B;AAE/DC,eAAAA,UAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAC;AAAA,MACb,eAAe,WAAW;AAAA,IAAA,EAC1B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,GAAG,GAAG;AAAA,IAAA,EAClB;AAAA,EACJ,GAAG,EAAE;AAGH,SAAAC,2BAAA;AAAA,IAACC,sEAAA;AAAA,IAAA;AAAA,MACC,kBAAkB,OAAO,qBAAqB,WAAW,CAAC;AAAA,MAE1D,UAAAC,2BAAA,KAAC,OAAI,EAAA,WAAU,sCACb,UAAA;AAAA,QAAAF,2BAAA;AAAA,UAACG,yBAAA;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,OAAM;AAAA,YACN,MAAMC,YAAA;AAAA,YACN,OAAO,uBAAuB,MAAM;AAAA,YAEnC,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAC1B;AAAA,QAEAJ,2BAAA;AAAA,UAACK,gCAAA;AAAA,UAAA;AAAA,YACC,cAAc;AAAA,YACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,YACxC,OAAM;AAAA,YACN,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,cACP;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MACD,MAAA,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF;AAAA,QAEC,eAAe,KACbL,2BAAA,IAAAM,yEAAA,uBAAA,EAAsB,YAAwB,MAAY;AAAA,QAE5D,eAAe,KACbN,2BAAAA,IAAAO,iDAAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACbP,2BAAA,IAAAQ,+CAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACbR,2BAAA,IAAAS,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9DT,2BAAAA,IAACU,mDAAS,UAAA,EAAA,YAAwB,KAAY,CAAA;AAAA,MAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
|
@@ -4,7 +4,7 @@ type DictionaryFieldEditorProps = {
|
|
|
4
4
|
dictionary: Dictionary;
|
|
5
5
|
onClickDictionaryList?: () => void;
|
|
6
6
|
isDarkMode?: boolean;
|
|
7
|
-
mode: 'local' | 'remote';
|
|
7
|
+
mode: ('local' | 'remote')[];
|
|
8
8
|
};
|
|
9
9
|
export declare const DictionaryFieldEditor: FC<DictionaryFieldEditorProps>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAYrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CA6FhE,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { ArrowLeft } from "lucide-react";
|
|
|
5
5
|
import { useState, useEffect } from "react";
|
|
6
6
|
import { useDictionary } from "react-intlayer";
|
|
7
7
|
import { Button } from "../Button/Button.mjs";
|
|
8
|
-
import { Container } from "../Container/index.mjs";
|
|
9
8
|
import "@intlayer/config/client";
|
|
10
9
|
import "@intlayer/core";
|
|
11
10
|
import "fuse.js";
|
|
@@ -14,6 +13,7 @@ import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
|
14
13
|
import "@intlayer/api";
|
|
15
14
|
import "../Toaster/Toast.mjs";
|
|
16
15
|
import "deepmerge";
|
|
16
|
+
import "../Container/index.mjs";
|
|
17
17
|
import "../DropDown/index.mjs";
|
|
18
18
|
import "../Input/Input.mjs";
|
|
19
19
|
import "../Input/Checkbox.mjs";
|
|
@@ -56,77 +56,58 @@ const DictionaryFieldEditor = ({
|
|
|
56
56
|
LocaleSwitcherContentProvider,
|
|
57
57
|
{
|
|
58
58
|
availableLocales: config.internationalization.locales ?? [],
|
|
59
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
Button,
|
|
63
|
-
{
|
|
64
|
-
onClick: () => onClickDictionaryList?.(),
|
|
65
|
-
variant: "hoverable",
|
|
66
|
-
size: "icon-md",
|
|
67
|
-
color: "text",
|
|
68
|
-
id: "return-to-dictionary-list",
|
|
69
|
-
Icon: ArrowLeft,
|
|
70
|
-
label: returnToDictionaryList.label.value
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
"label",
|
|
75
|
-
{
|
|
76
|
-
className: "cursor-pointer text-xs hover:underline",
|
|
77
|
-
htmlFor: "return-to-dictionary-list",
|
|
78
|
-
children: returnToDictionaryList.text
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
] }),
|
|
82
|
-
/* @__PURE__ */ jsxs(
|
|
83
|
-
Container,
|
|
59
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col gap-6 px-2", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Button,
|
|
84
62
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
onChange: (value) => setEditorView(value),
|
|
93
|
-
color: "text",
|
|
94
|
-
size: "sm",
|
|
95
|
-
className: "m-auto w-full max-w-xl",
|
|
96
|
-
choices: [
|
|
97
|
-
{
|
|
98
|
-
content: "Details",
|
|
99
|
-
value: 0
|
|
100
|
-
/* DetailsEditor */
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
content: "Structure",
|
|
104
|
-
value: 2
|
|
105
|
-
/* StructureEditor */
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
content: "Content",
|
|
109
|
-
value: 1
|
|
110
|
-
/* ContentEditor */
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
content: "JSON",
|
|
114
|
-
value: 3
|
|
115
|
-
/* JSONEditor */
|
|
116
|
-
}
|
|
117
|
-
].filter(
|
|
118
|
-
({ value }) => !(mode === "local" && value === 0)
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
editorView === 0 && /* @__PURE__ */ jsx(DictionaryDetailsForm, { dictionary, mode }),
|
|
123
|
-
editorView === 2 && /* @__PURE__ */ jsx(StructureEditor, { dictionary }),
|
|
124
|
-
editorView === 1 && /* @__PURE__ */ jsx(ContentEditor, { dictionary, isDarkMode }),
|
|
125
|
-
editorView === 3 && /* @__PURE__ */ jsx(JSONEditor, { dictionary, isDarkMode }),
|
|
126
|
-
/* @__PURE__ */ jsx(SaveForm, { dictionary, mode })
|
|
127
|
-
]
|
|
63
|
+
onClick: onClickDictionaryList,
|
|
64
|
+
variant: "hoverable",
|
|
65
|
+
className: "z-10 ml-5 mr-auto",
|
|
66
|
+
color: "text",
|
|
67
|
+
Icon: ArrowLeft,
|
|
68
|
+
label: returnToDictionaryList.label.value,
|
|
69
|
+
children: returnToDictionaryList.text
|
|
128
70
|
}
|
|
129
|
-
)
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
SwitchSelector,
|
|
74
|
+
{
|
|
75
|
+
defaultValue: editorView,
|
|
76
|
+
onChange: (value) => setEditorView(value),
|
|
77
|
+
color: "text",
|
|
78
|
+
size: "sm",
|
|
79
|
+
className: "m-auto w-full max-w-xl",
|
|
80
|
+
choices: [
|
|
81
|
+
{
|
|
82
|
+
content: "Details",
|
|
83
|
+
value: 0
|
|
84
|
+
/* DetailsEditor */
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
content: "Structure",
|
|
88
|
+
value: 2
|
|
89
|
+
/* StructureEditor */
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
content: "Content",
|
|
93
|
+
value: 1
|
|
94
|
+
/* ContentEditor */
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
content: "JSON",
|
|
98
|
+
value: 3
|
|
99
|
+
/* JSONEditor */
|
|
100
|
+
}
|
|
101
|
+
].filter(
|
|
102
|
+
({ value }) => !(!mode.includes("remote") && value === 0)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
editorView === 0 && /* @__PURE__ */ jsx(DictionaryDetailsForm, { dictionary, mode }),
|
|
107
|
+
editorView === 2 && /* @__PURE__ */ jsx(StructureEditor, { dictionary }),
|
|
108
|
+
editorView === 1 && /* @__PURE__ */ jsx(ContentEditor, { dictionary, isDarkMode }),
|
|
109
|
+
editorView === 3 && /* @__PURE__ */ jsx(JSONEditor, { dictionary, isDarkMode }),
|
|
110
|
+
/* @__PURE__ */ jsx(SaveForm, { dictionary, mode })
|
|
130
111
|
] })
|
|
131
112
|
}
|
|
132
113
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useConfiguration,\n useDictionariesRecordActions,\n useFocusDictionaryActions,\n} from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { ContentEditor } from './ContentEditor';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\nimport { StructureEditor } from './StructureEditor';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n mode: ('local' | 'remote')[];\n};\n\nenum EditorViewType {\n DetailsEditor,\n ContentEditor,\n StructureEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n mode,\n}) => {\n const config = useConfiguration();\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.ContentEditor\n );\n const { returnToDictionaryList } = useDictionary(\n dictionaryFieldEditorContent\n );\n const { setFocusedContent } = useFocusDictionaryActions();\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n // Focus the dictionary if not focused\n setFocusedContent((prev) => ({\n ...(prev ?? {}),\n dictionaryKey: dictionary.key,\n }));\n setLocaleDictionaries((prev) => ({\n ...prev,\n [dictionary.key]: dictionary,\n }));\n }, []);\n\n return (\n <LocaleSwitcherContentProvider\n availableLocales={config.internationalization.locales ?? []}\n >\n <div className=\"flex size-full flex-col gap-6 px-2\">\n <Button\n onClick={onClickDictionaryList}\n variant=\"hoverable\"\n className=\"z-10 ml-5 mr-auto\"\n color=\"text\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n >\n {returnToDictionaryList.text}\n </Button>\n\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"m-auto w-full max-w-xl\"\n choices={[\n {\n content: 'Details',\n value: EditorViewType.DetailsEditor,\n },\n {\n content: 'Structure',\n value: EditorViewType.StructureEditor,\n },\n {\n content: 'Content',\n value: EditorViewType.ContentEditor,\n },\n {\n content: 'JSON',\n value: EditorViewType.JSONEditor,\n },\n ].filter(\n ({ value }) =>\n !(\n !mode.includes('remote') &&\n value === EditorViewType.DetailsEditor\n )\n )}\n />\n\n {editorView === EditorViewType.DetailsEditor && (\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n )}\n {editorView === EditorViewType.StructureEditor && (\n <StructureEditor dictionary={dictionary} />\n )}\n {editorView === EditorViewType.ContentEditor && (\n <ContentEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n\n <SaveForm dictionary={dictionary} mode={mode} />\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAS,iBAAiB;AAC1B,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EACF;AACM,QAAA,EAAE,2BAA2B;AAAA,IACjC;AAAA,EACF;AACM,QAAA,EAAE,kBAAkB,IAAI,0BAA0B;AAClD,QAAA,EAAE,sBAAsB,IAAI,6BAA6B;AAE/D,YAAU,MAAM;AAEd,sBAAkB,CAAC,UAAU;AAAA,MAC3B,GAAI,QAAQ,CAAC;AAAA,MACb,eAAe,WAAW;AAAA,IAAA,EAC1B;AACF,0BAAsB,CAAC,UAAU;AAAA,MAC/B,GAAG;AAAA,MACH,CAAC,WAAW,GAAG,GAAG;AAAA,IAAA,EAClB;AAAA,EACJ,GAAG,EAAE;AAGH,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAkB,OAAO,qBAAqB,WAAW,CAAC;AAAA,MAE1D,UAAA,qBAAC,OAAI,EAAA,WAAU,sCACb,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,SAAS;AAAA,YACT,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,OAAM;AAAA,YACN,MAAM;AAAA,YACN,OAAO,uBAAuB,MAAM;AAAA,YAEnC,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAC1B;AAAA,QAEA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,cAAc;AAAA,YACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,YACxC,OAAM;AAAA,YACN,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,cACP;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cACT;AAAA,cACA;AAAA,gBACE,SAAS;AAAA,gBACT,OAAO;AAAA;AAAA,cAAA;AAAA,YACT,EACA;AAAA,cACA,CAAC,EAAE,MACD,MAAA,EACE,CAAC,KAAK,SAAS,QAAQ,KACvB,UAAU;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF;AAAA,QAEC,eAAe,KACb,oBAAA,uBAAA,EAAsB,YAAwB,MAAY;AAAA,QAE5D,eAAe,KACb,oBAAA,iBAAA,EAAgB,WAAwB,CAAA;AAAA,QAE1C,eAAe,KACb,oBAAA,eAAA,EAAc,YAAwB,YAAwB;AAAA,QAEhE,eAAe,KACb,oBAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,QAG9D,oBAAC,UAAS,EAAA,YAAwB,KAAY,CAAA;AAAA,MAAA,EAChD,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|