impact-nova 1.6.2 → 1.6.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,85 +1,86 @@
1
- import { jsxs as a, jsx as e, Fragment as U } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { ChevronDown as W, Search as X, Trash2 as Z, Pencil as _, Star as ee } from "lucide-react";
4
- import { cn as c } from "../../../lib/utils.js";
5
- import { Popover as te, PopoverTrigger as le, PopoverContent as ae } from "../popover.js";
6
- import { Tooltip as d, TooltipTrigger as p, TooltipContent as h } from "../tooltip.js";
7
- import { Button as M } from "../button.js";
8
- import { Separator as I } from "../separator.js";
9
- import { Tabs as re, TabsList as ie, TabsTrigger as j } from "../tabs.js";
10
- import { Input as ne } from "../input.js";
11
- import { Badge as se } from "../badge.js";
12
- import { Skeleton as oe } from "../skeleton.js";
13
- import { useImpactNovaI18n as ce } from "../../../i18n/ImpactNovaI18nContext.js";
14
- const Ce = ({
15
- selectedFilter: m,
16
- onSelectedFilterChange: O,
17
- savedFilters: $,
18
- recentFilters: C,
19
- onApplySavedFilter: B,
20
- onSavedFilterSearch: v,
21
- onSavedFiltersScroll: D,
22
- onDropdownOpenChange: G,
23
- isLoadingFilterPreferencesList: L = !1,
24
- onEditSavedFilter: S,
25
- onDeleteSavedFilter: w,
26
- onSetDefaultSavedFilter: k
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { ChevronDown as F, Search as V } from "lucide-react";
4
+ import { cn as b } from "../../../lib/utils.js";
5
+ import { Popover as Y, PopoverTrigger as q, PopoverContent as H } from "../popover.js";
6
+ import { Tooltip as v, TooltipTrigger as g, TooltipContent as y } from "../tooltip.js";
7
+ import { Button as S } from "../button.js";
8
+ import { Separator as w } from "../separator.js";
9
+ import { Tabs as J, TabsList as K, TabsTrigger as N } from "../tabs.js";
10
+ import { Input as U } from "../input.js";
11
+ import { Badge as W } from "../badge.js";
12
+ import { Skeleton as X } from "../skeleton.js";
13
+ import { useImpactNovaI18n as Z } from "../../../i18n/ImpactNovaI18nContext.js";
14
+ const he = ({
15
+ selectedFilter: c,
16
+ onSelectedFilterChange: C,
17
+ savedFilters: T,
18
+ recentFilters: m,
19
+ onApplySavedFilter: k,
20
+ onSavedFilterSearch: p,
21
+ onSavedFiltersScroll: P,
22
+ onDropdownOpenChange: A,
23
+ isLoadingFilterPreferencesList: j = !1,
24
+ onEditSavedFilter: $,
25
+ onDeleteSavedFilter: ee,
26
+ onSetDefaultSavedFilter: te
27
27
  }) => {
28
- const { t: r } = ce(), [g, T] = n.useState(!1), Q = (l) => {
29
- T(l), G?.(l);
30
- }, [P, E] = n.useState(""), [u, F] = n.useState(""), [i, R] = n.useState("All"), [s, A] = n.useState(null);
31
- n.useEffect(() => {
32
- const l = setTimeout(() => {
33
- F(P);
28
+ const { t: r } = Z(), [d, h] = s.useState(!1), I = (a) => {
29
+ h(a), A?.(a);
30
+ }, [u, M] = s.useState(""), [f, O] = s.useState(""), [n, D] = s.useState("All"), [i, x] = s.useState(null);
31
+ s.useEffect(() => {
32
+ const a = setTimeout(() => {
33
+ O(u);
34
34
  }, 300);
35
- return () => clearTimeout(l);
36
- }, [P]), n.useEffect(() => {
37
- v && v(
38
- u,
39
- i === "All" ? void 0 : i
35
+ return () => clearTimeout(a);
36
+ }, [u]), s.useEffect(() => {
37
+ p && p(
38
+ f,
39
+ n === "All" ? void 0 : n
40
40
  );
41
- }, [u, i, v]), n.useEffect(() => {
42
- g && A({ label: m });
43
- }, [g, m]);
44
- const z = (l) => {
45
- E(l.target.value);
46
- }, V = () => {
47
- s && (O?.(s.label), s.savedItem && B?.(s.savedItem), T(!1));
48
- }, Y = () => {
49
- T(!1);
50
- }, q = () => !C || C.length === 0 ? null : /* @__PURE__ */ a("div", { className: "flex flex-col", children: [
51
- /* @__PURE__ */ e("div", { className: "px-1 py-[6px] text-xs font-medium text-content-tertiary font-['Manrope']", children: "Recent" }),
52
- /* @__PURE__ */ e("div", { className: "mb-[6px] flex flex-col", children: C.map((l, f) => {
53
- const o = l.map((y) => y.label).join(", "), x = s?.label === o;
41
+ }, [f, n, p]), s.useEffect(() => {
42
+ d && x({ label: c });
43
+ }, [d, c]);
44
+ const E = (a) => {
45
+ M(a.target.value);
46
+ }, G = () => {
47
+ i && (C?.(i.label), i.savedItem && k?.(i.savedItem), h(!1));
48
+ }, L = () => {
49
+ h(!1);
50
+ }, Q = () => !m || m.length === 0 ? null : /* @__PURE__ */ l("div", { className: "flex flex-col", children: [
51
+ /* @__PURE__ */ e("div", { className: "px-1 py-[6px] text-xs font-medium text-[#60697d] font-['Manrope']", children: "Recent" }),
52
+ /* @__PURE__ */ e("div", { className: "mb-[6px] flex flex-col", children: m.map((a, t) => {
53
+ const o = a.map((z) => z.label).join(", "), B = i?.label === o;
54
54
  return /* @__PURE__ */ e(
55
- "div",
55
+ "button",
56
56
  {
57
- className: c(
58
- "flex cursor-pointer flex-row px-3 py-2 rounded-lg hover:bg-canvas-muted",
59
- x && "bg-brand-highlight"
57
+ type: "button",
58
+ className: b(
59
+ "flex cursor-pointer flex-row px-3 py-2 rounded-lg hover:bg-[#f5f6fa] w-full text-left bg-transparent border-none",
60
+ B && "bg-[#edf0ff]"
60
61
  ),
61
- onClick: () => A({ label: o }),
62
- children: /* @__PURE__ */ a(d, { children: [
63
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "text-sm font-['Manrope'] truncate text-content", children: o }) }),
64
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "right", children: o })
62
+ onClick: () => x({ label: o }),
63
+ children: /* @__PURE__ */ l(v, { children: [
64
+ /* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "text-sm font-['Manrope'] truncate text-[#1f2b4d]", children: o }) }),
65
+ /* @__PURE__ */ e(y, { variant: "tertiary", side: "right", children: o })
65
66
  ] })
66
67
  },
67
- f
68
+ t
68
69
  );
69
70
  }) }),
70
- /* @__PURE__ */ e(I, { className: "mb-2" })
71
- ] }), H = () => {
72
- if (L)
73
- return /* @__PURE__ */ e("div", { className: "flex max-h-[160px] flex-col overflow-y-auto px-3 py-2 space-y-2", children: [1, 2, 3, 4, 5].map((t) => /* @__PURE__ */ e(oe, { className: "h-9 w-full rounded-lg" }, t)) });
74
- let l = $?.filter(
75
- (t) => i === "All" || t.type === i
71
+ /* @__PURE__ */ e(w, { className: "mb-2" })
72
+ ] }), _ = () => {
73
+ if (j)
74
+ return /* @__PURE__ */ e("div", { className: "flex max-h-[160px] flex-col overflow-y-auto px-3 py-2 space-y-2", children: [1, 2, 3, 4, 5].map((t) => /* @__PURE__ */ e(X, { className: "h-9 w-full rounded-lg" }, t)) });
75
+ let a = T?.filter(
76
+ (t) => n === "All" || t.type === n
76
77
  );
77
- if (!v && u && (l = l?.filter(
78
- (t) => t.label.toLowerCase().includes(u.toLowerCase())
79
- )), !l || l.length === 0) {
78
+ if (!p && f && (a = a?.filter(
79
+ (t) => t.label.toLowerCase().includes(f.toLowerCase())
80
+ )), !a || a.length === 0) {
80
81
  let t = "No saved filters found";
81
- if (!!u)
82
- switch (i) {
82
+ if (!!f)
83
+ switch (n) {
83
84
  case "Personal":
84
85
  t = "No personal filters match your search";
85
86
  break;
@@ -90,7 +91,7 @@ const Ce = ({
90
91
  t = "No saved filters match your search";
91
92
  }
92
93
  else
93
- switch (i) {
94
+ switch (n) {
94
95
  case "Personal":
95
96
  t = "You haven't created any personal filters yet.";
96
97
  break;
@@ -100,194 +101,120 @@ const Ce = ({
100
101
  default:
101
102
  t = "No filters have been saved yet.";
102
103
  }
103
- return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center py-8 text-center min-h-[100px] px-6", children: /* @__PURE__ */ e("span", { className: "text-sm text-content-tertiary font-['Manrope'] leading-relaxed", children: t }) });
104
+ return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center py-8 text-center min-h-[100px] px-6", children: /* @__PURE__ */ e("span", { className: "text-sm text-[#60697d] font-['Manrope'] leading-relaxed", children: t }) });
104
105
  }
105
- const f = S || w || k, o = l.find((t) => t.isDefault), x = l.filter((t) => !t.isDefault), y = (t, N = !1) => {
106
- const K = s?.label === t.label;
107
- return /* @__PURE__ */ a(
108
- "div",
109
- {
110
- className: c(
111
- "group mb-1 flex items-center justify-between cursor-pointer rounded-lg px-3 py-2 text-sm font-medium font-['Manrope'] hover:bg-[#f5f6fa]",
112
- K ? "bg-[#edf0ff]" : "text-[#1f2b4d]"
113
- ),
114
- onClick: () => A({ label: t.label, savedItem: t }),
115
- children: [
116
- /* @__PURE__ */ a(d, { children: [
117
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "truncate flex-1 min-w-0", children: t.label }) }),
118
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "right", children: t.label })
119
- ] }),
120
- f && /* @__PURE__ */ a(
121
- "div",
106
+ return /* @__PURE__ */ e(
107
+ "div",
108
+ {
109
+ className: "flex max-h-[160px] flex-col overflow-y-auto",
110
+ onScroll: P,
111
+ children: a.map((t) => {
112
+ const o = i?.label === t.label;
113
+ return /* @__PURE__ */ e(
114
+ "button",
115
+ {
116
+ type: "button",
117
+ className: b(
118
+ "mb-1 flex justify-between cursor-pointer rounded-lg px-3 py-2 text-sm font-medium font-['Manrope'] hover:bg-[#f5f6fa] w-full text-left bg-transparent border-none",
119
+ o ? "bg-[#edf0ff]" : "text-[#1f2b4d]"
120
+ ),
121
+ onClick: () => x({ label: t.label, savedItem: t }),
122
+ children: /* @__PURE__ */ l(v, { children: [
123
+ /* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "truncate", children: t.label }) }),
124
+ /* @__PURE__ */ e(y, { variant: "tertiary", side: "right", children: t.label })
125
+ ] })
126
+ },
127
+ t.id
128
+ );
129
+ })
130
+ }
131
+ );
132
+ }, R = i?.label !== c;
133
+ return /* @__PURE__ */ l(Y, { open: d, onOpenChange: I, children: [
134
+ /* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ l(
135
+ "button",
136
+ {
137
+ type: "button",
138
+ className: "flex cursor-pointer items-center gap-2 bg-transparent border-none p-0",
139
+ "aria-label": r("filterStrip.selectFilter"),
140
+ "aria-expanded": d,
141
+ "aria-haspopup": "dialog",
142
+ children: [
143
+ /* @__PURE__ */ e("span", { className: "text-sm font-medium text-[#60697d] font-['Manrope']", children: r("filterStrip.filtersApplied") }),
144
+ /* @__PURE__ */ l(v, { children: [
145
+ /* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e(
146
+ W,
122
147
  {
123
- className: c(
124
- "flex items-center gap-1 ml-2 transition-opacity shrink-0",
125
- N ? "opacity-100" : "opacity-0 group-hover:opacity-100"
126
- ),
127
- children: [
128
- w && /* @__PURE__ */ a(d, { children: [
129
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e(
130
- "button",
131
- {
132
- type: "button",
133
- "aria-label": `${r("filterStrip.deleteFilter")} ${t.label}`,
134
- className: c(
135
- "p-1 rounded transition-colors",
136
- N ? "opacity-0 group-hover:opacity-100" : "hover:bg-[#e6e8f0]"
137
- ),
138
- onClick: (b) => {
139
- b.stopPropagation(), w(t);
140
- },
141
- children: /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5 text-[#60697d]" })
142
- }
143
- ) }),
144
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "top", children: r("filterStrip.deleteFilter") })
145
- ] }),
146
- S && /* @__PURE__ */ a(d, { children: [
147
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e(
148
- "button",
149
- {
150
- type: "button",
151
- "aria-label": `${r("filterStrip.editFilter")} ${t.label}`,
152
- className: c(
153
- "p-1 rounded transition-colors",
154
- N ? "opacity-0 group-hover:opacity-100" : "hover:bg-[#e6e8f0]"
155
- ),
156
- onClick: (b) => {
157
- b.stopPropagation(), S(t);
158
- },
159
- children: /* @__PURE__ */ e(_, { className: "h-3.5 w-3.5 text-[#60697d]" })
160
- }
161
- ) }),
162
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "top", children: r("filterStrip.editFilter") })
163
- ] }),
164
- k && /* @__PURE__ */ a(d, { children: [
165
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e(
166
- "button",
167
- {
168
- type: "button",
169
- "aria-label": `${t.isDefault ? r("filterStrip.defaultFilter") : r("filterStrip.setAsDefault")} ${t.label}`,
170
- className: "p-1 rounded hover:bg-[#e6e8f0] transition-colors",
171
- onClick: (b) => {
172
- b.stopPropagation(), k(t);
173
- },
174
- children: /* @__PURE__ */ e(
175
- ee,
176
- {
177
- className: c(
178
- "h-3.5 w-3.5",
179
- t.isDefault ? "text-[#E1BC29] fill-[#E1BC29]" : "text-[#60697d]"
180
- )
181
- }
182
- )
183
- }
184
- ) }),
185
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "top", children: t.isDefault ? r("filterStrip.defaultFilter") : r("filterStrip.setAsDefault") })
186
- ] })
187
- ]
148
+ color: "primary",
149
+ variant: "outline",
150
+ className: "font-['Manrope'] max-w-[140px]",
151
+ children: c || r("filterStrip.notSelected")
188
152
  }
189
- )
190
- ]
191
- },
192
- t.id
193
- );
194
- };
195
- return /* @__PURE__ */ a("div", { className: "flex flex-col", children: [
196
- o && /* @__PURE__ */ a(U, { children: [
197
- y(o, !0),
198
- x.length > 0 && /* @__PURE__ */ e(I, { className: "my-1" })
199
- ] }),
200
- x.length > 0 && /* @__PURE__ */ e(
201
- "div",
202
- {
203
- className: "flex max-h-[160px] flex-col overflow-y-auto",
204
- onScroll: D,
205
- children: x.map((t) => y(t, !1))
206
- }
207
- )
208
- ] });
209
- }, J = s?.label !== m;
210
- return /* @__PURE__ */ a(te, { open: g, onOpenChange: Q, children: [
211
- /* @__PURE__ */ e(le, { asChild: !0, children: /* @__PURE__ */ a("div", { className: "flex cursor-pointer items-center gap-2", children: [
212
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-content-tertiary font-['Manrope']", children: r("filterStrip.filtersApplied") }),
213
- /* @__PURE__ */ a(d, { children: [
214
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e(
215
- se,
216
- {
217
- color: "primary",
218
- variant: "outline",
219
- className: "font-['Manrope'] max-w-[140px] inline-block",
220
- children: /* @__PURE__ */ e("span", { className: "block truncate", children: m || r("filterStrip.notSelected") })
221
- }
222
- ) }),
223
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "top", children: m || r("filterStrip.notSelected") })
224
- ] }),
225
- /* @__PURE__ */ a(d, { children: [
226
- /* @__PURE__ */ e(p, { asChild: !0, children: /* @__PURE__ */ e(
227
- "div",
228
- {
229
- className: c(
230
- "flex h-8 w-8 items-center justify-center rounded-lg bg-canvas-muted transition-transform duration-200",
231
- g && "rotate-180"
232
- ),
233
- children: /* @__PURE__ */ e(W, { className: "h-4 w-4 text-content" })
234
- }
235
- ) }),
236
- /* @__PURE__ */ e(h, { variant: "tertiary", side: "top", children: r("filterStrip.selectFilter") })
237
- ] })
238
- ] }) }),
153
+ ) }),
154
+ /* @__PURE__ */ e(y, { variant: "tertiary", side: "top", children: c || r("filterStrip.notSelected") })
155
+ ] }),
156
+ /* @__PURE__ */ e(
157
+ "div",
158
+ {
159
+ className: b(
160
+ "flex h-8 w-8 items-center justify-center rounded-lg bg-[#f5f6fa] transition-transform duration-200",
161
+ d && "rotate-180"
162
+ ),
163
+ "aria-hidden": "true",
164
+ children: /* @__PURE__ */ e(F, { className: "h-4 w-4 text-[#1f2b4d]" })
165
+ }
166
+ )
167
+ ]
168
+ }
169
+ ) }),
239
170
  /* @__PURE__ */ e(
240
- ae,
171
+ H,
241
172
  {
242
173
  align: "start",
243
- className: "w-[280px] p-0 shadow-elevation-floating",
174
+ className: "w-[280px] p-0 shadow-[0_0_4px_0_rgba(0,0,0,0.12)]",
244
175
  sideOffset: 8,
245
- onInteractOutside: (l) => {
246
- const f = l.target;
247
- (f.closest('[role="dialog"]') || f.closest("[data-radix-dialog-content]")) && l.preventDefault();
248
- },
249
- children: /* @__PURE__ */ a("div", { className: "flex w-full flex-col py-[8px] px-[6px]", children: [
250
- q(),
251
- /* @__PURE__ */ a("div", { className: "flex flex-col", children: [
252
- /* @__PURE__ */ e("div", { className: "px-1 py-[6px] text-xs font-medium text-content-tertiary font-['Manrope']", children: r("filterStrip.savedFilters") }),
253
- /* @__PURE__ */ a(
254
- re,
176
+ children: /* @__PURE__ */ l("div", { className: "flex w-full flex-col py-[8px] px-[6px]", children: [
177
+ Q(),
178
+ /* @__PURE__ */ l("div", { className: "flex flex-col", children: [
179
+ /* @__PURE__ */ e("div", { className: "px-1 py-[6px] text-xs font-medium text-[#60697d] font-['Manrope']", children: r("filterStrip.savedFilters") }),
180
+ /* @__PURE__ */ l(
181
+ J,
255
182
  {
256
- value: i,
257
- onValueChange: (l) => R(l),
183
+ value: n,
184
+ onValueChange: (a) => D(a),
258
185
  variant: "outline",
259
186
  size: "sm",
260
187
  className: "w-full px-1",
261
188
  children: [
262
- /* @__PURE__ */ e("div", { className: "py-[8px]", children: /* @__PURE__ */ a(ie, { children: [
263
- /* @__PURE__ */ e(j, { value: "All", children: "All" }),
264
- /* @__PURE__ */ e(j, { value: "Global", children: "Global" }),
265
- /* @__PURE__ */ e(j, { value: "Personal", children: "Personal" })
189
+ /* @__PURE__ */ e("div", { className: "py-[8px]", children: /* @__PURE__ */ l(K, { children: [
190
+ /* @__PURE__ */ e(N, { value: "All", children: "All" }),
191
+ /* @__PURE__ */ e(N, { value: "Global", children: "Global" }),
192
+ /* @__PURE__ */ e(N, { value: "Personal", children: "Personal" })
266
193
  ] }) }),
267
194
  /* @__PURE__ */ e("div", { className: "pb-[8px]", children: /* @__PURE__ */ e(
268
- ne,
195
+ U,
269
196
  {
270
- prefix: /* @__PURE__ */ e(X, { className: "h-4 w-4 text-content-muted" }),
197
+ prefix: /* @__PURE__ */ e(V, { className: "h-4 w-4 text-gray-500" }),
271
198
  placeholder: r("filterStrip.searchFiltersPlaceholder"),
272
- value: P,
273
- onChange: z,
199
+ value: u,
200
+ onChange: E,
274
201
  className: "h-9 px-1 border-none shadow-none focus-visible:ring-0"
275
202
  }
276
203
  ) }),
277
- /* @__PURE__ */ e("div", { className: "mt-0", children: H() })
204
+ /* @__PURE__ */ e("div", { className: "mt-0", children: _() })
278
205
  ]
279
206
  }
280
207
  )
281
208
  ] }),
282
- /* @__PURE__ */ e(I, { className: "my-2" }),
283
- /* @__PURE__ */ a("div", { className: "flex justify-end gap-2 px-3 pb-1", children: [
284
- /* @__PURE__ */ e(M, { variant: "secondary", onClick: Y, children: r("prompt.cancel") }),
209
+ /* @__PURE__ */ e(w, { className: "my-2" }),
210
+ /* @__PURE__ */ l("div", { className: "flex justify-end gap-2 px-3 pb-1", children: [
211
+ /* @__PURE__ */ e(S, { variant: "secondary", onClick: L, children: r("prompt.cancel") }),
285
212
  /* @__PURE__ */ e(
286
- M,
213
+ S,
287
214
  {
288
215
  variant: "default",
289
- onClick: V,
290
- disabled: !J,
216
+ onClick: G,
217
+ disabled: !R,
291
218
  children: r("filterStrip.applyFilter")
292
219
  }
293
220
  )
@@ -298,5 +225,5 @@ const Ce = ({
298
225
  ] });
299
226
  };
300
227
  export {
301
- Ce as FilterSummary
228
+ he as FilterSummary
302
229
  };