UNPKG

@s-ui/react-molecule-select

Version:

`MoleculeSelect` is a customized `select` created from a combination of `AtomInput`, `MoleculeInputTags`, `MoleculeDropdownList` and `MoleculeDropdownOption`

33 lines 1.38 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; var _excluded = ["onClick", "iconArrowDown", "isOpen", "disabled", "children"]; import cx from 'classnames'; import PropTypes from 'prop-types'; import Injector from '@s-ui/react-primitive-injector'; import { CLASS_ARROW, CLASS_ARROW_DOWN, CLASS_ARROW_UP, CLASS_CONTAINER } from './config.js'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; var MoleculeInputSelect = function MoleculeInputSelect(props) { var _cx; var onClick = props.onClick, iconArrow = props.iconArrowDown, isOpen = props.isOpen, disabled = props.disabled, children = props.children, rest = _objectWithoutPropertiesLoose(props, _excluded); var classNames = cx(CLASS_ARROW, (_cx = {}, _cx[CLASS_ARROW_DOWN] = !isOpen, _cx[CLASS_ARROW_UP] = isOpen, _cx)); return /*#__PURE__*/_jsxs("div", { className: CLASS_CONTAINER, onClick: !disabled ? onClick : null, children: [/*#__PURE__*/_jsx(Injector, _extends({ onClick: onClick, disabled: disabled }, rest, { children: children })), /*#__PURE__*/_jsx("span", { className: classNames, children: iconArrow })] }); }; MoleculeInputSelect.displayName = 'MoleculeInputSelect'; export default MoleculeInputSelect;