@spteck/fluentui-react-charts 1.0.6 → 1.0.8
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/charts/BarChart/BarChart.d.ts +2 -1
- package/dist/charts/ComboChart/ComboChart.d.ts +2 -1
- package/dist/charts/Doughnut/DoughnutChart.d.ts +2 -1
- package/dist/charts/PieChart/PieChart.d.ts +2 -1
- package/dist/charts/areaChart/AreaChart.d.ts +2 -1
- package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +2 -1
- package/dist/charts/bubbleChart/BubbleChart.d.ts +2 -1
- package/dist/charts/floatBarChart/FloatBarChart.d.ts +2 -1
- package/dist/charts/index.d.ts +14 -0
- package/dist/charts/lineChart/LineChart.d.ts +2 -1
- package/dist/charts/polarChart/PolarChart.d.ts +2 -1
- package/dist/charts/radarChart/RadarChart.d.ts +2 -1
- package/dist/charts/scatterChart/ScatterChart.d.ts +2 -1
- package/dist/charts/stackedLineChart/StackedLineChart.d.ts +2 -1
- package/dist/charts/steamChart/SteamChart.d.ts +2 -1
- package/dist/components/index.d.ts +0 -14
- package/dist/fluentui-react-charts.cjs.development.js +1367 -1066
- package/dist/fluentui-react-charts.cjs.development.js.map +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js +1 -1
- package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -1
- package/dist/fluentui-react-charts.esm.js +1353 -1066
- package/dist/fluentui-react-charts.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/assets/sample1.png +0 -0
- package/src/assets/sample2.png +0 -0
- package/src/assets/sample3.png +0 -0
- package/src/charts/BarChart/BarChart.tsx +0 -227
- package/src/charts/BarChart/README.MD +0 -335
- package/src/charts/BarChart/index.ts +0 -1
- package/src/charts/ComboChart/ComboChart.tsx +0 -209
- package/src/charts/ComboChart/README.MD +0 -347
- package/src/charts/ComboChart/index.ts +0 -1
- package/src/charts/Doughnut/DoughnutChart.tsx +0 -152
- package/src/charts/Doughnut/README.MD +0 -296
- package/src/charts/Doughnut/index.ts +0 -1
- package/src/charts/PieChart/PieChart.tsx +0 -148
- package/src/charts/PieChart/README.MD +0 -315
- package/src/charts/PieChart/index.ts +0 -1
- package/src/charts/areaChart/AreaChart.tsx +0 -195
- package/src/charts/areaChart/README.MD +0 -236
- package/src/charts/areaChart/index.ts +0 -1
- package/src/charts/barHorizontalChart/BarHotizontalChart.tsx +0 -200
- package/src/charts/barHorizontalChart/README.MD +0 -278
- package/src/charts/barHorizontalChart/index.ts +0 -2
- package/src/charts/bubbleChart/BubbleChart.tsx +0 -184
- package/src/charts/bubbleChart/README.MD +0 -275
- package/src/charts/bubbleChart/index.ts +0 -1
- package/src/charts/floatBarChart/FloatBarChart.tsx +0 -178
- package/src/charts/floatBarChart/README.MD +0 -354
- package/src/charts/floatBarChart/index.ts +0 -1
- package/src/charts/lineChart/LineChart.tsx +0 -200
- package/src/charts/lineChart/README.MD +0 -354
- package/src/charts/lineChart/index.ts +0 -1
- package/src/charts/polarChart/PolarChart.tsx +0 -161
- package/src/charts/polarChart/README.MD +0 -336
- package/src/charts/polarChart/index.ts +0 -1
- package/src/charts/radarChart/README.MD +0 -388
- package/src/charts/radarChart/RadarChart.tsx +0 -173
- package/src/charts/radarChart/index.ts +0 -1
- package/src/charts/scatterChart/README.MD +0 -335
- package/src/charts/scatterChart/ScatterChart.tsx +0 -155
- package/src/charts/scatterChart/index.ts +0 -1
- package/src/charts/stackedLineChart/README.MD +0 -396
- package/src/charts/stackedLineChart/StackedLineChart.tsx +0 -188
- package/src/charts/stackedLineChart/index.ts +0 -1
- package/src/charts/steamChart/README.MD +0 -414
- package/src/charts/steamChart/SteamChart.tsx +0 -236
- package/src/charts/steamChart/index.ts +0 -1
- package/src/components/RenderLabel/RenderLabel.tsx +0 -39
- package/src/components/RenderLabel/index.ts +0 -2
- package/src/components/RenderLabel/useRenderLabelStylesStyles.ts +0 -25
- package/src/components/RenderLegend/RenderLegend.tsx +0 -40
- package/src/components/RenderTooltip/RenderTooltip.tsx +0 -111
- package/src/components/buttonMenu/ButtonMenu.tsx +0 -186
- package/src/components/buttonMenu/IButtonMenuOption.ts +0 -9
- package/src/components/buttonMenu/IButtonMenuProps.tsx +0 -40
- package/src/components/dashboard/DashBoard.tsx +0 -314
- package/src/components/dashboard/ExampleDashboardUsage.tsx +0 -114
- package/src/components/dashboard/IDashboardProps.tsx +0 -11
- package/src/components/dashboard/NoDashboards.tsx +0 -26
- package/src/components/dashboard/index.ts +0 -3
- package/src/components/dashboard/selectZoom/SelectZoom.tsx +0 -189
- package/src/components/dashboard/useDashboardStyles.ts +0 -76
- package/src/components/index.ts +0 -17
- package/src/components/legendContainer/LegendContainer.tsx +0 -118
- package/src/components/legendeButton/LegendButton.tsx +0 -57
- package/src/components/renderSliceLegend/RenderSliceLegend.tsx +0 -46
- package/src/components/renderValueLegend/RenderValueLegend.tsx +0 -43
- package/src/components/stack/IStackProps.tsx +0 -94
- package/src/components/stack/Stack.tsx +0 -103
- package/src/components/svgImages/BusinessReportIcon.tsx +0 -218
- package/src/components/themeProvider/ThemeProvider.tsx +0 -48
- package/src/constants/Constants.tsx +0 -23
- package/src/graphGlobalStyles/useGraphGlobalStyles.ts +0 -28
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useChartFactory.tsx +0 -136
- package/src/hooks/useChartUtils.tsx +0 -187
- package/src/hooks/useIndexedDBCache.ts +0 -122
- package/src/hooks/useResponsiveLegend.ts +0 -35
- package/src/index.tsx +0 -5
- package/src/models/ChartDatum.ts +0 -4
- package/src/models/ICardChartContainer.tsx +0 -11
- package/src/models/IChart.ts +0 -50
- package/src/models/index.ts +0 -3
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/css';
|
|
2
|
-
import { tokens } from '@fluentui/react-components';
|
|
3
|
-
|
|
4
|
-
export const useDashboardStyles = (): {
|
|
5
|
-
dashboardContainer: string;
|
|
6
|
-
cardBody: string;
|
|
7
|
-
chartContainer: string;
|
|
8
|
-
cardDescription: string;
|
|
9
|
-
cardWrapper: string;
|
|
10
|
-
} => {
|
|
11
|
-
return {
|
|
12
|
-
dashboardContainer: css({
|
|
13
|
-
display: 'grid',
|
|
14
|
-
padding: '20px',
|
|
15
|
-
gap: '16px',
|
|
16
|
-
backgroundColor: tokens.colorNeutralBackground2,
|
|
17
|
-
gridTemplateColumns: 'repeat(auto-fill, minmax(350px, 1fr))',
|
|
18
|
-
gridAutoRows: '350px',
|
|
19
|
-
overflowY: 'auto',
|
|
20
|
-
overflowX: 'hidden',
|
|
21
|
-
|
|
22
|
-
// Scrollbar styles
|
|
23
|
-
'::-webkit-scrollbar': {
|
|
24
|
-
width: '5px', // Width for vertical scrollbars
|
|
25
|
-
height: '5px', // Height for horizontal scrollbars
|
|
26
|
-
},
|
|
27
|
-
'::-webkit-scrollbar-track': {
|
|
28
|
-
background: tokens.colorNeutralBackground4, // Light gray for the track
|
|
29
|
-
borderRadius: '10px',
|
|
30
|
-
},
|
|
31
|
-
'::-webkit-scrollbar-thumb': {
|
|
32
|
-
background: tokens.colorBrandStroke2Hover, // Dark gray for the thumb
|
|
33
|
-
borderRadius: '10px',
|
|
34
|
-
},
|
|
35
|
-
'::-webkit-scrollbar-thumb:hover': {
|
|
36
|
-
background: tokens.colorNeutralStroke2, // Dark gray for the thumb
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
justifyContent: 'center',
|
|
40
|
-
gridAutoFlow: 'dense',
|
|
41
|
-
}),
|
|
42
|
-
cardBody: css({
|
|
43
|
-
display: 'flex',
|
|
44
|
-
flexDirection: 'column',
|
|
45
|
-
height: '100%',
|
|
46
|
-
minHeight: '320px',
|
|
47
|
-
}),
|
|
48
|
-
chartContainer: css({
|
|
49
|
-
flex: 1,
|
|
50
|
-
width: '100%',
|
|
51
|
-
minHeight: '280px',
|
|
52
|
-
}),
|
|
53
|
-
cardDescription: css({
|
|
54
|
-
color: `${tokens.colorNeutralForeground2}`,
|
|
55
|
-
marginTop: '4px',
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
cardWrapper: css({
|
|
59
|
-
position: 'relative',
|
|
60
|
-
height: '100%',
|
|
61
|
-
minHeight: '300px',
|
|
62
|
-
borderRadius: tokens.borderRadiusMedium,
|
|
63
|
-
transition: 'all 0.2s ease',
|
|
64
|
-
|
|
65
|
-
'&:hover': {
|
|
66
|
-
transform: 'translateY(-2px)',
|
|
67
|
-
boxShadow: `${tokens.shadow16}`,
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
'&:active': {
|
|
71
|
-
transform: 'translateY(0)',
|
|
72
|
-
boxShadow: `${tokens.shadow8}`,
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
76
|
-
};
|
package/src/components/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from '../charts/BarChart';
|
|
2
|
-
export * from '../charts/ComboChart';
|
|
3
|
-
export * from './dashboard/DashBoard';
|
|
4
|
-
export * from '../charts/Doughnut';
|
|
5
|
-
export * from '../charts/PieChart';
|
|
6
|
-
export * from '../charts/areaChart';
|
|
7
|
-
export * from '../charts/barHorizontalChart';
|
|
8
|
-
export * from '../charts/bubbleChart';
|
|
9
|
-
export * from '../charts/floatBarChart';
|
|
10
|
-
export * from '../charts/lineChart';
|
|
11
|
-
export * from '../charts/polarChart';
|
|
12
|
-
export * from '../charts/radarChart';
|
|
13
|
-
export * from '../charts/scatterChart';
|
|
14
|
-
export * from '../charts/stackedLineChart';
|
|
15
|
-
export * from '../charts/steamChart';
|
|
16
|
-
|
|
17
|
-
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Menu,
|
|
3
|
-
MenuButton,
|
|
4
|
-
MenuItem,
|
|
5
|
-
MenuList,
|
|
6
|
-
MenuPopover,
|
|
7
|
-
MenuTrigger,
|
|
8
|
-
} from '@fluentui/react-components';
|
|
9
|
-
|
|
10
|
-
import { LegendButton } from '../legendeButton/LegendButton';
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import Stack from '../stack/Stack';
|
|
13
|
-
import { css } from '@emotion/css';
|
|
14
|
-
|
|
15
|
-
interface LegendContainerProps<T> {
|
|
16
|
-
items: T[];
|
|
17
|
-
visibleLabels: string[];
|
|
18
|
-
toggleLabel: (label: string) => void;
|
|
19
|
-
renderLabel: (item: T) => string;
|
|
20
|
-
getColor: (item: T) => string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const styles = {
|
|
24
|
-
wrapper: css({
|
|
25
|
-
display: 'flex',
|
|
26
|
-
flexWrap: 'nowrap',
|
|
27
|
-
overflow: 'hidden',
|
|
28
|
-
justifyContent: 'center',
|
|
29
|
-
gap: 10,
|
|
30
|
-
padding: 2,
|
|
31
|
-
width: '100%',
|
|
32
|
-
boxSizing: 'border-box',
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export function LegendContainer<T extends { label: string }>(
|
|
37
|
-
props: LegendContainerProps<T> & {
|
|
38
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
39
|
-
|
|
40
|
-
visibleItems: T[];
|
|
41
|
-
overflowItems: T[];
|
|
42
|
-
}
|
|
43
|
-
) {
|
|
44
|
-
const {
|
|
45
|
-
containerRef,
|
|
46
|
-
|
|
47
|
-
visibleItems,
|
|
48
|
-
overflowItems,
|
|
49
|
-
visibleLabels,
|
|
50
|
-
toggleLabel,
|
|
51
|
-
renderLabel,
|
|
52
|
-
getColor,
|
|
53
|
-
} = props;
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<Stack
|
|
57
|
-
justifyContent="center"
|
|
58
|
-
alignItems="center"
|
|
59
|
-
marginLeft="10px"
|
|
60
|
-
marginRight="10px"
|
|
61
|
-
marginTop="25px"
|
|
62
|
-
marginBottom="20px"
|
|
63
|
-
>
|
|
64
|
-
<div ref={containerRef} className={styles.wrapper}>
|
|
65
|
-
{visibleItems.map(item => {
|
|
66
|
-
const label = item.label;
|
|
67
|
-
const isVisible =
|
|
68
|
-
visibleLabels.length === 0 || visibleLabels.includes(label);
|
|
69
|
-
return (
|
|
70
|
-
|
|
71
|
-
<LegendButton
|
|
72
|
-
key={label}
|
|
73
|
-
label={renderLabel(item)}
|
|
74
|
-
color={getColor(item)}
|
|
75
|
-
isVisible={isVisible}
|
|
76
|
-
onClick={() => toggleLabel(label)}
|
|
77
|
-
|
|
78
|
-
/>
|
|
79
|
-
|
|
80
|
-
);
|
|
81
|
-
})}
|
|
82
|
-
|
|
83
|
-
{overflowItems.length > 0 && (
|
|
84
|
-
<Menu>
|
|
85
|
-
<MenuTrigger disableButtonEnhancement>
|
|
86
|
-
<MenuButton size="small" appearance="transparent">
|
|
87
|
-
+{overflowItems.length}
|
|
88
|
-
</MenuButton>
|
|
89
|
-
</MenuTrigger>
|
|
90
|
-
<MenuPopover style={{ minWidth: 'fit-content', maxWidth: '200px' }}>
|
|
91
|
-
<MenuList>
|
|
92
|
-
{overflowItems.map(item => {
|
|
93
|
-
const label = item.label;
|
|
94
|
-
const isVisible =
|
|
95
|
-
visibleLabels.length === 0 || visibleLabels.includes(label);
|
|
96
|
-
return (
|
|
97
|
-
<MenuItem key={label} style={{ padding: 0 }}>
|
|
98
|
-
|
|
99
|
-
<LegendButton
|
|
100
|
-
label={renderLabel(item)}
|
|
101
|
-
color={getColor(item)}
|
|
102
|
-
isVisible={isVisible}
|
|
103
|
-
onClick={() => toggleLabel(label)}
|
|
104
|
-
style={{ width: '100px', textAlign: 'left' }}
|
|
105
|
-
/>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</MenuItem>
|
|
109
|
-
);
|
|
110
|
-
})}
|
|
111
|
-
</MenuList>
|
|
112
|
-
</MenuPopover>
|
|
113
|
-
</Menu>
|
|
114
|
-
)}
|
|
115
|
-
</div>
|
|
116
|
-
</Stack>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// LegendButton.tsx
|
|
2
|
-
import { Button, Caption1, Tooltip, tokens } from '@fluentui/react-components';
|
|
3
|
-
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
interface LegendButtonProps {
|
|
7
|
-
label: string;
|
|
8
|
-
isVisible: boolean;
|
|
9
|
-
color: string;
|
|
10
|
-
onClick: () => void;
|
|
11
|
-
style?: React.CSSProperties;
|
|
12
|
-
buttonRef?: React.Ref<HTMLButtonElement>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const LegendButton: React.FC<LegendButtonProps> = ({
|
|
16
|
-
label,
|
|
17
|
-
isVisible,
|
|
18
|
-
color,
|
|
19
|
-
onClick,
|
|
20
|
-
style = {},
|
|
21
|
-
buttonRef,
|
|
22
|
-
}) => {
|
|
23
|
-
return (
|
|
24
|
-
<Tooltip content={label} relationship="label">
|
|
25
|
-
<Button
|
|
26
|
-
ref={buttonRef}
|
|
27
|
-
shape="circular"
|
|
28
|
-
size="small"
|
|
29
|
-
appearance={isVisible ? 'primary' : 'outline'}
|
|
30
|
-
onClick={onClick}
|
|
31
|
-
style={{
|
|
32
|
-
backgroundColor: isVisible ? color : 'transparent',
|
|
33
|
-
color: isVisible ? '#fff' : tokens.colorNeutralForeground1,
|
|
34
|
-
borderColor: color,
|
|
35
|
-
borderWidth: 1,
|
|
36
|
-
width: '100px',
|
|
37
|
-
padding: '4px 8px',
|
|
38
|
-
textAlign: 'center',
|
|
39
|
-
...style,
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<Caption1
|
|
43
|
-
as="span"
|
|
44
|
-
style={{
|
|
45
|
-
display: 'block',
|
|
46
|
-
overflow: 'hidden',
|
|
47
|
-
textOverflow: 'ellipsis',
|
|
48
|
-
whiteSpace: 'nowrap',
|
|
49
|
-
lineHeight: '1.25',
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{label}
|
|
53
|
-
</Caption1>
|
|
54
|
-
</Button>
|
|
55
|
-
</Tooltip>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LegendContainer } from '../legendContainer/LegendContainer';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useResponsiveLegend } from '../../hooks/useResponsiveLegend';
|
|
4
|
-
|
|
5
|
-
export interface SliceLegendProps {
|
|
6
|
-
labels: string[];
|
|
7
|
-
colors: string[];
|
|
8
|
-
visibleLabels: string[];
|
|
9
|
-
toggleLabel: (label: string) => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const RenderSliceLegend: React.FC<SliceLegendProps> = ({
|
|
13
|
-
labels,
|
|
14
|
-
colors,
|
|
15
|
-
visibleLabels,
|
|
16
|
-
toggleLabel,
|
|
17
|
-
}) => {
|
|
18
|
-
interface SliceLegendItem {
|
|
19
|
-
label: string;
|
|
20
|
-
color: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const items: SliceLegendItem[] = labels.map((label, i) => ({ label, color: colors[i] }));
|
|
24
|
-
const {
|
|
25
|
-
containerRef,
|
|
26
|
-
|
|
27
|
-
visibleItems,
|
|
28
|
-
overflowItems,
|
|
29
|
-
} = useResponsiveLegend(items);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<LegendContainer
|
|
33
|
-
containerRef={containerRef}
|
|
34
|
-
|
|
35
|
-
visibleItems={visibleItems}
|
|
36
|
-
overflowItems={overflowItems}
|
|
37
|
-
items={items}
|
|
38
|
-
visibleLabels={visibleLabels}
|
|
39
|
-
toggleLabel={toggleLabel}
|
|
40
|
-
renderLabel={item => item.label}
|
|
41
|
-
getColor={item => item.color}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default RenderSliceLegend;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { LegendContainer } from '../legendContainer/LegendContainer';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useResponsiveLegend } from '../../hooks/useResponsiveLegend';
|
|
4
|
-
|
|
5
|
-
export interface LegendEntry {
|
|
6
|
-
label: string;
|
|
7
|
-
value: number;
|
|
8
|
-
color: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ValueLegendProps {
|
|
12
|
-
entries: LegendEntry[];
|
|
13
|
-
visibleLabels: string[];
|
|
14
|
-
toggleLabel: (label: string) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const RenderValueLegend: React.FC<ValueLegendProps> = ({
|
|
18
|
-
entries,
|
|
19
|
-
visibleLabels,
|
|
20
|
-
toggleLabel,
|
|
21
|
-
}) => {
|
|
22
|
-
const {
|
|
23
|
-
containerRef,
|
|
24
|
-
|
|
25
|
-
visibleItems,
|
|
26
|
-
overflowItems,
|
|
27
|
-
} = useResponsiveLegend(entries);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<LegendContainer
|
|
31
|
-
containerRef={containerRef}
|
|
32
|
-
visibleItems={visibleItems}
|
|
33
|
-
overflowItems={overflowItems}
|
|
34
|
-
items={entries}
|
|
35
|
-
visibleLabels={visibleLabels}
|
|
36
|
-
toggleLabel={toggleLabel}
|
|
37
|
-
renderLabel={entry => `${entry.label}: ${entry.value}`}
|
|
38
|
-
getColor={entry => entry.color}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default RenderValueLegend;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* StackProps interface defines the properties for the Stack component.
|
|
5
|
-
*/
|
|
6
|
-
export interface IStackProps {
|
|
7
|
-
/**
|
|
8
|
-
* Direction of stacking: horizontal (row) or vertical (column).
|
|
9
|
-
*/
|
|
10
|
-
direction?: "horizontal" | "vertical";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Flexbox justify-content property.
|
|
14
|
-
*/
|
|
15
|
-
justifyContent?: React.CSSProperties["justifyContent"];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Flexbox align-items property.
|
|
19
|
-
*/
|
|
20
|
-
alignItems?: React.CSSProperties["alignItems"];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Gap between items (can be predefined or custom value like '20px').
|
|
24
|
-
*/
|
|
25
|
-
gap?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Column gap between items (custom value or predefined).
|
|
29
|
-
*/
|
|
30
|
-
columnGap?: string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Row gap between items (custom value or predefined).
|
|
34
|
-
*/
|
|
35
|
-
rowGap?: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Predefined margin sizes (shorthand) or custom value.
|
|
39
|
-
*/
|
|
40
|
-
margin?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Predefined padding sizes (shorthand) or custom value.
|
|
44
|
-
*/
|
|
45
|
-
padding?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Individual margin properties (predefined or custom value).
|
|
49
|
-
*/
|
|
50
|
-
marginTop?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
51
|
-
marginBottom?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
52
|
-
marginLeft?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
53
|
-
marginRight?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Individual padding properties (predefined or custom value).
|
|
57
|
-
*/
|
|
58
|
-
paddingTop?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
59
|
-
paddingBottom?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
60
|
-
paddingLeft?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
61
|
-
paddingRight?: "xs" | "s" | "m" | "l" | "xl" | "xxl" | string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Width of the stack.
|
|
65
|
-
*/
|
|
66
|
-
width?: React.CSSProperties["width"];
|
|
67
|
-
|
|
68
|
-
/* Height of the stack. */
|
|
69
|
-
height?: React.CSSProperties["height"];
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Enable or disable wrapping of items.
|
|
73
|
-
*/
|
|
74
|
-
wrap?: boolean;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Child components to be rendered inside the stack.
|
|
78
|
-
*/
|
|
79
|
-
children: React.ReactNode;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Additional inline styles.
|
|
83
|
-
*/
|
|
84
|
-
style?: React.CSSProperties;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Additional class names for the stack.
|
|
88
|
-
*/
|
|
89
|
-
className?: string;
|
|
90
|
-
/* Overflow property */
|
|
91
|
-
overflow?: React.CSSProperties["overflow"];
|
|
92
|
-
/** background Color */
|
|
93
|
-
background?: React.CSSProperties["backgroundColor"];
|
|
94
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { mergeClasses, tokens } from "@fluentui/react-components";
|
|
2
|
-
|
|
3
|
-
import { IStackProps } from "./IStackProps";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { css } from "@emotion/css";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Mapping of predefined sizes to Fluent UI tokens.
|
|
9
|
-
*/
|
|
10
|
-
const sizeMap: Record<string, string> = {
|
|
11
|
-
xs: tokens.spacingHorizontalXS,
|
|
12
|
-
s: tokens.spacingHorizontalS,
|
|
13
|
-
m: tokens.spacingHorizontalM,
|
|
14
|
-
l: tokens.spacingHorizontalL,
|
|
15
|
-
xl: tokens.spacingHorizontalXL,
|
|
16
|
-
xxl: tokens.spacingHorizontalXXL,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Stack component provides a flexible layout using Flexbox.
|
|
21
|
-
* It allows stacking child components either horizontally or vertically with predefined spacing options.
|
|
22
|
-
*/
|
|
23
|
-
export const Stack: React.FC<IStackProps> = React.memo(
|
|
24
|
-
({
|
|
25
|
-
direction = "vertical",
|
|
26
|
-
justifyContent = "flex-start",
|
|
27
|
-
alignItems = "stretch",
|
|
28
|
-
gap,
|
|
29
|
-
columnGap,
|
|
30
|
-
rowGap,
|
|
31
|
-
margin,
|
|
32
|
-
padding,
|
|
33
|
-
marginTop,
|
|
34
|
-
marginBottom,
|
|
35
|
-
marginLeft,
|
|
36
|
-
marginRight,
|
|
37
|
-
paddingTop,
|
|
38
|
-
paddingBottom,
|
|
39
|
-
paddingLeft,
|
|
40
|
-
paddingRight,
|
|
41
|
-
width,
|
|
42
|
-
height,
|
|
43
|
-
wrap = false,
|
|
44
|
-
children,
|
|
45
|
-
style,
|
|
46
|
-
className,
|
|
47
|
-
overflow,
|
|
48
|
-
background
|
|
49
|
-
}) => {
|
|
50
|
-
const stackStyle = css({
|
|
51
|
-
display: "flex",
|
|
52
|
-
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
53
|
-
justifyContent,
|
|
54
|
-
alignItems,
|
|
55
|
-
gap: gap && sizeMap[gap] ? sizeMap[gap] : gap,
|
|
56
|
-
columnGap:
|
|
57
|
-
columnGap && sizeMap[columnGap] ? sizeMap[columnGap] : columnGap,
|
|
58
|
-
rowGap: rowGap && sizeMap[rowGap] ? sizeMap[rowGap] : rowGap,
|
|
59
|
-
margin: margin && sizeMap[margin] ? sizeMap[margin] : margin,
|
|
60
|
-
padding: padding && sizeMap[padding] ? sizeMap[padding] : padding,
|
|
61
|
-
marginTop:
|
|
62
|
-
marginTop && sizeMap[marginTop] ? sizeMap[marginTop] : marginTop,
|
|
63
|
-
marginBottom:
|
|
64
|
-
marginBottom && sizeMap[marginBottom]
|
|
65
|
-
? sizeMap[marginBottom]
|
|
66
|
-
: marginBottom,
|
|
67
|
-
marginLeft:
|
|
68
|
-
marginLeft && sizeMap[marginLeft] ? sizeMap[marginLeft] : marginLeft,
|
|
69
|
-
marginRight:
|
|
70
|
-
marginRight && sizeMap[marginRight]
|
|
71
|
-
? sizeMap[marginRight]
|
|
72
|
-
: marginRight,
|
|
73
|
-
paddingTop:
|
|
74
|
-
paddingTop && sizeMap[paddingTop] ? sizeMap[paddingTop] : paddingTop,
|
|
75
|
-
paddingBottom:
|
|
76
|
-
paddingBottom && sizeMap[paddingBottom]
|
|
77
|
-
? sizeMap[paddingBottom]
|
|
78
|
-
: paddingBottom,
|
|
79
|
-
paddingLeft:
|
|
80
|
-
paddingLeft && sizeMap[paddingLeft]
|
|
81
|
-
? sizeMap[paddingLeft]
|
|
82
|
-
: paddingLeft,
|
|
83
|
-
paddingRight:
|
|
84
|
-
paddingRight && sizeMap[paddingRight]
|
|
85
|
-
? sizeMap[paddingRight]
|
|
86
|
-
: paddingRight,
|
|
87
|
-
width,
|
|
88
|
-
height,
|
|
89
|
-
overflow,
|
|
90
|
-
flexWrap: wrap ? "wrap" : "nowrap",
|
|
91
|
-
backgroundColor: background,
|
|
92
|
-
...style,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<div className={mergeClasses(className, stackStyle)}>{children}</div>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
Stack.displayName = "Stack";
|
|
102
|
-
|
|
103
|
-
export default Stack;
|