@uva-glass/component-library 1.51.0 → 1.52.1

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 (60) hide show
  1. package/dist/{Lexical.prod-DSsdOWxu.js → Lexical.prod-zUeT_jIr.js} +253 -246
  2. package/dist/Lexical.prod-zUeT_jIr.js.map +1 -0
  3. package/dist/LexicalUtils.prod-DtRifALg.js +64 -0
  4. package/dist/LexicalUtils.prod-DtRifALg.js.map +1 -0
  5. package/dist/ListPlugin-CxyYg2bv.js +588 -0
  6. package/dist/ListPlugin-CxyYg2bv.js.map +1 -0
  7. package/dist/RteEditor.module--4R0Ql6Y.js +26 -0
  8. package/dist/RteEditor.module--4R0Ql6Y.js.map +1 -0
  9. package/dist/assets/HorizontalList.css +1 -1
  10. package/dist/assets/RteEditor.css +1 -1
  11. package/dist/assets/useFlyout.css +1 -0
  12. package/dist/components/Buttons/Button.stories.js +1 -1
  13. package/dist/components/Buttons/Button.stories.js.map +1 -1
  14. package/dist/components/Buttons/LinkButton.stories.js +5 -5
  15. package/dist/components/Buttons/LinkButton.stories.js.map +1 -1
  16. package/dist/components/Buttons/MenuButton.stories.js +10 -10
  17. package/dist/components/Buttons/MenuButton.stories.js.map +1 -1
  18. package/dist/components/HorizontalList/HorizontalList.d.ts +3 -2
  19. package/dist/components/HorizontalList/HorizontalList.js +10 -9
  20. package/dist/components/HorizontalList/HorizontalList.js.map +1 -1
  21. package/dist/components/HorizontalList/HorizontalList.stories.d.ts +1 -0
  22. package/dist/components/HorizontalList/HorizontalList.stories.js +35 -14
  23. package/dist/components/HorizontalList/HorizontalList.stories.js.map +1 -1
  24. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
  25. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +6 -0
  26. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +98 -0
  27. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -0
  28. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.d.ts +8 -0
  29. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +7 -0
  30. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -0
  31. package/dist/components/RteEditor/Plugins/LinkPlugin/index.d.ts +1 -0
  32. package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +5 -0
  33. package/dist/components/RteEditor/Plugins/LinkPlugin/index.js.map +1 -0
  34. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
  35. package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
  36. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +6 -0
  37. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +33 -28
  38. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  39. package/dist/components/RteEditor/Plugins/index.js +1 -1
  40. package/dist/components/RteEditor/RteEditor.js +532 -457
  41. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  42. package/dist/components/RteEditor/RteEditor.stories.js +1 -1
  43. package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
  44. package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
  45. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +5 -4
  46. package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
  47. package/dist/components/RteEditor/hooks/index.d.ts +1 -0
  48. package/dist/components/RteEditor/hooks/index.js +5 -0
  49. package/dist/components/RteEditor/hooks/index.js.map +1 -0
  50. package/dist/components/RteEditor/hooks/useFlyout.d.ts +12 -0
  51. package/dist/components/RteEditor/hooks/useFlyout.js +45 -0
  52. package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -0
  53. package/dist/helpers-DpGAANJ8.js +365 -0
  54. package/dist/helpers-DpGAANJ8.js.map +1 -0
  55. package/package.json +15 -15
  56. package/dist/Lexical.prod-DSsdOWxu.js.map +0 -1
  57. package/dist/ListPlugin-Bu2AbCDB.js +0 -643
  58. package/dist/ListPlugin-Bu2AbCDB.js.map +0 -1
  59. package/dist/RteEditor.module-RkKUrkOO.js +0 -21
  60. package/dist/RteEditor.module-RkKUrkOO.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import "react/jsx-runtime";
2
- import "../../../../Lexical.prod-DSsdOWxu.js";
3
- import { L as a } from "../../../../ListPlugin-Bu2AbCDB.js";
2
+ import "../../../../Lexical.prod-zUeT_jIr.js";
3
+ import { L as a } from "../../../../ListPlugin-CxyYg2bv.js";
4
4
  import "react";
5
5
  import "../../../../clsx-OuTLNxxd.js";
6
6
  import "../../../Icon/Icon.js";
7
- import "../../../../RteEditor.module-RkKUrkOO.js";
7
+ import "../../../../RteEditor.module--4R0Ql6Y.js";
8
8
  export {
9
9
  a as ListPlugin
10
10
  };
@@ -1,4 +1,4 @@
1
- import { L as r } from "../../../../ListPlugin-Bu2AbCDB.js";
1
+ import { L as r } from "../../../../ListPlugin-CxyYg2bv.js";
2
2
  export {
3
3
  r as ListPlugin
4
4
  };
@@ -1 +1,7 @@
1
+ export type TargetType = '_blank' | '_self';
2
+ export interface LinkType {
3
+ active: boolean;
4
+ url: string;
5
+ target: TargetType | string;
6
+ }
1
7
  export declare const ToolBarPlugin: () => JSX.Element;
@@ -1,38 +1,43 @@
1
- import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
- import { u as I, I as h, m as L } from "../../../../Lexical.prod-DSsdOWxu.js";
3
- import { useState as e, useCallback as N, useEffect as b } from "react";
4
- import { H as B, L as P } from "../../../../ListPlugin-Bu2AbCDB.js";
5
- import { BlockFormatPlugin as x } from "../BlockFormatPlugin/BlockFormatPlugin.js";
6
- import { s as F } from "../../../../RteEditor.module-RkKUrkOO.js";
7
- const w = () => {
8
- const [a] = I(), [c, f] = e(!1), [m, u] = e(!1), [d, o] = e(!1), [g, r] = e(!1), l = N(() => {
9
- const s = h();
10
- if (L(s)) {
11
- f(s.hasFormat("bold")), u(s.hasFormat("italic"));
12
- let t = s.anchor.getNode();
13
- for (; t !== null; ) {
14
- if (B(t)) {
15
- const i = t.getTag();
16
- o(i === "ul"), r(i === "ol");
17
- return;
18
- }
19
- t = t.getParent();
20
- }
21
- o(!1), r(!1);
1
+ import { jsxs as _, jsx as a } from "react/jsx-runtime";
2
+ import { u as I, I as k, m as N } from "../../../../Lexical.prod-zUeT_jIr.js";
3
+ import { useState as r, useCallback as P, useEffect as b } from "react";
4
+ import { L as B, H as h } from "../../../../ListPlugin-CxyYg2bv.js";
5
+ import { g as v } from "../../../../helpers-DpGAANJ8.js";
6
+ import { LinkPlugin as x } from "../LinkPlugin/LinkPlugin.js";
7
+ import { BlockFormatPlugin as F } from "../BlockFormatPlugin/BlockFormatPlugin.js";
8
+ import { s as U } from "../../../../RteEditor.module--4R0Ql6Y.js";
9
+ const n = (o, s) => {
10
+ let t = o, i;
11
+ for (; t !== null; ) {
12
+ if (s === "a" && v(t))
13
+ return { active: !0, url: t.__url, target: t.__target ? t.__target : "_self" };
14
+ if ((s === "ul" || s === "ol") && h(t))
15
+ return i = t.getTag(), i === s;
16
+ t = t.getParent();
17
+ }
18
+ return !1;
19
+ }, T = () => {
20
+ const [o] = I(), [s, t] = r(!1), [i, c] = r(!1), [m, u] = r(!1), [d, g] = r(!1), [p, L] = r({ active: !1, url: "", target: "_self" }), f = P(() => {
21
+ const e = k();
22
+ if (N(e)) {
23
+ t(e.hasFormat("bold")), c(e.hasFormat("italic"));
24
+ const l = e.anchor.getNode();
25
+ u(n(l, "ul")), g(n(l, "ol")), L(n(l, "a"));
22
26
  }
23
27
  }, []);
24
28
  return b(() => {
25
- a.registerUpdateListener(({ editorState: s }) => {
26
- s.read(() => {
27
- l();
29
+ o.registerUpdateListener(({ editorState: e }) => {
30
+ e.read(() => {
31
+ f();
28
32
  });
29
33
  });
30
- }, [a, l]), /* @__PURE__ */ p("div", { className: F.editor__toolbar, children: [
31
- /* @__PURE__ */ n(x, { isBold: c, isItalic: m }),
32
- /* @__PURE__ */ n(P, { isUList: d, isOList: g })
34
+ }, [o, f]), /* @__PURE__ */ _("div", { className: U.editor__toolbar, children: [
35
+ /* @__PURE__ */ a(F, { isBold: s, isItalic: i }),
36
+ /* @__PURE__ */ a(B, { isUList: m, isOList: d }),
37
+ /* @__PURE__ */ a(x, { isLink: p })
33
38
  ] });
34
39
  };
35
40
  export {
36
- w as ToolBarPlugin
41
+ T as ToolBarPlugin
37
42
  };
38
43
  //# sourceMappingURL=ToolbarPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { $getSelection, $isRangeSelection } from 'lexical';\nimport { useCallback, useEffect, useState } from 'react';\nimport { $isListNode } from '@lexical/list';\n\nimport type { ElementNode, TextNode } from 'lexical';\n\nimport { BlockFormatPlugin, ListPlugin } from 'components/RteEditor/Plugins';\nimport styles from 'components/RteEditor/RteEditor.module.css';\n\nexport const ToolBarPlugin = (): JSX.Element => {\n const [editor] = useLexicalComposerContext();\n const [isBold, setIsBold] = useState(false);\n const [isItalic, setIsItalic] = useState(false);\n const [isUList, setIsUList] = useState(false);\n const [isOList, setIsOList] = useState(false);\n\n const updateToolbar = useCallback(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n setIsBold(selection.hasFormat('bold'));\n setIsItalic(selection.hasFormat('italic'));\n\n const anchorNode = selection.anchor.getNode();\n let currentNode: TextNode | ElementNode | null = anchorNode;\n while (currentNode !== null) {\n if ($isListNode(currentNode)) {\n const tag = currentNode.getTag();\n tag === 'ul' ? setIsUList(true) : setIsUList(false);\n tag === 'ol' ? setIsOList(true) : setIsOList(false);\n return;\n }\n currentNode = currentNode.getParent();\n }\n setIsUList(false);\n setIsOList(false);\n }\n }, []);\n\n useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n return (\n <div className={styles['editor__toolbar']}>\n <BlockFormatPlugin isBold={isBold} isItalic={isItalic} />\n <ListPlugin isUList={isUList} isOList={isOList} />\n </div>\n );\n};\n"],"names":["ToolBarPlugin","editor","useLexicalComposerContext","isBold","setIsBold","useState","isItalic","setIsItalic","isUList","setIsUList","isOList","setIsOList","updateToolbar","useCallback","selection","$getSelection","$isRangeSelection","currentNode","$isListNode","tag","useEffect","editorState","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin"],"mappings":";;;;;;AAUO,MAAMA,IAAgB,MAAmB;AACxC,QAAA,CAACC,CAAM,IAAIC,KACX,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAK,GACxC,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK,GACtC,CAACK,GAASC,CAAU,IAAIN,EAAS,EAAK,GAEtCO,IAAgBC,EAAY,MAAM;AACtC,UAAMC,IAAYC;AACd,QAAAC,EAAkBF,CAAS,GAAG;AACtB,MAAAV,EAAAU,EAAU,UAAU,MAAM,CAAC,GACzBP,EAAAO,EAAU,UAAU,QAAQ,CAAC;AAGzC,UAAIG,IADeH,EAAU,OAAO,QAAQ;AAE5C,aAAOG,MAAgB,QAAM;AACvB,YAAAC,EAAYD,CAAW,GAAG;AACtB,gBAAAE,IAAMF,EAAY;AACxB,UAAeR,EAAfU,MAAQ,IAAsB,GACfR,EAAfQ,MAAQ,IAAsB;AAC9B;AAAA,QACF;AACA,QAAAF,IAAcA,EAAY;MAC5B;AACA,MAAAR,EAAW,EAAK,GAChBE,EAAW,EAAK;AAAA,IAClB;AAAA,EACF,GAAG,CAAE,CAAA;AAEL,SAAAS,EAAU,MAAM;AACd,IAAAnB,EAAO,uBAAuB,CAAC,EAAE,aAAAoB,QAAkB;AACjD,MAAAA,EAAY,KAAK,MAAM;AACP,QAAAT;MAAA,CACf;AAAA,IAAA,CACF;AAAA,EAAA,GACA,CAACX,GAAQW,CAAa,CAAC,GAGvB,gBAAAU,EAAA,OAAA,EAAI,WAAWC,EAAO,iBACrB,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAkB,QAAAtB,GAAgB,UAAAG,EAAoB,CAAA;AAAA,IACvD,gBAAAkB,EAACE,GAAW,EAAA,SAAAlB,GAAkB,SAAAE,EAAkB,CAAA;AAAA,EAClD,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"ToolbarPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { $getSelection, $isRangeSelection } from 'lexical';\nimport { useCallback, useEffect, useState } from 'react';\nimport { $isListNode } from '@lexical/list';\nimport { $isLinkNode } from '@lexical/link';\n\nimport type { ElementNode, TextNode } from 'lexical';\n\nimport { LinkPlugin } from 'components/RteEditor/Plugins/LinkPlugin';\nimport { BlockFormatPlugin, ListPlugin } from 'components/RteEditor/Plugins';\nimport styles from 'components/RteEditor/RteEditor.module.css';\n\nexport type TargetType = '_blank' | '_self';\nexport interface LinkType {\n active: boolean;\n url: string;\n target: TargetType | string;\n}\n\nconst getNodeTag = (anchorNode: ElementNode | TextNode, tagToMatch: string): boolean | LinkType => {\n let currentNode: TextNode | ElementNode | null = anchorNode;\n let tag: string | null;\n\n while (currentNode !== null) {\n if (tagToMatch === 'a') {\n if ($isLinkNode(currentNode)) {\n return { active: true, url: currentNode.__url, target: !currentNode.__target ? '_self' : currentNode.__target };\n }\n }\n\n if (tagToMatch === 'ul' || tagToMatch === 'ol') {\n if ($isListNode(currentNode)) {\n tag = currentNode.getTag();\n return tag === tagToMatch;\n }\n }\n\n currentNode = currentNode.getParent();\n }\n\n return false;\n};\n\nexport const ToolBarPlugin = (): JSX.Element => {\n const [editor] = useLexicalComposerContext();\n const [isBold, setIsBold] = useState(false);\n const [isItalic, setIsItalic] = useState(false);\n const [isUList, setIsUList] = useState<boolean>(false);\n const [isOList, setIsOList] = useState<boolean>(false);\n const [isLink, setIsLink] = useState<LinkType>({ active: false, url: '', target: '_self' });\n\n const updateToolbar = useCallback(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n setIsBold(selection.hasFormat('bold'));\n setIsItalic(selection.hasFormat('italic'));\n\n const anchorNode = selection.anchor.getNode();\n setIsUList(getNodeTag(anchorNode, 'ul') as boolean);\n setIsOList(getNodeTag(anchorNode, 'ol') as boolean);\n setIsLink(getNodeTag(anchorNode, 'a') as LinkType);\n }\n }, []);\n\n useEffect(() => {\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n updateToolbar();\n });\n });\n }, [editor, updateToolbar]);\n\n return (\n <div className={styles['editor__toolbar']}>\n <BlockFormatPlugin isBold={isBold} isItalic={isItalic} />\n <ListPlugin isUList={isUList} isOList={isOList} />\n <LinkPlugin isLink={isLink} />\n </div>\n );\n};\n"],"names":["getNodeTag","anchorNode","tagToMatch","currentNode","tag","$isLinkNode","$isListNode","ToolBarPlugin","editor","useLexicalComposerContext","isBold","setIsBold","useState","isItalic","setIsItalic","isUList","setIsUList","isOList","setIsOList","isLink","setIsLink","updateToolbar","useCallback","selection","$getSelection","$isRangeSelection","useEffect","editorState","jsxs","styles","jsx","BlockFormatPlugin","ListPlugin","LinkPlugin"],"mappings":";;;;;;;;AAmBA,MAAMA,IAAa,CAACC,GAAoCC,MAA2C;AACjG,MAAIC,IAA6CF,GAC7CG;AAEJ,SAAOD,MAAgB,QAAM;AAC3B,QAAID,MAAe,OACbG,EAAYF,CAAW;AACzB,aAAO,EAAE,QAAQ,IAAM,KAAKA,EAAY,OAAO,QAASA,EAAY,WAAqBA,EAAY,WAAtB,QAA+B;AAI9G,SAAAD,MAAe,QAAQA,MAAe,SACpCI,EAAYH,CAAW;AACzB,aAAAC,IAAM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AA,EAC9B,EAAA,CAAA;AAEJ;"}
@@ -1,6 +1,6 @@
1
1
  import { ToolBarPlugin as l } from "./ToolbarPlugin/ToolbarPlugin.js";
2
2
  import { BlockFormatPlugin as i } from "./BlockFormatPlugin/BlockFormatPlugin.js";
3
- import { L as a } from "../../../ListPlugin-Bu2AbCDB.js";
3
+ import { L as a } from "../../../ListPlugin-CxyYg2bv.js";
4
4
  export {
5
5
  i as BlockFormatPlugin,
6
6
  a as ListPlugin,