@headless-adminapp/fluent 1.0.3 → 1.1.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.
Files changed (130) hide show
  1. package/App/AppHeaderContianer.js +5 -1
  2. package/App/AppUI.js +7 -2
  3. package/App/Navigation/NavCategoryItemComponent.d.ts +8 -0
  4. package/App/Navigation/NavCategoryItemComponent.js +20 -0
  5. package/App/Navigation/NavItemComponent.d.ts +8 -0
  6. package/App/Navigation/NavItemComponent.js +19 -0
  7. package/App/Navigation/NavSubItemComponent.d.ts +8 -0
  8. package/App/Navigation/NavSubItemComponent.js +17 -0
  9. package/App/Navigation/NavigationContainer.d.ts +9 -0
  10. package/App/Navigation/NavigationContainer.js +85 -0
  11. package/App/Navigation/index.d.ts +1 -0
  12. package/App/Navigation/index.js +5 -0
  13. package/App/Navigation/types.d.ts +39 -0
  14. package/App/Navigation/types.js +2 -0
  15. package/App/Navigation/utils.d.ts +18 -0
  16. package/App/Navigation/utils.js +82 -0
  17. package/App/QuickActionItem.d.ts +3 -0
  18. package/App/QuickActionItem.js +12 -3
  19. package/CommandBar/Button.d.ts +1 -0
  20. package/CommandBar/Button.js +22 -2
  21. package/CommandBar/IconButton.d.ts +1 -0
  22. package/CommandBar/MenuButton.d.ts +1 -0
  23. package/CommandBar/MenuItem.d.ts +1 -0
  24. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +3 -1
  25. package/DataGrid/GridHeaderContainer.d.ts +1 -0
  26. package/DataGrid/GridHeaderContainer.js +6 -1
  27. package/DataGrid/GridHeaderDesktopV2.d.ts +6 -0
  28. package/DataGrid/GridHeaderDesktopV2.js +54 -0
  29. package/DataGrid/GridListContainer.js +9 -5
  30. package/DataGrid/GridTableContainer.d.ts +2 -0
  31. package/DataGrid/GridTableContainer.js +37 -13
  32. package/DataGrid/TableCell/TableCellAction.js +2 -1
  33. package/DataGrid/TableCell/TableCellBase.js +1 -0
  34. package/DataGrid/TableCell/TableCellLink.js +1 -0
  35. package/DataGrid/constants.d.ts +2 -0
  36. package/DataGrid/constants.js +5 -0
  37. package/DataGrid/useTableColumns.js +23 -6
  38. package/Insights/CommandBarContainer.js +1 -1
  39. package/Insights/FilterBarContainer.js +8 -8
  40. package/Insights/Grid.d.ts +7 -1
  41. package/Insights/Grid.js +24 -8
  42. package/Insights/Header.d.ts +6 -0
  43. package/Insights/Header.js +50 -0
  44. package/Insights/InsightsContainer.js +19 -14
  45. package/Insights/WidgetChartContainer.d.ts +13 -3
  46. package/Insights/WidgetChartContainer.js +62 -38
  47. package/Insights/WidgetDataGridContainer.d.ts +11 -4
  48. package/Insights/WidgetDataGridContainer.js +7 -28
  49. package/Insights/WidgetSection.d.ts +2 -0
  50. package/Insights/WidgetSection.js +16 -0
  51. package/Insights/WidgetTableContainer.d.ts +9 -2
  52. package/Insights/WidgetTableContainer.js +7 -18
  53. package/Insights/WidgetTileContainer.d.ts +0 -2
  54. package/Insights/WidgetTileContainer.js +8 -11
  55. package/Insights/WidgetTitleBar.d.ts +1 -1
  56. package/Insights/WidgetTitleBar.js +1 -1
  57. package/Insights/Widgets.d.ts +2 -2
  58. package/Insights/Widgets.js +15 -48
  59. package/Insights/charts/AreaChart.d.ts +1 -0
  60. package/Insights/charts/AreaChart.js +4 -1
  61. package/Insights/charts/BarChart.d.ts +1 -0
  62. package/Insights/charts/BarChart.js +3 -2
  63. package/Insights/charts/ComposedChart.d.ts +1 -0
  64. package/Insights/charts/ComposedChart.js +4 -1
  65. package/Insights/charts/FunnelChart.d.ts +6 -0
  66. package/Insights/charts/FunnelChart.js +50 -0
  67. package/Insights/charts/FunnelCustomTooltipContent.d.ts +5 -0
  68. package/Insights/charts/FunnelCustomTooltipContent.js +27 -0
  69. package/Insights/charts/GaugeChart.d.ts +1 -0
  70. package/Insights/charts/GaugeChart.js +1 -0
  71. package/Insights/charts/LineChart.d.ts +1 -0
  72. package/Insights/charts/LineChart.js +2 -2
  73. package/Insights/charts/OhlcChart.d.ts +1 -0
  74. package/Insights/charts/OhlcChart.js +1 -1
  75. package/Insights/charts/PieChart.d.ts +1 -0
  76. package/Insights/charts/PieChart.js +2 -1
  77. package/Insights/charts/RadarChart.d.ts +1 -0
  78. package/Insights/charts/RadarChart.js +1 -0
  79. package/Insights/charts/ScatterChart.d.ts +1 -0
  80. package/Insights/charts/ScatterChart.js +2 -1
  81. package/Insights/charts/renderers.d.ts +6 -5
  82. package/Insights/charts/renderers.js +16 -13
  83. package/Insights/constants.d.ts +4 -0
  84. package/Insights/constants.js +7 -0
  85. package/Insights/hooks/useQueriesData.d.ts +2 -2
  86. package/Insights/hooks/useQueriesData.js +0 -1
  87. package/OverflowCommandBar/render.js +3 -3
  88. package/PageBoard/BoardColumnUI.js +36 -7
  89. package/PageBoard/Header.js +5 -3
  90. package/PageBoard/PageBoard.js +7 -1
  91. package/PageCalendar/CalendarSection.js +37 -8
  92. package/PageCalendar/EventDialog/AttributeController.d.ts +2 -1
  93. package/PageCalendar/EventDialog/AttributeController.js +2 -2
  94. package/PageCalendar/EventDialog/EventFormBody.js +17 -2
  95. package/PageCalendar/EventDialog/EventFormContent.d.ts +4 -1
  96. package/PageCalendar/EventDialog/EventFormContent.js +7 -7
  97. package/PageCalendar/Header.js +1 -1
  98. package/PageCalendar/PageCalendar.js +6 -1
  99. package/PageCalendar/TitleSelector.js +8 -4
  100. package/PageEntityForm/PageEntityFormDesktopContainer.js +4 -0
  101. package/PageEntityForm/RecordAvatar.js +1 -2
  102. package/PageEntityForm/RecordCard.js +17 -28
  103. package/PageEntityForm/RelatedViewSelector.js +1 -0
  104. package/PageEntityForm/SectionContainer.js +7 -1
  105. package/PageEntityView/PageEntityView.d.ts +1 -0
  106. package/PageEntityView/PageEntityView.js +12 -2
  107. package/PageEntityView/PageEntityViewDesktopContainer.d.ts +1 -0
  108. package/PageEntityView/PageEntityViewDesktopContainer.js +7 -3
  109. package/PageEntityView/PageEntityViewDesktopFrame.js +1 -1
  110. package/PageEntityView/PageEntityViewDesktopFrameV2.d.ts +8 -0
  111. package/PageEntityView/PageEntityViewDesktopFrameV2.js +48 -0
  112. package/PageEntityView/PageEntityViewMobileContainer.js +2 -3
  113. package/PageEntityView/PageEntityViewMobileFrame.d.ts +8 -0
  114. package/PageEntityView/PageEntityViewMobileFrame.js +38 -0
  115. package/PageInsight/PageInsight.d.ts +7 -0
  116. package/PageInsight/PageInsight.js +31 -0
  117. package/PageInsight/index.d.ts +1 -0
  118. package/PageInsight/index.js +5 -0
  119. package/PageInsights/PageInsights.d.ts +5 -7
  120. package/PageInsights/PageInsights.js +24 -18
  121. package/PageInsights/index.d.ts +1 -1
  122. package/PageInsights/index.js +1 -2
  123. package/components/ComponentBroken.d.ts +7 -0
  124. package/components/ComponentBroken.js +16 -0
  125. package/components/ComponentErrorBoundary.d.ts +15 -0
  126. package/components/ComponentErrorBoundary.js +26 -0
  127. package/form/controls/DateTimeControl.js +17 -3
  128. package/form/controls/DurationControl.js +0 -2
  129. package/form/controls/LookupControl.js +6 -3
  130. package/package.json +3 -3
@@ -1,56 +1,80 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetChartContainer = void 0;
26
+ exports.WidgetChart = void 0;
4
27
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
28
+ const react_1 = require("react");
6
29
  const BodyLoading_1 = require("../components/BodyLoading");
7
- const AreaChart_1 = require("./charts/AreaChart");
8
- const BarChart_1 = require("./charts/BarChart");
9
- const ComposedChart_1 = require("./charts/ComposedChart");
10
- const GaugeChart_1 = require("./charts/GaugeChart");
11
- const LineChart_1 = require("./charts/LineChart");
12
- const OhlcChart_1 = require("./charts/OhlcChart");
13
- const PieChart_1 = require("./charts/PieChart");
14
- const RadarChart_1 = require("./charts/RadarChart");
15
- const ScatterChart_1 = require("./charts/ScatterChart");
16
- const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
30
+ const ComponentErrorBoundary_1 = require("../components/ComponentErrorBoundary");
31
+ const WidgetSection_1 = require("./WidgetSection");
17
32
  const WidgetTitleBar_1 = require("./WidgetTitleBar");
18
- function getChartComponent(type
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- ) {
33
+ const AreaChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/AreaChart'))));
34
+ const BarChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/BarChart'))));
35
+ const ComposedChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/ComposedChart'))));
36
+ const FunnelChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/FunnelChart'))));
37
+ const GaugeChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/GaugeChart'))));
38
+ const LineChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/LineChart'))));
39
+ const OhlcChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/OhlcChart'))));
40
+ const PieChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/PieChart'))));
41
+ const RadarChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/RadarChart'))));
42
+ const ScatterChart = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./charts/ScatterChart'))));
43
+ function getChartComponent(chart) {
44
+ const type = chart.type;
21
45
  switch (type) {
22
46
  case 'line':
23
- return LineChart_1.LineChart;
47
+ return LineChart;
24
48
  case 'area':
25
- return AreaChart_1.AreaChart;
49
+ return AreaChart;
26
50
  case 'bar':
27
- return BarChart_1.BarChart;
51
+ return BarChart;
28
52
  case 'composed':
29
- return ComposedChart_1.ComposedChart;
53
+ return ComposedChart;
30
54
  case 'scatter':
31
- return ScatterChart_1.ScatterChart;
55
+ return ScatterChart;
32
56
  case 'pie':
33
- return PieChart_1.PieChart;
57
+ return PieChart;
34
58
  case 'radar':
35
- return RadarChart_1.RadarChart;
59
+ return RadarChart;
36
60
  case 'gauge':
37
- return GaugeChart_1.GaugeChart;
61
+ return GaugeChart;
38
62
  case 'ohlc':
39
- return OhlcChart_1.OhlcChart;
63
+ return OhlcChart;
64
+ case 'funnel':
65
+ return FunnelChart;
66
+ default:
67
+ throw new Error(`Unsupported chart type: ${type}`);
40
68
  }
41
69
  }
42
- const WidgetChartContainer = ({ content, }) => {
43
- const { transformedCommands, dataset, isPending, isFetching, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
44
- const info = content.chart;
45
- const type = info.chart.type;
46
- const ChartComponent = getChartComponent(type);
47
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
48
- display: 'flex',
49
- flex: 1,
50
- background: react_components_1.tokens.colorNeutralBackground1,
51
- boxShadow: react_components_1.tokens.shadow2,
52
- borderRadius: react_components_1.tokens.borderRadiusMedium,
53
- flexDirection: 'column',
54
- }, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative' }, children: [!isPending && ((0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', inset: 0 }, children: (0, jsx_runtime_1.jsx)(ChartComponent, { dataset: dataset, chartInfo: info.chart }) })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] })] }));
70
+ const WidgetChart = (props) => {
71
+ return ((0, jsx_runtime_1.jsxs)(WidgetSection_1.WidgetSection, { children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: props.title, commands: props.commands }), (0, jsx_runtime_1.jsx)(WidgetChartBody, { dataset: props.dataset, chartInfo: props.chartInfo, isFetching: props.isFetching, isPending: props.isPending })] }));
72
+ };
73
+ exports.WidgetChart = WidgetChart;
74
+ const WidgetChartBody = ({ isFetching, isPending, chartInfo, dataset, }) => {
75
+ const ChartComponent = getChartComponent(chartInfo);
76
+ if (!ChartComponent) {
77
+ return null;
78
+ }
79
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flex: 1, position: 'relative' }, children: [!isPending && ((0, jsx_runtime_1.jsx)(ComponentErrorBoundary_1.ComponentErrorBoundary, { children: (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', inset: 0 }, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching }), children: (0, jsx_runtime_1.jsx)(ChartComponent, { dataset: dataset, chartInfo: chartInfo }) }) }) })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] }));
55
80
  };
56
- exports.WidgetChartContainer = WidgetChartContainer;
@@ -1,4 +1,11 @@
1
- import { DataGridWidgetExperience } from '@headless-adminapp/core/experience/insights';
2
- export declare function WidgetDataGridContainer({ content, }: Readonly<{
3
- content: DataGridWidgetExperience;
4
- }>): import("react/jsx-runtime").JSX.Element;
1
+ import { Filter } from '@headless-adminapp/core/transport';
2
+ interface WidgetDataGridContainerProps {
3
+ title: string;
4
+ logicalName: string;
5
+ maxRecords?: number;
6
+ filter?: Filter;
7
+ commands?: any[][];
8
+ }
9
+ /*** @deprecated Need refactoring */
10
+ export declare function WidgetDataGridContainer({ logicalName, maxRecords, filter, commands, title, }: Readonly<WidgetDataGridContainerProps>): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -8,13 +8,10 @@ const hooks_1 = require("@headless-adminapp/app/command/hooks");
8
8
  const DataGridProvider_1 = require("@headless-adminapp/app/datagrid/DataGridProvider");
9
9
  const hooks_2 = require("@headless-adminapp/app/datagrid/hooks");
10
10
  const hooks_3 = require("@headless-adminapp/app/metadata/hooks");
11
- const mutable_1 = require("@headless-adminapp/app/mutable");
12
- const widget_1 = require("@headless-adminapp/app/widget");
13
- const react_1 = require("react");
14
11
  const DataGrid_1 = require("../DataGrid");
15
12
  const WidgetTitleBar_1 = require("./WidgetTitleBar");
16
- function WidgetDataGridContainer({ content, }) {
17
- const logicalName = content.logicalName;
13
+ /*** @deprecated Need refactoring */
14
+ function WidgetDataGridContainer({ logicalName, maxRecords, filter, commands, title, }) {
18
15
  const schema = (0, hooks_3.useSchema)(logicalName);
19
16
  const { view } = (0, hooks_3.useExperienceView)(logicalName);
20
17
  if (!view) {
@@ -31,42 +28,24 @@ function WidgetDataGridContainer({ content, }) {
31
28
  borderRadius: react_components_1.tokens.borderRadiusMedium,
32
29
  // padding: tokens.spacingHorizontalM,
33
30
  flexDirection: 'column',
34
- }, children: (0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: [], allowViewSelection: false, maxRecords: content.maxRecords, extraFilter: content.filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { content: content }) }) }));
31
+ }, children: (0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: [], allowViewSelection: false, maxRecords: maxRecords, extraFilter: filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { title: title, commands: commands }) }) }));
35
32
  }
36
- const FormSubgridContainer = ({ content, }) => {
33
+ const FormSubgridContainer = ({ title, commands, }) => {
37
34
  const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
38
35
  const primaryControl = (0, hooks_2.useGridControlContext)();
39
- const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
40
- const widgetSetValue = (0, mutable_1.useContextSetValue)(widget_1.WidgetContext);
41
- const updateStateValue = (0, react_1.useCallback)(
42
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
- (value) => {
44
- widgetSetValue((state) => ({
45
- ...state,
46
- data: { ...state.data, ...value },
47
- }));
48
- }, [widgetSetValue]);
49
- const transformedCommands = (0, command_1.useCommands)([content.commands], {
36
+ const transformedCommands = (0, command_1.useCommands)(commands, {
50
37
  ...baseCommandHandleContext,
51
- primaryControl: {
52
- ...primaryControl,
53
- updateStateValue,
54
- },
38
+ primaryControl,
55
39
  });
56
40
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
57
41
  display: 'flex',
58
42
  flex: 1,
59
43
  flexDirection: 'column',
60
- // gap: 8,
61
- // backgroundColor: tokens.colorNeutralBackground2,
62
- // padding: 2,
63
44
  overflow: 'hidden',
64
- }, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widgetState.widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: {
65
- // gap: 12,
45
+ }, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: title, commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: {
66
46
  flex: 1,
67
47
  display: 'flex',
68
48
  flexDirection: 'column',
69
- // overflow: 'hidden',
70
49
  }, children: (0, jsx_runtime_1.jsx)("div", { style: {
71
50
  flex: 1,
72
51
  display: 'flex',
@@ -0,0 +1,2 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ export declare const WidgetSection: FC<PropsWithChildren>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WidgetSection = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const WidgetSection = ({ children }) => {
7
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
8
+ display: 'flex',
9
+ flex: 1,
10
+ background: react_components_1.tokens.colorNeutralBackground1,
11
+ boxShadow: 'none',
12
+ borderRadius: react_components_1.tokens.borderRadiusXLarge,
13
+ flexDirection: 'column',
14
+ }, children: children }));
15
+ };
16
+ exports.WidgetSection = WidgetSection;
@@ -1,7 +1,14 @@
1
- import { TableWidgetExperience } from '@headless-adminapp/core/experience/insights';
1
+ import { CommandItemState } from '@headless-adminapp/app/command';
2
+ import { Attribute } from '@headless-adminapp/core';
2
3
  import { FC } from 'react';
3
4
  interface WidgetTableContainerProps {
4
- content: TableWidgetExperience;
5
+ title: string;
6
+ columns: string[];
7
+ attributes: Record<string, Attribute>;
8
+ isPending?: boolean;
9
+ isFetching?: boolean;
10
+ commands?: CommandItemState[][];
11
+ data: any[];
5
12
  }
6
13
  export declare const WidgetTableContainer: FC<WidgetTableContainerProps>;
7
14
  export {};
@@ -5,21 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const utils_1 = require("@headless-adminapp/app/utils");
7
7
  const BodyLoading_1 = require("../components/BodyLoading");
8
- const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
8
+ const WidgetSection_1 = require("./WidgetSection");
9
9
  const WidgetTitleBar_1 = require("./WidgetTitleBar");
10
- const WidgetTableContainer = ({ content, }) => {
11
- const { transformedCommands, dataset, isPending, isFetching, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
12
- const info = content.table;
13
- const data = dataset[0];
14
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
15
- display: 'flex',
16
- flex: 1,
17
- background: react_components_1.tokens.colorNeutralBackground1,
18
- boxShadow: react_components_1.tokens.shadow2,
19
- borderRadius: react_components_1.tokens.borderRadiusMedium,
20
- flexDirection: 'column',
21
- overflow: 'hidden',
22
- }, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative', overflow: 'auto' }, children: [!isPending && ((0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
10
+ const WidgetTableContainer = ({ title, columns, attributes, isPending, isFetching, commands, data, }) => {
11
+ return ((0, jsx_runtime_1.jsxs)(WidgetSection_1.WidgetSection, { children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: title, commands: commands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative', overflow: 'auto' }, children: [!isPending && ((0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
23
12
  borderCollapse: 'collapse',
24
13
  width: '100%',
25
14
  }, children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
@@ -31,8 +20,8 @@ const WidgetTableContainer = ({ content, }) => {
31
20
  position: 'sticky',
32
21
  top: 0,
33
22
  minWidth: 'calc(100% - 16px)',
34
- }, children: info.columns.map((column, index) => {
35
- const attribute = info.attributes[column];
23
+ }, children: columns.map((column, index) => {
24
+ const attribute = attributes[column];
36
25
  return ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { style: {
37
26
  minWidth: 32,
38
27
  flexShrink: 0,
@@ -41,8 +30,8 @@ const WidgetTableContainer = ({ content, }) => {
41
30
  background: react_components_1.tokens.colorNeutralBackground3,
42
31
  borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
43
32
  }, children: attribute.label }, column + String(index)));
44
- }) }) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { children: data.map((row, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { children: info.columns.map((column) => {
45
- const attribute = info.attributes[column];
33
+ }) }) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { children: data.map((row, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { children: columns.map((column) => {
34
+ const attribute = attributes[column];
46
35
  const value = row[column];
47
36
  const formattedValue = (0, utils_1.getAttributeFormattedValue)(attribute, value) ?? '';
48
37
  switch (attribute?.type) {
@@ -1,7 +1,5 @@
1
- import { TileWidgetExperience } from '@headless-adminapp/core/experience/insights';
2
1
  import { FC } from 'react';
3
2
  interface WidgetTileContainerProps {
4
- content: TileWidgetExperience;
5
3
  }
6
4
  export declare const WidgetTileContainer: FC<WidgetTileContainerProps>;
7
5
  export {};
@@ -3,22 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WidgetTileContainer = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
7
- const WidgetTitleBar_1 = require("./WidgetTitleBar");
8
- const WidgetTileContainer = ({ content, }) => {
9
- const { transformedCommands, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
10
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
6
+ const WidgetTileContainer = ({}) => {
7
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
11
8
  display: 'flex',
12
9
  flex: 1,
13
10
  background: react_components_1.tokens.colorNeutralBackground1,
14
11
  boxShadow: react_components_1.tokens.shadow2,
15
12
  borderRadius: react_components_1.tokens.borderRadiusMedium,
16
13
  flexDirection: 'column',
17
- }, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { style: {
18
- flex: 1,
19
- alignItems: 'center',
20
- display: 'flex',
21
- paddingInline: 16,
22
- }, children: (0, jsx_runtime_1.jsx)(react_components_1.Title2, { children: "Not supported yet" }) }) })] }));
14
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { style: {
15
+ flex: 1,
16
+ alignItems: 'center',
17
+ display: 'flex',
18
+ paddingInline: 16,
19
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.Title2, { children: "Not supported yet" }) }) }) }));
23
20
  };
24
21
  exports.WidgetTileContainer = WidgetTileContainer;
@@ -1,7 +1,7 @@
1
1
  import { CommandItemState } from '@headless-adminapp/app/command';
2
2
  interface WidgetTitleBarProps {
3
3
  title: string;
4
- commands: CommandItemState[][];
4
+ commands?: CommandItemState[][];
5
5
  }
6
6
  export declare function WidgetTitleBar({ title, commands }: WidgetTitleBarProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -17,5 +17,5 @@ function WidgetTitleBar({ title, commands }) {
17
17
  paddingBlock: 8,
18
18
  height: 40,
19
19
  alignItems: 'center',
20
- }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), commands?.[0]?.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { marginRight: -20 }, children: (0, jsx_runtime_1.jsx)(CommandBar_1.default.Wrapper, { children: commands[0].map((command, index) => (0, OverflowCommandBar_1.renderCommandItem)(index, command, language)) }) }))] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] }));
20
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), !!commands && commands[0]?.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { marginRight: -20 }, children: (0, jsx_runtime_1.jsx)(CommandBar_1.default.Wrapper, { children: commands[0].map((command, index) => (0, OverflowCommandBar_1.renderCommandItem)(index, command, language)) }) }))] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] }));
21
21
  }
@@ -1,4 +1,4 @@
1
- import { InsightExpereince } from '@headless-adminapp/core/experience/insights';
1
+ import { InsightConfig } from '@headless-adminapp/core/experience/insights';
2
2
  export declare function Widgets({ widgets, }: Readonly<{
3
- widgets: InsightExpereince['widgets'];
3
+ widgets: InsightConfig['widgets'];
4
4
  }>): import("react/jsx-runtime").JSX.Element;
@@ -3,55 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Widgets = Widgets;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const hooks_1 = require("@headless-adminapp/app/hooks");
6
- const insights_1 = require("@headless-adminapp/app/insights");
7
- const mutable_1 = require("@headless-adminapp/app/mutable");
8
- const widget_1 = require("@headless-adminapp/app/widget");
9
- const react_1 = require("react");
10
6
  const Grid_1 = require("./Grid");
11
- const WidgetChartContainer_1 = require("./WidgetChartContainer");
12
- const WidgetDataGridContainer_1 = require("./WidgetDataGridContainer");
13
- const WidgetTableContainer_1 = require("./WidgetTableContainer");
14
- const WidgetTileContainer_1 = require("./WidgetTileContainer");
15
- const WidgetProvider = ({ children, widget, }) => {
16
- const contextValue = (0, mutable_1.useCreateContextStore)({
17
- widget,
18
- data: widget.defaultData,
19
- });
20
- (0, react_1.useEffect)(() => {
21
- contextValue.setValue({
22
- widget,
23
- data: widget.defaultData,
24
- });
25
- }, [contextValue, widget]);
26
- return ((0, jsx_runtime_1.jsx)(widget_1.WidgetContext.Provider, { value: contextValue, children: children }));
27
- };
28
7
  function Widgets({ widgets, }) {
29
- const isMobile = (0, hooks_1.useIsMobile)();
30
- return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGrid, { children: widgets.map((widget, index) => {
31
- return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: isMobile ? 12 : widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, widget.title + String(index)));
32
- }) }));
8
+ return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGrid, { children: (0, jsx_runtime_1.jsx)(WidgetRenderer, { items: widgets }) }));
33
9
  }
34
- function WidgetItem() {
35
- const insightState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
36
- const widgetState = (0, mutable_1.useContextSelector)(widget_1.WidgetContext, (state) => state);
37
- const widget = widgetState.widget;
38
- const content = typeof widget.content === 'function'
39
- ? widget.content(insightState, widgetState)
40
- : widget.content;
41
- if (content.type === 'tile') {
42
- return (0, jsx_runtime_1.jsx)(WidgetTileContainer_1.WidgetTileContainer, { content: content });
43
- }
44
- if (content.type === 'chart') {
45
- return (0, jsx_runtime_1.jsx)(WidgetChartContainer_1.WidgetChartContainer, { content: content });
46
- }
47
- if (content.type === 'grid') {
48
- return (0, jsx_runtime_1.jsx)(WidgetDataGridContainer_1.WidgetDataGridContainer, { content: content });
49
- }
50
- if (content.type === 'table') {
51
- return (0, jsx_runtime_1.jsx)(WidgetTableContainer_1.WidgetTableContainer, { content: content });
52
- }
53
- if (content.type === 'custom') {
54
- return (0, jsx_runtime_1.jsx)(content.Component, {});
55
- }
56
- return null;
10
+ function WidgetRenderer({ items }) {
11
+ const isMobile = (0, hooks_1.useIsMobile)();
12
+ return items.map((widget, index) => {
13
+ if (widget.type === 'space') {
14
+ if (isMobile) {
15
+ return null;
16
+ }
17
+ return (0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { column: widget.columns }, String(index));
18
+ }
19
+ if (widget.type === 'group') {
20
+ return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridGroup, { column: isMobile ? 12 : widget.columns, row: widget.rows, children: (0, jsx_runtime_1.jsx)(WidgetRenderer, { items: widget.items }) }, String(index)));
21
+ }
22
+ return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: isMobile ? 12 : widget.columns, children: (0, jsx_runtime_1.jsx)(widget.Component, { ...widget.props }) }, String(index)));
23
+ });
57
24
  }
@@ -3,3 +3,4 @@ export declare function AreaChart({ dataset, chartInfo, }: {
3
3
  dataset: any[];
4
4
  chartInfo: AreaChartInfo;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
+ export default AreaChart;
@@ -3,18 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AreaChart = AreaChart;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
6
7
  const recharts_1 = require("recharts");
7
8
  const CustomTooltipContent_1 = require("./CustomTooltipContent");
8
9
  const formatters_1 = require("./formatters");
9
10
  const renderers_1 = require("./renderers");
10
11
  function AreaChart({ dataset, chartInfo, }) {
12
+ const id = (0, react_1.useId)();
11
13
  const xAxis = chartInfo.xAxis;
12
14
  const yAxis = chartInfo.yAxis;
13
15
  const areas = chartInfo.areas;
14
16
  const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
15
17
  const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
16
- return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderAreas)(areas, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
18
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderAreas)(areas, id), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
17
19
  stroke: react_components_1.tokens.colorNeutralBackground6,
18
20
  opacity: 0.5,
19
21
  }, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
20
22
  }
23
+ exports.default = AreaChart;
@@ -3,3 +3,4 @@ export declare function BarChart({ dataset, chartInfo, }: Readonly<{
3
3
  dataset: any[];
4
4
  chartInfo: BarChartInfo;
5
5
  }>): import("react/jsx-runtime").JSX.Element;
6
+ export default BarChart;
@@ -14,7 +14,8 @@ function BarChart({ dataset, chartInfo, }) {
14
14
  const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
15
15
  const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
16
16
  return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: dataset[0], stackOffset: chartInfo.stackOffset, children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis), (0, renderers_1.renderBars)(bars, dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
17
- stroke: react_components_1.tokens.colorNeutralBackground6,
18
- opacity: 0.5,
17
+ fill: react_components_1.tokens.colorNeutralBackground6,
18
+ opacity: 0.2,
19
19
  }, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
20
20
  }
21
+ exports.default = BarChart;
@@ -3,3 +3,4 @@ export declare function ComposedChart({ dataset, chartInfo, }: {
3
3
  dataset: any[];
4
4
  chartInfo: ComposedChartInfo;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
+ export default ComposedChart;
@@ -3,17 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComposedChart = ComposedChart;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
6
7
  const recharts_1 = require("recharts");
7
8
  const CustomTooltipContent_1 = require("./CustomTooltipContent");
8
9
  const formatters_1 = require("./formatters");
9
10
  const renderers_1 = require("./renderers");
10
11
  function ComposedChart({ dataset, chartInfo, }) {
12
+ const id = (0, react_1.useId)();
11
13
  const xAxis = chartInfo.xAxis;
12
14
  const yAxis = chartInfo.yAxis;
13
15
  const xAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(xAxis.tick);
14
16
  const yAxisFullFormatter = (0, formatters_1.createLongAxisFormatter)(yAxis.tick);
15
- return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis, !!chartInfo.bars?.length), (0, renderers_1.renderLines)(chartInfo.lines ?? [], dataset), (0, renderers_1.renderAreas)(chartInfo.areas ?? [], dataset), (0, renderers_1.renderBars)(chartInfo.bars ?? [], dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
17
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, { data: dataset[0], children: [(0, renderers_1.renderGrid)(), (0, renderers_1.renderYAxis)(yAxis), (0, renderers_1.renderXAxis)(xAxis, !!chartInfo.bars?.length), (0, renderers_1.renderLines)(chartInfo.lines ?? []), (0, renderers_1.renderAreas)(chartInfo.areas ?? [], id), (0, renderers_1.renderBars)(chartInfo.bars ?? [], dataset), (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { cursor: {
16
18
  stroke: react_components_1.tokens.colorNeutralBackground6,
17
19
  opacity: 0.5,
18
20
  }, content: ({ active, payload, label }) => ((0, jsx_runtime_1.jsx)(CustomTooltipContent_1.CustomTooltipContent, { xAxisFormatter: xAxisFullFormatter, yAxisFormatter: yAxisFullFormatter, active: active, payload: payload, label: label })) })] }) }));
19
21
  }
22
+ exports.default = ComposedChart;
@@ -0,0 +1,6 @@
1
+ import { FunnelChartInfo } from '@headless-adminapp/core/experience/insights';
2
+ export declare function FunnelChart({ dataset, chartInfo, }: Readonly<{
3
+ dataset: any[];
4
+ chartInfo: FunnelChartInfo;
5
+ }>): import("react/jsx-runtime").JSX.Element;
6
+ export default FunnelChart;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FunnelChart = FunnelChart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
7
+ const recharts_1 = require("recharts");
8
+ const constants_1 = require("./constants");
9
+ const formatters_1 = require("./formatters");
10
+ const FunnelCustomTooltipContent_1 = require("./FunnelCustomTooltipContent");
11
+ function FunnelChart({ dataset, chartInfo, }) {
12
+ const item = chartInfo;
13
+ const nameFormatter = (0, formatters_1.createLongAxisFormatter)({
14
+ type: 'category',
15
+ options: item.nameTick?.options,
16
+ });
17
+ const nameFormatterRef = (0, react_1.useRef)(nameFormatter);
18
+ nameFormatterRef.current = nameFormatter;
19
+ const data = dataset[0];
20
+ const valueFormatter = (0, formatters_1.createLongAxisFormatter)(item.dataTick);
21
+ const transformedData = (0, react_1.useMemo)(() => {
22
+ if (!data?.length) {
23
+ return [];
24
+ }
25
+ let total = data[0][item.dataKey] ?? 0;
26
+ return data.map((dataItem, index) => {
27
+ const perc = total ? dataItem[item.dataKey] / total : 0;
28
+ const label = nameFormatterRef.current(dataItem[item.nameKey]);
29
+ const labelWithPerc = `${label} (${(perc * 100).toFixed(0)}%)`;
30
+ return {
31
+ value: dataItem[item.dataKey],
32
+ label: label,
33
+ labelWithPerc,
34
+ name: dataItem[item.nameKey],
35
+ fill: item.colorKey && dataItem[item.colorKey]
36
+ ? dataItem[item.colorKey]
37
+ : (item.colors ?? constants_1.defaultColors)[index % (item.colors ?? constants_1.defaultColors).length],
38
+ perc,
39
+ };
40
+ });
41
+ }, [data, item]);
42
+ return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: "100%", children: (0, jsx_runtime_1.jsxs)(recharts_1.FunnelChart, { children: [(0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: ({ active, payload }) => {
43
+ return ((0, jsx_runtime_1.jsx)(FunnelCustomTooltipContent_1.FunnelCustomTooltipContent, { valueFormatter: valueFormatter, active: active, payload: payload }));
44
+ } }), (0, jsx_runtime_1.jsx)(recharts_1.Funnel, { dataKey: "value", data: transformedData, isAnimationActive: false, lastShapeType: "rectangle", stroke: "none", children: (0, jsx_runtime_1.jsx)(recharts_1.LabelList, { position: "inside", fill: "#000", stroke: "none", dataKey: "labelWithPerc", style: {
45
+ fontSize: react_components_1.tokens.fontSizeBase100,
46
+ fontFamily: react_components_1.tokens.fontFamilyBase,
47
+ fill: react_components_1.tokens.colorNeutralForeground1,
48
+ }, content: ({ content: _, ...props }) => (0, jsx_runtime_1.jsx)(recharts_1.Label, { ...props }) }) })] }) }));
49
+ }
50
+ exports.default = FunnelChart;
@@ -0,0 +1,5 @@
1
+ export declare const FunnelCustomTooltipContent: ({ active, payload, valueFormatter, }: {
2
+ active?: boolean;
3
+ payload?: any[];
4
+ valueFormatter: (value: unknown) => string;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FunnelCustomTooltipContent = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const formatters_1 = require("./formatters");
7
+ const FunnelCustomTooltipContent = ({ active, payload, valueFormatter, }) => {
8
+ if (!active || !payload?.length) {
9
+ return null;
10
+ }
11
+ const [firstPayload] = payload;
12
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ boxShadow: react_components_1.tokens.shadow16,
16
+ backgroundColor: react_components_1.tokens.colorNeutralBackground1,
17
+ padding: 8,
18
+ borderRadius: 4,
19
+ gap: 4,
20
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: firstPayload.label }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
21
+ width: 8,
22
+ height: 8,
23
+ background: firstPayload.payload.fill,
24
+ borderRadius: 4,
25
+ } }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4, marginLeft: 8 }, children: valueFormatter(firstPayload.value) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, minWidth: 50 } }), (0, jsx_runtime_1.jsxs)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground4 }, children: [(0, formatters_1.formatNumber)(firstPayload.payload.perc * 100, { maxDigit: 2 }), "%"] })] }) })] }));
26
+ };
27
+ exports.FunnelCustomTooltipContent = FunnelCustomTooltipContent;
@@ -3,3 +3,4 @@ export declare function GaugeChart(_props: {
3
3
  dataset: any[];
4
4
  chartInfo: GaugeChartInfo;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
+ export default GaugeChart;
@@ -6,3 +6,4 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  function GaugeChart(_props) {
7
7
  return (0, jsx_runtime_1.jsx)("div", { children: "Not supported yet" });
8
8
  }
9
+ exports.default = GaugeChart;