@designa8/vibedesign-v6 1.10.1 → 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 +80 -28
- package/dist/index.js +80 -28
- package/package.json +1 -1
- package/src/atoms/AppSidebar/AppSidebar.tsx +54 -3
- package/src/atoms/AppSidebar/preview.tsx +13 -7
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +68 -23
- package/src/atoms/AppSidebarMobile/preview.tsx +30 -3
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,6 +3014,18 @@ 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
|
] });
|
|
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: [
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
3020
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
3021
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
3022
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
3027
|
+
] });
|
|
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" }) });
|
|
2991
3029
|
var AppSidebarMobile = import_react11.default.forwardRef(
|
|
2992
3030
|
({
|
|
2993
3031
|
brandName = "Atoms",
|
|
@@ -3001,6 +3039,8 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3001
3039
|
showUpgradeCard = false,
|
|
3002
3040
|
userInitials,
|
|
3003
3041
|
onInboxClick,
|
|
3042
|
+
darkMode = false,
|
|
3043
|
+
onDarkModeToggle,
|
|
3004
3044
|
open: openProp,
|
|
3005
3045
|
onOpenChange,
|
|
3006
3046
|
className
|
|
@@ -3040,6 +3080,7 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3040
3080
|
return () => clearTimeout(t);
|
|
3041
3081
|
}
|
|
3042
3082
|
}, [open]);
|
|
3083
|
+
const showFooterRow = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
3043
3084
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
3044
3085
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3045
3086
|
Button,
|
|
@@ -3090,8 +3131,6 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3090
3131
|
width: "min(280px, 85vw)",
|
|
3091
3132
|
display: "flex",
|
|
3092
3133
|
flexDirection: "column",
|
|
3093
|
-
/* Solid opaque fill — CSS var resolves from the project tokens;
|
|
3094
|
-
the inline style wins over any inherited transparency. */
|
|
3095
3134
|
backgroundColor: "var(--color-canvas)",
|
|
3096
3135
|
borderRight: "1px solid var(--color-hairline)",
|
|
3097
3136
|
boxShadow: "var(--shadow-lg)",
|
|
@@ -3198,7 +3237,7 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3198
3237
|
)
|
|
3199
3238
|
] }),
|
|
3200
3239
|
showUpgradeCard && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(UpgradeCard, { eyebrow: "", title: "Upgrade to Pro", subtitle: "Unlock more features" }),
|
|
3201
|
-
|
|
3240
|
+
showFooterRow && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between pt-xs", children: [
|
|
3202
3241
|
userInitials && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3203
3242
|
"span",
|
|
3204
3243
|
{
|
|
@@ -3208,27 +3247,40 @@ var AppSidebarMobile = import_react11.default.forwardRef(
|
|
|
3208
3247
|
children: userInitials
|
|
3209
3248
|
}
|
|
3210
3249
|
),
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-xs ml-auto", children: [
|
|
3251
|
+
onDarkModeToggle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3252
|
+
Button,
|
|
3253
|
+
{
|
|
3254
|
+
variant: "ghost",
|
|
3255
|
+
size: "sm",
|
|
3256
|
+
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
3257
|
+
onClick: onDarkModeToggle,
|
|
3258
|
+
className: "!p-xs !rounded-sm",
|
|
3259
|
+
children: darkMode ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SunIcon3, {}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MoonIcon3, {})
|
|
3260
|
+
}
|
|
3261
|
+
),
|
|
3262
|
+
onInboxClick && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3263
|
+
Button,
|
|
3264
|
+
{
|
|
3265
|
+
variant: "ghost",
|
|
3266
|
+
size: "sm",
|
|
3267
|
+
"aria-label": "Inbox",
|
|
3268
|
+
onClick: onInboxClick,
|
|
3269
|
+
className: "!p-xs !rounded-sm relative",
|
|
3270
|
+
children: [
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InboxIcon2, {}),
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3273
|
+
"span",
|
|
3274
|
+
{
|
|
3275
|
+
className: "absolute rounded-full bg-semantic-error",
|
|
3276
|
+
"aria-label": "New notifications",
|
|
3277
|
+
style: { width: "8px", height: "8px", top: "4px", right: "4px" }
|
|
3278
|
+
}
|
|
3279
|
+
)
|
|
3280
|
+
]
|
|
3281
|
+
}
|
|
3282
|
+
)
|
|
3283
|
+
] })
|
|
3232
3284
|
] })
|
|
3233
3285
|
]
|
|
3234
3286
|
}
|
|
@@ -4082,7 +4134,7 @@ var InspectIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", {
|
|
|
4082
4134
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 8v4l3 3" }),
|
|
4083
4135
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { cx: "12", cy: "12", r: "1", fill: "currentColor", stroke: "none" })
|
|
4084
4136
|
] });
|
|
4085
|
-
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" }) });
|
|
4086
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: [
|
|
4087
4139
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
4088
4140
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "9 21 3 21 3 15" }),
|
|
@@ -4199,7 +4251,7 @@ var PreviewToolbar = import_react18.default.forwardRef(
|
|
|
4199
4251
|
onClick: onDarkToggle,
|
|
4200
4252
|
className: "gap-xs rounded-xl",
|
|
4201
4253
|
children: [
|
|
4202
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MoonIcon4, {}),
|
|
4203
4255
|
"Dark"
|
|
4204
4256
|
]
|
|
4205
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,6 +2963,18 @@ 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
|
] });
|
|
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: [
|
|
2967
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2968
|
+
/* @__PURE__ */ jsx11("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2969
|
+
/* @__PURE__ */ jsx11("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
2970
|
+
/* @__PURE__ */ jsx11("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
2971
|
+
/* @__PURE__ */ jsx11("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
2972
|
+
/* @__PURE__ */ jsx11("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
2973
|
+
/* @__PURE__ */ jsx11("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
2974
|
+
/* @__PURE__ */ jsx11("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
2975
|
+
/* @__PURE__ */ jsx11("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
2976
|
+
] });
|
|
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" }) });
|
|
2940
2978
|
var AppSidebarMobile = React11.forwardRef(
|
|
2941
2979
|
({
|
|
2942
2980
|
brandName = "Atoms",
|
|
@@ -2950,6 +2988,8 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
2950
2988
|
showUpgradeCard = false,
|
|
2951
2989
|
userInitials,
|
|
2952
2990
|
onInboxClick,
|
|
2991
|
+
darkMode = false,
|
|
2992
|
+
onDarkModeToggle,
|
|
2953
2993
|
open: openProp,
|
|
2954
2994
|
onOpenChange,
|
|
2955
2995
|
className
|
|
@@ -2989,6 +3029,7 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
2989
3029
|
return () => clearTimeout(t);
|
|
2990
3030
|
}
|
|
2991
3031
|
}, [open]);
|
|
3032
|
+
const showFooterRow = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
2992
3033
|
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2993
3034
|
/* @__PURE__ */ jsx11("div", { ref, className, children: /* @__PURE__ */ jsx11(
|
|
2994
3035
|
Button,
|
|
@@ -3039,8 +3080,6 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
3039
3080
|
width: "min(280px, 85vw)",
|
|
3040
3081
|
display: "flex",
|
|
3041
3082
|
flexDirection: "column",
|
|
3042
|
-
/* Solid opaque fill — CSS var resolves from the project tokens;
|
|
3043
|
-
the inline style wins over any inherited transparency. */
|
|
3044
3083
|
backgroundColor: "var(--color-canvas)",
|
|
3045
3084
|
borderRight: "1px solid var(--color-hairline)",
|
|
3046
3085
|
boxShadow: "var(--shadow-lg)",
|
|
@@ -3147,7 +3186,7 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
3147
3186
|
)
|
|
3148
3187
|
] }),
|
|
3149
3188
|
showUpgradeCard && /* @__PURE__ */ jsx11(UpgradeCard, { eyebrow: "", title: "Upgrade to Pro", subtitle: "Unlock more features" }),
|
|
3150
|
-
|
|
3189
|
+
showFooterRow && /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between pt-xs", children: [
|
|
3151
3190
|
userInitials && /* @__PURE__ */ jsx11(
|
|
3152
3191
|
"span",
|
|
3153
3192
|
{
|
|
@@ -3157,27 +3196,40 @@ var AppSidebarMobile = React11.forwardRef(
|
|
|
3157
3196
|
children: userInitials
|
|
3158
3197
|
}
|
|
3159
3198
|
),
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
/* @__PURE__ */ jsx11(
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3199
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-xs ml-auto", children: [
|
|
3200
|
+
onDarkModeToggle && /* @__PURE__ */ jsx11(
|
|
3201
|
+
Button,
|
|
3202
|
+
{
|
|
3203
|
+
variant: "ghost",
|
|
3204
|
+
size: "sm",
|
|
3205
|
+
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
3206
|
+
onClick: onDarkModeToggle,
|
|
3207
|
+
className: "!p-xs !rounded-sm",
|
|
3208
|
+
children: darkMode ? /* @__PURE__ */ jsx11(SunIcon3, {}) : /* @__PURE__ */ jsx11(MoonIcon3, {})
|
|
3209
|
+
}
|
|
3210
|
+
),
|
|
3211
|
+
onInboxClick && /* @__PURE__ */ jsxs11(
|
|
3212
|
+
Button,
|
|
3213
|
+
{
|
|
3214
|
+
variant: "ghost",
|
|
3215
|
+
size: "sm",
|
|
3216
|
+
"aria-label": "Inbox",
|
|
3217
|
+
onClick: onInboxClick,
|
|
3218
|
+
className: "!p-xs !rounded-sm relative",
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ jsx11(InboxIcon2, {}),
|
|
3221
|
+
/* @__PURE__ */ jsx11(
|
|
3222
|
+
"span",
|
|
3223
|
+
{
|
|
3224
|
+
className: "absolute rounded-full bg-semantic-error",
|
|
3225
|
+
"aria-label": "New notifications",
|
|
3226
|
+
style: { width: "8px", height: "8px", top: "4px", right: "4px" }
|
|
3227
|
+
}
|
|
3228
|
+
)
|
|
3229
|
+
]
|
|
3230
|
+
}
|
|
3231
|
+
)
|
|
3232
|
+
] })
|
|
3181
3233
|
] })
|
|
3182
3234
|
]
|
|
3183
3235
|
}
|
|
@@ -4031,7 +4083,7 @@ var InspectIcon = () => /* @__PURE__ */ jsxs18("svg", { width: "15", height: "15
|
|
|
4031
4083
|
/* @__PURE__ */ jsx18("path", { d: "M12 8v4l3 3" }),
|
|
4032
4084
|
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "1", fill: "currentColor", stroke: "none" })
|
|
4033
4085
|
] });
|
|
4034
|
-
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" }) });
|
|
4035
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: [
|
|
4036
4088
|
/* @__PURE__ */ jsx18("polyline", { points: "15 3 21 3 21 9" }),
|
|
4037
4089
|
/* @__PURE__ */ jsx18("polyline", { points: "9 21 3 21 3 15" }),
|
|
@@ -4148,7 +4200,7 @@ var PreviewToolbar = React18.forwardRef(
|
|
|
4148
4200
|
onClick: onDarkToggle,
|
|
4149
4201
|
className: "gap-xs rounded-xl",
|
|
4150
4202
|
children: [
|
|
4151
|
-
/* @__PURE__ */ jsx18(
|
|
4203
|
+
/* @__PURE__ */ jsx18(MoonIcon4, {}),
|
|
4152
4204
|
"Dark"
|
|
4153
4205
|
]
|
|
4154
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>
|
|
@@ -47,6 +47,28 @@ const InboxIcon = () => (
|
|
|
47
47
|
</svg>
|
|
48
48
|
);
|
|
49
49
|
|
|
50
|
+
/** Sun icon — shown when darkMode is true (click to switch to light) */
|
|
51
|
+
const SunIcon = () => (
|
|
52
|
+
<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">
|
|
53
|
+
<circle cx="12" cy="12" r="5" />
|
|
54
|
+
<line x1="12" y1="1" x2="12" y2="3" />
|
|
55
|
+
<line x1="12" y1="21" x2="12" y2="23" />
|
|
56
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
|
57
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
|
58
|
+
<line x1="1" y1="12" x2="3" y2="12" />
|
|
59
|
+
<line x1="21" y1="12" x2="23" y2="12" />
|
|
60
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
|
61
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
/** Moon icon — shown when darkMode is false (click to switch to dark) */
|
|
66
|
+
const MoonIcon = () => (
|
|
67
|
+
<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">
|
|
68
|
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
|
69
|
+
</svg>
|
|
70
|
+
);
|
|
71
|
+
|
|
50
72
|
/* ─── Types ─────────────────────────────────────────────────────────────── */
|
|
51
73
|
|
|
52
74
|
export interface MobileNavSubItem {
|
|
@@ -74,6 +96,10 @@ export interface AppSidebarMobileProps {
|
|
|
74
96
|
showUpgradeCard?: boolean;
|
|
75
97
|
userInitials?: string;
|
|
76
98
|
onInboxClick?: () => void;
|
|
99
|
+
/** Whether dark mode is currently active. Used to pick sun vs moon icon. */
|
|
100
|
+
darkMode?: boolean;
|
|
101
|
+
/** When provided, renders a dark-mode toggle button in the footer. */
|
|
102
|
+
onDarkModeToggle?: () => void;
|
|
77
103
|
open?: boolean;
|
|
78
104
|
onOpenChange?: (open: boolean) => void;
|
|
79
105
|
className?: string;
|
|
@@ -95,6 +121,8 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
95
121
|
showUpgradeCard = false,
|
|
96
122
|
userInitials,
|
|
97
123
|
onInboxClick,
|
|
124
|
+
darkMode = false,
|
|
125
|
+
onDarkModeToggle,
|
|
98
126
|
open: openProp,
|
|
99
127
|
onOpenChange,
|
|
100
128
|
className,
|
|
@@ -143,6 +171,9 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
143
171
|
}
|
|
144
172
|
}, [open]);
|
|
145
173
|
|
|
174
|
+
/* ── Whether the footer row should be rendered at all ── */
|
|
175
|
+
const showFooterRow = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
176
|
+
|
|
146
177
|
return (
|
|
147
178
|
<>
|
|
148
179
|
{/* ── Trigger ── */}
|
|
@@ -188,10 +219,7 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
188
219
|
}}
|
|
189
220
|
/>
|
|
190
221
|
|
|
191
|
-
{/* Drawer panel
|
|
192
|
-
KEY FIX: background-color is set BOTH as a Tailwind class AND
|
|
193
|
-
as an inline style with a CSS var + html fallback so it is
|
|
194
|
-
always fully opaque — never transparent. */}
|
|
222
|
+
{/* Drawer panel */}
|
|
195
223
|
<div
|
|
196
224
|
style={{
|
|
197
225
|
position: "absolute",
|
|
@@ -201,8 +229,6 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
201
229
|
width: "min(280px, 85vw)",
|
|
202
230
|
display: "flex",
|
|
203
231
|
flexDirection: "column",
|
|
204
|
-
/* Solid opaque fill — CSS var resolves from the project tokens;
|
|
205
|
-
the inline style wins over any inherited transparency. */
|
|
206
232
|
backgroundColor: "var(--color-canvas)",
|
|
207
233
|
borderRight: "1px solid var(--color-hairline)",
|
|
208
234
|
boxShadow: "var(--shadow-lg)",
|
|
@@ -311,8 +337,9 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
311
337
|
<UpgradeCard eyebrow="" title="Upgrade to Pro" subtitle="Unlock more features" />
|
|
312
338
|
)}
|
|
313
339
|
|
|
314
|
-
{
|
|
340
|
+
{showFooterRow && (
|
|
315
341
|
<div className="flex items-center justify-between pt-xs">
|
|
342
|
+
{/* User avatar */}
|
|
316
343
|
{userInitials && (
|
|
317
344
|
<span
|
|
318
345
|
className="flex items-center justify-center rounded-full bg-primary text-on-primary text-body-sm font-weight-heading-sm cursor-pointer hover:bg-primary-hover transition-colors duration-150"
|
|
@@ -322,22 +349,40 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
322
349
|
{userInitials}
|
|
323
350
|
</span>
|
|
324
351
|
)}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
className="
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
352
|
+
|
|
353
|
+
{/* Right-side icon group */}
|
|
354
|
+
<div className="flex items-center gap-xs ml-auto">
|
|
355
|
+
{/* Dark mode toggle — only rendered when callback is provided */}
|
|
356
|
+
{onDarkModeToggle && (
|
|
357
|
+
<Button
|
|
358
|
+
variant="ghost"
|
|
359
|
+
size="sm"
|
|
360
|
+
aria-label={darkMode ? "Switch to light mode" : "Switch to dark mode"}
|
|
361
|
+
onClick={onDarkModeToggle}
|
|
362
|
+
className="!p-xs !rounded-sm"
|
|
363
|
+
>
|
|
364
|
+
{darkMode ? <SunIcon /> : <MoonIcon />}
|
|
365
|
+
</Button>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{/* Inbox button */}
|
|
369
|
+
{onInboxClick && (
|
|
370
|
+
<Button
|
|
371
|
+
variant="ghost"
|
|
372
|
+
size="sm"
|
|
373
|
+
aria-label="Inbox"
|
|
374
|
+
onClick={onInboxClick}
|
|
375
|
+
className="!p-xs !rounded-sm relative"
|
|
376
|
+
>
|
|
377
|
+
<InboxIcon />
|
|
378
|
+
<span
|
|
379
|
+
className="absolute rounded-full bg-semantic-error"
|
|
380
|
+
aria-label="New notifications"
|
|
381
|
+
style={{ width: "8px", height: "8px", top: "4px", right: "4px" }}
|
|
382
|
+
/>
|
|
383
|
+
</Button>
|
|
384
|
+
)}
|
|
385
|
+
</div>
|
|
341
386
|
</div>
|
|
342
387
|
)}
|
|
343
388
|
</div>
|
|
@@ -30,14 +30,15 @@ const ENTRIES = [
|
|
|
30
30
|
|
|
31
31
|
export default function Preview() {
|
|
32
32
|
const [activeId, setActiveId] = React.useState("home");
|
|
33
|
+
const [isDark, setIsDark] = React.useState(false);
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
36
|
-
{/*
|
|
37
|
+
{/* Basic usage — no dark mode toggle */}
|
|
37
38
|
<div className="rounded-xl bg-surface border border-hairline p-lg flex items-center justify-between gap-md">
|
|
38
39
|
<div>
|
|
39
|
-
<p className="text-body-sm font-weight-heading-sm text-ink mb-xs">
|
|
40
|
-
<p className="text-caption text-muted">Tap the hamburger
|
|
40
|
+
<p className="text-body-sm font-weight-heading-sm text-ink mb-xs">Default (no toggle)</p>
|
|
41
|
+
<p className="text-caption text-muted">Tap the hamburger to open the drawer. No dark-mode button shown.</p>
|
|
41
42
|
</div>
|
|
42
43
|
<AppSidebarMobile
|
|
43
44
|
brandName="Atoms"
|
|
@@ -52,6 +53,30 @@ export default function Preview() {
|
|
|
52
53
|
/>
|
|
53
54
|
</div>
|
|
54
55
|
|
|
56
|
+
{/* With dark mode toggle */}
|
|
57
|
+
<div className="rounded-xl bg-surface border border-hairline p-lg flex items-center justify-between gap-md">
|
|
58
|
+
<div>
|
|
59
|
+
<p className="text-body-sm font-weight-heading-sm text-ink mb-xs">With dark-mode toggle</p>
|
|
60
|
+
<p className="text-caption text-muted">
|
|
61
|
+
Opens the drawer and shows a sun/moon icon button in the footer row.
|
|
62
|
+
Currently: <strong>{isDark ? "dark" : "light"}</strong>
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
65
|
+
<AppSidebarMobile
|
|
66
|
+
brandName="Atoms"
|
|
67
|
+
entries={ENTRIES}
|
|
68
|
+
activeId={activeId}
|
|
69
|
+
onSelect={setActiveId}
|
|
70
|
+
workspaceName="Hello Designer"
|
|
71
|
+
showShareCard
|
|
72
|
+
showUpgradeCard
|
|
73
|
+
userInitials="N"
|
|
74
|
+
onInboxClick={() => {}}
|
|
75
|
+
darkMode={isDark}
|
|
76
|
+
onDarkModeToggle={() => setIsDark((d) => !d)}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
55
80
|
{/* Simulated mobile frame */}
|
|
56
81
|
<div
|
|
57
82
|
className="mx-auto rounded-xl overflow-hidden border border-hairline bg-surface-soft"
|
|
@@ -69,6 +94,8 @@ export default function Preview() {
|
|
|
69
94
|
showUpgradeCard
|
|
70
95
|
userInitials="N"
|
|
71
96
|
onInboxClick={() => {}}
|
|
97
|
+
darkMode={isDark}
|
|
98
|
+
onDarkModeToggle={() => setIsDark((d) => !d)}
|
|
72
99
|
/>
|
|
73
100
|
<span className="text-body-sm font-weight-heading-sm text-ink">Atoms</span>
|
|
74
101
|
<span
|