@petal-nexus/toolkit 0.1.0 → 0.1.1

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 (186) hide show
  1. package/README.md +31 -12
  2. package/dist/petal-toolkit.cjs10.js +1 -1
  3. package/dist/petal-toolkit.cjs11.js +1 -1
  4. package/dist/petal-toolkit.cjs1123.js +1 -1
  5. package/dist/petal-toolkit.cjs1125.js +1 -1
  6. package/dist/petal-toolkit.cjs1128.js +1 -1
  7. package/dist/petal-toolkit.cjs12.js +1 -1
  8. package/dist/petal-toolkit.cjs13.js +1 -1
  9. package/dist/petal-toolkit.cjs1320.js +1 -1
  10. package/dist/petal-toolkit.cjs1320.js.map +1 -1
  11. package/dist/petal-toolkit.cjs1321.js +1 -1
  12. package/dist/petal-toolkit.cjs1321.js.map +1 -1
  13. package/dist/petal-toolkit.cjs1322.js +1 -2
  14. package/dist/petal-toolkit.cjs1322.js.map +1 -1
  15. package/dist/petal-toolkit.cjs1325.js +1 -1
  16. package/dist/petal-toolkit.cjs1327.js +1 -1
  17. package/dist/petal-toolkit.cjs1328.js +1 -1
  18. package/dist/petal-toolkit.cjs1329.js +1 -1
  19. package/dist/petal-toolkit.cjs1329.js.map +1 -1
  20. package/dist/petal-toolkit.cjs1330.js +1 -1
  21. package/dist/petal-toolkit.cjs1330.js.map +1 -1
  22. package/dist/petal-toolkit.cjs1331.js +2 -1
  23. package/dist/petal-toolkit.cjs1331.js.map +1 -1
  24. package/dist/petal-toolkit.cjs1332.js +1 -1
  25. package/dist/petal-toolkit.cjs1332.js.map +1 -1
  26. package/dist/petal-toolkit.cjs1333.js +1 -1
  27. package/dist/petal-toolkit.cjs1333.js.map +1 -1
  28. package/dist/petal-toolkit.cjs1334.js +1 -1
  29. package/dist/petal-toolkit.cjs1334.js.map +1 -1
  30. package/dist/petal-toolkit.cjs1335.js +1 -1
  31. package/dist/petal-toolkit.cjs1346.js +1 -1
  32. package/dist/petal-toolkit.cjs1347.js +1 -1
  33. package/dist/petal-toolkit.cjs1348.js +1 -1
  34. package/dist/petal-toolkit.cjs14.js +1 -1
  35. package/dist/petal-toolkit.cjs15.js +1 -1
  36. package/dist/petal-toolkit.cjs18.js +1 -1
  37. package/dist/petal-toolkit.cjs19.js +1 -1
  38. package/dist/petal-toolkit.cjs22.js +1 -1
  39. package/dist/petal-toolkit.cjs24.js +1 -1
  40. package/dist/petal-toolkit.cjs25.js +1 -1
  41. package/dist/petal-toolkit.cjs26.js +1 -1
  42. package/dist/petal-toolkit.cjs27.js +1 -1
  43. package/dist/petal-toolkit.cjs30.js +1 -1
  44. package/dist/petal-toolkit.cjs31.js +1 -1
  45. package/dist/petal-toolkit.cjs32.js +1 -1
  46. package/dist/petal-toolkit.cjs34.js +1 -1
  47. package/dist/petal-toolkit.cjs35.js +1 -1
  48. package/dist/petal-toolkit.cjs36.js +1 -1
  49. package/dist/petal-toolkit.cjs37.js +1 -1
  50. package/dist/petal-toolkit.cjs38.js +1 -1
  51. package/dist/petal-toolkit.cjs4.js +1 -1
  52. package/dist/petal-toolkit.cjs40.js +1 -1
  53. package/dist/petal-toolkit.cjs41.js +1 -1
  54. package/dist/petal-toolkit.cjs42.js +1 -1
  55. package/dist/petal-toolkit.cjs43.js +1 -1
  56. package/dist/petal-toolkit.cjs44.js +1 -1
  57. package/dist/petal-toolkit.cjs45.js +1 -1
  58. package/dist/petal-toolkit.cjs47.js +1 -1
  59. package/dist/petal-toolkit.cjs48.js +1 -1
  60. package/dist/petal-toolkit.cjs5.js +1 -1
  61. package/dist/petal-toolkit.cjs50.js +1 -1
  62. package/dist/petal-toolkit.cjs52.js +1 -1
  63. package/dist/petal-toolkit.cjs6.js +1 -1
  64. package/dist/petal-toolkit.cjs682.js +1 -1
  65. package/dist/petal-toolkit.cjs684.js +1 -1
  66. package/dist/petal-toolkit.cjs7.js +1 -1
  67. package/dist/petal-toolkit.cjs715.js +1 -1
  68. package/dist/petal-toolkit.cjs719.js +1 -1
  69. package/dist/petal-toolkit.cjs721.js +1 -1
  70. package/dist/petal-toolkit.cjs726.js +1 -1
  71. package/dist/petal-toolkit.cjs734.js +1 -1
  72. package/dist/petal-toolkit.cjs752.js +1 -1
  73. package/dist/petal-toolkit.cjs764.js +1 -1
  74. package/dist/petal-toolkit.cjs787.js +1 -1
  75. package/dist/petal-toolkit.cjs8.js +1 -1
  76. package/dist/petal-toolkit.cjs847.js +1 -1
  77. package/dist/petal-toolkit.cjs848.js +1 -1
  78. package/dist/petal-toolkit.cjs850.js +1 -1
  79. package/dist/petal-toolkit.cjs851.js +1 -1
  80. package/dist/petal-toolkit.cjs854.js +1 -1
  81. package/dist/petal-toolkit.cjs859.js +1 -1
  82. package/dist/petal-toolkit.cjs861.js +1 -1
  83. package/dist/petal-toolkit.cjs864.js +1 -1
  84. package/dist/petal-toolkit.cjs866.js +1 -1
  85. package/dist/petal-toolkit.cjs867.js +1 -1
  86. package/dist/petal-toolkit.cjs868.js +1 -1
  87. package/dist/petal-toolkit.cjs870.js +1 -1
  88. package/dist/petal-toolkit.cjs874.js +1 -1
  89. package/dist/petal-toolkit.cjs9.js +1 -1
  90. package/dist/petal-toolkit.es10.js +3 -3
  91. package/dist/petal-toolkit.es11.js +3 -3
  92. package/dist/petal-toolkit.es1123.js +1 -1
  93. package/dist/petal-toolkit.es1125.js +1 -1
  94. package/dist/petal-toolkit.es1128.js +1 -1
  95. package/dist/petal-toolkit.es12.js +3 -3
  96. package/dist/petal-toolkit.es13.js +2 -2
  97. package/dist/petal-toolkit.es1320.js +2 -34
  98. package/dist/petal-toolkit.es1320.js.map +1 -1
  99. package/dist/petal-toolkit.es1321.js +2 -52
  100. package/dist/petal-toolkit.es1321.js.map +1 -1
  101. package/dist/petal-toolkit.es1322.js +2 -48
  102. package/dist/petal-toolkit.es1322.js.map +1 -1
  103. package/dist/petal-toolkit.es1324.js +2 -2
  104. package/dist/petal-toolkit.es1325.js +2 -2
  105. package/dist/petal-toolkit.es1326.js +2 -2
  106. package/dist/petal-toolkit.es1327.js +2 -2
  107. package/dist/petal-toolkit.es1328.js +2 -2
  108. package/dist/petal-toolkit.es1329.js +52 -2
  109. package/dist/petal-toolkit.es1329.js.map +1 -1
  110. package/dist/petal-toolkit.es1330.js +95 -2
  111. package/dist/petal-toolkit.es1330.js.map +1 -1
  112. package/dist/petal-toolkit.es1331.js +48 -2
  113. package/dist/petal-toolkit.es1331.js.map +1 -1
  114. package/dist/petal-toolkit.es1332.js +34 -17
  115. package/dist/petal-toolkit.es1332.js.map +1 -1
  116. package/dist/petal-toolkit.es1333.js +2 -95
  117. package/dist/petal-toolkit.es1333.js.map +1 -1
  118. package/dist/petal-toolkit.es1334.js +17 -2
  119. package/dist/petal-toolkit.es1334.js.map +1 -1
  120. package/dist/petal-toolkit.es1335.js +2 -2
  121. package/dist/petal-toolkit.es1338.js +2 -2
  122. package/dist/petal-toolkit.es1339.js +2 -2
  123. package/dist/petal-toolkit.es1340.js +2 -2
  124. package/dist/petal-toolkit.es1341.js +2 -2
  125. package/dist/petal-toolkit.es1343.js +2 -2
  126. package/dist/petal-toolkit.es1344.js +2 -2
  127. package/dist/petal-toolkit.es1346.js +2 -2
  128. package/dist/petal-toolkit.es1347.js +2 -2
  129. package/dist/petal-toolkit.es1348.js +2 -2
  130. package/dist/petal-toolkit.es14.js +2 -2
  131. package/dist/petal-toolkit.es15.js +2 -2
  132. package/dist/petal-toolkit.es18.js +3 -3
  133. package/dist/petal-toolkit.es19.js +3 -3
  134. package/dist/petal-toolkit.es22.js +2 -2
  135. package/dist/petal-toolkit.es24.js +2 -2
  136. package/dist/petal-toolkit.es25.js +2 -2
  137. package/dist/petal-toolkit.es26.js +2 -2
  138. package/dist/petal-toolkit.es27.js +3 -3
  139. package/dist/petal-toolkit.es30.js +1 -1
  140. package/dist/petal-toolkit.es31.js +2 -2
  141. package/dist/petal-toolkit.es32.js +2 -2
  142. package/dist/petal-toolkit.es34.js +2 -2
  143. package/dist/petal-toolkit.es35.js +1 -1
  144. package/dist/petal-toolkit.es36.js +2 -2
  145. package/dist/petal-toolkit.es37.js +2 -2
  146. package/dist/petal-toolkit.es38.js +1 -1
  147. package/dist/petal-toolkit.es4.js +2 -2
  148. package/dist/petal-toolkit.es40.js +2 -2
  149. package/dist/petal-toolkit.es41.js +2 -2
  150. package/dist/petal-toolkit.es42.js +2 -2
  151. package/dist/petal-toolkit.es43.js +2 -2
  152. package/dist/petal-toolkit.es44.js +3 -3
  153. package/dist/petal-toolkit.es45.js +2 -2
  154. package/dist/petal-toolkit.es47.js +2 -2
  155. package/dist/petal-toolkit.es48.js +1 -1
  156. package/dist/petal-toolkit.es5.js +2 -2
  157. package/dist/petal-toolkit.es50.js +1 -1
  158. package/dist/petal-toolkit.es52.js +2 -2
  159. package/dist/petal-toolkit.es6.js +3 -3
  160. package/dist/petal-toolkit.es682.js +1 -1
  161. package/dist/petal-toolkit.es684.js +1 -1
  162. package/dist/petal-toolkit.es7.js +2 -2
  163. package/dist/petal-toolkit.es715.js +1 -1
  164. package/dist/petal-toolkit.es719.js +1 -1
  165. package/dist/petal-toolkit.es721.js +1 -1
  166. package/dist/petal-toolkit.es726.js +1 -1
  167. package/dist/petal-toolkit.es734.js +1 -1
  168. package/dist/petal-toolkit.es752.js +1 -1
  169. package/dist/petal-toolkit.es764.js +1 -1
  170. package/dist/petal-toolkit.es787.js +1 -1
  171. package/dist/petal-toolkit.es8.js +1 -1
  172. package/dist/petal-toolkit.es847.js +1 -1
  173. package/dist/petal-toolkit.es848.js +1 -1
  174. package/dist/petal-toolkit.es850.js +1 -1
  175. package/dist/petal-toolkit.es851.js +1 -1
  176. package/dist/petal-toolkit.es854.js +1 -1
  177. package/dist/petal-toolkit.es859.js +1 -1
  178. package/dist/petal-toolkit.es861.js +1 -1
  179. package/dist/petal-toolkit.es864.js +1 -1
  180. package/dist/petal-toolkit.es866.js +1 -1
  181. package/dist/petal-toolkit.es867.js +1 -1
  182. package/dist/petal-toolkit.es868.js +1 -1
  183. package/dist/petal-toolkit.es870.js +1 -1
  184. package/dist/petal-toolkit.es874.js +1 -1
  185. package/dist/petal-toolkit.es9.js +3 -3
  186. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),y=require("react"),B=require("./petal-toolkit.cjs59.js"),E=require("./petal-toolkit.cjs1321.js"),p=require("./petal-toolkit.cjs55.js"),C=require("./petal-toolkit.cjs1333.js"),g=require("./petal-toolkit.cjs1322.js"),d=require("./petal-toolkit.cjs58.js");function j(x){switch(x){case"light":return{capexColor:"#3b82f6",depreciationColor:"#f97316",netColor:"#16a34a"};case"navy":return{capexColor:"#60a5fa",depreciationColor:"#fb923c",netColor:"#10b981"};case"dark":default:return{capexColor:"#3B82F6",depreciationColor:"#FFA502",netColor:"#00FFB3"}}}const I=y.memo(function({data:t,width:q="100%",height:D=400,className:v,themePreset:m="dark",theme:V,showLegend:f=!0,showNetInvestment:h=!0,onChartReady:i}){const{containerId:s,containerRef:F,surfaceRef:c,sciChartTheme:b,baseColors:o,containerStyle:k}=E.useFinancialChartSetup({chartName:"capex-depreciation",width:q,height:D,themePreset:m,customTheme:V}),n=j(m);return y.useEffect(()=>{if(!F.current||t.length===0)return;let S=!1;return(async()=>{try{const l=t.map(e=>e.period),u=t.map((e,A)=>A),{sciChartSurface:r,wasmContext:a}=await B.scichartExports.SciChartSurface.create(s,{theme:b});if(S){r.delete();return}c.current=r,r.xAxes.add(p.createCategoryXAxis(a,{labelColor:o.axisLabelColor,labels:l})),r.yAxes.add(p.createNumericYAxis(a,{labelColor:o.axisLabelColor,gridColor:o.gridColor,labelFormatter:p.labelFormatters.currency})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e-.15),yValues:t.map(e=>e.capex),name:"CapEx",color:n.capexColor,dataPointWidth:.3})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e+.15),yValues:t.map(e=>e.depreciation),name:"Depreciation",color:n.depreciationColor,dataPointWidth:.3})),h&&r.renderableSeries.add(C.createLineSeries(a,{xValues:u,yValues:t.map(e=>e.netInvestment??e.capex-e.depreciation),name:"Net Investment",color:n.netColor,strokeThickness:2,pointMarker:{size:6}})),g.addStandardModifiers(r,{crosshairColor:o.crosshairColor,valueFormatters:{CapEx:d.tooltipFormatters.currency,Depreciation:d.tooltipFormatters.currency,"Net Investment":d.tooltipFormatters.currency}}),f&&g.addLegendModifier(r),i==null||i(r)}catch(l){console.error("Failed to initialize CapexDepreciationChart:",l)}})(),()=>{S=!0,c.current&&(c.current.delete(),c.current=null)}},[t,s,b,o,n,f,h,i]),M.jsx("div",{ref:F,id:s,className:v,style:k})});exports.CapexDepreciationChart=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),y=require("react"),B=require("./petal-toolkit.cjs59.js"),E=require("./petal-toolkit.cjs1329.js"),p=require("./petal-toolkit.cjs55.js"),C=require("./petal-toolkit.cjs1330.js"),g=require("./petal-toolkit.cjs1331.js"),d=require("./petal-toolkit.cjs58.js");function j(x){switch(x){case"light":return{capexColor:"#3b82f6",depreciationColor:"#f97316",netColor:"#16a34a"};case"navy":return{capexColor:"#60a5fa",depreciationColor:"#fb923c",netColor:"#10b981"};case"dark":default:return{capexColor:"#3B82F6",depreciationColor:"#FFA502",netColor:"#00FFB3"}}}const I=y.memo(function({data:t,width:q="100%",height:D=400,className:v,themePreset:m="dark",theme:V,showLegend:f=!0,showNetInvestment:h=!0,onChartReady:i}){const{containerId:s,containerRef:F,surfaceRef:c,sciChartTheme:b,baseColors:o,containerStyle:k}=E.useFinancialChartSetup({chartName:"capex-depreciation",width:q,height:D,themePreset:m,customTheme:V}),n=j(m);return y.useEffect(()=>{if(!F.current||t.length===0)return;let S=!1;return(async()=>{try{const l=t.map(e=>e.period),u=t.map((e,A)=>A),{sciChartSurface:r,wasmContext:a}=await B.scichartExports.SciChartSurface.create(s,{theme:b});if(S){r.delete();return}c.current=r,r.xAxes.add(p.createCategoryXAxis(a,{labelColor:o.axisLabelColor,labels:l})),r.yAxes.add(p.createNumericYAxis(a,{labelColor:o.axisLabelColor,gridColor:o.gridColor,labelFormatter:p.labelFormatters.currency})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e-.15),yValues:t.map(e=>e.capex),name:"CapEx",color:n.capexColor,dataPointWidth:.3})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e+.15),yValues:t.map(e=>e.depreciation),name:"Depreciation",color:n.depreciationColor,dataPointWidth:.3})),h&&r.renderableSeries.add(C.createLineSeries(a,{xValues:u,yValues:t.map(e=>e.netInvestment??e.capex-e.depreciation),name:"Net Investment",color:n.netColor,strokeThickness:2,pointMarker:{size:6}})),g.addStandardModifiers(r,{crosshairColor:o.crosshairColor,valueFormatters:{CapEx:d.tooltipFormatters.currency,Depreciation:d.tooltipFormatters.currency,"Net Investment":d.tooltipFormatters.currency}}),f&&g.addLegendModifier(r),i==null||i(r)}catch(l){console.error("Failed to initialize CapexDepreciationChart:",l)}})(),()=>{S=!0,c.current&&(c.current.delete(),c.current=null)}},[t,s,b,o,n,f,h,i]),M.jsx("div",{ref:F,id:s,className:v,style:k})});exports.CapexDepreciationChart=I;
2
2
  //# sourceMappingURL=petal-toolkit.cjs9.js.map
@@ -1,10 +1,10 @@
1
1
  import { jsx as q } from "react/jsx-runtime";
2
2
  import { memo as D, useEffect as V } from "react";
3
3
  import { s as B } from "./petal-toolkit.es59.js";
4
- import { useFinancialChartSetup as E } from "./petal-toolkit.es1321.js";
4
+ import { useFinancialChartSetup as E } from "./petal-toolkit.es1329.js";
5
5
  import { createCategoryXAxis as R, createNumericYAxis as w, labelFormatters as I } from "./petal-toolkit.es55.js";
6
- import { createStackedCollection as L } from "./petal-toolkit.es1333.js";
7
- import { addStandardModifiers as M, addLegendModifier as N } from "./petal-toolkit.es1322.js";
6
+ import { createStackedCollection as L } from "./petal-toolkit.es1330.js";
7
+ import { addStandardModifiers as M, addLegendModifier as N } from "./petal-toolkit.es1331.js";
8
8
  import { tooltipFormatters as c } from "./petal-toolkit.es58.js";
9
9
  function j(C) {
10
10
  switch (C) {
@@ -1,10 +1,10 @@
1
1
  import { jsx as A } from "react/jsx-runtime";
2
2
  import { memo as E, useEffect as L } from "react";
3
3
  import { s as k } from "./petal-toolkit.es59.js";
4
- import { useFinancialChartSetup as v } from "./petal-toolkit.es1321.js";
4
+ import { useFinancialChartSetup as v } from "./petal-toolkit.es1329.js";
5
5
  import { createCategoryXAxis as V, createNumericYAxis as w, labelFormatters as I } from "./petal-toolkit.es55.js";
6
- import { createStackedCollection as M } from "./petal-toolkit.es1333.js";
7
- import { addStandardModifiers as N, addLegendModifier as P } from "./petal-toolkit.es1322.js";
6
+ import { createStackedCollection as M } from "./petal-toolkit.es1330.js";
7
+ import { addStandardModifiers as N, addLegendModifier as P } from "./petal-toolkit.es1331.js";
8
8
  import { tooltipFormatters as b } from "./petal-toolkit.es58.js";
9
9
  function j(u) {
10
10
  switch (u) {
@@ -1,4 +1,4 @@
1
- import { __exports as L } from "./petal-toolkit.es1354.js";
1
+ import { __exports as L } from "./petal-toolkit.es1357.js";
2
2
  var _;
3
3
  function n() {
4
4
  return _ ? L : (_ = 1, (function(T) {
@@ -1,4 +1,4 @@
1
- import { __exports as r } from "./petal-toolkit.es1357.js";
1
+ import { __exports as r } from "./petal-toolkit.es1355.js";
2
2
  var t;
3
3
  function i() {
4
4
  return t ? r : (t = 1, (function(n) {
@@ -1,4 +1,4 @@
1
- import { __exports as A } from "./petal-toolkit.es1355.js";
1
+ import { __exports as A } from "./petal-toolkit.es1354.js";
2
2
  var _;
3
3
  function e() {
4
4
  return _ ? A : (_ = 1, (function(E) {
@@ -1,10 +1,10 @@
1
1
  import { jsx as A } from "react/jsx-runtime";
2
2
  import { memo as L, useEffect as N } from "react";
3
3
  import { s as B } from "./petal-toolkit.es59.js";
4
- import { useFinancialChartSetup as V } from "./petal-toolkit.es1321.js";
4
+ import { useFinancialChartSetup as V } from "./petal-toolkit.es1329.js";
5
5
  import { createCategoryXAxis as k, createNumericYAxis as E, labelFormatters as M } from "./petal-toolkit.es55.js";
6
- import { addReferenceLine as O, createLineSeries as b } from "./petal-toolkit.es1333.js";
7
- import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1322.js";
6
+ import { addReferenceLine as O, createLineSeries as b } from "./petal-toolkit.es1330.js";
7
+ import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1331.js";
8
8
  import { tooltipFormatters as F } from "./petal-toolkit.es58.js";
9
9
  function D(C) {
10
10
  switch (C) {
@@ -1,9 +1,9 @@
1
1
  import { jsx as B } from "react/jsx-runtime";
2
2
  import { memo as E, useEffect as V } from "react";
3
3
  import { s } from "./petal-toolkit.es59.js";
4
- import { useFinancialChartSetup as X } from "./petal-toolkit.es1321.js";
4
+ import { useFinancialChartSetup as X } from "./petal-toolkit.es1329.js";
5
5
  import { createCategoryXAxis as G, createNumericYAxis as M } from "./petal-toolkit.es55.js";
6
- import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1322.js";
6
+ import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1331.js";
7
7
  import { tooltipFormatters as f } from "./petal-toolkit.es58.js";
8
8
  function W(S) {
9
9
  switch (S) {
@@ -1,37 +1,5 @@
1
- function m(e) {
2
- return typeof e == "number" ? e > 1e12 ? Math.floor(e / 1e3) : e : Math.floor(e.getTime() / 1e3);
3
- }
4
- function u(e) {
5
- return e > 1e12 ? new Date(e) : new Date(e * 1e3);
6
- }
7
- function f(e, t) {
8
- const n = u(e);
9
- if (t) {
10
- const [i, o] = t, r = (o - i) / 3600;
11
- if (r < 1)
12
- return n.toLocaleTimeString("en-US", {
13
- hour: "numeric",
14
- minute: "2-digit",
15
- second: "2-digit"
16
- });
17
- if (r < 24)
18
- return n.toLocaleTimeString("en-US", {
19
- hour: "numeric",
20
- minute: "2-digit"
21
- });
22
- if (r < 168)
23
- return n.toLocaleDateString("en-US", {
24
- month: "short",
25
- day: "numeric",
26
- hour: "numeric",
27
- minute: "2-digit"
28
- });
29
- }
30
- return n.toLocaleDateString("en-US", { month: "short", day: "numeric" });
31
- }
1
+ var s = {};
32
2
  export {
33
- f as formatAxisLabel,
34
- u as fromUnixTimestamp,
35
- m as toUnixTimestamp
3
+ s as __exports
36
4
  };
37
5
  //# sourceMappingURL=petal-toolkit.es1320.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1320.js","sources":["../src/utils/dateUtils.ts"],"sourcesContent":["/**\n * Shared Date Utilities\n *\n * Common date utilities used across charts.\n * Import from here instead of duplicating in each component.\n */\n\n/**\n * Convert a Date object or millisecond timestamp to Unix timestamp (seconds)\n *\n * SciChart uses Unix timestamps (seconds since epoch) for date axes.\n * This handles both Date objects and millisecond timestamps.\n *\n * @example\n * toUnixTimestamp(new Date('2024-01-15')) // 1705276800\n * toUnixTimestamp(1705276800000) // 1705276800 (already in ms, converts to seconds)\n * toUnixTimestamp(1705276800) // 1705276800 (already in seconds, returns as-is)\n */\nexport function toUnixTimestamp(date: Date | number): number {\n if (typeof date === 'number') {\n // If it's already a Unix timestamp (seconds), return as-is\n // If it's a millisecond timestamp (> year 2001 in seconds), convert\n if (date > 1_000_000_000_000) {\n return Math.floor(date / 1000);\n }\n return date;\n }\n return Math.floor(date.getTime() / 1000);\n}\n\n/**\n * Convert Unix timestamp (seconds) back to Date object\n *\n * @example\n * fromUnixTimestamp(1705276800) // Date('2024-01-15')\n */\nexport function fromUnixTimestamp(timestamp: number): Date {\n // Handle both seconds and milliseconds\n if (timestamp > 1_000_000_000_000) {\n return new Date(timestamp);\n }\n return new Date(timestamp * 1000);\n}\n\n/**\n * Format a date for display on chart axes\n *\n * @example\n * formatChartDate(new Date('2024-01-15')) // 'Jan 15'\n */\nexport function formatChartDate(date: Date | number): string {\n const d = typeof date === 'number' ? fromUnixTimestamp(date) : date;\n return d.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n });\n}\n\n/**\n * Format a date with full precision\n *\n * @example\n * formatChartDateFull(new Date('2024-01-15')) // 'Jan 15, 2024'\n */\nexport function formatChartDateFull(date: Date | number): string {\n const d = typeof date === 'number' ? fromUnixTimestamp(date) : date;\n return d.toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\n/**\n * Format a date with time\n *\n * @example\n * formatChartDateTime(new Date('2024-01-15T14:30:00')) // 'Jan 15, 2:30 PM'\n */\nexport function formatChartDateTime(date: Date | number): string {\n const d = typeof date === 'number' ? fromUnixTimestamp(date) : date;\n return d.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n });\n}\n\n/**\n * Get the start of a day (midnight) for a given date\n */\nexport function startOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\n/**\n * Get the end of a day (23:59:59.999) for a given date\n */\nexport function endOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(23, 59, 59, 999);\n return d;\n}\n\n/**\n * Smart format for chart axis labels - auto-detects granularity from data range\n *\n * Determines the appropriate format based on the time span of the data:\n * - Sub-hour range: show time with seconds (e.g., \"2:30:45 PM\")\n * - 1-24 hours: show time only (e.g., \"2:30 PM\")\n * - 1-7 days: show date + time (e.g., \"Jan 15, 2:30 PM\")\n * - > 7 days: show date only (e.g., \"Jan 15\")\n *\n * @param timestamp - Unix timestamp (seconds)\n * @param dataRange - Optional: [minTimestamp, maxTimestamp] to help detect granularity\n *\n * @example\n * // With daily data range\n * formatAxisLabel(1705276800, [1704672000, 1705881600]) // \"Jan 15\"\n *\n * // With intraday range (few hours)\n * formatAxisLabel(1705276800, [1705273200, 1705284000]) // \"2:30 PM\"\n *\n * // With sub-hour range (seconds precision)\n * formatAxisLabel(1705276845, [1705276800, 1705278000]) // \"2:30:45 PM\"\n */\nexport function formatAxisLabel(timestamp: number, dataRange?: [number, number]): string {\n const d = fromUnixTimestamp(timestamp);\n\n // If we have a data range, use it to detect granularity\n if (dataRange) {\n const [min, max] = dataRange;\n const rangeSeconds = max - min;\n const rangeHours = rangeSeconds / 3600;\n\n if (rangeHours < 1) {\n // Sub-hour range: show time with seconds\n return d.toLocaleTimeString('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n second: '2-digit',\n });\n } else if (rangeHours < 24) {\n // Intraday: show time only\n return d.toLocaleTimeString('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n });\n } else if (rangeHours < 24 * 7) {\n // Multi-day but < 1 week: show date + time\n return d.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n });\n }\n }\n\n // Default: date only (for daily+ data or when range unknown)\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });\n}\n"],"names":["toUnixTimestamp","date","fromUnixTimestamp","timestamp","formatAxisLabel","dataRange","d","min","max","rangeHours"],"mappings":"AAkBO,SAASA,EAAgBC,GAA6B;AAC3D,SAAI,OAAOA,KAAS,WAGdA,IAAO,OACF,KAAK,MAAMA,IAAO,GAAI,IAExBA,IAEF,KAAK,MAAMA,EAAK,QAAA,IAAY,GAAI;AACzC;AAQO,SAASC,EAAkBC,GAAyB;AAEzD,SAAIA,IAAY,OACP,IAAI,KAAKA,CAAS,IAEpB,IAAI,KAAKA,IAAY,GAAI;AAClC;AAuFO,SAASC,EAAgBD,GAAmBE,GAAsC;AACvF,QAAMC,IAAIJ,EAAkBC,CAAS;AAGrC,MAAIE,GAAW;AACb,UAAM,CAACE,GAAKC,CAAG,IAAIH,GAEbI,KADeD,IAAMD,KACO;AAElC,QAAIE,IAAa;AAEf,aAAOH,EAAE,mBAAmB,SAAS;AAAA,QACnC,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,QAAQ;AAAA,MAAA,CACT;AACH,QAAWG,IAAa;AAEtB,aAAOH,EAAE,mBAAmB,SAAS;AAAA,QACnC,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA,CACT;AACH,QAAWG,IAAa;AAEtB,aAAOH,EAAE,mBAAmB,SAAS;AAAA,QACnC,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA,CACT;AAAA,EAEL;AAGA,SAAOA,EAAE,mBAAmB,SAAS,EAAE,OAAO,SAAS,KAAK,WAAW;AACzE;"}
1
+ {"version":3,"file":"petal-toolkit.es1320.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,55 +1,5 @@
1
- import { useId as b, useRef as t } from "react";
2
- import { getThemeFromPreset as g } from "./petal-toolkit.es60.js";
3
- function m(r) {
4
- switch (r) {
5
- case "light":
6
- return {
7
- gridColor: "rgba(0, 0, 0, 0.08)",
8
- axisLabelColor: "#6b7280",
9
- crosshairColor: "#3b82f6"
10
- };
11
- case "navy":
12
- return {
13
- gridColor: "rgba(255, 255, 255, 0.08)",
14
- axisLabelColor: "#64748b",
15
- crosshairColor: "#60a5fa"
16
- };
17
- case "dark":
18
- default:
19
- return {
20
- gridColor: "rgba(255, 255, 255, 0.06)",
21
- axisLabelColor: "#6B7280",
22
- crosshairColor: "#3B82F6"
23
- };
24
- }
25
- }
26
- function p(r = "100%", o = 400) {
27
- return {
28
- width: typeof r == "number" ? `${r}px` : r,
29
- height: typeof o == "number" ? `${o}px` : o,
30
- position: "relative"
31
- };
32
- }
33
- function x({
34
- chartName: r,
35
- width: o = "100%",
36
- height: a = 400,
37
- themePreset: e = "dark",
38
- customTheme: n
39
- }) {
40
- const s = b(), c = t(null), i = t(null), l = n ?? g(e), u = m(e), f = `${r}-${s}`, C = p(o, a);
41
- return {
42
- containerId: f,
43
- containerRef: c,
44
- surfaceRef: i,
45
- sciChartTheme: l,
46
- baseColors: u,
47
- containerStyle: C
48
- };
49
- }
1
+ var e = {};
50
2
  export {
51
- m as getBaseThemeColors,
52
- p as getContainerStyle,
53
- x as useFinancialChartSetup
3
+ e as __exports
54
4
  };
55
5
  //# sourceMappingURL=petal-toolkit.es1321.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1321.js","sources":["../src/charts/financials/shared/useFinancialChartSetup.ts"],"sourcesContent":["import { useRef, useId } from 'react';\nimport type { SciChartSurface, IThemeProvider } from 'scichart';\nimport { type SciChartThemePreset, getThemeFromPreset } from '@/scichart/themes';\nimport type { BaseThemeColors, FinancialChartSetup } from './types';\n\n/**\n * Get base theme colors that are shared across all financial charts\n */\nexport function getBaseThemeColors(preset: SciChartThemePreset): BaseThemeColors {\n switch (preset) {\n case 'light':\n return {\n gridColor: 'rgba(0, 0, 0, 0.08)',\n axisLabelColor: '#6b7280',\n crosshairColor: '#3b82f6',\n };\n case 'navy':\n return {\n gridColor: 'rgba(255, 255, 255, 0.08)',\n axisLabelColor: '#64748b',\n crosshairColor: '#60a5fa',\n };\n case 'dark':\n default:\n return {\n gridColor: 'rgba(255, 255, 255, 0.06)',\n axisLabelColor: '#6B7280',\n crosshairColor: '#3B82F6',\n };\n }\n}\n\n/**\n * Calculate container style from width/height props\n */\nexport function getContainerStyle(\n width: string | number = '100%',\n height: string | number = 400\n): React.CSSProperties {\n return {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n position: 'relative',\n };\n}\n\ninterface UseFinancialChartSetupOptions {\n /** Chart name prefix for container ID (e.g., 'margin-analysis') */\n chartName: string;\n /** Width prop */\n width?: string | number;\n /** Height prop */\n height?: string | number;\n /** Theme preset */\n themePreset?: SciChartThemePreset;\n /** Custom theme (overrides preset) */\n customTheme?: IThemeProvider;\n}\n\n/**\n * Hook that handles common financial chart setup:\n * - Container ref and ID generation\n * - Surface ref for cleanup\n * - Theme resolution\n * - Base theme colors\n * - Container style calculation\n */\nexport function useFinancialChartSetup({\n chartName,\n width = '100%',\n height = 400,\n themePreset = 'dark',\n customTheme,\n}: UseFinancialChartSetupOptions): FinancialChartSetup {\n const chartId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const surfaceRef = useRef<SciChartSurface | null>(null);\n\n const sciChartTheme = customTheme ?? getThemeFromPreset(themePreset);\n const baseColors = getBaseThemeColors(themePreset);\n const containerId = `${chartName}-${chartId}`;\n const containerStyle = getContainerStyle(width, height);\n\n return {\n containerId,\n containerRef,\n surfaceRef,\n sciChartTheme,\n baseColors,\n containerStyle,\n };\n}\n"],"names":["getBaseThemeColors","preset","getContainerStyle","width","height","useFinancialChartSetup","chartName","themePreset","customTheme","chartId","useId","containerRef","useRef","surfaceRef","sciChartTheme","getThemeFromPreset","baseColors","containerId","containerStyle"],"mappings":";;AAQO,SAASA,EAAmBC,GAA8C;AAC/E,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AAAA,IACL;AACE,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,EAClB;AAEN;AAKO,SAASC,EACdC,IAAyB,QACzBC,IAA0B,KACL;AACrB,SAAO;AAAA,IACL,OAAO,OAAOD,KAAU,WAAW,GAAGA,CAAK,OAAOA;AAAA,IAClD,QAAQ,OAAOC,KAAW,WAAW,GAAGA,CAAM,OAAOA;AAAA,IACrD,UAAU;AAAA,EAAA;AAEd;AAuBO,SAASC,EAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,OAAAH,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,aAAAG,IAAc;AAAA,EACd,aAAAC;AACF,GAAuD;AACrD,QAAMC,IAAUC,EAAA,GACVC,IAAeC,EAAuB,IAAI,GAC1CC,IAAaD,EAA+B,IAAI,GAEhDE,IAAgBN,KAAeO,EAAmBR,CAAW,GAC7DS,IAAahB,EAAmBO,CAAW,GAC3CU,IAAc,GAAGX,CAAS,IAAIG,CAAO,IACrCS,IAAiBhB,EAAkBC,GAAOC,CAAM;AAEtD,SAAO;AAAA,IACL,aAAAa;AAAA,IACA,cAAAN;AAAA,IACA,YAAAE;AAAA,IACA,eAAAC;AAAA,IACA,YAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"petal-toolkit.es1321.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,51 +1,5 @@
1
- import { s as t } from "./petal-toolkit.es59.js";
2
- import { createCursorTooltip as P, TOOLTIP_STYLE as e } from "./petal-toolkit.es54.js";
3
- function k(i, r) {
4
- const { crosshairColor: a, showTooltip: s = !0, showAxisLabels: c = !0, valueFormatters: o } = r, g = new t.CursorModifier({
5
- showTooltip: s,
6
- showAxisLabels: c,
7
- crosshairStroke: a,
8
- tooltipSvgTemplate: P((n) => {
9
- if (n.length === 0)
10
- return { width: 0, height: 0, content: "" };
11
- const w = 180, f = 30, l = 20, $ = f + n.length * l, M = n[0], p = new Date((M.xValue ?? 0) * 1e3).toLocaleDateString("en-US", {
12
- month: "short",
13
- day: "numeric",
14
- year: "numeric"
15
- }), S = `<text x="12" y="20" font-size="11" font-weight="600" font-family="${e.fontFamily}" fill="${e.textPrimary}">${p}</text>`, L = n.map((d, h) => {
16
- var y;
17
- const m = f + h * l + 10, x = d.seriesName || `Series ${h + 1}`, u = o == null ? void 0 : o[x], C = u ? u(d.yValue ?? 0) : `${((y = d.yValue) == null ? void 0 : y.toFixed(2)) ?? "-"}`;
18
- return `<text x="12" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textSecondary}">${x}:</text>
19
- <text x="100" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textPrimary}">${C}</text>`;
20
- }).join(""), T = S + L;
21
- return { width: w, height: $, content: T };
22
- })
23
- });
24
- i.chartModifiers.add(
25
- new t.ZoomPanModifier(),
26
- new t.MouseWheelZoomModifier(),
27
- new t.ZoomExtentsModifier(),
28
- g
29
- );
30
- }
31
- function F(i, r = {}) {
32
- const {
33
- placement: a = t.ELegendPlacement.TopRight,
34
- orientation: s = t.ELegendOrientation.Horizontal,
35
- showCheckboxes: c = !1,
36
- showSeriesMarkers: o = !0
37
- } = r;
38
- i.chartModifiers.add(
39
- new t.LegendModifier({
40
- placement: a,
41
- orientation: s,
42
- showCheckboxes: c,
43
- showSeriesMarkers: o
44
- })
45
- );
46
- }
1
+ var a = {};
47
2
  export {
48
- F as addLegendModifier,
49
- k as addStandardModifiers
3
+ a as __exports
50
4
  };
51
5
  //# sourceMappingURL=petal-toolkit.es1322.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1322.js","sources":["../src/charts/financials/shared/chartModifiers.ts"],"sourcesContent":["import {\n SciChartSurface,\n ZoomPanModifier,\n MouseWheelZoomModifier,\n ZoomExtentsModifier,\n CursorModifier,\n LegendModifier,\n ELegendPlacement,\n ELegendOrientation,\n} from 'scichart';\nimport { createCursorTooltip, TOOLTIP_STYLE } from '@/scichart/modifiers/tooltipTemplates';\n\ninterface StandardModifiersOptions {\n /** Crosshair/cursor stroke color */\n crosshairColor: string;\n /** Whether to show tooltips on cursor (default: true) */\n showTooltip?: boolean;\n /** Whether to show axis labels on cursor (default: true) */\n showAxisLabels?: boolean;\n /** Formatter functions per series (by series name) */\n valueFormatters?: {\n [seriesName: string]: (value: number) => string;\n };\n}\n\n/**\n * Add standard chart modifiers: ZoomPan, MouseWheelZoom, ZoomExtents, Cursor with styled tooltip\n */\nexport function addStandardModifiers(\n surface: SciChartSurface,\n options: StandardModifiersOptions\n): void {\n const { crosshairColor, showTooltip = true, showAxisLabels = true, valueFormatters } = options;\n\n const cursorModifier = new CursorModifier({\n showTooltip,\n showAxisLabels,\n crosshairStroke: crosshairColor,\n tooltipSvgTemplate: createCursorTooltip((seriesInfos) => {\n // Default multi-series tooltip formatting with dark background\n if (seriesInfos.length === 0) {\n return { width: 0, height: 0, content: '' };\n }\n\n const width = 180;\n const baseHeight = 30;\n const rowHeight = 20;\n const height = baseHeight + (seriesInfos.length * rowHeight);\n\n // Date from first series\n const firstInfo = seriesInfos[0];\n const date = new Date((firstInfo.xValue ?? 0) * 1000);\n const dateStr = date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric'\n });\n\n const dateContent = `<text x=\"12\" y=\"20\" font-size=\"11\" font-weight=\"600\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${dateStr}</text>`;\n\n const seriesContent = seriesInfos.map((info, i) => {\n const yPos = baseHeight + (i * rowHeight) + 10;\n const seriesName = info.seriesName || `Series ${i + 1}`;\n\n // Apply formatter if provided, otherwise use default\n const formatter = valueFormatters?.[seriesName];\n const value = formatter\n ? formatter(info.yValue ?? 0)\n : `${info.yValue?.toFixed(2) ?? '-'}`;\n\n return `<text x=\"12\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textSecondary}\">${seriesName}:</text>\n <text x=\"100\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${value}</text>`;\n }).join('');\n\n const content = dateContent + seriesContent;\n\n return { width, height, content };\n }),\n });\n\n surface.chartModifiers.add(\n new ZoomPanModifier(),\n new MouseWheelZoomModifier(),\n new ZoomExtentsModifier(),\n cursorModifier\n );\n}\n\ninterface LegendModifierOptions {\n /** Placement of the legend (default: TopRight). Use ELegendPlacement enum values. */\n placement?: ELegendPlacement | number;\n /** Orientation of the legend (default: Horizontal). Use ELegendOrientation enum values. */\n orientation?: ELegendOrientation | number;\n /** Show checkboxes for toggling series (default: false) */\n showCheckboxes?: boolean;\n /** Show series markers in legend (default: true) */\n showSeriesMarkers?: boolean;\n}\n\n/**\n * Add a legend modifier to the chart\n */\nexport function addLegendModifier(\n surface: SciChartSurface,\n options: LegendModifierOptions = {}\n): void {\n const {\n placement = ELegendPlacement.TopRight,\n orientation = ELegendOrientation.Horizontal,\n showCheckboxes = false,\n showSeriesMarkers = true,\n } = options;\n\n surface.chartModifiers.add(\n new LegendModifier({\n placement: placement as ELegendPlacement,\n orientation: orientation as ELegendOrientation,\n showCheckboxes,\n showSeriesMarkers,\n })\n );\n}\n\n/**\n * Add both standard modifiers and legend in one call\n */\nexport function addStandardModifiersWithLegend(\n surface: SciChartSurface,\n options: StandardModifiersOptions & { legendOptions?: LegendModifierOptions }\n): void {\n addStandardModifiers(surface, options);\n addLegendModifier(surface, options.legendOptions);\n}\n"],"names":["addStandardModifiers","surface","options","crosshairColor","showTooltip","showAxisLabels","valueFormatters","cursorModifier","CursorModifier","createCursorTooltip","seriesInfos","width","baseHeight","rowHeight","height","firstInfo","dateStr","dateContent","TOOLTIP_STYLE","seriesContent","info","i","yPos","seriesName","formatter","value","_a","content","ZoomPanModifier","MouseWheelZoomModifier","ZoomExtentsModifier","addLegendModifier","placement","ELegendPlacement","orientation","ELegendOrientation","showCheckboxes","showSeriesMarkers","LegendModifier"],"mappings":";;AA4BO,SAASA,EACdC,GACAC,GACM;AACN,QAAM,EAAE,gBAAAC,GAAgB,aAAAC,IAAc,IAAM,gBAAAC,IAAiB,IAAM,iBAAAC,MAAoBJ,GAEjFK,IAAiB,IAAIC,iBAAe;AAAA,IACxC,aAAAJ;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAiBF;AAAA,IACjB,oBAAoBM,EAAoB,CAACC,MAAgB;AAEvD,UAAIA,EAAY,WAAW;AACzB,eAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAA;AAGzC,YAAMC,IAAQ,KACRC,IAAa,IACbC,IAAY,IACZC,IAASF,IAAcF,EAAY,SAASG,GAG5CE,IAAYL,EAAY,CAAC,GAEzBM,IADO,IAAI,MAAMD,EAAU,UAAU,KAAK,GAAI,EAC/B,mBAAmB,SAAS;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,MAAA,CACP,GAEKE,IAAc,qEAAqEC,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKF,CAAO,WAE3JG,IAAgBT,EAAY,IAAI,CAACU,GAAMC,MAAM;;AACjD,cAAMC,IAAOV,IAAcS,IAAIR,IAAa,IACtCU,IAAaH,EAAK,cAAc,UAAUC,IAAI,CAAC,IAG/CG,IAAYlB,KAAA,gBAAAA,EAAkBiB,IAC9BE,IAAQD,IACVA,EAAUJ,EAAK,UAAU,CAAC,IAC1B,KAAGM,IAAAN,EAAK,WAAL,gBAAAM,EAAa,QAAQ,OAAM,GAAG;AAErC,eAAO,mBAAmBJ,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,aAAa,KAAKK,CAAU;AAAA,mCACjHD,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKO,CAAK;AAAA,MACxI,CAAC,EAAE,KAAK,EAAE,GAEJE,IAAUV,IAAcE;AAE9B,aAAO,EAAE,OAAAR,GAAO,QAAAG,GAAQ,SAAAa,EAAA;AAAA,IAC1B,CAAC;AAAA,EAAA,CACF;AAED,EAAA1B,EAAQ,eAAe;AAAA,IACrB,IAAI2B,kBAAA;AAAA,IACJ,IAAIC,yBAAA;AAAA,IACJ,IAAIC,sBAAA;AAAA,IACJvB;AAAA,EAAA;AAEJ;AAgBO,SAASwB,EACd9B,GACAC,IAAiC,IAC3B;AACN,QAAM;AAAA,IACJ,WAAA8B,IAAYC,EAAAA,iBAAiB;AAAA,IAC7B,aAAAC,IAAcC,EAAAA,mBAAmB;AAAA,IACjC,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC,IAAoB;AAAA,EAAA,IAClBnC;AAEJ,EAAAD,EAAQ,eAAe;AAAA,IACrB,IAAIqC,iBAAe;AAAA,MACjB,WAAAN;AAAA,MACA,aAAAE;AAAA,MACA,gBAAAE;AAAA,MACA,mBAAAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"petal-toolkit.es1322.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +1,5 @@
1
- var e = {};
1
+ var p = {};
2
2
  export {
3
- e as __exports
3
+ p as __exports
4
4
  };
5
5
  //# sourceMappingURL=petal-toolkit.es1324.js.map
@@ -1,5 +1,5 @@
1
- var a = {};
1
+ var s = {};
2
2
  export {
3
- a as __exports
3
+ s as __exports
4
4
  };
5
5
  //# sourceMappingURL=petal-toolkit.es1325.js.map
@@ -1,5 +1,5 @@
1
- var p = {};
1
+ var t = {};
2
2
  export {
3
- p as __exports
3
+ t as __exports
4
4
  };
5
5
  //# sourceMappingURL=petal-toolkit.es1326.js.map
@@ -1,5 +1,5 @@
1
- var s = {};
1
+ var r = {};
2
2
  export {
3
- s as __exports
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=petal-toolkit.es1327.js.map
@@ -1,5 +1,5 @@
1
- var s = {};
1
+ var r = {};
2
2
  export {
3
- s as __exports
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=petal-toolkit.es1328.js.map
@@ -1,5 +1,55 @@
1
- var t = {};
1
+ import { useId as b, useRef as t } from "react";
2
+ import { getThemeFromPreset as g } from "./petal-toolkit.es60.js";
3
+ function m(r) {
4
+ switch (r) {
5
+ case "light":
6
+ return {
7
+ gridColor: "rgba(0, 0, 0, 0.08)",
8
+ axisLabelColor: "#6b7280",
9
+ crosshairColor: "#3b82f6"
10
+ };
11
+ case "navy":
12
+ return {
13
+ gridColor: "rgba(255, 255, 255, 0.08)",
14
+ axisLabelColor: "#64748b",
15
+ crosshairColor: "#60a5fa"
16
+ };
17
+ case "dark":
18
+ default:
19
+ return {
20
+ gridColor: "rgba(255, 255, 255, 0.06)",
21
+ axisLabelColor: "#6B7280",
22
+ crosshairColor: "#3B82F6"
23
+ };
24
+ }
25
+ }
26
+ function p(r = "100%", o = 400) {
27
+ return {
28
+ width: typeof r == "number" ? `${r}px` : r,
29
+ height: typeof o == "number" ? `${o}px` : o,
30
+ position: "relative"
31
+ };
32
+ }
33
+ function x({
34
+ chartName: r,
35
+ width: o = "100%",
36
+ height: a = 400,
37
+ themePreset: e = "dark",
38
+ customTheme: n
39
+ }) {
40
+ const s = b(), c = t(null), i = t(null), l = n ?? g(e), u = m(e), f = `${r}-${s}`, C = p(o, a);
41
+ return {
42
+ containerId: f,
43
+ containerRef: c,
44
+ surfaceRef: i,
45
+ sciChartTheme: l,
46
+ baseColors: u,
47
+ containerStyle: C
48
+ };
49
+ }
2
50
  export {
3
- t as __exports
51
+ m as getBaseThemeColors,
52
+ p as getContainerStyle,
53
+ x as useFinancialChartSetup
4
54
  };
5
55
  //# sourceMappingURL=petal-toolkit.es1329.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1329.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"petal-toolkit.es1329.js","sources":["../src/charts/financials/shared/useFinancialChartSetup.ts"],"sourcesContent":["import { useRef, useId } from 'react';\nimport type { SciChartSurface, IThemeProvider } from 'scichart';\nimport { type SciChartThemePreset, getThemeFromPreset } from '@/scichart/themes';\nimport type { BaseThemeColors, FinancialChartSetup } from './types';\n\n/**\n * Get base theme colors that are shared across all financial charts\n */\nexport function getBaseThemeColors(preset: SciChartThemePreset): BaseThemeColors {\n switch (preset) {\n case 'light':\n return {\n gridColor: 'rgba(0, 0, 0, 0.08)',\n axisLabelColor: '#6b7280',\n crosshairColor: '#3b82f6',\n };\n case 'navy':\n return {\n gridColor: 'rgba(255, 255, 255, 0.08)',\n axisLabelColor: '#64748b',\n crosshairColor: '#60a5fa',\n };\n case 'dark':\n default:\n return {\n gridColor: 'rgba(255, 255, 255, 0.06)',\n axisLabelColor: '#6B7280',\n crosshairColor: '#3B82F6',\n };\n }\n}\n\n/**\n * Calculate container style from width/height props\n */\nexport function getContainerStyle(\n width: string | number = '100%',\n height: string | number = 400\n): React.CSSProperties {\n return {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n position: 'relative',\n };\n}\n\ninterface UseFinancialChartSetupOptions {\n /** Chart name prefix for container ID (e.g., 'margin-analysis') */\n chartName: string;\n /** Width prop */\n width?: string | number;\n /** Height prop */\n height?: string | number;\n /** Theme preset */\n themePreset?: SciChartThemePreset;\n /** Custom theme (overrides preset) */\n customTheme?: IThemeProvider;\n}\n\n/**\n * Hook that handles common financial chart setup:\n * - Container ref and ID generation\n * - Surface ref for cleanup\n * - Theme resolution\n * - Base theme colors\n * - Container style calculation\n */\nexport function useFinancialChartSetup({\n chartName,\n width = '100%',\n height = 400,\n themePreset = 'dark',\n customTheme,\n}: UseFinancialChartSetupOptions): FinancialChartSetup {\n const chartId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const surfaceRef = useRef<SciChartSurface | null>(null);\n\n const sciChartTheme = customTheme ?? getThemeFromPreset(themePreset);\n const baseColors = getBaseThemeColors(themePreset);\n const containerId = `${chartName}-${chartId}`;\n const containerStyle = getContainerStyle(width, height);\n\n return {\n containerId,\n containerRef,\n surfaceRef,\n sciChartTheme,\n baseColors,\n containerStyle,\n };\n}\n"],"names":["getBaseThemeColors","preset","getContainerStyle","width","height","useFinancialChartSetup","chartName","themePreset","customTheme","chartId","useId","containerRef","useRef","surfaceRef","sciChartTheme","getThemeFromPreset","baseColors","containerId","containerStyle"],"mappings":";;AAQO,SAASA,EAAmBC,GAA8C;AAC/E,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AAAA,IACL;AACE,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,EAClB;AAEN;AAKO,SAASC,EACdC,IAAyB,QACzBC,IAA0B,KACL;AACrB,SAAO;AAAA,IACL,OAAO,OAAOD,KAAU,WAAW,GAAGA,CAAK,OAAOA;AAAA,IAClD,QAAQ,OAAOC,KAAW,WAAW,GAAGA,CAAM,OAAOA;AAAA,IACrD,UAAU;AAAA,EAAA;AAEd;AAuBO,SAASC,EAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,OAAAH,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,aAAAG,IAAc;AAAA,EACd,aAAAC;AACF,GAAuD;AACrD,QAAMC,IAAUC,EAAA,GACVC,IAAeC,EAAuB,IAAI,GAC1CC,IAAaD,EAA+B,IAAI,GAEhDE,IAAgBN,KAAeO,EAAmBR,CAAW,GAC7DS,IAAahB,EAAmBO,CAAW,GAC3CU,IAAc,GAAGX,CAAS,IAAIG,CAAO,IACrCS,IAAiBhB,EAAkBC,GAAOC,CAAM;AAEtD,SAAO;AAAA,IACL,aAAAa;AAAA,IACA,cAAAN;AAAA,IACA,YAAAE;AAAA,IACA,eAAAC;AAAA,IACA,YAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAEJ;"}
@@ -1,5 +1,98 @@
1
- var r = {};
1
+ import { s as t } from "./petal-toolkit.es59.js";
2
+ function h(e, n) {
3
+ const {
4
+ xValues: i,
5
+ yValues: c,
6
+ name: r,
7
+ color: o,
8
+ strokeThickness: a = 3,
9
+ pointMarker: s = {}
10
+ } = n, {
11
+ size: l = 8,
12
+ strokeColor: d = "#FFFFFF",
13
+ strokeThickness: k = 2
14
+ } = s, u = new t.XyDataSeries(e, {
15
+ xValues: i,
16
+ yValues: c,
17
+ dataSeriesName: r
18
+ });
19
+ return new t.FastLineRenderableSeries(e, {
20
+ dataSeries: u,
21
+ stroke: o,
22
+ strokeThickness: a,
23
+ pointMarker: new t.EllipsePointMarker(e, {
24
+ width: l,
25
+ height: l,
26
+ fill: o,
27
+ stroke: d,
28
+ strokeThickness: k
29
+ })
30
+ });
31
+ }
32
+ function y(e, n) {
33
+ const {
34
+ xValues: i,
35
+ yValues: c,
36
+ name: r,
37
+ color: o,
38
+ dataPointWidth: a = 0.6,
39
+ opacity: s = 0.8
40
+ } = n, l = Math.round(s * 255).toString(16).padStart(2, "0").toUpperCase(), d = new t.XyDataSeries(e, {
41
+ xValues: i,
42
+ yValues: c,
43
+ dataSeriesName: r
44
+ });
45
+ return new t.FastColumnRenderableSeries(e, {
46
+ dataSeries: d,
47
+ fill: o + l,
48
+ stroke: o,
49
+ strokeThickness: 0,
50
+ dataPointWidth: a
51
+ });
52
+ }
53
+ function p(e, n) {
54
+ const { xValues: i, series: c, groupId: r, dataPointWidth: o = 0.6 } = n, a = new t.StackedColumnCollection(e);
55
+ a.dataPointWidth = o;
56
+ for (const s of c) {
57
+ const l = new t.XyDataSeries(e, {
58
+ xValues: i,
59
+ yValues: s.yValues,
60
+ dataSeriesName: s.name
61
+ }), d = new t.StackedColumnRenderableSeries(e, {
62
+ dataSeries: l,
63
+ fill: s.color,
64
+ stroke: s.color,
65
+ strokeThickness: 0,
66
+ stackedGroupId: r
67
+ });
68
+ a.add(d);
69
+ }
70
+ return a;
71
+ }
72
+ function f(e, n) {
73
+ const {
74
+ y: i,
75
+ color: c,
76
+ label: r,
77
+ strokeThickness: o = 1,
78
+ dashed: a = !0
79
+ } = n;
80
+ e.annotations.add(
81
+ new t.HorizontalLineAnnotation({
82
+ y1: i,
83
+ stroke: c,
84
+ strokeThickness: o,
85
+ strokeDashArray: a ? [5, 5] : void 0,
86
+ annotationLayer: t.EAnnotationLayer.BelowChart,
87
+ showLabel: !!r,
88
+ labelValue: r
89
+ })
90
+ );
91
+ }
2
92
  export {
3
- r as __exports
93
+ f as addReferenceLine,
94
+ y as createBarSeries,
95
+ h as createLineSeries,
96
+ p as createStackedCollection
4
97
  };
5
98
  //# sourceMappingURL=petal-toolkit.es1330.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1330.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"petal-toolkit.es1330.js","sources":["../src/charts/financials/shared/seriesFactory.ts"],"sourcesContent":["/**\n * Series Factory Functions\n *\n * Reusable factory functions for creating common SciChart series types.\n * These reduce boilerplate in financial chart components.\n */\n\nimport {\n XyDataSeries,\n FastLineRenderableSeries,\n FastColumnRenderableSeries,\n StackedColumnRenderableSeries,\n StackedColumnCollection,\n EllipsePointMarker,\n HorizontalLineAnnotation,\n EAnnotationLayer,\n type TSciChart,\n type SciChartSurface,\n} from 'scichart';\n\n/** Options for creating a line series */\nexport interface LineSeriesOptions {\n xValues: number[];\n yValues: number[];\n name: string;\n color: string;\n strokeThickness?: number;\n pointMarker?: {\n size?: number;\n strokeColor?: string;\n strokeThickness?: number;\n };\n}\n\n/** Options for creating a bar/column series */\nexport interface BarSeriesOptions {\n xValues: number[];\n yValues: number[];\n name: string;\n color: string;\n dataPointWidth?: number;\n opacity?: number; // 0-1, will be converted to hex\n}\n\n/** Options for creating a stacked series within a collection */\nexport interface StackedSeriesConfig {\n yValues: number[];\n name: string;\n color: string;\n}\n\n/** Options for creating a stacked column collection */\nexport interface StackedCollectionOptions {\n xValues: number[];\n series: StackedSeriesConfig[];\n groupId: string;\n dataPointWidth?: number;\n}\n\n/** Options for creating a horizontal reference line */\nexport interface ReferenceLineOptions {\n y: number;\n color: string;\n label?: string;\n strokeThickness?: number;\n dashed?: boolean;\n}\n\n/**\n * Create a line series with point markers\n */\nexport function createLineSeries(\n wasmContext: TSciChart,\n options: LineSeriesOptions\n): FastLineRenderableSeries {\n const {\n xValues,\n yValues,\n name,\n color,\n strokeThickness = 3,\n pointMarker = {},\n } = options;\n\n const {\n size = 8,\n strokeColor = '#FFFFFF',\n strokeThickness: markerStrokeThickness = 2,\n } = pointMarker;\n\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues,\n dataSeriesName: name,\n });\n\n return new FastLineRenderableSeries(wasmContext, {\n dataSeries,\n stroke: color,\n strokeThickness,\n pointMarker: new EllipsePointMarker(wasmContext, {\n width: size,\n height: size,\n fill: color,\n stroke: strokeColor,\n strokeThickness: markerStrokeThickness,\n }),\n });\n}\n\n/**\n * Create a column/bar series\n */\nexport function createBarSeries(\n wasmContext: TSciChart,\n options: BarSeriesOptions\n): FastColumnRenderableSeries {\n const {\n xValues,\n yValues,\n name,\n color,\n dataPointWidth = 0.6,\n opacity = 0.8,\n } = options;\n\n // Convert opacity to hex (0.8 -> CC)\n const opacityHex = Math.round(opacity * 255).toString(16).padStart(2, '0').toUpperCase();\n\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues,\n dataSeriesName: name,\n });\n\n return new FastColumnRenderableSeries(wasmContext, {\n dataSeries,\n fill: color + opacityHex,\n stroke: color,\n strokeThickness: 0,\n dataPointWidth,\n });\n}\n\n/**\n * Create a stacked column collection with multiple series\n */\nexport function createStackedCollection(\n wasmContext: TSciChart,\n options: StackedCollectionOptions\n): StackedColumnCollection {\n const { xValues, series, groupId, dataPointWidth = 0.6 } = options;\n\n const collection = new StackedColumnCollection(wasmContext);\n collection.dataPointWidth = dataPointWidth;\n\n for (const seriesConfig of series) {\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues: seriesConfig.yValues,\n dataSeriesName: seriesConfig.name,\n });\n\n const stackedSeries = new StackedColumnRenderableSeries(wasmContext, {\n dataSeries,\n fill: seriesConfig.color,\n stroke: seriesConfig.color,\n strokeThickness: 0,\n stackedGroupId: groupId,\n });\n\n collection.add(stackedSeries);\n }\n\n return collection;\n}\n\n/**\n * Add a horizontal reference line annotation\n */\nexport function addReferenceLine(\n surface: SciChartSurface,\n options: ReferenceLineOptions\n): void {\n const {\n y,\n color,\n label,\n strokeThickness = 1,\n dashed = true,\n } = options;\n\n surface.annotations.add(\n new HorizontalLineAnnotation({\n y1: y,\n stroke: color,\n strokeThickness,\n strokeDashArray: dashed ? [5, 5] : undefined,\n annotationLayer: EAnnotationLayer.BelowChart,\n showLabel: !!label,\n labelValue: label,\n })\n );\n}\n"],"names":["createLineSeries","wasmContext","options","xValues","yValues","name","color","strokeThickness","pointMarker","size","strokeColor","markerStrokeThickness","dataSeries","XyDataSeries","FastLineRenderableSeries","EllipsePointMarker","createBarSeries","dataPointWidth","opacity","opacityHex","FastColumnRenderableSeries","createStackedCollection","series","groupId","collection","StackedColumnCollection","seriesConfig","stackedSeries","StackedColumnRenderableSeries","addReferenceLine","surface","y","label","dashed","HorizontalLineAnnotation","EAnnotationLayer"],"mappings":";AAuEO,SAASA,EACdC,GACAC,GAC0B;AAC1B,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc,CAAA;AAAA,EAAC,IACbN,GAEE;AAAA,IACJ,MAAAO,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,iBAAiBC,IAAwB;AAAA,EAAA,IACvCH,GAEEI,IAAa,IAAIC,EAAAA,aAAaZ,GAAa;AAAA,IAC/C,SAAAE;AAAA,IACA,SAAAC;AAAA,IACA,gBAAgBC;AAAA,EAAA,CACjB;AAED,SAAO,IAAIS,EAAAA,yBAAyBb,GAAa;AAAA,IAC/C,YAAAW;AAAA,IACA,QAAQN;AAAA,IACR,iBAAAC;AAAA,IACA,aAAa,IAAIQ,EAAAA,mBAAmBd,GAAa;AAAA,MAC/C,OAAOQ;AAAA,MACP,QAAQA;AAAA,MACR,MAAMH;AAAA,MACN,QAAQI;AAAA,MACR,iBAAiBC;AAAA,IAAA,CAClB;AAAA,EAAA,CACF;AACH;AAKO,SAASK,EACdf,GACAC,GAC4B;AAC5B,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,gBAAAW,IAAiB;AAAA,IACjB,SAAAC,IAAU;AAAA,EAAA,IACRhB,GAGEiB,IAAa,KAAK,MAAMD,IAAU,GAAG,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,EAAE,YAAA,GAErEN,IAAa,IAAIC,EAAAA,aAAaZ,GAAa;AAAA,IAC/C,SAAAE;AAAA,IACA,SAAAC;AAAA,IACA,gBAAgBC;AAAA,EAAA,CACjB;AAED,SAAO,IAAIe,EAAAA,2BAA2BnB,GAAa;AAAA,IACjD,YAAAW;AAAA,IACA,MAAMN,IAAQa;AAAA,IACd,QAAQb;AAAA,IACR,iBAAiB;AAAA,IACjB,gBAAAW;AAAA,EAAA,CACD;AACH;AAKO,SAASI,EACdpB,GACAC,GACyB;AACzB,QAAM,EAAE,SAAAC,GAAS,QAAAmB,GAAQ,SAAAC,GAAS,gBAAAN,IAAiB,QAAQf,GAErDsB,IAAa,IAAIC,EAAAA,wBAAwBxB,CAAW;AAC1D,EAAAuB,EAAW,iBAAiBP;AAE5B,aAAWS,KAAgBJ,GAAQ;AACjC,UAAMV,IAAa,IAAIC,EAAAA,aAAaZ,GAAa;AAAA,MAC/C,SAAAE;AAAA,MACA,SAASuB,EAAa;AAAA,MACtB,gBAAgBA,EAAa;AAAA,IAAA,CAC9B,GAEKC,IAAgB,IAAIC,EAAAA,8BAA8B3B,GAAa;AAAA,MACnE,YAAAW;AAAA,MACA,MAAMc,EAAa;AAAA,MACnB,QAAQA,EAAa;AAAA,MACrB,iBAAiB;AAAA,MACjB,gBAAgBH;AAAA,IAAA,CACjB;AAED,IAAAC,EAAW,IAAIG,CAAa;AAAA,EAC9B;AAEA,SAAOH;AACT;AAKO,SAASK,EACdC,GACA5B,GACM;AACN,QAAM;AAAA,IACJ,GAAA6B;AAAA,IACA,OAAAzB;AAAA,IACA,OAAA0B;AAAA,IACA,iBAAAzB,IAAkB;AAAA,IAClB,QAAA0B,IAAS;AAAA,EAAA,IACP/B;AAEJ,EAAA4B,EAAQ,YAAY;AAAA,IAClB,IAAII,2BAAyB;AAAA,MAC3B,IAAIH;AAAA,MACJ,QAAQzB;AAAA,MACR,iBAAAC;AAAA,MACA,iBAAiB0B,IAAS,CAAC,GAAG,CAAC,IAAI;AAAA,MACnC,iBAAiBE,EAAAA,iBAAiB;AAAA,MAClC,WAAW,CAAC,CAACH;AAAA,MACb,YAAYA;AAAA,IAAA,CACb;AAAA,EAAA;AAEL;"}
@@ -1,5 +1,51 @@
1
- var r = {};
1
+ import { s as t } from "./petal-toolkit.es59.js";
2
+ import { createCursorTooltip as P, TOOLTIP_STYLE as e } from "./petal-toolkit.es54.js";
3
+ function k(i, r) {
4
+ const { crosshairColor: a, showTooltip: s = !0, showAxisLabels: c = !0, valueFormatters: o } = r, g = new t.CursorModifier({
5
+ showTooltip: s,
6
+ showAxisLabels: c,
7
+ crosshairStroke: a,
8
+ tooltipSvgTemplate: P((n) => {
9
+ if (n.length === 0)
10
+ return { width: 0, height: 0, content: "" };
11
+ const w = 180, f = 30, l = 20, $ = f + n.length * l, M = n[0], p = new Date((M.xValue ?? 0) * 1e3).toLocaleDateString("en-US", {
12
+ month: "short",
13
+ day: "numeric",
14
+ year: "numeric"
15
+ }), S = `<text x="12" y="20" font-size="11" font-weight="600" font-family="${e.fontFamily}" fill="${e.textPrimary}">${p}</text>`, L = n.map((d, h) => {
16
+ var y;
17
+ const m = f + h * l + 10, x = d.seriesName || `Series ${h + 1}`, u = o == null ? void 0 : o[x], C = u ? u(d.yValue ?? 0) : `${((y = d.yValue) == null ? void 0 : y.toFixed(2)) ?? "-"}`;
18
+ return `<text x="12" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textSecondary}">${x}:</text>
19
+ <text x="100" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textPrimary}">${C}</text>`;
20
+ }).join(""), T = S + L;
21
+ return { width: w, height: $, content: T };
22
+ })
23
+ });
24
+ i.chartModifiers.add(
25
+ new t.ZoomPanModifier(),
26
+ new t.MouseWheelZoomModifier(),
27
+ new t.ZoomExtentsModifier(),
28
+ g
29
+ );
30
+ }
31
+ function F(i, r = {}) {
32
+ const {
33
+ placement: a = t.ELegendPlacement.TopRight,
34
+ orientation: s = t.ELegendOrientation.Horizontal,
35
+ showCheckboxes: c = !1,
36
+ showSeriesMarkers: o = !0
37
+ } = r;
38
+ i.chartModifiers.add(
39
+ new t.LegendModifier({
40
+ placement: a,
41
+ orientation: s,
42
+ showCheckboxes: c,
43
+ showSeriesMarkers: o
44
+ })
45
+ );
46
+ }
2
47
  export {
3
- r as __exports
48
+ F as addLegendModifier,
49
+ k as addStandardModifiers
4
50
  };
5
51
  //# sourceMappingURL=petal-toolkit.es1331.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"petal-toolkit.es1331.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"petal-toolkit.es1331.js","sources":["../src/charts/financials/shared/chartModifiers.ts"],"sourcesContent":["import {\n SciChartSurface,\n ZoomPanModifier,\n MouseWheelZoomModifier,\n ZoomExtentsModifier,\n CursorModifier,\n LegendModifier,\n ELegendPlacement,\n ELegendOrientation,\n} from 'scichart';\nimport { createCursorTooltip, TOOLTIP_STYLE } from '@/scichart/modifiers/tooltipTemplates';\n\ninterface StandardModifiersOptions {\n /** Crosshair/cursor stroke color */\n crosshairColor: string;\n /** Whether to show tooltips on cursor (default: true) */\n showTooltip?: boolean;\n /** Whether to show axis labels on cursor (default: true) */\n showAxisLabels?: boolean;\n /** Formatter functions per series (by series name) */\n valueFormatters?: {\n [seriesName: string]: (value: number) => string;\n };\n}\n\n/**\n * Add standard chart modifiers: ZoomPan, MouseWheelZoom, ZoomExtents, Cursor with styled tooltip\n */\nexport function addStandardModifiers(\n surface: SciChartSurface,\n options: StandardModifiersOptions\n): void {\n const { crosshairColor, showTooltip = true, showAxisLabels = true, valueFormatters } = options;\n\n const cursorModifier = new CursorModifier({\n showTooltip,\n showAxisLabels,\n crosshairStroke: crosshairColor,\n tooltipSvgTemplate: createCursorTooltip((seriesInfos) => {\n // Default multi-series tooltip formatting with dark background\n if (seriesInfos.length === 0) {\n return { width: 0, height: 0, content: '' };\n }\n\n const width = 180;\n const baseHeight = 30;\n const rowHeight = 20;\n const height = baseHeight + (seriesInfos.length * rowHeight);\n\n // Date from first series\n const firstInfo = seriesInfos[0];\n const date = new Date((firstInfo.xValue ?? 0) * 1000);\n const dateStr = date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric'\n });\n\n const dateContent = `<text x=\"12\" y=\"20\" font-size=\"11\" font-weight=\"600\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${dateStr}</text>`;\n\n const seriesContent = seriesInfos.map((info, i) => {\n const yPos = baseHeight + (i * rowHeight) + 10;\n const seriesName = info.seriesName || `Series ${i + 1}`;\n\n // Apply formatter if provided, otherwise use default\n const formatter = valueFormatters?.[seriesName];\n const value = formatter\n ? formatter(info.yValue ?? 0)\n : `${info.yValue?.toFixed(2) ?? '-'}`;\n\n return `<text x=\"12\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textSecondary}\">${seriesName}:</text>\n <text x=\"100\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${value}</text>`;\n }).join('');\n\n const content = dateContent + seriesContent;\n\n return { width, height, content };\n }),\n });\n\n surface.chartModifiers.add(\n new ZoomPanModifier(),\n new MouseWheelZoomModifier(),\n new ZoomExtentsModifier(),\n cursorModifier\n );\n}\n\ninterface LegendModifierOptions {\n /** Placement of the legend (default: TopRight). Use ELegendPlacement enum values. */\n placement?: ELegendPlacement | number;\n /** Orientation of the legend (default: Horizontal). Use ELegendOrientation enum values. */\n orientation?: ELegendOrientation | number;\n /** Show checkboxes for toggling series (default: false) */\n showCheckboxes?: boolean;\n /** Show series markers in legend (default: true) */\n showSeriesMarkers?: boolean;\n}\n\n/**\n * Add a legend modifier to the chart\n */\nexport function addLegendModifier(\n surface: SciChartSurface,\n options: LegendModifierOptions = {}\n): void {\n const {\n placement = ELegendPlacement.TopRight,\n orientation = ELegendOrientation.Horizontal,\n showCheckboxes = false,\n showSeriesMarkers = true,\n } = options;\n\n surface.chartModifiers.add(\n new LegendModifier({\n placement: placement as ELegendPlacement,\n orientation: orientation as ELegendOrientation,\n showCheckboxes,\n showSeriesMarkers,\n })\n );\n}\n\n/**\n * Add both standard modifiers and legend in one call\n */\nexport function addStandardModifiersWithLegend(\n surface: SciChartSurface,\n options: StandardModifiersOptions & { legendOptions?: LegendModifierOptions }\n): void {\n addStandardModifiers(surface, options);\n addLegendModifier(surface, options.legendOptions);\n}\n"],"names":["addStandardModifiers","surface","options","crosshairColor","showTooltip","showAxisLabels","valueFormatters","cursorModifier","CursorModifier","createCursorTooltip","seriesInfos","width","baseHeight","rowHeight","height","firstInfo","dateStr","dateContent","TOOLTIP_STYLE","seriesContent","info","i","yPos","seriesName","formatter","value","_a","content","ZoomPanModifier","MouseWheelZoomModifier","ZoomExtentsModifier","addLegendModifier","placement","ELegendPlacement","orientation","ELegendOrientation","showCheckboxes","showSeriesMarkers","LegendModifier"],"mappings":";;AA4BO,SAASA,EACdC,GACAC,GACM;AACN,QAAM,EAAE,gBAAAC,GAAgB,aAAAC,IAAc,IAAM,gBAAAC,IAAiB,IAAM,iBAAAC,MAAoBJ,GAEjFK,IAAiB,IAAIC,iBAAe;AAAA,IACxC,aAAAJ;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAiBF;AAAA,IACjB,oBAAoBM,EAAoB,CAACC,MAAgB;AAEvD,UAAIA,EAAY,WAAW;AACzB,eAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAA;AAGzC,YAAMC,IAAQ,KACRC,IAAa,IACbC,IAAY,IACZC,IAASF,IAAcF,EAAY,SAASG,GAG5CE,IAAYL,EAAY,CAAC,GAEzBM,IADO,IAAI,MAAMD,EAAU,UAAU,KAAK,GAAI,EAC/B,mBAAmB,SAAS;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,MAAA,CACP,GAEKE,IAAc,qEAAqEC,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKF,CAAO,WAE3JG,IAAgBT,EAAY,IAAI,CAACU,GAAMC,MAAM;;AACjD,cAAMC,IAAOV,IAAcS,IAAIR,IAAa,IACtCU,IAAaH,EAAK,cAAc,UAAUC,IAAI,CAAC,IAG/CG,IAAYlB,KAAA,gBAAAA,EAAkBiB,IAC9BE,IAAQD,IACVA,EAAUJ,EAAK,UAAU,CAAC,IAC1B,KAAGM,IAAAN,EAAK,WAAL,gBAAAM,EAAa,QAAQ,OAAM,GAAG;AAErC,eAAO,mBAAmBJ,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,aAAa,KAAKK,CAAU;AAAA,mCACjHD,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKO,CAAK;AAAA,MACxI,CAAC,EAAE,KAAK,EAAE,GAEJE,IAAUV,IAAcE;AAE9B,aAAO,EAAE,OAAAR,GAAO,QAAAG,GAAQ,SAAAa,EAAA;AAAA,IAC1B,CAAC;AAAA,EAAA,CACF;AAED,EAAA1B,EAAQ,eAAe;AAAA,IACrB,IAAI2B,kBAAA;AAAA,IACJ,IAAIC,yBAAA;AAAA,IACJ,IAAIC,sBAAA;AAAA,IACJvB;AAAA,EAAA;AAEJ;AAgBO,SAASwB,EACd9B,GACAC,IAAiC,IAC3B;AACN,QAAM;AAAA,IACJ,WAAA8B,IAAYC,EAAAA,iBAAiB;AAAA,IAC7B,aAAAC,IAAcC,EAAAA,mBAAmB;AAAA,IACjC,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC,IAAoB;AAAA,EAAA,IAClBnC;AAEJ,EAAAD,EAAQ,eAAe;AAAA,IACrB,IAAIqC,iBAAe;AAAA,MACjB,WAAAN;AAAA,MACA,aAAAE;AAAA,MACA,gBAAAE;AAAA,MACA,mBAAAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;"}