| 1 |
// Form structure |
| 2 |
// |
| 3 |
// Files located in `wyrm_core/_form.sass`. |
| 4 |
// |
| 5 |
// Forms follow the following basic struture. `.wy-control-group` |
| 6 |
// wraps the label and a `.wy-control`, which itself warps your actual |
| 7 |
// form elements. You can decide either to stack or align your forms. |
| 8 |
// A help message can be provided in a couple different styles, but |
| 9 |
// the most common is `.wy-form-message` as shown below. |
| 10 |
// |
| 11 |
// Markup: |
| 12 |
// <form class="{$modifiers}"> |
| 13 |
// <legend>A simple form</legend> |
| 14 |
// <fieldset> |
| 15 |
// <div class="wy-control-group"> |
| 16 |
// <label>Field name</label> |
| 17 |
// <div class="wy-control"> |
| 18 |
// <input type="text" placeholder="placeholder"/> |
| 19 |
// </div> |
| 20 |
// <span class="wy-form-message">Help text goes here!</span> |
| 21 |
// </div> |
| 22 |
// <input type="submit" class="btn" /> |
| 23 |
// </fieldset> |
| 24 |
// </form> |
| 25 |
// |
| 26 |
// Styleguide 6 |
| 27 |
|
| 28 |
|
| 29 |
.wy-form-stacked |
| 30 |
select |
| 31 |
display: block |
| 32 |
.wy-form-aligned |
| 33 |
input, textarea, select, .wy-help-inline, label |
| 34 |
display: inline-block |
| 35 |
*display: inline |
| 36 |
*zoom: 1 |
| 37 |
vertical-align: middle |
| 38 |
|
| 39 |
.wy-form-aligned |
| 40 |
.wy-control-group |
| 41 |
> label |
| 42 |
display: inline-block |
| 43 |
vertical-align: middle |
| 44 |
width: 10em |
| 45 |
margin: $base-line-height / 4 $base-line-height / 2 0 0 |
| 46 |
float: left |
| 47 |
.wy-control |
| 48 |
float: left |
| 49 |
label |
| 50 |
display: block |
| 51 |
select |
| 52 |
margin-top: $base-line-height / 4 |
| 53 |
|
| 54 |
fieldset |
| 55 |
border: 0 |
| 56 |
margin: 0 |
| 57 |
padding: 0 |
| 58 |
legend |
| 59 |
display: block |
| 60 |
width: 100% |
| 61 |
border: 0 |
| 62 |
padding: 0 |
| 63 |
white-space: normal |
| 64 |
margin-bottom: $base-line-height |
| 65 |
font-size: 150% |
| 66 |
*margin-left: -7px |
| 67 |
label |
| 68 |
display: block |
| 69 |
margin: 0 0 em(5px) 0 |
| 70 |
color: $gray-dark |
| 71 |
font-size: 90% |
| 72 |
|
| 73 |
input, select, textarea |
| 74 |
font-size: 100% |
| 75 |
margin: 0 |
| 76 |
vertical-align: baseline |
| 77 |
*vertical-align: middle |
| 78 |
|
| 79 |
|
| 80 |
.wy-control-group |
| 81 |
margin-bottom: $base-line-height |
| 82 |
+outer-container |
| 83 |
+clearfix |
| 84 |
|
| 85 |
.wy-control-group.wy-control-group-required > label:after |
| 86 |
content: " *" |
| 87 |
color: $red |
| 88 |
|
| 89 |
// For doing multi part, aligned form blocks within a single label |
| 90 |
|
| 91 |
.wy-control-group |
| 92 |
.wy-form-full, .wy-form-halves, .wy-form-thirds |
| 93 |
padding-bottom: $base-line-height / 2 |
| 94 |
select |
| 95 |
width: 100% |
| 96 |
input |
| 97 |
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 98 |
width: 100% |
| 99 |
.wy-control-group .wy-form-full |
| 100 |
+span-columns(12) |
| 101 |
+omega-type |
| 102 |
|
| 103 |
.wy-control-group .wy-form-halves |
| 104 |
+span-columns(6) |
| 105 |
+omega-type(2n) |
| 106 |
|
| 107 |
.wy-control-group .wy-form-thirds |
| 108 |
+span-columns(4) |
| 109 |
+omega-type(3n) |
| 110 |
|
| 111 |
// Sometimes you just output text in a form, not an actual input |
| 112 |
.wy-control-group.wy-control-group-no-input .wy-control |
| 113 |
margin: $base-line-height / 4 0 0 0 |
| 114 |
font-size: 90% |
| 115 |
|
| 116 |
.wy-control-no-input |
| 117 |
display: inline-block |
| 118 |
margin: $base-line-height / 4 0 0 0 |
| 119 |
font-size: 90% |
| 120 |
|
| 121 |
|
| 122 |
// Fluid inputs when needed |
| 123 |
|
| 124 |
.wy-control-group.fluid-input |
| 125 |
input |
| 126 |
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 127 |
width: 100% |
| 128 |
|
| 129 |
// Inline help for forms |
| 130 |
|
| 131 |
.wy-form-message-inline |
| 132 |
display: inline-block |
| 133 |
padding-left: 0.3em |
| 134 |
color: #666 |
| 135 |
vertical-align: middle |
| 136 |
font-size: 90% |
| 137 |
|
| 138 |
.wy-form-message |
| 139 |
display: block |
| 140 |
color: $gray-light |
| 141 |
font-size: 70% |
| 142 |
margin-top: em(5px) |
| 143 |
font-style: italic |
| 144 |
p |
| 145 |
font-size: inherit |
| 146 |
font-style: italic |
| 147 |
margin-bottom: $base-line-height / 4 |
| 148 |
p:last-child |
| 149 |
margin-bottom: 0 |
| 150 |
|
| 151 |
// Generic form elements |
| 152 |
// |
| 153 |
// Here's the output of common form inputs. The sass itself covers more types |
| 154 |
// like email, password, url, date...etc, but I've left them out for brevity. |
| 155 |
// |
| 156 |
// Markup: |
| 157 |
// <div class="wy-control-group"> |
| 158 |
// <label>Text field</label> |
| 159 |
// <div class="wy-control"> |
| 160 |
// <input type="text" placeholder="placeholder"/> |
| 161 |
// </div> |
| 162 |
// </div> |
| 163 |
// <div class="wy-control-group"> |
| 164 |
// <label>Textarea</label> |
| 165 |
// <div class="wy-control"> |
| 166 |
// <textarea></textarea> |
| 167 |
// </div> |
| 168 |
// </div> |
| 169 |
// <div class="wy-control-group"> |
| 170 |
// <label>Dropdown</label> |
| 171 |
// <div class="wy-control"> |
| 172 |
// <select> |
| 173 |
// <option></option> |
| 174 |
// <option>Option 1</option> |
| 175 |
// <option>Option 2</option> |
| 176 |
// </select> |
| 177 |
// </div> |
| 178 |
// </div> |
| 179 |
// <div class="wy-control-group"> |
| 180 |
// <label>Radio</label> |
| 181 |
// <div class="wy-control"> |
| 182 |
// <label class="wy-radio"> |
| 183 |
// <input type="radio"> |
| 184 |
// Option 1 |
| 185 |
// </label> |
| 186 |
// <label class="wy-radio"> |
| 187 |
// <input type="radio"> |
| 188 |
// Option 2 |
| 189 |
// </label> |
| 190 |
// </div> |
| 191 |
// </div> |
| 192 |
// <div class="wy-control-group"> |
| 193 |
// <label>Checkbox</label> |
| 194 |
// <div class="wy-control"> |
| 195 |
// <label class="wy-checkbox"> |
| 196 |
// <input type="checkbox"> |
| 197 |
// Option 1 |
| 198 |
// </label> |
| 199 |
// <label class="wy-checkbox"> |
| 200 |
// <input type="checkbox"> |
| 201 |
// Option 2 |
| 202 |
// </label> |
| 203 |
// </div> |
| 204 |
// </div> |
| 205 |
// |
| 206 |
// Styleguide 6.1 |
| 207 |
|
| 208 |
|
| 209 |
input |
| 210 |
line-height: normal |
| 211 |
|
| 212 |
input |
| 213 |
&[type="button"], &[type="reset"], &[type="submit"] |
| 214 |
-webkit-appearance: button |
| 215 |
cursor: pointer |
| 216 |
font-family: $base-font-family |
| 217 |
*overflow: visible |
| 218 |
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 219 |
-webkit-appearance: none |
| 220 |
padding: $base-line-height / 4 |
| 221 |
display: inline-block |
| 222 |
border: 1px solid $input-border-color |
| 223 |
font-size: 80% |
| 224 |
font-family: $base-font-family |
| 225 |
box-shadow: inset 0 1px 3px $input-shadow-color |
| 226 |
border-radius: 0 |
| 227 |
+transition(border .3s linear) |
| 228 |
+font-smooth |
| 229 |
&[type="datetime-local"] |
| 230 |
padding: em(5.5px) em(10px) |
| 231 |
&[disabled] |
| 232 |
cursor: default |
| 233 |
&[type="checkbox"], &[type="radio"] |
| 234 |
+box-sizing(border-box) |
| 235 |
padding: 0 |
| 236 |
margin-right: em(5px) |
| 237 |
*height: 13px |
| 238 |
*width: 13px |
| 239 |
&[type="search"] |
| 240 |
+box-sizing(border-box) |
| 241 |
&::-webkit-search-cancel-button, &::-webkit-search-decoration |
| 242 |
-webkit-appearance: none |
| 243 |
&[type="text"]:focus, &[type="password"]:focus, &[type="email"]:focus, &[type="url"]:focus, &[type="date"]:focus, &[type="month"]:focus, &[type="time"]:focus, &[type="datetime"]:focus, &[type="datetime-local"]:focus, &[type="week"]:focus, &[type="number"]:focus, &[type="search"]:focus, &[type="tel"]:focus, &[type="color"]:focus |
| 244 |
outline: 0 |
| 245 |
outline: thin dotted \9 |
| 246 |
border-color: $input-focus-color |
| 247 |
&.no-focus:focus |
| 248 |
border-color: $input-border-color !important |
| 249 |
&[type="file"]:focus, &[type="radio"]:focus, &[type="checkbox"]:focus |
| 250 |
outline: thin dotted $gray-dark |
| 251 |
outline: 1px auto #129FEA |
| 252 |
&[type="text"][disabled], &[type="password"][disabled], &[type="email"][disabled], &[type="url"][disabled], &[type="date"][disabled], &[type="month"][disabled], &[type="time"][disabled], &[type="datetime"][disabled], &[type="datetime-local"][disabled], &[type="week"][disabled], &[type="number"][disabled], &[type="search"][disabled], &[type="tel"][disabled], &[type="color"][disabled] |
| 253 |
cursor: not-allowed |
| 254 |
background-color: darken($input-background-color, 2%) |
| 255 |
|
| 256 |
input:focus:invalid, textarea:focus:invalid, select:focus:invalid |
| 257 |
color: $red |
| 258 |
border: 1px solid $red |
| 259 |
input:focus:invalid:focus, textarea:focus:invalid:focus, select:focus:invalid:focus |
| 260 |
border-color: $red |
| 261 |
input |
| 262 |
&[type="file"]:focus:invalid:focus, &[type="radio"]:focus:invalid:focus, &[type="checkbox"]:focus:invalid:focus |
| 263 |
outline-color: $red |
| 264 |
|
| 265 |
input.wy-input-large |
| 266 |
padding: $base-line-height / 2 |
| 267 |
font-size: 100% |
| 268 |
|
| 269 |
|
| 270 |
// Textareas and selects |
| 271 |
|
| 272 |
textarea |
| 273 |
overflow: auto |
| 274 |
vertical-align: top |
| 275 |
width: 100% |
| 276 |
font-family: $base-font-family |
| 277 |
select, textarea |
| 278 |
padding: em(8px) em(10px) |
| 279 |
display: inline-block |
| 280 |
border: 1px solid $input-border-color |
| 281 |
font-size: 80% |
| 282 |
box-shadow: inset 0 1px 3px $input-shadow-color |
| 283 |
+transition(border .3s linear) |
| 284 |
+font-smooth |
| 285 |
select |
| 286 |
border: 1px solid $input-border-color |
| 287 |
background-color: $input-background-color |
| 288 |
&[multiple] |
| 289 |
height: auto |
| 290 |
select:focus, textarea:focus |
| 291 |
outline: 0 |
| 292 |
select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] |
| 293 |
cursor: not-allowed |
| 294 |
background-color: darken($input-background-color, 2%) |
| 295 |
|
| 296 |
// Checkboxes and radios |
| 297 |
|
| 298 |
input |
| 299 |
&[type="radio"][disabled], &[type="checkbox"][disabled] |
| 300 |
cursor: not-allowed |
| 301 |
.wy-checkbox, .wy-radio |
| 302 |
margin: $base-line-height / 4 0 |
| 303 |
// Important because we don't want it overwritten in the case of errors |
| 304 |
color: $text-color |
| 305 |
display: block |
| 306 |
input |
| 307 |
vertical-align: baseline |
| 308 |
|
| 309 |
// Messages and input context |
| 310 |
|
| 311 |
.wy-form-message-inline |
| 312 |
display: inline-block |
| 313 |
*display: inline |
| 314 |
*zoom: 1 |
| 315 |
vertical-align: middle |
| 316 |
|
| 317 |
// Prefix and suffix for inputs |
| 318 |
// |
| 319 |
// Wyrm allows some basic prefix and suffic styling for text inputs. |
| 320 |
// |
| 321 |
// Markup: |
| 322 |
// <div class="wy-control-group"> |
| 323 |
// <label>Prefix</label> |
| 324 |
// <div class="wy-control wy-input-prefix"> |
| 325 |
// <span class="wy-input-context">@</span><input type="text" placeholder="placeholder"/> |
| 326 |
// </div> |
| 327 |
// </div> |
| 328 |
// <div class="wy-control-group"> |
| 329 |
// <label>Suffix</label> |
| 330 |
// <div class="wy-control wy-input-suffix"> |
| 331 |
// <input type="text" placeholder="placeholder"/><span class="wy-input-context">@gmail.com</span> |
| 332 |
// </div> |
| 333 |
// </div> |
| 334 |
// |
| 335 |
// Styleguide 6.2 |
| 336 |
|
| 337 |
|
| 338 |
.wy-input-prefix, .wy-input-suffix |
| 339 |
white-space: nowrap |
| 340 |
padding: $base-line-height / 4 |
| 341 |
.wy-input-context |
| 342 |
line-height: 27px // Hack for the moment. |
| 343 |
padding: 0 8px |
| 344 |
display: inline-block |
| 345 |
font-size: 80% |
| 346 |
background-color: $table-stripe-color |
| 347 |
border: solid 1px $input-border-color |
| 348 |
color: $gray-light |
| 349 |
|
| 350 |
.wy-input-suffix .wy-input-context |
| 351 |
border-left: 0 |
| 352 |
.wy-input-prefix .wy-input-context |
| 353 |
border-right: 0 |
| 354 |
|
| 355 |
// Switches |
| 356 |
// |
| 357 |
// True / false, boolean style switches. |
| 358 |
// |
| 359 |
// Markup: |
| 360 |
// <div class="wy-switch {$modifiers}"><span>Here is some really long text.</span></div> |
| 361 |
// |
| 362 |
// .active - active state. |
| 363 |
// .disabled - disabled. |
| 364 |
// |
| 365 |
// Styleguide 6.3 |
| 366 |
|
| 367 |
.wy-switch |
| 368 |
position: relative |
| 369 |
display: block |
| 370 |
height: $base-line-height |
| 371 |
margin-top: $base-line-height / 2 |
| 372 |
cursor: pointer |
| 373 |
&:before |
| 374 |
position: absolute |
| 375 |
content: "" |
| 376 |
display: block |
| 377 |
left: 0 |
| 378 |
top: 0 |
| 379 |
width: $base-line-height * 1.5 |
| 380 |
height: $base-line-height / 2 |
| 381 |
border-radius: 4px |
| 382 |
background: $gray-lighter |
| 383 |
+transition(all .2s ease-in-out) |
| 384 |
&:after |
| 385 |
position: absolute |
| 386 |
content: "" |
| 387 |
display: block |
| 388 |
width: 18px |
| 389 |
height: 18px |
| 390 |
border-radius: 4px |
| 391 |
background: $gray-light |
| 392 |
left: -3px |
| 393 |
top: -3px |
| 394 |
+transition(all .2s ease-in-out) |
| 395 |
span |
| 396 |
position: absolute |
| 397 |
left: $base-line-height * 2 |
| 398 |
display: block |
| 399 |
font-size: 12px |
| 400 |
color: $gray-lighter |
| 401 |
line-height: 1 |
| 402 |
.wy-switch.active |
| 403 |
&:before |
| 404 |
background: darken($green, 10%) |
| 405 |
&:after |
| 406 |
left: $base-line-height |
| 407 |
background: $green |
| 408 |
|
| 409 |
.wy-switch.disabled |
| 410 |
cursor: not-allowed |
| 411 |
opacity: .8 |
| 412 |
|
| 413 |
|
| 414 |
// Error handling and inline validation |
| 415 |
// |
| 416 |
// Wyrm has both block and inline level validation depending upon your needs. You can also |
| 417 |
// pair these with the global alerts mentioned in the alerts section of this styleguide. |
| 418 |
// |
| 419 |
// Markup: |
| 420 |
// <div class="wy-control-group wy-control-group-error"> |
| 421 |
// <label>After the fact error</label> |
| 422 |
// <div class="wy-control"> |
| 423 |
// <input type="text" placeholder="placeholder"/> |
| 424 |
// <span class="wy-form-message">Error text goes here.</span> |
| 425 |
// </div> |
| 426 |
// </div> |
| 427 |
// <div class="wy-control-group"> |
| 428 |
// <label>Inline success</label> |
| 429 |
// <div class="wy-control wy-inline-validate wy-inline-validate-info"> |
| 430 |
// <input type="text" placeholder="placeholder"/> |
| 431 |
// <span class="wy-input-context"> You may want to do this.</span> |
| 432 |
// </div> |
| 433 |
// </div> |
| 434 |
// <div class="wy-control-group"> |
| 435 |
// <label>Inline success</label> |
| 436 |
// <div class="wy-control wy-inline-validate wy-inline-validate-success"> |
| 437 |
// <input type="text" placeholder="placeholder"/> |
| 438 |
// <span class="wy-input-context"> Woot, way to go.</span> |
| 439 |
// </div> |
| 440 |
// </div> |
| 441 |
// <div class="wy-control-group"> |
| 442 |
// <label>Inline error</label> |
| 443 |
// <div class="wy-control wy-inline-validate wy-inline-validate-warning"> |
| 444 |
// <input type="text" placeholder="placeholder"/> |
| 445 |
// <span class="wy-input-context"> Hold on cowboy.</span> |
| 446 |
// </div> |
| 447 |
// </div> |
| 448 |
// <div class="wy-control-group"> |
| 449 |
// <label>Inline error</label> |
| 450 |
// <div class="wy-control wy-inline-validate wy-inline-validate-danger"> |
| 451 |
// <input type="text" placeholder="placeholder"/> |
| 452 |
// <span class="wy-input-context"> Damnit, you messed up.</span> |
| 453 |
// </div> |
| 454 |
// </div> |
| 455 |
// |
| 456 |
// Styleguide 6.4 |
| 457 |
|
| 458 |
.wy-control-group.wy-control-group-error |
| 459 |
.wy-form-message, > label |
| 460 |
color: $red |
| 461 |
input |
| 462 |
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 463 |
border: solid 1px $red |
| 464 |
textarea |
| 465 |
border: solid 1px $red |
| 466 |
|
| 467 |
.wy-inline-validate |
| 468 |
white-space: nowrap |
| 469 |
.wy-input-context |
| 470 |
padding: em(8px) em(10px) |
| 471 |
display: inline-block |
| 472 |
font-size: 80% |
| 473 |
.wy-inline-validate.wy-inline-validate-success .wy-input-context |
| 474 |
color: $green |
| 475 |
@extend %icon |
| 476 |
@extend .#{$icon-prefix}-#{$icon-ok} |
| 477 |
.wy-inline-validate.wy-inline-validate-danger .wy-input-context |
| 478 |
color: $red |
| 479 |
@extend %icon |
| 480 |
@extend .#{$icon-prefix}-#{$icon-remove} |
| 481 |
.wy-inline-validate.wy-inline-validate-warning .wy-input-context |
| 482 |
color: $orange |
| 483 |
@extend %icon |
| 484 |
@extend .#{$icon-prefix}-#{$icon-alert} |
| 485 |
.wy-inline-validate.wy-inline-validate-info .wy-input-context |
| 486 |
color: $blue |
| 487 |
@extend %icon |
| 488 |
@extend .#{$icon-prefix}-#{$icon-alert} |
| 489 |
|
| 490 |
// Some generic rotation classes for reading user images |
| 491 |
|
| 492 |
.rotate-90 |
| 493 |
@include transform(rotate(90deg)) |
| 494 |
.rotate-180 |
| 495 |
@include transform(rotate(180deg)) |
| 496 |
.rotate-270 |
| 497 |
@include transform(rotate(270deg)) |
| 498 |
.mirror |
| 499 |
@include transform(scaleX(-1)) |
| 500 |
&.rotate-90 |
| 501 |
@include transform(scaleX(-1) rotate(90deg)) |
| 502 |
&.rotate-180 |
| 503 |
@include transform(scaleX(-1) rotate(180deg)) |
| 504 |
&.rotate-270 |
| 505 |
@include transform(scaleX(-1) rotate(270deg)) |
| 506 |
|
| 507 |
@media only screen and (max-width: 480px) |
| 508 |
.wy-form |
| 509 |
button[type="submit"] |
| 510 |
margin: 0.7em 0 0 |
| 511 |
input |
| 512 |
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 513 |
margin-bottom: 0.3em |
| 514 |
display: block |
| 515 |
label |
| 516 |
margin-bottom: 0.3em |
| 517 |
display: block |
| 518 |
.wy-form input |
| 519 |
&[type="password"], &[type="email"], &[type="url"], &[type="date"], &[type="month"], &[type="time"], &[type="datetime"], &[type="datetime-local"], &[type="week"], &[type="number"], &[type="search"], &[type="tel"], &[type="color"] |
| 520 |
margin-bottom: 0 |
| 521 |
.wy-form-aligned |
| 522 |
.wy-control-group label |
| 523 |
margin-bottom: 0.3em |
| 524 |
text-align: left |
| 525 |
display: block |
| 526 |
width: 100% |
| 527 |
.wy-control |
| 528 |
margin: 1.5em 0 0 0 |
| 529 |
.wy-form .wy-help-inline, .wy-form-message-inline, .wy-form-message |
| 530 |
display: block |
| 531 |
font-size: 80% |
| 532 |
padding: $base-line-height / 4 0 |
| 533 |
|
| 534 |
|