@burdenoff/microfe-healthybowl 2026.624.6 → 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.
@@ -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,C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C,UAAD;MACE,eAAe,GAAS,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,CAAC;MACjD,UAAU,MAAS;MACnB,WAAU;gBAEV,kBAAC,GAAD,EAAa,WAAU,WAAY,CAAA;MAC5B,CAAA;KACR,MAAM,KAAK,EAAE,QAAQ,GAAY,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,MAA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;gBAEA,IAAI;MACE,EATF,EASE,CACT;KACF,kBAAC,UAAD;MACE,eAAe,GAAS,MAAM,KAAK,IAAI,IAAa,GAAG,IAAI,EAAE,CAAC;MAC9D,UAAU,KAAQ,IAAa;MAC/B,WAAU;MACV,cAAW;gBAEX,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;MAC7B,CAAA;KACL;MACF;KAEJ"}
@@ -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"}
@@ -1,53 +1,61 @@
1
1
  import { cn as e, formatCurrency as t, formatNumber as n } from "../utils/helpers.js";
2
2
  import { Minus as r, TrendingDown as i, TrendingUp as a } from "lucide-react";
3
3
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { Badge as c, Card as l } from "@burdenoff/fe-libs/ui";
4
5
  //#region src/healthybowl/components/StatCard.tsx
5
- var c = ({ label: c, value: l, previousValue: u, unit: d, prefix: f, icon: p, trend: m, change: h, className: g }) => {
6
- let _ = h ?? (u ? Math.round(((typeof l == "number" ? l : 0) - u) / u * 100) : 0), v = m ?? (_ > 0 ? "up" : _ < 0 ? "down" : "stable"), y = typeof l == "string" ? l : f === "$" ? t(l) : `${n(l)}${d ? ` ${d}` : ""}`;
7
- return /* @__PURE__ */ s("div", {
8
- className: e("rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm", g),
6
+ var u = {
7
+ up: "success",
8
+ down: "destructive",
9
+ stable: "secondary"
10
+ }, d = ({ label: d, value: f, previousValue: p, unit: m, prefix: h, icon: g, trend: _, change: v, className: y }) => {
11
+ let b = v ?? (p ? Math.round(((typeof f == "number" ? f : 0) - p) / p * 100) : 0), x = _ ?? (b > 0 ? "up" : b < 0 ? "down" : "stable"), S = typeof f == "string" ? f : h === "$" ? t(f) : `${n(f)}${m ? ` ${m}` : ""}`;
12
+ return /* @__PURE__ */ s(l, {
13
+ className: e("p-4 transition-none hover:border-border hover:shadow-sm", y),
9
14
  children: [
10
15
  /* @__PURE__ */ s("div", {
11
16
  className: "flex items-center justify-between",
12
17
  children: [/* @__PURE__ */ o("span", {
13
18
  className: "text-sm font-medium text-text-secondary",
14
- children: c
15
- }), p && /* @__PURE__ */ o("span", {
19
+ children: d
20
+ }), g && /* @__PURE__ */ o("span", {
16
21
  className: "text-text-secondary",
17
- children: p
22
+ children: g
18
23
  })]
19
24
  }),
20
25
  /* @__PURE__ */ o("div", {
21
26
  className: "mt-2 flex items-baseline gap-2",
22
27
  children: /* @__PURE__ */ o("span", {
23
- className: "text-2xl font-bold text-text-primary",
24
- children: y
28
+ className: "text-3xl font-semibold tabular-nums text-text-primary",
29
+ children: S
25
30
  })
26
31
  }),
27
- _ !== 0 && /* @__PURE__ */ s("div", {
28
- className: "mt-2 flex items-center gap-1 text-xs",
29
- children: [
30
- v === "up" && /* @__PURE__ */ o(a, { className: "h-3 w-3 text-success" }),
31
- v === "down" && /* @__PURE__ */ o(i, { className: "h-3 w-3 text-status-error-text" }),
32
- v === "stable" && /* @__PURE__ */ o(r, { className: "h-3 w-3 text-text-secondary" }),
33
- /* @__PURE__ */ s("span", {
34
- className: e("font-medium", v === "up" && "text-success", v === "down" && "text-status-error-text", v === "stable" && "text-text-secondary"),
35
- children: [
36
- _ > 0 ? "+" : "",
37
- _,
38
- "%"
39
- ]
40
- }),
41
- /* @__PURE__ */ o("span", {
42
- className: "text-text-secondary",
43
- children: "vs last period"
44
- })
45
- ]
32
+ b !== 0 && /* @__PURE__ */ s("div", {
33
+ className: "mt-2 flex items-center gap-2",
34
+ children: [/* @__PURE__ */ s(c, {
35
+ variant: u[x],
36
+ className: "gap-1",
37
+ children: [
38
+ x === "up" && /* @__PURE__ */ o(a, { className: "h-3 w-3" }),
39
+ x === "down" && /* @__PURE__ */ o(i, { className: "h-3 w-3" }),
40
+ x === "stable" && /* @__PURE__ */ o(r, { className: "h-3 w-3" }),
41
+ /* @__PURE__ */ s("span", {
42
+ className: "tabular-nums",
43
+ children: [
44
+ b > 0 ? "+" : "",
45
+ b,
46
+ "%"
47
+ ]
48
+ })
49
+ ]
50
+ }), /* @__PURE__ */ o("span", {
51
+ className: "text-xs text-text-secondary",
52
+ children: "vs last period"
53
+ })]
46
54
  })
47
55
  ]
48
56
  });
49
57
  };
50
58
  //#endregion
51
- export { c as StatCard };
59
+ export { d as StatCard };
52
60
 
53
61
  //# sourceMappingURL=StatCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatCard.js","names":[],"sources":["../../../src/healthybowl/components/StatCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { cn } from '../utils/helpers';\nimport { formatNumber, formatCurrency } from '../utils/helpers';\n\ninterface StatCardProps {\n label: string;\n value: number | string;\n previousValue?: number;\n unit?: string;\n prefix?: string;\n icon?: ReactNode;\n trend?: 'up' | 'down' | 'stable';\n change?: number;\n className?: string;\n}\n\nexport const StatCard: FC<StatCardProps> = ({\n label,\n value,\n previousValue,\n unit,\n prefix,\n icon,\n trend,\n change,\n className,\n}) => {\n const numericValue = typeof value === 'number' ? value : 0;\n const computedChange =\n change ?? (previousValue ? Math.round(((numericValue - previousValue) / previousValue) * 100) : 0);\n const computedTrend = trend ?? (computedChange > 0 ? 'up' : computedChange < 0 ? 'down' : 'stable');\n\n const displayValue =\n typeof value === 'string'\n ? value\n : prefix === '$'\n ? formatCurrency(value)\n : `${formatNumber(value)}${unit ? ` ${unit}` : ''}`;\n\n return (\n <div className={cn('rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm', className)}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-text-secondary\">{label}</span>\n {icon && <span className=\"text-text-secondary\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-2xl font-bold text-text-primary\">{displayValue}</span>\n </div>\n {computedChange !== 0 && (\n <div className=\"mt-2 flex items-center gap-1 text-xs\">\n {computedTrend === 'up' && <TrendingUp className=\"h-3 w-3 text-success\" />}\n {computedTrend === 'down' && <TrendingDown className=\"h-3 w-3 text-status-error-text\" />}\n {computedTrend === 'stable' && <Minus className=\"h-3 w-3 text-text-secondary\" />}\n <span\n className={cn(\n 'font-medium',\n computedTrend === 'up' && 'text-success',\n computedTrend === 'down' && 'text-status-error-text',\n computedTrend === 'stable' && 'text-text-secondary'\n )}\n >\n {computedChange > 0 ? '+' : ''}\n {computedChange}%\n </span>\n <span className=\"text-text-secondary\">vs last period</span>\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;AAiBA,IAAa,KAA+B,EAC1C,UACA,UACA,kBACA,SACA,WACA,SACA,UACA,WACA,mBACI;CAEJ,IAAM,IACJ,MAAW,IAAgB,KAAK,QAFb,OAAO,KAAU,WAAW,IAAQ,KAEA,KAAiB,IAAiB,IAAI,GAAG,IAC5F,IAAgB,MAAU,IAAiB,IAAI,OAAO,IAAiB,IAAI,SAAS,WAEpF,IACJ,OAAO,KAAU,WACb,IACA,MAAW,MACT,EAAe,EAAM,GACrB,GAAG,EAAa,EAAM,GAAG,IAAO,IAAI,MAAS;AAErD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,sEAAsE,EAAU;YAAnG;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAA2C;KAAa,CAAA,EACvE,KAAQ,kBAAC,QAAD;KAAM,WAAU;eAAuB;KAAY,CAAA,CACxD;;GACN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,QAAD;KAAM,WAAU;eAAwC;KAAoB,CAAA;IACxE,CAAA;GACL,MAAmB,KAClB,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,MAAkB,QAAQ,kBAAC,GAAD,EAAY,WAAU,wBAAyB,CAAA;KACzE,MAAkB,UAAU,kBAAC,GAAD,EAAc,WAAU,kCAAmC,CAAA;KACvF,MAAkB,YAAY,kBAAC,GAAD,EAAO,WAAU,+BAAgC,CAAA;KAChF,kBAAC,QAAD;MACE,WAAW,EACT,eACA,MAAkB,QAAQ,gBAC1B,MAAkB,UAAU,0BAC5B,MAAkB,YAAY,sBAC/B;gBANH;OAQG,IAAiB,IAAI,MAAM;OAC3B;OAAe;OACX;;KACP,kBAAC,QAAD;MAAM,WAAU;gBAAsB;MAAqB,CAAA;KACvD;;GAEJ"}
1
+ {"version":3,"file":"StatCard.js","names":[],"sources":["../../../src/healthybowl/components/StatCard.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { TrendingUp, TrendingDown, Minus } from 'lucide-react';\nimport { Card, Badge } from '@burdenoff/fe-libs/ui';\nimport { cn, formatNumber, formatCurrency } from '../utils/helpers';\n\ninterface StatCardProps {\n label: string;\n value: number | string;\n previousValue?: number;\n unit?: string;\n prefix?: string;\n icon?: ReactNode;\n trend?: 'up' | 'down' | 'stable';\n change?: number;\n className?: string;\n}\n\n/**\n * KPI tile re-based onto the Boff `Card` primitive with a metric treatment:\n * a large `tabular-nums` value and an optional period-over-period delta rendered\n * as a `Badge`. The public prop contract is unchanged so existing call sites are\n * untouched. The `Card` hover affordance is suppressed because this is a static\n * metric, not an interactive surface. Semantic tokens only — no raw colors.\n */\nconst trendBadgeVariant: Record<'up' | 'down' | 'stable', 'success' | 'destructive' | 'secondary'> = {\n up: 'success',\n down: 'destructive',\n stable: 'secondary',\n};\n\nexport const StatCard: FC<StatCardProps> = ({\n label,\n value,\n previousValue,\n unit,\n prefix,\n icon,\n trend,\n change,\n className,\n}) => {\n const numericValue = typeof value === 'number' ? value : 0;\n const computedChange =\n change ?? (previousValue ? Math.round(((numericValue - previousValue) / previousValue) * 100) : 0);\n const computedTrend = trend ?? (computedChange > 0 ? 'up' : computedChange < 0 ? 'down' : 'stable');\n\n const displayValue =\n typeof value === 'string'\n ? value\n : prefix === '$'\n ? formatCurrency(value)\n : `${formatNumber(value)}${unit ? ` ${unit}` : ''}`;\n\n return (\n <Card className={cn('p-4 transition-none hover:border-border hover:shadow-sm', className)}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-medium text-text-secondary\">{label}</span>\n {icon && <span className=\"text-text-secondary\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-3xl font-semibold tabular-nums text-text-primary\">{displayValue}</span>\n </div>\n {computedChange !== 0 && (\n <div className=\"mt-2 flex items-center gap-2\">\n <Badge variant={trendBadgeVariant[computedTrend]} className=\"gap-1\">\n {computedTrend === 'up' && <TrendingUp className=\"h-3 w-3\" />}\n {computedTrend === 'down' && <TrendingDown className=\"h-3 w-3\" />}\n {computedTrend === 'stable' && <Minus className=\"h-3 w-3\" />}\n <span className=\"tabular-nums\">\n {computedChange > 0 ? '+' : ''}\n {computedChange}%\n </span>\n </Badge>\n <span className=\"text-xs text-text-secondary\">vs last period</span>\n </div>\n )}\n </Card>\n );\n};\n"],"mappings":";;;;;AAwBA,IAAM,IAA+F;CACnG,IAAI;CACJ,MAAM;CACN,QAAQ;CACT,EAEY,KAA+B,EAC1C,UACA,UACA,kBACA,SACA,WACA,SACA,UACA,WACA,mBACI;CAEJ,IAAM,IACJ,MAAW,IAAgB,KAAK,QAFb,OAAO,KAAU,WAAW,IAAQ,KAEA,KAAiB,IAAiB,IAAI,GAAG,IAC5F,IAAgB,MAAU,IAAiB,IAAI,OAAO,IAAiB,IAAI,SAAS,WAEpF,IACJ,OAAO,KAAU,WACb,IACA,MAAW,MACT,EAAe,EAAM,GACrB,GAAG,EAAa,EAAM,GAAG,IAAO,IAAI,MAAS;AAErD,QACE,kBAAC,GAAD;EAAM,WAAW,EAAG,2DAA2D,EAAU;YAAzF;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAA2C;KAAa,CAAA,EACvE,KAAQ,kBAAC,QAAD;KAAM,WAAU;eAAuB;KAAY,CAAA,CACxD;;GACN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,QAAD;KAAM,WAAU;eAAyD;KAAoB,CAAA;IACzF,CAAA;GACL,MAAmB,KAClB,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAO,SAAS,EAAkB;KAAgB,WAAU;eAA5D;MACG,MAAkB,QAAQ,kBAAC,GAAD,EAAY,WAAU,WAAY,CAAA;MAC5D,MAAkB,UAAU,kBAAC,GAAD,EAAc,WAAU,WAAY,CAAA;MAChE,MAAkB,YAAY,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;MAC5D,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QACG,IAAiB,IAAI,MAAM;QAC3B;QAAe;QACX;;MACD;QACR,kBAAC,QAAD;KAAM,WAAU;eAA8B;KAAqB,CAAA,CAC/D;;GAEH"}
@@ -1,65 +1,19 @@
1
- import { cn as e } from "../utils/helpers.js";
2
- import { useEffect as t } from "react";
3
- import { AlertTriangle as n, CheckCircle as r, Info as i, X as a, XCircle as o } from "lucide-react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
1
+ import { toast as e } from "sonner";
5
2
  //#region src/healthybowl/components/Toast.tsx
6
- var l = {
7
- success: {
8
- icon: r,
9
- className: "border-success/30 bg-success-subtle text-success"
10
- },
11
- error: {
12
- icon: o,
13
- className: "border-status-error-border/30 bg-status-error-bg/10 text-status-error-text"
14
- },
15
- warning: {
16
- icon: n,
17
- className: "border-warning/30 bg-warning/10 text-warning"
18
- },
19
- info: {
20
- icon: i,
21
- className: "border-info/30 bg-info/10 text-info"
22
- }
23
- }, u = ({ id: n, title: r, description: i, variant: o, duration: u = 4e3, onDismiss: d }) => {
24
- let { icon: f, className: p } = l[o];
25
- return t(() => {
26
- if (u > 0) {
27
- let e = setTimeout(() => d(n), u);
28
- return () => clearTimeout(e);
29
- }
30
- }, [
31
- n,
32
- u,
33
- d
34
- ]), /* @__PURE__ */ c("div", {
35
- className: e("flex items-start gap-3 rounded-lg border p-4 shadow-lg animate-in slide-in-from-right-full", p),
36
- children: [
37
- /* @__PURE__ */ s(f, { className: "mt-0.5 h-5 w-5 shrink-0" }),
38
- /* @__PURE__ */ c("div", {
39
- className: "flex-1 min-w-0",
40
- children: [/* @__PURE__ */ s("p", {
41
- className: "text-sm font-medium",
42
- children: r
43
- }), i && /* @__PURE__ */ s("p", {
44
- className: "mt-0.5 text-xs opacity-80",
45
- children: i
46
- })]
47
- }),
48
- /* @__PURE__ */ s("button", {
49
- onClick: () => d(n),
50
- className: "shrink-0 opacity-60 hover:opacity-100",
51
- children: /* @__PURE__ */ s(a, { className: "h-4 w-4" })
52
- })
53
- ]
54
- });
55
- }, d = ({ toasts: e, onDismiss: t }) => e.length === 0 ? null : /* @__PURE__ */ s("div", {
56
- className: "fixed bottom-4 right-4 z-50 flex w-80 flex-col gap-2",
57
- children: e.map((e) => /* @__PURE__ */ s(u, {
58
- ...e,
59
- onDismiss: t
60
- }, e.id))
61
- });
3
+ var t = 0;
4
+ function n(n) {
5
+ let r = n.variant ?? "info", i = n.duration === void 0 ? void 0 : n.duration > 0 ? n.duration : Infinity, a = `hb-toast-${++t}`;
6
+ return e[r](n.title, {
7
+ description: n.description,
8
+ duration: i,
9
+ id: a
10
+ }), a;
11
+ }
12
+ function r(t) {
13
+ e.dismiss(t);
14
+ }
15
+ var i = () => null;
62
16
  //#endregion
63
- export { u as Toast, d as ToastContainer };
17
+ export { i as ToastContainer, r as dismissToast, n as pushToast };
64
18
 
65
19
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","names":[],"sources":["../../../src/healthybowl/components/Toast.tsx"],"sourcesContent":["import { useEffect, type FC } from 'react';\nimport { X, CheckCircle, AlertTriangle, Info, XCircle } from 'lucide-react';\nimport { cn } from '../utils/helpers';\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface ToastData {\n id: string;\n title: string;\n description?: string;\n variant: ToastVariant;\n duration?: number;\n}\n\ninterface ToastProps extends ToastData {\n onDismiss: (id: string) => void;\n}\n\nconst variantConfig: Record<ToastVariant, { icon: typeof CheckCircle; className: string }> = {\n success: {\n icon: CheckCircle,\n className: 'border-success/30 bg-success-subtle text-success',\n },\n error: { icon: XCircle, className: 'border-status-error-border/30 bg-status-error-bg/10 text-status-error-text' },\n warning: {\n icon: AlertTriangle,\n className: 'border-warning/30 bg-warning/10 text-warning',\n },\n info: { icon: Info, className: 'border-info/30 bg-info/10 text-info' },\n};\n\nexport const Toast: FC<ToastProps> = ({ id, title, description, variant, duration = 4000, onDismiss }) => {\n const { icon: Icon, className } = variantConfig[variant];\n\n useEffect(() => {\n if (duration > 0) {\n const timer = setTimeout(() => onDismiss(id), duration);\n return () => clearTimeout(timer);\n }\n }, [id, duration, onDismiss]);\n\n return (\n <div\n className={cn(\n 'flex items-start gap-3 rounded-lg border p-4 shadow-lg animate-in slide-in-from-right-full',\n className\n )}\n >\n <Icon className=\"mt-0.5 h-5 w-5 shrink-0\" />\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium\">{title}</p>\n {description && <p className=\"mt-0.5 text-xs opacity-80\">{description}</p>}\n </div>\n <button onClick={() => onDismiss(id)} className=\"shrink-0 opacity-60 hover:opacity-100\">\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n );\n};\n\ninterface ToastContainerProps {\n toasts: ToastData[];\n onDismiss: (id: string) => void;\n}\n\nexport const ToastContainer: FC<ToastContainerProps> = ({ toasts, onDismiss }) => {\n if (toasts.length === 0) return null;\n return (\n <div className=\"fixed bottom-4 right-4 z-50 flex w-80 flex-col gap-2\">\n {toasts.map((t) => (\n <Toast key={t.id} {...t} onDismiss={onDismiss} />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;AAkBA,IAAM,IAAuF;CAC3F,SAAS;EACP,MAAM;EACN,WAAW;EACZ;CACD,OAAO;EAAE,MAAM;EAAS,WAAW;EAA8E;CACjH,SAAS;EACP,MAAM;EACN,WAAW;EACZ;CACD,MAAM;EAAE,MAAM;EAAM,WAAW;EAAuC;CACvE,EAEY,KAAyB,EAAE,OAAI,UAAO,gBAAa,YAAS,cAAW,KAAM,mBAAgB;CACxG,IAAM,EAAE,MAAM,GAAM,iBAAc,EAAc;AAShD,QAPA,QAAgB;AACd,MAAI,IAAW,GAAG;GAChB,IAAM,IAAQ,iBAAiB,EAAU,EAAG,EAAE,EAAS;AACvD,gBAAa,aAAa,EAAM;;IAEjC;EAAC;EAAI;EAAU;EAAU,CAAC,EAG3B,kBAAC,OAAD;EACE,WAAW,EACT,8FACA,EACD;YAJH;GAME,kBAAC,GAAD,EAAM,WAAU,2BAA4B,CAAA;GAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,KAAD;KAAG,WAAU;eAAuB;KAAU,CAAA,EAC7C,KAAe,kBAAC,KAAD;KAAG,WAAU;eAA6B;KAAgB,CAAA,CACtE;;GACN,kBAAC,UAAD;IAAQ,eAAe,EAAU,EAAG;IAAE,WAAU;cAC9C,kBAAC,GAAD,EAAG,WAAU,WAAY,CAAA;IAClB,CAAA;GACL;;GASG,KAA2C,EAAE,WAAQ,mBAC5D,EAAO,WAAW,IAAU,OAE9B,kBAAC,OAAD;CAAK,WAAU;WACZ,EAAO,KAAK,MACX,kBAAC,GAAD;EAAkB,GAAI;EAAc;EAAa,EAArC,EAAE,GAAmC,CACjD;CACE,CAAA"}
1
+ {"version":3,"file":"Toast.js","names":[],"sources":["../../../src/healthybowl/components/Toast.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { toast as sonnerToast } from 'sonner';\n\n/**\n * HealthyBowl toast bridge.\n *\n * The host app shell (fe-libs `AppShellProvider`) already mounts ONE sonner\n * `<Toaster>`. To avoid a double-mount / double-fire we do NOT render our own\n * Toaster here. Instead we route every HB toast into that single host instance\n * by calling the `sonner` `toast` function.\n *\n * IMPORTANT (single-instance rule): `sonner` MUST be listed in\n * `externalDependencies` in this package's `vite.config.ts` (as in\n * microfe-botlit). Externalising it makes this `import { toast } from 'sonner'`\n * bind, at build-time composition, to the SAME sonner module the host shell\n * mounts its `<Toaster>` from — so these calls actually reach the host toaster.\n * If sonner were bundled instead, a second module instance would be created and\n * these toasts would silently never appear.\n *\n * The public surface is preserved verbatim so the ~56 existing call sites and\n * the `useToast` hook keep compiling unchanged:\n * - `ToastData` / `ToastVariant` types\n * - `Toast` and `ToastContainer` components (now render nothing; the host owns\n * the visible toast UI, icons, colours and positioning)\n * - the `pushToast` / `dismissToast` helpers backing `useToast`.\n */\n\nexport type ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface ToastData {\n id: string;\n title: string;\n description?: string;\n variant: ToastVariant;\n duration?: number;\n}\n\nlet toastCounter = 0;\n\n/**\n * Enqueue a toast into the host's sonner `<Toaster>` singleton.\n * Returns the toast id (a string the caller can later pass to `dismissToast`).\n */\nexport function pushToast(params: {\n title: string;\n description?: string;\n variant?: ToastVariant;\n duration?: number;\n}): string {\n const variant = params.variant ?? 'info';\n\n // Bespoke convention: `duration <= 0` meant \"sticky / never auto-dismiss\".\n // sonner auto-dismisses by default; `Infinity` reproduces the sticky case.\n const duration = params.duration === undefined ? undefined : params.duration > 0 ? params.duration : Infinity;\n\n // Generate the id ourselves and hand it to sonner so push + dismiss agree on\n // the id type. sonner's default ids are numeric and `dismiss(id)` matches by\n // strict equality, so a `String(numericId)` would never dismiss the toast\n // (this is what broke programmatic dismissal of sticky toasts).\n const id = `hb-toast-${++toastCounter}`;\n sonnerToast[variant](params.title, { description: params.description, duration, id });\n return id;\n}\n\n/** Dismiss a toast in the host singleton by id. */\nexport function dismissToast(id: string): void {\n sonnerToast.dismiss(id);\n}\n\ninterface ToastProps extends ToastData {\n onDismiss: (id: string) => void;\n}\n\n/**\n * Retained for API compatibility. The host `<Toaster>` renders the actual toast\n * UI, so this individual card renders nothing.\n */\nexport const Toast: FC<ToastProps> = () => null;\n\ninterface ToastContainerProps {\n toasts: ToastData[];\n onDismiss: (id: string) => void;\n}\n\n/**\n * Retained for API compatibility. HB must NOT mount its own Toaster (the host\n * app shell already mounts the single sonner `<Toaster>`), so this renders\n * nothing. Pages can keep rendering `<ToastContainer toasts onDismiss />`.\n */\nexport const ToastContainer: FC<ToastContainerProps> = () => null;\n"],"mappings":";;AAqCA,IAAI,IAAe;AAMnB,SAAgB,EAAU,GAKf;CACT,IAAM,IAAU,EAAO,WAAW,QAI5B,IAAW,EAAO,aAAa,KAAA,IAAY,KAAA,IAAY,EAAO,WAAW,IAAI,EAAO,WAAW,UAM/F,IAAK,YAAY,EAAE;AAEzB,QADA,EAAY,GAAS,EAAO,OAAO;EAAE,aAAa,EAAO;EAAa;EAAU;EAAI,CAAC,EAC9E;;AAIT,SAAgB,EAAa,GAAkB;AAC7C,GAAY,QAAQ,EAAG;;AAuBzB,IAAa,UAAgD"}
@@ -1,26 +1,16 @@
1
- import { useCallback as e, useState as t } from "react";
1
+ import { dismissToast as e, pushToast as t } from "../components/Toast.js";
2
+ import { useCallback as n } from "react";
2
3
  //#region src/healthybowl/hooks/useToast.ts
3
- var n = 0;
4
- function r() {
5
- let [r, i] = t([]), a = e((e) => {
6
- i((t) => t.filter((t) => t.id !== e));
7
- }, []);
4
+ var r = [];
5
+ function i() {
6
+ let i = n((t) => e(t), []);
8
7
  return {
9
8
  toasts: r,
10
- toast: e((e) => {
11
- let t = `toast-${++n}`, r = {
12
- id: t,
13
- title: e.title,
14
- description: e.description,
15
- variant: e.variant ?? "info",
16
- duration: e.duration ?? 4e3
17
- };
18
- return i((e) => [...e.slice(-4), r]), t;
19
- }, []),
20
- dismiss: a
9
+ toast: n((e) => t(e), []),
10
+ dismiss: i
21
11
  };
22
12
  }
23
13
  //#endregion
24
- export { r as useToast };
14
+ export { i as useToast };
25
15
 
26
16
  //# sourceMappingURL=useToast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToast.js","names":[],"sources":["../../../src/healthybowl/hooks/useToast.ts"],"sourcesContent":["/**\n * useToast Hook\n * Simple toast notification system for the HealthyBowl MFE.\n * @module healthybowl\n */\n\nimport { useState, useCallback } from 'react';\nimport type { ToastData, ToastVariant } from '../components/Toast';\n\nlet toastCounter = 0;\n\nexport function useToast() {\n const [toasts, setToasts] = useState<ToastData[]>([]);\n\n const dismiss = useCallback((id: string) => {\n setToasts((prev) => prev.filter((t) => t.id !== id));\n }, []);\n\n const toast = useCallback(\n (params: { title: string; description?: string; variant?: ToastVariant; duration?: number }) => {\n const id = `toast-${++toastCounter}`;\n const newToast: ToastData = {\n id,\n title: params.title,\n description: params.description,\n variant: params.variant ?? 'info',\n duration: params.duration ?? 4000,\n };\n setToasts((prev) => [...prev.slice(-4), newToast]); // Keep max 5 toasts\n return id;\n },\n []\n );\n\n return { toasts, toast, dismiss };\n}\n"],"mappings":";;AASA,IAAI,IAAe;AAEnB,SAAgB,IAAW;CACzB,IAAM,CAAC,GAAQ,KAAa,EAAsB,EAAE,CAAC,EAE/C,IAAU,GAAa,MAAe;AAC1C,KAAW,MAAS,EAAK,QAAQ,MAAM,EAAE,OAAO,EAAG,CAAC;IACnD,EAAE,CAAC;AAkBN,QAAO;EAAE;EAAQ,OAhBH,GACX,MAA+F;GAC9F,IAAM,IAAK,SAAS,EAAE,KAChB,IAAsB;IAC1B;IACA,OAAO,EAAO;IACd,aAAa,EAAO;IACpB,SAAS,EAAO,WAAW;IAC3B,UAAU,EAAO,YAAY;IAC9B;AAED,UADA,GAAW,MAAS,CAAC,GAAG,EAAK,MAAM,GAAG,EAAE,EAAS,CAAC,EAC3C;KAET,EAAE,CACH;EAEuB;EAAS"}
1
+ {"version":3,"file":"useToast.js","names":[],"sources":["../../../src/healthybowl/hooks/useToast.ts"],"sourcesContent":["/**\n * useToast Hook\n *\n * Toast notification for the HealthyBowl MFE. The host app shell (fe-libs\n * `AppShellProvider`) mounts the single sonner `<Toaster>`, so this hook does NOT\n * own React state or render its own UI — it routes every toast into that one host\n * instance via the `pushToast` / `dismissToast` helpers in `../components/Toast`.\n * The public return contract `{ toasts, toast, dismiss }` is preserved so all\n * existing call sites compile unchanged.\n * @module healthybowl\n */\n\nimport { useCallback } from 'react';\nimport type { ToastVariant } from '../components/Toast';\nimport { pushToast, dismissToast, type ToastData } from '../components/Toast';\n\nconst EMPTY_TOASTS: ToastData[] = [];\n\nexport function useToast() {\n const dismiss = useCallback((id: string) => dismissToast(id), []);\n\n const toast = useCallback(\n (params: { title: string; description?: string; variant?: ToastVariant; duration?: number }) => pushToast(params),\n []\n );\n\n return { toasts: EMPTY_TOASTS, toast, dismiss };\n}\n"],"mappings":";;;AAgBA,IAAM,IAA4B,EAAE;AAEpC,SAAgB,IAAW;CACzB,IAAM,IAAU,GAAa,MAAe,EAAa,EAAG,EAAE,EAAE,CAAC;AAOjE,QAAO;EAAE,QAAQ;EAAc,OALjB,GACX,MAA+F,EAAU,EAAO,EACjH,EAAE,CACH;EAEqC;EAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.624.6",
3
+ "version": "2026.625.1",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [
@@ -51,6 +51,7 @@
51
51
  "react-dom": "^19.0.0",
52
52
  "react-router-dom": "^7.1.3",
53
53
  "recharts": "^2.15.0",
54
+ "sonner": "^2.0.7",
54
55
  "tailwind-merge": "^3.4.0",
55
56
  "zustand": "^5.0.7"
56
57
  },