Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,101 changes: 3,738 additions & 2,363 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@statisticsfinland/pxvisualizer",
"version": "1.3.1",
"version": "1.3.2",
"description": "Component library for visualizing PxGraf data",
"main": "./dist/pxv.cjs",
"jestSonar": {
Expand Down Expand Up @@ -46,30 +46,30 @@
"author": "Statistics Finland",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.26.7",
"@storybook/addon-a11y": "^8.5.3",
"@storybook/addon-actions": "^8.1.3",
"@storybook/addon-essentials": "^8.5.3",
"@storybook/addon-interactions": "^8.5.3",
"@storybook/addon-links": "^8.5.3",
"@babel/core": "^7.28.4",
"@storybook/addon-a11y": "^8.6.14",
"@storybook/addon-actions": "^8.6.14",
"@storybook/addon-essentials": "^8.6.14",
"@storybook/addon-interactions": "^8.6.14",
"@storybook/addon-links": "^8.6.14",
"@storybook/addon-webpack5-compiler-swc": "^3.0.0",
"@storybook/blocks": "^8.1.3",
"@storybook/react": "^8.1.3",
"@storybook/react-webpack5": "^8.5.3",
"@storybook/test": "^8.1.3",
"@storybook/blocks": "^8.6.14",
"@storybook/react": "^8.6.14",
"@storybook/react-webpack5": "^8.6.14",
"@storybook/test": "^8.6.14",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.3.0",
"@types/file-saver": "^2.0.7",
"@types/jest": "^29.5.14",
"@types/jest": "^30.0.0",
"@types/papaparse": "^5.3.15",
"@types/react": "^19.1.0",
"@types/styled-components": "^5.1.34",
"@types/uuid": "^10.0.0",
"babel-loader": "^10.0.0",
"clean-publish": "^5.1.0",
"decimal.js": "^10.5.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest": "^30.2.0",
"jest-environment-jsdom": "^30.2.0",
"jest-junit": "^16.0.0",
"jest-sonar-reporter": "^2.0.0",
"jest-styled-components": "^7.2.0",
Expand All @@ -78,12 +78,12 @@
"react": "^19.1.0",
"react-dom": "^19.1.0",
"semver": "^7.7.0",
"storybook": "^8.5.3",
"storybook": "^8.6.14",
"styled-components": "^6.1.17",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.8.3",
"uuid": "^11.0.5"
"uuid": "^13.0.0"
},
"dependencies": {
"decimal.js": "^10.5.0",
Expand Down
9 changes: 4 additions & 5 deletions src/core/conversion/viewUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import {
import { SELECTABLE_TABLE_WITH_MISSING_DATA } from './fixtures/tableChart';
import { ASCENDING, DESCENDING, SUM, REVERSED, NO_SORTING } from './viewSorting';
import { buildSeries, convertPxGrafResponseToView, convertToRelative } from './viewUtils';
import { v4 as uuidV4 } from 'uuid'

const createContentComponent = (overrides?: Partial<IContentComponent>) => {
const id = uuidV4();
const id = Math.random().toString(36).substring(2, 15);
const defaultContentComponent = {
unit: { fi: `test-unit-${id}` },
source: { fi: `test-source-${id}` },
Expand All @@ -31,7 +30,7 @@ const createContentComponent = (overrides?: Partial<IContentComponent>) => {
};

const createVariableValue = (overrides?: Partial<IVariableValueMeta>) => {
const id = uuidV4();
const id = Math.random().toString(36).substring(2, 15);
const defaultValueMeta = {
name: { fi: `test-variable-value-name-${id}` },
code: `test-variable-value-code-${id}`,
Expand All @@ -46,7 +45,7 @@ const createVariableValue = (overrides?: Partial<IVariableValueMeta>) => {
};

const createVariable = (overrides?: Partial<IVariableMeta>): IVariableMeta => {
const id = uuidV4();
const id = Math.random().toString(36).substring(2, 15);
const defaultVariableMeta: IVariableMeta = {
code: `test-variable-code-${id}`,
name: { fi: `test-variable-name-${id}` },
Expand All @@ -59,7 +58,7 @@ const createVariable = (overrides?: Partial<IVariableMeta>): IVariableMeta => {
};

const createPxGrafResponse = (overrides?: Partial<IQueryVisualizationResponse>): IQueryVisualizationResponse => {
const id = uuidV4();
const id = Math.random().toString(36).substring(2, 15);
const defaultMetaData: IQueryVisualizationResponse = {
tableReference: { name: `test-table-reference-${id}`, hierarchy: [] },
data: [],
Expand Down
2 changes: 1 addition & 1 deletion src/core/highcharts/drawChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const drawChart = (
{
loadHighchartsModules();
const validLocale = formatLocale(locale);
Highcharts.setOptions(defaultTheme(validLocale));
Highcharts.setOptions(defaultTheme(validLocale, options?.fontFamily));
const variableSelections = extractSelectableVariableValues(pxGraphData.selectableVariableCodes, pxGraphData.metaData, pxGraphData.visualizationSettings.defaultSelectableVariableCodes, selectedVariableCodes);
const view = convertPxGrafResponseToView(pxGraphData, variableSelections);
const highChartOptions = convertPxGraphDataToChartOptions(validLocale, view, options);
Expand Down
15 changes: 12 additions & 3 deletions src/core/highcharts/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getAxisLabelFormatterFunction } from "../chartOptions/Utility/formatter
import { Translations, ArrayTranslations } from "../conversion/translations";
import { defaultColors } from "./defaultColors";

export const defaultTheme: (locale: string) => Highcharts.Options = (locale) => ({
export const defaultTheme: (locale: string, fontFamily?: string) => Highcharts.Options = (locale, fontFamily) => ({
accessibility: {
keyboardNavigation: {
seriesNavigation: {
Expand All @@ -27,7 +27,16 @@ export const defaultTheme: (locale: string) => Highcharts.Options = (locale) =>
exporting: {
enabled: false,
fallbackToExportServer: false,
allowHTML: true,
allowHTML: false,
chartOptions: {
// Setting fontFamily prevents Highcharts 12.4+ from inlining web fonts in SVG exports,
// which was causing extremely large file sizes (1000x larger than before)
chart: {
style: {
fontFamily: fontFamily || '"Barlow Semi Condensed", Verdana, sans-serif'
} as any // Type assertion to work around Highcharts typing limitation
}
}
},
lang: {
accessibility: {
Expand Down Expand Up @@ -106,7 +115,7 @@ export const defaultTheme: (locale: string) => Highcharts.Options = (locale) =>
colors: defaultColors, // chart series default colors
chart: {
style: {
fontFamily: '"Barlow Semi Condensed", Verdana, sans-serif'
fontFamily: fontFamily ?? '"Barlow Semi Condensed", Verdana, sans-serif'
},
spacingBottom: 30,
spacingLeft: 20, // for tilted labels to fit in the x axis with ellipsis overflow
Expand Down
2 changes: 1 addition & 1 deletion src/core/tables/__snapshots__/htmlTable.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`Html table render tests should match snapshot: Table with column variables only 1`] = `
"<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`Worksheet xml generation tests Should generate expected xml output with provided fixture with en locale including special characters 1`] = `
"<?xml version="1.0" ?>
Expand Down
1 change: 1 addition & 0 deletions src/core/types/chartOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
export interface IChartOptions {
accessibilityMode?: boolean;
showTitle?: boolean;
fontFamily?: string;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`burgerMenu, rendering tests Should render 1`] = `
<DocumentFragment>
Expand Down Expand Up @@ -30,7 +30,7 @@ exports[`burgerMenu, rendering tests Should render 1`] = `
class="c0"
>
<button
aria-controls="«r0»-menu"
aria-controls="_r_0_-menu"
aria-expanded="false"
aria-haspopup="menu"
aria-label="Kuvion valikko"
Expand Down
4 changes: 2 additions & 2 deletions src/react/components/burgerMenu/burgerMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('burgerMenu, functional tests', () => {
await waitFor(() => {
screen.getByText(btnText).click();
});
expect(mockFunction).toBeCalledTimes(1);
expect(mockFunction).toHaveBeenCalledTimes(1);
expect(screen.queryByText(btnText)).toBeNull();
expect(screen.queryByRole('menu')).toBeNull();
});
Expand All @@ -117,7 +117,7 @@ describe('burgerMenu, functional tests', () => {
await waitFor(() => {
screen.getByText(btnText).click();
});
expect(mockFunction).toBeCalledTimes(1);
expect(mockFunction).toHaveBeenCalledTimes(1);
expect(screen.queryByText(btnText)).toBeNull();
expect(screen.queryByRole('menu')).toBeNull();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`MenuItem, rendering tests should render 1`] = `
<DocumentFragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`Rendering test renders correctly 1`] = `
<DocumentFragment>
<div
class="sc-Qotzb ceAfRj"
class="sc-bRKDuR hOGaEz"
>
<h1>
Kuviota ei voitu muodostaa
Expand Down
Loading
Loading