wimui 0.20.0 → 0.22.0

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 (62) hide show
  1. package/dist/components/charts/AreaChart/AreaChart.cjs +1 -1
  2. package/dist/components/charts/AreaChart/AreaChart.d.ts +9 -2
  3. package/dist/components/charts/AreaChart/AreaChart.js +13 -29
  4. package/dist/components/charts/AreaChart/area-chart.module.cjs +1 -1
  5. package/dist/components/charts/AreaChart/area-chart.module.js +1 -1
  6. package/dist/components/charts/BarChart/BarChart.cjs +1 -1
  7. package/dist/components/charts/BarChart/BarChart.d.ts +9 -2
  8. package/dist/components/charts/BarChart/BarChart.js +12 -7
  9. package/dist/components/charts/BarChart/bar-chart.module.cjs +1 -1
  10. package/dist/components/charts/BarChart/bar-chart.module.js +1 -1
  11. package/dist/components/charts/FunnelChart/FunnelChart.cjs +1 -1
  12. package/dist/components/charts/FunnelChart/FunnelChart.js +36 -28
  13. package/dist/components/charts/FunnelChart/funnel-chart.module.cjs +1 -1
  14. package/dist/components/charts/FunnelChart/funnel-chart.module.js +1 -1
  15. package/dist/components/charts/GaugeChart/gauge-chart.module.cjs +1 -1
  16. package/dist/components/charts/GaugeChart/gauge-chart.module.js +1 -1
  17. package/dist/components/charts/Heatmap/Heatmap.cjs +1 -1
  18. package/dist/components/charts/Heatmap/Heatmap.js +11 -4
  19. package/dist/components/charts/Heatmap/heatmap.module.cjs +1 -1
  20. package/dist/components/charts/Heatmap/heatmap.module.js +1 -1
  21. package/dist/components/charts/LineChart/LineChart.cjs +1 -1
  22. package/dist/components/charts/LineChart/LineChart.d.ts +9 -2
  23. package/dist/components/charts/LineChart/LineChart.js +5 -3
  24. package/dist/components/charts/LineChart/line-chart.module.cjs +1 -1
  25. package/dist/components/charts/LineChart/line-chart.module.js +1 -1
  26. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  27. package/dist/components/charts/PieChart/PieChart.js +3 -2
  28. package/dist/components/charts/PieChart/pie-chart.module.cjs +1 -1
  29. package/dist/components/charts/PieChart/pie-chart.module.js +1 -1
  30. package/dist/components/charts/RadarChart/RadarChart.cjs +1 -1
  31. package/dist/components/charts/RadarChart/RadarChart.js +6 -2
  32. package/dist/components/charts/RadarChart/radar-chart.module.cjs +1 -1
  33. package/dist/components/charts/RadarChart/radar-chart.module.js +1 -1
  34. package/dist/components/charts/ScatterChart/ScatterChart.cjs +1 -1
  35. package/dist/components/charts/ScatterChart/ScatterChart.d.ts +12 -1
  36. package/dist/components/charts/ScatterChart/ScatterChart.js +10 -7
  37. package/dist/components/charts/ScatterChart/scatter-chart.module.cjs +1 -1
  38. package/dist/components/charts/ScatterChart/scatter-chart.module.js +1 -1
  39. package/dist/components/charts/Sparkline/Sparkline.cjs +1 -1
  40. package/dist/components/charts/Sparkline/Sparkline.js +62 -80
  41. package/dist/components/charts/Sparkline/sparkline.module.cjs +1 -1
  42. package/dist/components/charts/Sparkline/sparkline.module.js +1 -1
  43. package/dist/components/charts/Treemap/Treemap.cjs +1 -1
  44. package/dist/components/charts/Treemap/Treemap.js +107 -59
  45. package/dist/components/form/Rating/rating.module.cjs +1 -1
  46. package/dist/components/form/Rating/rating.module.js +1 -1
  47. package/dist/components/form/SignaturePad/signature-pad.module.cjs +1 -1
  48. package/dist/components/form/SignaturePad/signature-pad.module.js +6 -6
  49. package/dist/components/helpers.cjs +1 -1
  50. package/dist/components/helpers.d.ts +9 -0
  51. package/dist/components/helpers.js +2 -11
  52. package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
  53. package/dist/components/layout/Dashboard/Dashboard.d.ts +8 -0
  54. package/dist/components/layout/Dashboard/Dashboard.js +47 -42
  55. package/dist/components/layout/Dashboard/dashboard.module.cjs +1 -1
  56. package/dist/components/layout/Dashboard/dashboard.module.js +13 -13
  57. package/dist/llms-full.txt +22 -3
  58. package/dist/llms.txt +1 -1
  59. package/dist/styles.css +2 -2
  60. package/dist/wimui.umd.css +1 -1
  61. package/dist/wimui.umd.js +1 -1
  62. package/package.json +8 -1
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { ChartAxisDomain } from '../../helpers';
2
3
  export type ScatterChartProps = {
3
4
  /**
4
5
  * Points to plot. `z` optionally controls the point size.
@@ -19,6 +20,16 @@ export type ScatterChartProps = {
19
20
  * @default "Y"
20
21
  */
21
22
  yAxisName?: string;
23
+ /**
24
+ * Range of the X axis.
25
+ * @default ["auto", "auto"]
26
+ */
27
+ xDomain?: ChartAxisDomain;
28
+ /**
29
+ * Range of the Y axis.
30
+ * @default ["auto", "auto"]
31
+ */
32
+ yDomain?: ChartAxisDomain;
22
33
  /**
23
34
  * The height of the chart in pixels.
24
35
  * @default 300
@@ -39,4 +50,4 @@ export type ScatterChartProps = {
39
50
  */
40
51
  animated?: boolean;
41
52
  };
42
- export declare const ScatterChart: ({ data, xAxisName, yAxisName, height, width, title, animated, }: ScatterChartProps) => React.JSX.Element;
53
+ export declare const ScatterChart: ({ data, xAxisName, yAxisName, xDomain, yDomain, height, width, title, animated, }: ScatterChartProps) => React.JSX.Element;
@@ -6,17 +6,17 @@ import "react";
6
6
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
7
  import { CartesianGrid as o, Legend as s, ResponsiveContainer as c, Scatter as l, ScatterChart as u, Tooltip as d, XAxis as f, YAxis as p, ZAxis as m } from "recharts";
8
8
  //#region src/components/charts/ScatterChart/ScatterChart.tsx
9
- var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, width: y = "100%", title: b, animated: x = !1 }) => /* @__PURE__ */ a("div", {
9
+ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", xDomain: v = ["auto", "auto"], yDomain: y = ["auto", "auto"], height: b = 300, width: x = "100%", title: S, animated: C = !1 }) => /* @__PURE__ */ a("div", {
10
10
  className: `wim-scatter-chart ${r.root}`,
11
- style: { width: y },
12
- children: [b && /* @__PURE__ */ i(e, {
11
+ style: { width: x },
12
+ children: [S && /* @__PURE__ */ i(e, {
13
13
  tag: "h3",
14
14
  size: "md",
15
15
  style: { marginBottom: "var(--wim-spacing-md)" },
16
- children: b
16
+ children: S
17
17
  }), /* @__PURE__ */ i("div", {
18
18
  className: r.container,
19
- style: { height: v },
19
+ style: { height: b },
20
20
  children: /* @__PURE__ */ i(c, {
21
21
  width: "100%",
22
22
  height: "100%",
@@ -25,7 +25,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
25
25
  top: 20,
26
26
  right: 20,
27
27
  bottom: 20,
28
- left: 20
28
+ left: 0
29
29
  },
30
30
  children: [
31
31
  /* @__PURE__ */ i(o, { ...n.grid }),
@@ -34,6 +34,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
34
34
  dataKey: "x",
35
35
  name: g,
36
36
  unit: "",
37
+ domain: v,
37
38
  ...n.axis
38
39
  }),
39
40
  /* @__PURE__ */ i(p, {
@@ -41,6 +42,8 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
41
42
  dataKey: "y",
42
43
  name: _,
43
44
  unit: "",
45
+ domain: y,
46
+ width: 44,
44
47
  ...n.axis
45
48
  }),
46
49
  /* @__PURE__ */ i(m, {
@@ -60,7 +63,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
60
63
  name: "Data Points",
61
64
  data: h,
62
65
  fill: t[0],
63
- isAnimationActive: x
66
+ isAnimationActive: C
64
67
  })
65
68
  ]
66
69
  })
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_12ucx_4`,t=`_container_12ucx_9`,n={root:e,container:t};exports.container=t,exports.default=n,exports.root=e;
2
+ var e=`_root_pxnwr_4`,t=`_container_pxnwr_9`,n={root:e,container:t};exports.container=t,exports.default=n,exports.root=e;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/charts/ScatterChart/scatter-chart.module.scss
3
- var e = "_root_12ucx_4", t = "_container_12ucx_9", n = {
3
+ var e = "_root_pxnwr_4", t = "_container_pxnwr_9", n = {
4
4
  root: e,
5
5
  container: t
6
6
  };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./sparkline.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("classnames");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("recharts");var o=`var(--wim-color-chart-primary)`,s=({data:e,type:s=`line`,width:c=100,height:l=24,color:u=o,strokeWidth:d=2,showLastDot:f=!1,min:p,max:m,ariaLabel:h,className:g})=>{let _=(0,n.useId)().replace(/:/g,``),v=e.map((e,t)=>({index:t,value:e})),y=[p??`auto`,m??`auto`],b=e.length-1,x=typeof window<`u`&&!!window.__VRT__,S=typeof c==`number`?c:100,C=l??24,w=e=>{let{cx:t,cy:n,index:r}=e;return!f||r!==b||t==null||n==null?(0,i.jsx)(`g`,{},r):(0,i.jsx)(`circle`,{cx:t,cy:n,r:d+1,fill:u},r)},T=x?{width:S,height:C}:{},E={accessibilityLayer:!1,tabIndex:-1},D=()=>s===`bar`?(0,i.jsxs)(a.BarChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Bar,{dataKey:`value`,fill:u,radius:[2,2,0,0],isAnimationActive:!1})]}):s===`area`?(0,i.jsxs)(a.AreaChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(`defs`,{children:(0,i.jsxs)(`linearGradient`,{id:_,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:u,stopOpacity:.35}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:u,stopOpacity:0})]})}),(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Area,{type:`monotone`,dataKey:`value`,stroke:u,strokeWidth:d,fill:`url(#${_})`,dot:f?w:!1,isAnimationActive:!1})]}):(0,i.jsxs)(a.LineChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Line,{type:`monotone`,dataKey:`value`,stroke:u,strokeWidth:d,dot:f?w:!1,isAnimationActive:!1})]});return(0,i.jsx)(`div`,{className:(0,r.default)(`wim-sparkline`,t.default.root,g),style:{width:c,height:l},role:h?`img`:void 0,"aria-label":h,"aria-hidden":h?void 0:!0,children:x?D():(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:D()})})};s.displayName=`Sparkline`,exports.Sparkline=s;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./sparkline.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("classnames");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("recharts");var o=`var(--wim-color-chart-primary)`,s=({data:e,type:n=`line`,width:s=`100%`,height:c=24,color:l=o,strokeWidth:u=2,showLastDot:d=!1,min:f,max:p,ariaLabel:m,className:h})=>{let g=e.map((e,t)=>({index:t,value:e})),_=[f??`auto`,p??`auto`],v=e.length-1,y=typeof window<`u`&&!!window.__VRT__,b=typeof s==`number`?s:null,x=c??24,S=e=>{let{cx:t,cy:n,index:r}=e;return!d||r!==v||t==null||n==null?(0,i.jsx)(`g`,{},r):(0,i.jsx)(`circle`,{cx:t,cy:n,r:u+1,fill:l},r)},C=y&&b!==null?{width:b,height:x}:{},w={accessibilityLayer:!1,tabIndex:-1},T=()=>n===`bar`?(0,i.jsxs)(a.BarChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Bar,{dataKey:`value`,fill:l,radius:[2,2,0,0],isAnimationActive:!1})]}):n===`area`?(0,i.jsxs)(a.AreaChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Area,{type:`monotone`,dataKey:`value`,stroke:l,strokeWidth:u,fill:l,fillOpacity:.15,dot:d?S:!1,isAnimationActive:!1})]}):(0,i.jsxs)(a.LineChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Line,{type:`monotone`,dataKey:`value`,stroke:l,strokeWidth:u,dot:d?S:!1,isAnimationActive:!1})]});return(0,i.jsx)(`div`,{className:(0,r.default)(`wim-sparkline`,t.default.root,h),style:{width:s,height:c},role:m?`img`:void 0,"aria-label":m,"aria-hidden":m?void 0:!0,children:y&&b!==null?T():(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:T()})})};s.displayName=`Sparkline`,exports.Sparkline=s;
@@ -1,44 +1,44 @@
1
1
  "use client";
2
2
  import e from "./sparkline.module.js";
3
- import { useId as t } from "react";
4
- import n from "classnames";
5
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
- import { Area as a, AreaChart as o, Bar as s, BarChart as c, Line as l, LineChart as u, ResponsiveContainer as d, YAxis as f } from "recharts";
3
+ import "react";
4
+ import t from "classnames";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
+ import { Area as i, AreaChart as a, Bar as o, BarChart as s, Line as c, LineChart as l, ResponsiveContainer as u, YAxis as d } from "recharts";
7
7
  //#region src/components/charts/Sparkline/Sparkline.tsx
8
- var p = "var(--wim-color-chart-primary)", m = ({ data: m, type: h = "line", width: g = 100, height: _ = 24, color: v = p, strokeWidth: y = 2, showLastDot: b = !1, min: x, max: S, ariaLabel: C, className: w }) => {
9
- let T = t().replace(/:/g, ""), E = m.map((e, t) => ({
8
+ var f = "var(--wim-color-chart-primary)", p = ({ data: p, type: m = "line", width: h = "100%", height: g = 24, color: _ = f, strokeWidth: v = 2, showLastDot: y = !1, min: b, max: x, ariaLabel: S, className: C }) => {
9
+ let w = p.map((e, t) => ({
10
10
  index: t,
11
11
  value: e
12
- })), D = [x ?? "auto", S ?? "auto"], O = m.length - 1, k = typeof window < "u" && !!window.__VRT__, A = typeof g == "number" ? g : 100, j = _ ?? 24, M = (e) => {
13
- let { cx: t, cy: n, index: i } = e;
14
- return !b || i !== O || t == null || n == null ? /* @__PURE__ */ r("g", {}, i) : /* @__PURE__ */ r("circle", {
12
+ })), T = [b ?? "auto", x ?? "auto"], E = p.length - 1, D = typeof window < "u" && !!window.__VRT__, O = typeof h == "number" ? h : null, k = g ?? 24, A = (e) => {
13
+ let { cx: t, cy: r, index: i } = e;
14
+ return !y || i !== E || t == null || r == null ? /* @__PURE__ */ n("g", {}, i) : /* @__PURE__ */ n("circle", {
15
15
  cx: t,
16
- cy: n,
17
- r: y + 1,
18
- fill: v
16
+ cy: r,
17
+ r: v + 1,
18
+ fill: _
19
19
  }, i);
20
- }, N = k ? {
21
- width: A,
22
- height: j
23
- } : {}, P = {
20
+ }, j = D && O !== null ? {
21
+ width: O,
22
+ height: k
23
+ } : {}, M = {
24
24
  accessibilityLayer: !1,
25
25
  tabIndex: -1
26
- }, F = () => h === "bar" ? /* @__PURE__ */ i(c, {
27
- ...N,
28
- ...P,
29
- data: E,
26
+ }, N = () => m === "bar" ? /* @__PURE__ */ r(s, {
27
+ ...j,
28
+ ...M,
29
+ data: w,
30
30
  margin: {
31
31
  top: 2,
32
32
  right: 2,
33
33
  bottom: 2,
34
34
  left: 2
35
35
  },
36
- children: [/* @__PURE__ */ r(f, {
36
+ children: [/* @__PURE__ */ n(d, {
37
37
  hide: !0,
38
- domain: D
39
- }), /* @__PURE__ */ r(s, {
38
+ domain: T
39
+ }), /* @__PURE__ */ n(o, {
40
40
  dataKey: "value",
41
- fill: v,
41
+ fill: _,
42
42
  radius: [
43
43
  2,
44
44
  2,
@@ -47,85 +47,67 @@ var p = "var(--wim-color-chart-primary)", m = ({ data: m, type: h = "line", widt
47
47
  ],
48
48
  isAnimationActive: !1
49
49
  })]
50
- }) : h === "area" ? /* @__PURE__ */ i(o, {
51
- ...N,
52
- ...P,
53
- data: E,
50
+ }) : m === "area" ? /* @__PURE__ */ r(a, {
51
+ ...j,
52
+ ...M,
53
+ data: w,
54
54
  margin: {
55
55
  top: 2,
56
56
  right: 2,
57
57
  bottom: 2,
58
58
  left: 2
59
59
  },
60
- children: [
61
- /* @__PURE__ */ r("defs", { children: /* @__PURE__ */ i("linearGradient", {
62
- id: T,
63
- x1: "0",
64
- y1: "0",
65
- x2: "0",
66
- y2: "1",
67
- children: [/* @__PURE__ */ r("stop", {
68
- offset: "0%",
69
- stopColor: v,
70
- stopOpacity: .35
71
- }), /* @__PURE__ */ r("stop", {
72
- offset: "100%",
73
- stopColor: v,
74
- stopOpacity: 0
75
- })]
76
- }) }),
77
- /* @__PURE__ */ r(f, {
78
- hide: !0,
79
- domain: D
80
- }),
81
- /* @__PURE__ */ r(a, {
82
- type: "monotone",
83
- dataKey: "value",
84
- stroke: v,
85
- strokeWidth: y,
86
- fill: `url(#${T})`,
87
- dot: b ? M : !1,
88
- isAnimationActive: !1
89
- })
90
- ]
91
- }) : /* @__PURE__ */ i(u, {
92
- ...N,
93
- ...P,
94
- data: E,
60
+ children: [/* @__PURE__ */ n(d, {
61
+ hide: !0,
62
+ domain: T
63
+ }), /* @__PURE__ */ n(i, {
64
+ type: "monotone",
65
+ dataKey: "value",
66
+ stroke: _,
67
+ strokeWidth: v,
68
+ fill: _,
69
+ fillOpacity: .15,
70
+ dot: y ? A : !1,
71
+ isAnimationActive: !1
72
+ })]
73
+ }) : /* @__PURE__ */ r(l, {
74
+ ...j,
75
+ ...M,
76
+ data: w,
95
77
  margin: {
96
78
  top: 2,
97
79
  right: 2,
98
80
  bottom: 2,
99
81
  left: 2
100
82
  },
101
- children: [/* @__PURE__ */ r(f, {
83
+ children: [/* @__PURE__ */ n(d, {
102
84
  hide: !0,
103
- domain: D
104
- }), /* @__PURE__ */ r(l, {
85
+ domain: T
86
+ }), /* @__PURE__ */ n(c, {
105
87
  type: "monotone",
106
88
  dataKey: "value",
107
- stroke: v,
108
- strokeWidth: y,
109
- dot: b ? M : !1,
89
+ stroke: _,
90
+ strokeWidth: v,
91
+ dot: y ? A : !1,
110
92
  isAnimationActive: !1
111
93
  })]
112
94
  });
113
- return /* @__PURE__ */ r("div", {
114
- className: n("wim-sparkline", e.root, w),
95
+ return /* @__PURE__ */ n("div", {
96
+ className: t("wim-sparkline", e.root, C),
115
97
  style: {
116
- width: g,
117
- height: _
98
+ width: h,
99
+ height: g
118
100
  },
119
- role: C ? "img" : void 0,
120
- "aria-label": C,
121
- "aria-hidden": C ? void 0 : !0,
122
- children: k ? F() : /* @__PURE__ */ r(d, {
101
+ role: S ? "img" : void 0,
102
+ "aria-label": S,
103
+ "aria-hidden": S ? void 0 : !0,
104
+ children: D && O !== null ? N() : /* @__PURE__ */ n(u, {
123
105
  width: "100%",
124
106
  height: "100%",
125
- children: F()
107
+ children: N()
126
108
  })
127
109
  });
128
110
  };
129
- m.displayName = "Sparkline";
111
+ p.displayName = "Sparkline";
130
112
  //#endregion
131
- export { m as Sparkline };
113
+ export { p as Sparkline };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_15zk0_4`,t={root:e};exports.default=t,exports.root=e;
2
+ var e=`_root_1p9uf_4`,t={root:e};exports.default=t,exports.root=e;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
2
  //#region src/components/charts/Sparkline/sparkline.module.scss
3
- var e = "_root_15zk0_4", t = { root: e };
3
+ var e = "_root_1p9uf_4", t = { root: e };
4
4
  //#endregion
5
5
  export { t as default, e as root };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("./treemap.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("recharts");var s=({x:e,y:t,width:r,height:i,index:o,name:s})=>(0,a.jsxs)(`g`,{children:[(0,a.jsx)(`rect`,{x:e,y:t,width:r,height:i,style:{fill:n.CHART_COLORS[o%n.CHART_COLORS.length],stroke:`none`}}),r>30&&i>20&&(0,a.jsx)(`text`,{x:e+r/2,y:t+i/2,textAnchor:`middle`,dominantBaseline:`central`,style:{fill:n.CHART_TEXT_COLORS[o%n.CHART_TEXT_COLORS.length],fontSize:`var(--wim-font-size-lg)`,fontWeight:`var(--wim-font-weight-bold)`,stroke:`none`,strokeWidth:0,pointerEvents:`none`,userSelect:`none`},children:s})]}),c=({data:e,dataKey:i,aspectRatio:c=4/3,height:l=300,width:u=`100%`,title:d})=>!e||e.length===0?null:(0,a.jsxs)(`div`,{className:`wim-treemap ${r.default.root} wim-treemap__root`,style:{width:u},children:[d&&(0,a.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:d}),(0,a.jsx)(`div`,{className:`${r.default.container} wim-treemap__container`,style:{height:l,minWidth:0,minHeight:0},children:(0,a.jsx)(o.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,a.jsx)(o.Treemap,{data:e,dataKey:i,aspectRatio:c,stroke:`none`,content:s,isAnimationActive:!1,children:(0,a.jsx)(o.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,formatter:(e,t)=>[e,t]})})})})]});exports.Treemap=c;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("./treemap.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("recharts");var s=2,c=8,l=2,u=(e,t,n)=>{let r=n-t,i=r===0?1:Math.min(1,Math.max(0,(e-t)/r));return`color-mix(in oklch, var(--wim-color-chart-primary) ${20+Math.round(i*40)}%, var(--wim-color-surface))`},d=(0,i.createContext)({min:0,max:1}),f=({x:e,y:t,width:n,height:r,name:o,value:f,depth:p,children:m})=>{let{min:h,max:g}=(0,i.useContext)(d),_=o??``,v=(0,i.useCallback)(e=>{if(!e)return;let t=()=>{let t=Math.min(c,n*.12),r=Math.floor(n-t*2),i=()=>Math.ceil(e.getComputedTextLength())<=r;if(e.textContent=_,i()){e.style.visibility=``;return}let a=e.getComputedTextLength()/Math.max(1,_.length),o=Math.min(Math.floor(r/a)-1,_.length-1);for(;o>=l;){if(e.textContent=`${_.slice(0,o).trimEnd()}…`,i()){e.style.visibility=``;return}--o}e.textContent=_,e.style.visibility=`hidden`};t();let r=()=>{e.isConnected&&t()};return document.fonts?.addEventListener?.(`loadingdone`,r),()=>document.fonts?.removeEventListener?.(`loadingdone`,r)},[n,_]);return p===0||Array.isArray(m)&&m.length>0?(0,a.jsx)(`g`,{}):(0,a.jsxs)(`g`,{children:[(0,a.jsx)(`rect`,{x:e+s/2,y:t+s/2,width:Math.max(0,n-s),height:Math.max(0,r-s),style:{fill:u(f,h,g),stroke:`none`}}),n>30&&r>20&&(0,a.jsx)(`text`,{ref:v,x:e+n/2,y:t+r/2,textAnchor:`middle`,dominantBaseline:`central`,style:{fill:`var(--wim-color-text-primary)`,fontSize:`var(--wim-font-size-lg)`,fontWeight:`var(--wim-font-weight-bold)`,stroke:`none`,strokeWidth:0,pointerEvents:`none`,userSelect:`none`},children:_})]})},p=({data:e,dataKey:s,aspectRatio:c=4/3,height:l=300,width:u=`100%`,title:p})=>{let m=(0,i.useMemo)(()=>{let t=e=>e.flatMap(e=>Array.isArray(e.children)?t(e.children):[e]),n=t(e??[]).map(e=>Number(e[s])||0);return n.length?{min:Math.min(...n),max:Math.max(...n)}:{min:0,max:1}},[e,s]);return!e||e.length===0?null:(0,a.jsx)(d.Provider,{value:m,children:(0,a.jsxs)(`div`,{className:`wim-treemap ${r.default.root} wim-treemap__root`,style:{width:u},children:[p&&(0,a.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:p}),(0,a.jsx)(`div`,{className:`${r.default.container} wim-treemap__container`,style:{height:l,minWidth:0,minHeight:0},children:(0,a.jsx)(o.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,a.jsx)(o.Treemap,{data:e,dataKey:s,aspectRatio:c,stroke:`none`,content:f,isAnimationActive:!1,children:(0,a.jsx)(o.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,formatter:(e,t)=>[e,t]})})})})]})})};exports.Treemap=p;
@@ -1,67 +1,115 @@
1
1
  "use client";
2
2
  import { Title as e } from "../../typography/Title/Title.js";
3
- import { CHART_COLORS as t, CHART_TEXT_COLORS as n, CHART_THEME as r } from "../../helpers.js";
4
- import i from "./treemap.module.js";
5
- import "react";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import { ResponsiveContainer as s, Tooltip as c, Treemap as l } from "recharts";
3
+ import { CHART_THEME as t } from "../../helpers.js";
4
+ import n from "./treemap.module.js";
5
+ import { createContext as r, useCallback as i, useContext as a, useMemo as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { ResponsiveContainer as l, Tooltip as u, Treemap as d } from "recharts";
8
8
  //#region src/components/charts/Treemap/Treemap.tsx
9
- var u = ({ x: e, y: r, width: i, height: s, index: c, name: l }) => /* @__PURE__ */ o("g", { children: [/* @__PURE__ */ a("rect", {
10
- x: e,
11
- y: r,
12
- width: i,
13
- height: s,
14
- style: {
15
- fill: t[c % t.length],
16
- stroke: "none"
17
- }
18
- }), i > 30 && s > 20 && /* @__PURE__ */ a("text", {
19
- x: e + i / 2,
20
- y: r + s / 2,
21
- textAnchor: "middle",
22
- dominantBaseline: "central",
23
- style: {
24
- fill: n[c % n.length],
25
- fontSize: "var(--wim-font-size-lg)",
26
- fontWeight: "var(--wim-font-weight-bold)",
27
- stroke: "none",
28
- strokeWidth: 0,
29
- pointerEvents: "none",
30
- userSelect: "none"
31
- },
32
- children: l
33
- })] }), d = ({ data: t, dataKey: n, aspectRatio: d = 4 / 3, height: f = 300, width: p = "100%", title: m }) => !t || t.length === 0 ? null : /* @__PURE__ */ o("div", {
34
- className: `wim-treemap ${i.root} wim-treemap__root`,
35
- style: { width: p },
36
- children: [m && /* @__PURE__ */ a(e, {
37
- tag: "h3",
38
- size: "md",
39
- style: { marginBottom: "var(--wim-spacing-md)" },
40
- children: m
41
- }), /* @__PURE__ */ a("div", {
42
- className: `${i.container} wim-treemap__container`,
9
+ var f = 2, p = 8, m = 2, h = (e, t, n) => {
10
+ let r = n - t, i = r === 0 ? 1 : Math.min(1, Math.max(0, (e - t) / r));
11
+ return `color-mix(in oklch, var(--wim-color-chart-primary) ${20 + Math.round(i * 40)}%, var(--wim-color-surface))`;
12
+ }, g = r({
13
+ min: 0,
14
+ max: 1
15
+ }), _ = ({ x: e, y: t, width: n, height: r, name: o, value: l, depth: u, children: d }) => {
16
+ let { min: _, max: v } = a(g), y = o ?? "", b = i((e) => {
17
+ if (!e) return;
18
+ let t = () => {
19
+ let t = Math.min(p, n * .12), r = Math.floor(n - t * 2), i = () => Math.ceil(e.getComputedTextLength()) <= r;
20
+ if (e.textContent = y, i()) {
21
+ e.style.visibility = "";
22
+ return;
23
+ }
24
+ let a = e.getComputedTextLength() / Math.max(1, y.length), o = Math.min(Math.floor(r / a) - 1, y.length - 1);
25
+ for (; o >= m;) {
26
+ if (e.textContent = `${y.slice(0, o).trimEnd()}…`, i()) {
27
+ e.style.visibility = "";
28
+ return;
29
+ }
30
+ --o;
31
+ }
32
+ e.textContent = y, e.style.visibility = "hidden";
33
+ };
34
+ t();
35
+ let r = () => {
36
+ e.isConnected && t();
37
+ };
38
+ return document.fonts?.addEventListener?.("loadingdone", r), () => document.fonts?.removeEventListener?.("loadingdone", r);
39
+ }, [n, y]);
40
+ return u === 0 || Array.isArray(d) && d.length > 0 ? /* @__PURE__ */ s("g", {}) : /* @__PURE__ */ c("g", { children: [/* @__PURE__ */ s("rect", {
41
+ x: e + f / 2,
42
+ y: t + f / 2,
43
+ width: Math.max(0, n - f),
44
+ height: Math.max(0, r - f),
43
45
  style: {
44
- height: f,
45
- minWidth: 0,
46
- minHeight: 0
46
+ fill: h(l, _, v),
47
+ stroke: "none"
48
+ }
49
+ }), n > 30 && r > 20 && /* @__PURE__ */ s("text", {
50
+ ref: b,
51
+ x: e + n / 2,
52
+ y: t + r / 2,
53
+ textAnchor: "middle",
54
+ dominantBaseline: "central",
55
+ style: {
56
+ fill: "var(--wim-color-text-primary)",
57
+ fontSize: "var(--wim-font-size-lg)",
58
+ fontWeight: "var(--wim-font-weight-bold)",
59
+ stroke: "none",
60
+ strokeWidth: 0,
61
+ pointerEvents: "none",
62
+ userSelect: "none"
47
63
  },
48
- children: /* @__PURE__ */ a(s, {
49
- width: "100%",
50
- height: "100%",
51
- children: /* @__PURE__ */ a(l, {
52
- data: t,
53
- dataKey: n,
54
- aspectRatio: d,
55
- stroke: "none",
56
- content: u,
57
- isAnimationActive: !1,
58
- children: /* @__PURE__ */ a(c, {
59
- contentStyle: r.tooltip.contentStyle,
60
- formatter: (e, t) => [e, t]
64
+ children: y
65
+ })] });
66
+ }, v = ({ data: r, dataKey: i, aspectRatio: a = 4 / 3, height: f = 300, width: p = "100%", title: m }) => {
67
+ let h = o(() => {
68
+ let e = (t) => t.flatMap((t) => Array.isArray(t.children) ? e(t.children) : [t]), t = e(r ?? []).map((e) => Number(e[i]) || 0);
69
+ return t.length ? {
70
+ min: Math.min(...t),
71
+ max: Math.max(...t)
72
+ } : {
73
+ min: 0,
74
+ max: 1
75
+ };
76
+ }, [r, i]);
77
+ return !r || r.length === 0 ? null : /* @__PURE__ */ s(g.Provider, {
78
+ value: h,
79
+ children: /* @__PURE__ */ c("div", {
80
+ className: `wim-treemap ${n.root} wim-treemap__root`,
81
+ style: { width: p },
82
+ children: [m && /* @__PURE__ */ s(e, {
83
+ tag: "h3",
84
+ size: "md",
85
+ style: { marginBottom: "var(--wim-spacing-md)" },
86
+ children: m
87
+ }), /* @__PURE__ */ s("div", {
88
+ className: `${n.container} wim-treemap__container`,
89
+ style: {
90
+ height: f,
91
+ minWidth: 0,
92
+ minHeight: 0
93
+ },
94
+ children: /* @__PURE__ */ s(l, {
95
+ width: "100%",
96
+ height: "100%",
97
+ children: /* @__PURE__ */ s(d, {
98
+ data: r,
99
+ dataKey: i,
100
+ aspectRatio: a,
101
+ stroke: "none",
102
+ content: _,
103
+ isAnimationActive: !1,
104
+ children: /* @__PURE__ */ s(u, {
105
+ contentStyle: t.tooltip.contentStyle,
106
+ formatter: (e, t) => [e, t]
107
+ })
108
+ })
61
109
  })
62
- })
110
+ })]
63
111
  })
64
- })]
65
- });
112
+ });
113
+ };
66
114
  //#endregion
67
- export { d as Treemap };
115
+ export { v as Treemap };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_bt6fn_3`,t=`_sm_bt6fn_12`,n=`_md_bt6fn_16`,r=`_lg_bt6fn_20`,i=`_disabled_bt6fn_24`,a=`_star_bt6fn_27`,o=`_foreground_bt6fn_30`,s=`_full_bt6fn_50`,c=`_half_bt6fn_53`,l=`_background_bt6fn_56`,u=`_icon_bt6fn_59`,d={root:e,sm:t,md:n,lg:r,disabled:i,star:a,foreground:o,full:s,half:c,background:l,icon:u};exports.background=l,exports.default=d,exports.disabled=i,exports.foreground=o,exports.full=s,exports.half=c,exports.icon=u,exports.lg=r,exports.md=n,exports.root=e,exports.sm=t,exports.star=a;
2
+ var e=`_root_1acjf_3`,t=`_sm_1acjf_17`,n=`_md_1acjf_21`,r=`_lg_1acjf_25`,i=`_disabled_1acjf_29`,a=`_star_1acjf_32`,o=`_foreground_1acjf_35`,s=`_full_1acjf_55`,c=`_half_1acjf_58`,l=`_background_1acjf_61`,u=`_icon_1acjf_64`,d={root:e,sm:t,md:n,lg:r,disabled:i,star:a,foreground:o,full:s,half:c,background:l,icon:u};exports.background=l,exports.default=d,exports.disabled=i,exports.foreground=o,exports.full=s,exports.half=c,exports.icon=u,exports.lg=r,exports.md=n,exports.root=e,exports.sm=t,exports.star=a;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/form/Rating/rating.module.scss
3
- var e = "_root_bt6fn_3", t = "_sm_bt6fn_12", n = "_md_bt6fn_16", r = "_lg_bt6fn_20", i = "_disabled_bt6fn_24", a = "_star_bt6fn_27", o = "_foreground_bt6fn_30", s = "_full_bt6fn_50", c = "_half_bt6fn_53", l = "_background_bt6fn_56", u = "_icon_bt6fn_59", d = {
3
+ var e = "_root_1acjf_3", t = "_sm_1acjf_17", n = "_md_1acjf_21", r = "_lg_1acjf_25", i = "_disabled_1acjf_29", a = "_star_1acjf_32", o = "_foreground_1acjf_35", s = "_full_1acjf_55", c = "_half_1acjf_58", l = "_background_1acjf_61", u = "_icon_1acjf_64", d = {
4
4
  root: e,
5
5
  sm: t,
6
6
  md: n,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_1u1o9_295`,t=`_disabled_1u1o9_303`,n=`_canvasContainer_1u1o9_307`,r=`_danger_1u1o9_286`,i=`_canvas_1u1o9_307`,a=`_footer_1u1o9_331`,o={"wim-docs-container":`_wim-docs-container_1u1o9_87`,"wim-t":`_wim-t_1u1o9_250`,"react-flow":`_react-flow_1u1o9_273`,"react-flow__edges":`_react-flow__edges_1u1o9_274`,"react-flow__connectionline":`_react-flow__connectionline_1u1o9_275`,root:e,disabled:t,canvasContainer:n,danger:r,canvas:i,footer:a};exports.canvas=i,exports.canvasContainer=n,exports.danger=r,exports.default=o,exports.disabled=t,exports.footer=a,exports.root=e;
2
+ var e=`_root_1hhrf_295`,t=`_disabled_1hhrf_313`,n=`_canvasContainer_1hhrf_317`,r=`_danger_1hhrf_286`,i=`_canvas_1hhrf_317`,a=`_footer_1hhrf_341`,o={"wim-docs-container":`_wim-docs-container_1hhrf_87`,"wim-t":`_wim-t_1hhrf_250`,"react-flow":`_react-flow_1hhrf_273`,"react-flow__edges":`_react-flow__edges_1hhrf_274`,"react-flow__connectionline":`_react-flow__connectionline_1hhrf_275`,root:e,disabled:t,canvasContainer:n,danger:r,canvas:i,footer:a};exports.canvas=i,exports.canvasContainer=n,exports.danger=r,exports.default=o,exports.disabled=t,exports.footer=a,exports.root=e;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  //#region src/components/form/SignaturePad/signature-pad.module.scss
3
- var e = "_root_1u1o9_295", t = "_disabled_1u1o9_303", n = "_canvasContainer_1u1o9_307", r = "_danger_1u1o9_286", i = "_canvas_1u1o9_307", a = "_footer_1u1o9_331", o = {
4
- "wim-docs-container": "_wim-docs-container_1u1o9_87",
5
- "wim-t": "_wim-t_1u1o9_250",
6
- "react-flow": "_react-flow_1u1o9_273",
7
- "react-flow__edges": "_react-flow__edges_1u1o9_274",
8
- "react-flow__connectionline": "_react-flow__connectionline_1u1o9_275",
3
+ var e = "_root_1hhrf_295", t = "_disabled_1hhrf_313", n = "_canvasContainer_1hhrf_317", r = "_danger_1hhrf_286", i = "_canvas_1hhrf_317", a = "_footer_1hhrf_341", o = {
4
+ "wim-docs-container": "_wim-docs-container_1hhrf_87",
5
+ "wim-t": "_wim-t_1hhrf_250",
6
+ "react-flow": "_react-flow_1hhrf_273",
7
+ "react-flow__edges": "_react-flow__edges_1hhrf_274",
8
+ "react-flow__connectionline": "_react-flow__connectionline_1hhrf_275",
9
9
  root: e,
10
10
  disabled: t,
11
11
  canvasContainer: n,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=[`var(--wim-color-chart-primary)`,`var(--wim-color-chart-info)`,`var(--wim-color-chart-success)`,`var(--wim-color-chart-warning)`,`var(--wim-color-chart-danger)`,`var(--wim-color-chart-secondary)`,`var(--wim-color-text-tertiary)`,`var(--wim-color-disabled)`],t=[`var(--wim-color-text-on-chart-primary)`,`var(--wim-color-text-on-chart-info)`,`var(--wim-color-text-on-chart-success)`,`var(--wim-color-text-on-chart-warning)`,`var(--wim-color-text-on-chart-danger)`,`var(--wim-color-text-on-chart-secondary)`,`var(--wim-color-text-primary)`,`var(--wim-color-text-primary)`],n={axis:{stroke:`var(--wim-color-text-disabled)`,fontSize:12},grid:{stroke:`var(--wim-color-border-secondary)`,strokeDasharray:`3 3`},tooltip:{contentStyle:{backgroundColor:`var(--wim-color-glass-bg)`,border:`1px solid var(--wim-color-glass-border)`,borderRadius:`var(--wim-radius-md)`,fontSize:`var(--wim-font-size-sm)`,backdropFilter:`blur(8px)`,color:`var(--wim-color-text-primary)`},cursor:{fill:`var(--wim-color-text-primary)`,stroke:`var(--wim-color-border)`,strokeWidth:1,fillOpacity:.05,strokeOpacity:.5}}};exports.CHART_COLORS=e,exports.CHART_TEXT_COLORS=t,exports.CHART_THEME=n;
2
+ var e=[`var(--wim-color-chart-primary)`,`var(--wim-color-chart-info)`,`var(--wim-color-chart-success)`,`var(--wim-color-chart-warning)`,`var(--wim-color-chart-danger)`,`var(--wim-color-chart-secondary)`,`var(--wim-color-text-tertiary)`,`var(--wim-color-disabled)`],t={axis:{stroke:`var(--wim-color-text-disabled)`,fontSize:12},grid:{stroke:`var(--wim-color-border-secondary)`,strokeDasharray:`3 3`},tooltip:{contentStyle:{backgroundColor:`var(--wim-color-glass-bg)`,border:`1px solid var(--wim-color-glass-border)`,borderRadius:`var(--wim-radius-md)`,fontSize:`var(--wim-font-size-sm)`,backdropFilter:`blur(8px)`,color:`var(--wim-color-text-primary)`},cursor:{fill:`var(--wim-color-text-primary)`,stroke:`var(--wim-color-border)`,strokeWidth:1,fillOpacity:.05,strokeOpacity:.5}}};exports.CHART_COLORS=e,exports.CHART_THEME=t;
@@ -33,3 +33,12 @@ export declare const CHART_THEME: {
33
33
  };
34
34
  };
35
35
  };
36
+ /**
37
+ * 軸の範囲(recharts の domain と同じ書き方)。T134 で追加。
38
+ * 0 起点が要るのは面積で比べる図(棒)だけで、折れ線や散布図は
39
+ * データに合わせたほうが差が読める。
40
+ */
41
+ export type ChartAxisDomain = [
42
+ number | "auto" | "dataMin" | (string & {}),
43
+ number | "auto" | "dataMax" | (string & {})
44
+ ];
@@ -9,16 +9,7 @@ var e = [
9
9
  "var(--wim-color-chart-secondary)",
10
10
  "var(--wim-color-text-tertiary)",
11
11
  "var(--wim-color-disabled)"
12
- ], t = [
13
- "var(--wim-color-text-on-chart-primary)",
14
- "var(--wim-color-text-on-chart-info)",
15
- "var(--wim-color-text-on-chart-success)",
16
- "var(--wim-color-text-on-chart-warning)",
17
- "var(--wim-color-text-on-chart-danger)",
18
- "var(--wim-color-text-on-chart-secondary)",
19
- "var(--wim-color-text-primary)",
20
- "var(--wim-color-text-primary)"
21
- ], n = {
12
+ ], t = {
22
13
  axis: {
23
14
  stroke: "var(--wim-color-text-disabled)",
24
15
  fontSize: 12
@@ -46,4 +37,4 @@ var e = [
46
37
  }
47
38
  };
48
39
  //#endregion
49
- export { e as CHART_COLORS, t as CHART_TEXT_COLORS, n as CHART_THEME };
40
+ export { e as CHART_COLORS, t as CHART_THEME };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/close.cjs"),r=require("../../../icon/edit.cjs"),i=require("../../../icon/plus.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("../../data-display/Card/Card.cjs"),s=require("../../form/Button/Button.cjs"),c=require("./dashboard.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=(0,l.createContext)(null),p=()=>{let e=(0,l.useContext)(f);if(!e)throw Error(`Dashboard subcomponents must be used within Dashboard`);return e},m=l.default.forwardRef(({widgets:e,editable:n,defaultEditable:o=!1,onEditChange:p,onRemove:m,onAdd:g,columns:_=3,gap:v=`md`,showEditToggle:y=!0,label:b,className:x,style:S,children:C,...w},T)=>{let{t:E}=t.useWimTranslation(`components`),D=n!==void 0,[O,k]=(0,l.useState)(o),A=D?n:O,j=(0,l.useCallback)(()=>{let e=!A;D||k(e),p?.(e)},[A,D,p]),M={"--dashboard-columns":_,...S},N=(0,l.useMemo)(()=>({editable:A??!1,onRemove:m}),[A,m]);return(0,d.jsx)(f.Provider,{value:N,children:(0,d.jsxs)(`div`,{ref:T,className:(0,u.default)(`wim-dashboard`,c.default.root,x),"aria-label":b??E(`dashboard_widget.label`),...w,children:[y&&(0,d.jsxs)(`div`,{className:c.default.header,children:[b&&(0,d.jsx)(`h2`,{className:c.default.heading,children:b}),(0,d.jsx)(s.Button,{size:`sm`,variant:A?`solid`:`outline`,intent:`default`,className:void 0,onClick:j,"aria-pressed":A,"aria-label":E(A?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`),icon:(0,d.jsx)(a.Icon,{component:r.default,size:`sm`}),children:E(A?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`)})]}),(0,d.jsxs)(`div`,{className:(0,u.default)(c.default.grid,c.default[`gap-${v}`]),style:M,role:`region`,"aria-label":E(`dashboard_widget.grid_label`),children:[e?e.map(e=>(0,d.jsx)(h,{widget:e},e.id)):C,A&&g&&(0,d.jsx)(s.Button,{asChild:!0,className:c.default.addButton,onClick:g,"aria-label":E(`dashboard_widget.add_widget`),children:(0,d.jsxs)(`button`,{type:`button`,children:[(0,d.jsx)(a.Icon,{component:i.default,size:`md`}),(0,d.jsx)(`span`,{children:E(`dashboard_widget.add_widget`)})]})})]})]})})});m.displayName=`Dashboard`;var h=({widget:e,className:r,...i})=>{let{editable:l,onRemove:f}=p(),{t:m}=t.useWimTranslation(`components`),{id:h,title:g,description:_,content:v,span:y=1,rowSpan:b=1}=e;return(0,d.jsxs)(o.Card,{variant:`outline`,padding:`md`,radius:`md`,className:(0,u.default)(c.default.widget,c.default[`span-${y}`],c.default[`row-${b}`],{[c.default.editMode]:l},r),style:{"--widget-span":y,"--widget-row-span":b},...i,children:[(0,d.jsxs)(`div`,{className:c.default.widgetHeader,children:[(0,d.jsxs)(`div`,{className:c.default.widgetMeta,children:[(0,d.jsx)(`h3`,{className:c.default.widgetTitle,children:g}),_&&(0,d.jsx)(`p`,{className:c.default.widgetDescription,children:_})]}),l&&f&&(0,d.jsx)(s.Button,{size:`sm`,variant:`ghost`,intent:`danger`,className:c.default.removeButton,onClick:()=>f(h),"aria-label":m(`dashboard_widget.remove_widget`,{title:g}),icon:(0,d.jsx)(a.Icon,{component:n.default,size:`sm`})})]}),(0,d.jsx)(`div`,{className:c.default.widgetContent,children:v})]})};h.displayName=`DashboardWidgetCard`,exports.Dashboard=m,exports.DashboardWidgetCard=h;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/close.cjs"),r=require("../../../icon/edit.cjs"),i=require("../../../icon/plus.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("../../data-display/Card/Card.cjs"),s=require("../../form/Button/Button.cjs"),c=require("./dashboard.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=(0,l.createContext)(null),p=()=>{let e=(0,l.useContext)(f);if(!e)throw Error(`Dashboard subcomponents must be used within Dashboard`);return e},m=l.default.forwardRef(({widgets:e,editable:n,defaultEditable:o=!1,onEditChange:p,onRemove:m,onAdd:g,columns:_=3,gap:v=`md`,showEditToggle:y,titleLevel:b=3,label:x,className:S,style:C,children:w,...T},E)=>{let{t:D}=t.useWimTranslation(`components`),O=n!==void 0,[k,A]=(0,l.useState)(o),j=O?n:k,M=(0,l.useCallback)(()=>{let e=!j;O||A(e),p?.(e)},[j,O,p]),N={"--dashboard-columns":_,...C},P=y??(n!==void 0||o||m!==void 0||g!==void 0),F=(0,l.useMemo)(()=>({editable:j??!1,onRemove:m,titleLevel:b}),[j,m,b]);return(0,d.jsx)(f.Provider,{value:F,children:(0,d.jsxs)(`div`,{ref:E,className:(0,u.default)(`wim-dashboard`,c.default.root,S),"aria-label":x??D(`dashboard_widget.label`),...T,children:[(x||P)&&(0,d.jsxs)(`div`,{className:c.default.header,children:[x&&(0,d.jsx)(`h2`,{className:c.default.heading,children:x}),P&&(0,d.jsx)(s.Button,{size:`sm`,variant:j?`solid`:`outline`,intent:`default`,className:void 0,onClick:M,"aria-pressed":j,"aria-label":D(j?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`),icon:(0,d.jsx)(a.Icon,{component:r.default,size:`sm`}),children:D(j?`dashboard_widget.exit_edit`:`dashboard_widget.enter_edit`)})]}),(0,d.jsxs)(`div`,{className:(0,u.default)(c.default.grid,c.default[`gap-${v}`]),style:N,role:`region`,"aria-label":D(`dashboard_widget.grid_label`),children:[e?e.map(e=>(0,d.jsx)(h,{widget:e},e.id)):w,j&&g&&(0,d.jsx)(s.Button,{asChild:!0,className:c.default.addButton,onClick:g,"aria-label":D(`dashboard_widget.add_widget`),children:(0,d.jsxs)(`button`,{type:`button`,children:[(0,d.jsx)(a.Icon,{component:i.default,size:`md`}),(0,d.jsx)(`span`,{children:D(`dashboard_widget.add_widget`)})]})})]})]})})});m.displayName=`Dashboard`;var h=({widget:e,className:r,...i})=>{let{editable:l,onRemove:f,titleLevel:m}=p(),h=`h${m}`,{t:g}=t.useWimTranslation(`components`),{id:_,title:v,description:y,content:b,span:x=1,rowSpan:S=1}=e;return(0,d.jsxs)(o.Card,{variant:`outline`,padding:`md`,radius:`md`,className:(0,u.default)(c.default.widget,c.default[`span-${x}`],c.default[`row-${S}`],{[c.default.editMode]:l},r),style:{"--widget-span":x,"--widget-row-span":S},...i,children:[(0,d.jsxs)(`div`,{className:c.default.widgetHeader,children:[(0,d.jsxs)(`div`,{className:c.default.widgetMeta,children:[(0,d.jsx)(h,{className:c.default.widgetTitle,children:v}),y&&(0,d.jsx)(`p`,{className:c.default.widgetDescription,children:y})]}),l&&f&&(0,d.jsx)(s.Button,{size:`sm`,variant:`ghost`,intent:`danger`,className:c.default.removeButton,onClick:()=>f(_),"aria-label":g(`dashboard_widget.remove_widget`,{title:v}),icon:(0,d.jsx)(a.Icon,{component:n.default,size:`sm`})})]}),(0,d.jsx)(`div`,{className:c.default.widgetContent,children:b})]})};h.displayName=`DashboardWidgetCard`,exports.Dashboard=m,exports.DashboardWidgetCard=h;