@tbib-image-viewer/react 0.1.4 → 0.1.6
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.
- package/dist/index.css +77 -33
- package/dist/index.css.map +1 -1
- package/dist/index.js +401 -334
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +294 -237
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "@tbib-image-viewer/core";
|
|
15
15
|
|
|
16
16
|
// src/components/ImageToolbar.tsx
|
|
17
|
+
import React2 from "react";
|
|
17
18
|
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
18
19
|
import {
|
|
19
20
|
faHand,
|
|
@@ -264,251 +265,307 @@ var ImageToolbar = ({
|
|
|
264
265
|
totalImages
|
|
265
266
|
}) => {
|
|
266
267
|
const showSubtoolbar = activeTool === "pen" || activeTool === "highlighter" || activeTool === "laser";
|
|
268
|
+
const toolbarScrollRef = React2.useRef(null);
|
|
269
|
+
const subtoolbarScrollRef = React2.useRef(null);
|
|
270
|
+
const toolbarTouchState = React2.useRef({ isDown: false, startX: 0, scrollLeft: 0 });
|
|
271
|
+
const subtoolbarTouchState = React2.useRef({ isDown: false, startX: 0, scrollLeft: 0 });
|
|
272
|
+
const handleToolbarTouchStart = (e) => {
|
|
273
|
+
if (!toolbarScrollRef.current) return;
|
|
274
|
+
toolbarTouchState.current = {
|
|
275
|
+
isDown: true,
|
|
276
|
+
startX: e.touches[0].clientX,
|
|
277
|
+
scrollLeft: toolbarScrollRef.current.scrollLeft
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
const handleToolbarTouchMove = (e) => {
|
|
281
|
+
if (!toolbarTouchState.current.isDown || !toolbarScrollRef.current) return;
|
|
282
|
+
const dx = e.touches[0].clientX - toolbarTouchState.current.startX;
|
|
283
|
+
toolbarScrollRef.current.scrollLeft = toolbarTouchState.current.scrollLeft - dx;
|
|
284
|
+
};
|
|
285
|
+
const handleToolbarTouchEnd = () => {
|
|
286
|
+
toolbarTouchState.current.isDown = false;
|
|
287
|
+
};
|
|
288
|
+
const handleSubtoolbarTouchStart = (e) => {
|
|
289
|
+
if (!subtoolbarScrollRef.current) return;
|
|
290
|
+
subtoolbarTouchState.current = {
|
|
291
|
+
isDown: true,
|
|
292
|
+
startX: e.touches[0].clientX,
|
|
293
|
+
scrollLeft: subtoolbarScrollRef.current.scrollLeft
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
const handleSubtoolbarTouchMove = (e) => {
|
|
297
|
+
if (!subtoolbarTouchState.current.isDown || !subtoolbarScrollRef.current) return;
|
|
298
|
+
const dx = e.touches[0].clientX - subtoolbarTouchState.current.startX;
|
|
299
|
+
subtoolbarScrollRef.current.scrollLeft = subtoolbarTouchState.current.scrollLeft - dx;
|
|
300
|
+
};
|
|
301
|
+
const handleSubtoolbarTouchEnd = () => {
|
|
302
|
+
subtoolbarTouchState.current.isDown = false;
|
|
303
|
+
};
|
|
267
304
|
return /* @__PURE__ */ jsxs2("div", { className: "tbib-iv-toolbar-wrapper", children: [
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
"
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
className: "tbib-iv-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
"
|
|
447
|
-
style: { color: "#ef4444" },
|
|
448
|
-
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faXmark, style: { fontSize: "16px" } })
|
|
449
|
-
}
|
|
450
|
-
)
|
|
451
|
-
] })
|
|
452
|
-
] }),
|
|
453
|
-
showSubtoolbar && /* @__PURE__ */ jsxs2("div", { className: "tbib-iv-subtoolbar", role: "region", "aria-label": "Tool customization", children: [
|
|
454
|
-
activeTool !== "laser" && /* @__PURE__ */ jsx2("div", { className: "tbib-iv-thickness-group", children: THICKNESS_OPTIONS.map((opt) => /* @__PURE__ */ jsxs2(
|
|
455
|
-
"button",
|
|
456
|
-
{
|
|
457
|
-
type: "button",
|
|
458
|
-
className: `tbib-iv-thickness-btn ${strokeWidth === opt.value ? "tbib-iv-thickness-active" : ""}`,
|
|
459
|
-
onClick: () => onStrokeWidthChange(opt.value),
|
|
460
|
-
title: `${opt.label} stroke (${opt.value}px)`,
|
|
461
|
-
children: [
|
|
305
|
+
/* @__PURE__ */ jsx2("header", { className: "tbib-iv-toolbar", role: "toolbar", "aria-label": "Image tools", children: /* @__PURE__ */ jsxs2(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
ref: toolbarScrollRef,
|
|
309
|
+
className: "tbib-iv-toolbar-scroll",
|
|
310
|
+
onTouchStart: handleToolbarTouchStart,
|
|
311
|
+
onTouchMove: handleToolbarTouchMove,
|
|
312
|
+
onTouchEnd: handleToolbarTouchEnd,
|
|
313
|
+
children: [
|
|
314
|
+
currentIndex !== void 0 && totalImages !== void 0 && totalImages > 1 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ jsxs2("span", { className: "tbib-iv-tabular", title: "Current Image", children: [
|
|
316
|
+
currentIndex + 1,
|
|
317
|
+
" / ",
|
|
318
|
+
totalImages
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider" })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ jsx2(
|
|
323
|
+
"button",
|
|
324
|
+
{
|
|
325
|
+
type: "button",
|
|
326
|
+
className: `tbib-iv-btn ${activeTool === "hand" ? "tbib-iv-btn-active" : ""}`,
|
|
327
|
+
onClick: () => onToolChange("hand"),
|
|
328
|
+
title: "Pan & Move (1-finger / drag)",
|
|
329
|
+
"aria-label": "Hand Pan Tool",
|
|
330
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faHand })
|
|
331
|
+
}
|
|
332
|
+
),
|
|
333
|
+
/* @__PURE__ */ jsx2(
|
|
334
|
+
"button",
|
|
335
|
+
{
|
|
336
|
+
type: "button",
|
|
337
|
+
className: `tbib-iv-btn ${activeTool === "pen" ? "tbib-iv-btn-active" : ""}`,
|
|
338
|
+
onClick: () => onToolChange("pen"),
|
|
339
|
+
title: "Draw Pen",
|
|
340
|
+
"aria-label": "Pen Tool",
|
|
341
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faPen })
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ jsx2(
|
|
345
|
+
"button",
|
|
346
|
+
{
|
|
347
|
+
type: "button",
|
|
348
|
+
className: `tbib-iv-btn ${activeTool === "highlighter" ? "tbib-iv-btn-active" : ""}`,
|
|
349
|
+
onClick: () => onToolChange("highlighter"),
|
|
350
|
+
title: "Highlighter (Semi-transparent)",
|
|
351
|
+
"aria-label": "Highlighter Tool",
|
|
352
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faHighlighter })
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsx2(
|
|
356
|
+
"button",
|
|
357
|
+
{
|
|
358
|
+
type: "button",
|
|
359
|
+
className: `tbib-iv-btn ${activeTool === "laser" ? "tbib-iv-btn-active" : ""}`,
|
|
360
|
+
onClick: () => onToolChange("laser"),
|
|
361
|
+
title: "Laser Pointer (Glowing WebGL trail)",
|
|
362
|
+
"aria-label": "Laser Pointer",
|
|
363
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faCrosshairs })
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
/* @__PURE__ */ jsx2(
|
|
367
|
+
"button",
|
|
368
|
+
{
|
|
369
|
+
type: "button",
|
|
370
|
+
className: `tbib-iv-btn ${activeTool === "eraser" ? "tbib-iv-btn-active" : ""}`,
|
|
371
|
+
onClick: () => onToolChange("eraser"),
|
|
372
|
+
title: "Eraser (Erase strokes on tap)",
|
|
373
|
+
"aria-label": "Eraser Tool",
|
|
374
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faEraser })
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider" }),
|
|
378
|
+
/* @__PURE__ */ jsx2(
|
|
379
|
+
"button",
|
|
380
|
+
{
|
|
381
|
+
type: "button",
|
|
382
|
+
className: "tbib-iv-btn",
|
|
383
|
+
disabled: !canUndo,
|
|
384
|
+
onClick: onUndo,
|
|
385
|
+
title: "Undo (Ctrl+Z)",
|
|
386
|
+
"aria-label": "Undo",
|
|
387
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faRotateLeft })
|
|
388
|
+
}
|
|
389
|
+
),
|
|
390
|
+
/* @__PURE__ */ jsx2(
|
|
391
|
+
"button",
|
|
392
|
+
{
|
|
393
|
+
type: "button",
|
|
394
|
+
className: "tbib-iv-btn",
|
|
395
|
+
disabled: !canRedo,
|
|
396
|
+
onClick: onRedo,
|
|
397
|
+
title: "Redo (Ctrl+Y)",
|
|
398
|
+
"aria-label": "Redo",
|
|
399
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faRotateRight })
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsx2(
|
|
403
|
+
"button",
|
|
404
|
+
{
|
|
405
|
+
type: "button",
|
|
406
|
+
className: "tbib-iv-btn",
|
|
407
|
+
onClick: onClear,
|
|
408
|
+
title: "Clear Slide Annotations",
|
|
409
|
+
"aria-label": "Clear All",
|
|
410
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faTrashCan })
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider" }),
|
|
414
|
+
/* @__PURE__ */ jsx2(
|
|
415
|
+
"button",
|
|
416
|
+
{
|
|
417
|
+
type: "button",
|
|
418
|
+
className: "tbib-iv-btn",
|
|
419
|
+
onClick: onZoomOut,
|
|
420
|
+
title: "Zoom Out (-)",
|
|
421
|
+
"aria-label": "Zoom Out",
|
|
422
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faMagnifyingGlassMinus })
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ jsxs2("span", { className: "tbib-iv-tabular", title: "Current Zoom Scale", children: [
|
|
426
|
+
Math.round(zoomScale * 100),
|
|
427
|
+
"%"
|
|
428
|
+
] }),
|
|
429
|
+
/* @__PURE__ */ jsx2(
|
|
430
|
+
"button",
|
|
431
|
+
{
|
|
432
|
+
type: "button",
|
|
433
|
+
className: "tbib-iv-btn",
|
|
434
|
+
onClick: onZoomIn,
|
|
435
|
+
title: "Zoom In (+)",
|
|
436
|
+
"aria-label": "Zoom In",
|
|
437
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faMagnifyingGlassPlus })
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
/* @__PURE__ */ jsx2(
|
|
441
|
+
"button",
|
|
442
|
+
{
|
|
443
|
+
type: "button",
|
|
444
|
+
className: "tbib-iv-btn",
|
|
445
|
+
onClick: onZoomReset,
|
|
446
|
+
title: "Reset Fit to Screen (0)",
|
|
447
|
+
"aria-label": "Reset Zoom",
|
|
448
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faExpand })
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ jsx2(
|
|
452
|
+
"button",
|
|
453
|
+
{
|
|
454
|
+
type: "button",
|
|
455
|
+
className: "tbib-iv-btn",
|
|
456
|
+
onClick: onRotate,
|
|
457
|
+
title: "Rotate 90\xB0 Clockwise",
|
|
458
|
+
"aria-label": "Rotate Image",
|
|
459
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faRotate })
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider" }),
|
|
463
|
+
/* @__PURE__ */ jsx2(
|
|
464
|
+
DownloadMenu,
|
|
465
|
+
{
|
|
466
|
+
onDownloadAnnotated,
|
|
467
|
+
onDownloadClean,
|
|
468
|
+
onExportJson
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
onToggleFullscreen && /* @__PURE__ */ jsx2(
|
|
472
|
+
"button",
|
|
473
|
+
{
|
|
474
|
+
type: "button",
|
|
475
|
+
className: "tbib-iv-btn",
|
|
476
|
+
onClick: onToggleFullscreen,
|
|
477
|
+
title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
478
|
+
"aria-label": "Toggle Fullscreen",
|
|
479
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: isFullscreen ? faCompressAlt : faExpandAlt })
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
onClose && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
483
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider" }),
|
|
462
484
|
/* @__PURE__ */ jsx2(
|
|
463
|
-
"
|
|
485
|
+
"button",
|
|
464
486
|
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
487
|
+
type: "button",
|
|
488
|
+
className: "tbib-iv-btn",
|
|
489
|
+
onClick: onClose,
|
|
490
|
+
title: "Close Viewer (Esc)",
|
|
491
|
+
"aria-label": "Close",
|
|
492
|
+
style: { color: "#ef4444" },
|
|
493
|
+
children: /* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faXmark, style: { fontSize: "16px" } })
|
|
472
494
|
}
|
|
473
|
-
)
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
495
|
+
)
|
|
496
|
+
] })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
) }),
|
|
500
|
+
showSubtoolbar && /* @__PURE__ */ jsx2("div", { className: "tbib-iv-subtoolbar", role: "region", "aria-label": "Tool customization", children: /* @__PURE__ */ jsxs2(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
ref: subtoolbarScrollRef,
|
|
504
|
+
className: "tbib-iv-subtoolbar-scroll",
|
|
505
|
+
onTouchStart: handleSubtoolbarTouchStart,
|
|
506
|
+
onTouchMove: handleSubtoolbarTouchMove,
|
|
507
|
+
onTouchEnd: handleSubtoolbarTouchEnd,
|
|
508
|
+
children: [
|
|
509
|
+
activeTool !== "laser" && /* @__PURE__ */ jsx2("div", { className: "tbib-iv-thickness-group", children: THICKNESS_OPTIONS.map((opt) => /* @__PURE__ */ jsxs2(
|
|
485
510
|
"button",
|
|
486
511
|
{
|
|
487
512
|
type: "button",
|
|
488
|
-
className: `tbib-iv-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
513
|
+
className: `tbib-iv-thickness-btn ${strokeWidth === opt.value ? "tbib-iv-thickness-active" : ""}`,
|
|
514
|
+
onClick: () => onStrokeWidthChange(opt.value),
|
|
515
|
+
title: `${opt.label} stroke (${opt.value}px)`,
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ jsx2(
|
|
518
|
+
"span",
|
|
519
|
+
{
|
|
520
|
+
style: {
|
|
521
|
+
display: "inline-block",
|
|
522
|
+
width: `${Math.min(opt.value * 1.5, 12)}px`,
|
|
523
|
+
height: `${Math.min(opt.value * 1.5, 12)}px`,
|
|
524
|
+
borderRadius: "50%",
|
|
525
|
+
backgroundColor: "currentColor"
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
/* @__PURE__ */ jsx2("span", { children: opt.label })
|
|
530
|
+
]
|
|
493
531
|
},
|
|
494
|
-
|
|
495
|
-
)
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
532
|
+
opt.value
|
|
533
|
+
)) }),
|
|
534
|
+
activeTool === "laser" && /* @__PURE__ */ jsx2("span", { style: { fontSize: "11px", color: "var(--tbib-iv-text-muted)", fontStyle: "italic", paddingRight: "4px" }, children: "Laser Beam Color:" }),
|
|
535
|
+
/* @__PURE__ */ jsx2("div", { className: "tbib-iv-divider", style: { height: "16px", margin: "0 2px" } }),
|
|
536
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "inline-flex", alignItems: "center", gap: "6px" }, children: [
|
|
537
|
+
PRESET_COLORS.map((c) => {
|
|
538
|
+
const isSelected = color.toLowerCase() === c.toLowerCase();
|
|
539
|
+
return /* @__PURE__ */ jsx2(
|
|
540
|
+
"button",
|
|
541
|
+
{
|
|
542
|
+
type: "button",
|
|
543
|
+
className: `tbib-iv-swatch-btn ${isSelected ? "tbib-iv-swatch-active" : ""}`,
|
|
544
|
+
style: { backgroundColor: c },
|
|
545
|
+
onClick: () => onColorChange(c),
|
|
546
|
+
title: `Select color: ${c}`,
|
|
547
|
+
"aria-label": `Color ${c}`
|
|
548
|
+
},
|
|
549
|
+
c
|
|
550
|
+
);
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ jsxs2("label", { className: "tbib-iv-custom-color-btn", title: "Custom Color Picker", children: [
|
|
553
|
+
/* @__PURE__ */ jsx2(FontAwesomeIcon2, { icon: faEyeDropper, style: { fontSize: "10px", opacity: 0.8 } }),
|
|
554
|
+
/* @__PURE__ */ jsx2(
|
|
555
|
+
"input",
|
|
556
|
+
{
|
|
557
|
+
type: "color",
|
|
558
|
+
value: color,
|
|
559
|
+
onChange: (e) => onColorChange(e.target.value),
|
|
560
|
+
className: "tbib-iv-custom-color-input",
|
|
561
|
+
"aria-label": "Custom color picker"
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
] })
|
|
565
|
+
] })
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
) })
|
|
512
569
|
] });
|
|
513
570
|
};
|
|
514
571
|
|