@monolith-forensics/monolith-ui 1.1.83 → 1.1.85
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/DropDownMenu/DropDownMenu.js +9 -3
- package/dist/RichTextEditor/Components/BubbleMenu.js +42 -1
- package/dist/RichTextEditor/Components/DefaultColorIcon.d.ts +4 -0
- package/dist/RichTextEditor/Components/DefaultColorIcon.js +7 -0
- package/dist/RichTextEditor/Enums/Controls.d.ts +2 -1
- package/dist/RichTextEditor/Enums/Controls.js +1 -0
- package/dist/RichTextEditor/Enums/Extensions.d.ts +2 -0
- package/dist/RichTextEditor/Enums/Extensions.js +2 -0
- package/dist/RichTextEditor/Enums/TextColors.d.ts +13 -0
- package/dist/RichTextEditor/Enums/TextColors.js +14 -0
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +12 -0
- package/dist/RichTextEditor/Toolbar/Toolbar.js +34 -2
- package/dist/TagBox/types.d.ts +1 -1
- package/package.json +3 -1
|
@@ -280,7 +280,7 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
280
280
|
const handleAddItem = (item) => {
|
|
281
281
|
setSelected((prev) => {
|
|
282
282
|
let newSelected = [...prev, item];
|
|
283
|
-
const diff =
|
|
283
|
+
const diff = [item];
|
|
284
284
|
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
285
285
|
return newSelected;
|
|
286
286
|
});
|
|
@@ -288,7 +288,7 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
288
288
|
const handleRemoveItem = (item) => {
|
|
289
289
|
setSelected((prev) => {
|
|
290
290
|
let newSelected = prev.filter((i) => isObjectArray ? (i === null || i === void 0 ? void 0 : i.value) !== (item === null || item === void 0 ? void 0 : item.value) : i !== item);
|
|
291
|
-
const diff =
|
|
291
|
+
const diff = [item];
|
|
292
292
|
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
293
293
|
return newSelected;
|
|
294
294
|
});
|
|
@@ -312,7 +312,13 @@ const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, sear
|
|
|
312
312
|
if (item.items) {
|
|
313
313
|
return (_jsx(DropDownMenu, { data: item.items, children: item.label }));
|
|
314
314
|
}
|
|
315
|
-
return (_jsx(Tooltip, { content: TooltipContent ? _jsx(TooltipContent, { data: item.data }) : null, side: "left", children: _jsxs(MenuItem, { className: "MenuItem", "data-selected": isSelected, leftSection: multiselect && _jsx(CheckBox, { value: isSelected, size: size
|
|
315
|
+
return (_jsx(Tooltip, { content: TooltipContent ? _jsx(TooltipContent, { data: item.data }) : null, side: "left", children: _jsxs(MenuItem, { className: "MenuItem", "data-selected": isSelected, leftSection: multiselect && (_jsx(CheckBox, { value: isSelected, size: size, onChange: (newValue) => {
|
|
316
|
+
var _a;
|
|
317
|
+
newValue
|
|
318
|
+
? handleAddItem(item)
|
|
319
|
+
: handleRemoveItem(item);
|
|
320
|
+
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
|
|
321
|
+
} })), multiselect: multiselect, size: size, onClick: (e) => {
|
|
316
322
|
var _a;
|
|
317
323
|
e.preventDefault();
|
|
318
324
|
e.stopPropagation();
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import Extensions from "../Enums/Extensions";
|
|
4
|
-
import { BoldIcon, ItalicIcon, UnderlineIcon, CaseSensitiveIcon, ListIcon, ListOrderedIcon, StrikethroughIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, RemoveFormattingIcon, } from "lucide-react";
|
|
4
|
+
import { BoldIcon, ItalicIcon, UnderlineIcon, CaseSensitiveIcon, ListIcon, ListOrderedIcon, StrikethroughIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, RemoveFormattingIcon, SquircleIcon, } from "lucide-react";
|
|
5
5
|
import DropDownMenu from "../../DropDownMenu";
|
|
6
6
|
import { FloatingPortal, useFloating } from "@floating-ui/react";
|
|
7
7
|
import { useEffect, useRef } from "react";
|
|
8
8
|
import Button from "../../Button";
|
|
9
|
+
import TextColors from "../Enums/TextColors";
|
|
10
|
+
import DefaultColorIcon from "./DefaultColorIcon";
|
|
9
11
|
const getMenuItems = (editor, customMenuItems) => {
|
|
10
12
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
13
|
const node = (_c = (_b = (_a = editor === null || editor === void 0 ? void 0 : editor.state) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.$from) === null || _c === void 0 ? void 0 : _c.parent;
|
|
@@ -133,6 +135,45 @@ const getMenuItems = (editor, customMenuItems) => {
|
|
|
133
135
|
},
|
|
134
136
|
],
|
|
135
137
|
},
|
|
138
|
+
{
|
|
139
|
+
name: "color",
|
|
140
|
+
label: "Color",
|
|
141
|
+
type: "menu",
|
|
142
|
+
arrow: true,
|
|
143
|
+
buttonProps: {
|
|
144
|
+
// leftSection: nodeTypeIcon,
|
|
145
|
+
style: { fontSize: 11, padding: "4px" },
|
|
146
|
+
},
|
|
147
|
+
items: [
|
|
148
|
+
// remove Color Style
|
|
149
|
+
{
|
|
150
|
+
label: "Default",
|
|
151
|
+
value: "default",
|
|
152
|
+
leftSection: _jsx(DefaultColorIcon, { size: 12 }),
|
|
153
|
+
data: {
|
|
154
|
+
command: (editor) => {
|
|
155
|
+
editor.chain().focus().unsetColor().run();
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
...Object.keys(TextColors).map((color) => {
|
|
160
|
+
const colorKey = color;
|
|
161
|
+
return {
|
|
162
|
+
label: color,
|
|
163
|
+
value: TextColors[colorKey],
|
|
164
|
+
leftSection: (_jsx(SquircleIcon, { size: 12, color: TextColors[colorKey], style: {
|
|
165
|
+
backgroundColor: TextColors[colorKey],
|
|
166
|
+
borderRadius: "3px",
|
|
167
|
+
} })),
|
|
168
|
+
data: {
|
|
169
|
+
command: (editor) => {
|
|
170
|
+
editor.chain().focus().setColor(TextColors[colorKey]).run();
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}),
|
|
175
|
+
],
|
|
176
|
+
},
|
|
136
177
|
{
|
|
137
178
|
name: Extensions.Bold,
|
|
138
179
|
icon: BoldIcon,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const DefaultColorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: SVGSVGElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<SVGSVGElement> | null | undefined;
|
|
3
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
export default DefaultColorIcon;
|
|
@@ -5,6 +5,8 @@ var Extensions;
|
|
|
5
5
|
Extensions["Underline"] = "underline";
|
|
6
6
|
Extensions["Bold"] = "bold";
|
|
7
7
|
Extensions["Italic"] = "italic";
|
|
8
|
+
Extensions["Color"] = "color";
|
|
9
|
+
Extensions["TextStyle"] = "textStyle";
|
|
8
10
|
Extensions["Strike"] = "strike";
|
|
9
11
|
Extensions["BulletList"] = "bulletList";
|
|
10
12
|
Extensions["OrderedList"] = "orderedList";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare enum TextColors {
|
|
2
|
+
Black = "black",
|
|
3
|
+
Gray = "gray",
|
|
4
|
+
White = "white",
|
|
5
|
+
Red = "red",
|
|
6
|
+
Green = "limegreen",
|
|
7
|
+
Blue = "#4782da",
|
|
8
|
+
Yellow = "yellow",
|
|
9
|
+
Pink = "pink",
|
|
10
|
+
Purple = "purple",
|
|
11
|
+
Orange = "#f59e0b"
|
|
12
|
+
}
|
|
13
|
+
export default TextColors;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var TextColors;
|
|
2
|
+
(function (TextColors) {
|
|
3
|
+
TextColors["Black"] = "black";
|
|
4
|
+
TextColors["Gray"] = "gray";
|
|
5
|
+
TextColors["White"] = "white";
|
|
6
|
+
TextColors["Red"] = "red";
|
|
7
|
+
TextColors["Green"] = "limegreen";
|
|
8
|
+
TextColors["Blue"] = "#4782da";
|
|
9
|
+
TextColors["Yellow"] = "yellow";
|
|
10
|
+
TextColors["Pink"] = "pink";
|
|
11
|
+
TextColors["Purple"] = "purple";
|
|
12
|
+
TextColors["Orange"] = "#f59e0b";
|
|
13
|
+
})(TextColors || (TextColors = {}));
|
|
14
|
+
export default TextColors;
|
|
@@ -8,6 +8,8 @@ import TableCell from "@tiptap/extension-table-cell";
|
|
|
8
8
|
import TableHeader from "@tiptap/extension-table-header";
|
|
9
9
|
import TableRow from "@tiptap/extension-table-row";
|
|
10
10
|
import Placeholder from "@tiptap/extension-placeholder";
|
|
11
|
+
import { Color } from "@tiptap/extension-color";
|
|
12
|
+
import TextStyle from "@tiptap/extension-text-style";
|
|
11
13
|
import { InputRule, Extension } from "@tiptap/core";
|
|
12
14
|
import Focus from "@tiptap/extension-focus";
|
|
13
15
|
import UploadImagesPlugin from "../Plugins/UploadImagesPlugin";
|
|
@@ -72,6 +74,16 @@ const getTipTapExtensions = ({ extensions = [], slashCommands = [], bubbleMenuOp
|
|
|
72
74
|
gapcursor: false,
|
|
73
75
|
}),
|
|
74
76
|
},
|
|
77
|
+
{
|
|
78
|
+
name: Extensions.TextStyle,
|
|
79
|
+
category: "default",
|
|
80
|
+
extension: TextStyle,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: Extensions.Color,
|
|
84
|
+
category: "default",
|
|
85
|
+
extension: Color,
|
|
86
|
+
},
|
|
75
87
|
{
|
|
76
88
|
name: Extensions.Underline,
|
|
77
89
|
category: "default",
|
|
@@ -8,10 +8,14 @@ import Fonts from "../Enums/Fonts";
|
|
|
8
8
|
import { useContext } from "react";
|
|
9
9
|
import RichTextEditorContext from "../Contexts/RichTextEditorContext";
|
|
10
10
|
import Button from "../../Button";
|
|
11
|
+
import TextColors from "../Enums/TextColors";
|
|
12
|
+
import DefaultColorIcon from "../Components/DefaultColorIcon";
|
|
13
|
+
import { SquircleIcon } from "lucide-react";
|
|
11
14
|
const Toolbar = styled(({ className, editor, toolbarOptions }) => {
|
|
12
15
|
var _a;
|
|
13
16
|
const { controls } = toolbarOptions || {};
|
|
14
|
-
const customItems = controls === null || controls === void 0 ? void 0 : controls.filter((control) => typeof control !== "string" &&
|
|
17
|
+
const customItems = controls === null || controls === void 0 ? void 0 : controls.filter((control) => typeof control !== "string" &&
|
|
18
|
+
(control.type === "menu" || control.type === "button"));
|
|
15
19
|
const { font, setFont } = useContext(RichTextEditorContext);
|
|
16
20
|
return (_jsxs("div", { className: className, children: [(_a = customItems === null || customItems === void 0 ? void 0 : customItems.map) === null || _a === void 0 ? void 0 : _a.call(customItems, (item, index) => {
|
|
17
21
|
var _a, _b;
|
|
@@ -32,7 +36,35 @@ const Toolbar = styled(({ className, editor, toolbarOptions }) => {
|
|
|
32
36
|
fontWeight: "normal",
|
|
33
37
|
},
|
|
34
38
|
title: "Select Font",
|
|
35
|
-
}, children: (font || Fonts.DEFAULT) })), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.UNDO)) && _jsx(UndoControl, { editor: editor }), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.REDO)) && _jsx(RedoControl, { editor: editor })] }),
|
|
39
|
+
}, children: (font || Fonts.DEFAULT) })), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.UNDO)) && _jsx(UndoControl, { editor: editor }), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.REDO)) && _jsx(RedoControl, { editor: editor })] }), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.COLOR)) && (_jsx(DropDownMenu, { data: [
|
|
40
|
+
{
|
|
41
|
+
label: "Default",
|
|
42
|
+
value: "default",
|
|
43
|
+
leftSection: _jsx(DefaultColorIcon, { size: 12 }),
|
|
44
|
+
onClick: () => {
|
|
45
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().unsetColor().run();
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
...Object.keys(TextColors).map((color) => {
|
|
49
|
+
const colorKey = color;
|
|
50
|
+
return {
|
|
51
|
+
label: color,
|
|
52
|
+
value: TextColors[colorKey],
|
|
53
|
+
leftSection: (_jsx(SquircleIcon, { size: 12, color: TextColors[colorKey], style: {
|
|
54
|
+
backgroundColor: TextColors[colorKey],
|
|
55
|
+
borderRadius: "3px",
|
|
56
|
+
} })),
|
|
57
|
+
onClick: () => {
|
|
58
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().setColor(TextColors[colorKey]).run();
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}),
|
|
62
|
+
], size: "xxs", variant: "outlined", arrow: true, buttonProps: {
|
|
63
|
+
style: {
|
|
64
|
+
fontWeight: "normal",
|
|
65
|
+
},
|
|
66
|
+
title: "Select Color",
|
|
67
|
+
}, children: "Color" })), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.BOLD)) && _jsx(BoldControl, { editor: editor }), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.ITALIC)) && (_jsx(ItalicControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.UNDERLINE)) && (_jsx(UnderlineControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.STRIKE)) && (_jsx(StrikeThroughControl, { editor: editor }))] }), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.HEADING_1)) && (_jsx(Heading1Control, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.HEADING_2)) && (_jsx(Heading2Control, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.HEADING_3)) && (_jsx(Heading3Control, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.HEADING_4)) && (_jsx(Heading4Control, { editor: editor }))] }), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.BULLET_LIST)) && (_jsx(BulletListControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.ORDERED_LIST)) && (_jsx(OrderedListControl, { editor: editor }))] }), _jsxs(ControlsGroup, { children: [(controls === null || controls === void 0 ? void 0 : controls.includes(Controls.TEXT_ALIGN_LEFT)) && (_jsx(AlignLeftControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.TEXT_ALIGN_CENTER)) && (_jsx(AlignCenterControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.TEXT_ALIGN_RIGHT)) && (_jsx(AlignRightControl, { editor: editor })), (controls === null || controls === void 0 ? void 0 : controls.includes(Controls.TEXT_ALIGN_JUSTIFIED)) && (_jsx(AlignJustifiedControl, { editor: editor }))] })] }));
|
|
36
68
|
}) `
|
|
37
69
|
display: flex;
|
|
38
70
|
flex-direction: row;
|
package/dist/TagBox/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface TagBoxProps {
|
|
|
34
34
|
data: any;
|
|
35
35
|
}) => JSX.Element | React.ReactNode;
|
|
36
36
|
onChange?: (value: any[]) => void;
|
|
37
|
-
onScroll?: () => void;
|
|
37
|
+
onScroll?: (e: any) => void;
|
|
38
38
|
onSearch?: (value: string) => void;
|
|
39
39
|
searchFn?: (value: string) => void;
|
|
40
40
|
onItemAdded?: (value: any) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monolith-forensics/monolith-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.85",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Matt Danner (Monolith Forensics LLC)",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@radix-ui/react-switch": "^1.0.7",
|
|
29
29
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
30
30
|
"@tabler/icons-react": "^3.11.0",
|
|
31
|
+
"@tiptap/extension-color": "^2.9.1",
|
|
31
32
|
"@tiptap/extension-focus": "^2.5.9",
|
|
32
33
|
"@tiptap/extension-horizontal-rule": "^2.5.9",
|
|
33
34
|
"@tiptap/extension-image": "^2.5.9",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"@tiptap/extension-table-header": "^2.5.8",
|
|
38
39
|
"@tiptap/extension-table-row": "^2.5.8",
|
|
39
40
|
"@tiptap/extension-text-align": "^2.5.8",
|
|
41
|
+
"@tiptap/extension-text-style": "^2.9.1",
|
|
40
42
|
"@tiptap/extension-underline": "^2.5.8",
|
|
41
43
|
"@tiptap/pm": "^2.5.8",
|
|
42
44
|
"@tiptap/react": "^2.5.8",
|