@okjt/dashboard 0.3.0 → 0.4.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.
@@ -7,7 +7,13 @@ import AdminToolbarSearch from "./AdminToolbarSearch.js";
7
7
  import AdminToolbarFilters, { countActiveFilters } from "./AdminToolbarFilters.js";
8
8
  import { useSearch } from "./SearchContext.js";
9
9
  import { Button, useVisibleActions } from "@okjt/ui";
10
- function AdminFloatingToolbar({
10
+ import BoldToolbar from "./BoldToolbar.js";
11
+ import { useComponentDefaults } from "./DashboardProvider.js";
12
+ function AdminFloatingToolbar(ownProps) {
13
+ const { variant = "plain", ...props } = useComponentDefaults("FloatingToolbar", ownProps);
14
+ return variant === "bold" ? /* @__PURE__ */ jsx(BoldToolbar, { ...props }) : /* @__PURE__ */ jsx(PlainToolbar, { ...props });
15
+ }
16
+ function PlainToolbar({
11
17
  actions = [],
12
18
  children = null,
13
19
  search = null,
@@ -2,10 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { Link } from "react-router-dom";
5
- import { ChevronRight } from "lucide-react";
6
- import { motion } from "framer-motion";
5
+ import { ArrowUp, ChevronRight } from "lucide-react";
6
+ import { AnimatePresence, motion } from "framer-motion";
7
+ import DashboardIcon from "./DashboardIcon.js";
7
8
  import { useAdminChrome } from "./AdminChromeContext.js";
8
- import { useDashboard } from "./DashboardProvider.js";
9
+ import { useComponentDefaults, useDashboard } from "./DashboardProvider.js";
9
10
  const HEADER_OFFSET = 64;
10
11
  function useVisibleBelowHeader(ref) {
11
12
  const [visible, setVisible] = useState(true);
@@ -21,7 +22,11 @@ function useVisibleBelowHeader(ref) {
21
22
  }, [ref]);
22
23
  return visible;
23
24
  }
24
- function AdminPageHero({ title, description, breadcrumb, icon }) {
25
+ function AdminPageHero(ownProps) {
26
+ const { variant = "plain", ...props } = useComponentDefaults("PageHero", ownProps);
27
+ return variant === "bold" ? /* @__PURE__ */ jsx(BoldPageHero, { ...props }) : /* @__PURE__ */ jsx(PlainPageHero, { ...props });
28
+ }
29
+ function PlainPageHero({ title, description, breadcrumb, icon }) {
25
30
  const { home } = useDashboard();
26
31
  const crumbs = Array.isArray(breadcrumb) ? breadcrumb : [home, { label: breadcrumb || title }];
27
32
  const heroRef = useRef(null);
@@ -96,6 +101,66 @@ function AdminPageHero({ title, description, breadcrumb, icon }) {
96
101
  ] }) })
97
102
  ] });
98
103
  }
104
+ const SmallUpArrow = ({ className = "" }) => /* @__PURE__ */ jsx(ArrowUp, { className: `${className} inline h-3 w-3` });
105
+ function BoldBreadcrumb({ items }) {
106
+ if (!items?.length) return null;
107
+ return /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-2 mb-3 text-sm", children: items.map((item, index) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
108
+ index > 0 && /* @__PURE__ */ jsx(DashboardIcon, { icon: "crumb", fallback: ChevronRight, className: "text-faint/70 text-xs" }),
109
+ item.href || item.path ? /* @__PURE__ */ jsx(Link, { to: item.href || item.path, className: "text-soft hover:text-ink transition", children: item.label }) : /* @__PURE__ */ jsx("span", { className: "text-body", children: item.label })
110
+ ] }, index)) });
111
+ }
112
+ function BoldPageHero({ title, subtitle, description, breadcrumbs = [], breadcrumb, actions = null }) {
113
+ const crumbs = breadcrumbs.length ? breadcrumbs : Array.isArray(breadcrumb) ? breadcrumb : [];
114
+ const heroRef = useRef(null);
115
+ const visible = useVisibleBelowHeader(heroRef);
116
+ const { titleSlot } = useAdminChrome();
117
+ const parent = crumbs.length > 1 ? crumbs[crumbs.length - 2] : null;
118
+ const parentTo = parent?.href || parent?.path;
119
+ const compactTitle = titleSlot && createPortal(
120
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !visible && /* @__PURE__ */ jsxs(
121
+ motion.div,
122
+ {
123
+ initial: { opacity: 0, y: -6 },
124
+ animate: { opacity: 1, y: 0 },
125
+ exit: { opacity: 0, y: -6 },
126
+ transition: { duration: 0.15 },
127
+ className: "flex items-center gap-3 min-w-0",
128
+ children: [
129
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
130
+ parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[11px] text-soft truncate", children: parentTo ? /* @__PURE__ */ jsx(Link, { to: parentTo, className: "hover:text-ink transition", children: parent.label }) : parent.label }),
131
+ /* @__PURE__ */ jsx("p", { className: "text-ink font-semibold truncate", children: title })
132
+ ] }),
133
+ /* @__PURE__ */ jsxs(
134
+ "button",
135
+ {
136
+ type: "button",
137
+ onClick: () => window.scrollTo({ top: 0, behavior: "smooth" }),
138
+ className: "hidden md:inline text-xs text-soft hover:text-ink whitespace-nowrap transition",
139
+ title: "Back to top",
140
+ children: [
141
+ /* @__PURE__ */ jsx(DashboardIcon, { icon: "arrow-up", fallback: SmallUpArrow, className: "mr-1" }),
142
+ "Top"
143
+ ]
144
+ }
145
+ )
146
+ ]
147
+ },
148
+ "compact-title"
149
+ ) }),
150
+ titleSlot
151
+ );
152
+ return /* @__PURE__ */ jsxs("div", { className: "mb-6", ref: heroRef, children: [
153
+ compactTitle,
154
+ /* @__PURE__ */ jsx(BoldBreadcrumb, { items: crumbs }),
155
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [
156
+ /* @__PURE__ */ jsxs("div", { children: [
157
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl md:text-3xl font-bold text-ink", children: title }),
158
+ (subtitle || description) && /* @__PURE__ */ jsx("p", { className: "text-soft mt-1 text-sm md:text-base", children: subtitle || description })
159
+ ] }),
160
+ actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 flex-wrap", children: actions })
161
+ ] })
162
+ ] });
163
+ }
99
164
  export {
100
165
  AdminPageHero as default
101
166
  };
@@ -2,8 +2,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { motion } from "framer-motion";
3
3
  import AdminFloatingToolbar from "./AdminFloatingToolbar.js";
4
4
  import { SidePanelAside, SidePanelMobileBar } from "./AdminSidePanel.js";
5
- import { useDashboard } from "./DashboardProvider.js";
6
- function AdminPageLayout({
5
+ import { useComponentDefaults, useDashboard } from "./DashboardProvider.js";
6
+ function AdminPageLayout(ownProps) {
7
+ const { variant = "plain", ...props } = useComponentDefaults("PageLayout", ownProps);
8
+ return variant === "bold" ? /* @__PURE__ */ jsx(BoldPageLayout, { ...props }) : /* @__PURE__ */ jsx(PlainPageLayout, { ...props });
9
+ }
10
+ function PlainPageLayout({
7
11
  hero,
8
12
  summary,
9
13
  children,
@@ -49,6 +53,24 @@ function AdminPageLayout({
49
53
  showToolbar && /* @__PURE__ */ jsx(AdminFloatingToolbar, { actions, search, filters, children: toolbarContent })
50
54
  ] });
51
55
  }
56
+ function BoldPageLayout({ hero, summary = null, toolbar = null, panel: pagePanel, fill = false, onClick, className = "", bodyClassName = "", children }) {
57
+ const defaultPanel = useDashboard().useDefaultPanel();
58
+ const panel = pagePanel === false ? null : pagePanel || defaultPanel;
59
+ const classes = `fit:h-[calc(100dvh-12rem)] fit:flex fit:flex-col ${className}`.trim();
60
+ const body = fill ? "fit:h-full fit:flex fit:flex-col" : "fit:h-full fit:overflow-y-auto fit:overscroll-contain fit:-mx-1 fit:px-1 fit:pb-2";
61
+ return /* @__PURE__ */ jsxs("div", { onClick, className: classes, "data-layout": fill ? "fill" : "fit", children: [
62
+ /* @__PURE__ */ jsxs("div", { className: "fit:shrink-0", children: [
63
+ hero,
64
+ summary && /* @__PURE__ */ jsx("div", { className: "mb-6", children: summary })
65
+ ] }),
66
+ toolbar && /* @__PURE__ */ jsx(AdminFloatingToolbar, { variant: "bold", ...toolbar }),
67
+ panel && !panel.desktopOnly && panel.mobile !== false && /* @__PURE__ */ jsx(SidePanelMobileBar, { panel }),
68
+ /* @__PURE__ */ jsxs("div", { className: `fit:flex-1 fit:min-h-0 ${panel ? "lg:flex lg:gap-5" : ""}`, children: [
69
+ /* @__PURE__ */ jsx("div", { "data-scroll-region": fill ? void 0 : true, className: `min-w-0 ${panel ? "lg:flex-1" : ""} ${body} ${bodyClassName}`, children }),
70
+ panel && /* @__PURE__ */ jsx(SidePanelAside, { panel }, panel.id || panel.title)
71
+ ] })
72
+ ] });
73
+ }
52
74
  export {
53
75
  AdminPageLayout as default
54
76
  };
@@ -1,9 +1,14 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useDashboard, useComponentDefaults } from "./DashboardProvider.js";
3
+ import DashboardIcon, { toIcon } from "./DashboardIcon.js";
2
4
  import { useEffect, useRef, useState } from "react";
3
5
  import { AnimatePresence, Reorder, motion, useDragControls } from "framer-motion";
4
6
  import { Check, CheckSquare, ChevronUp, GripVertical, ListChecks, PanelRightClose, PanelRightOpen, X } from "lucide-react";
5
7
  import { Button, Overlay, buttonClass, usePermissions, useVisibleActions } from "@okjt/ui";
8
+ const useLook = () => useComponentDefaults("SidePanel", {}).variant || "plain";
9
+ const Named = ({ name, fallback: Fallback, className }) => /* @__PURE__ */ jsx(DashboardIcon, { icon: name, fallback: Fallback, className });
6
10
  function Badge({ item }) {
11
+ if (useLook() === "bold") return /* @__PURE__ */ jsx(BoldBadge, { item });
7
12
  if (item.badge > 0) {
8
13
  return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 min-w-[1.25rem] h-5 px-1.5 rounded-full bg-accent/15 text-accent-dark text-[11px] font-semibold flex items-center justify-center", children: item.badge > 99 ? "99+" : item.badge });
9
14
  }
@@ -15,7 +20,17 @@ function Badge({ item }) {
15
20
  }
16
21
  return null;
17
22
  }
23
+ function BoldBadge({ item }) {
24
+ if (item.badge > 0) {
25
+ return /* @__PURE__ */ jsx("span", { className: "ml-auto flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-accent/15 px-1.5 text-[11px] font-semibold text-accent-dark", children: item.badge > 99 ? "99+" : item.badge });
26
+ }
27
+ if (item.dot) return /* @__PURE__ */ jsx("span", { className: "ml-auto h-2 w-2 shrink-0 rounded-full bg-amber-400", "aria-label": "Unsaved changes" });
28
+ if (item.count != null) return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-tone-400", children: item.count });
29
+ return null;
30
+ }
18
31
  function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
32
+ const { iconFor } = useDashboard();
33
+ const look = useLook();
19
34
  const { items = [], activeId, onChange, navVariant = "list" } = panel;
20
35
  if (!items.length) return null;
21
36
  const pick = (id) => {
@@ -24,7 +39,7 @@ function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
24
39
  };
25
40
  if (navVariant === "grid") {
26
41
  return /* @__PURE__ */ jsx("div", { className: `grid gap-1 ${items.length <= 5 ? "grid-cols-5" : "grid-cols-4"}`, role: "tablist", "aria-label": panel.title, children: items.map((item) => {
27
- const Icon = item.icon;
42
+ const Icon = toIcon(item.icon, iconFor);
28
43
  const active = item.id === activeId;
29
44
  return /* @__PURE__ */ jsxs(
30
45
  "button",
@@ -53,7 +68,7 @@ function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
53
68
  const selecting = !!selection?.selecting;
54
69
  const canReorder = !!manage.canReorder && !selecting && movable.length > 1;
55
70
  const row = ({ item, groupStart }, leading) => /* @__PURE__ */ jsxs(Fragment, { children: [
56
- groupStart && /* @__PURE__ */ jsx("p", { className: `px-2 pb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-tone-400 ${groupStart === "later" ? "pt-3" : ""}`, children: item.group }),
71
+ groupStart && /* @__PURE__ */ jsx("p", { className: `${look === "bold" ? "px-2.5 pb-1 text-xs font-semibold capitalize text-tone-400" : "px-2 pb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-tone-400"} ${groupStart === "later" ? "pt-3" : ""}`, children: item.group }),
57
72
  /* @__PURE__ */ jsx(
58
73
  ItemRow,
59
74
  {
@@ -72,7 +87,28 @@ function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
72
87
  ] });
73
88
  }
74
89
  function ItemRow({ item, active, leading, selecting, checked, onClick }) {
75
- const Icon = item.icon;
90
+ const { iconFor } = useDashboard();
91
+ const look = useLook();
92
+ const Icon = toIcon(item.icon, iconFor);
93
+ if (look === "bold" && !selecting && !leading) {
94
+ return /* @__PURE__ */ jsxs(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ "aria-current": active ? "true" : void 0,
99
+ onClick,
100
+ className: `flex w-full items-center gap-3 rounded-xl border px-2 py-2 text-left text-sm transition ${active ? "border-accent-strong/20 bg-accent/10 text-ink" : "border-transparent text-contrast/70 hover:bg-contrast/5 hover:text-ink"}`,
101
+ children: [
102
+ Icon && /* @__PURE__ */ jsx("span", { className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${active ? "bg-contrast/10" : "bg-tone-50"}`, children: /* @__PURE__ */ jsx(Icon, { className: `text-xs ${active ? "text-accent-dark" : "text-contrast/45"}`, "aria-hidden": "true" }) }),
103
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
104
+ /* @__PURE__ */ jsx("span", { className: `block truncate font-medium ${item.muted && !active ? "text-tone-400" : ""}`, children: item.label }),
105
+ item.description && /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-tone-400", children: item.description })
106
+ ] }),
107
+ /* @__PURE__ */ jsx(Badge, { item })
108
+ ]
109
+ }
110
+ );
111
+ }
76
112
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
77
113
  leading,
78
114
  /* @__PURE__ */ jsxs(
@@ -233,12 +269,14 @@ function BulkBar({ selection, actions }) {
233
269
  ] });
234
270
  }
235
271
  function PanelHeader({ panel, children }) {
236
- const Icon = panel.icon;
272
+ const { iconFor } = useDashboard();
273
+ const Icon = toIcon(panel.icon, iconFor);
274
+ const bold = useLook() === "bold";
237
275
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2.5", children: [
238
- Icon && /* @__PURE__ */ jsx(Icon, { className: "w-5 h-5 text-accent mt-0.5 shrink-0", "aria-hidden": "true" }),
276
+ Icon && /* @__PURE__ */ jsx(Icon, { className: bold ? "mt-1 shrink-0 text-accent-dark" : "w-5 h-5 text-accent mt-0.5 shrink-0", "aria-hidden": "true" }),
239
277
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
240
- /* @__PURE__ */ jsx("h2", { className: "text-base font-medium text-tone-800 leading-tight", children: panel.title }),
241
- panel.subtitle && /* @__PURE__ */ jsx("p", { className: "text-xs text-tone-500 mt-0.5", children: panel.subtitle })
278
+ /* @__PURE__ */ jsx("h2", { className: bold ? "text-base font-semibold leading-tight text-ink" : "text-base font-medium text-tone-800 leading-tight", children: panel.title }),
279
+ panel.subtitle && /* @__PURE__ */ jsx("p", { className: bold ? "mt-0.5 text-xs text-tone-500" : "text-xs text-tone-500 mt-0.5", children: panel.subtitle })
242
280
  ] }),
243
281
  children
244
282
  ] });
@@ -253,13 +291,15 @@ function readCollapsed(panel) {
253
291
  return !!panel.defaultCollapsed;
254
292
  }
255
293
  function SidePanelRail({ panel, onExpand }) {
256
- const Icon = panel.icon;
294
+ const { iconFor } = useDashboard();
295
+ const Icon = toIcon(panel.icon, iconFor);
296
+ const bold = useLook() === "bold";
257
297
  return /* @__PURE__ */ jsxs(
258
298
  "aside",
259
299
  {
260
300
  "aria-label": panel.title,
261
301
  "data-side-panel": "collapsed",
262
- className: "hidden lg:flex flex-col items-center gap-1.5 w-12 shrink-0 py-2 lg:sticky lg:top-20 self-start lg:max-h-[calc(100dvh-6.5rem)] overflow-y-auto scrollbar-hide bg-surface rounded-2xl shadow-sm border border-tone-100",
302
+ className: bold ? "hidden lg:flex w-12 shrink-0 flex-col items-center gap-1.5 self-start overflow-y-auto rounded-2xl border border-tone-100 bg-surface py-2 lg:sticky lg:top-20 lg:max-h-[calc(100dvh-6.5rem)]" : "hidden lg:flex flex-col items-center gap-1.5 w-12 shrink-0 py-2 lg:sticky lg:top-20 self-start lg:max-h-[calc(100dvh-6.5rem)] overflow-y-auto scrollbar-hide bg-surface rounded-2xl shadow-sm border border-tone-100",
263
303
  children: [
264
304
  /* @__PURE__ */ jsx(
265
305
  "button",
@@ -268,13 +308,13 @@ function SidePanelRail({ panel, onExpand }) {
268
308
  onClick: onExpand,
269
309
  "aria-label": `Show ${panel.title}`,
270
310
  title: `Show ${panel.title}`,
271
- className: "p-2 rounded-lg text-tone-500 hover:bg-tone-100 hover:text-accent",
272
- children: /* @__PURE__ */ jsx(PanelRightOpen, { className: "w-4 h-4" })
311
+ className: bold ? "rounded-lg p-2 text-tone-500 hover:bg-contrast/5 hover:text-ink" : "p-2 rounded-lg text-tone-500 hover:bg-tone-100 hover:text-accent",
312
+ children: /* @__PURE__ */ jsx(Named, { name: "panel-expand", fallback: PanelRightOpen, className: bold ? "" : "w-4 h-4" })
273
313
  }
274
314
  ),
275
- Icon && !panel.items?.length && /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4 text-accent my-1", "aria-hidden": "true" }),
315
+ Icon && !panel.items?.length && /* @__PURE__ */ jsx(Icon, { className: bold ? "my-1 text-accent-dark" : "w-4 h-4 text-accent my-1", "aria-hidden": "true" }),
276
316
  panel.items?.map((item) => {
277
- const ItemIcon = item.icon;
317
+ const ItemIcon = toIcon(item.icon, iconFor);
278
318
  const active = item.id === panel.activeId;
279
319
  return /* @__PURE__ */ jsxs(
280
320
  "button",
@@ -284,10 +324,10 @@ function SidePanelRail({ panel, onExpand }) {
284
324
  "aria-label": item.label,
285
325
  title: item.label,
286
326
  "aria-current": active ? "true" : void 0,
287
- className: `relative p-2 rounded-lg ${active ? "bg-accent/10 text-accent" : "text-tone-500 hover:bg-tone-100"}`,
327
+ className: bold ? `relative rounded-lg p-2 text-xs ${active ? "bg-accent/10 text-accent-dark" : "text-tone-500 hover:bg-contrast/5"}` : `relative p-2 rounded-lg ${active ? "bg-accent/10 text-accent" : "text-tone-500 hover:bg-tone-100"}`,
288
328
  children: [
289
- ItemIcon ? /* @__PURE__ */ jsx(ItemIcon, { className: "w-4 h-4" }) : item.label.slice(0, 2),
290
- (item.badge > 0 || item.dot) && /* @__PURE__ */ jsx("span", { className: "absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-accent" })
329
+ ItemIcon ? /* @__PURE__ */ jsx(ItemIcon, { className: bold ? "" : "w-4 h-4" }) : item.label.slice(0, 2),
330
+ (item.badge > 0 || item.dot) && /* @__PURE__ */ jsx("span", { className: `absolute top-1 right-1 w-1.5 h-1.5 rounded-full ${bold ? "bg-accent-strong" : "bg-accent"}` })
291
331
  ]
292
332
  },
293
333
  item.id
@@ -299,6 +339,7 @@ function SidePanelRail({ panel, onExpand }) {
299
339
  );
300
340
  }
301
341
  function SidePanelAside({ panel }) {
342
+ const look = useLook();
302
343
  const [collapsed, setCollapsed] = useState(() => readCollapsed(panel));
303
344
  const manage = usePanelManage(panel);
304
345
  const selection = useSelection(panel);
@@ -309,16 +350,17 @@ function SidePanelAside({ panel }) {
309
350
  } catch {
310
351
  }
311
352
  };
353
+ const bold = look === "bold";
312
354
  if (collapsed) return /* @__PURE__ */ jsx(SidePanelRail, { panel, onExpand: () => toggle(false) });
313
355
  const hasListNav = panel.items?.length > 0 && panel.navVariant !== "grid";
314
356
  return /* @__PURE__ */ jsxs(
315
357
  "aside",
316
358
  {
317
359
  "aria-label": panel.title,
318
- "data-side-panel": true,
319
- className: "hidden lg:flex flex-col w-80 xl:w-[22rem] shrink-0 lg:sticky lg:top-20 lg:max-h-[calc(100dvh-6.5rem)] fit:max-h-full self-start fit:self-stretch bg-surface rounded-2xl shadow-sm border border-tone-100 overflow-hidden",
360
+ "data-side-panel": bold ? "expanded" : true,
361
+ className: bold ? "hidden lg:flex w-72 2xl:w-80 shrink-0 flex-col self-start overflow-hidden rounded-2xl border border-tone-100 bg-surface lg:sticky lg:top-20 lg:max-h-[calc(100dvh-6.5rem)] fit:max-h-full fit:self-stretch" : "hidden lg:flex flex-col w-80 xl:w-[22rem] shrink-0 lg:sticky lg:top-20 lg:max-h-[calc(100dvh-6.5rem)] fit:max-h-full self-start fit:self-stretch bg-surface rounded-2xl shadow-sm border border-tone-100 overflow-hidden",
320
362
  children: [
321
- /* @__PURE__ */ jsxs("div", { className: "shrink-0 p-4 pb-3 space-y-3 border-b border-tone-100", children: [
363
+ /* @__PURE__ */ jsxs("div", { className: bold ? "shrink-0 border-b border-tone-100 p-4 pb-3" : "shrink-0 p-4 pb-3 space-y-3 border-b border-tone-100", children: [
322
364
  /* @__PURE__ */ jsxs(PanelHeader, { panel, children: [
323
365
  manage.bulkActions.length > 0 && /* @__PURE__ */ jsx(SelectToggle, { selection }),
324
366
  /* @__PURE__ */ jsx(
@@ -328,32 +370,34 @@ function SidePanelAside({ panel }) {
328
370
  onClick: () => toggle(true),
329
371
  "aria-label": `Hide ${panel.title}`,
330
372
  title: "Collapse panel",
331
- className: "p-1.5 -m-1 rounded-lg text-tone-400 hover:bg-tone-100 hover:text-tone-600",
332
- children: /* @__PURE__ */ jsx(PanelRightClose, { className: "w-4 h-4" })
373
+ className: bold ? "-m-1 rounded-lg p-1.5 text-tone-400 hover:bg-contrast/5 hover:text-ink" : "p-1.5 -m-1 rounded-lg text-tone-400 hover:bg-tone-100 hover:text-tone-600",
374
+ children: /* @__PURE__ */ jsx(Named, { name: "panel-collapse", fallback: PanelRightClose, className: bold ? "" : "w-4 h-4" })
333
375
  }
334
376
  )
335
377
  ] }),
336
378
  panel.navVariant === "grid" && /* @__PURE__ */ jsx(SidePanelNav, { panel })
337
379
  ] }),
338
- (hasListNav || panel.content) && /* @__PURE__ */ jsxs("div", { className: "flex-1 min-h-0 overflow-y-auto overscroll-contain p-3 space-y-4", children: [
380
+ (hasListNav || panel.content) && /* @__PURE__ */ jsxs("div", { className: bold ? "min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain p-3" : "flex-1 min-h-0 overflow-y-auto overscroll-contain p-3 space-y-4", children: [
339
381
  hasListNav && /* @__PURE__ */ jsx(SidePanelNav, { panel, manage, selection }),
340
382
  panel.content && /* @__PURE__ */ jsx("div", { className: "px-1", children: panel.content })
341
383
  ] }),
342
384
  selection.selecting && /* @__PURE__ */ jsx(BulkBar, { selection, actions: manage.bulkActions }),
343
- panel.footer && !selection.selecting && /* @__PURE__ */ jsx("div", { className: "shrink-0 p-4 pt-3 border-t border-tone-100 bg-accent/[0.03]", children: panel.footer })
385
+ panel.footer && !selection.selecting && /* @__PURE__ */ jsx("div", { className: bold ? "shrink-0 border-t border-tone-100 p-4 pt-3 text-sm text-tone-500" : "shrink-0 p-4 pt-3 border-t border-tone-100 bg-accent/[0.03]", children: panel.footer })
344
386
  ]
345
387
  }
346
388
  );
347
389
  }
348
390
  function ChipRow({ panel, onPicked, className = "-mx-4 px-4" }) {
391
+ const { iconFor } = useDashboard();
392
+ const bold = useLook() === "bold";
349
393
  const rowRef = useRef(null);
350
394
  const { items = [], activeId, onChange } = panel;
351
395
  useEffect(() => {
352
396
  const el = rowRef.current?.querySelector('[aria-current="true"]');
353
397
  el?.scrollIntoView?.({ block: "nearest", inline: "center", behavior: "smooth" });
354
398
  }, [activeId]);
355
- return /* @__PURE__ */ jsx("div", { ref: rowRef, className: `flex gap-2 overflow-x-auto scrollbar-hide py-0.5 snap-x ${className}`, "aria-label": panel.title, role: "navigation", children: items.map((item) => {
356
- const Icon = item.icon;
399
+ return /* @__PURE__ */ jsx("div", { ref: rowRef, className: bold ? `flex snap-x gap-2 overflow-x-auto py-0.5 ${className}` : `flex gap-2 overflow-x-auto scrollbar-hide py-0.5 snap-x ${className}`, "aria-label": panel.title, role: "navigation", children: items.map((item) => {
400
+ const Icon = toIcon(item.icon, iconFor);
357
401
  const active = item.id === activeId;
358
402
  return /* @__PURE__ */ jsxs(
359
403
  "button",
@@ -364,12 +408,12 @@ function ChipRow({ panel, onPicked, className = "-mx-4 px-4" }) {
364
408
  onChange?.(item.id);
365
409
  onPicked?.(item.id);
366
410
  },
367
- className: `${buttonClass({ variant: active ? "secondary" : "primary", size: "sm" })} snap-start shrink-0 !rounded-full relative`,
411
+ className: bold ? `inline-flex shrink-0 snap-start items-center gap-2 rounded-full border px-3 py-1.5 text-sm font-medium transition ${active ? "border-accent-strong/40 bg-accent/15 text-ink" : "border-contrast/10 bg-contrast/5 text-contrast/70 hover:text-ink"}` : `${buttonClass({ variant: active ? "secondary" : "primary", size: "sm" })} snap-start shrink-0 !rounded-full relative`,
368
412
  children: [
369
- Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
413
+ Icon && /* @__PURE__ */ jsx(Icon, { className: bold ? "text-xs" : void 0, "aria-hidden": "true" }),
370
414
  /* @__PURE__ */ jsx("span", { className: `max-w-[14rem] truncate ${item.muted && !active ? "opacity-60" : ""}`, children: item.label }),
371
- item.count != null && /* @__PURE__ */ jsx("span", { className: `tabular-nums ${active ? "opacity-80" : "opacity-60"}`, children: item.count }),
372
- (item.badge > 0 || item.dot) && /* @__PURE__ */ jsx("span", { className: `w-1.5 h-1.5 rounded-full ${active ? "bg-white" : "bg-accent"}`, "aria-hidden": "true" })
415
+ item.count != null && /* @__PURE__ */ jsx("span", { className: `tabular-nums ${active && !bold ? "opacity-80" : "opacity-60"}`, children: item.count }),
416
+ (item.badge > 0 || item.dot) && /* @__PURE__ */ jsx("span", { className: `w-1.5 h-1.5 rounded-full ${bold ? "bg-accent-strong" : active ? "bg-white" : "bg-accent"}`, "aria-hidden": "true" })
373
417
  ]
374
418
  },
375
419
  item.id
@@ -379,7 +423,8 @@ function ChipRow({ panel, onPicked, className = "-mx-4 px-4" }) {
379
423
  function BottomSheet({ panel, manage, onClose }) {
380
424
  const dragControls = useDragControls();
381
425
  const selection = useSelection(panel);
382
- return /* @__PURE__ */ jsx(Overlay, { onClose, className: "flex items-end justify-center", backdropClassName: "bg-black/25", zIndex: 60, children: /* @__PURE__ */ jsxs(
426
+ const bold = useLook() === "bold";
427
+ return /* @__PURE__ */ jsx(Overlay, { onClose, className: "flex items-end justify-center", backdropClassName: bold ? "bg-black/50" : "bg-black/25", zIndex: 60, children: /* @__PURE__ */ jsxs(
383
428
  motion.div,
384
429
  {
385
430
  role: "dialog",
@@ -397,19 +442,19 @@ function BottomSheet({ panel, manage, onClose }) {
397
442
  onDragEnd: (_, info) => {
398
443
  if (info.offset.y > 90 || info.velocity.y > 500) onClose();
399
444
  },
400
- className: "w-full max-h-[78dvh] bg-surface rounded-t-3xl shadow-2xl flex flex-col pb-[env(safe-area-inset-bottom)]",
445
+ className: bold ? "flex max-h-[78dvh] w-full flex-col rounded-t-3xl border-t border-contrast/10 bg-surface pb-[env(safe-area-inset-bottom)] shadow-2xl" : "w-full max-h-[78dvh] bg-surface rounded-t-3xl shadow-2xl flex flex-col pb-[env(safe-area-inset-bottom)]",
401
446
  onClick: (e) => e.stopPropagation(),
402
447
  children: [
403
448
  /* @__PURE__ */ jsxs(
404
449
  "div",
405
450
  {
406
- className: "shrink-0 pt-2 pb-3 px-4 space-y-3 border-b border-tone-100 cursor-grab active:cursor-grabbing touch-none",
451
+ className: `shrink-0 pt-2 pb-3 px-4 space-y-3 border-b ${bold ? "border-tone-100" : "border-tone-100"} cursor-grab active:cursor-grabbing touch-none`,
407
452
  onPointerDown: (e) => dragControls.start(e),
408
453
  children: [
409
- /* @__PURE__ */ jsx("div", { className: "mx-auto w-10 h-1.5 rounded-full bg-tone-200", "aria-hidden": "true" }),
454
+ /* @__PURE__ */ jsx("div", { className: `mx-auto w-10 h-1.5 rounded-full ${bold ? "bg-contrast/15" : "bg-tone-200"}`, "aria-hidden": "true" }),
410
455
  /* @__PURE__ */ jsxs(PanelHeader, { panel, children: [
411
456
  manage && manage.bulkActions.length > 0 && /* @__PURE__ */ jsx(SelectToggle, { selection }),
412
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, "aria-label": "Close panel", className: "p-1.5 -m-1 rounded-lg text-tone-500 hover:bg-tone-100", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
457
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, "aria-label": "Close panel", className: bold ? "-m-1 rounded-lg p-1.5 text-tone-600 hover:bg-contrast/5" : "p-1.5 -m-1 rounded-lg text-tone-500 hover:bg-tone-100", children: /* @__PURE__ */ jsx(Named, { name: "close", fallback: X, className: bold ? "" : "w-5 h-5" }) })
413
458
  ] }),
414
459
  !manage && panel.items?.length > 0 && /* @__PURE__ */ jsx(ChipRow, { panel })
415
460
  ]
@@ -425,13 +470,16 @@ function BottomSheet({ panel, manage, onClose }) {
425
470
  ) });
426
471
  }
427
472
  function SidePanelMobileBar({ panel }) {
473
+ const { iconFor } = useDashboard();
428
474
  const [sheet, setSheet] = useState(null);
429
475
  const manage = usePanelManage(panel);
430
476
  const hasContent = !!panel.content;
431
477
  const hasItems = panel.items?.length > 0;
432
478
  const manageable = manage.canReorder || manage.bulkActions.length > 0;
433
- const Icon = panel.icon;
434
- return /* @__PURE__ */ jsxs("div", { className: "lg:hidden sticky top-16 z-20 -mx-4 sm:-mx-6 px-4 sm:px-6 py-2 bg-paper/95 backdrop-blur border-b border-accent/10", children: [
479
+ const Icon = toIcon(panel.icon, iconFor);
480
+ const bold = useLook() === "bold";
481
+ if (!hasContent && !hasItems) return null;
482
+ return /* @__PURE__ */ jsxs("div", { className: bold ? "sticky top-16 z-20 -mx-4 mb-4 border-b border-contrast/[0.06] bg-paper/95 px-4 py-2 backdrop-blur lg:hidden" : "lg:hidden sticky top-16 z-20 -mx-4 sm:-mx-6 px-4 sm:px-6 py-2 bg-paper/95 backdrop-blur border-b border-accent/10", children: [
435
483
  hasItems && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
436
484
  /* @__PURE__ */ jsx(
437
485
  ChipRow,
@@ -458,14 +506,14 @@ function SidePanelMobileBar({ panel }) {
458
506
  {
459
507
  type: "button",
460
508
  onClick: () => setSheet("content"),
461
- className: `${buttonClass({ variant: "primary", size: "sm", fullWidth: true })} !justify-between`,
509
+ className: bold ? "flex w-full items-center justify-between gap-2 rounded-xl border border-contrast/10 bg-contrast/5 px-3 py-2 text-sm font-medium text-ink" : `${buttonClass({ variant: "primary", size: "sm", fullWidth: true })} !justify-between`,
462
510
  "aria-haspopup": "dialog",
463
511
  children: [
464
512
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
465
- Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
513
+ Icon && /* @__PURE__ */ jsx(Icon, { className: bold ? "text-accent-dark" : void 0, "aria-hidden": "true" }),
466
514
  /* @__PURE__ */ jsx("span", { className: "truncate", children: panel.sheetLabel || panel.title })
467
515
  ] }),
468
- /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true" })
516
+ /* @__PURE__ */ jsx(Named, { name: "chevron-up", fallback: ChevronUp, className: bold ? "text-xs text-tone-500" : void 0 })
469
517
  ]
470
518
  }
471
519
  ),
@@ -1,5 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { motion } from "framer-motion";
3
+ import { Minus, TrendingDown, TrendingUp } from "lucide-react";
4
+ import DashboardIcon from "./DashboardIcon.js";
5
+ import { useComponentDefaults } from "./DashboardProvider.js";
3
6
  const gridColumns = {
4
7
  1: "md:grid-cols-1",
5
8
  2: "md:grid-cols-2",
@@ -8,7 +11,11 @@ const gridColumns = {
8
11
  5: "md:grid-cols-3 xl:grid-cols-5",
9
12
  6: "md:grid-cols-3 xl:grid-cols-6"
10
13
  };
11
- function AdminSummaryCards({ cards = [], columns = 4 }) {
14
+ function AdminSummaryCards(ownProps) {
15
+ const { variant = "plain", ...props } = useComponentDefaults("SummaryCards", ownProps);
16
+ return variant === "bold" ? /* @__PURE__ */ jsx(BoldSummaryCards, { ...props }) : /* @__PURE__ */ jsx(PlainSummaryCards, { ...props });
17
+ }
18
+ function PlainSummaryCards({ cards = [], columns = 4 }) {
12
19
  if (!cards.length) return null;
13
20
  const gridCols = gridColumns[columns] || gridColumns[4];
14
21
  const iconVisibility = columns >= 5 ? "flex xl:hidden 2xl:flex" : "flex";
@@ -46,6 +53,62 @@ function AdminSummaryCards({ cards = [], columns = 4 }) {
46
53
  );
47
54
  }) });
48
55
  }
56
+ const boldColumns = {
57
+ 1: "grid-cols-1",
58
+ 2: "grid-cols-2",
59
+ 3: "grid-cols-2 md:grid-cols-3",
60
+ 4: "grid-cols-2 xl:grid-cols-4",
61
+ 5: "grid-cols-2 md:grid-cols-3 xl:grid-cols-5",
62
+ 6: "grid-cols-2 md:grid-cols-3 xl:grid-cols-6"
63
+ };
64
+ function BoldSummaryCards({ cards = [], columns, stackOnPhones = false }) {
65
+ if (!cards.length) return null;
66
+ let cols = boldColumns[columns ?? Math.min(cards.length, 4)] || boldColumns[4];
67
+ const compact = (columns ?? cards.length) >= 5;
68
+ if (stackOnPhones) cols = cols.replace(/^grid-cols-2\b/, "grid-cols-1 sm:grid-cols-2");
69
+ return /* @__PURE__ */ jsx("div", { className: `grid gap-3 lg:gap-4 ${cols}`, children: cards.map((card) => /* @__PURE__ */ jsx(BoldStatCard, { compact, ...card }, card.label)) });
70
+ }
71
+ function BoldStatCard({ icon, label, value, trend, hint, onClick, active = false, compact = false }) {
72
+ const up = trend > 0;
73
+ const down = trend < 0;
74
+ const trendColor = up ? "text-emerald-300" : down ? "text-accent-dark" : "text-tone-500";
75
+ const Tag = onClick ? "button" : "div";
76
+ const interactive = onClick ? "w-full text-left transition hover:border-accent-dark/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-strong/60" : "";
77
+ const pressed = active ? "border-accent-strong/50 ring-1 ring-accent-strong/40" : "";
78
+ return /* @__PURE__ */ jsx(
79
+ Tag,
80
+ {
81
+ type: onClick ? "button" : void 0,
82
+ onClick,
83
+ "aria-pressed": onClick ? active : void 0,
84
+ className: `block rounded-2xl border border-tone-100 bg-surface backdrop-blur-xl ${compact ? "p-4 2xl:p-5" : "p-5 sm:p-6"} ${interactive} ${pressed}`,
85
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
86
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
87
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm text-tone-500", children: label }),
88
+ /* @__PURE__ */ jsx("p", { className: `truncate font-semibold tracking-tight text-ink ${compact ? "text-xl 2xl:text-2xl" : "text-2xl sm:text-3xl"}`, title: typeof value === "string" ? value : void 0, children: value }),
89
+ hint && /* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs text-tone-400", title: hint, children: hint }),
90
+ trend !== void 0 && trend !== null && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-1.5", children: [
91
+ /* @__PURE__ */ jsx(
92
+ DashboardIcon,
93
+ {
94
+ icon: up ? "trend-up" : down ? "trend-down" : "trend-flat",
95
+ fallback: up ? TrendingUp : down ? TrendingDown : Minus,
96
+ className: `${trendColor} text-[10px]`
97
+ }
98
+ ),
99
+ /* @__PURE__ */ jsxs("span", { className: `text-xs font-medium ${trendColor}`, children: [
100
+ Math.abs(trend),
101
+ "%"
102
+ ] }),
103
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-contrast/35", children: "vs. last month" })
104
+ ] })
105
+ ] }),
106
+ /* @__PURE__ */ jsx("div", { className: `h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-accent-soft/10 bg-action/30 ${compact ? "flex xl:hidden 2xl:flex" : "flex"}`, children: /* @__PURE__ */ jsx(DashboardIcon, { icon, className: "text-base text-accent-soft" }) })
107
+ ] })
108
+ }
109
+ );
110
+ }
49
111
  export {
112
+ BoldStatCard,
50
113
  AdminSummaryCards as default
51
114
  };