@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
33 lines (32 loc) • 1.26 kB
JavaScript
import { HvTooltip } from "../../Tooltip/Tooltip.js";
import { useClasses } from "./VerticalScrollListItem.styles.js";
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
import { jsx } from "react/jsx-runtime";
//#region src/ScrollToVertical/VerticalScrollListItem/VerticalScrollListItem.tsx
/**
* HvVerticalScrollListItem a focusable item to be used as part of the vertical scroll
*/
var HvVerticalScrollListItem = (props) => {
const { id, className, classes: classesProp, selected, label, tooltipPlacement = "left", href, ...others } = useDefaultProps("HvVerticalScrollListItem", props);
const { classes, cx } = useClasses(classesProp);
const Component = href != null ? "a" : "div";
return /* @__PURE__ */ jsx("li", {
id,
className: cx(classes.root, className),
"aria-current": selected,
children: /* @__PURE__ */ jsx(HvTooltip, {
title: label,
placement: tooltipPlacement,
children: /* @__PURE__ */ jsx(Component, {
role: href == null ? "button" : void 0,
tabIndex: 0,
className: classes.button,
href,
...others,
children: /* @__PURE__ */ jsx("div", { className: cx(classes.icon, { [classes.notSelected]: !selected }) })
})
})
});
};
//#endregion
export { HvVerticalScrollListItem };