@guardian/interactive-component-library 0.2.0-rc1 → 0.2.0-rc2
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/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/dayjs.min.js +4 -0
- package/dist/_virtual/relativeTime.js +4 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/molecules/canvas-map/Map.d.ts +17 -0
- package/dist/components/molecules/canvas-map/Map.js +89 -0
- package/dist/components/molecules/canvas-map/context/MapContext.d.ts +19 -0
- package/dist/components/molecules/canvas-map/context/MapContext.js +20 -0
- package/dist/components/molecules/canvas-map/controls/ZoomControl.d.ts +6 -0
- package/dist/components/molecules/canvas-map/controls/ZoomControl.js +40 -0
- package/dist/components/molecules/canvas-map/controls/icons/index.d.ts +3 -0
- package/dist/components/molecules/canvas-map/controls/icons/minus.d.ts +1 -0
- package/dist/components/molecules/canvas-map/controls/icons/minus.js +25 -0
- package/dist/components/molecules/canvas-map/controls/icons/plus.d.ts +1 -0
- package/dist/components/molecules/canvas-map/controls/icons/plus.js +25 -0
- package/dist/components/molecules/canvas-map/controls/icons/reset.d.ts +3 -0
- package/dist/components/molecules/canvas-map/controls/icons/reset.js +25 -0
- package/dist/components/molecules/canvas-map/controls/index.d.ts +1 -0
- package/dist/components/molecules/canvas-map/controls/style.module.css.js +11 -0
- package/dist/components/molecules/canvas-map/index.d.ts +12 -0
- package/dist/components/molecules/canvas-map/lib/Feature.d.ts +38 -0
- package/dist/components/molecules/canvas-map/lib/Feature.js +104 -0
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +20 -0
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +23 -0
- package/dist/components/molecules/canvas-map/lib/Map.d.ts +69 -0
- package/dist/components/molecules/canvas-map/lib/Map.js +254 -0
- package/dist/components/molecules/canvas-map/lib/View.d.ts +136 -0
- package/dist/components/molecules/canvas-map/lib/View.js +179 -0
- package/dist/components/molecules/canvas-map/lib/events/Dispatcher.d.ts +8 -0
- package/dist/components/molecules/canvas-map/lib/events/Dispatcher.js +35 -0
- package/dist/components/molecules/canvas-map/lib/events/MapEvent.d.ts +6 -0
- package/dist/components/molecules/canvas-map/lib/events/MapEvent.js +9 -0
- package/dist/components/molecules/canvas-map/lib/events/index.d.ts +2 -0
- package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.d.ts +10 -0
- package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +96 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Geometry.d.ts +32 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Geometry.js +41 -0
- package/dist/components/molecules/canvas-map/lib/geometry/LineString.d.ts +12 -0
- package/dist/components/molecules/canvas-map/lib/geometry/LineString.js +19 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Point.d.ts +11 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Point.js +16 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Polygon.d.ts +16 -0
- package/dist/components/molecules/canvas-map/lib/geometry/Polygon.js +46 -0
- package/dist/components/molecules/canvas-map/lib/geometry/index.d.ts +4 -0
- package/dist/components/molecules/canvas-map/lib/interpolators/index.d.ts +2 -0
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.d.ts +5 -0
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.js +95 -0
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.d.ts +4 -0
- package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js +65 -0
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +52 -0
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +111 -0
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +53 -0
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +132 -0
- package/dist/components/molecules/canvas-map/lib/layers/index.d.ts +3 -0
- package/dist/components/molecules/canvas-map/lib/projection/index.d.ts +22 -0
- package/dist/components/molecules/canvas-map/lib/projection/index.js +12 -0
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +6 -0
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +46 -0
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.d.ts +6 -0
- package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +53 -0
- package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.d.ts +17 -0
- package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +119 -0
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +10 -0
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +78 -0
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +15 -0
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +56 -0
- package/dist/components/molecules/canvas-map/lib/styles/Fill.d.ts +7 -0
- package/dist/components/molecules/canvas-map/lib/styles/Fill.js +15 -0
- package/dist/components/molecules/canvas-map/lib/styles/Stroke.d.ts +8 -0
- package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +16 -0
- package/dist/components/molecules/canvas-map/lib/styles/Style.d.ts +24 -0
- package/dist/components/molecules/canvas-map/lib/styles/Style.js +17 -0
- package/dist/components/molecules/canvas-map/lib/styles/Text.d.ts +10 -0
- package/dist/components/molecules/canvas-map/lib/styles/Text.js +14 -0
- package/dist/components/molecules/canvas-map/lib/styles/index.d.ts +4 -0
- package/dist/components/molecules/canvas-map/lib/util/array.d.ts +6 -0
- package/dist/components/molecules/canvas-map/lib/util/array.js +15 -0
- package/dist/components/molecules/canvas-map/lib/util/bboxFeature.d.ts +8 -0
- package/dist/components/molecules/canvas-map/lib/util/bboxFeature.js +26 -0
- package/dist/components/molecules/canvas-map/lib/util/debug.d.ts +11 -0
- package/dist/components/molecules/canvas-map/lib/util/debug.js +27 -0
- package/dist/components/molecules/canvas-map/lib/util/deflate.d.ts +36 -0
- package/dist/components/molecules/canvas-map/lib/util/distance.d.ts +1 -0
- package/dist/components/molecules/canvas-map/lib/util/distance.js +12 -0
- package/dist/components/molecules/canvas-map/lib/util/dom.d.ts +9 -0
- package/dist/components/molecules/canvas-map/lib/util/dom.js +28 -0
- package/dist/components/molecules/canvas-map/lib/util/extent.d.ts +21 -0
- package/dist/components/molecules/canvas-map/lib/util/extent.js +38 -0
- package/dist/components/molecules/canvas-map/lib/util/memoise.d.ts +10 -0
- package/dist/components/molecules/canvas-map/lib/util/memoise.js +20 -0
- package/dist/components/molecules/canvas-map/lib/util/resolution.d.ts +9 -0
- package/dist/components/molecules/canvas-map/lib/util/resolution.js +11 -0
- package/dist/components/molecules/canvas-map/lib/util/simplify.d.ts +114 -0
- package/dist/components/molecules/canvas-map/lib/util/size.d.ts +32 -0
- package/dist/components/molecules/canvas-map/lib/util/size.js +53 -0
- package/dist/components/molecules/canvas-map/lib/util/toRgba.d.ts +1 -0
- package/dist/components/molecules/canvas-map/lib/util/toRgba.js +25 -0
- package/dist/components/molecules/canvas-map/lib/util/uid.d.ts +5 -0
- package/dist/components/molecules/canvas-map/lib/util/uid.js +7 -0
- package/dist/components/molecules/canvas-map/lib/util/zoomLevel.d.ts +2 -0
- package/dist/components/molecules/canvas-map/lib/util/zoomLevel.js +14 -0
- package/dist/components/molecules/canvas-map/style.module.scss.js +20 -0
- package/dist/components/molecules/column-chart/column-chart-example.d.ts +35 -0
- package/dist/components/molecules/column-chart/column-chart-util.d.ts +1 -0
- package/dist/components/molecules/column-chart/index.d.ts +11 -0
- package/dist/components/molecules/column-chart/index.js +63 -0
- package/dist/components/molecules/column-chart/style.module.css.js +14 -0
- package/dist/components/molecules/control-change/index.d.ts +6 -0
- package/dist/components/molecules/control-change/index.js +29 -0
- package/dist/components/molecules/control-change/style.module.css.js +11 -0
- package/dist/components/molecules/dropdown/index.d.ts +11 -0
- package/dist/components/molecules/dropdown/index.js +191 -0
- package/dist/components/molecules/dropdown/style.module.css.js +50 -0
- package/dist/components/molecules/first-past-the-post-waffle/index.d.ts +5 -0
- package/dist/components/molecules/first-past-the-post-waffle/index.js +14 -0
- package/dist/components/molecules/first-past-the-post-waffle/style.module.css.js +14 -0
- package/dist/components/molecules/index.d.ts +17 -0
- package/dist/components/molecules/modal/index.d.ts +8 -0
- package/dist/components/molecules/modal/index.js +59 -0
- package/dist/components/molecules/modal/style.module.css.js +26 -0
- package/dist/components/molecules/page-section/index.d.ts +8 -0
- package/dist/components/molecules/page-section/index.js +52 -0
- package/dist/components/molecules/page-section/style.module.scss.js +20 -0
- package/dist/components/molecules/party-profile/index.d.ts +10 -0
- package/dist/components/molecules/party-profile/index.js +29 -0
- package/dist/components/molecules/party-profile/style.module.css.js +26 -0
- package/dist/components/molecules/refresh-indicator/index.d.ts +4 -0
- package/dist/components/molecules/refresh-indicator/index.js +18 -0
- package/dist/components/molecules/refresh-indicator/style.module.scss.js +17 -0
- package/dist/components/molecules/responsive-grid/index.d.ts +10 -0
- package/dist/components/molecules/responsive-grid/index.js +19 -0
- package/dist/components/molecules/responsive-grid/style.module.scss.js +8 -0
- package/dist/components/molecules/result-summary/index.d.ts +8 -0
- package/dist/components/molecules/result-summary/index.js +36 -0
- package/dist/components/molecules/result-summary/style.module.css.js +11 -0
- package/dist/components/molecules/search-input/icons/search.d.ts +1 -0
- package/dist/components/molecules/search-input/icons/search.js +24 -0
- package/dist/components/molecules/search-input/icons/search.module.css.js +11 -0
- package/dist/components/molecules/search-input/index.d.ts +11 -0
- package/dist/components/molecules/search-input/index.js +164 -0
- package/dist/components/molecules/search-input/style.module.css.js +32 -0
- package/dist/components/molecules/slope-chart/index.d.ts +16 -0
- package/dist/components/molecules/slope-chart/index.js +139 -0
- package/dist/components/molecules/slope-chart/style.module.css.js +35 -0
- package/dist/components/molecules/svg-map/context/MapContext.d.ts +1 -0
- package/dist/components/molecules/svg-map/context/MapContext.js +5 -0
- package/dist/components/molecules/svg-map/context/SVGMapProvider.d.ts +10 -0
- package/dist/components/molecules/svg-map/context/SVGMapProvider.js +88 -0
- package/dist/components/molecules/svg-map/helpers/bboxFeature.d.ts +8 -0
- package/dist/components/molecules/svg-map/helpers/bboxFeature.js +26 -0
- package/dist/components/molecules/svg-map/helpers/dynamicPropValue.d.ts +1 -0
- package/dist/components/molecules/svg-map/helpers/dynamicPropValue.js +9 -0
- package/dist/components/molecules/svg-map/helpers/geoMath.d.ts +4 -0
- package/dist/components/molecules/svg-map/helpers/saveSVG.d.ts +1 -0
- package/dist/components/molecules/svg-map/hooks/useCamera.d.ts +0 -0
- package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.d.ts +4 -0
- package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.js +19 -0
- package/dist/components/molecules/svg-map/index.d.ts +38 -0
- package/dist/components/molecules/svg-map/index.js +120 -0
- package/dist/components/molecules/svg-map/layers/CompositionBorders.d.ts +3 -0
- package/dist/components/molecules/svg-map/layers/CompositionBorders.js +14 -0
- package/dist/components/molecules/svg-map/layers/Line.d.ts +7 -0
- package/dist/components/molecules/svg-map/layers/Line.js +48 -0
- package/dist/components/molecules/svg-map/layers/Point.d.ts +10 -0
- package/dist/components/molecules/svg-map/layers/Point.js +59 -0
- package/dist/components/molecules/svg-map/layers/Polygon.d.ts +9 -0
- package/dist/components/molecules/svg-map/layers/Polygon.js +75 -0
- package/dist/components/molecules/svg-map/layers/Prerendered.d.ts +3 -0
- package/dist/components/molecules/svg-map/layers/Prerendered.js +11 -0
- package/dist/components/molecules/svg-map/layers/compositionBorders.module.scss.js +8 -0
- package/dist/components/molecules/svg-map/layers/index.d.ts +5 -0
- package/dist/components/molecules/svg-map/layers/index.js +12 -0
- package/dist/components/molecules/svg-map/renderers/SVGRenderer.d.ts +3 -0
- package/dist/components/molecules/svg-map/renderers/SVGRenderer.js +32 -0
- package/dist/components/molecules/svg-map/style.module.css.js +11 -0
- package/dist/components/molecules/table/index.d.ts +7 -0
- package/dist/components/molecules/table/index.js +90 -0
- package/dist/components/molecules/table/style.module.scss.js +29 -0
- package/dist/components/molecules/table/useTable.d.ts +8 -0
- package/dist/components/molecules/table/useTable.js +128 -0
- package/dist/components/molecules/tooltip/index.d.ts +82 -0
- package/dist/components/molecules/tooltip/index.js +117 -0
- package/dist/components/molecules/tooltip/style.module.css.js +8 -0
- package/dist/components/molecules/topline-result/index.d.ts +3 -0
- package/dist/components/molecules/topline-result/index.js +61 -0
- package/dist/components/molecules/topline-result/style.module.scss.js +38 -0
- package/dist/components/organisms/coalitions-tracker/index.d.ts +16 -0
- package/dist/components/organisms/coalitions-tracker/index.js +151 -0
- package/dist/components/organisms/coalitions-tracker/style.module.scss.js +32 -0
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/ticker/gradient/index.d.ts +1 -0
- package/dist/components/organisms/ticker/gradient/index.js +35 -0
- package/dist/components/organisms/ticker/gradient/style.module.scss.js +14 -0
- package/dist/components/organisms/ticker/index.d.ts +5 -0
- package/dist/components/organisms/ticker/index.js +102 -0
- package/dist/components/organisms/ticker/style.module.scss.js +32 -0
- package/dist/components/particles/ad-slot/index.d.ts +40 -0
- package/dist/components/particles/ad-slot/index.js +34 -0
- package/dist/components/particles/ad-slot/style.module.css.js +11 -0
- package/dist/components/particles/arrow-button/index.d.ts +6 -0
- package/dist/components/particles/arrow-button/index.js +32 -0
- package/dist/components/particles/arrow-button/style.module.css.js +11 -0
- package/dist/components/particles/aspect-ratio-box/index.d.ts +4 -0
- package/dist/components/particles/aspect-ratio-box/index.js +15 -0
- package/dist/components/particles/aspect-ratio-box/style.module.css.js +6 -0
- package/dist/components/particles/button/index.d.ts +6 -0
- package/dist/components/particles/button/index.js +10 -0
- package/dist/components/particles/button/style.module.css.js +11 -0
- package/dist/components/particles/change-bar/index.d.ts +8 -0
- package/dist/components/particles/change-bar/index.js +27 -0
- package/dist/components/particles/change-bar/style.module.scss.js +14 -0
- package/dist/components/particles/chevron/index.d.ts +6 -0
- package/dist/components/particles/chevron/index.js +78 -0
- package/dist/components/particles/chevron/style.module.css.js +20 -0
- package/dist/components/particles/circle-icon/index.d.ts +6 -0
- package/dist/components/particles/circle-icon/index.js +32 -0
- package/dist/components/particles/circle-icon/style.module.css.js +14 -0
- package/dist/components/particles/close-button/index.d.ts +5 -0
- package/dist/components/particles/close-button/index.js +35 -0
- package/dist/components/particles/close-button/style.module.css.js +17 -0
- package/dist/components/particles/container/index.d.ts +5 -0
- package/dist/components/particles/container/index.js +13 -0
- package/dist/components/particles/container/style.module.scss.js +11 -0
- package/dist/components/particles/gradient-icon/index.d.ts +1 -0
- package/dist/components/particles/gradient-icon/index.js +46 -0
- package/dist/components/particles/gradient-icon/style.module.css.js +14 -0
- package/dist/components/particles/index.d.ts +18 -0
- package/dist/components/particles/info-button/index.d.ts +3 -0
- package/dist/components/particles/info-button/index.js +19 -0
- package/dist/components/particles/info-button/style.module.css.js +11 -0
- package/dist/components/particles/legend-item/index.d.ts +6 -0
- package/dist/components/particles/legend-item/index.js +26 -0
- package/dist/components/particles/legend-item/style.module.css.js +17 -0
- package/dist/components/particles/relative-time-sentence/index.d.ts +4 -0
- package/dist/components/particles/relative-time-sentence/index.js +14 -0
- package/dist/components/particles/relative-time-sentence/style.module.css.js +8 -0
- package/dist/components/particles/square-cut-corner-icon/index.d.ts +6 -0
- package/dist/components/particles/square-cut-corner-icon/index.js +56 -0
- package/dist/components/particles/square-cut-corner-icon/style.module.scss.js +17 -0
- package/dist/components/particles/square-icon/index.d.ts +5 -0
- package/dist/components/particles/square-icon/index.js +28 -0
- package/dist/components/particles/square-icon/style.module.scss.js +11 -0
- package/dist/components/particles/stacked-bar/index.d.ts +23 -0
- package/dist/components/particles/stacked-bar/index.js +140 -0
- package/dist/components/particles/stacked-bar/style.module.css.js +17 -0
- package/dist/components/particles/stacked-grid/index.d.ts +6 -0
- package/dist/components/particles/stacked-grid/index.js +35 -0
- package/dist/components/particles/stacked-grid/style.module.css.js +20 -0
- package/dist/components/particles/waffle/index.d.ts +14 -0
- package/dist/components/particles/waffle/index.js +76 -0
- package/dist/components/particles/waffle/style.module.css.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +128 -0
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +338 -0
- package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +13 -0
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/albersUk.js +108 -0
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/bounds.js +24 -0
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/fit.js +18 -0
- package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/math.js +4 -0
- package/dist/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +70 -0
- package/dist/node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js +6 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js +24 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js +4 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js +8 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js +20 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js +43 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js +28 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js +59 -0
- package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js +18 -0
- package/dist/node_modules/.pnpm/d3-path@2.0.0/node_modules/d3-path/src/path.js +73 -0
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js +13 -0
- package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +96 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js +21 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js +5 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js +9 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js +39 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js +55 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js +42 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js +18 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js +18 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js +14 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js +15 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js +23 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js +16 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js +68 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js +11 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js +18 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js +23 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js +13 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js +125 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js +20 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js +24 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js +8 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js +47 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js +25 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js +18 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js +25 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js +22 -0
- package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js +64 -0
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/dayjs.min.js +282 -0
- package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/plugin/relativeTime.js +48 -0
- package/dist/node_modules/.pnpm/flatbush@4.4.0/node_modules/flatbush/index.js +339 -0
- package/dist/node_modules/.pnpm/flatqueue@2.0.3/node_modules/flatqueue/index.js +67 -0
- package/dist/node_modules/.pnpm/preact-merge-refs@1.0.2_preact@10.21.0/node_modules/preact-merge-refs/lib/preact-merge-refs.modern.js +10 -0
- package/dist/node_modules/.pnpm/preact-transitioning@1.4.1_preact@10.21.0/node_modules/preact-transitioning/lib/preact-transitioning.modern.js +63 -0
- package/dist/node_modules/.pnpm/quickselect@2.0.0/node_modules/quickselect/index.js +47 -0
- package/dist/node_modules/.pnpm/rbush-knn@4.0.0/node_modules/rbush-knn/index.js +42 -0
- package/dist/node_modules/.pnpm/rbush@4.0.0/node_modules/rbush/index.js +378 -0
- package/dist/node_modules/.pnpm/tinyqueue@2.0.3/node_modules/tinyqueue/index.js +65 -0
- package/dist/shared/colors/index.d.ts +2 -0
- package/dist/shared/helpers/createStore.d.ts +1 -0
- package/dist/shared/helpers/geometry.d.ts +3 -0
- package/dist/shared/helpers/geometry.js +16 -0
- package/dist/shared/helpers/geometry.test.d.ts +1 -0
- package/dist/shared/helpers/labelsUtil.d.ts +54 -0
- package/dist/shared/helpers/labelsUtil.js +58 -0
- package/dist/shared/helpers/labelsUtils.test.d.ts +1 -0
- package/dist/shared/helpers/shouldUpdate.d.ts +7 -0
- package/dist/shared/hooks/index.d.ts +3 -0
- package/dist/shared/hooks/useContainerSize.d.ts +1 -0
- package/dist/shared/hooks/useContainerSize.js +24 -0
- package/dist/shared/hooks/useTouchOrHover.d.ts +6 -0
- package/dist/shared/hooks/useTouchOrHover.js +95 -0
- package/dist/shared/hooks/useWindowSize.d.ts +4 -0
- package/dist/shared/hooks/useWindowSize.js +27 -0
- package/dist/style.css +74 -74
- package/dist/styles/helpers/mergeStyles.d.ts +1 -0
- package/dist/styles/helpers/mergeStyles.js +22 -0
- package/dist/styles/helpers/mergeStyles.test.d.ts +1 -0
- package/dist/styles/theme.config.d.ts +124 -0
- package/package.json +6 -9
- package/dist/interactive-component-library.js +0 -7993
- package/dist/interactive-component-library.js.map +0 -1
- package/dist/interactive-component-library.umd.cjs +0 -7989
- package/dist/interactive-component-library.umd.cjs.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function Gradient(): import("preact").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const gradient = "_gradient_plpaq_9";
|
|
2
|
+
const firstStop = "_firstStop_plpaq_24";
|
|
3
|
+
const lastStop = "_lastStop_plpaq_29";
|
|
4
|
+
const styles = {
|
|
5
|
+
gradient,
|
|
6
|
+
firstStop,
|
|
7
|
+
lastStop
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
styles as default,
|
|
11
|
+
firstStop,
|
|
12
|
+
gradient,
|
|
13
|
+
lastStop
|
|
14
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { toChildArray } from "preact";
|
|
3
|
+
import { useState, useMemo, useRef, useLayoutEffect } from "preact/hooks";
|
|
4
|
+
import { Gradient } from "./gradient/index.js";
|
|
5
|
+
import "../../particles/info-button/index.js";
|
|
6
|
+
import "../../particles/relative-time-sentence/index.js";
|
|
7
|
+
import { ArrowButton } from "../../particles/arrow-button/index.js";
|
|
8
|
+
import { Button } from "../../particles/button/index.js";
|
|
9
|
+
import styles from "./style.module.scss.js";
|
|
10
|
+
function Ticker({ maxItems = 20, onStateChange, children }) {
|
|
11
|
+
const [pageIndex, setPageIndex] = useState(0);
|
|
12
|
+
const [pageWidth, setPageWidth] = useState(0);
|
|
13
|
+
const [numberOfPages, setNumberOfPages] = useState(0);
|
|
14
|
+
const offsetWidth = useMemo(() => {
|
|
15
|
+
return -pageIndex * (pageWidth || 0);
|
|
16
|
+
}, [pageIndex, pageWidth]);
|
|
17
|
+
const tickerRef = useRef();
|
|
18
|
+
const tickerItemsRef = useRef();
|
|
19
|
+
const tickerScrollRef = useRef();
|
|
20
|
+
const controlsRef = useRef();
|
|
21
|
+
const [hideButtons, setHideButtons] = useState(false);
|
|
22
|
+
const [expanded, setExpanded] = useState(false);
|
|
23
|
+
const childArray = toChildArray(children);
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
const tickerItemsContainer = tickerItemsRef.current;
|
|
26
|
+
const pageWidth2 = tickerItemsContainer.clientWidth * 0.75;
|
|
27
|
+
setPageWidth(pageWidth2);
|
|
28
|
+
const numberOfPages2 = Math.ceil(
|
|
29
|
+
tickerScrollRef.current.scrollWidth / pageWidth2
|
|
30
|
+
);
|
|
31
|
+
setNumberOfPages(numberOfPages2);
|
|
32
|
+
}, [childArray]);
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
const hideButtons2 = childArray.length < 4;
|
|
35
|
+
setHideButtons(hideButtons2);
|
|
36
|
+
}, [childArray]);
|
|
37
|
+
function toggleExpandedState() {
|
|
38
|
+
if (expanded) {
|
|
39
|
+
tickerRef.current.scrollIntoView({ behavior: "smooth", alignToTop: true });
|
|
40
|
+
}
|
|
41
|
+
setExpanded((expanded2) => {
|
|
42
|
+
const newState = !expanded2;
|
|
43
|
+
if (onStateChange) onStateChange({ expanded: newState });
|
|
44
|
+
return newState;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
ref: tickerRef,
|
|
51
|
+
className: styles.ticker,
|
|
52
|
+
style: `--ticker-offset: ${offsetWidth}px;`,
|
|
53
|
+
"data-expanded": expanded,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx("div", { ref: tickerItemsRef, className: styles.tickerItems, children: /* @__PURE__ */ jsx("div", { ref: tickerScrollRef, className: styles.tickerScroll, children: childArray.map((child, index) => {
|
|
56
|
+
var _a;
|
|
57
|
+
return /* @__PURE__ */ jsx("div", { className: styles.tickerItem, children: child }, ((_a = child == null ? void 0 : child.props) == null ? void 0 : _a.id) ?? index);
|
|
58
|
+
}) }) }),
|
|
59
|
+
/* @__PURE__ */ jsxs(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: controlsRef,
|
|
63
|
+
className: styles.controls,
|
|
64
|
+
style: hideButtons && { display: "none" },
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: styles.gradient, children: /* @__PURE__ */ jsx(Gradient, {}) }),
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: styles.buttons, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
ArrowButton,
|
|
70
|
+
{
|
|
71
|
+
onClick: () => setPageIndex((d) => d + 1),
|
|
72
|
+
disabled: pageIndex >= numberOfPages - 2
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
ArrowButton,
|
|
77
|
+
{
|
|
78
|
+
direction: "left",
|
|
79
|
+
onClick: () => setPageIndex((d) => d - 1),
|
|
80
|
+
disabled: pageIndex <= 0
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsx("div", { className: styles.button, children: /* @__PURE__ */ jsx(
|
|
85
|
+
Button,
|
|
86
|
+
{
|
|
87
|
+
type: "regular",
|
|
88
|
+
styles: { buttonInner: styles.buttonInner },
|
|
89
|
+
onClick: toggleExpandedState,
|
|
90
|
+
children: expanded ? "Show fewer" : `Show ${maxItems} most recent`
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
Ticker
|
|
102
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const ticker = "_ticker_15ezr_9";
|
|
2
|
+
const tickerItems = "_tickerItems_15ezr_21";
|
|
3
|
+
const tickerScroll = "_tickerScroll_15ezr_26";
|
|
4
|
+
const tickerItem = "_tickerItem_15ezr_21";
|
|
5
|
+
const controls = "_controls_15ezr_48";
|
|
6
|
+
const gradient = "_gradient_15ezr_63";
|
|
7
|
+
const buttons = "_buttons_15ezr_75";
|
|
8
|
+
const button = "_button_15ezr_75";
|
|
9
|
+
const buttonInner = "_buttonInner_15ezr_101";
|
|
10
|
+
const styles = {
|
|
11
|
+
ticker,
|
|
12
|
+
tickerItems,
|
|
13
|
+
tickerScroll,
|
|
14
|
+
tickerItem,
|
|
15
|
+
controls,
|
|
16
|
+
gradient,
|
|
17
|
+
buttons,
|
|
18
|
+
button,
|
|
19
|
+
buttonInner
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
button,
|
|
23
|
+
buttonInner,
|
|
24
|
+
buttons,
|
|
25
|
+
controls,
|
|
26
|
+
styles as default,
|
|
27
|
+
gradient,
|
|
28
|
+
ticker,
|
|
29
|
+
tickerItem,
|
|
30
|
+
tickerItems,
|
|
31
|
+
tickerScroll
|
|
32
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Array of available breakpoints.
|
|
3
|
+
* @typedef {"mobile" | "phablet" | "tablet" | "desktop"} Breakpoint
|
|
4
|
+
*
|
|
5
|
+
* Type representing an ad size, defined as a tuple of two numbers in the format [width, height].
|
|
6
|
+
* @typedef {[number, number]} AdSize
|
|
7
|
+
*
|
|
8
|
+
* Type representing a size mapping for different breakpoints,
|
|
9
|
+
* the breakpoints cascade from the smallest to the largest.
|
|
10
|
+
* AKA if only mobile and desktop are defined, the mobile size will be used for phablet and tablet.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {Partial<Record<Breakpoint, AdSize[]>>} SizeMapping
|
|
13
|
+
*
|
|
14
|
+
* @interface AdSlotProps
|
|
15
|
+
* @property {string} name - The unique name of the ad slot.
|
|
16
|
+
* @property {SizeMapping} sizeMapping - The size mapping for the ad slot.
|
|
17
|
+
* @property {Object} styles - The styles for the ad slot.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* A placeholder for an ad slot, the commercial bundle will fill this slot with an ad,
|
|
21
|
+
* matching the size mapping.
|
|
22
|
+
*
|
|
23
|
+
* @param {AdSlotProps} props
|
|
24
|
+
* @returns {React.ComponentElement<AdSlotProps, null>}
|
|
25
|
+
*/
|
|
26
|
+
export function AdSlot({ name, sizeMapping, styles }: AdSlotProps): React.ComponentElement<AdSlotProps, null>;
|
|
27
|
+
/**
|
|
28
|
+
* Type representing an ad size, defined as a tuple of two numbers in the format [width, height].
|
|
29
|
+
*/
|
|
30
|
+
export type Breakpoint = "mobile" | "phablet" | "tablet" | "desktop";
|
|
31
|
+
/**
|
|
32
|
+
* Type representing a size mapping for different breakpoints,
|
|
33
|
+
* the breakpoints cascade from the smallest to the largest.
|
|
34
|
+
* AKA if only mobile and desktop are defined, the mobile size will be used for phablet and tablet.
|
|
35
|
+
*/
|
|
36
|
+
export type AdSize = [number, number];
|
|
37
|
+
/**
|
|
38
|
+
* Array of available breakpoints.
|
|
39
|
+
*/
|
|
40
|
+
export type SizeMapping = Partial<Record<Breakpoint, AdSize[]>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
3
|
+
import defaultStyles from "./style.module.css.js";
|
|
4
|
+
function AdSlot({ name, sizeMapping, styles }) {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
const slotId = `dfp-ad--${name}`;
|
|
7
|
+
styles = mergeStyles(defaultStyles, styles);
|
|
8
|
+
const mobileSizes = (_a = sizeMapping.mobile) == null ? void 0 : _a.map((size) => size.join(",")).join("|");
|
|
9
|
+
const tabletSizes = (_b = sizeMapping.tablet) == null ? void 0 : _b.map((size) => size.join(",")).join("|");
|
|
10
|
+
const desktopSizes = (_c = sizeMapping.desktop) == null ? void 0 : _c.map((size) => size.join(",")).join("|");
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { className: ["ad-slot-container", styles.container].join(" "), children: /* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
id: slotId,
|
|
15
|
+
className: [
|
|
16
|
+
"js-ad-slot",
|
|
17
|
+
"ad-slot",
|
|
18
|
+
"interactive-ad-slot",
|
|
19
|
+
styles.slot
|
|
20
|
+
].join(" "),
|
|
21
|
+
"data-link-name": `ad slot ${name}`,
|
|
22
|
+
"data-name": `${name}`,
|
|
23
|
+
"data-label-show": "true",
|
|
24
|
+
"ad-label-text": "Advertisement",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
"data-mobile": mobileSizes,
|
|
27
|
+
"data-tablet": tabletSizes,
|
|
28
|
+
"data-desktop": desktopSizes
|
|
29
|
+
}
|
|
30
|
+
) });
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
AdSlot
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import defaultStyles from "./style.module.css.js";
|
|
3
|
+
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
4
|
+
function ArrowButton({
|
|
5
|
+
direction = "right",
|
|
6
|
+
disabled = false,
|
|
7
|
+
styles,
|
|
8
|
+
onClick
|
|
9
|
+
}) {
|
|
10
|
+
styles = mergeStyles(defaultStyles, styles);
|
|
11
|
+
return /* @__PURE__ */ jsx("button", { className: styles.button, disabled, onClick, children: /* @__PURE__ */ jsxs(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
className: [styles.icon, direction].join(" "),
|
|
15
|
+
viewBox: "0 0 28 28",
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("circle", { cx: 14, cy: 14, r: "13", fillRule: "nonzero" }),
|
|
19
|
+
/* @__PURE__ */ jsx("g", { transform: "translate(6 7)", children: /* @__PURE__ */ jsx(
|
|
20
|
+
"path",
|
|
21
|
+
{
|
|
22
|
+
d: "M0.667319 7.63692L12.8497 7.63692L8.07231 13.3539L8.69338 13.975L15.334 7.31842L15.334 6.68143L8.69338 0.0249018L8.07231 0.645966L12.8497 6.36294L0.667319 6.36294L0.667319 7.63692Z",
|
|
23
|
+
fill: "#121212"
|
|
24
|
+
}
|
|
25
|
+
) })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
ArrowButton
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import style from "./style.module.css.js";
|
|
3
|
+
function AspectRatioBox({ heightAsProportionOfWidth, children }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: style["aspect-ratio-box"],
|
|
8
|
+
style: { "--aspect-ratio": heightAsProportionOfWidth },
|
|
9
|
+
children: /* @__PURE__ */ jsx("div", { style: { position: "absolute", width: "100%", height: "100%" }, children })
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
AspectRatioBox
|
|
15
|
+
};
|