@politicalwatch/tipi-uikit 1.7.10 → 1.7.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@politicalwatch/tipi-uikit",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "main": "src/components/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -406,6 +406,7 @@ class d3barchart extends d3chart {
406
406
  .attr('height', 0)
407
407
  .attr('width', 0)
408
408
  .on('mouseover', (d, i) => {
409
+ console.log('cfg in barchart', this.cfg);
409
410
  console.log('MOUSEOVER in barchart', d);
410
411
  const key = this.cfg.values[i % this.cfg.values.length];
411
412
  const label = this.cfg.tooltip.suffixPlural
@@ -424,10 +425,10 @@ class d3barchart extends d3chart {
424
425
  .on('mouseout', () => {
425
426
  this.tooltip.classed('active', false);
426
427
  })
427
- .on('mousemove', () => {
428
+ .on('mousemove', (event) => {
428
429
  this.tooltip
429
- .style('left', window.event['pageX'] - 28 + 'px')
430
- .style('top', window.event['pageY'] - 40 + 'px');
430
+ .style('left', event['pageX'] - 28 + 'px')
431
+ .style('top', event['pageY'] - 40 + 'px');
431
432
  });
432
433
  }
433
434
 
@@ -256,8 +256,9 @@ class d3sunburst extends d3chart {
256
256
  .attr('class', 'chart__slice chart__slice--sunburst')
257
257
  .style('fill', (d) => this.colorElement(d.data))
258
258
  .on('mouseover', (d) => {
259
+ console.log('MOUSEOVER in sunburst', d);
259
260
  const label = this.cfg.tooltip.suffixPlural
260
- ? pluralize(this.cfg.tooltip.suffix, d.value)
261
+ ? pluralize(this.cfg.tooltip.suffix, d.target.__data__.data.value)
261
262
  : this.cfg.tooltip.suffix;
262
263
  const text = this.cfg.tooltip.suffix
263
264
  ? `<div>${d.target.__data__.data[this.cfg.key]}: ${d.target.__data__.data.value} ${label}</div>`
@@ -258,22 +258,21 @@ class d3wordscloud extends d3chart {
258
258
  .attr('fill', (d) => d.color)
259
259
  .attr('transform', (d) => `translate(${[d.x, d.y]})rotate(${d.rotate})`)
260
260
  .on('mouseover', (d) => {
261
- console.log('MOUSEOVER in wordscoud', d);
262
261
  const label = this.cfg.tooltip.suffixPlural
263
- ? pluralize(this.cfg.tooltip.suffix, d.value)
262
+ ? pluralize(this.cfg.tooltip.suffix, d.target.__data__.value)
264
263
  : this.cfg.tooltip.suffix;
265
264
  const text = this.cfg.tooltip.suffix
266
- ? `<div>${d.text}: ${d.value} ${label}</div>`
267
- : `<div>${d.text}: ${d.value}</div>`;
265
+ ? `<div>${d.target.__data__.text}: ${d.target.__data__.value} ${label}</div>`
266
+ : `<div>${d.target.__data__.text}: ${d.target.__data__.value}</div>`;
268
267
  this.tooltip.html(text).classed('active', true);
269
268
  })
270
269
  .on('mouseout', () => {
271
270
  this.tooltip.classed('active', false);
272
271
  })
273
- .on('mousemove', () => {
272
+ .on('mousemove', (event) => {
274
273
  this.tooltip
275
- .style('left', window.event['pageX'] - 28 + 'px')
276
- .style('top', window.event['pageY'] - 40 + 'px');
274
+ .style('left', event['pageX'] - 28 + 'px')
275
+ .style('top', event['pageY'] - 40 + 'px');
277
276
  })
278
277
  .text((d) => d.text);
279
278
  }