semantic-forms 1.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -22
- package/package.json +15 -9
- package/semanticForms.css +72 -25
- package/semanticForms.js +34 -33
- package/semanticFormsImages.less +3 -3
- package/semanticFormsNoImages.css +69 -22
- package/semanticFormsNoImages.less +72 -19
- package/CHANGELOG.md +0 -17
- package/semanticForms.html +0 -164
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ If you want to set your own images for the clear fields and dropdown arrows, the
|
|
|
15
15
|
Apply the `semanticForms` class to your `<form>` elements:
|
|
16
16
|
|
|
17
17
|
```html
|
|
18
|
-
<form class=
|
|
18
|
+
<form class="semanticForms">
|
|
19
19
|
<!-- your form here -->
|
|
20
20
|
</form>
|
|
21
21
|
```
|
|
@@ -35,10 +35,10 @@ The float label input pattern is notoriously difficult to implement in a fashion
|
|
|
35
35
|
### Example
|
|
36
36
|
|
|
37
37
|
```html
|
|
38
|
-
<form class=
|
|
38
|
+
<form class="semanticForms">
|
|
39
39
|
<dl>
|
|
40
|
-
<dt><label for=
|
|
41
|
-
<dd><input id=
|
|
40
|
+
<dt><label for="name">Name</label></dt>
|
|
41
|
+
<dd><input id="name" name="name" type="text" placeholder="e.g. John Smith"></dd>
|
|
42
42
|
</dl>
|
|
43
43
|
</form>
|
|
44
44
|
```
|
|
@@ -46,10 +46,10 @@ The float label input pattern is notoriously difficult to implement in a fashion
|
|
|
46
46
|
### Or with a `<textarea>`
|
|
47
47
|
|
|
48
48
|
```html
|
|
49
|
-
<form class=
|
|
49
|
+
<form class="semanticForms">
|
|
50
50
|
<dl>
|
|
51
|
-
<dt><label for=
|
|
52
|
-
<dd><textarea id=
|
|
51
|
+
<dt><label for="textarea">Textarea</label></dt>
|
|
52
|
+
<dd><textarea id="textarea" name="textarea" rows="5" cols="50" placeholder="e.g. Long string of text"></textarea></dd>
|
|
53
53
|
</dl>
|
|
54
54
|
</form>
|
|
55
55
|
```
|
|
@@ -59,15 +59,15 @@ If you would like to manipulate the size of the area on the input field reserved
|
|
|
59
59
|
Adjust the horizontal offset of the clear field's click event click area (the default is 21):
|
|
60
60
|
|
|
61
61
|
```html
|
|
62
|
-
<form class=
|
|
62
|
+
<form class="semanticForms" data-clearfield-horizontal-offset="21">
|
|
63
63
|
<!-- your form here -->
|
|
64
64
|
</form>
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Adjust the vertical offset of the clear field
|
|
67
|
+
Adjust the vertical offset of the clear field"s click event click area (the default is 5):
|
|
68
68
|
|
|
69
69
|
```html
|
|
70
|
-
<form class=
|
|
70
|
+
<form class="semanticForms" data-clearfield-vertical-offset="5">
|
|
71
71
|
<!-- your form here -->
|
|
72
72
|
</form>
|
|
73
73
|
```
|
|
@@ -81,8 +81,8 @@ You can align buttons side-by-side, or in left/right/center groups.
|
|
|
81
81
|
Nothing fancy here:
|
|
82
82
|
|
|
83
83
|
```html
|
|
84
|
-
<
|
|
85
|
-
<
|
|
84
|
+
<button type="submit" name="submit">Non-grouped submit button</button>
|
|
85
|
+
<button type="submit" name="submit">Another one</button>
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
### Button groups
|
|
@@ -91,17 +91,53 @@ Driven by flexbox to intelligently align the buttons based on how many are in th
|
|
|
91
91
|
|
|
92
92
|
```html
|
|
93
93
|
<!-- aligns left/right -->
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
</
|
|
94
|
+
<menu>
|
|
95
|
+
<li><button type="submit" name="submit">Button 1</button></li>
|
|
96
|
+
<button type="submit" name="submit">Button 2</button></li>
|
|
97
|
+
</menu>
|
|
98
98
|
|
|
99
99
|
<!-- aligns left/center/right -->
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
</
|
|
100
|
+
<menu>
|
|
101
|
+
<li><button type="submit" name="submit">Button 1</button></li>
|
|
102
|
+
<li><button type="submit" name="submit">Button 2</button></li>
|
|
103
|
+
<li><button type="submit" name="submit">Button 3</button></li>
|
|
104
|
+
</menu>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Checkboxes and radio buttons
|
|
108
|
+
|
|
109
|
+
Checkboxes and radio buttons need to follow the following markup structure:
|
|
110
|
+
### Checkboxes
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<form class="semanticForms">
|
|
114
|
+
<dl>
|
|
115
|
+
<dt><label data-for="some_field_name">Checkboxes:</label></dt>
|
|
116
|
+
<dd class="checkboxes">
|
|
117
|
+
<ul id="some_field_name">
|
|
118
|
+
<li><input type="checkbox" name="some_field_name" id="c_one"> <label for="c_one">One</label></li>
|
|
119
|
+
<li><input type="checkbox" name="some_field_name" id="c_two"> <label for="c_two">Two</label></li>
|
|
120
|
+
<li><input type="checkbox" name="some_field_name" id="c_three"> <label for="c_three">Three</label></li>
|
|
121
|
+
</ul>
|
|
122
|
+
</dd>
|
|
123
|
+
</dl>
|
|
124
|
+
</form>
|
|
125
|
+
```
|
|
126
|
+
### Radio buttons
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<form class="semanticForms">
|
|
130
|
+
<dl>
|
|
131
|
+
<dt><label data-for="some_field_name">Radios:</label></dt>
|
|
132
|
+
<dd class="radios">
|
|
133
|
+
<ul id="some_field_name">
|
|
134
|
+
<li><input type="radio" name="some_field_name" id="r_one"> <label for="r_one">One</label></li>
|
|
135
|
+
<li><input type="radio" name="some_field_name" id="r_two"> <label for="r_two">Two</label></li>
|
|
136
|
+
<li><input type="radio" name="some_field_name" id="r_three"> <label for="r_three">Three</label></li>
|
|
137
|
+
</ul>
|
|
138
|
+
</dd>
|
|
139
|
+
</dl>
|
|
140
|
+
</form>
|
|
105
141
|
```
|
|
106
142
|
|
|
107
143
|
## Other features
|
|
@@ -119,5 +155,5 @@ See `semanticForms.html` or the [live demo](https://kethinov.github.io/semanticf
|
|
|
119
155
|
- `npm i`
|
|
120
156
|
- Make your changes. If you want to alter the CSS, do the changes in `semanticForms.less`.
|
|
121
157
|
- `npm run build`. The build step compiles the LESS file into CSS.
|
|
158
|
+
- Test your changes by opening `semanticForms.html` in your browser.
|
|
122
159
|
- Commit, push, open pull request.
|
|
123
|
-
|
package/package.json
CHANGED
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
"name": "semantic-forms",
|
|
3
3
|
"description": "Semantic Forms",
|
|
4
4
|
"author": "Eric Newport <kethinov@gmail.com>",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "2.1.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"semanticForms.css",
|
|
8
|
+
"semanticForms.js",
|
|
9
|
+
"semanticFormsImages.less",
|
|
10
|
+
"semanticFormsNoImages.css",
|
|
11
|
+
"semanticFormsNoImages.less"
|
|
12
|
+
],
|
|
6
13
|
"homepage": "https://github.com/kethinov/semanticforms",
|
|
7
14
|
"license": "CC-BY-4.0",
|
|
8
15
|
"main": "semanticforms.js",
|
|
9
16
|
"readmeFilename": "README.md",
|
|
10
17
|
"dependencies": {},
|
|
11
18
|
"devDependencies": {
|
|
12
|
-
"less": "
|
|
13
|
-
"standard": "
|
|
14
|
-
"lint-staged": "~8.2.1",
|
|
15
|
-
"husky": "~2.4.1"
|
|
19
|
+
"less": "4.1.3",
|
|
20
|
+
"standard": "17.0.0"
|
|
16
21
|
},
|
|
17
22
|
"scripts": {
|
|
18
23
|
"test": "echo \"TODO: tests\"",
|
|
19
24
|
"coverage": "echo \"TODO: test coverage\"",
|
|
20
25
|
"build": "lessc semanticFormsImages.less semanticForms.css && lessc semanticFormsNoImages.less semanticFormsNoImages.css"
|
|
21
26
|
},
|
|
22
|
-
"lint-staged": {
|
|
23
|
-
"*.js": "standard"
|
|
24
|
-
},
|
|
25
27
|
"repository": {
|
|
26
28
|
"type": "git",
|
|
27
29
|
"url": "git://github.com/kethinov/semanticforms.git"
|
|
@@ -31,5 +33,9 @@
|
|
|
31
33
|
"forms",
|
|
32
34
|
"float",
|
|
33
35
|
"label"
|
|
34
|
-
]
|
|
36
|
+
],
|
|
37
|
+
"funding": {
|
|
38
|
+
"type": "individual",
|
|
39
|
+
"url": "https://github.com/sponsors/kethinov"
|
|
40
|
+
}
|
|
35
41
|
}
|
package/semanticForms.css
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
.semanticForms {
|
|
2
2
|
font-family: sans-serif;
|
|
3
|
+
/*
|
|
4
|
+
TODO: still needed?
|
|
5
|
+
input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]) {
|
|
6
|
+
width: 270px;
|
|
7
|
+
padding-right: 0;
|
|
8
|
+
}
|
|
9
|
+
*/
|
|
3
10
|
}
|
|
4
|
-
.semanticForms input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
11
|
+
.semanticForms input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]):not([type=color]),
|
|
5
12
|
.semanticForms select,
|
|
6
13
|
.semanticForms textarea {
|
|
14
|
+
box-sizing: content-box;
|
|
7
15
|
background-color: #fff;
|
|
8
16
|
outline: 0;
|
|
9
17
|
border: 1px #c0c0c0 solid;
|
|
@@ -14,6 +22,20 @@
|
|
|
14
22
|
font-family: sans-serif;
|
|
15
23
|
padding: 5px 20px;
|
|
16
24
|
}
|
|
25
|
+
.semanticForms input[type=color] {
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
border: 0;
|
|
28
|
+
width: 292px;
|
|
29
|
+
height: 37px;
|
|
30
|
+
padding: 5px 20px;
|
|
31
|
+
}
|
|
32
|
+
.semanticForms select {
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
.semanticForms input[type=range] {
|
|
36
|
+
border: 0 !important;
|
|
37
|
+
width: 248px !important;
|
|
38
|
+
}
|
|
17
39
|
.semanticForms fieldset {
|
|
18
40
|
text-align: center;
|
|
19
41
|
margin-bottom: 25px;
|
|
@@ -29,14 +51,16 @@
|
|
|
29
51
|
.semanticForms dl {
|
|
30
52
|
text-align: left;
|
|
31
53
|
}
|
|
32
|
-
.semanticForms .checkboxes ul
|
|
54
|
+
.semanticForms .checkboxes ul,
|
|
55
|
+
.semanticForms .radios ul {
|
|
33
56
|
list-style: none;
|
|
34
57
|
padding: 0;
|
|
35
58
|
}
|
|
36
|
-
.semanticForms dd.checkboxes
|
|
59
|
+
.semanticForms dd.checkboxes,
|
|
60
|
+
.semanticForms dd.radios {
|
|
37
61
|
margin: 0;
|
|
38
62
|
}
|
|
39
|
-
.semanticForms input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
63
|
+
.semanticForms input:not([type='submit']):not([type='reset']):not([type=checkbox]):not([type=radio]),
|
|
40
64
|
.semanticForms textarea {
|
|
41
65
|
background-image: none;
|
|
42
66
|
background-size: 12px;
|
|
@@ -46,10 +70,6 @@
|
|
|
46
70
|
.semanticForms input:not([type=checkbox]):not([type=radio]) {
|
|
47
71
|
background-position: right -12px center;
|
|
48
72
|
}
|
|
49
|
-
.semanticForms input[type=date]:not([type='submit']):not([type=checkbox]):not([type=radio]) {
|
|
50
|
-
width: 270px;
|
|
51
|
-
padding-right: 0;
|
|
52
|
-
}
|
|
53
73
|
.semanticForms textarea {
|
|
54
74
|
background-position: right -12px top 10px;
|
|
55
75
|
height: 100px;
|
|
@@ -84,7 +104,10 @@
|
|
|
84
104
|
.semanticForms textarea:focus:-ms-input-placeholder {
|
|
85
105
|
color: #aaa;
|
|
86
106
|
}
|
|
87
|
-
.semanticForms input[type='submit']
|
|
107
|
+
.semanticForms input[type='submit'],
|
|
108
|
+
.semanticForms input[type='reset'],
|
|
109
|
+
.semanticForms input[type='image'],
|
|
110
|
+
.semanticForms button {
|
|
88
111
|
width: auto;
|
|
89
112
|
box-sizing: content-box;
|
|
90
113
|
float: none;
|
|
@@ -105,7 +128,16 @@
|
|
|
105
128
|
background-image: -ms-linear-gradient(bottom, #fff 0%, #c0c0c0 100%);
|
|
106
129
|
background-image: linear-gradient(to bottom, #fff 0%, #c0c0c0 100%);
|
|
107
130
|
}
|
|
108
|
-
.semanticForms input[type='submit']:
|
|
131
|
+
.semanticForms input[type='submit']:first-of-type,
|
|
132
|
+
.semanticForms input[type='reset']:first-of-type,
|
|
133
|
+
.semanticForms input[type='image']:first-of-type,
|
|
134
|
+
.semanticForms button:first-of-type {
|
|
135
|
+
margin-left: 0;
|
|
136
|
+
}
|
|
137
|
+
.semanticForms input[type='submit']:active,
|
|
138
|
+
.semanticForms input[type='reset']:active,
|
|
139
|
+
.semanticForms input[type='image']:active,
|
|
140
|
+
.semanticForms button:active {
|
|
109
141
|
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(#fff, 0), color-stop(#c0c0c0, 1));
|
|
110
142
|
background-image: -o-linear-gradient(bottom, #c0c0c0 0%, #fff 100%);
|
|
111
143
|
background-image: -moz-linear-gradient(bottom, #c0c0c0 0%, #fff 100%);
|
|
@@ -146,12 +178,12 @@
|
|
|
146
178
|
}
|
|
147
179
|
.semanticForms .floatLabelForm dd {
|
|
148
180
|
float: left;
|
|
149
|
-
margin: 0
|
|
181
|
+
margin: 0 10px 0 10px;
|
|
150
182
|
}
|
|
151
183
|
.semanticForms .floatLabelForm dd:nth-child(4n+2) {
|
|
152
184
|
clear: both;
|
|
153
185
|
}
|
|
154
|
-
.semanticForms .floatLabelForm dt:not(.checkboxes) {
|
|
186
|
+
.semanticForms .floatLabelForm dt:not(.checkboxes):not(.radios) {
|
|
155
187
|
font-size: 1px;
|
|
156
188
|
text-indent: 100%;
|
|
157
189
|
white-space: nowrap;
|
|
@@ -159,17 +191,19 @@
|
|
|
159
191
|
position: absolute;
|
|
160
192
|
right: 9999px;
|
|
161
193
|
}
|
|
162
|
-
.semanticForms .floatLabelForm dd:not(.checkboxes) {
|
|
194
|
+
.semanticForms .floatLabelForm dd:not(.checkboxes):not(.radios) {
|
|
163
195
|
display: flex;
|
|
164
196
|
flex-flow: column-reverse;
|
|
165
197
|
}
|
|
166
|
-
.semanticForms .floatLabelForm .checkboxes ul
|
|
167
|
-
|
|
168
|
-
|
|
198
|
+
.semanticForms .floatLabelForm .checkboxes ul,
|
|
199
|
+
.semanticForms .floatLabelForm .radios ul {
|
|
200
|
+
margin: 3px 20px 0 0;
|
|
201
|
+
width: 267px;
|
|
202
|
+
padding-left: 10px;
|
|
169
203
|
}
|
|
170
204
|
.semanticForms .floatLabelForm label.floatLabelFormAnimatedLabel {
|
|
171
205
|
width: 170px;
|
|
172
|
-
padding:
|
|
206
|
+
padding: 6px 15px;
|
|
173
207
|
font-size: 75%;
|
|
174
208
|
color: #aaa;
|
|
175
209
|
cursor: text;
|
|
@@ -224,7 +258,8 @@
|
|
|
224
258
|
.semanticForms .floatLabelForm textarea:not(:placeholder-shown) + label,
|
|
225
259
|
.semanticForms .floatLabelForm textarea:focus + label,
|
|
226
260
|
.semanticForms .floatLabelForm select + label.floatLabelFormAnimatedLabel,
|
|
227
|
-
.semanticForms .floatLabelForm .checkboxes label.floatLabelFormAnimatedLabel
|
|
261
|
+
.semanticForms .floatLabelForm .checkboxes label.floatLabelFormAnimatedLabel,
|
|
262
|
+
.semanticForms .floatLabelForm .radios label.floatLabelFormAnimatedLabel {
|
|
228
263
|
transform: translate(0, 0) scale(1);
|
|
229
264
|
text-indent: 6px;
|
|
230
265
|
cursor: default;
|
|
@@ -263,13 +298,20 @@
|
|
|
263
298
|
height: 0;
|
|
264
299
|
clear: both;
|
|
265
300
|
}
|
|
266
|
-
.semanticForms
|
|
301
|
+
.semanticForms menu {
|
|
267
302
|
width: 100%;
|
|
268
303
|
clear: both;
|
|
269
304
|
display: flex;
|
|
270
305
|
justify-content: space-between;
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
.semanticForms menu li {
|
|
309
|
+
list-style-type: none;
|
|
271
310
|
}
|
|
272
|
-
.semanticForms
|
|
311
|
+
.semanticForms menu input[type='submit'],
|
|
312
|
+
.semanticForms menu input[type='reset'],
|
|
313
|
+
.semanticForms menu input[type='image'],
|
|
314
|
+
.semanticForms menu button {
|
|
273
315
|
float: none;
|
|
274
316
|
clear: none;
|
|
275
317
|
margin: 0 0 25px 0;
|
|
@@ -283,10 +325,15 @@
|
|
|
283
325
|
.semanticForms fieldset {
|
|
284
326
|
text-align: left;
|
|
285
327
|
}
|
|
286
|
-
.semanticForms fieldset input[type='submit']
|
|
328
|
+
.semanticForms fieldset input[type='submit'],
|
|
329
|
+
.semanticForms fieldset input[type='reset'],
|
|
330
|
+
.semanticForms fieldset input[type='image'],
|
|
331
|
+
.semanticForms fieldset button {
|
|
287
332
|
float: left;
|
|
288
333
|
clear: none;
|
|
289
|
-
|
|
334
|
+
}
|
|
335
|
+
.semanticForms fieldset :last-child {
|
|
336
|
+
margin-right: 0;
|
|
290
337
|
}
|
|
291
338
|
}
|
|
292
339
|
.semanticForms.lowFlow dl {
|
|
@@ -298,10 +345,10 @@
|
|
|
298
345
|
.semanticForms.lowFlow dd:last-child {
|
|
299
346
|
margin: 0;
|
|
300
347
|
}
|
|
301
|
-
.semanticForms input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
348
|
+
.semanticForms input:not([type='submit']):not([type='reset']):not([type=checkbox]):not([type=radio]),
|
|
302
349
|
.semanticForms textarea {
|
|
303
|
-
background-image: url("data:image/svg+xml;utf8
|
|
350
|
+
background-image: url("data:image/svg+xml;utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 1000 1000' enable-background='new 0 0 1000 1000' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23000' d='M964.7,157.6L622.3,500l342.4,342.4l0,0c15.7,15.7,25.3,37.3,25.3,61.1c0,47.7-38.7,86.5-86.5,86.5c-23.9,0-45.5-9.7-61.1-25.3l0,0L500,622.3L157.6,964.7l0,0C142,980.3,120.3,990,96.5,990C48.7,990,10,951.3,10,903.5c0-23.9,9.7-45.5,25.3-61.1l0,0L377.7,500L35.3,157.6l0,0C19.7,142,10,120.3,10,96.5C10,48.7,48.7,10,96.5,10c23.9,0,45.5,9.7,61.1,25.3l0,0L500,377.7L842.4,35.3l0,0C858,19.7,879.7,10,903.5,10c47.8,0,86.5,38.7,86.5,86.5C990,120.3,980.3,142,964.7,157.6L964.7,157.6z'/%3E%3C/g%3E%3C/svg%3E");
|
|
304
351
|
}
|
|
305
352
|
.semanticForms select {
|
|
306
|
-
background-image: url("data:image/svg+xml;utf8
|
|
353
|
+
background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23000'%3E%3Cpolygon points='0,0 100,0 50,50'/%3E%3C/svg%3E");
|
|
307
354
|
}
|
package/semanticForms.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(function (
|
|
1
|
+
(function () {
|
|
2
2
|
// do some feature detection so none of the JS executes if the browser is too old
|
|
3
3
|
if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList) {
|
|
4
4
|
return
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const forms = document.querySelectorAll('form.semanticForms')
|
|
8
|
+
const fl = forms.length
|
|
9
|
+
let f
|
|
10
|
+
let form
|
|
11
|
+
let inputs
|
|
12
|
+
let input
|
|
13
|
+
let nodeName
|
|
14
|
+
let type
|
|
15
|
+
let label
|
|
16
|
+
let labelHTML
|
|
17
|
+
let newLabel
|
|
18
|
+
let dl
|
|
19
|
+
let l
|
|
20
|
+
let clearfieldHorizontalOffset
|
|
21
|
+
let clearfieldVerticalOffset
|
|
22
|
+
let i
|
|
23
23
|
|
|
24
24
|
// don't execute any of the JS if no forms class semanticForms exist
|
|
25
25
|
if (fl <= 0) {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
if (input && input.id) {
|
|
40
40
|
nodeName = input.nodeName
|
|
41
41
|
type = input.getAttribute('type')
|
|
42
|
-
if (nodeName === 'TEXTAREA' || nodeName === 'SELECT' || type === '
|
|
42
|
+
if (nodeName === 'TEXTAREA' || nodeName === 'SELECT' || type === 'checkbox' || type === 'color' || type === 'date' || type === 'datetime-local' || type === 'email' || type === 'file' || type === 'image' || type === 'month' || type === 'number' || type === 'password' || type === 'radio' || type === 'range' || type === 'search' || type === 'tel' || type === 'text' || type === 'time' || type === 'url' || type === 'week') {
|
|
43
43
|
dl = input.parentNode
|
|
44
44
|
while (dl && dl.nodeName !== 'DL') {
|
|
45
45
|
dl = dl.parentNode
|
|
@@ -74,11 +74,12 @@
|
|
|
74
74
|
label.setAttribute('hidden', 'hidden')
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (nodeName !== 'SELECT' && type !== 'checkbox' && type !== 'radio'
|
|
77
|
+
if (nodeName !== 'SELECT' && type !== 'checkbox' && type !== 'radio') {
|
|
78
78
|
// if it doesn't have a placeholder, add a blank one
|
|
79
79
|
if (!input.getAttribute('placeholder')) {
|
|
80
80
|
input.setAttribute('placeholder', '')
|
|
81
81
|
}
|
|
82
|
+
input.classList.add('semanticform')
|
|
82
83
|
inputHandler(input) // force x to appear on inputs with prefilled value
|
|
83
84
|
}
|
|
84
85
|
}
|
|
@@ -92,10 +93,10 @@
|
|
|
92
93
|
|
|
93
94
|
document.addEventListener('mousemove', function (e) {
|
|
94
95
|
if (isPatternElement(e)) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (nodeName === 'TEXTAREA' || type === '
|
|
96
|
+
const el = e.target
|
|
97
|
+
const nodeName = el.nodeName
|
|
98
|
+
const type = el.getAttribute('type')
|
|
99
|
+
if (nodeName === 'TEXTAREA' || type === 'checkbox' || type === 'color' || type === 'date' || type === 'datetime-local' || type === 'email' || type === 'file' || type === 'month' || type === 'number' || type === 'password' || type === 'radio' || type === 'range' || type === 'search' || type === 'tel' || type === 'text' || type === 'time' || type === 'url' || type === 'week') {
|
|
99
100
|
inputHandler(e)
|
|
100
101
|
if (el.offsetWidth - clearfieldHorizontalOffset < e.clientX - el.getBoundingClientRect().left && clearfieldHorizontalOffset + clearfieldVerticalOffset > e.clientY - el.getBoundingClientRect().top
|
|
101
102
|
) {
|
|
@@ -111,10 +112,10 @@
|
|
|
111
112
|
|
|
112
113
|
document.addEventListener('click', function (e) {
|
|
113
114
|
if (isPatternElement(e)) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (nodeName === 'TEXTAREA' || type === '
|
|
115
|
+
const el = e.target
|
|
116
|
+
const nodeName = el.nodeName
|
|
117
|
+
const type = el.getAttribute('type')
|
|
118
|
+
if (nodeName === 'TEXTAREA' || type === 'checkbox' || type === 'color' || type === 'date' || type === 'datetime-local' || type === 'email' || type === 'file' || type === 'month' || type === 'number' || type === 'password' || type === 'radio' || type === 'range' || type === 'search' || type === 'tel' || type === 'text' || type === 'time' || type === 'url' || type === 'week') {
|
|
118
119
|
if (el.offsetWidth - clearfieldHorizontalOffset < e.clientX - el.getBoundingClientRect().left &&
|
|
119
120
|
clearfieldHorizontalOffset + clearfieldVerticalOffset > e.clientY - el.getBoundingClientRect().top
|
|
120
121
|
) {
|
|
@@ -128,10 +129,10 @@
|
|
|
128
129
|
|
|
129
130
|
function inputHandler (e) {
|
|
130
131
|
if (isPatternElement(e)) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if ((nodeName && type) && (nodeName === 'TEXTAREA' || type === '
|
|
132
|
+
const el = e.target || e
|
|
133
|
+
const nodeName = el.nodeName
|
|
134
|
+
const type = el.getAttribute('type') || nodeName === 'TEXTAREA'
|
|
135
|
+
if ((nodeName && type) && (nodeName === 'TEXTAREA' || type === 'checkbox' || type === 'color' || type === 'date' || type === 'datetime-local' || type === 'email' || type === 'file' || type === 'month' || type === 'number' || type === 'password' || type === 'radio' || type === 'range' || type === 'search' || type === 'tel' || type === 'text' || type === 'time' || type === 'url' || type === 'week')) {
|
|
135
136
|
if (el.value) {
|
|
136
137
|
if (!el.classList.contains('x')) {
|
|
137
138
|
el.classList.add('x')
|
|
@@ -152,8 +153,8 @@
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
function isPatternElement (e) {
|
|
155
|
-
|
|
156
|
-
if (!thisEl.classList.contains('
|
|
156
|
+
const thisEl = e.target || e
|
|
157
|
+
if (!thisEl.classList.contains('semanticform')) {
|
|
157
158
|
return false
|
|
158
159
|
}
|
|
159
160
|
return true
|
package/semanticFormsImages.less
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
.semanticForms {
|
|
4
4
|
|
|
5
5
|
// clear fields
|
|
6
|
-
input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
6
|
+
input:not([type='submit']):not([type='reset']):not([type=checkbox]):not([type=radio]),
|
|
7
7
|
textarea {
|
|
8
|
-
background-image: url("data:image/svg+xml;utf8
|
|
8
|
+
background-image: url("data:image/svg+xml;utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 1000 1000' enable-background='new 0 0 1000 1000' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23000' d='M964.7,157.6L622.3,500l342.4,342.4l0,0c15.7,15.7,25.3,37.3,25.3,61.1c0,47.7-38.7,86.5-86.5,86.5c-23.9,0-45.5-9.7-61.1-25.3l0,0L500,622.3L157.6,964.7l0,0C142,980.3,120.3,990,96.5,990C48.7,990,10,951.3,10,903.5c0-23.9,9.7-45.5,25.3-61.1l0,0L377.7,500L35.3,157.6l0,0C19.7,142,10,120.3,10,96.5C10,48.7,48.7,10,96.5,10c23.9,0,45.5,9.7,61.1,25.3l0,0L500,377.7L842.4,35.3l0,0C858,19.7,879.7,10,903.5,10c47.8,0,86.5,38.7,86.5,86.5C990,120.3,980.3,142,964.7,157.6L964.7,157.6z'/%3E%3C/g%3E%3C/svg%3E");
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// custom select box design
|
|
12
12
|
select {
|
|
13
|
-
background-image: url("data:image/svg+xml;utf8
|
|
13
|
+
background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23000'%3E%3Cpolygon points='0,0 100,0 50,50'/%3E%3C/svg%3E");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
.semanticForms {
|
|
2
2
|
font-family: sans-serif;
|
|
3
|
+
/*
|
|
4
|
+
TODO: still needed?
|
|
5
|
+
input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]) {
|
|
6
|
+
width: 270px;
|
|
7
|
+
padding-right: 0;
|
|
8
|
+
}
|
|
9
|
+
*/
|
|
3
10
|
}
|
|
4
|
-
.semanticForms input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
11
|
+
.semanticForms input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]):not([type=color]),
|
|
5
12
|
.semanticForms select,
|
|
6
13
|
.semanticForms textarea {
|
|
14
|
+
box-sizing: content-box;
|
|
7
15
|
background-color: #fff;
|
|
8
16
|
outline: 0;
|
|
9
17
|
border: 1px #c0c0c0 solid;
|
|
@@ -14,6 +22,20 @@
|
|
|
14
22
|
font-family: sans-serif;
|
|
15
23
|
padding: 5px 20px;
|
|
16
24
|
}
|
|
25
|
+
.semanticForms input[type=color] {
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
border: 0;
|
|
28
|
+
width: 292px;
|
|
29
|
+
height: 37px;
|
|
30
|
+
padding: 5px 20px;
|
|
31
|
+
}
|
|
32
|
+
.semanticForms select {
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
.semanticForms input[type=range] {
|
|
36
|
+
border: 0 !important;
|
|
37
|
+
width: 248px !important;
|
|
38
|
+
}
|
|
17
39
|
.semanticForms fieldset {
|
|
18
40
|
text-align: center;
|
|
19
41
|
margin-bottom: 25px;
|
|
@@ -29,14 +51,16 @@
|
|
|
29
51
|
.semanticForms dl {
|
|
30
52
|
text-align: left;
|
|
31
53
|
}
|
|
32
|
-
.semanticForms .checkboxes ul
|
|
54
|
+
.semanticForms .checkboxes ul,
|
|
55
|
+
.semanticForms .radios ul {
|
|
33
56
|
list-style: none;
|
|
34
57
|
padding: 0;
|
|
35
58
|
}
|
|
36
|
-
.semanticForms dd.checkboxes
|
|
59
|
+
.semanticForms dd.checkboxes,
|
|
60
|
+
.semanticForms dd.radios {
|
|
37
61
|
margin: 0;
|
|
38
62
|
}
|
|
39
|
-
.semanticForms input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
63
|
+
.semanticForms input:not([type='submit']):not([type='reset']):not([type=checkbox]):not([type=radio]),
|
|
40
64
|
.semanticForms textarea {
|
|
41
65
|
background-image: none;
|
|
42
66
|
background-size: 12px;
|
|
@@ -46,10 +70,6 @@
|
|
|
46
70
|
.semanticForms input:not([type=checkbox]):not([type=radio]) {
|
|
47
71
|
background-position: right -12px center;
|
|
48
72
|
}
|
|
49
|
-
.semanticForms input[type=date]:not([type='submit']):not([type=checkbox]):not([type=radio]) {
|
|
50
|
-
width: 270px;
|
|
51
|
-
padding-right: 0;
|
|
52
|
-
}
|
|
53
73
|
.semanticForms textarea {
|
|
54
74
|
background-position: right -12px top 10px;
|
|
55
75
|
height: 100px;
|
|
@@ -84,7 +104,10 @@
|
|
|
84
104
|
.semanticForms textarea:focus:-ms-input-placeholder {
|
|
85
105
|
color: #aaa;
|
|
86
106
|
}
|
|
87
|
-
.semanticForms input[type='submit']
|
|
107
|
+
.semanticForms input[type='submit'],
|
|
108
|
+
.semanticForms input[type='reset'],
|
|
109
|
+
.semanticForms input[type='image'],
|
|
110
|
+
.semanticForms button {
|
|
88
111
|
width: auto;
|
|
89
112
|
box-sizing: content-box;
|
|
90
113
|
float: none;
|
|
@@ -105,7 +128,16 @@
|
|
|
105
128
|
background-image: -ms-linear-gradient(bottom, #fff 0%, #c0c0c0 100%);
|
|
106
129
|
background-image: linear-gradient(to bottom, #fff 0%, #c0c0c0 100%);
|
|
107
130
|
}
|
|
108
|
-
.semanticForms input[type='submit']:
|
|
131
|
+
.semanticForms input[type='submit']:first-of-type,
|
|
132
|
+
.semanticForms input[type='reset']:first-of-type,
|
|
133
|
+
.semanticForms input[type='image']:first-of-type,
|
|
134
|
+
.semanticForms button:first-of-type {
|
|
135
|
+
margin-left: 0;
|
|
136
|
+
}
|
|
137
|
+
.semanticForms input[type='submit']:active,
|
|
138
|
+
.semanticForms input[type='reset']:active,
|
|
139
|
+
.semanticForms input[type='image']:active,
|
|
140
|
+
.semanticForms button:active {
|
|
109
141
|
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(#fff, 0), color-stop(#c0c0c0, 1));
|
|
110
142
|
background-image: -o-linear-gradient(bottom, #c0c0c0 0%, #fff 100%);
|
|
111
143
|
background-image: -moz-linear-gradient(bottom, #c0c0c0 0%, #fff 100%);
|
|
@@ -146,12 +178,12 @@
|
|
|
146
178
|
}
|
|
147
179
|
.semanticForms .floatLabelForm dd {
|
|
148
180
|
float: left;
|
|
149
|
-
margin: 0
|
|
181
|
+
margin: 0 10px 0 10px;
|
|
150
182
|
}
|
|
151
183
|
.semanticForms .floatLabelForm dd:nth-child(4n+2) {
|
|
152
184
|
clear: both;
|
|
153
185
|
}
|
|
154
|
-
.semanticForms .floatLabelForm dt:not(.checkboxes) {
|
|
186
|
+
.semanticForms .floatLabelForm dt:not(.checkboxes):not(.radios) {
|
|
155
187
|
font-size: 1px;
|
|
156
188
|
text-indent: 100%;
|
|
157
189
|
white-space: nowrap;
|
|
@@ -159,17 +191,19 @@
|
|
|
159
191
|
position: absolute;
|
|
160
192
|
right: 9999px;
|
|
161
193
|
}
|
|
162
|
-
.semanticForms .floatLabelForm dd:not(.checkboxes) {
|
|
194
|
+
.semanticForms .floatLabelForm dd:not(.checkboxes):not(.radios) {
|
|
163
195
|
display: flex;
|
|
164
196
|
flex-flow: column-reverse;
|
|
165
197
|
}
|
|
166
|
-
.semanticForms .floatLabelForm .checkboxes ul
|
|
167
|
-
|
|
168
|
-
|
|
198
|
+
.semanticForms .floatLabelForm .checkboxes ul,
|
|
199
|
+
.semanticForms .floatLabelForm .radios ul {
|
|
200
|
+
margin: 3px 20px 0 0;
|
|
201
|
+
width: 267px;
|
|
202
|
+
padding-left: 10px;
|
|
169
203
|
}
|
|
170
204
|
.semanticForms .floatLabelForm label.floatLabelFormAnimatedLabel {
|
|
171
205
|
width: 170px;
|
|
172
|
-
padding:
|
|
206
|
+
padding: 6px 15px;
|
|
173
207
|
font-size: 75%;
|
|
174
208
|
color: #aaa;
|
|
175
209
|
cursor: text;
|
|
@@ -224,7 +258,8 @@
|
|
|
224
258
|
.semanticForms .floatLabelForm textarea:not(:placeholder-shown) + label,
|
|
225
259
|
.semanticForms .floatLabelForm textarea:focus + label,
|
|
226
260
|
.semanticForms .floatLabelForm select + label.floatLabelFormAnimatedLabel,
|
|
227
|
-
.semanticForms .floatLabelForm .checkboxes label.floatLabelFormAnimatedLabel
|
|
261
|
+
.semanticForms .floatLabelForm .checkboxes label.floatLabelFormAnimatedLabel,
|
|
262
|
+
.semanticForms .floatLabelForm .radios label.floatLabelFormAnimatedLabel {
|
|
228
263
|
transform: translate(0, 0) scale(1);
|
|
229
264
|
text-indent: 6px;
|
|
230
265
|
cursor: default;
|
|
@@ -263,13 +298,20 @@
|
|
|
263
298
|
height: 0;
|
|
264
299
|
clear: both;
|
|
265
300
|
}
|
|
266
|
-
.semanticForms
|
|
301
|
+
.semanticForms menu {
|
|
267
302
|
width: 100%;
|
|
268
303
|
clear: both;
|
|
269
304
|
display: flex;
|
|
270
305
|
justify-content: space-between;
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
.semanticForms menu li {
|
|
309
|
+
list-style-type: none;
|
|
271
310
|
}
|
|
272
|
-
.semanticForms
|
|
311
|
+
.semanticForms menu input[type='submit'],
|
|
312
|
+
.semanticForms menu input[type='reset'],
|
|
313
|
+
.semanticForms menu input[type='image'],
|
|
314
|
+
.semanticForms menu button {
|
|
273
315
|
float: none;
|
|
274
316
|
clear: none;
|
|
275
317
|
margin: 0 0 25px 0;
|
|
@@ -283,10 +325,15 @@
|
|
|
283
325
|
.semanticForms fieldset {
|
|
284
326
|
text-align: left;
|
|
285
327
|
}
|
|
286
|
-
.semanticForms fieldset input[type='submit']
|
|
328
|
+
.semanticForms fieldset input[type='submit'],
|
|
329
|
+
.semanticForms fieldset input[type='reset'],
|
|
330
|
+
.semanticForms fieldset input[type='image'],
|
|
331
|
+
.semanticForms fieldset button {
|
|
287
332
|
float: left;
|
|
288
333
|
clear: none;
|
|
289
|
-
|
|
334
|
+
}
|
|
335
|
+
.semanticForms fieldset :last-child {
|
|
336
|
+
margin-right: 0;
|
|
290
337
|
}
|
|
291
338
|
}
|
|
292
339
|
.semanticForms.lowFlow dl {
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
// globals
|
|
8
8
|
font-family: sans-serif;
|
|
9
9
|
|
|
10
|
-
input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
10
|
+
input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]):not([type=color]),
|
|
11
11
|
select,
|
|
12
12
|
textarea {
|
|
13
|
+
box-sizing: content-box;
|
|
13
14
|
background-color: @formBackgroundColor;
|
|
14
15
|
outline: 0;
|
|
15
16
|
border: 1px @borderColor solid;
|
|
@@ -21,6 +22,23 @@
|
|
|
21
22
|
padding: 5px 20px;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
input[type=color] {
|
|
26
|
+
background-color: @formBackgroundColor;
|
|
27
|
+
border: 0;
|
|
28
|
+
width: 292px;
|
|
29
|
+
height: 37px;
|
|
30
|
+
padding: 5px 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
select {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
input[type=range] {
|
|
38
|
+
border: 0 !important;
|
|
39
|
+
width: 248px !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
24
42
|
fieldset {
|
|
25
43
|
text-align: center;
|
|
26
44
|
margin-bottom: 25px;
|
|
@@ -40,18 +58,20 @@
|
|
|
40
58
|
text-align: left;
|
|
41
59
|
}
|
|
42
60
|
|
|
43
|
-
.checkboxes ul
|
|
61
|
+
.checkboxes ul,
|
|
62
|
+
.radios ul {
|
|
44
63
|
list-style: none;
|
|
45
64
|
padding: 0;
|
|
46
65
|
}
|
|
47
66
|
|
|
48
|
-
dd.checkboxes
|
|
67
|
+
dd.checkboxes,
|
|
68
|
+
dd.radios {
|
|
49
69
|
margin: 0;
|
|
50
70
|
}
|
|
51
71
|
|
|
52
72
|
|
|
53
73
|
// clear fields
|
|
54
|
-
input:not([type='submit']):not([type=checkbox]):not([type=radio]),
|
|
74
|
+
input:not([type='submit']):not([type='reset']):not([type=checkbox]):not([type=radio]),
|
|
55
75
|
textarea {
|
|
56
76
|
background-image: none;
|
|
57
77
|
background-size: 12px;
|
|
@@ -63,10 +83,13 @@
|
|
|
63
83
|
background-position: right -12px center;
|
|
64
84
|
}
|
|
65
85
|
|
|
66
|
-
|
|
86
|
+
/*
|
|
87
|
+
TODO: still needed?
|
|
88
|
+
input:not([type='submit']):not([type='reset']):not([type='image']):not([type=checkbox]):not([type=radio]) {
|
|
67
89
|
width: 270px;
|
|
68
90
|
padding-right: 0;
|
|
69
91
|
}
|
|
92
|
+
*/
|
|
70
93
|
|
|
71
94
|
textarea {
|
|
72
95
|
background-position: right -12px top 10px;
|
|
@@ -117,7 +140,10 @@
|
|
|
117
140
|
|
|
118
141
|
|
|
119
142
|
// buttons
|
|
120
|
-
input[type='submit']
|
|
143
|
+
input[type='submit'],
|
|
144
|
+
input[type='reset'],
|
|
145
|
+
input[type='image'],
|
|
146
|
+
button {
|
|
121
147
|
width: auto;
|
|
122
148
|
box-sizing: content-box;
|
|
123
149
|
float: none;
|
|
@@ -139,7 +165,17 @@
|
|
|
139
165
|
background-image: linear-gradient(to bottom, @formBackgroundColor 0%, @borderColor 100%);
|
|
140
166
|
}
|
|
141
167
|
|
|
142
|
-
input[type='submit']:
|
|
168
|
+
input[type='submit']:first-of-type,
|
|
169
|
+
input[type='reset']:first-of-type,
|
|
170
|
+
input[type='image']:first-of-type,
|
|
171
|
+
button:first-of-type {
|
|
172
|
+
margin-left: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
input[type='submit']:active,
|
|
176
|
+
input[type='reset']:active,
|
|
177
|
+
input[type='image']:active,
|
|
178
|
+
button:active {
|
|
143
179
|
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(@formBackgroundColor, 0), color-stop(@borderColor, 1));
|
|
144
180
|
background-image: -o-linear-gradient(bottom, @borderColor 0%, @formBackgroundColor 100%);
|
|
145
181
|
background-image: -moz-linear-gradient(bottom, @borderColor 0%, @formBackgroundColor 100%);
|
|
@@ -186,14 +222,14 @@
|
|
|
186
222
|
|
|
187
223
|
dd {
|
|
188
224
|
float: left;
|
|
189
|
-
margin: 0
|
|
225
|
+
margin: 0 10px 0 10px;
|
|
190
226
|
}
|
|
191
227
|
|
|
192
228
|
dd:nth-child(4n+2) {
|
|
193
229
|
clear: both;
|
|
194
230
|
}
|
|
195
231
|
|
|
196
|
-
dt:not(.checkboxes) {
|
|
232
|
+
dt:not(.checkboxes):not(.radios) {
|
|
197
233
|
font-size: 1px;
|
|
198
234
|
text-indent: 100%;
|
|
199
235
|
white-space: nowrap;
|
|
@@ -202,19 +238,21 @@
|
|
|
202
238
|
right: 9999px;
|
|
203
239
|
}
|
|
204
240
|
|
|
205
|
-
dd:not(.checkboxes) {
|
|
241
|
+
dd:not(.checkboxes):not(.radios) {
|
|
206
242
|
display: flex;
|
|
207
243
|
flex-flow: column-reverse;
|
|
208
244
|
}
|
|
209
245
|
|
|
210
|
-
.checkboxes ul
|
|
211
|
-
|
|
212
|
-
|
|
246
|
+
.checkboxes ul,
|
|
247
|
+
.radios ul {
|
|
248
|
+
margin: 3px 20px 0 0;
|
|
249
|
+
width: 267px;
|
|
250
|
+
padding-left: 10px;
|
|
213
251
|
}
|
|
214
252
|
|
|
215
253
|
label.floatLabelFormAnimatedLabel {
|
|
216
254
|
width: 170px;
|
|
217
|
-
padding:
|
|
255
|
+
padding: 6px 15px;
|
|
218
256
|
font-size: 75%;
|
|
219
257
|
color: #aaa;
|
|
220
258
|
cursor: text;
|
|
@@ -285,7 +323,8 @@
|
|
|
285
323
|
textarea:not(:placeholder-shown) + label,
|
|
286
324
|
textarea:focus + label,
|
|
287
325
|
select + label.floatLabelFormAnimatedLabel,
|
|
288
|
-
.checkboxes label.floatLabelFormAnimatedLabel
|
|
326
|
+
.checkboxes label.floatLabelFormAnimatedLabel,
|
|
327
|
+
.radios label.floatLabelFormAnimatedLabel {
|
|
289
328
|
transform: translate(0, 0) scale(1);
|
|
290
329
|
text-indent: 6px;
|
|
291
330
|
cursor: default;
|
|
@@ -332,13 +371,21 @@
|
|
|
332
371
|
clear: both;
|
|
333
372
|
}
|
|
334
373
|
|
|
335
|
-
|
|
374
|
+
menu {
|
|
336
375
|
width: 100%;
|
|
337
376
|
clear: both;
|
|
338
377
|
display: flex;
|
|
339
378
|
justify-content: space-between;
|
|
379
|
+
padding: 0;
|
|
340
380
|
|
|
341
|
-
|
|
381
|
+
li {
|
|
382
|
+
list-style-type: none;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
input[type='submit'],
|
|
386
|
+
input[type='reset'],
|
|
387
|
+
input[type='image'],
|
|
388
|
+
button {
|
|
342
389
|
float: none;
|
|
343
390
|
clear: none;
|
|
344
391
|
margin: 0 0 25px 0;
|
|
@@ -357,10 +404,16 @@
|
|
|
357
404
|
fieldset {
|
|
358
405
|
text-align: left;
|
|
359
406
|
|
|
360
|
-
input[type='submit']
|
|
407
|
+
input[type='submit'],
|
|
408
|
+
input[type='reset'],
|
|
409
|
+
input[type='image'],
|
|
410
|
+
button {
|
|
361
411
|
float: left;
|
|
362
412
|
clear: none;
|
|
363
|
-
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
:last-child {
|
|
416
|
+
margin-right: 0;
|
|
364
417
|
}
|
|
365
418
|
}
|
|
366
419
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# semanticforms Changelog
|
|
2
|
-
|
|
3
|
-
## Next version
|
|
4
|
-
|
|
5
|
-
- Put your changes here...
|
|
6
|
-
|
|
7
|
-
## 1.0.5
|
|
8
|
-
|
|
9
|
-
- Restricted JS events to target elements within `semanticForms` class form elements.
|
|
10
|
-
- Switched font sizes to % in case someone finds 16px too small and changes the default font size in the browser, these form fields will no longer stay fixed.
|
|
11
|
-
- Published to npm.
|
|
12
|
-
- Started CHANGELOG.
|
|
13
|
-
- Updated dependencies.
|
|
14
|
-
|
|
15
|
-
## 1.0.4 and below
|
|
16
|
-
|
|
17
|
-
[Here be dragons](https://en.wikipedia.org/wiki/Here_be_dragons)...
|
package/semanticForms.html
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang='en'>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset='utf-8'>
|
|
5
|
-
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
6
|
-
<meta name='format-detection' content='telephone=no'>
|
|
7
|
-
<title>Semantic Forms</title>
|
|
8
|
-
<link rel='stylesheet' href='semanticForms.css'>
|
|
9
|
-
<style>
|
|
10
|
-
h1,
|
|
11
|
-
p {
|
|
12
|
-
font-family: sans-serif;
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<main>
|
|
18
|
-
<header>
|
|
19
|
-
<h1>Semantic Forms</h1>
|
|
20
|
-
</header>
|
|
21
|
-
<article>
|
|
22
|
-
<section class='content'>
|
|
23
|
-
<p>A pattern library of forms based on semantic HTML enhanced with a modern UX.</p>
|
|
24
|
-
|
|
25
|
-
<form action='/somewhere' method='post' class='semanticForms' data-clearfield-horizontal-offset='21' data-clearfield-vertical-offset='5'>
|
|
26
|
-
<fieldset>
|
|
27
|
-
<legend>Fieldset legend (high flow, JS enabled)</legend>
|
|
28
|
-
<dl>
|
|
29
|
-
<dt><label for='name'>Name</label></dt>
|
|
30
|
-
<dd><input id='name' name='name' type='text' placeholder='e.g. John Smith'></dd>
|
|
31
|
-
|
|
32
|
-
<dt><label for='prefilled'>Prefilled field</label></dt>
|
|
33
|
-
<dd><input id='prefilled' name='prefilled' type='text' placeholder='e.g. Stuff' value='Some text prefilled'></dd>
|
|
34
|
-
|
|
35
|
-
<dt><label for='email'>Email</label></dt>
|
|
36
|
-
<dd><input id='email' name='email' type='email' placeholder='e.g. john.smith@somewhere.com'></dd>
|
|
37
|
-
|
|
38
|
-
<dt><label for='noplaceholder'>No placeholder</label></dt>
|
|
39
|
-
<dd><input id='noplaceholder' name='noplaceholder' type='text'></dd>
|
|
40
|
-
|
|
41
|
-
<dt><label for='selectbox'>Select box</label></dt>
|
|
42
|
-
<dd><select id='selectbox' name='selectbox'>
|
|
43
|
-
<option value='1'>Item one</option>
|
|
44
|
-
<option value='2'>Item two</option>
|
|
45
|
-
<option value='3'>Item three</option>
|
|
46
|
-
<option value='4'>Item four</option>
|
|
47
|
-
<option value='5'>Item five</option>
|
|
48
|
-
<option value='6'>Item six</option>
|
|
49
|
-
<option value='7'>Item seven</option>
|
|
50
|
-
</select></dd>
|
|
51
|
-
|
|
52
|
-
<dt><label for='textarea'>Textarea</label></dt>
|
|
53
|
-
<dd><textarea id='textarea' name='textarea' rows='5' cols='50' placeholder='e.g. He just kept talking in one incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt it was really quite hypnotic.'></textarea></dd>
|
|
54
|
-
|
|
55
|
-
<dt><label data-for='checkboxes'>Checkboxes:</label></dt>
|
|
56
|
-
<dd class='checkboxes'>
|
|
57
|
-
<ul id='checkboxes'>
|
|
58
|
-
<li><input type='checkbox' name='o_one' id='o_one'> <label for='o_one'>One</label></li>
|
|
59
|
-
<li><input type='checkbox' name='o_two' id='o_two'> <label for='o_two'>Two</label></li>
|
|
60
|
-
<li><input type='checkbox' name='o_three' id='o_three'> <label for='o_three'>Three</label></li>
|
|
61
|
-
</ul>
|
|
62
|
-
</dd>
|
|
63
|
-
|
|
64
|
-
<dt><label for='textareanoplaceholder'>Textarea (no placeholder)</label></dt>
|
|
65
|
-
<dd><textarea id='textareanoplaceholder' name='textareanoplaceholder' rows='5' cols='50'></textarea></dd>
|
|
66
|
-
|
|
67
|
-
<dt><label for='date'>Date field</label></dt>
|
|
68
|
-
<dd><input id='date' name='date' type='date'></dd>
|
|
69
|
-
|
|
70
|
-
<dt><label for='prefilledtextarea'>Textarea (prefilled)</label></dt>
|
|
71
|
-
<dd><textarea id='prefilledtextarea' name='prefilledtextarea' rows='5' cols='50' placeholder='e.g. He just kept talking in one incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt it was really quite hypnotic.'>Some prefilled content...</textarea></dd>
|
|
72
|
-
</dl>
|
|
73
|
-
|
|
74
|
-
<input type='submit' name='submit' value='Non-grouped submit button'>
|
|
75
|
-
<input type='submit' name='submit' value='Another one'>
|
|
76
|
-
|
|
77
|
-
<p>Flexbox button layout pattern with two submit buttons:</p>
|
|
78
|
-
<div class='buttonGroup'>
|
|
79
|
-
<input type='submit' name='submit' value='Button 1'>
|
|
80
|
-
<input type='submit' name='submit' value='Button 2'>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<p>Flexbox button layout pattern with three submit buttons:</p>
|
|
84
|
-
<div class='buttonGroup'>
|
|
85
|
-
<input type='submit' name='submit' value='Button 1'>
|
|
86
|
-
<input type='submit' name='submit' value='Button 2'>
|
|
87
|
-
<input type='submit' name='submit' value='Button 3'>
|
|
88
|
-
</div>
|
|
89
|
-
</fieldset>
|
|
90
|
-
</form>
|
|
91
|
-
|
|
92
|
-
<form action='/somewhere' method='post' class='semanticForms lowFlow'>
|
|
93
|
-
<fieldset>
|
|
94
|
-
<legend>Fieldset legend (low flow, JS disabled)</legend>
|
|
95
|
-
<dl>
|
|
96
|
-
<dt><label for='low-flow-name'>Name</label></dt>
|
|
97
|
-
<dd><input id='low-flow-name' name='name' type='text' placeholder='e.g. John Smith'></dd>
|
|
98
|
-
|
|
99
|
-
<dt><label for='low-flow-prefilled'>Prefilled field</label></dt>
|
|
100
|
-
<dd><input id='low-flow-prefilled' name='prefilled' type='text' placeholder='e.g. Stuff' value='Some text prefilled'></dd>
|
|
101
|
-
|
|
102
|
-
<dt><label for='low-flow-email'>Email</label></dt>
|
|
103
|
-
<dd><input id='low-flow-email' name='email' type='email' placeholder='e.g. john.smith@somewhere.com'></dd>
|
|
104
|
-
|
|
105
|
-
<dt><label for='low-flow-noplaceholder'>No placeholder</label></dt>
|
|
106
|
-
<dd><input id='low-flow-noplaceholder' name='noplaceholder' type='text' placeholder=' '></dd>
|
|
107
|
-
|
|
108
|
-
<dt><label for='low-flow-selectbox'>Select box</label></dt>
|
|
109
|
-
<dd><select id='low-flow-selectbox' name='selectbox'>
|
|
110
|
-
<option value='1'>Item one</option>
|
|
111
|
-
<option value='2'>Item two</option>
|
|
112
|
-
<option value='3'>Item three</option>
|
|
113
|
-
<option value='4'>Item four</option>
|
|
114
|
-
<option value='5'>Item five</option>
|
|
115
|
-
<option value='6'>Item six</option>
|
|
116
|
-
<option value='7'>Item seven</option>
|
|
117
|
-
</select></dd>
|
|
118
|
-
|
|
119
|
-
<dt><label for='low-flow-textarea'>Textarea</label></dt>
|
|
120
|
-
<dd><textarea id='low-flow-textarea' name='textarea' rows='5' cols='50' placeholder='e.g. He just kept talking in one incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt it was really quite hypnotic.'></textarea></dd>
|
|
121
|
-
|
|
122
|
-
<dt><label data-for='low-flow-checkboxes'>Checkboxes:</label></dt>
|
|
123
|
-
<dd class='checkboxes'>
|
|
124
|
-
<ul id='low-flow-checkboxes'>
|
|
125
|
-
<li><input type='checkbox' name='o_one' id='low-flow-o_one'> <label for='low-flow-o_one'>One</label></li>
|
|
126
|
-
<li><input type='checkbox' name='o_two' id='low-flow-o_two'> <label for='low-flow-o_two'>Two</label></li>
|
|
127
|
-
<li><input type='checkbox' name='o_three' id='low-flow-o_three'> <label for='low-flow-o_three'>Three</label></li>
|
|
128
|
-
</ul>
|
|
129
|
-
</dd>
|
|
130
|
-
|
|
131
|
-
<dt><label for='low-flow-textareanoplaceholder'>Textarea (no placeholder)</label></dt>
|
|
132
|
-
<dd><textarea id='low-flow-textareanoplaceholder' name='textareanoplaceholder' rows='5' cols='50'></textarea></dd>
|
|
133
|
-
|
|
134
|
-
<dt><label for='low-flow-date'>Date field</label></dt>
|
|
135
|
-
<dd><input id='low-flow-date' name='low-flow-date' type='date'></dd>
|
|
136
|
-
|
|
137
|
-
<dt><label for='low-flow-prefilledtextarea'>Textarea (prefilled)</label></dt>
|
|
138
|
-
<dd><textarea id='low-flow-prefilledtextarea' name='prefilledtextarea' rows='5' cols='50' placeholder='e.g. He just kept talking in one incredibly unbroken sentence moving from topic to topic so that no one had a chance to interrupt it was really quite hypnotic.'>Some prefilled content...</textarea></dd>
|
|
139
|
-
</dl>
|
|
140
|
-
|
|
141
|
-
<input type='submit' name='submit' value='Non-grouped submit button'>
|
|
142
|
-
<input type='submit' name='submit' value='Another one'>
|
|
143
|
-
|
|
144
|
-
<p>Grouped button layout pattern with two submit buttons:</p>
|
|
145
|
-
<div class='buttonGroup'>
|
|
146
|
-
<input type='submit' name='submit' value='Button 1'>
|
|
147
|
-
<input type='submit' name='submit' value='Button 2'>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<p>Grouped button layout pattern with three submit buttons:</p>
|
|
151
|
-
<div class='buttonGroup'>
|
|
152
|
-
<input type='submit' name='submit' value='Button 1'>
|
|
153
|
-
<input type='submit' name='submit' value='Button 2'>
|
|
154
|
-
<input type='submit' name='submit' value='Button 3'>
|
|
155
|
-
</div>
|
|
156
|
-
</fieldset>
|
|
157
|
-
</form>
|
|
158
|
-
</section>
|
|
159
|
-
</article>
|
|
160
|
-
</main>
|
|
161
|
-
|
|
162
|
-
<script type='text/javascript' src='semanticForms.js'></script>
|
|
163
|
-
</body>
|
|
164
|
-
</html>
|