@guardian/interactive-component-library 0.3.1 → 0.3.2
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/components/index.d.ts +3 -0
- package/dist/components/molecules/canvas-map/Map.d.ts +8 -0
- package/dist/components/molecules/canvas-map/Map.js +90 -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 +44 -0
- package/dist/components/molecules/canvas-map/lib/Feature.js +113 -0
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +21 -0
- package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +24 -0
- package/dist/components/molecules/canvas-map/lib/Map.d.ts +82 -0
- package/dist/components/molecules/canvas-map/lib/Map.js +267 -0
- package/dist/components/molecules/canvas-map/lib/View.d.ts +222 -0
- package/dist/components/molecules/canvas-map/lib/View.js +208 -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 +63 -0
- package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +122 -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 +22 -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 +118 -0
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +57 -0
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +136 -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 +27 -0
- package/dist/components/molecules/canvas-map/lib/projection/index.js +12 -0
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +16 -0
- package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +90 -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 +21 -0
- package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +133 -0
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +10 -0
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +79 -0
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +15 -0
- package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +53 -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 +24 -0
- package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +22 -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 +146 -0
- package/dist/components/molecules/canvas-map/lib/styles/Text.js +116 -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 +24 -0
- package/dist/components/molecules/canvas-map/lib/util/bounds.d.ts +47 -0
- package/dist/components/molecules/canvas-map/lib/util/bounds.js +61 -0
- package/dist/components/molecules/canvas-map/lib/util/coordinate.d.ts +26 -0
- package/dist/components/molecules/canvas-map/lib/util/coordinate.js +35 -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 +98 -0
- package/dist/components/molecules/canvas-map/lib/util/extent.js +118 -0
- package/dist/components/molecules/canvas-map/lib/util/index.d.ts +6 -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 +18 -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/option-picker/index.d.ts +26 -0
- package/dist/components/molecules/option-picker/index.js +94 -0
- package/dist/components/molecules/option-picker/style.module.css.js +35 -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 +40 -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 +165 -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 +121 -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 +147 -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 +7 -0
- package/dist/shared/hooks/useTouchOrHover.js +103 -0
- package/dist/shared/hooks/useWindowSize.d.ts +4 -0
- package/dist/shared/hooks/useWindowSize.js +27 -0
- package/dist/style.css +170 -82
- 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 +19 -10
- package/dist/interactive-component-library.js +0 -8370
- package/dist/interactive-component-library.js.map +0 -1
- package/dist/interactive-component-library.umd.cjs +0 -8365
- package/dist/interactive-component-library.umd.cjs.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import styles from "./search.module.css.js";
|
|
3
|
+
function SearchIcon() {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"svg",
|
|
6
|
+
{
|
|
7
|
+
viewBox: "0 0 20 20",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
className: styles.svg,
|
|
10
|
+
children: /* @__PURE__ */ jsx(
|
|
11
|
+
"path",
|
|
12
|
+
{
|
|
13
|
+
className: styles.path,
|
|
14
|
+
fillRule: "evenodd",
|
|
15
|
+
clipRule: "evenodd",
|
|
16
|
+
d: "M7.273 0c4.022 0 7.25 3.295 7.25 7.273a7.226 7.226 0 01-7.25 7.25C3.25 14.523 0 11.295 0 7.273 0 3.295 3.25 0 7.273 0zm0 1.84A5.403 5.403 0 001.84 7.274c0 3 2.409 5.454 5.432 5.454 3 0 5.454-2.454 5.454-5.454 0-3.023-2.454-5.432-5.454-5.432zM20 18.16l-5.432-5.432h-.932l-.909.91v.931L18.16 20 20 18.159z"
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
SearchIcon
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function SearchInput({ placeholder, inputValue, maxSuggestions, onInputChange, onSubmit, onSelect, onClear, onFocus, styles, }: {
|
|
2
|
+
placeholder: any;
|
|
3
|
+
inputValue: any;
|
|
4
|
+
maxSuggestions?: number;
|
|
5
|
+
onInputChange: any;
|
|
6
|
+
onSubmit: any;
|
|
7
|
+
onSelect: any;
|
|
8
|
+
onClear: any;
|
|
9
|
+
onFocus: any;
|
|
10
|
+
styles: any;
|
|
11
|
+
}): import("preact").JSX.Element;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "preact/hooks";
|
|
3
|
+
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
4
|
+
import { SearchIcon } from "./icons/search.js";
|
|
5
|
+
import "../../particles/info-button/index.js";
|
|
6
|
+
import "../../particles/relative-time-sentence/index.js";
|
|
7
|
+
import { CloseButton } from "../../particles/close-button/index.js";
|
|
8
|
+
import defaultStyles from "./style.module.css.js";
|
|
9
|
+
function SearchInput({
|
|
10
|
+
placeholder,
|
|
11
|
+
inputValue,
|
|
12
|
+
maxSuggestions = 5,
|
|
13
|
+
onInputChange,
|
|
14
|
+
onSubmit,
|
|
15
|
+
onSelect,
|
|
16
|
+
onClear,
|
|
17
|
+
onFocus,
|
|
18
|
+
styles
|
|
19
|
+
}) {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
styles = mergeStyles(defaultStyles, styles);
|
|
22
|
+
const inputRef = useRef(null);
|
|
23
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
24
|
+
const [suggestions, setSuggestions] = useState();
|
|
25
|
+
const [showSuggestions, setShowSuggestions] = useState(true);
|
|
26
|
+
async function updateSelectedIndex(diff) {
|
|
27
|
+
setSelectedIndex((currentIndex) => {
|
|
28
|
+
const newIndex = Math.max(
|
|
29
|
+
Math.min(currentIndex + diff, suggestions.length - 1),
|
|
30
|
+
-1
|
|
31
|
+
);
|
|
32
|
+
if (newIndex >= 0 && suggestions[newIndex].disabled) {
|
|
33
|
+
return currentIndex;
|
|
34
|
+
}
|
|
35
|
+
return newIndex;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function onKeyDown(event) {
|
|
39
|
+
if (event.key === "ArrowDown") {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
updateSelectedIndex(1);
|
|
42
|
+
} else if (event.key === "ArrowUp") {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
updateSelectedIndex(-1);
|
|
45
|
+
} else if (event.key === "Enter" && selectedIndex >= 0) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
onSelectSuggestion(suggestions[selectedIndex]);
|
|
48
|
+
} else if (event.key === "Enter") {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
if (onSubmit) {
|
|
51
|
+
const shouldBlur = await onSubmit(inputRef.current.value);
|
|
52
|
+
if (shouldBlur) {
|
|
53
|
+
inputRef.current.blur();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} else if (event.key === "Escape") {
|
|
57
|
+
inputRef.current.blur();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function inputChanged(input) {
|
|
61
|
+
let suggestions2 = await onInputChange(input);
|
|
62
|
+
if (suggestions2) {
|
|
63
|
+
suggestions2 = suggestions2.slice(0, maxSuggestions);
|
|
64
|
+
}
|
|
65
|
+
setSuggestions(suggestions2);
|
|
66
|
+
setSelectedIndex(-1);
|
|
67
|
+
}
|
|
68
|
+
function onSelectSuggestion(suggestion) {
|
|
69
|
+
onSelect(suggestion);
|
|
70
|
+
inputRef.current.value = suggestion.text;
|
|
71
|
+
inputRef.current.blur();
|
|
72
|
+
}
|
|
73
|
+
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "" || inputValue && inputValue !== "";
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.searchContainer, children: [
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"input",
|
|
77
|
+
{
|
|
78
|
+
name: "search",
|
|
79
|
+
placeholder,
|
|
80
|
+
ref: inputRef,
|
|
81
|
+
type: "text",
|
|
82
|
+
"aria-label": "Search input",
|
|
83
|
+
autoComplete: "off",
|
|
84
|
+
value: inputValue,
|
|
85
|
+
onKeyDown,
|
|
86
|
+
onInput: (e) => {
|
|
87
|
+
inputChanged(e.target.value);
|
|
88
|
+
},
|
|
89
|
+
onBlur: () => {
|
|
90
|
+
setShowSuggestions(false);
|
|
91
|
+
},
|
|
92
|
+
onFocus: (e) => {
|
|
93
|
+
e.target.select();
|
|
94
|
+
setShowSuggestions(true);
|
|
95
|
+
onFocus && onFocus(e);
|
|
96
|
+
},
|
|
97
|
+
className: styles.input
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx("div", { className: styles.searchIcon, children: /* @__PURE__ */ jsx(SearchIcon, {}) }),
|
|
101
|
+
showClearButton && /* @__PURE__ */ jsx("div", { className: styles.clearButton, children: /* @__PURE__ */ jsx(
|
|
102
|
+
CloseButton,
|
|
103
|
+
{
|
|
104
|
+
border: false,
|
|
105
|
+
onClick: () => {
|
|
106
|
+
const emptyValue = "";
|
|
107
|
+
inputRef.current.value = emptyValue;
|
|
108
|
+
inputChanged(emptyValue);
|
|
109
|
+
inputRef.current.focus();
|
|
110
|
+
onClear();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
) }),
|
|
114
|
+
showSuggestions && /* @__PURE__ */ jsx(
|
|
115
|
+
SuggestionList,
|
|
116
|
+
{
|
|
117
|
+
suggestions,
|
|
118
|
+
highlightText: (_c = inputRef.current) == null ? void 0 : _c.value,
|
|
119
|
+
selectedIndex,
|
|
120
|
+
styles,
|
|
121
|
+
onMouseOver: (_, index) => setSelectedIndex(index),
|
|
122
|
+
onSelect: onSelectSuggestion
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
function SuggestionList({
|
|
128
|
+
suggestions,
|
|
129
|
+
highlightText,
|
|
130
|
+
selectedIndex,
|
|
131
|
+
styles,
|
|
132
|
+
onMouseOver,
|
|
133
|
+
onSelect
|
|
134
|
+
}) {
|
|
135
|
+
if (!suggestions || suggestions.length === 0) return;
|
|
136
|
+
return /* @__PURE__ */ jsx("ul", { className: styles.suggestions, "aria-label": "Search suggestions", children: suggestions.map((d, index) => {
|
|
137
|
+
const shouldHighlight = !d.disabled;
|
|
138
|
+
return /* @__PURE__ */ jsxs(
|
|
139
|
+
"li",
|
|
140
|
+
{
|
|
141
|
+
"aria-label": d.text,
|
|
142
|
+
className: [
|
|
143
|
+
styles.suggestion,
|
|
144
|
+
index === selectedIndex && styles.selected,
|
|
145
|
+
d.disabled && styles.disabled
|
|
146
|
+
].join(" "),
|
|
147
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
148
|
+
onMouseOver: () => onMouseOver(d, index),
|
|
149
|
+
onClick: () => {
|
|
150
|
+
onSelect(d);
|
|
151
|
+
},
|
|
152
|
+
children: [
|
|
153
|
+
shouldHighlight && d.text.split(new RegExp(`(${highlightText})`, "ig")).map(
|
|
154
|
+
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: styles.highlighted, children: part }, i) : part
|
|
155
|
+
),
|
|
156
|
+
!shouldHighlight && d.text
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
index
|
|
160
|
+
);
|
|
161
|
+
}) });
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
SearchInput
|
|
165
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const searchContainer = "_searchContainer_1kj0x_1";
|
|
2
|
+
const input = "_input_1kj0x_5";
|
|
3
|
+
const searchIcon = "_searchIcon_1kj0x_27";
|
|
4
|
+
const clearButton = "_clearButton_1kj0x_36";
|
|
5
|
+
const suggestions = "_suggestions_1kj0x_42";
|
|
6
|
+
const suggestion = "_suggestion_1kj0x_42";
|
|
7
|
+
const disabled = "_disabled_1kj0x_68";
|
|
8
|
+
const selected = "_selected_1kj0x_73";
|
|
9
|
+
const highlighted = "_highlighted_1kj0x_77";
|
|
10
|
+
const defaultStyles = {
|
|
11
|
+
searchContainer,
|
|
12
|
+
input,
|
|
13
|
+
searchIcon,
|
|
14
|
+
clearButton,
|
|
15
|
+
suggestions,
|
|
16
|
+
suggestion,
|
|
17
|
+
disabled,
|
|
18
|
+
selected,
|
|
19
|
+
highlighted
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
clearButton,
|
|
23
|
+
defaultStyles as default,
|
|
24
|
+
disabled,
|
|
25
|
+
highlighted,
|
|
26
|
+
input,
|
|
27
|
+
searchContainer,
|
|
28
|
+
searchIcon,
|
|
29
|
+
selected,
|
|
30
|
+
suggestion,
|
|
31
|
+
suggestions
|
|
32
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function SlopeChart({ domain, lines, y1Label, y2Label, axis, styles, padding, svgId, }: {
|
|
2
|
+
domain: any;
|
|
3
|
+
lines: any;
|
|
4
|
+
y1Label?: (d: any) => any;
|
|
5
|
+
y2Label?: (d: any) => any;
|
|
6
|
+
axis: any;
|
|
7
|
+
styles: any;
|
|
8
|
+
padding?: {
|
|
9
|
+
left: number;
|
|
10
|
+
right: number;
|
|
11
|
+
top: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
};
|
|
14
|
+
svgId: any;
|
|
15
|
+
}): import("preact").JSX.Element;
|
|
16
|
+
export default SlopeChart;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo } from "preact/hooks";
|
|
3
|
+
import { positionLabels, scaleLinear } from "../../../shared/helpers/labelsUtil.js";
|
|
4
|
+
import { useContainerSize } from "../../../shared/hooks/useContainerSize.js";
|
|
5
|
+
import defaultStyles from "./style.module.css.js";
|
|
6
|
+
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
7
|
+
const SlopeChart = ({
|
|
8
|
+
domain,
|
|
9
|
+
lines,
|
|
10
|
+
y1Label = (d) => d.y1,
|
|
11
|
+
y2Label = (d) => d.y2,
|
|
12
|
+
axis,
|
|
13
|
+
styles,
|
|
14
|
+
padding = { left: 24, right: 24, top: 20, bottom: 20 },
|
|
15
|
+
svgId
|
|
16
|
+
}) => {
|
|
17
|
+
const wrapperRef = useRef(null);
|
|
18
|
+
const containerSize = useContainerSize(wrapperRef);
|
|
19
|
+
const width = containerSize ? containerSize.width : 0;
|
|
20
|
+
const contentWidth = Math.floor(width - padding.left - padding.right);
|
|
21
|
+
const contentHeight = contentWidth;
|
|
22
|
+
const height = contentHeight + padding.top + padding.bottom;
|
|
23
|
+
const yScale = scaleLinear(domain, [contentHeight, 0]);
|
|
24
|
+
const show = width > 0;
|
|
25
|
+
const y1Labels = useMemo(() => {
|
|
26
|
+
let labels = lines.map((d) => ({ y: yScale(d.y1), value: y1Label(d) }));
|
|
27
|
+
return positionLabels(labels);
|
|
28
|
+
}, [lines, y1Label, yScale]);
|
|
29
|
+
const y2Labels = useMemo(() => {
|
|
30
|
+
let labels = lines.map((d) => ({ y: yScale(d.y2), value: y2Label(d) }));
|
|
31
|
+
return positionLabels(labels);
|
|
32
|
+
}, [lines, y2Label, yScale]);
|
|
33
|
+
styles = mergeStyles({ ...defaultStyles }, styles);
|
|
34
|
+
const chart = /* @__PURE__ */ jsx("svg", { className: styles.svg, width, height, id: svgId, children: /* @__PURE__ */ jsxs("g", { transform: `translate(${padding.left} ${padding.top})`, children: [
|
|
35
|
+
/* @__PURE__ */ jsxs("g", { transform: `translate(0 ${contentHeight})`, children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"line",
|
|
38
|
+
{
|
|
39
|
+
x1: 0,
|
|
40
|
+
x2: contentWidth,
|
|
41
|
+
className: styles.axis,
|
|
42
|
+
shapeRendering: "crispEdges"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"text",
|
|
47
|
+
{
|
|
48
|
+
dominantBaseline: "hanging",
|
|
49
|
+
className: [styles.label, styles.axisLabel].join(" "),
|
|
50
|
+
children: axis.startLabel
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"text",
|
|
55
|
+
{
|
|
56
|
+
x: contentWidth,
|
|
57
|
+
dominantBaseline: "hanging",
|
|
58
|
+
textAnchor: "end",
|
|
59
|
+
className: [styles.label, styles.axisLabel].join(" "),
|
|
60
|
+
children: axis.endLabel
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
lines.map((line, index) => {
|
|
65
|
+
const itemStyles = mergeStyles({ ...styles }, line.styles);
|
|
66
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"line",
|
|
69
|
+
{
|
|
70
|
+
x1: 0,
|
|
71
|
+
y1: yScale(line.y1),
|
|
72
|
+
x2: contentWidth,
|
|
73
|
+
y2: yScale(line.y2),
|
|
74
|
+
className: `${itemStyles.lineWhite}`
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"line",
|
|
79
|
+
{
|
|
80
|
+
x1: 0,
|
|
81
|
+
y1: yScale(line.y1),
|
|
82
|
+
x2: contentWidth,
|
|
83
|
+
y2: yScale(line.y2),
|
|
84
|
+
className: `${itemStyles.line} stroke-color--${line.abbreviation}`
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
"circle",
|
|
89
|
+
{
|
|
90
|
+
cx: 0,
|
|
91
|
+
cy: yScale(line.y1),
|
|
92
|
+
r: 4,
|
|
93
|
+
className: `${itemStyles.circle} fill-color--${line.abbreviation}`
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"circle",
|
|
98
|
+
{
|
|
99
|
+
cx: contentWidth,
|
|
100
|
+
cy: yScale(line.y2),
|
|
101
|
+
r: 4,
|
|
102
|
+
className: `${itemStyles.circle} fill-color--${line.abbreviation}`
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }, index);
|
|
106
|
+
}),
|
|
107
|
+
y1Labels.map((label, index) => {
|
|
108
|
+
return /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(
|
|
109
|
+
"text",
|
|
110
|
+
{
|
|
111
|
+
x: 0,
|
|
112
|
+
y: label.y,
|
|
113
|
+
className: [styles.label, styles.y1Label].join(" "),
|
|
114
|
+
textAnchor: "end",
|
|
115
|
+
dominantBaseline: "middle",
|
|
116
|
+
children: label.value
|
|
117
|
+
}
|
|
118
|
+
) }, index);
|
|
119
|
+
}),
|
|
120
|
+
y2Labels.map((label, index) => {
|
|
121
|
+
return /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(
|
|
122
|
+
"text",
|
|
123
|
+
{
|
|
124
|
+
x: contentWidth,
|
|
125
|
+
y: label.y,
|
|
126
|
+
className: [styles.label, styles.y2Label].join(" "),
|
|
127
|
+
textAnchor: "start",
|
|
128
|
+
dominantBaseline: "middle",
|
|
129
|
+
children: label.value
|
|
130
|
+
}
|
|
131
|
+
) }, index);
|
|
132
|
+
})
|
|
133
|
+
] }) });
|
|
134
|
+
return /* @__PURE__ */ jsx("div", { className: styles.slopeChartContainer, ref: wrapperRef, children: show && chart });
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
SlopeChart,
|
|
138
|
+
SlopeChart as default
|
|
139
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const slopeChartContainer = "_slopeChartContainer_nmjjj_1";
|
|
2
|
+
const svg = "_svg_nmjjj_5";
|
|
3
|
+
const line = "_line_nmjjj_9";
|
|
4
|
+
const lineWhite = "_lineWhite_nmjjj_14";
|
|
5
|
+
const circle = "_circle_nmjjj_19";
|
|
6
|
+
const label = "_label_nmjjj_23";
|
|
7
|
+
const y1Label = "_y1Label_nmjjj_29";
|
|
8
|
+
const y2Label = "_y2Label_nmjjj_33";
|
|
9
|
+
const axis = "_axis_nmjjj_37";
|
|
10
|
+
const axisLabel = "_axisLabel_nmjjj_42";
|
|
11
|
+
const defaultStyles = {
|
|
12
|
+
slopeChartContainer,
|
|
13
|
+
svg,
|
|
14
|
+
line,
|
|
15
|
+
lineWhite,
|
|
16
|
+
circle,
|
|
17
|
+
label,
|
|
18
|
+
y1Label,
|
|
19
|
+
y2Label,
|
|
20
|
+
axis,
|
|
21
|
+
axisLabel
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
axis,
|
|
25
|
+
axisLabel,
|
|
26
|
+
circle,
|
|
27
|
+
defaultStyles as default,
|
|
28
|
+
label,
|
|
29
|
+
line,
|
|
30
|
+
lineWhite,
|
|
31
|
+
slopeChartContainer,
|
|
32
|
+
svg,
|
|
33
|
+
y1Label,
|
|
34
|
+
y2Label
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MapContext: import('preact').Context<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function SVGMapProvider({ id, mapRef, width, height, padding, config, selectedFeature, children, }: {
|
|
2
|
+
id: any;
|
|
3
|
+
mapRef: any;
|
|
4
|
+
width: any;
|
|
5
|
+
height: any;
|
|
6
|
+
padding: any;
|
|
7
|
+
config: any;
|
|
8
|
+
selectedFeature: any;
|
|
9
|
+
children: any;
|
|
10
|
+
}): import("preact").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useCallback } from "preact/hooks";
|
|
3
|
+
import { geoPath } from "d3-geo";
|
|
4
|
+
import { bboxFeature } from "../helpers/bboxFeature.js";
|
|
5
|
+
import { MapContext } from "./MapContext.js";
|
|
6
|
+
function SVGMapProvider({
|
|
7
|
+
id,
|
|
8
|
+
mapRef,
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
padding,
|
|
12
|
+
config,
|
|
13
|
+
selectedFeature,
|
|
14
|
+
children
|
|
15
|
+
}) {
|
|
16
|
+
const contentSize = useMemo(
|
|
17
|
+
() => ({
|
|
18
|
+
width: width - padding.left - padding.right,
|
|
19
|
+
height: height - padding.top - padding.bottom
|
|
20
|
+
}),
|
|
21
|
+
[width, height, padding]
|
|
22
|
+
);
|
|
23
|
+
const projection = useMemo(() => {
|
|
24
|
+
return config.projection.fitSize(
|
|
25
|
+
[contentSize.width, contentSize.height],
|
|
26
|
+
bboxFeature(config.bounds)
|
|
27
|
+
);
|
|
28
|
+
}, [contentSize, config]);
|
|
29
|
+
const path = geoPath().projection(projection);
|
|
30
|
+
const layerSet = useRef(/* @__PURE__ */ new Set());
|
|
31
|
+
const layers = useRef([]);
|
|
32
|
+
const updateLayers = useCallback((layerSet2) => {
|
|
33
|
+
const _layers = Array.from(layerSet2.current);
|
|
34
|
+
_layers.sort((a, b) => {
|
|
35
|
+
return b.zIndex - a.zIndex;
|
|
36
|
+
});
|
|
37
|
+
layers.current = _layers;
|
|
38
|
+
}, []);
|
|
39
|
+
const registerLayer = useCallback(
|
|
40
|
+
(layer) => {
|
|
41
|
+
layerSet.current.add(layer);
|
|
42
|
+
updateLayers(layerSet);
|
|
43
|
+
},
|
|
44
|
+
[updateLayers]
|
|
45
|
+
);
|
|
46
|
+
const unregisterLayer = useCallback(
|
|
47
|
+
(layer) => {
|
|
48
|
+
layerSet.current.delete(layer);
|
|
49
|
+
updateLayers(layerSet);
|
|
50
|
+
},
|
|
51
|
+
[updateLayers]
|
|
52
|
+
);
|
|
53
|
+
const findFeatureAtPoint = useCallback(
|
|
54
|
+
({ x, y }) => {
|
|
55
|
+
const adjustedPoint = [x - padding.left, y - padding.top];
|
|
56
|
+
for (const layer of layers.current) {
|
|
57
|
+
if (typeof layer.findFeatureAtPoint === "function") {
|
|
58
|
+
const feature = layer.findFeatureAtPoint(adjustedPoint);
|
|
59
|
+
if (feature) return feature;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
},
|
|
64
|
+
[padding]
|
|
65
|
+
);
|
|
66
|
+
const context = {
|
|
67
|
+
id,
|
|
68
|
+
projection,
|
|
69
|
+
config,
|
|
70
|
+
path,
|
|
71
|
+
size: { width, height },
|
|
72
|
+
contentSize,
|
|
73
|
+
padding,
|
|
74
|
+
extent: [
|
|
75
|
+
[0, 0],
|
|
76
|
+
[width, height]
|
|
77
|
+
],
|
|
78
|
+
selectedFeature,
|
|
79
|
+
registerLayer,
|
|
80
|
+
unregisterLayer,
|
|
81
|
+
findFeatureAtPoint
|
|
82
|
+
};
|
|
83
|
+
mapRef.current = context;
|
|
84
|
+
return /* @__PURE__ */ jsx(MapContext.Provider, { value: context, children });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
SVGMapProvider
|
|
88
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function bboxFeature(bounds) {
|
|
2
|
+
const minLon = bounds[0][0];
|
|
3
|
+
const minLat = bounds[0][1];
|
|
4
|
+
const maxLon = bounds[1][0];
|
|
5
|
+
const maxLat = bounds[1][1];
|
|
6
|
+
const feature = {
|
|
7
|
+
type: "Feature",
|
|
8
|
+
properties: {},
|
|
9
|
+
geometry: {
|
|
10
|
+
coordinates: [
|
|
11
|
+
[
|
|
12
|
+
[minLon, maxLat],
|
|
13
|
+
[maxLon, maxLat],
|
|
14
|
+
[maxLon, minLat],
|
|
15
|
+
[minLon, minLat],
|
|
16
|
+
[minLon, maxLat]
|
|
17
|
+
]
|
|
18
|
+
],
|
|
19
|
+
type: "Polygon"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return feature;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
bboxFeature
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function dynamicPropValue(prop: any, d: any, index: any): any;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function calculateScale(mapBounds: any, mapWidthPixels: any, mapHeightPixels: any): number;
|
|
2
|
+
export function circleContainsCoordinates(circleCoordinates: any, radius: any, coordinates: any): boolean;
|
|
3
|
+
export function distanceInKmBetweenEarthCoordinates(point1: any, point2: any): number;
|
|
4
|
+
export function degreesToRadians(degrees: any): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function saveSVG(elementId: any): void;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect } from "preact/hooks";
|
|
2
|
+
import { toChildArray } from "preact";
|
|
3
|
+
import * as index from "../layers/index.js";
|
|
4
|
+
const layerTypes = Object.values(index);
|
|
5
|
+
function useThrowIfNonLayerChildren(children) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const firstNonLayerChild = toChildArray(children).find(
|
|
8
|
+
(child) => !layerTypes.includes(child.type)
|
|
9
|
+
);
|
|
10
|
+
if (firstNonLayerChild) {
|
|
11
|
+
throw Error(
|
|
12
|
+
`unknown component type passed as child to SVGMap component: ${firstNonLayerChild.type}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}, [children]);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useThrowIfNonLayerChildren
|
|
19
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export * as MapLayers from './layers';
|
|
2
|
+
export namespace _Projection {
|
|
3
|
+
let geoAlbersUKComposite: any;
|
|
4
|
+
let geoAlbersEngland: any;
|
|
5
|
+
let geoMercator: any;
|
|
6
|
+
}
|
|
7
|
+
export namespace MapConfiguration {
|
|
8
|
+
namespace UKComposite {
|
|
9
|
+
import projection = _Projection.geoAlbersUKComposite;
|
|
10
|
+
export { projection };
|
|
11
|
+
export let bounds: number[][];
|
|
12
|
+
export let drawCompositionBorders: boolean;
|
|
13
|
+
export let drawToCanvas: boolean;
|
|
14
|
+
}
|
|
15
|
+
namespace England {
|
|
16
|
+
import projection_1 = _Projection.geoAlbersEngland;
|
|
17
|
+
export { projection_1 as projection };
|
|
18
|
+
let bounds_1: number[][];
|
|
19
|
+
export { bounds_1 as bounds };
|
|
20
|
+
let drawCompositionBorders_1: boolean;
|
|
21
|
+
export { drawCompositionBorders_1 as drawCompositionBorders };
|
|
22
|
+
let drawToCanvas_1: boolean;
|
|
23
|
+
export { drawToCanvas_1 as drawToCanvas };
|
|
24
|
+
}
|
|
25
|
+
namespace London {
|
|
26
|
+
let projection_2: any;
|
|
27
|
+
export { projection_2 as projection };
|
|
28
|
+
let bounds_2: number[][];
|
|
29
|
+
export { bounds_2 as bounds };
|
|
30
|
+
let drawCompositionBorders_2: boolean;
|
|
31
|
+
export { drawCompositionBorders_2 as drawCompositionBorders };
|
|
32
|
+
let drawToCanvas_2: boolean;
|
|
33
|
+
export { drawToCanvas_2 as drawToCanvas };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export const SVGMap: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<{}> & {
|
|
37
|
+
ref?: import('preact').Ref<any>;
|
|
38
|
+
}>;
|