UNPKG

@hitachivantara/uikit-react-lab

Version:

Contributed React components for the NEXT UI Kit.

45 lines (44 loc) 1.13 kB
import { jsx } from "react/jsx-runtime"; import { HvButton } from "@hitachivantara/uikit-react-core"; import { mergeStyles } from "@hitachivantara/uikit-react-utils"; import { getColor, dotSizes } from "../utils.js"; import { useClasses } from "./Dot.styles.js"; import { staticClasses } from "./Dot.styles.js"; const HvDot = ({ classes: classesProp, className, state, title, size = "sm", onClick, disabled: disabledProp }) => { const { classes, cx } = useClasses(classesProp); const dotSize = dotSizes[size] * (state === "Current" ? 1.5 : 1); const disabled = disabledProp ?? ["Current", "Disabled"].includes(state); return /* @__PURE__ */ jsx( HvButton, { style: mergeStyles(void 0, { "--dotColor": getColor(state), "--dotSize": `${dotSize}px` }), className: cx( classes.root, { [classes.active]: state === "Current", [classes.ghostDisabled]: disabled }, className ), "aria-label": title, icon: true, disabled, onClick } ); }; export { HvDot, staticClasses as dotClasses };