@monolith-forensics/monolith-ui 1.1.84 → 1.1.86
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/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/Table/Table.d.ts +4 -2
- package/dist/Table/Table.js +15 -17
- package/dist/Table/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +3 -1
|
@@ -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/Table/Table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "overlayscrollbars/overlayscrollbars.css";
|
|
2
|
-
interface ColumnProps {
|
|
2
|
+
export interface ColumnProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
key?: string | number;
|
|
5
5
|
dataField: string;
|
|
@@ -7,6 +7,7 @@ interface ColumnProps {
|
|
|
7
7
|
columnId?: string | number;
|
|
8
8
|
allowSorting?: boolean;
|
|
9
9
|
allowReorder?: boolean;
|
|
10
|
+
allowResize?: boolean;
|
|
10
11
|
resizeEnabled?: boolean;
|
|
11
12
|
width?: number;
|
|
12
13
|
sorting?: {
|
|
@@ -21,6 +22,7 @@ interface ColumnProps {
|
|
|
21
22
|
}
|
|
22
23
|
interface ColumnType extends React.FunctionComponent<ColumnProps> {
|
|
23
24
|
displayName: string;
|
|
25
|
+
props?: ColumnProps;
|
|
24
26
|
}
|
|
25
27
|
export declare const Column: ColumnType;
|
|
26
28
|
interface onResizeProps {
|
|
@@ -58,7 +60,7 @@ export declare const useTable: () => {
|
|
|
58
60
|
};
|
|
59
61
|
interface TableProps {
|
|
60
62
|
className?: string;
|
|
61
|
-
children:
|
|
63
|
+
children: ColumnType | ColumnType[];
|
|
62
64
|
data: {
|
|
63
65
|
[key: string]: any;
|
|
64
66
|
}[];
|
package/dist/Table/Table.js
CHANGED
|
@@ -23,7 +23,7 @@ import moment from "moment";
|
|
|
23
23
|
import { CheckBox } from "..";
|
|
24
24
|
import { Themes } from "../theme";
|
|
25
25
|
const MIN_COLUMN_WIDTH = 125;
|
|
26
|
-
export const Column = (
|
|
26
|
+
export const Column = () => {
|
|
27
27
|
return null;
|
|
28
28
|
};
|
|
29
29
|
Column.displayName = "Column";
|
|
@@ -443,23 +443,21 @@ const Table = styled(({ className, children, data, rowHeight, headerHeight, tabl
|
|
|
443
443
|
children = useMemo(() => {
|
|
444
444
|
return Array.isArray(children) ? children : [children];
|
|
445
445
|
}, [children]);
|
|
446
|
-
let columns = useMemo(() => {
|
|
447
|
-
var _a, _b;
|
|
448
|
-
return (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
: column.props.resizeEnabled,
|
|
460
|
-
});
|
|
446
|
+
let columns = useMemo(() => children === null || children === void 0 ? void 0 : children.map((column) => {
|
|
447
|
+
var _a, _b, _c;
|
|
448
|
+
return cloneElement(column, {
|
|
449
|
+
columnId: shortUUID.generate(),
|
|
450
|
+
allowResize: allowColumnResize !== undefined
|
|
451
|
+
? allowColumnResize
|
|
452
|
+
: (_a = column === null || column === void 0 ? void 0 : column.props) === null || _a === void 0 ? void 0 : _a.allowResize,
|
|
453
|
+
allowReorder: allowColumnReorder !== undefined
|
|
454
|
+
? allowColumnReorder
|
|
455
|
+
: (_b = column === null || column === void 0 ? void 0 : column.props) === null || _b === void 0 ? void 0 : _b.allowReorder,
|
|
456
|
+
resizeEnabled: allowColumnResize !== undefined
|
|
457
|
+
? allowColumnResize
|
|
458
|
+
: (_c = column === null || column === void 0 ? void 0 : column.props) === null || _c === void 0 ? void 0 : _c.resizeEnabled,
|
|
461
459
|
});
|
|
462
|
-
}, [children]);
|
|
460
|
+
}), [children]);
|
|
463
461
|
const [columnOrder, setColumnOrder] = useState(columns.map((col, index) => {
|
|
464
462
|
var _a, _b;
|
|
465
463
|
return {
|
package/dist/Table/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { default as Tooltip } from "./Tooltip";
|
|
|
25
25
|
export { default as Pill } from "./Pill";
|
|
26
26
|
export { default as Calendar } from "./Calendar";
|
|
27
27
|
export { default as Table } from "./Table";
|
|
28
|
+
export type { ColumnProps } from "./Table";
|
|
28
29
|
export { Column } from "./Table";
|
|
29
30
|
export { default as MonolithUIProvider } from "./MonolithUIProvider";
|
|
30
31
|
export { useMonolithUITheme } from "./MonolithUIProvider";
|
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.86",
|
|
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",
|