UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

30 lines (29 loc) 1.63 kB
import { __assign, __rest } from "tslib"; import React from 'react'; import clsx from 'clsx'; import styles from './styles.css.js'; import { getBaseProps } from '../../base-component'; var SelectableItem = function (_a, ref) { var _b; var children = _a.children, selected = _a.selected, highlighted = _a.highlighted, disabled = _a.disabled, hasBackground = _a.hasBackground, isParent = _a.isParent, isChild = _a.isChild, isKeyboard = _a.isKeyboard, virtualPosition = _a.virtualPosition, restProps = __rest(_a, ["children", "selected", "highlighted", "disabled", "hasBackground", "isParent", "isChild", "isKeyboard", "virtualPosition"]); var baseProps = getBaseProps(restProps); var className = clsx(styles['selectable-item'], (_b = {}, _b[styles.selected] = selected, _b[styles.highlighted] = highlighted, _b[styles['has-background']] = hasBackground, _b[styles.parent] = isParent, _b[styles.child] = isChild, _b[styles['is-keyboard']] = isKeyboard, _b[styles.disabled] = disabled, _b[styles.virtual] = virtualPosition !== undefined, _b)); var style = virtualPosition !== undefined ? { transform: "translateY(" + virtualPosition + "px)" } : undefined; return (React.createElement("li", __assign({ className: className, role: 'option', "aria-hidden": disabled, "aria-selected": selected, "aria-disabled": disabled, style: style }, baseProps), children, React.createElement("div", { className: styles['measure-strut'], ref: ref }))); }; export default React.forwardRef(SelectableItem);