Skip to content

Commit

Permalink
Merge branch 'master' into motion/persist-feature-gate
Browse files Browse the repository at this point in the history
  • Loading branch information
spmonahan authored Dec 19, 2024
2 parents 3232e29 + 6b77512 commit 1e8d444
Show file tree
Hide file tree
Showing 22 changed files with 250 additions and 111 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Ensure type safety of dependent fields",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> =
<LineChart
{...transformPlotlyJsonToScatterChartProps({ data, layout }, false, colorMap, isDarkTheme)}
legendProps={{
...legendProps,
onChange: onActiveLegendsChange,
canSelectMultipleLegends: true,
selectedLegends: activeLegends,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ export const transformPlotlyJsonToDonutProps = (
};
});

const width: number = layout?.width || 440;
const height: number = layout?.height || 220;
const hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;
const donutMarginHorizontal = hideLabels ? 0 : 80;
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
const width: number = typeof layout?.width === 'number' ? layout?.width : 440;
const height: number = typeof layout?.height === 'number' ? layout?.height : 220;
const hideLabels: boolean = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;
const donutMarginHorizontal: number = hideLabels ? 0 : 80;
const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);
const innerRadius: number = firstData.hole
? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
: 0;

const styles: IDonutChartProps['styles'] = {
root: {
'[class^="arcLabel"]': {
fontSize: firstData.textfont?.size,
...(typeof firstData.textfont?.size === 'number' ? { fontSize: firstData.textfont.size } : {}),
},
},
};
Expand Down Expand Up @@ -222,8 +222,8 @@ export const transformPlotlyJsonToVBCProps = (
const totalDataPoints = d3Merge(buckets).length;

buckets.forEach(bucket => {
const legend = series.name || `Series ${index + 1}`;
const color = getColor(legend, colorMap, isDarkTheme);
const legend: string = series.name || `Series ${index + 1}`;
const color: string = getColor(legend, colorMap, isDarkTheme);
let y = bucket.length;

if (series.histnorm === 'percent') {
Expand Down Expand Up @@ -256,7 +256,7 @@ export const transformPlotlyJsonToVBCProps = (

return {
data: vbcData,
chartTitle: layout?.title,
chartTitle: typeof layout?.title === 'string' ? layout?.title : '',
// width: layout?.width,
// height: layout?.height,
hideLegend: true,
Expand All @@ -278,7 +278,7 @@ export const transformPlotlyJsonToScatterChartProps = (
const isString = typeof xValues[0] === 'string';
const isXDate = isDateArray(xValues);
const isXNumber = isNumberArray(xValues);
const legend = series.name || `Series ${index + 1}`;
const legend: string = series.name || `Series ${index + 1}`;
const lineColor = getColor(legend, colorMap, isDarkTheme);

return {
Expand All @@ -292,7 +292,7 @@ export const transformPlotlyJsonToScatterChartProps = (
});

const chartProps: IChartProps = {
chartTitle: layout.title || '',
chartTitle: typeof layout.title === 'string' ? layout.title : '',
lineChartData: chartData,
};

Expand Down Expand Up @@ -330,24 +330,24 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (
})
.flat();

const chartHeight = layout.height || 450;
const margin = layout.margin?.l || 0;
const padding = layout.margin?.pad || 0;
const availableHeight = chartHeight - margin - padding;
const chartHeight: number = typeof layout.height === 'number' ? layout.height : 450;
const margin: number = typeof layout.margin?.l === 'number' ? layout.margin?.l : 0;
const padding: number = typeof layout.margin?.pad === 'number' ? layout.margin?.pad : 0;
const availableHeight: number = chartHeight - margin - padding;
const numberOfBars = data[0].y.length;
const scalingFactor = 0.01;
const gapFactor = 1 / (1 + scalingFactor * numberOfBars);
const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));

return {
data: chartData,
chartTitle: layout.title || '',
chartTitle: typeof layout.title === 'string' ? layout.title : '',
barHeight,
showYAxisLables: true,
styles: {
root: {
height: chartHeight,
width: layout.width || 600,
width: typeof layout.width === 'number' ? layout.width : 600,
},
},
};
Expand Down Expand Up @@ -375,7 +375,7 @@ export const transformPlotlyJsonToHeatmapProps = (jsonObj: any): IHeatMapChartPr
});
});
const heatmapData: IHeatMapChartData = {
legend: firstData.name || '',
legend: typeof firstData.name === 'string' ? firstData.name : '',
data: heatmapDataPoints,
value: 0,
};
Expand Down Expand Up @@ -429,17 +429,17 @@ export const transformPlotlyJsonToSankeyProps = (
}),
};

const width: number = layout?.width || 440;
const height: number = layout?.height || 220;
const width: number = typeof layout?.width === 'number' ? layout?.width : 440;
const height: number = typeof layout?.height === 'number' ? layout?.height : 220;
const styles: ISankeyChartProps['styles'] = {
root: {
fontSize: layout.font?.size,
...(typeof layout.font?.size === 'number' ? { fontSize: layout.font?.size } : {}),
},
};
const shouldResize: number = width + height;
return {
data: {
chartTitle: layout?.title,
chartTitle: typeof layout?.title === 'string' ? layout?.title : '',
SankeyChartData: sankeyChartData,
},
width,
Expand Down Expand Up @@ -491,15 +491,15 @@ export const transformPlotlyJsonToGaugeProps = (

return {
segments,
chartValue: firstData.value,
chartTitle: firstData.title?.text,
chartValue: typeof firstData.value === 'number' ? firstData.value : 0,
chartTitle: typeof firstData.title?.text === 'string' ? firstData.title?.text : '',
sublabel,
// range values can be null
minValue: firstData.gauge?.axis?.range?.[0] ?? undefined,
maxValue: firstData.gauge?.axis?.range?.[1] ?? undefined,
minValue: typeof firstData.gauge?.axis?.range?.[0] === 'number' ? firstData.gauge?.axis?.range?.[0] : undefined,
maxValue: typeof firstData.gauge?.axis?.range?.[1] === 'number' ? firstData.gauge?.axis?.range?.[1] : undefined,
chartValueFormat: () => firstData.value,
width: layout?.width,
height: layout?.height,
width: typeof layout?.width === 'number' ? layout?.width : 0,
height: typeof layout?.height === 'number' ? layout?.height : 0,
hideLegend: true,
styles,
};
Expand Down
15 changes: 15 additions & 0 deletions packages/react-components/react-components/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@fluentui/react-components",
"entries": [
{
"date": "Thu, 19 Dec 2024 14:30:56 GMT",
"tag": "@fluentui/react-components_v9.56.8",
"version": "9.56.8",
"comments": {
"patch": [
{
"author": "[email protected]",
"package": "@fluentui/react-message-bar",
"commit": "f2523077e9c92fc7f065308efe2081fc86846b5b",
"comment": "fix: MessageBar auto reflow should handle document reflow with `min-content`"
}
]
}
},
{
"date": "Wed, 18 Dec 2024 10:59:36 GMT",
"tag": "@fluentui/react-components_v9.56.7",
Expand Down
12 changes: 11 additions & 1 deletion packages/react-components/react-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Change Log - @fluentui/react-components

This log was last generated on Wed, 18 Dec 2024 10:59:36 GMT and should not be manually modified.
This log was last generated on Thu, 19 Dec 2024 14:30:56 GMT and should not be manually modified.

<!-- Start content -->

## [9.56.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-components_v9.56.8)

Thu, 19 Dec 2024 14:30:56 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-components_v9.56.7..@fluentui/react-components_v9.56.8)

### Patches

- `@fluentui/react-message-bar`
- fix: MessageBar auto reflow should handle document reflow with `min-content` ([PR #33409](https://github.com/microsoft/fluentui/pull/33409) by [email protected])

## [9.56.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-components_v9.56.7)

Wed, 18 Dec 2024 10:59:36 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/react-components/react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluentui/react-components",
"version": "9.56.7",
"version": "9.56.8",
"description": "Suite package for converged React components",
"main": "lib-commonjs/index.js",
"module": "lib/index.js",
Expand Down Expand Up @@ -66,7 +66,7 @@
"@fluentui/react-tree": "^9.8.11",
"@griffel/react": "^1.5.22",
"@swc/helpers": "^0.5.1",
"@fluentui/react-message-bar": "^9.2.18",
"@fluentui/react-message-bar": "^9.2.19",
"@fluentui/react-breadcrumb": "^9.0.47",
"@fluentui/react-aria": "^9.13.12",
"@fluentui/react-rating": "^9.0.26",
Expand Down
15 changes: 15 additions & 0 deletions packages/react-components/react-message-bar/library/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@fluentui/react-message-bar",
"entries": [
{
"date": "Thu, 19 Dec 2024 14:30:56 GMT",
"tag": "@fluentui/react-message-bar_v9.2.19",
"version": "9.2.19",
"comments": {
"patch": [
{
"author": "[email protected]",
"package": "@fluentui/react-message-bar",
"commit": "f2523077e9c92fc7f065308efe2081fc86846b5b",
"comment": "fix: MessageBar auto reflow should handle document reflow with `min-content`"
}
]
}
},
{
"date": "Mon, 16 Dec 2024 16:26:49 GMT",
"tag": "@fluentui/react-message-bar_v9.2.18",
Expand Down
11 changes: 10 additions & 1 deletion packages/react-components/react-message-bar/library/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Change Log - @fluentui/react-message-bar

This log was last generated on Mon, 16 Dec 2024 16:26:49 GMT and should not be manually modified.
This log was last generated on Thu, 19 Dec 2024 14:30:56 GMT and should not be manually modified.

<!-- Start content -->

## [9.2.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.2.19)

Thu, 19 Dec 2024 14:30:56 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-message-bar_v9.2.18..@fluentui/react-message-bar_v9.2.19)

### Patches

- fix: MessageBar auto reflow should handle document reflow with `min-content` ([PR #33409](https://github.com/microsoft/fluentui/pull/33409) by [email protected])

## [9.2.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-message-bar_v9.2.18)

Mon, 16 Dec 2024 16:26:49 GMT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluentui/react-message-bar",
"version": "9.2.18",
"version": "9.2.19",
"description": "Fluent UI MessageBar component",
"main": "lib-commonjs/index.js",
"module": "lib/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ describe('MessageBar', () => {
// do nothing
}
};

// @ts-expect-error https://github.com/jsdom/jsdom/issues/2032
global.IntersectionObserver = class IntersectionObserver {
public observe() {
// do nothing
}
public disconnect() {
// do nothing
}
};
});

beforeEach(() => {
Expand Down
Loading

0 comments on commit 1e8d444

Please sign in to comment.