@tumaet/prompt-ui-components 0.0.3 → 0.0.5

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 (232) hide show
  1. package/dist/components/DatePicker.js +18 -0
  2. package/dist/components/DatePicker.js.map +1 -0
  3. package/dist/components/DateRangePicker.js +12 -0
  4. package/dist/components/DateRangePicker.js.map +1 -0
  5. package/dist/components/DeleteConfirmationDialog.js +13 -0
  6. package/dist/components/DeleteConfirmationDialog.js.map +1 -0
  7. package/dist/components/ErrorPage.js +9 -0
  8. package/dist/components/ErrorPage.js.map +1 -0
  9. package/dist/components/LoadingPage.js +6 -0
  10. package/dist/components/LoadingPage.js.map +1 -0
  11. package/dist/components/ManagementPageHeader.js +5 -0
  12. package/dist/components/ManagementPageHeader.js.map +1 -0
  13. package/dist/components/MultiSelect.js +96 -0
  14. package/dist/components/MultiSelect.js.map +1 -0
  15. package/dist/components/SaveChangesAlert.js +31 -0
  16. package/dist/components/SaveChangesAlert.js.map +1 -0
  17. package/dist/components/UnauthorizedPage.js +13 -0
  18. package/dist/components/UnauthorizedPage.js.map +1 -0
  19. package/dist/components/index.js +9 -0
  20. package/dist/components/index.js.map +1 -1
  21. package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js +65 -0
  22. package/dist/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.js.map +1 -0
  23. package/dist/components/minimal-tiptap/components/image/image-edit-block.js +38 -0
  24. package/dist/components/minimal-tiptap/components/image/image-edit-block.js.map +1 -0
  25. package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js +12 -0
  26. package/dist/components/minimal-tiptap/components/image/image-edit-dialog.js.map +1 -0
  27. package/dist/components/minimal-tiptap/components/link/link-edit-block.js +34 -0
  28. package/dist/components/minimal-tiptap/components/link/link-edit-block.js.map +1 -0
  29. package/dist/components/minimal-tiptap/components/link/link-edit-popover.js +38 -0
  30. package/dist/components/minimal-tiptap/components/link/link-edit-popover.js.map +1 -0
  31. package/dist/components/minimal-tiptap/components/link/link-popover-block.js +28 -0
  32. package/dist/components/minimal-tiptap/components/link/link-popover-block.js.map +1 -0
  33. package/dist/components/minimal-tiptap/components/measured-container.js +16 -0
  34. package/dist/components/minimal-tiptap/components/measured-container.js.map +1 -0
  35. package/dist/components/minimal-tiptap/components/section/five.js +39 -0
  36. package/dist/components/minimal-tiptap/components/section/five.js.map +1 -0
  37. package/dist/components/minimal-tiptap/components/section/four.js +29 -0
  38. package/dist/components/minimal-tiptap/components/section/four.js.map +1 -0
  39. package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js +23 -0
  40. package/dist/components/minimal-tiptap/components/section/mailingPlaceholders.js.map +1 -0
  41. package/dist/components/minimal-tiptap/components/section/one.js +77 -0
  42. package/dist/components/minimal-tiptap/components/section/one.js.map +1 -0
  43. package/dist/components/minimal-tiptap/components/section/three.js +79 -0
  44. package/dist/components/minimal-tiptap/components/section/three.js.map +1 -0
  45. package/dist/components/minimal-tiptap/components/section/two.js +65 -0
  46. package/dist/components/minimal-tiptap/components/section/two.js.map +1 -0
  47. package/dist/components/minimal-tiptap/components/shortcut-key.js +11 -0
  48. package/dist/components/minimal-tiptap/components/shortcut-key.js.map +1 -0
  49. package/dist/components/minimal-tiptap/components/spinner.js +9 -0
  50. package/dist/components/minimal-tiptap/components/spinner.js.map +1 -0
  51. package/dist/components/minimal-tiptap/components/toolbar-button.js +15 -0
  52. package/dist/components/minimal-tiptap/components/toolbar-button.js.map +1 -0
  53. package/dist/components/minimal-tiptap/components/toolbar-section.js +27 -0
  54. package/dist/components/minimal-tiptap/components/toolbar-section.js.map +1 -0
  55. package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js +16 -0
  56. package/dist/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.js.map +1 -0
  57. package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js +2 -0
  58. package/dist/components/minimal-tiptap/extensions/code-block-lowlight/index.js.map +1 -0
  59. package/dist/components/minimal-tiptap/extensions/color/color.js +20 -0
  60. package/dist/components/minimal-tiptap/extensions/color/color.js.map +1 -0
  61. package/dist/components/minimal-tiptap/extensions/color/index.js +2 -0
  62. package/dist/components/minimal-tiptap/extensions/color/index.js.map +1 -0
  63. package/dist/components/minimal-tiptap/extensions/file-handler/index.js +74 -0
  64. package/dist/components/minimal-tiptap/extensions/file-handler/index.js.map +1 -0
  65. package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js +16 -0
  66. package/dist/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.js.map +1 -0
  67. package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js +2 -0
  68. package/dist/components/minimal-tiptap/extensions/horizontal-rule/index.js.map +1 -0
  69. package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js +39 -0
  70. package/dist/components/minimal-tiptap/extensions/image/components/image-actions.js.map +1 -0
  71. package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js +9 -0
  72. package/dist/components/minimal-tiptap/extensions/image/components/image-overlay.js.map +1 -0
  73. package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js +167 -0
  74. package/dist/components/minimal-tiptap/extensions/image/components/image-view-block.js.map +1 -0
  75. package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js +11 -0
  76. package/dist/components/minimal-tiptap/extensions/image/components/resize-handle.js.map +1 -0
  77. package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js +88 -0
  78. package/dist/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.js.map +1 -0
  79. package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js +32 -0
  80. package/dist/components/minimal-tiptap/extensions/image/hooks/use-image-actions.js.map +1 -0
  81. package/dist/components/minimal-tiptap/extensions/image/image.js +225 -0
  82. package/dist/components/minimal-tiptap/extensions/image/image.js.map +1 -0
  83. package/dist/components/minimal-tiptap/extensions/image/index.js +2 -0
  84. package/dist/components/minimal-tiptap/extensions/image/index.js.map +1 -0
  85. package/dist/components/minimal-tiptap/extensions/index.js +10 -0
  86. package/dist/components/minimal-tiptap/extensions/index.js.map +1 -0
  87. package/dist/components/minimal-tiptap/extensions/link/index.js +2 -0
  88. package/dist/components/minimal-tiptap/extensions/link/index.js.map +1 -0
  89. package/dist/components/minimal-tiptap/extensions/link/link.js +74 -0
  90. package/dist/components/minimal-tiptap/extensions/link/link.js.map +1 -0
  91. package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js +2 -0
  92. package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/index.js.map +1 -0
  93. package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js +20 -0
  94. package/dist/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.js.map +1 -0
  95. package/dist/components/minimal-tiptap/extensions/selection/index.js +2 -0
  96. package/dist/components/minimal-tiptap/extensions/selection/index.js.map +1 -0
  97. package/dist/components/minimal-tiptap/extensions/selection/selection.js +31 -0
  98. package/dist/components/minimal-tiptap/extensions/selection/selection.js.map +1 -0
  99. package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js +2 -0
  100. package/dist/components/minimal-tiptap/extensions/unset-all-marks/index.js.map +1 -0
  101. package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js +9 -0
  102. package/dist/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.js.map +1 -0
  103. package/dist/components/minimal-tiptap/form-description-tiptap.js +26 -0
  104. package/dist/components/minimal-tiptap/form-description-tiptap.js.map +1 -0
  105. package/dist/components/minimal-tiptap/hooks/use-container-size.js +44 -0
  106. package/dist/components/minimal-tiptap/hooks/use-container-size.js.map +1 -0
  107. package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js +160 -0
  108. package/dist/components/minimal-tiptap/hooks/use-minimal-tiptap.js.map +1 -0
  109. package/dist/components/minimal-tiptap/hooks/use-theme.js +19 -0
  110. package/dist/components/minimal-tiptap/hooks/use-theme.js.map +1 -0
  111. package/dist/components/minimal-tiptap/hooks/use-throttle.js +24 -0
  112. package/dist/components/minimal-tiptap/hooks/use-throttle.js.map +1 -0
  113. package/dist/components/minimal-tiptap/index.js +2 -0
  114. package/dist/components/minimal-tiptap/index.js.map +1 -0
  115. package/dist/components/minimal-tiptap/mailing-tiptap.js +30 -0
  116. package/dist/components/minimal-tiptap/mailing-tiptap.js.map +1 -0
  117. package/dist/components/minimal-tiptap/minimal-tiptap.js +29 -0
  118. package/dist/components/minimal-tiptap/minimal-tiptap.js.map +1 -0
  119. package/dist/components/minimal-tiptap/types.js +2 -0
  120. package/dist/components/minimal-tiptap/types.js.map +1 -0
  121. package/dist/components/minimal-tiptap/utils.js +156 -0
  122. package/dist/components/minimal-tiptap/utils.js.map +1 -0
  123. package/dist/components/table/GroupActionDialog.js +8 -0
  124. package/dist/components/table/GroupActionDialog.js.map +1 -0
  125. package/dist/components/table/SortableHeader.js +7 -0
  126. package/dist/components/table/SortableHeader.js.map +1 -0
  127. package/dist/components/ui/accordion.js +1 -1
  128. package/dist/components/ui/alert-dialog.js +2 -2
  129. package/dist/components/ui/alert.js +1 -1
  130. package/dist/components/ui/avatar.js +1 -1
  131. package/dist/components/ui/badge.js +1 -1
  132. package/dist/components/ui/breadcrumb.js +1 -1
  133. package/dist/components/ui/button.js +1 -1
  134. package/dist/components/ui/calendar.js +2 -2
  135. package/dist/components/ui/card.js +1 -1
  136. package/dist/components/ui/chart.js +1 -1
  137. package/dist/components/ui/checkbox.js +1 -1
  138. package/dist/components/ui/command.js +2 -2
  139. package/dist/components/ui/dialog.js +1 -1
  140. package/dist/components/ui/dropdown-menu.js +1 -1
  141. package/dist/components/ui/form.js +2 -2
  142. package/dist/components/ui/input.js +1 -1
  143. package/dist/components/ui/label.js +1 -1
  144. package/dist/components/ui/popover.js +1 -1
  145. package/dist/components/ui/progress.js +1 -1
  146. package/dist/components/ui/radio-group.js +1 -1
  147. package/dist/components/ui/scroll-area.js +1 -1
  148. package/dist/components/ui/select.js +1 -1
  149. package/dist/components/ui/separator.js +1 -1
  150. package/dist/components/ui/sheet.js +1 -1
  151. package/dist/components/ui/sidebar.js +8 -8
  152. package/dist/components/ui/skeleton.js +1 -1
  153. package/dist/components/ui/switch.js +1 -1
  154. package/dist/components/ui/table.js +1 -1
  155. package/dist/components/ui/tabs.js +1 -1
  156. package/dist/components/ui/textarea.js +1 -1
  157. package/dist/components/ui/toast.js +1 -1
  158. package/dist/components/ui/toaster.js +2 -2
  159. package/dist/components/ui/toggle-group.js +2 -2
  160. package/dist/components/ui/toggle.js +1 -1
  161. package/dist/components/ui/tooltip.js +1 -1
  162. package/dist/index.css +2 -3
  163. package/dist/index.js +1 -0
  164. package/dist/index.js.map +1 -1
  165. package/dist/types/components/DatePicker.d.ts +6 -0
  166. package/dist/types/components/DateRangePicker.d.ts +8 -0
  167. package/dist/types/components/DeleteConfirmationDialog.d.ts +9 -0
  168. package/dist/types/components/ErrorPage.d.ts +9 -0
  169. package/dist/types/components/LoadingPage.d.ts +1 -0
  170. package/dist/types/components/ManagementPageHeader.d.ts +5 -0
  171. package/dist/types/components/MultiSelect.d.ts +68 -0
  172. package/dist/types/components/SaveChangesAlert.d.ts +8 -0
  173. package/dist/types/components/UnauthorizedPage.d.ts +7 -0
  174. package/dist/types/components/index.d.ts +9 -0
  175. package/dist/types/components/minimal-tiptap/components/bubble-menu/link-bubble-menu.d.ts +7 -0
  176. package/dist/types/components/minimal-tiptap/components/image/image-edit-block.d.ts +8 -0
  177. package/dist/types/components/minimal-tiptap/components/image/image-edit-dialog.d.ts +8 -0
  178. package/dist/types/components/minimal-tiptap/components/link/link-edit-block.d.ts +9 -0
  179. package/dist/types/components/minimal-tiptap/components/link/link-edit-popover.d.ts +8 -0
  180. package/dist/types/components/minimal-tiptap/components/link/link-popover-block.d.ts +8 -0
  181. package/dist/types/components/minimal-tiptap/components/measured-container.d.ts +2 -0
  182. package/dist/types/components/minimal-tiptap/components/section/five.d.ts +12 -0
  183. package/dist/types/components/minimal-tiptap/components/section/four.d.ts +12 -0
  184. package/dist/types/components/minimal-tiptap/components/section/mailingPlaceholders.d.ts +10 -0
  185. package/dist/types/components/minimal-tiptap/components/section/one.d.ts +11 -0
  186. package/dist/types/components/minimal-tiptap/components/section/three.d.ts +9 -0
  187. package/dist/types/components/minimal-tiptap/components/section/two.d.ts +12 -0
  188. package/dist/types/components/minimal-tiptap/components/shortcut-key.d.ts +5 -0
  189. package/dist/types/components/minimal-tiptap/components/spinner.d.ts +5 -0
  190. package/dist/types/components/minimal-tiptap/components/toolbar-button.d.ts +10 -0
  191. package/dist/types/components/minimal-tiptap/components/toolbar-section.d.ts +16 -0
  192. package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/code-block-lowlight.d.ts +2 -0
  193. package/dist/types/components/minimal-tiptap/extensions/code-block-lowlight/index.d.ts +1 -0
  194. package/dist/types/components/minimal-tiptap/extensions/color/color.d.ts +1 -0
  195. package/dist/types/components/minimal-tiptap/extensions/color/index.d.ts +1 -0
  196. package/dist/types/components/minimal-tiptap/extensions/file-handler/index.d.ts +12 -0
  197. package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/horizontal-rule.d.ts +2 -0
  198. package/dist/types/components/minimal-tiptap/extensions/horizontal-rule/index.d.ts +1 -0
  199. package/dist/types/components/minimal-tiptap/extensions/image/components/image-actions.d.ts +17 -0
  200. package/dist/types/components/minimal-tiptap/extensions/image/components/image-overlay.d.ts +2 -0
  201. package/dist/types/components/minimal-tiptap/extensions/image/components/image-view-block.d.ts +3 -0
  202. package/dist/types/components/minimal-tiptap/extensions/image/components/resize-handle.d.ts +6 -0
  203. package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-drag-resize.d.ts +24 -0
  204. package/dist/types/components/minimal-tiptap/extensions/image/hooks/use-image-actions.d.ts +24 -0
  205. package/dist/types/components/minimal-tiptap/extensions/image/image.d.ts +52 -0
  206. package/dist/types/components/minimal-tiptap/extensions/image/index.d.ts +1 -0
  207. package/dist/types/components/minimal-tiptap/extensions/index.d.ts +9 -0
  208. package/dist/types/components/minimal-tiptap/extensions/link/index.d.ts +1 -0
  209. package/dist/types/components/minimal-tiptap/extensions/link/link.d.ts +2 -0
  210. package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/index.d.ts +1 -0
  211. package/dist/types/components/minimal-tiptap/extensions/reset-marks-on-enter/reset-marks-on-enter.d.ts +2 -0
  212. package/dist/types/components/minimal-tiptap/extensions/selection/index.d.ts +1 -0
  213. package/dist/types/components/minimal-tiptap/extensions/selection/selection.d.ts +3 -0
  214. package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/index.d.ts +1 -0
  215. package/dist/types/components/minimal-tiptap/extensions/unset-all-marks/unset-all-marks.d.ts +2 -0
  216. package/dist/types/components/minimal-tiptap/form-description-tiptap.d.ts +4 -0
  217. package/dist/types/components/minimal-tiptap/hooks/use-container-size.d.ts +1 -0
  218. package/dist/types/components/minimal-tiptap/hooks/use-minimal-tiptap.d.ts +13 -0
  219. package/dist/types/components/minimal-tiptap/hooks/use-theme.d.ts +2 -0
  220. package/dist/types/components/minimal-tiptap/hooks/use-throttle.d.ts +1 -0
  221. package/dist/types/components/minimal-tiptap/index.d.ts +1 -0
  222. package/dist/types/components/minimal-tiptap/mailing-tiptap.d.ts +13 -0
  223. package/dist/types/components/minimal-tiptap/minimal-tiptap.d.ts +12 -0
  224. package/dist/types/components/minimal-tiptap/types.d.ts +25 -0
  225. package/dist/types/components/minimal-tiptap/utils.d.ts +38 -0
  226. package/dist/types/components/table/GroupActionDialog.d.ts +11 -0
  227. package/dist/types/components/table/SortableHeader.d.ts +4 -0
  228. package/dist/types/components/ui/sidebar.d.ts +2 -2
  229. package/dist/types/hooks/use-toast.d.ts +1 -1
  230. package/dist/types/index.d.ts +1 -0
  231. package/package.json +24 -2
  232. package/src/index.css +1 -2
@@ -0,0 +1,160 @@
1
+ /* eslint-disable @typescript-eslint/no-shadow */
2
+ import * as React from 'react';
3
+ import { StarterKit } from '@tiptap/starter-kit';
4
+ import { useEditor } from '@tiptap/react';
5
+ import { Typography } from '@tiptap/extension-typography';
6
+ import { Placeholder } from '@tiptap/extension-placeholder';
7
+ import { Underline } from '@tiptap/extension-underline';
8
+ import { TextStyle } from '@tiptap/extension-text-style';
9
+ import { Link, Image, HorizontalRule, CodeBlockLowlight, Selection, Color, UnsetAllMarks, ResetMarksOnEnter, FileHandler, } from '../extensions';
10
+ import { cn } from '../../../lib/utils';
11
+ import { fileToBase64, getOutput, randomId } from '../utils';
12
+ import { useThrottle } from '../hooks/use-throttle';
13
+ import { toast } from 'sonner';
14
+ const createExtensions = (placeholder) => [
15
+ StarterKit.configure({
16
+ horizontalRule: false,
17
+ codeBlock: false,
18
+ paragraph: { HTMLAttributes: { class: 'text-node' } },
19
+ heading: { HTMLAttributes: { class: 'heading-node' } },
20
+ blockquote: { HTMLAttributes: { class: 'block-node' } },
21
+ bulletList: { HTMLAttributes: { class: 'list-node' } },
22
+ orderedList: { HTMLAttributes: { class: 'list-node' } },
23
+ code: { HTMLAttributes: { class: 'inline', spellcheck: 'false' } },
24
+ dropcursor: { width: 2, class: 'ProseMirror-dropcursor border' },
25
+ }),
26
+ Link,
27
+ Underline,
28
+ Image.configure({
29
+ allowedMimeTypes: ['image/*'],
30
+ maxFileSize: 5 * 1024 * 1024,
31
+ allowBase64: true,
32
+ uploadFn: async (file) => {
33
+ // NOTE: This is a fake upload function. Replace this with your own upload logic.
34
+ // This function should return the uploaded image URL.
35
+ // wait 3s to simulate upload
36
+ await new Promise((resolve) => setTimeout(resolve, 3000));
37
+ const src = await fileToBase64(file);
38
+ // either return { id: string | number, src: string } or just src
39
+ // return src;
40
+ return { id: randomId(), src };
41
+ },
42
+ onToggle(editor, files, pos) {
43
+ editor.commands.insertContentAt(pos, files.map((image) => {
44
+ const blobUrl = URL.createObjectURL(image);
45
+ const id = randomId();
46
+ return {
47
+ type: 'image',
48
+ attrs: {
49
+ id,
50
+ src: blobUrl,
51
+ alt: image.name,
52
+ title: image.name,
53
+ fileName: image.name,
54
+ },
55
+ };
56
+ }));
57
+ },
58
+ onImageRemoved({ id, src }) {
59
+ console.log('Image removed', { id, src });
60
+ },
61
+ onValidationError(errors) {
62
+ errors.forEach((error) => {
63
+ toast.error('Image validation error', {
64
+ position: 'bottom-right',
65
+ description: error.reason,
66
+ });
67
+ });
68
+ },
69
+ onActionSuccess({ action }) {
70
+ const mapping = {
71
+ copyImage: 'Copy Image',
72
+ copyLink: 'Copy Link',
73
+ download: 'Download',
74
+ };
75
+ toast.success(mapping[action], {
76
+ position: 'bottom-right',
77
+ description: 'Image action success',
78
+ });
79
+ },
80
+ onActionError(error, { action }) {
81
+ const mapping = {
82
+ copyImage: 'Copy Image',
83
+ copyLink: 'Copy Link',
84
+ download: 'Download',
85
+ };
86
+ toast.error(`Failed to ${mapping[action]}`, {
87
+ position: 'bottom-right',
88
+ description: error.message,
89
+ });
90
+ },
91
+ }),
92
+ FileHandler.configure({
93
+ allowBase64: true,
94
+ allowedMimeTypes: ['image/*'],
95
+ maxFileSize: 5 * 1024 * 1024,
96
+ onDrop: (editor, files, pos) => {
97
+ files.forEach(async (file) => {
98
+ const src = await fileToBase64(file);
99
+ editor.commands.insertContentAt(pos, {
100
+ type: 'image',
101
+ attrs: { src },
102
+ });
103
+ });
104
+ },
105
+ onPaste: (editor, files) => {
106
+ files.forEach(async (file) => {
107
+ const src = await fileToBase64(file);
108
+ editor.commands.insertContent({
109
+ type: 'image',
110
+ attrs: { src },
111
+ });
112
+ });
113
+ },
114
+ onValidationError: (errors) => {
115
+ errors.forEach((error) => {
116
+ toast.error('Image validation error', {
117
+ position: 'bottom-right',
118
+ description: error.reason,
119
+ });
120
+ });
121
+ },
122
+ }),
123
+ Color,
124
+ TextStyle,
125
+ Selection,
126
+ Typography,
127
+ UnsetAllMarks,
128
+ HorizontalRule,
129
+ ResetMarksOnEnter,
130
+ CodeBlockLowlight,
131
+ Placeholder.configure({ placeholder: () => placeholder }),
132
+ ];
133
+ export const useMinimalTiptapEditor = ({ value, output = 'html', placeholder = '', editorClassName, throttleDelay = 0, onUpdate, onBlur, ...props }) => {
134
+ const throttledSetValue = useThrottle((value) => onUpdate?.(value), throttleDelay);
135
+ const handleUpdate = React.useCallback((editor) => throttledSetValue(getOutput(editor, output)), [output, throttledSetValue]);
136
+ const handleCreate = React.useCallback((editor) => {
137
+ if (value && editor.isEmpty) {
138
+ editor.commands.setContent(value);
139
+ }
140
+ }, [value]);
141
+ const handleBlur = React.useCallback((editor) => onBlur?.(getOutput(editor, output)), [output, onBlur]);
142
+ const editor = useEditor({
143
+ extensions: createExtensions(placeholder),
144
+ editorProps: {
145
+ attributes: {
146
+ autocomplete: 'off',
147
+ autocorrect: 'off',
148
+ autocapitalize: 'off',
149
+ class: cn('focus:outline-none', editorClassName),
150
+ },
151
+ },
152
+ onUpdate: ({ editor }) => handleUpdate(editor),
153
+ onCreate: ({ editor }) => handleCreate(editor),
154
+ onBlur: ({ editor }) => handleBlur(editor),
155
+ ...props,
156
+ });
157
+ return editor;
158
+ };
159
+ export default useMinimalTiptapEditor;
160
+ //# sourceMappingURL=use-minimal-tiptap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-minimal-tiptap.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-minimal-tiptap.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,IAAI,EACJ,KAAK,EACL,cAA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AAC,WAAW,CACpC,CAAC,MAAc,EAAE,EAAE;QACjB,IAAI,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACnC,CAAC;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAA;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACvD,CAAC,MAAM,EAAE,MAAM,CAAC,CACjB,CAAA;IAED,MAAM,MAAM,GAAG,SAAS,CAAC;QACvB,UAAU,EAAE,gBAAgB,CAAC,WAAW,CAAC;QACzC,WAAW,EAAE;YACX,UAAU,EAAE;gBACV,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,KAAK;gBAClB,cAAc,EAAE,KAAK;gBACrB,KAAK,EAAE,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC;aACjD;SACF;QACD,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;QAC9C,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;QAC9C,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAC1C,GAAG,KAAK;KACT,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ export const useTheme = () => {
3
+ const [isDarkMode, setIsDarkMode] = React.useState(false);
4
+ React.useEffect(() => {
5
+ const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
6
+ setIsDarkMode(darkModeMediaQuery.matches);
7
+ const handleChange = (e) => {
8
+ const newDarkMode = e.matches;
9
+ setIsDarkMode(newDarkMode);
10
+ };
11
+ darkModeMediaQuery.addEventListener('change', handleChange);
12
+ return () => {
13
+ darkModeMediaQuery.removeEventListener('change', handleChange);
14
+ };
15
+ }, []);
16
+ return isDarkMode;
17
+ };
18
+ export default useTheme;
19
+ //# sourceMappingURL=use-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAA;QAC5E,aAAa,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;QAEzC,MAAM,YAAY,GAAG,CAAC,CAAsB,EAAE,EAAE;YAC9C,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,CAAA;YAC7B,aAAa,CAAC,WAAW,CAAC,CAAA;QAC5B,CAAC,CAAA;QAED,kBAAkB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAE3D,OAAO,GAAG,EAAE;YACV,kBAAkB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAChE,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { useRef, useCallback } from 'react';
2
+ export function useThrottle(callback, delay) {
3
+ const lastRan = useRef(Date.now());
4
+ const timeoutRef = useRef(null);
5
+ return useCallback((...args) => {
6
+ const handler = () => {
7
+ if (Date.now() - lastRan.current >= delay) {
8
+ callback(...args);
9
+ lastRan.current = Date.now();
10
+ }
11
+ else {
12
+ if (timeoutRef.current) {
13
+ clearTimeout(timeoutRef.current);
14
+ }
15
+ timeoutRef.current = setTimeout(() => {
16
+ callback(...args);
17
+ lastRan.current = Date.now();
18
+ }, delay - (Date.now() - lastRan.current));
19
+ }
20
+ };
21
+ handler();
22
+ }, [callback, delay]);
23
+ }
24
+ //# sourceMappingURL=use-throttle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-throttle.js","sourceRoot":"","sources":["../../../../src/components/minimal-tiptap/hooks/use-throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,UAAU,WAAW,CACzB,QAAW,EACX,KAAa;IAEb,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAClC,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;IAErE,OAAO,WAAW,CAChB,CAAC,GAAG,IAAmB,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;gBAC1C,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;gBACjB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YAC9B,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACvB,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;gBAClC,CAAC;gBACD,UAAU,CAAC,OAAO,GAAG,UAAU,CAC7B,GAAG,EAAE;oBACH,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;oBACjB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAC9B,CAAC,EACD,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CACvC,CAAA;YACH,CAAC;QACH,CAAC,CAAA;QAED,OAAO,EAAE,CAAA;IACX,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './minimal-tiptap';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import './styles/index.css';
4
+ import { EditorContent } from '@tiptap/react';
5
+ import { Separator } from '../../components/ui/separator';
6
+ import { cn } from '../../lib/utils';
7
+ import { SectionOne } from './components/section/one';
8
+ import { SectionTwo } from './components/section/two';
9
+ import { SectionThree } from './components/section/three';
10
+ import { SectionFour } from './components/section/four';
11
+ import { SectionFive } from './components/section/five';
12
+ import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
13
+ import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
14
+ import { MeasuredContainer } from './components/measured-container';
15
+ import SectionMailingPlaceholders from './components/section/mailingPlaceholders';
16
+ const MailingToolbar = ({ editor, placeholders }) => (_jsx("div", { className: 'shrink-0 overflow-x-auto border-b border-border p-2', children: _jsxs("div", { className: 'flex w-max items-center gap-px', children: [_jsx(SectionOne, { editor: editor, activeLevels: [1, 2, 3, 4, 5, 6] }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionTwo, { editor: editor, activeActions: ['bold', 'italic', 'underline', 'strikethrough', 'code', 'clearFormatting'], mainActionCount: 3 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionThree, { editor: editor }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFour, { editor: editor, activeActions: ['orderedList', 'bulletList'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFive, { editor: editor, activeActions: ['codeBlock', 'blockquote', 'horizontalRule'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionMailingPlaceholders, { editor: editor, placeholders: placeholders })] }) }));
17
+ export const MailingTiptapEditor = React.forwardRef(({ value, onChange, className, editorContentClassName, placeholders, ...props }, ref) => {
18
+ const editor = useMinimalTiptapEditor({
19
+ value,
20
+ onUpdate: onChange,
21
+ ...props,
22
+ });
23
+ if (!editor) {
24
+ return null;
25
+ }
26
+ return (_jsxs(MeasuredContainer, { as: 'div', name: 'editor', ref: ref, className: cn('flex h-auto min-h-72 w-full flex-col rounded-md border border-input shadow-sm focus-within:border-primary', className), children: [_jsx(MailingToolbar, { editor: editor, placeholders: placeholders }), _jsx(EditorContent, { editor: editor, className: cn('minimal-tiptap-editor', editorContentClassName) }), _jsx(LinkBubbleMenu, { editor: editor })] }));
27
+ });
28
+ MailingTiptapEditor.displayName = 'MailingTiptapEditor';
29
+ export default MailingTiptapEditor;
30
+ //# sourceMappingURL=mailing-tiptap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailing-tiptap.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/mailing-tiptap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAI3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC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Ae,mBAAmB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import './styles/index.css';
4
+ import { EditorContent } from '@tiptap/react';
5
+ import { Separator } from '../../components/ui/separator';
6
+ import { cn } from '../../lib/utils';
7
+ import { SectionOne } from './components/section/one';
8
+ import { SectionTwo } from './components/section/two';
9
+ import { SectionThree } from './components/section/three';
10
+ import { SectionFour } from './components/section/four';
11
+ import { SectionFive } from './components/section/five';
12
+ import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
13
+ import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
14
+ import { MeasuredContainer } from './components/measured-container';
15
+ const Toolbar = ({ editor }) => (_jsx("div", { className: 'shrink-0 overflow-x-auto border-b border-border p-2', children: _jsxs("div", { className: 'flex w-max items-center gap-px', children: [_jsx(SectionOne, { editor: editor, activeLevels: [1, 2, 3, 4, 5, 6] }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionTwo, { editor: editor, activeActions: ['bold', 'italic', 'underline', 'strikethrough', 'code', 'clearFormatting'], mainActionCount: 3 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionThree, { editor: editor }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFour, { editor: editor, activeActions: ['orderedList', 'bulletList'], mainActionCount: 0 }), _jsx(Separator, { orientation: 'vertical', className: 'mx-2 h-7' }), _jsx(SectionFive, { editor: editor, activeActions: ['codeBlock', 'blockquote', 'horizontalRule'], mainActionCount: 0 })] }) }));
16
+ export const MinimalTiptapEditor = React.forwardRef(({ value, onChange, className, editorContentClassName, ...props }, ref) => {
17
+ const editor = useMinimalTiptapEditor({
18
+ value,
19
+ onUpdate: onChange,
20
+ ...props,
21
+ });
22
+ if (!editor) {
23
+ return null;
24
+ }
25
+ return (_jsxs(MeasuredContainer, { as: 'div', name: 'editor', ref: ref, className: cn('flex h-auto min-h-32 w-full flex-col rounded-md border border-input shadow-sm focus-within:border-primary', className), children: [_jsx(Toolbar, { editor: editor }), _jsx(EditorContent, { editor: editor, className: cn('minimal-tiptap-editor', editorContentClassName) }), _jsx(LinkBubbleMenu, { editor: editor })] }));
26
+ });
27
+ MinimalTiptapEditor.displayName = 'MinimalTiptapEditor';
28
+ export default MinimalTiptapEditor;
29
+ //# sourceMappingURL=minimal-tiptap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimal-tiptap.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/minimal-tiptap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAI3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AASnE,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE,CAAC,CAClD,cAAK,SAAS,EAAC,qDAAqD,YAClE,eAAK,SAAS,EAAC,gCAAgC,aAC7C,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CA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C,iBAAiB,IAChB,EAAE,EAAC,KAAK,EACR,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,2GAA2G,EAC3G,SAAS,CACV,aAED,KAAC,OAAO,IAAC,MAAM,EAAE,MAAM,GAAI,EAC3B,KAAC,aAAa,IACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,GAC9D,EACF,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,IAChB,CACrB,CAAA;AACH,CAAC,CACF,CAAA;AAED,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA;AAEvD,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,156 @@
1
+ export const isClient = () => typeof window !== 'undefined';
2
+ export const isServer = () => !isClient();
3
+ export const isMacOS = () => isClient() && window.navigator.platform === 'MacIntel';
4
+ const shortcutKeyMap = {
5
+ mod: isMacOS() ? { symbol: '⌘', readable: 'Command' } : { symbol: 'Ctrl', readable: 'Control' },
6
+ alt: isMacOS() ? { symbol: '⌥', readable: 'Option' } : { symbol: 'Alt', readable: 'Alt' },
7
+ shift: { symbol: '⇧', readable: 'Shift' }
8
+ };
9
+ export const getShortcutKey = (key) => shortcutKeyMap[key.toLowerCase()] || { symbol: key, readable: key };
10
+ export const getShortcutKeys = (keys) => keys.map(getShortcutKey);
11
+ export const getOutput = (editor, format) => {
12
+ switch (format) {
13
+ case 'json':
14
+ return editor.getJSON();
15
+ case 'html':
16
+ return editor.isEmpty ? '' : editor.getHTML();
17
+ default:
18
+ return editor.getText();
19
+ }
20
+ };
21
+ export const isUrl = (text, options = { requireHostname: false }) => {
22
+ if (text.includes('\n'))
23
+ return false;
24
+ try {
25
+ const url = new URL(text);
26
+ const blockedProtocols = ['javascript:', 'file:', 'vbscript:', ...(options.allowBase64 ? [] : ['data:'])];
27
+ if (blockedProtocols.includes(url.protocol))
28
+ return false;
29
+ if (options.allowBase64 && url.protocol === 'data:')
30
+ return /^data:image\/[a-z]+;base64,/.test(text);
31
+ if (url.hostname)
32
+ return true;
33
+ return (url.protocol !== '' &&
34
+ (url.pathname.startsWith('//') || url.pathname.startsWith('http')) &&
35
+ !options.requireHostname);
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ };
41
+ export const sanitizeUrl = (url, options = {}) => {
42
+ if (!url)
43
+ return undefined;
44
+ if (options.allowBase64 && url.startsWith('data:image')) {
45
+ return isUrl(url, { requireHostname: false, allowBase64: true }) ? url : undefined;
46
+ }
47
+ return isUrl(url, { requireHostname: false, allowBase64: options.allowBase64 }) ||
48
+ /^(\/|#|mailto:|sms:|fax:|tel:)/.test(url)
49
+ ? url
50
+ : `https://${url}`;
51
+ };
52
+ export const blobUrlToBase64 = async (blobUrl) => {
53
+ const response = await fetch(blobUrl);
54
+ const blob = await response.blob();
55
+ return new Promise((resolve, reject) => {
56
+ const reader = new FileReader();
57
+ reader.onloadend = () => {
58
+ if (typeof reader.result === 'string') {
59
+ resolve(reader.result);
60
+ }
61
+ else {
62
+ reject(new Error('Failed to convert Blob to base64'));
63
+ }
64
+ };
65
+ reader.onerror = reject;
66
+ reader.readAsDataURL(blob);
67
+ });
68
+ };
69
+ export const randomId = () => Math.random().toString(36).slice(2, 11);
70
+ export const fileToBase64 = (file) => {
71
+ return new Promise((resolve, reject) => {
72
+ const reader = new FileReader();
73
+ reader.onloadend = () => {
74
+ if (typeof reader.result === 'string') {
75
+ resolve(reader.result);
76
+ }
77
+ else {
78
+ reject(new Error('Failed to convert File to base64'));
79
+ }
80
+ };
81
+ reader.onerror = reject;
82
+ reader.readAsDataURL(file);
83
+ });
84
+ };
85
+ const validateFileOrBase64 = (input, options, originalFile, validFiles, errors) => {
86
+ const { isValidType, isValidSize } = checkTypeAndSize(input, options);
87
+ if (isValidType && isValidSize) {
88
+ validFiles.push(originalFile);
89
+ }
90
+ else {
91
+ if (!isValidType)
92
+ errors.push({ file: input, reason: 'type' });
93
+ if (!isValidSize)
94
+ errors.push({ file: input, reason: 'size' });
95
+ }
96
+ };
97
+ const checkTypeAndSize = (input, { allowedMimeTypes, maxFileSize }) => {
98
+ const mimeType = input instanceof File ? input.type : base64MimeType(input);
99
+ const size = input instanceof File ? input.size : atob(input.split(',')[1]).length;
100
+ const isValidType = allowedMimeTypes.length === 0 ||
101
+ allowedMimeTypes.includes(mimeType) ||
102
+ allowedMimeTypes.includes(`${mimeType.split('/')[0]}/*`);
103
+ const isValidSize = !maxFileSize || size <= maxFileSize;
104
+ return { isValidType, isValidSize };
105
+ };
106
+ const base64MimeType = (encoded) => {
107
+ const result = encoded.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);
108
+ return result && result.length > 1 ? result[1] : 'unknown';
109
+ };
110
+ const isBase64 = (str) => {
111
+ if (str.startsWith('data:')) {
112
+ const matches = str.match(/^data:[^;]+;base64,(.+)$/);
113
+ if (matches && matches[1]) {
114
+ str = matches[1];
115
+ }
116
+ else {
117
+ return false;
118
+ }
119
+ }
120
+ try {
121
+ return btoa(atob(str)) === str;
122
+ }
123
+ catch {
124
+ return false;
125
+ }
126
+ };
127
+ export const filterFiles = (files, options) => {
128
+ const validFiles = [];
129
+ const errors = [];
130
+ files.forEach(file => {
131
+ const actualFile = 'src' in file ? file.src : file;
132
+ if (actualFile instanceof File) {
133
+ validateFileOrBase64(actualFile, options, file, validFiles, errors);
134
+ }
135
+ else if (typeof actualFile === 'string') {
136
+ if (isBase64(actualFile)) {
137
+ if (options.allowBase64) {
138
+ validateFileOrBase64(actualFile, options, file, validFiles, errors);
139
+ }
140
+ else {
141
+ errors.push({ file: actualFile, reason: 'base64NotAllowed' });
142
+ }
143
+ }
144
+ else {
145
+ if (!sanitizeUrl(actualFile, { allowBase64: options.allowBase64 })) {
146
+ errors.push({ file: actualFile, reason: 'invalidBase64' });
147
+ }
148
+ else {
149
+ validFiles.push(file);
150
+ }
151
+ }
152
+ }
153
+ });
154
+ return [validFiles, errors];
155
+ };
156
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/minimal-tiptap/utils.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAY,EAAE,CAAC,OAAO,MAAM,KAAK,WAAW,CAAA;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;AAClD,MAAM,CAAC,MAAM,OAAO,GAAG,GAAY,EAAE,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAA;AAE5F,MAAM,cAAc,GAAsC;IACxD,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE;IAC/F,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;IACzF,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE;CAC1C,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAqB,EAAE,CAC/D,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;AAErE,MAAM,CAA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C,EAAE,CAAC;gBACzB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;oBACxB,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;gBACrE,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAA;gBAC/D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;oBACnE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAA;gBAC5D,CAAC;qBAAM,CAAC;oBACN,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AAC7B,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '../../components/ui/button';
3
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '../../components/ui/dialog';
4
+ export const ActionDialog = ({ title, description, confirmLabel, confirmVariant = 'default', isOpen, onClose, onConfirm, }) => (_jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: 'outline', onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: confirmVariant, onClick: () => {
5
+ onConfirm();
6
+ onClose();
7
+ }, children: confirmLabel })] })] }) }));
8
+ //# sourceMappingURL=GroupActionDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupActionDialog.js","sourceRoot":"","sources":["../../../src/components/table/GroupActionDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAY/B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,cAAc,GAAG,SAAS,EAC1B,MAAM,EACN,OAAO,EACP,SAAS,GACS,EAAE,EAAE,CAAC,CACvB,KAAC,MAAM,IAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,YACzC,MAAC,aAAa,eACZ,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,KAAK,GAAe,EAClC,KAAC,iBAAiB,cAAE,WAAW,GAAqB,IACvC,EACf,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,uBAEjC,EACT,KAAC,MAAM,IACL,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,GAAG,EAAE;4BACZ,SAAS,EAAE,CAAA;4BACX,OAAO,EAAE,CAAA;wBACX,CAAC,YAEA,YAAY,GACN,IACI,IACD,GACT,CACV,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';
3
+ import { Button } from '../../components/ui/button';
4
+ export const SortableHeader = ({ column, title }) => {
5
+ return (_jsxs(Button, { variant: 'ghost', onClick: () => column.toggleSorting(column.getIsSorted() === 'asc'), children: [title, column.getIsSorted() === 'asc' ? (_jsx(ArrowUp, { className: 'ml-2 h-4 w-4' })) : column.getIsSorted() === 'desc' ? (_jsx(ArrowDown, { className: 'ml-2 h-4 w-4' })) : (_jsx(ArrowUpDown, { className: 'ml-2 h-4 w-4' }))] }));
6
+ };
7
+ //# sourceMappingURL=SortableHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SortableHeader.js","sourceRoot":"","sources":["../../../src/components/table/SortableHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAkC,EAAE,EAAE;IAClF,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,aACxF,KAAK,EACL,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAChC,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,GAAG,CACrC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,CACpC,KAAC,SAAS,IAAC,SAAS,EAAC,cAAc,GAAG,CACvC,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IAAC,SAAS,EAAC,cAAc,GAAG,CACzC,IACM,CACV,CAAA;AACH,CAAC,CAAA"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
4
4
  import { ChevronDown } from "lucide-react";
5
- import { cn } from "@/lib/utils";
5
+ import { cn } from "../../lib/utils";
6
6
  const Accordion = AccordionPrimitive.Root;
7
7
  const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (_jsx(AccordionPrimitive.Item, { ref: ref, className: cn("border-b", className), ...props })));
8
8
  AccordionItem.displayName = "AccordionItem";
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
4
- import { cn } from "@/lib/utils";
5
- import { buttonVariants } from "@/components/ui/button";
4
+ import { cn } from "../../lib/utils";
5
+ import { buttonVariants } from "../../components/ui/button";
6
6
  const AlertDialog = AlertDialogPrimitive.Root;
7
7
  const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
8
8
  const AlertDialogPortal = AlertDialogPrimitive.Portal;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { cva } from 'class-variance-authority';
4
- import { cn } from '@/lib/utils';
4
+ import { cn } from '../../lib/utils';
5
5
  const alertVariants = cva('relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground', {
6
6
  variants: {
7
7
  variant: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
4
- import { cn } from '@/lib/utils';
4
+ import { cn } from '../../lib/utils';
5
5
  const Avatar = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Root, { ref: ref, className: cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className), ...props })));
6
6
  Avatar.displayName = AvatarPrimitive.Root.displayName;
7
7
  const AvatarImage = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Image, { ref: ref, className: cn('aspect-square h-full w-full', className), ...props })));
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cva } from 'class-variance-authority';
3
- import { cn } from '@/lib/utils';
3
+ import { cn } from '../../lib/utils';
4
4
  const badgeVariants = cva('inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', {
5
5
  variants: {
6
6
  variant: {
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { ChevronRight, MoreHorizontal } from 'lucide-react';
5
- import { cn } from '@/lib/utils';
5
+ import { cn } from '../../lib/utils';
6
6
  const Breadcrumb = React.forwardRef(({ ...props }, ref) => _jsx("nav", { ref: ref, "aria-label": 'breadcrumb', ...props }));
7
7
  Breadcrumb.displayName = 'Breadcrumb';
8
8
  const BreadcrumbList = React.forwardRef(({ className, ...props }, ref) => (_jsx("ol", { ref: ref, className: cn('flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5', className), ...props })));
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { cva } from 'class-variance-authority';
5
- import { cn } from '@/lib/utils';
5
+ import { cn } from '../../lib/utils';
6
6
  const buttonVariants = cva('inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', {
7
7
  variants: {
8
8
  variant: {
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ChevronLeft, ChevronRight } from "lucide-react";
3
3
  import { DayPicker } from "react-day-picker";
4
- import { cn } from "@/lib/utils";
5
- import { buttonVariants } from "@/components/ui/button";
4
+ import { cn } from "../../lib/utils";
5
+ import { buttonVariants } from "../../components/ui/button";
6
6
  function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
7
7
  return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn("p-3", className), classNames: {
8
8
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { cn } from '@/lib/utils';
3
+ import { cn } from '../../lib/utils';
4
4
  const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('rounded-lg border bg-card text-card-foreground shadow-sm', className), ...props })));
5
5
  Card.displayName = 'Card';
6
6
  const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('flex flex-col space-y-1.5 p-6', className), ...props })));
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as RechartsPrimitive from "recharts";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../lib/utils";
5
5
  // Format: { THEME_NAME: CSS_SELECTOR }
6
6
  const THEMES = { light: "", dark: ".dark" };
7
7
  const ChartContext = React.createContext(null);