UNPKG

norma-library

Version:

Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.

19 lines 1.16 kB
import React, { useState } from "react"; import Select from "react-select"; import * as S from "./styles"; import Option from "./components/Option"; var SelectInput = function (_a) { var className = _a.className, label = _a.label, onChange = _a.onChange, placeholder = _a.placeholder, disabled = _a.disabled, options = _a.options, value = _a.value, isSearchable = _a.isSearchable, isClearable = _a.isClearable; var _b = useState(value), valueSelected = _b[0], setValueSelected = _b[1]; var components = { Option: Option }; return (React.createElement(S.Container, { className: className }, label ? React.createElement(S.Label, null, label) : null, React.createElement(Select, { placeholder: placeholder, className: "react-select-container", classNamePrefix: "react-select", defaultValue: valueSelected || '', options: options, isDisabled: disabled, isSearchable: isSearchable, isClearable: isClearable, components: components, onChange: function (values) { setValueSelected(values); onChange(values); } }))); }; export default SelectInput; //# sourceMappingURL=index.js.map