impact-nova 1.6.3 → 1.6.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,108 +1,108 @@
1
1
  import { jsxs as h, jsx as r } from "react/jsx-runtime";
2
2
  import * as n from "react";
3
- import { cn as d } from "../../lib/utils.js";
3
+ import { cn as c } from "../../lib/utils.js";
4
4
  import { Checkbox as T } from "./checkbox.js";
5
5
  import { Tooltip as R, TooltipTrigger as I, TooltipContent as D } from "./tooltip.js";
6
- import { Info as B } from "../../icons/index.js";
7
- import * as P from "highcharts";
8
- import j from "highcharts-react-official";
9
- import { useStatisticsChartData as L, useStatisticsChartLabel as G, useStatisticsChartSeries as O, useStatisticsChartOptions as W } from "./statistics-card.hooks.js";
6
+ import { Info as j } from "../../icons/index.js";
7
+ import { Chart as B } from "./chart/chart.js";
8
+ import { useStatisticsChartData as L, useStatisticsChartLabel as P, useStatisticsChartSeries as W, useStatisticsChartOptions as G } from "./statistics-card.hooks.js";
10
9
  const N = n.createContext(null), y = () => {
11
- const e = n.useContext(N);
12
- if (!e)
10
+ const a = n.useContext(N);
11
+ if (!a)
13
12
  throw new Error("StatisticsCard.* components must be used within a StatisticsCardRoot");
14
- return e;
13
+ return a;
15
14
  }, $ = n.forwardRef(
16
- ({ className: e, items: t, onItemToggle: s, chartSize: a = 110, config: o, mapItem: l, children: m, ...c }, i) => {
15
+ ({ className: a, items: e, onItemToggle: s, chartSize: t = 110, config: o, mapItem: l, children: m, ...d }, i) => {
17
16
  const p = n.useMemo(
18
- () => l ? t.map((v, k) => l(v, k)) : t,
19
- [t, l]
20
- ), f = "#f8f9fb", x = "px-5 py-4", u = "gap-4 md:gap-6 lg:gap-8", w = "w-full min-w-0 max-w-[439px]", g = o?.colors?.background || f, b = o?.spacing?.rootPadding || x, S = o?.spacing?.rootGap || u, C = o?.spacing?.rootWidth || w;
21
- return /* @__PURE__ */ r(N.Provider, { value: { items: p, onItemToggle: s, chartSize: a, config: o }, children: /* @__PURE__ */ r(
17
+ () => l ? e.map((v, k) => l(v, k)) : e,
18
+ [e, l]
19
+ ), f = "#f8f9fb", x = "px-5 py-4", g = "gap-4 md:gap-6 lg:gap-8", u = "w-full min-w-0 max-w-[439px]", C = o?.colors?.background || f, b = o?.spacing?.rootPadding || x, S = o?.spacing?.rootGap || g, w = o?.spacing?.rootWidth || u;
20
+ return /* @__PURE__ */ r(N.Provider, { value: { items: p, onItemToggle: s, chartSize: t, config: o }, children: /* @__PURE__ */ r(
22
21
  "div",
23
22
  {
24
23
  ref: i,
25
24
  role: "region",
26
25
  "aria-roledescription": "statistics card",
27
26
  "data-component": "statistics-card",
28
- className: d(
27
+ className: c(
29
28
  "flex flex-row flex-wrap md:flex-nowrap items-center justify-between rounded-lg box-border min-w-0 overflow-hidden",
30
- C,
29
+ w,
31
30
  b,
32
31
  S,
33
- e
32
+ a
34
33
  ),
35
34
  style: {
36
- backgroundColor: g
35
+ backgroundColor: C
37
36
  },
38
- ...c,
37
+ ...d,
39
38
  children: m
40
39
  }
41
40
  ) });
42
41
  }
43
42
  );
44
43
  $.displayName = "StatisticsCardRoot";
45
- const E = n.forwardRef(({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
44
+ const E = n.forwardRef(({ className: a, children: e, ...s }, t) => /* @__PURE__ */ r(
46
45
  "div",
47
46
  {
48
- ref: a,
49
- className: d("flex flex-col items-start gap-4 flex-shrink-0 min-w-0", e),
47
+ ref: t,
48
+ className: c("flex flex-col items-start gap-4 flex-shrink-0 min-w-0", a),
50
49
  ...s,
51
- children: t
50
+ children: e
52
51
  }
53
52
  ));
54
53
  E.displayName = "StatisticsCardHeader";
55
- const F = n.forwardRef(
56
- ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
54
+ const O = n.forwardRef(
55
+ ({ className: a, children: e, ...s }, t) => /* @__PURE__ */ r(
57
56
  "div",
58
57
  {
59
- ref: a,
60
- className: d("flex flex-row items-center gap-1.5 min-w-0 max-w-[150px]", e),
58
+ ref: t,
59
+ className: c("flex flex-row items-center gap-1.5 min-w-0 max-w-[150px]", a),
61
60
  ...s,
62
- children: t
61
+ children: e
63
62
  }
64
63
  )
65
64
  );
66
- F.displayName = "StatisticsCardTitle";
67
- const H = n.forwardRef(
68
- ({ icon: e, className: t, ...s }, a) => /* @__PURE__ */ r(
65
+ O.displayName = "StatisticsCardTitle";
66
+ const F = n.forwardRef(
67
+ ({ icon: a, className: e, ...s }, t) => /* @__PURE__ */ r(
69
68
  "div",
70
69
  {
71
- ref: a,
72
- className: d("flex items-center justify-center w-6 h-6 p-1.5 bg-[#ECEEFD] rounded-full shrink-0", t),
70
+ ref: t,
71
+ className: c("flex items-center justify-center w-6 h-6 p-1.5 bg-[#ECEEFD] rounded-full shrink-0", e),
73
72
  ...s,
74
- children: e
73
+ children: a
75
74
  }
76
75
  )
77
76
  );
78
- H.displayName = "StatisticsCardTitleIcon";
79
- const M = n.forwardRef(
80
- ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
77
+ F.displayName = "StatisticsCardTitleIcon";
78
+ const H = n.forwardRef(
79
+ ({ className: a, children: e, ...s }, t) => /* @__PURE__ */ r(
81
80
  "span",
82
81
  {
83
- ref: a,
84
- className: d("font-semibold text-base leading-[1.5em] text-[#777980] truncate line-clamp-1", e),
82
+ ref: t,
83
+ className: c("font-semibold text-base leading-[1.5em] text-[#777980] truncate line-clamp-1", a),
85
84
  ...s,
86
- children: t
85
+ children: e
87
86
  }
88
87
  )
89
88
  );
90
- M.displayName = "StatisticsCardTitleText";
91
- const q = n.forwardRef(
92
- ({ content: e, icon: t, ...s }, a) => /* @__PURE__ */ r("div", { ref: a, ...s, children: /* @__PURE__ */ h(R, { children: [
93
- /* @__PURE__ */ r(I, { asChild: !0, children: t || /* @__PURE__ */ r(B, { size: "sm", className: "text-[#60697D] cursor-pointer shrink-0" }) }),
94
- /* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: e })
89
+ H.displayName = "StatisticsCardTitleText";
90
+ const M = n.forwardRef(
91
+ ({ content: a, icon: e, ...s }, t) => /* @__PURE__ */ r("div", { ref: t, ...s, children: /* @__PURE__ */ h(R, { children: [
92
+ /* @__PURE__ */ r(I, { asChild: !0, children: e || /* @__PURE__ */ r(j, { size: "sm", className: "text-[#60697D] cursor-pointer shrink-0" }) }),
93
+ /* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a })
95
94
  ] }) })
96
95
  );
97
- q.displayName = "StatisticsCardTitleTooltip";
98
- const A = n.forwardRef(
99
- ({ className: e, centerLabel: t, chartConfig: s, chartSize: a = 104, ...o }, l) => {
100
- const { items: m, onItemToggle: c } = y(), { total: i, checkedTotal: p, hasChecked: f } = L(m), x = G(t, f, p, i), u = O(m, f), g = {
101
- ...W(m, c, s),
96
+ M.displayName = "StatisticsCardTitleTooltip";
97
+ const q = n.forwardRef(
98
+ ({ className: a, centerLabel: e, chartConfig: s, chartSize: t = 104, ...o }, l) => {
99
+ const { items: m, onItemToggle: d } = y(), { total: i, checkedTotal: p, hasChecked: f } = L(m), x = P(e, f, p, i), g = W(m, f), u = G(m, d, s), C = {
100
+ ...u,
102
101
  chart: {
102
+ ...u.chart,
103
103
  type: "pie",
104
- height: a,
105
- width: a,
104
+ height: t,
105
+ width: t,
106
106
  margin: [0, 0, 0, 0],
107
107
  spacing: [0, 0, 0, 0],
108
108
  backgroundColor: "transparent"
@@ -111,22 +111,23 @@ const A = n.forwardRef(
111
111
  credits: { enabled: !1 },
112
112
  exporting: { enabled: !1 },
113
113
  navigation: { buttonOptions: { enabled: !1 } },
114
- series: u
114
+ series: g
115
115
  };
116
116
  return /* @__PURE__ */ h(
117
117
  "div",
118
118
  {
119
119
  ref: l,
120
- className: d("relative flex items-center justify-center flex-shrink-0", e),
121
- style: { width: `${a}px`, height: `${a}px` },
120
+ className: c("relative flex items-center justify-center flex-shrink-0", a),
121
+ style: { width: `${t}px`, height: `${t}px` },
122
122
  ...o,
123
123
  children: [
124
124
  /* @__PURE__ */ r(
125
- j,
125
+ B,
126
126
  {
127
- highcharts: P,
128
- options: g,
129
- containerProps: { style: { width: "100%", height: "100%" } }
127
+ options: C,
128
+ height: t,
129
+ width: t,
130
+ noWrapper: !0
130
131
  }
131
132
  ),
132
133
  x && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ r("span", { className: "font-black text-[12px] leading-[9.536px] text-[#1F2B4D]", children: x }) })
@@ -135,59 +136,59 @@ const A = n.forwardRef(
135
136
  );
136
137
  }
137
138
  );
138
- A.displayName = "StatisticsCardChart";
139
- const J = n.forwardRef(({ className: e, children: t, ...s }, a) => {
140
- const { config: o } = y(), l = "w-full md:w-auto md:min-w-[190px] md:max-w-[208px]", m = "gap-2", c = o?.spacing?.legendWidth || l, i = o?.spacing?.itemGap || m;
139
+ q.displayName = "StatisticsCardChart";
140
+ const A = n.forwardRef(({ className: a, children: e, ...s }, t) => {
141
+ const { config: o } = y(), l = "w-full md:w-auto md:min-w-[190px] md:max-w-[208px]", m = "gap-2", d = o?.spacing?.legendWidth || l, i = o?.spacing?.itemGap || m;
141
142
  return /* @__PURE__ */ r(
142
143
  "div",
143
144
  {
144
- ref: a,
145
+ ref: t,
145
146
  role: "list",
146
- className: d(
147
+ className: c(
147
148
  "flex flex-col justify-center min-w-0 flex-1 md:flex-none",
148
- c,
149
+ d,
149
150
  i,
150
- e
151
+ a
151
152
  ),
152
153
  ...s,
153
- children: t
154
+ children: e
154
155
  }
155
156
  );
156
157
  });
157
- J.displayName = "StatisticsCardLegend";
158
- const K = n.forwardRef(
159
- ({ className: e, index: t, item: s, ...a }, o) => {
160
- const { items: l, onItemToggle: m, config: c } = y();
158
+ A.displayName = "StatisticsCardLegend";
159
+ const J = n.forwardRef(
160
+ ({ className: a, index: e, item: s, ...t }, o) => {
161
+ const { items: l, onItemToggle: m, config: d } = y();
161
162
  let i = s, p = -1;
162
- if (!i && t !== void 0 ? (i = l[t], p = t) : i && (p = l.findIndex((C) => C === i)), !i || p === -1) return null;
163
- const f = "bg-white", x = "px-3 py-1.5", u = "#E7CDF9", w = "#0D152C", g = c?.colors?.background || f, b = c?.spacing?.itemPadding || x;
164
- c?.colors?.outlineChecked;
165
- const S = c?.colors?.text || w;
163
+ if (!i && e !== void 0 ? (i = l[e], p = e) : i && (p = l.findIndex((w) => w === i)), !i || p === -1) return null;
164
+ const f = "bg-white", x = "px-3 py-1.5", g = "#E7CDF9", u = "#0D152C", C = d?.colors?.background || f, b = d?.spacing?.itemPadding || x;
165
+ d?.colors?.outlineChecked;
166
+ const S = d?.colors?.text || u;
166
167
  return /* @__PURE__ */ h(
167
168
  "div",
168
169
  {
169
170
  ref: o,
170
171
  role: "listitem",
171
172
  "aria-label": `${i.label}: ${i.value}`,
172
- className: d(
173
+ className: c(
173
174
  "flex flex-row items-center gap-2 rounded-md border-l-2 transition-all",
174
- g,
175
+ C,
175
176
  b,
176
- e
177
+ a
177
178
  ),
178
179
  style: {
179
180
  borderLeftColor: i.borderColor,
180
- boxShadow: i.checked ? `0 0 0 2px ${i.borderColor}` : "0px 0px 4px 0px rgba(0,0,0,0.12)",
181
+ boxShadow: i.checked ? `0 0 0 3px ${i.borderColor}` : "0px 0px 4px 0px rgba(0,0,0,0.12)",
181
182
  "--item-color": i.borderColor
182
183
  },
183
- ...a,
184
+ ...t,
184
185
  children: [
185
186
  /* @__PURE__ */ h("div", { className: "flex flex-row items-center gap-2 flex-1 min-w-0", children: [
186
187
  /* @__PURE__ */ r(
187
188
  T,
188
189
  {
189
190
  checked: i.checked ?? !1,
190
- onCheckedChange: (C) => m?.(p, C === !0),
191
+ onCheckedChange: (w) => m?.(p, w === !0),
191
192
  "aria-label": `Select ${i.label}`,
192
193
  className: "shrink-0"
193
194
  }
@@ -206,26 +207,26 @@ const K = n.forwardRef(
206
207
  );
207
208
  }
208
209
  );
209
- K.displayName = "StatisticsCardLegendItem";
210
- const Q = n.forwardRef(
211
- ({ className: e, children: t, ...s }, a) => /* @__PURE__ */ r(
210
+ J.displayName = "StatisticsCardLegendItem";
211
+ const K = n.forwardRef(
212
+ ({ className: a, children: e, ...s }, t) => /* @__PURE__ */ r(
212
213
  "div",
213
214
  {
214
- ref: a,
215
- className: d("flex flex-wrap items-center gap-3 self-center text-[11px] font-medium text-[#60697D]", e),
215
+ ref: t,
216
+ className: c("flex flex-wrap items-center gap-3 self-center text-[11px] font-medium text-[#60697D]", a),
216
217
  ...s,
217
- children: t
218
+ children: e
218
219
  }
219
220
  )
220
221
  );
221
- Q.displayName = "StatisticsCardSummary";
222
- const U = n.forwardRef(
223
- ({ className: e, label: t, count: s, color: a = "#60697D", ...o }, l) => /* @__PURE__ */ h(
222
+ K.displayName = "StatisticsCardSummary";
223
+ const Q = n.forwardRef(
224
+ ({ className: a, label: e, count: s, color: t = "#60697D", ...o }, l) => /* @__PURE__ */ h(
224
225
  "div",
225
226
  {
226
227
  ref: l,
227
- className: d("flex items-center gap-1", e),
228
- style: { "--summary-color": a },
228
+ className: c("flex items-center gap-1", a),
229
+ style: { "--summary-color": t },
229
230
  ...o,
230
231
  children: [
231
232
  /* @__PURE__ */ r(
@@ -235,7 +236,7 @@ const U = n.forwardRef(
235
236
  }
236
237
  ),
237
238
  /* @__PURE__ */ h("span", { children: [
238
- t,
239
+ e,
239
240
  ": ",
240
241
  s
241
242
  ] })
@@ -243,17 +244,17 @@ const U = n.forwardRef(
243
244
  }
244
245
  )
245
246
  );
246
- U.displayName = "StatisticsCardSummaryItem";
247
+ Q.displayName = "StatisticsCardSummaryItem";
247
248
  export {
248
- A as StatisticsCardChart,
249
+ q as StatisticsCardChart,
249
250
  E as StatisticsCardHeader,
250
- J as StatisticsCardLegend,
251
- K as StatisticsCardLegendItem,
251
+ A as StatisticsCardLegend,
252
+ J as StatisticsCardLegendItem,
252
253
  $ as StatisticsCardRoot,
253
- Q as StatisticsCardSummary,
254
- U as StatisticsCardSummaryItem,
255
- F as StatisticsCardTitle,
256
- H as StatisticsCardTitleIcon,
257
- M as StatisticsCardTitleText,
258
- q as StatisticsCardTitleTooltip
254
+ K as StatisticsCardSummary,
255
+ Q as StatisticsCardSummaryItem,
256
+ O as StatisticsCardTitle,
257
+ F as StatisticsCardTitleIcon,
258
+ H as StatisticsCardTitleText,
259
+ M as StatisticsCardTitleTooltip
259
260
  };
@@ -20,4 +20,5 @@ export interface ChartProps {
20
20
  isLoading?: boolean;
21
21
  loader?: React.ReactNode;
22
22
  children?: React.ReactNode;
23
+ noWrapper?: boolean;
23
24
  }
@@ -1 +1 @@
1
- export type { StatisticsCardItem, StatisticsCardConfig, StatisticsCardChartConfig, StatisticsCardRootProps, StatisticsCardTitleProps, StatisticsCardChartProps, StatisticsCardLegendItemProps, StatisticsCardSummaryProps, } from '../statistics-card';
1
+ export type { StatisticsCardItem, StatisticsCardConfig, StatisticsCardChartConfig, StatisticsCardRootProps, StatisticsCardChartProps, StatisticsCardLegendItemProps, } from '../statistics-card';