@servicetitan/marketing-ui 5.11.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/charts/common/color-tag.d.ts +15 -0
- package/dist/components/charts/common/color-tag.d.ts.map +1 -0
- package/dist/components/charts/common/color-tag.js +79 -0
- package/dist/components/charts/common/color-tag.js.map +1 -0
- package/dist/components/charts/common/color-tag.module.less +23 -0
- package/dist/components/charts/common/color-tag.module.less.d.ts +6 -0
- package/dist/components/charts/common/index.d.ts +2 -0
- package/dist/components/charts/common/index.d.ts.map +1 -0
- package/dist/components/charts/common/index.js +3 -0
- package/dist/components/charts/common/index.js.map +1 -0
- package/dist/components/charts/funnel-chart/components/funnel-chart.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.js +115 -70
- package/dist/components/charts/funnel-chart/components/funnel-chart.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less +28 -10
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +3 -1
- package/dist/components/charts/funnel-chart/components/funnel-svg.d.ts +2 -0
- package/dist/components/charts/funnel-chart/components/funnel-svg.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-svg.js +72 -31
- package/dist/components/charts/funnel-chart/components/funnel-svg.js.map +1 -1
- package/dist/components/charts/funnel-chart/funnel-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/utils/const.d.ts +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.d.ts +1 -0
- package/dist/components/charts/funnel-chart/utils/interface.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.d.ts +2 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.d.ts.map +1 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.js +47 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.js.map +1 -0
- package/dist/components/charts/line-chart/components/hover-popover.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.js +13 -7
- package/dist/components/charts/line-chart/components/hover-popover.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.module.less +10 -0
- package/dist/components/charts/line-chart/components/hover-popover.module.less.d.ts +2 -0
- package/dist/components/charts/line-chart/components/stuff.d.ts +0 -8
- package/dist/components/charts/line-chart/components/stuff.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.js +6 -20
- package/dist/components/charts/line-chart/components/stuff.js.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.module.less +0 -16
- package/dist/components/charts/line-chart/components/stuff.module.less.d.ts +0 -3
- package/dist/components/charts/line-chart/components/svg-bars.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/svg-bars.js +97 -13
- package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
- package/dist/components/charts/line-chart/line-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.d.ts +5 -0
- package/dist/components/charts/line-chart/stores/line-chart.store.d.ts.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.js +41 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.d.ts +4 -0
- package/dist/components/charts/line-chart/utils/interfaces.d.ts.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/labels.js +1 -1
- package/dist/components/charts/line-chart/utils/labels.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.js +24 -13
- package/dist/components/charts/pie-chart/components/pie-chart.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.module.less +15 -0
- package/dist/components/charts/pie-chart/components/pie-chart.module.less.d.ts +1 -0
- package/dist/components/charts/pie-chart/components/pie.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/components/pie.js +105 -28
- package/dist/components/charts/pie-chart/components/pie.js.map +1 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/utils/const.js +1 -1
- package/dist/components/charts/pie-chart/utils/const.js.map +1 -1
- package/dist/components/stat/stat-card.d.ts.map +1 -1
- package/dist/components/stat/stat-card.js +28 -12
- package/dist/components/stat/stat-card.js.map +1 -1
- package/package.json +5 -3
- package/src/components/charts/common/color-tag.module.less +23 -0
- package/src/components/charts/common/color-tag.module.less.d.ts +6 -0
- package/src/components/charts/common/color-tag.tsx +92 -0
- package/src/components/charts/common/index.ts +1 -0
- package/src/components/charts/funnel-chart/components/funnel-chart.module.less +28 -10
- package/src/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +3 -1
- package/src/components/charts/funnel-chart/components/funnel-chart.tsx +107 -78
- package/src/components/charts/funnel-chart/components/funnel-svg.tsx +91 -23
- package/src/components/charts/funnel-chart/funnel-chart.stories.tsx +3 -1
- package/src/components/charts/funnel-chart/utils/const.ts +1 -1
- package/src/components/charts/funnel-chart/utils/interface.ts +1 -0
- package/src/components/charts/funnel-chart/utils/svg-rounded-path.ts +86 -0
- package/src/components/charts/line-chart/components/hover-popover.module.less +10 -0
- package/src/components/charts/line-chart/components/hover-popover.module.less.d.ts +2 -0
- package/src/components/charts/line-chart/components/hover-popover.tsx +29 -9
- package/src/components/charts/line-chart/components/stuff.module.less +0 -16
- package/src/components/charts/line-chart/components/stuff.module.less.d.ts +0 -3
- package/src/components/charts/line-chart/components/stuff.tsx +4 -30
- package/src/components/charts/line-chart/components/svg-bars.tsx +106 -9
- package/src/components/charts/line-chart/line-chart.stories.tsx +13 -8
- package/src/components/charts/line-chart/stores/line-chart.store.ts +39 -1
- package/src/components/charts/line-chart/utils/interfaces.ts +4 -0
- package/src/components/charts/line-chart/utils/labels.ts +1 -1
- package/src/components/charts/pie-chart/components/pie-chart.module.less +15 -0
- package/src/components/charts/pie-chart/components/pie-chart.module.less.d.ts +1 -0
- package/src/components/charts/pie-chart/components/pie-chart.tsx +23 -13
- package/src/components/charts/pie-chart/components/pie.tsx +106 -40
- package/src/components/charts/pie-chart/pie-chart.stories.tsx +3 -4
- package/src/components/charts/pie-chart/utils/const.ts +1 -1
- package/src/components/stat/stat-card.tsx +34 -16
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface ColorTagProps {
|
|
3
|
+
label: string;
|
|
4
|
+
color: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
colorTagClassName?: string;
|
|
7
|
+
small?: boolean;
|
|
8
|
+
dashed?: boolean;
|
|
9
|
+
strokeColor?: string;
|
|
10
|
+
outlineColor?: string;
|
|
11
|
+
pattern?: 'solid' | 'striped' | 'outline';
|
|
12
|
+
}
|
|
13
|
+
export declare const ColorTag: FC<ColorTagProps>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=color-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-tag.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/common/color-tag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAKlC,UAAU,aAAa;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CAC7C;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA0EtC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { BodyText, Stack } from '@servicetitan/design-system';
|
|
5
|
+
import * as Styles from './color-tag.module.less';
|
|
6
|
+
export const ColorTag = ({ label, color, className, small, dashed, outlineColor, pattern, strokeColor, colorTagClassName })=>{
|
|
7
|
+
const uid = useId();
|
|
8
|
+
const patternId = `pattern-${uid}`;
|
|
9
|
+
const width = small ? 50 : 22;
|
|
10
|
+
const height = small ? 10 : 25;
|
|
11
|
+
const radius = small ? 0 : 3;
|
|
12
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
className: className,
|
|
15
|
+
gap: 1,
|
|
16
|
+
children: [
|
|
17
|
+
pattern === 'striped' ? /*#__PURE__*/ _jsxs("svg", {
|
|
18
|
+
width: width,
|
|
19
|
+
height: height,
|
|
20
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
21
|
+
className: classNames(Styles.colorTag, colorTagClassName),
|
|
22
|
+
"aria-hidden": true,
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ _jsx("defs", {
|
|
25
|
+
children: /*#__PURE__*/ _jsxs("pattern", {
|
|
26
|
+
id: patternId,
|
|
27
|
+
patternUnits: "userSpaceOnUse",
|
|
28
|
+
width: "8",
|
|
29
|
+
height: "8",
|
|
30
|
+
patternTransform: "rotate(45)",
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
33
|
+
width: "4",
|
|
34
|
+
height: "8",
|
|
35
|
+
fill: color,
|
|
36
|
+
opacity: "0.08"
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
39
|
+
width: "2",
|
|
40
|
+
height: "8",
|
|
41
|
+
fill: color
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
47
|
+
x: "0",
|
|
48
|
+
y: "0",
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
rx: radius,
|
|
52
|
+
ry: radius,
|
|
53
|
+
fill: `url(#${patternId})`,
|
|
54
|
+
stroke: strokeColor !== null && strokeColor !== void 0 ? strokeColor : color,
|
|
55
|
+
strokeWidth: 1,
|
|
56
|
+
vectorEffect: "non-scaling-stroke"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
60
|
+
className: classNames(Styles.colorTag, small && Styles.colorTagSmall, dashed && Styles.colorTagDashed, pattern === 'outline' && Styles.colorTagOutline, colorTagClassName),
|
|
61
|
+
style: dashed ? {
|
|
62
|
+
borderColor: strokeColor !== null && strokeColor !== void 0 ? strokeColor : color
|
|
63
|
+
} : pattern === 'outline' ? {
|
|
64
|
+
borderColor: outlineColor !== null && outlineColor !== void 0 ? outlineColor : color,
|
|
65
|
+
borderRadius: radius
|
|
66
|
+
} : {
|
|
67
|
+
backgroundColor: color,
|
|
68
|
+
borderRadius: radius
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx(BodyText, {
|
|
72
|
+
size: small ? 'xsmall' : 'small',
|
|
73
|
+
children: label
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=color-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/charts/common/color-tag.tsx"],"sourcesContent":["import { FC, useId } from 'react';\nimport classNames from 'classnames';\nimport { BodyText, Stack } from '@servicetitan/design-system';\nimport * as Styles from './color-tag.module.less';\n\ninterface ColorTagProps {\n label: string;\n color: string;\n className?: string;\n colorTagClassName?: string;\n small?: boolean;\n dashed?: boolean;\n strokeColor?: string;\n outlineColor?: string;\n pattern?: 'solid' | 'striped' | 'outline';\n}\n\nexport const ColorTag: FC<ColorTagProps> = ({\n label,\n color,\n className,\n small,\n dashed,\n outlineColor,\n pattern,\n strokeColor,\n colorTagClassName,\n}) => {\n const uid = useId();\n const patternId = `pattern-${uid}`;\n\n const width = small ? 50 : 22;\n const height = small ? 10 : 25;\n const radius = small ? 0 : 3;\n\n return (\n <Stack alignItems=\"center\" className={className} gap={1}>\n {pattern === 'striped' ? (\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n className={classNames(Styles.colorTag, colorTagClassName)}\n aria-hidden\n >\n <defs>\n <pattern\n id={patternId}\n patternUnits=\"userSpaceOnUse\"\n width=\"8\"\n height=\"8\"\n patternTransform=\"rotate(45)\"\n >\n <rect width=\"4\" height=\"8\" fill={color} opacity=\"0.08\" />\n <rect width=\"2\" height=\"8\" fill={color} />\n </pattern>\n </defs>\n <rect\n x=\"0\"\n y=\"0\"\n width={width}\n height={height}\n rx={radius}\n ry={radius}\n fill={`url(#${patternId})`}\n stroke={strokeColor ?? color}\n strokeWidth={1}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n ) : (\n <div\n className={classNames(\n Styles.colorTag,\n small && Styles.colorTagSmall,\n dashed && Styles.colorTagDashed,\n pattern === 'outline' && Styles.colorTagOutline,\n colorTagClassName\n )}\n style={\n dashed\n ? { borderColor: strokeColor ?? color }\n : pattern === 'outline'\n ? { borderColor: outlineColor ?? color, borderRadius: radius }\n : { backgroundColor: color, borderRadius: radius }\n }\n />\n )}\n <BodyText size={small ? 'xsmall' : 'small'}>{label}</BodyText>\n </Stack>\n );\n};\n"],"names":["useId","classNames","BodyText","Stack","Styles","ColorTag","label","color","className","small","dashed","outlineColor","pattern","strokeColor","colorTagClassName","uid","patternId","width","height","radius","alignItems","gap","svg","viewBox","colorTag","aria-hidden","defs","id","patternUnits","patternTransform","rect","fill","opacity","x","y","rx","ry","stroke","strokeWidth","vectorEffect","div","colorTagSmall","colorTagDashed","colorTagOutline","style","borderColor","borderRadius","backgroundColor","size"],"mappings":";AAAA,SAAaA,KAAK,QAAQ,QAAQ;AAClC,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,EAAEC,KAAK,QAAQ,8BAA8B;AAC9D,YAAYC,YAAY,0BAA0B;AAclD,OAAO,MAAMC,WAA8B,CAAC,EACxCC,KAAK,EACLC,KAAK,EACLC,SAAS,EACTC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,iBAAiB,EACpB;IACG,MAAMC,MAAMf;IACZ,MAAMgB,YAAY,CAAC,QAAQ,EAAED,KAAK;IAElC,MAAME,QAAQR,QAAQ,KAAK;IAC3B,MAAMS,SAAST,QAAQ,KAAK;IAC5B,MAAMU,SAASV,QAAQ,IAAI;IAE3B,qBACI,MAACN;QAAMiB,YAAW;QAASZ,WAAWA;QAAWa,KAAK;;YACjDT,YAAY,0BACT,MAACU;gBACGL,OAAOA;gBACPC,QAAQA;gBACRK,SAAS,CAAC,IAAI,EAAEN,MAAM,CAAC,EAAEC,QAAQ;gBACjCV,WAAWP,WAAWG,OAAOoB,QAAQ,EAAEV;gBACvCW,aAAW;;kCAEX,KAACC;kCACG,cAAA,MAACd;4BACGe,IAAIX;4BACJY,cAAa;4BACbX,OAAM;4BACNC,QAAO;4BACPW,kBAAiB;;8CAEjB,KAACC;oCAAKb,OAAM;oCAAIC,QAAO;oCAAIa,MAAMxB;oCAAOyB,SAAQ;;8CAChD,KAACF;oCAAKb,OAAM;oCAAIC,QAAO;oCAAIa,MAAMxB;;;;;kCAGzC,KAACuB;wBACGG,GAAE;wBACFC,GAAE;wBACFjB,OAAOA;wBACPC,QAAQA;wBACRiB,IAAIhB;wBACJiB,IAAIjB;wBACJY,MAAM,CAAC,KAAK,EAAEf,UAAU,CAAC,CAAC;wBAC1BqB,QAAQxB,wBAAAA,yBAAAA,cAAeN;wBACvB+B,aAAa;wBACbC,cAAa;;;+BAIrB,KAACC;gBACGhC,WAAWP,WACPG,OAAOoB,QAAQ,EACff,SAASL,OAAOqC,aAAa,EAC7B/B,UAAUN,OAAOsC,cAAc,EAC/B9B,YAAY,aAAaR,OAAOuC,eAAe,EAC/C7B;gBAEJ8B,OACIlC,SACM;oBAAEmC,aAAahC,wBAAAA,yBAAAA,cAAeN;gBAAM,IACpCK,YAAY,YACV;oBAAEiC,aAAalC,yBAAAA,0BAAAA,eAAgBJ;oBAAOuC,cAAc3B;gBAAO,IAC3D;oBAAE4B,iBAAiBxC;oBAAOuC,cAAc3B;gBAAO;;0BAInE,KAACjB;gBAAS8C,MAAMvC,QAAQ,WAAW;0BAAUH;;;;AAGzD,EAAE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import (reference) '~@servicetitan/tokens/core/tokens.less';
|
|
2
|
+
|
|
3
|
+
.color-tag {
|
|
4
|
+
width: 15px;
|
|
5
|
+
height: 15px;
|
|
6
|
+
margin-right: @spacing-1;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.color-tag-outline {
|
|
11
|
+
border-style: solid;
|
|
12
|
+
border-width: 1px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.color-tag-dashed {
|
|
16
|
+
height: 0;
|
|
17
|
+
border-top-style: dashed;
|
|
18
|
+
border-top-width: 3px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.color-tag-small {
|
|
22
|
+
width: @spacing-2;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/charts/common/index.ts"],"sourcesContent":["export { ColorTag } from './color-tag';\n"],"names":["ColorTag"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnel-chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/funnel-chart/components/funnel-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"funnel-chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/funnel-chart/components/funnel-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,EAAE,EAAY,MAAM,OAAO,CAAC;AAMxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA8J5C,CAAC"}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from 'react';
|
|
2
|
+
import { useMemo, useState, Fragment } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { BodyText, Eyebrow,
|
|
4
|
+
import { BodyText, Eyebrow, Icon, Mask, Stack, Tooltip } from '@servicetitan/design-system';
|
|
5
5
|
import { tokens } from '@servicetitan/tokens/core';
|
|
6
6
|
import { formatValue } from '../../../../utils/formatters';
|
|
7
7
|
import { StatDiff } from '../../../stat/stat-card';
|
|
8
8
|
import { defaultBottomSideLength, defaultTopSideLength } from '../utils/const';
|
|
9
9
|
import { FunnelPyramidSvg } from './funnel-svg';
|
|
10
10
|
import * as Styles from './funnel-chart.module.less';
|
|
11
|
+
import { Popover } from '@servicetitan/anvil2';
|
|
12
|
+
import { ColorTag } from '../../common';
|
|
11
13
|
export const FunnelChart = ({ sections, format, topSideLength = defaultTopSideLength, bottomSideLength = defaultBottomSideLength, popoverContent: PopoverContent, loading, className })=>{
|
|
12
14
|
const [popoverShown, setPopoverShown] = useState(undefined);
|
|
15
|
+
const [rowYs, setRowYs] = useState([]);
|
|
13
16
|
const colors = useMemo(()=>sections.map((s)=>s.color), [
|
|
14
17
|
sections
|
|
15
18
|
]);
|
|
19
|
+
const outlineColors = useMemo(()=>sections.map((s)=>s.outlineColor), [
|
|
20
|
+
sections
|
|
21
|
+
]);
|
|
16
22
|
const hidePopover = ()=>setPopoverShown(undefined);
|
|
17
|
-
const
|
|
18
|
-
left: `${100 - topSideLength}
|
|
23
|
+
const rightStyles = useMemo(()=>({
|
|
24
|
+
left: `${100 - topSideLength}%`,
|
|
25
|
+
width: `${topSideLength}%`
|
|
19
26
|
}), [
|
|
20
27
|
topSideLength
|
|
21
28
|
]);
|
|
@@ -27,101 +34,139 @@ export const FunnelChart = ({ sections, format, topSideLength = defaultTopSideLe
|
|
|
27
34
|
className: Styles.pyramidWrapper,
|
|
28
35
|
children: /*#__PURE__*/ _jsx(FunnelPyramidSvg, {
|
|
29
36
|
colors: colors,
|
|
37
|
+
outlineColors: outlineColors,
|
|
30
38
|
topSideLength: topSideLength,
|
|
31
|
-
bottomSideLength: bottomSideLength
|
|
39
|
+
bottomSideLength: bottomSideLength,
|
|
40
|
+
onRowAnchors: setRowYs
|
|
32
41
|
})
|
|
33
42
|
}),
|
|
34
43
|
/*#__PURE__*/ _jsx("div", {
|
|
35
44
|
className: classNames('d-f flex-column justify-content-around', Styles.pyramidBoxRight),
|
|
36
|
-
style:
|
|
37
|
-
children: sections.map(({ id, title, value, color, prev,
|
|
45
|
+
style: rightStyles,
|
|
46
|
+
children: sections.map(({ id, title, value, color, prev, data, outlineColor })=>/*#__PURE__*/ _jsx(Stack, {
|
|
38
47
|
className: Styles.flex1,
|
|
39
48
|
justifyContent: "center",
|
|
40
49
|
alignItems: "center",
|
|
41
50
|
onMouseEnter: ()=>setPopoverShown(id),
|
|
42
51
|
onMouseLeave: hidePopover,
|
|
43
52
|
children: /*#__PURE__*/ _jsxs(Popover, {
|
|
44
|
-
className: "of-hidden",
|
|
45
|
-
trigger: /*#__PURE__*/ _jsx(Headline, {
|
|
46
|
-
size: "small",
|
|
47
|
-
className: classNames('m-x-2 m-b-0-i', textClass),
|
|
48
|
-
"data-cy": `marketing-funnel-section-${id}-value`,
|
|
49
|
-
children: formatValue(value, format)
|
|
50
|
-
}),
|
|
51
53
|
open: popoverShown === id,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
width: "auto",
|
|
55
|
-
portal: true,
|
|
54
|
+
openOnHover: true,
|
|
55
|
+
placement: "right",
|
|
56
56
|
children: [
|
|
57
|
-
/*#__PURE__*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
/*#__PURE__*/ _jsx(Popover.Trigger, {
|
|
58
|
+
children: (props)=>/*#__PURE__*/ _jsx("span", {
|
|
59
|
+
...props,
|
|
60
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
61
|
+
className: Styles.percentTextWrapper,
|
|
62
|
+
children: /*#__PURE__*/ _jsx(BodyText, {
|
|
63
|
+
className: classNames('m-x-2 m-b-0-i'),
|
|
64
|
+
"data-cy": `marketing-funnel-section-${id}-value`,
|
|
65
|
+
children: formatValue(value, format)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ _jsxs(Popover.Content, {
|
|
61
71
|
children: [
|
|
62
|
-
/*#__PURE__*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
73
|
+
alignItems: "flex-start",
|
|
74
|
+
justifyContent: "flex-start",
|
|
75
|
+
direction: "column",
|
|
76
|
+
"data-cy": `marketing-funnel-popover-${id}-content`,
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ _jsx(ColorTag, {
|
|
81
|
+
label: "",
|
|
82
|
+
color: color,
|
|
83
|
+
outlineColor: outlineColor,
|
|
84
|
+
pattern: outlineColor ? 'outline' : 'solid'
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsxs(BodyText, {
|
|
87
|
+
bold: true,
|
|
88
|
+
className: "m-r-half",
|
|
89
|
+
children: [
|
|
90
|
+
title,
|
|
91
|
+
" ",
|
|
92
|
+
formatValue(value, format)
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ _jsx(Stack.Item, {
|
|
98
|
+
children: /*#__PURE__*/ _jsx(StatDiff, {
|
|
99
|
+
value: value,
|
|
100
|
+
prev: prev,
|
|
101
|
+
size: "xsmall",
|
|
102
|
+
format: format
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
]
|
|
74
106
|
}),
|
|
75
|
-
/*#__PURE__*/ _jsx(
|
|
107
|
+
!!PopoverContent && /*#__PURE__*/ _jsx(PopoverContent, {
|
|
108
|
+
id: id,
|
|
76
109
|
value: value,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
format: format
|
|
110
|
+
text: formatValue(value, format),
|
|
111
|
+
data: data
|
|
80
112
|
})
|
|
81
113
|
]
|
|
82
|
-
}),
|
|
83
|
-
!!PopoverContent && /*#__PURE__*/ _jsx(PopoverContent, {
|
|
84
|
-
id: id,
|
|
85
|
-
value: value,
|
|
86
|
-
text: formatValue(value, format),
|
|
87
|
-
data: data
|
|
88
114
|
})
|
|
89
115
|
]
|
|
90
116
|
})
|
|
91
117
|
}, title))
|
|
92
118
|
}),
|
|
93
|
-
/*#__PURE__*/ _jsx(
|
|
119
|
+
/*#__PURE__*/ _jsx("div", {
|
|
94
120
|
className: Styles.pyramidBoxLeft,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
style: {
|
|
122
|
+
width: `${100 - topSideLength}%`
|
|
123
|
+
},
|
|
124
|
+
children: sections.map((s, i)=>{
|
|
125
|
+
var _rowYs_i;
|
|
126
|
+
const y = (_rowYs_i = rowYs[i]) !== null && _rowYs_i !== void 0 ? _rowYs_i : 0;
|
|
127
|
+
const TITLE_UP = 24;
|
|
128
|
+
const DIFF_DOWN = 4;
|
|
129
|
+
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
100
130
|
children: [
|
|
101
|
-
/*#__PURE__*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
132
|
+
className: Styles.leftTitle,
|
|
133
|
+
style: {
|
|
134
|
+
top: `calc(${y}% - ${TITLE_UP}px)`
|
|
135
|
+
},
|
|
136
|
+
children: [
|
|
137
|
+
/*#__PURE__*/ _jsx(Eyebrow, {
|
|
138
|
+
size: "small",
|
|
139
|
+
className: classNames(Styles.statTitle, 'm-r-half'),
|
|
140
|
+
children: s.title
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
143
|
+
direction: "t",
|
|
144
|
+
portal: true,
|
|
145
|
+
text: s.description,
|
|
146
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
147
|
+
name: "info",
|
|
148
|
+
className: "m-r-1",
|
|
149
|
+
size: "14px",
|
|
150
|
+
color: tokens.colorNeutral90
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
]
|
|
105
154
|
}),
|
|
106
|
-
/*#__PURE__*/ _jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
155
|
+
/*#__PURE__*/ _jsx("div", {
|
|
156
|
+
className: Styles.leftDiff,
|
|
157
|
+
style: {
|
|
158
|
+
top: `calc(${y}% + ${DIFF_DOWN}px)`
|
|
159
|
+
},
|
|
160
|
+
children: /*#__PURE__*/ _jsx(StatDiff, {
|
|
161
|
+
value: s.value,
|
|
162
|
+
prev: s.prev,
|
|
163
|
+
size: "small",
|
|
164
|
+
format: format
|
|
115
165
|
})
|
|
116
|
-
}),
|
|
117
|
-
/*#__PURE__*/ _jsx(StatDiff, {
|
|
118
|
-
value: s.value,
|
|
119
|
-
prev: s.prev,
|
|
120
|
-
size: "xsmall",
|
|
121
|
-
format: format
|
|
122
166
|
})
|
|
123
167
|
]
|
|
124
|
-
}, s.id)
|
|
168
|
+
}, s.id);
|
|
169
|
+
})
|
|
125
170
|
})
|
|
126
171
|
]
|
|
127
172
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/funnel-chart/components/funnel-chart.tsx"],"sourcesContent":["import { useMemo, useState, FC } from 'react';\nimport classNames from 'classnames';\nimport {\n BodyText,\n Eyebrow,\n Headline,\n Icon,\n Mask,\n Popover,\n Stack,\n StatusLight,\n Tooltip,\n} from '@servicetitan/design-system';\nimport { tokens } from '@servicetitan/tokens/core';\nimport { formatValue } from '../../../../utils/formatters';\nimport { StatDiff } from '../../../stat/stat-card';\nimport { FunnelChartProps } from '../utils/interface';\nimport { defaultBottomSideLength, defaultTopSideLength } from '../utils/const';\nimport { FunnelPyramidSvg } from './funnel-svg';\nimport * as Styles from './funnel-chart.module.less';\n\nexport const FunnelChart: FC<FunnelChartProps> = ({\n sections,\n format,\n topSideLength = defaultTopSideLength,\n bottomSideLength = defaultBottomSideLength,\n popoverContent: PopoverContent,\n loading,\n className,\n}) => {\n const [popoverShown, setPopoverShown] = useState<number | undefined>(undefined);\n\n const colors = useMemo(() => sections.map(s => s.color), [sections]);\n const hidePopover = () => setPopoverShown(undefined);\n const pyramidTextsStyles = useMemo(\n () => ({ left: `${100 - topSideLength}%` }),\n [topSideLength]\n );\n\n return (\n <Mask\n className={classNames(\n 'h-100 bg-white border border-radius-2 p-3 of-hidden position-relative',\n className\n )}\n active={!!loading}\n >\n <div className={Styles.pyramidWrapper}>\n <FunnelPyramidSvg\n colors={colors}\n topSideLength={topSideLength}\n bottomSideLength={bottomSideLength}\n />\n </div>\n\n <div\n className={classNames(\n 'd-f flex-column justify-content-around',\n Styles.pyramidBoxRight\n )}\n style={pyramidTextsStyles}\n >\n {sections.map(({ id, title, value, color, prev, textClass, data }, ind) => (\n <Stack\n key={title}\n className={Styles.flex1}\n justifyContent=\"center\"\n alignItems=\"center\"\n onMouseEnter={() => setPopoverShown(id)}\n onMouseLeave={hidePopover}\n >\n <Popover\n className=\"of-hidden\"\n trigger={\n <Headline\n size=\"small\"\n className={classNames('m-x-2 m-b-0-i', textClass)}\n data-cy={`marketing-funnel-section-${id}-value`}\n >\n {formatValue(value, format)}\n </Headline>\n }\n open={popoverShown === id}\n direction={ind === 0 ? 'lt' : 'lb'}\n padding=\"s\"\n width=\"auto\"\n portal\n >\n <Stack\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n data-cy={`marketing-funnel-popover-${id}-content`}\n >\n <StatusLight color={color} />\n <BodyText bold className=\"m-r-half\">\n {formatValue(value, format)}\n </BodyText>\n <BodyText bold className=\"m-r-1\">\n {title}\n </BodyText>\n <StatDiff value={value} prev={prev} size=\"xsmall\" format={format} />\n </Stack>\n\n {!!PopoverContent && (\n <PopoverContent\n id={id}\n value={value}\n text={formatValue(value, format)}\n data={data}\n />\n )}\n </Popover>\n </Stack>\n ))}\n </div>\n <Stack className={Styles.pyramidBoxLeft} direction=\"column\">\n {sections.map(s => (\n <Stack\n key={s.id}\n className={Styles.flex1}\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n >\n <Eyebrow size=\"small\" className={classNames(Styles.statTitle, 'm-r-half')}>\n {s.title}\n </Eyebrow>\n\n <Tooltip direction=\"t\" portal text={s.description}>\n <Icon\n name=\"info\"\n className=\"m-r-1\"\n size=\"14px\"\n color={tokens.colorNeutral90}\n />\n </Tooltip>\n\n <StatDiff value={s.value} prev={s.prev} size=\"xsmall\" format={format} />\n </Stack>\n ))}\n </Stack>\n </Mask>\n );\n};\n"],"names":["useMemo","useState","classNames","BodyText","Eyebrow","Headline","Icon","Mask","Popover","Stack","StatusLight","Tooltip","tokens","formatValue","StatDiff","defaultBottomSideLength","defaultTopSideLength","FunnelPyramidSvg","Styles","FunnelChart","sections","format","topSideLength","bottomSideLength","popoverContent","PopoverContent","loading","className","popoverShown","setPopoverShown","undefined","colors","map","s","color","hidePopover","pyramidTextsStyles","left","active","div","pyramidWrapper","pyramidBoxRight","style","id","title","value","prev","textClass","data","ind","flex1","justifyContent","alignItems","onMouseEnter","onMouseLeave","trigger","size","data-cy","open","direction","padding","width","portal","bold","text","pyramidBoxLeft","statTitle","description","name","colorNeutral90"],"mappings":";AAAA,SAASA,OAAO,EAAEC,QAAQ,QAAY,QAAQ;AAC9C,OAAOC,gBAAgB,aAAa;AACpC,SACIC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,WAAW,EACXC,OAAO,QACJ,8BAA8B;AACrC,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,iBAAiB;AAC/E,SAASC,gBAAgB,QAAQ,eAAe;AAChD,YAAYC,YAAY,6BAA6B;AAErD,OAAO,MAAMC,cAAoC,CAAC,EAC9CC,QAAQ,EACRC,MAAM,EACNC,gBAAgBN,oBAAoB,EACpCO,mBAAmBR,uBAAuB,EAC1CS,gBAAgBC,cAAc,EAC9BC,OAAO,EACPC,SAAS,EACZ;IACG,MAAM,CAACC,cAAcC,gBAAgB,GAAG5B,SAA6B6B;IAErE,MAAMC,SAAS/B,QAAQ,IAAMoB,SAASY,GAAG,CAACC,CAAAA,IAAKA,EAAEC,KAAK,GAAG;QAACd;KAAS;IACnE,MAAMe,cAAc,IAAMN,gBAAgBC;IAC1C,MAA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OC,MAAMA;4CAAMU,MAAK;4CAASnC,QAAQA;;;;gCAG7D,CAAC,CAACI,gCACC,KAACA;oCACGkB,IAAIA;oCACJE,OAAOA;oCACPmB,MAAMnD,YAAYgC,OAAOxB;oCACzB2B,MAAMA;;;;uBA5CbJ;;0BAmDjB,KAACnC;gBAAMkB,WAAWT,OAAO+C,cAAc;gBAAEN,WAAU;0BAC9CvC,SAASY,GAAG,CAACC,CAAAA,kBACV,MAACxB;wBAEGkB,WAAWT,OAAOgC,KAAK;wBACvBC,gBAAe;wBACfC,YAAW;;0CAEX,KAAChD;gCAAQoD,MAAK;gCAAQ7B,WAAWzB,WAAWgB,OAAOgD,SAAS,EAAE;0CACzDjC,EAAEW,KAAK;;0CAGZ,KAACjC;gCAAQgD,WAAU;gCAAIG,MAAM;gCAACE,MAAM/B,EAAEkC,WAAW;0CAC7C,cAAA,KAAC7D;oCACG8D,MAAK;oCACLzC,WAAU;oCACV6B,MAAK;oCACLtB,OAAOtB,OAAOyD,cAAc;;;0CAIpC,KAACvD;gCAAS+B,OAAOZ,EAAEY,KAAK;gCAAEC,MAAMb,EAAEa,IAAI;gCAAEU,MAAK;gCAASnC,QAAQA;;;uBAlBzDY,EAAEU,EAAE;;;;AAwBjC,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/funnel-chart/components/funnel-chart.tsx"],"sourcesContent":["import { useMemo, useState, FC, Fragment } from 'react';\nimport classNames from 'classnames';\nimport { BodyText, Eyebrow, Icon, Mask, Stack, Tooltip } from '@servicetitan/design-system';\nimport { tokens } from '@servicetitan/tokens/core';\nimport { formatValue } from '../../../../utils/formatters';\nimport { StatDiff } from '../../../stat/stat-card';\nimport { FunnelChartProps } from '../utils/interface';\nimport { defaultBottomSideLength, defaultTopSideLength } from '../utils/const';\nimport { FunnelPyramidSvg } from './funnel-svg';\nimport * as Styles from './funnel-chart.module.less';\nimport { Popover } from '@servicetitan/anvil2';\nimport { ColorTag } from '../../common';\n\nexport const FunnelChart: FC<FunnelChartProps> = ({\n sections,\n format,\n topSideLength = defaultTopSideLength,\n bottomSideLength = defaultBottomSideLength,\n popoverContent: PopoverContent,\n loading,\n className,\n}) => {\n const [popoverShown, setPopoverShown] = useState<number | undefined>(undefined);\n const [rowYs, setRowYs] = useState<number[]>([]);\n const colors = useMemo(() => sections.map(s => s.color), [sections]);\n const outlineColors = useMemo(() => sections.map(s => s.outlineColor), [sections]);\n const hidePopover = () => setPopoverShown(undefined);\n\n const rightStyles = useMemo(\n () => ({\n left: `${100 - topSideLength}%`,\n width: `${topSideLength}%`,\n }),\n [topSideLength]\n );\n\n return (\n <Mask\n className={classNames(\n 'h-100 bg-white border border-radius-2 p-3 of-hidden position-relative',\n className\n )}\n active={!!loading}\n >\n <div className={Styles.pyramidWrapper}>\n <FunnelPyramidSvg\n colors={colors}\n outlineColors={outlineColors}\n topSideLength={topSideLength}\n bottomSideLength={bottomSideLength}\n onRowAnchors={setRowYs}\n />\n </div>\n\n <div\n className={classNames(\n 'd-f flex-column justify-content-around',\n Styles.pyramidBoxRight\n )}\n style={rightStyles}\n >\n {sections.map(({ id, title, value, color, prev, data, outlineColor }) => (\n <Stack\n key={title}\n className={Styles.flex1}\n justifyContent=\"center\"\n alignItems=\"center\"\n onMouseEnter={() => setPopoverShown(id)}\n onMouseLeave={hidePopover}\n >\n <Popover open={popoverShown === id} openOnHover placement=\"right\">\n <Popover.Trigger>\n {props => (\n <span {...props}>\n <div className={Styles.percentTextWrapper}>\n <BodyText\n className={classNames('m-x-2 m-b-0-i')}\n data-cy={`marketing-funnel-section-${id}-value`}\n >\n {formatValue(value, format)}\n </BodyText>\n </div>\n </span>\n )}\n </Popover.Trigger>\n <Popover.Content>\n <Stack\n alignItems=\"flex-start\"\n justifyContent=\"flex-start\"\n direction=\"column\"\n data-cy={`marketing-funnel-popover-${id}-content`}\n >\n <Stack>\n <ColorTag\n label=\"\"\n color={color}\n outlineColor={outlineColor}\n pattern={outlineColor ? 'outline' : 'solid'}\n />\n <BodyText bold className=\"m-r-half\">\n {title} {formatValue(value, format)}\n </BodyText>\n </Stack>\n <Stack.Item>\n <StatDiff\n value={value}\n prev={prev}\n size=\"xsmall\"\n format={format}\n />\n </Stack.Item>\n </Stack>\n\n {!!PopoverContent && (\n <PopoverContent\n id={id}\n value={value}\n text={formatValue(value, format)}\n data={data}\n />\n )}\n </Popover.Content>\n </Popover>\n </Stack>\n ))}\n </div>\n <div className={Styles.pyramidBoxLeft} style={{ width: `${100 - topSideLength}%` }}>\n {sections.map((s, i) => {\n const y = rowYs[i] ?? 0;\n const TITLE_UP = 24;\n const DIFF_DOWN = 4;\n\n return (\n <Fragment key={s.id}>\n <div\n className={Styles.leftTitle}\n style={{ top: `calc(${y}% - ${TITLE_UP}px)` }}\n >\n <Eyebrow\n size=\"small\"\n className={classNames(Styles.statTitle, 'm-r-half')}\n >\n {s.title}\n </Eyebrow>\n <Tooltip direction=\"t\" portal text={s.description}>\n <Icon\n name=\"info\"\n className=\"m-r-1\"\n size=\"14px\"\n color={tokens.colorNeutral90}\n />\n </Tooltip>\n </div>\n\n <div\n className={Styles.leftDiff}\n style={{ top: `calc(${y}% + ${DIFF_DOWN}px)` }}\n >\n <StatDiff\n value={s.value}\n prev={s.prev}\n size=\"small\"\n format={format}\n />\n </div>\n </Fragment>\n );\n })}\n </div>\n </Mask>\n );\n};\n"],"names":["useMemo","useState","Fragment","classNames","BodyText","Eyebrow","Icon","Mask","Stack","Tooltip","tokens","formatValue","StatDiff","defaultBottomSideLength","defaultTopSideLength","FunnelPyramidSvg","Styles","Popover","ColorTag","FunnelChart","sections","format","topSideLength","bottomSideLength","popoverContent","PopoverContent","loading","className","popoverShown","setPopoverShown","undefined","rowYs","setRowYs","colors","map","s","color","outlineColors","outlineColor","hidePopover","rightStyles","left","width","active","div","pyramidWrapper","onRowAnchors","pyramidBoxRight","style","id","title","value","prev","data","flex1","justifyContent","alignItems","onMouseEnter","onMouseLeave","open","openOnHover","placement","Trigger","props","span","percentTextWrapper","data-cy","Content","direction","label","pattern","bold","Item","size","text","pyramidBoxLeft","i","y","TITLE_UP","DIFF_DOWN","leftTitle","top","statTitle","portal","description","name","colorNeutral90","leftDiff"],"mappings":";AAAA,SAASA,OAAO,EAAEC,QAAQ,EAAMC,QAAQ,QAAQ,QAAQ;AACxD,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,QAAQ,8BAA8B;AAC5F,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,iBAAiB;AAC/E,SAASC,gBAAgB,QAAQ,eAAe;AAChD,YAAYC,YAAY,6BAA6B;AACrD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,QAAQ,QAAQ,eAAe;AAExC,OAAO,MAAMC,cAAoC,CAAC,EAC9CC,QAAQ,EACRC,MAAM,EACNC,gBAAgBR,oBAAoB,EACpCS,mBAAmBV,uBAAuB,EAC1CW,gBAAgBC,cAAc,EAC9BC,OAAO,EACPC,SAAS,EACZ;IACG,MAAM,CAACC,cAAcC,gBAAgB,GAAG5B,SAA6B6B;IACrE,MAAM,CAACC,OAAOC,SAAS,GAAG/B,SAAmB,EAAE;IAC/C,MAAMgC,SAASjC,QAAQ,IAAMoB,SAASc,GAAG,CAACC,CAAAA,IAAKA,EAAEC,KAAK,GAAG;QAAChB;KAAS;IACnE,MAAMiB,gBAAgBrC,QAAQ,IAAMoB,SAASc,GAAG,CAACC,CAAAA,IAAKA,EAAEG,YAAY,GAAG;QAAClB;KAAS;IACjF,MAAMmB,cAAc,IAAMV,gBAAgBC;IAE1C,MAAMU,cAAcxC,QAChB,IAAO,CAAA;YACHyC,MAAM,GAAG,MAAMnB,cAAc,CAAC,CAAC;YAC/BoB,OAAO,GAAGpB,cAAc,C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oCACdC,MAAMjB,EAAEiB,IAAI;oCACZqB,MAAK;oCACLpD,QAAQA;;;;uBA7BLc,EAAEc,EAAE;gBAkC3B;;;;AAIhB,EAAE"}
|
|
@@ -8,31 +8,49 @@
|
|
|
8
8
|
border-style: dashed;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
.percent-text-wrapper {
|
|
12
|
+
width: 32px;
|
|
13
|
+
height: 32px;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
border-radius: @border-radius-circular;
|
|
18
|
+
background: rgba(255, 255, 255, 0.8);
|
|
19
|
+
|
|
20
|
+
:global(.BodyText) {
|
|
21
|
+
font-size: @typescale-0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
11
25
|
.stat-title {
|
|
12
26
|
white-space: nowrap;
|
|
13
27
|
}
|
|
14
28
|
|
|
15
29
|
.pyramid-wrapper {
|
|
16
30
|
position: absolute;
|
|
17
|
-
inset: @spacing-3;
|
|
18
|
-
|
|
19
|
-
.pyramid-line {
|
|
20
|
-
stroke: @color-neutral-60;
|
|
21
|
-
stroke-width: 2;
|
|
22
|
-
}
|
|
31
|
+
inset: @spacing-3; // your existing chart padding
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
.pyramid-box-left,
|
|
26
34
|
.pyramid-box-right {
|
|
27
35
|
position: absolute;
|
|
28
36
|
inset: @spacing-3;
|
|
37
|
+
z-index: 5;
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
.pyramid-box-left {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: @spacing-3;
|
|
43
|
+
bottom: @spacing-3;
|
|
44
|
+
left: @spacing-3;
|
|
32
45
|
z-index: 4;
|
|
33
|
-
|
|
46
|
+
pointer-events: auto;
|
|
34
47
|
}
|
|
35
48
|
|
|
36
|
-
.
|
|
37
|
-
|
|
49
|
+
.leftTitle,
|
|
50
|
+
.leftDiff {
|
|
51
|
+
position: absolute;
|
|
52
|
+
left: 0;
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: flex-end;
|
|
55
|
+
align-items: end;
|
|
38
56
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
2
|
export const flex1: string;
|
|
3
|
+
export const leftDiff: string;
|
|
4
|
+
export const leftTitle: string;
|
|
5
|
+
export const percentTextWrapper: string;
|
|
3
6
|
export const pyramidBoxLeft: string;
|
|
4
7
|
export const pyramidBoxRight: string;
|
|
5
|
-
export const pyramidLine: string;
|
|
6
8
|
export const pyramidWrapper: string;
|
|
7
9
|
export const statTitle: string;
|
|
8
10
|
export const title: string;
|
|
@@ -3,6 +3,8 @@ export interface FunnelPyramidSvgProps {
|
|
|
3
3
|
colors: string[];
|
|
4
4
|
topSideLength?: number;
|
|
5
5
|
bottomSideLength?: number;
|
|
6
|
+
outlineColors?: (string | undefined)[];
|
|
7
|
+
onRowAnchors?: (ysPct: number[]) => void;
|
|
6
8
|
}
|
|
7
9
|
export declare const FunnelPyramidSvg: FC<FunnelPyramidSvgProps>;
|
|
8
10
|
//# sourceMappingURL=funnel-svg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnel-svg.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/funnel-chart/components/funnel-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"funnel-svg.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/funnel-chart/components/funnel-svg.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAa,MAAM,OAAO,CAAC;AAO/C,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAgKtD,CAAC"}
|