@monolith-forensics/monolith-ui 1.8.1-dev.4 → 1.8.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 (170) hide show
  1. package/dist/Button/Button.js +58 -9
  2. package/dist/Calendar/Calendar.d.ts +2 -7
  3. package/dist/Calendar/Calendar.js +49 -226
  4. package/dist/Calendar/CalendarStyles.d.ts +2 -6
  5. package/dist/Calendar/CalendarStyles.js +33 -153
  6. package/dist/Calendar/calendarHelpers.d.ts +2 -6
  7. package/dist/Calendar/calendarHelpers.js +5 -13
  8. package/dist/Charts/BarChart/BarChart.js +28 -14
  9. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  10. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  11. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  12. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  13. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  14. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  15. package/dist/Charts/ChartUtils/index.js +1 -0
  16. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  17. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  18. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  19. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  20. package/dist/Charts/LineChart/LineChart.js +34 -15
  21. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  22. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  23. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  24. package/dist/Charts/PieChart/PieChart.js +48 -33
  25. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  26. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  27. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  28. package/dist/CheckBox/CheckBox.js +19 -36
  29. package/dist/DateInput/DateInput.js +143 -198
  30. package/dist/DropDownMenu/DropDownMenu.js +15 -25
  31. package/dist/DropDownMenu/components/MenuComponent.js +2 -8
  32. package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
  33. package/dist/DropDownMenu/components/MenuItem.js +21 -25
  34. package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
  35. package/dist/DropDownMenu/components/MenuItemList.js +86 -192
  36. package/dist/DropDownMenu/components/StyledContent.js +2 -1
  37. package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
  38. package/dist/DropDownMenu/types.d.ts +0 -3
  39. package/dist/FieldLabel/FieldLabel.js +12 -4
  40. package/dist/FileInputField/FileInputField.js +23 -4
  41. package/dist/FileViewer/viewers/ImageViewer.js +18 -75
  42. package/dist/FormSection/FormSection.js +25 -5
  43. package/dist/IconButton/IconButton.js +16 -2
  44. package/dist/Input/Input.js +56 -7
  45. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +4 -1
  46. package/dist/Pill/Pill.js +79 -8
  47. package/dist/Popover/Popover.context.d.ts +1 -2
  48. package/dist/Popover/Popover.js +2 -5
  49. package/dist/Popover/Popover.styles.d.ts +6 -1
  50. package/dist/Popover/Popover.styles.js +28 -11
  51. package/dist/Popover/Popover.transitions.d.ts +2 -4
  52. package/dist/Popover/Popover.transitions.js +49 -23
  53. package/dist/Popover/PopoverDropdown.js +8 -6
  54. package/dist/Popover/PopoverTarget.js +3 -6
  55. package/dist/QueryFilter/DefaultOperators.d.ts +76 -0
  56. package/dist/QueryFilter/DefaultOperators.js +21 -0
  57. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  58. package/dist/QueryFilter/QueryFilter.js +303 -3
  59. package/dist/QueryFilter/index.d.ts +2 -3
  60. package/dist/QueryFilter/index.js +2 -3
  61. package/dist/QueryFilter/types.d.ts +52 -0
  62. package/dist/QueryFilter/types.js +1 -0
  63. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  64. package/dist/QueryFilter/useQueryFilter.js +19 -23
  65. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
  66. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
  67. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
  68. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
  69. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
  70. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
  71. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
  72. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
  73. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
  74. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
  75. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
  76. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
  77. package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
  78. package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
  79. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
  80. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
  81. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
  82. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
  83. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
  84. package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
  85. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
  86. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
  87. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
  88. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
  89. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
  90. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
  91. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
  92. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
  93. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
  94. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
  95. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
  96. package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
  97. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
  98. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
  99. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
  100. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
  101. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
  102. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
  103. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
  104. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
  105. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
  106. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
  107. package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
  108. package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
  109. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
  110. package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
  111. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
  112. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
  113. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
  114. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
  115. package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
  116. package/dist/RichTextEditor/Plugins/index.js +0 -1
  117. package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
  118. package/dist/RichTextEditor/RichTextEditor.js +35 -309
  119. package/dist/RichTextEditor/Toolbar/Toolbar.js +2 -14
  120. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
  121. package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
  122. package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
  123. package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
  124. package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
  125. package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
  126. package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
  127. package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
  128. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
  129. package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
  130. package/dist/SelectBox/SelectBox.js +5 -5
  131. package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
  132. package/dist/SelectBox/select-box.styled-components.js +48 -11
  133. package/dist/SelectBox/types.d.ts +0 -1
  134. package/dist/Switch/Switch.d.ts +2 -2
  135. package/dist/Switch/Switch.js +83 -18
  136. package/dist/Table/ColumnResizer.d.ts +9 -6
  137. package/dist/Table/ColumnResizer.js +10 -30
  138. package/dist/Table/StateStorage.d.ts +0 -4
  139. package/dist/Table/StateStorage.js +0 -13
  140. package/dist/Table/Table.js +12 -160
  141. package/dist/Table/TableComponents.d.ts +0 -10
  142. package/dist/Table/TableComponents.js +10 -71
  143. package/dist/Table/TableDefaults.d.ts +0 -7
  144. package/dist/Table/TableDefaults.js +0 -7
  145. package/dist/Table/TableHeader.js +16 -31
  146. package/dist/Table/TableMenu/TableMenu.js +1 -1
  147. package/dist/Table/TableProvider.js +75 -354
  148. package/dist/Table/TableRow.js +16 -28
  149. package/dist/Table/Utils/index.d.ts +1 -0
  150. package/dist/Table/Utils/index.js +1 -0
  151. package/dist/Table/Utils/resizeHandler.d.ts +3 -0
  152. package/dist/Table/Utils/resizeHandler.js +84 -0
  153. package/dist/Table/types.d.ts +19 -70
  154. package/dist/TagBox/TagBox.d.ts +1 -1
  155. package/dist/TagBox/TagBox.js +80 -22
  156. package/dist/TagBox/types.d.ts +0 -1
  157. package/dist/TextArea/TextArea.js +23 -9
  158. package/dist/TextInput/TextInput.js +6 -12
  159. package/dist/Utilities/parseTimestamp.js +6 -11
  160. package/dist/core/ArrowButton.d.ts +0 -2
  161. package/dist/core/ArrowButton.js +3 -7
  162. package/dist/core/ClearButton.d.ts +0 -2
  163. package/dist/core/ClearButton.js +3 -7
  164. package/dist/core/controlSizes.js +9 -9
  165. package/dist/core/index.d.ts +0 -1
  166. package/dist/core/index.js +0 -1
  167. package/dist/index.d.ts +0 -3
  168. package/dist/index.js +0 -2
  169. package/dist/theme/variants.js +8 -2
  170. package/package.json +18 -26
@@ -0,0 +1,75 @@
1
+ import { findCellPos, findTable, TableMap } from "@tiptap/pm/tables";
2
+ import { CORNER_BUTTON_SIZE, RAIL_THICKNESS, VIEWPORT_PADDING, } from "./TableTools.constants";
3
+ const toRect = (rect) => ({
4
+ top: rect.top,
5
+ left: rect.left,
6
+ width: rect.width,
7
+ height: rect.height,
8
+ });
9
+ const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
10
+ export const getRailTargetFromCell = (editor, cell) => {
11
+ const tableElement = cell.closest("table");
12
+ const rowElement = cell.closest("tr");
13
+ if (!tableElement || !rowElement || !editor.view.dom.contains(tableElement)) {
14
+ return null;
15
+ }
16
+ const cellPosition = editor.view.posAtDOM(cell, 0);
17
+ const $cell = findCellPos(editor.state.doc, cellPosition);
18
+ if (!$cell)
19
+ return null;
20
+ const table = findTable($cell);
21
+ if (!table)
22
+ return null;
23
+ const map = TableMap.get(table.node);
24
+ const cellRect = map.findCell($cell.pos - table.start);
25
+ const tableRect = toRect(tableElement.getBoundingClientRect());
26
+ const rowRect = toRect(rowElement.getBoundingClientRect());
27
+ const columnRect = toRect(cell.getBoundingClientRect());
28
+ if (tableRect.width <= 0 ||
29
+ tableRect.height <= 0 ||
30
+ rowRect.width <= 0 ||
31
+ rowRect.height <= 0 ||
32
+ columnRect.width <= 0 ||
33
+ columnRect.height <= 0) {
34
+ return null;
35
+ }
36
+ return {
37
+ kind: "column",
38
+ rowIndex: cellRect.top,
39
+ colIndex: cellRect.left,
40
+ tableElement,
41
+ tableRect,
42
+ tableContext: {
43
+ node: table.node,
44
+ pos: table.pos,
45
+ start: table.start,
46
+ map,
47
+ },
48
+ rowRect,
49
+ columnRect,
50
+ };
51
+ };
52
+ export const getRailRect = (target, kind) => {
53
+ if (kind === "column") {
54
+ const width = target.columnRect.width;
55
+ const left = clamp(target.columnRect.left, VIEWPORT_PADDING, Math.max(VIEWPORT_PADDING, window.innerWidth - width - VIEWPORT_PADDING));
56
+ return {
57
+ top: Math.max(VIEWPORT_PADDING, target.tableRect.top - RAIL_THICKNESS),
58
+ left,
59
+ width,
60
+ height: RAIL_THICKNESS,
61
+ };
62
+ }
63
+ const height = target.rowRect.height;
64
+ const top = clamp(target.rowRect.top, VIEWPORT_PADDING, Math.max(VIEWPORT_PADDING, window.innerHeight - height - VIEWPORT_PADDING));
65
+ return {
66
+ top,
67
+ left: Math.max(VIEWPORT_PADDING, target.rowRect.left - RAIL_THICKNESS),
68
+ width: RAIL_THICKNESS,
69
+ height,
70
+ };
71
+ };
72
+ export const getCornerRect = (target) => ({
73
+ top: Math.max(VIEWPORT_PADDING, target.tableRect.top - CORNER_BUTTON_SIZE),
74
+ left: Math.max(VIEWPORT_PADDING, target.tableRect.left - CORNER_BUTTON_SIZE),
75
+ });
@@ -0,0 +1,3 @@
1
+ export { TableRails } from "./TableRails";
2
+ export { TableToolsContent } from "./TableInsertControls";
3
+ export { TableToolsPopover } from "./TableToolsPopover";
@@ -0,0 +1,16 @@
1
+ import { Node as ProseMirrorNode } from "@tiptap/pm/model";
2
+ import type { Editor } from "@tiptap/react";
3
+ import type { RailTarget } from "./TableTools.types";
4
+ export declare const clampTableSize: (value: number) => number;
5
+ export declare const hasTableExtension: (editor: Editor | null) => boolean;
6
+ export declare const isTableActive: (editor: Editor | null) => boolean;
7
+ export declare const getCellsInTarget: (target: RailTarget) => {
8
+ pos: number;
9
+ node: ProseMirrorNode;
10
+ }[];
11
+ export declare const getCellsInTableTarget: (target: RailTarget) => {
12
+ pos: number;
13
+ node: ProseMirrorNode;
14
+ }[];
15
+ export declare const hasRiskyMergedCells: (target: RailTarget) => boolean;
16
+ export declare const getTopRowIsHeader: (target: RailTarget) => boolean;
@@ -0,0 +1,53 @@
1
+ import { rowIsHeader } from "@tiptap/pm/tables";
2
+ import { MAX_TABLE_SIZE, MIN_TABLE_SIZE } from "./TableTools.constants";
3
+ export const clampTableSize = (value) => {
4
+ if (Number.isNaN(value))
5
+ return MIN_TABLE_SIZE;
6
+ return Math.min(MAX_TABLE_SIZE, Math.max(MIN_TABLE_SIZE, value));
7
+ };
8
+ export const hasTableExtension = (editor) => Boolean(editor === null || editor === void 0 ? void 0 : editor.extensionManager.extensions.find((extension) => extension.name === "table"));
9
+ export const isTableActive = (editor) => Boolean((editor === null || editor === void 0 ? void 0 : editor.isActive("table")) ||
10
+ (editor === null || editor === void 0 ? void 0 : editor.isActive("tableRow")) ||
11
+ (editor === null || editor === void 0 ? void 0 : editor.isActive("tableCell")) ||
12
+ (editor === null || editor === void 0 ? void 0 : editor.isActive("tableHeader")));
13
+ export const getCellsInTarget = (target) => {
14
+ const { tableContext } = target;
15
+ return tableContext.map
16
+ .cellsInRect(target.kind === "row"
17
+ ? {
18
+ left: 0,
19
+ right: tableContext.map.width,
20
+ top: target.rowIndex,
21
+ bottom: target.rowIndex + 1,
22
+ }
23
+ : {
24
+ left: target.colIndex,
25
+ right: target.colIndex + 1,
26
+ top: 0,
27
+ bottom: tableContext.map.height,
28
+ })
29
+ .map((pos) => ({
30
+ pos,
31
+ node: tableContext.node.nodeAt(pos),
32
+ }))
33
+ .filter((cell) => Boolean(cell.node));
34
+ };
35
+ export const getCellsInTableTarget = (target) => {
36
+ const { tableContext } = target;
37
+ return tableContext.map
38
+ .cellsInRect({
39
+ left: 0,
40
+ right: tableContext.map.width,
41
+ top: 0,
42
+ bottom: tableContext.map.height,
43
+ })
44
+ .map((pos) => ({
45
+ pos,
46
+ node: tableContext.node.nodeAt(pos),
47
+ }))
48
+ .filter((cell) => Boolean(cell.node));
49
+ };
50
+ export const hasRiskyMergedCells = (target) => {
51
+ return getCellsInTarget(target).some((cell) => cell.node.attrs.rowspan > 1 || cell.node.attrs.colspan > 1);
52
+ };
53
+ export const getTopRowIsHeader = (target) => rowIsHeader(target.tableContext.map, target.tableContext.node, 0);
@@ -0,0 +1,40 @@
1
+ import type { RailKind, RailRect } from "./TableTools.types";
2
+ export declare const TableToolsPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const TableToolsSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const TableToolsSectionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("../../../FieldLabel").FieldLabelProps, never>, never>> & string;
5
+ export declare const InsertGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
+ export declare const Field: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
7
+ export declare const SwitchRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
+ export declare const RailRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
9
+ $rect: RailRect;
10
+ $kind: RailKind;
11
+ }>> & string;
12
+ export declare const MenuPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
+ export declare const MenuDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../../../Popover").PopoverDropdownProps, never>> & string & Omit<import("react").FC<import("../../../Popover").PopoverDropdownProps>, keyof import("react").Component<any, {}, any>>;
14
+ export declare const MenuGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
15
+ $withDivider: boolean;
16
+ }>> & string;
17
+ export declare const MenuButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
18
+ ref?: import("react").RefObject<HTMLButtonElement>;
19
+ children?: import("react").ReactNode | string;
20
+ className?: string;
21
+ loading?: boolean;
22
+ leftSection?: import("react").ReactNode;
23
+ rightSection?: import("react").ReactNode;
24
+ href?: string | null;
25
+ download?: string | null;
26
+ fullWidth?: boolean;
27
+ size?: import("../../../core").Size;
28
+ variant?: import("../../../core").Variant;
29
+ color?: import("../../../Button").ButtonColor;
30
+ disabled?: boolean;
31
+ selected?: boolean;
32
+ justify?: "start" | "center" | "end";
33
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
34
+ }, {
35
+ $danger?: boolean;
36
+ }>> & string & Omit<import("react").FC<import("../../../Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
37
+ export declare const CornerRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
38
+ $top: number;
39
+ $left: number;
40
+ }>> & string;
@@ -0,0 +1,167 @@
1
+ import styled from "styled-components";
2
+ import { Button } from "../../../Button";
3
+ import { getControlSizeTokens } from "../../../core";
4
+ import FieldLabel from "../../../FieldLabel";
5
+ import { Popover } from "../../../Popover";
6
+ import { CORNER_BUTTON_SIZE, RAIL_THICKNESS } from "./TableTools.constants";
7
+ export const TableToolsPanel = styled.div `
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 0.75rem;
11
+ min-width: 250px;
12
+ color: ${({ theme }) => theme.palette.text.primary};
13
+ `;
14
+ export const TableToolsSection = styled.div `
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 0.5rem;
18
+ `;
19
+ export const TableToolsSectionTitle = styled(FieldLabel) `
20
+ color: ${({ theme }) => theme.palette.text.secondary};
21
+ font-size: 0.6875rem;
22
+ font-weight: 600;
23
+ line-height: 1rem;
24
+ text-transform: uppercase;
25
+ `;
26
+ export const InsertGrid = styled.div `
27
+ display: grid;
28
+ grid-template-columns: repeat(2, minmax(0, 1fr));
29
+ gap: 0.5rem;
30
+ `;
31
+ export const Field = styled.label `
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: 0.25rem;
35
+ color: ${({ theme }) => theme.palette.text.secondary};
36
+ font-size: 0.75rem;
37
+ line-height: 1rem;
38
+ `;
39
+ export const SwitchRow = styled.div `
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: space-between;
43
+ gap: 0.75rem;
44
+ color: ${({ theme }) => theme.palette.text.secondary};
45
+ font-size: 0.75rem;
46
+ line-height: 1rem;
47
+ `;
48
+ export const RailRoot = styled.div `
49
+ display: flex;
50
+ position: fixed;
51
+ top: ${({ $rect }) => `${$rect.top}px`};
52
+ left: ${({ $rect }) => `${$rect.left}px`};
53
+ z-index: 1500;
54
+ width: ${({ $rect }) => `${$rect.width}px`};
55
+ height: ${({ $rect }) => `${$rect.height}px`};
56
+
57
+ top: ${({ $rect, $kind }) => $kind === "column" ? `${$rect.top + 5}px` : `${$rect.top}px`};
58
+
59
+ left: ${({ $rect, $kind }) => $kind === "row" ? `${$rect.left + 4}px` : `${$rect.left}px`};
60
+
61
+ button {
62
+ margin: auto;
63
+ width: 100%;
64
+ height: 100%;
65
+
66
+ width: ${({ $kind }) => $kind === "column" ? "30px" : RAIL_THICKNESS + "px"};
67
+
68
+ height: ${({ $kind }) => $kind === "row" ? "30px" : RAIL_THICKNESS + "px"};
69
+
70
+ min-height: 0;
71
+ padding: 0;
72
+ border-radius: 10px;
73
+ background-color: ${({ theme }) => theme.palette.background.paper};
74
+ color: ${({ theme }) => theme.palette.text.secondary};
75
+
76
+ &:hover {
77
+ background-color: ${({ theme }) => theme.palette.primary.main};
78
+ color: white;
79
+ }
80
+ }
81
+ `;
82
+ export const MenuPanel = styled.div `
83
+ display: flex;
84
+ flex-direction: column;
85
+ min-width: 220px;
86
+ color: ${({ theme }) => theme.palette.text.primary};
87
+ `;
88
+ export const MenuDropdown = styled(Popover.Dropdown) `
89
+ min-width: 180px;
90
+ border-radius: 5px;
91
+ border: 1px solid ${({ theme }) => theme.palette.divider};
92
+ background-color: ${({ theme }) => theme.palette.input.background};
93
+ box-shadow: none;
94
+ padding: 5px;
95
+ `;
96
+ export const MenuGroup = styled.div `
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: 1px;
100
+ padding-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
101
+ margin-top: ${({ $withDivider }) => ($withDivider ? "5px" : 0)};
102
+ border-top: ${({ $withDivider, theme }) => $withDivider ? `1px solid ${theme.palette.divider}` : 0};
103
+ `;
104
+ export const MenuButton = styled(Button) `
105
+ min-width: 100%;
106
+ height: ${getControlSizeTokens("sm").menuRowHeight}px;
107
+ min-height: ${getControlSizeTokens("sm").menuRowHeight}px;
108
+ padding: 0 ${getControlSizeTokens("sm").menuItemPaddingX}px;
109
+ border: none;
110
+ border-radius: 3px;
111
+ color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
112
+ font-weight: normal;
113
+ justify-content: flex-start;
114
+ width: 100%;
115
+
116
+ .button-label {
117
+ display: inline-block;
118
+ min-width: 0;
119
+ width: 100%;
120
+ overflow: hidden;
121
+ text-align: left;
122
+ text-overflow: ellipsis;
123
+ white-space: nowrap;
124
+ }
125
+
126
+ [data-position="left"] {
127
+ color: currentColor;
128
+ opacity: 0.8;
129
+ }
130
+
131
+ &:hover {
132
+ background-color: ${({ theme }) => theme.palette.action.hover};
133
+ color: ${({ $danger, theme }) => $danger ? theme.palette.error.main : theme.palette.text.primary};
134
+ }
135
+
136
+ &:active {
137
+ translate: none;
138
+ }
139
+
140
+ &:focus {
141
+ text-decoration: none;
142
+ }
143
+ `;
144
+ export const CornerRoot = styled.div `
145
+ display: flex;
146
+ position: fixed;
147
+ top: ${({ $top }) => `${$top}px`};
148
+ left: ${({ $left }) => `${$left}px`};
149
+ z-index: 1500;
150
+ width: ${CORNER_BUTTON_SIZE}px;
151
+ height: ${CORNER_BUTTON_SIZE}px;
152
+
153
+ button {
154
+ width: 100%;
155
+ height: 100%;
156
+ min-height: 0;
157
+ padding: 0;
158
+ border-radius: 6px;
159
+ background-color: ${({ theme }) => theme.palette.background.paper};
160
+ color: ${({ theme }) => theme.palette.text.secondary};
161
+
162
+ &:hover {
163
+ background-color: ${({ theme }) => theme.palette.primary.main};
164
+ color: white;
165
+ }
166
+ }
167
+ `;
@@ -0,0 +1,76 @@
1
+ import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
2
+ import type { TableMap } from "@tiptap/pm/tables";
3
+ import type { Editor } from "@tiptap/react";
4
+ import type { MouseEvent as ReactMouseEvent, ReactNode } from "react";
5
+ export type TableInsertOptions = {
6
+ rows: number;
7
+ cols: number;
8
+ withHeaderRow: boolean;
9
+ };
10
+ export type TableToolsContentProps = {
11
+ editor: Editor | null;
12
+ showInsert?: boolean;
13
+ onInsert?: () => void;
14
+ onAction?: () => void;
15
+ };
16
+ export type TableToolsPopoverProps = {
17
+ editor: Editor | null;
18
+ };
19
+ export type TableRailsProps = {
20
+ editor: Editor | null;
21
+ };
22
+ export type RailKind = "row" | "column";
23
+ export type OpenMenuKind = RailKind | "table";
24
+ export type Point = {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ export type RailRect = {
29
+ top: number;
30
+ left: number;
31
+ width: number;
32
+ height: number;
33
+ };
34
+ export type TableContext = {
35
+ node: ProseMirrorNode;
36
+ pos: number;
37
+ start: number;
38
+ map: TableMap;
39
+ };
40
+ export type TableRailTarget = {
41
+ kind: RailKind;
42
+ rowIndex: number;
43
+ colIndex: number;
44
+ tableElement: HTMLTableElement;
45
+ tableRect: RailRect;
46
+ tableContext: TableContext;
47
+ rowRect: RailRect;
48
+ columnRect: RailRect;
49
+ };
50
+ export type RailTarget = TableRailTarget;
51
+ export type TableToolAction = {
52
+ label: string;
53
+ leftSection: ReactNode;
54
+ disabled?: boolean;
55
+ danger?: boolean;
56
+ onClick: () => void;
57
+ };
58
+ export type TableToolActionGroup = {
59
+ label: string;
60
+ actions: TableToolAction[];
61
+ };
62
+ export type RailAction = TableToolAction;
63
+ export type RailActionGroup = TableToolActionGroup;
64
+ export type TableCornerMenuProps = {
65
+ editor: Editor | null;
66
+ target: TableRailTarget;
67
+ opened: boolean;
68
+ onOpen: () => void;
69
+ onClose: () => void;
70
+ onAction: () => void;
71
+ onMouseEnter: () => void;
72
+ onMouseLeave: () => void;
73
+ onMouseDown: (event: ReactMouseEvent<HTMLButtonElement>) => void;
74
+ };
75
+ export type TableAction = TableToolAction;
76
+ export type TableActionGroup = TableToolActionGroup;
@@ -0,0 +1,4 @@
1
+ export * from "./TableTools.commands";
2
+ export * from "./TableTools.constants";
3
+ export * from "./TableTools.geometry";
4
+ export * from "./TableTools.selectors";
@@ -0,0 +1,4 @@
1
+ export * from "./TableTools.commands";
2
+ export * from "./TableTools.constants";
3
+ export * from "./TableTools.geometry";
4
+ export * from "./TableTools.selectors";
@@ -0,0 +1,2 @@
1
+ import type { TableToolsPopoverProps } from "./TableTools.types";
2
+ export declare const TableToolsPopover: ({ editor }: TableToolsPopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Table2Icon } from "lucide-react";
3
+ import { useState } from "react";
4
+ import { Button } from "../../../Button";
5
+ import { Popover } from "../../../Popover";
6
+ import { hasTableExtension, isTableActive } from "./TableTools.selectors";
7
+ import { TableToolsContent } from "./TableInsertControls";
8
+ export const TableToolsPopover = ({ editor }) => {
9
+ const [opened, setOpened] = useState(false);
10
+ const selected = opened || isTableActive(editor);
11
+ return (_jsxs(Popover, { opened: opened, onChange: setOpened, position: "bottom", width: 285, trapFocus: true, children: [_jsx(Popover.Target, { children: _jsx(Button, { size: "xs", variant: "outlined", title: "Table", "aria-label": "Table", selected: selected, disabled: !hasTableExtension(editor), style: { padding: "1px 6px" }, children: _jsx(Table2Icon, { size: 14 }) }) }), _jsx(Popover.Dropdown, { children: _jsx(TableToolsContent, { editor: editor, showInsert: true, onInsert: () => setOpened(false) }) })] }));
12
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./TableTools";
2
+ export { hasTableExtension, isTableActive } from "./TableTools.selectors";
3
+ export type { OpenMenuKind, Point, RailAction, RailActionGroup, RailKind, RailRect, RailTarget, TableAction, TableActionGroup, TableContext, TableCornerMenuProps, TableInsertOptions, TableRailTarget, TableRailsProps, TableToolAction, TableToolActionGroup, TableToolsContentProps, TableToolsPopoverProps, } from "./TableTools.types";
@@ -0,0 +1,2 @@
1
+ export * from "./TableTools";
2
+ export { hasTableExtension, isTableActive } from "./TableTools.selectors";
@@ -0,0 +1,9 @@
1
+ declare enum HighlightColors {
2
+ Yellow = "rgba(250, 204, 21, 0.38)",
3
+ Green = "rgba(34, 197, 94, 0.34)",
4
+ Blue = "rgba(59, 130, 246, 0.34)",
5
+ Pink = "rgba(236, 72, 153, 0.32)",
6
+ Purple = "rgba(168, 85, 247, 0.34)",
7
+ Orange = "rgba(249, 115, 22, 0.34)"
8
+ }
9
+ export default HighlightColors;
@@ -0,0 +1,10 @@
1
+ var HighlightColors;
2
+ (function (HighlightColors) {
3
+ HighlightColors["Yellow"] = "rgba(250, 204, 21, 0.38)";
4
+ HighlightColors["Green"] = "rgba(34, 197, 94, 0.34)";
5
+ HighlightColors["Blue"] = "rgba(59, 130, 246, 0.34)";
6
+ HighlightColors["Pink"] = "rgba(236, 72, 153, 0.32)";
7
+ HighlightColors["Purple"] = "rgba(168, 85, 247, 0.34)";
8
+ HighlightColors["Orange"] = "rgba(249, 115, 22, 0.34)";
9
+ })(HighlightColors || (HighlightColors = {}));
10
+ export default HighlightColors;
@@ -1,13 +1,18 @@
1
1
  import TiptapImage from "@tiptap/extension-image";
2
2
  import StarterKit from "@tiptap/starter-kit";
3
3
  import HorizontalRule from "@tiptap/extension-horizontal-rule";
4
+ import Underline from "@tiptap/extension-underline";
4
5
  import TextAlign from "@tiptap/extension-text-align";
5
- import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table";
6
- import { Focus, Placeholder } from "@tiptap/extensions";
6
+ import Table from "@tiptap/extension-table";
7
+ import TableCell from "@tiptap/extension-table-cell";
8
+ import TableHeader from "@tiptap/extension-table-header";
9
+ import TableRow from "@tiptap/extension-table-row";
10
+ import Placeholder from "@tiptap/extension-placeholder";
7
11
  import { Color } from "@tiptap/extension-color";
8
- import { TextStyle } from "@tiptap/extension-text-style";
12
+ import TextStyle from "@tiptap/extension-text-style";
9
13
  import { InputRule, Extension } from "@tiptap/core";
10
- import { ImageActionsPlugin, UploadImagesPlugin, } from "../Plugins";
14
+ import Focus from "@tiptap/extension-focus";
15
+ import { UploadImagesPlugin } from "../Plugins";
11
16
  import getSlashCommand from "./getSlashCommand";
12
17
  import { Extensions } from "../Enums";
13
18
  import BubbleMenu from "./BubbleMenuExtension";
@@ -20,7 +25,7 @@ const CustomImage = TiptapImage.extend({
20
25
  } });
21
26
  },
22
27
  addProseMirrorPlugins() {
23
- return [UploadImagesPlugin(), ImageActionsPlugin(this.editor)];
28
+ return [UploadImagesPlugin()];
24
29
  },
25
30
  });
26
31
  const CustomStorage = Extension.create({
@@ -79,6 +84,11 @@ const getTipTapExtensions = ({ extensions = [], slashCommands = [], bubbleMenuOp
79
84
  category: "default",
80
85
  extension: Color,
81
86
  },
87
+ {
88
+ name: Extensions.Underline,
89
+ category: "default",
90
+ extension: Underline,
91
+ },
82
92
  {
83
93
  name: Extensions.TextAlign,
84
94
  category: "default",
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  import { Plugin, PluginKey } from "@tiptap/pm/state";
12
12
  import { ReactRenderer } from "@tiptap/react";
13
13
  import { CopyIcon, DownloadIcon, FullscreenIcon } from "lucide-react";
14
- import styled from "styled-components";
14
+ import styled, { useTheme } from "styled-components";
15
15
  import { Button } from "../../Button";
16
16
  import { FileViewer } from "../../FileViewer";
17
17
  import { useState } from "react";
@@ -19,10 +19,6 @@ const imageActionsKey = new PluginKey("image-actions");
19
19
  const ImageActionsMenuRoot = styled.div `
20
20
  display: flex;
21
21
  gap: 4px;
22
- padding: 4px;
23
- border-radius: 5px;
24
-
25
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
26
22
 
27
23
  button {
28
24
  width: 24px;
@@ -30,16 +26,17 @@ const ImageActionsMenuRoot = styled.div `
30
26
  }
31
27
  `;
32
28
  const ImageActionsMenu = ({ onCopy, onDownload, getFile, onMouseEnter, onMouseLeave, }) => {
29
+ const theme = useTheme();
33
30
  const [viewerFile, setViewerFile] = useState(null);
34
31
  const keepEditorFocus = (event) => {
35
32
  event.preventDefault();
36
33
  };
37
- return (_jsxs(_Fragment, { children: [_jsxs(ImageActionsMenuRoot, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [_jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Copy image", title: "Copy image", onMouseDown: keepEditorFocus, onClick: onCopy, children: _jsx(CopyIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Download image", title: "Download image", onMouseDown: keepEditorFocus, onClick: onDownload, children: _jsx(DownloadIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "View image fullscreen", title: "View image fullscreen", onMouseDown: keepEditorFocus, onClick: () => {
34
+ return (_jsxs(_Fragment, { children: [_jsxs(ImageActionsMenuRoot, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [_jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Copy image", title: "Copy image", onMouseDown: keepEditorFocus, onClick: onCopy, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(CopyIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "Download image", title: "Download image", onMouseDown: keepEditorFocus, onClick: onDownload, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(DownloadIcon, { size: 14 }) }), _jsx(Button, { type: "button", size: "xxs", variant: "outlined", "aria-label": "View image fullscreen", title: "View image fullscreen", onMouseDown: keepEditorFocus, onClick: () => {
38
35
  const file = getFile();
39
36
  if (file) {
40
37
  setViewerFile(file);
41
38
  }
42
- }, children: _jsx(FullscreenIcon, { size: 14 }) })] }), _jsx(FileViewer, { file: viewerFile || undefined, open: Boolean(viewerFile), onClose: () => setViewerFile(null) })] }));
39
+ }, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(FullscreenIcon, { size: 14 }) })] }), _jsx(FileViewer, { file: viewerFile || undefined, open: Boolean(viewerFile), onClose: () => setViewerFile(null) })] }));
43
40
  };
44
41
  const getImageFilename = (image) => {
45
42
  var _a, _b;
@@ -1,13 +1,5 @@
1
1
  import { Plugin } from "@tiptap/pm/state";
2
2
  import { DecorationSet, EditorView } from "@tiptap/pm/view";
3
- export declare const addImagePlaceholder: ({ view, id, pos, src, label, }: {
4
- view: EditorView;
5
- id: string;
6
- pos: number;
7
- src?: string;
8
- label?: string;
9
- }) => void;
10
- export declare const removeImagePlaceholder: (view: EditorView, id: string) => any;
11
3
  export type HandleImageUploadProps = {
12
4
  file: File;
13
5
  name: string;
@@ -19,12 +11,5 @@ export type HandleImageUploadProps = {
19
11
  export type HandleImageUpload = {
20
12
  (props: HandleImageUploadProps): Promise<string> | undefined;
21
13
  };
22
- export type HandleImageUrlUploadProps = {
23
- src: string;
24
- name: string;
25
- };
26
- export type HandleImageUrlUpload = {
27
- (props: HandleImageUrlUploadProps): Promise<string | undefined> | string | undefined;
28
- };
29
14
  export declare const startImageUpload: (file: File, view: EditorView, pos: number, handleImageUpload: HandleImageUpload | undefined) => void;
30
15
  export declare const UploadImagesPlugin: () => Plugin<DecorationSet>;