@hitachivantara/uikit-react-core
Version:
Core React components for the NEXT Design System.
52 lines (51 loc) • 1.54 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { useDefaultProps, createClasses, mergeStyles } from "@hitachivantara/uikit-react-utils";
import { getColor, theme } from "@hitachivantara/uikit-styles";
import { SvgBase } from "../icons.js";
const { useClasses } = createClasses("HvRadioIcon", {
root: {
borderRadius: theme.radii.full,
border: `1px solid ${theme.colors.borderStrong}`,
backgroundColor: theme.colors.bgContainer
},
checked: {
borderColor: "transparent",
backgroundColor: `var(--bg-color, ${theme.colors.primaryStrong})`,
color: theme.colors.bgContainer
},
disabled: {
borderColor: theme.colors.textDisabled,
backgroundColor: theme.colors.bgDisabled
},
checkedDisabled: {
borderColor: "transparent",
backgroundColor: theme.colors.borderDisabled,
color: theme.colors.bgDisabled
}
});
const HvRadioIcon = (props) => {
const {
className,
classes: classesProp,
checked,
disabled,
color
} = useDefaultProps("HvRadioIcon", props);
const { classes, cx } = useClasses(classesProp, false);
return /* @__PURE__ */ jsx(
SvgBase,
{
viewBox: "0 0 16 16",
className: cx(classes.root, className, {
[classes.checked]: checked,
[classes.disabled]: disabled,
[classes.checkedDisabled]: checked && disabled
}),
style: mergeStyles({}, { "--bg-color": getColor(color) }),
children: checked && /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "4.5" })
}
);
};
export {
HvRadioIcon
};