# lib-formulario

> Uma Lib React para realizar criação de formulario. &nbsp; Acesse o [link](https://www.npmjs.com/package/lib-formulario) do repositório do package no site oficial NPM. &nbsp; Acesse o [link](https://github.com/guiffsouza/lib-formulario) do repositório do G

Latest version **0.1.5** (published 2023-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install lib-formulario
pnpm add lib-formulario
yarn add lib-formulario
bun add lib-formulario
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2023-05-11 |
| First published | 2023-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 77.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guilherme |
| Maintainers | guiffsouza |

## Links

- npm: https://www.npmjs.com/package/lib-formulario
- npm.io page: https://npm.io/package/lib-formulario

## Dependencies (3)

- [react-input-mask](https://npm.io/package/react-input-mask.md) ^2.0.4
- [styled-components](https://npm.io/package/styled-components.md) ^6.0.0-rc.1
- [@types/react-input-mask](https://npm.io/package/@types/react-input-mask.md) ^3.0.2

## Recent versions

- 0.1.5 (latest) — 2023-05-11
- 0.1.4 — 2023-05-10
- 0.1.3 — 2023-05-10
- 0.1.2 — 2023-05-10
- 0.1.1 — 2023-05-10

## README

# Package lib-formulario

Uma Lib React para realizar criação de formulario.
&nbsp;
Acesse o [link](https://www.npmjs.com/package/lib-formulario) do repositório do package no site oficial NPM.
&nbsp;
Acesse o [link](https://github.com/guiffsouza/lib-formulario) do repositório do Github.

## Como usar

Para instalar o package bastar rodar o comando abaixo.

```
$ npm install lib-formulario
```

### Component Input

O Componente `Input` tem os seguintes tipos `'email'`, `'text'`, `'number'`, `'tel'`, `'password'`, `'date'`, `'datetime'`.
&nbsp;
Abaixo um exemplo de uso do componente.

```
import { Input } from 'lib-formulario';

function App() {
  return (
    <>
      <Input
          id='email'
          type='email'
          placeholder='Seu email'
          required={true}
          erro={true}
          messageErro='erro'
          border='normal'
          />
    </>
  );
}

export default App;
```

O componente `<Input/>` pode receber os seguintes valores:

| Key         | Tipagem                                                          | Valor Opcional ? |
| ----------- | ---------------------------------------------------------------- | ---------------- |
| id          | string                                                           | Não              |
| label       | string                                                           | Sim              |
| placeholder | string                                                           | Sim              |
| name        | string                                                           | Sim              |
| type        | 'email', 'text', 'number', 'tel', 'password', 'date', 'datetime' | Sim              |
| value       | string, number                                                   | Sim              |
| maxlength   | number                                                           | Sim              |
| erro        | boolean                                                          | Sim              |
| messageErro | string                                                           | Sim              |
| border      | 'normal', 'none'                                                 | Não              |
| required    | boolean                                                          | Sim              |
| mask        | boolean                                                          | Sim              |
| valueMask   | 'tel', 'date', 'dateFull'                                        | Sim              |
| onchange    | (e: React.ChangeEvent<HTMLInputElement>) => void                 | Sim              |
| onblur      | (e: React.FocusEvent<HTMLInputElement>) => void                  | Sim              |
| oninvalid   | (e: React.FormEvent<HTMLInputElement>) => void                   | Sim              |

Você pode passar uma Key `mask={true}` e `valueMask={'tel'}` para criar uma máscara `(11) 1 1111 - 1111` no input.

### Component InputList

O Componente `InputList` criar um input com listagem.
&nbsp;
O Componente recebe um array.
&nbsp;
Abaixo um exemplo de como usar o componente.

```
import { InputList } from 'lib-formulario';

function App() {
  return (
    <>
      <InputList
        label='Mes'
        lista={['janeiro', 'fevereiro']}
        name='mes'
        border='normal'
        required={true}/>
    </>
  );
}

export default App;
```

O Componente `<InputList/>` recebe os seguintes valores:

| Key      | Tipagem                                     | Valor Opcional ? |
| -------- | ------------------------------------------- | ---------------- |
| label    | string                                      | Sim              |
| lista    | string[]                                    | Não              |
| name     | string                                      | Não              |
| value    | string                                      | Sim              |
| border   | 'normal', 'none'                            | Sim              |
| required | boolean                                     | Sim              |
| onchange | (e: React.ChangeEvent<HTMLElement>) => void | Sim              |

### O Component Button

O Componente `Button` criar um botão.
&nbsp;
Abaixo um exemplo de como usar o componente.

```
import { Button } from 'lib-formulario';

function App() {
  return (
    <>
      <Button type='submit'>Enviar</Button>
    </>
  );
}

export default App;
```

O Componente `<Button/>` recebe os seguintes valores:

| Key      | Tipagem                                          | Valor Opcional ? |
| -------- | ------------------------------------------------ | ---------------- |
| type     | 'button', 'submit', 'reset'                      | Não              |
| children | ReactNode                                        | Não              |
| color    | string                                           | Sim              |
| onclick  | (e: React.MouseEvent<HTMLButtonElement>) => void | Sim              |

Você pode passar uma key `color={"#fff"}` para mudar a cor do background do botão.

---
_Source: https://npm.io/package/lib-formulario · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
