@bigmath-ui-library/core 2.0.5 → 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/dist/cjs/index.js +221 -35266
- package/dist/esm/index.js +220 -35260
- package/package.json +2 -1
- package/rollup.config.js +5 -0
- package/src/components/BMMaps/BMMapMarker.tsx +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigmath-ui-library/core",
|
|
3
|
-
"version": "2.0.
|
|
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
|
@@ -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
|
|
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:
|
|
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
|
});
|