@bikdotai/bik-component-library 0.0.859-beta.0 → 0.0.859

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 (59) hide show
  1. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  2. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  3. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  5. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  6. package/dist/cjs/icons/Informational/Communication/At.js +2 -0
  7. package/dist/cjs/icons/Informational/Communication/At.js.map +1 -0
  8. package/dist/cjs/icons/index.js +1 -1
  9. package/dist/cjs/index.js +1 -1
  10. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -3
  11. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +172 -182
  12. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  13. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  14. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  15. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +0 -1
  16. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  17. package/dist/esm/components/analytics-chips-and-dropdowns/index.d.ts +0 -4
  18. package/dist/esm/icons/Informational/Communication/At.d.ts +7 -0
  19. package/dist/esm/icons/Informational/Communication/At.js +47 -0
  20. package/dist/esm/icons/Informational/Communication/At.js.map +1 -0
  21. package/dist/esm/icons/Informational/Communication/index.d.ts +1 -0
  22. package/dist/esm/icons/index.d.ts +24 -24
  23. package/dist/esm/icons/index.js +592 -590
  24. package/dist/esm/icons/index.js.map +1 -1
  25. package/dist/esm/index.js +379 -383
  26. package/dist/esm/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +0 -2
  29. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +0 -1
  30. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +0 -2
  31. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +0 -1
  32. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +0 -2
  33. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +0 -1
  34. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +0 -2
  35. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +0 -1
  36. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js +0 -2
  37. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +0 -1
  38. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +0 -2
  39. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +0 -1
  40. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.d.ts +0 -16
  41. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +0 -69
  42. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +0 -1
  43. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.d.ts +0 -3
  44. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +0 -166
  45. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +0 -1
  46. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.model.d.ts +0 -21
  47. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.d.ts +0 -3
  48. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +0 -176
  49. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +0 -1
  50. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.model.d.ts +0 -19
  51. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.d.ts +0 -23
  52. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +0 -48
  53. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +0 -1
  54. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.d.ts +0 -3
  55. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js +0 -18
  56. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +0 -1
  57. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.d.ts +0 -4
  58. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +0 -13
  59. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.859-beta.0",
3
+ "version": "0.0.859",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("../../TypographyStyle.js"),e=require("../../../constants/Theme.js"),n=({title:o,padding:t,gap:i,dataTest:d,wrapperStyle:l,children:s})=>r.jsxs("div",{"data-test":d,style:{display:"flex",flexDirection:"column",gap:i,width:"100%",padding:t,borderRadius:8,border:`1px solid ${e.COLORS.stroke.primary}`,backgroundColor:e.COLORS.surface.standard,...l},children:[o&&r.jsx(a.TitleRegular,{color:e.COLORS.content.primary,children:o}),s]}),c=({value:o,chip:t})=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx(a.TitleMedium,{color:e.COLORS.content.primary,style:{whiteSpace:"nowrap"},children:o}),t&&r.jsx("div",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",borderRadius:4,border:`1px solid ${e.COLORS.stroke.primary}`,backgroundColor:e.COLORS.surface.subdued,whiteSpace:"nowrap"},children:r.jsx(a.BodyCaption,{color:e.COLORS.content.secondary,children:t})})]});exports.ChartCard=n;exports.ChartValueRow=c;
2
- //# sourceMappingURL=ChartLayout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChartLayout.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/ChartLayout.tsx"],"sourcesContent":["import React, { CSSProperties, ReactNode } from 'react';\nimport {\n\tBodyCaption,\n\tTitleMedium,\n\tTitleRegular,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\ninterface ChartCardProps {\n\ttitle?: string;\n\tpadding: CSSProperties['padding'];\n\tgap: number;\n\tdataTest: string;\n\twrapperStyle?: CSSProperties;\n\tchildren: ReactNode;\n}\n\nexport const ChartCard: React.FC<ChartCardProps> = ({\n\ttitle,\n\tpadding,\n\tgap,\n\tdataTest,\n\twrapperStyle,\n\tchildren,\n}) => (\n\t<div\n\t\tdata-test={dataTest}\n\t\tstyle={{\n\t\t\tdisplay: 'flex',\n\t\t\tflexDirection: 'column',\n\t\t\tgap,\n\t\t\twidth: '100%',\n\t\t\tpadding,\n\t\t\tborderRadius: 8,\n\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t...wrapperStyle,\n\t\t}}\n\t>\n\t\t{title && (\n\t\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t)}\n\t\t{children}\n\t</div>\n);\n\ninterface ChartValueRowProps {\n\tvalue: ReactNode;\n\tchip?: ReactNode;\n}\n\nexport const ChartValueRow: React.FC<ChartValueRowProps> = ({\n\tvalue,\n\tchip,\n}) => (\n\t<div\n\t\tstyle={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}\n\t>\n\t\t<TitleMedium\n\t\t\tcolor={COLORS.content.primary}\n\t\t\tstyle={{ whiteSpace: 'nowrap' }}\n\t\t>\n\t\t\t{value}\n\t\t</TitleMedium>\n\t\t{chip && (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\tbackgroundColor: COLORS.surface.subdued,\n\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{chip}</BodyCaption>\n\t\t\t</div>\n\t\t)}\n\t</div>\n);\n"],"names":["ChartCard","title","padding","gap","dataTest","wrapperStyle","children","jsxs","COLORS","TitleRegular","ChartValueRow","value","chip","jsx","TitleMedium","BodyCaption"],"mappings":"oMAiBaA,EAAsC,CAAC,CACnD,MAAAC,EACA,QAAAC,EACA,IAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,CACD,IACCC,EAAAA,KAAC,MAAA,CACA,YAAWH,EACX,MAAO,CACN,QAAS,OACT,cAAe,SACf,IAAAD,EACA,MAAO,OACP,QAAAD,EACA,aAAc,EACd,OAAQ,aAAaM,EAAAA,OAAO,OAAO,OAAO,GAC1C,gBAAiBA,EAAAA,OAAO,QAAQ,SAChC,GAAGH,CAAA,EAGH,SAAA,CAAAJ,SACCQ,EAAAA,aAAA,CAAa,MAAOD,SAAO,QAAQ,QAAU,SAAAP,EAAM,EAEpDK,CAAA,CAAA,CACF,EAQYI,EAA8C,CAAC,CAC3D,MAAAC,EACA,KAAAC,CACD,IACCL,EAAAA,KAAC,MAAA,CACA,MAAO,CAAE,QAAS,OAAQ,WAAY,SAAU,IAAK,EAAG,SAAU,MAAA,EAElE,SAAA,CAAAM,EAAAA,IAACC,EAAAA,YAAA,CACA,MAAON,EAAAA,OAAO,QAAQ,QACtB,MAAO,CAAE,WAAY,QAAA,EAEpB,SAAAG,CAAA,CAAA,EAEDC,GACAC,EAAAA,IAAC,MAAA,CACA,MAAO,CACN,QAAS,cACT,WAAY,SACZ,QAAS,UACT,aAAc,EACd,OAAQ,aAAaL,EAAAA,OAAO,OAAO,OAAO,GAC1C,gBAAiBA,EAAAA,OAAO,QAAQ,QAChC,WAAY,QAAA,EAGb,eAACO,EAAAA,YAAA,CAAY,MAAOP,EAAAA,OAAO,QAAQ,UAAY,SAAAI,CAAA,CAAK,CAAA,CAAA,CACrD,CAAA,CAEF"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),f=require("../../../TypographyStyle.js"),i=require("../../../../constants/Theme.js"),O=require("../ChartLayout.js"),g=require("../chartPalette.js"),r=require("../formatChartValue.js"),S=Array.from({length:2},(e,n)=>({key:`placeholder-${n}`,label:"",value:0})),j=({row:{bar:e,fillWidth:n,color:l,percentageLabel:c},labelWidth:d,barHeight:p,showTooltip:u,locale:h})=>{const[m,o]=b.useState(!1);return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:32},children:[t.jsxs("div",{style:{width:d,flexShrink:0,display:"flex",flexDirection:"column",gap:8},children:[t.jsx(f.BodyCaption,{color:i.COLORS.content.secondary,children:e.label}),t.jsx(O.ChartValueRow,{value:e.valueLabel??r.formatChartValue(r.toChartValue(e.value),h),chip:c})]}),t.jsxs("div",{"data-test":`comparison-bar-chart-bar-${e.key}`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{position:"relative",flex:1,height:p},children:[t.jsx("div",{"data-test":`comparison-bar-chart-track-${e.key}`,style:{position:"absolute",inset:0,borderRadius:4,border:`1px solid ${i.COLORS.stroke.primary}`,backgroundColor:i.COLORS.surface.standard,overflow:"hidden"},children:t.jsx("div",{"data-test":`comparison-bar-chart-fill-${e.key}`,style:{position:"absolute",top:0,left:0,bottom:0,width:`${n}%`,backgroundColor:l}})}),u&&m&&t.jsxs("div",{"data-test":`comparison-bar-chart-tooltip-${e.key}`,style:{position:"absolute",top:"50%",left:`${r.clamp(n/2,8,92)}%`,transform:"translate(-50%, -50%)",padding:"4px 8px",borderRadius:4,backgroundColor:i.COLORS.content.primary,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.12)",pointerEvents:"none"},children:[t.jsx("div",{style:{position:"absolute",top:-5,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:`5px solid ${i.COLORS.content.primary}`}}),t.jsx(f.BodyCaption,{color:i.COLORS.content.primaryInverse,children:c})]})]})]})},L=({bars:e=[],title:n,total:l,colors:c=g.COMPARISON_BAR_COLORS,labelWidth:d=180,barHeight:p=52,locale:u,showTooltip:h=!0,wrapperStyle:m})=>{const o=e.some(a=>r.toChartValue(a.value)>0),C=e.length?e:S,R=b.useMemo(()=>{const a=l!==void 0?r.toChartValue(l):C.reduce((s,x)=>s+r.toChartValue(x.value),0);return C.map((s,x)=>{const y=s.percentage??(a>0?r.toChartValue(s.value)/a*100:0),v=Number.isFinite(y)?Math.max(y,0):0;return{bar:s,fillWidth:r.clamp(v,0,100),color:o?s.color??g.pickColor(c,x):void 0,percentageLabel:o?s.percentageLabel??`${r.formatPercent(v)}%`:""}})},[C,l,c,o]);return t.jsx(O.ChartCard,{dataTest:"comparison-bar-chart",title:n,padding:24,gap:24,wrapperStyle:m,children:R.map(a=>t.jsx(j,{row:a,labelWidth:d,barHeight:p,showTooltip:h&&o,locale:u},a.bar.key))})};exports.ComparisonBarChart=L;
2
- //# sourceMappingURL=ComparisonBarChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComparisonBarChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ChartCard, ChartValueRow } from '../ChartLayout';\nimport { COMPARISON_BAR_COLORS, pickColor } from '../chartPalette';\nimport {\n\tclamp,\n\tformatChartValue,\n\tformatPercent,\n\ttoChartValue,\n} from '../formatChartValue';\nimport type {\n\tComparisonBarChartI,\n\tComparisonBarI,\n} from './ComparisonBarChart.model';\n\nconst PLACEHOLDER_BARS: ComparisonBarI[] = Array.from(\n\t{ length: 2 },\n\t(_, index) => ({ key: `placeholder-${index}`, label: '', value: 0 }),\n);\n\ninterface PreparedBar {\n\tbar: ComparisonBarI;\n\tfillWidth: number;\n\tcolor?: string;\n\tpercentageLabel: string;\n}\n\ninterface BarRowProps {\n\trow: PreparedBar;\n\tlabelWidth: number;\n\tbarHeight: number;\n\tshowTooltip: boolean;\n\tlocale?: string;\n}\n\nconst BarRow: React.FC<BarRowProps> = ({\n\trow: { bar, fillWidth, color, percentageLabel },\n\tlabelWidth,\n\tbarHeight,\n\tshowTooltip,\n\tlocale,\n}) => {\n\tconst [isHovered, setIsHovered] = useState(false);\n\n\treturn (\n\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 32 }}>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tgap: 8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{bar.label}</BodyCaption>\n\t\t\t\t<ChartValueRow\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tbar.valueLabel ?? formatChartValue(toChartValue(bar.value), locale)\n\t\t\t\t\t}\n\t\t\t\t\tchip={percentageLabel}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tdata-test={`comparison-bar-chart-bar-${bar.key}`}\n\t\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\t\tstyle={{ position: 'relative', flex: 1, height: barHeight }}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-test={`comparison-bar-chart-track-${bar.key}`}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-fill-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\twidth: `${fillWidth}%`,\n\t\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{showTooltip && isHovered && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-tooltip-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: '50%',\n\t\t\t\t\t\t\tleft: `${clamp(fillWidth / 2, 8, 92)}%`,\n\t\t\t\t\t\t\ttransform: 'translate(-50%, -50%)',\n\t\t\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\tbackgroundColor: COLORS.content.primary,\n\t\t\t\t\t\t\tboxShadow: '0px 2px 4px rgba(0, 0, 0, 0.12)',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: -5,\n\t\t\t\t\t\t\t\tleft: '50%',\n\t\t\t\t\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\tborderLeft: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderRight: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderBottom: `5px solid ${COLORS.content.primary}`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.primaryInverse}>\n\t\t\t\t\t\t\t{percentageLabel}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport const ComparisonBarChart: React.FC<ComparisonBarChartI> = ({\n\tbars = [],\n\ttitle,\n\ttotal,\n\tcolors = COMPARISON_BAR_COLORS,\n\tlabelWidth = 180,\n\tbarHeight = 52,\n\tlocale,\n\tshowTooltip = true,\n\twrapperStyle,\n}) => {\n\tconst hasData = bars.some((bar) => toChartValue(bar.value) > 0);\n\tconst visibleBars = bars.length ? bars : PLACEHOLDER_BARS;\n\n\tconst rows = useMemo<PreparedBar[]>(() => {\n\t\tconst denominator =\n\t\t\ttotal !== undefined\n\t\t\t\t? toChartValue(total)\n\t\t\t\t: visibleBars.reduce((sum, bar) => sum + toChartValue(bar.value), 0);\n\n\t\treturn visibleBars.map((bar, index) => {\n\t\t\tconst percentage =\n\t\t\t\tbar.percentage ??\n\t\t\t\t(denominator > 0 ? (toChartValue(bar.value) / denominator) * 100 : 0);\n\t\t\tconst share = Number.isFinite(percentage) ? Math.max(percentage, 0) : 0;\n\t\t\treturn {\n\t\t\t\tbar,\n\t\t\t\tfillWidth: clamp(share, 0, 100),\n\t\t\t\tcolor: hasData ? bar.color ?? pickColor(colors, index) : undefined,\n\t\t\t\tpercentageLabel: hasData\n\t\t\t\t\t? bar.percentageLabel ?? `${formatPercent(share)}%`\n\t\t\t\t\t: '',\n\t\t\t};\n\t\t});\n\t}, [visibleBars, total, colors, hasData]);\n\n\treturn (\n\t\t<ChartCard\n\t\t\tdataTest=\"comparison-bar-chart\"\n\t\t\ttitle={title}\n\t\t\tpadding={24}\n\t\t\tgap={24}\n\t\t\twrapperStyle={wrapperStyle}\n\t\t>\n\t\t\t{rows.map((row) => (\n\t\t\t\t<BarRow\n\t\t\t\t\tkey={row.bar.key}\n\t\t\t\t\trow={row}\n\t\t\t\t\tlabelWidth={labelWidth}\n\t\t\t\t\tbarHeight={barHeight}\n\t\t\t\t\tshowTooltip={showTooltip && hasData}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ChartCard>\n\t);\n};\n"],"names":["PLACEHOLDER_BARS","_","index","BarRow","bar","fillWidth","color","percentageLabel","labelWidth","barHeight","showTooltip","locale","isHovered","setIsHovered","useState","jsxs","jsx","BodyCaption","COLORS","ChartValueRow","formatChartValue","toChartValue","clamp","ComparisonBarChart","bars","title","total","colors","COMPARISON_BAR_COLORS","wrapperStyle","hasData","visibleBars","rows","useMemo","denominator","sum","percentage","share","pickColor","formatPercent","ChartCard","row"],"mappings":"gUAgBMA,EAAqC,MAAM,KAChD,CAAE,OAAQ,CAAA,EACV,CAACC,EAAGC,KAAW,CAAE,IAAK,eAAeA,CAAK,GAAI,MAAO,GAAI,MAAO,CAAA,EACjE,EAiBMC,EAAgC,CAAC,CACtC,IAAK,CAAE,IAAAC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EAAY,CAAC,EAAI,EACtE,MAAO,CACN,IAAAhC,EACA,UAAWkB,EAAAA,MAAMe,EAAO,EAAG,GAAG,EAC9B,MAAOP,EAAU1B,EAAI,OAASkC,EAAAA,UAAUX,EAAQzB,CAAK,EAAI,OACzD,gBAAiB4B,EACd1B,EAAI,iBAAmB,GAAGmC,gBAAcF,CAAK,CAAC,IAC9C,EAAA,CAEL,CAAC,CACF,EAAG,CAACN,EAAaL,EAAOC,EAAQG,CAAO,CAAC,EAExC,OACCd,EAAAA,IAACwB,EAAAA,UAAA,CACA,SAAS,uBACT,MAAAf,EACA,QAAS,GACT,IAAK,GACL,aAAAI,EAEC,SAAAG,EAAK,IAAKS,GACVzB,EAAAA,IAACb,EAAA,CAEA,IAAAsC,EACA,WAAAjC,EACA,UAAAC,EACA,YAAaC,GAAeoB,EAC5B,OAAAnB,CAAA,EALK8B,EAAI,IAAI,GAAA,CAOd,CAAA,CAAA,CAGJ"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),f=require("react"),L=require("../../../TypographyStyle.js"),v=require("../../../../constants/Theme.js"),j=require("../ChartLayout.js"),b=require("../chartPalette.js"),n=require("../formatChartValue.js"),m=require("./funnelGeometry.js"),S=Array.from({length:4},(t,o)=>({key:`placeholder-${o}`,label:"",value:0})),k=(t,o)=>{const a=t[o];if(a.percentageLabel!==void 0)return a.percentageLabel;if(o===0)return n.toChartValue(a.value)>0?"100%":"";const l=a.branchOf?t.find(p=>p.key===a.branchOf):t[o-1],s=n.toChartValue(l?.value);if(!l||s===0)return"";const h=n.toChartValue(a.value)/s*100;return`${n.formatPercent(h)}% of ${l.label}`},C=({left:t,height:o})=>r.jsx("div",{style:{position:"absolute",top:0,bottom:o===void 0?0:void 0,height:o,left:t,width:1,backgroundColor:v.COLORS.stroke.primary}}),O=({stage:t,color:o,chip:a,locale:l})=>r.jsxs("div",{"data-test":`funnel-chart-header-${t.key}`,style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",padding:"0 8px 0 12px"},children:[t.label&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",opacity:.8},children:[r.jsx("span",{style:{width:16,height:16,borderRadius:2.667,backgroundColor:o,flexShrink:0}}),r.jsx(L.BodyTiny,{color:v.COLORS.content.secondary,children:t.label})]}),r.jsx(j.ChartValueRow,{value:t.valueLabel??n.formatChartValue(n.toChartValue(t.value),l),chip:a})]}),w=({stages:t=[],title:o,plotHeight:a=291,headerHeight:l=83,colors:s=b.FUNNEL_BAND_COLORS,locale:h,wrapperStyle:p})=>{const i=t.length?t:S,c=f.useMemo(()=>m.buildFunnelLayout(i,{plotHeight:a,headerHeight:l}),[i,a,l]),u=!c.isEmpty,x=e=>`${e/m.FUNNEL_VIEW_WIDTH*100}%`,y=f.useMemo(()=>i.map((e,d)=>({stage:e,color:u?e.color??b.pickColor(s,d):v.COLORS.content.inactive,chip:u?k(i,d):""})),[i,s,u]),g=f.useMemo(()=>new Map(y.map(({stage:e,color:d})=>[e.key,d])),[y]);return r.jsx(j.ChartCard,{dataTest:"funnel-chart",title:o,padding:"18px 24px",gap:14,wrapperStyle:{overflow:"hidden",...p},children:r.jsxs("div",{style:{position:"relative",width:"100%",height:a},children:[r.jsx("svg",{width:"100%",height:"100%",viewBox:`0 0 ${m.FUNNEL_VIEW_WIDTH} ${a}`,preserveAspectRatio:"none","aria-hidden":!0,style:{position:"absolute",inset:0},children:c.bands.map(e=>r.jsx("path",{"data-test":`funnel-chart-band-${e.key}`,d:e.d,fill:u?g.get(e.key):"transparent"},e.key))}),c.separators.full.map(e=>r.jsx(C,{left:x(e)},`full-${e}`)),c.separators.header.map(e=>r.jsx(C,{left:x(e),height:l},`header-${e}`)),r.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:l,display:"flex"},children:y.map(e=>r.jsx(O,{...e,locale:h},e.stage.key))})]})})};exports.FunnelChart=w;
2
- //# sourceMappingURL=FunnelChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FunnelChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { BodyTiny } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ChartCard, ChartValueRow } from '../ChartLayout';\nimport { FUNNEL_BAND_COLORS, pickColor } from '../chartPalette';\nimport {\n\tformatChartValue,\n\tformatPercent,\n\ttoChartValue,\n} from '../formatChartValue';\nimport type { FunnelChartI, FunnelStageI } from './FunnelChart.model';\nimport { buildFunnelLayout, FUNNEL_VIEW_WIDTH } from './funnelGeometry';\n\nconst PLACEHOLDER_STAGES: FunnelStageI[] = Array.from(\n\t{ length: 4 },\n\t(_, index) => ({ key: `placeholder-${index}`, label: '', value: 0 }),\n);\n\nconst derivePercentageLabel = (\n\tstages: FunnelStageI[],\n\tindex: number,\n): string => {\n\tconst stage = stages[index];\n\tif (stage.percentageLabel !== undefined) {\n\t\treturn stage.percentageLabel;\n\t}\n\tif (index === 0) {\n\t\treturn toChartValue(stage.value) > 0 ? '100%' : '';\n\t}\n\tconst reference = stage.branchOf\n\t\t? stages.find((candidate) => candidate.key === stage.branchOf)\n\t\t: stages[index - 1];\n\tconst referenceValue = toChartValue(reference?.value);\n\tif (!reference || referenceValue === 0) {\n\t\treturn '';\n\t}\n\tconst share = (toChartValue(stage.value) / referenceValue) * 100;\n\treturn `${formatPercent(share)}% of ${reference.label}`;\n};\n\nconst Separator: React.FC<{ left: string; height?: number }> = ({\n\tleft,\n\theight,\n}) => (\n\t<div\n\t\tstyle={{\n\t\t\tposition: 'absolute',\n\t\t\ttop: 0,\n\t\t\tbottom: height === undefined ? 0 : undefined,\n\t\t\theight,\n\t\t\tleft,\n\t\t\twidth: 1,\n\t\t\tbackgroundColor: COLORS.stroke.primary,\n\t\t}}\n\t/>\n);\n\ninterface StageHeaderProps {\n\tstage: FunnelStageI;\n\tcolor?: string;\n\tchip: string;\n\tlocale?: string;\n}\n\nconst StageHeader: React.FC<StageHeaderProps> = ({\n\tstage,\n\tcolor,\n\tchip,\n\tlocale,\n}) => (\n\t<div\n\t\tdata-test={`funnel-chart-header-${stage.key}`}\n\t\tstyle={{\n\t\t\tflex: 1,\n\t\t\tminWidth: 0,\n\t\t\tdisplay: 'flex',\n\t\t\tflexDirection: 'column',\n\t\t\tgap: 8,\n\t\t\talignItems: 'flex-start',\n\t\t\tpadding: '0 8px 0 12px',\n\t\t}}\n\t>\n\t\t{stage.label && (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tgap: 8,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\topacity: 0.8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\twidth: 16,\n\t\t\t\t\t\theight: 16,\n\t\t\t\t\t\tborderRadius: 2.667,\n\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<BodyTiny color={COLORS.content.secondary}>{stage.label}</BodyTiny>\n\t\t\t</div>\n\t\t)}\n\t\t<ChartValueRow\n\t\t\tvalue={\n\t\t\t\tstage.valueLabel ?? formatChartValue(toChartValue(stage.value), locale)\n\t\t\t}\n\t\t\tchip={chip}\n\t\t/>\n\t</div>\n);\n\nexport const FunnelChart: React.FC<FunnelChartI> = ({\n\tstages = [],\n\ttitle,\n\tplotHeight = 291,\n\theaderHeight = 83,\n\tcolors = FUNNEL_BAND_COLORS,\n\tlocale,\n\twrapperStyle,\n}) => {\n\tconst visibleStages = stages.length ? stages : PLACEHOLDER_STAGES;\n\n\tconst layout = useMemo(\n\t\t() => buildFunnelLayout(visibleStages, { plotHeight, headerHeight }),\n\t\t[visibleStages, plotHeight, headerHeight],\n\t);\n\n\tconst hasData = !layout.isEmpty;\n\tconst toPercent = (x: number) => `${(x / FUNNEL_VIEW_WIDTH) * 100}%`;\n\n\tconst headers = useMemo(\n\t\t() =>\n\t\t\tvisibleStages.map((stage, index) => ({\n\t\t\t\tstage,\n\t\t\t\tcolor: hasData\n\t\t\t\t\t? stage.color ?? pickColor(colors, index)\n\t\t\t\t\t: COLORS.content.inactive,\n\t\t\t\tchip: hasData ? derivePercentageLabel(visibleStages, index) : '',\n\t\t\t})),\n\t\t[visibleStages, colors, hasData],\n\t);\n\n\tconst colorByStage = useMemo(\n\t\t() => new Map(headers.map(({ stage, color }) => [stage.key, color])),\n\t\t[headers],\n\t);\n\n\treturn (\n\t\t<ChartCard\n\t\t\tdataTest=\"funnel-chart\"\n\t\t\ttitle={title}\n\t\t\tpadding=\"18px 24px\"\n\t\t\tgap={14}\n\t\t\twrapperStyle={{ overflow: 'hidden', ...wrapperStyle }}\n\t\t>\n\t\t\t<div style={{ position: 'relative', width: '100%', height: plotHeight }}>\n\t\t\t\t<svg\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tviewBox={`0 0 ${FUNNEL_VIEW_WIDTH} ${plotHeight}`}\n\t\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t\t\taria-hidden\n\t\t\t\t\tstyle={{ position: 'absolute', inset: 0 }}\n\t\t\t\t>\n\t\t\t\t\t{layout.bands.map((band) => (\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\tkey={band.key}\n\t\t\t\t\t\t\tdata-test={`funnel-chart-band-${band.key}`}\n\t\t\t\t\t\t\td={band.d}\n\t\t\t\t\t\t\tfill={hasData ? colorByStage.get(band.key) : 'transparent'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</svg>\n\n\t\t\t\t{layout.separators.full.map((x) => (\n\t\t\t\t\t<Separator key={`full-${x}`} left={toPercent(x)} />\n\t\t\t\t))}\n\t\t\t\t{layout.separators.header.map((x) => (\n\t\t\t\t\t<Separator\n\t\t\t\t\t\tkey={`header-${x}`}\n\t\t\t\t\t\tleft={toPercent(x)}\n\t\t\t\t\t\theight={headerHeight}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\theight: headerHeight,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{headers.map((header) => (\n\t\t\t\t\t\t<StageHeader key={header.stage.key} {...header} locale={locale} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</ChartCard>\n\t);\n};\n"],"names":["PLACEHOLDER_STAGES","_","index","derivePercentageLabel","stages","stage","toChartValue","reference","candidate","referenceValue","share","formatPercent","Separator","left","height","jsx","COLORS","StageHeader","color","chip","locale","jsxs","BodyTiny","ChartValueRow","formatChartValue","FunnelChart","title","plotHeight","headerHeight","colors","FUNNEL_BAND_COLORS","wrapperStyle","visibleStages","layout","useMemo","buildFunnelLayout","hasData","toPercent","x","FUNNEL_VIEW_WIDTH","headers","pickColor","colorByStage","ChartCard","band","header"],"mappings":"iWAaMA,EAAqC,MAAM,KAChD,CAAE,OAAQ,CAAA,EACV,CAACC,EAAGC,KAAW,CAAE,IAAK,eAAeA,CAAK,GAAI,MAAO,GAAI,MAAO,CAAA,EACjE,EAEMC,EAAwB,CAC7BC,EACAF,IACY,CACZ,MAAMG,EAAQD,EAAOF,CAAK,EAC1B,GAAIG,EAAM,kBAAoB,OAC7B,OAAOA,EAAM,gBAEd,GAAIH,IAAU,EACb,OAAOI,EAAAA,aAAaD,EAAM,KAAK,EAAI,EAAI,OAAS,GAEjD,MAAME,EAAYF,EAAM,SACrBD,EAAO,KAAMI,GAAcA,EAAU,MAAQH,EAAM,QAAQ,EAC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C,SAAAM,EAAO,MAAM,IAAKW,GAClB7B,EAAAA,IAAC,OAAA,CAEA,YAAW,qBAAqB6B,EAAK,GAAG,GACxC,EAAGA,EAAK,EACR,KAAMR,EAAUM,EAAa,IAAIE,EAAK,GAAG,EAAI,aAAA,EAHxCA,EAAK,GAAA,CAKX,CAAA,CAAA,EAGDX,EAAO,WAAW,KAAK,IAAKK,GAC5BvB,EAAAA,IAACH,EAAA,CAA4B,KAAMyB,EAAUC,CAAC,CAAA,EAA9B,QAAQA,CAAC,EAAwB,CACjD,EACAL,EAAO,WAAW,OAAO,IAAKK,GAC9BvB,EAAAA,IAACH,EAAA,CAEA,KAAMyB,EAAUC,CAAC,EACjB,OAAQV,CAAA,EAFH,UAAUU,CAAC,EAAA,CAIjB,EAEDvB,EAAAA,IAAC,MAAA,CACA,MAAO,CACN,SAAU,WACV,IAAK,EACL,KAAM,EACN,MAAO,EACP,OAAQa,EACR,QAAS,MAAA,EAGT,SAAAY,EAAQ,IAAKK,GACb9B,EAAAA,IAACE,EAAA,CAAoC,GAAG4B,EAAQ,OAAAzB,CAAA,EAA9ByB,EAAO,MAAM,GAAiC,CAChE,CAAA,CAAA,CACF,CAAA,CACD,CAAA,CAAA,CAGH"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../formatChartValue.js"),v=1e3,l=e=>Math.round(e*100)/100,N=e=>e.reduce((a,c,o)=>{const r=a[a.length-1];return c.branchOf&&r?.branchOf===c.branchOf?r.stageIndexes.push(o):a.push({branchOf:c.branchOf,stageIndexes:[o]}),a},[]),W=(e,{plotHeight:a,headerHeight:c})=>{const o=Math.max(a-c,0),r=c+o/2,g=i.toChartValue(e[0]?.value),x=e.length===0||g===0||o===0,d=t=>l(t/e.length*v),I=t=>x?0:i.clamp(t/g*o,0,o),s=N(e);let p=0;const u=s.map(t=>{const n=d(p);return p+=t.stageIndexes.length,{x0:n,x1:d(p)}}),T=s.map(t=>t.stageIndexes.reduce((n,h)=>n+i.toChartValue(e[h].value),0)),$=[];return s.forEach((t,n)=>{const{x0:h,x1:y}=u[n],f=T[n],F=T[n+1]??f,E=I(f),L=I(F);let b=r-E/2,m=r-L/2;t.stageIndexes.forEach(O=>{const V=f>0?i.toChartValue(e[O].value)/f:0,C=b+E*V,M=m+L*V;$.push({key:e[O].key,d:[`M${h} ${l(b)}`,`L${y} ${l(m)}`,`L${y} ${l(M)}`,`L${h} ${l(C)}`,"Z"].join(" ")}),b=C,m=M})}),{bands:$,separators:{full:u.length?[u[0].x0,...u.map(t=>t.x1)]:[],header:s.flatMap(t=>t.stageIndexes.slice(1).map(n=>d(n)))},isEmpty:x}};exports.FUNNEL_VIEW_WIDTH=v;exports.buildFunnelLayout=W;
2
- //# sourceMappingURL=funnelGeometry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"funnelGeometry.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.ts"],"sourcesContent":["import { clamp, toChartValue } from '../formatChartValue';\n\nexport const FUNNEL_VIEW_WIDTH = 1000;\n\nexport interface FunnelGeometryStage {\n\tkey: string;\n\tvalue: number;\n\tbranchOf?: string;\n}\n\nexport interface FunnelGeometryOptions {\n\tplotHeight: number;\n\theaderHeight: number;\n}\n\nexport interface FunnelBandLayout {\n\tkey: string;\n\td: string;\n}\n\nexport interface FunnelLayout {\n\tbands: FunnelBandLayout[];\n\tseparators: {\n\t\tfull: number[];\n\t\theader: number[];\n\t};\n\tisEmpty: boolean;\n}\n\ninterface ColumnGroup {\n\tbranchOf?: string;\n\tstageIndexes: number[];\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\nconst groupIntoColumns = (stages: FunnelGeometryStage[]): ColumnGroup[] =>\n\tstages.reduce<ColumnGroup[]>((groups, stage, index) => {\n\t\tconst current = groups[groups.length - 1];\n\t\tif (stage.branchOf && current?.branchOf === stage.branchOf) {\n\t\t\tcurrent.stageIndexes.push(index);\n\t\t} else {\n\t\t\tgroups.push({ branchOf: stage.branchOf, stageIndexes: [index] });\n\t\t}\n\t\treturn groups;\n\t}, []);\n\nexport const buildFunnelLayout = (\n\tstages: FunnelGeometryStage[],\n\t{ plotHeight, headerHeight }: FunnelGeometryOptions,\n): FunnelLayout => {\n\tconst bandArea = Math.max(plotHeight - headerHeight, 0);\n\tconst centerY = headerHeight + bandArea / 2;\n\tconst baseValue = toChartValue(stages[0]?.value);\n\tconst isEmpty = stages.length === 0 || baseValue === 0 || bandArea === 0;\n\n\tconst toX = (cellIndex: number) =>\n\t\tround((cellIndex / stages.length) * FUNNEL_VIEW_WIDTH);\n\tconst heightOf = (value: number) =>\n\t\tisEmpty ? 0 : clamp((value / baseValue) * bandArea, 0, bandArea);\n\n\tconst groups = groupIntoColumns(stages);\n\tlet cellCursor = 0;\n\tconst columns = groups.map((group) => {\n\t\tconst x0 = toX(cellCursor);\n\t\tcellCursor += group.stageIndexes.length;\n\t\treturn { x0, x1: toX(cellCursor) };\n\t});\n\n\tconst columnTotals = groups.map((group) =>\n\t\tgroup.stageIndexes.reduce(\n\t\t\t(total, index) => total + toChartValue(stages[index].value),\n\t\t\t0,\n\t\t),\n\t);\n\n\tconst bands: FunnelBandLayout[] = [];\n\tgroups.forEach((group, columnIndex) => {\n\t\tconst { x0, x1 } = columns[columnIndex];\n\t\tconst leftTotal = columnTotals[columnIndex];\n\t\tconst rightTotal = columnTotals[columnIndex + 1] ?? leftTotal;\n\t\tconst leftHeight = heightOf(leftTotal);\n\t\tconst rightHeight = heightOf(rightTotal);\n\n\t\tlet leftTop = centerY - leftHeight / 2;\n\t\tlet rightTop = centerY - rightHeight / 2;\n\n\t\tgroup.stageIndexes.forEach((stageIndex) => {\n\t\t\tconst share =\n\t\t\t\tleftTotal > 0 ? toChartValue(stages[stageIndex].value) / leftTotal : 0;\n\t\t\tconst leftBottom = leftTop + leftHeight * share;\n\t\t\tconst rightBottom = rightTop + rightHeight * share;\n\t\t\tbands.push({\n\t\t\t\tkey: stages[stageIndex].key,\n\t\t\t\td: [\n\t\t\t\t\t`M${x0} ${round(leftTop)}`,\n\t\t\t\t\t`L${x1} ${round(rightTop)}`,\n\t\t\t\t\t`L${x1} ${round(rightBottom)}`,\n\t\t\t\t\t`L${x0} ${round(leftBottom)}`,\n\t\t\t\t\t'Z',\n\t\t\t\t].join(' '),\n\t\t\t});\n\t\t\tleftTop = leftBottom;\n\t\t\trightTop = rightBottom;\n\t\t});\n\t});\n\n\treturn {\n\t\tbands,\n\t\tseparators: {\n\t\t\tfull: columns.length ? [columns[0].x0, ...columns.map((c) => c.x1)] : [],\n\t\t\theader: groups.flatMap((group) =>\n\t\t\t\tgroup.stageIndexes.slice(1).map((index) => toX(index)),\n\t\t\t),\n\t\t},\n\t\tisEmpty,\n\t};\n};\n"],"names":["FUNNEL_VIEW_WIDTH","round","value","groupIntoColumns","stages","groups","stage","index","current","buildFunnelLayout","plotHeight","headerHeight","bandArea","centerY","baseValue","toChartValue","isEmpty","toX","cellIndex","heightOf","clamp","cellCursor","columns","group","x0","columnTotals","total","bands","columnIndex","x1","leftTotal","rightTotal","leftHeight","rightHeight","leftTop","rightTop","stageIndex","share","leftBottom","rightBottom","c"],"mappings":"0HAEaA,EAAoB,IAgC3BC,EAASC,GAAkB,KAAK,MAAMA,EAAQ,GAAG,EAAI,IAErDC,EAAoBC,GACzBA,EAAO,OAAsB,CAACC,EAAQC,EAAOC,IAAU,CACtD,MAAMC,EAAUH,EAAOA,EAAO,OAAS,CAAC,EACxC,OAAIC,EAAM,UAAYE,GAAS,WAAaF,EAAM,SACjDE,EAAQ,aAAa,KAAKD,CAAK,EAE/BF,EAAO,KAAK,CAAE,SAAUC,EAAM,SAAU,aAAc,CAACC,CAAK,EAAG,EAEzDF,CACR,EAAG,EAAE,EAEOI,EAAoB,CAChCL,EACA,CAAE,WAAAM,EAAY,aAAAC,KACI,CAClB,MAAMC,EAAW,KAAK,IAAIF,EAAaC,EAAc,CAAC,EAChDE,EAAUF,EAAeC,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GACxB,IAAIL,CAAE,IAAI5B,EAAMkC,CAAQ,CAAC,GACzB,IAAIN,CAAE,IAAI5B,EAAMsC,CAAW,CAAC,GAC5B,IAAIf,CAAE,IAAIvB,EAAMqC,CAAU,CAAC,GAC3B,GAAA,EACC,KAAK,GAAG,CAAA,CACV,EACDJ,EAAUI,EACVH,EAAWI,CACZ,CAAC,CACF,CAAC,EAEM,CACN,MAAAZ,EACA,WAAY,CACX,KAAML,EAAQ,OAAS,CAACA,EAAQ,CAAC,EAAE,GAAI,GAAGA,EAAQ,IAAKkB,GAAMA,EAAE,EAAE,CAAC,EAAI,CAAA,EACtE,OAAQnC,EAAO,QAASkB,GACvBA,EAAM,aAAa,MAAM,CAAC,EAAE,IAAKhB,GAAUU,EAAIV,CAAK,CAAC,CAAA,CACtD,EAED,QAAAS,CAAA,CAEF"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../../../constants/Theme.js"),t=[O.COLORS.stroke.brandLightAlt,O.COLORS.background.brandLight,O.COLORS.background.brandTint,O.COLORS.background.brandVeryLight],d=[O.COLORS.background.brand,O.COLORS.stroke.brandSubdued,O.COLORS.stroke.brandLightAlt,O.COLORS.background.brandTint],e=(n,r)=>n.length?n[r%n.length]:void 0;exports.COMPARISON_BAR_COLORS=d;exports.FUNNEL_BAND_COLORS=t;exports.pickColor=e;
2
- //# sourceMappingURL=chartPalette.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chartPalette.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/chartPalette.ts"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\n\nexport const FUNNEL_BAND_COLORS = [\n\tCOLORS.stroke.brandLightAlt,\n\tCOLORS.background.brandLight,\n\tCOLORS.background.brandTint,\n\tCOLORS.background.brandVeryLight,\n];\n\nexport const COMPARISON_BAR_COLORS = [\n\tCOLORS.background.brand,\n\tCOLORS.stroke.brandSubdued,\n\tCOLORS.stroke.brandLightAlt,\n\tCOLORS.background.brandTint,\n];\n\nexport const pickColor = (colors: string[], index: number) =>\n\tcolors.length ? colors[index % colors.length] : undefined;\n"],"names":["FUNNEL_BAND_COLORS","COLORS","COMPARISON_BAR_COLORS","pickColor","colors","index"],"mappings":"+HAEaA,EAAqB,CACjCC,EAAAA,OAAO,OAAO,cACdA,EAAAA,OAAO,WAAW,WAClBA,EAAAA,OAAO,WAAW,UAClBA,EAAAA,OAAO,WAAW,cACnB,EAEaC,EAAwB,CACpCD,EAAAA,OAAO,WAAW,MAClBA,EAAAA,OAAO,OAAO,aACdA,EAAAA,OAAO,OAAO,cACdA,EAAAA,OAAO,WAAW,SACnB,EAEaE,EAAY,CAACC,EAAkBC,IAC3CD,EAAO,OAASA,EAAOC,EAAQD,EAAO,MAAM,EAAI"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:0,o=(t,r="en-IN")=>Number.isFinite(t)?new Intl.NumberFormat(r).format(t):"0",a=t=>{if(!Number.isFinite(t))return"0";const r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}`:r.toFixed(1)},m=(t,r,e)=>Math.min(Math.max(t,r),e);exports.clamp=m;exports.formatChartValue=o;exports.formatPercent=a;exports.toChartValue=n;
2
- //# sourceMappingURL=formatChartValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatChartValue.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/formatChartValue.ts"],"sourcesContent":["export const toChartValue = (value: number | undefined): number =>\n\ttypeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n\nexport const formatChartValue = (value: number, locale = 'en-IN'): string =>\n\tNumber.isFinite(value) ? new Intl.NumberFormat(locale).format(value) : '0';\n\nexport const formatPercent = (value: number): string => {\n\tif (!Number.isFinite(value)) {\n\t\treturn '0';\n\t}\n\tconst rounded = Math.round(value * 10) / 10;\n\treturn Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(1);\n};\n\nexport const clamp = (value: number, min: number, max: number): number =>\n\tMath.min(Math.max(value, min), max);\n"],"names":["toChartValue","value","formatChartValue","locale","formatPercent","rounded","clamp","min","max"],"mappings":"gFAAO,MAAMA,EAAgBC,GAC5B,OAAOA,GAAU,UAAY,OAAO,SAASA,CAAK,GAAKA,EAAQ,EAAIA,EAAQ,EAE/DC,EAAmB,CAACD,EAAeE,EAAS,UACxD,OAAO,SAASF,CAAK,EAAI,IAAI,KAAK,aAAaE,CAAM,EAAE,OAAOF,CAAK,EAAI,IAE3DG,EAAiBH,GAA0B,CACvD,GAAI,CAAC,OAAO,SAASA,CAAK,EACzB,MAAO,IAER,MAAMI,EAAU,KAAK,MAAMJ,EAAQ,EAAE,EAAI,GACzC,OAAO,OAAO,UAAUI,CAAO,EAAI,GAAGA,CAAO,GAAKA,EAAQ,QAAQ,CAAC,CACpE,EAEaC,EAAQ,CAACL,EAAeM,EAAaC,IACjD,KAAK,IAAI,KAAK,IAAIP,EAAOM,CAAG,EAAGC,CAAG"}
@@ -1,16 +0,0 @@
1
- import { default as React, CSSProperties, ReactNode } from 'react';
2
- interface ChartCardProps {
3
- title?: string;
4
- padding: CSSProperties['padding'];
5
- gap: number;
6
- dataTest: string;
7
- wrapperStyle?: CSSProperties;
8
- children: ReactNode;
9
- }
10
- export declare const ChartCard: React.FC<ChartCardProps>;
11
- interface ChartValueRowProps {
12
- value: ReactNode;
13
- chip?: ReactNode;
14
- }
15
- export declare const ChartValueRow: React.FC<ChartValueRowProps>;
16
- export {};
@@ -1,69 +0,0 @@
1
- import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
- import { TitleRegular as s, TitleMedium as c, BodyCaption as p } from "../../TypographyStyle.js";
3
- import { COLORS as r } from "../../../constants/Theme.js";
4
- const x = ({
5
- title: e,
6
- padding: o,
7
- gap: d,
8
- dataTest: t,
9
- wrapperStyle: l,
10
- children: n
11
- }) => /* @__PURE__ */ a(
12
- "div",
13
- {
14
- "data-test": t,
15
- style: {
16
- display: "flex",
17
- flexDirection: "column",
18
- gap: d,
19
- width: "100%",
20
- padding: o,
21
- borderRadius: 8,
22
- border: `1px solid ${r.stroke.primary}`,
23
- backgroundColor: r.surface.standard,
24
- ...l
25
- },
26
- children: [
27
- e && /* @__PURE__ */ i(s, { color: r.content.primary, children: e }),
28
- n
29
- ]
30
- }
31
- ), f = ({
32
- value: e,
33
- chip: o
34
- }) => /* @__PURE__ */ a(
35
- "div",
36
- {
37
- style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" },
38
- children: [
39
- /* @__PURE__ */ i(
40
- c,
41
- {
42
- color: r.content.primary,
43
- style: { whiteSpace: "nowrap" },
44
- children: e
45
- }
46
- ),
47
- o && /* @__PURE__ */ i(
48
- "div",
49
- {
50
- style: {
51
- display: "inline-flex",
52
- alignItems: "center",
53
- padding: "4px 8px",
54
- borderRadius: 4,
55
- border: `1px solid ${r.stroke.primary}`,
56
- backgroundColor: r.surface.subdued,
57
- whiteSpace: "nowrap"
58
- },
59
- children: /* @__PURE__ */ i(p, { color: r.content.secondary, children: o })
60
- }
61
- )
62
- ]
63
- }
64
- );
65
- export {
66
- x as ChartCard,
67
- f as ChartValueRow
68
- };
69
- //# sourceMappingURL=ChartLayout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChartLayout.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/ChartLayout.tsx"],"sourcesContent":["import React, { CSSProperties, ReactNode } from 'react';\nimport {\n\tBodyCaption,\n\tTitleMedium,\n\tTitleRegular,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\ninterface ChartCardProps {\n\ttitle?: string;\n\tpadding: CSSProperties['padding'];\n\tgap: number;\n\tdataTest: string;\n\twrapperStyle?: CSSProperties;\n\tchildren: ReactNode;\n}\n\nexport const ChartCard: React.FC<ChartCardProps> = ({\n\ttitle,\n\tpadding,\n\tgap,\n\tdataTest,\n\twrapperStyle,\n\tchildren,\n}) => (\n\t<div\n\t\tdata-test={dataTest}\n\t\tstyle={{\n\t\t\tdisplay: 'flex',\n\t\t\tflexDirection: 'column',\n\t\t\tgap,\n\t\t\twidth: '100%',\n\t\t\tpadding,\n\t\t\tborderRadius: 8,\n\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t...wrapperStyle,\n\t\t}}\n\t>\n\t\t{title && (\n\t\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t)}\n\t\t{children}\n\t</div>\n);\n\ninterface ChartValueRowProps {\n\tvalue: ReactNode;\n\tchip?: ReactNode;\n}\n\nexport const ChartValueRow: React.FC<ChartValueRowProps> = ({\n\tvalue,\n\tchip,\n}) => (\n\t<div\n\t\tstyle={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}\n\t>\n\t\t<TitleMedium\n\t\t\tcolor={COLORS.content.primary}\n\t\t\tstyle={{ whiteSpace: 'nowrap' }}\n\t\t>\n\t\t\t{value}\n\t\t</TitleMedium>\n\t\t{chip && (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\tbackgroundColor: COLORS.surface.subdued,\n\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{chip}</BodyCaption>\n\t\t\t</div>\n\t\t)}\n\t</div>\n);\n"],"names":["ChartCard","title","padding","gap","dataTest","wrapperStyle","children","jsxs","COLORS","TitleRegular","ChartValueRow","value","chip","jsx","TitleMedium","BodyCaption"],"mappings":";;;AAiBO,MAAMA,IAAsC,CAAC;AAAA,EACnD,OAAAC;AAAA,EACA,SA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@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ComparisonBarChartI } from './ComparisonBarChart.model';
3
- export declare const ComparisonBarChart: React.FC<ComparisonBarChartI>;
@@ -1,166 +0,0 @@
1
- import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
- import { useMemo as R, useState as $ } from "react";
3
- import { BodyCaption as b } from "../../../TypographyStyle.js";
4
- import { COLORS as n } from "../../../../constants/Theme.js";
5
- import { ChartCard as w, ChartValueRow as L } from "../ChartLayout.js";
6
- import { pickColor as B, COMPARISON_BAR_COLORS as O } from "../chartPalette.js";
7
- import { toChartValue as d, formatPercent as S, clamp as C, formatChartValue as A } from "../formatChartValue.js";
8
- const M = Array.from(
9
- { length: 2 },
10
- (e, i) => ({ key: `placeholder-${i}`, label: "", value: 0 })
11
- ), E = ({
12
- row: { bar: e, fillWidth: i, color: s, percentageLabel: l },
13
- labelWidth: c,
14
- barHeight: m,
15
- showTooltip: h,
16
- locale: u
17
- }) => {
18
- const [f, t] = $(!1);
19
- return /* @__PURE__ */ p("div", { style: { display: "flex", alignItems: "center", gap: 32 }, children: [
20
- /* @__PURE__ */ p(
21
- "div",
22
- {
23
- style: {
24
- width: c,
25
- flexShrink: 0,
26
- display: "flex",
27
- flexDirection: "column",
28
- gap: 8
29
- },
30
- children: [
31
- /* @__PURE__ */ o(b, { color: n.content.secondary, children: e.label }),
32
- /* @__PURE__ */ o(
33
- L,
34
- {
35
- value: e.valueLabel ?? A(d(e.value), u),
36
- chip: l
37
- }
38
- )
39
- ]
40
- }
41
- ),
42
- /* @__PURE__ */ p(
43
- "div",
44
- {
45
- "data-test": `comparison-bar-chart-bar-${e.key}`,
46
- onMouseEnter: () => t(!0),
47
- onMouseLeave: () => t(!1),
48
- style: { position: "relative", flex: 1, height: m },
49
- children: [
50
- /* @__PURE__ */ o(
51
- "div",
52
- {
53
- "data-test": `comparison-bar-chart-track-${e.key}`,
54
- style: {
55
- position: "absolute",
56
- inset: 0,
57
- borderRadius: 4,
58
- border: `1px solid ${n.stroke.primary}`,
59
- backgroundColor: n.surface.standard,
60
- overflow: "hidden"
61
- },
62
- children: /* @__PURE__ */ o(
63
- "div",
64
- {
65
- "data-test": `comparison-bar-chart-fill-${e.key}`,
66
- style: {
67
- position: "absolute",
68
- top: 0,
69
- left: 0,
70
- bottom: 0,
71
- width: `${i}%`,
72
- backgroundColor: s
73
- }
74
- }
75
- )
76
- }
77
- ),
78
- h && f && /* @__PURE__ */ p(
79
- "div",
80
- {
81
- "data-test": `comparison-bar-chart-tooltip-${e.key}`,
82
- style: {
83
- position: "absolute",
84
- top: "50%",
85
- left: `${C(i / 2, 8, 92)}%`,
86
- transform: "translate(-50%, -50%)",
87
- padding: "4px 8px",
88
- borderRadius: 4,
89
- backgroundColor: n.content.primary,
90
- boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.12)",
91
- pointerEvents: "none"
92
- },
93
- children: [
94
- /* @__PURE__ */ o(
95
- "div",
96
- {
97
- style: {
98
- position: "absolute",
99
- top: -5,
100
- left: "50%",
101
- transform: "translateX(-50%)",
102
- width: 0,
103
- height: 0,
104
- borderLeft: "5px solid transparent",
105
- borderRight: "5px solid transparent",
106
- borderBottom: `5px solid ${n.content.primary}`
107
- }
108
- }
109
- ),
110
- /* @__PURE__ */ o(b, { color: n.content.primaryInverse, children: l })
111
- ]
112
- }
113
- )
114
- ]
115
- }
116
- )
117
- ] });
118
- }, N = ({
119
- bars: e = [],
120
- title: i,
121
- total: s,
122
- colors: l = O,
123
- labelWidth: c = 180,
124
- barHeight: m = 52,
125
- locale: h,
126
- showTooltip: u = !0,
127
- wrapperStyle: f
128
- }) => {
129
- const t = e.some((r) => d(r.value) > 0), v = e.length ? e : M, k = R(() => {
130
- const r = s !== void 0 ? d(s) : v.reduce((a, y) => a + d(y.value), 0);
131
- return v.map((a, y) => {
132
- const x = a.percentage ?? (r > 0 ? d(a.value) / r * 100 : 0), g = Number.isFinite(x) ? Math.max(x, 0) : 0;
133
- return {
134
- bar: a,
135
- fillWidth: C(g, 0, 100),
136
- color: t ? a.color ?? B(l, y) : void 0,
137
- percentageLabel: t ? a.percentageLabel ?? `${S(g)}%` : ""
138
- };
139
- });
140
- }, [v, s, l, t]);
141
- return /* @__PURE__ */ o(
142
- w,
143
- {
144
- dataTest: "comparison-bar-chart",
145
- title: i,
146
- padding: 24,
147
- gap: 24,
148
- wrapperStyle: f,
149
- children: k.map((r) => /* @__PURE__ */ o(
150
- E,
151
- {
152
- row: r,
153
- labelWidth: c,
154
- barHeight: m,
155
- showTooltip: u && t,
156
- locale: h
157
- },
158
- r.bar.key
159
- ))
160
- }
161
- );
162
- };
163
- export {
164
- N as ComparisonBarChart
165
- };
166
- //# sourceMappingURL=ComparisonBarChart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComparisonBarChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ChartCard, ChartValueRow } from '../ChartLayout';\nimport { COMPARISON_BAR_COLORS, pickColor } from '../chartPalette';\nimport {\n\tclamp,\n\tformatChartValue,\n\tformatPercent,\n\ttoChartValue,\n} from '../formatChartValue';\nimport type {\n\tComparisonBarChartI,\n\tComparisonBarI,\n} from './ComparisonBarChart.model';\n\nconst PLACEHOLDER_BARS: ComparisonBarI[] = Array.from(\n\t{ length: 2 },\n\t(_, index) => ({ key: `placeholder-${index}`, label: '', value: 0 }),\n);\n\ninterface PreparedBar {\n\tbar: ComparisonBarI;\n\tfillWidth: number;\n\tcolor?: string;\n\tpercentageLabel: string;\n}\n\ninterface BarRowProps {\n\trow: PreparedBar;\n\tlabelWidth: number;\n\tbarHeight: number;\n\tshowTooltip: boolean;\n\tlocale?: string;\n}\n\nconst BarRow: React.FC<BarRowProps> = ({\n\trow: { bar, fillWidth, color, percentageLabel },\n\tlabelWidth,\n\tbarHeight,\n\tshowTooltip,\n\tlocale,\n}) => {\n\tconst [isHovered, setIsHovered] = useState(false);\n\n\treturn (\n\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 32 }}>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tgap: 8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{bar.label}</BodyCaption>\n\t\t\t\t<ChartValueRow\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tbar.valueLabel ?? formatChartValue(toChartValue(bar.value), locale)\n\t\t\t\t\t}\n\t\t\t\t\tchip={percentageLabel}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tdata-test={`comparison-bar-chart-bar-${bar.key}`}\n\t\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\t\tstyle={{ position: 'relative', flex: 1, height: barHeight }}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-test={`comparison-bar-chart-track-${bar.key}`}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-fill-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\twidth: `${fillWidth}%`,\n\t\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{showTooltip && isHovered && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-tooltip-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: '50%',\n\t\t\t\t\t\t\tleft: `${clamp(fillWidth / 2, 8, 92)}%`,\n\t\t\t\t\t\t\ttransform: 'translate(-50%, -50%)',\n\t\t\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\tbackgroundColor: COLORS.content.primary,\n\t\t\t\t\t\t\tboxShadow: '0px 2px 4px rgba(0, 0, 0, 0.12)',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: -5,\n\t\t\t\t\t\t\t\tleft: '50%',\n\t\t\t\t\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\tborderLeft: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderRight: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderBottom: `5px solid ${COLORS.content.primary}`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.primaryInverse}>\n\t\t\t\t\t\t\t{percentageLabel}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport const ComparisonBarChart: React.FC<ComparisonBarChartI> = ({\n\tbars = [],\n\ttitle,\n\ttotal,\n\tcolors = COMPARISON_BAR_COLORS,\n\tlabelWidth = 180,\n\tbarHeight = 52,\n\tlocale,\n\tshowTooltip = true,\n\twrapperStyle,\n}) => {\n\tconst hasData = bars.some((bar) => toChartValue(bar.value) > 0);\n\tconst visibleBars = bars.length ? bars : PLACEHOLDER_BARS;\n\n\tconst rows = useMemo<PreparedBar[]>(() => {\n\t\tconst denominator =\n\t\t\ttotal !== undefined\n\t\t\t\t? toChartValue(total)\n\t\t\t\t: visibleBars.reduce((sum, bar) => sum + toChartValue(bar.value), 0);\n\n\t\treturn visibleBars.map((bar, index) => {\n\t\t\tconst percentage =\n\t\t\t\tbar.percentage ??\n\t\t\t\t(denominator > 0 ? (toChartValue(bar.value) / denominator) * 100 : 0);\n\t\t\tconst share = Number.isFinite(percentage) ? Math.max(percentage, 0) : 0;\n\t\t\treturn {\n\t\t\t\tbar,\n\t\t\t\tfillWidth: clamp(share, 0, 100),\n\t\t\t\tcolor: hasData ? bar.color ?? pickColor(colors, index) : undefined,\n\t\t\t\tpercentageLabel: hasData\n\t\t\t\t\t? bar.percentageLabel ?? `${formatPercent(share)}%`\n\t\t\t\t\t: '',\n\t\t\t};\n\t\t});\n\t}, [visibleBars, total, colors, hasData]);\n\n\treturn (\n\t\t<ChartCard\n\t\t\tdataTest=\"comparison-bar-chart\"\n\t\t\ttitle={title}\n\t\t\tpadding={24}\n\t\t\tgap={24}\n\t\t\twrapperStyle={wrapperStyle}\n\t\t>\n\t\t\t{rows.map((row) => (\n\t\t\t\t<BarRow\n\t\t\t\t\tkey={row.bar.key}\n\t\t\t\t\trow={row}\n\t\t\t\t\tlabelWidth={labelWidth}\n\t\t\t\t\tbarHeight={barHeight}\n\t\t\t\t\tshowTooltip={showTooltip && hasData}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ChartCard>\n\t);\n};\n"],"names":["PLACEHOLDER_BARS","_","index","BarRow","bar","fillWidth","color","percentageLabel","labelWidth","barHeight","showTooltip","locale","isHovered","setIsHovered","useState","jsxs","jsx","BodyCaption","COLORS","ChartValueRow","formatChartValue","toChartValue","clamp","ComparisonBarChart","bars","title","total","colors","COMPARISON_BAR_COLORS","wrapperStyle","hasData","visibleBars","rows","useMemo","denominator","sum","percentage","share","pickColor","formatPercent","ChartCard","row"],"mappings":";;;;;;;AAgBA,MAAMA,IAAqC,MAAM;AAAA,EAChD,EAAE,QAAQ,EAAA;AAAA,EACV,CAACC,GAAGC,OAAW,EAAE,KAAK,eAAeA,CAAK,IAAI,OAAO,IAAI,OAAO,EAAA;AACjE,GAiBMC,IAAgC,CAAC;AAAA,EACtC,KAAK,EAAE,KAAAC,GAAK,WAAAC,GAAW,OAAAC,GAAO,iBAAAC,EAAA;AAAA,EAC9B,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK;AAEhD,SACC,gBAAAC,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,GAAA,GACzD,UAAA;AAAA,IAAA,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,OAAOP;AAAA,UACP,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,eAAe;AAAA,UACf,KAAK;AAAA,QAAA;AAAA,QAGN,UAAA;AAAA,UAAA,gBAAAQ,EAACC,KAAY,OAAOC,EAAO,QAAQ,WAAY,YAAI,OAAM;AAAA,UACzD,gBAAAF;AAAA,YAACG;AAAA,YAAA;AAAA,cACA,OACCf,EAAI,cAAcgB,EAAiBC,EAAajB,EAAI,KAAK,GAAGO,CAAM;AAAA,cAEnE,MAAMJ;AAAA,YAAA;AAAA,UAAA;AAAA,QACP;AAAA,MAAA;AAAA,IAAA;AAAA,IAGD,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,aAAW,4BAA4BX,EAAI,G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mBAAmB,GAAGmC,EAAcF,CAAK,CAAC,MAC9C;AAAA,MAAA;AAAA,IAEL,CAAC;AAAA,EACF,GAAG,CAACN,GAAaL,GAAOC,GAAQG,CAAO,CAAC;AAExC,SACC,gBAAAd;AAAA,IAACwB;AAAA,IAAA;AAAA,MACA,UAAS;AAAA,MACT,OAAAf;AAAA,MACA,SAAS;AAAA,MACT,KAAK;AAAA,MACL,cAAAI;AAAA,MAEC,UAAAG,EAAK,IAAI,CAACS,MACV,gBAAAzB;AAAA,QAACb;AAAA,QAAA;AAAA,UAEA,KAAAsC;AAAA,UACA,YAAAjC;AAAA,UACA,WAAAC;AAAA,UACA,aAAaC,KAAeoB;AAAA,UAC5B,QAAAnB;AAAA,QAAA;AAAA,QALK8B,EAAI,IAAI;AAAA,MAAA,CAOd;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
@@ -1,21 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export interface ComparisonBarI {
3
- key: string;
4
- label: string;
5
- value: number;
6
- valueLabel?: string;
7
- percentage?: number;
8
- percentageLabel?: string;
9
- color?: string;
10
- }
11
- export interface ComparisonBarChartI {
12
- bars: ComparisonBarI[];
13
- title?: string;
14
- total?: number;
15
- colors?: string[];
16
- labelWidth?: number;
17
- barHeight?: number;
18
- locale?: string;
19
- showTooltip?: boolean;
20
- wrapperStyle?: CSSProperties;
21
- }
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- import { FunnelChartI } from './FunnelChart.model';
3
- export declare const FunnelChart: React.FC<FunnelChartI>;
@@ -1,176 +0,0 @@
1
- import { jsx as o, jsxs as y } from "react/jsx-runtime";
2
- import { useMemo as m } from "react";
3
- import { BodyTiny as L } from "../../../TypographyStyle.js";
4
- import { COLORS as v } from "../../../../constants/Theme.js";
5
- import { ChartCard as w, ChartValueRow as x } from "../ChartLayout.js";
6
- import { pickColor as S, FUNNEL_BAND_COLORS as $ } from "../chartPalette.js";
7
- import { toChartValue as d, formatPercent as E, formatChartValue as O } from "../formatChartValue.js";
8
- import { buildFunnelLayout as R, FUNNEL_VIEW_WIDTH as k } from "./funnelGeometry.js";
9
- const _ = Array.from(
10
- { length: 4 },
11
- (t, a) => ({ key: `placeholder-${a}`, label: "", value: 0 })
12
- ), A = (t, a) => {
13
- const r = t[a];
14
- if (r.percentageLabel !== void 0)
15
- return r.percentageLabel;
16
- if (a === 0)
17
- return d(r.value) > 0 ? "100%" : "";
18
- const l = r.branchOf ? t.find((h) => h.key === r.branchOf) : t[a - 1], n = d(l?.value);
19
- if (!l || n === 0)
20
- return "";
21
- const f = d(r.value) / n * 100;
22
- return `${E(f)}% of ${l.label}`;
23
- }, g = ({
24
- left: t,
25
- height: a
26
- }) => /* @__PURE__ */ o(
27
- "div",
28
- {
29
- style: {
30
- position: "absolute",
31
- top: 0,
32
- bottom: a === void 0 ? 0 : void 0,
33
- height: a,
34
- left: t,
35
- width: 1,
36
- backgroundColor: v.stroke.primary
37
- }
38
- }
39
- ), D = ({
40
- stage: t,
41
- color: a,
42
- chip: r,
43
- locale: l
44
- }) => /* @__PURE__ */ y(
45
- "div",
46
- {
47
- "data-test": `funnel-chart-header-${t.key}`,
48
- style: {
49
- flex: 1,
50
- minWidth: 0,
51
- display: "flex",
52
- flexDirection: "column",
53
- gap: 8,
54
- alignItems: "flex-start",
55
- padding: "0 8px 0 12px"
56
- },
57
- children: [
58
- t.label && /* @__PURE__ */ y(
59
- "div",
60
- {
61
- style: {
62
- display: "flex",
63
- alignItems: "center",
64
- gap: 8,
65
- width: "100%",
66
- opacity: 0.8
67
- },
68
- children: [
69
- /* @__PURE__ */ o(
70
- "span",
71
- {
72
- style: {
73
- width: 16,
74
- height: 16,
75
- borderRadius: 2.667,
76
- backgroundColor: a,
77
- flexShrink: 0
78
- }
79
- }
80
- ),
81
- /* @__PURE__ */ o(L, { color: v.content.secondary, children: t.label })
82
- ]
83
- }
84
- ),
85
- /* @__PURE__ */ o(
86
- x,
87
- {
88
- value: t.valueLabel ?? O(d(t.value), l),
89
- chip: r
90
- }
91
- )
92
- ]
93
- }
94
- ), j = ({
95
- stages: t = [],
96
- title: a,
97
- plotHeight: r = 291,
98
- headerHeight: l = 83,
99
- colors: n = $,
100
- locale: f,
101
- wrapperStyle: h
102
- }) => {
103
- const i = t.length ? t : _, s = m(
104
- () => R(i, { plotHeight: r, headerHeight: l }),
105
- [i, r, l]
106
- ), c = !s.isEmpty, b = (e) => `${e / k * 100}%`, u = m(
107
- () => i.map((e, p) => ({
108
- stage: e,
109
- color: c ? e.color ?? S(n, p) : v.content.inactive,
110
- chip: c ? A(i, p) : ""
111
- })),
112
- [i, n, c]
113
- ), C = m(
114
- () => new Map(u.map(({ stage: e, color: p }) => [e.key, p])),
115
- [u]
116
- );
117
- return /* @__PURE__ */ o(
118
- w,
119
- {
120
- dataTest: "funnel-chart",
121
- title: a,
122
- padding: "18px 24px",
123
- gap: 14,
124
- wrapperStyle: { overflow: "hidden", ...h },
125
- children: /* @__PURE__ */ y("div", { style: { position: "relative", width: "100%", height: r }, children: [
126
- /* @__PURE__ */ o(
127
- "svg",
128
- {
129
- width: "100%",
130
- height: "100%",
131
- viewBox: `0 0 ${k} ${r}`,
132
- preserveAspectRatio: "none",
133
- "aria-hidden": !0,
134
- style: { position: "absolute", inset: 0 },
135
- children: s.bands.map((e) => /* @__PURE__ */ o(
136
- "path",
137
- {
138
- "data-test": `funnel-chart-band-${e.key}`,
139
- d: e.d,
140
- fill: c ? C.get(e.key) : "transparent"
141
- },
142
- e.key
143
- ))
144
- }
145
- ),
146
- s.separators.full.map((e) => /* @__PURE__ */ o(g, { left: b(e) }, `full-${e}`)),
147
- s.separators.header.map((e) => /* @__PURE__ */ o(
148
- g,
149
- {
150
- left: b(e),
151
- height: l
152
- },
153
- `header-${e}`
154
- )),
155
- /* @__PURE__ */ o(
156
- "div",
157
- {
158
- style: {
159
- position: "absolute",
160
- top: 0,
161
- left: 0,
162
- right: 0,
163
- height: l,
164
- display: "flex"
165
- },
166
- children: u.map((e) => /* @__PURE__ */ o(D, { ...e, locale: f }, e.stage.key))
167
- }
168
- )
169
- ] })
170
- }
171
- );
172
- };
173
- export {
174
- j as FunnelChart
175
- };
176
- //# sourceMappingURL=FunnelChart.js.map