@monolith-forensics/monolith-ui 1.9.3-dev.0 → 1.9.3-dev.2

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 (47) hide show
  1. package/dist/Charts/BarChart/BarChart.js +28 -14
  2. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  3. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  4. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  5. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  6. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  7. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  8. package/dist/Charts/ChartUtils/index.js +1 -0
  9. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  10. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  11. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  12. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  13. package/dist/Charts/LineChart/LineChart.js +34 -15
  14. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  15. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  16. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  17. package/dist/Charts/PieChart/PieChart.js +48 -33
  18. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  19. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  20. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  21. package/dist/FieldLabel/FieldLabel.js +3 -18
  22. package/dist/RichTextEditor/Extensions/getSlashCommand.d.ts +23 -3
  23. package/dist/RichTextEditor/Extensions/getSlashCommand.js +14 -6
  24. package/dist/RichTextEditor/Extensions/getTiptapExtensions.d.ts +5 -2
  25. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +3 -1
  26. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +17 -3
  27. package/dist/RichTextEditor/RichTextEditor.d.ts +6 -3
  28. package/dist/RichTextEditor/RichTextEditor.js +6 -6
  29. package/dist/SegmentedControl/SegmentedControl.js +1 -1
  30. package/dist/SegmentedControl/SegmentedControl.styles.d.ts +1 -0
  31. package/dist/SegmentedControl/SegmentedControl.styles.js +30 -14
  32. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +1 -0
  33. package/dist/SegmentedControl/SegmentedControl.utils.js +5 -2
  34. package/dist/Table/Table.js +4 -3
  35. package/dist/Table/TableComponents.d.ts +3 -0
  36. package/dist/Table/TableComponents.js +47 -0
  37. package/dist/Table/TableHeader.js +1 -1
  38. package/dist/Table/TableMenu/TableMenu.js +4 -3
  39. package/dist/Table/TableProvider.js +39 -0
  40. package/dist/Table/TableRow.js +1 -1
  41. package/dist/Table/types.d.ts +6 -0
  42. package/dist/core/controlSizes.js +9 -9
  43. package/package.json +1 -1
  44. package/dist/RichTextEditor/Components/TableCornerMenu.d.ts +0 -16
  45. package/dist/RichTextEditor/Components/TableCornerMenu.js +0 -202
  46. package/dist/RichTextEditor/Components/TableTools.d.ts +0 -44
  47. package/dist/RichTextEditor/Components/TableTools.js +0 -790
@@ -1,202 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { TextSelection } from "@tiptap/pm/state";
3
- import { CopyIcon, EraserIcon, TablePropertiesIcon, Trash2Icon, } from "lucide-react";
4
- import styled from "styled-components";
5
- import { Button } from "../../Button";
6
- import { getControlSizeTokens } from "../../core";
7
- import { Popover } from "../../Popover";
8
- const CORNER_BUTTON_SIZE = 18;
9
- const VIEWPORT_PADDING = 8;
10
- const clearTableContents = (editor, target) => {
11
- if (!editor)
12
- return false;
13
- const paragraph = editor.state.schema.nodes.paragraph.createAndFill();
14
- if (!paragraph)
15
- return false;
16
- const tr = editor.state.tr;
17
- const { tableContext } = target;
18
- const cells = tableContext.map
19
- .cellsInRect({
20
- left: 0,
21
- right: tableContext.map.width,
22
- top: 0,
23
- bottom: tableContext.map.height,
24
- })
25
- .map((pos) => ({
26
- pos,
27
- node: tableContext.node.nodeAt(pos),
28
- }))
29
- .filter((cell) => Boolean(cell.node))
30
- .sort((a, b) => b.pos - a.pos);
31
- cells.forEach((cell) => {
32
- const from = tableContext.start + cell.pos + 1;
33
- const to = tableContext.start + cell.pos + cell.node.nodeSize - 1;
34
- tr.replaceWith(from, to, paragraph);
35
- });
36
- editor.view.dispatch(tr);
37
- return true;
38
- };
39
- const duplicateTable = (editor, target) => {
40
- if (!editor)
41
- return false;
42
- const { tableContext } = target;
43
- const paragraph = editor.state.schema.nodes.paragraph.createAndFill();
44
- if (!paragraph)
45
- return false;
46
- const insertPosition = tableContext.pos + tableContext.node.nodeSize;
47
- const duplicatedTable = tableContext.node.copy(tableContext.node.content);
48
- const tr = editor.state.tr.insert(insertPosition, [
49
- paragraph,
50
- duplicatedTable,
51
- ]);
52
- const firstCellPosition = tableContext.map.positionAt(0, 0, duplicatedTable);
53
- if (firstCellPosition !== null) {
54
- const duplicatePosition = insertPosition + paragraph.nodeSize;
55
- const firstCellContentPosition = duplicatePosition + 1 + firstCellPosition + 1;
56
- tr.setSelection(TextSelection.near(tr.doc.resolve(firstCellContentPosition)));
57
- }
58
- editor.view.dispatch(tr.scrollIntoView());
59
- return true;
60
- };
61
- const deleteTable = (editor, target) => {
62
- if (!editor)
63
- return false;
64
- const { tableContext } = target;
65
- editor.view.dispatch(editor.state.tr
66
- .delete(tableContext.pos, tableContext.pos + tableContext.node.nodeSize)
67
- .scrollIntoView());
68
- return true;
69
- };
70
- const getTableActionGroups = (editor, target) => [
71
- {
72
- label: "Content",
73
- actions: [
74
- {
75
- label: "Clear table contents",
76
- leftSection: _jsx(EraserIcon, { size: 14 }),
77
- onClick: () => clearTableContents(editor, target),
78
- },
79
- {
80
- label: "Duplicate table",
81
- leftSection: _jsx(CopyIcon, { size: 14 }),
82
- onClick: () => duplicateTable(editor, target),
83
- },
84
- ],
85
- },
86
- {
87
- label: "Delete",
88
- actions: [
89
- {
90
- label: "Delete table",
91
- leftSection: _jsx(Trash2Icon, { size: 14 }),
92
- danger: true,
93
- onClick: () => deleteTable(editor, target),
94
- },
95
- ],
96
- },
97
- ];
98
- const getCornerRect = (target) => ({
99
- top: Math.max(VIEWPORT_PADDING, target.tableRect.top - CORNER_BUTTON_SIZE),
100
- left: Math.max(VIEWPORT_PADDING, target.tableRect.left - CORNER_BUTTON_SIZE),
101
- });
102
- const CornerRoot = styled.div `
103
- display: flex;
104
- position: fixed;
105
- top: ${({ $top }) => `${$top}px`};
106
- left: ${({ $left }) => `${$left}px`};
107
- z-index: 1500;
108
- width: ${CORNER_BUTTON_SIZE}px;
109
- height: ${CORNER_BUTTON_SIZE}px;
110
-
111
- button {
112
- width: 100%;
113
- height: 100%;
114
- min-height: 0;
115
- padding: 0;
116
- border-radius: 6px;
117
- background-color: ${({ theme }) => theme.palette.background.paper};
118
- color: ${({ theme }) => theme.palette.text.secondary};
119
-
120
- &:hover {
121
- background-color: ${({ theme }) => theme.palette.primary.main};
122
- color: white;
123
- }
124
- }
125
- `;
126
- const TableMenuPanel = styled.div `
127
- display: flex;
128
- flex-direction: column;
129
- min-width: 220px;
130
- color: ${({ theme }) => theme.palette.text.primary};
131
- `;
132
- const TableMenuDropdown = styled(Popover.Dropdown) `
133
- min-width: 180px;
134
- border-radius: 5px;
135
- border: 1px solid ${({ theme }) => theme.palette.divider};
136
- background-color: ${({ theme }) => theme.palette.input.background};
137
- box-shadow: none;
138
- padding: 5px;
139
- `;
140
- const TableMenuGroup = styled.div `
141
- display: flex;
142
- flex-direction: column;
143
- gap: 1px;
144
- padding-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
145
- margin-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
146
- border-top: ${({ $withDivider, theme }) => $withDivider ? `1px solid ${theme.palette.divider}` : 0};
147
- `;
148
- const TableMenuButton = styled(Button) `
149
- min-width: 100%;
150
- height: ${getControlSizeTokens("sm").menuRowHeight}px;
151
- min-height: ${getControlSizeTokens("sm").menuRowHeight}px;
152
- padding: 0 ${getControlSizeTokens("sm").menuItemPaddingX}px;
153
- border: none;
154
- border-radius: 3px;
155
- color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
156
- font-weight: normal;
157
- justify-content: flex-start;
158
- width: 100%;
159
-
160
- .button-label {
161
- display: inline-block;
162
- min-width: 0;
163
- width: 100%;
164
- overflow: hidden;
165
- text-align: left;
166
- text-overflow: ellipsis;
167
- white-space: nowrap;
168
- }
169
-
170
- [data-position="left"] {
171
- color: currentColor;
172
- opacity: 0.8;
173
- }
174
-
175
- &:hover {
176
- background-color: ${({ theme }) => theme.palette.action.hover};
177
- color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
178
- }
179
-
180
- &:active {
181
- translate: none;
182
- }
183
-
184
- &:focus {
185
- text-decoration: none;
186
- }
187
- `;
188
- const TableMenu = ({ groups, onAction, }) => (_jsx(TableMenuPanel, { children: groups.map((group, index) => (_jsx(TableMenuGroup, { "$withDivider": index > 0, children: group.actions.map((action) => (_jsx(TableMenuButton, { "$danger": action.danger, size: "sm", variant: "subtle", leftSection: action.leftSection, justify: "start", onClick: () => {
189
- action.onClick();
190
- onAction();
191
- }, children: action.label }, action.label))) }, group.label))) }));
192
- export const TableCornerMenu = ({ editor, target, opened, onOpen, onClose, onAction, onMouseEnter, onMouseLeave, onMouseDown, }) => {
193
- const rect = getCornerRect(target);
194
- const groups = getTableActionGroups(editor, target);
195
- return (_jsx(CornerRoot, { "data-monolith-table-rail": true, "$top": rect.top, "$left": rect.left, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: _jsxs(Popover, { opened: opened, onChange: (nextOpened) => {
196
- if (nextOpened) {
197
- onOpen();
198
- return;
199
- }
200
- onClose();
201
- }, position: "bottom-start", width: 245, trapFocus: true, children: [_jsx(Popover.Target, { children: _jsx(Button, { type: "button", size: "xs", variant: "outlined", title: "Table options", "aria-label": "Table options", selected: opened, onMouseDown: onMouseDown, children: _jsx(TablePropertiesIcon, { size: 12 }) }) }), _jsx(TableMenuDropdown, { children: _jsx(TableMenu, { groups: groups, onAction: onAction }) })] }) }));
202
- };
@@ -1,44 +0,0 @@
1
- import { Editor } from "@tiptap/react";
2
- import { Node as ProseMirrorNode } from "@tiptap/pm/model";
3
- import { TableMap } from "@tiptap/pm/tables";
4
- type TableToolsContentProps = {
5
- editor: Editor | null;
6
- showInsert?: boolean;
7
- onInsert?: () => void;
8
- onAction?: () => void;
9
- };
10
- type TableToolsPopoverProps = {
11
- editor: Editor | null;
12
- };
13
- type TableRailsProps = {
14
- editor: Editor | null;
15
- };
16
- type RailKind = "row" | "column";
17
- type RailRect = {
18
- top: number;
19
- left: number;
20
- width: number;
21
- height: number;
22
- };
23
- type TableContext = {
24
- node: ProseMirrorNode;
25
- pos: number;
26
- start: number;
27
- map: TableMap;
28
- };
29
- export type TableRailTarget = {
30
- kind: RailKind;
31
- rowIndex: number;
32
- colIndex: number;
33
- tableElement: HTMLTableElement;
34
- tableRect: RailRect;
35
- tableContext: TableContext;
36
- rowRect: RailRect;
37
- columnRect: RailRect;
38
- };
39
- export declare const hasTableExtension: (editor: Editor | null) => boolean;
40
- export declare const isTableActive: (editor: Editor | null) => boolean;
41
- export declare const TableToolsContent: ({ editor, showInsert, onInsert, onAction, }: TableToolsContentProps) => import("react/jsx-runtime").JSX.Element;
42
- export declare const TableToolsPopover: ({ editor }: TableToolsPopoverProps) => import("react/jsx-runtime").JSX.Element;
43
- export declare const TableRails: ({ editor }: TableRailsProps) => import("react/jsx-runtime").JSX.Element | null;
44
- export {};