@bigmath-ui-library/core 2.0.4 → 2.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigmath-ui-library/core",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -30,6 +30,7 @@
30
30
  "postcss": "^8.5.10",
31
31
  "react-hook-form": "^7.73.1",
32
32
  "react-leaflet": "^5.0.0",
33
+ "reselect": "^4.1.8",
33
34
  "storybook-addon-pseudo-states": "4.0.2",
34
35
  "styled-components": "5.3.11"
35
36
  },
package/rollup.config.js CHANGED
@@ -22,6 +22,11 @@ const external = [
22
22
  /^@emotion\//,
23
23
  'styled-components',
24
24
  /^@types\//,
25
+ 'async_hooks',
26
+ 'util',
27
+ 'crypto',
28
+ 'stream',
29
+ 'reselect',
25
30
  ];
26
31
 
27
32
  export default [
@@ -2,10 +2,27 @@ import React, { FC, useCallback, useState } from "react";
2
2
  import { Marker, Tooltip } from "react-leaflet";
3
3
  import { styled } from "@mui/material";
4
4
  import { DivIcon, LatLngExpression } from "leaflet";
5
- import ReactDOMServer from 'react-dom/server';
5
+ import * as ReactDOM from "react-dom";
6
6
  import { useGetMapIcons } from "./MapIcons";
7
7
  import { MarkerType } from "./markerTypes";
8
8
 
9
+ // React 17 API still works at runtime, TypeScript types just don't expose it for React 19
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const renderElement = (ReactDOM as any).render;
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ const unmountElement = (ReactDOM as any).unmountComponentAtNode;
14
+
15
+ /**
16
+ * Browser-compatible replacement for ReactDOMServer.renderToStaticMarkup
17
+ */
18
+ function renderToStaticMarkup(element: React.ReactElement): string {
19
+ const container = document.createElement("div");
20
+ renderElement(element, container);
21
+ const html = container.innerHTML;
22
+ unmountElement(container);
23
+ return html;
24
+ }
25
+
9
26
  interface BMMapMarkerProps {
10
27
  icon?: React.ReactElement | null;
11
28
  iconHover?: React.ReactElement | null;
@@ -29,7 +46,7 @@ export const BMMapMarker: FC<BMMapMarkerProps> = ({ position, icon, iconHover, t
29
46
  const getIcon = useCallback((icon, hovered = false) => {
30
47
  if (icon === null) return undefined;
31
48
  return new DivIcon({
32
- html: ReactDOMServer.renderToStaticMarkup(icon),
49
+ html: renderToStaticMarkup(icon),
33
50
  iconSize: hovered ? [iconSize[0] + 10, iconSize[1] + 10] : iconSize,
34
51
  className: `svg-icon region-selected-marker ${className}`
35
52
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2019",
4
- "lib": ["ES2019", "DOM", "DOM.Iterable"],
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
5
5
  "module": "ESNext",
6
6
  "moduleResolution": "node",
7
7
  "allowSyntheticDefaultImports": true,