intlayer-editor 3.3.6 → 3.4.7

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.
Files changed (37) hide show
  1. package/dist/cjs/ContentSelectorWrapper.cjs +4 -1
  2. package/dist/cjs/ContentSelectorWrapper.cjs.map +1 -1
  3. package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +15 -4
  4. package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
  5. package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +8 -8
  6. package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -1
  7. package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs +26 -31
  8. package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -1
  9. package/dist/cjs/DictionaryListDrawer/{useDictionaryListDrawer.cjs → dictionaryListDrawerIdentifier.cjs} +6 -12
  10. package/dist/cjs/DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs.map +1 -0
  11. package/dist/cjs/DictionaryListDrawer/index.cjs +2 -2
  12. package/dist/cjs/DictionaryListDrawer/index.cjs.map +1 -1
  13. package/dist/esm/ContentSelectorWrapper.mjs +6 -2
  14. package/dist/esm/ContentSelectorWrapper.mjs.map +1 -1
  15. package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +17 -5
  16. package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
  17. package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +8 -8
  18. package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -1
  19. package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs +28 -33
  20. package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -1
  21. package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs +5 -0
  22. package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs.map +1 -0
  23. package/dist/esm/DictionaryListDrawer/index.mjs +1 -1
  24. package/dist/esm/DictionaryListDrawer/index.mjs.map +1 -1
  25. package/dist/types/ContentSelectorWrapper.d.ts.map +1 -1
  26. package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -1
  27. package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +1 -1
  28. package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts +2 -0
  29. package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts.map +1 -0
  30. package/dist/types/DictionaryListDrawer/index.d.ts +1 -1
  31. package/dist/types/DictionaryListDrawer/index.d.ts.map +1 -1
  32. package/package.json +11 -11
  33. package/dist/cjs/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +0 -1
  34. package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs +0 -10
  35. package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +0 -1
  36. package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts +0 -7
  37. package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts.map +0 -1
@@ -46,7 +46,10 @@ const ContentSelectorWrapper = ({
46
46
  }),
47
47
  [dictionaryId, dictionaryPath, keyPath, open]
48
48
  );
49
- const isSelected = (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, import_core.isSameKeyPath)(focusedContent?.keyPath ?? [], keyPath)) ?? false;
49
+ const isSelected = (0, import_react.useMemo)(
50
+ () => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, import_core.isSameKeyPath)(focusedContent?.keyPath ?? [], keyPath)) ?? false,
51
+ [focusedContent, isOpen, keyPath]
52
+ );
50
53
  (0, import_react.useEffect)(() => {
51
54
  if (isEditorEnabled && editedValue && typeof editedValue === "string") {
52
55
  setDisplayedChildren(editedValue);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected =\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false;\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n }\n }, [editedValue, isEditorEnabled]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DI;AA5DJ,kBAA4C;AAC5C,2BAAgC;AAChC,mBAMO;AACP,oCAAyC;AACzC,wCAA2C;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,QAC1D,8DAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,QAAM,EAAE,gBAAgB,QAAI,wDAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,QAC5C,uBAAoB,QAAQ;AAE9B,QAAM,mBAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;AAEA,QAAM,cACH,WACE,gBAAgB,SAAS,UAAU,KAAK,SACzC,2BAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAEF,8BAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,wCAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected = useMemo(\n () =>\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, isOpen, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n }\n }, [editedValue, isEditorEnabled]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkEI;AAhEJ,kBAA4C;AAC5C,2BAAgC;AAChC,mBAOO;AACP,oCAAyC;AACzC,wCAA2C;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,QAC1D,8DAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,QAAM,EAAE,gBAAgB,QAAI,wDAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,QAC5C,uBAAoB,QAAQ;AAE9B,QAAM,mBAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;AAEA,QAAM,iBAAa;AAAA,IACjB,OACG,WACE,gBAAgB,SAAS,UAAU,KAAK,SACzC,2BAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,QAAQ,OAAO;AAAA,EAClC;AAEA,8BAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,wCAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
@@ -28,8 +28,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
28
28
  var import_design_system = require("@intlayer/design-system");
29
29
  var import_hooks = require("@intlayer/design-system/hooks");
30
30
  var import_react = require("react");
31
+ var import_react_intlayer = require("react-intlayer");
31
32
  var import_shallow = require("zustand/shallow");
32
- var import_useDictionaryListDrawer = require('../DictionaryListDrawer/useDictionaryListDrawer.cjs');
33
+ var import_dictionaryListDrawerIdentifier = require('../DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs');
33
34
  var import_useDictionaryEditionDrawer = require('./useDictionaryEditionDrawer.cjs');
34
35
  const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
35
36
  const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
@@ -54,7 +55,11 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
54
55
  isOpen: keyPathEditionModal !== null,
55
56
  onClose: () => setKeyPathEditionModal(null),
56
57
  hasCloseButton: true,
57
- title: "Edit field",
58
+ title: (0, import_react_intlayer.t)({
59
+ en: "Edit field",
60
+ fr: "Modifier le champ",
61
+ es: "Editar campo"
62
+ }),
58
63
  size: "xl",
59
64
  transparency: "lg",
60
65
  children: dictionary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -84,7 +89,9 @@ const DictionaryEditionDrawer = ({
84
89
  }) => {
85
90
  const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId);
86
91
  const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryId);
87
- const { open: openDictionaryListDrawer } = (0, import_useDictionaryListDrawer.useDictionaryListDrawer)();
92
+ const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
93
+ openDictionaryListDrawer: () => s.open(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier)
94
+ }));
88
95
  const handleOnBack = () => {
89
96
  close();
90
97
  openDictionaryListDrawer();
@@ -104,7 +111,11 @@ const DictionaryEditionDrawer = ({
104
111
  ),
105
112
  backButton: {
106
113
  onBack: handleOnBack,
107
- text: "Dictionary list"
114
+ text: (0, import_react_intlayer.t)({
115
+ en: "Dictionary list",
116
+ fr: "Liste des dictionnaires",
117
+ es: "Lista de diccionarios"
118
+ })
108
119
  },
109
120
  children: focusedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
121
  DictionaryEditionDrawerContent,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title=\"Edit field\"\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoD4B;AAhD5B,2BAOO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,qBAA2B;AAC3B,qCAAwC;AACxC,wCAIO;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,QAC5C,8DAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AAEpD,QAAM,4BAAwB,0BAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,8BAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,2EAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,OAAM;AAAA,QACN,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAK,uDAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,YAAY;AACzE,QAAM,EAAE,MAAM,yBAAyB,QAAI,wDAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,qBAAiB;AAAA,QACrB,2BAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsD4B;AAlD5B,2BAQO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,4BAAkB;AAClB,qBAA2B;AAC3B,4CAA+C;AAC/C,wCAIO;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,QAC5C,8DAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AAEpD,QAAM,4BAAwB,0BAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,8BAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,2EAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,WAAO,yBAAE;AAAA,UACP,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAK,uDAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,YAAY;AACzE,QAAM,EAAE,yBAAyB,QAAI,0CAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,oEAA8B;AAAA,EACvE,EAAE;AAEF,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,UAAM,yBAAE;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,qBAAiB;AAAA,QACrB,2BAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -28,11 +28,11 @@ var import_shallow = require("zustand/shallow");
28
28
  const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
29
29
  const useDictionaryEditionDrawer = (dictionaryId) => {
30
30
  const id = getDrawerIdentifier(dictionaryId);
31
- const { isOpen, open, close } = (0, import_design_system.useRightDrawerStore)(id)(
31
+ const { isOpenDrawer, openDrawer, closeDrawer } = (0, import_design_system.useRightDrawerStore)(
32
32
  (0, import_shallow.useShallow)((e) => ({
33
- isOpen: e.isOpen,
34
- open: e.open,
35
- close: e.close
33
+ isOpenDrawer: e.isOpen,
34
+ openDrawer: e.open,
35
+ closeDrawer: e.close
36
36
  }))
37
37
  );
38
38
  const { setDictionariesRecord, getEditedContentValue } = (0, import_design_system.useEditedContentStore)(
@@ -58,17 +58,17 @@ const useDictionaryEditionDrawer = (dictionaryId) => {
58
58
  dictionaryPath,
59
59
  keyPath
60
60
  });
61
- open();
61
+ openDrawer(id);
62
62
  },
63
- [open, setFocusedContent]
63
+ [openDrawer, setFocusedContent]
64
64
  );
65
65
  return {
66
- isOpen,
66
+ isOpen: isOpenDrawer(id),
67
67
  focusedContent,
68
68
  setDictionariesRecord,
69
69
  getEditedContentValue,
70
70
  open: openDictionaryEditionDrawer,
71
- close
71
+ close: () => closeDrawer(id)
72
72
  };
73
73
  };
74
74
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpen, open, close } = useRightDrawerStore(id)(\n useShallow((e) => ({\n isOpen: e.isOpen,\n open: e.open,\n close: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n open();\n },\n [open, setFocusedContent]\n );\n\n return {\n isOpen,\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAIO;AACP,mBAA4B;AAC5B,qBAA2B;AAEpB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,QAAQ,MAAM,MAAM,QAAI,0CAAoB,EAAE;AAAA,QACpD,2BAAW,CAAC,OAAO;AAAA,MACjB,QAAQ,EAAE;AAAA,MACV,MAAM,EAAE;AAAA,MACR,OAAO,EAAE;AAAA,IACX,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,QACnD;AAAA,QACE,2BAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,QAAI;AAAA,QAC5C,2BAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,kCAA8B;AAAA,IAClC,CAAC;AAAA,MACC,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,WAAK;AAAA,IACP;AAAA,IACA,CAAC,MAAM,iBAAiB;AAAA,EAC1B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,EACF;AACF;","names":["dictionaryId"]}
1
+ {"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(\n useShallow((e) => ({\n isOpenDrawer: e.isOpen,\n openDrawer: e.open,\n closeDrawer: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n openDrawer(id);\n },\n [openDrawer, setFocusedContent]\n );\n\n return {\n isOpen: isOpenDrawer(id),\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close: () => closeDrawer(id),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAIO;AACP,mBAA4B;AAC5B,qBAA2B;AAEpB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,cAAc,YAAY,YAAY,QAAI;AAAA,QAChD,2BAAW,CAAC,OAAO;AAAA,MACjB,cAAc,EAAE;AAAA,MAChB,YAAY,EAAE;AAAA,MACd,aAAa,EAAE;AAAA,IACjB,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,QACnD;AAAA,QACE,2BAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,QAAI;AAAA,QAC5C,2BAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,kCAA8B;AAAA,IAClC,CAAC;AAAA,MACC,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,iBAAW,EAAE;AAAA,IACf;AAAA,IACA,CAAC,YAAY,iBAAiB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,QAAQ,aAAa,EAAE;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,MAAM,YAAY,EAAE;AAAA,EAC7B;AACF;","names":["dictionaryId"]}
@@ -29,25 +29,17 @@ var import_lucide_react = require("lucide-react");
29
29
  var import_react = require("react");
30
30
  var import_shallow = require("zustand/shallow");
31
31
  var import_useDictionaryEditionDrawer = require('../DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs');
32
- var import_useDictionaryListDrawer = require('./useDictionaryListDrawer.cjs');
33
- const DictionaryDrawerConnector = ({
34
- dictionaryId
35
- }) => {
36
- const rightDrawerStore = (0, import_design_system.useRightDrawerStore)(dictionaryId)();
37
- (0, import_react.useEffect)(() => {
38
- rightDrawerStore.open();
39
- }, [rightDrawerStore]);
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
41
- };
32
+ var import_dictionaryListDrawerIdentifier = require('./dictionaryListDrawerIdentifier.cjs');
42
33
  const DictionaryListDrawer = () => {
43
34
  const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
44
35
  const dictionaryKeyList = (0, import_react.useMemo)(
45
36
  () => Object.keys(dictionaries),
46
37
  [dictionaries]
47
38
  );
48
- const { closeDictionaryListDrawer } = (0, import_useDictionaryListDrawer.useDictionaryListDrawer)(
39
+ const { closeDrawer, openDrawer } = (0, import_design_system.useRightDrawerStore)(
49
40
  (0, import_shallow.useShallow)((s) => ({
50
- closeDictionaryListDrawer: s.close
41
+ closeDrawer: s.close,
42
+ openDrawer: s.open
51
43
  }))
52
44
  );
53
45
  const editedContent = (0, import_design_system.useEditedContentStore)(
@@ -56,36 +48,39 @@ const DictionaryListDrawer = () => {
56
48
  const setFocusedContent = (0, import_design_system.useEditionPanelStore)(
57
49
  (0, import_shallow.useShallow)((s) => s.setFocusedContent)
58
50
  );
59
- const [clickedDictionaryId, setClickedDictionaryId] = (0, import_react.useState)();
60
51
  const handleClickDictionary = (dictionaryId) => {
61
- closeDictionaryListDrawer();
52
+ closeDrawer(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier);
62
53
  const { filePath } = dictionaries[dictionaryId];
63
54
  setFocusedContent({
64
55
  dictionaryId,
65
56
  dictionaryPath: filePath
66
57
  });
67
- setClickedDictionaryId((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId));
58
+ openDrawer((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId));
68
59
  };
69
60
  const isDictionaryEdited = (0, import_react.useCallback)(
70
61
  (dictionaryId) => Object.keys(editedContent).includes(dictionaryId),
71
62
  [editedContent]
72
63
  );
73
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
74
- clickedDictionaryId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DictionaryDrawerConnector, { dictionaryId: clickedDictionaryId }),
75
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.RightDrawer, { title: "Dictionary list", identifier: "dictionaryListDrawer", children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
- import_design_system.Button,
77
- {
78
- label: `Open dictionary editor ${dictionaryId}`,
79
- onClick: () => handleClickDictionary(dictionaryId),
80
- variant: "hoverable",
81
- color: "text",
82
- IconRight: import_lucide_react.ChevronRight,
83
- size: "md",
84
- isFullWidth: true,
85
- children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
86
- }
87
- ) }, dictionaryId)) })
88
- ] });
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ import_design_system.RightDrawer,
66
+ {
67
+ title: "Dictionary list",
68
+ identifier: import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier,
69
+ children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
+ import_design_system.Button,
71
+ {
72
+ label: `Open dictionary editor ${dictionaryId}`,
73
+ onClick: () => handleClickDictionary(dictionaryId),
74
+ variant: "hoverable",
75
+ color: "text",
76
+ IconRight: import_lucide_react.ChevronRight,
77
+ size: "md",
78
+ isFullWidth: true,
79
+ children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
80
+ }
81
+ ) }, dictionaryId))
82
+ }
83
+ ) });
89
84
  };
90
85
  // Annotate the CommonJS export names for ESM import in node:
91
86
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useState, useEffect, useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { useDictionaryListDrawer } from './useDictionaryListDrawer';\n\ntype DictionaryDrawerConnectorProps = {\n dictionaryId: string;\n};\nconst DictionaryDrawerConnector: FC<DictionaryDrawerConnectorProps> = ({\n dictionaryId,\n}) => {\n const rightDrawerStore = useRightDrawerStore(dictionaryId)();\n\n useEffect(() => {\n rightDrawerStore.open();\n }, [rightDrawerStore]);\n\n return <></>;\n};\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n const { closeDictionaryListDrawer } = useDictionaryListDrawer(\n useShallow((s) => ({\n closeDictionaryListDrawer: s.close,\n }))\n );\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const [clickedDictionaryId, setClickedDictionaryId] = useState<string>();\n\n const handleClickDictionary = (dictionaryId: string) => {\n closeDictionaryListDrawer();\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n setClickedDictionaryId(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n {clickedDictionaryId && (\n <DictionaryDrawerConnector dictionaryId={clickedDictionaryId} />\n )}\n <RightDrawer title=\"Dictionary list\" identifier=\"dictionaryListDrawer\">\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BS;AA1BT,2BAMO;AACP,mBAAsC;AACtC,0BAA6B;AAC7B,mBAA8D;AAC9D,qBAA2B;AAC3B,wCAAoC;AACpC,qCAAwC;AAKxC,MAAM,4BAAgE,CAAC;AAAA,EACrE;AACF,MAAM;AACJ,QAAM,uBAAmB,0CAAoB,YAAY,EAAE;AAE3D,8BAAU,MAAM;AACd,qBAAiB,KAAK;AAAA,EACxB,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,2EAAE;AACX;AAEO,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AACpD,QAAM,wBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AACA,QAAM,EAAE,0BAA0B,QAAI;AAAA,QACpC,2BAAW,CAAC,OAAO;AAAA,MACjB,2BAA2B,EAAE;AAAA,IAC/B,EAAE;AAAA,EACJ;AACA,QAAM,oBAAgB;AAAA,QACpB,2BAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,wBAAoB;AAAA,QACxB,2BAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAAiB;AAEvE,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,8BAA0B;AAE1B,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,+BAAuB,uDAAoB,YAAY,CAAC;AAAA,EAC1D;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,4EACG;AAAA,2BACC,4CAAC,6BAA0B,cAAc,qBAAqB;AAAA,IAEhE,4CAAC,oCAAY,OAAM,mBAAkB,YAAW,wBAC7C,4BAAkB,IAAI,CAAC,iBACtB,4CAAC,SACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,0BAA0B,YAAY;AAAA,QAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,QACjD,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,WAAW;AAAA,QACX,MAAK;AAAA,QACL,aAAW;AAAA,QAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,IACN,KAbQ,YAcV,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (dictionaryId: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDI;AArDJ,2BAMO;AACP,mBAAsC;AACtC,0BAA6B;AAC7B,mBAAyC;AACzC,qBAA2B;AAC3B,wCAAoC;AACpC,4CAA+C;AAExC,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AACpD,QAAM,wBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AAEA,QAAM,EAAE,aAAa,WAAW,QAAI;AAAA,QAClC,2BAAW,CAAC,OAAO;AAAA,MACjB,aAAa,EAAE;AAAA,MACf,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,EACJ;AAEA,QAAM,oBAAgB;AAAA,QACpB,2BAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,wBAAoB;AAAA,QACxB,2BAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,gBAAY,oEAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,mBAAW,uDAAoB,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,2EACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UACjD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,MACN,KAbQ,YAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
@@ -16,20 +16,14 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useDictionaryListDrawer_exports = {};
20
- __export(useDictionaryListDrawer_exports, {
21
- dictionaryListDrawerIdentifier: () => dictionaryListDrawerIdentifier,
22
- useDictionaryListDrawer: () => useDictionaryListDrawer
19
+ var dictionaryListDrawerIdentifier_exports = {};
20
+ __export(dictionaryListDrawerIdentifier_exports, {
21
+ dictionaryListDrawerIdentifier: () => dictionaryListDrawerIdentifier
23
22
  });
24
- module.exports = __toCommonJS(useDictionaryListDrawer_exports);
25
- var import_design_system = require("@intlayer/design-system");
23
+ module.exports = __toCommonJS(dictionaryListDrawerIdentifier_exports);
26
24
  const dictionaryListDrawerIdentifier = "dictionaryList";
27
- const useDictionaryListDrawer = (0, import_design_system.useRightDrawerStore)(
28
- dictionaryListDrawerIdentifier
29
- );
30
25
  // Annotate the CommonJS export names for ESM import in node:
31
26
  0 && (module.exports = {
32
- dictionaryListDrawerIdentifier,
33
- useDictionaryListDrawer
27
+ dictionaryListDrawerIdentifier
34
28
  });
35
- //# sourceMappingURL=useDictionaryListDrawer.cjs.map
29
+ //# sourceMappingURL=dictionaryListDrawerIdentifier.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"sourcesContent":["export const dictionaryListDrawerIdentifier = 'dictionaryList';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,iCAAiC;","names":[]}
@@ -16,10 +16,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var DictionaryListDrawer_exports = {};
17
17
  module.exports = __toCommonJS(DictionaryListDrawer_exports);
18
18
  __reExport(DictionaryListDrawer_exports, require('./DictionaryListDrawer.cjs'), module.exports);
19
- __reExport(DictionaryListDrawer_exports, require('./useDictionaryListDrawer.cjs'), module.exports);
19
+ __reExport(DictionaryListDrawer_exports, require('./dictionaryListDrawerIdentifier.cjs'), module.exports);
20
20
  // Annotate the CommonJS export names for ESM import in node:
21
21
  0 && (module.exports = {
22
22
  ...require('./DictionaryListDrawer.cjs'),
23
- ...require('./useDictionaryListDrawer.cjs')
23
+ ...require('./dictionaryListDrawerIdentifier.cjs')
24
24
  });
25
25
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yCAAc,mCAAd;AACA,yCAAc,sCADd;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './dictionaryListDrawerIdentifier';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yCAAc,mCAAd;AACA,yCAAc,6CADd;","names":[]}
@@ -5,7 +5,8 @@ import { ContentSelector } from "@intlayer/design-system";
5
5
  import {
6
6
  useCallback,
7
7
  useEffect,
8
- useState
8
+ useState,
9
+ useMemo
9
10
  } from "react";
10
11
  import { useIntlayerEditorContext } from './IntlayerEditorProvider.mjs';
11
12
  import { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
@@ -27,7 +28,10 @@ const ContentSelectorWrapper = ({
27
28
  }),
28
29
  [dictionaryId, dictionaryPath, keyPath, open]
29
30
  );
30
- const isSelected = (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false;
31
+ const isSelected = useMemo(
32
+ () => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false,
33
+ [focusedContent, isOpen, keyPath]
34
+ );
31
35
  useEffect(() => {
32
36
  if (isEditorEnabled && editedValue && typeof editedValue === "string") {
33
37
  setDisplayedChildren(editedValue);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected =\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false;\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n }\n }, [editedValue, isEditorEnabled]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";AA8DI;AA5DJ,SAAS,qBAAmC;AAC5C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,IAC1D,2BAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,QAAM,EAAE,gBAAgB,IAAI,yBAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAAoB,QAAQ;AAE9B,QAAM,eAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;AAEA,QAAM,cACH,WACE,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAEF,YAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,mBAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected = useMemo(\n () =>\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, isOpen, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n }\n }, [editedValue, isEditorEnabled]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";AAkEI;AAhEJ,SAAS,qBAAmC;AAC5C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,IAC1D,2BAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,QAAM,EAAE,gBAAgB,IAAI,yBAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAAoB,QAAQ;AAE9B,QAAM,eAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;AAEA,QAAM,aAAa;AAAA,IACjB,OACG,WACE,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,QAAQ,OAAO;AAAA,EAClC;AAEA,YAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,mBAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
@@ -6,12 +6,14 @@ import {
6
6
  LocaleSwitcher,
7
7
  Modal,
8
8
  useEditionPanelStore,
9
- DictionaryFieldEditor
9
+ DictionaryFieldEditor,
10
+ useRightDrawerStore
10
11
  } from "@intlayer/design-system";
11
12
  import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
12
13
  import { useCallback, useEffect, useState } from "react";
14
+ import { t } from "react-intlayer";
13
15
  import { useShallow } from "zustand/shallow";
14
- import { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer.mjs';
16
+ import { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs';
15
17
  import {
16
18
  useDictionaryEditionDrawer,
17
19
  getDrawerIdentifier
@@ -39,7 +41,11 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
39
41
  isOpen: keyPathEditionModal !== null,
40
42
  onClose: () => setKeyPathEditionModal(null),
41
43
  hasCloseButton: true,
42
- title: "Edit field",
44
+ title: t({
45
+ en: "Edit field",
46
+ fr: "Modifier le champ",
47
+ es: "Editar campo"
48
+ }),
43
49
  size: "xl",
44
50
  transparency: "lg",
45
51
  children: dictionary && /* @__PURE__ */ jsx(
@@ -69,7 +75,9 @@ const DictionaryEditionDrawer = ({
69
75
  }) => {
70
76
  const id = getDrawerIdentifier(dictionaryId);
71
77
  const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);
72
- const { open: openDictionaryListDrawer } = useDictionaryListDrawer();
78
+ const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({
79
+ openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier)
80
+ }));
73
81
  const handleOnBack = () => {
74
82
  close();
75
83
  openDictionaryListDrawer();
@@ -89,7 +97,11 @@ const DictionaryEditionDrawer = ({
89
97
  ),
90
98
  backButton: {
91
99
  onBack: handleOnBack,
92
- text: "Dictionary list"
100
+ text: t({
101
+ en: "Dictionary list",
102
+ fr: "Liste des dictionnaires",
103
+ es: "Lista de diccionarios"
104
+ })
93
105
  },
94
106
  children: focusedContent && /* @__PURE__ */ jsx(
95
107
  DictionaryEditionDrawerContent,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title=\"Edit field\"\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAoD4B,wBAKxB,YALwB;AAhD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,aAAa,WAAW,gBAAyB;AAC1D,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B;AACxC;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,IAC5C,2BAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AAEpD,QAAM,wBAAwB,YAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,YAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,gCAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,OAAM;AAAA,QACN,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,KAAK,oBAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,IAAI,2BAA2B,YAAY;AACzE,QAAM,EAAE,MAAM,yBAAyB,IAAI,wBAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB;AAAA,IACrB,WAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAsD4B,wBAKxB,YALwB;AAlD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,aAAa,WAAW,gBAAyB;AAC1D,SAAS,SAAS;AAClB,SAAS,kBAAkB;AAC3B,SAAS,sCAAsC;AAC/C;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,IAC5C,2BAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AAEpD,QAAM,wBAAwB,YAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,YAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,gCAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,OAAO,EAAE;AAAA,UACP,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,KAAK,oBAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,IAAI,2BAA2B,YAAY;AACzE,QAAM,EAAE,yBAAyB,IAAI,oBAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,8BAA8B;AAAA,EACvE,EAAE;AAEF,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM,EAAE;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB;AAAA,IACrB,WAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -8,11 +8,11 @@ import { useShallow } from "zustand/shallow";
8
8
  const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
9
9
  const useDictionaryEditionDrawer = (dictionaryId) => {
10
10
  const id = getDrawerIdentifier(dictionaryId);
11
- const { isOpen, open, close } = useRightDrawerStore(id)(
11
+ const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(
12
12
  useShallow((e) => ({
13
- isOpen: e.isOpen,
14
- open: e.open,
15
- close: e.close
13
+ isOpenDrawer: e.isOpen,
14
+ openDrawer: e.open,
15
+ closeDrawer: e.close
16
16
  }))
17
17
  );
18
18
  const { setDictionariesRecord, getEditedContentValue } = useEditedContentStore(
@@ -38,17 +38,17 @@ const useDictionaryEditionDrawer = (dictionaryId) => {
38
38
  dictionaryPath,
39
39
  keyPath
40
40
  });
41
- open();
41
+ openDrawer(id);
42
42
  },
43
- [open, setFocusedContent]
43
+ [openDrawer, setFocusedContent]
44
44
  );
45
45
  return {
46
- isOpen,
46
+ isOpen: isOpenDrawer(id),
47
47
  focusedContent,
48
48
  setDictionariesRecord,
49
49
  getEditedContentValue,
50
50
  open: openDictionaryEditionDrawer,
51
- close
51
+ close: () => closeDrawer(id)
52
52
  };
53
53
  };
54
54
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpen, open, close } = useRightDrawerStore(id)(\n useShallow((e) => ({\n isOpen: e.isOpen,\n open: e.open,\n close: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n open();\n },\n [open, setFocusedContent]\n );\n\n return {\n isOpen,\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close,\n };\n};\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,QAAQ,MAAM,MAAM,IAAI,oBAAoB,EAAE;AAAA,IACpD,WAAW,CAAC,OAAO;AAAA,MACjB,QAAQ,EAAE;AAAA,MACV,MAAM,EAAE;AAAA,MACR,OAAO,EAAE;AAAA,IACX,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,IACnD;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,IAAI;AAAA,IAC5C,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,8BAA8B;AAAA,IAClC,CAAC;AAAA,MACC,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,WAAK;AAAA,IACP;AAAA,IACA,CAAC,MAAM,iBAAiB;AAAA,EAC1B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,EACF;AACF;","names":["dictionaryId"]}
1
+ {"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(\n useShallow((e) => ({\n isOpenDrawer: e.isOpen,\n openDrawer: e.open,\n closeDrawer: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n openDrawer(id);\n },\n [openDrawer, setFocusedContent]\n );\n\n return {\n isOpen: isOpenDrawer(id),\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close: () => closeDrawer(id),\n };\n};\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,cAAc,YAAY,YAAY,IAAI;AAAA,IAChD,WAAW,CAAC,OAAO;AAAA,MACjB,cAAc,EAAE;AAAA,MAChB,YAAY,EAAE;AAAA,MACd,aAAa,EAAE;AAAA,IACjB,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,IACnD;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,IAAI;AAAA,IAC5C,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,8BAA8B;AAAA,IAClC,CAAC;AAAA,MACC,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,iBAAW,EAAE;AAAA,IACf;AAAA,IACA,CAAC,YAAY,iBAAiB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,QAAQ,aAAa,EAAE;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,MAAM,YAAY,EAAE;AAAA,EAC7B;AACF;","names":["dictionaryId"]}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import {
4
4
  RightDrawer,
5
5
  Button,
@@ -9,28 +9,20 @@ import {
9
9
  } from "@intlayer/design-system";
10
10
  import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
11
11
  import { ChevronRight } from "lucide-react";
12
- import { useState, useEffect, useCallback, useMemo } from "react";
12
+ import { useCallback, useMemo } from "react";
13
13
  import { useShallow } from "zustand/shallow";
14
14
  import { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
15
- import { useDictionaryListDrawer } from './useDictionaryListDrawer.mjs';
16
- const DictionaryDrawerConnector = ({
17
- dictionaryId
18
- }) => {
19
- const rightDrawerStore = useRightDrawerStore(dictionaryId)();
20
- useEffect(() => {
21
- rightDrawerStore.open();
22
- }, [rightDrawerStore]);
23
- return /* @__PURE__ */ jsx(Fragment, {});
24
- };
15
+ import { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier.mjs';
25
16
  const DictionaryListDrawer = () => {
26
17
  const { all: dictionaries } = useGetAllDictionaries();
27
18
  const dictionaryKeyList = useMemo(
28
19
  () => Object.keys(dictionaries),
29
20
  [dictionaries]
30
21
  );
31
- const { closeDictionaryListDrawer } = useDictionaryListDrawer(
22
+ const { closeDrawer, openDrawer } = useRightDrawerStore(
32
23
  useShallow((s) => ({
33
- closeDictionaryListDrawer: s.close
24
+ closeDrawer: s.close,
25
+ openDrawer: s.open
34
26
  }))
35
27
  );
36
28
  const editedContent = useEditedContentStore(
@@ -39,36 +31,39 @@ const DictionaryListDrawer = () => {
39
31
  const setFocusedContent = useEditionPanelStore(
40
32
  useShallow((s) => s.setFocusedContent)
41
33
  );
42
- const [clickedDictionaryId, setClickedDictionaryId] = useState();
43
34
  const handleClickDictionary = (dictionaryId) => {
44
- closeDictionaryListDrawer();
35
+ closeDrawer(dictionaryListDrawerIdentifier);
45
36
  const { filePath } = dictionaries[dictionaryId];
46
37
  setFocusedContent({
47
38
  dictionaryId,
48
39
  dictionaryPath: filePath
49
40
  });
50
- setClickedDictionaryId(getDrawerIdentifier(dictionaryId));
41
+ openDrawer(getDrawerIdentifier(dictionaryId));
51
42
  };
52
43
  const isDictionaryEdited = useCallback(
53
44
  (dictionaryId) => Object.keys(editedContent).includes(dictionaryId),
54
45
  [editedContent]
55
46
  );
56
- return /* @__PURE__ */ jsxs(Fragment, { children: [
57
- clickedDictionaryId && /* @__PURE__ */ jsx(DictionaryDrawerConnector, { dictionaryId: clickedDictionaryId }),
58
- /* @__PURE__ */ jsx(RightDrawer, { title: "Dictionary list", identifier: "dictionaryListDrawer", children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
59
- Button,
60
- {
61
- label: `Open dictionary editor ${dictionaryId}`,
62
- onClick: () => handleClickDictionary(dictionaryId),
63
- variant: "hoverable",
64
- color: "text",
65
- IconRight: ChevronRight,
66
- size: "md",
67
- isFullWidth: true,
68
- children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
69
- }
70
- ) }, dictionaryId)) })
71
- ] });
47
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
48
+ RightDrawer,
49
+ {
50
+ title: "Dictionary list",
51
+ identifier: dictionaryListDrawerIdentifier,
52
+ children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
53
+ Button,
54
+ {
55
+ label: `Open dictionary editor ${dictionaryId}`,
56
+ onClick: () => handleClickDictionary(dictionaryId),
57
+ variant: "hoverable",
58
+ color: "text",
59
+ IconRight: ChevronRight,
60
+ size: "md",
61
+ isFullWidth: true,
62
+ children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
63
+ }
64
+ ) }, dictionaryId))
65
+ }
66
+ ) });
72
67
  };
73
68
  export {
74
69
  DictionaryListDrawer
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useState, useEffect, useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { useDictionaryListDrawer } from './useDictionaryListDrawer';\n\ntype DictionaryDrawerConnectorProps = {\n dictionaryId: string;\n};\nconst DictionaryDrawerConnector: FC<DictionaryDrawerConnectorProps> = ({\n dictionaryId,\n}) => {\n const rightDrawerStore = useRightDrawerStore(dictionaryId)();\n\n useEffect(() => {\n rightDrawerStore.open();\n }, [rightDrawerStore]);\n\n return <></>;\n};\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n const { closeDictionaryListDrawer } = useDictionaryListDrawer(\n useShallow((s) => ({\n closeDictionaryListDrawer: s.close,\n }))\n );\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const [clickedDictionaryId, setClickedDictionaryId] = useState<string>();\n\n const handleClickDictionary = (dictionaryId: string) => {\n closeDictionaryListDrawer();\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n setClickedDictionaryId(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n {clickedDictionaryId && (\n <DictionaryDrawerConnector dictionaryId={clickedDictionaryId} />\n )}\n <RightDrawer title=\"Dictionary list\" identifier=\"dictionaryListDrawer\">\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";AA6BS,wBAyCL,YAzCK;AA1BT;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,UAAU,WAAW,aAAa,eAAmB;AAC9D,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AAKxC,MAAM,4BAAgE,CAAC;AAAA,EACrE;AACF,MAAM;AACJ,QAAM,mBAAmB,oBAAoB,YAAY,EAAE;AAE3D,YAAU,MAAM;AACd,qBAAiB,KAAK;AAAA,EACxB,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO,gCAAE;AACX;AAEO,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AACpD,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AACA,QAAM,EAAE,0BAA0B,IAAI;AAAA,IACpC,WAAW,CAAC,OAAO;AAAA,MACjB,2BAA2B,EAAE;AAAA,IAC/B,EAAE;AAAA,EACJ;AACA,QAAM,gBAAgB;AAAA,IACpB,WAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,oBAAoB;AAAA,IACxB,WAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAiB;AAEvE,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,8BAA0B;AAE1B,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,2BAAuB,oBAAoB,YAAY,CAAC;AAAA,EAC1D;AAEA,QAAM,qBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,iCACG;AAAA,2BACC,oBAAC,6BAA0B,cAAc,qBAAqB;AAAA,IAEhE,oBAAC,eAAY,OAAM,mBAAkB,YAAW,wBAC7C,4BAAkB,IAAI,CAAC,iBACtB,oBAAC,SACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,0BAA0B,YAAY;AAAA,QAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,QACjD,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,WAAW;AAAA,QACX,MAAK;AAAA,QACL,aAAW;AAAA,QAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,IACN,KAbQ,YAcV,CACD,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (dictionaryId: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";AAwDI,mBAOQ,WAPR;AArDJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,aAAa,eAAmB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,sCAAsC;AAExC,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AACpD,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AAEA,QAAM,EAAE,aAAa,WAAW,IAAI;AAAA,IAClC,WAAW,CAAC,OAAO;AAAA,MACjB,aAAa,EAAE;AAAA,MACf,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,EACJ;AAEA,QAAM,gBAAgB;AAAA,IACpB,WAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,oBAAoB;AAAA,IACxB,WAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,gBAAY,8BAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,eAAW,oBAAoB,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,qBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,gCACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB,oBAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UACjD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,MACN,KAbQ,YAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
@@ -0,0 +1,5 @@
1
+ const dictionaryListDrawerIdentifier = "dictionaryList";
2
+ export {
3
+ dictionaryListDrawerIdentifier
4
+ };
5
+ //# sourceMappingURL=dictionaryListDrawerIdentifier.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"sourcesContent":["export const dictionaryListDrawerIdentifier = 'dictionaryList';\n"],"mappings":"AAAO,MAAM,iCAAiC;","names":[]}
@@ -1,3 +1,3 @@
1
1
  export * from './DictionaryListDrawer.mjs';
2
- export * from './useDictionaryListDrawer.mjs';
2
+ export * from './dictionaryListDrawerIdentifier.mjs';
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './dictionaryListDrawerIdentifier';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAIL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA6ClE,CAAC"}
1
+ {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAgDlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAWvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,EACL,KAAK,WAAW,IAAI,6BAA6B,EAGlD,MAAM,8BAA8B,CAAC;AAEtC,KAAK,mCAAmC,GAAG;IACzC,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAkDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA0CpE,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,EAAE,CAChD,sCAAsC,CAmBvC,CAAC"}
1
+ {"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAIlE,OAAO,EACL,KAAK,WAAW,IAAI,6BAA6B,EAGlD,MAAM,8BAA8B,CAAC;AAEtC,KAAK,mCAAmC,GAAG;IACzC,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAsDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAgDpE,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,EAAE,CAChD,sCAAsC,CAmBvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAYA,OAAO,EAA6C,EAAE,EAAE,MAAM,OAAO,CAAC;AAoBtE,eAAO,MAAM,oBAAoB,EAAE,EA+DlC,CAAC"}
1
+ {"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAwB,EAAE,EAAE,MAAM,OAAO,CAAC;AAKjD,eAAO,MAAM,oBAAoB,EAAE,EAgElC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const dictionaryListDrawerIdentifier = "dictionaryList";
2
+ //# sourceMappingURL=dictionaryListDrawerIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionaryListDrawerIdentifier.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,mBAAmB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from './DictionaryListDrawer';
2
- export * from './useDictionaryListDrawer';
2
+ export * from './dictionaryListDrawerIdentifier';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "3.3.6",
3
+ "version": "3.4.7",
4
4
  "private": false,
5
5
  "description": "IntLayer Editor is a tool that allow you to edit your IntLayer declaration files using a graphical interface.",
6
6
  "keywords": [
@@ -69,14 +69,14 @@
69
69
  "body-parser": "^1.20.3",
70
70
  "commander": "^12.1.0",
71
71
  "express": "^4.21.1",
72
- "lucide-react": "^0.456.0",
72
+ "lucide-react": "^0.468.0",
73
73
  "magic-regexp": "^0.8.0",
74
74
  "react": "^18.3.1",
75
75
  "react-dom": "^18.3.1",
76
76
  "zustand": "^5.0.1",
77
- "@intlayer/config": "^3.3.6",
78
- "@intlayer/design-system": "^3.3.6",
79
- "@intlayer/core": "^3.3.6"
77
+ "@intlayer/config": "^3.4.7",
78
+ "@intlayer/design-system": "^3.4.7",
79
+ "@intlayer/core": "^3.4.7"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@babel/generator": "7.26.2",
@@ -97,16 +97,16 @@
97
97
  "tsc-alias": "^1.8.10",
98
98
  "tsup": "^8.3.5",
99
99
  "typescript": "^5.7.2",
100
+ "@utils/ts-config": "^1.0.4",
100
101
  "@utils/eslint-config": "^1.0.4",
101
102
  "@utils/ts-config-types": "^1.0.4",
102
- "@utils/tsup-config": "^1.0.4",
103
- "@utils/ts-config": "^1.0.4"
103
+ "@utils/tsup-config": "^1.0.4"
104
104
  },
105
105
  "peerDependencies": {
106
- "@intlayer/config": "^3.3.6",
107
- "@intlayer/core": "^3.3.6",
108
- "@intlayer/design-system": "^3.3.6",
109
- "react-intlayer": "^3.3.6"
106
+ "@intlayer/config": "^3.4.7",
107
+ "@intlayer/core": "^3.4.7",
108
+ "@intlayer/design-system": "^3.4.7",
109
+ "react-intlayer": "^3.4.7"
110
110
  },
111
111
  "engines": {
112
112
  "node": ">=14.18"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/useDictionaryListDrawer.ts"],"sourcesContent":["import { useRightDrawerStore } from '@intlayer/design-system';\n\nexport const dictionaryListDrawerIdentifier = 'dictionaryList';\n\nexport const useDictionaryListDrawer = useRightDrawerStore(\n dictionaryListDrawerIdentifier\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAoC;AAE7B,MAAM,iCAAiC;AAEvC,MAAM,8BAA0B;AAAA,EACrC;AACF;","names":[]}
@@ -1,10 +0,0 @@
1
- import { useRightDrawerStore } from "@intlayer/design-system";
2
- const dictionaryListDrawerIdentifier = "dictionaryList";
3
- const useDictionaryListDrawer = useRightDrawerStore(
4
- dictionaryListDrawerIdentifier
5
- );
6
- export {
7
- dictionaryListDrawerIdentifier,
8
- useDictionaryListDrawer
9
- };
10
- //# sourceMappingURL=useDictionaryListDrawer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/DictionaryListDrawer/useDictionaryListDrawer.ts"],"sourcesContent":["import { useRightDrawerStore } from '@intlayer/design-system';\n\nexport const dictionaryListDrawerIdentifier = 'dictionaryList';\n\nexport const useDictionaryListDrawer = useRightDrawerStore(\n dictionaryListDrawerIdentifier\n);\n"],"mappings":"AAAA,SAAS,2BAA2B;AAE7B,MAAM,iCAAiC;AAEvC,MAAM,0BAA0B;AAAA,EACrC;AACF;","names":[]}
@@ -1,7 +0,0 @@
1
- export declare const dictionaryListDrawerIdentifier = "dictionaryList";
2
- export declare const useDictionaryListDrawer: import("zustand").UseBoundStore<import("zustand").StoreApi<{
3
- isOpen: boolean;
4
- open: () => void;
5
- close: () => void;
6
- }>>;
7
- //# sourceMappingURL=useDictionaryListDrawer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/useDictionaryListDrawer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D,eAAO,MAAM,uBAAuB;;;;GAEnC,CAAC"}