@loykin/designkit 0.0.1-dev.1 → 0.0.1-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
2
2
  import { clsx } from 'clsx';
3
3
  import { twMerge } from 'tailwind-merge';
4
- import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
4
+ import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
5
5
  import { mergeProps } from '@base-ui/react/merge-props';
6
6
  import { useRender } from '@base-ui/react/use-render';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import { Button as Button$1 } from '@base-ui/react/button';
9
9
  import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
10
- import { CheckIcon, ChevronRightIcon, ChevronDownIcon, ChevronUpIcon, XIcon, PanelLeftIcon, Check } from 'lucide-react';
10
+ import { GripHorizontal, CheckIcon, ChevronRightIcon, ChevronDownIcon, ChevronUpIcon, XIcon, PanelLeftIcon, SlidersHorizontal, Check } from 'lucide-react';
11
11
  import { Menu } from '@base-ui/react/menu';
12
12
  import { Input as Input$1 } from '@base-ui/react/input';
13
13
  import { Popover as Popover$1 } from '@base-ui/react/popover';
@@ -17,7 +17,7 @@ import { Select as Select$1 } from '@base-ui/react/select';
17
17
  import { Separator as Separator$1 } from '@base-ui/react/separator';
18
18
  import { Dialog } from '@base-ui/react/dialog';
19
19
  import * as React2 from 'react';
20
- import React2__default, { useMemo, Children, useState, Fragment, useEffect } from 'react';
20
+ import React2__default, { forwardRef, useMemo, Children, useState, Fragment, useCallback, useEffect } from 'react';
21
21
  import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
22
22
  import { Slider as Slider$1 } from '@base-ui/react/slider';
23
23
  import { Switch as Switch$1 } from '@base-ui/react/switch';
@@ -112,7 +112,11 @@ function AvatarGroupCount({ className, ...props }) {
112
112
  );
113
113
  }
114
114
  var badgeVariants = cva(
115
- "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
115
+ // transition-all is replaced with an explicit list to prevent width animation
116
+ // on font swap (e.g. font-display:swap triggering a layout recalc). Inside
117
+ // overflow:clip containers like DataGrid cells, an animated width change makes
118
+ // the pill appear to grow from a clipped state. Color transitions are preserved.
119
+ "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,opacity] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
116
120
  {
117
121
  variants: {
118
122
  variant: {
@@ -2130,6 +2134,259 @@ var DataPage = Object.assign(Root, {
2130
2134
  GroupBody,
2131
2135
  Footer
2132
2136
  });
2137
+ var DashboardPanel = forwardRef(function DashboardPanel2({
2138
+ title,
2139
+ description,
2140
+ loading,
2141
+ error,
2142
+ transparent,
2143
+ editable,
2144
+ className,
2145
+ style,
2146
+ children,
2147
+ headerRight
2148
+ }, ref) {
2149
+ return /* @__PURE__ */ jsxs(
2150
+ "div",
2151
+ {
2152
+ ref,
2153
+ className: cn(
2154
+ "group flex h-full flex-col overflow-hidden",
2155
+ transparent ? "" : "rounded-(--radius) border bg-card text-card-foreground",
2156
+ editable && "ring-1 ring-border/60 ring-inset",
2157
+ className
2158
+ ),
2159
+ style,
2160
+ children: [
2161
+ (title || headerRight || editable) && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 pl-3 pr-1.5 py-2", children: [
2162
+ editable && /* @__PURE__ */ jsx("div", { className: "shrink-0 cursor-grab active:cursor-grabbing select-none text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors -ml-1 px-0.5", children: /* @__PURE__ */ jsx(GripHorizontal, { className: "h-3.5 w-3.5" }) }),
2163
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2164
+ title && /* @__PURE__ */ jsx("p", { className: "truncate text-xs font-medium text-card-foreground", children: title }),
2165
+ description && /* @__PURE__ */ jsx("p", { className: "truncate text-[11px] text-muted-foreground", children: description })
2166
+ ] }),
2167
+ headerRight && /* @__PURE__ */ jsx("div", { className: "shrink-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-150", children: headerRight })
2168
+ ] }),
2169
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-h-0 p-3", children: [
2170
+ loading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-card/70 z-10", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }) }),
2171
+ error && /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error }) }),
2172
+ !error && children
2173
+ ] })
2174
+ ]
2175
+ }
2176
+ );
2177
+ });
2178
+ function DashboardBodyTemplate({
2179
+ theme,
2180
+ className,
2181
+ title,
2182
+ description,
2183
+ topBar,
2184
+ toolbar,
2185
+ variableBar,
2186
+ children,
2187
+ contentClassName
2188
+ }) {
2189
+ return /* @__PURE__ */ jsxs(DataPage, { className: cn("layout-dashboard", className), style: theme, children: [
2190
+ topBar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topBar }),
2191
+ (title || toolbar) && /* @__PURE__ */ jsx("header", { className: "shrink-0 border-b px-(--dk-page-padding-x) py-(--dk-page-padding-y)", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
2192
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2193
+ title && /* @__PURE__ */ jsx("h1", { className: "text-sm font-semibold truncate", children: title }),
2194
+ description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
2195
+ ] }),
2196
+ toolbar && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: toolbar })
2197
+ ] }) }),
2198
+ variableBar && /* @__PURE__ */ jsx("div", { className: "shrink-0 flex flex-wrap items-center gap-2 px-(--dk-page-padding-x) py-1.5", children: variableBar }),
2199
+ /* @__PURE__ */ jsx("div", { className: cn("flex-1 min-h-0 overflow-auto px-[calc(var(--dk-page-padding-x)-0.5rem)] pt-0 pb-(--dk-page-padding-y)", contentClassName), children })
2200
+ ] });
2201
+ }
2202
+ function clamp(value, min, max) {
2203
+ return Math.min(Math.max(value, min), max);
2204
+ }
2205
+ function ResizeHandle({
2206
+ axis,
2207
+ onPointerDown,
2208
+ className
2209
+ }) {
2210
+ return /* @__PURE__ */ jsxs(
2211
+ "div",
2212
+ {
2213
+ role: "separator",
2214
+ "aria-orientation": axis === "x" ? "vertical" : "horizontal",
2215
+ className: cn(
2216
+ "group/resize relative z-10 shrink-0 touch-none bg-transparent",
2217
+ axis === "x" ? "-mx-1 w-2 cursor-col-resize" : "-my-1 h-2 cursor-row-resize",
2218
+ className
2219
+ ),
2220
+ onPointerDown,
2221
+ children: [
2222
+ /* @__PURE__ */ jsx(
2223
+ "div",
2224
+ {
2225
+ className: cn(
2226
+ "absolute bg-border transition-colors group-hover/resize:bg-muted-foreground/40",
2227
+ axis === "x" ? "left-1/2 top-0 h-full w-px -translate-x-1/2" : "left-0 top-1/2 h-px w-full -translate-y-1/2"
2228
+ )
2229
+ }
2230
+ ),
2231
+ /* @__PURE__ */ jsx(
2232
+ "div",
2233
+ {
2234
+ className: cn(
2235
+ "absolute rounded-full bg-muted-foreground/35 opacity-0 transition-opacity group-hover/resize:opacity-100",
2236
+ axis === "x" ? "left-1/2 top-1/2 h-10 w-1 -translate-x-1/2 -translate-y-1/2" : "left-1/2 top-1/2 h-1 w-10 -translate-x-1/2 -translate-y-1/2"
2237
+ )
2238
+ }
2239
+ )
2240
+ ]
2241
+ }
2242
+ );
2243
+ }
2244
+ function WorkbenchBodyTemplate({
2245
+ theme,
2246
+ className,
2247
+ contentClassName,
2248
+ title,
2249
+ description,
2250
+ topBar,
2251
+ headerRight,
2252
+ toolbar,
2253
+ actions,
2254
+ leftPane,
2255
+ mainPane,
2256
+ rightPane,
2257
+ bottomPane,
2258
+ children,
2259
+ resizable = true,
2260
+ leftPaneCollapsed,
2261
+ rightPaneCollapsed,
2262
+ bottomPaneCollapsed,
2263
+ leftPaneWidth = 260,
2264
+ rightPaneWidth = 320,
2265
+ bottomPaneHeight = 240,
2266
+ minLeftPaneWidth = 180,
2267
+ maxLeftPaneWidth = 440,
2268
+ minRightPaneWidth = 240,
2269
+ maxRightPaneWidth = 520,
2270
+ minBottomPaneHeight = 120,
2271
+ maxBottomPaneHeight = 420,
2272
+ leftPaneClassName,
2273
+ mainPaneClassName,
2274
+ rightPaneClassName,
2275
+ bottomPaneClassName
2276
+ }) {
2277
+ const [leftWidth, setLeftWidth] = useState(leftPaneWidth);
2278
+ const [rightWidth, setRightWidth] = useState(rightPaneWidth);
2279
+ const [bottomHeight, setBottomHeight] = useState(bottomPaneHeight);
2280
+ const startResize = useCallback((event, axis, applyDelta) => {
2281
+ if (!resizable) return;
2282
+ const start = axis === "x" ? event.clientX : event.clientY;
2283
+ event.currentTarget.setPointerCapture(event.pointerId);
2284
+ const previousCursor = document.body.style.cursor;
2285
+ const previousUserSelect = document.body.style.userSelect;
2286
+ document.body.style.cursor = axis === "x" ? "col-resize" : "row-resize";
2287
+ document.body.style.userSelect = "none";
2288
+ const onPointerMove = (moveEvent) => {
2289
+ applyDelta((axis === "x" ? moveEvent.clientX : moveEvent.clientY) - start);
2290
+ };
2291
+ const onPointerUp = () => {
2292
+ document.body.style.cursor = previousCursor;
2293
+ document.body.style.userSelect = previousUserSelect;
2294
+ window.removeEventListener("pointermove", onPointerMove);
2295
+ window.removeEventListener("pointerup", onPointerUp);
2296
+ };
2297
+ window.addEventListener("pointermove", onPointerMove);
2298
+ window.addEventListener("pointerup", onPointerUp, { once: true });
2299
+ }, [resizable]);
2300
+ const headerRightContent = headerRight ?? toolbar;
2301
+ const showHeader = title || description || headerRightContent || actions;
2302
+ const showLeftPane = leftPane && !leftPaneCollapsed;
2303
+ const showRightPane = rightPane && !rightPaneCollapsed;
2304
+ const showBottomPane = bottomPane && !bottomPaneCollapsed;
2305
+ return /* @__PURE__ */ jsxs(DataPage, { className: cn("layout-workbench", className), style: theme, children: [
2306
+ topBar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topBar }),
2307
+ showHeader && /* @__PURE__ */ jsx("header", { className: "shrink-0 border-b px-(--dk-page-padding-x) py-[calc(var(--dk-page-padding-y)*0.75)]", children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-[var(--dk-toolbar-height)] items-center justify-between gap-3", children: [
2308
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2309
+ title && /* @__PURE__ */ jsx("h1", { className: "truncate text-sm font-semibold", children: title }),
2310
+ description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: description })
2311
+ ] }),
2312
+ (headerRightContent || actions) && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
2313
+ headerRightContent,
2314
+ actions
2315
+ ] })
2316
+ ] }) }),
2317
+ /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-0 flex-1 overflow-hidden", contentClassName), children: [
2318
+ showLeftPane && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2319
+ /* @__PURE__ */ jsx(
2320
+ "aside",
2321
+ {
2322
+ className: cn("min-h-0 shrink-0 overflow-hidden border-r bg-card/45", leftPaneClassName),
2323
+ style: { width: leftWidth },
2324
+ children: leftPane
2325
+ }
2326
+ ),
2327
+ resizable && /* @__PURE__ */ jsx(
2328
+ ResizeHandle,
2329
+ {
2330
+ axis: "x",
2331
+ onPointerDown: (event) => {
2332
+ const start = leftWidth;
2333
+ startResize(event, "x", (delta) => {
2334
+ setLeftWidth(clamp(start + delta, minLeftPaneWidth, maxLeftPaneWidth));
2335
+ });
2336
+ }
2337
+ }
2338
+ )
2339
+ ] }),
2340
+ /* @__PURE__ */ jsxs("main", { className: cn("flex min-w-0 flex-1 flex-col overflow-hidden", mainPaneClassName), children: [
2341
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: mainPane ?? children }),
2342
+ showBottomPane && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2343
+ resizable && /* @__PURE__ */ jsx(
2344
+ ResizeHandle,
2345
+ {
2346
+ axis: "y",
2347
+ onPointerDown: (event) => {
2348
+ const start = bottomHeight;
2349
+ startResize(event, "y", (delta) => {
2350
+ setBottomHeight(clamp(start - delta, minBottomPaneHeight, maxBottomPaneHeight));
2351
+ });
2352
+ }
2353
+ }
2354
+ ),
2355
+ /* @__PURE__ */ jsx(
2356
+ "section",
2357
+ {
2358
+ className: cn("min-h-0 shrink-0 overflow-hidden border-t bg-card/40", bottomPaneClassName),
2359
+ style: { height: bottomHeight },
2360
+ children: bottomPane
2361
+ }
2362
+ )
2363
+ ] })
2364
+ ] }),
2365
+ showRightPane && /* @__PURE__ */ jsxs(Fragment$1, { children: [
2366
+ resizable && /* @__PURE__ */ jsx(
2367
+ ResizeHandle,
2368
+ {
2369
+ axis: "x",
2370
+ onPointerDown: (event) => {
2371
+ const start = rightWidth;
2372
+ startResize(event, "x", (delta) => {
2373
+ setRightWidth(clamp(start - delta, minRightPaneWidth, maxRightPaneWidth));
2374
+ });
2375
+ }
2376
+ }
2377
+ ),
2378
+ /* @__PURE__ */ jsx(
2379
+ "aside",
2380
+ {
2381
+ className: cn("min-h-0 shrink-0 overflow-hidden border-l bg-card/45", rightPaneClassName),
2382
+ style: { width: rightWidth },
2383
+ children: rightPane
2384
+ }
2385
+ )
2386
+ ] })
2387
+ ] })
2388
+ ] });
2389
+ }
2133
2390
  function DataBodyTab(_props) {
2134
2391
  return null;
2135
2392
  }
@@ -2202,12 +2459,13 @@ function renderGroupProps(props) {
2202
2459
  description,
2203
2460
  actions,
2204
2461
  danger,
2462
+ className,
2205
2463
  children
2206
2464
  } = props;
2207
2465
  const variant = variantProp ?? layoutDefaultVariant[layout];
2208
2466
  if (layout === "split") {
2209
2467
  const panes = Children.toArray(children);
2210
- return /* @__PURE__ */ jsxs("div", { className: "py-(--dk-panel-gap)", children: [
2468
+ return /* @__PURE__ */ jsxs("div", { className: cn("py-(--dk-panel-gap)", className), children: [
2211
2469
  (title || description || actions) && /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-start justify-between", children: [
2212
2470
  /* @__PURE__ */ jsxs("div", { children: [
2213
2471
  title && /* @__PURE__ */ jsx("h2", { className: cn("text-sm font-semibold", danger && "text-destructive"), children: title }),
@@ -2219,7 +2477,7 @@ function renderGroupProps(props) {
2219
2477
  ] });
2220
2478
  }
2221
2479
  if (layout === "horizontal") {
2222
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-[calc(var(--dk-panel-gap)*2)] py-(--dk-panel-gap)", children: [
2480
+ return /* @__PURE__ */ jsxs("div", { className: cn("grid grid-cols-3 gap-[calc(var(--dk-panel-gap)*2)] py-(--dk-panel-gap)", className), children: [
2223
2481
  /* @__PURE__ */ jsxs("div", { children: [
2224
2482
  /* @__PURE__ */ jsx("p", { className: cn("text-sm font-medium", danger && "text-destructive"), children: title }),
2225
2483
  description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: description }),
@@ -2229,7 +2487,7 @@ function renderGroupProps(props) {
2229
2487
  ] });
2230
2488
  }
2231
2489
  if (layout === "inline") {
2232
- return /* @__PURE__ */ jsxs("div", { className: "py-(--dk-panel-gap)", children: [
2490
+ return /* @__PURE__ */ jsxs("div", { className: cn("py-(--dk-panel-gap)", className), children: [
2233
2491
  (title || description) && /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-start justify-between", children: [
2234
2492
  /* @__PURE__ */ jsxs("div", { children: [
2235
2493
  title && /* @__PURE__ */ jsx("h2", { className: cn("text-sm font-semibold", danger && "text-destructive"), children: title }),
@@ -2240,7 +2498,7 @@ function renderGroupProps(props) {
2240
2498
  /* @__PURE__ */ jsx(GroupWrapper, { layout, variant, children })
2241
2499
  ] });
2242
2500
  }
2243
- return /* @__PURE__ */ jsxs("div", { className: "py-(--dk-panel-gap)", children: [
2501
+ return /* @__PURE__ */ jsxs("div", { className: cn("py-(--dk-panel-gap)", className), children: [
2244
2502
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
2245
2503
  /* @__PURE__ */ jsxs("div", { children: [
2246
2504
  /* @__PURE__ */ jsx("h2", { className: cn("text-sm font-semibold", danger && "text-destructive"), children: title }),
@@ -2408,6 +2666,330 @@ var DataBodyTemplate = Object.assign(Root2, {
2408
2666
  Row: DataBodyRow,
2409
2667
  Field: DataBodyField
2410
2668
  });
2669
+ function useIsNarrow() {
2670
+ const [narrow, setNarrow] = useState(false);
2671
+ useEffect(() => {
2672
+ const mql = window.matchMedia("(max-width: 1023px)");
2673
+ setNarrow(mql.matches);
2674
+ const handler = (e) => setNarrow(e.matches);
2675
+ mql.addEventListener("change", handler);
2676
+ return () => mql.removeEventListener("change", handler);
2677
+ }, []);
2678
+ return narrow;
2679
+ }
2680
+ function BrowseBodyTemplate({
2681
+ theme,
2682
+ className,
2683
+ topBar,
2684
+ title,
2685
+ description,
2686
+ actions,
2687
+ sidebar,
2688
+ sidebarTitle = "Filters",
2689
+ sidebarWidth = "18rem",
2690
+ toolbar,
2691
+ footer,
2692
+ contentClassName,
2693
+ children
2694
+ }) {
2695
+ const isNarrow = useIsNarrow();
2696
+ const hasHeader = title || description || actions;
2697
+ return /* @__PURE__ */ jsxs(DataPage, { className: cn("layout-browse", className), style: theme, children: [
2698
+ topBar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topBar }),
2699
+ hasHeader && /* @__PURE__ */ jsxs(DataPage.Header, { children: [
2700
+ /* @__PURE__ */ jsx(DataPage.TitleBlock, { title, description }),
2701
+ /* @__PURE__ */ jsx(DataPage.Actions, { children: actions })
2702
+ ] }),
2703
+ /* @__PURE__ */ jsxs(DataPage.Content, { padding: "none", className: "flex flex-col overflow-hidden", children: [
2704
+ (toolbar || isNarrow) && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b px-(--dk-page-padding-x) py-2", children: [
2705
+ isNarrow && /* @__PURE__ */ jsxs(Sheet, { children: [
2706
+ /* @__PURE__ */ jsxs(
2707
+ SheetTrigger,
2708
+ {
2709
+ render: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", className: "shrink-0 gap-1.5" }),
2710
+ children: [
2711
+ /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
2712
+ sidebarTitle
2713
+ ]
2714
+ }
2715
+ ),
2716
+ /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "flex flex-col gap-0 p-0", children: [
2717
+ /* @__PURE__ */ jsx(SheetHeader, { className: "shrink-0 border-b px-4 py-3", children: /* @__PURE__ */ jsx(SheetTitle, { children: sidebarTitle }) }),
2718
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx("div", { className: "p-4", children: sidebar }) })
2719
+ ] })
2720
+ ] }),
2721
+ toolbar && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: toolbar })
2722
+ ] }),
2723
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
2724
+ !isNarrow && /* @__PURE__ */ jsx(
2725
+ "aside",
2726
+ {
2727
+ className: "shrink-0 overflow-hidden border-r",
2728
+ style: { width: sidebarWidth },
2729
+ children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsx("div", { className: "px-(--dk-page-padding-x) py-(--dk-page-padding-y)", children: sidebar }) })
2730
+ }
2731
+ ),
2732
+ /* @__PURE__ */ jsx(
2733
+ "div",
2734
+ {
2735
+ className: cn(
2736
+ "min-w-0 flex-1 overflow-hidden px-(--dk-page-padding-x) py-(--dk-page-padding-y)",
2737
+ "[&_.gridkit-shell]:h-full [&_.gridkit-table-stack]:flex-1 [&_.gridkit-table-stack]:min-h-0",
2738
+ "[&_.gridkit-frame]:flex-1 [&_.gridkit-frame]:min-h-0 [&_.gridkit-frame]:overflow-auto",
2739
+ contentClassName
2740
+ ),
2741
+ children
2742
+ }
2743
+ )
2744
+ ] })
2745
+ ] }),
2746
+ footer && /* @__PURE__ */ jsx(DataPage.Footer, { children: footer })
2747
+ ] });
2748
+ }
2749
+ function DetailBodyHeader({
2750
+ eyebrow,
2751
+ title,
2752
+ description,
2753
+ status,
2754
+ actions,
2755
+ compact,
2756
+ className
2757
+ }) {
2758
+ return /* @__PURE__ */ jsxs(DataPage.Header, { className, children: [
2759
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2760
+ eyebrow && /* @__PURE__ */ jsx("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: eyebrow }),
2761
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
2762
+ title && /* @__PURE__ */ jsx("h1", { className: cn("min-w-0 truncate font-semibold", compact ? "text-base" : "text-lg"), children: title }),
2763
+ status && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: status })
2764
+ ] }),
2765
+ description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
2766
+ ] }),
2767
+ /* @__PURE__ */ jsx(DataPage.Actions, { children: actions })
2768
+ ] });
2769
+ }
2770
+ function DetailBodyTab(_props) {
2771
+ return null;
2772
+ }
2773
+ function isDetailBodyTab(node) {
2774
+ return Boolean(node && typeof node === "object" && "type" in node && node.type === DetailBodyTab);
2775
+ }
2776
+ function DetailBodySection({
2777
+ title,
2778
+ description,
2779
+ actions,
2780
+ surface = "plain",
2781
+ className,
2782
+ children
2783
+ }) {
2784
+ return /* @__PURE__ */ jsxs(
2785
+ "section",
2786
+ {
2787
+ className: cn(
2788
+ "min-h-0",
2789
+ surface === "card" && "rounded-(--radius) border bg-card p-(--dk-panel-gap) text-card-foreground shadow-sm",
2790
+ surface === "bordered" && "rounded-(--radius) border p-(--dk-panel-gap)",
2791
+ className
2792
+ ),
2793
+ children: [
2794
+ (title || description || actions) && /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-start justify-between gap-3", children: [
2795
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2796
+ title && /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold", children: title }),
2797
+ description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: description })
2798
+ ] }),
2799
+ actions && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: actions })
2800
+ ] }),
2801
+ children
2802
+ ]
2803
+ }
2804
+ );
2805
+ }
2806
+ function renderChildren(nodes) {
2807
+ return Children.toArray(nodes).map((child, i) => /* @__PURE__ */ jsx(Fragment, { children: child }, i));
2808
+ }
2809
+ function DetailBodyTemplateRoot({
2810
+ variant = "record",
2811
+ theme,
2812
+ className,
2813
+ topBar,
2814
+ header,
2815
+ lead,
2816
+ eyebrow,
2817
+ title,
2818
+ description,
2819
+ status,
2820
+ actions,
2821
+ media,
2822
+ aside,
2823
+ summary,
2824
+ stickyAside = true,
2825
+ contentClassName,
2826
+ mediaClassName,
2827
+ asideClassName,
2828
+ children
2829
+ }) {
2830
+ const childArray = useMemo(() => Children.toArray(children), [children]);
2831
+ const tabs = childArray.filter(isDetailBodyTab);
2832
+ const hasTabs = tabs.length > 0;
2833
+ const [activeTab, setActiveTab] = useState(() => tabs[0]?.props.id ?? "");
2834
+ const selectedTab = tabs.find((tab) => tab.props.id === activeTab) ?? tabs[0];
2835
+ const summarySlot = summary ? /* @__PURE__ */ jsx("div", { className: "min-h-0 rounded-(--radius) border bg-card p-(--dk-panel-gap) text-card-foreground", children: summary }) : null;
2836
+ const mediaSlot = media ? /* @__PURE__ */ jsx("div", { className: cn("min-h-0 overflow-hidden rounded-(--radius) border bg-card", mediaClassName), children: media }) : null;
2837
+ const leadGridClass = variant === "media" ? "xl:grid-cols-[minmax(0,1.35fr)_minmax(18rem,0.65fr)]" : "xl:grid-cols-2";
2838
+ const defaultHeader = eyebrow || title || description || status || actions ? /* @__PURE__ */ jsx(
2839
+ DetailBodyHeader,
2840
+ {
2841
+ eyebrow,
2842
+ title,
2843
+ description,
2844
+ status,
2845
+ actions
2846
+ }
2847
+ ) : null;
2848
+ const defaultLead = media || summary ? /* @__PURE__ */ jsxs("div", { className: cn("grid gap-(--dk-panel-gap)", leadGridClass), children: [
2849
+ mediaSlot,
2850
+ summarySlot
2851
+ ] }) : null;
2852
+ const body = hasTabs ? /* @__PURE__ */ jsxs("div", { className: "min-h-0", children: [
2853
+ /* @__PURE__ */ jsx(DataPage.Tabs, { children: tabs.map((tab) => /* @__PURE__ */ jsx(
2854
+ DataPage.Tab,
2855
+ {
2856
+ active: (selectedTab?.props.id ?? "") === tab.props.id,
2857
+ count: tab.props.count,
2858
+ disabled: tab.props.disabled,
2859
+ onClick: () => setActiveTab(tab.props.id),
2860
+ children: tab.props.label
2861
+ },
2862
+ tab.props.id
2863
+ )) }),
2864
+ /* @__PURE__ */ jsx("div", { className: "pt-(--dk-panel-gap)", children: selectedTab?.props.children })
2865
+ ] }) : /* @__PURE__ */ jsx("div", { className: "space-y-(--dk-panel-gap)", children: renderChildren(children) });
2866
+ const leadSlot = lead ?? defaultLead;
2867
+ const outsideAsideSlot = variant === "full" ? null : aside;
2868
+ const insideAsideSlot = variant === "full" ? aside : null;
2869
+ const hasRecordInspector = Boolean(leadSlot);
2870
+ const hasFullLeadArea = Boolean(leadSlot || insideAsideSlot);
2871
+ const layout = {
2872
+ media: /* @__PURE__ */ jsxs(Fragment$1, { children: [
2873
+ leadSlot && /* @__PURE__ */ jsx("div", { className: "mb-(--dk-panel-gap)", children: leadSlot }),
2874
+ body
2875
+ ] }),
2876
+ record: /* @__PURE__ */ jsxs(
2877
+ "div",
2878
+ {
2879
+ className: cn(
2880
+ "grid gap-(--dk-panel-gap)",
2881
+ hasRecordInspector && "xl:grid-cols-[minmax(28rem,1fr)_minmax(14rem,18rem)]"
2882
+ ),
2883
+ children: [
2884
+ /* @__PURE__ */ jsx("div", { className: "min-w-0", children: body }),
2885
+ hasRecordInspector && /* @__PURE__ */ jsx("div", { className: "space-y-(--dk-panel-gap)", children: leadSlot })
2886
+ ]
2887
+ }
2888
+ ),
2889
+ full: /* @__PURE__ */ jsxs(Fragment$1, { children: [
2890
+ hasFullLeadArea && /* @__PURE__ */ jsxs(
2891
+ "div",
2892
+ {
2893
+ className: cn(
2894
+ "mb-(--dk-panel-gap) grid gap-(--dk-panel-gap)",
2895
+ insideAsideSlot && "xl:grid-cols-[minmax(0,1fr)_minmax(18rem,24rem)]"
2896
+ ),
2897
+ children: [
2898
+ leadSlot && /* @__PURE__ */ jsx("div", { className: "space-y-(--dk-panel-gap)", children: leadSlot }),
2899
+ insideAsideSlot && /* @__PURE__ */ jsx("div", { className: cn("min-h-0 rounded-(--radius) border bg-card p-(--dk-panel-gap)", asideClassName), children: insideAsideSlot })
2900
+ ]
2901
+ }
2902
+ ),
2903
+ body
2904
+ ] })
2905
+ };
2906
+ return /* @__PURE__ */ jsxs(DataPage, { className: cn("layout-detail", className), style: theme, "data-detail-variant": variant, children: [
2907
+ topBar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topBar }),
2908
+ header ?? defaultHeader,
2909
+ /* @__PURE__ */ jsx(DataPage.Content, { padding: "none", className: "overflow-hidden", children: /* @__PURE__ */ jsxs(
2910
+ "div",
2911
+ {
2912
+ className: cn(
2913
+ "grid h-full min-h-0 grid-cols-1 overflow-hidden",
2914
+ outsideAsideSlot && "lg:grid-cols-[minmax(0,1fr)_minmax(18rem,24rem)]"
2915
+ ),
2916
+ children: [
2917
+ /* @__PURE__ */ jsx(
2918
+ "main",
2919
+ {
2920
+ className: cn(
2921
+ "min-h-0 overflow-auto px-(--dk-page-padding-x) py-(--dk-page-padding-y)",
2922
+ contentClassName
2923
+ ),
2924
+ children: layout[variant]
2925
+ }
2926
+ ),
2927
+ outsideAsideSlot && /* @__PURE__ */ jsx("aside", { className: cn("min-h-0 border-t bg-background lg:border-l lg:border-t-0", asideClassName), children: /* @__PURE__ */ jsx(
2928
+ "div",
2929
+ {
2930
+ className: cn(
2931
+ "px-(--dk-page-padding-x) py-(--dk-page-padding-y)",
2932
+ stickyAside && "lg:sticky lg:top-0"
2933
+ ),
2934
+ children: outsideAsideSlot
2935
+ }
2936
+ ) })
2937
+ ]
2938
+ }
2939
+ ) })
2940
+ ] });
2941
+ }
2942
+ var DetailBodyTemplate = Object.assign(DetailBodyTemplateRoot, {
2943
+ Header: DetailBodyHeader,
2944
+ Tab: DetailBodyTab,
2945
+ Section: DetailBodySection
2946
+ });
2947
+ function ListDetailBodyTemplate({
2948
+ theme,
2949
+ className,
2950
+ topBar,
2951
+ list,
2952
+ detail,
2953
+ emptyDetail,
2954
+ listWidth = 320,
2955
+ listClassName,
2956
+ detailClassName
2957
+ }) {
2958
+ return /* @__PURE__ */ jsxs(
2959
+ DataPage,
2960
+ {
2961
+ className: cn("layout-list-detail", className),
2962
+ style: { "--ld-list-width": `${listWidth}px`, ...theme },
2963
+ children: [
2964
+ topBar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: topBar }),
2965
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
2966
+ /* @__PURE__ */ jsx(
2967
+ "aside",
2968
+ {
2969
+ className: cn(
2970
+ "min-h-0 shrink-0 overflow-hidden border-r",
2971
+ detail ? "hidden lg:flex lg:w-[var(--ld-list-width)] lg:flex-col" : "flex w-full flex-col lg:w-[var(--ld-list-width)]",
2972
+ listClassName
2973
+ ),
2974
+ children: list
2975
+ }
2976
+ ),
2977
+ /* @__PURE__ */ jsx(
2978
+ "main",
2979
+ {
2980
+ className: cn(
2981
+ "min-h-0 min-w-0 flex-1 overflow-auto",
2982
+ !detail && "hidden lg:block",
2983
+ detailClassName
2984
+ ),
2985
+ children: detail ?? emptyDetail
2986
+ }
2987
+ )
2988
+ ] })
2989
+ ]
2990
+ }
2991
+ );
2992
+ }
2411
2993
  function FormWizardBodyTemplate({
2412
2994
  theme,
2413
2995
  title,
@@ -3059,7 +3641,7 @@ function buildTokenMap({
3059
3641
  const c = (factor) => (primaryChroma * factor).toFixed(4);
3060
3642
  return {
3061
3643
  "--dk-radius": `${radius}rem`,
3062
- "--dg-radius": `${radius}rem`,
3644
+ "--gridkit-radius": `${radius}rem`,
3063
3645
  "--radius": `${radius}rem`,
3064
3646
  "--radius-sm": `${(radius * 0.6).toFixed(4)}rem`,
3065
3647
  "--radius-md": `${(radius * 0.8).toFixed(4)}rem`,
@@ -3070,9 +3652,9 @@ function buildTokenMap({
3070
3652
  "--dk-primary": `oklch(0.52 ${primaryChroma} ${primaryHue})`,
3071
3653
  "--dk-primary-foreground": "oklch(0.985 0 0)",
3072
3654
  "--dk-ring": `oklch(0.50 ${primaryChroma} ${primaryHue})`,
3073
- "--dg-primary": `oklch(0.52 ${primaryChroma} ${primaryHue})`,
3074
- "--dg-primary-foreground": "oklch(0.985 0 0)",
3075
- "--dg-ring": `oklch(0.50 ${primaryChroma} ${primaryHue})`,
3655
+ "--gridkit-primary": `oklch(0.52 ${primaryChroma} ${primaryHue})`,
3656
+ "--gridkit-primary-foreground": "oklch(0.985 0 0)",
3657
+ "--gridkit-ring": `oklch(0.50 ${primaryChroma} ${primaryHue})`,
3076
3658
  "--primary": `oklch(0.52 ${primaryChroma} ${primaryHue})`,
3077
3659
  "--primary-foreground": "oklch(0.985 0 0)",
3078
3660
  "--color-primary": `oklch(0.52 ${primaryChroma} ${primaryHue})`,
@@ -3095,8 +3677,8 @@ function buildTokenMap({
3095
3677
  "--dk-border": `oklch(0.922 ${c(0.04)} ${primaryHue})`,
3096
3678
  "--dk-input": `oklch(0.922 ${c(0.04)} ${primaryHue})`,
3097
3679
  "--dk-muted": `oklch(0.970 ${c(0.02)} ${primaryHue})`,
3098
- "--dg-border": `oklch(0.922 ${c(0.04)} ${primaryHue})`,
3099
- "--dg-muted": `oklch(0.970 ${c(0.02)} ${primaryHue})`,
3680
+ "--gridkit-border": `oklch(0.922 ${c(0.04)} ${primaryHue})`,
3681
+ "--gridkit-muted": `oklch(0.970 ${c(0.02)} ${primaryHue})`,
3100
3682
  "--dk-font-scale": fontScale,
3101
3683
  "--dk-line-height": lineHeight,
3102
3684
  "--dk-density": densityValues.density,
@@ -3141,8 +3723,8 @@ function buildDarkTonalTokens(primaryHue, primaryChroma) {
3141
3723
  "--dk-border": `oklch(0.32 ${c(0.06)} ${primaryHue})`,
3142
3724
  "--dk-input": `oklch(0.35 ${c(0.06)} ${primaryHue})`,
3143
3725
  "--dk-muted": `oklch(0.269 ${c(0.03)} ${primaryHue})`,
3144
- "--dg-border": `oklch(0.32 ${c(0.06)} ${primaryHue})`,
3145
- "--dg-muted": `oklch(0.269 ${c(0.03)} ${primaryHue})`
3726
+ "--gridkit-border": `oklch(0.32 ${c(0.06)} ${primaryHue})`,
3727
+ "--gridkit-muted": `oklch(0.269 ${c(0.03)} ${primaryHue})`
3146
3728
  };
3147
3729
  }
3148
3730
  function tokenMapToCss(tokens) {
@@ -3195,7 +3777,7 @@ ${tokenMapToCss(tokens)}
3195
3777
  }, [g.density]);
3196
3778
  }
3197
3779
  function buildTemplateTheme(g, ov = {}) {
3198
- return buildTokenMap({
3780
+ const tokens = buildTokenMap({
3199
3781
  radius: ov.radius ?? g.radius,
3200
3782
  primaryHue: g.primaryHue,
3201
3783
  primaryChroma: ov.primaryChroma ?? g.primaryChroma,
@@ -3206,8 +3788,12 @@ function buildTemplateTheme(g, ov = {}) {
3206
3788
  fontScale: g.fontScale ?? 1,
3207
3789
  lineHeight: g.lineHeight ?? 1
3208
3790
  });
3791
+ if (g.darkMode) {
3792
+ Object.assign(tokens, buildDarkTonalTokens(g.primaryHue, ov.primaryChroma ?? g.primaryChroma));
3793
+ }
3794
+ return tokens;
3209
3795
  }
3210
3796
 
3211
- export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColorsBodyTemplate, DataBodyTemplate, DataPage, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FormWizardBodyTemplate, Input, Label, LoginBodyTemplate, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, PageBreadcrumb, PageTopBar, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TypographyBodyTemplate, badgeVariants, buildTemplateTheme, buildTopBar, buttonVariants, cn, navigationMenuTriggerStyle, tabsListVariants, useIsMobile, useSidebar, useStyleInjector, useThemeStore };
3797
+ export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BrowseBodyTemplate, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColorsBodyTemplate, DashboardBodyTemplate, DashboardPanel, DataBodyTemplate, DataPage, DetailBodyTemplate, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FormWizardBodyTemplate, Input, Label, ListDetailBodyTemplate, LoginBodyTemplate, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPositioner, NavigationMenuTrigger, PageBreadcrumb, PageTopBar, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TypographyBodyTemplate, WorkbenchBodyTemplate, badgeVariants, buildTemplateTheme, buildTopBar, buttonVariants, cn, navigationMenuTriggerStyle, tabsListVariants, useIsMobile, useSidebar, useStyleInjector, useThemeStore };
3212
3798
  //# sourceMappingURL=index.js.map
3213
3799
  //# sourceMappingURL=index.js.map