-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforms.html
275 lines (271 loc) · 13.1 KB
/
forms.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="JP Rodrigues">
<meta name="description" content="O GainTime é um novo framework de HTML, CSS e JS para desenvolvimento de projetos responsivos, focado na simplicidade.">
<link rel="stylesheet" href="gaintime/css/gaintime.min.css" media="screen" title="no title">
<link rel="icon" type="image/png" href="assets/img/ico.png">
<title>GainTime</title>
</head>
<body class="website">
<header class="gt-top-menu sm-left">
<a href=".">
<img src="assets/img/gaintime.png" alt="GainTime" title="GainTime" />
</a>
<label class="menu-toggle">
<svg viewBox="0 0 24 24">
<path fill="#333" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z"></path>
</svg>
</label>
<nav>
<ul>
<li><a href=".">Como começar</a></li>
<li><a href="layouts">Layouts</a></li>
<li><a href="components">Componentes</a></li>
<li class="active"><a href="forms">Formulários</a></li>
<li><a href="helpers">Auxiliares</a></li>
<li><a href="flex">Flex Box</a></li>
<li><a href="grid">Grid System</a></li>
<li><a href="https://gthemes.github.io" target="_blank">Templates</a></li>
</ul>
</nav>
</header>
<section class="text-center" style="color: #FFF; background:#2e7bcf url('assets/img/bg.jpg')">
<h1>Formulários</h1>
<p class="center" style="max-width: 500px;">
Procuramos facilitar algumas coisas na hora de inserir e validar dados. :D
</p>
<span class="tag success">GA</span>
<span class="tag danger">IN</span>
<span class="tag warning">TI</span>
<span class="tag info">ME</span>
</section>
<section>
<h1>GT Form</code></h1>
<p>
O GainTime simplificou a estilização de formulários assumindo que, se o <code>form</code> é da classe <code>.gt-form</code>, todos os seus <code>inputs</code> devem ser estilizados. Aplica <code>max-width: 500px</code>.
</p>
<div class="inform info">
<p>
Experimente adicionar as classes <code>.small</code>, <code>.medium</code>, <code>.large</code> ou <code>.full</code>.
</p>
</div>
<div class="code-block html">
<code>
<span class="el"><</span>form
<span class="attr">class</span><span class="el">=</span><span class="value">"gt-form"</span>
<span class="attr">action</span><span class="el">=</span><span class="value">"myAction"</span>
<span class="attr">method</span><span class="el">=</span><span class="value">"post"</span><span class="el">></span>
<span class="tx">...</span>
<span class="el"></</span>form<span class="el">></span>
</code>
</div>
<form class="gt-form" action="." method="post">
<label for="name_1">Name</label>
<small>Este campo é apenas leitura</small>
<input id="name_1" data-validate="text" type="text" name="name" readonly value="Maria Hipotenusa da Silva">
<label for="lg">.lg</label>
<input class="lg" id="lg" type="text" name="lg" value="Este é um input Largo">
<label for="cpf">CPF</label>
<input id="cpf" type="text" name="cpf" data-validate="cpf" placeholder="000.000.000-00">
<footer class="btn-group">
<button type="reset" name="button" class="btn danger">Cancel</button>
<button type="button" name="button" class="btn success">Submit</button>
</footer>
</form>
</section>
<section>
<h1>GT Form Inline</h1>
<p>
Substituindo <code>.gt-form</code> por <code>.gt-form-inline</code> você vai conseguir formulários com todo o seu conteúdo alinhado à esquerda.
</p>
<div class="inform info">
<p>
É aplicado <code>display: inline-block; width: auto</code> a todos (<code>*</code>) os elementos de <code>.gt-form-inline</code>.
</p>
</div>
<div class="code-block html">
<code>
<span class="el"><</span>form
<span class="attr">class</span><span class="el">=</span><span class="value">"gt-form-inline"</span>
<span class="attr">action</span><span class="el">=</span><span class="value">"myAction"</span>
<span class="attr">method</span><span class="el">=</span><span class="value">"post"</span><span class="el">></span>
<span class="tx">...</span>
<span class="el"></</span>form<span class="el">></span>
</code>
</div>
<form class="gt-form-inline" action="." method="post">
<label for="name_2">Name</label>
<input id="name_2" type="text" name="name" data-validate="text" readonly value="Maria Hipotenusa da Silva">
<label for="cpf">CPF</label>
<input id="cpf" type="text" name="cpf" data-validate="cpf" placeholder="000.000.000-00">
<footer class="btn-group">
<button type="reset" name="button" class="btn danger">Cancel</button>
<button type="button" name="button" class="btn success">Submit</button>
</footer>
</form>
</section>
<section>
<h1>Status</h1>
<p>
Como desabilitamos a estilização <code>outline</code> padrão dos browsers, atribuimos características próprias a alguns status.
</p>
<form class="gt-form full" action="index.html" method="post">
<h2>:focus, <code>.has-focus</code></h2>
<input class="field has-focus full" type="text" name="focus" placeholder="Esta é a visualização de um input:focus">
<h2><code>.has-error</code></h2>
<input class="field has-error full" type="text" name="error" placeholder="Esta é a visualização de um input com erro">
<h2><code>.has-warning</code></h2>
<input class="field has-warning full" type="text" name="warning" placeholder="Esta é a visualização de um input com warning">
<h2>disabled</h2>
<input type="text" name="disabled" value="Este input está desabilitado" disabled>
<h2>readonly</h2>
<input type="text" name="readonly" value="Este input é de apenas leitura" readonly>
</form>
</section>
<section>
<h1>Exemplos</h1>
<div class="inform info" style="max-width: 500px">
<ul>
<li><code>checkbox e radio</code> são alinhados horizontalmente por padrão.</li>
<li><code>textarea</code> é desabilitado o resize horizontal por padrão.</li>
</ul>
</div>
<form class="gt-form" action="index.html" method="post">
<label for="input_a">Input</label>
<input id="input_a" type="text" name="name" value="">
<label for="select_a">Select</label>
<select id="select_a">
<option value="option">Teste</option>
</select>
<label for="selectMultiple">Select Multiple</label>
<select id="selectMultiple" multiple>
<option value="option1">Teste 1</option>
<option value="option2">Teste 2</option>
<option value="option3">Teste 3</option>
<option value="option4">Teste 4</option>
<option value="option5">Teste 5</option>
<option value="option6">Teste 6</option>
</select>
<div class="vertical-list">
<label for="radio">
<input id="radio" type="radio" name="radio" value="">
Radio
</label>
<label for="checkbox">
<input id="checkbox" type="checkbox" name="checkbox" value="">
Checkbox
</label>
</div>
<label for="textarea">Textarea</label>
<textarea id="textarea" name="textarea" rows="4"></textarea>
</form>
</section>
<section>
<h1>Inputs livres</h1>
<p>
Caso você queira aplicar a estilização dada aos inputs do <code>.gt-form</code> a inputs livres, basta adicionar a eles a classe <code>.field</code>.
</p>
<div class="code-block html">
<code>
<span class="el"><</span>input
<span class="attr">class</span><span class="el">=</span><span class="value">"field"</span>
<span class="attr">type</span><span class="el">=</span><span class="value">"text"</span><span class="el">></span>
</code>
</div>
<label for="free">Free Input</label>
<input id="free" class="field" type="text" method="post">
<label for="freeSelect">Free Select</label>
<select class="field" id="freeSelect">
<option value="option">option</option>
</select>
</section>
<section>
<h1>Validações</h1>
<p>
Adicionamos alguns testes de validação ao gaintime. Para ativar, basta adicionar o atributo <code>data-validate</code> ao <code>input</code> com uma das seguintes opções:
</p>
<p>Confira o nosso <a target="_blank" href="http://gaintime.github.io/br-validator">BR-validator</a>. OBS: Se você já vai utilizar o GainTime, não precisa importar o BR-validator, pois ele já faz parte do GainTime.</p>
<div class="inform warning">
<p>
As validações acontecem <code>on blur</code>.
</p>
</div>
<form class="gt-form" action="." method="post">
<h3>CPF</h3>
<p>
Formata e valida CPF.
</p>
<input id="cpf" type="text" name="cpf" data-validate="cpf" placeholder="000.000.000-00" maxlength="14">
<h3>CNPJ</h3>
<p>
Formata e valida CNPJ.
</p>
<input id="cnpj" type="text" name="cnpj" data-validate="cnpj" placeholder="00.000.000/0000-00">
<h3>brPhone</h3>
<label for="brPhone">Formata e valida telefones e celulares brasileiros</label>
<input type="text" data-validate="brPhone" name="brPhone" placeholder="(00) 0000-0000">
<h3>cep</h3>
<label for="cep">Formata CEP brasileiro. Para validar, recomendamos o VIACEP.</label>
<input type="text" data-validate="cep" name="cep" placeholder="44000-000">
<h3>date</h3>
<label for="date">Formata e valida datas (dd/mm/yyyy)</label>
<input type="text" data-validate="date" name="date" placeholder="19/08/1996">
<h3>num</h3>
<p>Aceita apenas algarismos (0-9).</p>
<input id="age" type="text" name="age" data-validate="num" placeholder="0123456789">
<h3>text</h3>
<p>Aceita apenas letras, espaço e apóstrofo. Pensado para campos de 'nome completo' e afins.</p>
<input id="name_3" type="text" name="name" placeholder="José Cateto Oposto" data-validate="text">
</form>
<div class="code-block html">
<code>
<span class="el"><</span>input
<span class="attr">type</span><span class="el">=</span><span class="value">"text"</span>
<span class="attr">data-validate</span><span class="el">=</span><span class="value">"cpf"</span><span class="el">></span>
</code>
</div>
</section>
<footer class="dark flex-box">
<div class="col">
<p>
<strong>GainTime</strong>, por <a href="https://github.com/jprodrigues70">JP Rodrigues</a>
</p>
<p>Código sob a licença <a href="https://opensource.org/licenses/mit-license.php">MIT</a>.</p>
<a href="https://github.com/GainTime/gainTime" class="content-align">
<svg fill="#FFF" aria-hidden="true" class="octicon octicon-mark-github" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg> <p>
GitHub
</p>
</a>
</div>
<div class="col">
<p>
Contribua com o <a href="https://github.com/GainTime/gaintime-factory">GainTime</a>.
</p>
<p>
Faça <a href="https://github.com/GainTime/gaintime-factory/issues">report de erros</a>!
</p>
<p>
Faça <a href="https://github.com/GainTime/gaintime-factory/issues">sugestões</a>!
</p>
</div>
<div class="col">
<p>
Versão v3.0.0
</p>
</div>
</footer>
<script type="text/javascript" src="gaintime/js/gaintime.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-100008959-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>