@collabchron/notiq 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +230 -39
  3. package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +15 -0
  4. package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +161 -0
  5. package/dist/EquationComponent-CB6DFIHV.mjs +154 -0
  6. package/dist/ExcalidrawComponent-XW6646OH.mjs +528 -0
  7. package/dist/ExcalidrawPlugin-ZFHT62IF.mjs +14 -0
  8. package/dist/ExportPlugin-V2RLM63S.mjs +11 -0
  9. package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +12 -0
  10. package/dist/FloatingTextFormatToolbarPlugin-F2GY6LMI.mjs +30 -0
  11. package/dist/HintComponet-BRL6EAMS.mjs +217 -0
  12. package/dist/InlineImageComponent-UWIUWBHI.mjs +453 -0
  13. package/dist/MobileToolbar-BOOZAMQE.mjs +268 -0
  14. package/dist/SlashCommand-GMT5JI33.mjs +28 -0
  15. package/dist/StoryBuilderComponent-JGDBM5JU.mjs +562 -0
  16. package/{src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx → dist/TableCellActionMenuPlugin-PGK2K3VG.mjs} +667 -759
  17. package/{src/components/editor/plugins/TableHoverActionsPlugin/index.tsx → dist/TableHoverActionsPlugin-GJVE6VRW.mjs} +258 -314
  18. package/dist/TemplatePlugin-ZD3QEVTI.mjs +9 -0
  19. package/dist/ToolbarPlugin-YKYA4NB4.mjs +1547 -0
  20. package/dist/babel-JZ2EV6AX.mjs +7233 -0
  21. package/dist/background-color-XZTYLGO2.mjs +362 -0
  22. package/dist/block-format-YJCV2DIY.mjs +15 -0
  23. package/dist/chunk-2FNEAMSP.mjs +127 -0
  24. package/dist/chunk-3CPBODXA.mjs +84 -0
  25. package/dist/chunk-3G37YKTV.mjs +83 -0
  26. package/dist/chunk-3JVFG7ER.mjs +184 -0
  27. package/dist/chunk-456TN7IM.mjs +110 -0
  28. package/dist/chunk-4EXYCTGJ.mjs +27 -0
  29. package/{src/utils/getSelectedNode.ts → dist/chunk-4HBCVSE6.mjs} +26 -27
  30. package/dist/chunk-4MEDW3T6.mjs +125 -0
  31. package/dist/chunk-4VWFVWYP.mjs +36 -0
  32. package/dist/chunk-5BAKY5KN.mjs +84 -0
  33. package/dist/chunk-5QSNIVIG.mjs +333 -0
  34. package/dist/chunk-64Z3FI7T.mjs +37 -0
  35. package/{src/components/editor/nodes/Stepper/index.tsx → dist/chunk-6RNZQOH2.mjs} +214 -260
  36. package/dist/chunk-77KXU36M.mjs +64 -0
  37. package/dist/chunk-77UA6HYR.mjs +165 -0
  38. package/dist/chunk-7NZAPJ4G.mjs +102 -0
  39. package/dist/chunk-7VUMHWWL.mjs +152 -0
  40. package/dist/chunk-AMMKBSST.mjs +1256 -0
  41. package/dist/chunk-BIU7WTLX.mjs +95 -0
  42. package/dist/chunk-EGMI62PP.mjs +83 -0
  43. package/dist/chunk-EHNQD5KO.mjs +88 -0
  44. package/dist/chunk-FSM26655.mjs +37 -0
  45. package/{src/components/editor/nodes/Hint/index.tsx → dist/chunk-G53GLEAY.mjs} +158 -190
  46. package/dist/chunk-GK35L7UY.mjs +28 -0
  47. package/dist/chunk-GXYD4VZM.mjs +193 -0
  48. package/dist/chunk-GYIOYVCN.mjs +538 -0
  49. package/dist/chunk-GZPNVR7L.mjs +157 -0
  50. package/dist/chunk-JXDPPUJI.mjs +52 -0
  51. package/dist/chunk-K36V4SIW.mjs +141 -0
  52. package/dist/chunk-KJ6AJ44Q.mjs +128 -0
  53. package/dist/chunk-KJV3FAZ7.mjs +142 -0
  54. package/{src/components/editor/plugins/ImagesPlugin/index.tsx → dist/chunk-LGG4IUIA.mjs} +189 -222
  55. package/dist/chunk-LQN3CMKV.mjs +1906 -0
  56. package/dist/chunk-N3WN46VL.mjs +236 -0
  57. package/dist/chunk-PBD6LMLC.mjs +366 -0
  58. package/dist/chunk-POGRR73N.mjs +33 -0
  59. package/{src/components/editor/utils/editorFormatting.ts → dist/chunk-PZSUSXQG.mjs} +238 -282
  60. package/dist/chunk-QEIFVK5M.mjs +29 -0
  61. package/dist/chunk-QHIQKMVN.mjs +427 -0
  62. package/dist/chunk-TCYK7DM7.mjs +36 -0
  63. package/dist/chunk-TTHQCW5F.mjs +47 -0
  64. package/dist/chunk-U47ABU5Z.mjs +53 -0
  65. package/dist/chunk-WDG7J2DY.mjs +116 -0
  66. package/dist/chunk-WJRHXI2C.mjs +733 -0
  67. package/dist/chunk-XLER2DHM.mjs +357 -0
  68. package/dist/chunk-XWC4TK2N.mjs +315 -0
  69. package/dist/chunk-YHPNOWFH.mjs +15 -0
  70. package/dist/chunk-YKC3SO4Z.mjs +32 -0
  71. package/dist/chunk-YMBXLRW5.mjs +374 -0
  72. package/dist/chunk-YPHOEJ46.mjs +64 -0
  73. package/dist/chunk-YUDCJRJM.mjs +25 -0
  74. package/dist/chunk-Z4EWP7BI.mjs +65 -0
  75. package/dist/chunk-ZB5LZQKC.mjs +191 -0
  76. package/dist/chunk-ZJRKATOJ.mjs +65 -0
  77. package/dist/color-BPKOPQKN.mjs +12 -0
  78. package/dist/estree-XC56IUFX.mjs +4414 -0
  79. package/dist/font-FEZ3GKSF.mjs +13 -0
  80. package/dist/font-size-EK775WRH.mjs +15 -0
  81. package/dist/html-S3ACX7NI.mjs +2738 -0
  82. package/dist/image-2PJIAYAT.mjs +993 -0
  83. package/dist/index.d.mts +145 -0
  84. package/dist/index.d.ts +145 -0
  85. package/dist/index.js +57855 -0
  86. package/dist/index.mjs +1790 -0
  87. package/dist/insert-gif-SAIDYURE.mjs +100 -0
  88. package/dist/insert-image-U3RJN3OW.mjs +259 -0
  89. package/dist/insert-node-5P2CRJ7S.mjs +201 -0
  90. package/dist/insert-poll-HCPM7MO6.mjs +33 -0
  91. package/dist/insert-table-24XYUS2W.mjs +66 -0
  92. package/dist/markdown-SNVBOSRA.mjs +3487 -0
  93. package/dist/poll-component-2R4MDLHS.mjs +303 -0
  94. package/dist/postcss-ONF3VDIM.mjs +5051 -0
  95. package/dist/standalone-EOIALU3M.mjs +2373 -0
  96. package/dist/stepper-FSARL6X6.mjs +304 -0
  97. package/dist/styles/notiq.css +1149 -0
  98. package/dist/text-align-VLECWO4H.mjs +118 -0
  99. package/dist/text-format-BG5WOOPZ.mjs +16 -0
  100. package/dist/typescript-AMPI6OVS.mjs +13135 -0
  101. package/package.json +67 -11
  102. package/src/styles/notiq.css +1149 -0
  103. package/src/styles/tailwind-plugin.ts +134 -0
  104. package/components.json +0 -21
  105. package/eslint.config.mjs +0 -16
  106. package/next.config.ts +0 -12
  107. package/postcss.config.mjs +0 -5
  108. package/public/file.svg +0 -1
  109. package/public/globe.svg +0 -1
  110. package/public/images/icons/plus.svg +0 -10
  111. package/public/next.svg +0 -1
  112. package/public/vercel.svg +0 -1
  113. package/public/window.svg +0 -1
  114. package/src/app/actions.ts +0 -2
  115. package/src/app/api/ai/route.ts +0 -175
  116. package/src/app/api/edgestore/[...edgestore]/route.ts +0 -28
  117. package/src/app/favicon.ico +0 -0
  118. package/src/app/globals.css +0 -205
  119. package/src/app/layout.tsx +0 -38
  120. package/src/app/page.tsx +0 -12
  121. package/src/components/editor/Core.tsx +0 -220
  122. package/src/components/editor/hooks/instructions-messages.ts +0 -300
  123. package/src/components/editor/hooks/use-mobile.ts +0 -19
  124. package/src/components/editor/hooks/useReport.ts +0 -67
  125. package/src/components/editor/hooks/useResizeObservert.ts +0 -22
  126. package/src/components/editor/index.tsx +0 -39
  127. package/src/components/editor/lexical-on-change.tsx +0 -28
  128. package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +0 -92
  129. package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +0 -65
  130. package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +0 -105
  131. package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +0 -143
  132. package/src/components/editor/nodes/EquationNode/EquationNode.tsx +0 -170
  133. package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +0 -228
  134. package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +0 -137
  135. package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +0 -317
  136. package/src/components/editor/nodes/ExcalidrawNode/index.tsx +0 -204
  137. package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +0 -134
  138. package/src/components/editor/nodes/Hint/HintComponet.tsx +0 -221
  139. package/src/components/editor/nodes/ImageNode/index.tsx +0 -328
  140. package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +0 -383
  141. package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +0 -94
  142. package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +0 -309
  143. package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +0 -146
  144. package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +0 -79
  145. package/src/components/editor/nodes/PollNode/index.tsx +0 -204
  146. package/src/components/editor/nodes/TweetNode/index.tsx +0 -214
  147. package/src/components/editor/nodes/index.ts +0 -81
  148. package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +0 -350
  149. package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +0 -56
  150. package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +0 -70
  151. package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +0 -192
  152. package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +0 -217
  153. package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +0 -26
  154. package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +0 -21
  155. package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +0 -76
  156. package/src/components/editor/plugins/CollapsiblePlugin/index.ts +0 -228
  157. package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +0 -44
  158. package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +0 -52
  159. package/src/components/editor/plugins/EquationsPlugin/index.tsx +0 -85
  160. package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +0 -98
  161. package/src/components/editor/plugins/FigmaPlugin/index.tsx +0 -42
  162. package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +0 -445
  163. package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +0 -275
  164. package/src/components/editor/plugins/InlineImagePlugin/index.tsx +0 -351
  165. package/src/components/editor/plugins/LayoutPlugin/index.tsx +0 -238
  166. package/src/components/editor/plugins/LinkPlugin/index.tsx +0 -36
  167. package/src/components/editor/plugins/LinkWithMetaData/index.tsx +0 -271
  168. package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -11
  169. package/src/components/editor/plugins/MarkdownTransformers/index.tsx +0 -304
  170. package/src/components/editor/plugins/PollPlugin/index.tsx +0 -49
  171. package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +0 -180
  172. package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +0 -253
  173. package/src/components/editor/plugins/SlashCommand/index.tsx +0 -621
  174. package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +0 -127
  175. package/src/components/editor/plugins/TabFocusPlugin/index.ts +0 -58
  176. package/src/components/editor/plugins/TableCellResizer/index.tsx +0 -438
  177. package/src/components/editor/plugins/TablePlugin/index.tsx +0 -99
  178. package/src/components/editor/plugins/ToolbarPlugin/index.tsx +0 -522
  179. package/src/components/editor/plugins/TwitterPlugin/index.ts +0 -35
  180. package/src/components/editor/plugins/YouTubeNode/index.tsx +0 -179
  181. package/src/components/editor/plugins/YouTubePlugin/index.ts +0 -41
  182. package/src/components/editor/themes/editor-theme.ts +0 -113
  183. package/src/components/editor/themes/theme.css +0 -377
  184. package/src/components/editor/utils/ai.ts +0 -291
  185. package/src/components/editor/utils/canUseDOM.ts +0 -12
  186. package/src/components/editor/utils/environment.ts +0 -50
  187. package/src/components/editor/utils/extract-data.ts +0 -166
  188. package/src/components/editor/utils/getAllLexicalChildren.ts +0 -13
  189. package/src/components/editor/utils/getDOMRangeRect.ts +0 -27
  190. package/src/components/editor/utils/getSelectedNode.ts +0 -27
  191. package/src/components/editor/utils/gif.ts +0 -29
  192. package/src/components/editor/utils/invariant.ts +0 -15
  193. package/src/components/editor/utils/setFloatingElemPosition.ts +0 -51
  194. package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +0 -40
  195. package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +0 -51
  196. package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +0 -15
  197. package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +0 -114
  198. package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +0 -6
  199. package/src/components/editor/utils/url.ts +0 -109
  200. package/src/components/editor/utils/useLayoutEffect.ts +0 -13
  201. package/src/components/providers/QueryProvider.tsx +0 -15
  202. package/src/components/providers/SharedHistoryContext.tsx +0 -28
  203. package/src/components/providers/ToolbarContext.tsx +0 -123
  204. package/src/components/providers/theme-provider.tsx +0 -11
  205. package/src/components/theme/ModeToggle.tsx +0 -40
  206. package/src/components/ui/FileInput.tsx +0 -40
  207. package/src/components/ui/Input.css +0 -32
  208. package/src/components/ui/Select.css +0 -42
  209. package/src/components/ui/Select.tsx +0 -36
  210. package/src/components/ui/TextInput.tsx +0 -48
  211. package/src/components/ui/ai/ai-button.tsx +0 -574
  212. package/src/components/ui/ai/border.tsx +0 -99
  213. package/src/components/ui/ai/placeholder-input-vanish.tsx +0 -282
  214. package/src/components/ui/button.tsx +0 -89
  215. package/src/components/ui/card.tsx +0 -76
  216. package/src/components/ui/checkbox.tsx +0 -30
  217. package/src/components/ui/command.tsx +0 -153
  218. package/src/components/ui/dialog/Dialog.css +0 -25
  219. package/src/components/ui/dialog/Dialog.tsx +0 -34
  220. package/src/components/ui/dialog.tsx +0 -122
  221. package/src/components/ui/drop-downs/background-color.tsx +0 -183
  222. package/src/components/ui/drop-downs/block-format.tsx +0 -159
  223. package/src/components/ui/drop-downs/code.tsx +0 -42
  224. package/src/components/ui/drop-downs/color.tsx +0 -177
  225. package/src/components/ui/drop-downs/font-size.tsx +0 -138
  226. package/src/components/ui/drop-downs/font.tsx +0 -155
  227. package/src/components/ui/drop-downs/index.tsx +0 -122
  228. package/src/components/ui/drop-downs/insert-node.tsx +0 -213
  229. package/src/components/ui/drop-downs/text-align.tsx +0 -123
  230. package/src/components/ui/drop-downs/text-format.tsx +0 -104
  231. package/src/components/ui/dropdown-menu.tsx +0 -201
  232. package/src/components/ui/equation/EquationEditor.css +0 -38
  233. package/src/components/ui/equation/EquationEditor.tsx +0 -56
  234. package/src/components/ui/equation/KatexEquationAlterer.css +0 -41
  235. package/src/components/ui/equation/KatexEquationAlterer.tsx +0 -83
  236. package/src/components/ui/equation/KatexRenderer.tsx +0 -66
  237. package/src/components/ui/excalidraw/ExcalidrawModal.css +0 -64
  238. package/src/components/ui/excalidraw/ExcalidrawModal.tsx +0 -234
  239. package/src/components/ui/excalidraw/Modal.css +0 -62
  240. package/src/components/ui/excalidraw/Modal.tsx +0 -110
  241. package/src/components/ui/hover-card.tsx +0 -29
  242. package/src/components/ui/image/error-image.tsx +0 -17
  243. package/src/components/ui/image/file-upload.tsx +0 -240
  244. package/src/components/ui/image/image-resizer.tsx +0 -297
  245. package/src/components/ui/image/image-toolbar.tsx +0 -264
  246. package/src/components/ui/image/index.tsx +0 -408
  247. package/src/components/ui/image/lazy-image.tsx +0 -68
  248. package/src/components/ui/image/lazy-video.tsx +0 -71
  249. package/src/components/ui/input.tsx +0 -22
  250. package/src/components/ui/models/custom-dialog.tsx +0 -320
  251. package/src/components/ui/models/insert-gif.tsx +0 -90
  252. package/src/components/ui/models/insert-image.tsx +0 -52
  253. package/src/components/ui/models/insert-poll.tsx +0 -29
  254. package/src/components/ui/models/insert-table.tsx +0 -62
  255. package/src/components/ui/models/use-model.tsx +0 -91
  256. package/src/components/ui/poll/poll-component.tsx +0 -304
  257. package/src/components/ui/popover.tsx +0 -33
  258. package/src/components/ui/progress.tsx +0 -28
  259. package/src/components/ui/scroll-area.tsx +0 -48
  260. package/src/components/ui/separator.tsx +0 -31
  261. package/src/components/ui/skeleton.tsx +0 -15
  262. package/src/components/ui/sonner.tsx +0 -31
  263. package/src/components/ui/stepper/step.tsx +0 -179
  264. package/src/components/ui/stepper/stepper.tsx +0 -89
  265. package/src/components/ui/textarea.tsx +0 -22
  266. package/src/components/ui/toggle.tsx +0 -71
  267. package/src/components/ui/tooltip.tsx +0 -32
  268. package/src/components/ui/write/text-format-floting-toolbar.tsx +0 -346
  269. package/src/lib/edgestore.ts +0 -9
  270. package/src/lib/pinecone-client.ts +0 -0
  271. package/src/lib/utils.ts +0 -6
  272. package/src/utils/docSerialization.ts +0 -77
  273. package/src/utils/emoji-list.ts +0 -16615
  274. package/src/utils/getDOMRangeRect.ts +0 -27
  275. package/src/utils/getThemeSelector.ts +0 -25
  276. package/src/utils/isMobileWidth.ts +0 -7
  277. package/src/utils/joinClasses.ts +0 -13
  278. package/src/utils/setFloatingElemPosition.ts +0 -74
  279. package/src/utils/setFloatingElemPositionForLinkEditor.ts +0 -46
  280. package/src/utils/swipe.ts +0 -127
  281. package/src/utils/url.ts +0 -38
  282. package/tsconfig.json +0 -27
@@ -0,0 +1,100 @@
1
+ import {
2
+ Skeleton
3
+ } from "./chunk-QEIFVK5M.mjs";
4
+ import {
5
+ Input
6
+ } from "./chunk-POGRR73N.mjs";
7
+ import {
8
+ Button
9
+ } from "./chunk-BIU7WTLX.mjs";
10
+ import "./chunk-YHPNOWFH.mjs";
11
+ import {
12
+ init_react_shim
13
+ } from "./chunk-77KXU36M.mjs";
14
+
15
+ // src/components/ui/models/insert-gif.tsx
16
+ init_react_shim();
17
+ import React2, { useState, useEffect } from "react";
18
+ import { useQuery } from "@tanstack/react-query";
19
+
20
+ // src/components/editor/utils/gif.ts
21
+ init_react_shim();
22
+ var API_KEY = process.env.NEXT_PUBLIC_TENOR_API_KEY;
23
+ var fetchGifs = async ({ q = "trending" }) => {
24
+ const params = new URLSearchParams({
25
+ key: API_KEY || "",
26
+ q,
27
+ limit: "200",
28
+ media_filter: "minimal"
29
+ });
30
+ const response = await fetch(`https://tenor.googleapis.com/v2/search?${params.toString()}`);
31
+ if (!response.ok) {
32
+ throw new Error(`HTTP error! Status: ${response.status}`);
33
+ }
34
+ const data = await response.json();
35
+ const gifs = data.results.map((gif) => ({
36
+ id: gif.id,
37
+ url: gif.media_formats.gif.url,
38
+ alt_text: gif.content_description
39
+ }));
40
+ return { gifs, next: data.next };
41
+ };
42
+ var gif_default = fetchGifs;
43
+
44
+ // src/components/ui/models/insert-gif.tsx
45
+ import { Search, X } from "lucide-react";
46
+ function InsertGif({ insertGifOnClick, onClose }) {
47
+ const [search, setSearch] = useState("");
48
+ const [debouncedSearch, setDebouncedSearch] = useState("");
49
+ useEffect(() => {
50
+ const handler = setTimeout(() => {
51
+ setDebouncedSearch(search);
52
+ }, 500);
53
+ return () => clearTimeout(handler);
54
+ }, [search]);
55
+ const { data: gifs, isPending } = useQuery({
56
+ queryKey: ["gifs", debouncedSearch],
57
+ queryFn: async () => {
58
+ const { gifs: gifs2 } = await gif_default({ q: debouncedSearch || "trending" });
59
+ return gifs2;
60
+ }
61
+ });
62
+ return /* @__PURE__ */ React2.createElement("div", { className: "flex flex-col space-y-1" }, /* @__PURE__ */ React2.createElement("form", { onSubmit: (e) => e.preventDefault(), className: "relative mb-3" }, /* @__PURE__ */ React2.createElement(
63
+ Button,
64
+ {
65
+ type: "submit",
66
+ className: "absolute text-gray-500 left-1 top-[50%] -translate-y-1/2",
67
+ variant: "ghost",
68
+ size: "sm"
69
+ },
70
+ /* @__PURE__ */ React2.createElement(Search, { className: "w-4 h-4" })
71
+ ), /* @__PURE__ */ React2.createElement(
72
+ Input,
73
+ {
74
+ onChange: (e) => setSearch(e.target.value),
75
+ value: search,
76
+ placeholder: "Search for GIFs",
77
+ className: "pl-9"
78
+ }
79
+ ), search && /* @__PURE__ */ React2.createElement(
80
+ X,
81
+ {
82
+ onClick: () => setSearch(""),
83
+ className: "w-4 h-4 absolute cursor-pointer transition-colors text-gray-500 right-3 top-[50%] hover:text-white -translate-y-1/2"
84
+ }
85
+ )), /* @__PURE__ */ React2.createElement("div", { className: "grid grid-cols-3 gap-2" }, isPending && Array(9).fill(0).map((_, i) => /* @__PURE__ */ React2.createElement(Skeleton, { key: i, className: "rounded-md w-full h-full" })), !isPending && (gifs == null ? void 0 : gifs.map((gif) => /* @__PURE__ */ React2.createElement(
86
+ "button",
87
+ {
88
+ key: gif.id,
89
+ onClick: () => {
90
+ insertGifOnClick({ src: gif.url, altText: gif.alt_text });
91
+ onClose();
92
+ },
93
+ className: "w-full h-full"
94
+ },
95
+ /* @__PURE__ */ React2.createElement("img", { src: gif.url, alt: gif.alt_text, className: "rounded-md w-full h-full" })
96
+ ))), !isPending && (gifs == null ? void 0 : gifs.length) === 0 && /* @__PURE__ */ React2.createElement("p", { className: "text-center text-gray-500" }, "No GIFs found")));
97
+ }
98
+ export {
99
+ InsertGif as default
100
+ };
@@ -0,0 +1,259 @@
1
+ import {
2
+ Progress,
3
+ useUpload
4
+ } from "./chunk-JXDPPUJI.mjs";
5
+ import {
6
+ INSERT_IMAGE_COMMAND
7
+ } from "./chunk-LGG4IUIA.mjs";
8
+ import "./chunk-N3WN46VL.mjs";
9
+ import {
10
+ Card,
11
+ CardContent
12
+ } from "./chunk-3G37YKTV.mjs";
13
+ import {
14
+ Button
15
+ } from "./chunk-BIU7WTLX.mjs";
16
+ import "./chunk-YHPNOWFH.mjs";
17
+ import {
18
+ React,
19
+ init_react_shim
20
+ } from "./chunk-77KXU36M.mjs";
21
+
22
+ // src/components/ui/models/insert-image.tsx
23
+ init_react_shim();
24
+ import { useEffect, useRef as useRef2 } from "react";
25
+
26
+ // src/components/ui/image/file-upload.tsx
27
+ init_react_shim();
28
+ import { useState, useRef } from "react";
29
+ import {
30
+ Upload,
31
+ Loader2,
32
+ X,
33
+ Image,
34
+ UploadCloudIcon,
35
+ Video
36
+ } from "lucide-react";
37
+ import { motion, AnimatePresence } from "framer-motion";
38
+
39
+ // src/lib/edgestore.ts
40
+ init_react_shim();
41
+ import { createEdgeStoreProvider } from "@edgestore/react";
42
+ var { EdgeStoreProvider, useEdgeStore } = createEdgeStoreProvider();
43
+
44
+ // src/components/ui/image/file-upload.tsx
45
+ var FileUploadZone = ({
46
+ InsertMedia
47
+ }) => {
48
+ const [draggedZone, setDraggedZone] = useState(null);
49
+ const [files, setFiles] = useState([]);
50
+ const [uploading, setUploading] = useState(false);
51
+ const [progress, setProgress] = useState(0);
52
+ const fileInputRef = useRef(null);
53
+ const { edgestore } = useEdgeStore();
54
+ const uploadConfig = useUpload();
55
+ const handleDragEnter = (index) => (e) => {
56
+ e.preventDefault();
57
+ setDraggedZone(index);
58
+ };
59
+ const handleDragLeave = (e) => {
60
+ e.preventDefault();
61
+ setDraggedZone(null);
62
+ };
63
+ const upload = async (newFiles) => {
64
+ setUploading(true);
65
+ setProgress(0);
66
+ let uploadedFiles = [];
67
+ for (let i = 0; i < newFiles.length; i++) {
68
+ const file = newFiles[i];
69
+ try {
70
+ let url = "";
71
+ if (uploadConfig == null ? void 0 : uploadConfig.uploadHandler) {
72
+ const res = await uploadConfig.uploadHandler(file, (p) => {
73
+ setProgress(
74
+ Math.round(p / 100 * ((i + 1) / newFiles.length) * 100)
75
+ );
76
+ });
77
+ url = res.url;
78
+ } else {
79
+ const response = await edgestore.publicFiles.upload({
80
+ file,
81
+ onProgressChange: (progress2) => {
82
+ setProgress(
83
+ Math.round(progress2 / 100 * ((i + 1) / newFiles.length) * 100)
84
+ );
85
+ }
86
+ });
87
+ url = response.url;
88
+ }
89
+ uploadedFiles.push({ url, alt: file.name });
90
+ } catch (error) {
91
+ console.error(`Error uploading ${file.name}:`, error);
92
+ }
93
+ }
94
+ setFiles((prevFiles) => [...prevFiles, ...uploadedFiles]);
95
+ setUploading(false);
96
+ setProgress(100);
97
+ };
98
+ const handleDrop = () => async (e) => {
99
+ e.preventDefault();
100
+ setDraggedZone(null);
101
+ const droppedFiles = Array.from(e.dataTransfer.files);
102
+ if (droppedFiles.length > 0) {
103
+ await upload(droppedFiles);
104
+ }
105
+ };
106
+ const handleFileSelect = async (e) => {
107
+ const selectedFiles = Array.from(e.target.files || []);
108
+ if (selectedFiles.length > 0) {
109
+ await upload(selectedFiles);
110
+ }
111
+ };
112
+ const removeFile = (index) => {
113
+ setFiles((prevFiles) => prevFiles.filter((_, i) => i !== index));
114
+ };
115
+ const zones = [
116
+ {
117
+ title: "Upload Images",
118
+ subtitle: "Drop images here",
119
+ icon: Image,
120
+ gradient: "from-purple-400 via-pink-500 to-red-500",
121
+ rotate: "-rotate-2"
122
+ },
123
+ {
124
+ title: "Upload Videos",
125
+ subtitle: "Drop videos here",
126
+ icon: Video,
127
+ gradient: "from-blue-400 via-teal-500 to-green-500",
128
+ rotate: ""
129
+ },
130
+ {
131
+ title: "Upload Files",
132
+ subtitle: "Drop files here",
133
+ icon: UploadCloudIcon,
134
+ gradient: "from-yellow-400 via-orange-500 to-red-500",
135
+ rotate: "rotate-3"
136
+ }
137
+ ];
138
+ return /* @__PURE__ */ React.createElement(Card, { className: "mx-auto w-full bg-transparent border-none max-w-[300px] lg:max-w-[500px] overflow-hidden rounded-[1rem]" }, /* @__PURE__ */ React.createElement(CardContent, { className: "p-6 py-7 cursor:pointer" }, /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-4 mb-6" }, zones.map((zone, index) => /* @__PURE__ */ React.createElement("div", { key: index, className: `relative ${zone.rotate}` }, /* @__PURE__ */ React.createElement(
139
+ motion.div,
140
+ {
141
+ onDragEnter: handleDragEnter(index),
142
+ onDragOver: (e) => e.preventDefault(),
143
+ onDragLeave: handleDragLeave,
144
+ onDrop: handleDrop,
145
+ whileHover: { y: -4, scale: 1.02 },
146
+ whileTap: { scale: 0.98 },
147
+ className: "group relative h-full"
148
+ },
149
+ /* @__PURE__ */ React.createElement(
150
+ "div",
151
+ {
152
+ className: `
153
+ absolute inset-0 -z-10 rounded-xl bg-gradient-to-br ${zone.gradient}
154
+ opacity-0 blur-md transition-opacity duration-300
155
+ ${draggedZone === index ? "opacity-70" : "group-hover:opacity-70"}
156
+ `
157
+ }
158
+ ),
159
+ /* @__PURE__ */ React.createElement(Card, { className: "relative h-full rounded-[1rem] overflow-hidden border-2 border-dashed border-gray-200 dark:border-gray-800 transition-colors duration-300 group-hover:border-transparent" }, /* @__PURE__ */ React.createElement(CardContent, { className: "flex h-full flex-col items-center justify-center p-6 text-center" }, /* @__PURE__ */ React.createElement(
160
+ motion.div,
161
+ {
162
+ whileHover: { scale: 1.1, rotate: 10 },
163
+ className: "rounded-full bg-gray-100 dark:bg-gray-800 p-3 mb-4"
164
+ },
165
+ /* @__PURE__ */ React.createElement(zone.icon, { className: "h-8 w-8 text-gray-500" })
166
+ ), /* @__PURE__ */ React.createElement("h3", { className: "mb-1 text-sm font-medium" }, zone.title), /* @__PURE__ */ React.createElement("p", { className: "text-xs text-gray-500" }, zone.subtitle)))
167
+ )))), (uploading || files.length > 0) && /* @__PURE__ */ React.createElement("div", { className: "mb-6" }, /* @__PURE__ */ React.createElement(Progress, { value: uploading ? progress : 100, className: "h-2 mb-2" }), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-500 mb-2" }, uploading ? `Uploading... ${progress}%` : `${files.length} file(s) uploaded`), /* @__PURE__ */ React.createElement(AnimatePresence, null, files.map((file, index) => /* @__PURE__ */ React.createElement(
168
+ motion.div,
169
+ {
170
+ key: `${file.alt}-${index}`,
171
+ initial: { opacity: 0, y: -10 },
172
+ animate: { opacity: 1, y: 0 },
173
+ exit: { opacity: 0, y: -10 },
174
+ className: "flex items-center justify-between bg-gray-100 dark:bg-gray-800 rounded-[1rem] p-2 mb-2"
175
+ },
176
+ /* @__PURE__ */ React.createElement("span", { className: "truncate max-w-[80%] text-sm text-gray-700 dark:text-gray-300 ml-2" }, file.alt),
177
+ /* @__PURE__ */ React.createElement(
178
+ Button,
179
+ {
180
+ variant: "ghost",
181
+ size: "icon",
182
+ onClick: () => removeFile(index),
183
+ className: "h-6 w-6 p-0 hover:bg-gray-200 dark:hover:bg-gray-700"
184
+ },
185
+ /* @__PURE__ */ React.createElement(X, { className: "h-4 w-4" })
186
+ )
187
+ )))), /* @__PURE__ */ React.createElement("div", { className: "text-center flex flex-col" }, /* @__PURE__ */ React.createElement(
188
+ "input",
189
+ {
190
+ type: "file",
191
+ ref: fileInputRef,
192
+ onChange: handleFileSelect,
193
+ className: "hidden",
194
+ multiple: true
195
+ }
196
+ ), /* @__PURE__ */ React.createElement(
197
+ Button,
198
+ {
199
+ onClick: () => {
200
+ var _a;
201
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
202
+ },
203
+ disabled: uploading,
204
+ className: "rounded-[1rem] mt-5"
205
+ },
206
+ uploading ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Uploading...") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Upload, { className: "mr-2 h-4 w-4" }), "Choose Files")
207
+ ), files.length > 0 && /* @__PURE__ */ React.createElement(
208
+ Button,
209
+ {
210
+ onClick: () => InsertMedia(files),
211
+ disabled: uploading,
212
+ className: "rounded-[1rem] mt-2"
213
+ },
214
+ "Insert the ",
215
+ files.length == 1 ? "image" : "images"
216
+ ))));
217
+ };
218
+ var file_upload_default = FileUploadZone;
219
+
220
+ // src/components/ui/models/insert-image.tsx
221
+ function InsertImageDialog({
222
+ activeEditor,
223
+ onClose
224
+ }) {
225
+ const hasModifier = useRef2(false);
226
+ useEffect(() => {
227
+ hasModifier.current = false;
228
+ const handler = (e) => {
229
+ hasModifier.current = e.altKey;
230
+ };
231
+ document.addEventListener("keydown", handler);
232
+ return () => {
233
+ document.removeEventListener("keydown", handler);
234
+ };
235
+ }, [activeEditor]);
236
+ const handleInsertImage = (payload) => {
237
+ activeEditor.dispatchCommand(INSERT_IMAGE_COMMAND, payload);
238
+ };
239
+ const InsertMedia = (files) => {
240
+ if (!files) {
241
+ return;
242
+ }
243
+ for (let index = 0; index < files.length; index++) {
244
+ console.log(files);
245
+ const payload = {
246
+ altText: files[index].alt || "image",
247
+ src: files[index].url
248
+ };
249
+ handleInsertImage(payload);
250
+ if (index === files.length - 1) {
251
+ onClose();
252
+ }
253
+ }
254
+ };
255
+ return /* @__PURE__ */ React.createElement(file_upload_default, { InsertMedia });
256
+ }
257
+ export {
258
+ InsertImageDialog
259
+ };
@@ -0,0 +1,201 @@
1
+ import {
2
+ INSERT_EXCALIDRAW_COMMAND
3
+ } from "./chunk-EHNQD5KO.mjs";
4
+ import {
5
+ DropDown
6
+ } from "./chunk-EGMI62PP.mjs";
7
+ import "./chunk-KJ6AJ44Q.mjs";
8
+ import "./chunk-64Z3FI7T.mjs";
9
+ import {
10
+ AutoEmbedDialog,
11
+ FigmaEmbedConfig,
12
+ INSERT_COLLAPSIBLE_COMMAND,
13
+ INSERT_LAYOUT_COMMAND,
14
+ TwitterEmbedConfig,
15
+ YoutubeEmbedConfig
16
+ } from "./chunk-AMMKBSST.mjs";
17
+ import {
18
+ useModal
19
+ } from "./chunk-5QSNIVIG.mjs";
20
+ import {
21
+ INSERT_IMAGE_COMMAND
22
+ } from "./chunk-LGG4IUIA.mjs";
23
+ import "./chunk-GXYD4VZM.mjs";
24
+ import "./chunk-N3WN46VL.mjs";
25
+ import {
26
+ Skeleton
27
+ } from "./chunk-QEIFVK5M.mjs";
28
+ import {
29
+ INSERT_HINT_COMMAND
30
+ } from "./chunk-G53GLEAY.mjs";
31
+ import "./chunk-XWC4TK2N.mjs";
32
+ import "./chunk-KJV3FAZ7.mjs";
33
+ import "./chunk-POGRR73N.mjs";
34
+ import "./chunk-WDG7J2DY.mjs";
35
+ import "./chunk-BIU7WTLX.mjs";
36
+ import "./chunk-YHPNOWFH.mjs";
37
+ import {
38
+ init_react_shim
39
+ } from "./chunk-77KXU36M.mjs";
40
+
41
+ // src/components/ui/drop-downs/insert-node.tsx
42
+ init_react_shim();
43
+ import React, { useMemo, lazy, Suspense } from "react";
44
+ import { AlertCircle, Columns2, Columns3, Columns4, DraftingCompassIcon, Figma, FlipHorizontal2, Image, ImagePlay, Plus, SquareChevronRight, SquarePenIcon, Table, Twitter, Youtube } from "lucide-react";
45
+ import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
46
+ var InsertImageDialog = lazy(() => import("./insert-image-U3RJN3OW.mjs").then((module) => ({ default: module.InsertImageDialog })));
47
+ var InsertGif = lazy(() => import("./insert-gif-SAIDYURE.mjs"));
48
+ var InsertTableBody = lazy(() => import("./insert-table-24XYUS2W.mjs").then((module) => ({ default: module.InsertTable })));
49
+ var InsertPoll = lazy(
50
+ () => import("./insert-poll-HCPM7MO6.mjs").then((module) => ({ default: module.InsertPoll }))
51
+ );
52
+ function InsertNode({
53
+ disabled,
54
+ editor
55
+ }) {
56
+ const [model, showModal] = useModal();
57
+ const insertGifOnClick = (payload) => {
58
+ editor.dispatchCommand(INSERT_IMAGE_COMMAND, payload);
59
+ };
60
+ const items = useMemo(
61
+ () => [
62
+ {
63
+ label: "Horizontal Rule",
64
+ icon: /* @__PURE__ */ React.createElement(FlipHorizontal2, { className: "w-4 h-4" }),
65
+ func: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0)
66
+ },
67
+ {
68
+ label: "Image",
69
+ icon: /* @__PURE__ */ React.createElement(Image, { className: "size-4" }),
70
+ func: () => {
71
+ showModal(
72
+ "Insert Image",
73
+ "Please select an image to upload.",
74
+ (onClose) => /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Skeleton, { className: "mx-2 w-[350px] h-[350px]" }) }, /* @__PURE__ */ React.createElement(InsertImageDialog, { activeEditor: editor, onClose })),
75
+ true
76
+ );
77
+ }
78
+ },
79
+ {
80
+ label: "GIF",
81
+ icon: /* @__PURE__ */ React.createElement(ImagePlay, { className: "w-4 h-4" }),
82
+ func: () => {
83
+ showModal(
84
+ "Insert GIF",
85
+ "Please select a GIF to upload.",
86
+ (onClose) => /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Skeleton, { className: "mx-2 w-[400px] h-[400px]" }) }, /* @__PURE__ */ React.createElement(InsertGif, { insertGifOnClick, onClose })),
87
+ true
88
+ );
89
+ }
90
+ },
91
+ {
92
+ label: "Table",
93
+ icon: /* @__PURE__ */ React.createElement(Table, { className: "w-4 h-4" }),
94
+ func: () => {
95
+ showModal(
96
+ "Insert Table",
97
+ "Please configure your table.",
98
+ (onClose) => /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Skeleton, { className: "mx-2 w-[400px] h-[100px]" }) }, /* @__PURE__ */ React.createElement(InsertTableBody, { activeEditor: editor, onClose })),
99
+ true
100
+ );
101
+ }
102
+ },
103
+ {
104
+ label: "ExcaliDraw",
105
+ icon: /* @__PURE__ */ React.createElement(DraftingCompassIcon, { className: "w-4 h-4" }),
106
+ func: () => {
107
+ editor.dispatchCommand(INSERT_EXCALIDRAW_COMMAND, void 0);
108
+ }
109
+ },
110
+ {
111
+ label: "Poll",
112
+ icon: /* @__PURE__ */ React.createElement(SquarePenIcon, { className: "w-4 h-4" }),
113
+ func: () => {
114
+ showModal(
115
+ "Create Poll",
116
+ "Please type your question.",
117
+ (onClose) => /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Skeleton, { className: "mx-2 w-[400px] h-[100px]" }) }, /* @__PURE__ */ React.createElement(InsertPoll, { activeEditor: editor, onClose })),
118
+ true
119
+ );
120
+ }
121
+ },
122
+ {
123
+ label: "2 columns (equal width)",
124
+ icon: /* @__PURE__ */ React.createElement(Columns2, { className: "w-4 h-4" }),
125
+ func: () => {
126
+ editor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 1fr");
127
+ }
128
+ },
129
+ {
130
+ label: "3 columns (equal width)",
131
+ icon: /* @__PURE__ */ React.createElement(Columns3, { className: "w-4 h-4" }),
132
+ func: () => {
133
+ editor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 1fr 1fr");
134
+ }
135
+ },
136
+ {
137
+ label: "4 columns (equal width)",
138
+ icon: /* @__PURE__ */ React.createElement(Columns4, { className: "w-4 h-4" }),
139
+ func: () => {
140
+ editor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 1fr 1fr 1fr");
141
+ }
142
+ },
143
+ {
144
+ label: "2 columns (25% - 75%)",
145
+ icon: /* @__PURE__ */ React.createElement(Columns2, { className: "w-4 h-4" }),
146
+ func: () => {
147
+ editor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 3fr");
148
+ }
149
+ },
150
+ {
151
+ label: "Collapsible container",
152
+ icon: /* @__PURE__ */ React.createElement(SquareChevronRight, { className: "w-4 h-4" }),
153
+ func: () => {
154
+ editor.dispatchCommand(INSERT_COLLAPSIBLE_COMMAND, void 0);
155
+ }
156
+ },
157
+ {
158
+ label: "Twitter",
159
+ icon: /* @__PURE__ */ React.createElement(Twitter, { className: "w-4 h-4" }),
160
+ func: () => {
161
+ showModal("Twitter tweet", "Insert a URL to embed a live preview. Works with Twitter, Google Drive, Vimeo, and more.", (onClose) => /* @__PURE__ */ React.createElement(AutoEmbedDialog, { embedConfig: TwitterEmbedConfig, onClose }), true);
162
+ }
163
+ },
164
+ {
165
+ label: "Youtube",
166
+ icon: /* @__PURE__ */ React.createElement(Youtube, null),
167
+ func: () => {
168
+ showModal("Youtube", "Insert a URL to embed a live preview. Works with YouTube, Google Drive, Vimeo, and more.", (onClose) => /* @__PURE__ */ React.createElement(AutoEmbedDialog, { embedConfig: YoutubeEmbedConfig, onClose }), true);
169
+ }
170
+ },
171
+ {
172
+ label: "Figma",
173
+ icon: /* @__PURE__ */ React.createElement(Figma, null),
174
+ func: () => {
175
+ showModal("Figma", "Insert a URL to embed a live preview. Works with Figma.", (onClose) => /* @__PURE__ */ React.createElement(AutoEmbedDialog, { embedConfig: FigmaEmbedConfig, onClose }), true);
176
+ }
177
+ },
178
+ {
179
+ label: "Hint",
180
+ icon: /* @__PURE__ */ React.createElement(AlertCircle, null),
181
+ func: () => {
182
+ editor.dispatchCommand(INSERT_HINT_COMMAND, "info");
183
+ }
184
+ }
185
+ ],
186
+ [editor, showModal]
187
+ );
188
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
189
+ DropDown,
190
+ {
191
+ values: items,
192
+ TriggerClassName: { width: "115px", border: "none" },
193
+ className: "cursor-pointer",
194
+ TriggerLabel: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Plus, null), /* @__PURE__ */ React.createElement("span", null, "Insert")),
195
+ disabled
196
+ }
197
+ ), model);
198
+ }
199
+ export {
200
+ InsertNode as default
201
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ INSERT_POLL_COMMAND
3
+ } from "./chunk-U47ABU5Z.mjs";
4
+ import "./chunk-GZPNVR7L.mjs";
5
+ import {
6
+ Input
7
+ } from "./chunk-POGRR73N.mjs";
8
+ import {
9
+ Button
10
+ } from "./chunk-BIU7WTLX.mjs";
11
+ import "./chunk-YHPNOWFH.mjs";
12
+ import {
13
+ React,
14
+ init_react_shim
15
+ } from "./chunk-77KXU36M.mjs";
16
+
17
+ // src/components/ui/models/insert-poll.tsx
18
+ init_react_shim();
19
+ import { useState } from "react";
20
+ function InsertPoll({
21
+ activeEditor,
22
+ onClose
23
+ }) {
24
+ const [question, setQuestion] = useState("");
25
+ const onClick = () => {
26
+ activeEditor.dispatchCommand(INSERT_POLL_COMMAND, question);
27
+ onClose();
28
+ };
29
+ return /* @__PURE__ */ React.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ React.createElement(Input, { placeholder: "Question?", onChange: (e) => setQuestion(e.target.value), value: question }), /* @__PURE__ */ React.createElement(Button, { disabled: question.trim() === "", onClick }, "Confirm"));
30
+ }
31
+ export {
32
+ InsertPoll
33
+ };
@@ -0,0 +1,66 @@
1
+ import {
2
+ Input
3
+ } from "./chunk-POGRR73N.mjs";
4
+ import {
5
+ Button
6
+ } from "./chunk-BIU7WTLX.mjs";
7
+ import "./chunk-YHPNOWFH.mjs";
8
+ import {
9
+ React,
10
+ init_react_shim
11
+ } from "./chunk-77KXU36M.mjs";
12
+
13
+ // src/components/ui/models/insert-table.tsx
14
+ init_react_shim();
15
+ import { INSERT_TABLE_COMMAND } from "@lexical/table";
16
+ import { useEffect, useState } from "react";
17
+ function InsertTable({
18
+ activeEditor,
19
+ onClose
20
+ }) {
21
+ const [rows, setRows] = useState("5");
22
+ const [columns, setColumns] = useState("5");
23
+ const [isDisabled, setIsDisabled] = useState(true);
24
+ useEffect(() => {
25
+ const row = Number(rows);
26
+ const column = Number(columns);
27
+ if (row && row > 0 && row <= 500 && column && column > 0 && column <= 50) {
28
+ setIsDisabled(false);
29
+ } else {
30
+ setIsDisabled(true);
31
+ }
32
+ }, [rows, columns]);
33
+ const onClick = () => {
34
+ activeEditor.dispatchCommand(INSERT_TABLE_COMMAND, {
35
+ columns,
36
+ rows
37
+ });
38
+ onClose();
39
+ };
40
+ return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-y-2 " }, /* @__PURE__ */ React.createElement(
41
+ Input,
42
+ {
43
+ placeholder: "# of rows (1-500)",
44
+ onChange: (e) => {
45
+ setRows(e.target.value);
46
+ },
47
+ value: rows,
48
+ "data-test-id": "table-modal-rows",
49
+ type: "number"
50
+ }
51
+ ), /* @__PURE__ */ React.createElement(
52
+ Input,
53
+ {
54
+ placeholder: "# of columns (1-50)",
55
+ onChange: (e) => {
56
+ setColumns(e.target.value);
57
+ },
58
+ value: columns,
59
+ "data-test-id": "table-modal-columns",
60
+ type: "number"
61
+ }
62
+ ), /* @__PURE__ */ React.createElement(Button, { className: "w-full", disabled: isDisabled, onClick }, "Confirm"));
63
+ }
64
+ export {
65
+ InsertTable
66
+ };