@tsiky/components-r19 1.6.97 → 1.6.99

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.
package/dist/chart.cjs.js CHANGED
@@ -967,4 +967,4 @@ Valid keys: `+JSON.stringify(Object.keys(z),null," "));var K=he(G,ae,N,$,W+"."+
967
967
  C${(e+i)/2},${t}
968
968
  ${(e+i)/2},${a}
969
969
  ${i},${a}
970
- `,h=o?.source?.fill??"#3b82f6",d=o?.target?.fill??"#ef4444",u=`sankey-gradient-${l}-${n}`;return F.jsxs(C.Layer,{children:[F.jsx("defs",{children:F.jsxs("linearGradient",{id:u,gradientUnits:"userSpaceOnUse",x1:e,x2:i,children:[F.jsx("stop",{offset:"0%",stopColor:h,stopOpacity:.2}),F.jsx("stop",{offset:"100%",stopColor:d,stopOpacity:.2})]})}),F.jsx("path",{d:c,fill:"none",stroke:`url(#${u})`,strokeWidth:Math.max(r,1),style:{transition:"all 0.4s ease"}})]})},zh=({data:s,height:e=600,nodePadding:t=30,showTooltip:i=!0,backgroundColor:a="#ffffff",fontSize:r="12px",fontWeight:n="400"})=>{const o=se.useId().replace(/:/g,""),l=se.useMemo(()=>({nodes:s.nodes.map(c=>({...c})),links:s.links.map(c=>({...c}))}),[s]);return F.jsx("div",{style:{width:"100%",height:e,backgroundColor:a,display:"flex",justifyContent:"center",alignItems:"center"},children:F.jsx("div",{style:{width:"100%",maxWidth:1200,height:"100%"},children:F.jsx(C.ResponsiveContainer,{width:"100%",height:"100%",children:F.jsx(Zr,{data:l,node:F.jsx(Th,{}),link:F.jsx(Rh,{uid:o}),nodePadding:t,fontSize:r,fontWeight:n,margin:{left:100,right:100,top:20,bottom:20},children:i&&F.jsx(C.Tooltip,{})})})})})},Dh=({data:s,colors:e,legendEnabled:t=!0,tooltipEnabled:i=!0,tooltipBackgroundColor:a="rgba(0, 0, 0, 0.8)",height:r=300,legendFontSize:n="12px",legendFontWeight:o="400",legendColor:l="#000"})=>{const[c,h]=se.useState(null),d=new Map(s.map((g,p)=>[g.name,p])),u=g=>{const p=(g.payload??[]).map(f=>({...f}));return p.sort((f,x)=>{const m=d.get(f.value)??999,v=d.get(x.value)??999;return m-v}),F.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:8,gap:16,flexWrap:"wrap"},children:p.map(f=>F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[F.jsx("div",{style:{width:12,height:12,backgroundColor:f.color,borderRadius:2}}),F.jsx("span",{style:{fontSize:n,fontWeight:o,color:l},children:f.value})]},Math.random()))})};return F.jsx(C.ResponsiveContainer,{width:"100%",height:r,children:F.jsxs(C.PieChart,{children:[F.jsx(C.Pie,{data:s,dataKey:"value",cx:"50%",cy:"45%",stroke:"none",outerRadius:100,innerRadius:0,paddingAngle:0,onMouseEnter:(g,p)=>h(p),onMouseLeave:()=>h(null),children:s.map((g,p)=>F.jsx(C.Cell,{fill:e[p%e.length],opacity:c===null||c===p?1:.5,style:{transition:"opacity 0.2s ease",cursor:"pointer"}},`cell-${p}`))}),i&&F.jsx(C.Tooltip,{contentStyle:{backgroundColor:a,border:"none",borderRadius:4,padding:"8px 12px"},formatter:g=>[g,"Patients"]}),t&&F.jsx(li,{content:u})]})})},Xh=({data:s,series:e,height:t=350,tooltipEnabled:i=!0,legendEnabled:a=!0,barSize:r=15,radius:n=2,yAxisWidth:o=35,yDomain:l})=>{const c=h=>{const{payload:d}=h;if(!d||d.length===0)return null;const u=[...d].sort((g,p)=>{const f=e.findIndex(m=>m.name===g.value||m.key===g.dataKey),x=e.findIndex(m=>m.name===p.value||m.key===p.dataKey);return f-x});return F.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"20px",marginTop:"20px",flexWrap:"wrap"},children:u.map((g,p)=>F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[F.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:g.color,borderRadius:"2px"}}),F.jsx("span",{style:{fontSize:"12px",color:"#666"},children:g.value})]},`item-${p}`))})};return F.jsx("div",{style:{width:"100%",height:t},children:F.jsx(C.ResponsiveContainer,{width:"100%",height:"100%",children:F.jsxs(C.BarChart,{data:s,margin:{top:20,right:0,left:0,bottom:0},children:[F.jsx(C.CartesianGrid,{strokeDasharray:"0",vertical:!1,stroke:"#f1f5f9"}),F.jsx(C.XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#64748b"},dy:10}),F.jsx(C.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#64748b"},width:o,domain:l}),i&&F.jsx(C.Tooltip,{cursor:{fill:"#f1f5f9",opacity:.4},contentStyle:{backgroundColor:"#ffffff",border:"1px solid #f1f5f9",borderRadius:"8px",padding:"10px",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)"},labelStyle:{color:"#1e293b",fontWeight:"bold",marginBottom:"5px",fontSize:"14px"},itemStyle:{fontSize:"12px",padding:"2px 0"},itemSorter:h=>e.findIndex(u=>u.name===h.name)}),a&&F.jsx(li,{content:c}),e.map((h,d)=>{const u=d===e.length-1;return F.jsx(C.Bar,{dataKey:h.key,name:h.name,stackId:"a",fill:h.color,barSize:r,radius:u?[n,n,0,0]:0},h.key)})]})})})};exports.PeriodRange=C.PeriodRange;exports.SimpleBarChart=C.SimpleBarChart;exports.Area=Sh;exports.AreaChartV2=Oh;exports.BoxPlotChart=Ph;exports.ChartV2=Mh;exports.HorizontalBarChart=Ch;exports.PieChartV2=Dh;exports.SankeyChartV2=zh;exports.StackedBarChartV2=Xh;
970
+ `,h=o?.source?.fill??"#3b82f6",d=o?.target?.fill??"#ef4444",u=`sankey-gradient-${l}-${n}`;return F.jsxs(C.Layer,{children:[F.jsx("defs",{children:F.jsxs("linearGradient",{id:u,gradientUnits:"userSpaceOnUse",x1:e,x2:i,children:[F.jsx("stop",{offset:"0%",stopColor:h,stopOpacity:.2}),F.jsx("stop",{offset:"100%",stopColor:d,stopOpacity:.2})]})}),F.jsx("path",{d:c,fill:"none",stroke:`url(#${u})`,strokeWidth:Math.max(r,1),style:{transition:"all 0.4s ease"}})]})},zh=({data:s,height:e=600,nodePadding:t=30,showTooltip:i=!0,backgroundColor:a="#ffffff",fontSize:r="12px",fontWeight:n="400"})=>{const o=se.useId().replace(/:/g,""),l=se.useMemo(()=>({nodes:s.nodes.map(c=>({...c})),links:s.links.map(c=>({...c}))}),[s]);return F.jsx("div",{style:{width:"100%",height:e,backgroundColor:a,display:"flex",justifyContent:"center",alignItems:"center"},children:F.jsx("div",{style:{width:"100%",maxWidth:1200,height:"100%"},children:F.jsx(C.ResponsiveContainer,{width:"100%",height:"100%",children:F.jsx(Zr,{data:l,node:F.jsx(Th,{}),link:F.jsx(Rh,{uid:o}),nodePadding:t,fontSize:r,fontWeight:n,margin:{left:100,right:100,top:20,bottom:20},children:i&&F.jsx(C.Tooltip,{})})})})})},Dh=({data:s,colors:e,legendEnabled:t=!0,tooltipEnabled:i=!0,tooltipBackgroundColor:a="rgba(0, 0, 0, 0.8)",height:r=300,legendFontSize:n="12px",legendFontWeight:o="400",legendColor:l="#000"})=>{const[c,h]=se.useState(null),d=new Map(s.map((g,p)=>[g.name,p])),u=g=>{const p=(g.payload??[]).map(f=>({...f}));return p.sort((f,x)=>{const m=d.get(f.value)??999,v=d.get(x.value)??999;return m-v}),F.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:8,gap:16,flexWrap:"wrap"},children:p.map(f=>F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[F.jsx("div",{style:{width:12,height:12,backgroundColor:f.color,borderRadius:2}}),F.jsx("span",{style:{fontSize:n,fontWeight:o,color:l},children:f.value})]},Math.random()))})};return F.jsx(C.ResponsiveContainer,{width:"100%",height:r,children:F.jsxs(C.PieChart,{children:[F.jsx(C.Pie,{data:s,dataKey:"value",cx:"50%",cy:"45%",stroke:"none",outerRadius:100,innerRadius:0,paddingAngle:0,onMouseEnter:(g,p)=>h(p),onMouseLeave:()=>h(null),children:s.map((g,p)=>F.jsx(C.Cell,{fill:e[p%e.length],opacity:c===null||c===p?1:.5,style:{transition:"opacity 0.2s ease",cursor:"pointer"}},`cell-${p}`))}),i&&F.jsx(C.Tooltip,{contentStyle:{backgroundColor:a,border:"none",borderRadius:4,padding:"8px 12px"},formatter:g=>[g,"Patients"]}),t&&F.jsx(li,{content:u})]})})},Xh=({data:s,series:e,height:t=350,tooltipEnabled:i=!0,legendEnabled:a=!0,barSize:r=15,radius:n=2,yAxisWidth:o=35,yDomain:l,reverseStack:c=!1})=>{const h=d=>{const{payload:u}=d;if(!u||u.length===0)return null;const g=[...u].sort((p,f)=>{const x=e.findIndex(v=>v.name===p.value||v.key===p.dataKey),m=e.findIndex(v=>v.name===f.value||v.key===f.dataKey);return x-m});return F.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"20px",marginTop:"20px",flexWrap:"wrap"},children:g.map((p,f)=>F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[F.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:p.color,borderRadius:"2px"}}),F.jsx("span",{style:{fontSize:"12px",color:"#666"},children:p.value})]},`item-${f}`))})};return F.jsx("div",{style:{width:"100%",height:t},children:F.jsx(C.ResponsiveContainer,{width:"100%",height:"100%",children:F.jsxs(C.BarChart,{data:s,margin:{top:20,right:0,left:0,bottom:0},children:[F.jsx(C.CartesianGrid,{strokeDasharray:"0",vertical:!1,stroke:"#f1f5f9"}),F.jsx(C.XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#64748b"},dy:10}),F.jsx(C.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#64748b"},width:o,domain:l}),i&&F.jsx(C.Tooltip,{cursor:{fill:"#f1f5f9",opacity:.4},contentStyle:{backgroundColor:"#ffffff",border:"1px solid #f1f5f9",borderRadius:"8px",padding:"10px",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)"},labelStyle:{color:"#1e293b",fontWeight:"bold",marginBottom:"5px",fontSize:"14px"},itemStyle:{fontSize:"12px",padding:"2px 0"},itemSorter:d=>-e.findIndex(g=>g.name===d.name)}),a&&F.jsx(li,{content:h}),(()=>{const d=c?[...e].reverse():e;return d.map((u,g)=>{const p=g===d.length-1;return F.jsx(C.Bar,{dataKey:u.key,name:u.name,stackId:"a",fill:u.color,barSize:r,radius:p?[n,n,0,0]:0},u.key)})})()]})})})};exports.PeriodRange=C.PeriodRange;exports.SimpleBarChart=C.SimpleBarChart;exports.Area=Sh;exports.AreaChartV2=Oh;exports.BoxPlotChart=Ph;exports.ChartV2=Mh;exports.HorizontalBarChart=Ch;exports.PieChartV2=Dh;exports.SankeyChartV2=zh;exports.StackedBarChartV2=Xh;
package/dist/chart.js CHANGED
@@ -15911,7 +15911,8 @@ const Or = /* @__PURE__ */ qa(Du), Xu = ["#e24b33", "#e2b23a", "#6feff0", "#2f5b
15911
15911
  barSize: r = 15,
15912
15912
  radius: n = 2,
15913
15913
  yAxisWidth: o = 35,
15914
- yDomain: l
15914
+ yDomain: l,
15915
+ reverseStack: c = !1
15915
15916
  }) => /* @__PURE__ */ N("div", { style: { width: "100%", height: t }, children: /* @__PURE__ */ N(Pt, { width: "100%", height: "100%", children: /* @__PURE__ */ pe(
15916
15917
  al,
15917
15918
  {
@@ -15965,15 +15966,15 @@ const Or = /* @__PURE__ */ qa(Du), Xu = ["#e24b33", "#e2b23a", "#6feff0", "#2f5b
15965
15966
  fontSize: "12px",
15966
15967
  padding: "2px 0"
15967
15968
  },
15968
- itemSorter: (h) => e.findIndex((u) => u.name === h.name)
15969
+ itemSorter: (d) => -e.findIndex((g) => g.name === d.name)
15969
15970
  }
15970
15971
  ),
15971
- a && /* @__PURE__ */ N(Fi, { content: (h) => {
15972
- const { payload: d } = h;
15973
- if (!d || d.length === 0) return null;
15974
- const u = [...d].sort((g, p) => {
15975
- const f = e.findIndex((m) => m.name === g.value || m.key === g.dataKey), x = e.findIndex((m) => m.name === p.value || m.key === p.dataKey);
15976
- return f - x;
15972
+ a && /* @__PURE__ */ N(Fi, { content: (d) => {
15973
+ const { payload: u } = d;
15974
+ if (!u || u.length === 0) return null;
15975
+ const g = [...u].sort((p, f) => {
15976
+ const x = e.findIndex((v) => v.name === p.value || v.key === p.dataKey), m = e.findIndex((v) => v.name === f.value || v.key === f.dataKey);
15977
+ return x - m;
15977
15978
  });
15978
15979
  return /* @__PURE__ */ N(
15979
15980
  "div",
@@ -15985,38 +15986,41 @@ const Or = /* @__PURE__ */ qa(Du), Xu = ["#e24b33", "#e2b23a", "#6feff0", "#2f5b
15985
15986
  marginTop: "20px",
15986
15987
  flexWrap: "wrap"
15987
15988
  },
15988
- children: u.map((g, p) => /* @__PURE__ */ pe("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
15989
+ children: g.map((p, f) => /* @__PURE__ */ pe("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
15989
15990
  /* @__PURE__ */ N(
15990
15991
  "div",
15991
15992
  {
15992
15993
  style: {
15993
15994
  width: "12px",
15994
15995
  height: "12px",
15995
- backgroundColor: g.color,
15996
+ backgroundColor: p.color,
15996
15997
  borderRadius: "2px"
15997
15998
  }
15998
15999
  }
15999
16000
  ),
16000
- /* @__PURE__ */ N("span", { style: { fontSize: "12px", color: "#666" }, children: g.value })
16001
- ] }, `item-${p}`))
16001
+ /* @__PURE__ */ N("span", { style: { fontSize: "12px", color: "#666" }, children: p.value })
16002
+ ] }, `item-${f}`))
16002
16003
  }
16003
16004
  );
16004
16005
  } }),
16005
- e.map((h, d) => {
16006
- const u = d === e.length - 1;
16007
- return /* @__PURE__ */ N(
16008
- Aa,
16009
- {
16010
- dataKey: h.key,
16011
- name: h.name,
16012
- stackId: "a",
16013
- fill: h.color,
16014
- barSize: r,
16015
- radius: u ? [n, n, 0, 0] : 0
16016
- },
16017
- h.key
16018
- );
16019
- })
16006
+ (() => {
16007
+ const d = c ? [...e].reverse() : e;
16008
+ return d.map((u, g) => {
16009
+ const p = g === d.length - 1;
16010
+ return /* @__PURE__ */ N(
16011
+ Aa,
16012
+ {
16013
+ dataKey: u.key,
16014
+ name: u.name,
16015
+ stackId: "a",
16016
+ fill: u.color,
16017
+ barSize: r,
16018
+ radius: p ? [n, n, 0, 0] : 0
16019
+ },
16020
+ u.key
16021
+ );
16022
+ });
16023
+ })()
16020
16024
  ]
16021
16025
  }
16022
16026
  ) }) });
@@ -18,6 +18,7 @@ export interface StackedBarChartV2Props {
18
18
  radius?: number | [number, number, number, number];
19
19
  yAxisWidth?: number;
20
20
  yDomain?: [number, number] | [string, string] | [(value: number) => number, (value: number) => number];
21
+ reverseStack?: boolean;
21
22
  }
22
23
  export declare const StackedBarChartV2: React.FC<StackedBarChartV2Props>;
23
24
  export default StackedBarChartV2;
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBarChartV2.d.ts","sourceRoot":"","sources":["../../../../../src/components/Charts/stacked-bar-v2/StackedBarChartV2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EACJ,CAAC,MAAM,EAAE,MAAM,CAAC,GAChB,CAAC,MAAM,EAAE,MAAM,CAAC,GAChB,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;CAC5D;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4H9D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"StackedBarChartV2.d.ts","sourceRoot":"","sources":["../../../../../src/components/Charts/stacked-bar-v2/StackedBarChartV2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EACJ,CAAC,MAAM,EAAE,MAAM,CAAC,GAChB,CAAC,MAAM,EAAE,MAAM,CAAC,GAChB,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA8H9D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsiky/components-r19",
3
- "version": "1.6.97",
3
+ "version": "1.6.99",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",