@intlayer/design-system 5.0.0 → 5.0.2
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 +10 -10
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +10 -10
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +10 -10
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +3 -3
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +3 -3
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +6 -6
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +6 -6
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.cjs +7 -7
- package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.mjs +7 -7
- package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.d.ts.map +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs +8 -8
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs +8 -8
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts.map +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.cjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.cjs.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.d.ts.map +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.mjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +4 -4
- 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 +4 -4
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +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 +6 -6
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +6 -6
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +22 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +22 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +2 -2
- 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 +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +10 -4
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +10 -4
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +6 -6
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +6 -6
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs +59 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +4 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs +59 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
- package/dist/components/IDE/CopyButton.cjs +1 -1
- package/dist/components/IDE/CopyButton.cjs.map +1 -1
- package/dist/components/IDE/CopyButton.d.ts.map +1 -1
- package/dist/components/IDE/CopyButton.mjs +1 -1
- package/dist/components/IDE/CopyButton.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +5 -5
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +5 -5
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts +6 -6
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +3 -3
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +3 -3
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
- package/dist/{index-Di_3dNqI.js → index-BVYRWLUL.js} +3 -2
- package/dist/index-BVYRWLUL.js.map +1 -0
- package/dist/{index-ZARcTrR0.cjs → index-DTQyeqio.cjs} +3 -2
- package/dist/index-DTQyeqio.cjs.map +1 -0
- package/package.json +17 -17
- package/dist/index-Di_3dNqI.js.map +0 -1
- package/dist/index-ZARcTrR0.cjs.map +0 -1
|
@@ -8,7 +8,7 @@ import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
|
8
8
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
9
|
import { usePushDictionaries, useGetProjects, useGetTags, useAuditContentDeclarationMetadata, useWriteDictionary } from "../../../hooks/intlayerAPIHooks.mjs";
|
|
10
10
|
import "deepmerge";
|
|
11
|
-
import "../../../index-
|
|
11
|
+
import "../../../index-BVYRWLUL.js";
|
|
12
12
|
import "@intlayer/config/client";
|
|
13
13
|
import "@intlayer/api";
|
|
14
14
|
import "../../Button/Button.mjs";
|
|
@@ -47,7 +47,7 @@ const DictionaryDetailsForm = ({
|
|
|
47
47
|
const { data: tags, isLoading: isLoadingTags } = useGetTags();
|
|
48
48
|
const dictionaryValue = {
|
|
49
49
|
...dictionary,
|
|
50
|
-
|
|
50
|
+
version: dictionary.version ?? "-1"
|
|
51
51
|
};
|
|
52
52
|
const DictionaryDetailsSchema = useDictionaryDetailsSchema(
|
|
53
53
|
String(project?._id)
|
|
@@ -128,7 +128,7 @@ const DictionaryDetailsForm = ({
|
|
|
128
128
|
{
|
|
129
129
|
name: "key",
|
|
130
130
|
label: keyInput.label,
|
|
131
|
-
placeholder: keyInput.label,
|
|
131
|
+
placeholder: keyInput.label.value,
|
|
132
132
|
description: keyInput.description,
|
|
133
133
|
disabled: isSubmitting,
|
|
134
134
|
isRequired: true
|
|
@@ -139,7 +139,7 @@ const DictionaryDetailsForm = ({
|
|
|
139
139
|
{
|
|
140
140
|
name: "title",
|
|
141
141
|
label: titleInput.label,
|
|
142
|
-
placeholder: titleInput.placeholder,
|
|
142
|
+
placeholder: titleInput.placeholder.value,
|
|
143
143
|
description: titleInput.description,
|
|
144
144
|
disabled: isSubmitting
|
|
145
145
|
}
|
|
@@ -150,7 +150,7 @@ const DictionaryDetailsForm = ({
|
|
|
150
150
|
{
|
|
151
151
|
name: "description",
|
|
152
152
|
label: descriptionInput.label,
|
|
153
|
-
placeholder: descriptionInput.placeholder,
|
|
153
|
+
placeholder: descriptionInput.placeholder.value,
|
|
154
154
|
description: descriptionInput.description,
|
|
155
155
|
disabled: isSubmitting
|
|
156
156
|
}
|
|
@@ -160,14 +160,14 @@ const DictionaryDetailsForm = ({
|
|
|
160
160
|
Form.MultiSelect,
|
|
161
161
|
{
|
|
162
162
|
name: "projectIds",
|
|
163
|
-
label: projectInput.label,
|
|
164
|
-
description: projectInput.description,
|
|
163
|
+
label: projectInput.label.value,
|
|
164
|
+
description: projectInput.description.value,
|
|
165
165
|
children: [
|
|
166
166
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
167
167
|
MultiSelect.Trigger,
|
|
168
168
|
{
|
|
169
169
|
getBadgeValue: (value) => projects?.data?.find((project2) => String(project2._id) === value)?.name ?? value,
|
|
170
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Input, { placeholder: projectInput.placeholder })
|
|
170
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Input, { placeholder: projectInput.placeholder.value })
|
|
171
171
|
}
|
|
172
172
|
),
|
|
173
173
|
/* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Content, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { isLoading: isLoadingProjects, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.List, { children: projects?.data?.map((project2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -185,14 +185,14 @@ const DictionaryDetailsForm = ({
|
|
|
185
185
|
Form.MultiSelect,
|
|
186
186
|
{
|
|
187
187
|
name: "tags",
|
|
188
|
-
label: tagsSelect.label,
|
|
189
|
-
description: tagsSelect.description,
|
|
188
|
+
label: tagsSelect.label.value,
|
|
189
|
+
description: tagsSelect.description.value,
|
|
190
190
|
children: [
|
|
191
191
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
192
192
|
MultiSelect.Trigger,
|
|
193
193
|
{
|
|
194
194
|
getBadgeValue: (value) => projects?.data?.find((project2) => String(project2._id) === value)?.name ?? value,
|
|
195
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Input, { placeholder: tagsSelect.placeholder })
|
|
195
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Input, { placeholder: tagsSelect.placeholder.value })
|
|
196
196
|
}
|
|
197
197
|
),
|
|
198
198
|
/* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.Content, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { isLoading: isLoadingProjects, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelect.List, { children: tags?.data?.map((tag) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -212,10 +212,15 @@ const DictionaryDetailsForm = ({
|
|
|
212
212
|
Form.Select,
|
|
213
213
|
{
|
|
214
214
|
name: "publishedVersion",
|
|
215
|
-
description: publishedVersionSelect.description,
|
|
215
|
+
description: publishedVersionSelect.description.value,
|
|
216
216
|
label: publishedVersionSelect.label,
|
|
217
217
|
children: [
|
|
218
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Select.Trigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
218
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Select.Trigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
219
|
+
Select.Value,
|
|
220
|
+
{
|
|
221
|
+
placeholder: publishedVersionSelect.placeholder.value
|
|
222
|
+
}
|
|
223
|
+
) }),
|
|
219
224
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select.Content, { children: [
|
|
220
225
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Select.Item, { value: "-1", children: "LTS" }),
|
|
221
226
|
dictionary.availableVersions?.map(
|
|
@@ -232,7 +237,7 @@ const DictionaryDetailsForm = ({
|
|
|
232
237
|
Form.Button,
|
|
233
238
|
{
|
|
234
239
|
type: "button",
|
|
235
|
-
label: auditButton.label,
|
|
240
|
+
label: auditButton.label.value,
|
|
236
241
|
Icon: WandSparkles,
|
|
237
242
|
variant: "outline",
|
|
238
243
|
color: "text",
|
|
@@ -247,7 +252,7 @@ const DictionaryDetailsForm = ({
|
|
|
247
252
|
Form.Button,
|
|
248
253
|
{
|
|
249
254
|
type: "submit",
|
|
250
|
-
label: publishButton.label,
|
|
255
|
+
label: publishButton.label.value,
|
|
251
256
|
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
252
257
|
Icon: ArrowUpFromLine,
|
|
253
258
|
color: "text",
|
|
@@ -259,7 +264,7 @@ const DictionaryDetailsForm = ({
|
|
|
259
264
|
Form.Button,
|
|
260
265
|
{
|
|
261
266
|
type: "submit",
|
|
262
|
-
label: saveButton.label,
|
|
267
|
+
label: saveButton.label.value,
|
|
263
268
|
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
264
269
|
Icon: Save,
|
|
265
270
|
color: "text",
|
|
@@ -271,7 +276,7 @@ const DictionaryDetailsForm = ({
|
|
|
271
276
|
Form.Button,
|
|
272
277
|
{
|
|
273
278
|
type: "submit",
|
|
274
|
-
label: downloadButton.label,
|
|
279
|
+
label: downloadButton.label.value,
|
|
275
280
|
disabled: isSubmitting || !isFormEdited || isLoading,
|
|
276
281
|
Icon: Download,
|
|
277
282
|
color: "text",
|
package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryDetailsForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport {\n DictionaryAPI,\n Dictionary as DistantDictionary,\n} from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, Save, WandSparkles } from 'lucide-react';\nimport { type FC, useEffect, useMemo } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect, Select } from '../../Select';\nimport { dictionaryDetailsContent } from './dictionaryDetails.content';\nimport {\n useDictionaryDetailsSchema,\n DictionaryDetailsFormData,\n} from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { pushDictionaries } = usePushDictionaries();\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags, isLoading: isLoadingTags } = useGetTags();\n const dictionaryValue = {\n ...dictionary,\n publishedVersion: dictionary.publishedVersion ?? '-1',\n };\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?._id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionaryValue,\n });\n const {\n titleInput,\n keyInput,\n descriptionInput,\n publishedVersionSelect,\n publishButton,\n saveButton,\n projectInput,\n tagsSelect,\n auditButton,\n downloadButton,\n } = useDictionary(dictionaryDetailsContent);\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const { writeDictionary } = useWriteDictionary();\n\n useEffect(() => {\n form.reset(dictionaryValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dictionary, form?.reset]);\n\n const isFormEdited = form.formState.isDirty;\n const isLocalDictionary =\n typeof (dictionary as DistantDictionary)?._id === 'undefined';\n\n const onSubmitSuccess = async (data: DictionaryDetailsFormData) => {\n const updatedDictionary = {\n ...dictionary,\n ...data,\n };\n\n if (mode === 'remote') {\n await pushDictionaries([updatedDictionary]);\n } else {\n await writeDictionary(updatedDictionary);\n }\n\n setLocaleDictionary(updatedDictionary);\n };\n\n const handleOnAuditFile = async () => {\n const updatedDictionary = form.getValues();\n await auditContentDeclaration({\n fileContent: JSON.stringify({ ...dictionary, ...updatedDictionary }),\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n form.reset({\n ...updatedDictionary,\n ...editedDictionary,\n publishedVersion: updatedDictionary.publishedVersion ?? '-1',\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n const isLoading = isSubmitting || isLoadingTags;\n\n const { editedContent } = useEditedContent();\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n dictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(dictionary.content),\n [dictionary, editedDictionary]\n );\n\n return (\n <Form\n className=\"flex size-full flex-1 flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder}\n description={titleInput.description}\n disabled={isSubmitting}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder}\n description={descriptionInput.description}\n disabled={isSubmitting}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label}\n description={projectInput.description}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project._id)}\n value={String(project._id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label}\n description={tagsSelect.description}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n {((dictionary as DictionaryAPI).availableVersions?.length ?? 0) > 1 && (\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.Select\n name=\"publishedVersion\"\n description={publishedVersionSelect.description}\n label={publishedVersionSelect.label}\n >\n <Select.Trigger>\n <Select.Value placeholder={publishedVersionSelect.placeholder} />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"-1\">LTS</Select.Item>\n {(dictionary as DictionaryAPI).availableVersions?.map(\n (version) => (\n <Select.Item value={version} key={version}>\n {version}\n </Select.Item>\n )\n )}\n </Select.Content>\n </Form.Select>\n <div className=\"w-full\" />\n </div>\n )}\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n\n {mode === 'remote' ? (\n isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )\n ) : (\n <Form.Button\n type=\"submit\"\n label={downloadButton.label}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Download}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n </div>\n </Form>\n );\n};\n"],"names":["editedDictionary","jsxs","jsx","project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ,IAAI,QAAQ;AAC5B,QAAM,EAAE,YAAY,WAAW,CAAC;AAC1B,QAAA,EAAE,oBAAoB,IAAI,6BAA6B;AACvD,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AACjD,QAAM,EAAE,MAAM,UAAU,WAAW,kBAAA,IAAsB,eAAe;AACxE,QAAM,EAAE,MAAM,MAAM,WAAW,cAAA,IAAkB,WAAW;AAC5D,QAAM,kBAAkB;AAAA,IACtB,GAAG;AAAA,IACH,kBAAkB,WAAW,oBAAoB;AAAA,EACnD;AAEA,QAAM,0BAA0B;AAAA,IAC9B,OAAO,SAAS,GAAG;AAAA,EACrB;AACA,QAAM,EAAE,MAAM,iBAAiB,QAAQ,yBAAyB;AAAA,IAC9D,eAAe;AAAA,EAAA,CAChB;AACK,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,wBAAwB;AAC1C,QAAM,EAAE,yBAAyB,WAAW,WAAA,IAC1C,mCAAmC;AAC/B,QAAA,EAAE,gBAAgB,IAAI,mBAAmB;AAE/C,YAAU,MAA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cAGjB,YACEA,kCAAA;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,MAAK;AAAA,cACL,OAAO,WAAW;AAAA,cAClB,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,cAC3C,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cAEV,UAAW,WAAA;AAAA,YAAA;AAAA,UAAA,IAKlBA,kCAAA;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,MAAK;AAAA,cACL,OAAO,eAAe;AAAA,cACtB,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,cAC3C,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cAEV,UAAe,eAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAClB,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"DictionaryDetailsForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"sourcesContent":["'use client';\n\nimport {\n DictionaryAPI,\n Dictionary as DistantDictionary,\n} from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport { ArrowUpFromLine, Download, Save, WandSparkles } from 'lucide-react';\nimport { type FC, useEffect, useMemo } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAuditContentDeclarationMetadata,\n useGetProjects,\n useGetTags,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { Loader } from '../../Loader';\nimport { MultiSelect, Select } from '../../Select';\nimport { dictionaryDetailsContent } from './dictionaryDetails.content';\nimport {\n useDictionaryDetailsSchema,\n DictionaryDetailsFormData,\n} from './useDictionaryDetailsSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: 'local' | 'remote';\n};\n\nexport const DictionaryDetailsForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { pushDictionaries } = usePushDictionaries();\n const { data: projects, isLoading: isLoadingProjects } = useGetProjects();\n const { data: tags, isLoading: isLoadingTags } = useGetTags();\n const dictionaryValue = {\n ...dictionary,\n version: dictionary.version ?? '-1',\n };\n\n const DictionaryDetailsSchema = useDictionaryDetailsSchema(\n String(project?._id)\n );\n const { form, isSubmitting } = useForm(DictionaryDetailsSchema, {\n defaultValues: dictionaryValue,\n });\n const {\n titleInput,\n keyInput,\n descriptionInput,\n publishedVersionSelect,\n publishButton,\n saveButton,\n projectInput,\n tagsSelect,\n auditButton,\n downloadButton,\n } = useDictionary(dictionaryDetailsContent);\n const { auditContentDeclaration, isLoading: isAuditing } =\n useAuditContentDeclarationMetadata();\n const { writeDictionary } = useWriteDictionary();\n\n useEffect(() => {\n form.reset(dictionaryValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dictionary, form?.reset]);\n\n const isFormEdited = form.formState.isDirty;\n const isLocalDictionary =\n typeof (dictionary as DistantDictionary)?._id === 'undefined';\n\n const onSubmitSuccess = async (data: DictionaryDetailsFormData) => {\n const updatedDictionary = {\n ...dictionary,\n ...data,\n };\n\n if (mode === 'remote') {\n await pushDictionaries([updatedDictionary]);\n } else {\n await writeDictionary(updatedDictionary);\n }\n\n setLocaleDictionary(updatedDictionary);\n };\n\n const handleOnAuditFile = async () => {\n const updatedDictionary = form.getValues();\n await auditContentDeclaration({\n fileContent: JSON.stringify({ ...dictionary, ...updatedDictionary }),\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedDictionary = JSON.parse(response.data.fileContent) as\n | Partial<Dictionary>\n | undefined;\n\n form.reset({\n ...updatedDictionary,\n ...editedDictionary,\n publishedVersion: updatedDictionary.publishedVersion ?? '-1',\n });\n } catch (error) {\n console.error(error);\n }\n });\n };\n\n const isLoading = isSubmitting || isLoadingTags;\n\n const { editedContent } = useEditedContent();\n const editedDictionary = useMemo(\n () => editedContent?.[dictionary.key],\n [editedContent, dictionary.key]\n );\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n dictionary &&\n JSON.stringify(editedDictionary.content) !==\n JSON.stringify(dictionary.content),\n [dictionary, editedDictionary]\n );\n\n return (\n <Form\n className=\"flex size-full flex-1 flex-col gap-8\"\n {...form}\n schema={DictionaryDetailsSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.EditableFieldInput\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.label.value}\n description={keyInput.description}\n disabled={isSubmitting}\n isRequired\n />\n <Form.EditableFieldInput\n name=\"title\"\n label={titleInput.label}\n placeholder={titleInput.placeholder.value}\n description={titleInput.description}\n disabled={isSubmitting}\n />\n </div>\n <Form.EditableFieldTextArea\n name=\"description\"\n label={descriptionInput.label}\n placeholder={descriptionInput.placeholder.value}\n description={descriptionInput.description}\n disabled={isSubmitting}\n />\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.MultiSelect\n name=\"projectIds\"\n label={projectInput.label.value}\n description={projectInput.description.value}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {projects?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project._id)}\n value={String(project._id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.MultiSelect\n name=\"tags\"\n label={tagsSelect.label.value}\n description={tagsSelect.description.value}\n >\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={tagsSelect.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <Loader isLoading={isLoadingProjects}>\n <MultiSelect.List>\n {tags?.data?.map((tag) => (\n <MultiSelect.Item\n key={String(tag.key)}\n value={String(tag.key)}\n >\n {tag.name ?? tag.key}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </Loader>\n </MultiSelect.Content>\n </Form.MultiSelect>\n </div>\n {((dictionary as DictionaryAPI).availableVersions?.length ?? 0) > 1 && (\n <div className=\"flex size-full flex-1 gap-8 max-md:flex-col\">\n <Form.Select\n name=\"publishedVersion\"\n description={publishedVersionSelect.description.value}\n label={publishedVersionSelect.label}\n >\n <Select.Trigger>\n <Select.Value\n placeholder={publishedVersionSelect.placeholder.value}\n />\n </Select.Trigger>\n <Select.Content>\n <Select.Item value=\"-1\">LTS</Select.Item>\n {(dictionary as DictionaryAPI).availableVersions?.map(\n (version) => (\n <Select.Item value={version} key={version}>\n {version}\n </Select.Item>\n )\n )}\n </Select.Content>\n </Form.Select>\n <div className=\"w-full\" />\n </div>\n )}\n\n <div className=\"flex flex-wrap items-center justify-end gap-2 max-md:flex-col\">\n <Form.Button\n type=\"button\"\n label={auditButton.label.value}\n Icon={WandSparkles}\n variant=\"outline\"\n color=\"text\"\n className=\"max-md:w-full\"\n onClick={handleOnAuditFile}\n disabled={isSubmitting || isAuditing}\n isLoading={isAuditing}\n >\n {auditButton.text}\n </Form.Button>\n\n {mode === 'remote' ? (\n isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={ArrowUpFromLine}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )\n ) : (\n <Form.Button\n type=\"submit\"\n label={downloadButton.label.value}\n disabled={isSubmitting || !isFormEdited || isLoading}\n Icon={Download}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isSubmitting}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n </div>\n </Form>\n );\n};\n"],"names":["editedDictionary","jsxs","jsx","project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,wBAAoD,CAAC;AAAA,EAChE;AAAA,EACA;AACF,MAAM;AACE,QAAA,EAAE,QAAQ,IAAI,QAAQ;AAC5B,QAAM,EAAE,YAAY,WAAW,CAAC;AAC1B,QAAA,EAAE,oBAAoB,IAAI,6BAA6B;AACvD,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AACjD,QAAM,EAAE,MAAM,UAAU,WAAW,kBAAA,IAAsB,eAAe;AACxE,QAAM,EAAE,MAAM,MAAM,WAAW,cAAA,IAAkB,WAAW;AAC5D,QAAM,kBAAkB;AAAA,IACtB,GAAG;AAAA,IACH,SAAS,WAAW,WAAW;AAAA,EACjC;AAEA,QAAM,0BAA0B;AAAA,IAC9B,OAAO,SAAS,GAAG;AAAA,EACrB;AACA,QAAM,EAAE,MAAM,iBAAiB,QAAQ,yBAAyB;AAAA,IAC9D,eAAe;AAAA,EAAA,CAChB;AACK,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,cAAc,wBAAwB;AAC1C,QAAM,EAAE,yBAAyB,WAAW,WAAA,IAC1C,mCAAmC;AAC/B,QAAA,EAAE,gBAAgB,IAAI,mBAAmB;AAE/C,YA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AAgB;AAAA,cAC3C,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cAEV,UAAc,cAAA;AAAA,YAAA;AAAA,cAGjB,YACEA,kCAAA;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,MAAK;AAAA,cACL,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,cAC3C,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cAEV,UAAW,WAAA;AAAA,YAAA;AAAA,UAAA,IAKlBA,kCAAA;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,MAAK;AAAA,cACL,OAAO,eAAe,MAAM;AAAA,cAC5B,UAAU,gBAAgB,CAAC,gBAAgB;AAAA,cAC3C,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cAEV,UAAe,eAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAClB,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDetailsSchema.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useDictionaryDetailsSchema.cjs","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,\n invalid_type_error: titleInvalidTypeError,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n message: titleMinLengthError,\n })\n .optional(),\n key: z\n .string({\n required_error: keyRequiredError,\n invalid_type_error: keyInvalidTypeError,\n })\n .min(4, { message: keyMinLengthError })\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 })\n .default(''),\n description: z\n .string({\n required_error: descriptionRequiredError,\n invalid_type_error: descriptionInvalidTypeError,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n required_error: requiredErrorProjectId,\n invalid_type_error: invalidTypeErrorProjectId,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n invalid_type_error: invalidTypeErrorTags,\n })\n )\n .default([]),\n publishedVersion: z.string().default('-1'),\n });\n};\n\nexport type DictionaryDetailsFormData = z.infer<\n ReturnType<typeof useDictionaryDetailsSchema>\n>;\n"],"names":["useDictionary","useDictionaryDetailsSchemaContent","z"],"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,IACEA,cAAAA,cAAcC,sFAAAA,iCAAiC;AAEnD,SAAOC,IAAAA,EAAE,OAAO;AAAA,IACd,OAAOA,MACJ,OAAO;AAAA,MACN,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IAAA,CACrB,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,SAAS;AAAA,IACV,CAAA,EACA,SAAS;AAAA,IACZ,KAAKA,MACF,OAAO;AAAA,MACN,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACrB,CAAA,EACA,IAAI,GAAG,EAAE,SAAS,kBAAkB,CAAC,EAUrC,MAAM,oBAAoB,EAAE,SAAS,cAAe,CAAA,EACpD,QAAQ,EAAE;AAAA,IACb,aAAaA,MACV,OAAO;AAAA,MACN,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACrB,CAAA,EACA,SAAS;AAAA,IACZ,YAAYA,IACT,EAAA;AAAA,MACCA,IAAAA,EAAE,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAMA,IACH,EAAA;AAAA,MACCA,IAAAA,EAAE,OAAO;AAAA,QACP,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,IACb,kBAAkBA,IAAA,EAAE,OAAO,EAAE,QAAQ,IAAI;AAAA,EAAA,CAC1C;AACH;;"}
|
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":"
|
|
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;;;;;;;;;;;;;;;;;;;;;EAmE3D,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":["
|
|
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,\n invalid_type_error: titleInvalidTypeError,\n })\n // Can be length of 0 or > 4\n .refine((val) => val.length === 0 || val.length >= 4, {\n message: titleMinLengthError,\n })\n .optional(),\n key: z\n .string({\n required_error: keyRequiredError,\n invalid_type_error: keyInvalidTypeError,\n })\n .min(4, { message: keyMinLengthError })\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 })\n .default(''),\n description: z\n .string({\n required_error: descriptionRequiredError,\n invalid_type_error: descriptionInvalidTypeError,\n })\n .optional(),\n projectIds: z\n .array(\n z.string({\n required_error: requiredErrorProjectId,\n invalid_type_error: invalidTypeErrorProjectId,\n })\n )\n .default([projectId]),\n tags: z\n .array(\n z.string({\n invalid_type_error: invalidTypeErrorTags,\n })\n )\n .default([]),\n publishedVersion: z.string().default('-1'),\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;AAAA,MAChB,oBAAoB;AAAA,IAAA,CACrB,EAEA,OAAO,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,UAAU,GAAG;AAAA,MACpD,SAAS;AAAA,IACV,CAAA,EACA,SAAS;AAAA,IACZ,KAAK,EACF,OAAO;AAAA,MACN,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACrB,CAAA,EACA,IAAI,GAAG,EAAE,SAAS,kBAAkB,CAAC,EAUrC,MAAM,oBAAoB,EAAE,SAAS,cAAe,CAAA,EACpD,QAAQ,EAAE;AAAA,IACb,aAAa,EACV,OAAO;AAAA,MACN,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACrB,CAAA,EACA,SAAS;AAAA,IACZ,YAAY,EACT;AAAA,MACC,EAAE,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAAA,EAEF,QAAQ,CAAC,SAAS,CAAC;AAAA,IACtB,MAAM,EACH;AAAA,MACC,EAAE,OAAO;AAAA,QACP,oBAAoB;AAAA,MACrB,CAAA;AAAA,IAAA,EAEF,QAAQ,CAAA,CAAE;AAAA,IACb,kBAAkB,EAAE,OAAO,EAAE,QAAQ,IAAI;AAAA,EAAA,CAC1C;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useState, type FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n mode: 'local' | 'remote';\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n mode,\n}) => {\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n {mode === 'remote' && (\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n </Container>\n )}\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useState","useDictionary","dictionaryFieldEditorContent","LocaleSwitcherContentProvider","jsxs","jsx","Button","ArrowLeft","Container","H2","DictionaryDetailsForm","SwitchSelector","NodeEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA,CAAC,YAAY,aAAa,IAAIA,WAAA;AAAA,IAClC;AAAA;AAAA,EACF;AACA,QAAM,EAAE,w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AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdN,iDAACO,4CAAAA,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbP,2BAAA,kBAAA,IAAAQ,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DR,2BAAAA,kBAAAA,IAACS,mDAAS,UAAA,EAAA,YAAwB,KAAY,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAChD,EAAA,CACF,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAa1C,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1B,CAAC;AAOF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CA8EhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useState, type FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useState, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n mode: 'local' | 'remote';\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n mode,\n}) => {\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n {mode === 'remote' && (\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} mode={mode} />\n </Container>\n )}\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} mode={mode} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA;AAAA,EACF;AACA,QA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,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdA,sCAAC,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbA,kCAAA,IAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DA,kCAAAA,IAAC,UAAS,EAAA,YAAwB,KAAY,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAChD,EAAA,CACF,EACF,CAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type Locales } from '@intlayer/config';\nimport {\n type KeyPath,\n type Dictionary,\n getContentNodeByKeyPath,\n} from '@intlayer/core';\nimport { useFocusDictionary, useEditedContent } from '@intlayer/editor-react';\nimport { RotateCcw, X } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"EditorView.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type Locales } from '@intlayer/config';\nimport {\n type KeyPath,\n type Dictionary,\n getContentNodeByKeyPath,\n} from '@intlayer/core';\nimport { useFocusDictionary, useEditedContent } from '@intlayer/editor-react';\nimport { RotateCcw, X } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { Button } from '../../Button';\nimport { EditableFieldInput } from '../../EditableField';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n locales: Locales[];\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n locales,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector, restoreButton } =\n useDictionary(editorViewContent);\n const {\n editedContent,\n renameEditedContent,\n addEditedContent,\n removeEditedContent,\n } = useEditedContent();\n\n const editedSection = editedContent?.[dictionaryKey]?.content\n ? getContentNodeByKeyPath(editedContent?.[dictionaryKey].content, keyPath)\n : undefined;\n\n const dictionarySection = getContentNodeByKeyPath(\n dictionary.content,\n keyPath\n );\n\n const section = editedSection ?? dictionarySection;\n\n const isEdited = useMemo(\n () =>\n editedSection &&\n JSON.stringify(editedSection) !== JSON.stringify(dictionarySection),\n [editedSection, dictionarySection]\n );\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionary={dictionary}\n locales={locales}\n />\n )}\n\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <div className=\"ml-auto flex gap-2\">\n {isEdited && (\n <Button\n label={restoreButton.label}\n variant=\"outline\"\n color=\"text-inverse\"\n Icon={RotateCcw}\n onClick={() => removeEditedContent(dictionaryKey, keyPath)}\n >\n {restoreButton.text}\n </Button>\n )}\n <Button\n label={deleteButton.label}\n variant=\"outline\"\n color=\"error\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n </div>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["useFocusDictionary","useDictionary","editorViewContent","useEditedContent","getContentNodeByKeyPath","useMemo","getIsEditableSection","sentenceToCamelCase","jsxs","Fragment","jsx","TextEditor","Label","EditableFieldInput","camelCaseToSentence","NodeTypeSelector","Button","RotateCcw","X"],"mappings":";;;;;;;;;;;;;;;;;;AA8BO,MAAM,aAAkC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,gBAAgB,yBAAyB,IAAIA,+BAAmB;AAClE,QAAA,UAAU,gBAAgB,WAAW,CAAC;AAC5C,QAAM,iBAAiB,QAAQ,QAAQ,SAAS,CAAC,GAAG,OAAO;AAC3D,QAAM,E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,UAAc,cAAA;AAAA,cAAA;AAAA,YACjB;AAAA,YAEFP,2BAAA,kBAAA;AAAA,cAACM,yBAAA;AAAA,cAAA;AAAA,gBACC,OAAO,aAAa;AAAA,gBACpB,SAAQ;AAAA,gBACR,OAAM;AAAA,gBACN,MAAME,YAAA;AAAA,gBACN,SAAS,MAAM;AACI,mCAAA,eAAe,QAAW,OAAO;AAElD,wBAAM,gBAA2B,QAAQ,MAAM,GAAG,EAAE;AACpD,2CAAyB,aAAa;AAAA,gBACxC;AAAA,gBAEC,UAAa,aAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB,EACF,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MA7DG,KAAK,UAAU,gBAAgB,OAAO;AAAA,IAiE7C,IAAAR,iDAAC,QAAK,EAAA,WAAU,MAAM,CAAA;AAAA,EAAA,GAE1B;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAczC,KAAK,eAAe,GAAG;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAqI1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type Locales } from '@intlayer/config';\nimport {\n type KeyPath,\n type Dictionary,\n getContentNodeByKeyPath,\n} from '@intlayer/core';\nimport { useFocusDictionary, useEditedContent } from '@intlayer/editor-react';\nimport { RotateCcw, X } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"EditorView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type Locales } from '@intlayer/config';\nimport {\n type KeyPath,\n type Dictionary,\n getContentNodeByKeyPath,\n} from '@intlayer/core';\nimport { useFocusDictionary, useEditedContent } from '@intlayer/editor-react';\nimport { RotateCcw, X } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { Button } from '../../Button';\nimport { EditableFieldInput } from '../../EditableField';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n locales: Locales[];\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n locales,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector, restoreButton } =\n useDictionary(editorViewContent);\n const {\n editedContent,\n renameEditedContent,\n addEditedContent,\n removeEditedContent,\n } = useEditedContent();\n\n const editedSection = editedContent?.[dictionaryKey]?.content\n ? getContentNodeByKeyPath(editedContent?.[dictionaryKey].content, keyPath)\n : undefined;\n\n const dictionarySection = getContentNodeByKeyPath(\n dictionary.content,\n keyPath\n );\n\n const section = editedSection ?? dictionarySection;\n\n const isEdited = useMemo(\n () =>\n editedSection &&\n JSON.stringify(editedSection) !== JSON.stringify(dictionarySection),\n [editedSection, dictionarySection]\n );\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionary={dictionary}\n locales={locales}\n />\n )}\n\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <div className=\"ml-auto flex gap-2\">\n {isEdited && (\n <Button\n label={restoreButton.label}\n variant=\"outline\"\n color=\"text-inverse\"\n Icon={RotateCcw}\n onClick={() => removeEditedContent(dictionaryKey, keyPath)}\n >\n {restoreButton.text}\n </Button>\n )}\n <Button\n label={deleteButton.label}\n variant=\"outline\"\n color=\"error\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n </div>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["jsxs","Fragment","jsx"],"mappings":";;;;;;;;;;;;;;;;AA8BO,MAAM,aAAkC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,gBAAgB,yBAAyB,IAAI,mBAAmB;AAClE,QAAA,UAAU,gBAAgB,WAAW,CAAC;AAC5C,QAAM,iBAAiB,QAAQ,QAAQ,SAAS,CAAC,GAAG,OAAO;AAC3D,QAAM,EAAE,YAAY,cAAc,kBAAkB,cAAc,IAChE,cAAc,iBAAiB;AAC3B,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,iBAAiB;AAEf,QAAA,gBAAgB,gBAAgB,aAAa,GAAG,UAClD,wBAAwB,gBAAgB,aAAa,EAAE,SAAS,OAAO,IACvE;AAEJ,QAAM,oBAAoB;AAAA,IACxB,WAAW;AAAA,IACX;AAAA,EACF;AAEA,QAAM,UAAU,iBAAiB;AAEjC,QAAM,WAAW;AAAA,IACf,MACE,iBACA,KAAK,UAAU,aAAa,MAAM,KAAK,UAAU,iBAAi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@__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
215
215
|
components_Button_Button.Button,
|
|
216
216
|
{
|
|
217
|
-
label: addNewEnumeration.label,
|
|
217
|
+
label: addNewEnumeration.label.value,
|
|
218
218
|
variant: "hoverable",
|
|
219
219
|
color: "neutral",
|
|
220
220
|
textAlign: "left",
|
|
@@ -270,7 +270,7 @@ const ArrayTextEditor = ({
|
|
|
270
270
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
271
271
|
components_Button_Button.Button,
|
|
272
272
|
{
|
|
273
|
-
label: addNewElement.label,
|
|
273
|
+
label: addNewElement.label.value,
|
|
274
274
|
variant: "hoverable",
|
|
275
275
|
color: "neutral",
|
|
276
276
|
textAlign: "left",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/TextEditor.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n type EnumerationContent,\n type TranslationContent,\n NodeType,\n type KeyPath,\n type ContentNode,\n getLocaleName,\n Dictionary,\n getSectionType,\n} from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Plus, WandSparkles, X } from 'lucide-react';\nimport {\n createElement,\n type ReactElement,\n type ReactNode,\n type FC,\n} from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport { Button } from '../../Button';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { navigationViewContent } from '../NavigationView/navigationViewNode.content';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n locales: Locales[];\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n locales,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n const { auditContentDeclarationField, isLoading: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField({\n fileContent: JSON.stringify(dictionary),\n keyPath,\n locales,\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(dictionary.key, editedContent, keyPath);\n } catch (error) {\n console.error(error);\n }\n });\n }}\n />\n }\n {...props}\n />\n );\n};\n\nconst createReactElement = (element: ReactElement) => {\n if (typeof element === 'string') {\n // If it's a string, simply return it (used for text content)\n return element;\n }\n\n const convertChildrenAsArray = (element: ReactElement): ReactElement => {\n if (element?.props && typeof element.props.children === 'object') {\n const childrenResult: ReactNode[] = [];\n const { children } = element.props;\n\n // Create the children elements recursively, if any\n Object.keys(children).forEach((key) =>\n childrenResult.push(createReactElement(children[key]))\n );\n\n return {\n ...element,\n props: { ...element.props, children: childrenResult },\n };\n }\n\n return {\n ...element,\n props: { ...element.props, children: element.props.children },\n };\n };\n\n const fixedElement = convertChildrenAsArray(element);\n\n const { type, props } = fixedElement;\n\n // Create and return the React element\n return createElement(type ?? 'div', props, ...props.children);\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n locales: Locales[];\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}: TextEditorProps) => {\n const { locale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locales, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as Locales[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {localesList.map((translationKey) => (\n <tr\n key={translationKey}\n className=\"border-text dark:border-text-dark w-full\"\n lang={translationKey}\n >\n <td className=\"flex w-full flex-col p-2\">\n {selectedLocales.length > 1 && (\n <span className=\"w-full p-2 text-xs\">\n {getLocaleName(translationKey, locale)}\n </span>\n )}\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {\n (section as TranslationContent<string>)[NodeType.Translation][\n translationKey\n ] as string\n }\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full table-fixed gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => (\n <tr\n key={enumKey}\n className=\"border-text dark:border-text-dark w-full\"\n >\n <td className=\"border-text dark:border-text-dark w-44 border-r-[1.5px] p-2\">\n <div className=\"flex gap-1\">\n <Button\n label=\"Remove\"\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n Icon={X}\n className=\"w-16\"\n onClick={() =>\n addEditedContent(dictionary.key, undefined, [\n ...keyPath,\n {\n type: NodeType.Enumeration,\n key: enumKey,\n },\n ])\n }\n />\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.key, newValue, keyPath);\n }}\n />\n </div>\n </td>\n <td className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n { type: NodeType.Enumeration, key: enumKey },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {\n (section as EnumerationContent<string>)[NodeType.Enumeration][\n enumKey as any\n ] as string\n }\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n\n <tfoot>\n <Button\n label={addNewEnumeration.label}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() =>\n addEditedContent(\n dictionary.key,\n '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }],\n false\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {(section as ContentNode[]).map((subSection, index) => (\n <tr\n key={JSON.stringify(subSection)}\n className=\"border-text dark:border-text-dark w-full\"\n >\n <td className=\"p-2\">{index}</td>\n <td className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {subSection as string}\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n <tfoot>\n <Button\n label={addNewElement.label}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as ContentNode[]).length,\n },\n ];\n addEditedContent(dictionary.key, '', newKeyPath, false);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { tsxNotEditable } = useDictionary(navigationViewContent);\n const nodeType = getSectionType(section);\n const isEditableSection = getIsEditableSection(section);\n\n if (!isEditableSection) return <></>;\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n {createReactElement(section as unknown as ReactElement)}\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {tsxNotEditable}\n </span>\n </>\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"border-text dark:border-text-dark w-full border-t-[1.5px] p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n locales={locales}\n >\n {section as string}\n </ContentEditorTextArea>\n </div>\n );\n }\n\n return <>Error loading section</>;\n};\n"],"names":["useEditedContent","useAuditContentDeclarationField","jsx","ContentEditorTextAreaBase","Button","WandSparkles","element","createElement","useLocale","useLocaleSwitcherContent","NodeType","jsxs","getLocaleName","useDictionary","navigationViewContent","X","EnumKeyInput","renameKey","Plus","getSectionType","getIsEditableSection","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAWhE,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,iBAAiB,IAAIA,6BAAiB;AAC9C,QAAM,EAAE,8BAA8B,WAAW,WAAA,IAC/CC,uBAAAA,gCAAgC;AAGhC,SAAAC,2BAAA,kBAAA;AAAA,IAACC,+CAAA;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,iBAAiB,CAAC,aAChB,iBAAiB,WAAW,KAAK,UAAU,OAAO;AAAA,MAEpD,mBACED,2BAAA,kBAAA;AAAA,QAACE,yBAAA;AAAA,QAAA;AAAA,UACC,MAAMC,YAAA;AAAA,UACN,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UACN,WAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS,MAAM;AACgB,yCAAA;AAAA,cAC3B,aAAa,KAAK,UAAU,UAAU;AAAA,cACtC;AAAA,cACA;AAAA,YAAA,CACD,EAAE,KAAK,CAAC,aAAa;AAChB,kBAAA,CAAC,SAAS,KAAM;AAEhB,kBAAA;AACI,sBAAA,gBAAgB,SAAS,KAAK;AAEnB,iCAAA,WAAW,KAAK,eAAe,OAAO;AA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MAAA,GACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,aAAa;AAEnC,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,aAAa;AAEnC,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,OAAO;AAE7B,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAGE,MAAA,aAAaQ,cAAS,MAAM;AAE5B,WAAAR,2BAAAA,kBAAAA,IAAC,OAAI,EAAA,WAAU,iEACb,UAAAA,2BAAA,kBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,cAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAAA;AAIJ,mGAAS,UAAqB,wBAAA,CAAA;AAChC;;;"}
|
|
1
|
+
{"version":3,"file":"TextEditor.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/TextEditor.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n type EnumerationContent,\n type TranslationContent,\n NodeType,\n type KeyPath,\n type ContentNode,\n getLocaleName,\n Dictionary,\n getSectionType,\n} from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { Plus, WandSparkles, X } from 'lucide-react';\nimport {\n createElement,\n type ReactElement,\n type ReactNode,\n type FC,\n} from 'react';\nimport { useDictionary, useLocale } from 'react-intlayer';\nimport { useAuditContentDeclarationField } from '../../../hooks';\nimport { renameKey } from '../../../utils/object';\nimport { Button } from '../../Button';\nimport {\n ContentEditorTextArea as ContentEditorTextAreaBase,\n ContentEditorTextAreaProps as ContentEditorTextAreaPropsBase,\n} from '../../ContentEditor/ContentEditorTextArea';\nimport { useLocaleSwitcherContent } from '../../LocaleSwitcherContentDropDown';\nimport { EnumKeyInput } from '../EnumKeyInput';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { navigationViewContent } from '../NavigationView/navigationViewNode.content';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\ntype ContentEditorTextAreaProps = Omit<\n ContentEditorTextAreaPropsBase,\n 'onContentChange'\n> & {\n keyPath: KeyPath[];\n dictionary: Dictionary;\n locales: Locales[];\n};\n\nconst ContentEditorTextArea: FC<ContentEditorTextAreaProps> = ({\n keyPath,\n dictionary,\n locales,\n ...props\n}) => {\n const { addEditedContent } = useEditedContent();\n const { auditContentDeclarationField, isLoading: isAuditing } =\n useAuditContentDeclarationField();\n\n return (\n <ContentEditorTextAreaBase\n variant=\"default\"\n onContentChange={(newValue) =>\n addEditedContent(dictionary.key, newValue, keyPath)\n }\n additionalButtons={\n <Button\n Icon={WandSparkles}\n label=\"Audit\"\n variant=\"hoverable\"\n size=\"icon-sm\"\n color=\"text\"\n className=\"cursor-pointer hover:scale-110\"\n isLoading={isAuditing}\n onClick={() => {\n auditContentDeclarationField({\n fileContent: JSON.stringify(dictionary),\n keyPath,\n locales,\n }).then((response) => {\n if (!response.data) return;\n\n try {\n const editedContent = response.data.fileContent as string;\n\n addEditedContent(dictionary.key, editedContent, keyPath);\n } catch (error) {\n console.error(error);\n }\n });\n }}\n />\n }\n {...props}\n />\n );\n};\n\nconst createReactElement = (element: ReactElement) => {\n if (typeof element === 'string') {\n // If it's a string, simply return it (used for text content)\n return element;\n }\n\n const convertChildrenAsArray = (element: ReactElement): ReactElement => {\n if (element?.props && typeof element.props.children === 'object') {\n const childrenResult: ReactNode[] = [];\n const { children } = element.props;\n\n // Create the children elements recursively, if any\n Object.keys(children).forEach((key) =>\n childrenResult.push(createReactElement(children[key]))\n );\n\n return {\n ...element,\n props: { ...element.props, children: childrenResult },\n };\n }\n\n return {\n ...element,\n props: { ...element.props, children: element.props.children },\n };\n };\n\n const fixedElement = convertChildrenAsArray(element);\n\n const { type, props } = fixedElement;\n\n // Create and return the React element\n return createElement(type ?? 'div', props, ...props.children);\n};\n\nexport type TextEditorProps = {\n dictionary: Dictionary;\n keyPath: KeyPath[];\n section: ContentNode;\n locales: Locales[];\n};\n\nconst TranslationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}: TextEditorProps) => {\n const { locale } = useLocale();\n const { selectedLocales, availableLocales } = useLocaleSwitcherContent();\n\n const sectionContent = (section as TranslationContent<string>)[\n NodeType.Translation\n ] as Record<Locales, string>;\n\n const sectionContentKeys = Object.keys(sectionContent) as Locales[];\n\n const isFiltered = availableLocales.length > selectedLocales.length;\n\n const localesList = isFiltered\n ? selectedLocales\n : // If the translation include content in other locales, we display all of them\n [...new Set([...availableLocales, ...sectionContentKeys])];\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {localesList.map((translationKey) => (\n <tr\n key={translationKey}\n className=\"border-text dark:border-text-dark w-full\"\n lang={translationKey}\n >\n <td className=\"flex w-full flex-col p-2\">\n {selectedLocales.length > 1 && (\n <span className=\"w-full p-2 text-xs\">\n {getLocaleName(translationKey, locale)}\n </span>\n )}\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n { type: NodeType.Translation, key: translationKey },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {\n (section as TranslationContent<string>)[NodeType.Translation][\n translationKey\n ] as string\n }\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nconst EnumerationTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewEnumeration } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full table-fixed gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {Object.keys(\n (section as EnumerationContent<ContentNode>)[NodeType.Enumeration]\n ).map((enumKey) => (\n <tr\n key={enumKey}\n className=\"border-text dark:border-text-dark w-full\"\n >\n <td className=\"border-text dark:border-text-dark w-44 border-r-[1.5px] p-2\">\n <div className=\"flex gap-1\">\n <Button\n label=\"Remove\"\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n Icon={X}\n className=\"w-16\"\n onClick={() =>\n addEditedContent(dictionary.key, undefined, [\n ...keyPath,\n {\n type: NodeType.Enumeration,\n key: enumKey,\n },\n ])\n }\n />\n <EnumKeyInput\n value={enumKey}\n onChange={(value) => {\n const preValueContent = (\n section as EnumerationContent<string>\n )[NodeType.Enumeration];\n const newValueContent = renameKey(\n preValueContent,\n enumKey as keyof typeof preValueContent,\n value\n );\n const newValue = {\n ...(section as EnumerationContent<string>),\n [NodeType.Enumeration]: newValueContent,\n };\n\n addEditedContent(dictionary.key, newValue, keyPath);\n }}\n />\n </div>\n </td>\n <td className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n { type: NodeType.Enumeration, key: enumKey },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {\n (section as EnumerationContent<string>)[NodeType.Enumeration][\n enumKey as any\n ] as string\n }\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n\n <tfoot>\n <Button\n label={addNewEnumeration.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() =>\n addEditedContent(\n dictionary.key,\n '',\n [...keyPath, { type: NodeType.Enumeration, key: 'unknown' }],\n false\n )\n }\n Icon={Plus}\n className=\"m-2\"\n >\n {addNewEnumeration.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nconst ArrayTextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { addEditedContent } = useEditedContent();\n const { addNewElement } = useDictionary(navigationViewContent);\n\n return (\n <table className=\"w-full gap-2\">\n <tbody className=\"divide-y-[1.5px]\">\n {(section as unknown as ContentNode[]).map((subSection, index) => (\n <tr\n key={JSON.stringify(subSection)}\n className=\"border-text dark:border-text-dark w-full\"\n >\n <td className=\"p-2\">{index}</td>\n <td className=\"w-full p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={[\n ...keyPath,\n {\n type: NodeType.Array,\n key: index,\n },\n ]}\n dictionary={dictionary}\n locales={locales}\n >\n {subSection as string}\n </ContentEditorTextArea>\n </td>\n </tr>\n ))}\n </tbody>\n <tfoot>\n <Button\n label={addNewElement.label.value}\n variant=\"hoverable\"\n color=\"neutral\"\n textAlign=\"left\"\n onClick={() => {\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeType.Array,\n key: (section as unknown as ContentNode[]).length,\n },\n ];\n addEditedContent(dictionary.key, '', newKeyPath, false);\n }}\n Icon={Plus}\n >\n {addNewElement.text}\n </Button>\n </tfoot>\n </table>\n );\n};\n\nexport const TextEditor: FC<TextEditorProps> = ({\n section,\n keyPath,\n dictionary,\n locales,\n}) => {\n const { tsxNotEditable } = useDictionary(navigationViewContent);\n const nodeType = getSectionType(section);\n const isEditableSection = getIsEditableSection(section);\n\n if (!isEditableSection) return <></>;\n\n if (typeof section === 'object') {\n if (nodeType === NodeType.ReactNode) {\n return (\n <>\n {createReactElement(section as unknown as ReactElement)}\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n {tsxNotEditable}\n </span>\n </>\n );\n }\n\n if (nodeType === NodeType.Translation) {\n return (\n <TranslationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n\n if (nodeType === NodeType.Enumeration) {\n return (\n <EnumerationTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n\n if (nodeType === NodeType.Array) {\n return (\n <ArrayTextEditor\n dictionary={dictionary}\n keyPath={keyPath}\n section={section}\n locales={locales}\n />\n );\n }\n }\n\n if (nodeType === NodeType.Text) {\n return (\n <div className=\"border-text dark:border-text-dark w-full border-t-[1.5px] p-2\">\n <ContentEditorTextArea\n variant=\"default\"\n aria-label=\"Edit field\"\n keyPath={keyPath}\n dictionary={dictionary}\n locales={locales}\n >\n {section as string}\n </ContentEditorTextArea>\n </div>\n );\n }\n\n return <>Error loading section</>;\n};\n"],"names":["useEditedContent","useAuditContentDeclarationField","jsx","ContentEditorTextAreaBase","Button","WandSparkles","element","createElement","useLocale","useLocaleSwitcherContent","NodeType","jsxs","getLocaleName","useDictionary","navigationViewContent","X","EnumKeyInput","renameKey","Plus","getSectionType","getIsEditableSection","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,YAAsB,CAAC,YAAY,MAAM,UAAU;AAWhE,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,iBAAiB,IAAIA,6BAAiB;AAC9C,QAAM,EAAE,8BAA8B,WAAW,WAAA,IAC/CC,uBAAAA,gCAAgC;AAGhC,SAAAC,2BAAA,kBAAA;AAAA,IAACC,+CAAA;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,iBAAiB,CAAC,aAChB,iBAAiB,WAAW,KAAK,UAAU,OAAO;AAAA,MAEpD,mBACED,2BAAA,kBAAA;AAAA,QAACE,yBAAA;AAAA,QAAA;AAAA,UACC,MAAMC,YAAA;AAAA,UACN,OAAM;AAAA,UACN,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UACN,WAAU;AAAA,UACV,WAAW;AAAA,UACX,SAAS,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BAAAA,UAAA,CAAA,CAAA;AAE7B,MAAA,OAAO,YAAY,UAAU;AAC3B,QAAA,aAAaX,cAAS,WAAW;AACnC,aAEKC,2BAAA,kBAAA,KAAAU,uCAAA,EAAA,UAAA;AAAA,QAAA,mBAAmB,OAAkC;AAAA,QACrDnB,2BAAA,kBAAA,IAAA,QAAA,EAAK,WAAU,+CACb,UACH,eAAA,CAAA;AAAA,MAAA,GACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,aAAa;AAEnC,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,aAAa;AAEnC,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAIA,QAAA,aAAaQ,cAAS,OAAO;AAE7B,aAAAR,2BAAA,kBAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAGE,MAAA,aAAaQ,cAAS,MAAM;AAE5B,WAAAR,2BAAAA,kBAAAA,IAAC,OAAI,EAAA,WAAU,iEACb,UAAAA,2BAAA,kBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,cAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QAEC,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EAAA;AAIJ,mGAAS,UAAqB,wBAAA,CAAA;AAChC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/TextEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,UAAU,EAEX,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAIL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/TextEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,UAAU,EAEX,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAIL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAcf,eAAO,MAAM,SAAS,EAAE,MAAM,EAAmC,CAAC;AAgGlE,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAuOF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2E1C,CAAC"}
|
|
@@ -212,7 +212,7 @@ const EnumerationTextEditor = ({
|
|
|
212
212
|
/* @__PURE__ */ jsxRuntimeExports.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
213
213
|
Button,
|
|
214
214
|
{
|
|
215
|
-
label: addNewEnumeration.label,
|
|
215
|
+
label: addNewEnumeration.label.value,
|
|
216
216
|
variant: "hoverable",
|
|
217
217
|
color: "neutral",
|
|
218
218
|
textAlign: "left",
|
|
@@ -268,7 +268,7 @@ const ArrayTextEditor = ({
|
|
|
268
268
|
/* @__PURE__ */ jsxRuntimeExports.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
269
269
|
Button,
|
|
270
270
|
{
|
|
271
|
-
label: addNewElement.label,
|
|
271
|
+
label: addNewElement.label.value,
|
|
272
272
|
variant: "hoverable",
|
|
273
273
|
color: "neutral",
|
|
274
274
|
textAlign: "left",
|