@intlayer/design-system 5.1.3 → 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 +37 -102
- 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 +6 -7
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +6 -7
- 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 +20 -9
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +21 -10
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +241 -209
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +245 -213
- 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/EnumKeyInput.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +19 -13
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.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/StructureEditor.cjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +3 -2
- 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 +3 -2
- 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 +3 -1
- 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 +3 -1
- 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/intlayerAPIHooks.cjs +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +1 -1
- package/dist/hooks/intlayerAPIHooks.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-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- 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/dist/zod-BV4nCGJE.js.map +1 -1
- package/dist/zod-DSrtTSD_.cjs.map +1 -1
- package/package.json +19 -19
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts +0 -10
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs.map +0 -1
- 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,EAC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,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,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AA,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;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumKeyInput.cjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"w-
|
|
1
|
+
{"version":3,"file":"EnumKeyInput.cjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"min-w-4\"\n />\n </div>\n );\n};\n"],"names":["useMemo","useState","useEffect","jsxs","Select","jsx","Input"],"mappings":";;;;;;;;;;AAMA,MAAM,sBAAsB,CAC1B,UACwE;AACpE,MAAA;AACA,MAAA;AAEA,MAAA,OAAO,UAAU,YAAY,CAAC,MAAM,OAAO,KAAK,CAAC,GAAG;AAEzC,iBAAA;AACb,kBAAc,MAAM,SAA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AAK,UAAI,KAAA;AAAA,uCAC3BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,uCAC7BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,uCAC3BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,uCAC7BA,yBAAAA,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,IAAA,CAAA;AAAA,MAAA,EAC9B,CAAA;AAAA,IAAA,GACF;AAAA,IACAC,2BAAA;AAAA,MAACC,uBAAA;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAc,eAAe;AAAA,QAC7B,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,QAC9C,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumKeyInput.mjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"w-
|
|
1
|
+
{"version":3,"file":"EnumKeyInput.mjs","sources":["../../../src/components/DictionaryFieldEditor/EnumKeyInput.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { Input } from '../Input';\nimport { Select } from '../Select';\n\nconst extractInitialState = (\n value: string | number\n): { comparator: string | undefined; numberValue: string | undefined } => {\n let comparator;\n let numberValue;\n\n if (typeof value === 'number' || !isNaN(Number(value))) {\n // If value is a number or numeric string, set comparator to '=' and numberValue accordingly\n comparator = '=';\n numberValue = value.toString();\n } else if (typeof value === 'string') {\n // Define possible comparators\n const comparators = ['<=', '>=', '<', '>', '='];\n // Find the comparator that matches the start of the string\n const matchedComparator = comparators.find((comp) =>\n value.startsWith(comp)\n );\n if (matchedComparator) {\n comparator = matchedComparator;\n numberValue = value.slice(matchedComparator.length);\n }\n }\n\n return { comparator, numberValue };\n};\n\ntype EnumKeyInputProps = {\n value: string | number;\n onChange: (value: string) => void;\n};\n\n/**\n * Example of values:\n * - `<1`\n * - `>-44.3`\n * - `=999`\n * - `<=1`\n * - `>=1`\n * - 88\n * - `-1`\n *\n */\nexport const EnumKeyInput: FC<EnumKeyInputProps> = ({ value, onChange }) => {\n const { comparator: initialComparator, numberValue: initialNumberValue } =\n useMemo(() => extractInitialState(value), [value]);\n const [comparator, setComparator] = useState<string | null>(\n initialComparator ?? null\n );\n const [numberValue, setNumberValue] = useState<string | null>(\n initialNumberValue ?? null\n );\n\n useEffect(() => {\n if (\n comparator &&\n numberValue &&\n (comparator !== initialComparator || numberValue !== initialNumberValue)\n ) {\n const newValue = `${comparator}${numberValue}`;\n\n onChange(newValue);\n }\n }, [\n comparator,\n initialComparator,\n initialNumberValue,\n numberValue,\n onChange,\n ]);\n\n return (\n <div className=\"flex gap-1\">\n <Select onValueChange={setComparator} defaultValue={initialComparator}>\n <Select.Trigger className=\"w-20\">\n <Select.Value placeholder=\"Select a comparator\" />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"<\">{`<`}</Select.Item>\n <Select.Item value=\"<=\">{`<=`}</Select.Item>\n <Select.Item value=\"=\">{`=`}</Select.Item>\n <Select.Item value=\">=\">{`>=`}</Select.Item>\n <Select.Item value=\">\">{`>`}</Select.Item>\n </Select.Content>\n </Select>\n <Input\n type=\"number\"\n defaultValue={numberValue ?? undefined}\n onChange={(e) => setNumberValue(e.target.value)}\n className=\"min-w-4\"\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,sBAAsB,CAC1B,UACwE;AACpE,MAAA;AACA,MAAA;AAEA,MAAA,OAAO,UAAU,YAAY,CAAC,MAAM,OAAO,KAAK,CAAC,GAAG;AAE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,MAAA;AAAA,4BAC7B,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,KAAA;AAAA,4BAC3B,OAAO,MAAP,EAAY,OAAM,MAAM,UAAK,MAAA;AAAA,4BAC7B,OAAO,MAAP,EAAY,OAAM,KAAK,UAAI,IAAA,CAAA;AAAA,MAAA,EAC9B,CAAA;AAAA,IAAA,GACF;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAc,eAAe;AAAA,QAC7B,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,QAC9C,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
|
|
@@ -30,12 +30,11 @@ const NavigationViewNode = ({
|
|
|
30
30
|
goToTranslation
|
|
31
31
|
} = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
|
|
32
32
|
const nodeType = core.getNodeType(section);
|
|
33
|
-
const isEditableSection = components_DictionaryFieldEditor_getIsEditableSection.getIsEditableSection(section);
|
|
34
33
|
const getIsSelected = ReactExports.useCallback(
|
|
35
34
|
(keyPath2) => (focusedContent?.keyPath?.length ?? 0) > 0 && core.isSameKeyPath(keyPath2, focusedContent?.keyPath ?? []),
|
|
36
35
|
[focusedContent?.keyPath]
|
|
37
36
|
);
|
|
38
|
-
if (!section
|
|
37
|
+
if (!section) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
39
38
|
if (typeof section === "object") {
|
|
40
39
|
if (nodeType === core.NodeType.ReactNode) {
|
|
41
40
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "React Node" });
|
|
@@ -55,7 +54,7 @@ const NavigationViewNode = ({
|
|
|
55
54
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
55
|
components_Button_Button.Button,
|
|
57
56
|
{
|
|
58
|
-
label: `${goToTranslation.label} ${translationKey}`,
|
|
57
|
+
label: `${goToTranslation.label.value} ${translationKey}`,
|
|
59
58
|
isActive: getIsSelected(childKeyPath),
|
|
60
59
|
variant: "hoverable",
|
|
61
60
|
color: "text",
|
|
@@ -70,7 +69,7 @@ const NavigationViewNode = ({
|
|
|
70
69
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
70
|
components_Accordion_Accordion.Accordion,
|
|
72
71
|
{
|
|
73
|
-
label: `${goToTranslation.label} ${translationKey}`,
|
|
72
|
+
label: `${goToTranslation.label.value} ${translationKey}`,
|
|
74
73
|
isActive: getIsSelected(childKeyPath),
|
|
75
74
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
76
75
|
header: translationKey,
|
|
@@ -104,7 +103,7 @@ const NavigationViewNode = ({
|
|
|
104
103
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
104
|
components_Button_Button.Button,
|
|
106
105
|
{
|
|
107
|
-
label: `${goToEnumeration.label} ${key}`,
|
|
106
|
+
label: `${goToEnumeration.label.value} ${key}`,
|
|
108
107
|
isActive: getIsSelected(childKeyPath),
|
|
109
108
|
variant: "hoverable",
|
|
110
109
|
color: "text",
|
|
@@ -119,7 +118,7 @@ const NavigationViewNode = ({
|
|
|
119
118
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
119
|
components_Accordion_Accordion.Accordion,
|
|
121
120
|
{
|
|
122
|
-
label: `${goToEnumeration.label} ${key}`,
|
|
121
|
+
label: `${goToEnumeration.label.value} ${key}`,
|
|
123
122
|
isActive: getIsSelected(childKeyPath),
|
|
124
123
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
125
124
|
header: key,
|
|
@@ -148,7 +147,7 @@ const NavigationViewNode = ({
|
|
|
148
147
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
149
148
|
components_Button_Button.Button,
|
|
150
149
|
{
|
|
151
|
-
label: `${goToElement.label} ${index}`,
|
|
150
|
+
label: `${goToElement.label.value} ${index}`,
|
|
152
151
|
isActive: getIsSelected(childKeyPath),
|
|
153
152
|
variant: "hoverable",
|
|
154
153
|
color: "text",
|
|
@@ -163,7 +162,7 @@ const NavigationViewNode = ({
|
|
|
163
162
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
163
|
components_Accordion_Accordion.Accordion,
|
|
165
164
|
{
|
|
166
|
-
label: `${goToElement.label} ${index}`,
|
|
165
|
+
label: `${goToElement.label.value} ${index}`,
|
|
167
166
|
isActive: getIsSelected(childKeyPath),
|
|
168
167
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
169
168
|
header: index,
|
|
@@ -195,8 +194,15 @@ const NavigationViewNode = ({
|
|
|
195
194
|
}
|
|
196
195
|
];
|
|
197
196
|
const sectionArray2 = section;
|
|
198
|
-
const
|
|
199
|
-
|
|
197
|
+
const emptySectionEl = core.getEmptyNode(
|
|
198
|
+
sectionArray2[sectionArray2.length - 1]
|
|
199
|
+
) ?? "";
|
|
200
|
+
addEditedContent(
|
|
201
|
+
dictionaryKey,
|
|
202
|
+
emptySectionEl,
|
|
203
|
+
newKeyPath,
|
|
204
|
+
false
|
|
205
|
+
);
|
|
200
206
|
setFocusedContentKeyPath(newKeyPath);
|
|
201
207
|
},
|
|
202
208
|
Icon: lucideReact.Plus,
|
|
@@ -217,7 +223,7 @@ const NavigationViewNode = ({
|
|
|
217
223
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
218
224
|
components_Button_Button.Button,
|
|
219
225
|
{
|
|
220
|
-
label: `${goToField.label} ${key}`,
|
|
226
|
+
label: `${goToField.label.value} ${key}`,
|
|
221
227
|
isActive: getIsSelected(childKeyPath),
|
|
222
228
|
variant: "hoverable",
|
|
223
229
|
color: "text",
|
|
@@ -232,7 +238,7 @@ const NavigationViewNode = ({
|
|
|
232
238
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
233
239
|
components_Accordion_Accordion.Accordion,
|
|
234
240
|
{
|
|
235
|
-
label: `${goToField.label} ${key}`,
|
|
241
|
+
label: `${goToField.label.value} ${key}`,
|
|
236
242
|
isActive: getIsSelected(childKeyPath),
|
|
237
243
|
onClick: () => setFocusedContentKeyPath(childKeyPath),
|
|
238
244
|
header: utils_camelCase.camelCaseToSentence(key),
|