jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
27 lines (24 loc) • 1.3 kB
JavaScript
import { __rest } from '../../../../../node_modules/tslib/tslib.es6.js';
import React__default from 'react';
import { FormItem, FormLabel } from '../11-form-item/index.js';
import { Input as Input$1 } from './styles.js';
/**
* @file index.tsx
*
* @fileoverview Input component. Renders a button input together with its label.
*/
/**
* A input is a form element where users can type information on. The input can be of several types (the parent component can set that via the "type" property).
* The component inherits props from the "InputHTMLAttributes" so any property for a checkbox can be used with this component.
*/
const Input = (_a) => {
var { label, id, disabled = false, required = false, error = false } = _a, props = __rest(_a, ["label", "id", "disabled", "required", "error"]);
if (!label) {
return React__default.createElement(Input$1, Object.assign({ disabled: disabled, id: id }, props));
}
return (React__default.createElement(FormItem, null,
React__default.createElement(FormLabel, { error: error, required: required, disabled: disabled, htmlFor: id }, label),
React__default.createElement(Input$1, Object.assign({ error: error, disabled: disabled, id: id }, props))));
};
export default Input;
export { Input };