@wazespace/wme-react-components
Version:
A package with useful replications of the Waze Map Editor components to use in userscripts
17 lines • 792 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Waze } from '../wz-intrinsic-element-components';
import { WzBadgeNativeColorsArray } from '../wme-intrinsic-elements-props';
export function WzBadge(props) {
const { color, style = {}, ...rest } = props;
const isNativeColor = isNativeBadgeColor(color);
if (color && !isNativeColor) {
style['--wz-badge-dot-color'] = color;
}
return (_jsx(Waze.IntrinsicElements.WzBadge, { color: isNativeColor ? color : undefined, style: style, ...rest }));
}
function isNativeBadgeColor(color) {
if (!color)
return true; // in case there is no color provided, the default one will be chosen, hence it is a native color
return WzBadgeNativeColorsArray.includes(color);
}
//# sourceMappingURL=WzBadge.js.map