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

27 lines (26 loc) 2.03 kB
import { __assign, __rest } from "tslib"; import React from 'react'; import clsx from 'clsx'; import styles from './styles.css.js'; import { Label, LabelTag, Description, Tags, FilteringTags, OptionIcon } from './option-parts'; import { getBaseProps } from '../../base-component'; var Option = function (_a) { var option = _a.option, highlightText = _a.highlightText, _b = _a.triggerVariant, triggerVariant = _b === void 0 ? false : _b, restProps = __rest(_a, ["option", "highlightText", "triggerVariant"]); if (!option) { return null; } var disabled = option.disabled; var baseProps = getBaseProps(restProps); var className = clsx(styles.option, disabled && styles.disabled); var icon = option.__customIcon || (React.createElement(OptionIcon, { name: option.iconName, url: option.iconUrl, alt: option.iconAlt, size: option.description || option.tags ? 'big' : 'normal' })); return (React.createElement("div", __assign({ title: option.label || option.value, "data-value": option.value, className: className, "aria-disabled": disabled }, baseProps), icon, React.createElement("div", { className: clsx(styles.content) }, React.createElement("div", { className: clsx(styles['label-content']) }, React.createElement(Label, { label: option.label || option.value, prefix: option.__labelPrefix, highlightText: highlightText, triggerVariant: triggerVariant }), React.createElement(LabelTag, { labelTag: option.labelTag, highlightText: highlightText, triggerVariant: triggerVariant })), React.createElement(Description, { description: option.description, highlightText: highlightText, triggerVariant: triggerVariant }), React.createElement(Tags, { tags: option.tags, highlightText: highlightText, triggerVariant: triggerVariant }), React.createElement(FilteringTags, { filteringTags: option.filteringTags, highlightText: highlightText, triggerVariant: triggerVariant })))); }; export default Option;