@designa8/vibedesign-v6 1.10.2 → 1.10.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 +1 -1
- package/dist/index.cjs +33 -7
- package/dist/index.js +33 -7
- package/package.json +1 -1
- package/src/atoms/AppSidebar/AppSidebar.tsx +54 -3
- package/src/atoms/AppSidebar/preview.tsx +13 -7
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2734,6 +2734,18 @@ var SidebarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", {
|
|
|
2734
2734
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
2735
2735
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
|
|
2736
2736
|
] });
|
|
2737
|
+
var SunIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: [
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
2744
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
2746
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
2747
|
+
] });
|
|
2748
|
+
var MoonIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
2737
2749
|
var AppSidebar = import_react10.default.forwardRef(
|
|
2738
2750
|
({
|
|
2739
2751
|
brandName,
|
|
@@ -2748,6 +2760,9 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2748
2760
|
showUpgradeCard = false,
|
|
2749
2761
|
userInitials,
|
|
2750
2762
|
onInboxClick,
|
|
2763
|
+
// dark mode toggle
|
|
2764
|
+
darkMode = false,
|
|
2765
|
+
onDarkModeToggle,
|
|
2751
2766
|
// legacy compat
|
|
2752
2767
|
activeItem,
|
|
2753
2768
|
collapsed: collapsedProp,
|
|
@@ -2776,7 +2791,7 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2776
2791
|
const resolvedActiveId = activeId ?? activeItem ?? "";
|
|
2777
2792
|
const hasEntries = entries && entries.length > 0;
|
|
2778
2793
|
const hasFooterPromoContent = showShareCard || showUpgradeCard;
|
|
2779
|
-
const hasFooterBottomContent = !!(userInitials || onInboxClick);
|
|
2794
|
+
const hasFooterBottomContent = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
2780
2795
|
const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
|
|
2781
2796
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2782
2797
|
"nav",
|
|
@@ -2909,7 +2924,7 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2909
2924
|
{
|
|
2910
2925
|
className: [
|
|
2911
2926
|
"flex items-center pt-xs transition-all duration-300",
|
|
2912
|
-
collapsed ? "justify-center" : "justify-between"
|
|
2927
|
+
collapsed ? "justify-center flex-col gap-xs" : "justify-between"
|
|
2913
2928
|
].join(" "),
|
|
2914
2929
|
children: [
|
|
2915
2930
|
userInitials && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -2948,6 +2963,17 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2948
2963
|
}
|
|
2949
2964
|
)
|
|
2950
2965
|
}
|
|
2966
|
+
),
|
|
2967
|
+
onDarkModeToggle && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2968
|
+
Button,
|
|
2969
|
+
{
|
|
2970
|
+
variant: "ghost",
|
|
2971
|
+
size: "sm",
|
|
2972
|
+
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
2973
|
+
onClick: onDarkModeToggle,
|
|
2974
|
+
className: "!p-xs !rounded-sm flex-shrink-0",
|
|
2975
|
+
children: darkMode ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SunIcon2, {}) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MoonIcon2, {})
|
|
2976
|
+
}
|
|
2951
2977
|
)
|
|
2952
2978
|
]
|
|
2953
2979
|
}
|
|
@@ -2988,7 +3014,7 @@ var InboxIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { v
|
|
|
2988
3014
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12" }),
|
|
2989
3015
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
|
|
2990
3016
|
] });
|
|
2991
|
-
var
|
|
3017
|
+
var SunIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, "aria-hidden": "true", children: [
|
|
2992
3018
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2993
3019
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2994
3020
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
@@ -2999,7 +3025,7 @@ var SunIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { vie
|
|
|
2999
3025
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
3000
3026
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
3001
3027
|
] });
|
|
3002
|
-
var
|
|
3028
|
+
var MoonIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
3003
3029
|
var AppSidebarMobile = import_react11.default.forwardRef(
|
|
3004
3030
|
({
|
|
3005
3031
|
brandName = "Atoms",
|
|
@@ -3230,7 +3256,7 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3230
3256
|
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
3231
3257
|
onClick: onDarkModeToggle,
|
|
3232
3258
|
className: "!p-xs !rounded-sm",
|
|
3233
|
-
children: darkMode ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3259
|
+
children: darkMode ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SunIcon3, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MoonIcon3, {})
|
|
3234
3260
|
}
|
|
3235
3261
|
),
|
|
3236
3262
|
onInboxClick && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
@@ -4108,7 +4134,7 @@ var InspectIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", {
|
|
|
4108
4134
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 8v4l3 3" }),
|
|
4109
4135
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { cx: "12", cy: "12", r: "1", fill: "currentColor", stroke: "none" })
|
|
4110
4136
|
] });
|
|
4111
|
-
var
|
|
4137
|
+
var MoonIcon4 = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
4112
4138
|
var FullscreenIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4113
4139
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
4114
4140
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "9 21 3 21 3 15" }),
|
|
@@ -4225,7 +4251,7 @@ var PreviewToolbar = import_react18.default.forwardRef(
|
|
|
4225
4251
|
onClick: onDarkToggle,
|
|
4226
4252
|
className: "gap-xs rounded-xl",
|
|
4227
4253
|
children: [
|
|
4228
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MoonIcon4, {}),
|
|
4229
4255
|
"Dark"
|
|
4230
4256
|
]
|
|
4231
4257
|
}
|
package/dist/index.js
CHANGED
|
@@ -2683,6 +2683,18 @@ var SidebarIcon = () => /* @__PURE__ */ jsxs10("svg", { viewBox: "0 0 24 24", fi
|
|
|
2683
2683
|
/* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
2684
2684
|
/* @__PURE__ */ jsx10("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
|
|
2685
2685
|
] });
|
|
2686
|
+
var SunIcon2 = () => /* @__PURE__ */ jsxs10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: [
|
|
2687
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2688
|
+
/* @__PURE__ */ jsx10("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2689
|
+
/* @__PURE__ */ jsx10("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
2690
|
+
/* @__PURE__ */ jsx10("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
2691
|
+
/* @__PURE__ */ jsx10("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
2692
|
+
/* @__PURE__ */ jsx10("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
2693
|
+
/* @__PURE__ */ jsx10("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
2694
|
+
/* @__PURE__ */ jsx10("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
2695
|
+
/* @__PURE__ */ jsx10("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
2696
|
+
] });
|
|
2697
|
+
var MoonIcon2 = () => /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: /* @__PURE__ */ jsx10("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
2686
2698
|
var AppSidebar = React10.forwardRef(
|
|
2687
2699
|
({
|
|
2688
2700
|
brandName,
|
|
@@ -2697,6 +2709,9 @@ var AppSidebar = React10.forwardRef(
|
|
|
2697
2709
|
showUpgradeCard = false,
|
|
2698
2710
|
userInitials,
|
|
2699
2711
|
onInboxClick,
|
|
2712
|
+
// dark mode toggle
|
|
2713
|
+
darkMode = false,
|
|
2714
|
+
onDarkModeToggle,
|
|
2700
2715
|
// legacy compat
|
|
2701
2716
|
activeItem,
|
|
2702
2717
|
collapsed: collapsedProp,
|
|
@@ -2725,7 +2740,7 @@ var AppSidebar = React10.forwardRef(
|
|
|
2725
2740
|
const resolvedActiveId = activeId ?? activeItem ?? "";
|
|
2726
2741
|
const hasEntries = entries && entries.length > 0;
|
|
2727
2742
|
const hasFooterPromoContent = showShareCard || showUpgradeCard;
|
|
2728
|
-
const hasFooterBottomContent = !!(userInitials || onInboxClick);
|
|
2743
|
+
const hasFooterBottomContent = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
2729
2744
|
const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
|
|
2730
2745
|
return /* @__PURE__ */ jsxs10(
|
|
2731
2746
|
"nav",
|
|
@@ -2858,7 +2873,7 @@ var AppSidebar = React10.forwardRef(
|
|
|
2858
2873
|
{
|
|
2859
2874
|
className: [
|
|
2860
2875
|
"flex items-center pt-xs transition-all duration-300",
|
|
2861
|
-
collapsed ? "justify-center" : "justify-between"
|
|
2876
|
+
collapsed ? "justify-center flex-col gap-xs" : "justify-between"
|
|
2862
2877
|
].join(" "),
|
|
2863
2878
|
children: [
|
|
2864
2879
|
userInitials && /* @__PURE__ */ jsx10(
|
|
@@ -2897,6 +2912,17 @@ var AppSidebar = React10.forwardRef(
|
|
|
2897
2912
|
}
|
|
2898
2913
|
)
|
|
2899
2914
|
}
|
|
2915
|
+
),
|
|
2916
|
+
onDarkModeToggle && /* @__PURE__ */ jsx10(
|
|
2917
|
+
Button,
|
|
2918
|
+
{
|
|
2919
|
+
variant: "ghost",
|
|
2920
|
+
size: "sm",
|
|
2921
|
+
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
2922
|
+
onClick: onDarkModeToggle,
|
|
2923
|
+
className: "!p-xs !rounded-sm flex-shrink-0",
|
|
2924
|
+
children: darkMode ? /* @__PURE__ */ jsx10(SunIcon2, {}) : /* @__PURE__ */ jsx10(MoonIcon2, {})
|
|
2925
|
+
}
|
|
2900
2926
|
)
|
|
2901
2927
|
]
|
|
2902
2928
|
}
|
|
@@ -2937,7 +2963,7 @@ var InboxIcon2 = () => /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 24 24", fil
|
|
|
2937
2963
|
/* @__PURE__ */ jsx11("polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12" }),
|
|
2938
2964
|
/* @__PURE__ */ jsx11("path", { d: "M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
|
|
2939
2965
|
] });
|
|
2940
|
-
var
|
|
2966
|
+
var SunIcon3 = () => /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, "aria-hidden": "true", children: [
|
|
2941
2967
|
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2942
2968
|
/* @__PURE__ */ jsx11("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2943
2969
|
/* @__PURE__ */ jsx11("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
@@ -2948,7 +2974,7 @@ var SunIcon2 = () => /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 24 24", fill:
|
|
|
2948
2974
|
/* @__PURE__ */ jsx11("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
2949
2975
|
/* @__PURE__ */ jsx11("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
2950
2976
|
] });
|
|
2951
|
-
var
|
|
2977
|
+
var MoonIcon3 = () => /* @__PURE__ */ jsx11("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, "aria-hidden": "true", children: /* @__PURE__ */ jsx11("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
2952
2978
|
var AppSidebarMobile = React11.forwardRef(
|
|
2953
2979
|
({
|
|
2954
2980
|
brandName = "Atoms",
|
|
@@ -3179,7 +3205,7 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
3179
3205
|
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
3180
3206
|
onClick: onDarkModeToggle,
|
|
3181
3207
|
className: "!p-xs !rounded-sm",
|
|
3182
|
-
children: darkMode ? /* @__PURE__ */ jsx11(
|
|
3208
|
+
children: darkMode ? /* @__PURE__ */ jsx11(SunIcon3, {}) : /* @__PURE__ */ jsx11(MoonIcon3, {})
|
|
3183
3209
|
}
|
|
3184
3210
|
),
|
|
3185
3211
|
onInboxClick && /* @__PURE__ */ jsxs11(
|
|
@@ -4057,7 +4083,7 @@ var InspectIcon = () => /* @__PURE__ */ jsxs18("svg", { width: "15", height: "15
|
|
|
4057
4083
|
/* @__PURE__ */ jsx18("path", { d: "M12 8v4l3 3" }),
|
|
4058
4084
|
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "1", fill: "currentColor", stroke: "none" })
|
|
4059
4085
|
] });
|
|
4060
|
-
var
|
|
4086
|
+
var MoonIcon4 = () => /* @__PURE__ */ jsx18("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx18("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
4061
4087
|
var FullscreenIcon = () => /* @__PURE__ */ jsxs18("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4062
4088
|
/* @__PURE__ */ jsx18("polyline", { points: "15 3 21 3 21 9" }),
|
|
4063
4089
|
/* @__PURE__ */ jsx18("polyline", { points: "9 21 3 21 3 15" }),
|
|
@@ -4174,7 +4200,7 @@ var PreviewToolbar = React18.forwardRef(
|
|
|
4174
4200
|
onClick: onDarkToggle,
|
|
4175
4201
|
className: "gap-xs rounded-xl",
|
|
4176
4202
|
children: [
|
|
4177
|
-
/* @__PURE__ */ jsx18(
|
|
4203
|
+
/* @__PURE__ */ jsx18(MoonIcon4, {}),
|
|
4178
4204
|
"Dark"
|
|
4179
4205
|
]
|
|
4180
4206
|
}
|
package/package.json
CHANGED
|
@@ -39,6 +39,26 @@ const SidebarIcon = () => (
|
|
|
39
39
|
</svg>
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
+
const SunIcon = () => (
|
|
43
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
44
|
+
<circle cx="12" cy="12" r="5" />
|
|
45
|
+
<line x1="12" y1="1" x2="12" y2="3" />
|
|
46
|
+
<line x1="12" y1="21" x2="12" y2="23" />
|
|
47
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
|
48
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
|
49
|
+
<line x1="1" y1="12" x2="3" y2="12" />
|
|
50
|
+
<line x1="21" y1="12" x2="23" y2="12" />
|
|
51
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
|
52
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
|
53
|
+
</svg>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const MoonIcon = () => (
|
|
57
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
58
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
59
|
+
</svg>
|
|
60
|
+
);
|
|
61
|
+
|
|
42
62
|
/* ─── Types ──────────────────────────────────────────────────────────────── */
|
|
43
63
|
|
|
44
64
|
export interface NavSubItem {
|
|
@@ -114,6 +134,21 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
114
134
|
*/
|
|
115
135
|
onInboxClick?: () => void;
|
|
116
136
|
|
|
137
|
+
// ── Dark mode toggle ─────────────────────────────────────────────────────
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Whether dark mode is currently active. Controls which icon is shown
|
|
141
|
+
* (sun = dark mode on, moon = dark mode off).
|
|
142
|
+
*/
|
|
143
|
+
darkMode?: boolean;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* When provided, renders a dark/light mode toggle button in the footer row
|
|
147
|
+
* (last item, after the inbox button). Calls this when the user clicks it.
|
|
148
|
+
* If omitted the toggle button is not shown.
|
|
149
|
+
*/
|
|
150
|
+
onDarkModeToggle?: () => void;
|
|
151
|
+
|
|
117
152
|
// ── Legacy / backwards-compatible props ──────────────────────────────────
|
|
118
153
|
|
|
119
154
|
/** @deprecated Use activeId instead. */
|
|
@@ -146,6 +181,9 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
146
181
|
showUpgradeCard = false,
|
|
147
182
|
userInitials,
|
|
148
183
|
onInboxClick,
|
|
184
|
+
// dark mode toggle
|
|
185
|
+
darkMode = false,
|
|
186
|
+
onDarkModeToggle,
|
|
149
187
|
// legacy compat
|
|
150
188
|
activeItem,
|
|
151
189
|
collapsed: collapsedProp,
|
|
@@ -186,7 +224,7 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
186
224
|
|
|
187
225
|
/* ── Footer visibility ── */
|
|
188
226
|
const hasFooterPromoContent = showShareCard || showUpgradeCard;
|
|
189
|
-
const hasFooterBottomContent = !!(userInitials || onInboxClick);
|
|
227
|
+
const hasFooterBottomContent = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
190
228
|
const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
|
|
191
229
|
|
|
192
230
|
return (
|
|
@@ -346,12 +384,12 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
346
384
|
</div>
|
|
347
385
|
)}
|
|
348
386
|
|
|
349
|
-
{/* Bottom bar: user avatar + inbox
|
|
387
|
+
{/* Bottom bar: user avatar + inbox + dark mode toggle */}
|
|
350
388
|
{hasFooterBottomContent && (
|
|
351
389
|
<div
|
|
352
390
|
className={[
|
|
353
391
|
"flex items-center pt-xs transition-all duration-300",
|
|
354
|
-
collapsed ? "justify-center" : "justify-between",
|
|
392
|
+
collapsed ? "justify-center flex-col gap-xs" : "justify-between",
|
|
355
393
|
].join(" ")}
|
|
356
394
|
>
|
|
357
395
|
{/* User avatar — only when userInitials provided */}
|
|
@@ -387,6 +425,19 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
387
425
|
</Button>
|
|
388
426
|
</div>
|
|
389
427
|
)}
|
|
428
|
+
|
|
429
|
+
{/* Dark mode toggle — only when onDarkModeToggle provided */}
|
|
430
|
+
{onDarkModeToggle && (
|
|
431
|
+
<Button
|
|
432
|
+
variant="ghost"
|
|
433
|
+
size="sm"
|
|
434
|
+
aria-label={darkMode ? "Switch to light mode" : "Switch to dark mode"}
|
|
435
|
+
onClick={onDarkModeToggle}
|
|
436
|
+
className="!p-xs !rounded-sm flex-shrink-0"
|
|
437
|
+
>
|
|
438
|
+
{darkMode ? <SunIcon /> : <MoonIcon />}
|
|
439
|
+
</Button>
|
|
440
|
+
)}
|
|
390
441
|
</div>
|
|
391
442
|
)}
|
|
392
443
|
</div>
|
|
@@ -45,12 +45,13 @@ const SubFileIcon = () => (
|
|
|
45
45
|
</svg>
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
-
/* ─── Scenario A: Full sidebar with
|
|
48
|
+
/* ─── Scenario A: Full sidebar with dark mode toggle ────────────────────── */
|
|
49
49
|
|
|
50
50
|
function FullSidebarDemo() {
|
|
51
51
|
const [collapsed, setCollapsed] = React.useState(false);
|
|
52
52
|
const [activeId, setActiveId] = React.useState("projects");
|
|
53
53
|
const [activeSubId, setActiveSubId] = React.useState<string | undefined>("proj-alpha");
|
|
54
|
+
const [darkMode, setDarkMode] = React.useState(false);
|
|
54
55
|
const [subItems, setSubItems] = React.useState([
|
|
55
56
|
{ id: "proj-alpha", label: "Alpha", icon: <SubFileIcon /> },
|
|
56
57
|
{ id: "proj-beta", label: "Beta", icon: <SubFileIcon /> },
|
|
@@ -78,7 +79,7 @@ function FullSidebarDemo() {
|
|
|
78
79
|
return (
|
|
79
80
|
<div>
|
|
80
81
|
<p className="text-caption text-muted mb-sm">
|
|
81
|
-
Full footer · deletable sub-items
|
|
82
|
+
Full footer · deletable sub-items · dark mode toggle (moon/sun icon, last in footer row)
|
|
82
83
|
</p>
|
|
83
84
|
<div
|
|
84
85
|
className="relative flex bg-canvas rounded-xl border border-hairline shadow-card overflow-hidden"
|
|
@@ -97,12 +98,14 @@ function FullSidebarDemo() {
|
|
|
97
98
|
showShareCard
|
|
98
99
|
showUpgradeCard
|
|
99
100
|
userInitials="O"
|
|
100
|
-
onInboxClick={() =>
|
|
101
|
+
onInboxClick={() => {}}
|
|
102
|
+
darkMode={darkMode}
|
|
103
|
+
onDarkModeToggle={() => setDarkMode((d) => !d)}
|
|
101
104
|
/>
|
|
102
105
|
|
|
103
106
|
<div className="flex-1 flex flex-col items-center justify-center bg-surface-soft gap-md p-xl">
|
|
104
107
|
<p className="text-body-sm text-muted text-center">
|
|
105
|
-
{collapsed ? "Sidebar collapsed" : "Sidebar expanded"}
|
|
108
|
+
{collapsed ? "Sidebar collapsed" : "Sidebar expanded"} · {darkMode ? "Dark mode on" : "Dark mode off"}
|
|
106
109
|
</p>
|
|
107
110
|
<p className="text-caption text-muted-soft text-center">
|
|
108
111
|
Active: <strong>{activeId}</strong>
|
|
@@ -166,9 +169,10 @@ function MinimalSidebarDemo() {
|
|
|
166
169
|
);
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
/* ─── Scenario C: Partial footer — avatar + inbox only
|
|
172
|
+
/* ─── Scenario C: Partial footer — avatar + inbox + dark mode toggle only ─ */
|
|
170
173
|
|
|
171
174
|
function PartialFooterDemo() {
|
|
175
|
+
const [darkMode, setDarkMode] = React.useState(false);
|
|
172
176
|
const entries: NavEntry[] = [
|
|
173
177
|
{ id: "home", label: "Home", icon: <HomeIcon /> },
|
|
174
178
|
{ id: "starred", label: "Starred", icon: <StarIcon /> },
|
|
@@ -179,7 +183,7 @@ function PartialFooterDemo() {
|
|
|
179
183
|
return (
|
|
180
184
|
<div>
|
|
181
185
|
<p className="text-caption text-muted mb-sm">
|
|
182
|
-
Partial footer —
|
|
186
|
+
Partial footer — user avatar, inbox, and dark mode toggle (no promo cards)
|
|
183
187
|
</p>
|
|
184
188
|
<div
|
|
185
189
|
className="relative flex bg-canvas rounded-xl border border-hairline shadow-card overflow-hidden"
|
|
@@ -192,9 +196,11 @@ function PartialFooterDemo() {
|
|
|
192
196
|
onSelect={setActiveId}
|
|
193
197
|
userInitials="AJ"
|
|
194
198
|
onInboxClick={() => {}}
|
|
199
|
+
darkMode={darkMode}
|
|
200
|
+
onDarkModeToggle={() => setDarkMode((d) => !d)}
|
|
195
201
|
/>
|
|
196
202
|
<div className="flex-1 flex items-center justify-center bg-surface-soft">
|
|
197
|
-
<p className="text-body-sm text-muted">
|
|
203
|
+
<p className="text-body-sm text-muted">{darkMode ? "Dark mode on" : "Dark mode off"}</p>
|
|
198
204
|
</div>
|
|
199
205
|
</div>
|
|
200
206
|
</div>
|