@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.
Files changed (335) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/dayjs.min.js +4 -0
  3. package/dist/_virtual/relativeTime.js +4 -0
  4. package/dist/components/index.d.ts +3 -0
  5. package/dist/components/molecules/canvas-map/Map.d.ts +17 -0
  6. package/dist/components/molecules/canvas-map/Map.js +89 -0
  7. package/dist/components/molecules/canvas-map/context/MapContext.d.ts +19 -0
  8. package/dist/components/molecules/canvas-map/context/MapContext.js +20 -0
  9. package/dist/components/molecules/canvas-map/controls/ZoomControl.d.ts +6 -0
  10. package/dist/components/molecules/canvas-map/controls/ZoomControl.js +40 -0
  11. package/dist/components/molecules/canvas-map/controls/icons/index.d.ts +3 -0
  12. package/dist/components/molecules/canvas-map/controls/icons/minus.d.ts +1 -0
  13. package/dist/components/molecules/canvas-map/controls/icons/minus.js +25 -0
  14. package/dist/components/molecules/canvas-map/controls/icons/plus.d.ts +1 -0
  15. package/dist/components/molecules/canvas-map/controls/icons/plus.js +25 -0
  16. package/dist/components/molecules/canvas-map/controls/icons/reset.d.ts +3 -0
  17. package/dist/components/molecules/canvas-map/controls/icons/reset.js +25 -0
  18. package/dist/components/molecules/canvas-map/controls/index.d.ts +1 -0
  19. package/dist/components/molecules/canvas-map/controls/style.module.css.js +11 -0
  20. package/dist/components/molecules/canvas-map/index.d.ts +12 -0
  21. package/dist/components/molecules/canvas-map/lib/Feature.d.ts +38 -0
  22. package/dist/components/molecules/canvas-map/lib/Feature.js +104 -0
  23. package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +20 -0
  24. package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +23 -0
  25. package/dist/components/molecules/canvas-map/lib/Map.d.ts +69 -0
  26. package/dist/components/molecules/canvas-map/lib/Map.js +254 -0
  27. package/dist/components/molecules/canvas-map/lib/View.d.ts +136 -0
  28. package/dist/components/molecules/canvas-map/lib/View.js +179 -0
  29. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.d.ts +8 -0
  30. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.js +35 -0
  31. package/dist/components/molecules/canvas-map/lib/events/MapEvent.d.ts +6 -0
  32. package/dist/components/molecules/canvas-map/lib/events/MapEvent.js +9 -0
  33. package/dist/components/molecules/canvas-map/lib/events/index.d.ts +2 -0
  34. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.d.ts +10 -0
  35. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +96 -0
  36. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.d.ts +32 -0
  37. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.js +41 -0
  38. package/dist/components/molecules/canvas-map/lib/geometry/LineString.d.ts +12 -0
  39. package/dist/components/molecules/canvas-map/lib/geometry/LineString.js +19 -0
  40. package/dist/components/molecules/canvas-map/lib/geometry/Point.d.ts +11 -0
  41. package/dist/components/molecules/canvas-map/lib/geometry/Point.js +16 -0
  42. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.d.ts +16 -0
  43. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.js +46 -0
  44. package/dist/components/molecules/canvas-map/lib/geometry/index.d.ts +4 -0
  45. package/dist/components/molecules/canvas-map/lib/interpolators/index.d.ts +2 -0
  46. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.d.ts +5 -0
  47. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.js +95 -0
  48. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.d.ts +4 -0
  49. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js +65 -0
  50. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +52 -0
  51. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +111 -0
  52. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +53 -0
  53. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +132 -0
  54. package/dist/components/molecules/canvas-map/lib/layers/index.d.ts +3 -0
  55. package/dist/components/molecules/canvas-map/lib/projection/index.d.ts +22 -0
  56. package/dist/components/molecules/canvas-map/lib/projection/index.js +12 -0
  57. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +6 -0
  58. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +46 -0
  59. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.d.ts +6 -0
  60. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +53 -0
  61. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.d.ts +17 -0
  62. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +119 -0
  63. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +10 -0
  64. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +78 -0
  65. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +15 -0
  66. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +56 -0
  67. package/dist/components/molecules/canvas-map/lib/styles/Fill.d.ts +7 -0
  68. package/dist/components/molecules/canvas-map/lib/styles/Fill.js +15 -0
  69. package/dist/components/molecules/canvas-map/lib/styles/Stroke.d.ts +8 -0
  70. package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +16 -0
  71. package/dist/components/molecules/canvas-map/lib/styles/Style.d.ts +24 -0
  72. package/dist/components/molecules/canvas-map/lib/styles/Style.js +17 -0
  73. package/dist/components/molecules/canvas-map/lib/styles/Text.d.ts +10 -0
  74. package/dist/components/molecules/canvas-map/lib/styles/Text.js +14 -0
  75. package/dist/components/molecules/canvas-map/lib/styles/index.d.ts +4 -0
  76. package/dist/components/molecules/canvas-map/lib/util/array.d.ts +6 -0
  77. package/dist/components/molecules/canvas-map/lib/util/array.js +15 -0
  78. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.d.ts +8 -0
  79. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.js +26 -0
  80. package/dist/components/molecules/canvas-map/lib/util/debug.d.ts +11 -0
  81. package/dist/components/molecules/canvas-map/lib/util/debug.js +27 -0
  82. package/dist/components/molecules/canvas-map/lib/util/deflate.d.ts +36 -0
  83. package/dist/components/molecules/canvas-map/lib/util/distance.d.ts +1 -0
  84. package/dist/components/molecules/canvas-map/lib/util/distance.js +12 -0
  85. package/dist/components/molecules/canvas-map/lib/util/dom.d.ts +9 -0
  86. package/dist/components/molecules/canvas-map/lib/util/dom.js +28 -0
  87. package/dist/components/molecules/canvas-map/lib/util/extent.d.ts +21 -0
  88. package/dist/components/molecules/canvas-map/lib/util/extent.js +38 -0
  89. package/dist/components/molecules/canvas-map/lib/util/memoise.d.ts +10 -0
  90. package/dist/components/molecules/canvas-map/lib/util/memoise.js +20 -0
  91. package/dist/components/molecules/canvas-map/lib/util/resolution.d.ts +9 -0
  92. package/dist/components/molecules/canvas-map/lib/util/resolution.js +11 -0
  93. package/dist/components/molecules/canvas-map/lib/util/simplify.d.ts +114 -0
  94. package/dist/components/molecules/canvas-map/lib/util/size.d.ts +32 -0
  95. package/dist/components/molecules/canvas-map/lib/util/size.js +53 -0
  96. package/dist/components/molecules/canvas-map/lib/util/toRgba.d.ts +1 -0
  97. package/dist/components/molecules/canvas-map/lib/util/toRgba.js +25 -0
  98. package/dist/components/molecules/canvas-map/lib/util/uid.d.ts +5 -0
  99. package/dist/components/molecules/canvas-map/lib/util/uid.js +7 -0
  100. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.d.ts +2 -0
  101. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.js +14 -0
  102. package/dist/components/molecules/canvas-map/style.module.scss.js +20 -0
  103. package/dist/components/molecules/column-chart/column-chart-example.d.ts +35 -0
  104. package/dist/components/molecules/column-chart/column-chart-util.d.ts +1 -0
  105. package/dist/components/molecules/column-chart/index.d.ts +11 -0
  106. package/dist/components/molecules/column-chart/index.js +63 -0
  107. package/dist/components/molecules/column-chart/style.module.css.js +14 -0
  108. package/dist/components/molecules/control-change/index.d.ts +6 -0
  109. package/dist/components/molecules/control-change/index.js +29 -0
  110. package/dist/components/molecules/control-change/style.module.css.js +11 -0
  111. package/dist/components/molecules/dropdown/index.d.ts +11 -0
  112. package/dist/components/molecules/dropdown/index.js +191 -0
  113. package/dist/components/molecules/dropdown/style.module.css.js +50 -0
  114. package/dist/components/molecules/first-past-the-post-waffle/index.d.ts +5 -0
  115. package/dist/components/molecules/first-past-the-post-waffle/index.js +14 -0
  116. package/dist/components/molecules/first-past-the-post-waffle/style.module.css.js +14 -0
  117. package/dist/components/molecules/index.d.ts +17 -0
  118. package/dist/components/molecules/modal/index.d.ts +8 -0
  119. package/dist/components/molecules/modal/index.js +59 -0
  120. package/dist/components/molecules/modal/style.module.css.js +26 -0
  121. package/dist/components/molecules/page-section/index.d.ts +8 -0
  122. package/dist/components/molecules/page-section/index.js +52 -0
  123. package/dist/components/molecules/page-section/style.module.scss.js +20 -0
  124. package/dist/components/molecules/party-profile/index.d.ts +10 -0
  125. package/dist/components/molecules/party-profile/index.js +29 -0
  126. package/dist/components/molecules/party-profile/style.module.css.js +26 -0
  127. package/dist/components/molecules/refresh-indicator/index.d.ts +4 -0
  128. package/dist/components/molecules/refresh-indicator/index.js +18 -0
  129. package/dist/components/molecules/refresh-indicator/style.module.scss.js +17 -0
  130. package/dist/components/molecules/responsive-grid/index.d.ts +10 -0
  131. package/dist/components/molecules/responsive-grid/index.js +19 -0
  132. package/dist/components/molecules/responsive-grid/style.module.scss.js +8 -0
  133. package/dist/components/molecules/result-summary/index.d.ts +8 -0
  134. package/dist/components/molecules/result-summary/index.js +36 -0
  135. package/dist/components/molecules/result-summary/style.module.css.js +11 -0
  136. package/dist/components/molecules/search-input/icons/search.d.ts +1 -0
  137. package/dist/components/molecules/search-input/icons/search.js +24 -0
  138. package/dist/components/molecules/search-input/icons/search.module.css.js +11 -0
  139. package/dist/components/molecules/search-input/index.d.ts +11 -0
  140. package/dist/components/molecules/search-input/index.js +164 -0
  141. package/dist/components/molecules/search-input/style.module.css.js +32 -0
  142. package/dist/components/molecules/slope-chart/index.d.ts +16 -0
  143. package/dist/components/molecules/slope-chart/index.js +139 -0
  144. package/dist/components/molecules/slope-chart/style.module.css.js +35 -0
  145. package/dist/components/molecules/svg-map/context/MapContext.d.ts +1 -0
  146. package/dist/components/molecules/svg-map/context/MapContext.js +5 -0
  147. package/dist/components/molecules/svg-map/context/SVGMapProvider.d.ts +10 -0
  148. package/dist/components/molecules/svg-map/context/SVGMapProvider.js +88 -0
  149. package/dist/components/molecules/svg-map/helpers/bboxFeature.d.ts +8 -0
  150. package/dist/components/molecules/svg-map/helpers/bboxFeature.js +26 -0
  151. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.d.ts +1 -0
  152. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.js +9 -0
  153. package/dist/components/molecules/svg-map/helpers/geoMath.d.ts +4 -0
  154. package/dist/components/molecules/svg-map/helpers/saveSVG.d.ts +1 -0
  155. package/dist/components/molecules/svg-map/hooks/useCamera.d.ts +0 -0
  156. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.d.ts +4 -0
  157. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.js +19 -0
  158. package/dist/components/molecules/svg-map/index.d.ts +38 -0
  159. package/dist/components/molecules/svg-map/index.js +120 -0
  160. package/dist/components/molecules/svg-map/layers/CompositionBorders.d.ts +3 -0
  161. package/dist/components/molecules/svg-map/layers/CompositionBorders.js +14 -0
  162. package/dist/components/molecules/svg-map/layers/Line.d.ts +7 -0
  163. package/dist/components/molecules/svg-map/layers/Line.js +48 -0
  164. package/dist/components/molecules/svg-map/layers/Point.d.ts +10 -0
  165. package/dist/components/molecules/svg-map/layers/Point.js +59 -0
  166. package/dist/components/molecules/svg-map/layers/Polygon.d.ts +9 -0
  167. package/dist/components/molecules/svg-map/layers/Polygon.js +75 -0
  168. package/dist/components/molecules/svg-map/layers/Prerendered.d.ts +3 -0
  169. package/dist/components/molecules/svg-map/layers/Prerendered.js +11 -0
  170. package/dist/components/molecules/svg-map/layers/compositionBorders.module.scss.js +8 -0
  171. package/dist/components/molecules/svg-map/layers/index.d.ts +5 -0
  172. package/dist/components/molecules/svg-map/layers/index.js +12 -0
  173. package/dist/components/molecules/svg-map/renderers/SVGRenderer.d.ts +3 -0
  174. package/dist/components/molecules/svg-map/renderers/SVGRenderer.js +32 -0
  175. package/dist/components/molecules/svg-map/style.module.css.js +11 -0
  176. package/dist/components/molecules/table/index.d.ts +7 -0
  177. package/dist/components/molecules/table/index.js +90 -0
  178. package/dist/components/molecules/table/style.module.scss.js +29 -0
  179. package/dist/components/molecules/table/useTable.d.ts +8 -0
  180. package/dist/components/molecules/table/useTable.js +128 -0
  181. package/dist/components/molecules/tooltip/index.d.ts +82 -0
  182. package/dist/components/molecules/tooltip/index.js +117 -0
  183. package/dist/components/molecules/tooltip/style.module.css.js +8 -0
  184. package/dist/components/molecules/topline-result/index.d.ts +3 -0
  185. package/dist/components/molecules/topline-result/index.js +61 -0
  186. package/dist/components/molecules/topline-result/style.module.scss.js +38 -0
  187. package/dist/components/organisms/coalitions-tracker/index.d.ts +16 -0
  188. package/dist/components/organisms/coalitions-tracker/index.js +151 -0
  189. package/dist/components/organisms/coalitions-tracker/style.module.scss.js +32 -0
  190. package/dist/components/organisms/index.d.ts +2 -0
  191. package/dist/components/organisms/ticker/gradient/index.d.ts +1 -0
  192. package/dist/components/organisms/ticker/gradient/index.js +35 -0
  193. package/dist/components/organisms/ticker/gradient/style.module.scss.js +14 -0
  194. package/dist/components/organisms/ticker/index.d.ts +5 -0
  195. package/dist/components/organisms/ticker/index.js +102 -0
  196. package/dist/components/organisms/ticker/style.module.scss.js +32 -0
  197. package/dist/components/particles/ad-slot/index.d.ts +40 -0
  198. package/dist/components/particles/ad-slot/index.js +34 -0
  199. package/dist/components/particles/ad-slot/style.module.css.js +11 -0
  200. package/dist/components/particles/arrow-button/index.d.ts +6 -0
  201. package/dist/components/particles/arrow-button/index.js +32 -0
  202. package/dist/components/particles/arrow-button/style.module.css.js +11 -0
  203. package/dist/components/particles/aspect-ratio-box/index.d.ts +4 -0
  204. package/dist/components/particles/aspect-ratio-box/index.js +15 -0
  205. package/dist/components/particles/aspect-ratio-box/style.module.css.js +6 -0
  206. package/dist/components/particles/button/index.d.ts +6 -0
  207. package/dist/components/particles/button/index.js +10 -0
  208. package/dist/components/particles/button/style.module.css.js +11 -0
  209. package/dist/components/particles/change-bar/index.d.ts +8 -0
  210. package/dist/components/particles/change-bar/index.js +27 -0
  211. package/dist/components/particles/change-bar/style.module.scss.js +14 -0
  212. package/dist/components/particles/chevron/index.d.ts +6 -0
  213. package/dist/components/particles/chevron/index.js +78 -0
  214. package/dist/components/particles/chevron/style.module.css.js +20 -0
  215. package/dist/components/particles/circle-icon/index.d.ts +6 -0
  216. package/dist/components/particles/circle-icon/index.js +32 -0
  217. package/dist/components/particles/circle-icon/style.module.css.js +14 -0
  218. package/dist/components/particles/close-button/index.d.ts +5 -0
  219. package/dist/components/particles/close-button/index.js +35 -0
  220. package/dist/components/particles/close-button/style.module.css.js +17 -0
  221. package/dist/components/particles/container/index.d.ts +5 -0
  222. package/dist/components/particles/container/index.js +13 -0
  223. package/dist/components/particles/container/style.module.scss.js +11 -0
  224. package/dist/components/particles/gradient-icon/index.d.ts +1 -0
  225. package/dist/components/particles/gradient-icon/index.js +46 -0
  226. package/dist/components/particles/gradient-icon/style.module.css.js +14 -0
  227. package/dist/components/particles/index.d.ts +18 -0
  228. package/dist/components/particles/info-button/index.d.ts +3 -0
  229. package/dist/components/particles/info-button/index.js +19 -0
  230. package/dist/components/particles/info-button/style.module.css.js +11 -0
  231. package/dist/components/particles/legend-item/index.d.ts +6 -0
  232. package/dist/components/particles/legend-item/index.js +26 -0
  233. package/dist/components/particles/legend-item/style.module.css.js +17 -0
  234. package/dist/components/particles/relative-time-sentence/index.d.ts +4 -0
  235. package/dist/components/particles/relative-time-sentence/index.js +14 -0
  236. package/dist/components/particles/relative-time-sentence/style.module.css.js +8 -0
  237. package/dist/components/particles/square-cut-corner-icon/index.d.ts +6 -0
  238. package/dist/components/particles/square-cut-corner-icon/index.js +56 -0
  239. package/dist/components/particles/square-cut-corner-icon/style.module.scss.js +17 -0
  240. package/dist/components/particles/square-icon/index.d.ts +5 -0
  241. package/dist/components/particles/square-icon/index.js +28 -0
  242. package/dist/components/particles/square-icon/style.module.scss.js +11 -0
  243. package/dist/components/particles/stacked-bar/index.d.ts +23 -0
  244. package/dist/components/particles/stacked-bar/index.js +140 -0
  245. package/dist/components/particles/stacked-bar/style.module.css.js +17 -0
  246. package/dist/components/particles/stacked-grid/index.d.ts +6 -0
  247. package/dist/components/particles/stacked-grid/index.js +35 -0
  248. package/dist/components/particles/stacked-grid/style.module.css.js +20 -0
  249. package/dist/components/particles/waffle/index.d.ts +14 -0
  250. package/dist/components/particles/waffle/index.js +76 -0
  251. package/dist/components/particles/waffle/style.module.css.js +11 -0
  252. package/dist/index.d.ts +2 -0
  253. package/dist/index.js +128 -0
  254. package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +338 -0
  255. package/dist/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +13 -0
  256. package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/albersUk.js +108 -0
  257. package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/bounds.js +24 -0
  258. package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/fit.js +18 -0
  259. package/dist/node_modules/.pnpm/d3-composite-projections@1.4.0/node_modules/d3-composite-projections/src/math.js +4 -0
  260. package/dist/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +70 -0
  261. package/dist/node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js +6 -0
  262. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js +24 -0
  263. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js +4 -0
  264. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js +8 -0
  265. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js +20 -0
  266. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js +43 -0
  267. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js +28 -0
  268. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js +59 -0
  269. package/dist/node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js +18 -0
  270. package/dist/node_modules/.pnpm/d3-path@2.0.0/node_modules/d3-path/src/path.js +73 -0
  271. package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js +13 -0
  272. package/dist/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +96 -0
  273. package/dist/node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js +21 -0
  274. 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
  275. 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
  276. 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
  277. 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
  278. 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
  279. 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
  280. 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
  281. 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
  282. 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
  283. 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
  284. 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
  285. 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
  286. 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
  287. 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
  288. 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
  289. 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
  290. 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
  291. 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
  292. 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
  293. 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
  294. 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
  295. 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
  296. 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
  297. 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
  298. 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
  299. 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
  300. package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/dayjs.min.js +282 -0
  301. package/dist/node_modules/.pnpm/dayjs@1.11.12/node_modules/dayjs/plugin/relativeTime.js +48 -0
  302. package/dist/node_modules/.pnpm/flatbush@4.4.0/node_modules/flatbush/index.js +339 -0
  303. package/dist/node_modules/.pnpm/flatqueue@2.0.3/node_modules/flatqueue/index.js +67 -0
  304. 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
  305. 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
  306. package/dist/node_modules/.pnpm/quickselect@2.0.0/node_modules/quickselect/index.js +47 -0
  307. package/dist/node_modules/.pnpm/rbush-knn@4.0.0/node_modules/rbush-knn/index.js +42 -0
  308. package/dist/node_modules/.pnpm/rbush@4.0.0/node_modules/rbush/index.js +378 -0
  309. package/dist/node_modules/.pnpm/tinyqueue@2.0.3/node_modules/tinyqueue/index.js +65 -0
  310. package/dist/shared/colors/index.d.ts +2 -0
  311. package/dist/shared/helpers/createStore.d.ts +1 -0
  312. package/dist/shared/helpers/geometry.d.ts +3 -0
  313. package/dist/shared/helpers/geometry.js +16 -0
  314. package/dist/shared/helpers/geometry.test.d.ts +1 -0
  315. package/dist/shared/helpers/labelsUtil.d.ts +54 -0
  316. package/dist/shared/helpers/labelsUtil.js +58 -0
  317. package/dist/shared/helpers/labelsUtils.test.d.ts +1 -0
  318. package/dist/shared/helpers/shouldUpdate.d.ts +7 -0
  319. package/dist/shared/hooks/index.d.ts +3 -0
  320. package/dist/shared/hooks/useContainerSize.d.ts +1 -0
  321. package/dist/shared/hooks/useContainerSize.js +24 -0
  322. package/dist/shared/hooks/useTouchOrHover.d.ts +6 -0
  323. package/dist/shared/hooks/useTouchOrHover.js +95 -0
  324. package/dist/shared/hooks/useWindowSize.d.ts +4 -0
  325. package/dist/shared/hooks/useWindowSize.js +27 -0
  326. package/dist/style.css +74 -74
  327. package/dist/styles/helpers/mergeStyles.d.ts +1 -0
  328. package/dist/styles/helpers/mergeStyles.js +22 -0
  329. package/dist/styles/helpers/mergeStyles.test.d.ts +1 -0
  330. package/dist/styles/theme.config.d.ts +124 -0
  331. package/package.json +6 -9
  332. package/dist/interactive-component-library.js +0 -7993
  333. package/dist/interactive-component-library.js.map +0 -1
  334. package/dist/interactive-component-library.umd.cjs +0 -7989
  335. package/dist/interactive-component-library.umd.cjs.map +0 -1
@@ -0,0 +1,9 @@
1
+ export function Polygon({ id, features, fill, stroke, strokeWidth, zIndex, styles, }: {
2
+ id: any;
3
+ features: any;
4
+ fill?: any;
5
+ stroke?: any;
6
+ strokeWidth?: number;
7
+ zIndex?: number;
8
+ styles: any;
9
+ }): import("preact").JSX.Element;
@@ -0,0 +1,75 @@
1
+ import { jsx, Fragment } from "preact/jsx-runtime";
2
+ import { useContext, useState, useEffect, useCallback } from "preact/hooks";
3
+ import { MapContext } from "../context/MapContext.js";
4
+ import { dynamicPropValue } from "../helpers/dynamicPropValue.js";
5
+ import { geoContains } from "d3-geo";
6
+ import Flatbush from "../../../../node_modules/.pnpm/flatbush@4.4.0/node_modules/flatbush/index.js";
7
+ function Polygon({
8
+ id,
9
+ features,
10
+ fill = null,
11
+ stroke = null,
12
+ strokeWidth = 1,
13
+ zIndex = 0,
14
+ styles
15
+ }) {
16
+ const context = useContext(MapContext);
17
+ const [searchIndex, setSearchIndex] = useState();
18
+ useEffect(() => {
19
+ if (!context.path) return;
20
+ let index = new Flatbush(features.length);
21
+ for (const feature of features) {
22
+ const bounds = context.path.bounds(feature);
23
+ index.add(
24
+ Math.floor(bounds[0][0]),
25
+ Math.floor(bounds[0][1]),
26
+ Math.ceil(bounds[1][0]),
27
+ Math.ceil(bounds[1][1])
28
+ );
29
+ }
30
+ index.finish();
31
+ setSearchIndex(index);
32
+ }, [context.path, features]);
33
+ const findFeatureAtPoint = useCallback(
34
+ ([x, y]) => {
35
+ const projectedPoint = context.projection.invert([x, y]);
36
+ const results = searchIndex.search(x, y, x, y);
37
+ let found = results[0];
38
+ results.forEach((idx) => {
39
+ const feature = features[idx];
40
+ if (geoContains(feature, projectedPoint)) {
41
+ found = idx;
42
+ }
43
+ });
44
+ return features[found];
45
+ },
46
+ [context, searchIndex, features]
47
+ );
48
+ useEffect(() => {
49
+ const layer = {
50
+ zIndex,
51
+ findFeatureAtPoint
52
+ };
53
+ context.registerLayer(layer);
54
+ return () => {
55
+ context.unregisterLayer(layer);
56
+ };
57
+ }, [context, zIndex, findFeatureAtPoint]);
58
+ return /* @__PURE__ */ jsx(Fragment, { children: features.map((d, index) => {
59
+ return /* @__PURE__ */ jsx(
60
+ "path",
61
+ {
62
+ id: dynamicPropValue(id, d, index),
63
+ className: dynamicPropValue(styles, d, index),
64
+ fill: dynamicPropValue(fill, d, index),
65
+ stroke: dynamicPropValue(stroke, d, index),
66
+ strokeWidth: dynamicPropValue(strokeWidth, d, index),
67
+ d: context.path(d)
68
+ },
69
+ index
70
+ );
71
+ }) });
72
+ }
73
+ export {
74
+ Polygon
75
+ };
@@ -0,0 +1,3 @@
1
+ export function Prerendered({ url }: {
2
+ url: any;
3
+ }): import("preact").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import { useContext } from "preact/hooks";
3
+ import { MapContext } from "../context/MapContext.js";
4
+ function Prerendered({ url }) {
5
+ const context = useContext(MapContext);
6
+ const { width, height } = context.contentSize;
7
+ return /* @__PURE__ */ jsx("image", { width, height, href: url });
8
+ }
9
+ export {
10
+ Prerendered
11
+ };
@@ -0,0 +1,8 @@
1
+ const path = "_path_1cwd5_9";
2
+ const defaultStyles = {
3
+ path
4
+ };
5
+ export {
6
+ defaultStyles as default,
7
+ path
8
+ };
@@ -0,0 +1,5 @@
1
+ export * from './Polygon';
2
+ export * from './Line';
3
+ export * from './CompositionBorders';
4
+ export * from './Prerendered';
5
+ export * from './Point';
@@ -0,0 +1,12 @@
1
+ import { Polygon } from "./Polygon.js";
2
+ import { Line } from "./Line.js";
3
+ import { CompositionBorders } from "./CompositionBorders.js";
4
+ import { Prerendered } from "./Prerendered.js";
5
+ import { Point } from "./Point.js";
6
+ export {
7
+ CompositionBorders,
8
+ Line,
9
+ Point,
10
+ Polygon,
11
+ Prerendered
12
+ };
@@ -0,0 +1,3 @@
1
+ export function SVGRenderer({ children }: {
2
+ children: any;
3
+ }): import("preact").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ import { useContext } from "preact/hooks";
3
+ import { MapContext } from "../context/MapContext.js";
4
+ import { CompositionBorders } from "../layers/CompositionBorders.js";
5
+ function SVGRenderer({ children }) {
6
+ const { id, config, size, selectedFeature, padding } = useContext(MapContext);
7
+ return /* @__PURE__ */ jsx(
8
+ "svg",
9
+ {
10
+ id,
11
+ width: size.width,
12
+ height: size.height,
13
+ viewBox: `0 0 ${size.width} ${size.height}`,
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ onClick: () => {
16
+ if (selectedFeature) {
17
+ selectedFeature.value = null;
18
+ }
19
+ },
20
+ children: /* @__PURE__ */ jsxs("g", { transform: `translate(${padding.left} ${padding.top})`, children: [
21
+ /* @__PURE__ */ jsx("g", { children }),
22
+ config.drawCompositionBorders && Object.prototype.hasOwnProperty.call(
23
+ config.projection,
24
+ "getCompositionBorders"
25
+ ) && /* @__PURE__ */ jsx(CompositionBorders, {})
26
+ ] })
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ SVGRenderer
32
+ };
@@ -0,0 +1,11 @@
1
+ const container = "_container_9pdyv_1";
2
+ const svg = "_svg_9pdyv_7";
3
+ const styles = {
4
+ container,
5
+ svg
6
+ };
7
+ export {
8
+ container,
9
+ styles as default,
10
+ svg
11
+ };
@@ -0,0 +1,7 @@
1
+ export function Table({ columns, data, hideHeader, stickyHeader, styles, }: {
2
+ columns: any;
3
+ data: any;
4
+ hideHeader?: boolean;
5
+ stickyHeader?: boolean;
6
+ styles: any;
7
+ }): import("preact").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import { jsxs, jsx } from "preact/jsx-runtime";
2
+ import { useState } from "preact/hooks";
3
+ import { useTable } from "./useTable.js";
4
+ import { Chevron } from "../../particles/chevron/index.js";
5
+ import defaultStyles from "./style.module.scss.js";
6
+ import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
7
+ function Table({
8
+ columns,
9
+ data,
10
+ hideHeader = false,
11
+ stickyHeader = false,
12
+ styles
13
+ }) {
14
+ const [sortState, setSortState] = useState(() => {
15
+ const columnIndex = columns.findIndex((column) => {
16
+ if ("sort" in column) {
17
+ return true;
18
+ }
19
+ return false;
20
+ });
21
+ const ascending = columnIndex >= 0 ? columns[columnIndex].sort.ascending : false;
22
+ return {
23
+ columnIndex,
24
+ ascending
25
+ };
26
+ });
27
+ const table = useTable({ columns, data, sortState });
28
+ const sortByColumn = (index) => {
29
+ setSortState((currentState) => {
30
+ return {
31
+ columnIndex: index,
32
+ ascending: index === currentState.columnIndex ? !currentState.ascending : false
33
+ };
34
+ });
35
+ };
36
+ styles = mergeStyles(defaultStyles, styles);
37
+ return /* @__PURE__ */ jsxs("table", { className: styles.table, cellSpacing: 0, cellPadding: 0, children: [
38
+ /* @__PURE__ */ jsx("thead", { className: hideHeader && styles.hideHeader, children: /* @__PURE__ */ jsx("tr", { children: table.columns.map((column, index) => {
39
+ var _a;
40
+ let columnStyle = mergeStyles(
41
+ styles.headerCell,
42
+ (_a = column.styles) == null ? void 0 : _a.headerCell
43
+ );
44
+ if (stickyHeader) {
45
+ columnStyle = mergeStyles(columnStyle, styles.stickyHeader);
46
+ }
47
+ return /* @__PURE__ */ jsx("th", { scope: "col", className: columnStyle, children: /* @__PURE__ */ jsx(
48
+ HeaderCell,
49
+ {
50
+ styles: mergeStyles(styles, column.styles),
51
+ onClick: () => sortByColumn(index),
52
+ ...column.headerProps
53
+ },
54
+ index
55
+ ) }, column.id);
56
+ }) }) }),
57
+ /* @__PURE__ */ jsx("tbody", { className: hideHeader && styles.hideHeaderNoBorder, children: table.rows.map((row) => {
58
+ return /* @__PURE__ */ jsx("tr", { className: styles.bodyRow, children: row.cells.map((cell) => {
59
+ var _a;
60
+ return /* @__PURE__ */ jsx(
61
+ "td",
62
+ {
63
+ className: mergeStyles(
64
+ styles.bodyCell,
65
+ (_a = cell.column.styles) == null ? void 0 : _a.bodyCell
66
+ ),
67
+ children: cell.displayValue
68
+ },
69
+ cell.id
70
+ );
71
+ }) }, row.id);
72
+ }) })
73
+ ] });
74
+ }
75
+ function HeaderCell({ text, sortable, isSorted, styles, onClick }) {
76
+ if (!sortable) {
77
+ return text;
78
+ }
79
+ let direction = "down";
80
+ if ((isSorted == null ? void 0 : isSorted.ascending) === false) {
81
+ direction = "up";
82
+ }
83
+ return /* @__PURE__ */ jsxs("button", { onClick, className: styles.headerCellButton, children: [
84
+ /* @__PURE__ */ jsx("span", { children: text }),
85
+ /* @__PURE__ */ jsx(Chevron, { active: !!isSorted, direction })
86
+ ] });
87
+ }
88
+ export {
89
+ Table
90
+ };
@@ -0,0 +1,29 @@
1
+ const table = "_table_fhbur_9";
2
+ const hideHeader = "_hideHeader_fhbur_20";
3
+ const hideHeaderNoBorder = "_hideHeaderNoBorder_fhbur_29";
4
+ const headerCell = "_headerCell_fhbur_33";
5
+ const stickyHeader = "_stickyHeader_fhbur_42";
6
+ const headerCellButton = "_headerCellButton_fhbur_49";
7
+ const bodyRow = "_bodyRow_fhbur_58";
8
+ const bodyCell = "_bodyCell_fhbur_62";
9
+ const defaultStyles = {
10
+ table,
11
+ hideHeader,
12
+ hideHeaderNoBorder,
13
+ headerCell,
14
+ stickyHeader,
15
+ headerCellButton,
16
+ bodyRow,
17
+ bodyCell
18
+ };
19
+ export {
20
+ bodyCell,
21
+ bodyRow,
22
+ defaultStyles as default,
23
+ headerCell,
24
+ headerCellButton,
25
+ hideHeader,
26
+ hideHeaderNoBorder,
27
+ stickyHeader,
28
+ table
29
+ };
@@ -0,0 +1,8 @@
1
+ export function useTable({ columns, data, sortState }: {
2
+ columns: any;
3
+ data: any;
4
+ sortState: any;
5
+ }): {
6
+ columns: any;
7
+ rows: any;
8
+ };
@@ -0,0 +1,128 @@
1
+ import { useMemo } from "preact/hooks";
2
+ const sortAscending = (accessor) => {
3
+ return (a, b) => {
4
+ const valueA = a[accessor];
5
+ const valueB = b[accessor];
6
+ if (valueA === null) {
7
+ return -1;
8
+ } else if (valueB === null) {
9
+ return 1;
10
+ }
11
+ if (valueA < valueB) return -1;
12
+ if (valueA > valueB) return 1;
13
+ return 0;
14
+ };
15
+ };
16
+ const sortDescending = (accessor) => {
17
+ return (a, b) => {
18
+ const valueA = a[accessor];
19
+ const valueB = b[accessor];
20
+ if (valueA === null) {
21
+ return 1;
22
+ } else if (valueB === null) {
23
+ return -1;
24
+ }
25
+ if (valueA > valueB) return -1;
26
+ if (valueA < valueB) return 1;
27
+ return 0;
28
+ };
29
+ };
30
+ function useTable({ columns, data, sortState }) {
31
+ const sortedData = useMemo(() => {
32
+ if (sortState.columnIndex < 0) {
33
+ return data;
34
+ }
35
+ const dataCopy = new Array(...data);
36
+ const column = columns[sortState.columnIndex];
37
+ const sortFunction = sortState.ascending ? sortAscending(column.accessor) : sortDescending(column.accessor);
38
+ dataCopy.sort(sortFunction);
39
+ return dataCopy;
40
+ }, [columns, data, sortState]);
41
+ const columnModels = useMemo(() => {
42
+ return columns.map((column, columnIndex) => {
43
+ const isSorted = sortState.columnIndex === columnIndex && sortState;
44
+ return new ColumnModel(columnIndex, column, isSorted);
45
+ });
46
+ }, [columns, sortState]);
47
+ const rowModels = useMemo(() => {
48
+ return sortedData.map((d, rowIndex) => {
49
+ const cells = columnModels.map((column, columnIndex) => {
50
+ return new CellModel(column, columnIndex, d, column.cell);
51
+ });
52
+ return new RowModel(rowIndex, cells);
53
+ });
54
+ }, [columnModels, sortedData]);
55
+ return {
56
+ columns: columnModels,
57
+ rows: rowModels
58
+ };
59
+ }
60
+ class ColumnModel {
61
+ constructor(index, definition, isSorted) {
62
+ this.index = index;
63
+ this.definition = definition;
64
+ this.isSorted = isSorted;
65
+ this.defaultValue = definition.defaultValue;
66
+ }
67
+ get id() {
68
+ return this.definition.id || this.header;
69
+ }
70
+ get accessor() {
71
+ return this.definition.accessor;
72
+ }
73
+ get header() {
74
+ return this.definition.header;
75
+ }
76
+ get headerProps() {
77
+ return {
78
+ text: this.header,
79
+ sortable: this.definition.sortable,
80
+ isSorted: this.isSorted,
81
+ ...this.headerCellStyle
82
+ };
83
+ }
84
+ get cell() {
85
+ return this.definition.cell;
86
+ }
87
+ get styles() {
88
+ return this.definition.styles;
89
+ }
90
+ }
91
+ class RowModel {
92
+ constructor(index, cells) {
93
+ this.index = index;
94
+ this.cells = cells;
95
+ }
96
+ get id() {
97
+ return this.index;
98
+ }
99
+ }
100
+ class CellModel {
101
+ constructor(column, columnIndex, row, cell) {
102
+ this.column = column;
103
+ this.columnIndex = columnIndex;
104
+ this.row = row;
105
+ this.cell = cell;
106
+ }
107
+ get id() {
108
+ return this.columnIndex;
109
+ }
110
+ get displayValue() {
111
+ if (this.cell) {
112
+ return this.cell(this.row);
113
+ }
114
+ if (!Object.prototype.hasOwnProperty.call(this.row, this.column.accessor)) {
115
+ if (this.column.defaultValue) {
116
+ return this.column.defaultValue.toString();
117
+ }
118
+ const rowData = JSON.stringify(this.row, null, 2);
119
+ throw new Error(
120
+ `Missing value for key ${this.column.accessor} in ${rowData}`
121
+ );
122
+ }
123
+ return this.row[this.column.accessor] !== null ? this.row[this.column.accessor].toString() : "null";
124
+ }
125
+ }
126
+ export {
127
+ useTable
128
+ };
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @typedef {Object} Point
3
+ * @property {number} x
4
+ * @property {number} y
5
+ */
6
+ /**
7
+ * @typedef {Object} Rect
8
+ * @property {number} x
9
+ * @property {number} y
10
+ * @property {number} width
11
+ * @property {number} height
12
+ */
13
+ /**
14
+ * @typedef {Object} TooltipProps
15
+ * @property {Element} for - The element to which the tooltip should be positioned.
16
+ * @property {Point} [positionInTarget] - The position of the tooltip within the target element.
17
+ * @property {Rect} [touchRect] - The position of the touch event that triggered the tooltip.
18
+ * @property {boolean} [show] - Whether the tooltip should be shown or not.
19
+ * @property {Object} [styles] - Additional styles to be applied to the tooltip.
20
+ * @property {React.ReactNode} children - The content to be displayed inside the tooltip.
21
+ */
22
+ /**
23
+ * A tooltip component that displays content at a specific position relative to a target element.
24
+ *
25
+ * @param {TooltipProps} props
26
+ * @returns {JSX.Element}
27
+ */
28
+ export function Tooltip({ for: targetElement, touchRect, positionInTarget, show, styles, children, }: TooltipProps): JSX.Element;
29
+ export type Point = {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ export type Rect = {
34
+ x: number;
35
+ y: number;
36
+ width: number;
37
+ height: number;
38
+ };
39
+ export type TooltipProps = {
40
+ /**
41
+ * - The element to which the tooltip should be positioned.
42
+ */
43
+ /**
44
+ * - The element to which the tooltip should be positioned.
45
+ */
46
+ for: Element;
47
+ /**
48
+ * - The position of the tooltip within the target element.
49
+ */
50
+ /**
51
+ * - The position of the tooltip within the target element.
52
+ */
53
+ positionInTarget?: Point;
54
+ /**
55
+ * - The position of the touch event that triggered the tooltip.
56
+ */
57
+ /**
58
+ * - The position of the touch event that triggered the tooltip.
59
+ */
60
+ touchRect?: Rect;
61
+ /**
62
+ * - Whether the tooltip should be shown or not.
63
+ */
64
+ /**
65
+ * - Whether the tooltip should be shown or not.
66
+ */
67
+ show?: boolean;
68
+ /**
69
+ * - Additional styles to be applied to the tooltip.
70
+ */
71
+ /**
72
+ * - Additional styles to be applied to the tooltip.
73
+ */
74
+ styles?: any;
75
+ /**
76
+ * - The content to be displayed inside the tooltip.
77
+ */
78
+ /**
79
+ * - The content to be displayed inside the tooltip.
80
+ */
81
+ children: React.ReactNode;
82
+ };
@@ -0,0 +1,117 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import { useState, useRef, useEffect, useLayoutEffect } from "preact/hooks";
3
+ import { createPortal } from "preact/compat";
4
+ import { rectsIntersect } from "../../../shared/helpers/geometry.js";
5
+ import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
6
+ import defaultStyles from "./style.module.css.js";
7
+ function Tooltip({
8
+ for: targetElement,
9
+ touchRect,
10
+ positionInTarget,
11
+ show = true,
12
+ styles,
13
+ children
14
+ }) {
15
+ if (!targetElement) throw new Error("Target for tooltip cannot be undefined");
16
+ const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
17
+ const [displayElement, setDisplayElement] = useState(null);
18
+ const tooltipRef = useRef();
19
+ styles = mergeStyles(defaultStyles, styles);
20
+ useEffect(() => {
21
+ setDisplayElement(document.querySelector("body"));
22
+ return () => {
23
+ setDisplayElement(null);
24
+ };
25
+ }, []);
26
+ useLayoutEffect(() => {
27
+ if (!tooltipRef.current) return;
28
+ const targetRect = targetElement.getBoundingClientRect();
29
+ if (positionInTarget) {
30
+ const newPosition = tooltipPositionForPoint({
31
+ targetRect,
32
+ positionInTarget,
33
+ tooltip: tooltipRef.current,
34
+ displayElement
35
+ });
36
+ setTooltipPosition(newPosition);
37
+ } else if (!positionInTarget) {
38
+ const newPosition = tooltipPositionForRect({
39
+ targetRect,
40
+ touchRect,
41
+ tooltip: tooltipRef.current,
42
+ displayElement
43
+ });
44
+ setTooltipPosition(newPosition);
45
+ }
46
+ }, [targetElement, positionInTarget, displayElement, tooltipRef, touchRect]);
47
+ if (!displayElement) return;
48
+ const fixedStyle = {
49
+ display: show ? "block" : "none",
50
+ position: "fixed",
51
+ left: tooltipPosition.x,
52
+ top: tooltipPosition.y,
53
+ zIndex: 100
54
+ };
55
+ const tooltip = /* @__PURE__ */ jsx("div", { ref: tooltipRef, className: styles.tooltip, style: fixedStyle, children });
56
+ return createPortal(tooltip, displayElement);
57
+ }
58
+ function tooltipPositionForPoint({
59
+ targetRect,
60
+ positionInTarget,
61
+ tooltip,
62
+ displayElement
63
+ }) {
64
+ const newPosition = {
65
+ x: positionInTarget.x + targetRect.x,
66
+ y: positionInTarget.y + targetRect.y
67
+ };
68
+ const tooltipWidth = tooltip.offsetWidth;
69
+ const tooltipHeight = tooltip.offsetHeight;
70
+ const displayElementRect = displayElement.getBoundingClientRect();
71
+ if (newPosition.x + tooltipWidth > displayElementRect.right) {
72
+ newPosition.x -= tooltipWidth;
73
+ }
74
+ if (newPosition.y + tooltipHeight > displayElementRect.bottom) {
75
+ newPosition.y -= tooltipHeight;
76
+ }
77
+ if (newPosition.x <= displayElementRect.left) {
78
+ newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
79
+ }
80
+ return newPosition;
81
+ }
82
+ function tooltipPositionForRect({
83
+ targetRect,
84
+ touchRect = { x: 0, y: 0, width: 0, height: 0 },
85
+ tooltip,
86
+ displayElement
87
+ }) {
88
+ const newPosition = {
89
+ x: targetRect.right,
90
+ y: targetRect.top
91
+ };
92
+ const tooltipWidth = tooltip.offsetWidth;
93
+ const tooltipHeight = tooltip.offsetHeight;
94
+ const tooltipRect = {
95
+ ...newPosition,
96
+ width: tooltipWidth,
97
+ height: tooltipHeight
98
+ };
99
+ if (rectsIntersect(tooltipRect, touchRect)) {
100
+ newPosition.x = touchRect.x + touchRect.width / 2;
101
+ newPosition.y = touchRect.y - tooltipHeight;
102
+ }
103
+ const displayElementRect = displayElement.getBoundingClientRect();
104
+ if (newPosition.x + tooltipWidth > displayElementRect.right) {
105
+ newPosition.x = targetRect.left - tooltipWidth;
106
+ }
107
+ if (newPosition.y - tooltipHeight < displayElementRect.top) {
108
+ newPosition.y = targetRect.bottom;
109
+ }
110
+ if (newPosition.x <= displayElementRect.left) {
111
+ newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
112
+ }
113
+ return newPosition;
114
+ }
115
+ export {
116
+ Tooltip
117
+ };
@@ -0,0 +1,8 @@
1
+ const tooltip = "_tooltip_11t5d_1";
2
+ const defaultStyles = {
3
+ tooltip
4
+ };
5
+ export {
6
+ defaultStyles as default,
7
+ tooltip
8
+ };
@@ -0,0 +1,3 @@
1
+ export const ToplineResult: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<{}> & {
2
+ ref?: import('preact').Ref<any>;
3
+ }>;