@nivaro/react 0.3.43 → 0.3.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +38 -5
  4. package/dist/shared/components/CollectionBrowserView.js +1390 -1358
  5. package/dist/shared/components/DataTable.js +356 -334
  6. package/dist/shared/components/ProfileView.js +16 -21
  7. package/dist/shared/components/command-center/CommandCenterView.js +90 -355
  8. package/dist/shared/components/command-center/Header.js +70 -0
  9. package/dist/shared/components/command-center/PeekPanel.js +6 -0
  10. package/dist/shared/components/command-center/api.js +26 -0
  11. package/dist/shared/components/command-center/panels/AttentionPanel.js +6 -0
  12. package/dist/shared/components/command-center/panels/FeedPanel.js +33 -0
  13. package/dist/shared/components/command-center/panels/FlowPanel.js +61 -0
  14. package/dist/shared/components/command-center/panels/ForecastPanel.js +6 -0
  15. package/dist/shared/components/command-center/panels/MapPanel.js +74 -0
  16. package/dist/shared/components/command-center/panels/PartnersPanel.js +6 -0
  17. package/dist/shared/components/command-center/panels/PeoplePanel.js +47 -0
  18. package/dist/shared/components/command-center/panels/RegionPicker.js +6 -0
  19. package/dist/shared/components/command-center/panels/SystemPanel.js +53 -0
  20. package/dist/shared/components/command-center/panels/ThroughputPanel.js +6 -0
  21. package/dist/shared/components/command-center/panels/TimeBar.js +10 -0
  22. package/dist/shared/components/command-center/panels/TrafficPanel.js +11 -0
  23. package/dist/shared/components/command-center/panels/WorkloadPanel.js +6 -0
  24. package/dist/shared/components/command-center/panels/registry.js +28 -0
  25. package/dist/shared/components/command-center/state.js +12 -0
  26. package/dist/shared/components/command-center/theme.js +66 -0
  27. package/dist/shared/components/imports/ImportConsole.js +48 -47
  28. package/dist/shared/components/notifications/TestMyRules.js +39 -38
  29. package/dist/shared/components/profile/TeamsConnect.js +2 -2
  30. package/dist/shared/components/queue/QueueQuickFilters.js +81 -63
  31. package/dist/shared/components/queue/QueueWorklist.js +598 -586
  32. package/dist/shared/lib/quick-filter-cascade.js +29 -0
  33. package/package.json +1 -1
@@ -1,116 +1,134 @@
1
- import { jsxs as g, jsx as s, Fragment as f } from "react/jsx-runtime";
2
- import { useQuery as S } from "@tanstack/react-query";
3
- import { useState as d, useEffect as C, useMemo as N } from "react";
4
- import { MultiPick as x } from "../CollectionBrowserView.js";
5
- const b = (t) => Array.isArray(t) ? t : t ? [t] : [];
6
- function O({
7
- def: t,
8
- selected: a,
9
- onChange: k,
10
- badge: p
1
+ import { jsxs as f, jsx as i, Fragment as S } from "react/jsx-runtime";
2
+ import { useQuery as N } from "@tanstack/react-query";
3
+ import { useState as x, useEffect as O, useMemo as C } from "react";
4
+ import { MultiPick as q } from "../CollectionBrowserView.js";
5
+ const d = (r) => Array.isArray(r) ? r : r ? [r] : [];
6
+ function v({
7
+ def: r,
8
+ selected: n,
9
+ onChange: h,
10
+ badge: y,
11
+ narrowBy: p
11
12
  }) {
12
- const [h, i] = d(!1), [y, c] = d(""), l = t.loadOptions, { data: u = [], isLoading: e } = S({
13
- queryKey: ["queue-quick-facet", t.key, y],
14
- queryFn: () => l ? l(y) : Promise.resolve([]),
15
- enabled: !!l && (h || a.length > 0),
13
+ const [c, g] = x(!1), [o, m] = x(""), u = r.loadOptions, e = JSON.stringify(p), { data: a = [], isLoading: l } = N({
14
+ queryKey: ["queue-quick-facet", r.key, o, e],
15
+ queryFn: () => u ? u(o, { narrowBy: p }) : Promise.resolve([]),
16
+ enabled: !!u && (c || n.length > 0),
16
17
  staleTime: 6e4
17
- }), r = N(() => {
18
- const o = new Set(u.map((n) => n.value));
19
- return [...u, ...a.filter((n) => !o.has(n)).map((n) => ({ label: n, value: n }))];
20
- }, [u, a]);
21
- return /* @__PURE__ */ s(
22
- x,
18
+ }), k = C(() => {
19
+ const s = new Set(a.map((t) => t.value));
20
+ return [...a, ...n.filter((t) => !s.has(t)).map((t) => ({ label: t, value: t }))];
21
+ }, [a, n]);
22
+ return /* @__PURE__ */ i(
23
+ q,
23
24
  {
24
- label: t.placeholder,
25
- options: r,
26
- selected: a,
27
- onChange: (o) => k(o.map(String)),
28
- loading: e,
29
- badge: p,
30
- onSearch: c,
31
- onOpenChange: (o) => {
32
- o && i(!0);
25
+ label: r.placeholder,
26
+ options: k,
27
+ selected: n,
28
+ onChange: (s) => h(s.map(String)),
29
+ loading: l,
30
+ badge: y,
31
+ onSearch: m,
32
+ onOpenChange: (s) => {
33
+ s && g(!0);
33
34
  }
34
35
  }
35
36
  );
36
37
  }
37
38
  function Q({
38
- defs: t,
39
- values: a,
40
- seededKeys: k,
41
- onApply: p,
42
- onClear: h,
43
- right: i
39
+ defs: r,
40
+ values: n,
41
+ seededKeys: h,
42
+ onApply: y,
43
+ onClear: p,
44
+ right: c
44
45
  }) {
45
- const y = JSON.stringify(t.map((e) => [e.key, b(a[e.key])])), [c, l] = d({});
46
- C(() => {
46
+ const g = JSON.stringify(r.map((e) => [e.key, d(n[e.key])])), [o, m] = x({});
47
+ O(() => {
47
48
  const e = {};
48
- for (const r of t) e[r.key] = b(a[r.key]);
49
- l(e);
50
- }, [y]);
51
- const u = t.some(
52
- (e) => JSON.stringify(c[e.key] ?? []) !== JSON.stringify(b(a[e.key]))
49
+ for (const a of r) e[a.key] = d(n[a.key]);
50
+ m(e);
51
+ }, [g]);
52
+ const u = r.some(
53
+ (e) => JSON.stringify(o[e.key] ?? []) !== JSON.stringify(d(n[e.key]))
53
54
  );
54
- return t.length === 0 && !i ? null : /* @__PURE__ */ g(
55
+ return r.length === 0 && !c ? null : /* @__PURE__ */ f(
55
56
  "div",
56
57
  {
57
58
  className: "flex shrink-0 flex-wrap items-center gap-1.5 border-b border-slate-100 bg-white px-4 py-1.5 dark:border-slate-800 dark:bg-slate-900",
58
59
  "data-queue-quick-filters": !0,
59
60
  children: [
60
- t.map((e) => {
61
- const r = c[e.key] ?? [], o = e.restricted ? {
61
+ r.map((e) => {
62
+ const a = o[e.key] ?? [], l = e.restricted ? {
62
63
  label: "restricted",
63
64
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
64
65
  title: `Options limited to your restricted ${e.placeholder} scope`
65
- } : k.has(e.key) && r.length > 0 ? {
66
+ } : h.has(e.key) && a.length > 0 ? {
66
67
  label: "your default",
67
68
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
68
69
  title: `Pre-selected from your default ${e.placeholder} scope — adjust freely`
69
- } : null, n = (m) => {
70
- l((q) => ({ ...q, [e.key]: m })), m.length === 0 && b(a[e.key]).length > 0 && p({ [e.key]: e.multi || e.type === "combobox" ? [] : "" });
71
- };
72
- return e.loadOptions ? /* @__PURE__ */ s(O, { def: e, selected: r, onChange: n, badge: o }, e.key) : /* @__PURE__ */ s(
73
- x,
70
+ } : null, k = (t) => {
71
+ m((b) => ({ ...b, [e.key]: t })), t.length === 0 && d(n[e.key]).length > 0 && y({ [e.key]: e.multi || e.type === "combobox" ? [] : "" });
72
+ }, s = r.filter((t) => {
73
+ var b;
74
+ return t.key !== e.key && t.cascade && (((b = o[t.key]) == null ? void 0 : b.length) ?? 0) > 0;
75
+ }).map((t) => ({
76
+ collection: t.cascade.collection,
77
+ field: t.cascade.field,
78
+ values: o[t.key] ?? []
79
+ }));
80
+ return e.loadOptions ? /* @__PURE__ */ i(
81
+ v,
82
+ {
83
+ def: e,
84
+ selected: a,
85
+ onChange: k,
86
+ badge: l,
87
+ narrowBy: s
88
+ },
89
+ e.key
90
+ ) : /* @__PURE__ */ i(
91
+ q,
74
92
  {
75
93
  label: e.placeholder,
76
94
  options: e.options ?? [],
77
- selected: r,
78
- onChange: (m) => n(m.map(String)),
79
- badge: o
95
+ selected: a,
96
+ onChange: (t) => k(t.map(String)),
97
+ badge: l
80
98
  },
81
99
  e.key
82
100
  );
83
101
  }),
84
- t.length > 0 && /* @__PURE__ */ g(f, { children: [
85
- /* @__PURE__ */ s(
102
+ r.length > 0 && /* @__PURE__ */ f(S, { children: [
103
+ /* @__PURE__ */ i(
86
104
  "button",
87
105
  {
88
106
  type: "button",
89
107
  onClick: () => {
90
108
  const e = {};
91
- for (const r of t) {
92
- const o = c[r.key] ?? [];
93
- e[r.key] = r.multi || r.type === "combobox" ? o : o[0] ?? "";
109
+ for (const a of r) {
110
+ const l = o[a.key] ?? [];
111
+ e[a.key] = a.multi || a.type === "combobox" ? l : l[0] ?? "";
94
112
  }
95
- p(e);
113
+ y(e);
96
114
  },
97
115
  className: `h-6 rounded px-2.5 text-[11px] font-semibold text-white transition-[filter] hover:brightness-110 ${u ? "bg-nvr-cyan" : "bg-nvr-cyan opacity-60"}`,
98
116
  "data-queue-quick-apply": !0,
99
117
  children: "Apply"
100
118
  }
101
119
  ),
102
- /* @__PURE__ */ s(
120
+ /* @__PURE__ */ i(
103
121
  "button",
104
122
  {
105
123
  type: "button",
106
- onClick: h,
124
+ onClick: p,
107
125
  className: "h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
108
126
  "data-queue-quick-clear": !0,
109
127
  children: "Clear"
110
128
  }
111
129
  )
112
130
  ] }),
113
- i && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", children: i })
131
+ c && /* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-2", children: c })
114
132
  ]
115
133
  }
116
134
  );