@maayan-albert/moab-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,665 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useRef, useState, useEffect, useCallback } from 'react';
3
+ import { Trash2, X } from 'lucide-react';
4
+ import html2canvas from 'html2canvas';
5
+
6
+ // src/components/Button.tsx
7
+ var Button = ({
8
+ children,
9
+ variant = "primary",
10
+ size = "medium",
11
+ disabled = false,
12
+ onClick,
13
+ className = "",
14
+ ...props
15
+ }) => {
16
+ const baseStyles = "font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2";
17
+ const variantStyles = {
18
+ primary: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
19
+ secondary: "bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",
20
+ outline: "border-2 border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500"
21
+ };
22
+ const sizeStyles = {
23
+ small: "px-3 py-1.5 text-sm",
24
+ medium: "px-4 py-2 text-base",
25
+ large: "px-6 py-3 text-lg"
26
+ };
27
+ const disabledStyles = disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
28
+ return /* @__PURE__ */ jsx(
29
+ "button",
30
+ {
31
+ className: `${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${disabledStyles} ${className}`,
32
+ disabled,
33
+ onClick,
34
+ ...props,
35
+ children
36
+ }
37
+ );
38
+ };
39
+ var Button_default = Button;
40
+ var Card = ({
41
+ children,
42
+ title,
43
+ className = "",
44
+ ...props
45
+ }) => {
46
+ return /* @__PURE__ */ jsxs(
47
+ "div",
48
+ {
49
+ className: `bg-white rounded-lg shadow-md p-6 border border-gray-200 ${className}`,
50
+ ...props,
51
+ children: [
52
+ title && /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold mb-4 text-gray-800", children: title }),
53
+ children
54
+ ]
55
+ }
56
+ );
57
+ };
58
+ var Card_default = Card;
59
+ var Input = ({
60
+ label,
61
+ type = "text",
62
+ placeholder,
63
+ value,
64
+ onChange,
65
+ required = false,
66
+ className = "",
67
+ ...props
68
+ }) => {
69
+ return /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
70
+ label && /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
71
+ label,
72
+ required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1", children: "*" })
73
+ ] }),
74
+ /* @__PURE__ */ jsx(
75
+ "input",
76
+ {
77
+ type,
78
+ placeholder,
79
+ value,
80
+ onChange,
81
+ required,
82
+ className: `w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${className}`,
83
+ ...props
84
+ }
85
+ )
86
+ ] });
87
+ };
88
+ var Input_default = Input;
89
+ var DrawingTool = ({
90
+ width,
91
+ height,
92
+ className = "",
93
+ overlay = true,
94
+ ...props
95
+ }) => {
96
+ const canvasRef = useRef(null);
97
+ const toolbarRef = useRef(null);
98
+ const [isDrawing, setIsDrawing] = useState(false);
99
+ const brushColor = "#EF4444";
100
+ const brushSize = 5;
101
+ const [canvasSize, setCanvasSize] = useState({ width: 0, height: 0 });
102
+ const [enabled, setEnabled] = useState(false);
103
+ const [hasContent, setHasContent] = useState(false);
104
+ const [isDragging, setIsDragging] = useState(false);
105
+ const [corner, setCorner] = useState("bottom-right");
106
+ const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
107
+ const [showClearTooltip, setShowClearTooltip] = useState(false);
108
+ useEffect(() => {
109
+ if (overlay) {
110
+ const updateSize = () => {
111
+ setCanvasSize({
112
+ width: window.innerWidth,
113
+ height: window.innerHeight
114
+ });
115
+ };
116
+ updateSize();
117
+ window.addEventListener("resize", updateSize);
118
+ return () => window.removeEventListener("resize", updateSize);
119
+ } else {
120
+ setCanvasSize({
121
+ width: width || 800,
122
+ height: height || 600
123
+ });
124
+ }
125
+ }, [overlay, width, height]);
126
+ useEffect(() => {
127
+ const canvas = canvasRef.current;
128
+ if (!canvas || canvasSize.width === 0 || canvasSize.height === 0) return;
129
+ const ctx = canvas.getContext("2d");
130
+ if (!ctx) return;
131
+ canvas.width = canvasSize.width;
132
+ canvas.height = canvasSize.height;
133
+ ctx.strokeStyle = brushColor;
134
+ ctx.lineWidth = brushSize;
135
+ ctx.lineCap = "round";
136
+ ctx.lineJoin = "round";
137
+ setHasContent(false);
138
+ }, [canvasSize, brushColor, brushSize]);
139
+ const getCoordinates = useCallback(
140
+ (e) => {
141
+ const canvas = canvasRef.current;
142
+ if (!canvas) return { x: 0, y: 0 };
143
+ const rect = canvas.getBoundingClientRect();
144
+ const scaleX = canvas.width / rect.width;
145
+ const scaleY = canvas.height / rect.height;
146
+ if ("touches" in e) {
147
+ return {
148
+ x: (e.touches[0].clientX - rect.left) * scaleX,
149
+ y: (e.touches[0].clientY - rect.top) * scaleY
150
+ };
151
+ } else {
152
+ return {
153
+ x: (e.clientX - rect.left) * scaleX,
154
+ y: (e.clientY - rect.top) * scaleY
155
+ };
156
+ }
157
+ },
158
+ []
159
+ );
160
+ const startDrawing = useCallback(
161
+ (e) => {
162
+ if (!enabled) return;
163
+ e.preventDefault();
164
+ const canvas = canvasRef.current;
165
+ const ctx = canvas?.getContext("2d");
166
+ if (!canvas || !ctx) return;
167
+ const { x, y } = getCoordinates(e);
168
+ ctx.beginPath();
169
+ ctx.moveTo(x, y);
170
+ setIsDrawing(true);
171
+ },
172
+ [enabled, getCoordinates]
173
+ );
174
+ const draw = useCallback(
175
+ (e) => {
176
+ if (!isDrawing) return;
177
+ e.preventDefault();
178
+ const canvas = canvasRef.current;
179
+ const ctx = canvas?.getContext("2d");
180
+ if (!canvas || !ctx) return;
181
+ const { x, y } = getCoordinates(e);
182
+ ctx.lineTo(x, y);
183
+ ctx.stroke();
184
+ setHasContent(true);
185
+ },
186
+ [isDrawing, getCoordinates]
187
+ );
188
+ const stopDrawing = useCallback(() => {
189
+ setIsDrawing(false);
190
+ }, []);
191
+ const clearCanvas = useCallback(() => {
192
+ const canvas = canvasRef.current;
193
+ const ctx = canvas?.getContext("2d");
194
+ if (!canvas || !ctx) return;
195
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
196
+ setHasContent(false);
197
+ }, []);
198
+ const takeScreenshot = useCallback(async () => {
199
+ try {
200
+ const toolbar = toolbarRef.current;
201
+ if (toolbar) {
202
+ toolbar.style.opacity = "0";
203
+ }
204
+ const canvas = await html2canvas(document.body, {
205
+ useCORS: true,
206
+ logging: false,
207
+ windowWidth: window.innerWidth,
208
+ windowHeight: window.innerHeight
209
+ });
210
+ if (toolbar) {
211
+ toolbar.style.opacity = "";
212
+ }
213
+ canvas.toBlob(async (blob) => {
214
+ if (!blob) return;
215
+ try {
216
+ await navigator.clipboard.write([
217
+ new ClipboardItem({
218
+ "image/png": blob
219
+ })
220
+ ]);
221
+ } catch (err) {
222
+ console.error("Failed to copy to clipboard:", err);
223
+ const url = URL.createObjectURL(blob);
224
+ const a = document.createElement("a");
225
+ a.href = url;
226
+ a.download = "screenshot.png";
227
+ a.click();
228
+ URL.revokeObjectURL(url);
229
+ }
230
+ }, "image/png");
231
+ } catch (error) {
232
+ console.error("Failed to take screenshot:", error);
233
+ }
234
+ }, []);
235
+ useEffect(() => {
236
+ const canvas = canvasRef.current;
237
+ const ctx = canvas?.getContext("2d");
238
+ if (!ctx) return;
239
+ ctx.strokeStyle = brushColor;
240
+ ctx.lineWidth = brushSize;
241
+ }, [brushColor, brushSize]);
242
+ const getTargetCorner = useCallback(
243
+ (startX, startY, currentX, currentY) => {
244
+ const deltaX = currentX - startX;
245
+ const deltaY = currentY - startY;
246
+ const threshold = 50;
247
+ if (Math.abs(deltaX) < threshold && Math.abs(deltaY) < threshold) {
248
+ return null;
249
+ }
250
+ const viewportWidth = window.innerWidth;
251
+ const viewportHeight = window.innerHeight;
252
+ const horizontal = currentX < viewportWidth / 2 ? "left" : "right";
253
+ const vertical = currentY < viewportHeight / 2 ? "top" : "bottom";
254
+ if (vertical === "top" && horizontal === "left") return "top-left";
255
+ if (vertical === "top" && horizontal === "right") return "top-right";
256
+ if (vertical === "bottom" && horizontal === "left") return "bottom-left";
257
+ if (vertical === "bottom" && horizontal === "right")
258
+ return "bottom-right";
259
+ return null;
260
+ },
261
+ []
262
+ );
263
+ const handleMouseDown = useCallback((e) => {
264
+ if (e.target.closest("button")) {
265
+ return;
266
+ }
267
+ e.preventDefault();
268
+ e.stopPropagation();
269
+ setIsDragging(true);
270
+ setDragStart({
271
+ x: e.clientX,
272
+ y: e.clientY
273
+ });
274
+ }, []);
275
+ useEffect(() => {
276
+ const handleMouseMove = (e) => {
277
+ if (!isDragging) return;
278
+ e.preventDefault();
279
+ e.stopPropagation();
280
+ const targetCorner = getTargetCorner(
281
+ dragStart.x,
282
+ dragStart.y,
283
+ e.clientX,
284
+ e.clientY
285
+ );
286
+ if (targetCorner) {
287
+ setCorner(targetCorner);
288
+ } else {
289
+ const viewportWidth = window.innerWidth;
290
+ const viewportHeight = window.innerHeight;
291
+ const horizontal = e.clientX < viewportWidth / 2 ? "left" : "right";
292
+ const vertical = e.clientY < viewportHeight / 2 ? "top" : "bottom";
293
+ if (vertical === "top" && horizontal === "left") setCorner("top-left");
294
+ else if (vertical === "top" && horizontal === "right")
295
+ setCorner("top-right");
296
+ else if (vertical === "bottom" && horizontal === "left")
297
+ setCorner("bottom-left");
298
+ else setCorner("bottom-right");
299
+ }
300
+ };
301
+ const handleMouseUp = (e) => {
302
+ e.preventDefault();
303
+ e.stopPropagation();
304
+ setIsDragging(false);
305
+ };
306
+ if (isDragging) {
307
+ document.addEventListener("mousemove", handleMouseMove, {
308
+ passive: false
309
+ });
310
+ document.addEventListener("mouseup", handleMouseUp, { passive: false });
311
+ }
312
+ return () => {
313
+ document.removeEventListener("mousemove", handleMouseMove);
314
+ document.removeEventListener("mouseup", handleMouseUp);
315
+ };
316
+ }, [isDragging, dragStart, getTargetCorner]);
317
+ if (overlay) {
318
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
319
+ /* @__PURE__ */ jsx(
320
+ "canvas",
321
+ {
322
+ ref: canvasRef,
323
+ onMouseDown: startDrawing,
324
+ onMouseMove: draw,
325
+ onMouseUp: stopDrawing,
326
+ onMouseLeave: stopDrawing,
327
+ onTouchStart: startDrawing,
328
+ onTouchMove: draw,
329
+ onTouchEnd: stopDrawing,
330
+ className: `fixed top-0 left-0 touch-none z-50 transition-opacity ${enabled && !isDragging ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
331
+ style: {
332
+ width: `${canvasSize.width}px`,
333
+ height: `${canvasSize.height}px`
334
+ }
335
+ }
336
+ ),
337
+ /* @__PURE__ */ jsxs(
338
+ "div",
339
+ {
340
+ ref: toolbarRef,
341
+ className: `fixed flex flex-row items-center px-2 py-1.5 bg-neutral-800 rounded-full shadow-lg z-[60] ${isDragging ? "cursor-grabbing" : "cursor-grab"} ${className}`,
342
+ style: {
343
+ gap: enabled ? "8px" : "0px",
344
+ transition: "gap 300ms ease-in-out",
345
+ ...corner === "top-left" ? { top: "16px", left: "16px", bottom: "auto", right: "auto" } : corner === "top-right" ? { top: "16px", right: "16px", bottom: "auto", left: "auto" } : corner === "bottom-left" ? { bottom: "16px", left: "16px", top: "auto", right: "auto" } : { bottom: "16px", right: "16px", top: "auto", left: "auto" }
346
+ },
347
+ onMouseDown: handleMouseDown,
348
+ ...props,
349
+ onClick: (e) => e.stopPropagation(),
350
+ children: [
351
+ /* @__PURE__ */ jsx(
352
+ "div",
353
+ {
354
+ className: "overflow-hidden flex-shrink-0",
355
+ style: {
356
+ maxWidth: enabled ? "100px" : "0px",
357
+ opacity: enabled ? 1 : 0,
358
+ transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
359
+ },
360
+ children: /* @__PURE__ */ jsx(
361
+ "button",
362
+ {
363
+ onClick: (e) => {
364
+ e.stopPropagation();
365
+ takeScreenshot();
366
+ },
367
+ className: "p-2 text-white hover:bg-neutral-600/30 rounded-full transition-colors focus:outline-none whitespace-nowrap",
368
+ "aria-label": "Take screenshot",
369
+ children: /* @__PURE__ */ jsxs(
370
+ "svg",
371
+ {
372
+ xmlns: "http://www.w3.org/2000/svg",
373
+ width: "18",
374
+ height: "18",
375
+ viewBox: "0 0 24 24",
376
+ fill: "none",
377
+ stroke: "currentColor",
378
+ strokeWidth: "2",
379
+ strokeLinecap: "round",
380
+ strokeLinejoin: "round",
381
+ className: "lucide lucide-camera",
382
+ children: [
383
+ /* @__PURE__ */ jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
384
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "13", r: "3" })
385
+ ]
386
+ }
387
+ )
388
+ }
389
+ )
390
+ }
391
+ ),
392
+ /* @__PURE__ */ jsxs(
393
+ "div",
394
+ {
395
+ className: "overflow-hidden flex-shrink-0 relative",
396
+ style: {
397
+ maxWidth: enabled ? "100px" : "0px",
398
+ opacity: enabled ? 1 : 0,
399
+ transition: "max-width 300ms ease-in-out, opacity 300ms ease-in-out"
400
+ },
401
+ children: [
402
+ /* @__PURE__ */ jsxs(
403
+ "button",
404
+ {
405
+ onClick: (e) => {
406
+ e.stopPropagation();
407
+ clearCanvas();
408
+ setShowClearTooltip(false);
409
+ },
410
+ onMouseEnter: () => {
411
+ if (hasContent) {
412
+ setShowClearTooltip(true);
413
+ }
414
+ },
415
+ onMouseLeave: () => setShowClearTooltip(false),
416
+ disabled: !hasContent,
417
+ className: "p-2 text-white rounded-full focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed relative group",
418
+ "aria-label": "Clear canvas",
419
+ children: [
420
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full bg-red-600/30 opacity-0 group-hover:opacity-100 transition-opacity disabled:group-hover:opacity-0" }),
421
+ /* @__PURE__ */ jsx(
422
+ Trash2,
423
+ {
424
+ size: 18,
425
+ strokeWidth: 2,
426
+ className: "relative z-10 group-hover:text-red-600 transition-colors"
427
+ }
428
+ )
429
+ ]
430
+ }
431
+ ),
432
+ showClearTooltip && hasContent && /* @__PURE__ */ jsxs("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-neutral-800 rounded-full shadow-lg whitespace-nowrap z-[70]", children: [
433
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
434
+ /* @__PURE__ */ jsx("span", { className: "text-white text-sm", children: "Clear all" }),
435
+ /* @__PURE__ */ jsx(
436
+ "button",
437
+ {
438
+ onClick: (e) => {
439
+ e.stopPropagation();
440
+ setShowClearTooltip(false);
441
+ },
442
+ onMouseDown: (e) => e.stopPropagation(),
443
+ className: "text-white hover:text-neutral-300 transition-colors rounded-full",
444
+ "aria-label": "Dismiss tooltip",
445
+ children: /* @__PURE__ */ jsx(X, { size: 14, strokeWidth: 2 })
446
+ }
447
+ )
448
+ ] }),
449
+ /* @__PURE__ */ jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 -mt-1", children: /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-neutral-800 rotate-45" }) })
450
+ ] })
451
+ ]
452
+ }
453
+ ),
454
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-shrink-0", children: [
455
+ /* @__PURE__ */ jsx(
456
+ "button",
457
+ {
458
+ onClick: (e) => {
459
+ e.stopPropagation();
460
+ setEnabled(!enabled);
461
+ },
462
+ className: "p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
463
+ style: {
464
+ opacity: enabled ? 0 : 1,
465
+ pointerEvents: enabled ? "none" : "auto",
466
+ transition: "opacity 300ms ease-in-out"
467
+ },
468
+ "aria-label": "Turn on drawing",
469
+ children: /* @__PURE__ */ jsxs(
470
+ "svg",
471
+ {
472
+ xmlns: "http://www.w3.org/2000/svg",
473
+ width: "18",
474
+ height: "18",
475
+ viewBox: "0 0 24 24",
476
+ fill: "none",
477
+ stroke: "currentColor",
478
+ strokeWidth: "2",
479
+ strokeLinecap: "round",
480
+ strokeLinejoin: "round",
481
+ className: "lucide lucide-brush",
482
+ children: [
483
+ /* @__PURE__ */ jsx("path", { d: "m11 10 3 3" }),
484
+ /* @__PURE__ */ jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
485
+ /* @__PURE__ */ jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
486
+ ]
487
+ }
488
+ )
489
+ }
490
+ ),
491
+ /* @__PURE__ */ jsx(
492
+ "button",
493
+ {
494
+ onClick: (e) => {
495
+ e.stopPropagation();
496
+ setEnabled(false);
497
+ },
498
+ className: "absolute inset-0 p-1.5 text-white hover:bg-neutral-600/30 rounded-full transition-all focus:outline-none",
499
+ style: {
500
+ opacity: enabled ? 1 : 0,
501
+ pointerEvents: enabled ? "auto" : "none",
502
+ transition: "opacity 300ms ease-in-out"
503
+ },
504
+ "aria-label": "Close",
505
+ children: /* @__PURE__ */ jsx(X, { size: 18, strokeWidth: 2.5 })
506
+ }
507
+ )
508
+ ] })
509
+ ]
510
+ }
511
+ )
512
+ ] });
513
+ }
514
+ return /* @__PURE__ */ jsxs(
515
+ "div",
516
+ {
517
+ className: `flex flex-col items-center gap-4 p-6 bg-white rounded-full shadow-lg border border-gray-200 ${className}`,
518
+ ...props,
519
+ children: [
520
+ /* @__PURE__ */ jsxs(
521
+ "div",
522
+ {
523
+ className: "flex flex-row items-center w-full justify-center transition-all duration-300 ease-in-out",
524
+ style: {
525
+ gap: enabled ? "12px" : "0px"
526
+ },
527
+ children: [
528
+ /* @__PURE__ */ jsx(
529
+ "button",
530
+ {
531
+ onClick: () => setEnabled(!enabled),
532
+ className: `p-3 rounded-xl transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 ${enabled ? "bg-emerald-500 text-white hover:bg-emerald-600 active:bg-emerald-700" : "bg-slate-500 text-white hover:bg-slate-600 active:bg-slate-700"}`,
533
+ "aria-label": enabled ? "Turn off drawing" : "Turn on drawing",
534
+ children: enabled ? /* @__PURE__ */ jsx(X, { size: 20, strokeWidth: 2.5 }) : /* @__PURE__ */ jsxs(
535
+ "svg",
536
+ {
537
+ xmlns: "http://www.w3.org/2000/svg",
538
+ width: "20",
539
+ height: "20",
540
+ viewBox: "0 0 24 24",
541
+ fill: "none",
542
+ stroke: "currentColor",
543
+ strokeWidth: "2",
544
+ strokeLinecap: "round",
545
+ strokeLinejoin: "round",
546
+ className: "lucide lucide-brush",
547
+ children: [
548
+ /* @__PURE__ */ jsx("path", { d: "m11 10 3 3" }),
549
+ /* @__PURE__ */ jsx("path", { d: "M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z" }),
550
+ /* @__PURE__ */ jsx("path", { d: "M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031" })
551
+ ]
552
+ }
553
+ )
554
+ }
555
+ ),
556
+ /* @__PURE__ */ jsx(
557
+ "div",
558
+ {
559
+ className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
560
+ style: {
561
+ width: enabled ? "52px" : "0px",
562
+ minWidth: enabled ? "52px" : "0px",
563
+ opacity: enabled ? 1 : 0
564
+ },
565
+ children: /* @__PURE__ */ jsx(
566
+ "button",
567
+ {
568
+ onClick: clearCanvas,
569
+ disabled: !hasContent,
570
+ className: "p-3 bg-red-500 text-white hover:text-red-200 rounded-xl hover:bg-red-600 active:bg-red-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-red-500 disabled:hover:shadow-md disabled:active:scale-100 whitespace-nowrap",
571
+ "aria-label": "Clear canvas",
572
+ children: /* @__PURE__ */ jsxs(
573
+ "svg",
574
+ {
575
+ xmlns: "http://www.w3.org/2000/svg",
576
+ width: "20",
577
+ height: "20",
578
+ viewBox: "0 0 24 24",
579
+ fill: "none",
580
+ stroke: "currentColor",
581
+ strokeWidth: "2",
582
+ strokeLinecap: "round",
583
+ strokeLinejoin: "round",
584
+ className: "lucide lucide-brush-cleaning",
585
+ children: [
586
+ /* @__PURE__ */ jsx("path", { d: "m16 22-1-4" }),
587
+ /* @__PURE__ */ jsx("path", { d: "M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1" }),
588
+ /* @__PURE__ */ jsx("path", { d: "M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z" }),
589
+ /* @__PURE__ */ jsx("path", { d: "m8 22 1-4" })
590
+ ]
591
+ }
592
+ )
593
+ }
594
+ )
595
+ }
596
+ ),
597
+ /* @__PURE__ */ jsx(
598
+ "div",
599
+ {
600
+ className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0",
601
+ style: {
602
+ width: enabled ? "52px" : "0px",
603
+ minWidth: enabled ? "52px" : "0px",
604
+ opacity: enabled ? 1 : 0
605
+ },
606
+ children: /* @__PURE__ */ jsx(
607
+ "button",
608
+ {
609
+ onClick: takeScreenshot,
610
+ className: "p-3 bg-neutral-500 text-white rounded-xl hover:bg-neutral-600 active:bg-neutral-700 transition-all duration-200 focus:outline-none shadow-md hover:shadow-lg active:scale-95 whitespace-nowrap",
611
+ "aria-label": "Take screenshot",
612
+ children: /* @__PURE__ */ jsxs(
613
+ "svg",
614
+ {
615
+ xmlns: "http://www.w3.org/2000/svg",
616
+ width: "20",
617
+ height: "20",
618
+ viewBox: "0 0 24 24",
619
+ fill: "none",
620
+ stroke: "currentColor",
621
+ strokeWidth: "2",
622
+ strokeLinecap: "round",
623
+ strokeLinejoin: "round",
624
+ className: "lucide lucide-camera",
625
+ children: [
626
+ /* @__PURE__ */ jsx("path", { d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" }),
627
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "13", r: "3" })
628
+ ]
629
+ }
630
+ )
631
+ }
632
+ )
633
+ }
634
+ )
635
+ ]
636
+ }
637
+ ),
638
+ /* @__PURE__ */ jsx(
639
+ "canvas",
640
+ {
641
+ ref: canvasRef,
642
+ onMouseDown: startDrawing,
643
+ onMouseMove: draw,
644
+ onMouseUp: stopDrawing,
645
+ onMouseLeave: stopDrawing,
646
+ onTouchStart: startDrawing,
647
+ onTouchMove: draw,
648
+ onTouchEnd: stopDrawing,
649
+ className: `border border-gray-300 rounded touch-none transition-opacity ${enabled ? "cursor-crosshair pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
650
+ style: {
651
+ width: `${canvasSize.width}px`,
652
+ height: `${canvasSize.height}px`,
653
+ maxWidth: "100%"
654
+ }
655
+ }
656
+ )
657
+ ]
658
+ }
659
+ );
660
+ };
661
+ var DrawingTool_default = DrawingTool;
662
+
663
+ export { Button, Button_default as ButtonDefault, Card, Card_default as CardDefault, DrawingTool, DrawingTool_default as DrawingToolDefault, Input, Input_default as InputDefault };
664
+ //# sourceMappingURL=components.mjs.map
665
+ //# sourceMappingURL=components.mjs.map