@razzusharma/accent-theme 2.0.2 → 2.0.3
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/README.md +38 -0
- package/dist/index.d.mts +25 -38
- package/dist/index.d.ts +25 -38
- package/dist/index.js +414 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -259,7 +259,17 @@ var gapClasses = {
|
|
|
259
259
|
md: "gap-2",
|
|
260
260
|
lg: "gap-3"
|
|
261
261
|
};
|
|
262
|
-
var
|
|
262
|
+
var sizePixels = {
|
|
263
|
+
sm: 24,
|
|
264
|
+
md: 32,
|
|
265
|
+
lg: 40
|
|
266
|
+
};
|
|
267
|
+
var gapPixels = {
|
|
268
|
+
sm: 4,
|
|
269
|
+
md: 8,
|
|
270
|
+
lg: 12
|
|
271
|
+
};
|
|
272
|
+
var CheckmarkIcon = ({ className = "", style }) => /* @__PURE__ */ jsx("svg", { className, style, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx(
|
|
263
273
|
"path",
|
|
264
274
|
{
|
|
265
275
|
fillRule: "evenodd",
|
|
@@ -306,14 +316,35 @@ function AccentColorSwatch({
|
|
|
306
316
|
${className}
|
|
307
317
|
`,
|
|
308
318
|
style: {
|
|
319
|
+
width: `${sizePixels[size]}px`,
|
|
320
|
+
height: `${sizePixels[size]}px`,
|
|
321
|
+
borderRadius: "9999px",
|
|
322
|
+
position: "relative",
|
|
323
|
+
display: "inline-flex",
|
|
324
|
+
alignItems: "center",
|
|
325
|
+
justifyContent: "center",
|
|
326
|
+
flexShrink: 0,
|
|
327
|
+
border: "none",
|
|
328
|
+
padding: 0,
|
|
329
|
+
cursor: "pointer",
|
|
309
330
|
background: `hsl(${config.primary})`,
|
|
310
|
-
["--tw-ring-color"]: `hsl(${config.light})
|
|
331
|
+
["--tw-ring-color"]: `hsl(${config.light})`,
|
|
332
|
+
boxShadow: isSelected ? `0 0 0 2px #fff, 0 0 0 4px hsl(${config.light})` : void 0
|
|
311
333
|
},
|
|
312
334
|
title: config.name,
|
|
313
335
|
"aria-label": `Select ${config.name} theme`,
|
|
314
336
|
"aria-pressed": isSelected
|
|
315
337
|
}, isSelected && showCheckmark && React2.createElement(CheckmarkIcon, {
|
|
316
|
-
className: "absolute inset-0 w-full h-full p-1.5 text-white drop-shadow-md"
|
|
338
|
+
className: "absolute inset-0 w-full h-full p-1.5 text-white drop-shadow-md",
|
|
339
|
+
style: {
|
|
340
|
+
position: "absolute",
|
|
341
|
+
inset: 0,
|
|
342
|
+
width: "100%",
|
|
343
|
+
height: "100%",
|
|
344
|
+
padding: "6px",
|
|
345
|
+
color: "#fff",
|
|
346
|
+
pointerEvents: "none"
|
|
347
|
+
}
|
|
317
348
|
}));
|
|
318
349
|
}
|
|
319
350
|
function AccentColorPicker({
|
|
@@ -357,7 +388,11 @@ function AccentColorPicker({
|
|
|
357
388
|
if (variant === "inline") {
|
|
358
389
|
return React2.createElement("div", {
|
|
359
390
|
className: `grid ${gapClasses.md} ${className}`,
|
|
360
|
-
style: {
|
|
391
|
+
style: {
|
|
392
|
+
display: "grid",
|
|
393
|
+
gap: `${gapPixels.md}px`,
|
|
394
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
395
|
+
}
|
|
361
396
|
}, Object.entries(colors).map(([color]) => {
|
|
362
397
|
const isSelected = accentColor === color;
|
|
363
398
|
return React2.createElement(AccentColorSwatch, {
|
|
@@ -382,7 +417,11 @@ function AccentColorPicker({
|
|
|
382
417
|
"div",
|
|
383
418
|
{
|
|
384
419
|
ref: dropdownRef,
|
|
385
|
-
className: `relative inline-block ${className}
|
|
420
|
+
className: `relative inline-block ${className}`,
|
|
421
|
+
style: {
|
|
422
|
+
position: "relative",
|
|
423
|
+
display: "inline-block"
|
|
424
|
+
}
|
|
386
425
|
},
|
|
387
426
|
React2.createElement("button", {
|
|
388
427
|
type: "button",
|
|
@@ -427,11 +466,30 @@ function AccentColorPicker({
|
|
|
427
466
|
border border-slate-600/40
|
|
428
467
|
shadow-2xl shadow-slate-950/50 backdrop-blur-xl
|
|
429
468
|
`,
|
|
430
|
-
role: "listbox"
|
|
469
|
+
role: "listbox",
|
|
470
|
+
style: {
|
|
471
|
+
position: "absolute",
|
|
472
|
+
right: 0,
|
|
473
|
+
marginTop: "12px",
|
|
474
|
+
padding: "16px",
|
|
475
|
+
borderRadius: "16px",
|
|
476
|
+
zIndex: 50,
|
|
477
|
+
minWidth: "290px",
|
|
478
|
+
background: "linear-gradient(to bottom, rgba(30,41,59,0.95), rgba(15,23,42,0.95))",
|
|
479
|
+
border: "1px solid rgba(71,85,105,0.4)",
|
|
480
|
+
boxShadow: "0 24px 48px rgba(2,6,23,0.5)",
|
|
481
|
+
backdropFilter: "blur(16px)"
|
|
482
|
+
}
|
|
431
483
|
}, [
|
|
432
484
|
React2.createElement("div", {
|
|
433
485
|
key: "header",
|
|
434
|
-
className: "flex items-start gap-3 mb-3"
|
|
486
|
+
className: "flex items-start gap-3 mb-3",
|
|
487
|
+
style: {
|
|
488
|
+
display: "flex",
|
|
489
|
+
alignItems: "flex-start",
|
|
490
|
+
gap: "12px",
|
|
491
|
+
marginBottom: "12px"
|
|
492
|
+
}
|
|
435
493
|
}, [
|
|
436
494
|
React2.createElement("div", {
|
|
437
495
|
key: "icon-wrap",
|
|
@@ -442,17 +500,36 @@ function AccentColorPicker({
|
|
|
442
500
|
React2.createElement("div", { key: "titles" }, [
|
|
443
501
|
React2.createElement("p", {
|
|
444
502
|
key: "title",
|
|
445
|
-
className: "text-[1.15rem] font-semibold text-slate-100 leading-5"
|
|
503
|
+
className: "text-[1.15rem] font-semibold text-slate-100 leading-5",
|
|
504
|
+
style: {
|
|
505
|
+
margin: 0,
|
|
506
|
+
fontSize: "1.15rem",
|
|
507
|
+
lineHeight: 1.25,
|
|
508
|
+
fontWeight: 600,
|
|
509
|
+
color: "#f1f5f9"
|
|
510
|
+
}
|
|
446
511
|
}, "Theme Color"),
|
|
447
512
|
React2.createElement("p", {
|
|
448
513
|
key: "subtitle",
|
|
449
|
-
className: "text-sm text-slate-300 mt-1"
|
|
514
|
+
className: "text-sm text-slate-300 mt-1",
|
|
515
|
+
style: {
|
|
516
|
+
margin: "4px 0 0",
|
|
517
|
+
fontSize: "0.875rem",
|
|
518
|
+
color: "#cbd5e1"
|
|
519
|
+
}
|
|
450
520
|
}, "Choose your preferred accent color")
|
|
451
521
|
])
|
|
452
522
|
]),
|
|
453
523
|
React2.createElement("div", {
|
|
454
524
|
key: "grid",
|
|
455
|
-
className: "grid grid-cols-4 gap-3 border-t border-white/10 pt-4"
|
|
525
|
+
className: "grid grid-cols-4 gap-3 border-t border-white/10 pt-4",
|
|
526
|
+
style: {
|
|
527
|
+
display: "grid",
|
|
528
|
+
gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
|
|
529
|
+
gap: "12px",
|
|
530
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
531
|
+
paddingTop: "16px"
|
|
532
|
+
}
|
|
456
533
|
}, Object.entries(colors).map(([color, config]) => {
|
|
457
534
|
const isSelected = accentColor === color;
|
|
458
535
|
return React2.createElement("button", {
|
|
@@ -466,22 +543,52 @@ function AccentColorPicker({
|
|
|
466
543
|
${isSelected ? "ring-2 ring-white/70 scale-[1.03]" : "ring-1 ring-white/10"}
|
|
467
544
|
`,
|
|
468
545
|
style: {
|
|
469
|
-
|
|
546
|
+
width: "48px",
|
|
547
|
+
height: "48px",
|
|
548
|
+
borderRadius: "12px",
|
|
549
|
+
border: "none",
|
|
550
|
+
cursor: "pointer",
|
|
551
|
+
position: "relative",
|
|
552
|
+
background: `hsl(${config.primary})`,
|
|
553
|
+
boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,0.7)" : "0 0 0 1px rgba(255,255,255,0.1)"
|
|
470
554
|
},
|
|
471
555
|
title: config.name,
|
|
472
556
|
role: "option",
|
|
473
557
|
"aria-selected": isSelected
|
|
474
558
|
}, isSelected && React2.createElement(CheckmarkIcon, {
|
|
475
|
-
className: "absolute inset-0 w-full h-full p-3 text-white drop-shadow-md"
|
|
559
|
+
className: "absolute inset-0 w-full h-full p-3 text-white drop-shadow-md",
|
|
560
|
+
style: {
|
|
561
|
+
position: "absolute",
|
|
562
|
+
inset: 0,
|
|
563
|
+
width: "100%",
|
|
564
|
+
height: "100%",
|
|
565
|
+
padding: "12px",
|
|
566
|
+
color: "#fff",
|
|
567
|
+
pointerEvents: "none"
|
|
568
|
+
}
|
|
476
569
|
}));
|
|
477
570
|
})),
|
|
478
571
|
React2.createElement("div", {
|
|
479
572
|
key: "footer",
|
|
480
|
-
className: "mt-4 pt-4 border-t border-white/10 flex items-center justify-between gap-3"
|
|
573
|
+
className: "mt-4 pt-4 border-t border-white/10 flex items-center justify-between gap-3",
|
|
574
|
+
style: {
|
|
575
|
+
marginTop: "16px",
|
|
576
|
+
paddingTop: "16px",
|
|
577
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
578
|
+
display: "flex",
|
|
579
|
+
alignItems: "center",
|
|
580
|
+
justifyContent: "space-between",
|
|
581
|
+
gap: "12px"
|
|
582
|
+
}
|
|
481
583
|
}, [
|
|
482
584
|
React2.createElement("p", {
|
|
483
585
|
key: "current-text",
|
|
484
|
-
className: "text-[1.05rem] text-slate-200"
|
|
586
|
+
className: "text-[1.05rem] text-slate-200",
|
|
587
|
+
style: {
|
|
588
|
+
margin: 0,
|
|
589
|
+
fontSize: "1.05rem",
|
|
590
|
+
color: "#e2e8f0"
|
|
591
|
+
}
|
|
485
592
|
}, `Current: ${colors[accentColor]?.name || accentColor}`),
|
|
486
593
|
React2.createElement("span", {
|
|
487
594
|
key: "current-pill",
|
|
@@ -562,14 +669,23 @@ function AccentColorMenu({
|
|
|
562
669
|
};
|
|
563
670
|
if (!mounted) {
|
|
564
671
|
return React2.createElement("div", {
|
|
565
|
-
className: `animate-pulse bg-gray-200 dark:bg-gray-700 rounded-lg w-24 h-9 ${className}
|
|
672
|
+
className: `animate-pulse bg-gray-200 dark:bg-gray-700 rounded-lg w-24 h-9 ${className}`,
|
|
673
|
+
style: {
|
|
674
|
+
width: "96px",
|
|
675
|
+
height: "36px",
|
|
676
|
+
borderRadius: "8px"
|
|
677
|
+
}
|
|
566
678
|
});
|
|
567
679
|
}
|
|
568
680
|
return React2.createElement(
|
|
569
681
|
"div",
|
|
570
682
|
{
|
|
571
683
|
ref: menuRef,
|
|
572
|
-
className: `relative inline-block ${className}
|
|
684
|
+
className: `relative inline-block ${className}`,
|
|
685
|
+
style: {
|
|
686
|
+
position: "relative",
|
|
687
|
+
display: "inline-block"
|
|
688
|
+
}
|
|
573
689
|
},
|
|
574
690
|
React2.createElement("button", {
|
|
575
691
|
type: "button",
|
|
@@ -607,7 +723,22 @@ function AccentColorMenu({
|
|
|
607
723
|
border border-gray-200 dark:border-gray-700
|
|
608
724
|
z-50 min-w-[160px]
|
|
609
725
|
${alignClasses[align]}
|
|
610
|
-
|
|
726
|
+
`,
|
|
727
|
+
style: {
|
|
728
|
+
position: "absolute",
|
|
729
|
+
top: "100%",
|
|
730
|
+
marginTop: "8px",
|
|
731
|
+
padding: "8px",
|
|
732
|
+
background: "#ffffff",
|
|
733
|
+
borderRadius: "8px",
|
|
734
|
+
boxShadow: "0 12px 30px rgba(15,23,42,0.18)",
|
|
735
|
+
border: "1px solid #e5e7eb",
|
|
736
|
+
zIndex: 50,
|
|
737
|
+
minWidth: "160px",
|
|
738
|
+
left: align === "start" ? 0 : align === "center" ? "50%" : void 0,
|
|
739
|
+
right: align === "end" ? 0 : void 0,
|
|
740
|
+
transform: align === "center" ? "translateX(-50%)" : void 0
|
|
741
|
+
}
|
|
611
742
|
}, Object.entries(colors).map(([color, config]) => {
|
|
612
743
|
const isSelected = accentColor === color;
|
|
613
744
|
return React2.createElement("button", {
|
|
@@ -618,20 +749,48 @@ function AccentColorMenu({
|
|
|
618
749
|
w-full flex items-center gap-3 px-3 py-2 rounded-md
|
|
619
750
|
transition-colors
|
|
620
751
|
${isSelected ? "bg-gray-100 dark:bg-gray-700" : "hover:bg-gray-50 dark:hover:bg-gray-700/50"}
|
|
621
|
-
|
|
752
|
+
`,
|
|
753
|
+
style: {
|
|
754
|
+
width: "100%",
|
|
755
|
+
display: "flex",
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
gap: "12px",
|
|
758
|
+
padding: "8px 12px",
|
|
759
|
+
borderRadius: "6px",
|
|
760
|
+
border: "none",
|
|
761
|
+
cursor: "pointer",
|
|
762
|
+
background: isSelected ? "#f3f4f6" : "transparent"
|
|
763
|
+
}
|
|
622
764
|
}, [
|
|
623
765
|
React2.createElement("div", {
|
|
624
766
|
key: "dot",
|
|
625
767
|
className: `w-4 h-4 rounded-full flex-shrink-0`,
|
|
626
|
-
style: {
|
|
768
|
+
style: {
|
|
769
|
+
width: "16px",
|
|
770
|
+
height: "16px",
|
|
771
|
+
borderRadius: "9999px",
|
|
772
|
+
flexShrink: 0,
|
|
773
|
+
background: `hsl(${config.primary})`
|
|
774
|
+
}
|
|
627
775
|
}),
|
|
628
776
|
React2.createElement("span", {
|
|
629
777
|
key: "name",
|
|
630
|
-
className: `text-sm ${isSelected ? "font-medium text-gray-900 dark:text-gray-100" : "text-gray-700 dark:text-gray-300"}
|
|
778
|
+
className: `text-sm ${isSelected ? "font-medium text-gray-900 dark:text-gray-100" : "text-gray-700 dark:text-gray-300"}`,
|
|
779
|
+
style: {
|
|
780
|
+
fontSize: "14px",
|
|
781
|
+
fontWeight: isSelected ? 500 : 400,
|
|
782
|
+
color: isSelected ? "#111827" : "#374151"
|
|
783
|
+
}
|
|
631
784
|
}, config.name),
|
|
632
785
|
isSelected && React2.createElement(CheckmarkIcon, {
|
|
633
786
|
key: "check",
|
|
634
|
-
className: "w-4 h-4 ml-auto text-gray-500 dark:text-gray-400"
|
|
787
|
+
className: "w-4 h-4 ml-auto text-gray-500 dark:text-gray-400",
|
|
788
|
+
style: {
|
|
789
|
+
width: "16px",
|
|
790
|
+
height: "16px",
|
|
791
|
+
marginLeft: "auto",
|
|
792
|
+
color: "#6b7280"
|
|
793
|
+
}
|
|
635
794
|
})
|
|
636
795
|
]);
|
|
637
796
|
}))
|
|
@@ -870,6 +1029,237 @@ function AccentColorGrid({
|
|
|
870
1029
|
}));
|
|
871
1030
|
}
|
|
872
1031
|
|
|
1032
|
+
// src/AccentThemeWidget.tsx
|
|
1033
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
1034
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1035
|
+
var CheckIcon = () => /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 20 20", fill: "currentColor", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx2(
|
|
1036
|
+
"path",
|
|
1037
|
+
{
|
|
1038
|
+
fillRule: "evenodd",
|
|
1039
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
1040
|
+
clipRule: "evenodd"
|
|
1041
|
+
}
|
|
1042
|
+
) });
|
|
1043
|
+
var PaletteIcon2 = () => /* @__PURE__ */ jsxs2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", style: { width: "14px", height: "14px" }, children: [
|
|
1044
|
+
/* @__PURE__ */ jsx2(
|
|
1045
|
+
"path",
|
|
1046
|
+
{
|
|
1047
|
+
strokeLinecap: "round",
|
|
1048
|
+
strokeLinejoin: "round",
|
|
1049
|
+
strokeWidth: 1.8,
|
|
1050
|
+
d: "M12 3a9 9 0 100 18h1.4a2.6 2.6 0 000-5.2H11a1.5 1.5 0 010-3h4.8a3.2 3.2 0 003.2-3.2C19 6 15.9 3 12 3z"
|
|
1051
|
+
}
|
|
1052
|
+
),
|
|
1053
|
+
/* @__PURE__ */ jsx2("circle", { cx: "7.5", cy: "10.2", r: "1" }),
|
|
1054
|
+
/* @__PURE__ */ jsx2("circle", { cx: "10.5", cy: "7.5", r: "1" }),
|
|
1055
|
+
/* @__PURE__ */ jsx2("circle", { cx: "14.2", cy: "7.3", r: "1" })
|
|
1056
|
+
] });
|
|
1057
|
+
function AccentThemeWidget({
|
|
1058
|
+
className = "",
|
|
1059
|
+
title = "Theme Color",
|
|
1060
|
+
subtitle = "Choose your preferred accent color",
|
|
1061
|
+
position = "top-right",
|
|
1062
|
+
offset = 20,
|
|
1063
|
+
defaultOpen = true,
|
|
1064
|
+
collapsible = true,
|
|
1065
|
+
showCurrent = true,
|
|
1066
|
+
onChange
|
|
1067
|
+
}) {
|
|
1068
|
+
const { accentColor, setAccentColor, mounted, colors } = useAccentTheme();
|
|
1069
|
+
const { primary } = useAccentColor();
|
|
1070
|
+
const [isOpen, setIsOpen] = useState3(defaultOpen);
|
|
1071
|
+
const panelRef = useRef2(null);
|
|
1072
|
+
useEffect3(() => {
|
|
1073
|
+
if (!collapsible || !isOpen) return;
|
|
1074
|
+
const handleClickOutside = (event) => {
|
|
1075
|
+
if (panelRef.current && !panelRef.current.contains(event.target)) {
|
|
1076
|
+
setIsOpen(false);
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1080
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1081
|
+
}, [isOpen, collapsible]);
|
|
1082
|
+
const placementStyle = useMemo2(() => {
|
|
1083
|
+
if (position === "inline") {
|
|
1084
|
+
return { position: "relative", display: "inline-block" };
|
|
1085
|
+
}
|
|
1086
|
+
const base = { position: "fixed", zIndex: 80 };
|
|
1087
|
+
if (position === "top-right") base.top = `${offset}px`, base.right = `${offset}px`;
|
|
1088
|
+
if (position === "top-left") base.top = `${offset}px`, base.left = `${offset}px`;
|
|
1089
|
+
if (position === "bottom-right") base.bottom = `${offset}px`, base.right = `${offset}px`;
|
|
1090
|
+
if (position === "bottom-left") base.bottom = `${offset}px`, base.left = `${offset}px`;
|
|
1091
|
+
return base;
|
|
1092
|
+
}, [position, offset]);
|
|
1093
|
+
const handleColorChange = (color) => {
|
|
1094
|
+
setAccentColor(color);
|
|
1095
|
+
onChange?.(color);
|
|
1096
|
+
};
|
|
1097
|
+
if (!mounted) {
|
|
1098
|
+
return /* @__PURE__ */ jsx2(
|
|
1099
|
+
"div",
|
|
1100
|
+
{
|
|
1101
|
+
className,
|
|
1102
|
+
style: {
|
|
1103
|
+
...placementStyle,
|
|
1104
|
+
width: "228px",
|
|
1105
|
+
height: "196px",
|
|
1106
|
+
borderRadius: "14px",
|
|
1107
|
+
background: "rgba(31,41,55,0.75)",
|
|
1108
|
+
border: "1px solid rgba(255,255,255,0.12)"
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
return /* @__PURE__ */ jsxs2("div", { className, style: placementStyle, ref: panelRef, children: [
|
|
1114
|
+
collapsible ? /* @__PURE__ */ jsx2(
|
|
1115
|
+
"button",
|
|
1116
|
+
{
|
|
1117
|
+
type: "button",
|
|
1118
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
1119
|
+
"aria-label": "Toggle theme color panel",
|
|
1120
|
+
style: {
|
|
1121
|
+
width: "38px",
|
|
1122
|
+
height: "38px",
|
|
1123
|
+
borderRadius: "9999px",
|
|
1124
|
+
border: "1px solid rgba(168,85,247,0.45)",
|
|
1125
|
+
background: "radial-gradient(circle at 35% 30%, rgba(168,85,247,0.42), rgba(15,23,42,0.9))",
|
|
1126
|
+
color: "#c4b5fd",
|
|
1127
|
+
display: "grid",
|
|
1128
|
+
placeItems: "center",
|
|
1129
|
+
cursor: "pointer",
|
|
1130
|
+
marginLeft: position.endsWith("left") ? 0 : "auto",
|
|
1131
|
+
marginBottom: isOpen ? "8px" : 0,
|
|
1132
|
+
boxShadow: "0 8px 24px rgba(76,29,149,0.35)"
|
|
1133
|
+
},
|
|
1134
|
+
children: /* @__PURE__ */ jsx2(PaletteIcon2, {})
|
|
1135
|
+
}
|
|
1136
|
+
) : null,
|
|
1137
|
+
isOpen ? /* @__PURE__ */ jsxs2(
|
|
1138
|
+
"div",
|
|
1139
|
+
{
|
|
1140
|
+
role: "dialog",
|
|
1141
|
+
"aria-label": "Theme color picker",
|
|
1142
|
+
style: {
|
|
1143
|
+
width: "228px",
|
|
1144
|
+
padding: "12px",
|
|
1145
|
+
borderRadius: "14px",
|
|
1146
|
+
background: "linear-gradient(180deg, rgba(30,41,59,0.96), rgba(15,23,42,0.96))",
|
|
1147
|
+
border: "1px solid rgba(100,116,139,0.45)",
|
|
1148
|
+
boxShadow: "0 24px 50px rgba(2,6,23,0.5)",
|
|
1149
|
+
color: "#f8fafc",
|
|
1150
|
+
backdropFilter: "blur(14px)"
|
|
1151
|
+
},
|
|
1152
|
+
children: [
|
|
1153
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px", marginBottom: "12px" }, children: [
|
|
1154
|
+
/* @__PURE__ */ jsx2(
|
|
1155
|
+
"div",
|
|
1156
|
+
{
|
|
1157
|
+
"aria-hidden": true,
|
|
1158
|
+
style: {
|
|
1159
|
+
width: "20px",
|
|
1160
|
+
height: "20px",
|
|
1161
|
+
borderRadius: "9999px",
|
|
1162
|
+
border: "1px solid rgba(168,85,247,0.45)",
|
|
1163
|
+
display: "grid",
|
|
1164
|
+
placeItems: "center",
|
|
1165
|
+
color: "#c4b5fd"
|
|
1166
|
+
},
|
|
1167
|
+
children: /* @__PURE__ */ jsx2(PaletteIcon2, {})
|
|
1168
|
+
}
|
|
1169
|
+
),
|
|
1170
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
1171
|
+
/* @__PURE__ */ jsx2("p", { style: { margin: 0, fontSize: "1.1rem", fontWeight: 700, lineHeight: 1.15 }, children: title }),
|
|
1172
|
+
/* @__PURE__ */ jsx2("p", { style: { margin: "2px 0 0", fontSize: "0.8rem", color: "#94a3b8" }, children: subtitle })
|
|
1173
|
+
] })
|
|
1174
|
+
] }),
|
|
1175
|
+
/* @__PURE__ */ jsx2(
|
|
1176
|
+
"div",
|
|
1177
|
+
{
|
|
1178
|
+
style: {
|
|
1179
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
1180
|
+
paddingTop: "12px",
|
|
1181
|
+
display: "grid",
|
|
1182
|
+
gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
|
|
1183
|
+
gap: "8px"
|
|
1184
|
+
},
|
|
1185
|
+
children: Object.entries(colors).map(([color, config]) => {
|
|
1186
|
+
const selected = accentColor === color;
|
|
1187
|
+
return /* @__PURE__ */ jsx2(
|
|
1188
|
+
"button",
|
|
1189
|
+
{
|
|
1190
|
+
type: "button",
|
|
1191
|
+
onClick: () => handleColorChange(color),
|
|
1192
|
+
title: config.name,
|
|
1193
|
+
"aria-label": `Select ${config.name}`,
|
|
1194
|
+
style: {
|
|
1195
|
+
width: "42px",
|
|
1196
|
+
height: "42px",
|
|
1197
|
+
borderRadius: "10px",
|
|
1198
|
+
border: "none",
|
|
1199
|
+
cursor: "pointer",
|
|
1200
|
+
position: "relative",
|
|
1201
|
+
background: `hsl(${config.primary})`,
|
|
1202
|
+
boxShadow: selected ? "0 0 0 2px rgba(255,255,255,0.68)" : "0 0 0 1px rgba(255,255,255,0.1)"
|
|
1203
|
+
},
|
|
1204
|
+
children: selected ? /* @__PURE__ */ jsx2(
|
|
1205
|
+
"span",
|
|
1206
|
+
{
|
|
1207
|
+
style: {
|
|
1208
|
+
position: "absolute",
|
|
1209
|
+
inset: 0,
|
|
1210
|
+
display: "block",
|
|
1211
|
+
color: "#fff",
|
|
1212
|
+
padding: "10px",
|
|
1213
|
+
pointerEvents: "none"
|
|
1214
|
+
},
|
|
1215
|
+
children: /* @__PURE__ */ jsx2(CheckIcon, {})
|
|
1216
|
+
}
|
|
1217
|
+
) : null
|
|
1218
|
+
},
|
|
1219
|
+
color
|
|
1220
|
+
);
|
|
1221
|
+
})
|
|
1222
|
+
}
|
|
1223
|
+
),
|
|
1224
|
+
showCurrent ? /* @__PURE__ */ jsxs2(
|
|
1225
|
+
"div",
|
|
1226
|
+
{
|
|
1227
|
+
style: {
|
|
1228
|
+
marginTop: "12px",
|
|
1229
|
+
paddingTop: "10px",
|
|
1230
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
1231
|
+
display: "flex",
|
|
1232
|
+
alignItems: "center",
|
|
1233
|
+
justifyContent: "space-between",
|
|
1234
|
+
gap: "8px"
|
|
1235
|
+
},
|
|
1236
|
+
children: [
|
|
1237
|
+
/* @__PURE__ */ jsxs2("p", { style: { margin: 0, color: "#e2e8f0", fontSize: "0.95rem" }, children: [
|
|
1238
|
+
"Current: ",
|
|
1239
|
+
colors[accentColor]?.name || accentColor
|
|
1240
|
+
] }),
|
|
1241
|
+
/* @__PURE__ */ jsx2(
|
|
1242
|
+
"span",
|
|
1243
|
+
{
|
|
1244
|
+
"aria-hidden": true,
|
|
1245
|
+
style: {
|
|
1246
|
+
width: "46px",
|
|
1247
|
+
height: "20px",
|
|
1248
|
+
borderRadius: "9999px",
|
|
1249
|
+
background: primary,
|
|
1250
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.25)"
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
)
|
|
1254
|
+
]
|
|
1255
|
+
}
|
|
1256
|
+
) : null
|
|
1257
|
+
]
|
|
1258
|
+
}
|
|
1259
|
+
) : null
|
|
1260
|
+
] });
|
|
1261
|
+
}
|
|
1262
|
+
|
|
873
1263
|
// src/utils.ts
|
|
874
1264
|
function generateCSSVariables(config, prefix = "") {
|
|
875
1265
|
const p = prefix ? `${prefix}-` : "";
|
|
@@ -931,7 +1321,7 @@ var storage = {
|
|
|
931
1321
|
};
|
|
932
1322
|
|
|
933
1323
|
// src/index.ts
|
|
934
|
-
var VERSION = "2.0.
|
|
1324
|
+
var VERSION = "2.0.2";
|
|
935
1325
|
export {
|
|
936
1326
|
AccentColorButton,
|
|
937
1327
|
AccentColorGrid,
|
|
@@ -941,6 +1331,7 @@ export {
|
|
|
941
1331
|
AccentColorSwatches,
|
|
942
1332
|
AccentThemeProvider,
|
|
943
1333
|
AccentThemeReset,
|
|
1334
|
+
AccentThemeWidget,
|
|
944
1335
|
CurrentAccentIndicator,
|
|
945
1336
|
VERSION,
|
|
946
1337
|
adjustHSL,
|