@servicetitan/marketing-ui 5.11.0 → 5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/charts/funnel-chart/index.d.ts +1 -1
- package/dist/components/charts/funnel-chart/index.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/index.js +0 -1
- package/dist/components/charts/funnel-chart/index.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg-bars.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/svg-bars.js +0 -2
- package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
- package/dist/components/charts/line-chart/index.d.ts +1 -1
- package/dist/components/charts/line-chart/index.d.ts.map +1 -1
- package/dist/components/charts/line-chart/index.js +0 -1
- package/dist/components/charts/line-chart/index.js.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.d.ts +2 -2
- 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 +0 -2
- package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
- package/dist/components/charts/pie-chart/index.d.ts +1 -1
- package/dist/components/charts/pie-chart/index.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/index.js +0 -1
- package/dist/components/charts/pie-chart/index.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.d.ts.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +1 -1
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/utils/date/date-range-picker-state.d.ts +3 -2
- package/dist/utils/date/date-range-picker-state.d.ts.map +1 -1
- package/dist/utils/date/date-range-picker-state.js +0 -1
- package/dist/utils/date/date-range-picker-state.js.map +1 -1
- package/package.json +2 -2
- package/src/components/charts/funnel-chart/index.ts +1 -1
- package/src/components/charts/line-chart/components/svg-bars.tsx +0 -2
- package/src/components/charts/line-chart/index.ts +1 -1
- package/src/components/charts/line-chart/stores/line-chart.store.ts +2 -2
- package/src/components/charts/pie-chart/index.ts +1 -1
- package/src/components/image-cropper/image-cropper.tsx +2 -1
- package/src/utils/date/date-range-picker-state.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/funnel-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/funnel-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,mBAAmB,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/charts/funnel-chart/index.ts"],"sourcesContent":["export { FunnelChart } from './components/funnel-chart';\nexport * from './utils/interface';\n"],"names":["FunnelChart"],"mappings":"AAAA,SAASA,WAAW,QAAQ,4BAA4B
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/charts/funnel-chart/index.ts"],"sourcesContent":["export { FunnelChart } from './components/funnel-chart';\nexport type * from './utils/interface';\n"],"names":["FunnelChart"],"mappings":"AAAA,SAASA,WAAW,QAAQ,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg-bars.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,UAAU,YAAY;IAClB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"svg-bars.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,UAAU,YAAY;IAClB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAoEpC,CAAC;AAEF,UAAU,iBAAiB;IACvB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAyB7C,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { useDependencies } from '@servicetitan/react-ioc';
|
|
|
4
4
|
import { keyVal } from '../utils/key';
|
|
5
5
|
import { SvgStore } from '../stores/svg.store';
|
|
6
6
|
export const SvgBars = observer(({ metrics, isStackedBarChart, isGroupedBarChart })=>{
|
|
7
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
8
7
|
const [store] = useDependencies(SvgStore);
|
|
9
8
|
const { fpx, fpy, barWidth, length } = store;
|
|
10
9
|
const barWidthHalf = barWidth / 2;
|
|
@@ -64,7 +63,6 @@ export const SvgBars = observer(({ metrics, isStackedBarChart, isGroupedBarChart
|
|
|
64
63
|
});
|
|
65
64
|
});
|
|
66
65
|
export const SvgBarsHover = observer(({ onHover, onLeave })=>{
|
|
67
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
68
66
|
const [store] = useDependencies(SvgStore);
|
|
69
67
|
const { fpx, fpy, barWidth, length } = store;
|
|
70
68
|
const barWidthHalf = barWidth / 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { observer } from 'mobx-react';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { ChartMetric } from '../utils/internal-interfaces';\nimport { keyVal } from '../utils/key';\nimport { SvgStore } from '../stores/svg.store';\n\ninterface SvgBarsProps {\n metrics: ChartMetric[];\n isStackedBarChart?: boolean;\n isGroupedBarChart?: boolean;\n}\n\nexport const SvgBars: FC<SvgBarsProps> = observer(\n ({ metrics, isStackedBarChart, isGroupedBarChart }) => {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { observer } from 'mobx-react';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { ChartMetric } from '../utils/internal-interfaces';\nimport { keyVal } from '../utils/key';\nimport { SvgStore } from '../stores/svg.store';\n\ninterface SvgBarsProps {\n metrics: ChartMetric[];\n isStackedBarChart?: boolean;\n isGroupedBarChart?: boolean;\n}\n\nexport const SvgBars: FC<SvgBarsProps> = observer(\n ({ metrics, isStackedBarChart, isGroupedBarChart }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n const values = metrics.map(m => ({\n id: m.id,\n color: m.valuesOpts?.[i]?.color ?? m.color,\n opacity: m.opacity,\n val: store.periodY(m, i),\n }));\n\n if (isStackedBarChart) {\n let stackedBarHeight = values.reduce((sum, curr) => sum + curr.val, 0);\n\n for (const value of values) {\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(stackedBarHeight)}\n width={fpx(barWidth)}\n height={fpx(value.val)}\n fill={value.color}\n />\n );\n stackedBarHeight -= value.val;\n }\n } else if (isGroupedBarChart) {\n for (let j = 0; j < values.length; j++) {\n const groupedBarX = (j * barWidth) / values.length;\n const value = values[j];\n\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={x + groupedBarX - barWidthHalf}\n y={fpy(value.val)}\n width={barWidth / values.length - 0.1}\n height={fpx(value.val)}\n fill={value.color}\n opacity={value.opacity}\n />\n );\n }\n } else {\n values.sort((a, b) => b.val - a.val);\n for (const value of values) {\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(value.val)}\n width={fpx(barWidth)}\n height={fpx(value.val)}\n fill={value.color}\n />\n );\n }\n }\n }\n\n return <g>{paths}</g>;\n }\n);\n\ninterface SvgBarsHoverProps {\n onHover(ind: number): void;\n onLeave(ind: number): void;\n}\n\nexport const SvgBarsHover: FC<SvgBarsHoverProps> = observer(({ onHover, onLeave }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n\n paths.push(\n <rect\n key={keyVal('_', i)}\n onMouseEnter={() => onHover(i)}\n onMouseLeave={() => onLeave(i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(100)}\n width={fpx(barWidth)}\n height=\"100%\"\n fill=\"white\"\n fillOpacity=\"0\"\n />\n );\n }\n\n return <g>{paths}</g>;\n});\n"],"names":["observer","useDependencies","keyVal","SvgStore","SvgBars","metrics","isStackedBarChart","isGroupedBarChart","store","fpx","fpy","barWidth","length","barWidthHalf","paths","i","x","periodX","values","map","m","id","color","valuesOpts","opacity","val","periodY","stackedBarHeight","reduce","sum","curr","value","push","rect","y","width","height","fill","j","groupedBarX","sort","a","b","g","SvgBarsHover","onHover","onLeave","onMouseEnter","onMouseLeave","fillOpacity"],"mappings":";AACA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,QAAQ,QAAQ,sBAAsB;AAQ/C,OAAO,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Q/B;YAC5BC,GAAGP,IAAIO,IAAIH;YACXqB,GAAGxB,IAAI;YACPyB,OAAO1B,IAAIE;YACXyB,QAAO;YACPC,MAAK;YACLY,aAAY;WARP/C,OAAO,KAAKa;IAW7B;IAEA,qBAAO,KAAC4B;kBAAG7B;;AACf,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/line-chart/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/line-chart/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,oBAAoB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/charts/line-chart/index.ts"],"sourcesContent":["export * from './utils/interfaces';\nexport * from './components/container';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/charts/line-chart/index.ts"],"sourcesContent":["export type * from './utils/interfaces';\nexport * from './components/container';\n"],"names":[],"mappings":"AACA,cAAc,yBAAyB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LineChartDisplay, LineChartPeriod, LineChartProps, LineChartResolution } from '../utils/interfaces';
|
|
2
|
-
import { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';
|
|
1
|
+
import type { LineChartDisplay, LineChartPeriod, LineChartProps, LineChartResolution } from '../utils/interfaces';
|
|
2
|
+
import type { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';
|
|
3
3
|
export declare class LineChartStore {
|
|
4
4
|
isInit: boolean;
|
|
5
5
|
display: LineChartDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.store.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"line-chart.store.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,gBAAgB,EAGhB,eAAe,EACf,cAAc,EACd,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAsErF,qBACa,cAAc;IACX,MAAM,UAAS;IACf,OAAO,EAAE,gBAAgB,CAAoB;IAC7C,OAAO,EAAE,WAAW,EAAE,CAAM;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAM;IAChC,UAAU,EAAE,mBAAmB,CAAS;IAExC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAE5B,YAAY,SAAM;;IAMtB,IAAI,GAAI,OAAO,cAAc,UAsCnC;IAEM,eAAe,GAAI,OAAO,MAAM,EAAE,WAAW,OAAO,UAM1D;CACL"}
|
|
@@ -22,9 +22,7 @@ function _ts_metadata(k, v) {
|
|
|
22
22
|
}
|
|
23
23
|
import { injectable } from '@servicetitan/react-ioc';
|
|
24
24
|
import { action, observable, makeObservable } from 'mobx';
|
|
25
|
-
import { LineChartDisplay, LineChartResolution } from '../utils/interfaces';
|
|
26
25
|
import { defaultDisplay } from '../utils/const';
|
|
27
|
-
import { SideMetricsSettings } from '../utils/internal-interfaces';
|
|
28
26
|
import { getFormatter } from '../utils/formatters';
|
|
29
27
|
const getSideMetricsSettings = (metrics, values, range, title, format)=>{
|
|
30
28
|
let maxRange = range !== null && range !== void 0 ? range : 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, observable, makeObservable } from 'mobx';\nimport {\n LineChartDisplay,\n LineChartDisplayValueFormat,\n LineChartMetricValues,\n LineChartPeriod,\n LineChartProps,\n LineChartResolution,\n} from '../utils/interfaces';\nimport { defaultDisplay } from '../utils/const';\nimport { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';\nimport { getFormatter } from '../utils/formatters';\n\nconst getSideMetricsSettings = (\n metrics: ChartMetric[],\n values: LineChartMetricValues[],\n range?: number,\n title?: string,\n format?: LineChartDisplayValueFormat\n): SideMetricsSettings | undefined => {\n let maxRange = range ?? 0;\n const lineBarMetricIDs = metrics\n .filter(m => m.type === 'line' || m.type === 'bar' || m.type === 'grouped-bar')\n .map(m => m.id);\n const stackedBarMetricIDs = metrics.filter(m => m.type === 'stacked-bar').map(m => m.id);\n\n if (!maxRange) {\n maxRange = values.reduce(\n (sum, metricValues) =>\n lineBarMetricIDs.includes(metricValues.metricId)\n ? Math.max(\n sum,\n metricValues.values.reduce((acc, v) => Math.max(acc, v), 0)\n )\n : sum,\n 0\n );\n }\n\n if (stackedBarMetricIDs.length) {\n const stackChartMetricValues = values\n .filter(metricValues => stackedBarMetricIDs.includes(metricValues.metricId))\n .map(metric => metric.values);\n\n const summedStackedMetrics = stackChartMetricValues[0]?.map((value, i) =>\n stackChartMetricValues.reduce((sum, metricValues) => sum + metricValues[i], 0)\n );\n\n if (summedStackedMetrics?.length) {\n maxRange = Math.max(...summedStackedMetrics, maxRange);\n }\n }\n\n if (!maxRange) {\n if (!lineBarMetricIDs.length && !stackedBarMetricIDs.length) {\n return undefined;\n }\n\n maxRange = 10;\n }\n\n maxRange = Math.max(maxRange, 10);\n\n if (format === 'moneyShort' && maxRange > 1000 && maxRange < 10000) {\n maxRange = 10000;\n }\n\n const sums = [];\n const step = maxRange / 10;\n const formatter = getFormatter(format);\n\n for (let i = 0; i < 10; i++) {\n sums.push(formatter(maxRange - i * step));\n }\n\n const width = title ? 64 : 48;\n\n return { maxRange, maxValue: 1.1 * maxRange, title: title ?? '', values: sums, width };\n};\n\n@injectable()\nexport class LineChartStore {\n @observable isInit = false;\n @observable display: LineChartDisplay = defaultDisplay();\n @observable metrics: ChartMetric[] = [];\n @observable periods: LineChartPeriod[] = [];\n @observable resolution: LineChartResolution = 'day';\n\n @observable left?: SideMetricsSettings;\n @observable right?: SideMetricsSettings;\n\n @observable hoveredIndex = -1;\n\n constructor() {\n makeObservable(this);\n }\n\n @action init = (props: LineChartProps) => {\n this.display = {\n ...defaultDisplay(),\n ...(props.display ?? {}),\n };\n\n this.metrics = props.metrics.map(m => {\n const mv = props.metricValues.find(mv => mv.metricId === m.id);\n\n return {\n ...m,\n isRight: !!m.isRight,\n type: m.type ?? 'line',\n opts: m.opts ?? {},\n values: mv?.values ?? [],\n valuesOpts: mv?.opts,\n };\n });\n\n this.left = getSideMetricsSettings(\n this.metrics.filter(m => !m.isRight),\n props.metricValues,\n props.maxRange,\n props.titleY,\n this.display.yLeftFormat\n );\n this.right = getSideMetricsSettings(\n this.metrics.filter(m => m.isRight),\n props.metricValues,\n props.maxRangeRight,\n props.titleYRight,\n this.display.yRightFormat\n );\n\n this.resolution = props.resolution;\n this.periods = props.periods || [];\n this.hoveredIndex = -1;\n this.isInit = true;\n };\n\n @action setHoveredIndex = (index: number, isHovered: boolean) => {\n if (isHovered) {\n this.hoveredIndex = index;\n } else if (index === this.hoveredIndex) {\n this.hoveredIndex = -1;\n }\n };\n}\n"],"names":["injectable","action","observable","makeObservable","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, observable, makeObservable } from 'mobx';\nimport type {\n LineChartDisplay,\n LineChartDisplayValueFormat,\n LineChartMetricValues,\n LineChartPeriod,\n LineChartProps,\n LineChartResolution,\n} from '../utils/interfaces';\nimport { defaultDisplay } from '../utils/const';\nimport type { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';\nimport { getFormatter } from '../utils/formatters';\n\nconst getSideMetricsSettings = (\n metrics: ChartMetric[],\n values: LineChartMetricValues[],\n range?: number,\n title?: string,\n format?: LineChartDisplayValueFormat\n): SideMetricsSettings | undefined => {\n let maxRange = range ?? 0;\n const lineBarMetricIDs = metrics\n .filter(m => m.type === 'line' || m.type === 'bar' || m.type === 'grouped-bar')\n .map(m => m.id);\n const stackedBarMetricIDs = metrics.filter(m => m.type === 'stacked-bar').map(m => m.id);\n\n if (!maxRange) {\n maxRange = values.reduce(\n (sum, metricValues) =>\n lineBarMetricIDs.includes(metricValues.metricId)\n ? Math.max(\n sum,\n metricValues.values.reduce((acc, v) => Math.max(acc, v), 0)\n )\n : sum,\n 0\n );\n }\n\n if (stackedBarMetricIDs.length) {\n const stackChartMetricValues = values\n .filter(metricValues => stackedBarMetricIDs.includes(metricValues.metricId))\n .map(metric => metric.values);\n\n const summedStackedMetrics = stackChartMetricValues[0]?.map((value, i) =>\n stackChartMetricValues.reduce((sum, metricValues) => sum + metricValues[i], 0)\n );\n\n if (summedStackedMetrics?.length) {\n maxRange = Math.max(...summedStackedMetrics, maxRange);\n }\n }\n\n if (!maxRange) {\n if (!lineBarMetricIDs.length && !stackedBarMetricIDs.length) {\n return undefined;\n }\n\n maxRange = 10;\n }\n\n maxRange = Math.max(maxRange, 10);\n\n if (format === 'moneyShort' && maxRange > 1000 && maxRange < 10000) {\n maxRange = 10000;\n }\n\n const sums = [];\n const step = maxRange / 10;\n const formatter = getFormatter(format);\n\n for (let i = 0; i < 10; i++) {\n sums.push(formatter(maxRange - i * step));\n }\n\n const width = title ? 64 : 48;\n\n return { maxRange, maxValue: 1.1 * maxRange, title: title ?? '', values: sums, width };\n};\n\n@injectable()\nexport class LineChartStore {\n @observable isInit = false;\n @observable display: LineChartDisplay = defaultDisplay();\n @observable metrics: ChartMetric[] = [];\n @observable periods: LineChartPeriod[] = [];\n @observable resolution: LineChartResolution = 'day';\n\n @observable left?: SideMetricsSettings;\n @observable right?: SideMetricsSettings;\n\n @observable hoveredIndex = -1;\n\n constructor() {\n makeObservable(this);\n }\n\n @action init = (props: LineChartProps) => {\n this.display = {\n ...defaultDisplay(),\n ...(props.display ?? {}),\n };\n\n this.metrics = props.metrics.map(m => {\n const mv = props.metricValues.find(mv => mv.metricId === m.id);\n\n return {\n ...m,\n isRight: !!m.isRight,\n type: m.type ?? 'line',\n opts: m.opts ?? {},\n values: mv?.values ?? [],\n valuesOpts: mv?.opts,\n };\n });\n\n this.left = getSideMetricsSettings(\n this.metrics.filter(m => !m.isRight),\n props.metricValues,\n props.maxRange,\n props.titleY,\n this.display.yLeftFormat\n );\n this.right = getSideMetricsSettings(\n this.metrics.filter(m => m.isRight),\n props.metricValues,\n props.maxRangeRight,\n props.titleYRight,\n this.display.yRightFormat\n );\n\n this.resolution = props.resolution;\n this.periods = props.periods || [];\n this.hoveredIndex = -1;\n this.isInit = true;\n };\n\n @action setHoveredIndex = (index: number, isHovered: boolean) => {\n if (isHovered) {\n this.hoveredIndex = index;\n } else if (index === this.hoveredIndex) {\n this.hoveredIndex = -1;\n }\n };\n}\n"],"names":["injectable","action","observable","makeObservable","defaultDisplay","getFormatter","getSideMetricsSettings","metrics","values","range","title","format","maxRange","lineBarMetricIDs","filter","m","type","map","id","stackedBarMetricIDs","reduce","sum","metricValues","includes","metricId","Math","max","acc","v","length","stackChartMetricValues","metric","summedStackedMetrics","value","i","undefined","sums","step","formatter","push","width","maxValue","LineChartStore","isInit","display","periods","resolution","left","right","hoveredIndex","init","props","mv","find","isRight","opts","valuesOpts","titleY","yLeftFormat","maxRangeRight","titleYRight","yRightFormat","setHoveredIndex","index","isHovered"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,OAAO;AAS1D,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,SAASC,YAAY,QAAQ,sBAAsB;AAEnD,MAAMC,yBAAyB,CAC3BC,SACAC,QACAC,OACAC,OACAC;IAEA,IAAIC,WAAWH,kBAAAA,mBAAAA,QAAS;IACxB,MAAMI,mBAAmBN,QACpBO,MAAM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eAAAA,yBAAAA,GAAI5C,MAAM,cAAV4C,wBAAAA,aAAc,EAAE;oBACxBI,UAAU,EAAEJ,eAAAA,yBAAAA,GAAIG,IAAI;gBACxB;YACJ;YAEA,IAAI,CAACR,IAAI,GAAGzC,uBACR,IAAI,CAACC,OAAO,CAACO,MAAM,CAACC,CAAAA,IAAK,CAACA,EAAEuC,OAAO,GACnCH,MAAM7B,YAAY,EAClB6B,MAAMvC,QAAQ,EACduC,MAAMM,MAAM,EACZ,IAAI,CAACb,OAAO,CAACc,WAAW;YAE5B,IAAI,CAACV,KAAK,GAAG1C,uBACT,IAAI,CAACC,OAAO,CAACO,MAAM,CAACC,CAAAA,IAAKA,EAAEuC,OAAO,GAClCH,MAAM7B,YAAY,EAClB6B,MAAMQ,aAAa,EACnBR,MAAMS,WAAW,EACjB,IAAI,CAAChB,OAAO,CAACiB,YAAY;YAG7B,IAAI,CAACf,UAAU,GAAGK,MAAML,UAAU;YAClC,IAAI,CAACD,OAAO,GAAGM,MAAMN,OAAO,IAAI,EAAE;YAClC,IAAI,CAACI,YAAY,GAAG,CAAC;YACrB,IAAI,CAACN,MAAM,GAAG;QAClB;QAEA,uBAAQmB,mBAAkB,CAACC,OAAeC;YACtC,IAAIA,WAAW;gBACX,IAAI,CAACf,YAAY,GAAGc;YACxB,OAAO,IAAIA,UAAU,IAAI,CAACd,YAAY,EAAE;gBACpC,IAAI,CAACA,YAAY,GAAG,CAAC;YACzB;QACJ;QAjDI9C,eAAe,IAAI;IACvB;AAiDJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/pie-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/pie-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/charts/pie-chart/index.ts"],"sourcesContent":["export { PieChart } from './components/pie-chart';\nexport { PieChartSection, PieChartPopoverContentType } from './utils/interface';\n"],"names":["PieChart"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/charts/pie-chart/index.ts"],"sourcesContent":["export { PieChart } from './components/pie-chart';\nexport type { PieChartSection, PieChartPopoverContentType } from './utils/interface';\n"],"names":["PieChart"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-cropper.d.ts","sourceRoot":"","sources":["../../../src/components/image-cropper/image-cropper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"image-cropper.d.ts","sourceRoot":"","sources":["../../../src/components/image-cropper/image-cropper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,qCAAqC,CAAC;AAE7C,UAAU,iBAAiB;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE;QACF,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL;AAED,qBACa,YAAa,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,IAAI,CAAC,CAAO;IACpB,OAAO,CAAC,KAAK,CAAC,CAAmB;gBAEjC,KAAK,EAAE,iBAAiB;IAKpC,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,+BA2CxC;IAGP,iBAAiB;IAIjB,oBAAoB;IAMpB,MAAM;IAaN,OAAO,CAAC,YAAY,CAAsC;IAG1D,OAAO,CAAC,iBAAiB,CAWvB;CACL"}
|
|
@@ -24,7 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
import { Component } from 'react';
|
|
25
25
|
import { observable, action, makeObservable } from 'mobx';
|
|
26
26
|
import { observer } from 'mobx-react';
|
|
27
|
-
import ReactCrop
|
|
27
|
+
import ReactCrop from 'react-image-crop';
|
|
28
28
|
import 'react-image-crop/dist/ReactCrop.css';
|
|
29
29
|
export class ImageCropper extends Component {
|
|
30
30
|
componentDidMount() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/image-cropper/image-cropper.tsx"],"sourcesContent":["import { Component } from 'react';\nimport { observable, action, makeObservable } from 'mobx';\nimport { observer } from 'mobx-react';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/components/image-cropper/image-cropper.tsx"],"sourcesContent":["import { Component } from 'react';\nimport { observable, action, makeObservable } from 'mobx';\nimport { observer } from 'mobx-react';\nimport type { Crop } from 'react-image-crop';\nimport ReactCrop from 'react-image-crop';\nimport 'react-image-crop/dist/ReactCrop.css';\n\ninterface ImageCropperProps {\n file: File;\n crop: {\n width: number;\n height: number;\n };\n}\n\n@observer\nexport class ImageCropper extends Component<ImageCropperProps> {\n @observable private src?: string;\n @observable private crop?: Crop;\n @observable private image?: HTMLImageElement;\n\n constructor(props: ImageCropperProps) {\n super(props);\n makeObservable(this);\n }\n\n getCroppedImg = (type: string, fileName: string) =>\n new Promise<File | undefined>(resolve => {\n if (!this.image || !this.crop) {\n resolve(undefined);\n return;\n }\n\n const { x, y } = this.crop;\n if (x == null || y == null) {\n resolve(undefined);\n return;\n }\n\n const { width, height } = this.props.crop;\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n resolve(undefined);\n return;\n }\n\n ctx.drawImage(\n this.image,\n x * (this.image.naturalWidth / this.image.width),\n y * (this.image.naturalHeight / this.image.height),\n width,\n height,\n 0,\n 0,\n width,\n height\n );\n\n canvas.toBlob(\n blob => {\n const result = blob ? new File([blob], fileName) : undefined;\n resolve(result);\n },\n type,\n 1\n );\n });\n\n @action\n componentDidMount() {\n return (this.src = URL.createObjectURL(this.props.file));\n }\n\n componentWillUnmount() {\n if (this.src) {\n URL.revokeObjectURL(this.src);\n }\n }\n\n render() {\n return this.src ? (\n <ReactCrop\n locked\n src={this.src}\n crop={this.crop}\n onChange={this.handleChange}\n onImageLoaded={this.handleImageLoaded}\n />\n ) : null;\n }\n\n @action\n private handleChange = (crop: Crop) => (this.crop = crop);\n\n @action\n private handleImageLoaded = (image: HTMLImageElement) => {\n this.image = image;\n this.crop = {\n unit: 'px',\n x: 0,\n y: 0,\n width: this.props.crop.width * (image.width / image.naturalWidth),\n height: this.props.crop.height * (image.height / image.naturalHeight),\n };\n\n return false;\n };\n}\n"],"names":["Component","observable","action","makeObservable","observer","ReactCrop","ImageCropper","componentDidMount","src","URL","createObjectURL","props","file","componentWillUnmount","revokeObjectURL","render","locked","crop","onChange","handleChange","onImageLoaded","handleImageLoaded","image","getCroppedImg","type","fileName","Promise","resolve","undefined","x","y","width","height","canvas","document","createElement","ctx","getContext","drawImage","naturalWidth","naturalHeight","toBlob","blob","result","File","unit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,UAAU,EAAEC,MAAM,EAAEC,cAAc,QAAQ,OAAO;AAC1D,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAOC,eAAe,mBAAmB;AACzC,OAAO,sCAAsC;AAW7C,OAAO,MAAMC,qBAAqBN;IAwD9BO,oBAAoB;QAChB,OAAQ,IAAI,CAACC,GAAG,GAAGC,IAAIC,eAAe,CAAC,IAAI,CAACC,KAAK,CAACC,IAAI;IAC1D;IAEAC,uBAAuB;QACnB,IAAI,IAAI,CAACL,GAAG,EAAE;YACVC,IAAIK,eAAe,CAAC,IAAI,CAACN,G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AAA;oBACI,MAAMC,SAASD,OAAO,IAAIE,KAAK;wBAACF;qBAAK,EAAEjB,YAAYG;oBACnDD,QAAQgB;gBACZ,GACAnB,MACA;YAER,KAyBJ,uBACQL,gBAAe,CAACF,OAAgB,IAAI,CAACA,IAAI,GAAGA,OAEpD,uBACQI,qBAAoB,CAACC;YACzB,IAAI,CAACA,KAAK,GAAGA;YACb,IAAI,CAACL,IAAI,GAAG;gBACR4B,MAAM;gBACNhB,GAAG;gBACHC,GAAG;gBACHC,OAAO,IAAI,CAACpB,KAAK,CAACM,IAAI,CAACc,KAAK,GAAIT,CAAAA,MAAMS,KAAK,GAAGT,MAAMiB,YAAY,AAAD;gBAC/DP,QAAQ,IAAI,CAACrB,KAAK,CAACM,IAAI,CAACe,MAAM,GAAIV,CAAAA,MAAMU,MAAM,GAAGV,MAAMkB,aAAa,AAAD;YACvE;YAEA,OAAO;QACX;QAtFIrC,eAAe,IAAI;IACvB;AAsFJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DateRangePickerOption
|
|
2
|
-
import { DateRange } from './date';
|
|
1
|
+
import type { DateRangePickerOption } from './date-range-picker-options';
|
|
2
|
+
import type { DateRange } from './date';
|
|
3
|
+
import { DateRangePickerOptions } from './date-range-picker-options';
|
|
3
4
|
interface DateRangePickerStateConfig {
|
|
4
5
|
defaultValue?: DateRange;
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker-state.d.ts","sourceRoot":"","sources":["../../../src/utils/date/date-range-picker-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"date-range-picker-state.d.ts","sourceRoot":"","sources":["../../../src/utils/date/date-range-picker-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,UAAU,0BAA0B;IAChC,YAAY,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,+BAA+B,CAAC,UAAU,SAAS,MAAM,CACtE,SAAQ,wBAAwB;IAChC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;CAC/D;AAED,qBAAa,oBAAoB,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;IAE9B,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAEtD,IAAc,cAAc,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,SAAS,CAM5E;gBAEW,MAAM,CAAC,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IAY7F,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,0BAA0B,GAAG,wBAAwB;IAI5E,MAAM,CAAC,iBAAiB,CAAC,UAAU,SAAS,MAAM,EAC9C,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC,EAC3C,MAAM,CAAC,EAAE,0BAA0B,GACpC,+BAA+B,CAAC,UAAU,CAAC;IAOtC,QAAQ,GAAI,MAAM,SAAS,UAEjC;CACL"}
|
|
@@ -20,7 +20,6 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
20
20
|
function _ts_metadata(k, v) {
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
|
-
import { DateRange } from './date';
|
|
24
23
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
25
24
|
export class DateRangePickerState {
|
|
26
25
|
get selectedOption() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/date/date-range-picker-state.ts"],"sourcesContent":["import { DateRangePickerOption
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/date/date-range-picker-state.ts"],"sourcesContent":["import type { DateRangePickerOption } from './date-range-picker-options';\nimport type { DateRange } from './date';\nimport { DateRangePickerOptions } from './date-range-picker-options';\nimport { action, computed, makeObservable, observable } from 'mobx';\n\ninterface DateRangePickerStateConfig {\n defaultValue?: DateRange;\n}\n\nexport interface DateRangePickerStateType {\n value?: DateRange;\n onChange(val?: DateRange): void;\n}\n\nexport interface DateRangePickerOptionsStateType<OptionKeys extends string>\n extends DateRangePickerStateType {\n readonly options: DateRangePickerOptions<OptionKeys>;\n readonly selectedOption?: DateRangePickerOption<OptionKeys>;\n}\n\nexport class DateRangePickerState<OptionKeys extends string = never> {\n @observable value?: DateRange;\n\n readonly options?: DateRangePickerOptions<OptionKeys>;\n\n @computed get selectedOption(): DateRangePickerOption<OptionKeys> | undefined {\n if (!this.value || !this.options) {\n return undefined;\n }\n\n return this.options.findOption(this.value);\n }\n\n constructor(config?: DateRangePickerStateConfig, options?: DateRangePickerOptions<OptionKeys>) {\n makeObservable(this);\n\n this.options = options;\n\n if (config?.defaultValue) {\n this.value = config.defaultValue;\n } else if (this.options?.defaultOption) {\n this.value = this.options.findOption(this.options.defaultOption)?.value;\n }\n }\n\n static create(config?: DateRangePickerStateConfig): DateRangePickerStateType {\n return new DateRangePickerState(config);\n }\n\n static createWithOptions<OptionKeys extends string>(\n options: DateRangePickerOptions<OptionKeys>,\n config?: DateRangePickerStateConfig\n ): DateRangePickerOptionsStateType<OptionKeys> {\n return new DateRangePickerState(\n config,\n options\n ) as DateRangePickerOptionsStateType<OptionKeys>;\n }\n\n @action onChange = (val?: DateRange) => {\n this.value = val;\n };\n}\n"],"names":["action","computed","makeObservable","observable","DateRangePickerState","selectedOption","value","options","undefined","findOption","create","config","createWithOptions","onChange","val","defaultValue","defaultOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AAiBpE,OAAO,MAAMC;IAKT,IAAcC,iBAAgE;QAC1E,IAAI,CAAC,IAAI,CAACC,KAAK,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;YAC9B,OAAOC;QACX;QAEA,OAAO,IAAI,CAACD,OAAO,CAACE,UAAU,CAAC,IAAI,CAACH,KAAK;IAC7C;IAcA,OAAOI,OAAOC,MAAmC,EAA4B;QACzE,OAAO,IAAIP,qBAAqBO;IACpC;IAEA,OAAOC,kBACHL,OAA2C,EAC3CI,MAAmC,EACQ;QAC3C,OAAO,IAAIP,qBACPO,QACAJ;IAER;IAxBA,YAAYI,MAAmC,EAAEJ,OAA4C,CAAE;YAOhF;QAnBf,uBAAYD,SAAZ,KAAA;QAEA,uBAASC,WAAT,KAAA;QAoCA,uBAAQM,YAAW,CAACC;YAChB,IAAI,CAACR,KAAK,GAAGQ;QACjB;QA3BIZ,eAAe,IAAI;QAEnB,IAAI,CAACK,OAAO,GAAGA;QAEf,IAAII,mBAAAA,6BAAAA,OAAQI,YAAY,EAAE;YACtB,IAAI,CAACT,KAAK,GAAGK,OAAOI,YAAY;QACpC,OAAO,KAAI,gBAAA,IAAI,CAACR,OAAO,cAAZ,oCAAA,cAAcS,aAAa,EAAE;gBACvB;YAAb,IAAI,CAACV,KAAK,IAAG,2BAAA,IAAI,CAACC,OAAO,CAACE,UAAU,CAAC,IAAI,CAACF,OAAO,CAACS,aAAa,eAAlD,+CAAA,yBAAqDV,KAAK;QAC3E;IACJ;AAmBJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/marketing-ui",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "Marketing UI component and utils",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"less": true,
|
|
52
52
|
"webpack": false
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "5bc4f3c9c8a181df124fdc614964757e5490ea9b"
|
|
55
55
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FunnelChart } from './components/funnel-chart';
|
|
2
|
-
export * from './utils/interface';
|
|
2
|
+
export type * from './utils/interface';
|
|
@@ -13,7 +13,6 @@ interface SvgBarsProps {
|
|
|
13
13
|
|
|
14
14
|
export const SvgBars: FC<SvgBarsProps> = observer(
|
|
15
15
|
({ metrics, isStackedBarChart, isGroupedBarChart }) => {
|
|
16
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
16
|
const [store] = useDependencies(SvgStore);
|
|
18
17
|
const { fpx, fpy, barWidth, length } = store;
|
|
19
18
|
const barWidthHalf = barWidth / 2;
|
|
@@ -88,7 +87,6 @@ interface SvgBarsHoverProps {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
export const SvgBarsHover: FC<SvgBarsHoverProps> = observer(({ onHover, onLeave }) => {
|
|
91
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
92
90
|
const [store] = useDependencies(SvgStore);
|
|
93
91
|
const { fpx, fpy, barWidth, length } = store;
|
|
94
92
|
const barWidthHalf = barWidth / 2;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './utils/interfaces';
|
|
1
|
+
export type * from './utils/interfaces';
|
|
2
2
|
export * from './components/container';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { injectable } from '@servicetitan/react-ioc';
|
|
2
2
|
import { action, observable, makeObservable } from 'mobx';
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
LineChartDisplay,
|
|
5
5
|
LineChartDisplayValueFormat,
|
|
6
6
|
LineChartMetricValues,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
LineChartResolution,
|
|
10
10
|
} from '../utils/interfaces';
|
|
11
11
|
import { defaultDisplay } from '../utils/const';
|
|
12
|
-
import { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';
|
|
12
|
+
import type { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';
|
|
13
13
|
import { getFormatter } from '../utils/formatters';
|
|
14
14
|
|
|
15
15
|
const getSideMetricsSettings = (
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { PieChart } from './components/pie-chart';
|
|
2
|
-
export { PieChartSection, PieChartPopoverContentType } from './utils/interface';
|
|
2
|
+
export type { PieChartSection, PieChartPopoverContentType } from './utils/interface';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import { observable, action, makeObservable } from 'mobx';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
|
-
import
|
|
4
|
+
import type { Crop } from 'react-image-crop';
|
|
5
|
+
import ReactCrop from 'react-image-crop';
|
|
5
6
|
import 'react-image-crop/dist/ReactCrop.css';
|
|
6
7
|
|
|
7
8
|
interface ImageCropperProps {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DateRangePickerOption
|
|
2
|
-
import { DateRange } from './date';
|
|
1
|
+
import type { DateRangePickerOption } from './date-range-picker-options';
|
|
2
|
+
import type { DateRange } from './date';
|
|
3
|
+
import { DateRangePickerOptions } from './date-range-picker-options';
|
|
3
4
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
4
5
|
|
|
5
6
|
interface DateRangePickerStateConfig {
|