@icij/murmur-next 4.0.10 → 4.0.13

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 (52) hide show
  1. package/dist/lib/components/AccordionStep.vue.d.ts +1 -2
  2. package/dist/lib/components/AccordionWrapper.vue.d.ts +1 -2
  3. package/dist/lib/components/AdvancedLinkForm.vue.d.ts +4 -5
  4. package/dist/lib/components/BrandExpansion.vue.d.ts +2 -3
  5. package/dist/lib/components/ConfirmButton.vue.d.ts +1 -2
  6. package/dist/lib/components/ContentPlaceholder.vue.d.ts +2 -3
  7. package/dist/lib/components/CustomPagination.vue.d.ts +5 -6
  8. package/dist/lib/components/DonateForm.vue.d.ts +4 -5
  9. package/dist/lib/components/EmbedForm.vue.d.ts +4 -5
  10. package/dist/lib/components/FollowUsPopover.vue.d.ts +4 -5
  11. package/dist/lib/components/GenericFooter.vue.d.ts +1 -2
  12. package/dist/lib/components/GenericHeader.vue.d.ts +231 -232
  13. package/dist/lib/components/HapticCopy.vue.d.ts +8 -10
  14. package/dist/lib/components/ImddbHeader.vue.d.ts +230 -231
  15. package/dist/lib/components/OrdinalLegend.vue.d.ts +1 -2
  16. package/dist/lib/components/RangePicker.vue.d.ts +2 -3
  17. package/dist/lib/components/ResponsiveIframe.vue.d.ts +2 -4
  18. package/dist/lib/components/ScaleLegend.vue.d.ts +1 -1
  19. package/dist/lib/components/SelectableDropdown.vue.d.ts +3 -3
  20. package/dist/lib/components/SharingOptions.vue.d.ts +1 -2
  21. package/dist/lib/components/SharingOptionsLink.vue.d.ts +1 -2
  22. package/dist/lib/components/SignUpForm.vue.d.ts +5 -6
  23. package/dist/lib/components/SlideUpDown.vue.d.ts +2 -3
  24. package/dist/lib/components/TexturedDeck.vue.d.ts +1 -2
  25. package/dist/lib/components/TinyPagination.vue.d.ts +8 -9
  26. package/dist/lib/composables/chart.d.ts +1 -2
  27. package/dist/lib/composables/resizeObserver.d.ts +1 -2
  28. package/dist/lib/composables/sendEmail.d.ts +1 -2
  29. package/dist/lib/config.d.ts +1 -0
  30. package/dist/lib/datavisualisations/BarChart.vue.d.ts +35 -21
  31. package/dist/lib/datavisualisations/ColumnChart.vue.d.ts +1 -2
  32. package/dist/lib/datavisualisations/LineChart.vue.d.ts +1 -1
  33. package/dist/lib/datavisualisations/StackedBarChart.vue.d.ts +1 -1
  34. package/dist/lib/datavisualisations/StackedColumnChart.vue.d.ts +1 -1
  35. package/dist/lib/i18n.d.ts +1 -0
  36. package/dist/lib/main.d.ts +3 -4
  37. package/dist/lib/maps/ChoroplethMap.vue.d.ts +2 -2
  38. package/dist/lib/maps/SymbolMap.vue.d.ts +1 -2
  39. package/dist/lib/murmur.css +1 -1
  40. package/dist/lib/murmur.js +16466 -13059
  41. package/dist/lib/murmur.js.map +1 -1
  42. package/dist/lib/murmur.umd.cjs +60 -34
  43. package/dist/lib/murmur.umd.cjs.map +1 -1
  44. package/dist/lib/types.d.ts +3 -6
  45. package/dist/lib/utils/assets.d.ts +1 -1
  46. package/dist/lib/utils/iframe-resizer.d.ts +1 -1
  47. package/dist/lib/utils/placeholder.d.ts +1 -0
  48. package/dist/lib/utils/placeholderTypes.d.ts +2 -3
  49. package/lib/components/HapticCopy.vue +1 -1
  50. package/lib/components/SelectableDropdown.vue +24 -18
  51. package/lib/datavisualisations/BarChart.vue +15 -10
  52. package/package.json +1 -1
@@ -1,10 +1,7 @@
1
- /// <reference types="@/shims-vue" />
2
- /// <reference types="node_modules/vue-i18n/dist/vue-i18n" />
3
- import type { StyleValue } from '../node_modules/vue';
1
+ import { StyleValue, ComputedRef, Ref } from '../node_modules/vue';
4
2
  import { AccordionKey, ParentKey } from './keys';
5
- import { ComputedRef } from '../node_modules/vue';
6
- import type { GeoProjection } from 'd3-geo';
7
- import { Ref } from '../node_modules/vue';
3
+ import { GeoProjection } from 'd3-geo';
4
+
8
5
  export type Step = symbol | string;
9
6
  export type Accordion = {
10
7
  emitAccordionNextStepEvent: () => void;
@@ -1,2 +1,2 @@
1
- export declare const injectAsset: ((file: string, id?: string) => Promise<unknown>) & import("lodash").MemoizedFunction;
1
+ export declare const injectAsset: ((file: string, id?: string) => Promise<unknown>) & import('lodash').MemoizedFunction;
2
2
  export declare const injectAssets: (...args: string[]) => Promise<void>;
@@ -1,5 +1,5 @@
1
- /// <reference types="@/shims-pym" />
2
1
  import { Child as PymChild } from 'pym.js';
2
+
3
3
  export default class IframeResizer {
4
4
  initializer: Promise<PymChild>;
5
5
  constructor();
@@ -1,4 +1,5 @@
1
1
  import { BoxStyle, ContentPlaceholderStyledRows, ContentPlaceholderRows } from './placeholderTypes';
2
+
2
3
  export declare function isFlexBasis(value: string | number): boolean;
3
4
  export declare function isWidth(value: string | number): boolean;
4
5
  export declare function getBoxStyle(left: number, width: number, isLast: boolean, subClass?: string): BoxStyle[];
@@ -1,6 +1,5 @@
1
- /// <reference types="@/shims-vue" />
2
- /// <reference types="vue-i18n" />
3
- import type { StyleValue } from '../../node_modules/vue';
1
+ import { StyleValue } from '../../node_modules/vue';
2
+
4
3
  export interface BoxStyle {
5
4
  style: StyleValue;
6
5
  subClass?: string;
@@ -39,7 +39,7 @@ export default defineComponent({
39
39
  * Text to copy to the clipboard
40
40
  */
41
41
  text: {
42
- type: String,
42
+ type: [String, Number],
43
43
  default: null
44
44
  },
45
45
  /**
@@ -7,6 +7,7 @@ import identity from 'lodash/identity'
7
7
  import isEqual from 'lodash/isEqual'
8
8
  import uniqueId from 'lodash/uniqueId'
9
9
  import { faCheckSquare, faSquare } from '@fortawesome/free-regular-svg-icons'
10
+ //@ts-expect-error no typings available
10
11
  import { RecycleScroller } from 'vue-virtual-scroller'
11
12
 
12
13
  import Fa from './Fa'
@@ -132,9 +133,6 @@ export default defineComponent({
132
133
  '--scroller-height': props.scrollerHeight
133
134
  }
134
135
  })
135
- const keyField = computed(() => {
136
- return typeof items_.value[0] === 'string' ? null : 'recycle_scroller_id'
137
- })
138
136
  const items_ = computed((): Item[] => {
139
137
  if (typeof props.items[0] === 'string') {
140
138
  return props.items
@@ -144,6 +142,9 @@ export default defineComponent({
144
142
  recycle_scroller_id: `id-${uniqueId()}`
145
143
  }))
146
144
  })
145
+ const keyField = computed(() => {
146
+ return typeof items_.value[0] === 'string' ? null : 'recycle_scroller_id'
147
+ })
147
148
  const firstActiveItemIndex = computed(() => {
148
149
  return activeItems.value.length
149
150
  ? items_.value.indexOf(activeItems.value[0])
@@ -167,9 +168,19 @@ export default defineComponent({
167
168
  toggleKeys()
168
169
  }
169
170
  )
171
+ watch(
172
+ () => props.modelValue,
173
+ (itemOrItems) => {
174
+ const items = castArray(itemOrItems)
175
+ if (!isEqual(activeItems.value, items)) {
176
+ activateItemOrItems(itemOrItems)
177
+ }
178
+ },
179
+ { deep: true, immediate: true}
180
+ )
170
181
  watch(
171
182
  () => activeItems.value,
172
- () => {
183
+ (itemOrItems) => {
173
184
  /**
174
185
  * Fired when the selected value change. It will pass a canonical value
175
186
  * or an array of values if the property `multiple` is set to true.
@@ -179,18 +190,9 @@ export default defineComponent({
179
190
  */
180
191
  emit(
181
192
  'update:modelValue',
182
- props.multiple ? activeItems.value : activeItems.value[0]
183
- )
184
- },
185
- { deep: true }
186
- )
187
- watch(
188
- () => props.modelValue,
189
- (itemOrItems) => {
190
- const items = castArray(itemOrItems)
191
- if (!isEqual(activeItems.value, items)) {
192
- activateItemOrItems(items)
193
- }
193
+ props.multiple ? itemOrItems : itemOrItems[0]
194
+ )
195
+
194
196
  },
195
197
  { deep: true }
196
198
  )
@@ -251,7 +253,7 @@ export default defineComponent({
251
253
  if (itemActivated(item)) {
252
254
  activeItems.value = filter(activeItems.value, (i) => !props.eq(item, i))
253
255
  } else {
254
- activeItems.value.push(item)
256
+ activeItems.value = [...activeItems.value, item]
255
257
  }
256
258
  }
257
259
  function selectRangeToItem(item: Item) {
@@ -329,6 +331,9 @@ export default defineComponent({
329
331
  function itemId(item: Item) {
330
332
  return `dropdown-item-${item.recycle_scroller_id ?? item.toLowerCase()}`
331
333
  }
334
+ function serialize(item: Item) {
335
+ return props.serializer?.(item)
336
+ }
332
337
 
333
338
  return {
334
339
  cssProps,
@@ -340,6 +345,7 @@ export default defineComponent({
340
345
  clickToAddItem,
341
346
  clickToSelectRangeToItem,
342
347
  indexIcon,
348
+ serialize,
343
349
  scroller,
344
350
  activeItems,
345
351
  itemId
@@ -384,7 +390,7 @@ export default defineComponent({
384
390
  >
385
391
  <!-- @slot Item's label content -->
386
392
  <slot name="item-label" :item="item">
387
- {{ serializer(item) }}
393
+ {{ serialize(item) }}
388
394
  </slot>
389
395
  </div>
390
396
  </slot>
@@ -4,7 +4,10 @@ import identity from 'lodash/identity'
4
4
  import sortBy from 'lodash/sortBy'
5
5
  import { defineComponent, computed, ref, watch } from 'vue'
6
6
  import { chartProps, getChartProps, useChart } from '@/composables/chart'
7
+ import { ComponentPublicInstance } from 'vue'
7
8
 
9
+ type Datum = {value:number|number[],highlight?:boolean,label?:string}
10
+ type Bar = {width:number,height:number, x:number,y:number} & Datum;
8
11
  export default defineComponent({
9
12
  name: 'BarChart',
10
13
  props: {
@@ -81,13 +84,12 @@ export default defineComponent({
81
84
  },
82
85
  ...chartProps()
83
86
  },
84
- emits: ['loaded', 'resized'],
85
87
  setup(props, { emit }) {
86
- const el = ref(null)
88
+ const el = ref<ComponentPublicInstance<HTMLElement> |null>(null)
87
89
  const width = ref(0)
88
90
  const isLoaded = ref(false)
89
91
  const { loadedData, elementsMaxBBox, dataHasHighlights, d3Formatter } =
90
- useChart(el, getChartProps(props), { emit }, isLoaded, onResize, null)
92
+ useChart(el, getChartProps(props), { emit }, isLoaded, onResize)
91
93
  // onMounted(() => {
92
94
  // window.addEventListener('resize', onResize)
93
95
  // onResize()
@@ -96,7 +98,7 @@ export default defineComponent({
96
98
  // window.removeEventListener('resize', onResize)
97
99
  // })
98
100
 
99
- const sortedData = computed(() => {
101
+ const sortedData = computed(():[] => {
100
102
  if (!loadedData.value) {
101
103
  return []
102
104
  }
@@ -137,13 +139,15 @@ export default defineComponent({
137
139
  const scale = computed(() => {
138
140
  const x = d3
139
141
  .scaleLinear()
140
- .domain([0, d3.max(sortedData.value, (d) => d.value)])
142
+ //@ts-expect-error D3 api
143
+ .domain([0, d3.max(sortedData.value, (d:Datum) => d.value)])
141
144
  .range([0, padded.value.width - valueWidth.value])
142
145
  return { x }
143
146
  })
144
- const bars = computed(() => {
145
- return sortedData.value.map((d, i) => {
147
+ const bars = computed(():Bar[] => {
148
+ return sortedData.value.map((d:Datum, i) => {
146
149
  return {
150
+ //@ts-expect-error D3 api
147
151
  width: Math.abs(scale.value.x(d.value)),
148
152
  height: Math.abs(props.barHeight),
149
153
  value: d.value,
@@ -154,7 +158,7 @@ export default defineComponent({
154
158
  })
155
159
  })
156
160
  const labels = computed(() => {
157
- return sortedData.value.map((d, i) => {
161
+ return sortedData.value.map((d:Datum, i) => {
158
162
  return {
159
163
  label: d.label,
160
164
  x: labelWidth.value,
@@ -166,15 +170,16 @@ export default defineComponent({
166
170
  return (props.barHeight + props.barGap) * sortedData.value.length
167
171
  })
168
172
 
169
- function formatXDatum(d) {
173
+ function formatXDatum(d:number|number[]) {
170
174
  return d3Formatter(d, props.xAxisTickFormat)
171
175
  }
172
176
  function onResize() {
173
177
  if (el.value) {
174
- width.value = el.value.offsetWidth
178
+ width.value = el.value?.offsetWidth
175
179
  }
176
180
  }
177
181
  function initialize() {
182
+ // @ts-expect-error D3 api
178
183
  d3.axisBottom().scale(scale.value.x)
179
184
  }
180
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icij/murmur-next",
3
- "version": "4.0.10",
3
+ "version": "4.0.13",
4
4
  "private": false,
5
5
  "description": "Murmur is ICIJ's Design System for Bootstrap 5 and Vue.js",
6
6
  "author": "promera@icij.org",