@guardian/interactive-component-library 0.2.0-rc4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/dist/interactive-component-library.js +8365 -0
  2. package/dist/interactive-component-library.js.map +1 -0
  3. package/dist/interactive-component-library.umd.cjs +8360 -0
  4. package/dist/interactive-component-library.umd.cjs.map +1 -0
  5. package/dist/style.css +157 -73
  6. package/package.json +11 -19
  7. package/dist/components/index.d.ts +0 -3
  8. package/dist/components/molecules/canvas-map/Map.d.ts +0 -17
  9. package/dist/components/molecules/canvas-map/Map.js +0 -89
  10. package/dist/components/molecules/canvas-map/context/MapContext.d.ts +0 -19
  11. package/dist/components/molecules/canvas-map/context/MapContext.js +0 -20
  12. package/dist/components/molecules/canvas-map/controls/ZoomControl.d.ts +0 -6
  13. package/dist/components/molecules/canvas-map/controls/ZoomControl.js +0 -40
  14. package/dist/components/molecules/canvas-map/controls/icons/index.d.ts +0 -3
  15. package/dist/components/molecules/canvas-map/controls/icons/minus.d.ts +0 -1
  16. package/dist/components/molecules/canvas-map/controls/icons/minus.js +0 -25
  17. package/dist/components/molecules/canvas-map/controls/icons/plus.d.ts +0 -1
  18. package/dist/components/molecules/canvas-map/controls/icons/plus.js +0 -25
  19. package/dist/components/molecules/canvas-map/controls/icons/reset.d.ts +0 -3
  20. package/dist/components/molecules/canvas-map/controls/icons/reset.js +0 -25
  21. package/dist/components/molecules/canvas-map/controls/index.d.ts +0 -1
  22. package/dist/components/molecules/canvas-map/controls/style.module.css.js +0 -11
  23. package/dist/components/molecules/canvas-map/index.d.ts +0 -12
  24. package/dist/components/molecules/canvas-map/lib/Feature.d.ts +0 -38
  25. package/dist/components/molecules/canvas-map/lib/Feature.js +0 -104
  26. package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +0 -20
  27. package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +0 -23
  28. package/dist/components/molecules/canvas-map/lib/Map.d.ts +0 -69
  29. package/dist/components/molecules/canvas-map/lib/Map.js +0 -254
  30. package/dist/components/molecules/canvas-map/lib/View.d.ts +0 -136
  31. package/dist/components/molecules/canvas-map/lib/View.js +0 -179
  32. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.d.ts +0 -8
  33. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.js +0 -35
  34. package/dist/components/molecules/canvas-map/lib/events/MapEvent.d.ts +0 -6
  35. package/dist/components/molecules/canvas-map/lib/events/MapEvent.js +0 -9
  36. package/dist/components/molecules/canvas-map/lib/events/index.d.ts +0 -2
  37. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.d.ts +0 -10
  38. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +0 -96
  39. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.d.ts +0 -32
  40. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.js +0 -41
  41. package/dist/components/molecules/canvas-map/lib/geometry/LineString.d.ts +0 -12
  42. package/dist/components/molecules/canvas-map/lib/geometry/LineString.js +0 -19
  43. package/dist/components/molecules/canvas-map/lib/geometry/Point.d.ts +0 -11
  44. package/dist/components/molecules/canvas-map/lib/geometry/Point.js +0 -16
  45. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.d.ts +0 -16
  46. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.js +0 -46
  47. package/dist/components/molecules/canvas-map/lib/geometry/index.d.ts +0 -4
  48. package/dist/components/molecules/canvas-map/lib/interpolators/index.d.ts +0 -2
  49. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.d.ts +0 -5
  50. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.js +0 -95
  51. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.d.ts +0 -4
  52. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js +0 -65
  53. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +0 -52
  54. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +0 -111
  55. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +0 -53
  56. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +0 -132
  57. package/dist/components/molecules/canvas-map/lib/layers/index.d.ts +0 -3
  58. package/dist/components/molecules/canvas-map/lib/projection/index.d.ts +0 -22
  59. package/dist/components/molecules/canvas-map/lib/projection/index.js +0 -12
  60. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +0 -6
  61. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +0 -46
  62. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.d.ts +0 -6
  63. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +0 -53
  64. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.d.ts +0 -17
  65. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +0 -119
  66. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +0 -10
  67. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +0 -78
  68. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +0 -15
  69. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +0 -56
  70. package/dist/components/molecules/canvas-map/lib/styles/Fill.d.ts +0 -7
  71. package/dist/components/molecules/canvas-map/lib/styles/Fill.js +0 -15
  72. package/dist/components/molecules/canvas-map/lib/styles/Stroke.d.ts +0 -8
  73. package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +0 -16
  74. package/dist/components/molecules/canvas-map/lib/styles/Style.d.ts +0 -24
  75. package/dist/components/molecules/canvas-map/lib/styles/Style.js +0 -17
  76. package/dist/components/molecules/canvas-map/lib/styles/Text.d.ts +0 -10
  77. package/dist/components/molecules/canvas-map/lib/styles/Text.js +0 -14
  78. package/dist/components/molecules/canvas-map/lib/styles/index.d.ts +0 -4
  79. package/dist/components/molecules/canvas-map/lib/util/array.d.ts +0 -6
  80. package/dist/components/molecules/canvas-map/lib/util/array.js +0 -15
  81. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.d.ts +0 -8
  82. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.js +0 -26
  83. package/dist/components/molecules/canvas-map/lib/util/debug.d.ts +0 -11
  84. package/dist/components/molecules/canvas-map/lib/util/debug.js +0 -27
  85. package/dist/components/molecules/canvas-map/lib/util/deflate.d.ts +0 -36
  86. package/dist/components/molecules/canvas-map/lib/util/distance.d.ts +0 -1
  87. package/dist/components/molecules/canvas-map/lib/util/distance.js +0 -12
  88. package/dist/components/molecules/canvas-map/lib/util/dom.d.ts +0 -9
  89. package/dist/components/molecules/canvas-map/lib/util/dom.js +0 -28
  90. package/dist/components/molecules/canvas-map/lib/util/extent.d.ts +0 -21
  91. package/dist/components/molecules/canvas-map/lib/util/extent.js +0 -38
  92. package/dist/components/molecules/canvas-map/lib/util/memoise.d.ts +0 -10
  93. package/dist/components/molecules/canvas-map/lib/util/memoise.js +0 -20
  94. package/dist/components/molecules/canvas-map/lib/util/resolution.d.ts +0 -9
  95. package/dist/components/molecules/canvas-map/lib/util/resolution.js +0 -11
  96. package/dist/components/molecules/canvas-map/lib/util/simplify.d.ts +0 -114
  97. package/dist/components/molecules/canvas-map/lib/util/size.d.ts +0 -32
  98. package/dist/components/molecules/canvas-map/lib/util/size.js +0 -53
  99. package/dist/components/molecules/canvas-map/lib/util/toRgba.d.ts +0 -1
  100. package/dist/components/molecules/canvas-map/lib/util/toRgba.js +0 -25
  101. package/dist/components/molecules/canvas-map/lib/util/uid.d.ts +0 -5
  102. package/dist/components/molecules/canvas-map/lib/util/uid.js +0 -7
  103. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.d.ts +0 -2
  104. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.js +0 -14
  105. package/dist/components/molecules/canvas-map/style.module.scss.js +0 -20
  106. package/dist/components/molecules/column-chart/column-chart-example.d.ts +0 -35
  107. package/dist/components/molecules/column-chart/column-chart-util.d.ts +0 -1
  108. package/dist/components/molecules/column-chart/index.d.ts +0 -11
  109. package/dist/components/molecules/column-chart/index.js +0 -63
  110. package/dist/components/molecules/column-chart/style.module.css.js +0 -14
  111. package/dist/components/molecules/control-change/index.d.ts +0 -6
  112. package/dist/components/molecules/control-change/index.js +0 -29
  113. package/dist/components/molecules/control-change/style.module.css.js +0 -11
  114. package/dist/components/molecules/dropdown/index.d.ts +0 -11
  115. package/dist/components/molecules/dropdown/index.js +0 -191
  116. package/dist/components/molecules/dropdown/style.module.css.js +0 -50
  117. package/dist/components/molecules/first-past-the-post-waffle/index.d.ts +0 -5
  118. package/dist/components/molecules/first-past-the-post-waffle/index.js +0 -14
  119. package/dist/components/molecules/first-past-the-post-waffle/style.module.css.js +0 -14
  120. package/dist/components/molecules/index.d.ts +0 -17
  121. package/dist/components/molecules/modal/index.d.ts +0 -8
  122. package/dist/components/molecules/modal/index.js +0 -59
  123. package/dist/components/molecules/modal/style.module.css.js +0 -26
  124. package/dist/components/molecules/page-section/index.d.ts +0 -8
  125. package/dist/components/molecules/page-section/index.js +0 -52
  126. package/dist/components/molecules/page-section/style.module.scss.js +0 -20
  127. package/dist/components/molecules/party-profile/index.d.ts +0 -10
  128. package/dist/components/molecules/party-profile/index.js +0 -29
  129. package/dist/components/molecules/party-profile/style.module.css.js +0 -26
  130. package/dist/components/molecules/refresh-indicator/index.d.ts +0 -4
  131. package/dist/components/molecules/refresh-indicator/index.js +0 -18
  132. package/dist/components/molecules/refresh-indicator/style.module.scss.js +0 -17
  133. package/dist/components/molecules/responsive-grid/index.d.ts +0 -10
  134. package/dist/components/molecules/responsive-grid/index.js +0 -19
  135. package/dist/components/molecules/responsive-grid/style.module.scss.js +0 -8
  136. package/dist/components/molecules/result-summary/index.d.ts +0 -8
  137. package/dist/components/molecules/result-summary/index.js +0 -38
  138. package/dist/components/molecules/result-summary/style.module.css.js +0 -11
  139. package/dist/components/molecules/search-input/icons/search.d.ts +0 -1
  140. package/dist/components/molecules/search-input/icons/search.js +0 -24
  141. package/dist/components/molecules/search-input/icons/search.module.css.js +0 -11
  142. package/dist/components/molecules/search-input/index.d.ts +0 -11
  143. package/dist/components/molecules/search-input/index.js +0 -164
  144. package/dist/components/molecules/search-input/style.module.css.js +0 -32
  145. package/dist/components/molecules/slope-chart/index.d.ts +0 -16
  146. package/dist/components/molecules/slope-chart/index.js +0 -139
  147. package/dist/components/molecules/slope-chart/style.module.css.js +0 -35
  148. package/dist/components/molecules/svg-map/context/MapContext.d.ts +0 -1
  149. package/dist/components/molecules/svg-map/context/MapContext.js +0 -5
  150. package/dist/components/molecules/svg-map/context/SVGMapProvider.d.ts +0 -10
  151. package/dist/components/molecules/svg-map/context/SVGMapProvider.js +0 -88
  152. package/dist/components/molecules/svg-map/helpers/bboxFeature.d.ts +0 -8
  153. package/dist/components/molecules/svg-map/helpers/bboxFeature.js +0 -26
  154. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.d.ts +0 -1
  155. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.js +0 -9
  156. package/dist/components/molecules/svg-map/helpers/geoMath.d.ts +0 -4
  157. package/dist/components/molecules/svg-map/helpers/saveSVG.d.ts +0 -1
  158. package/dist/components/molecules/svg-map/hooks/useCamera.d.ts +0 -0
  159. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.d.ts +0 -4
  160. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.js +0 -19
  161. package/dist/components/molecules/svg-map/index.d.ts +0 -38
  162. package/dist/components/molecules/svg-map/index.js +0 -121
  163. package/dist/components/molecules/svg-map/layers/CompositionBorders.d.ts +0 -3
  164. package/dist/components/molecules/svg-map/layers/CompositionBorders.js +0 -14
  165. package/dist/components/molecules/svg-map/layers/Line.d.ts +0 -7
  166. package/dist/components/molecules/svg-map/layers/Line.js +0 -48
  167. package/dist/components/molecules/svg-map/layers/Point.d.ts +0 -10
  168. package/dist/components/molecules/svg-map/layers/Point.js +0 -59
  169. package/dist/components/molecules/svg-map/layers/Polygon.d.ts +0 -9
  170. package/dist/components/molecules/svg-map/layers/Polygon.js +0 -75
  171. package/dist/components/molecules/svg-map/layers/Prerendered.d.ts +0 -3
  172. package/dist/components/molecules/svg-map/layers/Prerendered.js +0 -11
  173. package/dist/components/molecules/svg-map/layers/compositionBorders.module.scss.js +0 -8
  174. package/dist/components/molecules/svg-map/layers/index.d.ts +0 -5
  175. package/dist/components/molecules/svg-map/layers/index.js +0 -12
  176. package/dist/components/molecules/svg-map/renderers/SVGRenderer.d.ts +0 -3
  177. package/dist/components/molecules/svg-map/renderers/SVGRenderer.js +0 -32
  178. package/dist/components/molecules/svg-map/style.module.css.js +0 -11
  179. package/dist/components/molecules/table/index.d.ts +0 -7
  180. package/dist/components/molecules/table/index.js +0 -90
  181. package/dist/components/molecules/table/style.module.scss.js +0 -29
  182. package/dist/components/molecules/table/useTable.d.ts +0 -8
  183. package/dist/components/molecules/table/useTable.js +0 -128
  184. package/dist/components/molecules/tooltip/index.d.ts +0 -82
  185. package/dist/components/molecules/tooltip/index.js +0 -117
  186. package/dist/components/molecules/tooltip/style.module.css.js +0 -8
  187. package/dist/components/molecules/topline-result/index.d.ts +0 -3
  188. package/dist/components/molecules/topline-result/index.js +0 -61
  189. package/dist/components/molecules/topline-result/style.module.scss.js +0 -38
  190. package/dist/components/organisms/coalitions-tracker/index.d.ts +0 -16
  191. package/dist/components/organisms/coalitions-tracker/index.js +0 -151
  192. package/dist/components/organisms/coalitions-tracker/style.module.scss.js +0 -32
  193. package/dist/components/organisms/index.d.ts +0 -2
  194. package/dist/components/organisms/ticker/gradient/index.d.ts +0 -1
  195. package/dist/components/organisms/ticker/gradient/index.js +0 -35
  196. package/dist/components/organisms/ticker/gradient/style.module.scss.js +0 -14
  197. package/dist/components/organisms/ticker/index.d.ts +0 -5
  198. package/dist/components/organisms/ticker/index.js +0 -102
  199. package/dist/components/organisms/ticker/style.module.scss.js +0 -32
  200. package/dist/components/particles/ad-slot/index.d.ts +0 -40
  201. package/dist/components/particles/ad-slot/index.js +0 -34
  202. package/dist/components/particles/ad-slot/style.module.css.js +0 -11
  203. package/dist/components/particles/arrow-button/index.d.ts +0 -6
  204. package/dist/components/particles/arrow-button/index.js +0 -32
  205. package/dist/components/particles/arrow-button/style.module.css.js +0 -11
  206. package/dist/components/particles/aspect-ratio-box/index.d.ts +0 -4
  207. package/dist/components/particles/aspect-ratio-box/index.js +0 -15
  208. package/dist/components/particles/aspect-ratio-box/style.module.css.js +0 -6
  209. package/dist/components/particles/button/index.d.ts +0 -6
  210. package/dist/components/particles/button/index.js +0 -10
  211. package/dist/components/particles/button/style.module.css.js +0 -11
  212. package/dist/components/particles/change-bar/index.d.ts +0 -8
  213. package/dist/components/particles/change-bar/index.js +0 -27
  214. package/dist/components/particles/change-bar/style.module.scss.js +0 -14
  215. package/dist/components/particles/chevron/index.d.ts +0 -6
  216. package/dist/components/particles/chevron/index.js +0 -78
  217. package/dist/components/particles/chevron/style.module.css.js +0 -20
  218. package/dist/components/particles/circle-icon/index.d.ts +0 -6
  219. package/dist/components/particles/circle-icon/index.js +0 -32
  220. package/dist/components/particles/circle-icon/style.module.css.js +0 -14
  221. package/dist/components/particles/close-button/index.d.ts +0 -5
  222. package/dist/components/particles/close-button/index.js +0 -35
  223. package/dist/components/particles/close-button/style.module.css.js +0 -17
  224. package/dist/components/particles/container/index.d.ts +0 -5
  225. package/dist/components/particles/container/index.js +0 -13
  226. package/dist/components/particles/container/style.module.scss.js +0 -11
  227. package/dist/components/particles/gradient-icon/index.d.ts +0 -1
  228. package/dist/components/particles/gradient-icon/index.js +0 -46
  229. package/dist/components/particles/gradient-icon/style.module.css.js +0 -14
  230. package/dist/components/particles/index.d.ts +0 -18
  231. package/dist/components/particles/info-button/index.d.ts +0 -3
  232. package/dist/components/particles/info-button/index.js +0 -19
  233. package/dist/components/particles/info-button/style.module.css.js +0 -11
  234. package/dist/components/particles/legend-item/index.d.ts +0 -6
  235. package/dist/components/particles/legend-item/index.js +0 -26
  236. package/dist/components/particles/legend-item/style.module.css.js +0 -17
  237. package/dist/components/particles/relative-time-sentence/index.d.ts +0 -4
  238. package/dist/components/particles/relative-time-sentence/index.js +0 -14
  239. package/dist/components/particles/relative-time-sentence/style.module.css.js +0 -8
  240. package/dist/components/particles/square-cut-corner-icon/index.d.ts +0 -6
  241. package/dist/components/particles/square-cut-corner-icon/index.js +0 -56
  242. package/dist/components/particles/square-cut-corner-icon/style.module.scss.js +0 -17
  243. package/dist/components/particles/square-icon/index.d.ts +0 -5
  244. package/dist/components/particles/square-icon/index.js +0 -28
  245. package/dist/components/particles/square-icon/style.module.scss.js +0 -11
  246. package/dist/components/particles/stacked-bar/index.d.ts +0 -23
  247. package/dist/components/particles/stacked-bar/index.js +0 -140
  248. package/dist/components/particles/stacked-bar/style.module.css.js +0 -17
  249. package/dist/components/particles/stacked-grid/index.d.ts +0 -6
  250. package/dist/components/particles/stacked-grid/index.js +0 -35
  251. package/dist/components/particles/stacked-grid/style.module.css.js +0 -20
  252. package/dist/components/particles/waffle/index.d.ts +0 -14
  253. package/dist/components/particles/waffle/index.js +0 -76
  254. package/dist/components/particles/waffle/style.module.css.js +0 -11
  255. package/dist/index.d.ts +0 -2
  256. package/dist/index.js +0 -128
  257. package/dist/shared/colors/index.d.ts +0 -2
  258. package/dist/shared/helpers/createStore.d.ts +0 -1
  259. package/dist/shared/helpers/geometry.d.ts +0 -3
  260. package/dist/shared/helpers/geometry.js +0 -16
  261. package/dist/shared/helpers/geometry.test.d.ts +0 -1
  262. package/dist/shared/helpers/labelsUtil.d.ts +0 -54
  263. package/dist/shared/helpers/labelsUtil.js +0 -58
  264. package/dist/shared/helpers/labelsUtils.test.d.ts +0 -1
  265. package/dist/shared/helpers/shouldUpdate.d.ts +0 -7
  266. package/dist/shared/hooks/index.d.ts +0 -3
  267. package/dist/shared/hooks/useContainerSize.d.ts +0 -1
  268. package/dist/shared/hooks/useContainerSize.js +0 -24
  269. package/dist/shared/hooks/useTouchOrHover.d.ts +0 -6
  270. package/dist/shared/hooks/useTouchOrHover.js +0 -95
  271. package/dist/shared/hooks/useWindowSize.d.ts +0 -4
  272. package/dist/shared/hooks/useWindowSize.js +0 -27
  273. package/dist/styles/helpers/mergeStyles.d.ts +0 -1
  274. package/dist/styles/helpers/mergeStyles.js +0 -22
  275. package/dist/styles/helpers/mergeStyles.test.d.ts +0 -1
  276. package/dist/styles/theme.config.d.ts +0 -124
@@ -1,11 +0,0 @@
1
- const container = "_container_azu4a_1";
2
- const paragraph = "_paragraph_azu4a_12";
3
- const defaultStyles = {
4
- container,
5
- paragraph
6
- };
7
- export {
8
- container,
9
- defaultStyles as default,
10
- paragraph
11
- };
@@ -1 +0,0 @@
1
- export function SearchIcon(): import("preact").JSX.Element;
@@ -1,24 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
1
- const svg = "_svg_1dms8_1";
2
- const path = "_path_1dms8_8";
3
- const styles = {
4
- svg,
5
- path
6
- };
7
- export {
8
- styles as default,
9
- path,
10
- svg
11
- };
@@ -1,11 +0,0 @@
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;
@@ -1,164 +0,0 @@
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
- value: inputValue,
84
- onKeyDown,
85
- onInput: (e) => {
86
- inputChanged(e.target.value);
87
- },
88
- onBlur: () => {
89
- setShowSuggestions(false);
90
- },
91
- onFocus: (e) => {
92
- e.target.select();
93
- setShowSuggestions(true);
94
- onFocus && onFocus(e);
95
- },
96
- className: styles.input
97
- }
98
- ),
99
- /* @__PURE__ */ jsx("div", { className: styles.searchIcon, children: /* @__PURE__ */ jsx(SearchIcon, {}) }),
100
- showClearButton && /* @__PURE__ */ jsx("div", { className: styles.clearButton, children: /* @__PURE__ */ jsx(
101
- CloseButton,
102
- {
103
- border: false,
104
- onClick: () => {
105
- const emptyValue = "";
106
- inputRef.current.value = emptyValue;
107
- inputChanged(emptyValue);
108
- inputRef.current.focus();
109
- onClear();
110
- }
111
- }
112
- ) }),
113
- showSuggestions && /* @__PURE__ */ jsx(
114
- SuggestionList,
115
- {
116
- suggestions,
117
- highlightText: (_c = inputRef.current) == null ? void 0 : _c.value,
118
- selectedIndex,
119
- styles,
120
- onMouseOver: (_, index) => setSelectedIndex(index),
121
- onSelect: onSelectSuggestion
122
- }
123
- )
124
- ] });
125
- }
126
- function SuggestionList({
127
- suggestions,
128
- highlightText,
129
- selectedIndex,
130
- styles,
131
- onMouseOver,
132
- onSelect
133
- }) {
134
- if (!suggestions || suggestions.length === 0) return;
135
- return /* @__PURE__ */ jsx("ul", { className: styles.suggestions, "aria-label": "Search suggestions", children: suggestions.map((d, index) => {
136
- const shouldHighlight = !d.disabled;
137
- return /* @__PURE__ */ jsxs(
138
- "li",
139
- {
140
- "aria-label": d.text,
141
- className: [
142
- styles.suggestion,
143
- index === selectedIndex && styles.selected,
144
- d.disabled && styles.disabled
145
- ].join(" "),
146
- onMouseDown: (e) => e.preventDefault(),
147
- onMouseOver: () => onMouseOver(d, index),
148
- onClick: () => {
149
- onSelect(d);
150
- },
151
- children: [
152
- shouldHighlight && d.text.split(new RegExp(`(${highlightText})`, "ig")).map(
153
- (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: styles.highlighted, children: part }, i) : part
154
- ),
155
- !shouldHighlight && d.text
156
- ]
157
- },
158
- index
159
- );
160
- }) });
161
- }
162
- export {
163
- SearchInput
164
- };
@@ -1,32 +0,0 @@
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
- };
@@ -1,16 +0,0 @@
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;
@@ -1,139 +0,0 @@
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
- };
@@ -1,35 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export const MapContext: import('preact').Context<any>;
@@ -1,5 +0,0 @@
1
- import { createContext } from "preact";
2
- const MapContext = createContext();
3
- export {
4
- MapContext
5
- };
@@ -1,10 +0,0 @@
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;
@@ -1,88 +0,0 @@
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
- };
@@ -1,8 +0,0 @@
1
- export function bboxFeature(bounds: any): {
2
- type: string;
3
- properties: {};
4
- geometry: {
5
- coordinates: any[][][];
6
- type: string;
7
- };
8
- };
@@ -1,26 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export function dynamicPropValue(prop: any, d: any, index: any): any;
@@ -1,9 +0,0 @@
1
- function dynamicPropValue(prop, d, index) {
2
- if (typeof prop === "function") {
3
- return prop(d, index);
4
- }
5
- return prop;
6
- }
7
- export {
8
- dynamicPropValue
9
- };
@@ -1,4 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export function saveSVG(elementId: any): void;
@@ -1,4 +0,0 @@
1
- /**
2
- * Throws an error if any child component in `children` is not a valid layer (Polygon, Line, etc)
3
- */
4
- export function useThrowIfNonLayerChildren(children: any): void;
@@ -1,19 +0,0 @@
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
- };