@uva-glass/component-library 3.45.5 → 3.45.6

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 (48) hide show
  1. package/dist/{LexicalClipboard.prod-BP8LNbol.js → LexicalClipboard.prod-pXq91TBU.js} +2 -2
  2. package/dist/{LexicalClipboard.prod-BP8LNbol.js.map → LexicalClipboard.prod-pXq91TBU.js.map} +1 -1
  3. package/dist/{LexicalList.prod-D6IAptR7.js → LexicalList.prod--mkvX0uW.js} +2 -2
  4. package/dist/{LexicalList.prod-D6IAptR7.js.map → LexicalList.prod--mkvX0uW.js.map} +1 -1
  5. package/dist/{LexicalSelection.prod-ZvNRDI9l.js → LexicalSelection.prod-Ct4PZOht.js} +5 -5
  6. package/dist/{LexicalSelection.prod-ZvNRDI9l.js.map → LexicalSelection.prod-Ct4PZOht.js.map} +1 -1
  7. package/dist/{LexicalTable.prod-DJktN6jF.js → LexicalTable.prod-Bexd4dGG.js} +2 -2
  8. package/dist/{LexicalTable.prod-DJktN6jF.js.map → LexicalTable.prod-Bexd4dGG.js.map} +1 -1
  9. package/dist/{TableCellResizerPlugin-DFzNK-ve.js → TableCellResizerPlugin-Cpbankb8.js} +2 -2
  10. package/dist/{TableCellResizerPlugin-DFzNK-ve.js.map → TableCellResizerPlugin-Cpbankb8.js.map} +1 -1
  11. package/dist/{TablePlugin-4Zj0xZie.js → TablePlugin-FTN9oxnI.js} +2 -2
  12. package/dist/{TablePlugin-4Zj0xZie.js.map → TablePlugin-FTN9oxnI.js.map} +1 -1
  13. package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
  14. package/dist/components/FormInput/FormInput.js +1 -1
  15. package/dist/components/InputField/InputField.stories.js +1 -1
  16. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  17. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  18. package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
  19. package/dist/components/MultiSelect/index.js +1 -1
  20. package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
  21. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
  22. package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
  23. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
  24. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +1 -1
  25. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +1 -1
  26. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +1 -1
  27. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +43 -49
  28. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
  29. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +1 -1
  30. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +2 -2
  31. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
  32. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
  33. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +2 -2
  34. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +1 -1
  35. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  36. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +2 -2
  37. package/dist/components/RteEditor/Plugins/index.js +2 -2
  38. package/dist/components/RteEditor/RteEditor.js +303 -312
  39. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  40. package/dist/components/RteEditor/RteEditor.stories.js +29 -29
  41. package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
  42. package/dist/components/RteEditor/helpers.d.ts +0 -1
  43. package/dist/components/RteEditor/helpers.js +18 -19
  44. package/dist/components/RteEditor/helpers.js.map +1 -1
  45. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +1 -1
  46. package/dist/components/index.js +1 -1
  47. package/dist/index.js +1 -1
  48. package/package.json +1 -1
@@ -1,68 +1,62 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
2
  import { o as y } from "../../../../LexicalComposerContext.prod-DOyoZx0P.js";
3
- import { T as N, C as v, y as I, n as D, a as f, c as S } from "../../../../LexicalList.prod-D6IAptR7.js";
4
- import { H as w } from "../../../../LexicalSelection.prod-ZvNRDI9l.js";
5
- import { useState as p, useEffect as K } from "react";
6
- import { c as x } from "../../../../clsx-OuTLNxxd.js";
7
- import { as as O, I as U, a0 as B, w as b, a as h, K as E, F } from "../../../../Lexical.prod-nXWuyOKD.js";
8
- import { Icon as T } from "../../../Icon/Icon.js";
3
+ import { T as f, C as _, y as N, n as D, a as b, c as P } from "../../../../LexicalList.prod--mkvX0uW.js";
4
+ import { useState as p, useEffect as v } from "react";
5
+ import { c as S } from "../../../../clsx-OuTLNxxd.js";
6
+ import { as as w, I as x, a0 as O, w as I, a as K, K as U } from "../../../../Lexical.prod-nXWuyOKD.js";
7
+ import { Icon as B } from "../../../Icon/Icon.js";
9
8
  import { s as l } from "../../../../RteEditor.module-CovRFt0S.js";
10
- import { useTranslation as $ } from "../../hooks/useTranslation.js";
11
- const j = {
9
+ import { useTranslation as E } from "../../hooks/useTranslation.js";
10
+ const T = {
12
11
  bullet: "BulletList",
13
12
  number: "NumberedList"
14
- }, z = ["bullet", "number"], W = () => {
15
- const u = $(), [e] = y(), [g, s] = p("paragraph"), [c, L] = p(!1), [m, C] = p(!1), P = () => {
16
- e.update(() => {
17
- const t = b();
18
- h(t) && w(t, () => F());
19
- });
20
- }, k = (t) => {
21
- t === "number" && g !== "number" ? (e.dispatchCommand(v, void 0), s("number")) : t === "bullet" && g !== "bullet" ? (e.dispatchCommand(I, void 0), s("bullet")) : (P(), s("paragraph"));
13
+ }, $ = ["bullet", "number"], M = () => {
14
+ const u = E(), [e] = y(), [h, s] = p(null), [c, g] = p(!1), [m, L] = p(!1), k = (t) => {
15
+ t === "number" && h !== "number" ? (e.dispatchCommand(_, void 0), s("number")) : t === "bullet" && h !== "bullet" ? (e.dispatchCommand(N, void 0), s("bullet")) : (e.dispatchCommand(f, void 0), s(null));
22
16
  };
23
- return K(() => {
17
+ return v(() => {
24
18
  const t = e.registerCommand(
25
- O,
26
- (r) => r.ctrlKey && r.shiftKey && r.code === "Digit7" ? (r.preventDefault(), m ? e.dispatchCommand(N, void 0) : e.dispatchCommand(v, void 0), !0) : r.ctrlKey && r.shiftKey && r.code === "Digit8" ? (r.preventDefault(), c ? e.dispatchCommand(N, void 0) : e.dispatchCommand(I, void 0), !0) : !1,
27
- U
19
+ w,
20
+ (o) => o.ctrlKey && o.shiftKey && o.code === "Digit7" ? (o.preventDefault(), m ? e.dispatchCommand(f, void 0) : e.dispatchCommand(_, void 0), !0) : o.ctrlKey && o.shiftKey && o.code === "Digit8" ? (o.preventDefault(), c ? e.dispatchCommand(f, void 0) : e.dispatchCommand(N, void 0), !0) : !1,
21
+ x
28
22
  );
29
23
  return () => {
30
24
  t();
31
25
  };
32
- }, [e, m, c]), K(() => {
26
+ }, [e, m, c]), v(() => {
33
27
  e.registerCommand(
34
- B,
35
- (r) => (r.preventDefault(), e.update(() => {
36
- const n = b();
37
- if (!h(n))
28
+ O,
29
+ (o) => (o.preventDefault(), e.update(() => {
30
+ const i = I();
31
+ if (!K(i))
38
32
  return;
39
- const o = n.anchor.getNode(), i = o.getParent();
40
- if (!D(i))
33
+ const r = i.anchor.getNode(), n = r.getParent();
34
+ if (!D(n))
41
35
  return;
42
- const a = i.getParent();
43
- if (f(a)) {
44
- const _ = S(f(a) ? a.getListType() : "bullet");
45
- i.append(_), _.append(o);
36
+ const a = n.getParent();
37
+ if (b(a)) {
38
+ const C = P(b(a) ? a.getListType() : "bullet");
39
+ n.append(C), C.append(r);
46
40
  }
47
41
  }), !0),
48
- E
42
+ U
49
43
  );
50
- const t = e.registerUpdateListener(({ editorState: r }) => {
51
- r.read(() => {
52
- const n = b();
53
- if (h(n)) {
54
- let o = n.anchor.getNode();
55
- for (; o !== null; ) {
56
- if (f(o)) {
57
- const a = o.getTag();
58
- L(a === "ul"), C(a === "ol"), a === "ul" && s("bullet"), a === "ol" && s("number");
44
+ const t = e.registerUpdateListener(({ editorState: o }) => {
45
+ o.read(() => {
46
+ const i = I();
47
+ if (K(i)) {
48
+ let r = i.anchor.getNode();
49
+ for (; r !== null; ) {
50
+ if (b(r)) {
51
+ const a = r.getTag();
52
+ g(a === "ul"), L(a === "ol"), a === "ul" && s("bullet"), a === "ol" && s("number");
59
53
  return;
60
54
  }
61
- const i = o.getParent();
62
- if (i === null) break;
63
- o = i;
55
+ const n = r.getParent();
56
+ if (n === null) break;
57
+ r = n;
64
58
  }
65
- L(!1), C(!1), s("paragraph");
59
+ g(!1), L(!1), s(null);
66
60
  }
67
61
  return !1;
68
62
  });
@@ -70,12 +64,12 @@ const j = {
70
64
  return () => {
71
65
  t();
72
66
  };
73
- }, [e]), /* @__PURE__ */ d("div", { className: l["editor__toolbar-button-group"], children: z.map((t) => /* @__PURE__ */ d(
67
+ }, [e]), /* @__PURE__ */ d("div", { className: l["editor__toolbar-button-group"], children: $.map((t) => /* @__PURE__ */ d(
74
68
  "button",
75
69
  {
76
70
  onClick: () => k(t),
77
71
  title: u.format[`${t}Tooltip`],
78
- className: x(
72
+ className: S(
79
73
  l["editor__toolbar-button"],
80
74
  l[`editor__toolbar-button--${t}`],
81
75
  t === "bullet" && c && l["editor__toolbar-button--active"],
@@ -84,12 +78,12 @@ const j = {
84
78
  "aria-label": u.aria.labels[t],
85
79
  "aria-keyshortcuts": u.aria.keyshortcuts[t],
86
80
  type: "button",
87
- children: /* @__PURE__ */ d(T, { name: j[t], size: 24 })
81
+ children: /* @__PURE__ */ d(B, { name: T[t], size: 24 })
88
82
  },
89
83
  t
90
84
  )) });
91
85
  };
92
86
  export {
93
- W as ListPlugin
87
+ M as ListPlugin
94
88
  };
95
89
  //# sourceMappingURL=ListPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ListPlugin/ListPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport {\n $createListNode,\n $isListItemNode,\n $isListNode,\n INSERT_ORDERED_LIST_COMMAND,\n INSERT_UNORDERED_LIST_COMMAND,\n REMOVE_LIST_COMMAND,\n} from '@lexical/list';\nimport { $setBlocksType } from '@lexical/selection';\nimport { useEffect, useState } from 'react';\nimport { clsx } from 'clsx';\nimport {\n $createParagraphNode,\n $getSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n KEY_DOWN_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical';\n\nimport type { ElementNode, RangeSelection } from 'lexical';\n\nimport { Icon } from 'components/Icon';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ntype ListTypesType = 'bullet' | 'number' | 'paragraph';\nconst LIST_TYPE_ICONS = {\n bullet: 'BulletList',\n number: 'NumberedList',\n};\n\nconst ListTypes = ['bullet', 'number'];\n\nexport const ListPlugin = () => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const [blockType, setBlockType] = useState<ListTypesType>('paragraph');\n const [isUList, setIsUList] = useState<boolean>(false);\n const [isOList, setIsOList] = useState<boolean>(false);\n\n const formatParagraph = () => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n $setBlocksType(selection, () => $createParagraphNode());\n }\n });\n };\n\n const formatList = (listType: ListTypesType): void => {\n if (listType === 'number' && blockType !== 'number') {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);\n setBlockType('number');\n } else if (listType === 'bullet' && blockType !== 'bullet') {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);\n setBlockType('bullet');\n } else {\n formatParagraph();\n setBlockType('paragraph');\n }\n };\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit7') {\n event.preventDefault();\n if (isOList) {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n } else {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);\n }\n return true;\n }\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit8') {\n event.preventDefault();\n if (isUList) {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n } else {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);\n }\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n return () => {\n removeKeyboardShortcut();\n };\n }, [editor, isOList, isUList]);\n\n useEffect(() => {\n editor.registerCommand(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault();\n editor.update(() => {\n const selection = $getSelection() as RangeSelection;\n if (!$isRangeSelection(selection)) {\n return;\n }\n\n const currentNode = selection.anchor.getNode();\n const parent = currentNode.getParent();\n if (!$isListItemNode(parent)) {\n return;\n }\n\n const listParent = parent.getParent();\n if ($isListNode(listParent)) {\n const newList = $createListNode($isListNode(listParent) ? listParent.getListType() : 'bullet');\n parent.append(newList);\n newList.append(currentNode);\n }\n });\n return true;\n },\n COMMAND_PRIORITY_LOW\n );\n\n const removeStatusListener = editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n let anchorNode = selection.anchor.getNode() as ElementNode;\n while (anchorNode !== null) {\n if ($isListNode(anchorNode)) {\n const tag = anchorNode.getTag();\n setIsUList(tag === 'ul');\n setIsOList(tag === 'ol');\n if (tag === 'ul') {\n setBlockType('bullet');\n }\n if (tag === 'ol') {\n setBlockType('number');\n }\n return;\n }\n const parentNode = anchorNode.getParent();\n if (parentNode === null) break;\n anchorNode = parentNode;\n }\n setIsUList(false);\n setIsOList(false);\n setBlockType('paragraph');\n }\n return false;\n });\n });\n\n return () => {\n removeStatusListener();\n };\n }, [editor]);\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n {ListTypes.map((listType) => (\n <button\n onClick={() => formatList(listType as ListTypesType)}\n key={listType}\n title={t.format[`${listType}Tooltip` as keyof typeof t.format]}\n className={clsx(\n styles['editor__toolbar-button'],\n styles[`editor__toolbar-button--${listType}`],\n listType === 'bullet' && isUList && styles['editor__toolbar-button--active'],\n listType === 'number' && isOList && styles['editor__toolbar-button--active']\n )}\n aria-label={t.aria.labels[listType as keyof typeof t.aria.labels]}\n aria-keyshortcuts={t.aria.keyshortcuts[listType as keyof typeof t.aria.keyshortcuts]}\n type=\"button\"\n >\n <Icon name={LIST_TYPE_ICONS[listType as keyof typeof Icon]} size={24} />\n </button>\n ))}\n </div>\n );\n};\n"],"names":["LIST_TYPE_ICONS","ListTypes","ListPlugin","t","useTranslation","editor","useLexicalComposerContext","blockType","setBlockType","useState","isUList","setIsUList","isOList","setIsOList","formatParagraph","selection","$getSelection","$isRangeSelection","$setBlocksType","$createParagraphNode","formatList","listType","INSERT_ORDERED_LIST_COMMAND","INSERT_UNORDERED_LIST_COMMAND","useEffect","removeKeyboardShortcut","KEY_DOWN_COMMAND","event","REMOVE_LIST_COMMAND","COMMAND_PRIORITY_EDITOR","KEY_TAB_COMMAND","currentNode","parent","$isListItemNode","listParent","$isListNode","newList","$createListNode","COMMAND_PRIORITY_LOW","removeStatusListener","editorState","anchorNode","tag","parentNode","jsx","styles","clsx","Icon"],"mappings":";;;;;;;;;;AA6BA,MAAMA,IAAkB;AAAA,EACtB,QAAQ;AAAA,EACR,QAAQ;AACV,GAEMC,IAAY,CAAC,UAAU,QAAQ,GAExBC,IAAa,MAAM;AAC9B,QAAMC,IAAIC,EAAA,GACJ,CAACC,CAAM,IAAIC,EAAA,GACX,CAACC,GAAWC,CAAY,IAAIC,EAAwB,WAAW,GAC/D,CAACC,GAASC,CAAU,IAAIF,EAAkB,EAA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nD,OAAOlB,EAAE,OAAO,GAAGkB,CAAQ,SAAkC;AAAA,MAC7D,WAAWyB;AAAA,QACTD,EAAO,wBAAwB;AAAA,QAC/BA,EAAO,2BAA2BxB,CAAQ,EAAE;AAAA,QAC5CA,MAAa,YAAYX,KAAWmC,EAAO,gCAAgC;AAAA,QAC3ExB,MAAa,YAAYT,KAAWiC,EAAO,gCAAgC;AAAA,MAAA;AAAA,MAE7E,cAAY1C,EAAE,KAAK,OAAOkB,CAAsC;AAAA,MAChE,qBAAmBlB,EAAE,KAAK,aAAakB,CAA4C;AAAA,MACnF,MAAK;AAAA,MAEL,4BAAC0B,GAAA,EAAK,MAAM/C,EAAgBqB,CAA6B,GAAG,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,IAZjEA;AAAA,EAAA,CAcR,GACH;AAEJ;"}
1
+ {"version":3,"file":"ListPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ListPlugin/ListPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport {\n $createListNode,\n $isListItemNode,\n $isListNode,\n INSERT_ORDERED_LIST_COMMAND,\n INSERT_UNORDERED_LIST_COMMAND,\n REMOVE_LIST_COMMAND,\n} from '@lexical/list';\nimport { useEffect, useState } from 'react';\nimport { clsx } from 'clsx';\nimport {\n $getSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n COMMAND_PRIORITY_LOW,\n KEY_DOWN_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical';\n\nimport type { ElementNode, RangeSelection } from 'lexical';\n\nimport { Icon } from 'components/Icon';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\ntype ListTypesType = 'bullet' | 'number' | null;\nconst LIST_TYPE_ICONS = {\n bullet: 'BulletList',\n number: 'NumberedList',\n};\n\nconst ListTypes = ['bullet', 'number'];\n\nexport const ListPlugin = () => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const [blockType, setBlockType] = useState<ListTypesType>(null);\n const [isUList, setIsUList] = useState<boolean>(false);\n const [isOList, setIsOList] = useState<boolean>(false);\n\n const formatList = (listType: ListTypesType): void => {\n if (listType === 'number' && blockType !== 'number') {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);\n setBlockType('number');\n } else if (listType === 'bullet' && blockType !== 'bullet') {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);\n setBlockType('bullet');\n } else {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n setBlockType(null);\n }\n };\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit7') {\n event.preventDefault();\n if (isOList) {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n } else {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);\n }\n return true;\n }\n if (event.ctrlKey && event.shiftKey && event.code === 'Digit8') {\n event.preventDefault();\n if (isUList) {\n editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);\n } else {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);\n }\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n return () => {\n removeKeyboardShortcut();\n };\n }, [editor, isOList, isUList]);\n\n useEffect(() => {\n editor.registerCommand(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault();\n editor.update(() => {\n const selection = $getSelection() as RangeSelection;\n if (!$isRangeSelection(selection)) {\n return;\n }\n\n const currentNode = selection.anchor.getNode();\n const parent = currentNode.getParent();\n if (!$isListItemNode(parent)) {\n return;\n }\n\n const listParent = parent.getParent();\n if ($isListNode(listParent)) {\n const newList = $createListNode($isListNode(listParent) ? listParent.getListType() : 'bullet');\n parent.append(newList);\n newList.append(currentNode);\n }\n });\n return true;\n },\n COMMAND_PRIORITY_LOW\n );\n\n const removeStatusListener = editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n let anchorNode = selection.anchor.getNode() as ElementNode;\n while (anchorNode !== null) {\n if ($isListNode(anchorNode)) {\n const tag = anchorNode.getTag();\n setIsUList(tag === 'ul');\n setIsOList(tag === 'ol');\n if (tag === 'ul') {\n setBlockType('bullet');\n }\n if (tag === 'ol') {\n setBlockType('number');\n }\n return;\n }\n const parentNode = anchorNode.getParent();\n if (parentNode === null) break;\n anchorNode = parentNode;\n }\n setIsUList(false);\n setIsOList(false);\n setBlockType(null);\n }\n return false;\n });\n });\n\n return () => {\n removeStatusListener();\n };\n }, [editor]);\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n {ListTypes.map((listType) => (\n <button\n onClick={() => formatList(listType as ListTypesType)}\n key={listType}\n title={t.format[`${listType}Tooltip` as keyof typeof t.format]}\n className={clsx(\n styles['editor__toolbar-button'],\n styles[`editor__toolbar-button--${listType}`],\n listType === 'bullet' && isUList && styles['editor__toolbar-button--active'],\n listType === 'number' && isOList && styles['editor__toolbar-button--active']\n )}\n aria-label={t.aria.labels[listType as keyof typeof t.aria.labels]}\n aria-keyshortcuts={t.aria.keyshortcuts[listType as keyof typeof t.aria.keyshortcuts]}\n type=\"button\"\n >\n <Icon name={LIST_TYPE_ICONS[listType as keyof typeof Icon]} size={24} />\n </button>\n ))}\n </div>\n );\n};\n"],"names":["LIST_TYPE_ICONS","ListTypes","ListPlugin","t","useTranslation","editor","useLexicalComposerContext","blockType","setBlockType","useState","isUList","setIsUList","isOList","setIsOList","formatList","listType","INSERT_ORDERED_LIST_COMMAND","INSERT_UNORDERED_LIST_COMMAND","REMOVE_LIST_COMMAND","useEffect","removeKeyboardShortcut","KEY_DOWN_COMMAND","event","COMMAND_PRIORITY_EDITOR","KEY_TAB_COMMAND","selection","$getSelection","$isRangeSelection","currentNode","parent","$isListItemNode","listParent","$isListNode","newList","$createListNode","COMMAND_PRIORITY_LOW","removeStatusListener","editorState","anchorNode","tag","parentNode","jsx","styles","clsx","Icon"],"mappings":";;;;;;;;;AA2BA,MAAMA,IAAkB;AAAA,EACtB,QAAQ;AAAA,EACR,QAAQ;AACV,GAEMC,IAAY,CAAC,UAAU,QAAQ,GAExBC,IAAa,MAAM;AAC9B,QAAMC,IAAIC,EAAA,GACJ,CAACC,CAAM,IAAIC,EAAA,GACX,CAACC,GAAWC,CAAY,IAAIC,EAAwB,IAAI,GACxD,CAACC,GAASC,CAAU,IAAIF,EAAkB,EAAK,GAC/C,CAACG,GAASC,CAAU,IAAIJ,EAAkB,EAAK,GAE/CK,IAAa,CAACC,MAAkC;AACpD,IAAIA,MAAa,YAAYR,MAAc,YACzCF,EAAO,gBAAgBW,GAA6B,MAAS,GAC7DR,EAAa,QAAQ,KACZO,MAAa,YAAYR,MAAc,YAChDF,EAAO,gBAAgBY,GAA+B,MAAS,GAC/DT,EAAa,QAAQ,MAErBH,EAAO,gBAAgBa,GAAqB,MAAS,GACrDV,EAAa,IAAI;AAAA,EAErB;AAEA,SAAAW,EAAU,MAAM;AACd,UAAMC,IAAyBf,EAAO;AAAA,MACpCgB;AAAAA,MACA,CAACC,MACKA,EAAM,WAAWA,EAAM,YAAYA,EAAM,SAAS,YACpDA,EAAM,eAAA,GACFV,IACFP,EAAO,gBAAgBa,GAAqB,MAAS,IAErDb,EAAO,gBAAgBW,GAA6B,MAAS,GAExD,MAELM,EAAM,WAAWA,EAAM,YAAYA,EAAM,SAAS,YACpDA,EAAM,eAAA,GACFZ,IACFL,EAAO,gBAAgBa,GAAqB,MAAS,IAErDb,EAAO,gBAAgBY,GAA+B,MAAS,GAE1D,MAEF;AAAA,MAETM;AAAAA,IAAA;AAGF,WAAO,MAAM;AACX,MAAAH,EAAA;AAAA,IACF;AAAA,EACF,GAAG,CAACf,GAAQO,GAASF,CAAO,CAAC,GAE7BS,EAAU,MAAM;AACd,IAAAd,EAAO;AAAA,MACLmB;AA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M,CAAC,GAGT,gBAAAoC,EAAC,SAAI,WAAWC,EAAO,8BAA8B,GAClD,UAAAzC,EAAU,IAAI,CAACc,MACd,gBAAA0B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,MAAM3B,EAAWC,CAAyB;AAAA,MAEnD,OAAOZ,EAAE,OAAO,GAAGY,CAAQ,SAAkC;AAAA,MAC7D,WAAW4B;AAAA,QACTD,EAAO,wBAAwB;AAAA,QAC/BA,EAAO,2BAA2B3B,CAAQ,EAAE;AAAA,QAC5CA,MAAa,YAAYL,KAAWgC,EAAO,gCAAgC;AAAA,QAC3E3B,MAAa,YAAYH,KAAW8B,EAAO,gCAAgC;AAAA,MAAA;AAAA,MAE7E,cAAYvC,EAAE,KAAK,OAAOY,CAAsC;AAAA,MAChE,qBAAmBZ,EAAE,KAAK,aAAaY,CAA4C;AAAA,MACnF,MAAK;AAAA,MAEL,4BAAC6B,GAAA,EAAK,MAAM5C,EAAgBe,CAA6B,GAAG,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,IAZjEA;AAAA,EAAA,CAcR,GACH;AAEJ;"}
@@ -2,7 +2,7 @@ import { o as m } from "../../../../LexicalComposerContext.prod-DOyoZx0P.js";
2
2
  import { useEffect as c } from "react";
3
3
  import { af as f, R as p, w as u } from "../../../../Lexical.prod-nXWuyOKD.js";
4
4
  import { L as i } from "../../../../LexicalUtils.prod-Ckfw0Hjt.js";
5
- import { A as d } from "../../../../LexicalClipboard.prod-BP8LNbol.js";
5
+ import { A as d } from "../../../../LexicalClipboard.prod-pXq91TBU.js";
6
6
  import { d as D } from "../../../../index-yEhaxKq-.js";
7
7
  const P = () => {
8
8
  const [e] = m(), l = (t) => {
@@ -1,8 +1,8 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../../../LexicalComposerContext.prod-DOyoZx0P.js";
4
- import { T as b } from "../../../../TableCellResizerPlugin-DFzNK-ve.js";
5
- import "../../../../LexicalTable.prod-DJktN6jF.js";
4
+ import { T as b } from "../../../../TableCellResizerPlugin-Cpbankb8.js";
5
+ import "../../../../LexicalTable.prod-Bexd4dGG.js";
6
6
  import "../../../../LexicalUtils.prod-Ckfw0Hjt.js";
7
7
  import "../../../../Lexical.prod-nXWuyOKD.js";
8
8
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { T as r } from "../../../../TableCellResizerPlugin-DFzNK-ve.js";
1
+ import { T as r } from "../../../../TableCellResizerPlugin-Cpbankb8.js";
2
2
  export {
3
3
  r as TableCellResizerPlugin
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { b as E } from "../../../../TablePlugin-4Zj0xZie.js";
3
+ import { b as E } from "../../../../TablePlugin-FTN9oxnI.js";
4
4
  import "../../../Accordion/Accordion.js";
5
5
  import "../../../Buttons/Button.js";
6
6
  import "../../../Buttons/LinkButton.js";
@@ -1,11 +1,11 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../../../LexicalComposerContext.prod-DOyoZx0P.js";
3
3
  import "../../../../clsx-OuTLNxxd.js";
4
- import "../../../../LexicalTable.prod-DJktN6jF.js";
4
+ import "../../../../LexicalTable.prod-Bexd4dGG.js";
5
5
  import "../../../../Lexical.prod-nXWuyOKD.js";
6
6
  import "../../../../LexicalUtils.prod-Ckfw0Hjt.js";
7
7
  import "react";
8
- import { T as K } from "../../../../TablePlugin-4Zj0xZie.js";
8
+ import { T as K } from "../../../../TablePlugin-FTN9oxnI.js";
9
9
  import "./helpers.js";
10
10
  import "../../nodes/TableWrapperNode/TableWrapperNode.js";
11
11
  import "../../hooks/useFlyout.js";
@@ -1,4 +1,4 @@
1
- import { V as T, R as i, H as w, n as p, B as u, P as b, a as E, z as R, K as g, Y as D, L as I, v as x } from "../../../../LexicalTable.prod-DJktN6jF.js";
1
+ import { V as T, R as i, H as w, n as p, B as u, P as b, a as E, z as R, K as g, Y as D, L as I, v as x } from "../../../../LexicalTable.prod-Bexd4dGG.js";
2
2
  import { F as S } from "../../../../Lexical.prod-nXWuyOKD.js";
3
3
  import { TableWrapperNode as N } from "../../nodes/TableWrapperNode/TableWrapperNode.js";
4
4
  const y = 32, a = 48, W = 1, O = 200, P = 320, H = (t, e) => {
@@ -1,4 +1,4 @@
1
- import { T as o } from "../../../../TablePlugin-4Zj0xZie.js";
1
+ import { T as o } from "../../../../TablePlugin-FTN9oxnI.js";
2
2
  import { TableCellContextMenu as t } from "./TableCellContextMenu/TableCellContextMenu.js";
3
3
  export {
4
4
  t as TableCellContextMenu,
@@ -2,12 +2,12 @@ import { jsxs as P, jsx as n } from "react/jsx-runtime";
2
2
  import { o as y } from "../../../../LexicalComposerContext.prod-DOyoZx0P.js";
3
3
  import { w as f, a as h, k as C } from "../../../../Lexical.prod-nXWuyOKD.js";
4
4
  import { useState as L, useRef as E, useCallback as k, useEffect as c } from "react";
5
- import { W as g } from "../../../../LexicalTable.prod-DJktN6jF.js";
5
+ import { W as g } from "../../../../LexicalTable.prod-Bexd4dGG.js";
6
6
  import { BlockFormatPlugin as T } from "../BlockFormatPlugin/BlockFormatPlugin.js";
7
7
  import { ListPlugin as N } from "../ListPlugin/ListPlugin.js";
8
8
  import { LinkPlugin as x } from "../LinkPlugin/LinkPlugin.js";
9
9
  import { HistoryPlugin as B } from "../HistoryPlugin/HistoryPlugin.js";
10
- import { T as S } from "../../../../TablePlugin-4Zj0xZie.js";
10
+ import { T as S } from "../../../../TablePlugin-FTN9oxnI.js";
11
11
  import { TableCellContextMenu as z } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
12
12
  import "react-dom";
13
13
  import "../../../../index-yEhaxKq-.js";
@@ -3,9 +3,9 @@ import { BlockFormatPlugin as t } from "./BlockFormatPlugin/BlockFormatPlugin.js
3
3
  import { ListPlugin as n } from "./ListPlugin/ListPlugin.js";
4
4
  import { LinkPlugin as g, getLinkNodeTag as m } from "./LinkPlugin/LinkPlugin.js";
5
5
  import { HistoryPlugin as f } from "./HistoryPlugin/HistoryPlugin.js";
6
- import { T as u } from "../../../TablePlugin-4Zj0xZie.js";
6
+ import { T as u } from "../../../TablePlugin-FTN9oxnI.js";
7
7
  import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
8
- import { T as b } from "../../../TableCellResizerPlugin-DFzNK-ve.js";
8
+ import { T as b } from "../../../TableCellResizerPlugin-Cpbankb8.js";
9
9
  import { PasteHandlerPlugin as C } from "./PasteHandlerPlugin/PasteHandlerPlugin.js";
10
10
  export {
11
11
  t as BlockFormatPlugin,