UNPKG

pagamio-frontend-commons-lib

Version:

Pagamio library for Frontend reusable components like the form engine and table container

7 lines (6 loc) 1.06 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import React from 'react'; import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '../../../../components'; const SelectInput = React.forwardRef(({ field, error, options, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsxs(Select, { onValueChange: props.onChange, value: props.value, disabled: field.disabled, children: [_jsx(SelectTrigger, { className: "w-full border-gray-300 disabled:text-gray-400 disabled:bg-gray-50", children: _jsx(SelectValue, { placeholder: field.label }) }), _jsx(SelectContent, { children: _jsx(SelectGroup, { children: options && options.map((item) => (_jsx(SelectItem, { value: item.value, children: item.label }, item.value))) }) })] }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] }))); export default SelectInput;