@intlayer/design-system 6.0.0-canary.3 → 6.0.0
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/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +3 -3
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +8 -5
- 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 +8 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +1 -8
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +1 -8
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/hooks/reactQuery.d.ts +10 -10
- package/package.json +18 -17
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs
CHANGED
|
@@ -23,7 +23,7 @@ const DictionaryCreationForm = ({
|
|
|
23
23
|
const { session } = hooks_useAuth_useAuth.useAuth();
|
|
24
24
|
const { project } = session ?? {};
|
|
25
25
|
const { mutate: addDictionary, isPending } = hooks_reactQuery.useAddDictionary();
|
|
26
|
-
const { data:
|
|
26
|
+
const { data: projectsData } = hooks_reactQuery.useGetProjects();
|
|
27
27
|
const DictionarySchema = components_DictionaryFieldEditor_DictionaryCreationForm_useDictionaryFormSchema.useDictionarySchema(String(project?.id));
|
|
28
28
|
const { form, isSubmitting } = components_Form_FormBase.useForm(DictionarySchema);
|
|
29
29
|
const { keyInput, createDictionaryButton, projectInput } = reactIntlayer.useIntlayer("dictionary-form");
|
|
@@ -58,11 +58,11 @@ const DictionaryCreationForm = ({
|
|
|
58
58
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
59
|
components_Select_Multiselect.MultiSelect.Trigger,
|
|
60
60
|
{
|
|
61
|
-
getBadgeValue: (value) =>
|
|
61
|
+
getBadgeValue: (value) => projectsData?.data?.find((project2) => String(project2.id) === value)?.name ?? value,
|
|
62
62
|
children: /* @__PURE__ */ jsxRuntime.jsx(components_Select_Multiselect.MultiSelect.Input, { placeholder: projectInput.placeholder.value })
|
|
63
63
|
}
|
|
64
64
|
),
|
|
65
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_Select_Multiselect.MultiSelect.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_Select_Multiselect.MultiSelect.List, { children:
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_Select_Multiselect.MultiSelect.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_Select_Multiselect.MultiSelect.List, { children: projectsData?.data?.map((project2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
66
|
components_Select_Multiselect.MultiSelect.Item,
|
|
67
67
|
{
|
|
68
68
|
value: String(project2.id),
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { useAddDictionary, useGetProjects } from '../../../hooks/reactQuery';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor } from '../../Button';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data:
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { useAddDictionary, useGetProjects } from '../../../hooks/reactQuery';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor } from '../../Button';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data: projectsData } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?.id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } =\n useIntlayer('dictionary-form');\n\n const onSubmitSuccess = (data: DictionaryFormData) => {\n addDictionary(\n { dictionary: data },\n {\n onSuccess: () => {\n onDictionaryCreated?.();\n },\n }\n );\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px] m-auto\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projectsData?.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 <MultiSelect.List>\n {projectsData?.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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color={ButtonColor.TEXT}\n isLoading={isSubmitting || isPending}\n label={createDictionaryButton.ariaLabel.value}\n isFullWidth\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["useAuth","useAddDictionary","useGetProjects","useDictionarySchema","useForm","useIntlayer","jsxs","Form","jsx","MultiSelect","project","ButtonColor"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM;AACJ,QAAM,EAAE,QAAA,IAAYA,8BAAA;AACpB,QAAM,EAAE,YAAY,WAAW,CAAA;AAC/B,QAAM,EAAE,QAAQ,eAAe,UAAA,IAAcC,iBAAAA,iBAAA;AAC7C,QAAM,EAAE,MAAM,aAAA,IAAiBC,gCAAA;AAC/B,QAAM,mBAAmBC,gFAAAA,oBAAoB,OAAO,SAAS,EAAE,CAAC;AAChE,QAAM,EAAE,MAAM,iBAAiBC,yBAAAA,QAAQ,gBAAgB;AACvD,QAAM,EAAE,UAAU,wBAAwB,aAAA,IACxCC,cAAAA,YAAY,iBAAiB;AAE/B,QAAM,kBAAkB,CAAC,SAA6B;AACpD;AAAA,MACE,EAAE,YAAY,KAAA;AAAA,MACd;AAAA,QACE,WAAW,MAAM;AACf,gCAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAEA,SACEC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AAA,YAEV,UAAA,uBAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -21,7 +21,7 @@ const DictionaryCreationForm = ({
|
|
|
21
21
|
const { session } = useAuth();
|
|
22
22
|
const { project } = session ?? {};
|
|
23
23
|
const { mutate: addDictionary, isPending } = useAddDictionary();
|
|
24
|
-
const { data:
|
|
24
|
+
const { data: projectsData } = useGetProjects();
|
|
25
25
|
const DictionarySchema = useDictionarySchema(String(project?.id));
|
|
26
26
|
const { form, isSubmitting } = useForm(DictionarySchema);
|
|
27
27
|
const { keyInput, createDictionaryButton, projectInput } = useIntlayer("dictionary-form");
|
|
@@ -56,11 +56,11 @@ const DictionaryCreationForm = ({
|
|
|
56
56
|
/* @__PURE__ */ jsx(
|
|
57
57
|
MultiSelect.Trigger,
|
|
58
58
|
{
|
|
59
|
-
getBadgeValue: (value) =>
|
|
59
|
+
getBadgeValue: (value) => projectsData?.data?.find((project2) => String(project2.id) === value)?.name ?? value,
|
|
60
60
|
children: /* @__PURE__ */ jsx(MultiSelect.Input, { placeholder: projectInput.placeholder.value })
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
|
-
/* @__PURE__ */ jsx(MultiSelect.Content, { children: /* @__PURE__ */ jsx(MultiSelect.List, { children:
|
|
63
|
+
/* @__PURE__ */ jsx(MultiSelect.Content, { children: /* @__PURE__ */ jsx(MultiSelect.List, { children: projectsData?.data?.map((project2) => /* @__PURE__ */ jsx(
|
|
64
64
|
MultiSelect.Item,
|
|
65
65
|
{
|
|
66
66
|
value: String(project2.id),
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { useAddDictionary, useGetProjects } from '../../../hooks/reactQuery';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor } from '../../Button';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data:
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { useAddDictionary, useGetProjects } from '../../../hooks/reactQuery';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { ButtonColor } from '../../Button';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data: projectsData } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?.id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } =\n useIntlayer('dictionary-form');\n\n const onSubmitSuccess = (data: DictionaryFormData) => {\n addDictionary(\n { dictionary: data },\n {\n onSuccess: () => {\n onDictionaryCreated?.();\n },\n }\n );\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px] m-auto\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label.value}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projectsData?.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 <MultiSelect.List>\n {projectsData?.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 </MultiSelect.Content>\n </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color={ButtonColor.TEXT}\n isLoading={isSubmitting || isPending}\n label={createDictionaryButton.ariaLabel.value}\n isFullWidth\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["project"],"mappings":";;;;;;;;;;;;;;;;;AAkBO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM;AACJ,QAAM,EAAE,QAAA,IAAY,QAAA;AACpB,QAAM,EAAE,YAAY,WAAW,CAAA;AAC/B,QAAM,EAAE,QAAQ,eAAe,UAAA,IAAc,iBAAA;AAC7C,QAAM,EAAE,MAAM,aAAA,IAAiB,eAAA;AAC/B,QAAM,mBAAmB,oBAAoB,OAAO,SAAS,EAAE,CAAC;AAChE,QAAM,EAAE,MAAM,iBAAiB,QAAQ,gBAAgB;AACvD,QAAM,EAAE,UAAU,wBAAwB,aAAA,IACxC,YAAY,iBAAiB;AAE/B,QAAM,kBAAkB,CAAC,SAA6B;AACpD;AAAA,MACE,EAAE,YAAY,KAAA;AAAA,MACd;AAAA,QACE,WAAW,MAAM;AACf,gCAAA;AAAA,QACF;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@@ const SaveForm = ({
|
|
|
81
81
|
};
|
|
82
82
|
const handleDeleteDictionary = () => {
|
|
83
83
|
if (!dictionary.id) return;
|
|
84
|
-
deleteDictionary(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
deleteDictionary(
|
|
85
|
+
dictionary.id.toString(),
|
|
86
|
+
{
|
|
87
|
+
onSuccess: (res) => {
|
|
88
|
+
if (res) {
|
|
89
|
+
onDelete?.();
|
|
90
|
+
}
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
|
-
|
|
93
|
+
);
|
|
91
94
|
};
|
|
92
95
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
93
96
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Modal, ModalSize } from '../../../components/Modal';\nimport {\n useAuth,\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Form } from '../../Form';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { mutate: deleteDictionary, isPending: isDeleting } =\n useDeleteDictionary();\n const { mutate: writeDictionary, isPending: isWriting } =\n useWriteDictionary();\n const { mutate: pushDictionaries, isPending: isPushing } =\n usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useIntlayer('save-dictionary-details');\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.localId!];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as DistantDictionary)?.id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n writeDictionary(\n {\n dictionary: updatedDictionary,\n },\n {\n onSuccess: () => {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n },\n }\n );\n };\n\n const handlePushDictionary = () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n pushDictionaries([updatedDictionary], {\n onSuccess: (res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n }\n },\n });\n };\n\n const handleDeleteDictionary = () => {\n if (!(dictionary as DistantDictionary).id) return;\n\n deleteDictionary((dictionary as DistantDictionary).id.toString(), {\n onSuccess: (res) => {\n if (res) {\n onDelete?.();\n }\n },\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size={ModalSize.MD}\n >\n <form className=\"size-full px-3\">\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n variant={ButtonVariant.OUTLINE}\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color={ButtonColor.ERROR}\n variant={ButtonVariant.OUTLINE}\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.localId!)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color={ButtonColor.TEXT}\n variant={\n isAuthenticated ? ButtonVariant.OUTLINE : ButtonVariant.DEFAULT\n }\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":["useState","useDictionariesRecordActions","useDeleteDictionary","useWriteDictionary","usePushDictionaries","useEditedContent","useIntlayer","useAuth","jsxs","Fragment","jsx","Modal","ModalSize","Form","ButtonColor","ButtonVariant","Save","cn","Trash","RotateCcw","Download","ArrowUpFromLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAIA,aAAAA,SAAS,KAAK;AAC1E,QAAM,EAAE,oBAAA,IAAwBC,yCAAA;AAChC,QAAM,EAAE,QAAQ,kBAAkB,WAAW,WAAA,IAC3CC,iBAAAA,oBAAA;AACF,QAAM,EAAE,QAAQ,iBAAiB,WAAW,UAAA,IAC1CC,iBAAAA,mBAAA;AACF,QAAM,EAAE,QAAQ,kBAAkB,WAAW,UAAA,IAC3CC,iBAAAA,oBAAA;AACF,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAA,IAAyBC,6BAAA;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEC,cAAAA,YAAY,yBAAyB;AACzC,QAAM,EAAE,gBAAA,IAAoBC,8BAAA;AAE5B,QAAM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,YAACG,sCAAAA,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAMG,YAAAA;AAAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAA,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Modal, ModalSize } from '../../../components/Modal';\nimport {\n useAuth,\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Form } from '../../Form';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { mutate: deleteDictionary, isPending: isDeleting } =\n useDeleteDictionary();\n const { mutate: writeDictionary, isPending: isWriting } =\n useWriteDictionary();\n const { mutate: pushDictionaries, isPending: isPushing } =\n usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useIntlayer('save-dictionary-details');\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.localId!];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as unknown as DistantDictionary)?.id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n writeDictionary(\n {\n dictionary: updatedDictionary,\n },\n {\n onSuccess: () => {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n },\n }\n );\n };\n\n const handlePushDictionary = () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n pushDictionaries([updatedDictionary], {\n onSuccess: (res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n }\n },\n });\n };\n\n const handleDeleteDictionary = () => {\n if (!(dictionary as unknown as DistantDictionary).id) return;\n\n deleteDictionary(\n (dictionary as unknown as DistantDictionary).id.toString(),\n {\n onSuccess: (res) => {\n if (res) {\n onDelete?.();\n }\n },\n }\n );\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size={ModalSize.MD}\n >\n <form className=\"size-full px-3\">\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n variant={ButtonVariant.OUTLINE}\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color={ButtonColor.ERROR}\n variant={ButtonVariant.OUTLINE}\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.localId!)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color={ButtonColor.TEXT}\n variant={\n isAuthenticated ? ButtonVariant.OUTLINE : ButtonVariant.DEFAULT\n }\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":["useState","useDictionariesRecordActions","useDeleteDictionary","useWriteDictionary","usePushDictionaries","useEditedContent","useIntlayer","useAuth","jsxs","Fragment","jsx","Modal","ModalSize","Form","ButtonColor","ButtonVariant","Save","cn","Trash","RotateCcw","Download","ArrowUpFromLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAIA,aAAAA,SAAS,KAAK;AAC1E,QAAM,EAAE,oBAAA,IAAwBC,yCAAA;AAChC,QAAM,EAAE,QAAQ,kBAAkB,WAAW,WAAA,IAC3CC,iBAAAA,oBAAA;AACF,QAAM,EAAE,QAAQ,iBAAiB,WAAW,UAAA,IAC1CC,iBAAAA,mBAAA;AACF,QAAM,EAAE,QAAQ,kBAAkB,WAAW,UAAA,IAC3CC,iBAAAA,oBAAA;AACF,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAA,IAAyBC,6BAAA;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACEC,cAAAA,YAAY,yBAAyB;AACzC,QAAM,EAAE,gBAAA,IAAoBC,8BAAA;AAE5B,QAAM,mBAAmB,gBAAgB,WAAW,OAAQ;AAE5D,QAAM,WACJ,oBACA,KAAK,UAAU,gBAAgB,MAAM,KAAK,UAAU,UAAU;AAEhE,QAAM,sBACJ,OAAQ,YAA6C,OAAO;AAE9D,QAAM,mCAAmC,YAAY;AACn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U;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAA,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAYjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,kBAAkB,EAExB,MAAM,OAAO,CAAC;AAaf,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAYjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,kBAAkB,EAExB,MAAM,OAAO,CAAC;AAaf,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,sBAAsB,CA+M/C,CAAC"}
|
|
@@ -79,13 +79,16 @@ const SaveForm = ({
|
|
|
79
79
|
};
|
|
80
80
|
const handleDeleteDictionary = () => {
|
|
81
81
|
if (!dictionary.id) return;
|
|
82
|
-
deleteDictionary(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
deleteDictionary(
|
|
83
|
+
dictionary.id.toString(),
|
|
84
|
+
{
|
|
85
|
+
onSuccess: (res) => {
|
|
86
|
+
if (res) {
|
|
87
|
+
onDelete?.();
|
|
88
|
+
}
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
);
|
|
89
92
|
};
|
|
90
93
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
94
|
/* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Modal, ModalSize } from '../../../components/Modal';\nimport {\n useAuth,\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Form } from '../../Form';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { mutate: deleteDictionary, isPending: isDeleting } =\n useDeleteDictionary();\n const { mutate: writeDictionary, isPending: isWriting } =\n useWriteDictionary();\n const { mutate: pushDictionaries, isPending: isPushing } =\n usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useIntlayer('save-dictionary-details');\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.localId!];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as DistantDictionary)?.id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n writeDictionary(\n {\n dictionary: updatedDictionary,\n },\n {\n onSuccess: () => {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n },\n }\n );\n };\n\n const handlePushDictionary = () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n pushDictionaries([updatedDictionary], {\n onSuccess: (res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n }\n },\n });\n };\n\n const handleDeleteDictionary = () => {\n if (!(dictionary as DistantDictionary).id) return;\n\n deleteDictionary((dictionary as DistantDictionary).id.toString(), {\n onSuccess: (res) => {\n if (res) {\n onDelete?.();\n }\n },\n });\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size={ModalSize.MD}\n >\n <form className=\"size-full px-3\">\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n variant={ButtonVariant.OUTLINE}\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color={ButtonColor.ERROR}\n variant={ButtonVariant.OUTLINE}\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.localId!)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color={ButtonColor.TEXT}\n variant={\n isAuthenticated ? ButtonVariant.OUTLINE : ButtonVariant.DEFAULT\n }\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,KAAK;AAC1E,QAAM,EAAE,oBAAA,IAAwB,6BAAA;AAChC,QAAM,EAAE,QAAQ,kBAAkB,WAAW,WAAA,IAC3C,oBAAA;AACF,QAAM,EAAE,QAAQ,iBAAiB,WAAW,UAAA,IAC1C,mBAAA;AACF,QAAM,EAAE,QAAQ,kBAAkB,WAAW,UAAA,IAC3C,oBAAA;AACF,QAAM,YAAY,aAAa;AAE/B,QAAM,EAAE,eAAe,qBAAA,IAAyB,iBAAA;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,YAAY,yBAAyB;AACzC,QAAM,EAAE,gBAAA,IAAoB,QAAA;AAE5B,QAAM,mBAAmB,gBAAgB,WAAW,OAAQ;AAE5D,QAAM,WACJ,oBACA,KAAK,UAAU,gBAAgB,MAAM,KAAK,UAAU,UAAU;AAEhE,QAAM,sBACJ,OAAQ,YAAkC,OAAO;AAEnD,QAAM,mCAA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,YAAY;AAAA,YAAA;AAAA,UAAA;AAAA,UAGhB,KAAK,SAAS,OAAO,KACpB;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,eAAe,MAAM;AAAA,cAC5B,UAAU,CAAC,YAAY;AAAA,cACvB,MAAM;AAAA,cACN,OAAO,YAAY;AAAA,cACnB,SACE,kBAAkB,cAAc,UAAU,cAAc;AAAA,cAE1D,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS,MAAM,0BAA0B,IAAI;AAAA,cAE5C,UAAA,eAAe;AAAA,YAAA;AAAA,UAAA;AAAA,UAGnB,KAAK,SAAS,QAAQ,KAAK,mBAAmB,CAAC,uBAC9C;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,cAAc,MAAM;AAAA,cAC3B,UAAU;AAAA,cACV,MAAM;AAAA,cACN,OAAO,YAAY;AAAA,cACnB,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAA,cAAc;AAAA,YAAA;AAAA,UAAA;AAAA,UAGlB,KAAK,SAAS,QAAQ,KACrB,mBACA,uBACA,YACE;AAAA,YAAC,KAAK;AAAA,YAAL;AAAA,cACC,OAAO,WAAW,MAAM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAA,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n useDictionariesRecordActions,\n useEditedContent,\n} from '@intlayer/editor-react';\nimport {\n ArrowUpFromLine,\n Download,\n RotateCcw,\n Save,\n Trash,\n} from 'lucide-react';\nimport {\n type DetailedHTMLProps,\n type FC,\n type FormHTMLAttributes,\n useState,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Modal, ModalSize } from '../../../components/Modal';\nimport {\n useAuth,\n useDeleteDictionary,\n usePushDictionaries,\n useWriteDictionary,\n} from '../../../hooks';\nimport { cn } from '../../../utils/cn';\nimport { ButtonColor, ButtonVariant } from '../../Button';\nimport { Form } from '../../Form';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n mode: ('local' | 'remote')[];\n onDelete?: () => void;\n} & DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({\n dictionary,\n mode,\n className,\n onDelete,\n ...props\n}) => {\n const [isFormatAlertModalOpen, setIsFormatAlertModalOpen] = useState(false);\n const { setLocaleDictionary } = useDictionariesRecordActions();\n const { mutate: deleteDictionary, isPending: isDeleting } =\n useDeleteDictionary();\n const { mutate: writeDictionary, isPending: isWriting } =\n useWriteDictionary();\n const { mutate: pushDictionaries, isPending: isPushing } =\n usePushDictionaries();\n const isLoading = isWriting || isPushing;\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const {\n deleteButton,\n resetButton,\n saveButton,\n publishButton,\n downloadButton,\n confirmation,\n } = useIntlayer('save-dictionary-details');\n const { isAuthenticated } = useAuth();\n\n const editedDictionary = editedContent?.[dictionary.localId!];\n\n const isEdited =\n editedDictionary &&\n JSON.stringify(editedDictionary) !== JSON.stringify(dictionary);\n\n const isDistantDictionary =\n typeof (dictionary as unknown as DistantDictionary)?.id !== 'undefined';\n\n const handleSaveDictionaryConfirmation = async () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n writeDictionary(\n {\n dictionary: updatedDictionary,\n },\n {\n onSuccess: () => {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n },\n }\n );\n };\n\n const handlePushDictionary = () => {\n if (!editedContent?.[dictionary.localId!]) return;\n\n const updatedDictionary = {\n ...dictionary,\n ...editedContent?.[dictionary.localId!],\n };\n\n pushDictionaries([updatedDictionary], {\n onSuccess: (res) => {\n if (res) {\n setLocaleDictionary(editedContent?.[dictionary.localId!]);\n restoreEditedContent(dictionary.localId!);\n }\n },\n });\n };\n\n const handleDeleteDictionary = () => {\n if (!(dictionary as unknown as DistantDictionary).id) return;\n\n deleteDictionary(\n (dictionary as unknown as DistantDictionary).id.toString(),\n {\n onSuccess: (res) => {\n if (res) {\n onDelete?.();\n }\n },\n }\n );\n };\n\n return (\n <>\n <Modal\n isOpen={isFormatAlertModalOpen}\n title={confirmation.title.value}\n size={ModalSize.MD}\n >\n <form className=\"size-full px-3\">\n <p className=\"text-neutral py-4 text-sm\">{confirmation.message}</p>\n\n <div className=\"mt-12 flex justify-end gap-2 max-md:flex-col\">\n <Form.Button\n label={confirmation.cancelButton.label.value}\n disabled={!isEdited || isLoading}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n variant={ButtonVariant.OUTLINE}\n onClick={() => setIsFormatAlertModalOpen(false)}\n >\n {confirmation.cancelButton.text}\n </Form.Button>\n <Form.Button\n label={confirmation.confirmButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handleSaveDictionaryConfirmation}\n >\n {confirmation.confirmButton.text}\n </Form.Button>\n </div>\n </form>\n </Modal>\n <form\n className={cn('flex justify-end gap-2 max-md:flex-col', className)}\n {...props}\n >\n {mode.includes('remote') &&\n isDistantDictionary &&\n onDelete &&\n isAuthenticated && (\n <Form.Button\n label={deleteButton.label.value}\n Icon={Trash}\n color={ButtonColor.ERROR}\n variant={ButtonVariant.OUTLINE}\n className=\"max-md:w-full\"\n isLoading={isDeleting}\n onClick={handleDeleteDictionary}\n >\n {deleteButton.text}\n </Form.Button>\n )}\n {isEdited && (\n <Form.Button\n label={resetButton.label.value}\n disabled={!isEdited}\n Icon={RotateCcw}\n variant={ButtonVariant.OUTLINE}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n onClick={() => restoreEditedContent(dictionary.localId!)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {mode.includes('local') && (\n <Form.Button\n label={downloadButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Download}\n color={ButtonColor.TEXT}\n variant={\n isAuthenticated ? ButtonVariant.OUTLINE : ButtonVariant.DEFAULT\n }\n className=\"max-md:w-full\"\n isLoading={isWriting}\n onClick={() => setIsFormatAlertModalOpen(true)}\n >\n {downloadButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') && isAuthenticated && !isDistantDictionary && (\n <Form.Button\n label={publishButton.label.value}\n disabled={isLoading}\n Icon={ArrowUpFromLine}\n color={ButtonColor.TEXT}\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {publishButton.text}\n </Form.Button>\n )}\n {mode.includes('remote') &&\n isAuthenticated &&\n isDistantDictionary &&\n isEdited && (\n <Form.Button\n label={saveButton.label.value}\n disabled={!isEdited || isLoading}\n Icon={Save}\n color=\"text\"\n className=\"max-md:w-full\"\n isLoading={isPushing}\n onClick={handlePushDictionary}\n >\n {saveButton.text}\n </Form.Button>\n )}\n </form>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,WAAuC,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,KAAK;AAC1E,QAAM,EAAE,oBAAA,IAAwB,6BAAA;AAChC,QAAM,EAAE,QAAQ,kBAAkB,WAAW,WAAA,IAC3C,oBAAA;AACF,QAAM,EAAE,QAAQ,iBAAiB,WAAW,UAAA,IAC1C,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AM;AAAA,cACxB,UAAU,CAAC,YAAY;AAAA,cACvB,MAAM;AAAA,cACN,OAAM;AAAA,cACN,WAAU;AAAA,cACV,WAAW;AAAA,cACX,SAAS;AAAA,cAER,UAAA,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEN,GACF;AAEJ;"}
|
|
@@ -8,14 +8,7 @@ const StructureEditor = ({ dictionary }) => {
|
|
|
8
8
|
const { content, key, localId } = dictionary;
|
|
9
9
|
const { editedContent } = editorReact.useEditedContent();
|
|
10
10
|
const initialSection = typeof editedContent?.[localId]?.content === "undefined" ? content : editedContent?.[localId]?.content;
|
|
11
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
-
components_DictionaryFieldEditor_StructureView_StructureView.NodeView,
|
|
13
|
-
{
|
|
14
|
-
section: initialSection,
|
|
15
|
-
keyPath: [],
|
|
16
|
-
dictionaryKey: dictionary.key
|
|
17
|
-
}
|
|
18
|
-
);
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_DictionaryFieldEditor_StructureView_StructureView.NodeView, { section: initialSection, keyPath: [], dictionaryKey: key });
|
|
19
12
|
};
|
|
20
13
|
exports.StructureEditor = StructureEditor;
|
|
21
14
|
//# sourceMappingURL=StructureEditor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { type FC } from 'react';\nimport { NodeView } from './StructureView/StructureView';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n};\n\nexport const StructureEditor: FC<NodeEditorProps> = ({ dictionary }) => {\n const { content, key, localId } = dictionary;\n\n const { editedContent } = useEditedContent();\n const initialSection =\n typeof editedContent?.[localId!]?.content === 'undefined'\n ? content\n : editedContent?.[localId!]?.content;\n\n return
|
|
1
|
+
{"version":3,"file":"StructureEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { type FC } from 'react';\nimport { NodeView } from './StructureView/StructureView';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n};\n\nexport const StructureEditor: FC<NodeEditorProps> = ({ dictionary }) => {\n const { content, key, localId } = dictionary;\n\n const { editedContent } = useEditedContent();\n const initialSection =\n typeof editedContent?.[localId!]?.content === 'undefined'\n ? content\n : editedContent?.[localId!]?.content;\n\n return <NodeView section={initialSection} keyPath={[]} dictionaryKey={key} />;\n};\n"],"names":["useEditedContent","jsx","NodeView"],"mappings":";;;;;;AAWO,MAAM,kBAAuC,CAAC,EAAE,iBAAiB;AACtE,QAAM,EAAE,SAAS,KAAK,QAAA,IAAY;AAElC,QAAM,EAAE,cAAA,IAAkBA,6BAAA;AAC1B,QAAM,iBACJ,OAAO,gBAAgB,OAAQ,GAAG,YAAY,cAC1C,UACA,gBAAgB,OAAQ,GAAG;AAEjC,SAAOC,2BAAAA,IAACC,yEAAS,SAAS,gBAAgB,SAAS,CAAA,GAAI,eAAe,KAAK;AAC7E;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"StructureEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,eAAe,CAU/C,CAAC"}
|
|
@@ -6,14 +6,7 @@ const StructureEditor = ({ dictionary }) => {
|
|
|
6
6
|
const { content, key, localId } = dictionary;
|
|
7
7
|
const { editedContent } = useEditedContent();
|
|
8
8
|
const initialSection = typeof editedContent?.[localId]?.content === "undefined" ? content : editedContent?.[localId]?.content;
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
NodeView,
|
|
11
|
-
{
|
|
12
|
-
section: initialSection,
|
|
13
|
-
keyPath: [],
|
|
14
|
-
dictionaryKey: dictionary.key
|
|
15
|
-
}
|
|
16
|
-
);
|
|
9
|
+
return /* @__PURE__ */ jsx(NodeView, { section: initialSection, keyPath: [], dictionaryKey: key });
|
|
17
10
|
};
|
|
18
11
|
export {
|
|
19
12
|
StructureEditor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { type FC } from 'react';\nimport { NodeView } from './StructureView/StructureView';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n};\n\nexport const StructureEditor: FC<NodeEditorProps> = ({ dictionary }) => {\n const { content, key, localId } = dictionary;\n\n const { editedContent } = useEditedContent();\n const initialSection =\n typeof editedContent?.[localId!]?.content === 'undefined'\n ? content\n : editedContent?.[localId!]?.content;\n\n return
|
|
1
|
+
{"version":3,"file":"StructureEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/StructureEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { type FC } from 'react';\nimport { NodeView } from './StructureView/StructureView';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n};\n\nexport const StructureEditor: FC<NodeEditorProps> = ({ dictionary }) => {\n const { content, key, localId } = dictionary;\n\n const { editedContent } = useEditedContent();\n const initialSection =\n typeof editedContent?.[localId!]?.content === 'undefined'\n ? content\n : editedContent?.[localId!]?.content;\n\n return <NodeView section={initialSection} keyPath={[]} dictionaryKey={key} />;\n};\n"],"names":[],"mappings":";;;;AAWO,MAAM,kBAAuC,CAAC,EAAE,iBAAiB;AACtE,QAAM,EAAE,SAAS,KAAK,QAAA,IAAY;AAElC,QAAM,EAAE,cAAA,IAAkB,iBAAA;AAC1B,QAAM,iBACJ,OAAO,gBAAgB,OAAQ,GAAG,YAAY,cAC1C,UACA,gBAAgB,OAAQ,GAAG;AAEjC,SAAO,oBAAC,YAAS,SAAS,gBAAgB,SAAS,CAAA,GAAI,eAAe,KAAK;AAC7E;"}
|
|
@@ -33,7 +33,7 @@ export declare const useLogin: () => import('@tanstack/react-query').UseMutation
|
|
|
33
33
|
status: number;
|
|
34
34
|
statusText: string;
|
|
35
35
|
};
|
|
36
|
-
}, Error, import('
|
|
36
|
+
}, Error, import('better-auth').Prettify<{
|
|
37
37
|
email: string;
|
|
38
38
|
password: string;
|
|
39
39
|
callbackURL?: string | undefined;
|
|
@@ -124,7 +124,7 @@ export declare const useGetVerifyEmailStatus: () => import('@tanstack/react-quer
|
|
|
124
124
|
status: number;
|
|
125
125
|
statusText: string;
|
|
126
126
|
};
|
|
127
|
-
}, Error, [import('
|
|
127
|
+
}, Error, [import('better-auth').Prettify<{
|
|
128
128
|
query: {
|
|
129
129
|
token: string;
|
|
130
130
|
callbackURL?: string | undefined;
|
|
@@ -276,7 +276,7 @@ export declare const useRegister: () => import('@tanstack/react-query').UseMutat
|
|
|
276
276
|
status: number;
|
|
277
277
|
statusText: string;
|
|
278
278
|
};
|
|
279
|
-
}, Error, import('
|
|
279
|
+
}, Error, import('better-auth').Prettify<{
|
|
280
280
|
email: string;
|
|
281
281
|
name: string;
|
|
282
282
|
password: string;
|
|
@@ -357,7 +357,7 @@ export declare const useLogout: () => import('@tanstack/react-query').UseMutatio
|
|
|
357
357
|
status: number;
|
|
358
358
|
statusText: string;
|
|
359
359
|
};
|
|
360
|
-
}, Error, import('
|
|
360
|
+
}, Error, import('better-auth').Prettify<{
|
|
361
361
|
query?: Record<string, any> | undefined;
|
|
362
362
|
fetchOptions?: {
|
|
363
363
|
method?: string | undefined;
|
|
@@ -436,7 +436,7 @@ export declare const useChangePassword: () => import('@tanstack/react-query').Us
|
|
|
436
436
|
status: number;
|
|
437
437
|
statusText: string;
|
|
438
438
|
};
|
|
439
|
-
}, Error, import('
|
|
439
|
+
}, Error, import('better-auth').Prettify<{
|
|
440
440
|
newPassword: string;
|
|
441
441
|
currentPassword: string;
|
|
442
442
|
revokeOtherSessions?: boolean | undefined;
|
|
@@ -513,7 +513,7 @@ export declare const useAskResetPassword: () => import('@tanstack/react-query').
|
|
|
513
513
|
status: number;
|
|
514
514
|
statusText: string;
|
|
515
515
|
};
|
|
516
|
-
}, Error, import('
|
|
516
|
+
}, Error, import('better-auth').Prettify<{
|
|
517
517
|
email: string;
|
|
518
518
|
redirectTo?: string | undefined;
|
|
519
519
|
} & {
|
|
@@ -588,7 +588,7 @@ export declare const useResetPassword: () => import('@tanstack/react-query').Use
|
|
|
588
588
|
status: number;
|
|
589
589
|
statusText: string;
|
|
590
590
|
};
|
|
591
|
-
}, Error, import('
|
|
591
|
+
}, Error, import('better-auth').Prettify<{
|
|
592
592
|
newPassword: string;
|
|
593
593
|
token?: string | undefined;
|
|
594
594
|
} & {
|
|
@@ -677,7 +677,7 @@ export declare const useVerifyEmail: () => import('@tanstack/react-query').UseMu
|
|
|
677
677
|
status: number;
|
|
678
678
|
statusText: string;
|
|
679
679
|
};
|
|
680
|
-
}, Error, import('
|
|
680
|
+
}, Error, import('better-auth').Prettify<{
|
|
681
681
|
query: {
|
|
682
682
|
token: string;
|
|
683
683
|
callbackURL?: string | undefined;
|
|
@@ -742,7 +742,7 @@ export declare const useVerifyEmail: () => import('@tanstack/react-query').UseMu
|
|
|
742
742
|
}>, unknown>;
|
|
743
743
|
export declare const useGetUserByAccount: () => import('@tanstack/react-query').UseMutationResult<{
|
|
744
744
|
data: {
|
|
745
|
-
user: import('
|
|
745
|
+
user: import('better-auth').OAuth2UserInfo;
|
|
746
746
|
data: Record<string, any>;
|
|
747
747
|
};
|
|
748
748
|
error: null;
|
|
@@ -754,7 +754,7 @@ export declare const useGetUserByAccount: () => import('@tanstack/react-query').
|
|
|
754
754
|
status: number;
|
|
755
755
|
statusText: string;
|
|
756
756
|
};
|
|
757
|
-
}, Error, import('
|
|
757
|
+
}, Error, import('better-auth').Prettify<{
|
|
758
758
|
accountId: string;
|
|
759
759
|
} & {
|
|
760
760
|
fetchOptions?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/design-system",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer design system, including UI components used in the Intlayer editor, website, and visual editor/CMS.",
|
|
6
6
|
"keywords": [
|
|
@@ -85,13 +85,13 @@
|
|
|
85
85
|
"tailwind-merge": "^3.3.0",
|
|
86
86
|
"zod": "^3.25.56",
|
|
87
87
|
"zustand": "^4.5.6",
|
|
88
|
-
"@intlayer/
|
|
89
|
-
"@intlayer/
|
|
90
|
-
"intlayer": "6.0.0
|
|
91
|
-
"@intlayer/
|
|
92
|
-
"
|
|
93
|
-
"@intlayer/
|
|
94
|
-
"react-intlayer": "6.0.0
|
|
88
|
+
"@intlayer/api": "6.0.0",
|
|
89
|
+
"@intlayer/config": "6.0.0",
|
|
90
|
+
"@intlayer/core": "6.0.0",
|
|
91
|
+
"@intlayer/dictionaries-entry": "6.0.0",
|
|
92
|
+
"intlayer": "6.0.0",
|
|
93
|
+
"@intlayer/editor-react": "6.0.0",
|
|
94
|
+
"react-intlayer": "6.0.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@chromatic-com/storybook": "^3.2.7",
|
|
@@ -131,10 +131,10 @@
|
|
|
131
131
|
"vite-plugin-dts": "^4.5.3",
|
|
132
132
|
"vitest": "^3.2.4",
|
|
133
133
|
"@utils/eslint-config": "1.0.4",
|
|
134
|
-
"@utils/ts-config": "1.0.4",
|
|
135
134
|
"@utils/ts-config-types": "1.0.4",
|
|
136
135
|
"@utils/tsup-config": "1.0.4",
|
|
137
|
-
"
|
|
136
|
+
"@utils/ts-config": "1.0.4",
|
|
137
|
+
"vite-intlayer": "6.0.0"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
140
|
"@monaco-editor/react": "^4.7.0",
|
|
@@ -148,13 +148,14 @@
|
|
|
148
148
|
"react-dom": ">=16.0.0",
|
|
149
149
|
"tailwind-merge": "^3.3.0",
|
|
150
150
|
"zustand": "^4.5.6",
|
|
151
|
-
"@intlayer/
|
|
152
|
-
"@intlayer/
|
|
153
|
-
"@intlayer/
|
|
154
|
-
"intlayer": "6.0.0
|
|
155
|
-
"
|
|
156
|
-
"react-intlayer": "6.0.0
|
|
157
|
-
"@intlayer/
|
|
151
|
+
"@intlayer/core": "6.0.0",
|
|
152
|
+
"@intlayer/api": "6.0.0",
|
|
153
|
+
"@intlayer/config": "6.0.0",
|
|
154
|
+
"@intlayer/editor-react": "6.0.0",
|
|
155
|
+
"intlayer": "6.0.0",
|
|
156
|
+
"react-intlayer": "6.0.0",
|
|
157
|
+
"@intlayer/dictionaries-entry": "6.0.0",
|
|
158
|
+
"@intlayer/backend": "6.0.0"
|
|
158
159
|
},
|
|
159
160
|
"scripts": {
|
|
160
161
|
"build": "pnpm clean & pnpm build:ci",
|