@icij/murmur-next 4.0.1 → 4.0.4

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.
Files changed (62) hide show
  1. package/lib/components/AccordionStep.vue +53 -42
  2. package/lib/components/AccordionWrapper.vue +25 -24
  3. package/lib/components/ActiveTextTruncate.vue +44 -22
  4. package/lib/components/AdvancedLinkForm.vue +96 -46
  5. package/lib/components/Brand.vue +30 -23
  6. package/lib/components/BrandExpansion.vue +12 -3
  7. package/lib/components/ConfirmButton.vue +30 -26
  8. package/lib/components/ContentPlaceholder.vue +11 -7
  9. package/lib/components/CustomPagination.vue +50 -32
  10. package/lib/components/DigitsInput.vue +64 -60
  11. package/lib/components/DonateForm.vue +112 -83
  12. package/lib/components/EmbedForm.vue +37 -21
  13. package/lib/components/EmbeddableFooter.vue +14 -10
  14. package/lib/components/FollowUsPopover.vue +42 -40
  15. package/lib/components/GenericFooter.vue +98 -23
  16. package/lib/components/GenericHeader.vue +66 -29
  17. package/lib/components/HapticCopy.vue +41 -29
  18. package/lib/components/ImddbHeader.vue +113 -92
  19. package/lib/components/OrdinalLegend.vue +43 -20
  20. package/lib/components/RangePicker.vue +63 -42
  21. package/lib/components/ResponsiveIframe.vue +9 -2
  22. package/lib/components/ScaleLegend.vue +56 -18
  23. package/lib/components/SecretInput.vue +7 -8
  24. package/lib/components/SelectableDropdown.vue +120 -74
  25. package/lib/components/SharingOptions.vue +93 -36
  26. package/lib/components/SharingOptionsLink.vue +11 -5
  27. package/lib/components/SignUpForm.vue +44 -23
  28. package/lib/components/SlideUpDown.vue +7 -2
  29. package/lib/components/TexturedDeck.vue +24 -14
  30. package/lib/components/TinyPagination.vue +35 -22
  31. package/lib/composables/chart.ts +174 -157
  32. package/lib/composables/resizeObserver.ts +29 -29
  33. package/lib/composables/sendEmail.ts +53 -42
  34. package/lib/config.default.ts +17 -10
  35. package/lib/config.ts +34 -27
  36. package/lib/datavisualisations/BarChart.vue +48 -42
  37. package/lib/datavisualisations/ColumnChart.vue +133 -89
  38. package/lib/datavisualisations/LineChart.vue +79 -57
  39. package/lib/datavisualisations/StackedBarChart.vue +116 -68
  40. package/lib/datavisualisations/StackedColumnChart.vue +196 -115
  41. package/lib/enums.ts +25 -15
  42. package/lib/i18n.ts +3 -3
  43. package/lib/keys.ts +2 -2
  44. package/lib/main.ts +14 -10
  45. package/lib/maps/ChoroplethMap.vue +299 -160
  46. package/lib/maps/ChoroplethMapAnnotation.vue +29 -18
  47. package/lib/maps/SymbolMap.vue +194 -123
  48. package/lib/shims-bootstrap-vue.d.ts +1 -1
  49. package/lib/shims-vue.d.ts +3 -3
  50. package/lib/styles/functions.scss +10 -6
  51. package/lib/styles/lib.scss +2 -4
  52. package/lib/styles/mixins.scss +8 -8
  53. package/lib/styles/utilities.scss +1 -1
  54. package/lib/styles/variables.scss +24 -18
  55. package/lib/types.ts +26 -10
  56. package/lib/utils/animation.ts +4 -4
  57. package/lib/utils/assets.ts +31 -28
  58. package/lib/utils/clipboard.ts +16 -10
  59. package/lib/utils/iframe-resizer.ts +18 -13
  60. package/lib/utils/placeholder.ts +54 -23
  61. package/lib/utils/placeholderTypes.ts +3 -3
  62. package/package.json +7 -2
@@ -1,13 +1,20 @@
1
-
2
1
  <script lang="ts">
3
2
  import * as d3 from 'd3'
4
3
  import isFunction from 'lodash/isFunction'
5
4
  import identity from 'lodash/identity'
6
- import {chartProps, getChartProps, useChart} from "@/composables/chart.js"
7
- import {computed, ref, defineComponent, watchEffect, ComponentPublicInstance, toRaw} from 'vue'
5
+ import { chartProps, getChartProps, useChart } from '@/composables/chart.js'
6
+ import {
7
+ computed,
8
+ ref,
9
+ defineComponent,
10
+ watchEffect,
11
+ ComponentPublicInstance,
12
+ toRaw
13
+ } from 'vue'
8
14
 
9
15
  // Call the first argument if it's a function, or return it
10
- const castCall = (fnOrValue = identity, ...rest) => (isFunction(fnOrValue) ? fnOrValue(...rest) : fnOrValue)
16
+ const castCall = (fnOrValue = identity, ...rest) =>
17
+ isFunction(fnOrValue) ? fnOrValue(...rest) : fnOrValue
11
18
 
12
19
  export default defineComponent({
13
20
  name: 'LineChart',
@@ -55,7 +62,7 @@ export default defineComponent({
55
62
  */
56
63
  yAxisTickFormat: {
57
64
  type: [Function, String],
58
- default: ()=>identity
65
+ default: () => identity
59
66
  },
60
67
  /**
61
68
  * Argument for y-axis ticks
@@ -74,22 +81,22 @@ export default defineComponent({
74
81
  },
75
82
  ...chartProps()
76
83
  },
77
- setup(props,{emit}){
78
- const width =ref(0)
79
- const height= ref(0)
80
- const el= ref<ComponentPublicInstance<HTMLElement> | null>(null)
81
- const line= ref<d3.Line<[number,number]>|null>(null)
84
+ setup(props, { emit }) {
85
+ const width = ref(0)
86
+ const height = ref(0)
87
+ const el = ref<ComponentPublicInstance<HTMLElement> | null>(null)
88
+ const line = ref<d3.Line<[number, number]> | null>(null)
82
89
  const isLoaded = ref(false)
83
90
 
84
- const {loadedData,
91
+ const {
92
+ loadedData,
85
93
  elementsMaxBBox,
86
94
  d3Formatter,
87
95
  xAxisYearFormat,
88
96
  baseHeightRatio
89
- } = useChart(el,getChartProps(props),{emit},isLoaded,setSizes)
90
-
97
+ } = useChart(el, getChartProps(props), { emit }, isLoaded, setSizes)
91
98
 
92
- const labelWidth = computed(()=> {
99
+ const labelWidth = computed(() => {
93
100
  if (props.fixedLabelWidth) {
94
101
  return props.fixedLabelWidth
95
102
  }
@@ -97,63 +104,74 @@ export default defineComponent({
97
104
  const defaultWidth = 100
98
105
  return elementsMaxBBox({ selector, defaultWidth }).width
99
106
  })
100
- const labelHeight = computed(()=> {
107
+ const labelHeight = computed(() => {
101
108
  const selector = '.line-chart__axis--y .tick'
102
109
  const defaultHeight = 10
103
110
  return elementsMaxBBox({ selector, defaultHeight }).height
104
111
  })
105
- const bucketHeight = computed(()=> {
112
+ const bucketHeight = computed(() => {
106
113
  const selector = '.line-chart__axis--x .tick'
107
114
  const defaultHeight = 10
108
115
  return elementsMaxBBox({ selector, defaultHeight }).height
109
116
  })
110
- const bucketWidth = computed(()=> {
117
+ const bucketWidth = computed(() => {
111
118
  const selector = '.line-chart__axis--x .tick text'
112
119
  const defaultWidth = 0
113
120
  return elementsMaxBBox({ selector, defaultWidth }).width
114
121
  })
115
- const scale = computed(()=> {
122
+ const scale = computed(() => {
116
123
  return {
117
124
  x: d3.scaleTime().range([0, padded.value.width]),
118
125
  y: d3.scaleLinear().range([padded.value.height, 0])
119
126
  }
120
127
  })
121
- const margin = computed(()=> {
128
+ const margin = computed(() => {
122
129
  const left = labelWidth.value + 10
123
130
  const right = bucketWidth.value / 2
124
131
  const top = labelHeight.value
125
132
  const bottom = bucketHeight.value + 10
126
133
  return { left, right, top, bottom }
127
134
  })
128
- const padded = computed(()=> {
135
+ const padded = computed(() => {
129
136
  const widthP = width.value - margin.value.left - margin.value.right
130
137
  const heightP = height.value - margin.value.top - margin.value.bottom
131
- return { width:widthP, height:heightP }
138
+ return { width: widthP, height: heightP }
132
139
  })
133
- const formattedData = computed(()=> {
134
- if (!loadedData.value) {
135
- return []
136
- }
137
- return loadedData.value.map(d => {
140
+ const formattedData = computed(() => {
141
+ if (!loadedData.value) {
142
+ return []
143
+ }
144
+ return loadedData.value.map((d) => {
138
145
  // toRaw prevent modifying the Proxy object created with the props.data
139
146
  let rawD = toRaw(d)
140
147
  rawD[props.timeseriesKey] = parseTime(d[props.timeseriesKey])
141
- rawD[props.seriesName]= +d[props.seriesName]
148
+ rawD[props.seriesName] = +d[props.seriesName]
142
149
  return rawD
143
- });
150
+ })
144
151
  })
145
- const createLine = d3.line().x((d) => d.x).y((d) => d.y)
152
+ const createLine = d3
153
+ .line()
154
+ .x((d) => d.x)
155
+ .y((d) => d.y)
146
156
 
147
157
  const parseTime = d3.timeParse('%Y')
148
158
  function setSizes() {
149
- if(el.value){
159
+ if (el.value) {
150
160
  width.value = el.value.offsetWidth
151
- height.value = props.fixedHeight !== null ? props.fixedHeight : el.value.offsetWidth * baseHeightRatio.value
161
+ height.value =
162
+ props.fixedHeight !== null
163
+ ? props.fixedHeight
164
+ : el.value.offsetWidth * baseHeightRatio.value
152
165
  }
153
166
  }
154
167
  function update() {
155
- scale.value.x.domain(d3.extent(formattedData.value, d => d[props.timeseriesKey]))
156
- scale.value.y.domain([0, d3.max(formattedData.value, (d) => d[props.seriesName])])
168
+ scale.value.x.domain(
169
+ d3.extent(formattedData.value, (d) => d[props.timeseriesKey])
170
+ )
171
+ scale.value.y.domain([
172
+ 0,
173
+ d3.max(formattedData.value, (d) => d[props.seriesName])
174
+ ])
157
175
 
158
176
  const points = formattedData.value.map((d) => {
159
177
  return {
@@ -164,24 +182,23 @@ export default defineComponent({
164
182
 
165
183
  line.value = createLine(points)
166
184
  d3.select(el.value)
167
- .select('.line-chart__axis--x')
168
- .call(
169
- d3.axisBottom(scale.value.x)
170
- .ticks(props.xAxisTicks)
171
- .tickFormat((d) => castCall(xAxisYearFormat, d.getFullYear()))
172
- )
185
+ .select('.line-chart__axis--x')
186
+ .call(
187
+ d3
188
+ .axisBottom(scale.value.x)
189
+ .ticks(props.xAxisTicks)
190
+ .tickFormat((d) => castCall(xAxisYearFormat, d.getFullYear()))
191
+ )
173
192
  d3.select(el.value)
174
- .select('.line-chart__axis--y')
175
- .call(
176
- d3.axisLeft(scale.value.y)
177
- .tickFormat((d) => d3Formatter(d, props.yAxisTickFormat))
178
- .ticks(props.yAxisTicks)
179
- )
180
- .selectAll('.tick line')
181
- .attr('x2', padded.value.width)
182
-
183
-
184
-
193
+ .select('.line-chart__axis--y')
194
+ .call(
195
+ d3
196
+ .axisLeft(scale.value.y)
197
+ .tickFormat((d) => d3Formatter(d, props.yAxisTickFormat))
198
+ .ticks(props.yAxisTicks)
199
+ )
200
+ .selectAll('.tick line')
201
+ .attr('x2', padded.value.width)
185
202
  }
186
203
  // function initialize() {
187
204
  // d3.axisBottom().scale(scale.value.x)
@@ -203,8 +220,8 @@ export default defineComponent({
203
220
  // watch(labelHeight,()=> {
204
221
  // update()
205
222
  // })
206
- watchEffect(()=> {
207
- update()
223
+ watchEffect(() => {
224
+ update()
208
225
  })
209
226
  return {
210
227
  el,
@@ -218,19 +235,24 @@ export default defineComponent({
218
235
  })
219
236
  </script>
220
237
  <template>
221
- <div ref="el" class="line-chart" :style="{ '--line-color': lineColor }" :class="{ 'line-chart--social-mode': socialMode }">
238
+ <div
239
+ ref="el"
240
+ class="line-chart"
241
+ :style="{ '--line-color': lineColor }"
242
+ :class="{ 'line-chart--social-mode': socialMode }"
243
+ >
222
244
  <svg :width="width" :height="height">
223
245
  <g
224
- class="line-chart__axis line-chart__axis--x"
225
- :style="{
246
+ class="line-chart__axis line-chart__axis--x"
247
+ :style="{
226
248
  transform: `translate(${margin.left}px, ${margin.top + padded.height}px)`
227
249
  }"
228
250
  >
229
251
  >
230
252
  </g>
231
253
  <g
232
- class="line-chart__axis line-chart__axis--y"
233
- :style="{ transform: `translate(${margin.left}px, ${margin.top}px)` }"
254
+ class="line-chart__axis line-chart__axis--y"
255
+ :style="{ transform: `translate(${margin.left}px, ${margin.top}px)` }"
234
256
  >
235
257
  >
236
258
  </g>
@@ -7,9 +7,17 @@ import kebabCase from 'lodash/kebabCase'
7
7
  import keys from 'lodash/keys'
8
8
  import without from 'lodash/without'
9
9
  import sortBy from 'lodash/sortBy'
10
- import {ComponentPublicInstance, computed, defineComponent, nextTick, PropType, ref, watch} from 'vue'
11
- import {chartProps, getChartProps, useChart} from "@/composables/chart.js";
12
- import {isArray} from "lodash";
10
+ import {
11
+ ComponentPublicInstance,
12
+ computed,
13
+ defineComponent,
14
+ nextTick,
15
+ PropType,
16
+ ref,
17
+ watch
18
+ } from 'vue'
19
+ import { chartProps, getChartProps, useChart } from '@/composables/chart.js'
20
+ import { isArray } from 'lodash'
13
21
 
14
22
  export default defineComponent({
15
23
  name: 'StackedBarChart',
@@ -134,17 +142,13 @@ export default defineComponent({
134
142
  },
135
143
  ...chartProps()
136
144
  },
137
- setup(props, {emit}) {
145
+ setup(props, { emit }) {
138
146
  const highlightedKeys = ref(props.highlights)
139
147
  const highlightTimeout = ref<NodeJS.Timeout | undefined>(undefined)
140
148
  const isLoaded = ref(false)
141
149
  const el = ref<ComponentPublicInstance<HTMLElement> | null>(null)
142
- const {
143
- loadedData,
144
- baseHeightRatio,
145
- d3Formatter,
146
- dataHasHighlights
147
- } = useChart(el, getChartProps(props), {emit}, isLoaded)
150
+ const { loadedData, baseHeightRatio, d3Formatter, dataHasHighlights } =
151
+ useChart(el, getChartProps(props), { emit }, isLoaded)
148
152
 
149
153
  const hasConstraintHeight = computed(() => {
150
154
  return props.fixedHeight !== null || props.socialMode
@@ -154,7 +158,9 @@ export default defineComponent({
154
158
  if (!isLoaded.value) {
155
159
  return []
156
160
  }
157
- return !props.sortBy ? loadedData.value : sortBy(loadedData.value, props.sortBy)
161
+ return !props.sortBy
162
+ ? loadedData.value
163
+ : sortBy(loadedData.value, props.sortBy)
158
164
  })
159
165
  const discoveredKeys = computed((): any[] => {
160
166
  if (props.keys.length) {
@@ -166,7 +172,10 @@ export default defineComponent({
166
172
  return without(keys(loadedData.value[0]), props.labelField)
167
173
  })
168
174
  const colorScale = computed(() => {
169
- return d3.scaleOrdinal().domain(discoveredKeys.value).range(props.barColors)
175
+ return d3
176
+ .scaleOrdinal()
177
+ .domain(discoveredKeys.value)
178
+ .range(props.barColors)
170
179
  })
171
180
  const maxValue = computed(() => {
172
181
  return d3.max(loadedData.value || [], (datum, i) => {
@@ -183,7 +192,9 @@ export default defineComponent({
183
192
  if (props.fixedHeight !== null) {
184
193
  return `${props.fixedHeight}px`
185
194
  }
186
- return props.socialMode && el.value ? `${el.value.offsetWidth * baseHeightRatio.value}px` : 'auto'
195
+ return props.socialMode && el.value
196
+ ? `${el.value.offsetWidth * baseHeightRatio.value}px`
197
+ : 'auto'
187
198
  })
188
199
 
189
200
  function normalizeKey(key: string) {
@@ -209,7 +220,10 @@ export default defineComponent({
209
220
  clearTimeout(highlightTimeout.value)
210
221
  const delay = props.restoreHighlightDelay
211
222
  // Delay the restoration so it can be cancelled by a new highlight
212
- highlightTimeout.value = setTimeout(() => (highlightedKeys.value = props.highlights), delay)
223
+ highlightTimeout.value = setTimeout(
224
+ () => (highlightedKeys.value = props.highlights),
225
+ delay
226
+ )
213
227
  }
214
228
 
215
229
  function delayHighlight(key: string) {
@@ -226,18 +240,22 @@ export default defineComponent({
226
240
 
227
241
  function isRowHighlighted(i: number | string) {
228
242
  const row = get(sortedData.value, [i, props.labelField], null)
229
- return (isArray(props.rowHighlights) && props.rowHighlights?.includes(row)) && !highlightedKeys.value.length
243
+ return (
244
+ isArray(props.rowHighlights) &&
245
+ props.rowHighlights?.includes(row) &&
246
+ !highlightedKeys.value.length
247
+ )
230
248
  }
231
249
 
232
250
  function barStyle(i: number | string, key: string) {
233
251
  const value = sortedData.value[i][key]
234
252
  const totalWidth = props.relative ? totalRowValue(i) : maxValue.value
235
253
  if (!totalWidth) {
236
- throw new Error("Total width is not correct" + totalWidth)
254
+ throw new Error('Total width is not correct' + totalWidth)
237
255
  }
238
256
  const width = `${100 * (value / totalWidth)}%`
239
257
  const backgroundColor = colorScale.value(key)
240
- return {width, backgroundColor}
258
+ return { width, backgroundColor }
241
259
  }
242
260
 
243
261
  // function barHeightBounds(height:number) {
@@ -250,15 +268,15 @@ export default defineComponent({
250
268
  await nextTick()
251
269
  // Collect sizes first
252
270
  const stack = discoveredKeys.value.map((key: string) => {
253
- const {bar, row, value} = queryBarAndValue(i as number, key)
271
+ const { bar, row, value } = queryBarAndValue(i as number, key)
254
272
  if (!bar || !row || !value) {
255
- throw new Error("Values not retrieved")
273
+ throw new Error('Values not retrieved')
256
274
  }
257
275
  const barEdge = bar.getBoundingClientRect().left + bar.offsetWidth
258
276
  const barWidth = bar.offsetWidth
259
277
  const rowEdge = row.getBoundingClientRect().left + row.offsetWidth
260
278
  const valueWidth = value.offsetWidth
261
- return {key, barEdge, barWidth, rowEdge, valueWidth}
279
+ return { key, barEdge, barWidth, rowEdge, valueWidth }
262
280
  })
263
281
  // Infer value's display
264
282
  return stack.map((desc, index) => {
@@ -266,9 +284,12 @@ export default defineComponent({
266
284
  if (index > 0) {
267
285
  const prevDesc = stack[index - 1]
268
286
  const bothValuesWidth = desc.valueWidth + prevDesc.valueWidth
269
- desc.overflow = desc.overflow || (prevDesc.overflow && desc.barWidth < bothValuesWidth)
287
+ desc.overflow =
288
+ desc.overflow ||
289
+ (prevDesc.overflow && desc.barWidth < bothValuesWidth)
270
290
  }
271
- desc.pushed = desc.barEdge + desc.valueWidth > desc.rowEdge && desc.overflow
291
+ desc.pushed =
292
+ desc.barEdge + desc.valueWidth > desc.rowEdge && desc.overflow
272
293
  return desc
273
294
  })
274
295
  }
@@ -285,17 +306,17 @@ export default defineComponent({
285
306
  const bar = row?.querySelector(barSelector) as HTMLElement
286
307
  const valueSelector = `.${barClass}__value`
287
308
  const value = bar?.querySelector(valueSelector) as HTMLElement
288
- return {bar, row, value}
309
+ return { bar, row, value }
289
310
  }
290
311
 
291
- async function hasValueOverflow(i: number | string, key: string) {
292
- const stack = await stackBarAndValue(i)
293
- return get(find(stack, {key}), 'overflow')
312
+ async function hasValueOverflow(i: number | string, key: string) {
313
+ const stack = await stackBarAndValue(i)
314
+ return get(find(stack, { key }), 'overflow')
294
315
  }
295
316
 
296
317
  async function hasValuePushed(i: number | string, key: string) {
297
318
  const stack = await stackBarAndValue(i)
298
- return get(find(stack, {key}), 'pushed')
319
+ return get(find(stack, { key }), 'pushed')
299
320
  }
300
321
 
301
322
  async function hasValueHidden(i: number | string, key: string) {
@@ -339,9 +360,12 @@ export default defineComponent({
339
360
  return d3Formatter(d, props.xAxisTickFormat)
340
361
  }
341
362
 
342
- watch(() => props.highlights, (newHighlights) => {
343
- highlightedKeys.value = newHighlights
344
- })
363
+ watch(
364
+ () => props.highlights,
365
+ (newHighlights) => {
366
+ highlightedKeys.value = newHighlights
367
+ }
368
+ )
345
369
 
346
370
  return {
347
371
  colorScale,
@@ -367,7 +391,6 @@ export default defineComponent({
367
391
  normalizeKey,
368
392
  restoreHighlights
369
393
  }
370
-
371
394
  }
372
395
 
373
396
  // watch: {
@@ -387,69 +410,87 @@ export default defineComponent({
387
410
  // }
388
411
  // }
389
412
  // },
390
-
391
413
  })
392
414
  </script>
393
415
  <template>
394
416
  <div
395
- ref="el"
396
- :class="{
417
+ ref="el"
418
+ :class="{
397
419
  'stacked-bar-chart--social-mode': socialMode,
398
420
  'stacked-bar-chart--label-above': labelAbove,
399
- 'stacked-bar-chart--has-highlights': hasHighlights || hasRowHighlights || dataHasHighlights,
421
+ 'stacked-bar-chart--has-highlights':
422
+ hasHighlights || hasRowHighlights || dataHasHighlights,
400
423
  'stacked-bar-chart--has-constraint-height': hasConstraintHeight,
401
424
  'stacked-bar-chart--has-label-above': labelAbove
402
425
  }"
403
- :style="{ height }"
404
- class="stacked-bar-chart d-flex flex-column"
426
+ :style="{ height }"
427
+ class="stacked-bar-chart d-flex flex-column"
405
428
  >
406
429
  <div class="d-flex align-items-center">
407
430
  <slot name="header-left">
408
- <ul v-if="!hideLegend" class="stacked-bar-chart__legend list-inline mx-0 mt-0 mb-2">
431
+ <ul
432
+ v-if="!hideLegend"
433
+ class="stacked-bar-chart__legend list-inline mx-0 mt-0 mb-2"
434
+ >
409
435
  <li
410
- v-for="key in discoveredKeys"
411
- :key="key"
412
- :class="{
436
+ v-for="key in discoveredKeys"
437
+ :key="key"
438
+ :class="{
413
439
  'stacked-bar-chart__legend__item--highlighted': isHighlighted(key)
414
440
  }"
415
- class="stacked-bar-chart__legend__item list-inline-item d-inline-flex"
416
- @mouseleave="restoreHighlights()"
417
- @mouseover="delayHighlight(key)"
441
+ class="stacked-bar-chart__legend__item list-inline-item d-inline-flex"
442
+ @mouseleave="restoreHighlights()"
443
+ @mouseover="delayHighlight(key)"
418
444
  >
419
- <span :style="{ 'background-color': colorScale(key) }" class="stacked-bar-chart__legend__item__box"/>
445
+ <span
446
+ :style="{ 'background-color': colorScale(key) }"
447
+ class="stacked-bar-chart__legend__item__box"
448
+ />
420
449
  {{ groupName(key) }}
421
450
  </li>
422
451
  </ul>
423
452
  </slot>
424
- <slot name="header-right"/>
453
+ <slot name="header-right" />
425
454
  </div>
426
455
  <div class="stacked-bar-chart__groups">
427
456
  <div
428
- v-for="(datum, i) in sortedData"
429
- :key="i"
430
- :class="{ 'flex-column': labelAbove }"
431
- class="stacked-bar-chart__groups__item border-bottom flex-fill d-flex align-items-center"
457
+ v-for="(datum, i) in sortedData"
458
+ :key="i"
459
+ :class="{ 'flex-column': labelAbove }"
460
+ class="stacked-bar-chart__groups__item border-bottom flex-fill d-flex align-items-center"
432
461
  >
433
- <div :class="{ 'w-100': labelAbove }" class="stacked-bar-chart__groups__item__label me-1 small">
462
+ <div
463
+ :class="{ 'w-100': labelAbove }"
464
+ class="stacked-bar-chart__groups__item__label me-1 small"
465
+ >
434
466
  {{ datum[labelField] }}
435
467
  </div>
436
- <div class="stacked-bar-chart__groups__item__bars my-1 d-flex flex-grow-1 align-items-center">
468
+ <div
469
+ class="stacked-bar-chart__groups__item__bars my-1 d-flex flex-grow-1 align-items-center"
470
+ >
437
471
  <div
438
- v-for="(key, j) in discoveredKeys"
439
- :key="j"
440
- :class="{
472
+ v-for="(key, j) in discoveredKeys"
473
+ :key="j"
474
+ :class="{
441
475
  [`stacked-bar-chart__groups__item__bars__item--${normalizeKey(key)}`]: true,
442
476
  [`stacked-bar-chart__groups__item__bars__item--${j}n`]: true,
443
- 'stacked-bar-chart__groups__item__bars__item--highlighted': isHighlighted(key) || isRowHighlighted(i),
444
- 'stacked-bar-chart__groups__item__bars__item--hidden': isHidden(i, key),
445
- 'stacked-bar-chart__groups__item__bars__item--value-overflow': hasValueOverflow(i, key),
446
- 'stacked-bar-chart__groups__item__bars__item--value-pushed': hasValuePushed(i, key),
447
- 'stacked-bar-chart__groups__item__bars__item--value-hidden': hasValueHidden(i, key)
477
+ 'stacked-bar-chart__groups__item__bars__item--highlighted':
478
+ isHighlighted(key) || isRowHighlighted(i),
479
+ 'stacked-bar-chart__groups__item__bars__item--hidden': isHidden(
480
+ i,
481
+ key
482
+ ),
483
+ 'stacked-bar-chart__groups__item__bars__item--value-overflow':
484
+ hasValueOverflow(i, key),
485
+ 'stacked-bar-chart__groups__item__bars__item--value-pushed':
486
+ hasValuePushed(i, key),
487
+ 'stacked-bar-chart__groups__item__bars__item--value-hidden':
488
+ hasValueHidden(i, key)
448
489
  }"
449
- :style="barStyle(i, key)"
450
- class="stacked-bar-chart__groups__item__bars__item"
451
- @mouseleave="restoreHighlights()"
452
- @mouseover="delayHighlight(key)"
490
+ :style="barStyle(i, key)"
491
+ class="stacked-bar-chart__groups__item__bars__item"
492
+ @mouseleave="restoreHighlights()"
493
+ @mouseover="delayHighlight(key)"
453
494
  >
454
495
  <div class="stacked-bar-chart__groups__item__bars__item__value p-1">
455
496
  {{ formatXDatum(datum[key]) }}
@@ -467,7 +508,9 @@ export default defineComponent({
467
508
  .stacked-bar-chart {
468
509
  $muted-group-opacity: 0.2;
469
510
  $muted-group-filter: grayscale(30%) brightness(10%);
470
- $muted-group-transition: opacity 0.3s, filter 0.3s;
511
+ $muted-group-transition:
512
+ opacity 0.3s,
513
+ filter 0.3s;
471
514
  $colors: $primary, $info, $warning;
472
515
  $quantile: 3;
473
516
 
@@ -541,7 +584,8 @@ export default defineComponent({
541
584
  min-height: calc(100% - 1.5rem);
542
585
  }
543
586
 
544
- .stacked-bar-chart--has-constraint-height.stacked-bar-chart--label-above & {
587
+ .stacked-bar-chart--has-constraint-height.stacked-bar-chart--label-above
588
+ & {
545
589
  height: auto;
546
590
  min-height: auto;
547
591
  }
@@ -581,8 +625,12 @@ export default defineComponent({
581
625
  visibility: hidden;
582
626
  }
583
627
 
584
- .stacked-bar-chart:not(.stacked-bar-chart--has-highlights) &--value-hidden &__value,
585
- .stacked-bar-chart:not(.stacked-bar-chart--has-highlights) &--value-pushed &__value {
628
+ .stacked-bar-chart:not(.stacked-bar-chart--has-highlights)
629
+ &--value-hidden
630
+ &__value,
631
+ .stacked-bar-chart:not(.stacked-bar-chart--has-highlights)
632
+ &--value-pushed
633
+ &__value {
586
634
  visibility: hidden;
587
635
  }
588
636