@burdenoff/microfe-healthybowl 2026.624.5 → 2026.625.1

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.
Files changed (29) hide show
  1. package/dist/healthybowl/components/Breadcrumbs.js +20 -27
  2. package/dist/healthybowl/components/Breadcrumbs.js.map +1 -1
  3. package/dist/healthybowl/components/ChartCard.js +21 -14
  4. package/dist/healthybowl/components/ChartCard.js.map +1 -1
  5. package/dist/healthybowl/components/DataTable.js +109 -79
  6. package/dist/healthybowl/components/DataTable.js.map +1 -1
  7. package/dist/healthybowl/components/EmptyState.js +9 -24
  8. package/dist/healthybowl/components/EmptyState.js.map +1 -1
  9. package/dist/healthybowl/components/ErrorState.js +16 -24
  10. package/dist/healthybowl/components/ErrorState.js.map +1 -1
  11. package/dist/healthybowl/components/FilterBar.js +15 -14
  12. package/dist/healthybowl/components/FilterBar.js.map +1 -1
  13. package/dist/healthybowl/components/LoadingSkeleton.js +2 -1
  14. package/dist/healthybowl/components/LoadingSkeleton.js.map +1 -1
  15. package/dist/healthybowl/components/Modal.js +22 -55
  16. package/dist/healthybowl/components/Modal.js.map +1 -1
  17. package/dist/healthybowl/components/PageLayout.js +10 -16
  18. package/dist/healthybowl/components/PageLayout.js.map +1 -1
  19. package/dist/healthybowl/components/PageLoader.js +4 -6
  20. package/dist/healthybowl/components/PageLoader.js.map +1 -1
  21. package/dist/healthybowl/components/StatCard.js +37 -29
  22. package/dist/healthybowl/components/StatCard.js.map +1 -1
  23. package/dist/healthybowl/components/StatusBadge.js +20 -18
  24. package/dist/healthybowl/components/StatusBadge.js.map +1 -1
  25. package/dist/healthybowl/components/Toast.js +15 -61
  26. package/dist/healthybowl/components/Toast.js.map +1 -1
  27. package/dist/healthybowl/hooks/useToast.js +8 -18
  28. package/dist/healthybowl/hooks/useToast.js.map +1 -1
  29. package/package.json +2 -1
@@ -1,31 +1,24 @@
1
- import { cn as e } from "../utils/helpers.js";
2
- import { ChevronRight as t, Home as n } from "lucide-react";
3
- import { Link as r } from "react-router-dom";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
1
+ import { useBasePath as e } from "../hooks/useBasePath.js";
2
+ import { useNavigate as t } from "react-router-dom";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { Breadcrumbs as r } from "@burdenoff/fe-libs/chrome";
5
5
  //#region src/healthybowl/components/Breadcrumbs.tsx
6
- var o = ({ items: o, className: s }) => /* @__PURE__ */ a("nav", {
7
- "aria-label": "Breadcrumb",
8
- className: e("flex items-center gap-1 text-sm", s),
9
- children: [/* @__PURE__ */ i(r, {
10
- to: "",
11
- className: "flex items-center text-text-secondary hover:text-text-primary",
12
- children: /* @__PURE__ */ i(n, { className: "h-3.5 w-3.5" })
13
- }), o.map((n, s) => {
14
- let c = s === o.length - 1;
15
- return /* @__PURE__ */ a("span", {
16
- className: "flex items-center gap-1",
17
- children: [/* @__PURE__ */ i(t, { className: "h-3.5 w-3.5 text-text-secondary/50" }), c || !n.href ? /* @__PURE__ */ i("span", {
18
- className: e(c ? "font-medium text-text-primary" : "text-text-secondary"),
19
- children: n.label
20
- }) : /* @__PURE__ */ i(r, {
21
- to: n.href,
22
- className: "text-text-secondary hover:text-text-primary",
23
- children: n.label
24
- })]
25
- }, n.label);
26
- })]
27
- });
6
+ var i = ({ items: i, className: a }) => {
7
+ let o = t(), { buildPath: s } = e();
8
+ return /* @__PURE__ */ n(r, {
9
+ items: i.map((e, t) => {
10
+ let n = t === i.length - 1, r = e.href;
11
+ return {
12
+ label: e.label,
13
+ isCurrentPage: n,
14
+ onClick: !n && r ? () => o(r) : void 0
15
+ };
16
+ }),
17
+ className: a,
18
+ onHomeClick: () => o(s(""))
19
+ });
20
+ };
28
21
  //#endregion
29
- export { o as Breadcrumbs };
22
+ export { i as Breadcrumbs };
30
23
 
31
24
  //# sourceMappingURL=Breadcrumbs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.js","names":[],"sources":["../../../src/healthybowl/components/Breadcrumbs.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ChevronRight, Home } from 'lucide-react';\nimport { Link } from 'react-router-dom';\nimport { cn } from '../utils/helpers';\n\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\ninterface BreadcrumbsProps {\n items: BreadcrumbItem[];\n className?: string;\n}\n\nexport const Breadcrumbs: FC<BreadcrumbsProps> = ({ items, className }) => {\n return (\n <nav aria-label=\"Breadcrumb\" className={cn('flex items-center gap-1 text-sm', className)}>\n <Link to=\"\" className=\"flex items-center text-text-secondary hover:text-text-primary\">\n <Home className=\"h-3.5 w-3.5\" />\n </Link>\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n return (\n <span key={item.label} className=\"flex items-center gap-1\">\n <ChevronRight className=\"h-3.5 w-3.5 text-text-secondary/50\" />\n {isLast || !item.href ? (\n <span className={cn(isLast ? 'font-medium text-text-primary' : 'text-text-secondary')}>{item.label}</span>\n ) : (\n <Link to={item.href} className=\"text-text-secondary hover:text-text-primary\">\n {item.label}\n </Link>\n )}\n </span>\n );\n })}\n </nav>\n );\n};\n"],"mappings":";;;;;AAeA,IAAa,KAAqC,EAAE,UAAO,mBAEvD,kBAAC,OAAD;CAAK,cAAW;CAAa,WAAW,EAAG,mCAAmC,EAAU;WAAxF,CACE,kBAAC,GAAD;EAAM,IAAG;EAAG,WAAU;YACpB,kBAAC,GAAD,EAAM,WAAU,eAAgB,CAAA;EAC3B,CAAA,EACN,EAAM,KAAK,GAAM,MAAU;EAC1B,IAAM,IAAS,MAAU,EAAM,SAAS;AACxC,SACE,kBAAC,QAAD;GAAuB,WAAU;aAAjC,CACE,kBAAC,GAAD,EAAc,WAAU,sCAAuC,CAAA,EAC9D,KAAU,CAAC,EAAK,OACf,kBAAC,QAAD;IAAM,WAAW,EAAG,IAAS,kCAAkC,sBAAsB;cAAG,EAAK;IAAa,CAAA,GAE1G,kBAAC,GAAD;IAAM,IAAI,EAAK;IAAM,WAAU;cAC5B,EAAK;IACD,CAAA,CAEJ;KATI,EAAK,MAST;GAET,CACE"}
1
+ {"version":3,"file":"Breadcrumbs.js","names":[],"sources":["../../../src/healthybowl/components/Breadcrumbs.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Breadcrumbs as FeBreadcrumbs } from '@burdenoff/fe-libs/chrome';\nimport type { BreadcrumbItem as FeBreadcrumbItem } from '@burdenoff/fe-libs/chrome';\nimport { useBasePath } from '../hooks/useBasePath';\n\n/**\n * Public breadcrumb item contract for HealthyBowl pages. Intentionally narrow\n * ({ label, href? }) — re-exported via the components barrel and consumed by\n * ~15 page call sites, so it must not widen.\n */\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\ninterface BreadcrumbsProps {\n items: BreadcrumbItem[];\n className?: string;\n}\n\n/**\n * Breadcrumb trail wrapping the Boff `Breadcrumbs` chrome primitive (semantic\n * tokens, Home icon + chevron separators, collapse/ellipsis baked in).\n *\n * Behaviour preserved from the previous hand-rolled version:\n * - The last item (and any item without an `href`) renders as bold, current,\n * non-clickable text.\n * - Items with an `href` render as links that perform react-router SPA\n * navigation. The fe-libs primitive navigates via `onClick` (it does not act\n * on `href`), so each `href` is translated into an `onClick` that calls\n * `navigate(href)`.\n * - The Home icon navigates to the HealthyBowl dashboard root.\n */\nexport const Breadcrumbs: FC<BreadcrumbsProps> = ({ items, className }) => {\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n\n const mappedItems: FeBreadcrumbItem[] = items.map((item, index) => {\n const isLast = index === items.length - 1;\n const href = item.href;\n return {\n label: item.label,\n isCurrentPage: isLast,\n onClick: !isLast && href ? () => navigate(href) : undefined,\n };\n });\n\n return <FeBreadcrumbs items={mappedItems} className={className} onHomeClick={() => navigate(buildPath(''))} />;\n};\n"],"mappings":";;;;;AAkCA,IAAa,KAAqC,EAAE,UAAO,mBAAgB;CACzE,IAAM,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa;AAYnC,QAAO,kBAAC,GAAD;EAAe,OAVkB,EAAM,KAAK,GAAM,MAAU;GACjE,IAAM,IAAS,MAAU,EAAM,SAAS,GAClC,IAAO,EAAK;AAClB,UAAO;IACL,OAAO,EAAK;IACZ,eAAe;IACf,SAAS,CAAC,KAAU,UAAa,EAAS,EAAK,GAAG,KAAA;IACnD;IACD;EAEmD;EAAW,mBAAmB,EAAS,EAAU,GAAG,CAAC;EAAI,CAAA"}
@@ -1,23 +1,30 @@
1
1
  import { cn as e } from "../utils/helpers.js";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { Card as r, CardContent as i, CardDescription as a, CardHeader as o, CardTitle as s } from "@burdenoff/fe-libs/ui";
3
4
  //#region src/healthybowl/components/ChartCard.tsx
4
- var r = ({ title: r, description: i, actions: a, children: o, className: s }) => /* @__PURE__ */ n("div", {
5
- className: e("rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm", s),
6
- children: [/* @__PURE__ */ n("div", {
7
- className: "mb-4 flex items-center justify-between",
8
- children: [/* @__PURE__ */ n("div", { children: [/* @__PURE__ */ t("h3", {
9
- className: "text-sm font-medium text-text-primary",
10
- children: r
11
- }), i && /* @__PURE__ */ t("p", {
12
- className: "text-xs text-text-secondary mt-0.5",
13
- children: i
14
- })] }), a && /* @__PURE__ */ t("div", {
5
+ var c = ({ title: c, description: l, actions: u, children: d, className: f }) => /* @__PURE__ */ n(r, {
6
+ className: e("p-0", f),
7
+ children: [/* @__PURE__ */ n(o, {
8
+ className: "flex-row items-center justify-between space-y-0 p-4 pb-4",
9
+ children: [/* @__PURE__ */ n("div", {
10
+ className: "space-y-0.5",
11
+ children: [/* @__PURE__ */ t(s, {
12
+ className: "text-sm font-medium text-text-primary",
13
+ children: c
14
+ }), l && /* @__PURE__ */ t(a, {
15
+ className: "text-xs text-text-secondary",
16
+ children: l
17
+ })]
18
+ }), u && /* @__PURE__ */ t("div", {
15
19
  className: "flex items-center gap-2",
16
- children: a
20
+ children: u
17
21
  })]
18
- }), o]
22
+ }), /* @__PURE__ */ t(i, {
23
+ className: "p-4 pt-0",
24
+ children: d
25
+ })]
19
26
  });
20
27
  //#endregion
21
- export { r as ChartCard };
28
+ export { c as ChartCard };
22
29
 
23
30
  //# sourceMappingURL=ChartCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartCard.js","names":[],"sources":["../../../src/healthybowl/components/ChartCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { cn } from '../utils/helpers';\n\ninterface ChartCardProps {\n title: string;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\nexport const ChartCard: FC<ChartCardProps> = ({ title, description, actions, children, className }) => {\n return (\n <div className={cn('rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm', className)}>\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">{title}</h3>\n {description && <p className=\"text-xs text-text-secondary mt-0.5\">{description}</p>}\n </div>\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </div>\n {children}\n </div>\n );\n};\n"],"mappings":";;;AAWA,IAAa,KAAiC,EAAE,UAAO,gBAAa,YAAS,aAAU,mBAEnF,kBAAC,OAAD;CAAK,WAAW,EAAG,sEAAsE,EAAU;WAAnG,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;aAAyC;GAAW,CAAA,EACjE,KAAe,kBAAC,KAAD;GAAG,WAAU;aAAsC;GAAgB,CAAA,CAC/E,EAAA,CAAA,EACL,KAAW,kBAAC,OAAD;GAAK,WAAU;aAA2B;GAAc,CAAA,CAChE;KACL,EACG"}
1
+ {"version":3,"file":"ChartCard.js","names":[],"sources":["../../../src/healthybowl/components/ChartCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/helpers';\n\ninterface ChartCardProps {\n title: string;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\n/**\n * Insight-treatment card for charts and dashboard widgets. Wraps the Boff\n * `Card` primitive (surface, border, shadow and hover affordance) and lays out a\n * compact header (title / optional description / optional right-aligned actions)\n * above a body slot. Class overrides keep the original compact density\n * (`p-4`, `text-sm` title, `text-xs` description) rather than the primitive's\n * larger defaults, so existing dashboards render unchanged. `className` is\n * forwarded to the outer card so per-call-site grid spans (e.g. `lg:col-span-2`)\n * keep working.\n */\nexport const ChartCard: FC<ChartCardProps> = ({ title, description, actions, children, className }) => {\n return (\n <Card className={cn('p-0', className)}>\n <CardHeader className=\"flex-row items-center justify-between space-y-0 p-4 pb-4\">\n <div className=\"space-y-0.5\">\n <CardTitle className=\"text-sm font-medium text-text-primary\">{title}</CardTitle>\n {description && <CardDescription className=\"text-xs text-text-secondary\">{description}</CardDescription>}\n </div>\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </CardHeader>\n <CardContent className=\"p-4 pt-0\">{children}</CardContent>\n </Card>\n );\n};\n"],"mappings":";;;;AAsBA,IAAa,KAAiC,EAAE,UAAO,gBAAa,YAAS,aAAU,mBAEnF,kBAAC,GAAD;CAAM,WAAW,EAAG,OAAO,EAAU;WAArC,CACE,kBAAC,GAAD;EAAY,WAAU;YAAtB,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IAAW,WAAU;cAAyC;IAAkB,CAAA,EAC/E,KAAe,kBAAC,GAAD;IAAiB,WAAU;cAA+B;IAA8B,CAAA,CACpG;MACL,KAAW,kBAAC,OAAD;GAAK,WAAU;aAA2B;GAAc,CAAA,CACzD;KACb,kBAAC,GAAD;EAAa,WAAU;EAAY;EAAuB,CAAA,CACrD"}
@@ -2,117 +2,147 @@ import { cn as e } from "../utils/helpers.js";
2
2
  import { useCallback as t, useMemo as n, useState as r } from "react";
3
3
  import { ChevronDown as i, ChevronLeft as a, ChevronRight as o, ChevronUp as s, ChevronsUpDown as c } from "lucide-react";
4
4
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { ResponsiveTable as d } from "@burdenoff/fe-libs/ui";
5
6
  //#region src/healthybowl/components/DataTable.tsx
6
- function d({ columns: d, data: f, keyField: p, onRowClick: m, emptyMessage: h = "No data available", className: g, pageSize: _ = 10, selectable: v = !1, selectedKeys: y, onSelectionChange: b }) {
7
- let [x, S] = r(null), [C, w] = r(null), [T, E] = r(0), D = t((e) => {
8
- x === e ? C === "asc" ? w("desc") : C === "desc" ? (S(null), w(null)) : w("asc") : (S(e), w("asc")), E(0);
9
- }, [x, C]), O = n(() => !x || !C ? f : [...f].sort((e, t) => {
10
- let n = e[x], r = t[x];
7
+ var f = new Set(["actions", "action"]), p = new Set([
8
+ "expand",
9
+ "select",
10
+ "selection"
11
+ ]), m = new Set([...f, ...p]);
12
+ function h({ columns: h, data: g, keyField: _, onRowClick: v, emptyMessage: y = "No data available", className: b, pageSize: x = 10, selectable: S = !1, selectedKeys: C, onSelectionChange: w }) {
13
+ let [T, E] = r(null), [D, O] = r(null), [k, A] = r(0), j = t((e) => {
14
+ T === e ? D === "asc" ? O("desc") : D === "desc" ? (E(null), O(null)) : O("asc") : (E(e), O("asc")), A(0);
15
+ }, [T, D]), M = n(() => !T || !D ? g : [...g].sort((e, t) => {
16
+ let n = e[T], r = t[T];
11
17
  if (n == null && r == null) return 0;
12
18
  if (n == null) return 1;
13
19
  if (r == null) return -1;
14
20
  let i = typeof n == "number" && typeof r == "number" ? n - r : String(n).localeCompare(String(r));
15
- return C === "asc" ? i : -i;
21
+ return D === "asc" ? i : -i;
16
22
  }), [
17
- f,
18
- x,
23
+ g,
24
+ T,
25
+ D
26
+ ]), N = Math.max(1, Math.ceil(M.length / x)), P = M.slice(k * x, (k + 1) * x), F = t((e) => String(e[_]), [_]), I = S && C ? P.length > 0 && P.every((e) => C.has(F(e))) : !1, L = t(() => {
27
+ if (!w || !C) return;
28
+ let e = new Set(C);
29
+ I ? P.forEach((t) => e.delete(F(t))) : P.forEach((t) => e.add(F(t))), w(e);
30
+ }, [
31
+ I,
32
+ w,
33
+ P,
34
+ F,
19
35
  C
20
- ]), k = Math.max(1, Math.ceil(O.length / _)), A = O.slice(T * _, (T + 1) * _), j = v && y ? A.every((e) => y.has(String(e[p]))) : !1, M = () => {
21
- if (!b || !y) return;
22
- let e = new Set(y);
23
- j ? A.forEach((t) => e.delete(String(t[p]))) : A.forEach((t) => e.add(String(t[p]))), b(e);
24
- }, N = (e) => {
25
- if (!b || !y) return;
26
- let t = String(e[p]), n = new Set(y);
27
- n.has(t) ? n.delete(t) : n.add(t), b(n);
28
- };
29
- return f.length === 0 ? /* @__PURE__ */ l("div", {
36
+ ]), R = t((e) => {
37
+ if (!w || !C) return;
38
+ let t = F(e), n = new Set(C);
39
+ n.has(t) ? n.delete(t) : n.add(t), w(n);
40
+ }, [
41
+ w,
42
+ F,
43
+ C
44
+ ]), z = n(() => h.find((e) => !m.has(e.key) && e.header.trim() !== "")?.key, [h]), B = t((e) => e.key === z ? "primary" : f.has(e.key) ? "secondary" : p.has(e.key) || e.header.trim() === "" ? "hidden-on-mobile" : "secondary", [z]), V = n(() => {
45
+ let t = h.map((t) => {
46
+ let n = t.sortable !== !1, r = T === t.key;
47
+ return {
48
+ key: t.key,
49
+ priority: B(t),
50
+ headerClassName: t.className,
51
+ cellClassName: t.className,
52
+ mobileLabel: t.header,
53
+ header: /* @__PURE__ */ u("span", {
54
+ className: e("inline-flex items-center gap-1 text-xs font-medium uppercase tracking-wider text-text-secondary", n && "cursor-pointer select-none hover:text-text-primary"),
55
+ onClick: n ? () => j(t.key) : void 0,
56
+ children: [t.header, n && (r ? l(D === "asc" ? s : i, { className: "h-3 w-3" }) : /* @__PURE__ */ l(c, { className: "h-3 w-3 opacity-30" }))]
57
+ }),
58
+ cell: (e) => t.render ? t.render(e) : String(e[t.key] ?? "")
59
+ };
60
+ });
61
+ return S ? [{
62
+ key: "__select__",
63
+ priority: "hidden-on-mobile",
64
+ headerClassName: "w-10",
65
+ cellClassName: "w-10",
66
+ header: /* @__PURE__ */ l("input", {
67
+ type: "checkbox",
68
+ checked: I,
69
+ onChange: L,
70
+ className: "h-4 w-4 rounded border-border-subtle",
71
+ "aria-label": "Select all rows on this page"
72
+ }),
73
+ cell: (e) => /* @__PURE__ */ l("span", {
74
+ onClick: (e) => e.stopPropagation(),
75
+ children: /* @__PURE__ */ l("input", {
76
+ type: "checkbox",
77
+ checked: C?.has(F(e)) ?? !1,
78
+ onChange: () => R(e),
79
+ className: "h-4 w-4 rounded border-border-subtle",
80
+ "aria-label": "Select row"
81
+ })
82
+ })
83
+ }, ...t] : t;
84
+ }, [
85
+ h,
86
+ B,
87
+ T,
88
+ D,
89
+ j,
90
+ S,
91
+ I,
92
+ L,
93
+ C,
94
+ F,
95
+ R
96
+ ]);
97
+ return g.length === 0 ? /* @__PURE__ */ l("div", {
30
98
  className: "flex items-center justify-center rounded-lg border border-border-subtle bg-bg-surface p-12",
31
99
  children: /* @__PURE__ */ l("p", {
32
100
  className: "text-sm text-text-secondary",
33
- children: h
101
+ children: y
34
102
  })
35
103
  }) : /* @__PURE__ */ u("div", {
36
- className: e("space-y-3", g),
104
+ className: e("space-y-3", b),
37
105
  children: [/* @__PURE__ */ l("div", {
38
- className: "overflow-x-auto rounded-lg border border-border-subtle",
39
- children: /* @__PURE__ */ u("table", {
40
- className: "w-full",
41
- children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", {
42
- className: "border-b border-border-subtle bg-bg-sunken/50",
43
- children: [v && /* @__PURE__ */ l("th", {
44
- className: "w-10 px-3 py-3",
45
- children: /* @__PURE__ */ l("input", {
46
- type: "checkbox",
47
- checked: j && A.length > 0,
48
- onChange: M,
49
- className: "h-4 w-4 rounded border-border-subtle"
50
- })
51
- }), d.map((t) => {
52
- let n = t.sortable !== !1, r = x === t.key;
53
- return /* @__PURE__ */ l("th", {
54
- className: e("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-text-secondary", n && "cursor-pointer select-none hover:text-text-primary", t.className),
55
- onClick: n ? () => D(t.key) : void 0,
56
- children: /* @__PURE__ */ u("span", {
57
- className: "inline-flex items-center gap-1",
58
- children: [t.header, n && (r ? l(C === "asc" ? s : i, { className: "h-3 w-3" }) : /* @__PURE__ */ l(c, { className: "h-3 w-3 opacity-30" }))]
59
- })
60
- }, t.key);
61
- })]
62
- }) }), /* @__PURE__ */ l("tbody", {
63
- className: "divide-y divide-border bg-bg-surface",
64
- children: A.map((t) => {
65
- let n = String(t[p]), r = v && y?.has(n);
66
- return /* @__PURE__ */ u("tr", {
67
- className: e("transition-colors", m && "cursor-pointer hover:bg-bg-sunken/50", r && "bg-action-primary-bg/5"),
68
- onClick: () => m?.(t),
69
- children: [v && /* @__PURE__ */ l("td", {
70
- className: "w-10 px-3 py-3",
71
- onClick: (e) => e.stopPropagation(),
72
- children: /* @__PURE__ */ l("input", {
73
- type: "checkbox",
74
- checked: r ?? !1,
75
- onChange: () => N(t),
76
- className: "h-4 w-4 rounded border-border-subtle"
77
- })
78
- }), d.map((n) => /* @__PURE__ */ l("td", {
79
- className: e("px-4 py-3 text-sm text-text-primary", n.className),
80
- children: n.render ? n.render(t) : String(t[n.key] ?? "")
81
- }, n.key))]
82
- }, n);
83
- })
84
- })]
106
+ className: "rounded-lg border border-border-subtle",
107
+ children: /* @__PURE__ */ l(d, {
108
+ columns: V,
109
+ data: P,
110
+ rowKey: F,
111
+ onRowClick: v
85
112
  })
86
- }), O.length > _ && /* @__PURE__ */ u("div", {
113
+ }), M.length > x && /* @__PURE__ */ u("div", {
87
114
  className: "flex items-center justify-between text-sm",
88
115
  children: [/* @__PURE__ */ u("span", {
89
116
  className: "text-text-secondary",
90
117
  children: [
91
118
  "Showing ",
92
- T * _ + 1,
119
+ k * x + 1,
93
120
  "-",
94
- Math.min((T + 1) * _, O.length),
121
+ Math.min((k + 1) * x, M.length),
95
122
  " of ",
96
- O.length
123
+ M.length
97
124
  ]
98
125
  }), /* @__PURE__ */ u("div", {
99
126
  className: "flex items-center gap-1",
100
127
  children: [
101
128
  /* @__PURE__ */ l("button", {
102
- onClick: () => E((e) => Math.max(0, e - 1)),
103
- disabled: T === 0,
129
+ onClick: () => A((e) => Math.max(0, e - 1)),
130
+ disabled: k === 0,
104
131
  className: "rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40",
132
+ "aria-label": "Previous page",
105
133
  children: /* @__PURE__ */ l(a, { className: "h-4 w-4" })
106
134
  }),
107
- Array.from({ length: k }).map((t, n) => /* @__PURE__ */ l("button", {
108
- onClick: () => E(n),
109
- className: e("h-8 w-8 rounded-md text-xs font-medium transition-colors", n === T ? "bg-foreground text-background" : "text-text-secondary hover:bg-bg-sunken"),
135
+ Array.from({ length: N }).map((t, n) => /* @__PURE__ */ l("button", {
136
+ onClick: () => A(n),
137
+ "aria-current": n === k ? "page" : void 0,
138
+ className: e("h-8 w-8 rounded-md text-xs font-medium transition-colors", n === k ? "bg-foreground text-background" : "text-text-secondary hover:bg-bg-sunken"),
110
139
  children: n + 1
111
140
  }, n)),
112
141
  /* @__PURE__ */ l("button", {
113
- onClick: () => E((e) => Math.min(k - 1, e + 1)),
114
- disabled: T >= k - 1,
142
+ onClick: () => A((e) => Math.min(N - 1, e + 1)),
143
+ disabled: k >= N - 1,
115
144
  className: "rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40",
145
+ "aria-label": "Next page",
116
146
  children: /* @__PURE__ */ l(o, { className: "h-4 w-4" })
117
147
  })
118
148
  ]
@@ -121,6 +151,6 @@ function d({ columns: d, data: f, keyField: p, onRowClick: m, emptyMessage: h =
121
151
  });
122
152
  }
123
153
  //#endregion
124
- export { d as DataTable };
154
+ export { h as DataTable };
125
155
 
126
156
  //# sourceMappingURL=DataTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/healthybowl/components/DataTable.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown, ChevronLeft, ChevronRight } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\nexport interface Column<T> {\n key: string;\n header: string;\n render?: (item: T) => ReactNode;\n className?: string;\n sortable?: boolean;\n}\n\ntype SortDirection = 'asc' | 'desc' | null;\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n data: T[];\n keyField: string;\n onRowClick?: (item: T) => void;\n emptyMessage?: string;\n className?: string;\n pageSize?: number;\n selectable?: boolean;\n selectedKeys?: Set<string>;\n onSelectionChange?: (keys: Set<string>) => void;\n}\n\nexport function DataTable<T extends object>({\n columns,\n data,\n keyField,\n onRowClick,\n emptyMessage = 'No data available',\n className,\n pageSize = 10,\n selectable = false,\n selectedKeys,\n onSelectionChange,\n}: DataTableProps<T>) {\n const [sortKey, setSortKey] = useState<string | null>(null);\n const [sortDir, setSortDir] = useState<SortDirection>(null);\n const [page, setPage] = useState(0);\n\n const handleSort = useCallback(\n (key: string) => {\n if (sortKey === key) {\n if (sortDir === 'asc') setSortDir('desc');\n else if (sortDir === 'desc') {\n setSortKey(null);\n setSortDir(null);\n } else setSortDir('asc');\n } else {\n setSortKey(key);\n setSortDir('asc');\n }\n setPage(0);\n },\n [sortKey, sortDir]\n );\n\n const sorted = useMemo(() => {\n if (!sortKey || !sortDir) return data;\n return [...data].sort((a, b) => {\n const av = (a as Record<string, unknown>)[sortKey];\n const bv = (b as Record<string, unknown>)[sortKey];\n if (av == null && bv == null) return 0;\n if (av == null) return 1;\n if (bv == null) return -1;\n const cmp = typeof av === 'number' && typeof bv === 'number' ? av - bv : String(av).localeCompare(String(bv));\n return sortDir === 'asc' ? cmp : -cmp;\n });\n }, [data, sortKey, sortDir]);\n\n const totalPages = Math.max(1, Math.ceil(sorted.length / pageSize));\n const paged = sorted.slice(page * pageSize, (page + 1) * pageSize);\n\n const allPageKeysSelected =\n selectable && selectedKeys\n ? paged.every((item) => selectedKeys.has(String((item as Record<string, unknown>)[keyField])))\n : false;\n\n const handleSelectAll = () => {\n if (!onSelectionChange || !selectedKeys) return;\n const keys = new Set(selectedKeys);\n if (allPageKeysSelected) {\n paged.forEach((item) => keys.delete(String((item as Record<string, unknown>)[keyField])));\n } else {\n paged.forEach((item) => keys.add(String((item as Record<string, unknown>)[keyField])));\n }\n onSelectionChange(keys);\n };\n\n const handleSelectRow = (item: T) => {\n if (!onSelectionChange || !selectedKeys) return;\n const key = String((item as Record<string, unknown>)[keyField]);\n const keys = new Set(selectedKeys);\n if (keys.has(key)) keys.delete(key);\n else keys.add(key);\n onSelectionChange(keys);\n };\n\n if (data.length === 0) {\n return (\n <div className=\"flex items-center justify-center rounded-lg border border-border-subtle bg-bg-surface p-12\">\n <p className=\"text-sm text-text-secondary\">{emptyMessage}</p>\n </div>\n );\n }\n\n return (\n <div className={cn('space-y-3', className)}>\n <div className=\"overflow-x-auto rounded-lg border border-border-subtle\">\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b border-border-subtle bg-bg-sunken/50\">\n {selectable && (\n <th className=\"w-10 px-3 py-3\">\n <input\n type=\"checkbox\"\n checked={allPageKeysSelected && paged.length > 0}\n onChange={handleSelectAll}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n </th>\n )}\n {columns.map((col) => {\n const isSortable = col.sortable !== false;\n const isActive = sortKey === col.key;\n return (\n <th\n key={col.key}\n className={cn(\n 'px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-text-secondary',\n isSortable && 'cursor-pointer select-none hover:text-text-primary',\n col.className\n )}\n onClick={isSortable ? () => handleSort(col.key) : undefined}\n >\n <span className=\"inline-flex items-center gap-1\">\n {col.header}\n {isSortable &&\n (isActive ? (\n sortDir === 'asc' ? (\n <ChevronUp className=\"h-3 w-3\" />\n ) : (\n <ChevronDown className=\"h-3 w-3\" />\n )\n ) : (\n <ChevronsUpDown className=\"h-3 w-3 opacity-30\" />\n ))}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border bg-bg-surface\">\n {paged.map((item) => {\n const rowKey = String((item as Record<string, unknown>)[keyField]);\n const isSelected = selectable && selectedKeys?.has(rowKey);\n return (\n <tr\n key={rowKey}\n className={cn(\n 'transition-colors',\n onRowClick && 'cursor-pointer hover:bg-bg-sunken/50',\n isSelected && 'bg-action-primary-bg/5'\n )}\n onClick={() => onRowClick?.(item)}\n >\n {selectable && (\n <td className=\"w-10 px-3 py-3\" onClick={(e) => e.stopPropagation()}>\n <input\n type=\"checkbox\"\n checked={isSelected ?? false}\n onChange={() => handleSelectRow(item)}\n className=\"h-4 w-4 rounded border-border-subtle\"\n />\n </td>\n )}\n {columns.map((col) => (\n <td key={col.key} className={cn('px-4 py-3 text-sm text-text-primary', col.className)}>\n {col.render ? col.render(item) : String((item as Record<string, unknown>)[col.key] ?? '')}\n </td>\n ))}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n\n {/* Pagination */}\n {sorted.length > pageSize && (\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">\n Showing {page * pageSize + 1}-{Math.min((page + 1) * pageSize, sorted.length)} of {sorted.length}\n </span>\n <div className=\"flex items-center gap-1\">\n <button\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n className=\"rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n {Array.from({ length: totalPages }).map((_, i) => (\n <button\n key={i}\n onClick={() => setPage(i)}\n className={cn(\n 'h-8 w-8 rounded-md text-xs font-medium transition-colors',\n i === page ? 'bg-foreground text-background' : 'text-text-secondary hover:bg-bg-sunken'\n )}\n >\n {i + 1}\n </button>\n ))}\n <button\n onClick={() => setPage((p) => Math.min(totalPages - 1, p + 1))}\n disabled={page >= totalPages - 1}\n className=\"rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AA2BA,SAAgB,EAA4B,EAC1C,YACA,SACA,aACA,eACA,kBAAe,qBACf,cACA,cAAW,IACX,gBAAa,IACb,iBACA,wBACoB;CACpB,IAAM,CAAC,GAAS,KAAc,EAAwB,KAAK,EACrD,CAAC,GAAS,KAAc,EAAwB,KAAK,EACrD,CAAC,GAAM,KAAW,EAAS,EAAE,EAE7B,IAAa,GAChB,MAAgB;AAWf,EAVI,MAAY,IACV,MAAY,QAAO,EAAW,OAAO,GAChC,MAAY,UACnB,EAAW,KAAK,EAChB,EAAW,KAAK,IACX,EAAW,MAAM,IAExB,EAAW,EAAI,EACf,EAAW,MAAM,GAEnB,EAAQ,EAAE;IAEZ,CAAC,GAAS,EAAQ,CACnB,EAEK,IAAS,QACT,CAAC,KAAW,CAAC,IAAgB,IAC1B,CAAC,GAAG,EAAK,CAAC,MAAM,GAAG,MAAM;EAC9B,IAAM,IAAM,EAA8B,IACpC,IAAM,EAA8B;AAC1C,MAAI,KAAM,QAAQ,KAAM,KAAM,QAAO;AACrC,MAAI,KAAM,KAAM,QAAO;AACvB,MAAI,KAAM,KAAM,QAAO;EACvB,IAAM,IAAM,OAAO,KAAO,YAAY,OAAO,KAAO,WAAW,IAAK,IAAK,OAAO,EAAG,CAAC,cAAc,OAAO,EAAG,CAAC;AAC7G,SAAO,MAAY,QAAQ,IAAM,CAAC;GAClC,EACD;EAAC;EAAM;EAAS;EAAQ,CAAC,EAEtB,IAAa,KAAK,IAAI,GAAG,KAAK,KAAK,EAAO,SAAS,EAAS,CAAC,EAC7D,IAAQ,EAAO,MAAM,IAAO,IAAW,IAAO,KAAK,EAAS,EAE5D,IACJ,KAAc,IACV,EAAM,OAAO,MAAS,EAAa,IAAI,OAA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AAY,CAAC,CAAC,KAAK,GAAG,MAC1C,kBAAC,UAAD;MAEE,eAAe,EAAQ,EAAE;MACzB,WAAW,EACT,4DACA,MAAM,IAAO,kCAAkC,yCAChD;gBAEA,IAAI;MACE,EARF,EAQE,CACT;KACF,kBAAC,UAAD;MACE,eAAe,GAAS,MAAM,KAAK,IAAI,IAAa,GAAG,IAAI,EAAE,CAAC;MAC9D,UAAU,KAAQ,IAAa;MAC/B,WAAU;gBAEV,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;MAC7B,CAAA;KACL;MACF;KAEJ"}
1
+ {"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/healthybowl/components/DataTable.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown, ChevronLeft, ChevronRight } from 'lucide-react';\nimport { ResponsiveTable, type ResponsiveTableColumn, type ResponsiveTableColumnPriority } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/helpers';\n\nexport interface Column<T> {\n key: string;\n header: string;\n render?: (item: T) => ReactNode;\n className?: string;\n sortable?: boolean;\n}\n\ntype SortDirection = 'asc' | 'desc' | null;\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n data: T[];\n keyField: string;\n onRowClick?: (item: T) => void;\n emptyMessage?: string;\n className?: string;\n pageSize?: number;\n selectable?: boolean;\n selectedKeys?: Set<string>;\n onSelectionChange?: (keys: Set<string>) => void;\n}\n\n/** Row-action columns (edit / delete / adjust). Shown on the desktop table AND\n * kept on the mobile card (as a secondary field) so row operations stay\n * reachable below 767px — the old horizontally-scrollable table exposed them. */\nconst ACTION_COLUMN_KEYS = new Set(['actions', 'action']);\n/** Pure-control columns (row-select / expand) — dropped from the mobile card. */\nconst CONTROL_COLUMN_KEYS = new Set(['expand', 'select', 'selection']);\n/** All non-content keys, used only to skip them when picking the card heading. */\nconst UTIL_COLUMN_KEYS = new Set([...ACTION_COLUMN_KEYS, ...CONTROL_COLUMN_KEYS]);\n\n/**\n * Tabular list wrapping the Boff `ResponsiveTable` (real <table> at md+, a stack\n * of cards below 767px). The bespoke client-side sorting, pagination and row\n * selection are retained here because the primitive does not provide them — only\n * the current page slice is handed to `ResponsiveTable`. The public prop +\n * `Column` API is unchanged so existing call sites compile as-is.\n */\nexport function DataTable<T extends object>({\n columns,\n data,\n keyField,\n onRowClick,\n emptyMessage = 'No data available',\n className,\n pageSize = 10,\n selectable = false,\n selectedKeys,\n onSelectionChange,\n}: DataTableProps<T>) {\n const [sortKey, setSortKey] = useState<string | null>(null);\n const [sortDir, setSortDir] = useState<SortDirection>(null);\n const [page, setPage] = useState(0);\n\n const handleSort = useCallback(\n (key: string) => {\n if (sortKey === key) {\n if (sortDir === 'asc') setSortDir('desc');\n else if (sortDir === 'desc') {\n setSortKey(null);\n setSortDir(null);\n } else setSortDir('asc');\n } else {\n setSortKey(key);\n setSortDir('asc');\n }\n setPage(0);\n },\n [sortKey, sortDir]\n );\n\n const sorted = useMemo(() => {\n if (!sortKey || !sortDir) return data;\n return [...data].sort((a, b) => {\n const av = (a as Record<string, unknown>)[sortKey];\n const bv = (b as Record<string, unknown>)[sortKey];\n if (av == null && bv == null) return 0;\n if (av == null) return 1;\n if (bv == null) return -1;\n const cmp = typeof av === 'number' && typeof bv === 'number' ? av - bv : String(av).localeCompare(String(bv));\n return sortDir === 'asc' ? cmp : -cmp;\n });\n }, [data, sortKey, sortDir]);\n\n const totalPages = Math.max(1, Math.ceil(sorted.length / pageSize));\n const paged = sorted.slice(page * pageSize, (page + 1) * pageSize);\n\n const rowKeyFor = useCallback((item: T) => String((item as Record<string, unknown>)[keyField]), [keyField]);\n\n const allPageKeysSelected =\n selectable && selectedKeys ? paged.length > 0 && paged.every((item) => selectedKeys.has(rowKeyFor(item))) : false;\n\n const handleSelectAll = useCallback(() => {\n if (!onSelectionChange || !selectedKeys) return;\n const keys = new Set(selectedKeys);\n if (allPageKeysSelected) {\n paged.forEach((item) => keys.delete(rowKeyFor(item)));\n } else {\n paged.forEach((item) => keys.add(rowKeyFor(item)));\n }\n onSelectionChange(keys);\n }, [allPageKeysSelected, onSelectionChange, paged, rowKeyFor, selectedKeys]);\n\n const handleSelectRow = useCallback(\n (item: T) => {\n if (!onSelectionChange || !selectedKeys) return;\n const key = rowKeyFor(item);\n const keys = new Set(selectedKeys);\n if (keys.has(key)) keys.delete(key);\n else keys.add(key);\n onSelectionChange(keys);\n },\n [onSelectionChange, rowKeyFor, selectedKeys]\n );\n\n // Derive a mobile-card priority for each column: the first content column is\n // the card heading; util columns (actions/expand/select) are hidden on mobile;\n // everything else is a labelled secondary field. Desktop renders every column\n // regardless, so this never changes the md+ table.\n const firstContentKey = useMemo(() => {\n const content = columns.find((c) => !UTIL_COLUMN_KEYS.has(c.key) && c.header.trim() !== '');\n return content?.key;\n }, [columns]);\n\n const priorityFor = useCallback(\n (col: Column<T>): ResponsiveTableColumnPriority => {\n if (col.key === firstContentKey) return 'primary';\n // Edit/delete actions stay on the mobile card so rows remain operable.\n if (ACTION_COLUMN_KEYS.has(col.key)) return 'secondary';\n // Pure controls + unlabelled columns drop off the mobile card.\n if (CONTROL_COLUMN_KEYS.has(col.key) || col.header.trim() === '') return 'hidden-on-mobile';\n return 'secondary';\n },\n [firstContentKey]\n );\n\n const responsiveColumns = useMemo<ResponsiveTableColumn<T>[]>(() => {\n const mapped = columns.map((col): ResponsiveTableColumn<T> => {\n const isSortable = col.sortable !== false;\n const isActive = sortKey === col.key;\n return {\n key: col.key,\n priority: priorityFor(col),\n headerClassName: col.className,\n cellClassName: col.className,\n mobileLabel: col.header,\n header: (\n <span\n className={cn(\n 'inline-flex items-center gap-1 text-xs font-medium uppercase tracking-wider text-text-secondary',\n isSortable && 'cursor-pointer select-none hover:text-text-primary'\n )}\n onClick={isSortable ? () => handleSort(col.key) : undefined}\n >\n {col.header}\n {isSortable &&\n (isActive ? (\n sortDir === 'asc' ? (\n <ChevronUp className=\"h-3 w-3\" />\n ) : (\n <ChevronDown className=\"h-3 w-3\" />\n )\n ) : (\n <ChevronsUpDown className=\"h-3 w-3 opacity-30\" />\n ))}\n </span>\n ),\n cell: (item: T) => (col.render ? col.render(item) : String((item as Record<string, unknown>)[col.key] ?? '')),\n };\n });\n\n if (!selectable) return mapped;\n\n const selectColumn: ResponsiveTableColumn<T> = {\n key: '__select__',\n priority: 'hidden-on-mobile',\n headerClassName: 'w-10',\n cellClassName: 'w-10',\n header: (\n <input\n type=\"checkbox\"\n checked={allPageKeysSelected}\n onChange={handleSelectAll}\n className=\"h-4 w-4 rounded border-border-subtle\"\n aria-label=\"Select all rows on this page\"\n />\n ),\n cell: (item: T) => (\n <span onClick={(e) => e.stopPropagation()}>\n <input\n type=\"checkbox\"\n checked={selectedKeys?.has(rowKeyFor(item)) ?? false}\n onChange={() => handleSelectRow(item)}\n className=\"h-4 w-4 rounded border-border-subtle\"\n aria-label=\"Select row\"\n />\n </span>\n ),\n };\n return [selectColumn, ...mapped];\n }, [\n columns,\n priorityFor,\n sortKey,\n sortDir,\n handleSort,\n selectable,\n allPageKeysSelected,\n handleSelectAll,\n selectedKeys,\n rowKeyFor,\n handleSelectRow,\n ]);\n\n if (data.length === 0) {\n return (\n <div className=\"flex items-center justify-center rounded-lg border border-border-subtle bg-bg-surface p-12\">\n <p className=\"text-sm text-text-secondary\">{emptyMessage}</p>\n </div>\n );\n }\n\n return (\n <div className={cn('space-y-3', className)}>\n <div className=\"rounded-lg border border-border-subtle\">\n <ResponsiveTable<T> columns={responsiveColumns} data={paged} rowKey={rowKeyFor} onRowClick={onRowClick} />\n </div>\n\n {/* Pagination */}\n {sorted.length > pageSize && (\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">\n Showing {page * pageSize + 1}-{Math.min((page + 1) * pageSize, sorted.length)} of {sorted.length}\n </span>\n <div className=\"flex items-center gap-1\">\n <button\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n className=\"rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\n aria-label=\"Previous page\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n {Array.from({ length: totalPages }).map((_, i) => (\n <button\n key={i}\n onClick={() => setPage(i)}\n aria-current={i === page ? 'page' : undefined}\n className={cn(\n 'h-8 w-8 rounded-md text-xs font-medium transition-colors',\n i === page ? 'bg-foreground text-background' : 'text-text-secondary hover:bg-bg-sunken'\n )}\n >\n {i + 1}\n </button>\n ))}\n <button\n onClick={() => setPage((p) => Math.min(totalPages - 1, p + 1))}\n disabled={page >= totalPages - 1}\n className=\"rounded-md border border-border-subtle p-1.5 text-text-secondary transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\n aria-label=\"Next page\"\n >\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AA+BA,IAAM,IAAqB,IAAI,IAAI,CAAC,WAAW,SAAS,CAAC,EAEnD,IAAsB,IAAI,IAAI;CAAC;CAAU;CAAU;CAAY,CAAC,EAEhE,IAAmB,IAAI,IAAI,CAAC,GAAG,GAAoB,GAAG,EAAoB,CAAC;AASjF,SAAgB,EAA4B,EAC1C,YACA,SACA,aACA,eACA,kBAAe,qBACf,cACA,cAAW,IACX,gBAAa,IACb,iBACA,wBACoB;CACpB,IAAM,CAAC,GAAS,KAAc,EAAwB,KAAK,EACrD,CAAC,GAAS,KAAc,EAAwB,KAAK,EACrD,CAAC,GAAM,KAAW,EAAS,EAAE,EAE7B,IAAa,GAChB,MAAgB;AAWf,EAVI,MAAY,IACV,MAAY,QAAO,EAAW,OAAO,GAChC,MAAY,UACnB,EAAW,KAAK,EAChB,EAAW,KAAK,IACX,EAAW,MAAM,IAExB,EAAW,EAAI,EACf,EAAW,MAAM,GAEnB,EAAQ,EAAE;IAEZ,CAAC,GAAS,EAAQ,CACnB,EAEK,IAAS,QACT,CAAC,KAAW,CAAC,IAAgB,I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,EAAc,WAAU,WAAY,CAAA;MAC7B,CAAA;KACL;MACF;KAEJ"}
@@ -1,29 +1,14 @@
1
- import { cn as e } from "../utils/helpers.js";
2
- import { Inbox as t } from "lucide-react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { EmptyState as t } from "@burdenoff/fe-libs/ui";
4
3
  //#region src/healthybowl/components/EmptyState.tsx
5
- var i = ({ icon: i, title: a, description: o, action: s, className: c }) => /* @__PURE__ */ r("div", {
6
- className: e("flex flex-col items-center justify-center rounded-lg border border-dashed border-border-subtle bg-bg-surface/50 p-12 text-center", c),
7
- children: [
8
- /* @__PURE__ */ n("div", {
9
- className: "mb-4 text-text-secondary",
10
- children: i || /* @__PURE__ */ n(t, { className: "h-12 w-12" })
11
- }),
12
- /* @__PURE__ */ n("h3", {
13
- className: "text-lg font-medium text-text-primary",
14
- children: a
15
- }),
16
- o && /* @__PURE__ */ n("p", {
17
- className: "mt-1 text-sm text-text-secondary max-w-md",
18
- children: o
19
- }),
20
- s && /* @__PURE__ */ n("div", {
21
- className: "mt-4",
22
- children: s
23
- })
24
- ]
4
+ var n = ({ icon: n, title: r, description: i, action: a, className: o }) => /* @__PURE__ */ e(t, {
5
+ icon: n,
6
+ title: r,
7
+ description: i,
8
+ action: a,
9
+ className: o
25
10
  });
26
11
  //#endregion
27
- export { i as EmptyState };
12
+ export { n as EmptyState };
28
13
 
29
14
  //# sourceMappingURL=EmptyState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/healthybowl/components/EmptyState.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { Inbox } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\ninterface EmptyStateProps {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}\n\nexport const EmptyState: FC<EmptyStateProps> = ({ icon, title, description, action, className }) => {\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-dashed border-border-subtle bg-bg-surface/50 p-12 text-center',\n className\n )}\n >\n <div className=\"mb-4 text-text-secondary\">{icon || <Inbox className=\"h-12 w-12\" />}</div>\n <h3 className=\"text-lg font-medium text-text-primary\">{title}</h3>\n {description && <p className=\"mt-1 text-sm text-text-secondary max-w-md\">{description}</p>}\n {action && <div className=\"mt-4\">{action}</div>}\n </div>\n );\n};\n"],"mappings":";;;;AAYA,IAAa,KAAmC,EAAE,SAAM,UAAO,gBAAa,WAAQ,mBAEhF,kBAAC,OAAD;CACE,WAAW,EACT,oIACA,EACD;WAJH;EAME,kBAAC,OAAD;GAAK,WAAU;aAA4B,KAAQ,kBAAC,GAAD,EAAO,WAAU,aAAc,CAAA;GAAO,CAAA;EACzF,kBAAC,MAAD;GAAI,WAAU;aAAyC;GAAW,CAAA;EACjE,KAAe,kBAAC,KAAD;GAAG,WAAU;aAA6C;GAAgB,CAAA;EACzF,KAAU,kBAAC,OAAD;GAAK,WAAU;aAAQ;GAAa,CAAA;EAC3C"}
1
+ {"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/healthybowl/components/EmptyState.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { EmptyState as BoffEmptyState } from '@burdenoff/fe-libs/ui';\n\ninterface EmptyStateProps {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}\n\n/**\n * Thin wrapper over the Boff `EmptyState` primitive. Keeps the local prop API\n * (`icon`/`title`/`description`/`action`/`className`) so existing call sites are\n * untouched; the primitive owns the canonical icon→title→description→action\n * layout. When `icon` is omitted, the primitive supplies its default inbox icon.\n */\nexport const EmptyState: FC<EmptyStateProps> = ({ icon, title, description, action, className }) => {\n return <BoffEmptyState icon={icon} title={title} description={description} action={action} className={className} />;\n};\n"],"mappings":";;;AAiBA,IAAa,KAAmC,EAAE,SAAM,UAAO,gBAAa,WAAQ,mBAC3E,kBAAC,GAAD;CAAsB;CAAa;CAAoB;CAAqB;CAAmB;CAAa,CAAA"}
@@ -1,28 +1,20 @@
1
- import { cn as e } from "../utils/helpers.js";
2
- import { AlertCircle as t } from "lucide-react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
1
+ import { AlertTriangle as e } from "lucide-react";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { Button as n, EmptyState as r } from "@burdenoff/fe-libs/ui";
4
4
  //#region src/healthybowl/components/ErrorState.tsx
5
- var i = ({ title: i = "Couldn't load this data", description: a = "Something went wrong while loading. Please try again.", onRetry: o, icon: s, className: c }) => /* @__PURE__ */ r("div", {
6
- className: e("flex flex-col items-center justify-center rounded-lg border border-border-subtle bg-bg-surface p-12 text-center", c),
7
- children: [
8
- /* @__PURE__ */ n("div", {
9
- className: "mb-4 text-status-error-text",
10
- children: s || /* @__PURE__ */ n(t, { className: "h-12 w-12" })
11
- }),
12
- /* @__PURE__ */ n("h3", {
13
- className: "text-lg font-medium text-text-primary",
14
- children: i
15
- }),
16
- a && /* @__PURE__ */ n("p", {
17
- className: "mt-1 max-w-md text-sm text-text-secondary",
18
- children: a
19
- }),
20
- o && /* @__PURE__ */ n("button", {
21
- onClick: o,
22
- className: "mt-4 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
23
- children: "Try again"
24
- })
25
- ]
5
+ var i = ({ title: i = "Couldn't load this data", description: a = "Something went wrong while loading. Please try again.", onRetry: o, icon: s, className: c }) => /* @__PURE__ */ t(r, {
6
+ icon: s ?? /* @__PURE__ */ t(e, {
7
+ className: "size-8 text-status-error-text",
8
+ "aria-hidden": "true"
9
+ }),
10
+ title: i,
11
+ description: a,
12
+ action: o ? /* @__PURE__ */ t(n, {
13
+ variant: "outline",
14
+ onClick: o,
15
+ children: "Retry"
16
+ }) : void 0,
17
+ className: c
26
18
  });
27
19
  //#endregion
28
20
  export { i as ErrorState };
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorState.js","names":[],"sources":["../../../src/healthybowl/components/ErrorState.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\ninterface ErrorStateProps {\n /** Honest title — defaults to a generic load-failure message. */\n title?: string;\n description?: string;\n /** Optional retry handler (e.g. the hook's `refetch`). */\n onRetry?: () => void;\n icon?: ReactNode;\n className?: string;\n}\n\n/**\n * Shown when a query FAILED (vs. EmptyState, which means it succeeded with no data). Pages render\n * this instead of an empty state when the relevant query errored, so a load failure is never\n * silently disguised as \"no data yet\".\n */\nexport const ErrorState: FC<ErrorStateProps> = ({\n title = \"Couldn't load this data\",\n description = 'Something went wrong while loading. Please try again.',\n onRetry,\n icon,\n className,\n}) => {\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center rounded-lg border border-border-subtle bg-bg-surface p-12 text-center',\n className\n )}\n >\n <div className=\"mb-4 text-status-error-text\">{icon || <AlertCircle className=\"h-12 w-12\" />}</div>\n <h3 className=\"text-lg font-medium text-text-primary\">{title}</h3>\n {description && <p className=\"mt-1 max-w-md text-sm text-text-secondary\">{description}</p>}\n {onRetry && (\n <button\n onClick={onRetry}\n className=\"mt-4 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90\"\n >\n Try again\n </button>\n )}\n </div>\n );\n};\n"],"mappings":";;;;AAmBA,IAAa,KAAmC,EAC9C,WAAQ,2BACR,iBAAc,yDACd,YACA,SACA,mBAGE,kBAAC,OAAD;CACE,WAAW,EACT,mHACA,EACD;WAJH;EAME,kBAAC,OAAD;GAAK,WAAU;aAA+B,KAAQ,kBAAC,GAAD,EAAa,WAAU,aAAc,CAAA;GAAO,CAAA;EAClG,kBAAC,MAAD;GAAI,WAAU;aAAyC;GAAW,CAAA;EACjE,KAAe,kBAAC,KAAD;GAAG,WAAU;aAA6C;GAAgB,CAAA;EACzF,KACC,kBAAC,UAAD;GACE,SAAS;GACT,WAAU;aACX;GAEQ,CAAA;EAEP"}
1
+ {"version":3,"file":"ErrorState.js","names":[],"sources":["../../../src/healthybowl/components/ErrorState.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { AlertTriangle } from 'lucide-react';\nimport { Button, EmptyState } from '@burdenoff/fe-libs/ui';\n\ninterface ErrorStateProps {\n /** Honest title — defaults to a generic load-failure message. */\n title?: string;\n description?: string;\n /** Optional retry handler (e.g. the hook's `refetch`). */\n onRetry?: () => void;\n icon?: ReactNode;\n className?: string;\n}\n\n/**\n * Shown when a query FAILED (vs. EmptyState, which means it succeeded with no data). Pages render\n * this instead of an empty state when the relevant query errored, so a load failure is never\n * silently disguised as \"no data yet\". Built on the Boff `EmptyState` primitive with an error icon\n * and a retry action.\n */\nexport const ErrorState: FC<ErrorStateProps> = ({\n title = \"Couldn't load this data\",\n description = 'Something went wrong while loading. Please try again.',\n onRetry,\n icon,\n className,\n}) => {\n return (\n <EmptyState\n icon={icon ?? <AlertTriangle className=\"size-8 text-status-error-text\" aria-hidden=\"true\" />}\n title={title}\n description={description}\n action={\n onRetry ? (\n <Button variant=\"outline\" onClick={onRetry}>\n Retry\n </Button>\n ) : undefined\n }\n className={className}\n />\n );\n};\n"],"mappings":";;;;AAoBA,IAAa,KAAmC,EAC9C,WAAQ,2BACR,iBAAc,yDACd,YACA,SACA,mBAGE,kBAAC,GAAD;CACE,MAAM,KAAQ,kBAAC,GAAD;EAAe,WAAU;EAAgC,eAAY;EAAS,CAAA;CACrF;CACM;CACb,QACE,IACE,kBAAC,GAAD;EAAQ,SAAQ;EAAU,SAAS;YAAS;EAEnC,CAAA,GACP,KAAA;CAEK;CACX,CAAA"}
@@ -1,31 +1,32 @@
1
1
  import { cn as e } from "../utils/helpers.js";
2
2
  import { Search as t } from "lucide-react";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { Input as i } from "@burdenoff/fe-libs/ui";
4
5
  //#region src/healthybowl/components/FilterBar.tsx
5
- var i = ({ searchValue: i, onSearchChange: a, searchPlaceholder: o = "Search...", filters: s, actions: c, className: l }) => /* @__PURE__ */ r("div", {
6
- className: e("flex flex-wrap items-center gap-3", l),
6
+ var a = ({ searchValue: a, onSearchChange: o, searchPlaceholder: s = "Search...", filters: c, actions: l, className: u }) => /* @__PURE__ */ r("div", {
7
+ className: e("flex flex-wrap items-center gap-3", u),
7
8
  children: [
8
9
  /* @__PURE__ */ r("div", {
9
- className: "relative flex-1 min-w-[200px]",
10
- children: [/* @__PURE__ */ n(t, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ n("input", {
10
+ className: "relative min-w-[200px] flex-1",
11
+ children: [/* @__PURE__ */ n(t, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ n(i, {
11
12
  type: "text",
12
- value: i,
13
- onChange: (e) => a(e.target.value),
14
- placeholder: o,
15
- className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-1"
13
+ value: a,
14
+ onChange: (e) => o(e.target.value),
15
+ placeholder: s,
16
+ className: "h-9 pl-9"
16
17
  })]
17
18
  }),
18
- s && /* @__PURE__ */ n("div", {
19
- className: "flex items-center gap-2",
20
- children: s
21
- }),
22
19
  c && /* @__PURE__ */ n("div", {
23
- className: "flex items-center gap-2 ml-auto",
20
+ className: "flex items-center gap-2",
24
21
  children: c
22
+ }),
23
+ l && /* @__PURE__ */ n("div", {
24
+ className: "ml-auto flex items-center gap-2",
25
+ children: l
25
26
  })
26
27
  ]
27
28
  });
28
29
  //#endregion
29
- export { i as FilterBar };
30
+ export { a as FilterBar };
30
31
 
31
32
  //# sourceMappingURL=FilterBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterBar.js","names":[],"sources":["../../../src/healthybowl/components/FilterBar.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { Search } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\ninterface FilterBarProps {\n searchValue: string;\n onSearchChange: (value: string) => void;\n searchPlaceholder?: string;\n filters?: ReactNode;\n actions?: ReactNode;\n className?: string;\n}\n\nexport const FilterBar: FC<FilterBarProps> = ({\n searchValue,\n onSearchChange,\n searchPlaceholder = 'Search...',\n filters,\n actions,\n className,\n}) => {\n return (\n <div className={cn('flex flex-wrap items-center gap-3', className)}>\n <div className=\"relative flex-1 min-w-[200px]\">\n <Search className=\"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary\" />\n <input\n type=\"text\"\n value={searchValue}\n onChange={(e) => onSearchChange(e.target.value)}\n placeholder={searchPlaceholder}\n className=\"h-9 w-full rounded-md border border-border-subtle bg-bg-surface pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-1\"\n />\n </div>\n {filters && <div className=\"flex items-center gap-2\">{filters}</div>}\n {actions && <div className=\"flex items-center gap-2 ml-auto\">{actions}</div>}\n </div>\n );\n};\n"],"mappings":";;;;AAaA,IAAa,KAAiC,EAC5C,gBACA,mBACA,uBAAoB,aACpB,YACA,YACA,mBAGE,kBAAC,OAAD;CAAK,WAAW,EAAG,qCAAqC,EAAU;WAAlE;EACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD,EAAQ,WAAU,wEAAyE,CAAA,EAC3F,kBAAC,SAAD;IACE,MAAK;IACL,OAAO;IACP,WAAW,MAAM,EAAe,EAAE,OAAO,MAAM;IAC/C,aAAa;IACb,WAAU;IACV,CAAA,CACE;;EACL,KAAW,kBAAC,OAAD;GAAK,WAAU;aAA2B;GAAc,CAAA;EACnE,KAAW,kBAAC,OAAD;GAAK,WAAU;aAAmC;GAAc,CAAA;EACxE"}
1
+ {"version":3,"file":"FilterBar.js","names":[],"sources":["../../../src/healthybowl/components/FilterBar.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { Search } from 'lucide-react';\nimport { Input } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/helpers';\n\ninterface FilterBarProps {\n searchValue: string;\n onSearchChange: (value: string) => void;\n searchPlaceholder?: string;\n filters?: ReactNode;\n actions?: ReactNode;\n className?: string;\n}\n\n/**\n * Filter/search toolbar. The search field wraps the Boff `Input` primitive\n * (theme-compliant border/background/focus-ring via semantic tokens) with a\n * leading search icon. The `filters` and `actions` slots remain caller-owned\n * ReactNode, so existing call sites pass their own controls unchanged.\n */\nexport const FilterBar: FC<FilterBarProps> = ({\n searchValue,\n onSearchChange,\n searchPlaceholder = 'Search...',\n filters,\n actions,\n className,\n}) => {\n return (\n <div className={cn('flex flex-wrap items-center gap-3', className)}>\n <div className=\"relative min-w-[200px] flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n <Input\n type=\"text\"\n value={searchValue}\n onChange={(e) => onSearchChange(e.target.value)}\n placeholder={searchPlaceholder}\n className=\"h-9 pl-9\"\n />\n </div>\n {filters && <div className=\"flex items-center gap-2\">{filters}</div>}\n {actions && <div className=\"ml-auto flex items-center gap-2\">{actions}</div>}\n </div>\n );\n};\n"],"mappings":";;;;;AAoBA,IAAa,KAAiC,EAC5C,gBACA,mBACA,uBAAoB,aACpB,YACA,YACA,mBAGE,kBAAC,OAAD;CAAK,WAAW,EAAG,qCAAqC,EAAU;WAAlE;EACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD,EAAQ,WAAU,8FAA+F,CAAA,EACjH,kBAAC,GAAD;IACE,MAAK;IACL,OAAO;IACP,WAAW,MAAM,EAAe,EAAE,OAAO,MAAM;IAC/C,aAAa;IACb,WAAU;IACV,CAAA,CACE;;EACL,KAAW,kBAAC,OAAD;GAAK,WAAU;aAA2B;GAAc,CAAA;EACnE,KAAW,kBAAC,OAAD;GAAK,WAAU;aAAmC;GAAc,CAAA;EACxE"}