@pibit.ai/cure-design-system 0.6.43 → 0.6.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.
@@ -1,111 +1,121 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import { useMemo as p } from "react";
3
- import { ResponsiveContainer as v } from "../../node_modules/recharts/es6/component/ResponsiveContainer.js";
4
- import { PieChart as $ } from "../../node_modules/recharts/es6/chart/PieChart.js";
5
- import { Pie as b } from "../../node_modules/recharts/es6/polar/Pie.js";
6
- import { Cell as j } from "../../node_modules/recharts/es6/component/Cell.js";
7
- const C = (s, i) => {
8
- if (s <= i.length)
9
- return i.slice(0, s);
10
- const o = [...i], c = s - i.length;
11
- for (let r = 0; r < c; r++) {
12
- const u = r * 360 / c, d = 65 + r % 3 * 10, m = 50 + r % 2 * 10;
13
- o.push(`hsl(${u}, ${d}%, ${m}%)`);
3
+ import { ResponsiveContainer as $ } from "../../node_modules/recharts/es6/component/ResponsiveContainer.js";
4
+ import { PieChart as j } from "../../node_modules/recharts/es6/chart/PieChart.js";
5
+ import { Pie as C } from "../../node_modules/recharts/es6/polar/Pie.js";
6
+ import { Cell as k } from "../../node_modules/recharts/es6/component/Cell.js";
7
+ const A = (a, r) => {
8
+ if (a <= r.length)
9
+ return r.slice(0, a);
10
+ const o = [...r], m = a - r.length;
11
+ for (let i = 0; i < m; i++) {
12
+ const d = i * 360 / m, h = 65 + i % 3 * 10, c = 50 + i % 2 * 10;
13
+ o.push(`hsl(${d}, ${h}%, ${c}%)`);
14
14
  }
15
15
  return o;
16
16
  };
17
- function R({
18
- data: s,
19
- colors: i,
17
+ function B({
18
+ data: a,
19
+ colors: r,
20
20
  innerRadius: o = 72,
21
- outerRadius: c = 120,
22
- isPercentage: r = !0,
23
- showLegend: u = !1,
24
- showCenterLabel: d = !1,
25
- centerSubLabel: m,
21
+ outerRadius: m = 120,
22
+ isPercentage: i = !0,
23
+ showLegend: d = !1,
24
+ showCenterLabel: h = !1,
25
+ centerSubLabel: c,
26
26
  title: g,
27
- size: h = 240,
28
- compact: f = !1
27
+ size: u = 240,
28
+ compact: f = !1,
29
+ "aria-label": v
29
30
  }) {
30
- const n = p(() => [...s], [s]), w = p(() => C(n.length, i), [n, i]), y = p(() => n.reduce((t, l) => t + (Number.isFinite(l.value) ? l.value : 0), 0), [n]), N = (t) => `${Number.isFinite(t) ? t : 0}${r ? "%" : ""}`, x = /* @__PURE__ */ a("div", { className: "pointer-events-none relative", style: { width: h, height: h }, children: [
31
- /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
32
- b,
33
- {
34
- data: n,
35
- dataKey: "value",
36
- nameKey: "name",
37
- cx: "50%",
38
- cy: "50%",
39
- innerRadius: o,
40
- outerRadius: c,
41
- startAngle: 90,
42
- endAngle: -270,
43
- paddingAngle: f ? 0 : 2,
44
- strokeWidth: 0,
45
- cornerRadius: f ? 0 : 4,
46
- style: { outline: "none" },
47
- isAnimationActive: !1,
48
- children: n.map((t, l) => /* @__PURE__ */ e(
49
- j,
31
+ const l = p(() => [...a], [a]), y = p(() => A(l.length, r), [l, r]), N = p(() => l.reduce((t, n) => t + (Number.isFinite(n.value) ? n.value : 0), 0), [l]), w = (t) => `${Number.isFinite(t) ? t : 0}${i ? "%" : ""}`, b = v ?? l.map((t) => `${String(t.name)} ${w(t.value)}`).join(", "), x = /* @__PURE__ */ s(
32
+ "div",
33
+ {
34
+ className: "pointer-events-none relative",
35
+ style: { width: u, height: u },
36
+ role: "img",
37
+ "aria-label": b,
38
+ children: [
39
+ /* @__PURE__ */ e($, { width: "100%", height: "100%", children: /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
40
+ C,
41
+ {
42
+ data: l,
43
+ dataKey: "value",
44
+ nameKey: "name",
45
+ cx: "50%",
46
+ cy: "50%",
47
+ innerRadius: o,
48
+ outerRadius: m,
49
+ startAngle: 90,
50
+ endAngle: -270,
51
+ paddingAngle: f ? 0 : 2,
52
+ strokeWidth: 0,
53
+ cornerRadius: f ? 0 : 4,
54
+ style: { outline: "none" },
55
+ isAnimationActive: !1,
56
+ children: l.map((t, n) => /* @__PURE__ */ e(
57
+ k,
58
+ {
59
+ fill: y[n],
60
+ stroke: "none",
61
+ style: { outline: "none", cursor: "default" }
62
+ },
63
+ `cell-${n}`
64
+ ))
65
+ }
66
+ ) }) }),
67
+ h && /* @__PURE__ */ s(
68
+ "div",
50
69
  {
51
- fill: w[l],
52
- stroke: "none",
53
- style: { outline: "none", cursor: "default" }
54
- },
55
- `cell-${l}`
56
- ))
57
- }
58
- ) }) }),
59
- d && /* @__PURE__ */ a(
60
- "div",
61
- {
62
- className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center px-4 text-center",
63
- "aria-hidden": !0,
64
- children: [
65
- /* @__PURE__ */ e("span", { className: "text-2xl font-semibold tabular-nums text-primary", children: Number.isFinite(y) ? y : 0 }),
66
- m ? /* @__PURE__ */ e("span", { className: "mt-1 max-w-[7.5rem] text-sm font-normal leading-snug text-secondary text-center", children: m }) : null
67
- ]
68
- }
69
- )
70
- ] });
71
- return u ? /* @__PURE__ */ a("div", { className: "flex w-full min-w-0 max-w-[1100px] flex-col gap-3 bg-white", style: { outline: "none" }, children: [
70
+ className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center px-4 text-center",
71
+ "aria-hidden": !0,
72
+ children: [
73
+ /* @__PURE__ */ e("span", { className: "text-2xl font-semibold tabular-nums text-primary", children: Number.isFinite(N) ? N : 0 }),
74
+ c ? /* @__PURE__ */ e("span", { className: "mt-1 max-w-[7.5rem] text-sm font-normal leading-snug text-secondary text-center", children: c }) : null
75
+ ]
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ return d ? /* @__PURE__ */ s("div", { className: "flex w-full min-w-0 max-w-[1100px] flex-col gap-3 bg-primary", style: { outline: "none" }, children: [
72
82
  g ? /* @__PURE__ */ e("h4", { className: "text-sm font-normal text-primary", children: g }) : null,
73
- /* @__PURE__ */ a("div", { className: "flex w-full min-w-0 flex-row flex-wrap items-center gap-[60px]", children: [
83
+ /* @__PURE__ */ s("div", { className: "flex w-full min-w-0 flex-row flex-wrap items-center gap-[60px]", children: [
74
84
  x,
75
- n.length > 0 ? /* @__PURE__ */ e("ul", { className: "flex min-h-[2.75rem] min-w-0 flex-1 flex-row flex-wrap content-center items-stretch gap-x-[60px] gap-y-4", children: n.map((t, l) => /* @__PURE__ */ a("li", { className: "flex w-[132px] items-stretch gap-2.5", children: [
85
+ l.length > 0 ? /* @__PURE__ */ e("ul", { className: "flex min-h-[2.75rem] min-w-0 flex-1 flex-row flex-wrap content-center items-stretch gap-x-[60px] gap-y-4", children: l.map((t, n) => /* @__PURE__ */ s("li", { className: "flex w-[132px] items-stretch gap-2.5", children: [
76
86
  /* @__PURE__ */ e(
77
87
  "div",
78
88
  {
79
89
  className: "w-1.5 shrink-0 rounded-sm",
80
90
  style: {
81
- backgroundColor: w[l],
91
+ backgroundColor: y[n],
82
92
  minHeight: "2.75rem"
83
93
  }
84
94
  }
85
95
  ),
86
- /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col justify-center", children: [
96
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 flex-col justify-center", children: [
87
97
  /* @__PURE__ */ e("span", { className: "text-xs text-secondary", children: t.name }),
88
- /* @__PURE__ */ e("span", { className: "text-xl font-semibold tabular-nums text-primary", children: N(t.value) })
98
+ /* @__PURE__ */ e("span", { className: "text-xl font-semibold tabular-nums text-primary", children: w(t.value) })
89
99
  ] })
90
- ] }, `${String(t.name)}-${l}`)) }) : null
100
+ ] }, `${String(t.name)}-${n}`)) }) : null
91
101
  ] })
92
102
  ] }) : f ? /* @__PURE__ */ e(
93
103
  "div",
94
104
  {
95
105
  className: "flex items-center justify-center",
96
- style: { outline: "none", width: h, height: h },
106
+ style: { outline: "none", width: u, height: u },
97
107
  children: x
98
108
  }
99
109
  ) : /* @__PURE__ */ e(
100
110
  "div",
101
111
  {
102
- className: "flex h-full min-h-[150px] w-full items-center justify-center bg-white",
112
+ className: "flex h-full min-h-[150px] w-full items-center justify-center bg-primary",
103
113
  style: { outline: "none" },
104
114
  children: x
105
115
  }
106
116
  );
107
117
  }
108
118
  export {
109
- R as DonutChart,
110
- R as default
119
+ B as DonutChart,
120
+ B as default
111
121
  };