@monolith-forensics/monolith-ui 1.8.1 → 1.9.0

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 (179) hide show
  1. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -4
  2. package/dist/Tabs/Tab.js +0 -8
  3. package/dist/TagBox/TagBox.d.ts +1 -1
  4. package/dist/TagBox/TagBox.js +135 -35
  5. package/dist/TagBox/types.d.ts +13 -0
  6. package/dist/core/controlSizes.d.ts +0 -26
  7. package/dist/core/controlSizes.js +0 -156
  8. package/dist/core/index.d.ts +1 -0
  9. package/dist/core/index.js +1 -0
  10. package/dist/theme/variants.js +0 -8
  11. package/package.json +1 -1
  12. package/dist/Charts/BarChart/BarChart.d.ts +0 -5
  13. package/dist/Charts/BarChart/BarChart.js +0 -563
  14. package/dist/Charts/BarChart/BarChart.lib.d.ts +0 -31
  15. package/dist/Charts/BarChart/BarChart.lib.js +0 -136
  16. package/dist/Charts/BarChart/BarChart.styled.d.ts +0 -56
  17. package/dist/Charts/BarChart/BarChart.styled.js +0 -119
  18. package/dist/Charts/BarChart/BarChart.types.d.ts +0 -179
  19. package/dist/Charts/BarChart/BarChart.types.js +0 -1
  20. package/dist/Charts/BarChart/index.d.ts +0 -3
  21. package/dist/Charts/BarChart/index.js +0 -2
  22. package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +0 -11
  23. package/dist/Charts/ChartPrimitives/ChartExportControl.js +0 -29
  24. package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +0 -1
  25. package/dist/Charts/ChartPrimitives/chartActions.styled.js +0 -8
  26. package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +0 -12
  27. package/dist/Charts/ChartPrimitives/chartLegend.styled.js +0 -52
  28. package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +0 -19
  29. package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +0 -61
  30. package/dist/Charts/ChartPrimitives/index.d.ts +0 -4
  31. package/dist/Charts/ChartPrimitives/index.js +0 -4
  32. package/dist/Charts/ChartUtils/chartColors.d.ts +0 -8
  33. package/dist/Charts/ChartUtils/chartColors.js +0 -65
  34. package/dist/Charts/ChartUtils/chartExport.d.ts +0 -47
  35. package/dist/Charts/ChartUtils/chartExport.js +0 -311
  36. package/dist/Charts/ChartUtils/chartMath.d.ts +0 -3
  37. package/dist/Charts/ChartUtils/chartMath.js +0 -3
  38. package/dist/Charts/ChartUtils/chartSizing.d.ts +0 -20
  39. package/dist/Charts/ChartUtils/chartSizing.js +0 -83
  40. package/dist/Charts/ChartUtils/index.d.ts +0 -4
  41. package/dist/Charts/ChartUtils/index.js +0 -4
  42. package/dist/Charts/HeatMap/HeatMap.d.ts +0 -5
  43. package/dist/Charts/HeatMap/HeatMap.js +0 -233
  44. package/dist/Charts/HeatMap/HeatMap.lib.d.ts +0 -30
  45. package/dist/Charts/HeatMap/HeatMap.lib.js +0 -115
  46. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +0 -41
  47. package/dist/Charts/HeatMap/HeatMap.styled.js +0 -94
  48. package/dist/Charts/HeatMap/HeatMap.types.d.ts +0 -86
  49. package/dist/Charts/HeatMap/HeatMap.types.js +0 -1
  50. package/dist/Charts/HeatMap/index.d.ts +0 -3
  51. package/dist/Charts/HeatMap/index.js +0 -2
  52. package/dist/Charts/LineChart/LineChart.d.ts +0 -5
  53. package/dist/Charts/LineChart/LineChart.js +0 -548
  54. package/dist/Charts/LineChart/LineChart.lib.d.ts +0 -24
  55. package/dist/Charts/LineChart/LineChart.lib.js +0 -132
  56. package/dist/Charts/LineChart/LineChart.styled.d.ts +0 -64
  57. package/dist/Charts/LineChart/LineChart.styled.js +0 -151
  58. package/dist/Charts/LineChart/LineChart.types.d.ts +0 -201
  59. package/dist/Charts/LineChart/LineChart.types.js +0 -1
  60. package/dist/Charts/LineChart/index.d.ts +0 -3
  61. package/dist/Charts/LineChart/index.js +0 -2
  62. package/dist/Charts/PieChart/PieChart.d.ts +0 -4
  63. package/dist/Charts/PieChart/PieChart.js +0 -214
  64. package/dist/Charts/PieChart/PieChart.lib.d.ts +0 -5
  65. package/dist/Charts/PieChart/PieChart.lib.js +0 -19
  66. package/dist/Charts/PieChart/PieChart.styled.d.ts +0 -56
  67. package/dist/Charts/PieChart/PieChart.styled.js +0 -168
  68. package/dist/Charts/PieChart/PieChart.types.d.ts +0 -104
  69. package/dist/Charts/PieChart/PieChart.types.js +0 -1
  70. package/dist/Charts/PieChart/index.d.ts +0 -2
  71. package/dist/Charts/PieChart/index.js +0 -1
  72. package/dist/Charts/index.d.ts +0 -5
  73. package/dist/Charts/index.js +0 -4
  74. package/dist/QueryFilter/QueryFilter.constants.d.ts +0 -134
  75. package/dist/QueryFilter/QueryFilter.constants.js +0 -39
  76. package/dist/QueryFilter/QueryFilter.lib.d.ts +0 -14
  77. package/dist/QueryFilter/QueryFilter.lib.js +0 -84
  78. package/dist/QueryFilter/QueryFilter.styled.d.ts +0 -89
  79. package/dist/QueryFilter/QueryFilter.styled.js +0 -184
  80. package/dist/QueryFilter/QueryFilter.types.d.ts +0 -61
  81. package/dist/QueryFilter/QueryFilter.types.js +0 -1
  82. package/dist/QueryFilter/components/MultiSelectEditor.d.ts +0 -7
  83. package/dist/QueryFilter/components/MultiSelectEditor.js +0 -44
  84. package/dist/QueryFilter/components/RuleChip.d.ts +0 -8
  85. package/dist/QueryFilter/components/RuleChip.js +0 -37
  86. package/dist/QueryFilter/components/Rules.d.ts +0 -11
  87. package/dist/QueryFilter/components/Rules.js +0 -41
  88. package/dist/QueryFilter/components/UnavailableRuleChip.d.ts +0 -5
  89. package/dist/QueryFilter/components/UnavailableRuleChip.js +0 -7
  90. package/dist/QueryFilter/components/ValueEditor.d.ts +0 -7
  91. package/dist/QueryFilter/components/ValueEditor.js +0 -45
  92. package/dist/QueryFilter/components/ValueSelector.d.ts +0 -7
  93. package/dist/QueryFilter/components/ValueSelector.js +0 -34
  94. package/dist/QueryFilter/components/index.d.ts +0 -6
  95. package/dist/QueryFilter/components/index.js +0 -6
  96. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +0 -18
  97. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +0 -6
  98. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +0 -9
  99. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +0 -42
  100. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +0 -10
  101. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +0 -60
  102. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +0 -9
  103. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +0 -30
  104. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +0 -3
  105. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +0 -28
  106. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +0 -10
  107. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +0 -17
  108. package/dist/RichTextEditor/Components/LinkEditor.d.ts +0 -8
  109. package/dist/RichTextEditor/Components/LinkEditor.js +0 -94
  110. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +0 -2
  111. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +0 -19
  112. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +0 -2
  113. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +0 -24
  114. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +0 -2
  115. package/dist/RichTextEditor/Components/TableTools/TableRails.js +0 -180
  116. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +0 -5
  117. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +0 -6
  118. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +0 -5
  119. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +0 -183
  120. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +0 -16
  121. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +0 -217
  122. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +0 -8
  123. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +0 -11
  124. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +0 -3
  125. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +0 -23
  126. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +0 -75
  127. package/dist/RichTextEditor/Components/TableTools/TableTools.js +0 -3
  128. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +0 -16
  129. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +0 -53
  130. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +0 -40
  131. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +0 -167
  132. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +0 -76
  133. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +0 -1
  134. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +0 -4
  135. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +0 -4
  136. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +0 -2
  137. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +0 -12
  138. package/dist/RichTextEditor/Components/TableTools/index.d.ts +0 -3
  139. package/dist/RichTextEditor/Components/TableTools/index.js +0 -2
  140. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +0 -9
  141. package/dist/RichTextEditor/Enums/HighlightColors.js +0 -10
  142. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +0 -3
  143. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +0 -238
  144. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +0 -20
  145. package/dist/RichTextEditor/Utils/codeBlockUtils.js +0 -137
  146. package/dist/RichTextEditor/Utils/codeUtils.d.ts +0 -3
  147. package/dist/RichTextEditor/Utils/codeUtils.js +0 -12
  148. package/dist/RichTextEditor/Utils/linkUtils.d.ts +0 -19
  149. package/dist/RichTextEditor/Utils/linkUtils.js +0 -57
  150. package/dist/RichTextEditor/Utils/tableUtils.d.ts +0 -1
  151. package/dist/RichTextEditor/Utils/tableUtils.js +0 -1
  152. package/dist/SuperDatePicker/SuperDatePicker.constants.d.ts +0 -24
  153. package/dist/SuperDatePicker/SuperDatePicker.constants.js +0 -30
  154. package/dist/SuperDatePicker/SuperDatePicker.d.ts +0 -3
  155. package/dist/SuperDatePicker/SuperDatePicker.js +0 -31
  156. package/dist/SuperDatePicker/SuperDatePicker.lib.d.ts +0 -17
  157. package/dist/SuperDatePicker/SuperDatePicker.lib.js +0 -206
  158. package/dist/SuperDatePicker/SuperDatePicker.styled.d.ts +0 -60
  159. package/dist/SuperDatePicker/SuperDatePicker.styled.js +0 -256
  160. package/dist/SuperDatePicker/SuperDatePicker.types.d.ts +0 -48
  161. package/dist/SuperDatePicker/SuperDatePicker.types.js +0 -1
  162. package/dist/SuperDatePicker/components/CommonPresetGroups.d.ts +0 -7
  163. package/dist/SuperDatePicker/components/CommonPresetGroups.js +0 -6
  164. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.d.ts +0 -10
  165. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.js +0 -9
  166. package/dist/SuperDatePicker/components/EndpointDateInput.d.ts +0 -16
  167. package/dist/SuperDatePicker/components/EndpointDateInput.js +0 -26
  168. package/dist/SuperDatePicker/components/EndpointPopover.d.ts +0 -18
  169. package/dist/SuperDatePicker/components/EndpointPopover.js +0 -11
  170. package/dist/SuperDatePicker/components/QuickRangeDropdown.d.ts +0 -14
  171. package/dist/SuperDatePicker/components/QuickRangeDropdown.js +0 -19
  172. package/dist/SuperDatePicker/components/QuickRangePopover.d.ts +0 -18
  173. package/dist/SuperDatePicker/components/QuickRangePopover.js +0 -12
  174. package/dist/SuperDatePicker/components/index.d.ts +0 -6
  175. package/dist/SuperDatePicker/components/index.js +0 -6
  176. package/dist/SuperDatePicker/index.d.ts +0 -3
  177. package/dist/SuperDatePicker/index.js +0 -3
  178. package/dist/SuperDatePicker/useSuperDatePicker.d.ts +0 -32
  179. package/dist/SuperDatePicker/useSuperDatePicker.js +0 -125
@@ -1,238 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
- import { Plugin, PluginKey } from "@tiptap/pm/state";
12
- import { ReactRenderer } from "@tiptap/react";
13
- import { CopyIcon, DownloadIcon, FullscreenIcon } from "lucide-react";
14
- import styled, { useTheme } from "styled-components";
15
- import { Button } from "../../Button";
16
- import { FileViewer } from "../../FileViewer";
17
- import { useState } from "react";
18
- const imageActionsKey = new PluginKey("image-actions");
19
- const ImageActionsMenuRoot = styled.div `
20
- display: flex;
21
- gap: 4px;
22
-
23
- button {
24
- width: 24px;
25
- padding: 0;
26
- }
27
- `;
28
- const ImageActionsMenu = ({ onCopy, onDownload, getFile, onMouseEnter, onMouseLeave, }) => {
29
- const theme = useTheme();
30
- const [viewerFile, setViewerFile] = useState(null);
31
- const keepEditorFocus = (event) => {
32
- event.preventDefault();
33
- };
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: () => {
35
- const file = getFile();
36
- if (file) {
37
- setViewerFile(file);
38
- }
39
- }, style: { backgroundColor: theme.palette.background.paper }, children: _jsx(FullscreenIcon, { size: 14 }) })] }), _jsx(FileViewer, { file: viewerFile || undefined, open: Boolean(viewerFile), onClose: () => setViewerFile(null) })] }));
40
- };
41
- const getImageFilename = (image) => {
42
- var _a, _b;
43
- const fromTitle = (_b = (_a = image.title) === null || _a === void 0 ? void 0 : _a.match(/Filename:\s*(.+)$/)) === null || _b === void 0 ? void 0 : _b[1];
44
- if (fromTitle)
45
- return fromTitle;
46
- if (image.alt)
47
- return image.alt;
48
- try {
49
- const url = new URL(image.src);
50
- const pathname = url.pathname.split("/").filter(Boolean).pop();
51
- if (pathname)
52
- return pathname;
53
- }
54
- catch (_c) {
55
- // Data URLs and blob URLs are fine; fall back to a generated filename.
56
- }
57
- return "image.png";
58
- };
59
- const getImageBlob = (src) => __awaiter(void 0, void 0, void 0, function* () {
60
- const response = yield fetch(src);
61
- if (!response.ok) {
62
- throw new Error("Unable to load image.");
63
- }
64
- return response.blob();
65
- });
66
- const copyImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
67
- var _a;
68
- const ClipboardItemCtor = window.ClipboardItem;
69
- if (!((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.write) || !ClipboardItemCtor) {
70
- throw new Error("Image copying is not supported by this browser.");
71
- }
72
- const blob = yield getImageBlob(image.src);
73
- const type = blob.type || "image/png";
74
- yield navigator.clipboard.write([
75
- new ClipboardItemCtor({
76
- [type]: blob,
77
- }),
78
- ]);
79
- });
80
- const downloadImage = (image) => __awaiter(void 0, void 0, void 0, function* () {
81
- const filename = getImageFilename(image);
82
- let href = image.src;
83
- let objectUrl = null;
84
- try {
85
- const blob = yield getImageBlob(image.src);
86
- objectUrl = URL.createObjectURL(blob);
87
- href = objectUrl;
88
- }
89
- catch (_a) {
90
- // Cross-origin images may not be fetchable, but the browser can still try
91
- // the original URL as the download target.
92
- }
93
- const link = document.createElement("a");
94
- link.href = href;
95
- link.download = filename;
96
- document.body.appendChild(link);
97
- link.click();
98
- link.remove();
99
- if (objectUrl) {
100
- URL.revokeObjectURL(objectUrl);
101
- }
102
- });
103
- const getImageViewerFile = (image) => {
104
- var _a;
105
- const name = getImageFilename(image);
106
- const ext = ((_a = name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || "png";
107
- const url = image.currentSrc || image.src;
108
- return {
109
- name,
110
- ext,
111
- type: "image",
112
- url,
113
- };
114
- };
115
- class ImageActionsView {
116
- constructor(view, editor) {
117
- this.component = null;
118
- this.toolbar = null;
119
- this.activeImage = null;
120
- this.hideTimer = null;
121
- this.handleMouseOver = (event) => {
122
- var _a;
123
- const target = event.target;
124
- const image = (_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, "img");
125
- if (!(image instanceof HTMLImageElement) ||
126
- image.classList.contains("uploading") ||
127
- !this.view.dom.contains(image)) {
128
- return;
129
- }
130
- this.activeImage = image;
131
- this.cancelHide();
132
- this.show();
133
- };
134
- this.handleMouseOut = (event) => {
135
- var _a, _b;
136
- const relatedTarget = event.relatedTarget;
137
- if (relatedTarget &&
138
- (((_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget)) ||
139
- ((_b = this.activeImage) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget)))) {
140
- return;
141
- }
142
- this.scheduleHide();
143
- };
144
- this.handleCopy = () => __awaiter(this, void 0, void 0, function* () {
145
- if (!this.activeImage)
146
- return;
147
- try {
148
- yield copyImage(this.activeImage);
149
- }
150
- catch (error) {
151
- alert(error.message || "Unable to copy image.");
152
- }
153
- });
154
- this.handleDownload = () => __awaiter(this, void 0, void 0, function* () {
155
- if (!this.activeImage)
156
- return;
157
- yield downloadImage(this.activeImage);
158
- });
159
- this.getFile = () => {
160
- if (!this.activeImage)
161
- return null;
162
- return getImageViewerFile(this.activeImage);
163
- };
164
- this.hide = () => {
165
- if (this.toolbar) {
166
- this.toolbar.style.display = "none";
167
- }
168
- this.activeImage = null;
169
- };
170
- this.cancelHide = () => {
171
- if (!this.hideTimer)
172
- return;
173
- clearTimeout(this.hideTimer);
174
- this.hideTimer = null;
175
- };
176
- this.scheduleHide = () => {
177
- this.cancelHide();
178
- this.hideTimer = setTimeout(this.hide, 120);
179
- };
180
- this.updatePosition = () => {
181
- if (!this.activeImage ||
182
- !this.toolbar ||
183
- this.toolbar.style.display === "none")
184
- return;
185
- const rect = this.activeImage.getBoundingClientRect();
186
- const top = Math.max(8, rect.top + 8);
187
- const left = Math.min(window.innerWidth - this.toolbar.offsetWidth - 8, Math.max(8, rect.right - this.toolbar.offsetWidth - 8));
188
- this.toolbar.style.top = `${top}px`;
189
- this.toolbar.style.left = `${left}px`;
190
- };
191
- this.view = view;
192
- this.editor = editor;
193
- this.view.dom.addEventListener("mouseover", this.handleMouseOver);
194
- this.view.dom.addEventListener("mouseout", this.handleMouseOut);
195
- window.addEventListener("scroll", this.updatePosition, true);
196
- window.addEventListener("resize", this.updatePosition);
197
- }
198
- ensureToolbar() {
199
- if (this.toolbar)
200
- return this.toolbar;
201
- this.component = new ReactRenderer(ImageActionsMenu, {
202
- editor: this.editor,
203
- props: {
204
- onCopy: this.handleCopy,
205
- onDownload: this.handleDownload,
206
- getFile: this.getFile,
207
- onMouseEnter: this.cancelHide,
208
- onMouseLeave: this.scheduleHide,
209
- },
210
- className: "monolith-image-actions",
211
- });
212
- this.toolbar = this.component.element;
213
- this.toolbar.style.position = "fixed";
214
- this.toolbar.style.display = "none";
215
- this.toolbar.style.zIndex = "16000";
216
- this.view.dom.ownerDocument.body.appendChild(this.toolbar);
217
- return this.toolbar;
218
- }
219
- show() {
220
- const toolbar = this.ensureToolbar();
221
- toolbar.style.display = "block";
222
- this.updatePosition();
223
- }
224
- destroy() {
225
- var _a, _b;
226
- this.cancelHide();
227
- this.view.dom.removeEventListener("mouseover", this.handleMouseOver);
228
- this.view.dom.removeEventListener("mouseout", this.handleMouseOut);
229
- window.removeEventListener("scroll", this.updatePosition, true);
230
- window.removeEventListener("resize", this.updatePosition);
231
- (_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.remove();
232
- (_b = this.component) === null || _b === void 0 ? void 0 : _b.destroy();
233
- }
234
- }
235
- export const ImageActionsPlugin = (editor) => new Plugin({
236
- key: imageActionsKey,
237
- view: (view) => new ImageActionsView(view, editor),
238
- });
@@ -1,20 +0,0 @@
1
- import { Editor } from "@tiptap/react";
2
- export type CodeBlockLanguage = {
3
- label: string;
4
- value: string;
5
- };
6
- export declare const DEFAULT_CODE_BLOCK_LANGUAGE = "plaintext";
7
- export declare const CODE_BLOCK_LANGUAGES: CodeBlockLanguage[];
8
- export declare const getCodeBlockLanguage: (editor: Editor | null) => string;
9
- export declare const getCodeBlockLanguageOption: (language?: string) => CodeBlockLanguage;
10
- export declare const canFormatCodeBlockLanguage: (language?: string) => boolean;
11
- export declare const formatCodeBlockText: (text: string, language?: string) => Promise<string>;
12
- export declare const hasSyntaxHighlightedCodeBlock: (editor: Editor | null) => boolean;
13
- export declare const setCodeBlockLanguage: (editor: Editor | null, language: string) => void;
14
- export declare const getCodeBlockWrap: (editor: Editor | null) => boolean;
15
- export declare const toggleCodeBlockWrap: (editor: Editor | null) => void;
16
- export declare const toggleCodeBlock: (editor: Editor | null) => void;
17
- export declare const getActiveCodeBlockText: (editor: Editor | null) => string;
18
- export declare const replaceCodeBlockContent: (editor: Editor, from: number, to: number, text: string) => boolean;
19
- export declare const formatActiveCodeBlock: (editor: Editor | null) => Promise<void>;
20
- export declare const copyCodeBlockText: (text: string) => Promise<void>;
@@ -1,137 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import prettier from "prettier/standalone";
11
- import * as prettierBabelPlugin from "prettier/plugins/babel";
12
- import * as prettierEstreePlugin from "prettier/plugins/estree";
13
- import * as prettierHtmlPlugin from "prettier/plugins/html";
14
- import * as prettierMarkdownPlugin from "prettier/plugins/markdown";
15
- import * as prettierPostcssPlugin from "prettier/plugins/postcss";
16
- import * as prettierTypescriptPlugin from "prettier/plugins/typescript";
17
- import * as prettierYamlPlugin from "prettier/plugins/yaml";
18
- export const DEFAULT_CODE_BLOCK_LANGUAGE = "plaintext";
19
- export const CODE_BLOCK_LANGUAGES = [
20
- { label: "Plain Text", value: DEFAULT_CODE_BLOCK_LANGUAGE },
21
- { label: "JavaScript", value: "javascript" },
22
- { label: "TypeScript", value: "typescript" },
23
- { label: "JSX", value: "jsx" },
24
- { label: "TSX", value: "tsx" },
25
- { label: "HTML", value: "html" },
26
- { label: "CSS", value: "css" },
27
- { label: "JSON", value: "json" },
28
- { label: "Markdown", value: "markdown" },
29
- { label: "Bash", value: "bash" },
30
- { label: "Python", value: "python" },
31
- { label: "SQL", value: "sql" },
32
- { label: "YAML", value: "yaml" },
33
- { label: "XML", value: "xml" },
34
- ];
35
- const PRETTIER_PARSERS = {
36
- javascript: "babel",
37
- jsx: "babel",
38
- typescript: "typescript",
39
- tsx: "typescript",
40
- html: "html",
41
- css: "css",
42
- json: "json",
43
- markdown: "markdown",
44
- yaml: "yaml",
45
- };
46
- const PRETTIER_PLUGINS = [
47
- prettierBabelPlugin,
48
- prettierEstreePlugin,
49
- prettierHtmlPlugin,
50
- prettierMarkdownPlugin,
51
- prettierPostcssPlugin,
52
- prettierTypescriptPlugin,
53
- prettierYamlPlugin,
54
- ];
55
- export const getCodeBlockLanguage = (editor) => {
56
- var _a;
57
- return (((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes("codeBlock")) === null || _a === void 0 ? void 0 : _a.language) ||
58
- DEFAULT_CODE_BLOCK_LANGUAGE);
59
- };
60
- export const getCodeBlockLanguageOption = (language) => {
61
- return (CODE_BLOCK_LANGUAGES.find((item) => item.value === language) ||
62
- CODE_BLOCK_LANGUAGES[0]);
63
- };
64
- export const canFormatCodeBlockLanguage = (language) => {
65
- return Boolean(language && PRETTIER_PARSERS[language]);
66
- };
67
- export const formatCodeBlockText = (text, language) => __awaiter(void 0, void 0, void 0, function* () {
68
- const parser = language ? PRETTIER_PARSERS[language] : undefined;
69
- if (!parser) {
70
- throw new Error("Code formatting is not supported for this language.");
71
- }
72
- const formatted = yield prettier.format(text, {
73
- parser,
74
- plugins: PRETTIER_PLUGINS,
75
- });
76
- return formatted.replace(/\n$/, "");
77
- });
78
- export const hasSyntaxHighlightedCodeBlock = (editor) => {
79
- return Boolean(editor === null || editor === void 0 ? void 0 : editor.extensionManager.extensions.find((extension) => { var _a; return extension.name === "codeBlock" && ((_a = extension.options) === null || _a === void 0 ? void 0 : _a.lowlight); }));
80
- };
81
- export const setCodeBlockLanguage = (editor, language) => {
82
- if (!(editor === null || editor === void 0 ? void 0 : editor.isActive("codeBlock")))
83
- return;
84
- editor.chain().focus().updateAttributes("codeBlock", { language }).run();
85
- };
86
- export const getCodeBlockWrap = (editor) => {
87
- var _a;
88
- return Boolean((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes("codeBlock")) === null || _a === void 0 ? void 0 : _a.wrap);
89
- };
90
- export const toggleCodeBlockWrap = (editor) => {
91
- if (!(editor === null || editor === void 0 ? void 0 : editor.isActive("codeBlock")))
92
- return;
93
- editor
94
- .chain()
95
- .focus()
96
- .updateAttributes("codeBlock", { wrap: !getCodeBlockWrap(editor) })
97
- .run();
98
- };
99
- export const toggleCodeBlock = (editor) => {
100
- if (!editor)
101
- return;
102
- editor
103
- .chain()
104
- .focus()
105
- .toggleCodeBlock({ language: DEFAULT_CODE_BLOCK_LANGUAGE })
106
- .run();
107
- };
108
- export const getActiveCodeBlockText = (editor) => {
109
- if (!(editor === null || editor === void 0 ? void 0 : editor.isActive("codeBlock")))
110
- return "";
111
- return editor.state.selection.$from.parent.textContent;
112
- };
113
- export const replaceCodeBlockContent = (editor, from, to, text) => {
114
- return editor.commands.command(({ state, tr }) => {
115
- if (text.length) {
116
- tr.replaceWith(from, to, state.schema.text(text));
117
- }
118
- else {
119
- tr.delete(from, to);
120
- }
121
- return true;
122
- });
123
- };
124
- export const formatActiveCodeBlock = (editor) => __awaiter(void 0, void 0, void 0, function* () {
125
- if (!(editor === null || editor === void 0 ? void 0 : editor.isActive("codeBlock")))
126
- return;
127
- const language = getCodeBlockLanguage(editor);
128
- const formatted = yield formatCodeBlockText(getActiveCodeBlockText(editor), language);
129
- replaceCodeBlockContent(editor, editor.state.selection.$from.start(), editor.state.selection.$from.end(), formatted);
130
- });
131
- export const copyCodeBlockText = (text) => __awaiter(void 0, void 0, void 0, function* () {
132
- var _a;
133
- if (!((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText)) {
134
- throw new Error("Clipboard copying is not supported by this browser.");
135
- }
136
- yield navigator.clipboard.writeText(text);
137
- });
@@ -1,3 +0,0 @@
1
- import { Editor } from "@tiptap/react";
2
- export declare const hasInlineCode: (editor: Editor | null) => boolean;
3
- export declare const toggleInlineCode: (editor: Editor | null) => void;
@@ -1,12 +0,0 @@
1
- export const hasInlineCode = (editor) => {
2
- return Boolean(editor === null || editor === void 0 ? void 0 : editor.extensionManager.extensions.find((extension) => extension.name === "code"));
3
- };
4
- export const toggleInlineCode = (editor) => {
5
- if (!editor || !hasInlineCode(editor))
6
- return;
7
- if (editor.isActive("code")) {
8
- editor.chain().focus().unsetCode().run();
9
- return;
10
- }
11
- editor.chain().focus().unsetAllMarks().setCode().run();
12
- };
@@ -1,19 +0,0 @@
1
- import { EditorState } from "@tiptap/pm/state";
2
- export declare const LINK_TARGET = "_blank";
3
- export declare const LINK_REL = "noopener noreferrer nofollow";
4
- export type NormalizedLink = {
5
- href: string;
6
- isValid: boolean;
7
- };
8
- export declare const normalizeLinkUrl: (value?: string | null) => NormalizedLink;
9
- export declare const getLinkAttributes: (href: string) => {
10
- href: string;
11
- target: string;
12
- rel: string;
13
- class: string;
14
- };
15
- export declare const openLink: (href?: string | null) => void;
16
- export declare const getLinkRangeAtPosition: (state: EditorState, pos: number) => void | import("@tiptap/core").Range;
17
- export declare const getLinkAttributesAtPosition: (state: EditorState, pos: number) => {
18
- href?: string;
19
- } | undefined;
@@ -1,57 +0,0 @@
1
- import { getMarkRange } from "@tiptap/core";
2
- export const LINK_TARGET = "_blank";
3
- export const LINK_REL = "noopener noreferrer nofollow";
4
- export const normalizeLinkUrl = (value) => {
5
- const trimmedValue = (value === null || value === void 0 ? void 0 : value.trim()) || "";
6
- if (!trimmedValue) {
7
- return { href: "", isValid: false };
8
- }
9
- const href = /^[a-z][a-z0-9+.-]*:/i.test(trimmedValue)
10
- ? trimmedValue
11
- : `https://${trimmedValue}`;
12
- try {
13
- const url = new URL(href);
14
- const isValid = url.protocol === "http:" || url.protocol === "https:";
15
- return {
16
- href,
17
- isValid,
18
- };
19
- }
20
- catch (_a) {
21
- return {
22
- href,
23
- isValid: false,
24
- };
25
- }
26
- };
27
- export const getLinkAttributes = (href) => ({
28
- href,
29
- target: LINK_TARGET,
30
- rel: LINK_REL,
31
- class: "editor-link",
32
- });
33
- export const openLink = (href) => {
34
- if (!href)
35
- return;
36
- const normalizedLink = normalizeLinkUrl(href);
37
- if (!normalizedLink.isValid)
38
- return;
39
- window.open(normalizedLink.href, "_blank", "noopener,noreferrer");
40
- };
41
- export const getLinkRangeAtPosition = (state, pos) => {
42
- const linkMark = state.schema.marks.link;
43
- if (!linkMark)
44
- return;
45
- return getMarkRange(state.doc.resolve(pos), linkMark);
46
- };
47
- export const getLinkAttributesAtPosition = (state, pos) => {
48
- const linkMark = state.schema.marks.link;
49
- if (!linkMark)
50
- return;
51
- const $pos = state.doc.resolve(pos);
52
- const nextNode = $pos.parent.childAfter($pos.parentOffset).node;
53
- const previousNode = $pos.parent.childBefore($pos.parentOffset).node;
54
- const mark = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.marks.find((mark) => mark.type === linkMark)) ||
55
- (previousNode === null || previousNode === void 0 ? void 0 : previousNode.marks.find((mark) => mark.type === linkMark));
56
- return mark === null || mark === void 0 ? void 0 : mark.attrs;
57
- };
@@ -1 +0,0 @@
1
- export declare const TABLE_CELL_MIN_WIDTH = 120;
@@ -1 +0,0 @@
1
- export const TABLE_CELL_MIN_WIDTH = 120;
@@ -1,24 +0,0 @@
1
- import type { QuickDirection, QuickUnit, SuperDatePickerProps, SuperDatePickerValue } from "./SuperDatePicker.types";
2
- export declare const DEFAULT_VALUE: SuperDatePickerValue;
3
- export declare const DEFAULT_ON_CHANGE: NonNullable<SuperDatePickerProps["onChange"]>;
4
- export declare const DEFAULT_PLACEHOLDER = "Select date/time range";
5
- export declare const DEFAULT_START_LABEL = "Start";
6
- export declare const DEFAULT_END_LABEL = "End";
7
- export declare const DEFAULT_FORMAT: NonNullable<SuperDatePickerProps["format"]>;
8
- export declare const DEFAULT_SIZE: NonNullable<SuperDatePickerProps["size"]>;
9
- export declare const DEFAULT_VARIANT: NonNullable<SuperDatePickerProps["variant"]>;
10
- export declare const DEFAULT_REQUIRED = false;
11
- export declare const DEFAULT_CLEARABLE = true;
12
- export declare const DEFAULT_DISABLED = false;
13
- export declare const DEFAULT_UTC = false;
14
- export declare const DEFAULT_QUICK_DIRECTION: QuickDirection;
15
- export declare const DEFAULT_QUICK_AMOUNT = "15";
16
- export declare const DEFAULT_QUICK_UNIT: QuickUnit;
17
- export declare const QUICK_UNITS: Array<{
18
- label: string;
19
- value: QuickUnit;
20
- }>;
21
- export declare const QUICK_DIRECTION_OPTIONS: Array<{
22
- label: string;
23
- value: QuickDirection;
24
- }>;
@@ -1,30 +0,0 @@
1
- export const DEFAULT_VALUE = {
2
- start: null,
3
- end: null,
4
- };
5
- export const DEFAULT_ON_CHANGE = () => { };
6
- export const DEFAULT_PLACEHOLDER = "Select date/time range";
7
- export const DEFAULT_START_LABEL = "Start";
8
- export const DEFAULT_END_LABEL = "End";
9
- export const DEFAULT_FORMAT = "YYYY-MM-DD HH:mm:ss";
10
- export const DEFAULT_SIZE = "sm";
11
- export const DEFAULT_VARIANT = "outlined";
12
- export const DEFAULT_REQUIRED = false;
13
- export const DEFAULT_CLEARABLE = true;
14
- export const DEFAULT_DISABLED = false;
15
- export const DEFAULT_UTC = false;
16
- export const DEFAULT_QUICK_DIRECTION = "last";
17
- export const DEFAULT_QUICK_AMOUNT = "15";
18
- export const DEFAULT_QUICK_UNIT = "minutes";
19
- export const QUICK_UNITS = [
20
- { label: "Minutes", value: "minutes" },
21
- { label: "Hours", value: "hours" },
22
- { label: "Days", value: "days" },
23
- { label: "Weeks", value: "weeks" },
24
- { label: "Months", value: "months" },
25
- { label: "Years", value: "years" },
26
- ];
27
- export const QUICK_DIRECTION_OPTIONS = [
28
- { label: "Last", value: "last" },
29
- { label: "Next", value: "next" },
30
- ];
@@ -1,3 +0,0 @@
1
- import type { SuperDatePickerProps } from "./SuperDatePicker.types";
2
- declare const SuperDatePicker: import("react").ForwardRefExoticComponent<SuperDatePickerProps & import("react").RefAttributes<HTMLElement>>;
3
- export default SuperDatePicker;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { FieldLabel } from "..";
4
- import { ClearButton } from "../core";
5
- import { DEFAULT_DISABLED, DEFAULT_END_LABEL, DEFAULT_FORMAT, DEFAULT_ON_CHANGE, DEFAULT_PLACEHOLDER, DEFAULT_REQUIRED, DEFAULT_SIZE, DEFAULT_START_LABEL, DEFAULT_UTC, DEFAULT_VALUE, DEFAULT_VARIANT, } from "./SuperDatePicker.constants";
6
- import useSuperDatePicker from "./useSuperDatePicker";
7
- import { EndpointPopover, QuickRangePopover, } from "./components";
8
- import { RangeSeparator, StyledContainer, StyledInput, TriggerActions, } from "./SuperDatePicker.styled";
9
- const SuperDatePicker = forwardRef(({ className, style, defaultValue = DEFAULT_VALUE, value, onChange = DEFAULT_ON_CHANGE, label, description, placeholder = DEFAULT_PLACEHOLDER, startLabel = DEFAULT_START_LABEL, endLabel = DEFAULT_END_LABEL, format = DEFAULT_FORMAT, size = DEFAULT_SIZE, variant = DEFAULT_VARIANT, required = DEFAULT_REQUIRED, clearable, disabled = DEFAULT_DISABLED, error, width, min, max, timeIntervalMinutes, utc = DEFAULT_UTC, presets, }, ref) => {
10
- const isClearable = clearable === true;
11
- const picker = useSuperDatePicker({
12
- defaultValue,
13
- value,
14
- onChange,
15
- disabled,
16
- min,
17
- max,
18
- utc,
19
- presets,
20
- });
21
- return (_jsxs(StyledContainer, { ref: (node) => {
22
- if (typeof ref === "function") {
23
- ref(node);
24
- }
25
- else if (ref) {
26
- ref.current = node;
27
- }
28
- }, className: className, "$width": width, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInput, { size: size, variant: variant, "$disabled": disabled, "$active": picker.openSegment !== null, "$clearable": isClearable, style: style, children: [_jsx(QuickRangePopover, { opened: picker.openSegment === "quick", disabled: disabled, size: size, commonRangeGroups: picker.commonRangeGroups, quickDirection: picker.quickDirection, quickAmount: picker.quickAmount, quickUnit: picker.quickUnit, onOpenChange: (opened) => picker.handleOpenSegmentChange("quick", opened), onQuickDirectionChange: picker.handleQuickDirectionChange, onQuickAmountChange: picker.handleQuickAmountChange, onQuickAmountSubmit: picker.handleQuickAmountSubmit, onQuickUnitChange: picker.handleQuickUnitChange, onPresetClick: picker.handlePreset }), _jsx(EndpointPopover, { opened: picker.openSegment === "start", disabled: disabled, label: startLabel, value: picker.value.start, onOpenChange: (opened) => picker.handleOpenSegmentChange("start", opened), onInputChange: (next) => picker.handleEndpointChange("start", next), onCalendarChange: (date) => picker.handleCalendarChange("start", date), format: format, size: size, utc: utc, min: min, max: picker.getEndpointMax("start"), timeIntervalMinutes: timeIntervalMinutes }), _jsx(RangeSeparator, { size: size, children: "\u2192" }), _jsx(EndpointPopover, { opened: picker.openSegment === "end", disabled: disabled, label: endLabel, value: picker.value.end, onOpenChange: (opened) => picker.handleOpenSegmentChange("end", opened), onInputChange: (next) => picker.handleEndpointChange("end", next), onCalendarChange: (date) => picker.handleCalendarChange("end", date), format: format, size: size, utc: utc, min: picker.getEndpointMin("end"), max: max, timeIntervalMinutes: timeIntervalMinutes }), _jsx(TriggerActions, { children: isClearable && (picker.value.start || picker.value.end) ? (_jsx(ClearButton, { size: size, onClick: picker.handleClear })) : null })] })] }));
29
- });
30
- SuperDatePicker.displayName = "SuperDatePicker";
31
- export default SuperDatePicker;
@@ -1,17 +0,0 @@
1
- import moment from "moment";
2
- import type { CommonRangeGroupConfig, SuperDatePickerPreset } from "./SuperDatePicker.types";
3
- export declare const resolveNow: (utc: boolean) => moment.Moment;
4
- export declare const serializeMoment: (value: moment.Moment, utc: boolean) => string;
5
- export declare const createRange: (start: moment.Moment, end: moment.Moment, utc: boolean) => {
6
- start: string;
7
- end: string;
8
- };
9
- export declare const makeCommonRange: (utc: boolean, label: string, getRange: (now: moment.Moment) => {
10
- start: moment.Moment;
11
- end: moment.Moment;
12
- }) => SuperDatePickerPreset;
13
- export declare const getDefaultCommonRangeGroups: (utc: boolean) => CommonRangeGroupConfig[];
14
- export declare const getAdditionalCommonRangeGroups: (utc: boolean) => CommonRangeGroupConfig[];
15
- export declare const parseRangeMoment: (value: string | null | undefined, utc: boolean) => moment.Moment | null;
16
- export declare const momentToCalendarDate: (value: string | null | undefined, utc: boolean) => Date | undefined;
17
- export declare const calendarDateToMoment: (value: Date, utc: boolean) => moment.Moment;