@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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ All notable changes to `@sckyzo/cosmos-react` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.5.0](https://github.com/SckyzO/cosmos/compare/@sckyzo/cosmos-react@0.4.1...@sckyzo/cosmos-react@0.5.0) (2026-11-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **react:** add a floating Shell and a Sidebar edge toggle ([4e5c334](https://github.com/SckyzO/cosmos/commit/4e5c33446ecce015d03e972fcafe20b33a95c278))
|
|
14
|
+
* **react:** export the SidebarGutter type ([6144bca](https://github.com/SckyzO/cosmos/commit/6144bca63b97dc75bba0888ea4f693fd1b919a19))
|
|
15
|
+
* **react:** group Sidebar rows and add a tight gutter ([96c686c](https://github.com/SckyzO/cosmos/commit/96c686c8a9ea459db3657a2fd8d63f46bc6e68b4))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **react:** make the collapsed Sidebar's rows square ([08c1392](https://github.com/SckyzO/cosmos/commit/08c139273b48cbfc6e6d3a92c35bfdf1b1065bdf))
|
|
21
|
+
* **react:** mark only titled blocks after another in the rail ([f1d4e44](https://github.com/SckyzO/cosmos/commit/f1d4e44cdccdd4e10945db72844798af4561b768))
|
|
22
|
+
|
|
8
23
|
## [0.4.1](https://github.com/SckyzO/cosmos/compare/@sckyzo/cosmos-react@0.4.0...@sckyzo/cosmos-react@0.4.1) (2026-10-31)
|
|
9
24
|
|
|
10
25
|
|
package/dist/index.cjs
CHANGED
|
@@ -879,6 +879,8 @@ var Shell = ({
|
|
|
879
879
|
onCollapsedChange,
|
|
880
880
|
collapseControl = "topbar",
|
|
881
881
|
container = "fluid",
|
|
882
|
+
variant = "attached",
|
|
883
|
+
sidebarGutter,
|
|
882
884
|
defaultSidebarOpen = false,
|
|
883
885
|
sidebarOpen: controlledOpen,
|
|
884
886
|
onSidebarOpenChange,
|
|
@@ -905,10 +907,22 @@ var Shell = ({
|
|
|
905
907
|
wasMobile.current = isMobile;
|
|
906
908
|
}, [isMobile, open, setOpen]);
|
|
907
909
|
const navId = react.useId();
|
|
910
|
+
const gutter = sidebarGutter ?? (variant === "floating" ? "tight" : "default");
|
|
908
911
|
const shell = react.useMemo(
|
|
909
|
-
() => ({
|
|
910
|
-
|
|
912
|
+
() => ({
|
|
913
|
+
collapsed,
|
|
914
|
+
setCollapsed,
|
|
915
|
+
isMobile,
|
|
916
|
+
open,
|
|
917
|
+
setOpen,
|
|
918
|
+
navId,
|
|
919
|
+
collapseControl,
|
|
920
|
+
variant,
|
|
921
|
+
sidebarGutter: gutter
|
|
922
|
+
}),
|
|
923
|
+
[collapsed, setCollapsed, isMobile, open, setOpen, navId, collapseControl, variant, gutter]
|
|
911
924
|
);
|
|
925
|
+
const floating = variant === "floating" && !isMobile;
|
|
912
926
|
const layout = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
913
927
|
sidebar && (isMobile ? (
|
|
914
928
|
// Off screen until opened. The Drawer brings the portal, scrim, focus trap, Escape
|
|
@@ -926,24 +940,34 @@ var Shell = ({
|
|
|
926
940
|
}
|
|
927
941
|
)
|
|
928
942
|
) : /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "shrink-0", children: sidebar })),
|
|
929
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
"
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
className: clsx.clsx(
|
|
947
|
+
"flex min-w-0 flex-1 flex-col",
|
|
948
|
+
floating && "overflow-hidden rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-panel)] shadow-sm"
|
|
949
|
+
),
|
|
950
|
+
"data-shell-panel": floating ? "" : void 0,
|
|
951
|
+
children: [
|
|
952
|
+
topbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: topbar }),
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-auto lg:flex-row lg:overflow-visible", children: [
|
|
954
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "min-w-0 flex-1 lg:overflow-auto", children }),
|
|
955
|
+
secondary && /* @__PURE__ */ jsxRuntime.jsx(
|
|
956
|
+
"aside",
|
|
957
|
+
{
|
|
958
|
+
className: clsx.clsx(
|
|
959
|
+
"shrink-0 border-t border-[var(--color-border)] lg:overflow-auto lg:border-s lg:border-t-0",
|
|
960
|
+
// `max-lg:` sorts after the plain width utility: full width while stacked.
|
|
961
|
+
secondaryWidthClassName,
|
|
962
|
+
"max-lg:w-full"
|
|
963
|
+
),
|
|
964
|
+
children: secondary
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
] })
|
|
968
|
+
]
|
|
969
|
+
}
|
|
970
|
+
)
|
|
947
971
|
] });
|
|
948
972
|
return /* @__PURE__ */ jsxRuntime.jsx(ShellContext.Provider, { value: sidebar ? shell : null, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
949
973
|
"div",
|
|
@@ -951,12 +975,23 @@ var Shell = ({
|
|
|
951
975
|
className: clsx.clsx(
|
|
952
976
|
"flex h-screen w-screen overflow-hidden bg-[var(--color-bg-base)] text-[var(--color-text-base)]",
|
|
953
977
|
container === "boxed" && "justify-center",
|
|
978
|
+
// Floating: 10px around and between the two cards.
|
|
979
|
+
floating && container === "fluid" && "gap-2.5 p-2.5",
|
|
954
980
|
className
|
|
955
981
|
),
|
|
956
982
|
children: container === "boxed" ? (
|
|
957
983
|
// The column's hairlines only show where the page background does: the window is
|
|
958
984
|
// wider than the column.
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
985
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
986
|
+
"div",
|
|
987
|
+
{
|
|
988
|
+
className: clsx.clsx(
|
|
989
|
+
"flex h-full w-full max-w-[1440px] min-w-0 border-[var(--color-border)] min-[1441px]:border-x",
|
|
990
|
+
floating && "gap-2.5 p-2.5"
|
|
991
|
+
),
|
|
992
|
+
children: layout
|
|
993
|
+
}
|
|
994
|
+
)
|
|
960
995
|
) : layout
|
|
961
996
|
}
|
|
962
997
|
) });
|
|
@@ -2118,6 +2153,8 @@ var useKeepFocus = () => {
|
|
|
2118
2153
|
hadFocus.current = false;
|
|
2119
2154
|
}, []);
|
|
2120
2155
|
};
|
|
2156
|
+
var GUTTER = "var(--cosmos-sidebar-gutter,20px)";
|
|
2157
|
+
var TIGHT_GUTTER = "10px";
|
|
2121
2158
|
var COMPACT_WIDTH = 88;
|
|
2122
2159
|
var SidebarContext = react.createContext({
|
|
2123
2160
|
collapsed: false,
|
|
@@ -2136,32 +2173,41 @@ var useSidebarCollapsed = (override) => {
|
|
|
2136
2173
|
};
|
|
2137
2174
|
var SidebarDepthContext = react.createContext(0);
|
|
2138
2175
|
var ROW_INSET = {
|
|
2139
|
-
wide: {
|
|
2140
|
-
|
|
2141
|
-
|
|
2176
|
+
wide: {
|
|
2177
|
+
margin: "mx-[var(--cosmos-sidebar-gutter,20px)]",
|
|
2178
|
+
width: "w-[calc(100%-2*var(--cosmos-sidebar-gutter,20px))]",
|
|
2179
|
+
px: GUTTER
|
|
2180
|
+
},
|
|
2181
|
+
tight: { margin: "mx-2", width: "w-[calc(100%-1rem)]", px: "8px" },
|
|
2182
|
+
none: { margin: "mx-0", width: "w-full", px: "0px" }
|
|
2142
2183
|
};
|
|
2184
|
+
var ROW_PADDING = 12;
|
|
2185
|
+
var ICON = 16;
|
|
2186
|
+
var TOP_LABEL = ROW_PADDING + ICON + 12;
|
|
2143
2187
|
var LEVEL = [
|
|
2144
|
-
{ text: "text-sm", py: "py-row-10" },
|
|
2145
2188
|
{ text: "text-sm", py: "py-row-6" },
|
|
2146
|
-
{ text: "text-
|
|
2147
|
-
{ text: "text-xs", py: "py-row-5" }
|
|
2189
|
+
{ text: "text-sm", py: "py-row-4" },
|
|
2190
|
+
{ text: "text-xs", py: "py-row-5" },
|
|
2191
|
+
{ text: "text-xs", py: "py-row-4" }
|
|
2148
2192
|
];
|
|
2149
2193
|
var level = (depth) => LEVEL[Math.min(depth, LEVEL.length - 1)];
|
|
2150
2194
|
var NESTED_PADDING = 10;
|
|
2151
2195
|
var useNestedGeometry = (inset) => {
|
|
2152
2196
|
const { labelOrigin } = react.useContext(SidebarContext);
|
|
2153
|
-
const
|
|
2154
|
-
const
|
|
2197
|
+
const margin = ROW_INSET[inset].px;
|
|
2198
|
+
const at = (px2) => labelOrigin === void 0 ? `calc(${margin} + ${px2}px)` : `${labelOrigin + px2 - TOP_LABEL}px`;
|
|
2199
|
+
const labelX = (depth) => TOP_LABEL + 16 * (depth - 1);
|
|
2155
2200
|
return {
|
|
2156
2201
|
/** Margin (and, for a `<button>`, width) that puts a nested row's pill at its own indent. */
|
|
2157
2202
|
rowStyle: (depth, button) => {
|
|
2158
|
-
const left = labelX(depth) - NESTED_PADDING;
|
|
2159
|
-
return button ? { marginInlineStart: left, width: `calc(100% - ${left
|
|
2203
|
+
const left = at(labelX(depth) - NESTED_PADDING);
|
|
2204
|
+
return button ? { marginInlineStart: left, width: `calc(100% - ${left} - ${margin})` } : { marginInlineStart: left };
|
|
2160
2205
|
},
|
|
2161
2206
|
/** The guide line under a row's children: under a top-level icon, or 4 px before the label. */
|
|
2162
|
-
guideStart: (depth) => depth === 0 ?
|
|
2207
|
+
guideStart: (depth) => depth === 0 ? at(ROW_PADDING + ICON / 2) : at(labelX(depth) - 4)
|
|
2163
2208
|
};
|
|
2164
2209
|
};
|
|
2210
|
+
var RAIL_ROW = "mx-auto mb-1 size-ctrl-36 justify-center text-sm";
|
|
2165
2211
|
var ACTIVE_ROW = {
|
|
2166
2212
|
tint: "bg-brand-500/10 text-brand-600 dark:text-brand-400",
|
|
2167
2213
|
solid: "bg-brand-500 text-white"
|
|
@@ -2203,7 +2249,7 @@ var CompactLabel = ({
|
|
|
2203
2249
|
var CompactTip = ({ label, children }) => /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: label, position: "end", block: true, children });
|
|
2204
2250
|
var FOOTER_DIVIDER = {
|
|
2205
2251
|
full: "border-t border-[var(--color-border)]",
|
|
2206
|
-
inset: "relative before:absolute before:inset-x-
|
|
2252
|
+
inset: "relative before:absolute before:inset-x-[var(--cosmos-sidebar-gutter,20px)] before:top-0 before:h-px before:bg-[var(--color-border)]",
|
|
2207
2253
|
none: ""
|
|
2208
2254
|
};
|
|
2209
2255
|
var SidebarRoot = ({
|
|
@@ -2218,6 +2264,8 @@ var SidebarRoot = ({
|
|
|
2218
2264
|
footer,
|
|
2219
2265
|
footerDivider = "full",
|
|
2220
2266
|
activeStyle = "tint",
|
|
2267
|
+
gutter: gutterProp,
|
|
2268
|
+
edgeToggle: edgeToggleProp,
|
|
2221
2269
|
onCollapsedChange,
|
|
2222
2270
|
className
|
|
2223
2271
|
}) => {
|
|
@@ -2231,6 +2279,10 @@ var SidebarRoot = ({
|
|
|
2231
2279
|
const inDrawer = shell?.isMobile === true;
|
|
2232
2280
|
const compact = variant === "compact" && !inDrawer;
|
|
2233
2281
|
const collapsed = inDrawer || compact ? false : shell ? shell.collapsed : ownCollapsed;
|
|
2282
|
+
const floating = shell?.variant === "floating" && !inDrawer;
|
|
2283
|
+
const gutter = gutterProp ?? shell?.sidebarGutter ?? "default";
|
|
2284
|
+
const edgeToggle = (edgeToggleProp ?? floating) && !inDrawer && !compact;
|
|
2285
|
+
const toggleCollapsed = () => shell ? shell.setCollapsed(!shell.collapsed) : setOwnCollapsed(!ownCollapsed);
|
|
2234
2286
|
const ownNavId = react.useId();
|
|
2235
2287
|
const navId = shell ? shell.navId : ownNavId;
|
|
2236
2288
|
const showToggle = !inDrawer && !compact && (onCollapsedChange !== void 0 || shell?.collapseControl === "sidebar");
|
|
@@ -2258,11 +2310,15 @@ var SidebarRoot = ({
|
|
|
2258
2310
|
ref: navRef,
|
|
2259
2311
|
id: navId,
|
|
2260
2312
|
"aria-label": "Main navigation",
|
|
2261
|
-
style:
|
|
2313
|
+
style: {
|
|
2314
|
+
...inDrawer ? {} : { width: compact ? COMPACT_WIDTH : rail ? collapsedWidth : fit.width },
|
|
2315
|
+
...gutter === "tight" ? { "--cosmos-sidebar-gutter": TIGHT_GUTTER } : {}
|
|
2316
|
+
},
|
|
2262
2317
|
className: clsx.clsx(
|
|
2263
|
-
"flex h-full flex-col overflow-hidden bg-[var(--color-bg-panel)]",
|
|
2264
|
-
// The drawer panel draws the edge and the shadow, and sets the width.
|
|
2265
|
-
|
|
2318
|
+
"relative flex h-full flex-col overflow-hidden bg-[var(--color-bg-panel)]",
|
|
2319
|
+
// The drawer panel draws the edge and the shadow, and sets the width. Floating, the
|
|
2320
|
+
// sidebar is a card of its own.
|
|
2321
|
+
inDrawer ? "w-full" : floating ? "rounded-xl border border-[var(--color-border)] shadow-sm" : "border-e border-[var(--color-border)]",
|
|
2266
2322
|
// Not before the first frames: the width measured at mount shows at once.
|
|
2267
2323
|
fit.animated && clsx.clsx(
|
|
2268
2324
|
overlay ? "transition-[width,box-shadow]" : "transition-[width]",
|
|
@@ -2276,14 +2332,33 @@ var SidebarRoot = ({
|
|
|
2276
2332
|
...hover.props,
|
|
2277
2333
|
children: [
|
|
2278
2334
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-x-hidden overflow-y-auto", children }),
|
|
2335
|
+
edgeToggle && // Mouse only: hidden from assistive technology and out of the tab order, since the
|
|
2336
|
+
// toggles already do the job by keyboard. The line shows under the pointer.
|
|
2337
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2338
|
+
"button",
|
|
2339
|
+
{
|
|
2340
|
+
type: "button",
|
|
2341
|
+
tabIndex: -1,
|
|
2342
|
+
"aria-hidden": true,
|
|
2343
|
+
"data-sidebar-edge": "",
|
|
2344
|
+
onClick: toggleCollapsed,
|
|
2345
|
+
title: collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2346
|
+
className: clsx.clsx(
|
|
2347
|
+
"group/edge absolute inset-y-0 end-0 z-10 w-2",
|
|
2348
|
+
collapsed ? "cursor-e-resize rtl:cursor-w-resize" : "cursor-w-resize rtl:cursor-e-resize"
|
|
2349
|
+
),
|
|
2350
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "group-hover/edge:bg-brand-500 absolute inset-y-3 end-0 w-0.5 rounded-full bg-transparent transition-colors" })
|
|
2351
|
+
}
|
|
2352
|
+
),
|
|
2279
2353
|
footer && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2280
2354
|
"div",
|
|
2281
2355
|
{
|
|
2282
2356
|
className: clsx.clsx(
|
|
2283
2357
|
"shrink-0 overflow-hidden",
|
|
2284
|
-
compact ? "p-2" : "p-3",
|
|
2358
|
+
compact ? "p-2" : rail ? "p-3" : "py-3",
|
|
2285
2359
|
FOOTER_DIVIDER[footerDivider]
|
|
2286
2360
|
),
|
|
2361
|
+
style: compact || rail ? void 0 : { paddingInline: `max(0px, calc(${GUTTER} - 8px))` },
|
|
2287
2362
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2288
2363
|
SidebarContext.Provider,
|
|
2289
2364
|
{
|
|
@@ -2370,9 +2445,10 @@ var SidebarBrand = ({
|
|
|
2370
2445
|
const baseClass = clsx.clsx(
|
|
2371
2446
|
"focus-visible:focus-indicator flex h-[72px] items-center focus-visible:ring-inset",
|
|
2372
2447
|
// The logo alone has the row to itself: centred, with no gap for the hidden title.
|
|
2373
|
-
compact ? "justify-center" : "gap-3 px-5",
|
|
2448
|
+
compact ? "justify-center" : collapsed ? "gap-3 px-5" : "gap-3",
|
|
2374
2449
|
inDrawer ? "min-w-0 flex-1" : clsx.clsx("shrink-0", divider && "border-b border-[var(--color-border)]")
|
|
2375
2450
|
);
|
|
2451
|
+
const brandStyle = compact || collapsed ? void 0 : { paddingInline: `calc(${GUTTER} + 2px) ${GUTTER}` };
|
|
2376
2452
|
const marker = inDrawer || !divider ? void 0 : "";
|
|
2377
2453
|
let brand;
|
|
2378
2454
|
if (href) {
|
|
@@ -2382,7 +2458,9 @@ var SidebarBrand = ({
|
|
|
2382
2458
|
ref,
|
|
2383
2459
|
href,
|
|
2384
2460
|
className: baseClass,
|
|
2461
|
+
style: brandStyle,
|
|
2385
2462
|
"data-sidebar-brand": marker,
|
|
2463
|
+
"data-sidebar-head": "",
|
|
2386
2464
|
children: inner
|
|
2387
2465
|
}
|
|
2388
2466
|
);
|
|
@@ -2394,12 +2472,24 @@ var SidebarBrand = ({
|
|
|
2394
2472
|
type: "button",
|
|
2395
2473
|
onClick,
|
|
2396
2474
|
className: clsx.clsx(baseClass, "w-full text-start"),
|
|
2475
|
+
style: brandStyle,
|
|
2397
2476
|
"data-sidebar-brand": marker,
|
|
2477
|
+
"data-sidebar-head": "",
|
|
2398
2478
|
children: inner
|
|
2399
2479
|
}
|
|
2400
2480
|
);
|
|
2401
2481
|
} else {
|
|
2402
|
-
brand = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2482
|
+
brand = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2483
|
+
"div",
|
|
2484
|
+
{
|
|
2485
|
+
ref,
|
|
2486
|
+
className: baseClass,
|
|
2487
|
+
style: brandStyle,
|
|
2488
|
+
"data-sidebar-brand": marker,
|
|
2489
|
+
"data-sidebar-head": "",
|
|
2490
|
+
children: inner
|
|
2491
|
+
}
|
|
2492
|
+
);
|
|
2403
2493
|
}
|
|
2404
2494
|
if (!inDrawer || !shell) return brand;
|
|
2405
2495
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2410,6 +2500,7 @@ var SidebarBrand = ({
|
|
|
2410
2500
|
divider && "border-b border-[var(--color-border)]"
|
|
2411
2501
|
),
|
|
2412
2502
|
"data-sidebar-brand": divider ? "" : void 0,
|
|
2503
|
+
"data-sidebar-head": "",
|
|
2413
2504
|
children: [
|
|
2414
2505
|
brand,
|
|
2415
2506
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2455,22 +2546,22 @@ var SidebarItem = ({
|
|
|
2455
2546
|
const nested = !collapsed && depth > 0;
|
|
2456
2547
|
const baseClass = clsx.clsx(
|
|
2457
2548
|
"group focus-visible:focus-indicator flex items-center rounded-lg font-medium transition-colors",
|
|
2458
|
-
compact ? "text-2xs relative flex-col gap-1 py-2 text-center" : clsx.clsx(
|
|
2459
|
-
"gap-3",
|
|
2460
|
-
nested ? "px-2.5" :
|
|
2549
|
+
compact ? clsx.clsx("text-2xs relative flex-col gap-1 py-2 text-center", ROW_INSET[inset].margin) : collapsed ? RAIL_ROW : clsx.clsx(
|
|
2550
|
+
"mb-1 gap-3",
|
|
2551
|
+
nested ? "px-2.5" : "px-3",
|
|
2461
2552
|
level(nested ? depth : 0).py,
|
|
2462
|
-
level(nested ? depth : 0).text
|
|
2553
|
+
level(nested ? depth : 0).text,
|
|
2554
|
+
ROW_INSET[inset].margin
|
|
2463
2555
|
),
|
|
2464
|
-
ROW_INSET[inset].margin,
|
|
2465
2556
|
active ? ACTIVE_ROW[ctx.activeStyle] : IDLE_ROW
|
|
2466
2557
|
);
|
|
2467
2558
|
const style = nested ? geometry.rowStyle(depth, !href) : void 0;
|
|
2468
2559
|
const content = compact ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2469
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "
|
|
2560
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-5 shrink-0" }),
|
|
2470
2561
|
/* @__PURE__ */ jsxRuntime.jsx(CompactLabel, { label, labelRef: setCompactLabel }),
|
|
2471
2562
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inset-e-1 absolute top-1", children: badge })
|
|
2472
2563
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2473
|
-
!nested && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "
|
|
2564
|
+
!nested && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4 shrink-0" }),
|
|
2474
2565
|
!collapsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2475
2566
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", ...fitLabel(labelId), children: label }),
|
|
2476
2567
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: badge })
|
|
@@ -2500,7 +2591,7 @@ var SidebarItem = ({
|
|
|
2500
2591
|
closeDrawer?.();
|
|
2501
2592
|
},
|
|
2502
2593
|
"aria-label": name,
|
|
2503
|
-
className: clsx.clsx(baseClass, ROW_INSET[inset].width, !compact && "text-start"),
|
|
2594
|
+
className: clsx.clsx(baseClass, !collapsed && ROW_INSET[inset].width, !compact && "text-start"),
|
|
2504
2595
|
style,
|
|
2505
2596
|
"aria-current": active ? "page" : void 0,
|
|
2506
2597
|
"data-sidebar-item": "",
|
|
@@ -2563,13 +2654,13 @@ var SidebarSubMenu = ({
|
|
|
2563
2654
|
"aria-label": compact ? void 0 : label,
|
|
2564
2655
|
className: clsx.clsx(
|
|
2565
2656
|
"group focus-visible:focus-indicator flex items-center rounded-lg font-medium transition-colors",
|
|
2566
|
-
compact ? "text-2xs py-row-8 flex-col gap-1 text-center" :
|
|
2567
|
-
ROW_INSET[inset].margin,
|
|
2568
|
-
ROW_INSET[inset].width,
|
|
2657
|
+
compact ? "text-2xs py-row-8 flex-col gap-1 text-center" : RAIL_ROW,
|
|
2658
|
+
compact && ROW_INSET[inset].margin,
|
|
2659
|
+
compact && ROW_INSET[inset].width,
|
|
2569
2660
|
active ? ACTIVE_ROW[ctx.activeStyle] : IDLE_ROW
|
|
2570
2661
|
),
|
|
2571
2662
|
children: [
|
|
2572
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: clsx.clsx("shrink-0", compact ? "size-5" : "size-4") }),
|
|
2573
2664
|
compact && /* @__PURE__ */ jsxRuntime.jsx(CompactLabel, { label, labelRef: setCompactLabel })
|
|
2574
2665
|
]
|
|
2575
2666
|
}
|
|
@@ -2585,10 +2676,10 @@ var SidebarSubMenu = ({
|
|
|
2585
2676
|
inDrawer: false,
|
|
2586
2677
|
inset: "tight",
|
|
2587
2678
|
activeStyle: ctx.activeStyle,
|
|
2588
|
-
labelOrigin:
|
|
2679
|
+
labelOrigin: 8 + NESTED_PADDING
|
|
2589
2680
|
},
|
|
2590
2681
|
children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarDepthContext.Provider, { value: 1, children: [
|
|
2591
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 pt-1 pb-
|
|
2682
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 pt-1 pb-1.5 text-xs font-medium text-[var(--color-text-muted)]", children: label }),
|
|
2592
2683
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2593
2684
|
"div",
|
|
2594
2685
|
{
|
|
@@ -2611,14 +2702,14 @@ var SidebarSubMenu = ({
|
|
|
2611
2702
|
const padding = nested ? "px-2.5" : "px-3";
|
|
2612
2703
|
const tone = active ? ACTIVE_ROW[ctx.activeStyle] : inTrail ? TRAIL_ROW : nested && !ownPage ? GROUPING_ROW : IDLE_ROW;
|
|
2613
2704
|
const row = clsx.clsx(
|
|
2614
|
-
"group flex items-center rounded-lg font-medium transition-colors",
|
|
2705
|
+
"group mb-1 flex items-center rounded-lg font-medium transition-colors",
|
|
2615
2706
|
text,
|
|
2616
2707
|
ROW_INSET[inset].margin,
|
|
2617
2708
|
tone
|
|
2618
2709
|
);
|
|
2619
2710
|
const toggle = () => setOpen((v) => !v);
|
|
2620
2711
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2621
|
-
!nested && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "
|
|
2712
|
+
!nested && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4 shrink-0" }),
|
|
2622
2713
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", ...fitLabel(labelId), children: label }),
|
|
2623
2714
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: badge })
|
|
2624
2715
|
] });
|
|
@@ -2741,14 +2832,18 @@ var SidebarGroup = ({
|
|
|
2741
2832
|
if (collapsed) {
|
|
2742
2833
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1", children });
|
|
2743
2834
|
}
|
|
2744
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
2835
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-[18px] [[data-sidebar-head]+&]:pt-1", children: [
|
|
2745
2836
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2746
2837
|
"button",
|
|
2747
2838
|
{
|
|
2748
2839
|
type: "button",
|
|
2749
2840
|
onClick: () => setOpen((v) => !v),
|
|
2750
2841
|
"aria-expanded": open,
|
|
2751
|
-
className:
|
|
2842
|
+
className: clsx.clsx(
|
|
2843
|
+
"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)]",
|
|
2844
|
+
ROW_INSET.wide.margin,
|
|
2845
|
+
ROW_INSET.wide.width
|
|
2846
|
+
),
|
|
2752
2847
|
children: [
|
|
2753
2848
|
open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3 w-3 rtl:-scale-x-100" }),
|
|
2754
2849
|
label
|
|
@@ -2761,10 +2856,8 @@ var SidebarGroup = ({
|
|
|
2761
2856
|
var SectionTitle = ({ label, className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2762
2857
|
"p",
|
|
2763
2858
|
{
|
|
2764
|
-
className: clsx.clsx(
|
|
2765
|
-
|
|
2766
|
-
className
|
|
2767
|
-
),
|
|
2859
|
+
className: clsx.clsx("text-xs font-medium text-[var(--color-text-muted)]", className),
|
|
2860
|
+
style: { paddingInline: `calc(${GUTTER} + ${ROW_PADDING}px) ${GUTTER}` },
|
|
2768
2861
|
children: label
|
|
2769
2862
|
}
|
|
2770
2863
|
);
|
|
@@ -2782,14 +2875,29 @@ var SidebarSection = ({
|
|
|
2782
2875
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
2783
2876
|
] });
|
|
2784
2877
|
}
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2878
|
+
const titled = Boolean(label);
|
|
2879
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2880
|
+
"div",
|
|
2881
|
+
{
|
|
2882
|
+
className: collapsed && titled ? "[[data-sidebar-head]+&]:-mt-3.5" : "pt-[18px] [[data-sidebar-head]+&]:pt-1",
|
|
2883
|
+
children: [
|
|
2884
|
+
collapsed ? titled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2885
|
+
"div",
|
|
2886
|
+
{
|
|
2887
|
+
"data-sidebar-mark": "",
|
|
2888
|
+
className: "flex justify-center py-2 text-[var(--color-text-muted)] [[data-sidebar-head]+div>&]:invisible",
|
|
2889
|
+
"aria-hidden": true,
|
|
2890
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: [
|
|
2891
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "12", r: "1.75" }),
|
|
2892
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "1.75" }),
|
|
2893
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "12", r: "1.75" })
|
|
2894
|
+
] })
|
|
2895
|
+
}
|
|
2896
|
+
) : label && /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { label, className: "mb-1.5" }),
|
|
2897
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
2898
|
+
]
|
|
2899
|
+
}
|
|
2900
|
+
);
|
|
2793
2901
|
};
|
|
2794
2902
|
var Sidebar = SidebarRoot;
|
|
2795
2903
|
Sidebar.Brand = SidebarBrand;
|
|
@@ -4068,7 +4176,7 @@ var DEFAULT_SUMMARY_LABELS = {
|
|
|
4068
4176
|
UNKNOWN: "Status unknown",
|
|
4069
4177
|
INFO: "Operational, with notices"
|
|
4070
4178
|
};
|
|
4071
|
-
var
|
|
4179
|
+
var ICON2 = {
|
|
4072
4180
|
OK: lucideReact.CheckCircle,
|
|
4073
4181
|
WARN: lucideReact.AlertTriangle,
|
|
4074
4182
|
CRIT: lucideReact.XCircle,
|
|
@@ -4154,7 +4262,7 @@ var HealthSummary = ({
|
|
|
4154
4262
|
}
|
|
4155
4263
|
);
|
|
4156
4264
|
}
|
|
4157
|
-
const Icon2 =
|
|
4265
|
+
const Icon2 = ICON2[shown];
|
|
4158
4266
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4159
4267
|
"div",
|
|
4160
4268
|
{
|