@guardian/interactive-component-library 0.2.0-rc4 → 0.3.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.
- package/dist/interactive-component-library.js +8365 -0
- package/dist/interactive-component-library.js.map +1 -0
- package/dist/interactive-component-library.umd.cjs +8360 -0
- package/dist/interactive-component-library.umd.cjs.map +1 -0
- package/dist/style.css +157 -73
- package/package.json +11 -19
- package/dist/components/index.d.ts +0 -3
- package/dist/components/molecules/canvas-map/Map.d.ts +0 -17
- package/dist/components/molecules/canvas-map/Map.js +0 -89
- package/dist/components/molecules/canvas-map/context/MapContext.d.ts +0 -19
- package/dist/components/molecules/canvas-map/context/MapContext.js +0 -20
- package/dist/components/molecules/canvas-map/controls/ZoomControl.d.ts +0 -6
- package/dist/components/molecules/canvas-map/controls/ZoomControl.js +0 -40
- package/dist/components/molecules/canvas-map/controls/icons/index.d.ts +0 -3
- package/dist/components/molecules/canvas-map/controls/icons/minus.d.ts +0 -1
- package/dist/components/molecules/canvas-map/controls/icons/minus.js +0 -25
- package/dist/components/molecules/canvas-map/controls/icons/plus.d.ts +0 -1
- package/dist/components/molecules/canvas-map/controls/icons/plus.js +0 -25
- package/dist/components/molecules/canvas-map/controls/icons/reset.d.ts +0 -3
- package/dist/components/molecules/canvas-map/controls/icons/reset.js +0 -25
- package/dist/components/molecules/canvas-map/controls/index.d.ts +0 -1
- package/dist/components/molecules/canvas-map/controls/style.module.css.js +0 -11
- package/dist/components/molecules/canvas-map/index.d.ts +0 -12
- package/dist/components/molecules/canvas-map/lib/Feature.d.ts +0 -38
- package/dist/components/molecules/canvas-map/lib/Feature.js +0 -104
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +0 -20
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +0 -23
- package/dist/components/molecules/canvas-map/lib/Map.d.ts +0 -69
- package/dist/components/molecules/canvas-map/lib/Map.js +0 -254
- package/dist/components/molecules/canvas-map/lib/View.d.ts +0 -136
- package/dist/components/molecules/canvas-map/lib/View.js +0 -179
- package/dist/components/molecules/canvas-map/lib/events/Dispatcher.d.ts +0 -8
- package/dist/components/molecules/canvas-map/lib/events/Dispatcher.js +0 -35
- package/dist/components/molecules/canvas-map/lib/events/MapEvent.d.ts +0 -6
- package/dist/components/molecules/canvas-map/lib/events/MapEvent.js +0 -9
- package/dist/components/molecules/canvas-map/lib/events/index.d.ts +0 -2
- package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.d.ts +0 -10
- package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +0 -96
- package/dist/components/molecules/canvas-map/lib/geometry/Geometry.d.ts +0 -32
- package/dist/components/molecules/canvas-map/lib/geometry/Geometry.js +0 -41
- package/dist/components/molecules/canvas-map/lib/geometry/LineString.d.ts +0 -12
- package/dist/components/molecules/canvas-map/lib/geometry/LineString.js +0 -19
- package/dist/components/molecules/canvas-map/lib/geometry/Point.d.ts +0 -11
- package/dist/components/molecules/canvas-map/lib/geometry/Point.js +0 -16
- package/dist/components/molecules/canvas-map/lib/geometry/Polygon.d.ts +0 -16
- package/dist/components/molecules/canvas-map/lib/geometry/Polygon.js +0 -46
- package/dist/components/molecules/canvas-map/lib/geometry/index.d.ts +0 -4
- package/dist/components/molecules/canvas-map/lib/interpolators/index.d.ts +0 -2
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.d.ts +0 -5
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.js +0 -95
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.d.ts +0 -4
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js +0 -65
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +0 -52
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +0 -111
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +0 -53
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +0 -132
- package/dist/components/molecules/canvas-map/lib/layers/index.d.ts +0 -3
- package/dist/components/molecules/canvas-map/lib/projection/index.d.ts +0 -22
- package/dist/components/molecules/canvas-map/lib/projection/index.js +0 -12
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +0 -6
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +0 -46
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.d.ts +0 -6
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +0 -53
- package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.d.ts +0 -17
- package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +0 -119
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +0 -10
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +0 -78
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +0 -15
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +0 -56
- package/dist/components/molecules/canvas-map/lib/styles/Fill.d.ts +0 -7
- package/dist/components/molecules/canvas-map/lib/styles/Fill.js +0 -15
- package/dist/components/molecules/canvas-map/lib/styles/Stroke.d.ts +0 -8
- package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +0 -16
- package/dist/components/molecules/canvas-map/lib/styles/Style.d.ts +0 -24
- package/dist/components/molecules/canvas-map/lib/styles/Style.js +0 -17
- package/dist/components/molecules/canvas-map/lib/styles/Text.d.ts +0 -10
- package/dist/components/molecules/canvas-map/lib/styles/Text.js +0 -14
- package/dist/components/molecules/canvas-map/lib/styles/index.d.ts +0 -4
- package/dist/components/molecules/canvas-map/lib/util/array.d.ts +0 -6
- package/dist/components/molecules/canvas-map/lib/util/array.js +0 -15
- package/dist/components/molecules/canvas-map/lib/util/bboxFeature.d.ts +0 -8
- package/dist/components/molecules/canvas-map/lib/util/bboxFeature.js +0 -26
- package/dist/components/molecules/canvas-map/lib/util/debug.d.ts +0 -11
- package/dist/components/molecules/canvas-map/lib/util/debug.js +0 -27
- package/dist/components/molecules/canvas-map/lib/util/deflate.d.ts +0 -36
- package/dist/components/molecules/canvas-map/lib/util/distance.d.ts +0 -1
- package/dist/components/molecules/canvas-map/lib/util/distance.js +0 -12
- package/dist/components/molecules/canvas-map/lib/util/dom.d.ts +0 -9
- package/dist/components/molecules/canvas-map/lib/util/dom.js +0 -28
- package/dist/components/molecules/canvas-map/lib/util/extent.d.ts +0 -21
- package/dist/components/molecules/canvas-map/lib/util/extent.js +0 -38
- package/dist/components/molecules/canvas-map/lib/util/memoise.d.ts +0 -10
- package/dist/components/molecules/canvas-map/lib/util/memoise.js +0 -20
- package/dist/components/molecules/canvas-map/lib/util/resolution.d.ts +0 -9
- package/dist/components/molecules/canvas-map/lib/util/resolution.js +0 -11
- package/dist/components/molecules/canvas-map/lib/util/simplify.d.ts +0 -114
- package/dist/components/molecules/canvas-map/lib/util/size.d.ts +0 -32
- package/dist/components/molecules/canvas-map/lib/util/size.js +0 -53
- package/dist/components/molecules/canvas-map/lib/util/toRgba.d.ts +0 -1
- package/dist/components/molecules/canvas-map/lib/util/toRgba.js +0 -25
- package/dist/components/molecules/canvas-map/lib/util/uid.d.ts +0 -5
- package/dist/components/molecules/canvas-map/lib/util/uid.js +0 -7
- package/dist/components/molecules/canvas-map/lib/util/zoomLevel.d.ts +0 -2
- package/dist/components/molecules/canvas-map/lib/util/zoomLevel.js +0 -14
- package/dist/components/molecules/canvas-map/style.module.scss.js +0 -20
- package/dist/components/molecules/column-chart/column-chart-example.d.ts +0 -35
- package/dist/components/molecules/column-chart/column-chart-util.d.ts +0 -1
- package/dist/components/molecules/column-chart/index.d.ts +0 -11
- package/dist/components/molecules/column-chart/index.js +0 -63
- package/dist/components/molecules/column-chart/style.module.css.js +0 -14
- package/dist/components/molecules/control-change/index.d.ts +0 -6
- package/dist/components/molecules/control-change/index.js +0 -29
- package/dist/components/molecules/control-change/style.module.css.js +0 -11
- package/dist/components/molecules/dropdown/index.d.ts +0 -11
- package/dist/components/molecules/dropdown/index.js +0 -191
- package/dist/components/molecules/dropdown/style.module.css.js +0 -50
- package/dist/components/molecules/first-past-the-post-waffle/index.d.ts +0 -5
- package/dist/components/molecules/first-past-the-post-waffle/index.js +0 -14
- package/dist/components/molecules/first-past-the-post-waffle/style.module.css.js +0 -14
- package/dist/components/molecules/index.d.ts +0 -17
- package/dist/components/molecules/modal/index.d.ts +0 -8
- package/dist/components/molecules/modal/index.js +0 -59
- package/dist/components/molecules/modal/style.module.css.js +0 -26
- package/dist/components/molecules/page-section/index.d.ts +0 -8
- package/dist/components/molecules/page-section/index.js +0 -52
- package/dist/components/molecules/page-section/style.module.scss.js +0 -20
- package/dist/components/molecules/party-profile/index.d.ts +0 -10
- package/dist/components/molecules/party-profile/index.js +0 -29
- package/dist/components/molecules/party-profile/style.module.css.js +0 -26
- package/dist/components/molecules/refresh-indicator/index.d.ts +0 -4
- package/dist/components/molecules/refresh-indicator/index.js +0 -18
- package/dist/components/molecules/refresh-indicator/style.module.scss.js +0 -17
- package/dist/components/molecules/responsive-grid/index.d.ts +0 -10
- package/dist/components/molecules/responsive-grid/index.js +0 -19
- package/dist/components/molecules/responsive-grid/style.module.scss.js +0 -8
- package/dist/components/molecules/result-summary/index.d.ts +0 -8
- package/dist/components/molecules/result-summary/index.js +0 -38
- package/dist/components/molecules/result-summary/style.module.css.js +0 -11
- package/dist/components/molecules/search-input/icons/search.d.ts +0 -1
- package/dist/components/molecules/search-input/icons/search.js +0 -24
- package/dist/components/molecules/search-input/icons/search.module.css.js +0 -11
- package/dist/components/molecules/search-input/index.d.ts +0 -11
- package/dist/components/molecules/search-input/index.js +0 -164
- package/dist/components/molecules/search-input/style.module.css.js +0 -32
- package/dist/components/molecules/slope-chart/index.d.ts +0 -16
- package/dist/components/molecules/slope-chart/index.js +0 -139
- package/dist/components/molecules/slope-chart/style.module.css.js +0 -35
- package/dist/components/molecules/svg-map/context/MapContext.d.ts +0 -1
- package/dist/components/molecules/svg-map/context/MapContext.js +0 -5
- package/dist/components/molecules/svg-map/context/SVGMapProvider.d.ts +0 -10
- package/dist/components/molecules/svg-map/context/SVGMapProvider.js +0 -88
- package/dist/components/molecules/svg-map/helpers/bboxFeature.d.ts +0 -8
- package/dist/components/molecules/svg-map/helpers/bboxFeature.js +0 -26
- package/dist/components/molecules/svg-map/helpers/dynamicPropValue.d.ts +0 -1
- package/dist/components/molecules/svg-map/helpers/dynamicPropValue.js +0 -9
- package/dist/components/molecules/svg-map/helpers/geoMath.d.ts +0 -4
- package/dist/components/molecules/svg-map/helpers/saveSVG.d.ts +0 -1
- package/dist/components/molecules/svg-map/hooks/useCamera.d.ts +0 -0
- package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.d.ts +0 -4
- package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.js +0 -19
- package/dist/components/molecules/svg-map/index.d.ts +0 -38
- package/dist/components/molecules/svg-map/index.js +0 -121
- package/dist/components/molecules/svg-map/layers/CompositionBorders.d.ts +0 -3
- package/dist/components/molecules/svg-map/layers/CompositionBorders.js +0 -14
- package/dist/components/molecules/svg-map/layers/Line.d.ts +0 -7
- package/dist/components/molecules/svg-map/layers/Line.js +0 -48
- package/dist/components/molecules/svg-map/layers/Point.d.ts +0 -10
- package/dist/components/molecules/svg-map/layers/Point.js +0 -59
- package/dist/components/molecules/svg-map/layers/Polygon.d.ts +0 -9
- package/dist/components/molecules/svg-map/layers/Polygon.js +0 -75
- package/dist/components/molecules/svg-map/layers/Prerendered.d.ts +0 -3
- package/dist/components/molecules/svg-map/layers/Prerendered.js +0 -11
- package/dist/components/molecules/svg-map/layers/compositionBorders.module.scss.js +0 -8
- package/dist/components/molecules/svg-map/layers/index.d.ts +0 -5
- package/dist/components/molecules/svg-map/layers/index.js +0 -12
- package/dist/components/molecules/svg-map/renderers/SVGRenderer.d.ts +0 -3
- package/dist/components/molecules/svg-map/renderers/SVGRenderer.js +0 -32
- package/dist/components/molecules/svg-map/style.module.css.js +0 -11
- package/dist/components/molecules/table/index.d.ts +0 -7
- package/dist/components/molecules/table/index.js +0 -90
- package/dist/components/molecules/table/style.module.scss.js +0 -29
- package/dist/components/molecules/table/useTable.d.ts +0 -8
- package/dist/components/molecules/table/useTable.js +0 -128
- package/dist/components/molecules/tooltip/index.d.ts +0 -82
- package/dist/components/molecules/tooltip/index.js +0 -117
- package/dist/components/molecules/tooltip/style.module.css.js +0 -8
- package/dist/components/molecules/topline-result/index.d.ts +0 -3
- package/dist/components/molecules/topline-result/index.js +0 -61
- package/dist/components/molecules/topline-result/style.module.scss.js +0 -38
- package/dist/components/organisms/coalitions-tracker/index.d.ts +0 -16
- package/dist/components/organisms/coalitions-tracker/index.js +0 -151
- package/dist/components/organisms/coalitions-tracker/style.module.scss.js +0 -32
- package/dist/components/organisms/index.d.ts +0 -2
- package/dist/components/organisms/ticker/gradient/index.d.ts +0 -1
- package/dist/components/organisms/ticker/gradient/index.js +0 -35
- package/dist/components/organisms/ticker/gradient/style.module.scss.js +0 -14
- package/dist/components/organisms/ticker/index.d.ts +0 -5
- package/dist/components/organisms/ticker/index.js +0 -102
- package/dist/components/organisms/ticker/style.module.scss.js +0 -32
- package/dist/components/particles/ad-slot/index.d.ts +0 -40
- package/dist/components/particles/ad-slot/index.js +0 -34
- package/dist/components/particles/ad-slot/style.module.css.js +0 -11
- package/dist/components/particles/arrow-button/index.d.ts +0 -6
- package/dist/components/particles/arrow-button/index.js +0 -32
- package/dist/components/particles/arrow-button/style.module.css.js +0 -11
- package/dist/components/particles/aspect-ratio-box/index.d.ts +0 -4
- package/dist/components/particles/aspect-ratio-box/index.js +0 -15
- package/dist/components/particles/aspect-ratio-box/style.module.css.js +0 -6
- package/dist/components/particles/button/index.d.ts +0 -6
- package/dist/components/particles/button/index.js +0 -10
- package/dist/components/particles/button/style.module.css.js +0 -11
- package/dist/components/particles/change-bar/index.d.ts +0 -8
- package/dist/components/particles/change-bar/index.js +0 -27
- package/dist/components/particles/change-bar/style.module.scss.js +0 -14
- package/dist/components/particles/chevron/index.d.ts +0 -6
- package/dist/components/particles/chevron/index.js +0 -78
- package/dist/components/particles/chevron/style.module.css.js +0 -20
- package/dist/components/particles/circle-icon/index.d.ts +0 -6
- package/dist/components/particles/circle-icon/index.js +0 -32
- package/dist/components/particles/circle-icon/style.module.css.js +0 -14
- package/dist/components/particles/close-button/index.d.ts +0 -5
- package/dist/components/particles/close-button/index.js +0 -35
- package/dist/components/particles/close-button/style.module.css.js +0 -17
- package/dist/components/particles/container/index.d.ts +0 -5
- package/dist/components/particles/container/index.js +0 -13
- package/dist/components/particles/container/style.module.scss.js +0 -11
- package/dist/components/particles/gradient-icon/index.d.ts +0 -1
- package/dist/components/particles/gradient-icon/index.js +0 -46
- package/dist/components/particles/gradient-icon/style.module.css.js +0 -14
- package/dist/components/particles/index.d.ts +0 -18
- package/dist/components/particles/info-button/index.d.ts +0 -3
- package/dist/components/particles/info-button/index.js +0 -19
- package/dist/components/particles/info-button/style.module.css.js +0 -11
- package/dist/components/particles/legend-item/index.d.ts +0 -6
- package/dist/components/particles/legend-item/index.js +0 -26
- package/dist/components/particles/legend-item/style.module.css.js +0 -17
- package/dist/components/particles/relative-time-sentence/index.d.ts +0 -4
- package/dist/components/particles/relative-time-sentence/index.js +0 -14
- package/dist/components/particles/relative-time-sentence/style.module.css.js +0 -8
- package/dist/components/particles/square-cut-corner-icon/index.d.ts +0 -6
- package/dist/components/particles/square-cut-corner-icon/index.js +0 -56
- package/dist/components/particles/square-cut-corner-icon/style.module.scss.js +0 -17
- package/dist/components/particles/square-icon/index.d.ts +0 -5
- package/dist/components/particles/square-icon/index.js +0 -28
- package/dist/components/particles/square-icon/style.module.scss.js +0 -11
- package/dist/components/particles/stacked-bar/index.d.ts +0 -23
- package/dist/components/particles/stacked-bar/index.js +0 -140
- package/dist/components/particles/stacked-bar/style.module.css.js +0 -17
- package/dist/components/particles/stacked-grid/index.d.ts +0 -6
- package/dist/components/particles/stacked-grid/index.js +0 -35
- package/dist/components/particles/stacked-grid/style.module.css.js +0 -20
- package/dist/components/particles/waffle/index.d.ts +0 -14
- package/dist/components/particles/waffle/index.js +0 -76
- package/dist/components/particles/waffle/style.module.css.js +0 -11
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -128
- package/dist/shared/colors/index.d.ts +0 -2
- package/dist/shared/helpers/createStore.d.ts +0 -1
- package/dist/shared/helpers/geometry.d.ts +0 -3
- package/dist/shared/helpers/geometry.js +0 -16
- package/dist/shared/helpers/geometry.test.d.ts +0 -1
- package/dist/shared/helpers/labelsUtil.d.ts +0 -54
- package/dist/shared/helpers/labelsUtil.js +0 -58
- package/dist/shared/helpers/labelsUtils.test.d.ts +0 -1
- package/dist/shared/helpers/shouldUpdate.d.ts +0 -7
- package/dist/shared/hooks/index.d.ts +0 -3
- package/dist/shared/hooks/useContainerSize.d.ts +0 -1
- package/dist/shared/hooks/useContainerSize.js +0 -24
- package/dist/shared/hooks/useTouchOrHover.d.ts +0 -6
- package/dist/shared/hooks/useTouchOrHover.js +0 -95
- package/dist/shared/hooks/useWindowSize.d.ts +0 -4
- package/dist/shared/hooks/useWindowSize.js +0 -27
- package/dist/styles/helpers/mergeStyles.d.ts +0 -1
- package/dist/styles/helpers/mergeStyles.js +0 -22
- package/dist/styles/helpers/mergeStyles.test.d.ts +0 -1
- package/dist/styles/theme.config.d.ts +0 -124
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "preact/hooks";
|
|
2
|
-
const sortAscending = (accessor) => {
|
|
3
|
-
return (a, b) => {
|
|
4
|
-
const valueA = a[accessor];
|
|
5
|
-
const valueB = b[accessor];
|
|
6
|
-
if (valueA === null) {
|
|
7
|
-
return -1;
|
|
8
|
-
} else if (valueB === null) {
|
|
9
|
-
return 1;
|
|
10
|
-
}
|
|
11
|
-
if (valueA < valueB) return -1;
|
|
12
|
-
if (valueA > valueB) return 1;
|
|
13
|
-
return 0;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
const sortDescending = (accessor) => {
|
|
17
|
-
return (a, b) => {
|
|
18
|
-
const valueA = a[accessor];
|
|
19
|
-
const valueB = b[accessor];
|
|
20
|
-
if (valueA === null) {
|
|
21
|
-
return 1;
|
|
22
|
-
} else if (valueB === null) {
|
|
23
|
-
return -1;
|
|
24
|
-
}
|
|
25
|
-
if (valueA > valueB) return -1;
|
|
26
|
-
if (valueA < valueB) return 1;
|
|
27
|
-
return 0;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
function useTable({ columns, data, sortState }) {
|
|
31
|
-
const sortedData = useMemo(() => {
|
|
32
|
-
if (sortState.columnIndex < 0) {
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
const dataCopy = new Array(...data);
|
|
36
|
-
const column = columns[sortState.columnIndex];
|
|
37
|
-
const sortFunction = sortState.ascending ? sortAscending(column.accessor) : sortDescending(column.accessor);
|
|
38
|
-
dataCopy.sort(sortFunction);
|
|
39
|
-
return dataCopy;
|
|
40
|
-
}, [columns, data, sortState]);
|
|
41
|
-
const columnModels = useMemo(() => {
|
|
42
|
-
return columns.map((column, columnIndex) => {
|
|
43
|
-
const isSorted = sortState.columnIndex === columnIndex && sortState;
|
|
44
|
-
return new ColumnModel(columnIndex, column, isSorted);
|
|
45
|
-
});
|
|
46
|
-
}, [columns, sortState]);
|
|
47
|
-
const rowModels = useMemo(() => {
|
|
48
|
-
return sortedData.map((d, rowIndex) => {
|
|
49
|
-
const cells = columnModels.map((column, columnIndex) => {
|
|
50
|
-
return new CellModel(column, columnIndex, d, column.cell);
|
|
51
|
-
});
|
|
52
|
-
return new RowModel(rowIndex, cells);
|
|
53
|
-
});
|
|
54
|
-
}, [columnModels, sortedData]);
|
|
55
|
-
return {
|
|
56
|
-
columns: columnModels,
|
|
57
|
-
rows: rowModels
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
class ColumnModel {
|
|
61
|
-
constructor(index, definition, isSorted) {
|
|
62
|
-
this.index = index;
|
|
63
|
-
this.definition = definition;
|
|
64
|
-
this.isSorted = isSorted;
|
|
65
|
-
this.defaultValue = definition.defaultValue;
|
|
66
|
-
}
|
|
67
|
-
get id() {
|
|
68
|
-
return this.definition.id || this.header;
|
|
69
|
-
}
|
|
70
|
-
get accessor() {
|
|
71
|
-
return this.definition.accessor;
|
|
72
|
-
}
|
|
73
|
-
get header() {
|
|
74
|
-
return this.definition.header;
|
|
75
|
-
}
|
|
76
|
-
get headerProps() {
|
|
77
|
-
return {
|
|
78
|
-
text: this.header,
|
|
79
|
-
sortable: this.definition.sortable,
|
|
80
|
-
isSorted: this.isSorted,
|
|
81
|
-
...this.headerCellStyle
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
get cell() {
|
|
85
|
-
return this.definition.cell;
|
|
86
|
-
}
|
|
87
|
-
get styles() {
|
|
88
|
-
return this.definition.styles;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
class RowModel {
|
|
92
|
-
constructor(index, cells) {
|
|
93
|
-
this.index = index;
|
|
94
|
-
this.cells = cells;
|
|
95
|
-
}
|
|
96
|
-
get id() {
|
|
97
|
-
return this.index;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
class CellModel {
|
|
101
|
-
constructor(column, columnIndex, row, cell) {
|
|
102
|
-
this.column = column;
|
|
103
|
-
this.columnIndex = columnIndex;
|
|
104
|
-
this.row = row;
|
|
105
|
-
this.cell = cell;
|
|
106
|
-
}
|
|
107
|
-
get id() {
|
|
108
|
-
return this.columnIndex;
|
|
109
|
-
}
|
|
110
|
-
get displayValue() {
|
|
111
|
-
if (this.cell) {
|
|
112
|
-
return this.cell(this.row);
|
|
113
|
-
}
|
|
114
|
-
if (!Object.prototype.hasOwnProperty.call(this.row, this.column.accessor)) {
|
|
115
|
-
if (this.column.defaultValue) {
|
|
116
|
-
return this.column.defaultValue.toString();
|
|
117
|
-
}
|
|
118
|
-
const rowData = JSON.stringify(this.row, null, 2);
|
|
119
|
-
throw new Error(
|
|
120
|
-
`Missing value for key ${this.column.accessor} in ${rowData}`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
return this.row[this.column.accessor] !== null ? this.row[this.column.accessor].toString() : "null";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export {
|
|
127
|
-
useTable
|
|
128
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} Point
|
|
3
|
-
* @property {number} x
|
|
4
|
-
* @property {number} y
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {Object} Rect
|
|
8
|
-
* @property {number} x
|
|
9
|
-
* @property {number} y
|
|
10
|
-
* @property {number} width
|
|
11
|
-
* @property {number} height
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {Object} TooltipProps
|
|
15
|
-
* @property {Element} for - The element to which the tooltip should be positioned.
|
|
16
|
-
* @property {Point} [positionInTarget] - The position of the tooltip within the target element.
|
|
17
|
-
* @property {Rect} [touchRect] - The position of the touch event that triggered the tooltip.
|
|
18
|
-
* @property {boolean} [show] - Whether the tooltip should be shown or not.
|
|
19
|
-
* @property {Object} [styles] - Additional styles to be applied to the tooltip.
|
|
20
|
-
* @property {React.ReactNode} children - The content to be displayed inside the tooltip.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* A tooltip component that displays content at a specific position relative to a target element.
|
|
24
|
-
*
|
|
25
|
-
* @param {TooltipProps} props
|
|
26
|
-
* @returns {JSX.Element}
|
|
27
|
-
*/
|
|
28
|
-
export function Tooltip({ for: targetElement, touchRect, positionInTarget, show, styles, children, }: TooltipProps): JSX.Element;
|
|
29
|
-
export type Point = {
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
};
|
|
33
|
-
export type Rect = {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
};
|
|
39
|
-
export type TooltipProps = {
|
|
40
|
-
/**
|
|
41
|
-
* - The element to which the tooltip should be positioned.
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* - The element to which the tooltip should be positioned.
|
|
45
|
-
*/
|
|
46
|
-
for: Element;
|
|
47
|
-
/**
|
|
48
|
-
* - The position of the tooltip within the target element.
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* - The position of the tooltip within the target element.
|
|
52
|
-
*/
|
|
53
|
-
positionInTarget?: Point;
|
|
54
|
-
/**
|
|
55
|
-
* - The position of the touch event that triggered the tooltip.
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* - The position of the touch event that triggered the tooltip.
|
|
59
|
-
*/
|
|
60
|
-
touchRect?: Rect;
|
|
61
|
-
/**
|
|
62
|
-
* - Whether the tooltip should be shown or not.
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* - Whether the tooltip should be shown or not.
|
|
66
|
-
*/
|
|
67
|
-
show?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* - Additional styles to be applied to the tooltip.
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* - Additional styles to be applied to the tooltip.
|
|
73
|
-
*/
|
|
74
|
-
styles?: any;
|
|
75
|
-
/**
|
|
76
|
-
* - The content to be displayed inside the tooltip.
|
|
77
|
-
*/
|
|
78
|
-
/**
|
|
79
|
-
* - The content to be displayed inside the tooltip.
|
|
80
|
-
*/
|
|
81
|
-
children: React.ReactNode;
|
|
82
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect, useLayoutEffect } from "preact/hooks";
|
|
3
|
-
import { createPortal } from "preact/compat";
|
|
4
|
-
import { rectsIntersect } from "../../../shared/helpers/geometry.js";
|
|
5
|
-
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
6
|
-
import defaultStyles from "./style.module.css.js";
|
|
7
|
-
function Tooltip({
|
|
8
|
-
for: targetElement,
|
|
9
|
-
touchRect,
|
|
10
|
-
positionInTarget,
|
|
11
|
-
show = true,
|
|
12
|
-
styles,
|
|
13
|
-
children
|
|
14
|
-
}) {
|
|
15
|
-
if (!targetElement) throw new Error("Target for tooltip cannot be undefined");
|
|
16
|
-
const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
|
|
17
|
-
const [displayElement, setDisplayElement] = useState(null);
|
|
18
|
-
const tooltipRef = useRef();
|
|
19
|
-
styles = mergeStyles(defaultStyles, styles);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
setDisplayElement(document.querySelector("body"));
|
|
22
|
-
return () => {
|
|
23
|
-
setDisplayElement(null);
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
useLayoutEffect(() => {
|
|
27
|
-
if (!tooltipRef.current) return;
|
|
28
|
-
const targetRect = targetElement.getBoundingClientRect();
|
|
29
|
-
if (positionInTarget) {
|
|
30
|
-
const newPosition = tooltipPositionForPoint({
|
|
31
|
-
targetRect,
|
|
32
|
-
positionInTarget,
|
|
33
|
-
tooltip: tooltipRef.current,
|
|
34
|
-
displayElement
|
|
35
|
-
});
|
|
36
|
-
setTooltipPosition(newPosition);
|
|
37
|
-
} else if (!positionInTarget) {
|
|
38
|
-
const newPosition = tooltipPositionForRect({
|
|
39
|
-
targetRect,
|
|
40
|
-
touchRect,
|
|
41
|
-
tooltip: tooltipRef.current,
|
|
42
|
-
displayElement
|
|
43
|
-
});
|
|
44
|
-
setTooltipPosition(newPosition);
|
|
45
|
-
}
|
|
46
|
-
}, [targetElement, positionInTarget, displayElement, tooltipRef, touchRect]);
|
|
47
|
-
if (!displayElement) return;
|
|
48
|
-
const fixedStyle = {
|
|
49
|
-
display: show ? "block" : "none",
|
|
50
|
-
position: "fixed",
|
|
51
|
-
left: tooltipPosition.x,
|
|
52
|
-
top: tooltipPosition.y,
|
|
53
|
-
zIndex: 100
|
|
54
|
-
};
|
|
55
|
-
const tooltip = /* @__PURE__ */ jsx("div", { ref: tooltipRef, className: styles.tooltip, style: fixedStyle, children });
|
|
56
|
-
return createPortal(tooltip, displayElement);
|
|
57
|
-
}
|
|
58
|
-
function tooltipPositionForPoint({
|
|
59
|
-
targetRect,
|
|
60
|
-
positionInTarget,
|
|
61
|
-
tooltip,
|
|
62
|
-
displayElement
|
|
63
|
-
}) {
|
|
64
|
-
const newPosition = {
|
|
65
|
-
x: positionInTarget.x + targetRect.x,
|
|
66
|
-
y: positionInTarget.y + targetRect.y
|
|
67
|
-
};
|
|
68
|
-
const tooltipWidth = tooltip.offsetWidth;
|
|
69
|
-
const tooltipHeight = tooltip.offsetHeight;
|
|
70
|
-
const displayElementRect = displayElement.getBoundingClientRect();
|
|
71
|
-
if (newPosition.x + tooltipWidth > displayElementRect.right) {
|
|
72
|
-
newPosition.x -= tooltipWidth;
|
|
73
|
-
}
|
|
74
|
-
if (newPosition.y + tooltipHeight > displayElementRect.bottom) {
|
|
75
|
-
newPosition.y -= tooltipHeight;
|
|
76
|
-
}
|
|
77
|
-
if (newPosition.x <= displayElementRect.left) {
|
|
78
|
-
newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
|
|
79
|
-
}
|
|
80
|
-
return newPosition;
|
|
81
|
-
}
|
|
82
|
-
function tooltipPositionForRect({
|
|
83
|
-
targetRect,
|
|
84
|
-
touchRect = { x: 0, y: 0, width: 0, height: 0 },
|
|
85
|
-
tooltip,
|
|
86
|
-
displayElement
|
|
87
|
-
}) {
|
|
88
|
-
const newPosition = {
|
|
89
|
-
x: targetRect.right,
|
|
90
|
-
y: targetRect.top
|
|
91
|
-
};
|
|
92
|
-
const tooltipWidth = tooltip.offsetWidth;
|
|
93
|
-
const tooltipHeight = tooltip.offsetHeight;
|
|
94
|
-
const tooltipRect = {
|
|
95
|
-
...newPosition,
|
|
96
|
-
width: tooltipWidth,
|
|
97
|
-
height: tooltipHeight
|
|
98
|
-
};
|
|
99
|
-
if (rectsIntersect(tooltipRect, touchRect)) {
|
|
100
|
-
newPosition.x = touchRect.x + touchRect.width / 2;
|
|
101
|
-
newPosition.y = touchRect.y - tooltipHeight;
|
|
102
|
-
}
|
|
103
|
-
const displayElementRect = displayElement.getBoundingClientRect();
|
|
104
|
-
if (newPosition.x + tooltipWidth > displayElementRect.right) {
|
|
105
|
-
newPosition.x = targetRect.left - tooltipWidth;
|
|
106
|
-
}
|
|
107
|
-
if (newPosition.y - tooltipHeight < displayElementRect.top) {
|
|
108
|
-
newPosition.y = targetRect.bottom;
|
|
109
|
-
}
|
|
110
|
-
if (newPosition.x <= displayElementRect.left) {
|
|
111
|
-
newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
|
|
112
|
-
}
|
|
113
|
-
return newPosition;
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
Tooltip
|
|
117
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
3
|
-
import "preact/hooks";
|
|
4
|
-
import { InfoButton } from "../../particles/info-button/index.js";
|
|
5
|
-
import "../../particles/relative-time-sentence/index.js";
|
|
6
|
-
import { forwardRef } from "preact/compat";
|
|
7
|
-
import defaultStyles from "./style.module.scss.js";
|
|
8
|
-
const ToplineResult = forwardRef(
|
|
9
|
-
({
|
|
10
|
-
name,
|
|
11
|
-
secondaryName,
|
|
12
|
-
mainNumber,
|
|
13
|
-
mainNumberSuffix,
|
|
14
|
-
secondaryNumber,
|
|
15
|
-
styles,
|
|
16
|
-
displayRow = false,
|
|
17
|
-
abbreviation,
|
|
18
|
-
onMouseOver,
|
|
19
|
-
onClick,
|
|
20
|
-
onMouseOut,
|
|
21
|
-
onInfoPress,
|
|
22
|
-
showInfoButton = false,
|
|
23
|
-
infoButtonRef
|
|
24
|
-
}, ref) => {
|
|
25
|
-
styles = mergeStyles({ ...defaultStyles }, styles);
|
|
26
|
-
const displayStyle = displayRow ? styles.displayRow : styles.displayColumn;
|
|
27
|
-
return /* @__PURE__ */ jsxs(
|
|
28
|
-
"div",
|
|
29
|
-
{
|
|
30
|
-
className: styles.toplineResult,
|
|
31
|
-
onMouseOver,
|
|
32
|
-
onClick,
|
|
33
|
-
onMouseOut,
|
|
34
|
-
ref,
|
|
35
|
-
children: [
|
|
36
|
-
/* @__PURE__ */ jsxs("div", { className: styles.topRow, children: [
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
"span",
|
|
39
|
-
{
|
|
40
|
-
className: `${styles.primaryname} before-color--${abbreviation}`,
|
|
41
|
-
children: name
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
showInfoButton && /* @__PURE__ */ jsx("span", { className: styles.infoButton, children: /* @__PURE__ */ jsx(InfoButton, { onClick: onInfoPress, ref: infoButtonRef }) })
|
|
45
|
-
] }),
|
|
46
|
-
secondaryName && /* @__PURE__ */ jsx("div", { className: styles.subhead, children: /* @__PURE__ */ jsx("span", { className: styles.secondaryname, children: secondaryName }) }),
|
|
47
|
-
/* @__PURE__ */ jsxs("div", { className: `${styles.displayNumbers} ${displayStyle}`, children: [
|
|
48
|
-
/* @__PURE__ */ jsxs("div", { className: styles.mainNumber, children: [
|
|
49
|
-
mainNumber,
|
|
50
|
-
mainNumberSuffix && /* @__PURE__ */ jsx("span", { className: styles.mainNumberSuffix, children: mainNumberSuffix })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ jsx("div", { className: styles.secondaryNumber, children: secondaryNumber })
|
|
53
|
-
] })
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
export {
|
|
60
|
-
ToplineResult
|
|
61
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const toplineResult = "_toplineResult_1su0d_9";
|
|
2
|
-
const primaryname = "_primaryname_1su0d_15";
|
|
3
|
-
const secondaryname = "_secondaryname_1su0d_31";
|
|
4
|
-
const name = "_name_1su0d_39";
|
|
5
|
-
const displayNumbers = "_displayNumbers_1su0d_54";
|
|
6
|
-
const mainNumber = "_mainNumber_1su0d_69";
|
|
7
|
-
const mainNumberSuffix = "_mainNumberSuffix_1su0d_75";
|
|
8
|
-
const secondaryNumber = "_secondaryNumber_1su0d_79";
|
|
9
|
-
const displayRow = "_displayRow_1su0d_84";
|
|
10
|
-
const displayColumn = "_displayColumn_1su0d_91";
|
|
11
|
-
const topRow = "_topRow_1su0d_95";
|
|
12
|
-
const defaultStyles = {
|
|
13
|
-
toplineResult,
|
|
14
|
-
primaryname,
|
|
15
|
-
secondaryname,
|
|
16
|
-
name,
|
|
17
|
-
displayNumbers,
|
|
18
|
-
mainNumber,
|
|
19
|
-
mainNumberSuffix,
|
|
20
|
-
secondaryNumber,
|
|
21
|
-
displayRow,
|
|
22
|
-
displayColumn,
|
|
23
|
-
topRow
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
defaultStyles as default,
|
|
27
|
-
displayColumn,
|
|
28
|
-
displayNumbers,
|
|
29
|
-
displayRow,
|
|
30
|
-
mainNumber,
|
|
31
|
-
mainNumberSuffix,
|
|
32
|
-
name,
|
|
33
|
-
primaryname,
|
|
34
|
-
secondaryNumber,
|
|
35
|
-
secondaryname,
|
|
36
|
-
topRow,
|
|
37
|
-
toplineResult
|
|
38
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function CoalitionsTracker({ coalitions, threshold, barChartHeight, listMembersAccessor, listMemberTotalAccessor, listDescriptionAccessor, abbreviationAccessor, thresholdTextBold, thresholdText, styles, labelOverlapConfig, }: {
|
|
2
|
-
coalitions: any;
|
|
3
|
-
threshold: any;
|
|
4
|
-
barChartHeight?: number;
|
|
5
|
-
listMembersAccessor?: string;
|
|
6
|
-
listMemberTotalAccessor?: string;
|
|
7
|
-
listDescriptionAccessor?: string;
|
|
8
|
-
abbreviationAccessor?: string;
|
|
9
|
-
thresholdTextBold: any;
|
|
10
|
-
thresholdText: any;
|
|
11
|
-
styles: any;
|
|
12
|
-
labelOverlapConfig?: {
|
|
13
|
-
labelSize: number;
|
|
14
|
-
moveBothLabels: boolean;
|
|
15
|
-
};
|
|
16
|
-
}): import("preact").JSX.Element;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { useRef, useState, useLayoutEffect } from "preact/hooks";
|
|
3
|
-
import { useWindowSize } from "../../../shared/hooks/useWindowSize.js";
|
|
4
|
-
import { LabelOverlapConfig, StackedBar, LabelType } from "../../particles/stacked-bar/index.js";
|
|
5
|
-
import defaultStyles from "./style.module.scss.js";
|
|
6
|
-
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
7
|
-
function CoalitionsTracker({
|
|
8
|
-
coalitions,
|
|
9
|
-
threshold,
|
|
10
|
-
barChartHeight = 32,
|
|
11
|
-
listMembersAccessor = "parties",
|
|
12
|
-
listMemberTotalAccessor = "totalSeats",
|
|
13
|
-
listDescriptionAccessor = "description",
|
|
14
|
-
abbreviationAccessor = "abbreviation",
|
|
15
|
-
thresholdTextBold,
|
|
16
|
-
thresholdText,
|
|
17
|
-
styles,
|
|
18
|
-
labelOverlapConfig = LabelOverlapConfig
|
|
19
|
-
}) {
|
|
20
|
-
const wrapperRef = useRef(null);
|
|
21
|
-
const thresholdTextRef = useRef(null);
|
|
22
|
-
const [width, setWidth] = useState(0);
|
|
23
|
-
const biggestListTotal = Math.max(
|
|
24
|
-
...coalitions.map(
|
|
25
|
-
(l) => l[listMembersAccessor].reduce(
|
|
26
|
-
(acc, cur) => acc + cur[listMemberTotalAccessor],
|
|
27
|
-
0
|
|
28
|
-
)
|
|
29
|
-
)
|
|
30
|
-
);
|
|
31
|
-
const windowSize = useWindowSize();
|
|
32
|
-
const thresholdTextMinWidth = windowSize.width < 740 ? 66 : 150;
|
|
33
|
-
const thresholdDotWidth = 11;
|
|
34
|
-
const thresholdTextPaddingLeft = 5;
|
|
35
|
-
const maxBarWidth = width - thresholdTextMinWidth - (thresholdDotWidth - 1) / 2 - thresholdTextPaddingLeft;
|
|
36
|
-
const thresholdLeft = threshold / biggestListTotal * maxBarWidth;
|
|
37
|
-
const parsedLists = coalitions.map((coalition) => {
|
|
38
|
-
const listTotal = coalition[listMembersAccessor].reduce(
|
|
39
|
-
(acc, cur) => acc + cur[listMemberTotalAccessor],
|
|
40
|
-
0
|
|
41
|
-
);
|
|
42
|
-
return {
|
|
43
|
-
title: coalition["name"],
|
|
44
|
-
description: coalition[listDescriptionAccessor],
|
|
45
|
-
height: barChartHeight,
|
|
46
|
-
width: listTotal / biggestListTotal * maxBarWidth,
|
|
47
|
-
stack: coalition[listMembersAccessor].map((m) => {
|
|
48
|
-
const listTotal2 = coalition[listMembersAccessor].reduce(
|
|
49
|
-
(acc, cur) => acc + cur[listMemberTotalAccessor],
|
|
50
|
-
0
|
|
51
|
-
);
|
|
52
|
-
return {
|
|
53
|
-
label: m[listMemberTotalAccessor],
|
|
54
|
-
fraction: m[listMemberTotalAccessor] / listTotal2,
|
|
55
|
-
abbreviation: m[abbreviationAccessor]
|
|
56
|
-
};
|
|
57
|
-
}).sort((a, b) => b.fraction - a.fraction)
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
styles = mergeStyles(defaultStyles, styles);
|
|
61
|
-
useLayoutEffect(() => {
|
|
62
|
-
const newWidth = wrapperRef.current.getBoundingClientRect().width;
|
|
63
|
-
setWidth(newWidth);
|
|
64
|
-
}, [windowSize]);
|
|
65
|
-
const renderCoalition = (list, index) => {
|
|
66
|
-
if (list.width <= 0) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsxs(
|
|
70
|
-
"div",
|
|
71
|
-
{
|
|
72
|
-
className: styles.coalition,
|
|
73
|
-
style: { position: "relative", zIndex: 2 },
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsx("h3", { className: styles.title, children: list.title }),
|
|
76
|
-
/* @__PURE__ */ jsx(
|
|
77
|
-
"p",
|
|
78
|
-
{
|
|
79
|
-
className: styles.description,
|
|
80
|
-
style: { maxWidth: thresholdLeft <= 620 ? thresholdLeft - 8 : 620 },
|
|
81
|
-
children: list.description
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
StackedBar,
|
|
86
|
-
{
|
|
87
|
-
labelOverlapConfig,
|
|
88
|
-
labelType: LabelType.hanging,
|
|
89
|
-
stack: list.stack,
|
|
90
|
-
width: list.width,
|
|
91
|
-
height: barChartHeight,
|
|
92
|
-
createSVG: true,
|
|
93
|
-
styles
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
index
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: styles.coalitionsWrapper, children: [
|
|
102
|
-
/* @__PURE__ */ jsx("div", { className: styles.coalitionsContainer, children: parsedLists.map(renderCoalition) }),
|
|
103
|
-
/* @__PURE__ */ jsx(
|
|
104
|
-
"div",
|
|
105
|
-
{
|
|
106
|
-
className: styles.thresholdDot,
|
|
107
|
-
style: {
|
|
108
|
-
position: "absolute",
|
|
109
|
-
height: thresholdDotWidth,
|
|
110
|
-
width: thresholdDotWidth,
|
|
111
|
-
top: 0,
|
|
112
|
-
left: 0.5 + thresholdLeft - thresholdDotWidth / 2
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ jsx(
|
|
117
|
-
"div",
|
|
118
|
-
{
|
|
119
|
-
className: styles.thresholdLine,
|
|
120
|
-
style: {
|
|
121
|
-
position: "absolute",
|
|
122
|
-
height: "100%",
|
|
123
|
-
width: 1,
|
|
124
|
-
top: 0,
|
|
125
|
-
left: thresholdLeft
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
/* @__PURE__ */ jsxs(
|
|
130
|
-
"div",
|
|
131
|
-
{
|
|
132
|
-
ref: thresholdTextRef,
|
|
133
|
-
className: styles.thresholdText,
|
|
134
|
-
style: {
|
|
135
|
-
position: "absolute",
|
|
136
|
-
minWidth: thresholdTextMinWidth,
|
|
137
|
-
width: "auto",
|
|
138
|
-
top: -(thresholdDotWidth + 1) / 2,
|
|
139
|
-
left: thresholdLeft + (thresholdDotWidth - 1) / 2 + thresholdTextPaddingLeft
|
|
140
|
-
},
|
|
141
|
-
children: [
|
|
142
|
-
thresholdTextBold && /* @__PURE__ */ jsx("span", { className: styles.thresholdTextBold, children: thresholdTextBold }),
|
|
143
|
-
thresholdText && /* @__PURE__ */ jsx("span", { children: thresholdText })
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
] });
|
|
148
|
-
}
|
|
149
|
-
export {
|
|
150
|
-
CoalitionsTracker
|
|
151
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const coalitionsWrapper = "_coalitionsWrapper_4egbd_9";
|
|
2
|
-
const coalitionsContainer = "_coalitionsContainer_4egbd_14";
|
|
3
|
-
const coalition = "_coalition_4egbd_9";
|
|
4
|
-
const title = "_title_4egbd_27";
|
|
5
|
-
const description = "_description_4egbd_28";
|
|
6
|
-
const thresholdText = "_thresholdText_4egbd_43";
|
|
7
|
-
const thresholdTextBold = "_thresholdTextBold_4egbd_54";
|
|
8
|
-
const thresholdDot = "_thresholdDot_4egbd_61";
|
|
9
|
-
const thresholdLine = "_thresholdLine_4egbd_62";
|
|
10
|
-
const defaultStyles = {
|
|
11
|
-
coalitionsWrapper,
|
|
12
|
-
coalitionsContainer,
|
|
13
|
-
coalition,
|
|
14
|
-
title,
|
|
15
|
-
description,
|
|
16
|
-
thresholdText,
|
|
17
|
-
thresholdTextBold,
|
|
18
|
-
thresholdDot,
|
|
19
|
-
thresholdLine
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
coalition,
|
|
23
|
-
coalitionsContainer,
|
|
24
|
-
coalitionsWrapper,
|
|
25
|
-
defaultStyles as default,
|
|
26
|
-
description,
|
|
27
|
-
thresholdDot,
|
|
28
|
-
thresholdLine,
|
|
29
|
-
thresholdText,
|
|
30
|
-
thresholdTextBold,
|
|
31
|
-
title
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function Gradient(): import("preact").JSX.Element;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
-
import styles from "./style.module.scss.js";
|
|
3
|
-
function Gradient() {
|
|
4
|
-
return /* @__PURE__ */ jsxs(
|
|
5
|
-
"svg",
|
|
6
|
-
{
|
|
7
|
-
width: "100%",
|
|
8
|
-
height: "100%",
|
|
9
|
-
viewBox: "0 0 10 10",
|
|
10
|
-
fill: "none",
|
|
11
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
-
preserveAspectRatio: "none",
|
|
13
|
-
children: [
|
|
14
|
-
/* @__PURE__ */ jsx("g", { className: styles.gradient, children: /* @__PURE__ */ jsx("rect", { fill: "url(#paint0_linear_3798_6653)" }) }),
|
|
15
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
16
|
-
"linearGradient",
|
|
17
|
-
{
|
|
18
|
-
id: "paint0_linear_3798_6653",
|
|
19
|
-
x1: "0%",
|
|
20
|
-
y1: "0%",
|
|
21
|
-
x2: "100%",
|
|
22
|
-
y2: "0%",
|
|
23
|
-
children: [
|
|
24
|
-
/* @__PURE__ */ jsx("stop", { className: styles.firstStop }),
|
|
25
|
-
/* @__PURE__ */ jsx("stop", { className: styles.lastStop, offset: "1" })
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
) })
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
Gradient
|
|
35
|
-
};
|