@spteck/fluentui-react-charts 1.0.7 → 1.0.9

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 (105) hide show
  1. package/dist/charts/BarChart/BarChart.d.ts +2 -1
  2. package/dist/charts/ComboChart/ComboChart.d.ts +2 -1
  3. package/dist/charts/Doughnut/DoughnutChart.d.ts +2 -1
  4. package/dist/charts/PieChart/PieChart.d.ts +2 -1
  5. package/dist/charts/areaChart/AreaChart.d.ts +2 -1
  6. package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +2 -1
  7. package/dist/charts/bubbleChart/BubbleChart.d.ts +2 -1
  8. package/dist/charts/floatBarChart/FloatBarChart.d.ts +2 -1
  9. package/dist/charts/index.d.ts +14 -0
  10. package/dist/charts/lineChart/LineChart.d.ts +2 -1
  11. package/dist/charts/polarChart/PolarChart.d.ts +2 -1
  12. package/dist/charts/radarChart/RadarChart.d.ts +2 -1
  13. package/dist/charts/scatterChart/ScatterChart.d.ts +2 -1
  14. package/dist/charts/stackedLineChart/StackedLineChart.d.ts +2 -1
  15. package/dist/charts/steamChart/SteamChart.d.ts +2 -1
  16. package/dist/components/index.d.ts +0 -14
  17. package/dist/fluentui-react-charts.cjs.development.js +1086 -1072
  18. package/dist/fluentui-react-charts.cjs.development.js.map +1 -1
  19. package/dist/fluentui-react-charts.cjs.production.min.js +1 -1
  20. package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -1
  21. package/dist/fluentui-react-charts.esm.js +1074 -1074
  22. package/dist/fluentui-react-charts.esm.js.map +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/package.json +5 -5
  25. package/src/assets/sample1.png +0 -0
  26. package/src/assets/sample2.png +0 -0
  27. package/src/assets/sample3.png +0 -0
  28. package/src/charts/BarChart/BarChart.tsx +0 -227
  29. package/src/charts/BarChart/README.MD +0 -335
  30. package/src/charts/BarChart/index.ts +0 -1
  31. package/src/charts/ComboChart/ComboChart.tsx +0 -209
  32. package/src/charts/ComboChart/README.MD +0 -347
  33. package/src/charts/ComboChart/index.ts +0 -1
  34. package/src/charts/Doughnut/DoughnutChart.tsx +0 -152
  35. package/src/charts/Doughnut/README.MD +0 -296
  36. package/src/charts/Doughnut/index.ts +0 -1
  37. package/src/charts/PieChart/PieChart.tsx +0 -148
  38. package/src/charts/PieChart/README.MD +0 -315
  39. package/src/charts/PieChart/index.ts +0 -1
  40. package/src/charts/areaChart/AreaChart.tsx +0 -195
  41. package/src/charts/areaChart/README.MD +0 -236
  42. package/src/charts/areaChart/index.ts +0 -1
  43. package/src/charts/barHorizontalChart/BarHotizontalChart.tsx +0 -200
  44. package/src/charts/barHorizontalChart/README.MD +0 -278
  45. package/src/charts/barHorizontalChart/index.ts +0 -2
  46. package/src/charts/bubbleChart/BubbleChart.tsx +0 -184
  47. package/src/charts/bubbleChart/README.MD +0 -275
  48. package/src/charts/bubbleChart/index.ts +0 -1
  49. package/src/charts/floatBarChart/FloatBarChart.tsx +0 -178
  50. package/src/charts/floatBarChart/README.MD +0 -354
  51. package/src/charts/floatBarChart/index.ts +0 -1
  52. package/src/charts/lineChart/LineChart.tsx +0 -200
  53. package/src/charts/lineChart/README.MD +0 -354
  54. package/src/charts/lineChart/index.ts +0 -1
  55. package/src/charts/polarChart/PolarChart.tsx +0 -161
  56. package/src/charts/polarChart/README.MD +0 -336
  57. package/src/charts/polarChart/index.ts +0 -1
  58. package/src/charts/radarChart/README.MD +0 -388
  59. package/src/charts/radarChart/RadarChart.tsx +0 -173
  60. package/src/charts/radarChart/index.ts +0 -1
  61. package/src/charts/scatterChart/README.MD +0 -335
  62. package/src/charts/scatterChart/ScatterChart.tsx +0 -155
  63. package/src/charts/scatterChart/index.ts +0 -1
  64. package/src/charts/stackedLineChart/README.MD +0 -396
  65. package/src/charts/stackedLineChart/StackedLineChart.tsx +0 -188
  66. package/src/charts/stackedLineChart/index.ts +0 -1
  67. package/src/charts/steamChart/README.MD +0 -414
  68. package/src/charts/steamChart/SteamChart.tsx +0 -236
  69. package/src/charts/steamChart/index.ts +0 -1
  70. package/src/components/RenderLabel/RenderLabel.tsx +0 -39
  71. package/src/components/RenderLabel/index.ts +0 -2
  72. package/src/components/RenderLabel/useRenderLabelStylesStyles.ts +0 -25
  73. package/src/components/RenderLegend/RenderLegend.tsx +0 -40
  74. package/src/components/RenderTooltip/RenderTooltip.tsx +0 -111
  75. package/src/components/buttonMenu/ButtonMenu.tsx +0 -186
  76. package/src/components/buttonMenu/IButtonMenuOption.ts +0 -9
  77. package/src/components/buttonMenu/IButtonMenuProps.tsx +0 -40
  78. package/src/components/dashboard/DashBoard.tsx +0 -314
  79. package/src/components/dashboard/ExampleDashboardUsage.tsx +0 -114
  80. package/src/components/dashboard/IDashboardProps.tsx +0 -11
  81. package/src/components/dashboard/NoDashboards.tsx +0 -26
  82. package/src/components/dashboard/index.ts +0 -3
  83. package/src/components/dashboard/selectZoom/SelectZoom.tsx +0 -184
  84. package/src/components/dashboard/useDashboardStyles.ts +0 -76
  85. package/src/components/index.ts +0 -17
  86. package/src/components/legendContainer/LegendContainer.tsx +0 -118
  87. package/src/components/legendeButton/LegendButton.tsx +0 -57
  88. package/src/components/renderSliceLegend/RenderSliceLegend.tsx +0 -46
  89. package/src/components/renderValueLegend/RenderValueLegend.tsx +0 -43
  90. package/src/components/stack/IStackProps.tsx +0 -94
  91. package/src/components/stack/Stack.tsx +0 -103
  92. package/src/components/svgImages/BusinessReportIcon.tsx +0 -218
  93. package/src/components/themeProvider/ThemeProvider.tsx +0 -48
  94. package/src/constants/Constants.tsx +0 -23
  95. package/src/graphGlobalStyles/useGraphGlobalStyles.ts +0 -28
  96. package/src/hooks/index.ts +0 -1
  97. package/src/hooks/useChartFactory.tsx +0 -136
  98. package/src/hooks/useChartUtils.tsx +0 -187
  99. package/src/hooks/useIndexedDBCache.ts +0 -119
  100. package/src/hooks/useResponsiveLegend.ts +0 -35
  101. package/src/index.tsx +0 -5
  102. package/src/models/ChartDatum.ts +0 -4
  103. package/src/models/ICardChartContainer.tsx +0 -11
  104. package/src/models/IChart.ts +0 -50
  105. package/src/models/index.ts +0 -3
@@ -1,25 +0,0 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import {
4
- makeStyles,
5
- shorthands,
6
- } from '@fluentui/react-components';
7
-
8
- export const useRenderLabelStyles = makeStyles({
9
-
10
- labelContainer: {
11
- display: "flex",
12
- flexDirection: "row",
13
- justifyContent: "flex-start",
14
- alignItems: "center",
15
- ...shorthands.gap("6px"),
16
- },
17
- iconStyles: {
18
- width: "26px",
19
- },
20
- item: {
21
- paddingLeft: "15px",
22
- },
23
-
24
-
25
- });
@@ -1,40 +0,0 @@
1
- import { LegendContainer } from '../legendContainer/LegendContainer';
2
- import React from 'react';
3
- import { useResponsiveLegend } from '../../hooks/useResponsiveLegend';
4
-
5
- export interface LegendControlProps {
6
- data: { label: string }[];
7
- visibleSeries: string[];
8
- seriesColors: Record<string, string>;
9
- toggleSeries: (label: string) => void;
10
- }
11
-
12
- const RenderLegend: React.FC<LegendControlProps> = ({
13
- data,
14
- visibleSeries,
15
- seriesColors,
16
- toggleSeries,
17
- }) => {
18
- const {
19
- containerRef,
20
-
21
- visibleItems,
22
- overflowItems,
23
- } = useResponsiveLegend(data);
24
-
25
- return (
26
- <LegendContainer
27
- containerRef={containerRef}
28
-
29
- visibleItems={visibleItems}
30
- overflowItems={overflowItems}
31
- items={data}
32
- visibleLabels={visibleSeries}
33
- toggleLabel={toggleSeries}
34
- renderLabel={d => d.label}
35
- getColor={d => seriesColors[d.label]}
36
- />
37
- );
38
- };
39
-
40
- export default RenderLegend;
@@ -1,111 +0,0 @@
1
- import {
2
- Caption1,
3
- Card,
4
- FluentProvider,
5
- IdPrefixProvider,
6
- Text,
7
- Theme,
8
- } from '@fluentui/react-components';
9
- import { css, keyframes } from '@emotion/css';
10
-
11
- import React from 'react';
12
- import Stack from '../stack/Stack';
13
- import { useThemeContext } from '../themeProvider/ThemeProvider';
14
-
15
- interface TooltipItem {
16
- dataset: {
17
- label: string;
18
- backgroundColor: string;
19
- };
20
- raw: number | null;
21
- }
22
-
23
- interface IRenderTooltipProps {
24
-
25
- title: string[];
26
- body: TooltipItem[];
27
- }
28
-
29
- const fadeIn = keyframes`
30
- from { opacity: 0; transform: scale(0.95); }
31
- to { opacity: 1; transform: scale(1); }
32
- `;
33
-
34
- const useStyles = (theme: Theme, isDark: boolean) => ({
35
- tooltip: css({
36
- backgroundColor: isDark
37
- ? 'rgba(32, 32, 32, 0.9)'
38
- : 'rgba(255, 255, 255, 0.9)',
39
- border: `1px solid ${
40
- isDark ? theme.colorNeutralStroke1 : theme.colorNeutralStroke2
41
- }`,
42
- boxShadow: theme.shadow4,
43
- padding: '8px 12px',
44
- maxWidth: 250,
45
- borderRadius: '4px',
46
- animation: `${fadeIn} 150ms ease-out`,
47
- transformOrigin: 'top left',
48
- position: 'relative',
49
- }),
50
- arrow: css({
51
- position: 'absolute',
52
- top: '-6px',
53
- left: '10px',
54
- width: 0,
55
- height: 0,
56
- borderLeft: '6px solid transparent',
57
- borderRight: '6px solid transparent',
58
- borderBottom: `6px solid ${
59
- isDark ? 'rgba(32, 32, 32, 0.9)' : 'rgba(255, 255, 255, 0.9)'
60
- }`,
61
- }),
62
- colorDot: css({
63
- width: '10px',
64
- height: '10px',
65
- borderRadius: '50%',
66
- marginRight: '6px',
67
- display: 'inline-block',
68
- verticalAlign: 'middle',
69
- }),
70
- });
71
-
72
- export function RenderTooltip({ title, body }: IRenderTooltipProps) {
73
- const { theme,themeName } = useThemeContext();
74
- const isDark = themeName === 'dark';
75
- const styles = useStyles(theme, isDark);
76
-
77
- return (
78
- <IdPrefixProvider value="chartjs-tooltip">
79
- <FluentProvider theme={theme} style={{ zIndex: 1000 }}>
80
- <Card className={styles.tooltip}>
81
- <div className={styles.arrow} />
82
- <Stack rowGap="5px">
83
- {title.length > 0 && (
84
- <Text block>
85
- {title[0]}
86
- </Text>
87
- )}
88
- {body.map((item, index) => (
89
- <Stack
90
- key={index}
91
- direction="horizontal"
92
- columnGap="6px"
93
- alignItems="center"
94
- >
95
- <div
96
- className={styles.colorDot}
97
- style={{
98
- backgroundColor: item.dataset.backgroundColor,
99
- border: `1px solid ${item.dataset.backgroundColor}`,
100
- }}
101
- />
102
- <Caption1>{item.dataset.label}:</Caption1>
103
- <Text>{item.raw}</Text>
104
- </Stack>
105
- ))}
106
- </Stack>
107
- </Card>
108
- </FluentProvider>
109
- </IdPrefixProvider>
110
- );
111
- }
@@ -1,186 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import * as React from 'react';
3
-
4
- import {
5
- Field,
6
- Menu,
7
- MenuButton,
8
- MenuItem,
9
- MenuItemRadio,
10
- MenuList,
11
- MenuPopover,
12
- MenuProps,
13
- MenuTrigger,
14
- Tooltip,
15
- } from '@fluentui/react-components';
16
-
17
- import { IButtonMenuOption } from './IButtonMenuOption';
18
- import { IButtonMenuProps } from './IButtonMenuProps';
19
-
20
- export const ButtonMenu: React.FunctionComponent<IButtonMenuProps> = (
21
- props: React.PropsWithChildren<IButtonMenuProps>
22
- ) => {
23
- const {
24
- onSelected,
25
- value,
26
- styles,
27
- options,
28
- apparence,
29
- shape,
30
- label,
31
- defaultButtonIcon = undefined,
32
- showItemLabel = true,
33
- showOnlyIcon = false,
34
- DefaultButtonLabel,
35
- as = 'Radiobutton',
36
- buttonTooltip = undefined,
37
- } = props;
38
- const iconSelectedRef = React.useRef<JSX.Element>();
39
-
40
- // State for selected option
41
- const [selectedOption, setSelectedOption] = React.useState<IButtonMenuOption>(
42
- value ?? options[0]
43
- );
44
-
45
- const [checkedValues, setCheckedValues] = React.useState<
46
- Record<string, string[]>
47
- >({
48
- option: [value ? value?.key : options?.[0]?.key],
49
- });
50
-
51
- const fieldRef = React.useRef<HTMLDivElement>(null);
52
-
53
- React.useEffect(() => {
54
- // Synchronize selectedOption with props
55
- if (value !== undefined) {
56
- setSelectedOption(value);
57
- setCheckedValues({ option: [value.key] });
58
- }
59
- iconSelectedRef.current = options.find(
60
- option => option.key === (value?.key ?? options[0]?.key)
61
- )?.icon;
62
- }, [value, options]);
63
-
64
- const [open, setOpen] = React.useState(false);
65
- const onOpenChange: MenuProps['onOpenChange'] = React.useCallback(
66
- (_e: any, data: { open: boolean | ((prevState: boolean) => boolean) }) => {
67
- setOpen(data.open);
68
- },
69
- []
70
- );
71
-
72
- const getOptionLabel = React.useCallback((option: IButtonMenuOption) => {
73
- return option?.text ?? '';
74
- }, []);
75
-
76
- const onCheckedValueChange: MenuProps['onCheckedValueChange'] = React.useCallback(
77
- (
78
- _e: unknown,
79
- { name, checkedItems }: { name: string; checkedItems: string[] }
80
- ) => {
81
- if (name === 'option') {
82
- const newOption = checkedItems[0];
83
- setSelectedOption(options.find(option => option.key === newOption)!);
84
- setCheckedValues({ option: checkedItems });
85
- iconSelectedRef.current = options.find(
86
- option => option.key === newOption
87
- )?.icon;
88
- onSelected(options.find(option => option.key === newOption)!);
89
- }
90
- },
91
- [options, onSelected]
92
- );
93
-
94
- const buttonLabel = React.useMemo(() => {
95
- if (showItemLabel) {
96
- return (
97
- getOptionLabel(selectedOption) ??
98
- DefaultButtonLabel ??
99
- 'No data available'
100
- );
101
- }
102
- return DefaultButtonLabel ?? 'Select an option';
103
- }, [selectedOption, showItemLabel, getOptionLabel, DefaultButtonLabel]);
104
-
105
- const RenderMenuButtonIcon = React.useCallback(() => {
106
- return (
107
- <Field label={label} style={styles} ref={fieldRef}>
108
- <Menu open={open} onOpenChange={onOpenChange}>
109
- <MenuTrigger disableButtonEnhancement>
110
- <MenuButton
111
- shape={shape ?? 'circular'}
112
- icon={showItemLabel ? iconSelectedRef.current : defaultButtonIcon}
113
- appearance={apparence ?? 'secondary'}
114
- >
115
- {showOnlyIcon ? '' : buttonLabel}
116
- </MenuButton>
117
- </MenuTrigger>
118
- <MenuPopover style={{ minWidth: 'fit-content' }}>
119
- <MenuList
120
- onCheckedValueChange={onCheckedValueChange}
121
- checkedValues={checkedValues}
122
- style={{ width: fieldRef.current?.offsetWidth }}
123
- >
124
- {options.map((option: IButtonMenuOption) =>
125
- as === 'Radiobutton' ? (
126
- <MenuItemRadio
127
- key={option.key}
128
- name="option"
129
- value={option.key}
130
- icon={option.icon}
131
- disabled={option.disabled}
132
- >
133
- {getOptionLabel(option)}
134
- </MenuItemRadio>
135
- ) : (
136
- <MenuItem
137
- key={option.key}
138
- onClick={() => {
139
- onSelected(option);
140
- setOpen(false);
141
- }}
142
- icon={option.icon}
143
- disabled={option.disabled}
144
- >
145
- {getOptionLabel(option)}
146
- </MenuItem>
147
- )
148
- )}
149
- </MenuList>
150
- </MenuPopover>
151
- </Menu>
152
- </Field>
153
- );
154
- }, [
155
- label,
156
- styles,
157
- open,
158
- onOpenChange,
159
- shape,
160
- showItemLabel,
161
- defaultButtonIcon,
162
- apparence,
163
- showOnlyIcon,
164
- buttonLabel,
165
- onCheckedValueChange,
166
- checkedValues,
167
- options,
168
- as,
169
- getOptionLabel,
170
- onSelected,
171
- ]);
172
-
173
- return (
174
- <>
175
- {buttonTooltip !== undefined ? (
176
- <Tooltip content={buttonTooltip} relationship="label">
177
- <div>
178
- <RenderMenuButtonIcon />
179
- </div>
180
- </Tooltip>
181
- ) : (
182
- <RenderMenuButtonIcon />
183
- )}
184
- </>
185
- );
186
- };
@@ -1,9 +0,0 @@
1
- export interface IButtonMenuOption {
2
- key: string;
3
- text: string;
4
- icon?: React.ReactElement;
5
- selected: boolean;
6
- disabled?: boolean;
7
- description?: string;
8
- color?: string;
9
- }
@@ -1,40 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { IButtonMenuOption } from "./IButtonMenuOption";
4
- import { Theme } from "@fluentui/react-components";
5
-
6
- /**
7
- * Props for the ButtonMenu component.
8
- *
9
- * @property onSelected - Callback invoked when an option is selected.
10
- * @property value - The currently selected option.
11
- * @property label - Optional label for the button menu.
12
- * @property styles - Custom CSS styles for the component.
13
- * @property theme - Theme object to style the component.
14
- * @property options - Array of selectable options for the menu.
15
- * @property apparence - Visual appearance of the button menu. Can be "primary", "subtle", "outline", or "transparent".
16
- * @property shape - Shape of the button. Can be "circular" or "square".
17
- * @property defaultButtonIcon - Icon to display on the default button.
18
- * @property showItemLabel - Whether to show the label for each item.
19
- * @property showOnlyIcon - Whether to display only the icon without the label.
20
- * @property DefaultButtonLabel - Label to display on the default button.
21
- * @property as - Determines the button type, either "Radiobutton" or "MenuButton".
22
- * @property buttonTooltip - Tooltip text for the button.
23
- */
24
-
25
- export interface IButtonMenuProps {
26
- onSelected: (option: IButtonMenuOption) => void;
27
- value?: IButtonMenuOption;
28
- label?: string;
29
- styles?: React.CSSProperties;
30
- theme?: Theme;
31
- options: IButtonMenuOption[];
32
- apparence?: "primary" | "subtle" | "outline" | "transparent";
33
- shape?: "circular" | "square";
34
- defaultButtonIcon?: JSX.Element;
35
- showItemLabel?: boolean;
36
- showOnlyIcon?: boolean;
37
- DefaultButtonLabel?: string;
38
- as?: "Radiobutton" | "MenuButton";
39
- buttonTooltip?: string;
40
- }