@burdenoff/microfe-bigconsole 2026.1122.1 → 2026.1122.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,77 @@
1
1
  import { useDashboardStore as e, useGlobalFilterValues as t } from "../../../store/dashboardStore.js";
2
2
  import "../../../hooks/index.js";
3
3
  import { SECTION_FOCUS_RING as n } from "../../common/sectionStyles.js";
4
- import { FilterChip as r } from "./FilterChip.js";
5
- import i from "../../../hooks/useGlobalFilters.js";
6
- import ee from "../../../hooks/useFilterUrlSync.js";
7
- import te from "../../../hooks/useFilterPresets.js";
4
+ import { FilterChip as ee } from "./FilterChip.js";
5
+ import te from "../../../hooks/useGlobalFilters.js";
6
+ import r from "../../../hooks/useFilterUrlSync.js";
7
+ import i from "../../../hooks/useFilterPresets.js";
8
8
  import "../../../store/index.js";
9
+ import { useIsPastView as ne } from "../../../asof/AsOfProvider.js";
10
+ import "../../../asof/index.js";
9
11
  import { FilterEditor as a } from "./FilterEditor.js";
10
- import { FilterPresetSelector as o } from "./FilterPresetSelector.js";
11
- import { SEMANTIC_COLORS as s } from "../../../utils/semanticTokens.js";
12
+ import { FilterPresetSelector as re } from "./FilterPresetSelector.js";
13
+ import { SEMANTIC_COLORS as o } from "../../../utils/semanticTokens.js";
12
14
  import "../../common/index.js";
13
- import { useCallback as c, useEffect as l, useState as u } from "react";
14
- import { useI18n as ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
15
+ import { useCallback as s, useEffect as c, useState as l } from "react";
16
+ import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
16
18
  // src/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.tsx
17
- var p = `inline-flex min-h-control-sm items-center gap-icon-gap rounded-button border border-[var(--color-border-subtle)] bg-bg-surface px-3 py-1 text-sm font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-accentSubtle ${n}`, m = `inline-flex min-h-control-sm items-center gap-icon-gap rounded-button px-2 py-1 text-sm font-medium text-text-secondary motion-safe:transition-colors hover:bg-bg-accentSubtle ${n}`;
18
- function h({ dashboardId: n, onFilterChange: h, collapsible: g = !0, className: _ = "", enableUrlSync: v = !0, enablePresets: y = !0 }) {
19
- let { t: b } = ne(), { filters: x, loading: S, error: C, fetchFilters: w, createFilter: T, updateFilter: E, deleteFilter: D } = i(), O = t(), k = e((e) => e.setGlobalFilterValue), A = e((e) => e.setGlobalFilterValues), j = e((e) => e.clearGlobalFilterValue);
20
- l(() => {
21
- let t = e.getState().globalFilterValues, n = Object.fromEntries(x.filter((e) => e.defaultValue !== void 0 && !(e.id in t)).map((e) => [e.id, e.defaultValue]));
22
- Object.keys(n).length && A({
19
+ var f = `inline-flex min-h-control-sm items-center gap-icon-gap rounded-button border border-[var(--color-border-subtle)] bg-bg-surface px-3 py-1 text-sm font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-accentSubtle ${n}`, p = `inline-flex min-h-control-sm items-center gap-icon-gap rounded-button px-2 py-1 text-sm font-medium text-text-secondary motion-safe:transition-colors hover:bg-bg-accentSubtle ${n}`;
20
+ function m({ dashboardId: n, onFilterChange: m, collapsible: h = !0, className: g = "", enableUrlSync: _ = !0, enablePresets: v = !0 }) {
21
+ let { t: y } = ie(), { filters: b, loading: x, error: S, fetchFilters: C, createFilter: w, updateFilter: T, deleteFilter: E } = te(), D = t(), O = e((e) => e.setGlobalFilterValue), k = e((e) => e.setGlobalFilterValues), A = e((e) => e.clearGlobalFilterValue);
22
+ c(() => {
23
+ let t = e.getState().globalFilterValues, n = Object.fromEntries(b.filter((e) => e.defaultValue !== void 0 && !(e.id in t)).map((e) => [e.id, e.defaultValue]));
24
+ Object.keys(n).length && k({
23
25
  ...n,
24
26
  ...t
25
27
  });
26
28
  }, [
27
- x,
28
- O,
29
- A
29
+ b,
30
+ D,
31
+ k
30
32
  ]);
31
- let { getShareableUrl: M, clearUrlParams: N } = ee({
32
- enabled: v,
33
+ let { getShareableUrl: j, clearUrlParams: M } = r({
34
+ enabled: _,
33
35
  paramPrefix: "filter_",
34
36
  debounceMs: 300
35
- }), { presets: P, activePresetId: F, loadPresets: I, applyPreset: L, saveCurrentAsPreset: R, deletePreset: z, clearActivePreset: B } = te(n), [V, re] = u(!1), [H, U] = u(!1), [W, G] = u(null), [K, q] = u(!1);
36
- l(() => {
37
- n && (w(n), y && I(n));
37
+ }), { presets: N, activePresetId: P, loadPresets: F, applyPreset: I, saveCurrentAsPreset: L, deletePreset: R, clearActivePreset: z } = i(n), [B, ae] = l(!1), [V, H] = l(!1), [U, W] = l(null), [G, K] = l(!1);
38
+ c(() => {
39
+ n && (C(n), v && F(n));
38
40
  }, [
39
41
  n,
40
- w,
41
- I,
42
- y
43
- ]), l(() => {
44
- h && h(e.getState().globalFilterValues);
45
- }, [O, h]), l(() => {
46
- if (F && Object.keys(O).length > 0) {
47
- let e = P.find((e) => e.id === F);
48
- e && JSON.stringify(e.values) !== JSON.stringify(O) && B();
42
+ C,
43
+ F,
44
+ v
45
+ ]), c(() => {
46
+ m && m(e.getState().globalFilterValues);
47
+ }, [D, m]), c(() => {
48
+ if (P && Object.keys(D).length > 0) {
49
+ let e = N.find((e) => e.id === P);
50
+ e && JSON.stringify(e.values) !== JSON.stringify(D) && z();
49
51
  }
50
52
  }, [
51
- O,
52
- F,
53
+ D,
53
54
  P,
54
- B
55
+ N,
56
+ z
55
57
  ]);
56
- let J = c((e, t) => {
57
- k(e, t);
58
- }, [k]), Y = c(() => {
59
- G(null), U(!0);
60
- }, []), ie = c((e) => {
61
- G(e), U(!0);
62
- }, []), X = c(async (e) => {
63
- if (W) {
64
- if (!await E({
65
- id: W.id,
58
+ let q = s((e, t) => {
59
+ O(e, t);
60
+ }, [O]), J = ne(), Y = s(() => {
61
+ J || (W(null), H(!0));
62
+ }, [J]), oe = s((e) => {
63
+ J || (W(e), H(!0));
64
+ }, [J]), X = s(async (e) => {
65
+ if (J) throw Error("Filters cannot be changed in a past view");
66
+ if (U) {
67
+ if (!await T({
68
+ id: U.id,
66
69
  name: e.name,
67
70
  config: e.config,
68
71
  defaultValue: e.defaultValue,
69
72
  isRequired: e.isRequired
70
73
  })) throw Error("Filter save failed");
71
- } else if (!await T({
74
+ } else if (!await w({
72
75
  dashboardId: n,
73
76
  name: e.name,
74
77
  type: e.type,
@@ -76,128 +79,133 @@ function h({ dashboardId: n, onFilterChange: h, collapsible: g = !0, className:
76
79
  defaultValue: e.defaultValue,
77
80
  isRequired: e.isRequired
78
81
  })) throw Error("Filter save failed");
79
- U(!1), G(null);
82
+ H(!1), W(null);
80
83
  }, [
81
84
  n,
82
- W,
85
+ U,
86
+ w,
83
87
  T,
84
- E
85
- ]), Z = c(async (e) => {
86
- await D(e) && j(e);
87
- }, [D, j]), ae = c(() => {
88
- A(Object.fromEntries(x.filter((e) => e.defaultValue !== void 0).map((e) => [e.id, e.defaultValue]))), N(), B();
88
+ J
89
+ ]), se = s(async (e) => {
90
+ J || await E(e) && A(e);
89
91
  }, [
90
- x,
92
+ E,
91
93
  A,
92
- N,
93
- B
94
- ]), oe = c(async () => {
95
- let e = M();
94
+ J
95
+ ]), ce = s(() => {
96
+ k(Object.fromEntries(b.filter((e) => e.defaultValue !== void 0).map((e) => [e.id, e.defaultValue]))), M(), z();
97
+ }, [
98
+ b,
99
+ k,
100
+ M,
101
+ z
102
+ ]), Z = s(async () => {
103
+ let e = j();
96
104
  try {
97
- await navigator.clipboard.writeText(e), q(!0), setTimeout(() => q(!1), 2e3);
105
+ await navigator.clipboard.writeText(e), K(!0), setTimeout(() => K(!1), 2e3);
98
106
  } catch {}
99
- }, [M]), se = c((e) => {
100
- L(e);
101
- }, [L]), ce = c((e, t) => {
102
- R(e, t);
103
- }, [R]), le = c((e) => {
104
- z(e);
105
- }, [z]), ue = c(() => {
106
- re((e) => !e);
107
- }, []), Q = x.filter((e) => O[e.id] !== void 0 && O[e.id] !== null && O[e.id] !== "").length;
108
- if (S && x.length === 0 && !H) return /* @__PURE__ */ f("div", {
109
- className: `flex flex-wrap items-center gap-control-gap border-b border-[var(--color-border-subtle)] bg-bg-sunken px-card-padding py-control-gap ${_}`,
107
+ }, [j]), le = s((e) => {
108
+ I(e);
109
+ }, [I]), ue = s((e, t) => {
110
+ L(e, t);
111
+ }, [L]), de = s((e) => {
112
+ R(e);
113
+ }, [R]), fe = s(() => {
114
+ ae((e) => !e);
115
+ }, []), Q = b.filter((e) => D[e.id] !== void 0 && D[e.id] !== null && D[e.id] !== "").length;
116
+ if (x && b.length === 0 && !V) return /* @__PURE__ */ d("div", {
117
+ className: `flex flex-wrap items-center gap-control-gap border-b border-[var(--color-border-subtle)] bg-bg-sunken px-card-padding py-control-gap ${g}`,
110
118
  role: "status",
111
119
  "aria-live": "polite",
112
120
  "data-testid": "global-filters-loading",
113
- children: [/* @__PURE__ */ d("span", { className: "h-icon-sm w-icon-sm animate-spin rounded-full border-2 border-action-primary-bg border-t-transparent" }), /* @__PURE__ */ d("span", {
121
+ children: [/* @__PURE__ */ u("span", { className: "h-icon-sm w-icon-sm animate-spin rounded-full border-2 border-action-primary-bg border-t-transparent" }), /* @__PURE__ */ u("span", {
114
122
  className: "text-sm text-text-secondary",
115
- children: b("bigconsole.filters.bar.loading", "Loading filters...")
123
+ children: y("bigconsole.filters.bar.loading", "Loading filters...")
116
124
  })]
117
125
  });
118
- let $ = C && /* @__PURE__ */ f("div", {
126
+ let $ = S && /* @__PURE__ */ d("div", {
119
127
  role: "alert",
120
128
  className: "flex flex-wrap items-center gap-2 px-3 py-2 text-sm text-status-error-text",
121
- children: [/* @__PURE__ */ d("span", { children: b("bigconsole.filters.bar.requestFailed", "Filters could not be loaded or saved. Try again.") }), /* @__PURE__ */ d("button", {
129
+ children: [/* @__PURE__ */ u("span", { children: y("bigconsole.filters.bar.requestFailed", "Filters could not be loaded or saved. Try again.") }), /* @__PURE__ */ u("button", {
122
130
  type: "button",
123
- onClick: () => void w(n),
124
- className: m,
125
- children: b("bigconsole.filters.bar.retry", "Retry")
131
+ onClick: () => void C(n),
132
+ className: p,
133
+ children: y("bigconsole.filters.bar.retry", "Retry")
126
134
  })]
127
135
  });
128
- return x.length === 0 ? /* @__PURE__ */ f("div", {
129
- className: `flex flex-wrap items-center justify-between gap-control-gap border-b border-[var(--color-border-subtle)] bg-bg-sunken px-card-padding py-control-gap ${_}`,
136
+ return b.length === 0 ? /* @__PURE__ */ d("div", {
137
+ className: `flex flex-wrap items-center justify-between gap-control-gap border-b border-[var(--color-border-subtle)] bg-bg-sunken px-card-padding py-control-gap ${g}`,
130
138
  "data-testid": "global-filters-empty",
131
139
  children: [
132
- /* @__PURE__ */ f("div", {
140
+ /* @__PURE__ */ d("div", {
133
141
  className: "flex min-w-0 flex-wrap items-center gap-icon-gap",
134
- children: [/* @__PURE__ */ d("h2", {
142
+ children: [/* @__PURE__ */ u("h2", {
135
143
  className: "text-sm font-semibold text-text-primary",
136
- children: b("bigconsole.filters.bar.title", "Filters")
137
- }), /* @__PURE__ */ d("span", {
144
+ children: y("bigconsole.filters.bar.title", "Filters")
145
+ }), /* @__PURE__ */ u("span", {
138
146
  className: "text-sm text-text-muted",
139
- children: b("bigconsole.filters.bar.noFiltersConfigured", "No filters configured")
147
+ children: y("bigconsole.filters.bar.noFiltersConfigured", "No filters configured")
140
148
  })]
141
149
  }),
142
- /* @__PURE__ */ d("button", {
150
+ !J && /* @__PURE__ */ u("button", {
143
151
  type: "button",
144
152
  onClick: Y,
145
- className: p,
146
- children: b("bigconsole.filters.bar.addFilter", "+ Add Filter")
153
+ className: f,
154
+ children: y("bigconsole.filters.bar.addFilter", "+ Add Filter")
147
155
  }),
148
156
  $,
149
- H && /* @__PURE__ */ d(a, {
150
- filter: W,
157
+ V && /* @__PURE__ */ u(a, {
158
+ filter: U,
151
159
  dashboardId: n,
152
160
  onSave: X,
153
161
  onClose: () => {
154
- U(!1), G(null);
162
+ H(!1), W(null);
155
163
  }
156
164
  })
157
165
  ]
158
- }) : /* @__PURE__ */ f("section", {
159
- className: `flex min-w-0 flex-col border-b border-[var(--color-border-subtle)] bg-bg-sunken ${_}`,
166
+ }) : /* @__PURE__ */ d("section", {
167
+ className: `flex min-w-0 flex-col border-b border-[var(--color-border-subtle)] bg-bg-sunken ${g}`,
160
168
  "aria-labelledby": "global-filters-heading",
161
169
  "data-testid": "global-filters-bar",
162
170
  children: [
163
171
  $,
164
- /* @__PURE__ */ f("div", {
165
- className: `flex flex-wrap items-center justify-between gap-control-gap px-card-padding py-control-gap ${V ? "" : "border-b border-[var(--color-border-subtle)]"}`,
166
- children: [/* @__PURE__ */ f("div", {
172
+ /* @__PURE__ */ d("div", {
173
+ className: `flex flex-wrap items-center justify-between gap-control-gap px-card-padding py-control-gap ${B ? "" : "border-b border-[var(--color-border-subtle)]"}`,
174
+ children: [/* @__PURE__ */ d("div", {
167
175
  className: "flex min-w-0 flex-wrap items-center gap-icon-gap",
168
176
  children: [
169
- /* @__PURE__ */ d("h2", {
177
+ /* @__PURE__ */ u("h2", {
170
178
  id: "global-filters-heading",
171
179
  className: "text-sm font-semibold text-text-primary",
172
- children: b("bigconsole.filters.bar.title", "Filters")
180
+ children: y("bigconsole.filters.bar.title", "Filters")
173
181
  }),
174
- /* @__PURE__ */ d("span", {
182
+ /* @__PURE__ */ u("span", {
175
183
  className: "rounded-pill bg-bg-surface px-2 py-0.5 text-xs font-medium text-text-secondary",
176
- children: x.length
184
+ children: b.length
177
185
  }),
178
- Q > 0 && /* @__PURE__ */ d("span", {
186
+ Q > 0 && /* @__PURE__ */ u("span", {
179
187
  className: "rounded-pill bg-[var(--color-status-success-bgSubtle)] px-2 py-0.5 text-xs font-medium text-status-success-text",
180
- children: b("bigconsole.filters.bar.activeCount", "{{count}} active", { count: Q ?? "" })
188
+ children: y("bigconsole.filters.bar.activeCount", "{{count}} active", { count: Q ?? "" })
181
189
  })
182
190
  ]
183
- }), /* @__PURE__ */ f("div", {
191
+ }), /* @__PURE__ */ d("div", {
184
192
  className: "flex min-w-0 flex-wrap items-center justify-end gap-control-gap",
185
193
  children: [
186
- y && /* @__PURE__ */ d(o, {
187
- presets: P,
188
- activePresetId: F,
189
- onApplyPreset: se,
190
- onSavePreset: ce,
191
- onDeletePreset: le
194
+ v && /* @__PURE__ */ u(re, {
195
+ presets: N,
196
+ activePresetId: P,
197
+ onApplyPreset: le,
198
+ onSavePreset: ue,
199
+ onDeletePreset: de
192
200
  }),
193
- v && Q > 0 && /* @__PURE__ */ f("div", {
201
+ _ && Q > 0 && /* @__PURE__ */ d("div", {
194
202
  style: { position: "relative" },
195
- children: [/* @__PURE__ */ f("button", {
203
+ children: [/* @__PURE__ */ d("button", {
196
204
  type: "button",
197
- onClick: oe,
198
- title: b("bigconsole.filters.bar.shareUrlTitle", "Copy shareable URL with filters"),
199
- className: p,
200
- children: [/* @__PURE__ */ f("svg", {
205
+ onClick: Z,
206
+ title: y("bigconsole.filters.bar.shareUrlTitle", "Copy shareable URL with filters"),
207
+ className: f,
208
+ children: [/* @__PURE__ */ d("svg", {
201
209
  width: "14",
202
210
  height: "14",
203
211
  viewBox: "0 0 24 24",
@@ -205,17 +213,17 @@ function h({ dashboardId: n, onFilterChange: h, collapsible: g = !0, className:
205
213
  stroke: "currentColor",
206
214
  strokeWidth: "2",
207
215
  children: [
208
- /* @__PURE__ */ d("path", { d: "M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8" }),
209
- /* @__PURE__ */ d("polyline", { points: "16,6 12,2 8,6" }),
210
- /* @__PURE__ */ d("line", {
216
+ /* @__PURE__ */ u("path", { d: "M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8" }),
217
+ /* @__PURE__ */ u("polyline", { points: "16,6 12,2 8,6" }),
218
+ /* @__PURE__ */ u("line", {
211
219
  x1: "12",
212
220
  y1: "2",
213
221
  x2: "12",
214
222
  y2: "15"
215
223
  })
216
224
  ]
217
- }), b("bigconsole.filters.bar.share", "Share")]
218
- }), K && /* @__PURE__ */ d("div", {
225
+ }), y("bigconsole.filters.bar.share", "Share")]
226
+ }), G && /* @__PURE__ */ u("div", {
219
227
  style: {
220
228
  position: "absolute",
221
229
  top: "100%",
@@ -223,60 +231,61 @@ function h({ dashboardId: n, onFilterChange: h, collapsible: g = !0, className:
223
231
  transform: "translateX(-50%)",
224
232
  marginTop: "4px",
225
233
  padding: "6px 12px",
226
- backgroundColor: s.textPrimary,
227
- color: s.bgPrimary,
234
+ backgroundColor: o.textPrimary,
235
+ color: o.bgPrimary,
228
236
  fontSize: "12px",
229
237
  borderRadius: "4px",
230
238
  whiteSpace: "nowrap",
231
239
  zIndex: 100001
232
240
  },
233
- children: b("bigconsole.filters.bar.urlCopied", "URL copied!")
241
+ children: y("bigconsole.filters.bar.urlCopied", "URL copied!")
234
242
  })]
235
243
  }),
236
- Q > 0 && /* @__PURE__ */ d("button", {
244
+ Q > 0 && /* @__PURE__ */ u("button", {
237
245
  type: "button",
238
- onClick: ae,
239
- className: `${m} text-status-error-text`,
240
- children: b("bigconsole.filters.bar.resetAll", "Reset all")
246
+ onClick: ce,
247
+ className: `${p} text-status-error-text`,
248
+ children: y("bigconsole.filters.bar.resetAll", "Reset all")
241
249
  }),
242
- /* @__PURE__ */ d("button", {
250
+ !J && /* @__PURE__ */ u("button", {
243
251
  type: "button",
244
252
  onClick: Y,
245
- className: p,
246
- children: b("bigconsole.filters.bar.addFilter", "+ Add Filter")
253
+ className: f,
254
+ children: y("bigconsole.filters.bar.addFilter", "+ Add Filter")
247
255
  }),
248
- g && /* @__PURE__ */ d("button", {
256
+ h && /* @__PURE__ */ u("button", {
249
257
  type: "button",
250
- onClick: ue,
251
- "aria-expanded": !V,
252
- "aria-controls": V ? void 0 : "global-filters-chips",
253
- className: m,
254
- children: V ? b("bigconsole.filters.bar.expand", "▼ Expand") : b("bigconsole.filters.bar.collapse", "▲ Collapse")
258
+ onClick: fe,
259
+ "aria-expanded": !B,
260
+ "aria-controls": B ? void 0 : "global-filters-chips",
261
+ className: p,
262
+ children: B ? y("bigconsole.filters.bar.expand", "▼ Expand") : y("bigconsole.filters.bar.collapse", "▲ Collapse")
255
263
  })
256
264
  ]
257
265
  })]
258
266
  }),
259
- !V && /* @__PURE__ */ d("div", {
267
+ !B && /* @__PURE__ */ u("div", {
260
268
  id: "global-filters-chips",
261
269
  className: "relative flex flex-wrap gap-control-gap px-card-padding py-control-gap",
262
270
  style: { overflow: "visible" },
263
- children: x.map((e) => /* @__PURE__ */ d(r, {
271
+ children: b.map((e) => /* @__PURE__ */ u(ee, {
264
272
  filter: e,
265
- value: O[e.id],
266
- onChange: (t) => J(e.id, t),
267
- onEdit: () => ie(e),
268
- onDelete: () => Z(e.id)
273
+ value: D[e.id],
274
+ onChange: (t) => q(e.id, t),
275
+ onEdit: () => oe(e),
276
+ onDelete: () => se(e.id),
277
+ readOnly: J
269
278
  }, e.id))
270
279
  }),
271
- H && /* @__PURE__ */ d(a, {
272
- filter: W,
280
+ V && /* @__PURE__ */ u(a, {
281
+ filter: U,
273
282
  dashboardId: n,
274
283
  onSave: X,
275
284
  onClose: () => {
276
- U(!1), G(null);
285
+ H(!1), W(null);
277
286
  }
278
287
  })
279
288
  ]
280
289
  });
281
290
  }
282
- export { h as GlobalFiltersBar, h as default };
291
+ export { m as GlobalFiltersBar, m as default };