@south-paw/react-vector-maps
Version:
A React component for interactive vector maps of the world and 100+ countries
43 lines (42 loc) • 1.01 kB
JavaScript
// lib/react-shim.js
import * as React from "react";
// src/VectorMap.tsx
import { jsx, jsxs } from "react/jsx-runtime";
function VectorMap({
id,
name,
layers,
tabIndex = 0,
layerProps,
checkedLayers,
currentLayers,
children,
...other
}) {
if (!layers || layers.length === 0) {
console.error(
`[@south-paw/react-vector-maps] No 'layers' prop provided. Did you spread a map object onto the component?`
);
return null;
}
return /* @__PURE__ */ jsxs("svg", {
xmlns: "http://www.w3.org/2000/svg",
"aria-label": name,
...other,
children: [
children,
layers.map((layer) => /* @__PURE__ */ jsx("path", {
tabIndex,
"aria-label": layer.name,
"aria-checked": checkedLayers && checkedLayers.includes(layer.id),
"aria-current": currentLayers && currentLayers.includes(layer.id),
...layer,
...layerProps
}, layer.id))
]
}, id);
}
export {
VectorMap
};
//# sourceMappingURL=index.mjs.map