@sckyzo/cosmos-react 0.4.0 → 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 +38 -0
- package/README.md +19 -1691
- package/dist/index.cjs +297 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +297 -121
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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;
|
|
@@ -3224,7 +3332,7 @@ var ProfileHeader = ({
|
|
|
3224
3332
|
) }),
|
|
3225
3333
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 basis-60 sm:pt-3", children: [
|
|
3226
3334
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
3227
|
-
/* @__PURE__ */ jsxRuntime.jsx(Heading2, { className: "text-xl font-bold break-words text-[var(--color-text-primary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: name }) }),
|
|
3335
|
+
/* @__PURE__ */ jsxRuntime.jsx(Heading2, { className: "min-w-0 text-xl font-bold break-words text-[var(--color-text-primary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: name }) }),
|
|
3228
3336
|
badges
|
|
3229
3337
|
] }),
|
|
3230
3338
|
headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm break-words text-[var(--color-text-secondary)]", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: headline }) }),
|
|
@@ -3463,7 +3571,9 @@ var Button = ({
|
|
|
3463
3571
|
type,
|
|
3464
3572
|
disabled: disabled || loading,
|
|
3465
3573
|
className: clsx.clsx(
|
|
3466
|
-
|
|
3574
|
+
// A label on one line in a button of fixed height: a row too narrow for it wraps or
|
|
3575
|
+
// scrolls the buttons, not the text.
|
|
3576
|
+
"focus-visible:focus-indicator inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors",
|
|
3467
3577
|
VARIANT_CLASS[variant][intent],
|
|
3468
3578
|
TEXT_CLASS[size],
|
|
3469
3579
|
variant === "link" ? LINK_CLASS : [
|
|
@@ -3475,19 +3585,19 @@ var Button = ({
|
|
|
3475
3585
|
),
|
|
3476
3586
|
...rest,
|
|
3477
3587
|
children: [
|
|
3478
|
-
Icon2 && iconPosition === "start" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: ICON_SIZE[size] }),
|
|
3588
|
+
Icon2 && iconPosition === "start" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: clsx.clsx("shrink-0", ICON_SIZE[size]) }),
|
|
3479
3589
|
loading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3480
3590
|
"span",
|
|
3481
3591
|
{
|
|
3482
3592
|
"aria-hidden": true,
|
|
3483
3593
|
className: clsx.clsx(
|
|
3484
|
-
"animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
3594
|
+
"shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
3485
3595
|
ICON_SIZE[size]
|
|
3486
3596
|
)
|
|
3487
3597
|
}
|
|
3488
3598
|
),
|
|
3489
3599
|
children,
|
|
3490
|
-
Icon2 && iconPosition === "end" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: ICON_SIZE[size] })
|
|
3600
|
+
Icon2 && iconPosition === "end" && !loading && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: clsx.clsx("shrink-0", ICON_SIZE[size]) })
|
|
3491
3601
|
]
|
|
3492
3602
|
}
|
|
3493
3603
|
);
|
|
@@ -4066,7 +4176,7 @@ var DEFAULT_SUMMARY_LABELS = {
|
|
|
4066
4176
|
UNKNOWN: "Status unknown",
|
|
4067
4177
|
INFO: "Operational, with notices"
|
|
4068
4178
|
};
|
|
4069
|
-
var
|
|
4179
|
+
var ICON2 = {
|
|
4070
4180
|
OK: lucideReact.CheckCircle,
|
|
4071
4181
|
WARN: lucideReact.AlertTriangle,
|
|
4072
4182
|
CRIT: lucideReact.XCircle,
|
|
@@ -4152,7 +4262,7 @@ var HealthSummary = ({
|
|
|
4152
4262
|
}
|
|
4153
4263
|
);
|
|
4154
4264
|
}
|
|
4155
|
-
const Icon2 =
|
|
4265
|
+
const Icon2 = ICON2[shown];
|
|
4156
4266
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4157
4267
|
"div",
|
|
4158
4268
|
{
|
|
@@ -4526,7 +4636,7 @@ var CheckName = ({ check, open, onToggle, outputId }) => check.output === void 0
|
|
|
4526
4636
|
}
|
|
4527
4637
|
);
|
|
4528
4638
|
var Output = ({ check, open, outputId }) => check.output === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { id: outputId, hidden: !open, className: "min-w-0", children: open && /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: check.output }) });
|
|
4529
|
-
var Dash = () => /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-muted)] max-
|
|
4639
|
+
var Dash = () => /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-[var(--color-text-muted)] @max-[48rem]:hidden", children: "\u2014" });
|
|
4530
4640
|
var CheckRow = ({ check, open, onToggle, outputId, now }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4531
4641
|
"li",
|
|
4532
4642
|
{
|
|
@@ -4535,15 +4645,15 @@ var CheckRow = ({ check, open, onToggle, outputId, now }) => /* @__PURE__ */ jsx
|
|
|
4535
4645
|
(check.status === "WARN" || check.status === "CRIT") && "bg-gray-50/60 dark:bg-white/[0.02]"
|
|
4536
4646
|
),
|
|
4537
4647
|
children: [
|
|
4538
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5
|
|
4648
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5 @min-[48rem]:grid @min-[48rem]:grid-cols-[6.5rem_minmax(6rem,10rem)_minmax(0,12rem)_minmax(12rem,1fr)_5rem_7rem] @min-[48rem]:items-center @min-[48rem]:gap-3", children: [
|
|
4539
4649
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: check.status, label: STATUS_NAME[check.status] }) }),
|
|
4540
4650
|
/* @__PURE__ */ jsxRuntime.jsx(CheckName, { check, open, onToggle, outputId }),
|
|
4541
|
-
check.target ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-xs break-all text-[var(--color-text-secondary)]
|
|
4651
|
+
check.target ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-xs break-all text-[var(--color-text-secondary)] @min-[48rem]:truncate", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: check.target }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
|
|
4542
4652
|
check.message ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: check.message }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
|
|
4543
|
-
check.latency !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums
|
|
4544
|
-
check.checkedAt !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--color-text-secondary)] tabular-nums
|
|
4653
|
+
check.latency !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums @min-[48rem]:text-end", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: formatLatency(check.latency) }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {}),
|
|
4654
|
+
check.checkedAt !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[var(--color-text-secondary)] tabular-nums @min-[48rem]:text-end", children: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { value: check.checkedAt, now }) }) : /* @__PURE__ */ jsxRuntime.jsx(Dash, {})
|
|
4545
4655
|
] }),
|
|
4546
|
-
check.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx(open && "mt-3
|
|
4656
|
+
check.output !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx(open && "mt-3 @min-[48rem]:ms-[7.25rem]"), children: /* @__PURE__ */ jsxRuntime.jsx(Output, { check, open, outputId }) })
|
|
4547
4657
|
]
|
|
4548
4658
|
}
|
|
4549
4659
|
);
|
|
@@ -4671,7 +4781,9 @@ var HealthCheckList = ({
|
|
|
4671
4781
|
role: ariaLabel ? "group" : void 0,
|
|
4672
4782
|
"aria-label": ariaLabel,
|
|
4673
4783
|
className: clsx.clsx(
|
|
4674
|
-
|
|
4784
|
+
// The rows lay their columns out from the list's own width, not the screen's: in a card the
|
|
4785
|
+
// list is narrower than the screen, and a grid of fixed columns left the message nothing.
|
|
4786
|
+
variant === "list" && "@container overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-bg-panel)]",
|
|
4675
4787
|
variant === "grid" && "flex flex-col gap-4",
|
|
4676
4788
|
className
|
|
4677
4789
|
),
|
|
@@ -5764,9 +5876,9 @@ function StackedListItem({
|
|
|
5764
5876
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-x-0 -top-px bottom-0", "aria-hidden": true }),
|
|
5765
5877
|
/* @__PURE__ */ jsxRuntime.jsx("bdi", { children: title })
|
|
5766
5878
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm/6 font-semibold text-gray-900 dark:text-white", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: title }) });
|
|
5767
|
-
const titleRow = badge ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-x-3", children: [
|
|
5879
|
+
const titleRow = badge ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-start gap-x-3 gap-y-1", children: [
|
|
5768
5880
|
titleEl,
|
|
5769
|
-
badge
|
|
5881
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-none", children: badge })
|
|
5770
5882
|
] }) : titleEl;
|
|
5771
5883
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5772
5884
|
"li",
|
|
@@ -7832,7 +7944,9 @@ var AvatarGroup = ({
|
|
|
7832
7944
|
"span",
|
|
7833
7945
|
{
|
|
7834
7946
|
className: clsx.clsx(
|
|
7835
|
-
|
|
7947
|
+
// The surface behind each avatar: a tinted fill lets the one before it, and its ring, show
|
|
7948
|
+
// through otherwise.
|
|
7949
|
+
"relative inline-flex shrink-0 bg-[var(--color-bg-panel)] ring-2 ring-[var(--color-bg-panel)] has-focus-visible:z-10",
|
|
7836
7950
|
AVATAR_SHAPE_CLASS[shape],
|
|
7837
7951
|
index > 0 && OVERLAP_CLASS[spacing][size],
|
|
7838
7952
|
index < last && INITIALS_SHIFT_CLASS[spacing][size]
|
|
@@ -8810,7 +8924,8 @@ var STATE_CONFIG = {
|
|
|
8810
8924
|
saving: { label: "Saving\u2026", loading: true },
|
|
8811
8925
|
// The `success` intent carries the dark text on green (white on green-500 is about 2.3:1).
|
|
8812
8926
|
saved: { label: "Saved", icon: lucideReact.Check, intent: "success" },
|
|
8813
|
-
|
|
8927
|
+
// What to do next, not the name of the state: the save failed, the click saves again.
|
|
8928
|
+
error: { label: "Try again", intent: "danger" }
|
|
8814
8929
|
};
|
|
8815
8930
|
var StatefulSaveButton = ({
|
|
8816
8931
|
state,
|
|
@@ -9160,7 +9275,9 @@ function NotificationsPanelTrigger({
|
|
|
9160
9275
|
"aria-expanded": open,
|
|
9161
9276
|
onClick: () => setOpen(!open),
|
|
9162
9277
|
className: clsx.clsx(
|
|
9163
|
-
|
|
9278
|
+
// The ping around the count grows to twice its size: clipped to the bell, it never widens
|
|
9279
|
+
// the row that holds it. The focus ring is a shadow, outside the clip.
|
|
9280
|
+
"focus-visible:focus-indicator h-ctrl-40 w-ctrl-40 relative flex items-center justify-center overflow-hidden rounded-lg border transition-colors",
|
|
9164
9281
|
muted ? "border-gray-200 text-gray-400 dark:border-gray-700 dark:text-gray-600" : "border-gray-200 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-white",
|
|
9165
9282
|
className
|
|
9166
9283
|
),
|
|
@@ -13745,21 +13862,30 @@ var DatePicker = (props) => {
|
|
|
13745
13862
|
]
|
|
13746
13863
|
}
|
|
13747
13864
|
),
|
|
13748
|
-
isRange ?
|
|
13749
|
-
|
|
13750
|
-
|
|
13751
|
-
"
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13865
|
+
isRange ? (
|
|
13866
|
+
// Two dates side by side don't fit a phone: the end date goes under the start date.
|
|
13867
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13868
|
+
"div",
|
|
13869
|
+
{
|
|
13870
|
+
className: clsx.clsx("flex flex-wrap items-center gap-2", !fullWidth && "w-fit max-w-full"),
|
|
13871
|
+
children: [
|
|
13872
|
+
renderTrigger(
|
|
13873
|
+
fieldId,
|
|
13874
|
+
"from",
|
|
13875
|
+
selectedRange.from,
|
|
13876
|
+
props.fromPlaceholder ?? "Start date"
|
|
13877
|
+
),
|
|
13878
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: "to" }),
|
|
13879
|
+
renderTrigger(
|
|
13880
|
+
void 0,
|
|
13881
|
+
"to",
|
|
13882
|
+
selectedRange.to,
|
|
13883
|
+
props.toPlaceholder ?? "End date"
|
|
13884
|
+
)
|
|
13885
|
+
]
|
|
13886
|
+
}
|
|
13761
13887
|
)
|
|
13762
|
-
|
|
13888
|
+
) : renderTrigger(
|
|
13763
13889
|
fieldId,
|
|
13764
13890
|
"from",
|
|
13765
13891
|
selectedSingle,
|
|
@@ -14014,7 +14140,7 @@ var OtpInput = ({
|
|
|
14014
14140
|
if (finalValue.length === length) onComplete?.(finalValue);
|
|
14015
14141
|
};
|
|
14016
14142
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex items-center gap-2", className), role: "group", "aria-label": ariaLabel, children: [
|
|
14017
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "flex items-center gap-2", children: Array.from({ length }).map((_, i) => {
|
|
14143
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { dir: "ltr", className: "flex min-w-0 items-center gap-2", children: Array.from({ length }).map((_, i) => {
|
|
14018
14144
|
const cellChar = value[i] ?? "";
|
|
14019
14145
|
const display = mask && cellChar ? "\u2022" : cellChar;
|
|
14020
14146
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14037,7 +14163,8 @@ var OtpInput = ({
|
|
|
14037
14163
|
onPaste: handlePaste(i),
|
|
14038
14164
|
onFocus: (e) => e.target.select(),
|
|
14039
14165
|
className: clsx.clsx(
|
|
14040
|
-
|
|
14166
|
+
// 2.5rem wide, narrower when the row doesn't fit (eight cells on a phone).
|
|
14167
|
+
"h-ctrl-48 w-10 min-w-0 rounded-lg border bg-white text-center text-lg font-semibold text-gray-900 tabular-nums transition-colors disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:text-white",
|
|
14041
14168
|
fieldStateClass({ invalid: error, success })
|
|
14042
14169
|
)
|
|
14043
14170
|
},
|
|
@@ -16079,7 +16206,8 @@ function Item4({
|
|
|
16079
16206
|
"dd",
|
|
16080
16207
|
{
|
|
16081
16208
|
className: clsx.clsx(
|
|
16082
|
-
|
|
16209
|
+
// A value with no space in it (an e-mail) breaks inside the row.
|
|
16210
|
+
"min-w-0 text-sm font-medium break-words text-[var(--color-text-primary)]",
|
|
16083
16211
|
mono && "font-mono text-xs"
|
|
16084
16212
|
),
|
|
16085
16213
|
children: isolate(children)
|
|
@@ -16101,7 +16229,7 @@ function Item4({
|
|
|
16101
16229
|
"dd",
|
|
16102
16230
|
{
|
|
16103
16231
|
className: clsx.clsx(
|
|
16104
|
-
"mt-1 text-sm/6 text-gray-700 sm:col-span-2 sm:mt-0 dark:text-gray-300",
|
|
16232
|
+
"mt-1 min-w-0 text-sm/6 break-words text-gray-700 sm:col-span-2 sm:mt-0 dark:text-gray-300",
|
|
16105
16233
|
mono && "font-mono"
|
|
16106
16234
|
),
|
|
16107
16235
|
children: isolate(children)
|
|
@@ -16198,7 +16326,7 @@ var KpiCard = ({
|
|
|
16198
16326
|
);
|
|
16199
16327
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16200
16328
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-between gap-3", children: [
|
|
16201
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-xs font-medium tracking-wider text-gray-500 uppercase dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: label }) }),
|
|
16329
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-xs font-medium tracking-wider break-words hyphens-auto text-gray-500 uppercase dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: label }) }),
|
|
16202
16330
|
Icon2 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16203
16331
|
"span",
|
|
16204
16332
|
{
|
|
@@ -16221,7 +16349,9 @@ var KpiCard = ({
|
|
|
16221
16349
|
"span",
|
|
16222
16350
|
{
|
|
16223
16351
|
className: clsx.clsx(
|
|
16224
|
-
|
|
16352
|
+
// A figure with no break in it (`€12,418,906.40`) wraps in a narrow card instead of
|
|
16353
|
+
// running out of it: cut, it would read as another number.
|
|
16354
|
+
"block text-3xl font-bold tracking-tight break-words tabular-nums",
|
|
16225
16355
|
intent === "neutral" ? "text-gray-900 dark:text-white" : INTENT_STYLE[intent].text
|
|
16226
16356
|
),
|
|
16227
16357
|
children: withExact ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -16706,7 +16836,8 @@ var MiniCalendar = ({
|
|
|
16706
16836
|
"aria-current": isToday ? "date" : void 0,
|
|
16707
16837
|
className: clsx.clsx(
|
|
16708
16838
|
// The number sits above the middle of the cell (`pb-1.5`) to leave room for the event dot under it.
|
|
16709
|
-
|
|
16839
|
+
// At least 28px wide: a calendar as wide as its content had columns as narrow as the numbers.
|
|
16840
|
+
"h-ctrl-36 min-w-ctrl-28 relative flex items-center justify-center rounded-md border pb-1.5 text-xs font-medium transition-colors focus-visible:ring-inset",
|
|
16710
16841
|
isSelected ? "bg-brand-500 hover:bg-brand-600 focus-visible:focus-indicator-on-accent border-transparent text-white" : isToday ? "border-brand-500 text-brand-600 hover:bg-brand-50 focus-visible:focus-indicator dark:text-brand-400 dark:hover:bg-white/5" : "focus-visible:focus-indicator border-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5"
|
|
16711
16842
|
),
|
|
16712
16843
|
children: [
|
|
@@ -18515,12 +18646,13 @@ var DataTableBulkActions = ({
|
|
|
18515
18646
|
icon: item.icon,
|
|
18516
18647
|
disabled: item.disabled,
|
|
18517
18648
|
onClick: () => item.onClick(selectedRows),
|
|
18649
|
+
className: "shrink-0",
|
|
18518
18650
|
children: item.label
|
|
18519
18651
|
},
|
|
18520
18652
|
item.key
|
|
18521
18653
|
);
|
|
18522
18654
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18523
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex items-center gap-2", phoneIcons && "max-sm:hidden"), children: [
|
|
18655
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx("flex flex-wrap items-center gap-2", phoneIcons && "max-sm:hidden"), children: [
|
|
18524
18656
|
button(first, true),
|
|
18525
18657
|
rest.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18526
18658
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden items-center gap-2 @min-[1152px]:flex", children: rest.map((item) => button(item, false)) }),
|
|
@@ -18920,6 +19052,43 @@ var PageSizeSelect = ({ value, options, onChange }) => {
|
|
|
18920
19052
|
] });
|
|
18921
19053
|
};
|
|
18922
19054
|
|
|
19055
|
+
// src/table/columnWidths.ts
|
|
19056
|
+
var DEFAULT_COLUMN_MIN_WIDTH = "8rem";
|
|
19057
|
+
var NUMBER = String.raw`(?:\d+(?:\.\d+)?|\.\d+)`;
|
|
19058
|
+
var LENGTH = new RegExp(`^${NUMBER}(?:px|rem|em|ch)$`);
|
|
19059
|
+
var PERCENT2 = new RegExp(`^(${NUMBER})%$`);
|
|
19060
|
+
var ratio = (n) => Number(n.toFixed(4));
|
|
19061
|
+
var tableMinWidth = (columns, fixed, takesTheRest) => {
|
|
19062
|
+
if (columns.length === 0) return void 0;
|
|
19063
|
+
const lengths = [...fixed];
|
|
19064
|
+
const autoMins = [];
|
|
19065
|
+
const percents = [];
|
|
19066
|
+
columns.forEach((c, i) => {
|
|
19067
|
+
const width = c.width?.trim() ?? "";
|
|
19068
|
+
const min = c.minWidth ?? DEFAULT_COLUMN_MIN_WIDTH;
|
|
19069
|
+
const share = PERCENT2.exec(width);
|
|
19070
|
+
if (i === takesTheRest) autoMins.push(LENGTH.test(width) ? width : min);
|
|
19071
|
+
else if (LENGTH.test(width)) lengths.push(width);
|
|
19072
|
+
else if (share) percents.push({ share: Number(share[1]) / 100, min });
|
|
19073
|
+
else autoMins.push(min);
|
|
19074
|
+
});
|
|
19075
|
+
const bounds = percents.map((p) => `calc(${p.min} / ${ratio(p.share)})`);
|
|
19076
|
+
const left = ratio(1 - percents.reduce((sum, p) => sum + p.share, 0));
|
|
19077
|
+
const widest = [...new Set(autoMins)];
|
|
19078
|
+
const parts = [
|
|
19079
|
+
...lengths,
|
|
19080
|
+
...autoMins.length > 0 ? [`${autoMins.length} * ${widest.length === 1 ? widest[0] : `max(${widest.join(", ")})`}`] : []
|
|
19081
|
+
];
|
|
19082
|
+
if (parts.length > 0 && left > 0) {
|
|
19083
|
+
bounds.push(
|
|
19084
|
+
left === 1 ? `calc(${parts.join(" + ")})` : `calc((${parts.join(" + ")}) / ${left})`
|
|
19085
|
+
);
|
|
19086
|
+
}
|
|
19087
|
+
const distinct = [...new Set(bounds)];
|
|
19088
|
+
if (distinct.length === 0) return void 0;
|
|
19089
|
+
return distinct.length === 1 ? distinct[0] : `max(${distinct.join(", ")})`;
|
|
19090
|
+
};
|
|
19091
|
+
|
|
18923
19092
|
// src/table/pipeline.ts
|
|
18924
19093
|
var filtersToRecord = (filters) => {
|
|
18925
19094
|
const out = {};
|
|
@@ -19809,12 +19978,15 @@ var DataTable = ({
|
|
|
19809
19978
|
[filteredRows, columns, manual, sortKey, sortDir]
|
|
19810
19979
|
);
|
|
19811
19980
|
const firstColumnTakesTheRest = (selectable || actionColumn) && columns.length > 0 && columns.every((c) => c.width);
|
|
19812
|
-
const
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
|
|
19981
|
+
const tableMinimum = tableMinWidth(
|
|
19982
|
+
columns,
|
|
19983
|
+
[
|
|
19984
|
+
expandable && EXPAND_COLUMN_WIDTH,
|
|
19985
|
+
selectable && SELECT_COLUMN_WIDTH,
|
|
19986
|
+
actionColumn && (rowEditing ? EDIT_ACTION_COLUMN_WIDTH : ACTION_COLUMN_WIDTH)
|
|
19987
|
+
].filter((w) => Boolean(w)),
|
|
19988
|
+
firstColumnTakesTheRest ? 0 : void 0
|
|
19989
|
+
);
|
|
19818
19990
|
const mobileSortable = columns.some((c) => c.sortable);
|
|
19819
19991
|
const hasRows = sortedRows.length > 0;
|
|
19820
19992
|
const showSkeleton = loading && !hasRows;
|
|
@@ -20279,7 +20451,11 @@ var DataTable = ({
|
|
|
20279
20451
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
20280
20452
|
"div",
|
|
20281
20453
|
{
|
|
20282
|
-
className: clsx.clsx(
|
|
20454
|
+
className: clsx.clsx(
|
|
20455
|
+
// The actions go to the next line when the count leaves them too little room.
|
|
20456
|
+
"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2",
|
|
20457
|
+
mobileCards && "max-sm:flex-1"
|
|
20458
|
+
),
|
|
20283
20459
|
children: [
|
|
20284
20460
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-brand-700 dark:text-brand-300 text-sm font-medium whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsxs("bdi", { children: [
|
|
20285
20461
|
selection.size,
|
|
@@ -20294,7 +20470,7 @@ var DataTable = ({
|
|
|
20294
20470
|
children: "Clear"
|
|
20295
20471
|
}
|
|
20296
20472
|
),
|
|
20297
|
-
(bulkActionItems || bulkActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-
|
|
20473
|
+
(bulkActionItems || bulkActions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-auto flex-wrap items-center gap-2 ps-1", children: [
|
|
20298
20474
|
bulkActionItems && /* @__PURE__ */ jsxRuntime.jsx(
|
|
20299
20475
|
DataTableBulkActions,
|
|
20300
20476
|
{
|
|
@@ -20431,7 +20607,7 @@ var DataTable = ({
|
|
|
20431
20607
|
"aria-labelledby": ariaLabelledBy,
|
|
20432
20608
|
"aria-busy": loading || void 0,
|
|
20433
20609
|
"aria-rowcount": windowed ? pageRows.length + 1 : void 0,
|
|
20434
|
-
style:
|
|
20610
|
+
style: tableMinimum ? { minWidth: tableMinimum } : void 0,
|
|
20435
20611
|
className: "w-full table-fixed",
|
|
20436
20612
|
children: [
|
|
20437
20613
|
/* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
|
|
@@ -21382,7 +21558,7 @@ var SocialAuthButtons = ({
|
|
|
21382
21558
|
onClick: () => onProviderClick(provider),
|
|
21383
21559
|
disabled: isDisabled,
|
|
21384
21560
|
"aria-label": label,
|
|
21385
|
-
className: "focus-visible:focus-indicator h-ctrl-40 flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",
|
|
21561
|
+
className: "focus-visible:focus-indicator h-ctrl-40 flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700 [&>svg]:shrink-0",
|
|
21386
21562
|
children: [
|
|
21387
21563
|
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(Icon2, {}),
|
|
21388
21564
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label })
|