@servicetitan/marketing-ui 5.8.1 → 5.10.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/ads/ads-stat.js +21 -10
- package/dist/components/ads/ads-stat.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.js +118 -6
- package/dist/components/charts/funnel-chart/components/funnel-chart.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +9 -0
- package/dist/components/charts/funnel-chart/components/funnel-svg.js +62 -12
- package/dist/components/charts/funnel-chart/components/funnel-svg.js.map +1 -1
- package/dist/components/charts/funnel-chart/funnel-chart.stories.d.ts +0 -1
- package/dist/components/charts/funnel-chart/funnel-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/index.js +1 -0
- package/dist/components/charts/funnel-chart/index.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js +1 -0
- package/dist/components/charts/funnel-chart/utils/const.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.js +2 -1
- package/dist/components/charts/funnel-chart/utils/interface.js.map +1 -1
- package/dist/components/charts/line-chart/components/body.js +105 -16
- package/dist/components/charts/line-chart/components/body.js.map +1 -1
- package/dist/components/charts/line-chart/components/body.module.less.d.ts +4 -0
- package/dist/components/charts/line-chart/components/container.js +12 -4
- package/dist/components/charts/line-chart/components/container.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.js +56 -13
- package/dist/components/charts/line-chart/components/hover-popover.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.module.less.d.ts +5 -0
- package/dist/components/charts/line-chart/components/sidebar.js +35 -5
- package/dist/components/charts/line-chart/components/sidebar.js.map +1 -1
- package/dist/components/charts/line-chart/components/sidebar.module.less.d.ts +13 -0
- package/dist/components/charts/line-chart/components/stuff.js +73 -32
- package/dist/components/charts/line-chart/components/stuff.js.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.module.less.d.ts +6 -0
- package/dist/components/charts/line-chart/components/svg-bars.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/svg-bars.js +60 -26
- package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg-body.js +52 -11
- package/dist/components/charts/line-chart/components/svg-body.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg-lines.js +46 -27
- package/dist/components/charts/line-chart/components/svg-lines.js.map +1 -1
- package/dist/components/charts/line-chart/components/svg.module.less.d.ts +5 -0
- package/dist/components/charts/line-chart/index.js +1 -0
- package/dist/components/charts/line-chart/index.js.map +1 -1
- 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 +98 -127
- package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
- package/dist/components/charts/line-chart/stores/svg.store.d.ts.map +1 -1
- package/dist/components/charts/line-chart/stores/svg.store.js +66 -108
- package/dist/components/charts/line-chart/stores/svg.store.js.map +1 -1
- package/dist/components/charts/line-chart/utils/const.js +8 -7
- package/dist/components/charts/line-chart/utils/const.js.map +1 -1
- package/dist/components/charts/line-chart/utils/formatters.d.ts.map +1 -1
- package/dist/components/charts/line-chart/utils/formatters.js +13 -11
- package/dist/components/charts/line-chart/utils/formatters.js.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.js +2 -1
- package/dist/components/charts/line-chart/utils/interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/internal-interfaces.js +2 -1
- package/dist/components/charts/line-chart/utils/internal-interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/key.d.ts.map +1 -1
- package/dist/components/charts/line-chart/utils/key.js +2 -1
- package/dist/components/charts/line-chart/utils/key.js.map +1 -1
- package/dist/components/charts/line-chart/utils/labels.d.ts.map +1 -1
- package/dist/components/charts/line-chart/utils/labels.js +50 -46
- package/dist/components/charts/line-chart/utils/labels.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.js +60 -6
- package/dist/components/charts/pie-chart/components/pie-chart.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.module.less.d.ts +3 -0
- package/dist/components/charts/pie-chart/components/pie.js +176 -39
- package/dist/components/charts/pie-chart/components/pie.js.map +1 -1
- package/dist/components/charts/pie-chart/index.js +2 -0
- package/dist/components/charts/pie-chart/index.js.map +1 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.d.ts +0 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/utils/const.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/utils/const.js +55 -39
- package/dist/components/charts/pie-chart/utils/const.js.map +1 -1
- package/dist/components/charts/pie-chart/utils/interface.js +2 -1
- package/dist/components/charts/pie-chart/utils/interface.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.d.ts.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +74 -88
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/components/stat/stat-card.js +68 -22
- package/dist/components/stat/stat-card.js.map +1 -1
- package/dist/components/stat/stat-card.module.less.d.ts +5 -0
- package/dist/components/stat/stat-cards.stories.d.ts +0 -1
- package/dist/components/stat/stat-cards.stories.d.ts.map +1 -1
- package/dist/components/stat/stat-extended-card.js +76 -4
- package/dist/components/stat/stat-extended-card.js.map +1 -1
- package/dist/components/stat/stat-extended-card.stories.d.ts +0 -1
- package/dist/components/stat/stat-extended-card.stories.d.ts.map +1 -1
- package/dist/components/ui/action-button/action-button.js +33 -7
- package/dist/components/ui/action-button/action-button.js.map +1 -1
- package/dist/components/ui/action-button/action-button.module.less.d.ts +9 -0
- package/dist/components/ui/action-button/action-button.stories.d.ts +0 -1
- package/dist/components/ui/action-button/action-button.stories.d.ts.map +1 -1
- package/dist/components/ui/action-button/index.js +1 -0
- package/dist/components/ui/action-button/index.js.map +1 -1
- package/dist/components/ui/centered-spinner/centered-spinner.js +20 -2
- package/dist/components/ui/centered-spinner/centered-spinner.js.map +1 -1
- package/dist/components/ui/centered-spinner/centered-spinner.stories.d.ts +0 -1
- package/dist/components/ui/centered-spinner/centered-spinner.stories.d.ts.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.js +71 -35
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/date-range-picker/date-range-picker.module.less.d.ts +4 -0
- package/dist/components/ui/date-range-picker/date-range-picker.stories.d.ts.map +1 -1
- package/dist/components/ui/disabled-button.js +12 -3
- package/dist/components/ui/disabled-button.js.map +1 -1
- package/dist/components/ui/label-with-hint/label-with-hint.js +23 -1
- package/dist/components/ui/label-with-hint/label-with-hint.js.map +1 -1
- package/dist/components/ui/label-with-hint/label-with-hint.stories.d.ts +0 -1
- package/dist/components/ui/label-with-hint/label-with-hint.stories.d.ts.map +1 -1
- package/dist/components/ui/line-text/index.js +1 -0
- package/dist/components/ui/line-text/index.js.map +1 -1
- package/dist/components/ui/line-text/line-text-body.stories.d.ts +0 -1
- package/dist/components/ui/line-text/line-text-body.stories.d.ts.map +1 -1
- package/dist/components/ui/line-text/line-text-head.stories.d.ts +0 -1
- package/dist/components/ui/line-text/line-text-head.stories.d.ts.map +1 -1
- package/dist/components/ui/line-text/line-text.js +71 -25
- package/dist/components/ui/line-text/line-text.js.map +1 -1
- package/dist/components/ui/line-text/line-text.module.less.d.ts +6 -0
- package/dist/components/ui/title-popover/index.js +1 -0
- package/dist/components/ui/title-popover/index.js.map +1 -1
- package/dist/components/ui/title-popover/title-popover.d.ts.map +1 -1
- package/dist/components/ui/title-popover/title-popover.js +78 -69
- package/dist/components/ui/title-popover/title-popover.js.map +1 -1
- package/dist/components/ui/title-popover/title-popover.module.less.d.ts +3 -0
- package/dist/components/ui/title-popover/title-popover.stories.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/__tests__/format-big-numbers.test.d.ts +2 -0
- package/dist/utils/__tests__/format-big-numbers.test.d.ts.map +1 -0
- package/dist/utils/__tests__/formatters.test.d.ts +2 -0
- package/dist/utils/__tests__/formatters.test.d.ts.map +1 -0
- package/dist/utils/__tests__/helpers.test.d.ts +2 -0
- package/dist/utils/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/utils/__tests__/string-case.test.d.ts +2 -0
- package/dist/utils/__tests__/string-case.test.d.ts.map +1 -0
- package/dist/utils/ads-texts.js +2 -1
- package/dist/utils/ads-texts.js.map +1 -1
- package/dist/utils/date/__tests__/date-range-picker.test.d.ts +2 -0
- package/dist/utils/date/__tests__/date-range-picker.test.d.ts.map +1 -0
- package/dist/utils/date/__tests__/date-tenant.test.d.ts +2 -0
- package/dist/utils/date/__tests__/date-tenant.test.d.ts.map +1 -0
- package/dist/utils/date/date-range-picker-options.d.ts.map +1 -1
- package/dist/utils/date/date-range-picker-options.js +90 -68
- package/dist/utils/date/date-range-picker-options.js.map +1 -1
- package/dist/utils/date/date-range-picker-state.d.ts.map +1 -1
- package/dist/utils/date/date-range-picker-state.js +42 -43
- package/dist/utils/date/date-range-picker-state.js.map +1 -1
- package/dist/utils/date/date-tenant.js +4 -6
- package/dist/utils/date/date-tenant.js.map +1 -1
- package/dist/utils/date/date.d.ts.map +1 -1
- package/dist/utils/date/date.js +5 -9
- package/dist/utils/date/date.js.map +1 -1
- package/dist/utils/date/index.js +1 -0
- package/dist/utils/date/index.js.map +1 -1
- package/dist/utils/format-big-numbers.d.ts.map +1 -1
- package/dist/utils/format-big-numbers.js +11 -6
- package/dist/utils/format-big-numbers.js.map +1 -1
- package/dist/utils/formatters.d.ts.map +1 -1
- package/dist/utils/formatters.js +8 -7
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +9 -12
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/marketing-parner-handlers.js +9 -12
- package/dist/utils/marketing-parner-handlers.js.map +1 -1
- package/dist/utils/string-case.js +1 -0
- package/dist/utils/string-case.js.map +1 -1
- package/dist/utils/use-client-rect.d.ts +1 -5
- package/dist/utils/use-client-rect.d.ts.map +1 -1
- package/dist/utils/use-client-rect.js +19 -19
- package/dist/utils/use-client-rect.js.map +1 -1
- package/dist/utils/use-target-range-store.js +7 -6
- package/dist/utils/use-target-range-store.js.map +1 -1
- package/package.json +11 -11
- package/src/components/charts/funnel-chart/funnel-chart.stories.tsx +3 -2
- package/src/components/charts/line-chart/components/svg-bars.tsx +2 -0
- package/src/components/ui/action-button/action-button.stories.tsx +3 -2
- package/src/components/ui/centered-spinner/centered-spinner.stories.tsx +3 -2
- package/src/components/ui/date-range-picker/date-range-picker.stories.tsx +5 -6
- package/src/components/ui/date-range-picker/date-range-picker.tsx +2 -2
- package/src/components/ui/line-text/line-text-body.stories.tsx +3 -2
- package/src/components/ui/line-text/line-text-head.stories.tsx +3 -2
- package/src/components/ui/line-text/line-text.tsx +1 -1
- package/src/components/ui/title-popover/title-popover.stories.tsx +3 -2
- package/src/utils/date/__tests__/date-range-picker.test.ts +1 -1
- package/src/utils/use-client-rect.ts +1 -1
- package/dist/components/charts/funnel-chart/funnel-chart.stories.js +0 -76
- package/dist/components/charts/funnel-chart/funnel-chart.stories.js.map +0 -1
- package/dist/components/charts/line-chart/line-chart.stories.js +0 -225
- package/dist/components/charts/line-chart/line-chart.stories.js.map +0 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.js +0 -22
- package/dist/components/charts/pie-chart/pie-chart.stories.js.map +0 -1
- package/dist/components/image-cropper/image-cropper.stories.js +0 -48
- package/dist/components/image-cropper/image-cropper.stories.js.map +0 -1
- package/dist/components/stat/stat-cards.stories.js +0 -16
- package/dist/components/stat/stat-cards.stories.js.map +0 -1
- package/dist/components/stat/stat-extended-card.stories.js +0 -12
- package/dist/components/stat/stat-extended-card.stories.js.map +0 -1
- package/dist/components/ui/action-button/action-button.stories.js +0 -11
- package/dist/components/ui/action-button/action-button.stories.js.map +0 -1
- package/dist/components/ui/centered-spinner/centered-spinner.stories.js +0 -12
- package/dist/components/ui/centered-spinner/centered-spinner.stories.js.map +0 -1
- package/dist/components/ui/date-range-picker/date-range-picker.stories.js +0 -18
- package/dist/components/ui/date-range-picker/date-range-picker.stories.js.map +0 -1
- package/dist/components/ui/label-with-hint/label-with-hint.stories.js +0 -12
- package/dist/components/ui/label-with-hint/label-with-hint.stories.js.map +0 -1
- package/dist/components/ui/line-text/line-text-body.stories.js +0 -11
- package/dist/components/ui/line-text/line-text-body.stories.js.map +0 -1
- package/dist/components/ui/line-text/line-text-head.stories.js +0 -11
- package/dist/components/ui/line-text/line-text-head.stories.js.map +0 -1
- package/dist/components/ui/title-popover/title-popover.stories.js +0 -17
- package/dist/components/ui/title-popover/title-popover.stories.js.map +0 -1
- package/dist/utils/date/__mocks__/date-mock.js +0 -19
- package/dist/utils/date/__mocks__/date-mock.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useLocalStore } from 'mobx-react';
|
|
2
2
|
import { action } from 'mobx';
|
|
3
|
-
export const useTargetRangeStore = ()
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}));
|
|
3
|
+
export const useTargetRangeStore = ()=>useLocalStore(()=>({
|
|
4
|
+
targetRange: undefined,
|
|
5
|
+
setTargetRange: action(function(range) {
|
|
6
|
+
this.targetRange = range;
|
|
7
|
+
})
|
|
8
|
+
}));
|
|
9
|
+
|
|
9
10
|
//# sourceMappingURL=use-target-range-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-target-range-store.ts"],"sourcesContent":["import { useLocalStore } from 'mobx-react';\nimport { action } from 'mobx';\n\nexport type OptionalRange = Range | undefined;\n\nexport interface TargetRangeStore {\n targetRange: OptionalRange;\n setTargetRange: (range: OptionalRange) => void;\n}\n\nexport const useTargetRangeStore = () =>\n useLocalStore<TargetRangeStore>(() => ({\n targetRange: undefined,\n setTargetRange: action(function (this: TargetRangeStore, range: OptionalRange) {\n this.targetRange = range;\n }),\n }));\n"],"names":["useLocalStore","action","useTargetRangeStore","targetRange","undefined","setTargetRange","range"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,MAAM,QAAQ,OAAO;AAS9B,OAAO,MAAMC,sBAAsB,IAC/BF,cAAgC,IAAO,CAAA;YACnCG,aAAaC;YACbC,gBAAgBJ,OAAO,SAAkCK,KAAoB;gBACzE,IAAI,CAACH,WAAW,GAAGG;YACvB;QACJ,CAAA,GAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/marketing-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "Marketing UI component and utils",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"src"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"classnames": "
|
|
17
|
+
"classnames": "^2.3.1",
|
|
18
18
|
"react-image-crop": "8.6.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@servicetitan/design-system": "~14.5.1",
|
|
33
|
-
"@servicetitan/react-ioc": "^
|
|
34
|
-
"@servicetitan/tokens": ">=12.1
|
|
35
|
-
"@testing-library/react": "^14.
|
|
33
|
+
"@servicetitan/react-ioc": "^31.3.2",
|
|
34
|
+
"@servicetitan/tokens": ">=12.2.1",
|
|
35
|
+
"@testing-library/react": "^14.2.1",
|
|
36
36
|
"@types/accounting": "~0.4.2",
|
|
37
|
-
"@types/history": "~4.7.
|
|
37
|
+
"@types/history": "~4.7.10",
|
|
38
38
|
"@types/react": "~18.2.55",
|
|
39
39
|
"@types/react-image-crop": "8.1.2",
|
|
40
40
|
"accounting": "~0.4.1",
|
|
41
|
-
"axios": "
|
|
41
|
+
"axios": "~0.30.0",
|
|
42
42
|
"mobx": "~6.10.2",
|
|
43
|
-
"mobx-react": "
|
|
44
|
-
"moment": "~2.29.
|
|
45
|
-
"react": "
|
|
43
|
+
"mobx-react": "^9.2.0",
|
|
44
|
+
"moment": "~2.29.3",
|
|
45
|
+
"react": "^18.2.0"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"less": true,
|
|
52
52
|
"webpack": false
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7fc7b9cbf766fe23879ae81831f28bdd96559bce"
|
|
55
55
|
}
|
|
@@ -7,8 +7,9 @@ export default {
|
|
|
7
7
|
component: FunnelChart,
|
|
8
8
|
parameters: {},
|
|
9
9
|
};
|
|
10
|
-
const w = (cb: () => ReactElement) => () =>
|
|
11
|
-
<div style={{ height: '300px', width: '420px' }}>{cb()}</div
|
|
10
|
+
const w = (cb: () => ReactElement) => () => (
|
|
11
|
+
<div style={{ height: '300px', width: '420px' }}>{cb()}</div>
|
|
12
|
+
);
|
|
12
13
|
|
|
13
14
|
const sections3 = (): FunnelChartSection<{ info: string[] }>[] => [
|
|
14
15
|
{
|
|
@@ -13,6 +13,7 @@ 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
|
|
16
17
|
const [store] = useDependencies(SvgStore);
|
|
17
18
|
const { fpx, fpy, barWidth, length } = store;
|
|
18
19
|
const barWidthHalf = barWidth / 2;
|
|
@@ -87,6 +88,7 @@ interface SvgBarsHoverProps {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
export const SvgBarsHover: FC<SvgBarsHoverProps> = observer(({ onHover, onLeave }) => {
|
|
91
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
90
92
|
const [store] = useDependencies(SvgStore);
|
|
91
93
|
const { fpx, fpy, barWidth, length } = store;
|
|
92
94
|
const barWidthHalf = barWidth / 2;
|
|
@@ -7,8 +7,9 @@ export default {
|
|
|
7
7
|
parameters: {},
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () =>
|
|
11
|
-
<div style={style}>{cb()}</div
|
|
10
|
+
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () => (
|
|
11
|
+
<div style={style}>{cb()}</div>
|
|
12
|
+
);
|
|
12
13
|
|
|
13
14
|
export const actionButtonHoverPrimary = w({}, () => (
|
|
14
15
|
<ActionButton hover="primary">Button</ActionButton>
|
|
@@ -7,8 +7,9 @@ export default {
|
|
|
7
7
|
parameters: {},
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () =>
|
|
11
|
-
<div style={style}>{cb()}</div
|
|
10
|
+
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () => (
|
|
11
|
+
<div style={style}>{cb()}</div>
|
|
12
|
+
);
|
|
12
13
|
|
|
13
14
|
export const centeredSpinnerTiny = w({}, () => <CenteredSpinner size="tiny" />);
|
|
14
15
|
export const centeredSpinner = w({ width: '400px', height: '400px' }, () => <CenteredSpinner />);
|
|
@@ -12,12 +12,11 @@ export default {
|
|
|
12
12
|
const tz = { UtcOffset: 0 };
|
|
13
13
|
const state = DateRangePickerState.createWithOptions(DateRangePickerOptionsTenantAds.create(tz));
|
|
14
14
|
|
|
15
|
-
const w = (style: { width?: string; height?: string }, Component: FC) => () =>
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
15
|
+
const w = (style: { width?: string; height?: string }, Component: FC) => () => (
|
|
16
|
+
<div style={style}>
|
|
17
|
+
<Component />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
21
20
|
|
|
22
21
|
export const dateRangePicker = w({}, () => <DateRangePicker state={state} />);
|
|
23
22
|
export const dateRangePickerCompare = w({}, () => <DateRangePicker state={state} compare />);
|
|
@@ -91,8 +91,8 @@ export const DateRangePicker = observer(
|
|
|
91
91
|
const textValue = selectedOption
|
|
92
92
|
? selectedOption.text
|
|
93
93
|
: compare || !value
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
? 'Custom Date Range'
|
|
95
|
+
: formatDateRange(value);
|
|
96
96
|
|
|
97
97
|
return (
|
|
98
98
|
<Stack>
|
|
@@ -7,8 +7,9 @@ export default {
|
|
|
7
7
|
parameters: {},
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const w = (style: { width?: string }, cb: () => ReactElement) => () =>
|
|
11
|
-
<div style={style}>{cb()}</div
|
|
10
|
+
const w = (style: { width?: string }, cb: () => ReactElement) => () => (
|
|
11
|
+
<div style={style}>{cb()}</div>
|
|
12
|
+
);
|
|
12
13
|
|
|
13
14
|
export const bodyTextLineUnlimited = w({}, () => <BodyTextLine>just a simple text</BodyTextLine>);
|
|
14
15
|
export const bodyTextLineLimited = w({ width: '400px' }, () => (
|
|
@@ -7,8 +7,9 @@ export default {
|
|
|
7
7
|
parameters: {},
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const w = (style: { width?: string }, cb: () => ReactElement) => () =>
|
|
11
|
-
<div style={style}>{cb()}</div
|
|
10
|
+
const w = (style: { width?: string }, cb: () => ReactElement) => () => (
|
|
11
|
+
<div style={style}>{cb()}</div>
|
|
12
|
+
);
|
|
12
13
|
|
|
13
14
|
export const headlineLineUnlimited = w({}, () => <HeadlineLine>just a simple text</HeadlineLine>);
|
|
14
15
|
export const headlineLineLimited = w({ width: '400px' }, () => (
|
|
@@ -13,7 +13,7 @@ import * as Styles from './line-text.module.less';
|
|
|
13
13
|
const useLimited = (): [
|
|
14
14
|
(node: HTMLElement | null) => void,
|
|
15
15
|
(node: HTMLElement | null) => void,
|
|
16
|
-
boolean
|
|
16
|
+
boolean,
|
|
17
17
|
] => {
|
|
18
18
|
const [rect1, ref1] = useClientRect();
|
|
19
19
|
const [rect2, ref2] = useClientRect();
|
|
@@ -8,8 +8,9 @@ export default {
|
|
|
8
8
|
parameters: {},
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () =>
|
|
12
|
-
<div style={style}>{cb()}</div
|
|
11
|
+
const w = (style: { width?: string; height?: string }, cb: () => ReactElement) => () => (
|
|
12
|
+
<div style={style}>{cb()}</div>
|
|
13
|
+
);
|
|
13
14
|
|
|
14
15
|
export const titlePopover = w({}, () => <TitlePopover text="Title text">Content</TitlePopover>);
|
|
15
16
|
export const titlePopoverToggle = w({}, () => {
|
|
@@ -10,7 +10,7 @@ type OptType = [
|
|
|
10
10
|
[number, number, number],
|
|
11
11
|
[number, number, number],
|
|
12
12
|
string,
|
|
13
|
-
DateRangePickerOptionsTenantAdsTypes
|
|
13
|
+
DateRangePickerOptionsTenantAdsTypes,
|
|
14
14
|
];
|
|
15
15
|
const opt = ([sy, sm, sd]: [number, number, number], [ey, em, ed]: [number, number, number]) => ({
|
|
16
16
|
start: new Date(sy, sm - 1, sd),
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
export const useClientRect = (): [
|
|
4
4
|
DOMRect | null,
|
|
5
5
|
(node: HTMLElement | null) => void,
|
|
6
|
-
HTMLElement | null
|
|
6
|
+
HTMLElement | null,
|
|
7
7
|
] => {
|
|
8
8
|
const element = useRef<HTMLElement | null>(null);
|
|
9
9
|
const [rect, setRect] = useState<DOMRect | null>(null);
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FunnelChart } from './index';
|
|
3
|
-
import { BodyText } from '@servicetitan/design-system';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Marketing UI/charts/FunnelChart',
|
|
6
|
-
component: FunnelChart,
|
|
7
|
-
parameters: {},
|
|
8
|
-
};
|
|
9
|
-
const w = (cb) => () => _jsx("div", { style: { height: '300px', width: '420px' }, children: cb() });
|
|
10
|
-
const sections3 = () => [
|
|
11
|
-
{
|
|
12
|
-
id: 1,
|
|
13
|
-
color: '#A9D1FF',
|
|
14
|
-
title: 'Revenue',
|
|
15
|
-
description: 'rate 1 description',
|
|
16
|
-
value: 0.33,
|
|
17
|
-
prev: 0.38,
|
|
18
|
-
data: { info: ['random text 1'] },
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 2,
|
|
22
|
-
color: '#3684F5',
|
|
23
|
-
title: 'Budget',
|
|
24
|
-
description: 'rate 2 description',
|
|
25
|
-
value: 0.23,
|
|
26
|
-
prev: 0.21,
|
|
27
|
-
data: { info: ['random text 2', 'random text 22'] },
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 3,
|
|
31
|
-
color: '#1360D9',
|
|
32
|
-
title: 'Sales',
|
|
33
|
-
description: 'rate 3 description',
|
|
34
|
-
value: 0.11,
|
|
35
|
-
prev: 0.11,
|
|
36
|
-
textClass: 'c-white',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
const CustomPopoverContent = ({ data }) => (data === null || data === void 0 ? void 0 : data.info.length) ? (_jsx("div", { children: data.info.map(t => (_jsx(BodyText, { children: t }, t))) })) : null;
|
|
40
|
-
export const funnelChart3Sections = w(() => (_jsx(FunnelChart, { format: "percent", sections: sections3() })));
|
|
41
|
-
export const funnelChart4Sections = w(() => (_jsx(FunnelChart, { format: "percent", sections: [
|
|
42
|
-
{
|
|
43
|
-
id: 1,
|
|
44
|
-
color: '#A9D1FF',
|
|
45
|
-
title: 'Revenue',
|
|
46
|
-
description: 'rate 1 description',
|
|
47
|
-
value: 0.33,
|
|
48
|
-
prev: 0.38,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: 2,
|
|
52
|
-
color: '#56A4FF',
|
|
53
|
-
title: 'Budget',
|
|
54
|
-
description: 'rate 2 description',
|
|
55
|
-
value: 0.23,
|
|
56
|
-
prev: 0.21,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 3,
|
|
60
|
-
color: '#2270EE',
|
|
61
|
-
title: 'Sales',
|
|
62
|
-
description: 'rate 3 description',
|
|
63
|
-
value: 0.11,
|
|
64
|
-
prev: 0.11,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 4,
|
|
68
|
-
color: '#1360D9',
|
|
69
|
-
title: 'Sales',
|
|
70
|
-
description: 'rate 4 description',
|
|
71
|
-
value: 0.22,
|
|
72
|
-
prev: 0.221,
|
|
73
|
-
},
|
|
74
|
-
] })));
|
|
75
|
-
export const funnelChartCustomContent = w(() => (_jsx(FunnelChart, { format: "percent", topSideLength: 80, bottomSideLength: 20, sections: sections3(), popoverContent: CustomPopoverContent })));
|
|
76
|
-
//# sourceMappingURL=funnel-chart.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"funnel-chart.stories.js","sourceRoot":"","sources":["../../../../src/components/charts/funnel-chart/funnel-chart.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAqD,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,eAAe;IACX,KAAK,EAAE,iCAAiC;IACxC,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,EAAE;CACjB,CAAC;AACF,MAAM,CAAC,GAAG,CAAC,EAAsB,EAAE,EAAE,CAAC,GAAG,EAAE,CACvC,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAG,EAAE,EAAE,GAAO,CAAC;AAElE,MAAM,SAAS,GAAG,GAA6C,EAAE,CAAC;IAC9D;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QAAQ,EAAE;QACN;YACI,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACb;QACD;YACI,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACb;QACD;YACI,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACb;QACD;YACI,EAAE,EAAE,CAAC;YACL,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,KAAK;SACd;KACJ,GACH,CACL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAC5C,KAAC,WAAW,IACR,MAAM,EAAC,SAAS,EAChB,aAAa,EAAE,EAAE,EACjB,gBAAgB,EAAE,EAAE,EACpB,QAAQ,EAAE,SAAS,EAAE,EACrB,cAAc,EAAE,oBAAoB,GACtC,CACL,CAAC,CAAC"}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Form } from '@servicetitan/design-system';
|
|
4
|
-
import { LineChart } from './index';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Marketing UI/charts/LineChart',
|
|
7
|
-
component: LineChart,
|
|
8
|
-
parameters: {},
|
|
9
|
-
};
|
|
10
|
-
const dailyValues = (() => {
|
|
11
|
-
const periods = [];
|
|
12
|
-
const days = new Date(2021, 7, 0).getDate();
|
|
13
|
-
for (let i = 1; i <= days; i++) {
|
|
14
|
-
periods.push({
|
|
15
|
-
from: new Date(2021, 7, i),
|
|
16
|
-
to: new Date(2021, 7, i + 1),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
periods,
|
|
21
|
-
values: [
|
|
22
|
-
{
|
|
23
|
-
metricId: 1,
|
|
24
|
-
values: periods.map((_, index) => 2000 + (index % 5) * 2000),
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
metricId: 2,
|
|
28
|
-
values: periods.map(({ from }) => (from.getDay() !== 0 ? 5000 : 0)),
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
const stackedBarChartValues = (() => {
|
|
34
|
-
const periods = [];
|
|
35
|
-
const days = new Date(2021, 7, 0).getDate();
|
|
36
|
-
for (let i = 1; i <= days; i++) {
|
|
37
|
-
periods.push({
|
|
38
|
-
from: new Date(2021, 7, i),
|
|
39
|
-
to: new Date(2021, 7, i + 1),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
periods,
|
|
44
|
-
values: [
|
|
45
|
-
{
|
|
46
|
-
metricId: 2,
|
|
47
|
-
values: periods.map((_, index) => 15 + (index % 5) * 15),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
metricId: 3,
|
|
51
|
-
values: periods.map((_, index) => 10 + (index % 5) * 10),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
metricId: 4,
|
|
55
|
-
values: periods.map((_, index) => 5 + (index % 5) * 5),
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
})();
|
|
60
|
-
const weeklyValues = (() => {
|
|
61
|
-
const periods = [];
|
|
62
|
-
for (let i = 0; i <= 15; i++) {
|
|
63
|
-
periods.push({
|
|
64
|
-
from: new Date(2021, 7, 8 + i * 7),
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
periods,
|
|
69
|
-
values: [
|
|
70
|
-
{
|
|
71
|
-
metricId: 1,
|
|
72
|
-
values: periods.map((_, index) => 2000 + (index % 5) * 2000),
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
metricId: 2,
|
|
76
|
-
values: periods.map(({ from }) => from.getDate() % 10),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
};
|
|
80
|
-
})();
|
|
81
|
-
export const lineChartDailyBottomTitles = () => (_jsx(LineChart, { resolution: "day", metrics: [
|
|
82
|
-
{
|
|
83
|
-
id: 1,
|
|
84
|
-
color: '#60dfa6',
|
|
85
|
-
title: 'Revenue',
|
|
86
|
-
type: 'bar',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
id: 2,
|
|
90
|
-
color: '#737475',
|
|
91
|
-
title: 'Budget',
|
|
92
|
-
type: 'line',
|
|
93
|
-
opts: { dashed: true },
|
|
94
|
-
isRight: true,
|
|
95
|
-
},
|
|
96
|
-
], metricValues: dailyValues.values, periods: dailyValues.periods, titleY: "Left title", display: {
|
|
97
|
-
yLeft: false,
|
|
98
|
-
yLeftFormat: 'money',
|
|
99
|
-
metricsTitlePosition: 'bottom',
|
|
100
|
-
} }));
|
|
101
|
-
export const stackedBarChartDailyBottomTitles = () => {
|
|
102
|
-
return (_jsx(LineChart, { resolution: "day", metrics: [
|
|
103
|
-
{
|
|
104
|
-
id: 2,
|
|
105
|
-
title: 'Lead Calls',
|
|
106
|
-
type: 'stacked-bar',
|
|
107
|
-
color: '#D0D8DD',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: 3,
|
|
111
|
-
title: 'Online Bookings',
|
|
112
|
-
type: 'stacked-bar',
|
|
113
|
-
color: '#08BFDF',
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 4,
|
|
117
|
-
title: 'Manual Calls',
|
|
118
|
-
type: 'stacked-bar',
|
|
119
|
-
color: '#1FBC70',
|
|
120
|
-
},
|
|
121
|
-
], metricValues: stackedBarChartValues.values, periods: dailyValues.periods, titleY: "Left title", display: {
|
|
122
|
-
yLeft: false,
|
|
123
|
-
yLeftFormat: 'number',
|
|
124
|
-
metricsTitlePosition: 'bottom',
|
|
125
|
-
} }));
|
|
126
|
-
};
|
|
127
|
-
export const groupedBarChartDailyBottomTitles = () => {
|
|
128
|
-
return (_jsx(LineChart, { resolution: "day", metrics: [
|
|
129
|
-
{
|
|
130
|
-
id: 2,
|
|
131
|
-
title: 'Lead Calls',
|
|
132
|
-
type: 'grouped-bar',
|
|
133
|
-
color: '#D0D8DD',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: 3,
|
|
137
|
-
title: 'Online Bookings',
|
|
138
|
-
type: 'grouped-bar',
|
|
139
|
-
color: '#08BFDF',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: 4,
|
|
143
|
-
title: 'Manual Calls',
|
|
144
|
-
type: 'grouped-bar',
|
|
145
|
-
color: '#1FBC70',
|
|
146
|
-
},
|
|
147
|
-
], metricValues: stackedBarChartValues.values, periods: dailyValues.periods, titleY: "Left title", display: {
|
|
148
|
-
yLeft: false,
|
|
149
|
-
yLeftFormat: 'number',
|
|
150
|
-
metricsTitlePosition: 'bottom',
|
|
151
|
-
} }));
|
|
152
|
-
};
|
|
153
|
-
export const lineChartWeekly = () => (_jsx(LineChart, { resolution: "week", metrics: [
|
|
154
|
-
{
|
|
155
|
-
id: 1,
|
|
156
|
-
color: '#60dfa6',
|
|
157
|
-
title: 'Revenue',
|
|
158
|
-
type: 'line',
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: 2,
|
|
162
|
-
color: '#737475',
|
|
163
|
-
title: 'Numbers',
|
|
164
|
-
type: 'line',
|
|
165
|
-
isRight: true,
|
|
166
|
-
},
|
|
167
|
-
], metricValues: weeklyValues.values, periods: weeklyValues.periods, display: {
|
|
168
|
-
yLeft: true,
|
|
169
|
-
yRight: true,
|
|
170
|
-
yLeftFormat: 'moneyShort',
|
|
171
|
-
metricsTitlePosition: 'top',
|
|
172
|
-
} }));
|
|
173
|
-
const CountrySelect = () => {
|
|
174
|
-
const [value, setValue] = useState();
|
|
175
|
-
const options = [
|
|
176
|
-
{ key: 1, group: 'Arcona', value: 1, text: 'Australia' },
|
|
177
|
-
{ key: 2, group: 'Arcona', value: 2, text: 'America' },
|
|
178
|
-
{ key: 3, group: 'Arcona', value: 3, text: 'New Zealand' },
|
|
179
|
-
{ key: 4, group: 'Ewok', value: 4, text: 'Spain' },
|
|
180
|
-
{ key: 5, group: 'Gungan', value: 5, text: 'Turkey' },
|
|
181
|
-
{ key: 6, group: 'Gungan', value: 6, text: 'India' },
|
|
182
|
-
];
|
|
183
|
-
return (_jsx(Form.Select, { width: "4", open: true, grouped: true, label: "Clearable select with groups", placeholder: "Choose Country", options: options, onChange: (event, value) => setValue(value.value), value: value }));
|
|
184
|
-
};
|
|
185
|
-
export const lineChartMergedDays = () => (_jsx("div", { style: { width: '800px' }, children: _jsx(LineChart, { resolution: "week", metrics: [
|
|
186
|
-
{
|
|
187
|
-
id: 1,
|
|
188
|
-
color: '#60dfa6',
|
|
189
|
-
title: 'Revenue',
|
|
190
|
-
type: 'bar',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: 2,
|
|
194
|
-
color: '#737475',
|
|
195
|
-
title: 'Numbers',
|
|
196
|
-
type: 'line',
|
|
197
|
-
isRight: true,
|
|
198
|
-
},
|
|
199
|
-
], metricValues: weeklyValues.values, periods: weeklyValues.periods, titleY: "Left title", display: {
|
|
200
|
-
yLeft: true,
|
|
201
|
-
yRight: true,
|
|
202
|
-
yLeftFormat: 'moneyShort',
|
|
203
|
-
metricsTitlePosition: 'top',
|
|
204
|
-
} }) }));
|
|
205
|
-
export const lineChartIndexes = () => (_jsxs("div", { children: [_jsx(CountrySelect, {}), _jsx(LineChart, { resolution: "week", metrics: [
|
|
206
|
-
{
|
|
207
|
-
id: 1,
|
|
208
|
-
color: '#60dfa6',
|
|
209
|
-
title: 'Revenue',
|
|
210
|
-
type: 'bar',
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: 2,
|
|
214
|
-
color: '#737475',
|
|
215
|
-
title: 'Numbers',
|
|
216
|
-
type: 'line',
|
|
217
|
-
isRight: true,
|
|
218
|
-
},
|
|
219
|
-
], metricValues: weeklyValues.values, periods: weeklyValues.periods, display: {
|
|
220
|
-
yLeft: true,
|
|
221
|
-
yRight: true,
|
|
222
|
-
yLeftFormat: 'moneyShort',
|
|
223
|
-
metricsTitlePosition: 'top',
|
|
224
|
-
} })] }));
|
|
225
|
-
//# sourceMappingURL=line-chart.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.stories.js","sourceRoot":"","sources":["../../../../src/components/charts/line-chart/line-chart.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAmB,MAAM,SAAS,CAAC;AAErD,eAAe;IACX,KAAK,EAAE,+BAA+B;IACtC,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;IACtB,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YAC1B,EAAE,EAAE,IAAI,IAAI,C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CACT,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PieChart } from './index';
|
|
3
|
-
import { Eyebrow, Stack, BodyText } from '@servicetitan/design-system';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Marketing UI/charts/PieChart',
|
|
6
|
-
component: PieChart,
|
|
7
|
-
parameters: {},
|
|
8
|
-
};
|
|
9
|
-
export const pieChart5AutoColor = () => (_jsx(PieChart, { title: "Pie Chart", height: 250, sections: [
|
|
10
|
-
{ title: 'lorem', value: 99 },
|
|
11
|
-
{ title: 'ipsum', value: 88 },
|
|
12
|
-
{ title: 'dolor', value: 66 },
|
|
13
|
-
{ title: 'sit', value: 55 },
|
|
14
|
-
{ title: 'amet', value: 22 },
|
|
15
|
-
], popoverDirection: "lt" }));
|
|
16
|
-
export const pieChartWithContent = () => (_jsx(PieChart, { title: "Pie Chart", height: 300, sections: [
|
|
17
|
-
{ title: 'New Customer', value: 61 },
|
|
18
|
-
{ title: 'Existing Customer', value: 90 },
|
|
19
|
-
], content: () => (_jsxs(Stack, { className: "h-100", justifyContent: "center", alignItems: "center", direction: "column", children: [_jsx(BodyText, { bold: true, children: "244" }), _jsx(Eyebrow, { size: "small", children: "Total Leads" })] })), radiusRelative: 45, hideTitles: true }));
|
|
20
|
-
export const pieChart1CustomColor = () => (_jsx(PieChart, { title: "Pie Chart", height: 250, sections: [{ title: 'lorem', value: 99, color: '#ffe278' }] }));
|
|
21
|
-
export const pieChartNoData = () => _jsx(PieChart, { title: "Pie Chart", height: 250, sections: [] });
|
|
22
|
-
//# sourceMappingURL=pie-chart.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.stories.js","sourceRoot":"","sources":["../../../../src/components/charts/pie-chart/pie-chart.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OA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AC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CACtC,KAAC,QAAQ,IACL,KAAK,EAAC,WAAW,EACjB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,GAC7D,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAC,QAAQ,IAAC,KAAK,EAAC,WAAW,EAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,GAAI,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { useRef, useState, Fragment } from 'react';
|
|
12
|
-
import { ImageCropper } from './image-cropper';
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Marketing UI/ImageCropper/ImageCropper',
|
|
15
|
-
component: ImageCropper,
|
|
16
|
-
parameters: {},
|
|
17
|
-
};
|
|
18
|
-
const BasicExample = () => {
|
|
19
|
-
const [imageToEdit, setImageToEdit] = useState();
|
|
20
|
-
const [croppedImage, setCroppedImage] = useState();
|
|
21
|
-
const imageCropper = useRef(null);
|
|
22
|
-
const handleFileChange = (e) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
25
|
-
if (!file) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
setImageToEdit(file);
|
|
29
|
-
};
|
|
30
|
-
const handleSave = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
var _a;
|
|
32
|
-
if (!imageToEdit) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const file = yield ((_a = imageCropper.current) === null || _a === void 0 ? void 0 : _a.getCroppedImg(imageToEdit.type, imageToEdit.name));
|
|
36
|
-
if (!file) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const reader = new FileReader();
|
|
40
|
-
reader.readAsDataURL(file);
|
|
41
|
-
reader.onload = () => {
|
|
42
|
-
setCroppedImage(reader.result);
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
return (_jsxs(Fragment, { children: [_jsx("input", { type: "file", accept: "image/png, image/jpeg", onChange: handleFileChange }), imageToEdit && (_jsxs("div", { style: { marginTop: 30 }, children: [_jsx("button", { onClick: handleSave, children: "Save cropped image" }), _jsx("div", { style: { marginTop: 30 }, children: _jsx(ImageCropper, { file: imageToEdit, ref: imageCropper, crop: { width: 300, height: 300 } }) })] })), croppedImage && (_jsxs("div", { style: { marginTop: 30 }, children: [_jsx("a", { href: croppedImage, download: imageToEdit === null || imageToEdit === void 0 ? void 0 : imageToEdit.name, children: "Download" }), _jsx("div", { style: { marginTop: 30 }, children: _jsx("img", { src: croppedImage }) })] }))] }));
|
|
46
|
-
};
|
|
47
|
-
export const basic = () => _jsx(BasicExample, {});
|
|
48
|
-
//# sourceMappingURL=image-cropper.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-cropper.stories.js","sourceRoot":"","sources":["../../../src/components/image-cropper/image-cropper.stories.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EA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