@sis-cc/dotstatsuite-components 17.31.0 → 18.0.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.
package/lib/app.js CHANGED
@@ -12,7 +12,7 @@ var _app2 = _interopRequireDefault(_app);
12
12
 
13
13
  var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
14
14
 
15
- var _styles = require('@material-ui/core/styles');
15
+ var _styles = require('@mui/material/styles');
16
16
 
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
@@ -22,9 +22,13 @@ var root = (0, _client.createRoot)(container);
22
22
 
23
23
  var App = function App() {
24
24
  return _react2.default.createElement(
25
- _styles.ThemeProvider,
26
- { theme: theme },
27
- _react2.default.createElement(_app2.default, null)
25
+ _styles.StyledEngineProvider,
26
+ { injectFirst: true },
27
+ _react2.default.createElement(
28
+ _styles.ThemeProvider,
29
+ { theme: theme },
30
+ _react2.default.createElement(_app2.default, null)
31
+ )
28
32
  );
29
33
  };
30
34
 
@@ -33,7 +33,7 @@ var getDisplayableValues = function getDisplayableValues(values) {
33
33
  // - empty/null/undefined/!array values (so far)
34
34
  var hasInvalidValues = R.pipe(R.prop('values'), R.anyPass([R.isNil, R.complement(R.is(Array)), R.isEmpty]));
35
35
  var isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
36
- var filterInvalidConcepts = R.filter(isConceptInvalid);
36
+ var filterValidConcepts = R.reject(isConceptInvalid);
37
37
  // concepts is an array of ids... (misnamed!)
38
38
  var conceptIdsLens = R.lensProp('concepts');
39
39
  var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
@@ -41,8 +41,14 @@ var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
41
41
  return function () {
42
42
  var combinations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
43
43
 
44
- var invalidConceptIds = R.pluck('id', filterInvalidConcepts(concepts));
45
- return R.map(R.over(conceptIdsLens, R.without(invalidConceptIds)), combinations);
44
+ var validConceptIds = R.pluck('id', filterValidConcepts(concepts));
45
+ return R.reduce(function (acc, comb) {
46
+ var refinedConcepts = R.intersection(validConceptIds, comb.concepts);
47
+ if (R.length(refinedConcepts) < 2) {
48
+ return acc;
49
+ }
50
+ return R.append((0, _extends4.default)({}, comb, { concepts: refinedConcepts }), acc);
51
+ }, [], combinations);
46
52
  };
47
53
  };
48
54
 
@@ -16,7 +16,7 @@ var _reactHelmet = require('react-helmet');
16
16
 
17
17
  var _core = require('@blueprintjs/core');
18
18
 
19
- var _styles = require('@material-ui/core/styles');
19
+ var _styles = require('@mui/material/styles');
20
20
 
21
21
  var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
22
22
 
@@ -152,26 +152,22 @@ exports.default = function () {
152
152
  return _react2.default.createElement(
153
153
  'div',
154
154
  { style: { padding: 10 } },
155
+ _react2.default.createElement(_reactHelmet.Helmet, { htmlAttributes: { dir: isRtl ? 'rtl' : 'ltr' } }),
155
156
  _react2.default.createElement(
156
- _styles.ThemeProvider,
157
- { theme: theme },
158
- _react2.default.createElement(_reactHelmet.Helmet, { htmlAttributes: { dir: isRtl ? 'rtl' : 'ltr' } }),
159
- _react2.default.createElement(
160
- 'button',
161
- { onClick: function onClick() {
162
- return setRtl(!isRtl);
163
- } },
164
- isRtl ? 'left to right' : 'right to left'
165
- ),
166
- _react2.default.createElement(
167
- _core.Tabs2,
168
- { renderActiveTabPanelOnly: false },
169
- _react2.default.createElement(_core.Tab2, {
170
- id: 'uc1',
171
- title: _react2.default.createElement(AppTab, { label: 'full screen resizable chart', iconName: 'fullscreen' }),
172
- panel: _react2.default.createElement(_useCase2.default, { isRtl: isRtl, config: config, style: style, options: options })
173
- })
174
- )
157
+ 'button',
158
+ { onClick: function onClick() {
159
+ return setRtl(!isRtl);
160
+ } },
161
+ isRtl ? 'left to right' : 'right to left'
162
+ ),
163
+ _react2.default.createElement(
164
+ _core.Tabs2,
165
+ { renderActiveTabPanelOnly: false },
166
+ _react2.default.createElement(_core.Tab2, {
167
+ id: 'uc1',
168
+ title: _react2.default.createElement(AppTab, { label: 'full screen resizable chart', iconName: 'fullscreen' }),
169
+ panel: _react2.default.createElement(_useCase2.default, { isRtl: isRtl, config: config, style: style, options: options })
170
+ })
175
171
  )
176
172
  );
177
173
  };
@@ -38,7 +38,7 @@ var _size2 = _interopRequireDefault(_size);
38
38
 
39
39
  var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
40
40
 
41
- var _styles = require('@material-ui/core/styles');
41
+ var _styles = require('@mui/styles');
42
42
 
43
43
  var _options = require('./chartUtils/options');
44
44
 
@@ -20,7 +20,9 @@ var _ramda = require('ramda');
20
20
 
21
21
  var R = _interopRequireWildcard(_ramda);
22
22
 
23
- var _styles = require('@material-ui/core/styles');
23
+ var _makeStyles = require('@mui/styles/makeStyles');
24
+
25
+ var _makeStyles2 = _interopRequireDefault(_makeStyles);
24
26
 
25
27
  var _constants = require('../../../rules/src/constants');
26
28
 
@@ -30,7 +32,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
30
32
 
31
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
34
 
33
- var useStyles = (0, _styles.makeStyles)(function (theme) {
35
+ var useStyles = (0, _makeStyles2.default)(function (theme) {
34
36
  var legendFont = (0, _utils.getFontFromTheme)(['axisLegend'])(theme);
35
37
  return {
36
38
  xLegend: legendFont,
@@ -20,7 +20,7 @@ var _dotstatsuiteD3Charts = require('@sis-cc/dotstatsuite-d3-charts');
20
20
 
21
21
  var _src = require('../../../bridge-d3-react/src');
22
22
 
23
- var _styles = require('@material-ui/core/styles');
23
+ var _styles = require('@mui/material/styles');
24
24
 
25
25
  var _AxisLegend = require('./AxisLegend');
26
26
 
@@ -20,7 +20,9 @@ var _ramda = require('ramda');
20
20
 
21
21
  var R = _interopRequireWildcard(_ramda);
22
22
 
23
- var _styles = require('@material-ui/core/styles');
23
+ var _makeStyles = require('@mui/styles/makeStyles');
24
+
25
+ var _makeStyles2 = _interopRequireDefault(_makeStyles);
24
26
 
25
27
  var _utils = require('../utils');
26
28
 
@@ -28,7 +30,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
28
30
 
29
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
32
 
31
- var useStyles = (0, _styles.makeStyles)(function (theme) {
33
+ var useStyles = (0, _makeStyles2.default)(function (theme) {
32
34
  return {
33
35
  legend: (0, _extends3.default)({}, (0, _utils.getFontFromTheme)(['chartLegend'])(theme), {
34
36
  display: 'flex',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "17.31.0",
4
+ "version": "18.0.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -13,7 +13,8 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@blueprintjs/core": "^1.22.0",
16
- "@material-ui/core": "^4",
16
+ "@mui/material": "^5.16.5",
17
+ "@mui/styles": "^5.16.5",
17
18
  "@sis-cc/dotstatsuite-sdmxjs": "*",
18
19
  "@sis-cc/dotstatsuite-visions": "*",
19
20
  "react": "^18",
@@ -23,6 +24,11 @@
23
24
  "web-component-env": "^2.0.0"
24
25
  },
25
26
  "dependencies": {
27
+ "@emotion/react": "^11.13.3",
28
+ "@emotion/styled": "^11.13.0",
29
+ "@mui/icons-material": "^5.16.5",
30
+ "@mui/material": "^5.16.5",
31
+ "@mui/styles": "^5.16.5",
26
32
  "@react-hook/size": "^2.1.1",
27
33
  "@sis-cc/dotstatsuite-d3-charts": "^8.3.0",
28
34
  "date-fns": "^1.30.1",
@@ -34,7 +40,8 @@
34
40
  "ramda": "^0.26.1"
35
41
  },
36
42
  "peerDependencies": {
37
- "@material-ui/core": "^4",
43
+ "@mui/icons-material": "^5.16.5",
44
+ "@mui/material": "^5.16.5",
38
45
  "@sis-cc/dotstatsuite-sdmxjs": "^8",
39
46
  "@sis-cc/dotstatsuite-visions": "^9",
40
47
  "react": "^18",
package/src/app.js CHANGED
@@ -2,17 +2,19 @@ import React from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import ViewerApp from './viewer/src/app';
4
4
  import { sisccTheme } from '@sis-cc/dotstatsuite-visions';
5
- import { ThemeProvider } from '@material-ui/core/styles';
6
- import { createTheme } from '@material-ui/core/styles';
5
+ import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
6
+ import { createTheme } from '@mui/material/styles';
7
7
 
8
8
  const theme = createTheme(sisccTheme({ rtl: 'ltr' }));
9
9
  const container = document.getElementById('root');
10
10
  const root = createRoot(container);
11
11
 
12
12
  const App = () => (
13
- <ThemeProvider theme={theme}>
14
- <ViewerApp />
15
- </ThemeProvider>
13
+ <StyledEngineProvider injectFirst>
14
+ <ThemeProvider theme={theme}>
15
+ <ViewerApp />
16
+ </ThemeProvider>
17
+ </StyledEngineProvider>
16
18
  );
17
19
 
18
20
  root.render(<App />);
@@ -16,17 +16,20 @@ const hasInvalidValues = R.pipe(
16
16
  R.anyPass([R.isNil, R.complement(R.is(Array)), R.isEmpty]),
17
17
  );
18
18
  const isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
19
- const filterInvalidConcepts = R.filter(isConceptInvalid);
19
+ const filterValidConcepts = R.reject(isConceptInvalid);
20
20
  // concepts is an array of ids... (misnamed!)
21
21
  const conceptIdsLens = R.lensProp('concepts');
22
22
  const rejectInvalidConceptIds =
23
23
  (concepts = []) =>
24
24
  (combinations = []) => {
25
- const invalidConceptIds = R.pluck('id', filterInvalidConcepts(concepts));
26
- return R.map(
27
- R.over(conceptIdsLens, R.without(invalidConceptIds)),
28
- combinations,
29
- );
25
+ const validConceptIds = R.pluck('id', filterValidConcepts(concepts));
26
+ return R.reduce((acc, comb) => {
27
+ const refinedConcepts = R.intersection(validConceptIds, comb.concepts);
28
+ if (R.length(refinedConcepts) < 2) {
29
+ return acc;
30
+ }
31
+ return R.append({ ...comb, concepts: refinedConcepts }, acc);
32
+ }, [], combinations);
30
33
  };
31
34
 
32
35
  export const parseCombinations = (
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Helmet } from 'react-helmet';
3
3
  import { Tab2, Tabs2, Intent, Icon, Tooltip, Position } from '@blueprintjs/core';
4
- import { ThemeProvider } from '@material-ui/core/styles';
5
- import { createTheme } from '@material-ui/core/styles';
4
+ import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
5
+ import { createTheme } from '@mui/material/styles';
6
6
  import { sisccTheme } from '@sis-cc/dotstatsuite-visions';
7
7
  import UseCase1 from './app/use-case-1';
8
8
  import TableCase from './app/table';
@@ -100,18 +100,20 @@ export default () => {
100
100
  */
101
101
 
102
102
  return (
103
- <div style={{padding: 10}}>
104
- <ThemeProvider theme={theme}>
105
- <Helmet htmlAttributes={{ dir: isRtl ? 'rtl' : 'ltr' }} />
106
- <button onClick={() => setRtl(!isRtl)}>{isRtl ? 'left to right' : 'right to left'}</button>
107
- <Tabs2 renderActiveTabPanelOnly={false}>
108
- <Tab2
109
- id="uc1"
110
- title={<AppTab label="full screen resizable chart" iconName="fullscreen" />}
111
- panel={<UseCase1 isRtl={isRtl} config={config} style={style} options={options} />}
112
- />
113
- </Tabs2>
114
- </ThemeProvider>
103
+ <div style={{ padding: 10 }}>
104
+ {/* <StyledEngineProvider injectFirst>
105
+ <ThemeProvider theme={theme}> */}
106
+ <Helmet htmlAttributes={{ dir: isRtl ? 'rtl' : 'ltr' }} />
107
+ <button onClick={() => setRtl(!isRtl)}>{isRtl ? 'left to right' : 'right to left'}</button>
108
+ <Tabs2 renderActiveTabPanelOnly={false}>
109
+ <Tab2
110
+ id="uc1"
111
+ title={<AppTab label="full screen resizable chart" iconName="fullscreen" />}
112
+ panel={<UseCase1 isRtl={isRtl} config={config} style={style} options={options} />}
113
+ />
114
+ </Tabs2>
115
+ {/* </ThemeProvider>
116
+ </StyledEngineProvider> */}
115
117
  </div>
116
118
  );
117
119
  };
@@ -3,7 +3,7 @@ import * as R from 'ramda';
3
3
  import cx from 'classnames';
4
4
  import useSize from '@react-hook/size';
5
5
  import { Loading, NoData, TableHtml5 } from '@sis-cc/dotstatsuite-visions';
6
- import { useTheme, makeStyles } from '@material-ui/core/styles';
6
+ import { makeStyles, useTheme } from '@mui/styles';
7
7
  import getChartOptions from './chartUtils/options';
8
8
  import Header from './header';
9
9
  import Chart from './chart';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import * as R from 'ramda';
4
- import { makeStyles } from '@material-ui/core/styles';
4
+ import makeStyles from '@mui/styles/makeStyles';
5
5
  import { SCATTER } from '../../../rules/src/constants';
6
6
  import { getFontFromTheme } from '../utils';
7
7
 
@@ -3,7 +3,7 @@ import * as R from 'ramda';
3
3
  import numeral from 'numeral';
4
4
  import { computeOptions } from '@sis-cc/dotstatsuite-d3-charts';
5
5
  import { ChoroplethLegend } from '../../../bridge-d3-react/src';
6
- import { useTheme } from '@material-ui/core/styles';
6
+ import { useTheme } from '@mui/material/styles';
7
7
  import AxisLegend from './AxisLegend';
8
8
  import FocusLegend from './FocusLegend';
9
9
  import SeriesLegend from './SeriesLegend';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import * as R from 'ramda';
4
- import { makeStyles } from '@material-ui/core/styles';
4
+ import makeStyles from '@mui/styles/makeStyles';
5
5
  import { getFontFromTheme } from '../utils';
6
6
 
7
7
  const useStyles = makeStyles(theme => ({
@@ -17,7 +17,7 @@ describe('parseCombinations tests', () => {
17
17
  { id: 'COMB11', concepts: ['DIM4', 'DIM7'] },
18
18
  { id: 'COMB12', concepts: ['DIM4', 'ATTR7'] },
19
19
  { id: 'COMB13', concepts: ['DIM7', 'ATTR7'] },
20
- { id: 'COMB14', concepts: ['DIM3', 'ATTR5', 'ATTR8'] }
20
+ { id: 'COMB14', concepts: ['DIM3', 'ATTR5', 'ATTR8'] },
21
21
  ];
22
22
 
23
23
  const dimensions = [
@@ -146,26 +146,6 @@ describe('parseCombinations tests', () => {
146
146
  relationship: ['DIM4'],
147
147
  display: true,
148
148
  },
149
- {
150
- id: 'COMB11',
151
- concepts: ['DIM4'],
152
- series: true,
153
- relationship: ['DIM4'],
154
- display: true,
155
- },
156
- {
157
- id: 'COMB12',
158
- concepts: ['DIM4'],
159
- series: true,
160
- relationship: ['DIM4'],
161
- display: true,
162
- },
163
- {
164
- id: 'COMB13',
165
- concepts: [],
166
- display: false,
167
- header: true,
168
- },
169
149
  {
170
150
  id: 'COMB14',
171
151
  concepts: ['DIM3', 'ATTR5', 'ATTR8'],