@sckyzo/cosmos-react 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs +180 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +180 -72
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -853,6 +853,8 @@ var Shell = ({
|
|
|
853
853
|
onCollapsedChange,
|
|
854
854
|
collapseControl = "topbar",
|
|
855
855
|
container = "fluid",
|
|
856
|
+
variant = "attached",
|
|
857
|
+
sidebarGutter,
|
|
856
858
|
defaultSidebarOpen = false,
|
|
857
859
|
sidebarOpen: controlledOpen,
|
|
858
860
|
onSidebarOpenChange,
|
|
@@ -879,10 +881,22 @@ var Shell = ({
|
|
|
879
881
|
wasMobile.current = isMobile;
|
|
880
882
|
}, [isMobile, open, setOpen]);
|
|
881
883
|
const navId = useId();
|
|
884
|
+
const gutter = sidebarGutter ?? (variant === "floating" ? "tight" : "default");
|
|
882
885
|
const shell = useMemo(
|
|
883
|
-
() => ({
|
|
884
|
-
|
|
886
|
+
() => ({
|
|
887
|
+
collapsed,
|
|
888
|
+
setCollapsed,
|
|
889
|
+
isMobile,
|
|
890
|
+
open,
|
|
891
|
+
setOpen,
|
|
892
|
+
navId,
|
|
893
|
+
collapseControl,
|
|
894
|
+
variant,
|
|
895
|
+
sidebarGutter: gutter
|
|
896
|
+
}),
|
|
897
|
+
[collapsed, setCollapsed, isMobile, open, setOpen, navId, collapseControl, variant, gutter]
|
|
885
898
|
);
|
|
899
|
+
const floating = variant === "floating" && !isMobile;
|
|
886
900
|
const layout = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
887
901
|
sidebar && (isMobile ? (
|
|
888
902
|
// Off screen until opened. The Drawer brings the portal, scrim, focus trap, Escape
|
|
@@ -900,24 +914,34 @@ var Shell = ({
|
|
|
900
914
|
}
|
|
901
915
|
)
|
|
902
916
|
) : /* @__PURE__ */ jsx("aside", { className: "shrink-0", children: sidebar })),
|
|
903
|
-
/* @__PURE__ */ jsxs(
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
"
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
917
|
+
/* @__PURE__ */ jsxs(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
className: clsx(
|
|
921
|
+
"flex min-w-0 flex-1 flex-col",
|
|
922
|
+
floating && "overflow-hidden rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-panel)] shadow-sm"
|
|
923
|
+
),
|
|
924
|
+
"data-shell-panel": floating ? "" : void 0,
|
|
925
|
+
children: [
|
|
926
|
+
topbar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topbar }),
|
|
927
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-auto lg:flex-row lg:overflow-visible", children: [
|
|
928
|
+
/* @__PURE__ */ jsx("main", { className: "min-w-0 flex-1 lg:overflow-auto", children }),
|
|
929
|
+
secondary && /* @__PURE__ */ jsx(
|
|
930
|
+
"aside",
|
|
931
|
+
{
|
|
932
|
+
className: clsx(
|
|
933
|
+
"shrink-0 border-t border-[var(--color-border)] lg:overflow-auto lg:border-s lg:border-t-0",
|
|
934
|
+
// `max-lg:` sorts after the plain width utility: full width while stacked.
|
|
935
|
+
secondaryWidthClassName,
|
|
936
|
+
"max-lg:w-full"
|
|
937
|
+
),
|
|
938
|
+
children: secondary
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
] })
|
|
942
|
+
]
|
|
943
|
+
}
|
|
944
|
+
)
|
|
921
945
|
] });
|
|
922
946
|
return /* @__PURE__ */ jsx(ShellContext.Provider, { value: sidebar ? shell : null, children: /* @__PURE__ */ jsx(
|
|
923
947
|
"div",
|
|
@@ -925,12 +949,23 @@ var Shell = ({
|
|
|
925
949
|
className: clsx(
|
|
926
950
|
"flex h-screen w-screen overflow-hidden bg-[var(--color-bg-base)] text-[var(--color-text-base)]",
|
|
927
951
|
container === "boxed" && "justify-center",
|
|
952
|
+
// Floating: 10px around and between the two cards.
|
|
953
|
+
floating && container === "fluid" && "gap-2.5 p-2.5",
|
|
928
954
|
className
|
|
929
955
|
),
|
|
930
956
|
children: container === "boxed" ? (
|
|
931
957
|
// The column's hairlines only show where the page background does: the window is
|
|
932
958
|
// wider than the column.
|
|
933
|
-
/* @__PURE__ */ jsx(
|
|
959
|
+
/* @__PURE__ */ jsx(
|
|
960
|
+
"div",
|
|
961
|
+
{
|
|
962
|
+
className: clsx(
|
|
963
|
+
"flex h-full w-full max-w-[1440px] min-w-0 border-[var(--color-border)] min-[1441px]:border-x",
|
|
964
|
+
floating && "gap-2.5 p-2.5"
|
|
965
|
+
),
|
|
966
|
+
children: layout
|
|
967
|
+
}
|
|
968
|
+
)
|
|
934
969
|
) : layout
|
|
935
970
|
}
|
|
936
971
|
) });
|
|
@@ -2092,6 +2127,8 @@ var useKeepFocus = () => {
|
|
|
2092
2127
|
hadFocus.current = false;
|
|
2093
2128
|
}, []);
|
|
2094
2129
|
};
|
|
2130
|
+
var GUTTER = "var(--cosmos-sidebar-gutter,20px)";
|
|
2131
|
+
var TIGHT_GUTTER = "10px";
|
|
2095
2132
|
var COMPACT_WIDTH = 88;
|
|
2096
2133
|
var SidebarContext = createContext({
|
|
2097
2134
|
collapsed: false,
|
|
@@ -2110,32 +2147,41 @@ var useSidebarCollapsed = (override) => {
|
|
|
2110
2147
|
};
|
|
2111
2148
|
var SidebarDepthContext = createContext(0);
|
|
2112
2149
|
var ROW_INSET = {
|
|
2113
|
-
wide: {
|
|
2114
|
-
|
|
2115
|
-
|
|
2150
|
+
wide: {
|
|
2151
|
+
margin: "mx-[var(--cosmos-sidebar-gutter,20px)]",
|
|
2152
|
+
width: "w-[calc(100%-2*var(--cosmos-sidebar-gutter,20px))]",
|
|
2153
|
+
px: GUTTER
|
|
2154
|
+
},
|
|
2155
|
+
tight: { margin: "mx-2", width: "w-[calc(100%-1rem)]", px: "8px" },
|
|
2156
|
+
none: { margin: "mx-0", width: "w-full", px: "0px" }
|
|
2116
2157
|
};
|
|
2158
|
+
var ROW_PADDING = 12;
|
|
2159
|
+
var ICON = 16;
|
|
2160
|
+
var TOP_LABEL = ROW_PADDING + ICON + 12;
|
|
2117
2161
|
var LEVEL = [
|
|
2118
|
-
{ text: "text-sm", py: "py-row-10" },
|
|
2119
2162
|
{ text: "text-sm", py: "py-row-6" },
|
|
2120
|
-
{ text: "text-
|
|
2121
|
-
{ text: "text-xs", py: "py-row-5" }
|
|
2163
|
+
{ text: "text-sm", py: "py-row-4" },
|
|
2164
|
+
{ text: "text-xs", py: "py-row-5" },
|
|
2165
|
+
{ text: "text-xs", py: "py-row-4" }
|
|
2122
2166
|
];
|
|
2123
2167
|
var level = (depth) => LEVEL[Math.min(depth, LEVEL.length - 1)];
|
|
2124
2168
|
var NESTED_PADDING = 10;
|
|
2125
2169
|
var useNestedGeometry = (inset) => {
|
|
2126
2170
|
const { labelOrigin } = useContext(SidebarContext);
|
|
2127
|
-
const
|
|
2128
|
-
const
|
|
2171
|
+
const margin = ROW_INSET[inset].px;
|
|
2172
|
+
const at = (px2) => labelOrigin === void 0 ? `calc(${margin} + ${px2}px)` : `${labelOrigin + px2 - TOP_LABEL}px`;
|
|
2173
|
+
const labelX = (depth) => TOP_LABEL + 16 * (depth - 1);
|
|
2129
2174
|
return {
|
|
2130
2175
|
/** Margin (and, for a `<button>`, width) that puts a nested row's pill at its own indent. */
|
|
2131
2176
|
rowStyle: (depth, button) => {
|
|
2132
|
-
const left = labelX(depth) - NESTED_PADDING;
|
|
2133
|
-
return button ? { marginInlineStart: left, width: `calc(100% - ${left
|
|
2177
|
+
const left = at(labelX(depth) - NESTED_PADDING);
|
|
2178
|
+
return button ? { marginInlineStart: left, width: `calc(100% - ${left} - ${margin})` } : { marginInlineStart: left };
|
|
2134
2179
|
},
|
|
2135
2180
|
/** The guide line under a row's children: under a top-level icon, or 4 px before the label. */
|
|
2136
|
-
guideStart: (depth) => depth === 0 ?
|
|
2181
|
+
guideStart: (depth) => depth === 0 ? at(ROW_PADDING + ICON / 2) : at(labelX(depth) - 4)
|
|
2137
2182
|
};
|
|
2138
2183
|
};
|
|
2184
|
+
var RAIL_ROW = "mx-auto mb-1 size-ctrl-36 justify-center text-sm";
|
|
2139
2185
|
var ACTIVE_ROW = {
|
|
2140
2186
|
tint: "bg-brand-500/10 text-brand-600 dark:text-brand-400",
|
|
2141
2187
|
solid: "bg-brand-500 text-white"
|
|
@@ -2177,7 +2223,7 @@ var CompactLabel = ({
|
|
|
2177
2223
|
var CompactTip = ({ label, children }) => /* @__PURE__ */ jsx(Tooltip, { content: label, position: "end", block: true, children });
|
|
2178
2224
|
var FOOTER_DIVIDER = {
|
|
2179
2225
|
full: "border-t border-[var(--color-border)]",
|
|
2180
|
-
inset: "relative before:absolute before:inset-x-
|
|
2226
|
+
inset: "relative before:absolute before:inset-x-[var(--cosmos-sidebar-gutter,20px)] before:top-0 before:h-px before:bg-[var(--color-border)]",
|
|
2181
2227
|
none: ""
|
|
2182
2228
|
};
|
|
2183
2229
|
var SidebarRoot = ({
|
|
@@ -2192,6 +2238,8 @@ var SidebarRoot = ({
|
|
|
2192
2238
|
footer,
|
|
2193
2239
|
footerDivider = "full",
|
|
2194
2240
|
activeStyle = "tint",
|
|
2241
|
+
gutter: gutterProp,
|
|
2242
|
+
edgeToggle: edgeToggleProp,
|
|
2195
2243
|
onCollapsedChange,
|
|
2196
2244
|
className
|
|
2197
2245
|
}) => {
|
|
@@ -2205,6 +2253,10 @@ var SidebarRoot = ({
|
|
|
2205
2253
|
const inDrawer = shell?.isMobile === true;
|
|
2206
2254
|
const compact = variant === "compact" && !inDrawer;
|
|
2207
2255
|
const collapsed = inDrawer || compact ? false : shell ? shell.collapsed : ownCollapsed;
|
|
2256
|
+
const floating = shell?.variant === "floating" && !inDrawer;
|
|
2257
|
+
const gutter = gutterProp ?? shell?.sidebarGutter ?? "default";
|
|
2258
|
+
const edgeToggle = (edgeToggleProp ?? floating) && !inDrawer && !compact;
|
|
2259
|
+
const toggleCollapsed = () => shell ? shell.setCollapsed(!shell.collapsed) : setOwnCollapsed(!ownCollapsed);
|
|
2208
2260
|
const ownNavId = useId();
|
|
2209
2261
|
const navId = shell ? shell.navId : ownNavId;
|
|
2210
2262
|
const showToggle = !inDrawer && !compact && (onCollapsedChange !== void 0 || shell?.collapseControl === "sidebar");
|
|
@@ -2232,11 +2284,15 @@ var SidebarRoot = ({
|
|
|
2232
2284
|
ref: navRef,
|
|
2233
2285
|
id: navId,
|
|
2234
2286
|
"aria-label": "Main navigation",
|
|
2235
|
-
style:
|
|
2287
|
+
style: {
|
|
2288
|
+
...inDrawer ? {} : { width: compact ? COMPACT_WIDTH : rail ? collapsedWidth : fit.width },
|
|
2289
|
+
...gutter === "tight" ? { "--cosmos-sidebar-gutter": TIGHT_GUTTER } : {}
|
|
2290
|
+
},
|
|
2236
2291
|
className: clsx(
|
|
2237
|
-
"flex h-full flex-col overflow-hidden bg-[var(--color-bg-panel)]",
|
|
2238
|
-
// The drawer panel draws the edge and the shadow, and sets the width.
|
|
2239
|
-
|
|
2292
|
+
"relative flex h-full flex-col overflow-hidden bg-[var(--color-bg-panel)]",
|
|
2293
|
+
// The drawer panel draws the edge and the shadow, and sets the width. Floating, the
|
|
2294
|
+
// sidebar is a card of its own.
|
|
2295
|
+
inDrawer ? "w-full" : floating ? "rounded-xl border border-[var(--color-border)] shadow-sm" : "border-e border-[var(--color-border)]",
|
|
2240
2296
|
// Not before the first frames: the width measured at mount shows at once.
|
|
2241
2297
|
fit.animated && clsx(
|
|
2242
2298
|
overlay ? "transition-[width,box-shadow]" : "transition-[width]",
|
|
@@ -2250,14 +2306,33 @@ var SidebarRoot = ({
|
|
|
2250
2306
|
...hover.props,
|
|
2251
2307
|
children: [
|
|
2252
2308
|
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-x-hidden overflow-y-auto", children }),
|
|
2309
|
+
edgeToggle && // Mouse only: hidden from assistive technology and out of the tab order, since the
|
|
2310
|
+
// toggles already do the job by keyboard. The line shows under the pointer.
|
|
2311
|
+
/* @__PURE__ */ jsx(
|
|
2312
|
+
"button",
|
|
2313
|
+
{
|
|
2314
|
+
type: "button",
|
|
2315
|
+
tabIndex: -1,
|
|
2316
|
+
"aria-hidden": true,
|
|
2317
|
+
"data-sidebar-edge": "",
|
|
2318
|
+
onClick: toggleCollapsed,
|
|
2319
|
+
title: collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2320
|
+
className: clsx(
|
|
2321
|
+
"group/edge absolute inset-y-0 end-0 z-10 w-2",
|
|
2322
|
+
collapsed ? "cursor-e-resize rtl:cursor-w-resize" : "cursor-w-resize rtl:cursor-e-resize"
|
|
2323
|
+
),
|
|
2324
|
+
children: /* @__PURE__ */ jsx("span", { className: "group-hover/edge:bg-brand-500 absolute inset-y-3 end-0 w-0.5 rounded-full bg-transparent transition-colors" })
|
|
2325
|
+
}
|
|
2326
|
+
),
|
|
2253
2327
|
footer && /* @__PURE__ */ jsx(
|
|
2254
2328
|
"div",
|
|
2255
2329
|
{
|
|
2256
2330
|
className: clsx(
|
|
2257
2331
|
"shrink-0 overflow-hidden",
|
|
2258
|
-
compact ? "p-2" : "p-3",
|
|
2332
|
+
compact ? "p-2" : rail ? "p-3" : "py-3",
|
|
2259
2333
|
FOOTER_DIVIDER[footerDivider]
|
|
2260
2334
|
),
|
|
2335
|
+
style: compact || rail ? void 0 : { paddingInline: `max(0px, calc(${GUTTER} - 8px))` },
|
|
2261
2336
|
children: /* @__PURE__ */ jsx(
|
|
2262
2337
|
SidebarContext.Provider,
|
|
2263
2338
|
{
|
|
@@ -2344,9 +2419,10 @@ var SidebarBrand = ({
|
|
|
2344
2419
|
const baseClass = clsx(
|
|
2345
2420
|
"focus-visible:focus-indicator flex h-[72px] items-center focus-visible:ring-inset",
|
|
2346
2421
|
// The logo alone has the row to itself: centred, with no gap for the hidden title.
|
|
2347
|
-
compact ? "justify-center" : "gap-3 px-5",
|
|
2422
|
+
compact ? "justify-center" : collapsed ? "gap-3 px-5" : "gap-3",
|
|
2348
2423
|
inDrawer ? "min-w-0 flex-1" : clsx("shrink-0", divider && "border-b border-[var(--color-border)]")
|
|
2349
2424
|
);
|
|
2425
|
+
const brandStyle = compact || collapsed ? void 0 : { paddingInline: `calc(${GUTTER} + 2px) ${GUTTER}` };
|
|
2350
2426
|
const marker = inDrawer || !divider ? void 0 : "";
|
|
2351
2427
|
let brand;
|
|
2352
2428
|
if (href) {
|
|
@@ -2356,7 +2432,9 @@ var SidebarBrand = ({
|
|
|
2356
2432
|
ref,
|
|
2357
2433
|
href,
|
|
2358
2434
|
className: baseClass,
|
|
2435
|
+
style: brandStyle,
|
|
2359
2436
|
"data-sidebar-brand": marker,
|
|
2437
|
+
"data-sidebar-head": "",
|
|
2360
2438
|
children: inner
|
|
2361
2439
|
}
|
|
2362
2440
|
);
|
|
@@ -2368,12 +2446,24 @@ var SidebarBrand = ({
|
|
|
2368
2446
|
type: "button",
|
|
2369
2447
|
onClick,
|
|
2370
2448
|
className: clsx(baseClass, "w-full text-start"),
|
|
2449
|
+
style: brandStyle,
|
|
2371
2450
|
"data-sidebar-brand": marker,
|
|
2451
|
+
"data-sidebar-head": "",
|
|
2372
2452
|
children: inner
|
|
2373
2453
|
}
|
|
2374
2454
|
);
|
|
2375
2455
|
} else {
|
|
2376
|
-
brand = /* @__PURE__ */ jsx(
|
|
2456
|
+
brand = /* @__PURE__ */ jsx(
|
|
2457
|
+
"div",
|
|
2458
|
+
{
|
|
2459
|
+
ref,
|
|
2460
|
+
className: baseClass,
|
|
2461
|
+
style: brandStyle,
|
|
2462
|
+
"data-sidebar-brand": marker,
|
|
2463
|
+
"data-sidebar-head": "",
|
|
2464
|
+
children: inner
|
|
2465
|
+
}
|
|
2466
|
+
);
|
|
2377
2467
|
}
|
|
2378
2468
|
if (!inDrawer || !shell) return brand;
|
|
2379
2469
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2384,6 +2474,7 @@ var SidebarBrand = ({
|
|
|
2384
2474
|
divider && "border-b border-[var(--color-border)]"
|
|
2385
2475
|
),
|
|
2386
2476
|
"data-sidebar-brand": divider ? "" : void 0,
|
|
2477
|
+
"data-sidebar-head": "",
|
|
2387
2478
|
children: [
|
|
2388
2479
|
brand,
|
|
2389
2480
|
/* @__PURE__ */ jsx(
|
|
@@ -2429,22 +2520,22 @@ var SidebarItem = ({
|
|
|
2429
2520
|
const nested = !collapsed && depth > 0;
|
|
2430
2521
|
const baseClass = clsx(
|
|
2431
2522
|
"group focus-visible:focus-indicator flex items-center rounded-lg font-medium transition-colors",
|
|
2432
|
-
compact ? "text-2xs relative flex-col gap-1 py-2 text-center" : clsx(
|
|
2433
|
-
"gap-3",
|
|
2434
|
-
nested ? "px-2.5" :
|
|
2523
|
+
compact ? clsx("text-2xs relative flex-col gap-1 py-2 text-center", ROW_INSET[inset].margin) : collapsed ? RAIL_ROW : clsx(
|
|
2524
|
+
"mb-1 gap-3",
|
|
2525
|
+
nested ? "px-2.5" : "px-3",
|
|
2435
2526
|
level(nested ? depth : 0).py,
|
|
2436
|
-
level(nested ? depth : 0).text
|
|
2527
|
+
level(nested ? depth : 0).text,
|
|
2528
|
+
ROW_INSET[inset].margin
|
|
2437
2529
|
),
|
|
2438
|
-
ROW_INSET[inset].margin,
|
|
2439
2530
|
active ? ACTIVE_ROW[ctx.activeStyle] : IDLE_ROW
|
|
2440
2531
|
);
|
|
2441
2532
|
const style = nested ? geometry.rowStyle(depth, !href) : void 0;
|
|
2442
2533
|
const content = compact ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2443
|
-
/* @__PURE__ */ jsx(Icon2, { className: "
|
|
2534
|
+
/* @__PURE__ */ jsx(Icon2, { className: "size-5 shrink-0" }),
|
|
2444
2535
|
/* @__PURE__ */ jsx(CompactLabel, { label, labelRef: setCompactLabel }),
|
|
2445
2536
|
badge && /* @__PURE__ */ jsx("span", { className: "inset-e-1 absolute top-1", children: badge })
|
|
2446
2537
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2447
|
-
!nested && /* @__PURE__ */ jsx(Icon2, { className: "
|
|
2538
|
+
!nested && /* @__PURE__ */ jsx(Icon2, { className: "size-4 shrink-0" }),
|
|
2448
2539
|
!collapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2449
2540
|
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", ...fitLabel(labelId), children: label }),
|
|
2450
2541
|
badge && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: badge })
|
|
@@ -2474,7 +2565,7 @@ var SidebarItem = ({
|
|
|
2474
2565
|
closeDrawer?.();
|
|
2475
2566
|
},
|
|
2476
2567
|
"aria-label": name,
|
|
2477
|
-
className: clsx(baseClass, ROW_INSET[inset].width, !compact && "text-start"),
|
|
2568
|
+
className: clsx(baseClass, !collapsed && ROW_INSET[inset].width, !compact && "text-start"),
|
|
2478
2569
|
style,
|
|
2479
2570
|
"aria-current": active ? "page" : void 0,
|
|
2480
2571
|
"data-sidebar-item": "",
|
|
@@ -2537,13 +2628,13 @@ var SidebarSubMenu = ({
|
|
|
2537
2628
|
"aria-label": compact ? void 0 : label,
|
|
2538
2629
|
className: clsx(
|
|
2539
2630
|
"group focus-visible:focus-indicator flex items-center rounded-lg font-medium transition-colors",
|
|
2540
|
-
compact ? "text-2xs py-row-8 flex-col gap-1 text-center" :
|
|
2541
|
-
ROW_INSET[inset].margin,
|
|
2542
|
-
ROW_INSET[inset].width,
|
|
2631
|
+
compact ? "text-2xs py-row-8 flex-col gap-1 text-center" : RAIL_ROW,
|
|
2632
|
+
compact && ROW_INSET[inset].margin,
|
|
2633
|
+
compact && ROW_INSET[inset].width,
|
|
2543
2634
|
active ? ACTIVE_ROW[ctx.activeStyle] : IDLE_ROW
|
|
2544
2635
|
),
|
|
2545
2636
|
children: [
|
|
2546
|
-
/* @__PURE__ */ jsx(Icon2, { className: "
|
|
2637
|
+
/* @__PURE__ */ jsx(Icon2, { className: clsx("shrink-0", compact ? "size-5" : "size-4") }),
|
|
2547
2638
|
compact && /* @__PURE__ */ jsx(CompactLabel, { label, labelRef: setCompactLabel })
|
|
2548
2639
|
]
|
|
2549
2640
|
}
|
|
@@ -2559,10 +2650,10 @@ var SidebarSubMenu = ({
|
|
|
2559
2650
|
inDrawer: false,
|
|
2560
2651
|
inset: "tight",
|
|
2561
2652
|
activeStyle: ctx.activeStyle,
|
|
2562
|
-
labelOrigin:
|
|
2653
|
+
labelOrigin: 8 + NESTED_PADDING
|
|
2563
2654
|
},
|
|
2564
2655
|
children: /* @__PURE__ */ jsxs(SidebarDepthContext.Provider, { value: 1, children: [
|
|
2565
|
-
/* @__PURE__ */ jsx("p", { className: "px-3 pt-1 pb-
|
|
2656
|
+
/* @__PURE__ */ jsx("p", { className: "px-3 pt-1 pb-1.5 text-xs font-medium text-[var(--color-text-muted)]", children: label }),
|
|
2566
2657
|
/* @__PURE__ */ jsx(
|
|
2567
2658
|
"div",
|
|
2568
2659
|
{
|
|
@@ -2585,14 +2676,14 @@ var SidebarSubMenu = ({
|
|
|
2585
2676
|
const padding = nested ? "px-2.5" : "px-3";
|
|
2586
2677
|
const tone = active ? ACTIVE_ROW[ctx.activeStyle] : inTrail ? TRAIL_ROW : nested && !ownPage ? GROUPING_ROW : IDLE_ROW;
|
|
2587
2678
|
const row = clsx(
|
|
2588
|
-
"group flex items-center rounded-lg font-medium transition-colors",
|
|
2679
|
+
"group mb-1 flex items-center rounded-lg font-medium transition-colors",
|
|
2589
2680
|
text,
|
|
2590
2681
|
ROW_INSET[inset].margin,
|
|
2591
2682
|
tone
|
|
2592
2683
|
);
|
|
2593
2684
|
const toggle = () => setOpen((v) => !v);
|
|
2594
2685
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2595
|
-
!nested && /* @__PURE__ */ jsx(Icon2, { className: "
|
|
2686
|
+
!nested && /* @__PURE__ */ jsx(Icon2, { className: "size-4 shrink-0" }),
|
|
2596
2687
|
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", ...fitLabel(labelId), children: label }),
|
|
2597
2688
|
badge && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: badge })
|
|
2598
2689
|
] });
|
|
@@ -2715,14 +2806,18 @@ var SidebarGroup = ({
|
|
|
2715
2806
|
if (collapsed) {
|
|
2716
2807
|
return /* @__PURE__ */ jsx("div", { className: "my-1", children });
|
|
2717
2808
|
}
|
|
2718
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
2809
|
+
return /* @__PURE__ */ jsxs("div", { className: "pt-[18px] [[data-sidebar-head]+&]:pt-1", children: [
|
|
2719
2810
|
/* @__PURE__ */ jsxs(
|
|
2720
2811
|
"button",
|
|
2721
2812
|
{
|
|
2722
2813
|
type: "button",
|
|
2723
2814
|
onClick: () => setOpen((v) => !v),
|
|
2724
2815
|
"aria-expanded": open,
|
|
2725
|
-
className:
|
|
2816
|
+
className: clsx(
|
|
2817
|
+
"focus-visible:focus-indicator py-row-4 flex items-center gap-2 rounded-lg px-3 text-xs font-medium text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]",
|
|
2818
|
+
ROW_INSET.wide.margin,
|
|
2819
|
+
ROW_INSET.wide.width
|
|
2820
|
+
),
|
|
2726
2821
|
children: [
|
|
2727
2822
|
open ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 rtl:-scale-x-100" }),
|
|
2728
2823
|
label
|
|
@@ -2735,10 +2830,8 @@ var SidebarGroup = ({
|
|
|
2735
2830
|
var SectionTitle = ({ label, className }) => /* @__PURE__ */ jsx(
|
|
2736
2831
|
"p",
|
|
2737
2832
|
{
|
|
2738
|
-
className: clsx(
|
|
2739
|
-
|
|
2740
|
-
className
|
|
2741
|
-
),
|
|
2833
|
+
className: clsx("text-xs font-medium text-[var(--color-text-muted)]", className),
|
|
2834
|
+
style: { paddingInline: `calc(${GUTTER} + ${ROW_PADDING}px) ${GUTTER}` },
|
|
2742
2835
|
children: label
|
|
2743
2836
|
}
|
|
2744
2837
|
);
|
|
@@ -2756,14 +2849,29 @@ var SidebarSection = ({
|
|
|
2756
2849
|
/* @__PURE__ */ jsx("div", { children })
|
|
2757
2850
|
] });
|
|
2758
2851
|
}
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2852
|
+
const titled = Boolean(label);
|
|
2853
|
+
return /* @__PURE__ */ jsxs(
|
|
2854
|
+
"div",
|
|
2855
|
+
{
|
|
2856
|
+
className: collapsed && titled ? "[[data-sidebar-head]+&]:-mt-3.5" : "pt-[18px] [[data-sidebar-head]+&]:pt-1",
|
|
2857
|
+
children: [
|
|
2858
|
+
collapsed ? titled && /* @__PURE__ */ jsx(
|
|
2859
|
+
"div",
|
|
2860
|
+
{
|
|
2861
|
+
"data-sidebar-mark": "",
|
|
2862
|
+
className: "flex justify-center py-2 text-[var(--color-text-muted)] [[data-sidebar-head]+div>&]:invisible",
|
|
2863
|
+
"aria-hidden": true,
|
|
2864
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: [
|
|
2865
|
+
/* @__PURE__ */ jsx("circle", { cx: "6", cy: "12", r: "1.75" }),
|
|
2866
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
2867
|
+
/* @__PURE__ */ jsx("circle", { cx: "18", cy: "12", r: "1.75" })
|
|
2868
|
+
] })
|
|
2869
|
+
}
|
|
2870
|
+
) : label && /* @__PURE__ */ jsx(SectionTitle, { label, className: "mb-1.5" }),
|
|
2871
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
2872
|
+
]
|
|
2873
|
+
}
|
|
2874
|
+
);
|
|
2767
2875
|
};
|
|
2768
2876
|
var Sidebar = SidebarRoot;
|
|
2769
2877
|
Sidebar.Brand = SidebarBrand;
|
|
@@ -4042,7 +4150,7 @@ var DEFAULT_SUMMARY_LABELS = {
|
|
|
4042
4150
|
UNKNOWN: "Status unknown",
|
|
4043
4151
|
INFO: "Operational, with notices"
|
|
4044
4152
|
};
|
|
4045
|
-
var
|
|
4153
|
+
var ICON2 = {
|
|
4046
4154
|
OK: CheckCircle,
|
|
4047
4155
|
WARN: AlertTriangle,
|
|
4048
4156
|
CRIT: XCircle,
|
|
@@ -4128,7 +4236,7 @@ var HealthSummary = ({
|
|
|
4128
4236
|
}
|
|
4129
4237
|
);
|
|
4130
4238
|
}
|
|
4131
|
-
const Icon2 =
|
|
4239
|
+
const Icon2 = ICON2[shown];
|
|
4132
4240
|
return /* @__PURE__ */ jsxs(
|
|
4133
4241
|
"div",
|
|
4134
4242
|
{
|