@burdenoff/microfe-bigconsole 2026.1103.3 → 2026.1103.5

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,55 +1,67 @@
1
1
  import e from "../store/drilldownStore.js";
2
- import { SECTION_FOCUS_RING as t } from "./common/sectionStyles.js";
2
+ import { GlobalFilterFieldsFragmentDoc as t } from "../../generated/wspace-operations.js";
3
+ import { SECTION_FOCUS_RING as n } from "./common/sectionStyles.js";
3
4
  import "./common/index.js";
4
- import { getVisibleDrilldownParams as n } from "../utils/drilldownParams.js";
5
- import { memo as r, useCallback as i, useRef as a } from "react";
6
- import { ResponsiveDialog as o, ResponsiveDialogContent as s, ResponsiveDialogDescription as c, ResponsiveDialogTitle as l } from "@burdenoff/fe-libs/ui";
7
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
5
+ import { getDrilldownParamSummary as r } from "../utils/drilldownParams.js";
6
+ import { memo as i, useCallback as a, useContext as o, useRef as s } from "react";
7
+ import { ResponsiveDialog as c, ResponsiveDialogContent as l, ResponsiveDialogDescription as u, ResponsiveDialogTitle as d } from "@burdenoff/fe-libs/ui";
8
+ import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { getApolloContext as p } from "@apollo/client/react";
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
11
  //#region src/bigconsole/components/DrilldownModal.tsx
9
- var f = r(function({ renderDashboard: r, onClose: f }) {
10
- let m = a(null), h = e((e) => e.isOpen), g = e((e) => e.dashboardId), _ = e((e) => e.params), v = e((e) => e.history), y = e((e) => e.closeModal), b = e((e) => e.popDrilldown), x = i(() => {
11
- y(), f?.();
12
- }, [y, f]), S = i(() => {
13
- b();
14
- }, [b]);
15
- return !h || !g ? null : /* @__PURE__ */ u(o, {
16
- open: h,
12
+ var g = i(function({ renderDashboard: i, onClose: g }) {
13
+ let { t: v } = f(), { client: y } = o(p()), b = s(null), x = e((e) => e.isOpen), S = e((e) => e.dashboardId), C = e((e) => e.params), w = e((e) => e.history), T = e((e) => e.closeModal), E = e((e) => e.popDrilldown), D = a(() => {
14
+ T(), g?.();
15
+ }, [T, g]), O = a(() => {
16
+ E();
17
+ }, [E]);
18
+ if (!x || !S) return null;
19
+ let k = r(C, (e) => y?.cache.readFragment({
20
+ id: y.cache.identify({
21
+ __typename: "BigConsoleGlobalFilter",
22
+ id: e
23
+ }),
24
+ fragment: t,
25
+ returnPartialData: !0
26
+ }));
27
+ return /* @__PURE__ */ m(c, {
28
+ open: x,
17
29
  onOpenChange: (e) => {
18
- e || x();
30
+ e || D();
19
31
  },
20
- children: /* @__PURE__ */ d(s, {
32
+ children: /* @__PURE__ */ h(l, {
21
33
  showCloseButton: !1,
22
34
  onOpenAutoFocus: () => {
23
35
  let e = document.activeElement;
24
- e instanceof HTMLElement && e !== document.body && !e.closest("[role=\"dialog\"]") && (m.current = e);
36
+ e instanceof HTMLElement && e !== document.body && !e.closest("[role=\"dialog\"]") && (b.current = e);
25
37
  },
26
38
  onCloseAutoFocus: (e) => {
27
- e.preventDefault(), m.current?.isConnected && m.current.focus();
39
+ e.preventDefault(), b.current?.isConnected && b.current.focus();
28
40
  },
29
41
  className: "flex w-full md:w-[calc(100%-2rem)] max-w-5xl flex-col gap-0 overflow-hidden rounded-card bg-bg-surface p-0 sm:max-w-5xl",
30
42
  style: { maxHeight: "calc(100dvh - 2rem)" },
31
43
  children: [
32
- /* @__PURE__ */ u(c, {
44
+ /* @__PURE__ */ m(u, {
33
45
  className: "sr-only",
34
46
  children: "Explore the linked dashboard and return to the previous drilldown level."
35
47
  }),
36
- /* @__PURE__ */ d("div", {
48
+ /* @__PURE__ */ h("div", {
37
49
  className: "flex flex-shrink-0 flex-wrap items-center justify-between gap-control-gap border-b border-[var(--color-border-subtle)] px-4 py-3",
38
- children: [/* @__PURE__ */ d("div", {
50
+ children: [/* @__PURE__ */ h("div", {
39
51
  className: "flex min-w-0 items-center gap-3",
40
52
  children: [
41
- v.length > 0 && /* @__PURE__ */ u("button", {
53
+ w.length > 0 && /* @__PURE__ */ m("button", {
42
54
  type: "button",
43
- onClick: S,
55
+ onClick: O,
44
56
  className: "flex h-control-md w-[var(--size-controlHeight-md)] shrink-0 items-center justify-center rounded-button motion-safe:transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
45
57
  title: "Go back",
46
58
  "aria-label": "Go back",
47
- children: /* @__PURE__ */ u("svg", {
59
+ children: /* @__PURE__ */ m("svg", {
48
60
  className: "w-5 h-5 text-text-secondary",
49
61
  fill: "none",
50
62
  stroke: "currentColor",
51
63
  viewBox: "0 0 24 24",
52
- children: /* @__PURE__ */ u("path", {
64
+ children: /* @__PURE__ */ m("path", {
53
65
  strokeLinecap: "round",
54
66
  strokeLinejoin: "round",
55
67
  strokeWidth: 2,
@@ -57,33 +69,33 @@ var f = r(function({ renderDashboard: r, onClose: f }) {
57
69
  })
58
70
  })
59
71
  }),
60
- /* @__PURE__ */ u(l, {
72
+ /* @__PURE__ */ m(d, {
61
73
  className: "truncate text-sm font-semibold text-text-primary",
62
74
  children: "Drilldown View"
63
75
  }),
64
- v.length > 0 && /* @__PURE__ */ d("span", {
76
+ w.length > 0 && /* @__PURE__ */ h("span", {
65
77
  className: "text-xs text-text-muted",
66
78
  children: [
67
79
  "(",
68
- v.length + 1,
80
+ w.length + 1,
69
81
  " level",
70
- v.length > 0 ? "s" : "",
82
+ w.length > 0 ? "s" : "",
71
83
  " deep)"
72
84
  ]
73
85
  })
74
86
  ]
75
- }), /* @__PURE__ */ u("button", {
87
+ }), /* @__PURE__ */ m("button", {
76
88
  type: "button",
77
- onClick: x,
78
- className: `flex h-control-md w-[var(--size-controlHeight-md)] shrink-0 items-center justify-center rounded-button motion-safe:transition-colors hover:bg-bg-sunken ${t}`,
89
+ onClick: D,
90
+ className: `flex h-control-md w-[var(--size-controlHeight-md)] shrink-0 items-center justify-center rounded-button motion-safe:transition-colors hover:bg-bg-sunken ${n}`,
79
91
  title: "Close (Esc)",
80
92
  "aria-label": "Close drilldown",
81
- children: /* @__PURE__ */ u("svg", {
93
+ children: /* @__PURE__ */ m("svg", {
82
94
  className: "w-5 h-5 text-text-secondary",
83
95
  fill: "none",
84
96
  stroke: "currentColor",
85
97
  viewBox: "0 0 24 24",
86
- children: /* @__PURE__ */ u("path", {
98
+ children: /* @__PURE__ */ m("path", {
87
99
  strokeLinecap: "round",
88
100
  strokeLinejoin: "round",
89
101
  strokeWidth: 2,
@@ -92,30 +104,29 @@ var f = r(function({ renderDashboard: r, onClose: f }) {
92
104
  })
93
105
  })]
94
106
  }),
95
- /* @__PURE__ */ u("div", {
107
+ /* @__PURE__ */ m("div", {
96
108
  className: "min-h-0 flex-1 overflow-y-auto bg-bg-sunken p-4",
97
- children: r ? r(g, _) : /* @__PURE__ */ u(p, {})
109
+ children: i ? i(S, C) : /* @__PURE__ */ m(_, {})
98
110
  }),
99
- /* @__PURE__ */ u("div", {
111
+ /* @__PURE__ */ m("div", {
100
112
  className: "flex-shrink-0 border-t border-[var(--color-border-subtle)] px-4 py-2",
101
- children: /* @__PURE__ */ d("div", {
113
+ children: /* @__PURE__ */ h("div", {
102
114
  className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-xs text-text-muted",
103
- children: [/* @__PURE__ */ d("span", { children: [
104
- "Parameters:",
105
- " ",
106
- n(_).map(([e]) => e).join(", ") || "None"
107
- ] }), /* @__PURE__ */ u("span", { children: "Press Esc to close" })]
115
+ children: [/* @__PURE__ */ m("span", {
116
+ className: "min-w-0 break-words",
117
+ children: v("bigconsole.drilldown.parameters", "Parameters: {{parameters}}", { parameters: k || v("bigconsole.drilldown.noParameters", "None") })
118
+ }), /* @__PURE__ */ m("span", { children: "Press Esc to close" })]
108
119
  })
109
120
  })
110
121
  ]
111
122
  })
112
123
  });
113
124
  });
114
- function p() {
115
- return /* @__PURE__ */ u("div", {
125
+ function _() {
126
+ return /* @__PURE__ */ m("div", {
116
127
  className: "flex items-center justify-center h-full text-sm text-text-secondary",
117
128
  children: "Unable to load drilldown content. Please try again."
118
129
  });
119
130
  }
120
131
  //#endregion
121
- export { f as DrilldownModal, f as default };
132
+ export { g as DrilldownModal, g as default };
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  import { ChartConfig, ChartData } from './types';
3
3
  export interface FunnelChartProps {
4
- /** Chart data (should be sorted by value descending) */
4
+ /** Chart data in funnel stage order */
5
5
  data: ChartData[];
6
6
  /** Chart configuration */
7
7
  config: ChartConfig;
@@ -1,68 +1,83 @@
1
1
  import { ChartTooltip as e } from "../ChartTooltip.js";
2
- import { memo as t } from "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { Cell as i, Funnel as a, FunnelChart as o, LabelList as s, ResponsiveContainer as c, Tooltip as l } from "recharts";
2
+ import { funnelStages as t } from "./funnelData.js";
3
+ import { memo as n } from "react";
4
+ import { useI18n as r } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { Cell as o, Funnel as s, FunnelChart as c, LabelList as l, ResponsiveContainer as u, Tooltip as d } from "recharts";
5
7
  //#region src/bigconsole/components/widgets/chart/charts/FunnelChart.tsx
6
- var u = [
8
+ var f = [
7
9
  "var(--color-chart-1)",
8
10
  "var(--color-chart-2)",
9
11
  "var(--color-chart-3)",
10
12
  "var(--color-chart-4)",
11
13
  "var(--color-chart-5)"
12
- ], d = t(function({ data: t = [], config: d, dataKey: f = "value", nameKey: p = "name", onDataClick: m }) {
13
- let h = (e) => typeof e == "number" ? new Intl.NumberFormat("en-US", {
14
+ ], p = n(function({ data: n = [], config: p, dataKey: m = "value", nameKey: h = "name", onDataClick: g }) {
15
+ let { t: _, locale: v } = r(), y = t(n, m, h), b = (e) => typeof e == "number" ? new Intl.NumberFormat("en-US", {
14
16
  notation: e >= 1e4 ? "compact" : "standard",
15
17
  maximumFractionDigits: 2
16
18
  }).format(e) : String(e);
17
- if (!t?.length) return null;
18
- let g = t.map((e, n) => {
19
- if (n === 0) return {
20
- ...e,
21
- rate: 100
22
- };
23
- let r = t[n - 1][f], i = e[f], a = r > 0 ? i / r * 100 : 0;
24
- return {
25
- ...e,
26
- rate: a
27
- };
19
+ if (!y || !y.length || y.every((e) => e.value === 0)) return /* @__PURE__ */ i("div", {
20
+ role: "status",
21
+ className: "flex items-center justify-center h-full text-text-secondary text-sm p-4",
22
+ children: y ? _("bigconsole.widgets.funnel.noCounts", "No funnel counts to display. Connect data with at least one count greater than zero.") : _("bigconsole.widgets.funnel.invalidFields", "Each funnel row needs a label in \"{{labelField}}\" and a non-negative number in \"{{valueField}}\". Choose the label and value fields in Style.", {
23
+ labelField: h,
24
+ valueField: m
25
+ })
28
26
  });
29
- return /* @__PURE__ */ n(c, {
30
- width: "100%",
31
- height: "100%",
32
- children: /* @__PURE__ */ r(o, { children: [/* @__PURE__ */ n(l, { content: /* @__PURE__ */ n(e, {
33
- valueFormatter: h,
34
- labelFormatter: (e) => String(e)
35
- }) }), /* @__PURE__ */ r(a, {
36
- dataKey: f,
37
- nameKey: p,
38
- data: g,
39
- isAnimationActive: !0,
40
- onClick: ((e, t) => {
41
- m && e && m(e, t);
42
- }),
43
- children: [
44
- /* @__PURE__ */ n(s, {
45
- position: "right",
46
- fill: "var(--color-text-primary)",
47
- stroke: "none",
48
- dataKey: p,
49
- fontSize: 12
50
- }),
51
- /* @__PURE__ */ n(s, {
52
- position: "center",
53
- fill: "var(--color-text-on-primary, #ffffff)",
54
- stroke: "none",
55
- formatter: (e) => h(e),
56
- fontSize: 14,
57
- fontWeight: 600
58
- }),
59
- g.map((e, t) => /* @__PURE__ */ n(i, {
60
- fill: d.colors?.[t] || u[t % u.length],
61
- style: { cursor: m ? "pointer" : "default" }
62
- }, `cell-${t}`))
63
- ]
64
- })] })
27
+ let x = new Intl.NumberFormat(v, {
28
+ style: "percent",
29
+ maximumFractionDigits: 1
30
+ }), S = y.map((e) => ({
31
+ ...e.row,
32
+ __conversionLabel: `${e.label} (${e.conversion === void 0 ? "—" : x.format(e.conversion)})`
33
+ }));
34
+ return /* @__PURE__ */ a("div", {
35
+ className: "flex flex-col h-full",
36
+ children: [/* @__PURE__ */ i("p", {
37
+ className: "text-xs text-text-secondary mb-2",
38
+ children: _("bigconsole.widgets.funnel.conversionBasis", "Conversion from previous stage; first stage is the baseline.")
39
+ }), /* @__PURE__ */ i("div", {
40
+ className: "flex-1 min-h-0",
41
+ children: /* @__PURE__ */ i(u, {
42
+ width: "100%",
43
+ height: "100%",
44
+ children: /* @__PURE__ */ a(c, { children: [/* @__PURE__ */ i(d, { content: /* @__PURE__ */ i(e, {
45
+ valueFormatter: b,
46
+ labelFormatter: (e) => String(e)
47
+ }) }), /* @__PURE__ */ a(s, {
48
+ dataKey: m,
49
+ nameKey: h,
50
+ data: S,
51
+ isAnimationActive: !0,
52
+ onClick: (e, t) => {
53
+ t !== void 0 && n[t] && g?.(n[t], t);
54
+ },
55
+ children: [
56
+ /* @__PURE__ */ i(l, {
57
+ position: "right",
58
+ fill: "var(--color-text-primary)",
59
+ stroke: "none",
60
+ dataKey: "__conversionLabel",
61
+ fontSize: 12
62
+ }),
63
+ /* @__PURE__ */ i(l, {
64
+ position: "center",
65
+ fill: "var(--color-text-on-primary, #ffffff)",
66
+ stroke: "none",
67
+ dataKey: m,
68
+ formatter: (e) => b(e),
69
+ fontSize: 14,
70
+ fontWeight: 600
71
+ }),
72
+ S.map((e, t) => /* @__PURE__ */ i(o, {
73
+ fill: p.colors?.[t] || f[t % f.length],
74
+ style: { cursor: g ? "pointer" : "default" }
75
+ }, `cell-${t}`))
76
+ ]
77
+ })] })
78
+ })
79
+ })]
65
80
  });
66
81
  });
67
82
  //#endregion
68
- export { d as FunnelChart, d as default };
83
+ export { p as FunnelChart, p as default };
@@ -0,0 +1,8 @@
1
+ import { ChartData } from './types';
2
+ /** Keep the caller's stage order; conversions compare adjacent stages. */
3
+ export declare function funnelStages(data: ChartData[], valueField: string, labelField: string): {
4
+ row: ChartData;
5
+ value: number;
6
+ label: string;
7
+ conversion: number | undefined;
8
+ }[] | null;
@@ -0,0 +1,17 @@
1
+ //#region src/bigconsole/components/widgets/chart/charts/funnelData.ts
2
+ function e(e, t, n) {
3
+ return !Array.isArray(e) || e.some((e) => {
4
+ let r = e?.[t], i = e?.[n];
5
+ return typeof r != "number" || !Number.isFinite(r) || r < 0 || !["string", "number"].includes(typeof i) || String(i).trim() === "";
6
+ }) ? null : e.map((r, i) => {
7
+ let a = r[t], o = e[Math.max(0, i - 1)][t];
8
+ return {
9
+ row: r,
10
+ value: a,
11
+ label: String(r[n]),
12
+ conversion: o > 0 ? a / o : void 0
13
+ };
14
+ });
15
+ }
16
+ //#endregion
17
+ export { e as funnelStages };
@@ -1,2 +1,8 @@
1
1
  /** Display only meaningful context; the original drilldown parameters remain unchanged. */
2
2
  export declare function getVisibleDrilldownParams(params: Record<string, unknown>): Array<[string, unknown]>;
3
+ export interface DrilldownFilterLabel {
4
+ name?: string;
5
+ config?: Record<string, unknown>;
6
+ }
7
+ /** Resolve display metadata only; never rewrite filter IDs or values used by widgets. */
8
+ export declare function getDrilldownParamSummary(params: Record<string, unknown>, readFilter?: (id: string) => DrilldownFilterLabel | null | undefined): string;
@@ -2,5 +2,23 @@
2
2
  function e(e) {
3
3
  return Object.entries(e).filter(([e, t]) => e.startsWith("__") || t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : !Array.isArray(t) || t.length > 0);
4
4
  }
5
+ function t(e, n) {
6
+ if (Array.isArray(e)) return e.map((e) => t(e, n)).join(", ");
7
+ if (typeof e == "object" && e) {
8
+ let r = e;
9
+ return typeof r.label == "string" ? r.label : "value" in r ? t(r.value, n) : JSON.stringify(e);
10
+ }
11
+ if (Array.isArray(n)) {
12
+ let t = n.find((t) => t && typeof t == "object" && t.value === e && typeof t.label == "string");
13
+ if (t) return t.label;
14
+ }
15
+ return String(e);
16
+ }
17
+ function n(n, r = () => void 0) {
18
+ return e(n).map(([e, n]) => {
19
+ let i = r(e);
20
+ return `${i?.name || e}: ${t(n, i?.config?.options)}`;
21
+ }).join("; ");
22
+ }
5
23
  //#endregion
6
- export { e as getVisibleDrilldownParams };
24
+ export { n as getDrilldownParamSummary, e as getVisibleDrilldownParams };