@uva-glass/component-library 1.49.0 → 1.50.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.
- package/dist/Lexical.prod-DSsdOWxu.js +4043 -0
- package/dist/Lexical.prod-DSsdOWxu.js.map +1 -0
- package/dist/ListPlugin-Bu2AbCDB.js +643 -0
- package/dist/ListPlugin-Bu2AbCDB.js.map +1 -0
- package/dist/RteEditor.module-RkKUrkOO.js +21 -0
- package/dist/RteEditor.module-RkKUrkOO.js.map +1 -0
- package/dist/assets/CheckboxButton.css +1 -1
- package/dist/assets/RteEditor.css +1 -0
- package/dist/components/CheckboxButton/CheckboxButton.js +29 -29
- package/dist/components/Icon/icons/index.d.ts +12 -0
- package/dist/components/Icon/icons/index.js +93 -73
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.d.ts +6 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +32 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.d.ts +6 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +11 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +38 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/index.d.ts +3 -0
- package/dist/components/RteEditor/Plugins/index.js +9 -0
- package/dist/components/RteEditor/Plugins/index.js.map +1 -0
- package/dist/components/RteEditor/RteEditor.d.ts +7 -0
- package/dist/components/RteEditor/RteEditor.js +833 -0
- package/dist/components/RteEditor/RteEditor.js.map +1 -0
- package/dist/components/RteEditor/RteEditor.stories.d.ts +6 -0
- package/dist/components/RteEditor/RteEditor.stories.js +40 -0
- package/dist/components/RteEditor/RteEditor.stories.js.map +1 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +11 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +16 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -0
- package/dist/components/RteEditor/UvaTheme/index.d.ts +1 -0
- package/dist/components/RteEditor/UvaTheme/index.js +5 -0
- package/dist/components/RteEditor/UvaTheme/index.js.map +1 -0
- package/dist/components/RteEditor/index.d.ts +1 -0
- package/dist/components/RteEditor/index.js +5 -0
- package/dist/components/RteEditor/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +23 -21
- package/dist/components/index.js.map +1 -1
- package/dist/index-DsprzSCj.js +19067 -0
- package/dist/index-DsprzSCj.js.map +1 -0
- package/dist/index.js +23 -21
- package/dist/index.js.map +1 -1
- package/dist/{react-18-m8Z-Ep7B.js → react-18-C0Aiha-e.js} +2 -2
- package/dist/{react-18-m8Z-Ep7B.js.map → react-18-C0Aiha-e.js.map} +1 -1
- package/dist/storybook__react.d.js +1993 -1
- package/dist/storybook__react.d.js.map +1 -1
- package/package.json +23 -17
- package/dist/storybook__react.d-fgYZl9aD.js +0 -21053
- package/dist/storybook__react.d-fgYZl9aD.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { u as m, d as n } from "../../../../Lexical.prod-DSsdOWxu.js";
|
|
3
|
+
import { c as s } from "../../../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { Icon as d } from "../../../Icon/Icon.js";
|
|
5
|
+
import { s as t } from "../../../../RteEditor.module-RkKUrkOO.js";
|
|
6
|
+
const b = {
|
|
7
|
+
bold: "FormatBold",
|
|
8
|
+
italic: "FormatItalic"
|
|
9
|
+
}, e = ["bold", "italic"], p = ({ isBold: i, isItalic: a }) => {
|
|
10
|
+
const [l] = m(), c = (o) => {
|
|
11
|
+
l.dispatchCommand(n, o);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ r("div", { className: t["editor__toolbar-button-group"], children: e.map((o) => /* @__PURE__ */ r(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
onClick: () => c(o),
|
|
17
|
+
className: s(
|
|
18
|
+
t["editor__toolbar-button"],
|
|
19
|
+
t[`editor__toolbar-button--${o}`],
|
|
20
|
+
o === "bold" && i && t["editor__toolbar-button--active"],
|
|
21
|
+
o === "italic" && a && t["editor__toolbar-button--active"]
|
|
22
|
+
),
|
|
23
|
+
"aria-label": `Format ${o}`,
|
|
24
|
+
children: /* @__PURE__ */ r(d, { name: b[o], size: 20 })
|
|
25
|
+
},
|
|
26
|
+
o
|
|
27
|
+
)) });
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
p as BlockFormatPlugin
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=BlockFormatPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockFormatPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport clsx from 'clsx';\nimport { FORMAT_TEXT_COMMAND } from 'lexical';\n\nimport { Icon } from 'components/Icon';\nimport styles from 'components/RteEditor/RteEditor.module.css';\n\ntype BlockTypesType = 'bold' | 'italic';\nconst BLOCK_TYPE_ICONS = {\n bold: 'FormatBold',\n italic: 'FormatItalic',\n};\n\ninterface BlockFormatPluginProps {\n isBold: boolean;\n isItalic: boolean;\n}\n\nconst BlockTypes = ['bold', 'italic'];\n\nexport const BlockFormatPlugin = ({ isBold, isItalic }: BlockFormatPluginProps): JSX.Element => {\n const [editor] = useLexicalComposerContext();\n const onClick = (type: BlockTypesType): void => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, type);\n };\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n {BlockTypes.map((type) => (\n <button\n onClick={() => onClick(type as BlockTypesType)}\n key={type}\n className={clsx(\n styles['editor__toolbar-button'],\n styles[`editor__toolbar-button--${type}`],\n type === 'bold' && isBold && styles['editor__toolbar-button--active'],\n type === 'italic' && isItalic && styles['editor__toolbar-button--active']\n )}\n aria-label={`Format ${type}`}\n >\n <Icon name={BLOCK_TYPE_ICONS[type as keyof typeof Icon]} size={20} />\n </button>\n ))}\n </div>\n );\n};\n"],"names":["BLOCK_TYPE_ICONS","BlockTypes","BlockFormatPlugin","isBold","isItalic","editor","useLexicalComposerContext","onClick","type","FORMAT_TEXT_COMMAND","jsx","styles","clsx","Icon"],"mappings":";;;;;AAQA,MAAMA,IAAmB;AAAA,EACvB,MAAM;AAAA,EACN,QAAQ;AACV,GAOMC,IAAa,CAAC,QAAQ,QAAQ,GAEvBC,IAAoB,CAAC,EAAE,QAAAC,GAAQ,UAAAC,QAAoD;AACxF,QAAA,CAACC,CAAM,IAAIC,KACXC,IAAU,CAACC,MAA+B;AACvC,IAAAH,EAAA,gBAAgBI,GAAqBD,CAAI;AAAA,EAAA;AAIhD,SAAA,gBAAAE,EAAC,SAAI,WAAWC,EAAO,8BAA8B,GAClD,UAAAV,EAAW,IAAI,CAACO,MACf,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,MAAMH,EAAQC,CAAsB;AAAA,MAE7C,WAAWI;AAAA,QACTD,EAAO,wBAAwB;AAAA,QAC/BA,EAAO,2BAA2BH,CAAI,EAAE;AAAA,QACxCA,MAAS,UAAUL,KAAUQ,EAAO,gCAAgC;AAAA,QACpEH,MAAS,YAAYJ,KAAYO,EAAO,gCAAgC;AAAA,MAC1E;AAAA,MACA,cAAY,UAAUH,CAAI;AAAA,MAE1B,4BAACK,GAAK,EAAA,MAAMb,EAAiBQ,CAAyB,GAAG,MAAM,IAAI;AAAA,IAAA;AAAA,IAT9DA;AAAA,EAWR,CAAA,EACH,CAAA;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BlockFormatPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../../../../Lexical.prod-DSsdOWxu.js";
|
|
3
|
+
import { L as a } from "../../../../ListPlugin-Bu2AbCDB.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "../../../../clsx-OuTLNxxd.js";
|
|
6
|
+
import "../../../Icon/Icon.js";
|
|
7
|
+
import "../../../../RteEditor.module-RkKUrkOO.js";
|
|
8
|
+
export {
|
|
9
|
+
a as ListPlugin
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=ListPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListPlugin.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ToolBarPlugin: () => JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
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);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
return b(() => {
|
|
25
|
+
a.registerUpdateListener(({ editorState: s }) => {
|
|
26
|
+
s.read(() => {
|
|
27
|
+
l();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
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 })
|
|
33
|
+
] });
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
w as ToolBarPlugin
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=ToolbarPlugin.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToolbarPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToolBarPlugin as l } from "./ToolbarPlugin/ToolbarPlugin.js";
|
|
2
|
+
import { BlockFormatPlugin as i } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
3
|
+
import { L as a } from "../../../ListPlugin-Bu2AbCDB.js";
|
|
4
|
+
export {
|
|
5
|
+
i as BlockFormatPlugin,
|
|
6
|
+
a as ListPlugin,
|
|
7
|
+
l as ToolBarPlugin
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface RteEditorProps {
|
|
2
|
+
namespace?: string;
|
|
3
|
+
initialValue?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
onChange: (content: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const RteEditor: ({ namespace, initialValue, placeholder, onChange, }: RteEditorProps) => import("react/jsx-runtime").JSX.Element;
|