jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
30 lines (27 loc) • 1.55 kB
JavaScript
import { __rest } from '../../../../../node_modules/tslib/tslib.es6.js';
import React__default from 'react';
import { FormItem } from '../11-form-item/index.js';
import { FormLabel } from '../11-form-item/01-form-label/index.js';
import { FormDescription } from '../11-form-item/02-form-description/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 { id, label, description, disabled = false, required = false, error = false } = _a, props = __rest(_a, ["id", "label", "description", "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)),
description && React__default.createElement(FormDescription, null, description)));
};
export default Input;
export { Input };