@politicalwatch/tipi-uikit 1.5.7 → 1.5.9

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.5.7",
3
+ "version": "1.5.9",
4
4
  "main": "src/components/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -3,7 +3,7 @@ import { select, selectAll } from 'd3-selection';
3
3
  import { scaleOrdinal, scaleLinear } from 'd3-scale';
4
4
  import { min, max, extent } from 'd3-array';
5
5
  import { transition } from 'd3-transition';
6
- import * as cloud from 'd3-cloud';
6
+ import { cloud } from 'd3-cloud';
7
7
  import {
8
8
  easeLinear,
9
9
  easePolyIn,
@@ -165,10 +165,10 @@ class d3wordscloud extends d3chart {
165
165
  * Compute data before operate
166
166
  */
167
167
  computeData() {
168
- d3.cloud()
168
+ cloud()
169
169
  .size([this.cfg.width, this.cfg.height])
170
170
  .words(
171
- this.data.map(d => ({
171
+ this.data.map((d) => ({
172
172
  text: d[this.cfg.key],
173
173
  size: d[this.cfg.size],
174
174
  value: d[this.cfg.value],
@@ -177,8 +177,8 @@ class d3wordscloud extends d3chart {
177
177
  )
178
178
  .rotate(() => this.wordsAngle(this.cfg.angle))
179
179
  .font(this.cfg.fontFamily)
180
- .fontSize(d => d.size * this.fontScale)
181
- .on('end', d => {
180
+ .fontSize((d) => d.size * this.fontScale)
181
+ .on('end', (d) => {
182
182
  if (this.data.length !== d.length && this.fontScale > 0) {
183
183
  this.fontScale = this.fontScale - 0.1;
184
184
  this.computeData();
@@ -198,9 +198,9 @@ class d3wordscloud extends d3chart {
198
198
  this.svg
199
199
  .attr(
200
200
  'viewBox',
201
- `0 0 ${this.cfg.width + this.cfg.margin.left + this.cfg.margin.right} ${this.cfg.height +
202
- this.cfg.margin.top +
203
- this.cfg.margin.bottom}`
201
+ `0 0 ${this.cfg.width + this.cfg.margin.left + this.cfg.margin.right} ${
202
+ this.cfg.height + this.cfg.margin.top + this.cfg.margin.bottom
203
+ }`
204
204
  )
205
205
  .attr('width', this.cfg.width + this.cfg.margin.left + this.cfg.margin.right)
206
206
  .attr('height', this.cfg.height + this.cfg.margin.top + this.cfg.margin.bottom);
@@ -224,7 +224,7 @@ class d3wordscloud extends d3chart {
224
224
  .ease(d3[this.cfg.transition.ease]);
225
225
 
226
226
  // Word group selection data
227
- this.wordgroup = this.gcenter.selectAll('.chart__word-group').data(this.tData, d => d.text);
227
+ this.wordgroup = this.gcenter.selectAll('.chart__word-group').data(this.tData, (d) => d.text);
228
228
  }
229
229
 
230
230
  /**
@@ -252,12 +252,12 @@ class d3wordscloud extends d3chart {
252
252
 
253
253
  newwords
254
254
  .append('text')
255
- .style('font-size', d => d.size + 'px')
256
- .style('font-family', d => d.font)
255
+ .style('font-size', (d) => d.size + 'px')
256
+ .style('font-family', (d) => d.font)
257
257
  .attr('text-anchor', 'middle')
258
- .attr('fill', d => d.color)
259
- .attr('transform', d => `translate(${[d.x, d.y]})rotate(${d.rotate})`)
260
- .on('mouseover', d => {
258
+ .attr('fill', (d) => d.color)
259
+ .attr('transform', (d) => `translate(${[d.x, d.y]})rotate(${d.rotate})`)
260
+ .on('mouseover', (d) => {
261
261
  const label = this.cfg.tooltip.suffixPlural
262
262
  ? pluralize(this.cfg.tooltip.suffix, d.value)
263
263
  : this.cfg.tooltip.suffix;
@@ -274,7 +274,7 @@ class d3wordscloud extends d3chart {
274
274
  .style('left', window.event['pageX'] - 28 + 'px')
275
275
  .style('top', window.event['pageY'] - 40 + 'px');
276
276
  })
277
- .text(d => d.text);
277
+ .text((d) => d.text);
278
278
  }
279
279
 
280
280
  /**
@@ -285,11 +285,11 @@ class d3wordscloud extends d3chart {
285
285
 
286
286
  this.wordgroup
287
287
  .selectAll('text')
288
- .data(this.tData, d => d.text)
288
+ .data(this.tData, (d) => d.text)
289
289
  .transition(this.transition)
290
- .attr('fill', d => this.colorElement(d, 'text'))
291
- .style('font-size', d => d.size + 'px')
292
- .attr('transform', d => `translate(${[d.x, d.y]})rotate(${d.rotate})`);
290
+ .attr('fill', (d) => this.colorElement(d, 'text'))
291
+ .style('font-size', (d) => d.size + 'px')
292
+ .attr('transform', (d) => `translate(${[d.x, d.y]})rotate(${d.rotate})`);
293
293
  }
294
294
 
295
295
  /**
@@ -298,11 +298,7 @@ class d3wordscloud extends d3chart {
298
298
  exitElements() {
299
299
  if (!this.renderEnd) return;
300
300
 
301
- this.wordgroup
302
- .exit()
303
- .transition(this.transition)
304
- .style('opacity', 0)
305
- .remove();
301
+ this.wordgroup.exit().transition(this.transition).style('opacity', 0).remove();
306
302
  }
307
303
 
308
304
  /**