@sis-cc/dotstatsuite-visions 12.4.0 → 12.6.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.
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import * as R from 'ramda';
3
3
  import PropTypes from 'prop-types';
4
4
  import dateFns from 'date-fns';
5
- import Grid from '@mui/material/Grid';
5
+ import { Grid, Typography } from '@mui/material';
6
6
  import { numeralFormat } from './lib';
7
7
  import { Select } from '../';
8
8
  import useStyles from './styles';
@@ -133,8 +133,9 @@ var Period = function Period(_ref) {
133
133
  Grid,
134
134
  { item: true, xs: 12, className: classes.sideLabel },
135
135
  React.createElement(
136
- 'span',
136
+ Typography,
137
137
  {
138
+ variant: 'body2',
138
139
  tabIndex: 0 // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
139
140
  , 'aria-label': label
140
141
  },
@@ -42,7 +42,8 @@ var Item = function Item(_ref) {
42
42
  _ref$depth = _ref.depth,
43
43
  depth = _ref$depth === undefined ? 0 : _ref$depth,
44
44
  eventsListeners = _ref.eventsListeners,
45
- expanded = _ref.expanded;
45
+ expanded = _ref.expanded,
46
+ highlightedLabel = _ref.highlightedLabel;
46
47
 
47
48
  var _useKeyboardEscapeHan = useKeyboardEscapeHandler(),
48
49
  open = _useKeyboardEscapeHan.open,
@@ -50,6 +51,7 @@ var Item = function Item(_ref) {
50
51
 
51
52
  var padding = depth * 30 + (depth > 0 && !hasChildrenOnLevel ? 30 : 0) + (!hasChild && hasChildrenOnLevel ? 30 : 0);
52
53
 
54
+ var formattedLabel = highlightedLabel ? React.createElement('div', { dangerouslySetInnerHTML: { __html: highlightedLabel } }) : label;
53
55
  return React.createElement(
54
56
  ListItem,
55
57
  {
@@ -151,7 +153,7 @@ var Item = function Item(_ref) {
151
153
  variant: 'body2',
152
154
  className: cx(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !R.isEmpty(description), _cx5))
153
155
  },
154
- label
156
+ formattedLabel
155
157
  )
156
158
  ),
157
159
  R.not(R.isNil(count)) && React.createElement(
@@ -193,7 +195,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
193
195
  depth: PropTypes.number,
194
196
  eventsListeners: PropTypes.object,
195
197
  isGreyed: PropTypes.bool,
196
- expanded: PropTypes.bool
198
+ expanded: PropTypes.bool,
199
+ highlightedLabel: PropTypes.string
197
200
  } : {};
198
201
 
199
202
  export default Item;
@@ -29,31 +29,47 @@ export var spotlightFilter = function spotlightFilter(term) {
29
29
  }
30
30
  return acc;
31
31
  };
32
+ var matchRegExp = function matchRegExp(str) {
33
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
34
+ };
35
+
36
+ // Highlight matching terms in the label
37
+ var highlightLabel = function highlightLabel(label) {
38
+ var regex = new RegExp('(' + matchRegExp(term) + ')', 'gi');
39
+ return label.replace(regex, function (match) {
40
+ return '<span style=background-color:yellow;border-bottom:2px solid #8CC841>' + match + '</span>';
41
+ });
42
+ };
32
43
 
33
44
  var recurse = function recurse(item) {
34
- var isValidItem = R.includes(R.toLower(term), R.toLower(labelRenderer(item)));
45
+ var label = labelRenderer(item);
46
+ var isValidItem = R.includes(R.toLower(term), R.toLower(label));
35
47
 
36
48
  var result = [];
37
49
 
38
50
  if (isValidItem) {
51
+ var highlightedLabel = highlightLabel(label);
52
+ console.log(highlightedLabel);
39
53
  var parents = findParents(item);
40
- result = [].concat(parents, [item]);
54
+ result = [].concat(parents, [_extends({}, item, { highlightedLabel: highlightedLabel })]);
55
+
41
56
  if (displayChildren) {
42
57
  var children = getDescendants(R.prop('id', item), groupedItemsByParentId);
43
- return [].concat(parents, [item], children);
58
+ return [].concat(parents, [_extends({}, item, { highlightedLabel: highlightedLabel })], children);
44
59
  }
45
60
  }
61
+
46
62
  if (R.has(getHierarchicalId(item), groupedItemsByParentId)) {
47
63
  var childItems = groupedItemsByParentId[getHierarchicalId(item)] || [];
48
64
  var matchingChildren = R.chain(recurse, childItems);
49
65
 
50
66
  // res with any matching children
51
- return R.uniq([].concat(result, matchingChildren));
67
+ return R.uniqBy(R.prop('id'), [].concat(result, matchingChildren));
52
68
  }
53
69
  return result;
54
70
  };
55
71
 
56
- return R.uniq(R.chain(recurse, groupedItemsByParentId['#ROOT'] || []));
72
+ return R.uniqBy(R.prop('id'))(R.chain(recurse, groupedItemsByParentId['#ROOT'] || []));
57
73
  };
58
74
  };
59
75
 
package/es/theme.js CHANGED
@@ -7,8 +7,8 @@ export var innerPalette = {
7
7
  primaryMain: '#0549ab',
8
8
  primaryLight: '#007bc7',
9
9
  primaryDark: '#0549ab',
10
- hover: 'rgba(14, 144, 224, 0.13)',
11
- selected: 'rgba(14, 144, 224, 0.25)',
10
+ hover: 'rgba(14, 144, 224, 0.13) !important',
11
+ selected: 'rgba(14, 144, 224, 0.25) !important',
12
12
  textLight: '#444444',
13
13
  textDark: '#182026'
14
14
  };
@@ -42,6 +42,13 @@ export var sisccTheme = function sisccTheme(_ref) {
42
42
  return {
43
43
  direction: rtl,
44
44
  components: {
45
+ MuiCssBaseline: {
46
+ styleOverrides: {
47
+ body: {
48
+ fontSize: '0.875rem'
49
+ }
50
+ }
51
+ },
45
52
  MuiButtonBase: {
46
53
  defaultProps: {
47
54
  disableRipple: true
@@ -111,11 +118,14 @@ export var sisccTheme = function sisccTheme(_ref) {
111
118
  styleOverrides: {
112
119
  root: {
113
120
  color: outerPalette.primaryMain || innerPalette.primaryMain,
114
- '&$selected': {
115
- backgroundColor: outerPalette.hover || innerPalette.hover,
116
- '&:hover': {
117
- backgroundColor: outerPalette.selected || innerPalette.selected
118
- }
121
+ '&.Mui-selected': {
122
+ backgroundColor: outerPalette.hover || innerPalette.hover
123
+ },
124
+ '&:hover': {
125
+ backgroundColor: outerPalette.hover || innerPalette.hover
126
+ },
127
+ '&.Mui-selected:hover': {
128
+ backgroundColor: outerPalette.selected || innerPalette.selected
119
129
  }
120
130
  }
121
131
  }
@@ -142,7 +152,8 @@ export var sisccTheme = function sisccTheme(_ref) {
142
152
  root: {
143
153
  color: outerPalette.primaryMain || innerPalette.primaryMain,
144
154
  '&:hover': {
145
- color: outerPalette.primaryLight || innerPalette.primaryLight
155
+ color: outerPalette.primaryLight || innerPalette.primaryLight,
156
+ textDecoration: 'underline'
146
157
  },
147
158
  '&.Mui-focused': isA11y && focus
148
159
  },
@@ -362,7 +373,7 @@ export var sisccTheme = function sisccTheme(_ref) {
362
373
  typography: {
363
374
  fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
364
375
  h6: {
365
- fontSize: ' 1.0625rem'
376
+ fontSize: '1.0625rem'
366
377
  },
367
378
  body1: {
368
379
  fontSize: '0.750rem',
@@ -18,9 +18,7 @@ var _dateFns = require('date-fns');
18
18
 
19
19
  var _dateFns2 = _interopRequireDefault(_dateFns);
20
20
 
21
- var _Grid = require('@mui/material/Grid');
22
-
23
- var _Grid2 = _interopRequireDefault(_Grid);
21
+ var _material = require('@mui/material');
24
22
 
25
23
  var _lib = require('./lib');
26
24
 
@@ -118,10 +116,10 @@ var Period = function Period(_ref) {
118
116
  };
119
117
  };
120
118
  return _react2.default.createElement(
121
- _Grid2.default,
119
+ _material.Grid,
122
120
  { 'data-testid': 'period-picker-test-id', container: true, direction: 'row' },
123
121
  showFrequency && _react2.default.createElement(
124
- _Grid2.default,
122
+ _material.Grid,
125
123
  {
126
124
  item: true,
127
125
  xs: 12,
@@ -129,10 +127,10 @@ var Period = function Period(_ref) {
129
127
  'data-testid': 'period-picker-frequency-test-id'
130
128
  },
131
129
  _react2.default.createElement(
132
- _Grid2.default,
130
+ _material.Grid,
133
131
  { container: true, direction: 'row' },
134
132
  _react2.default.createElement(
135
- _Grid2.default,
133
+ _material.Grid,
136
134
  { item: true, xs: 12 },
137
135
  _react2.default.createElement(_.Select, {
138
136
  id: labels.frequency,
@@ -152,17 +150,18 @@ var Period = function Period(_ref) {
152
150
  testId = _ref3.testId,
153
151
  getIsDisabled = _ref3.getIsDisabled;
154
152
  return _react2.default.createElement(
155
- _Grid2.default,
153
+ _material.Grid,
156
154
  { key: getter, item: true, xs: 12, 'data-testid': testId },
157
155
  _react2.default.createElement(
158
- _Grid2.default,
156
+ _material.Grid,
159
157
  { container: true, direction: 'row' },
160
158
  _react2.default.createElement(
161
- _Grid2.default,
159
+ _material.Grid,
162
160
  { item: true, xs: 12, className: classes.sideLabel },
163
161
  _react2.default.createElement(
164
- 'span',
162
+ _material.Typography,
165
163
  {
164
+ variant: 'body2',
166
165
  tabIndex: 0 // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
167
166
  , 'aria-label': label
168
167
  },
@@ -171,13 +170,13 @@ var Period = function Period(_ref) {
171
170
  )
172
171
  ),
173
172
  _react2.default.createElement(
174
- _Grid2.default,
173
+ _material.Grid,
175
174
  { container: true, direction: 'row' },
176
175
  _react2.default.createElement(
177
- _Grid2.default,
176
+ _material.Grid,
178
177
  { item: true, xs: 12 },
179
178
  _react2.default.createElement(
180
- _Grid2.default,
179
+ _material.Grid,
181
180
  { container: true, className: classes.headerContainer, spacing: 1 },
182
181
  R.map(function (row) {
183
182
  return R.map(function (_ref4) {
@@ -186,7 +185,7 @@ var Period = function Period(_ref) {
186
185
 
187
186
  var selectedValue = R.isNil(R.prop(id)(value)) ? R.head(values) : R.prop(id)(value);
188
187
  return _react2.default.createElement(
189
- _Grid2.default,
188
+ _material.Grid,
190
189
  {
191
190
  key: id,
192
191
  item: true,
@@ -85,7 +85,8 @@ var Item = function Item(_ref) {
85
85
  _ref$depth = _ref.depth,
86
86
  depth = _ref$depth === undefined ? 0 : _ref$depth,
87
87
  eventsListeners = _ref.eventsListeners,
88
- expanded = _ref.expanded;
88
+ expanded = _ref.expanded,
89
+ highlightedLabel = _ref.highlightedLabel;
89
90
 
90
91
  var _useKeyboardEscapeHan = (0, _useKeybordEscapeHandler2.default)(),
91
92
  open = _useKeyboardEscapeHan.open,
@@ -93,6 +94,7 @@ var Item = function Item(_ref) {
93
94
 
94
95
  var padding = depth * 30 + (depth > 0 && !hasChildrenOnLevel ? 30 : 0) + (!hasChild && hasChildrenOnLevel ? 30 : 0);
95
96
 
97
+ var formattedLabel = highlightedLabel ? _react2.default.createElement('div', { dangerouslySetInnerHTML: { __html: highlightedLabel } }) : label;
96
98
  return _react2.default.createElement(
97
99
  _ListItem2.default,
98
100
  {
@@ -194,7 +196,7 @@ var Item = function Item(_ref) {
194
196
  variant: 'body2',
195
197
  className: (0, _classnames2.default)(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !R.isEmpty(description), _cx5))
196
198
  },
197
- label
199
+ formattedLabel
198
200
  )
199
201
  ),
200
202
  R.not(R.isNil(count)) && _react2.default.createElement(
@@ -236,7 +238,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
236
238
  depth: _propTypes2.default.number,
237
239
  eventsListeners: _propTypes2.default.object,
238
240
  isGreyed: _propTypes2.default.bool,
239
- expanded: _propTypes2.default.bool
241
+ expanded: _propTypes2.default.bool,
242
+ highlightedLabel: _propTypes2.default.string
240
243
  } : {};
241
244
 
242
245
  exports.default = Item;
@@ -3,7 +3,8 @@
3
3
  exports.__esModule = true;
4
4
  exports.withSpotlight = exports.spotlightFilter = undefined;
5
5
 
6
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint react/prop-types: 0 */
7
+
7
8
 
8
9
  var _ramda = require('ramda');
9
10
 
@@ -19,8 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
20
 
20
21
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
21
22
 
22
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* eslint react/prop-types: 0 */
23
-
23
+ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
24
24
 
25
25
  var spotlightFilter = exports.spotlightFilter = function spotlightFilter(term) {
26
26
  var labelRenderer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : R.prop('label');
@@ -44,31 +44,47 @@ var spotlightFilter = exports.spotlightFilter = function spotlightFilter(term) {
44
44
  }
45
45
  return acc;
46
46
  };
47
+ var matchRegExp = function matchRegExp(str) {
48
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
49
+ };
50
+
51
+ // Highlight matching terms in the label
52
+ var highlightLabel = function highlightLabel(label) {
53
+ var regex = new RegExp('(' + matchRegExp(term) + ')', 'gi');
54
+ return label.replace(regex, function (match) {
55
+ return '<span style=background-color:yellow;border-bottom:2px solid #8CC841>' + match + '</span>';
56
+ });
57
+ };
47
58
 
48
59
  var recurse = function recurse(item) {
49
- var isValidItem = R.includes(R.toLower(term), R.toLower(labelRenderer(item)));
60
+ var label = labelRenderer(item);
61
+ var isValidItem = R.includes(R.toLower(term), R.toLower(label));
50
62
 
51
63
  var result = [];
52
64
 
53
65
  if (isValidItem) {
66
+ var highlightedLabel = highlightLabel(label);
67
+ console.log(highlightedLabel);
54
68
  var parents = findParents(item);
55
- result = [].concat(parents, [item]);
69
+ result = [].concat(parents, [_extends({}, item, { highlightedLabel: highlightedLabel })]);
70
+
56
71
  if (displayChildren) {
57
72
  var children = (0, _utils.getDescendants)(R.prop('id', item), groupedItemsByParentId);
58
- return [].concat(parents, [item], children);
73
+ return [].concat(parents, [_extends({}, item, { highlightedLabel: highlightedLabel })], children);
59
74
  }
60
75
  }
76
+
61
77
  if (R.has((0, _utils.getHierarchicalId)(item), groupedItemsByParentId)) {
62
78
  var childItems = groupedItemsByParentId[(0, _utils.getHierarchicalId)(item)] || [];
63
79
  var matchingChildren = R.chain(recurse, childItems);
64
80
 
65
81
  // res with any matching children
66
- return R.uniq([].concat(result, matchingChildren));
82
+ return R.uniqBy(R.prop('id'), [].concat(result, matchingChildren));
67
83
  }
68
84
  return result;
69
85
  };
70
86
 
71
- return R.uniq(R.chain(recurse, groupedItemsByParentId['#ROOT'] || []));
87
+ return R.uniqBy(R.prop('id'))(R.chain(recurse, groupedItemsByParentId['#ROOT'] || []));
72
88
  };
73
89
  };
74
90
 
package/lib/theme.js CHANGED
@@ -11,8 +11,8 @@ var innerPalette = exports.innerPalette = {
11
11
  primaryMain: '#0549ab',
12
12
  primaryLight: '#007bc7',
13
13
  primaryDark: '#0549ab',
14
- hover: 'rgba(14, 144, 224, 0.13)',
15
- selected: 'rgba(14, 144, 224, 0.25)',
14
+ hover: 'rgba(14, 144, 224, 0.13) !important',
15
+ selected: 'rgba(14, 144, 224, 0.25) !important',
16
16
  textLight: '#444444',
17
17
  textDark: '#182026'
18
18
  };
@@ -46,6 +46,13 @@ var sisccTheme = exports.sisccTheme = function sisccTheme(_ref) {
46
46
  return {
47
47
  direction: rtl,
48
48
  components: {
49
+ MuiCssBaseline: {
50
+ styleOverrides: {
51
+ body: {
52
+ fontSize: '0.875rem'
53
+ }
54
+ }
55
+ },
49
56
  MuiButtonBase: {
50
57
  defaultProps: {
51
58
  disableRipple: true
@@ -115,11 +122,14 @@ var sisccTheme = exports.sisccTheme = function sisccTheme(_ref) {
115
122
  styleOverrides: {
116
123
  root: {
117
124
  color: outerPalette.primaryMain || innerPalette.primaryMain,
118
- '&$selected': {
119
- backgroundColor: outerPalette.hover || innerPalette.hover,
120
- '&:hover': {
121
- backgroundColor: outerPalette.selected || innerPalette.selected
122
- }
125
+ '&.Mui-selected': {
126
+ backgroundColor: outerPalette.hover || innerPalette.hover
127
+ },
128
+ '&:hover': {
129
+ backgroundColor: outerPalette.hover || innerPalette.hover
130
+ },
131
+ '&.Mui-selected:hover': {
132
+ backgroundColor: outerPalette.selected || innerPalette.selected
123
133
  }
124
134
  }
125
135
  }
@@ -146,7 +156,8 @@ var sisccTheme = exports.sisccTheme = function sisccTheme(_ref) {
146
156
  root: {
147
157
  color: outerPalette.primaryMain || innerPalette.primaryMain,
148
158
  '&:hover': {
149
- color: outerPalette.primaryLight || innerPalette.primaryLight
159
+ color: outerPalette.primaryLight || innerPalette.primaryLight,
160
+ textDecoration: 'underline'
150
161
  },
151
162
  '&.Mui-focused': isA11y && focus
152
163
  },
@@ -366,7 +377,7 @@ var sisccTheme = exports.sisccTheme = function sisccTheme(_ref) {
366
377
  typography: {
367
378
  fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
368
379
  h6: {
369
- fontSize: ' 1.0625rem'
380
+ fontSize: '1.0625rem'
370
381
  },
371
382
  body1: {
372
383
  fontSize: '0.750rem',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "12.4.0",
3
+ "version": "12.6.0",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @sis-cc/dotstatsuite-visions v12.4.0 - https://visions-qa.siscc.org/#o
2
+ * @sis-cc/dotstatsuite-visions v12.6.0 - https://visions-qa.siscc.org/#o
3
3
  * MIT Licensed
4
4
  */
5
5
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -9187,7 +9187,7 @@ if (true) {
9187
9187
  /* 166 */
9188
9188
  /***/ (function(module) {
9189
9189
 
9190
- module.exports = {"name":"@sis-cc/dotstatsuite-visions","version":"12.4.0","description":"Library of visual components","author":"OECD","homepage":"https://visions-qa.siscc.org/#o","license":"MIT","repository":"https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-visions","main":"lib/index.js","module":"es/index.js","engines":{"node":">=14"},"files":["css","es","lib","umd"],"scripts":{"build":"nwb build-react-component --copy-files --no-demo && node scripts/doc && nwb build-demo","build:dev":"nwb build-react-component --copy-files --no-demo","clean":"nwb clean-module && nwb clean-demo","prepublishOnly":"npm run build","start":"nwb serve-react-demo","test":"jest","test:watch":"jest --watch --no-cache","lint":"eslint src/ --color","precommit":"lint-staged"},"dependencies":{"@emotion/react":"^11.13.0","@emotion/styled":"^11.13.0","@hello-pangea/dnd":"^16.6.0","@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","@mui/styles":"^5.16.5","@react-hook/size":"^2.1.1","classnames":"^2.2.6","cross-env":"^7.0.3","date-fns":"^1.30.1","isemail":"^3.2.0","numeral":"^2.0.6","prop-types":"^15.7.2","ramda":"^0.27.0","react-draggable":"^4.4.5","react-error-boundary":"^4.0.10","react-virtualized":"^9.21.2"},"peerDependencies":{"@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","react":"^18","react-dom":"^18"},"devDependencies":{"@babel/eslint-parser":"^7.5.4","@babel/plugin-syntax-dynamic-import":"^7.2.0","@cfaester/enzyme-adapter-react-18":"^0.7.0","@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","@testing-library/jest-dom":"^5.16.5","@testing-library/react":"^14.0.0","babel-jest":"^24.8.0","babel-preset-react-app":"^9.0.0","dox":"^0.9.0","eslint":"^8.39.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","husky":"^2.7.0","identity-obj-proxy":"^3.0.0","jest":"^24.8.0","jss":"^10.10.0","jss-rtl":"^0.2.3","lint-staged":"^8.2.1","mutationobserver-shim":"^0.3.7","nwb":"0.23.0","prettier":"^2.8.8","pretty-quick":"^3.1.3","react":"^18","react-a11y":"^1.1.0","react-dom":"^18","react-helmet":"^5.2.1","react-scrollable-anchor":"^0.6.1","react-syntax-highlighter":"^10.2.1","sanitize-html":"2.7.0","webpack":"^5.68.0","webpack-cli":"^4.9.2","webpack-dev-server":"^4.7.4"},"jest":{"verbose":true,"coverageDirectory":"coverage","collectCoverageFrom":["src/**/*.{js,jsx,ts,tsx}","!src/ScopeList/*.{js,jsx,ts,tsx}","!src/**/*.d.ts"],"setupFilesAfterEnv":["<rootDir>/tests/setup.js"],"testMatch":["**/tests/**/*.{spec,test}.{js,jsx,ts,tsx}","!**/tests/ScopeList.test.js"],"testEnvironment":"jsdom","transform":{"^.+\\.(js|jsx|ts|tsx)$":"<rootDir>/node_modules/babel-jest"},"transformIgnorePatterns":["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$","^.+\\.module\\.(css|sass|scss)$"],"modulePaths":[],"moduleNameMapper":{"^react-native$":"react-native-web","^.+\\.module\\.(css|sass|scss)$":"identity-obj-proxy","\\.(jpg|jpeg|png)$":"identity-obj-proxy"},"moduleFileExtensions":["web.js","js","web.ts","ts","web.tsx","tsx","json","web.jsx","jsx","node"]},"babel":{"presets":["react-app"],"plugins":["@babel/plugin-syntax-dynamic-import"]},"eslintConfig":{"env":{"browser":true,"jest":true,"node":true,"es6":true},"extends":["eslint:recommended","plugin:react/recommended","plugin:jsx-a11y/recommended"],"parser":"@babel/eslint-parser","parserOptions":{"babelOptions":{"presets":[["babel-preset-react-app",false],"babel-preset-react-app/test"]},"ecmaFeatures":{"experimentalObjectRestSpread":true,"jsx":true},"sourceType":"module"},"plugins":["prettier","react","import","react-hooks","jsx-a11y"],"rules":{"no-console":"warn","no-unused-vars":"error","react/display-name":"off","react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","no-use-before-define":"error"}},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"src/**/*.{js,css}":["prettier --write","git add","yarn lint"]},"prettier":{"endOfLine":"lf","useTabs":false,"printWidth":100,"tabWidth":2,"singleQuote":true,"trailingComma":"all","bracketSameLine":false,"bracketSpacing":true,"parser":"babel","semi":true,"arrowParens":"avoid"}};
9190
+ module.exports = {"name":"@sis-cc/dotstatsuite-visions","version":"12.6.0","description":"Library of visual components","author":"OECD","homepage":"https://visions-qa.siscc.org/#o","license":"MIT","repository":"https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-visions","main":"lib/index.js","module":"es/index.js","engines":{"node":">=14"},"files":["css","es","lib","umd"],"scripts":{"build":"nwb build-react-component --copy-files --no-demo && node scripts/doc && nwb build-demo","build:dev":"nwb build-react-component --copy-files --no-demo","clean":"nwb clean-module && nwb clean-demo","prepublishOnly":"npm run build","start":"nwb serve-react-demo","test":"jest","test:watch":"jest --watch --no-cache","lint":"eslint src/ --color","precommit":"lint-staged"},"dependencies":{"@emotion/react":"^11.13.0","@emotion/styled":"^11.13.0","@hello-pangea/dnd":"^16.6.0","@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","@mui/styles":"^5.16.5","@react-hook/size":"^2.1.1","classnames":"^2.2.6","cross-env":"^7.0.3","date-fns":"^1.30.1","isemail":"^3.2.0","numeral":"^2.0.6","prop-types":"^15.7.2","ramda":"^0.27.0","react-draggable":"^4.4.5","react-error-boundary":"^4.0.10","react-virtualized":"^9.21.2"},"peerDependencies":{"@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","react":"^18","react-dom":"^18"},"devDependencies":{"@babel/eslint-parser":"^7.5.4","@babel/plugin-syntax-dynamic-import":"^7.2.0","@cfaester/enzyme-adapter-react-18":"^0.7.0","@mui/icons-material":"^5.16.5","@mui/material":"^5.16.5","@testing-library/jest-dom":"^5.16.5","@testing-library/react":"^14.0.0","babel-jest":"^24.8.0","babel-preset-react-app":"^9.0.0","dox":"^0.9.0","eslint":"^8.39.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","husky":"^2.7.0","identity-obj-proxy":"^3.0.0","jest":"^24.8.0","jss":"^10.10.0","jss-rtl":"^0.2.3","lint-staged":"^8.2.1","mutationobserver-shim":"^0.3.7","nwb":"0.23.0","prettier":"^2.8.8","pretty-quick":"^3.1.3","react":"^18","react-a11y":"^1.1.0","react-dom":"^18","react-helmet":"^5.2.1","react-scrollable-anchor":"^0.6.1","react-syntax-highlighter":"^10.2.1","sanitize-html":"2.7.0","webpack":"^5.68.0","webpack-cli":"^4.9.2","webpack-dev-server":"^4.7.4"},"jest":{"verbose":true,"coverageDirectory":"coverage","collectCoverageFrom":["src/**/*.{js,jsx,ts,tsx}","!src/ScopeList/*.{js,jsx,ts,tsx}","!src/**/*.d.ts"],"setupFilesAfterEnv":["<rootDir>/tests/setup.js"],"testMatch":["**/tests/**/*.{spec,test}.{js,jsx,ts,tsx}","!**/tests/ScopeList.test.js"],"testEnvironment":"jsdom","transform":{"^.+\\.(js|jsx|ts|tsx)$":"<rootDir>/node_modules/babel-jest"},"transformIgnorePatterns":["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$","^.+\\.module\\.(css|sass|scss)$"],"modulePaths":[],"moduleNameMapper":{"^react-native$":"react-native-web","^.+\\.module\\.(css|sass|scss)$":"identity-obj-proxy","\\.(jpg|jpeg|png)$":"identity-obj-proxy"},"moduleFileExtensions":["web.js","js","web.ts","ts","web.tsx","tsx","json","web.jsx","jsx","node"]},"babel":{"presets":["react-app"],"plugins":["@babel/plugin-syntax-dynamic-import"]},"eslintConfig":{"env":{"browser":true,"jest":true,"node":true,"es6":true},"extends":["eslint:recommended","plugin:react/recommended","plugin:jsx-a11y/recommended"],"parser":"@babel/eslint-parser","parserOptions":{"babelOptions":{"presets":[["babel-preset-react-app",false],"babel-preset-react-app/test"]},"ecmaFeatures":{"experimentalObjectRestSpread":true,"jsx":true},"sourceType":"module"},"plugins":["prettier","react","import","react-hooks","jsx-a11y"],"rules":{"no-console":"warn","no-unused-vars":"error","react/display-name":"off","react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","no-use-before-define":"error"}},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"src/**/*.{js,css}":["prettier --write","git add","yarn lint"]},"prettier":{"endOfLine":"lf","useTabs":false,"printWidth":100,"tabWidth":2,"singleQuote":true,"trailingComma":"all","bracketSameLine":false,"bracketSpacing":true,"parser":"babel","semi":true,"arrowParens":"avoid"}};
9191
9191
 
9192
9192
  /***/ }),
9193
9193
  /* 167 */
@@ -56138,8 +56138,8 @@ var innerPalette = {
56138
56138
  primaryMain: '#0549ab',
56139
56139
  primaryLight: '#007bc7',
56140
56140
  primaryDark: '#0549ab',
56141
- hover: 'rgba(14, 144, 224, 0.13)',
56142
- selected: 'rgba(14, 144, 224, 0.25)',
56141
+ hover: 'rgba(14, 144, 224, 0.13) !important',
56142
+ selected: 'rgba(14, 144, 224, 0.25) !important',
56143
56143
  textLight: '#444444',
56144
56144
  textDark: '#182026'
56145
56145
  };
@@ -56173,6 +56173,13 @@ var sisccTheme = function sisccTheme(_ref) {
56173
56173
  return {
56174
56174
  direction: rtl,
56175
56175
  components: {
56176
+ MuiCssBaseline: {
56177
+ styleOverrides: {
56178
+ body: {
56179
+ fontSize: '0.875rem'
56180
+ }
56181
+ }
56182
+ },
56176
56183
  MuiButtonBase: {
56177
56184
  defaultProps: {
56178
56185
  disableRipple: true
@@ -56242,11 +56249,14 @@ var sisccTheme = function sisccTheme(_ref) {
56242
56249
  styleOverrides: {
56243
56250
  root: {
56244
56251
  color: outerPalette.primaryMain || innerPalette.primaryMain,
56245
- '&$selected': {
56246
- backgroundColor: outerPalette.hover || innerPalette.hover,
56247
- '&:hover': {
56248
- backgroundColor: outerPalette.selected || innerPalette.selected
56249
- }
56252
+ '&.Mui-selected': {
56253
+ backgroundColor: outerPalette.hover || innerPalette.hover
56254
+ },
56255
+ '&:hover': {
56256
+ backgroundColor: outerPalette.hover || innerPalette.hover
56257
+ },
56258
+ '&.Mui-selected:hover': {
56259
+ backgroundColor: outerPalette.selected || innerPalette.selected
56250
56260
  }
56251
56261
  }
56252
56262
  }
@@ -56273,7 +56283,8 @@ var sisccTheme = function sisccTheme(_ref) {
56273
56283
  root: {
56274
56284
  color: outerPalette.primaryMain || innerPalette.primaryMain,
56275
56285
  '&:hover': {
56276
- color: outerPalette.primaryLight || innerPalette.primaryLight
56286
+ color: outerPalette.primaryLight || innerPalette.primaryLight,
56287
+ textDecoration: 'underline'
56277
56288
  },
56278
56289
  '&.Mui-focused': isA11y && focus
56279
56290
  },
@@ -56493,7 +56504,7 @@ var sisccTheme = function sisccTheme(_ref) {
56493
56504
  typography: {
56494
56505
  fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
56495
56506
  h6: {
56496
- fontSize: ' 1.0625rem'
56507
+ fontSize: '1.0625rem'
56497
56508
  },
56498
56509
  body1: {
56499
56510
  fontSize: '0.750rem',
@@ -61237,8 +61248,9 @@ var PeriodPicker_Period = function Period(_ref) {
61237
61248
  material_Grid_Grid,
61238
61249
  { item: true, xs: 12, className: classes.sideLabel },
61239
61250
  react_default.a.createElement(
61240
- 'span',
61251
+ material_Typography_Typography,
61241
61252
  {
61253
+ variant: 'body2',
61242
61254
  tabIndex: 0 // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
61243
61255
  , 'aria-label': label
61244
61256
  },
@@ -79530,7 +79542,8 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
79530
79542
  _ref$depth = _ref.depth,
79531
79543
  depth = _ref$depth === undefined ? 0 : _ref$depth,
79532
79544
  eventsListeners = _ref.eventsListeners,
79533
- expanded = _ref.expanded;
79545
+ expanded = _ref.expanded,
79546
+ highlightedLabel = _ref.highlightedLabel;
79534
79547
 
79535
79548
  var _useKeyboardEscapeHan = useKeybordEscapeHandler(),
79536
79549
  open = _useKeyboardEscapeHan.open,
@@ -79538,6 +79551,7 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
79538
79551
 
79539
79552
  var padding = depth * 30 + (depth > 0 && !hasChildrenOnLevel ? 30 : 0) + (!hasChild && hasChildrenOnLevel ? 30 : 0);
79540
79553
 
79554
+ var formattedLabel = highlightedLabel ? react_default.a.createElement('div', { dangerouslySetInnerHTML: { __html: highlightedLabel } }) : label;
79541
79555
  return react_default.a.createElement(
79542
79556
  material_ListItem_ListItem,
79543
79557
  {
@@ -79639,7 +79653,7 @@ var VirtualizedTree_Item_Item = function Item(_ref) {
79639
79653
  variant: 'body2',
79640
79654
  className: classnames_default()(classes.label, (_cx5 = {}, _cx5[classes.disabledLabel] = isGreyed, _cx5[classes.tooltipNotice] = !es_isEmpty(description), _cx5))
79641
79655
  },
79642
- label
79656
+ formattedLabel
79643
79657
  )
79644
79658
  ),
79645
79659
  es_not(es_isNil(count)) && react_default.a.createElement(
@@ -79681,7 +79695,8 @@ VirtualizedTree_Item_Item.propTypes = {
79681
79695
  depth: prop_types_default.a.number,
79682
79696
  eventsListeners: prop_types_default.a.object,
79683
79697
  isGreyed: prop_types_default.a.bool,
79684
- expanded: prop_types_default.a.bool
79698
+ expanded: prop_types_default.a.bool,
79699
+ highlightedLabel: prop_types_default.a.string
79685
79700
  };
79686
79701
 
79687
79702
  /* harmony default export */ var VirtualizedTree_Item = (VirtualizedTree_Item_Item);
@@ -80757,31 +80772,47 @@ var withSpotlight_spotlightFilter = function spotlightFilter(term) {
80757
80772
  }
80758
80773
  return acc;
80759
80774
  };
80775
+ var matchRegExp = function matchRegExp(str) {
80776
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
80777
+ };
80778
+
80779
+ // Highlight matching terms in the label
80780
+ var highlightLabel = function highlightLabel(label) {
80781
+ var regex = new RegExp('(' + matchRegExp(term) + ')', 'gi');
80782
+ return label.replace(regex, function (match) {
80783
+ return '<span style=background-color:yellow;border-bottom:2px solid #8CC841>' + match + '</span>';
80784
+ });
80785
+ };
80760
80786
 
80761
80787
  var recurse = function recurse(item) {
80762
- var isValidItem = es_includes(es_toLower(term), es_toLower(labelRenderer(item)));
80788
+ var label = labelRenderer(item);
80789
+ var isValidItem = es_includes(es_toLower(term), es_toLower(label));
80763
80790
 
80764
80791
  var result = [];
80765
80792
 
80766
80793
  if (isValidItem) {
80794
+ var highlightedLabel = highlightLabel(label);
80795
+ console.log(highlightedLabel);
80767
80796
  var parents = findParents(item);
80768
- result = [].concat(parents, [item]);
80797
+ result = [].concat(parents, [withSpotlight_extends({}, item, { highlightedLabel: highlightedLabel })]);
80798
+
80769
80799
  if (displayChildren) {
80770
80800
  var children = utils_getDescendants(es_prop('id', item), groupedItemsByParentId);
80771
- return [].concat(parents, [item], children);
80801
+ return [].concat(parents, [withSpotlight_extends({}, item, { highlightedLabel: highlightedLabel })], children);
80772
80802
  }
80773
80803
  }
80804
+
80774
80805
  if (es_has(utils_getHierarchicalId(item), groupedItemsByParentId)) {
80775
80806
  var childItems = groupedItemsByParentId[utils_getHierarchicalId(item)] || [];
80776
80807
  var matchingChildren = es_chain(recurse, childItems);
80777
80808
 
80778
80809
  // res with any matching children
80779
- return es_uniq([].concat(result, matchingChildren));
80810
+ return es_uniqBy(es_prop('id'), [].concat(result, matchingChildren));
80780
80811
  }
80781
80812
  return result;
80782
80813
  };
80783
80814
 
80784
- return es_uniq(es_chain(recurse, groupedItemsByParentId['#ROOT'] || []));
80815
+ return es_uniqBy(es_prop('id'))(es_chain(recurse, groupedItemsByParentId['#ROOT'] || []));
80785
80816
  };
80786
80817
  };
80787
80818