Initial commit
[yaffs-website] / web / themes / custom / yaffs / scss / component / _form.scss
1 /**
2  * Form styles.
3  */
4
5 // Checkboxes / radio buttons.
6 .checkbox, .radio {
7   // Remove top/bottom margins when in table context, because this is most
8   // likely a tableselect checkbox element.
9   table &.form-no-label {
10     margin-bottom: 0;
11     margin-top: 0;
12   }
13 }
14
15 // Browsers do not recognize pseudo :after selectors, we must create a wrapper
16 // around the select element to style it properly.
17 // $see http://stackoverflow.com/q/21103542
18 .select-wrapper {
19   display: inline-block;
20   position: relative;
21   width: 100%;
22   .form-inline & {
23     width: auto;
24   }
25   .input-group & {
26     display: table-cell;
27     // Reset rounded corners
28     &:first-child .form-control:first-child {
29       @include border-left-radius($border-radius-base);
30     }
31     &:last-child .form-control:first-child {
32       @include border-right-radius($border-radius-base);
33     }
34   }
35   select {
36     -webkit-appearance: none;
37     -moz-appearance: none;
38     appearance: none;
39     line-height: 1;
40     padding-right: 2em;
41     &::-ms-expand {
42       opacity: 0;
43     }
44   }
45   &:after {
46     color: $brand-primary;
47     content: '▼';
48     font-style: normal;
49     font-weight: 400;
50     line-height: 1;
51     margin-top: -.5em;
52     padding-right: .5em;
53     pointer-events: none;
54     position: absolute;
55     right: 0;
56     top: 50%;
57     z-index: 10;
58
59     // Use a more stylish icon if the theme uses glyphicons.
60     .has-glyphicons & {
61       -webkit-font-smoothing: antialiased;
62       -moz-osx-font-smoothing: grayscale;
63       content: '\e114'; // .glyphicon-chevron-down
64       display: inline-block;
65       font-family: 'Glyphicons Halflings';
66     }
67     .has-error & {
68       color: $state-danger-text;
69     }
70     .has-success & {
71       color: $state-success-text;
72     }
73     .has-warning & {
74       color: $state-warning-text;
75     }
76   }
77 }
78
79 // Use CSS/SVG image for required mark.
80 // @see https://www.drupal.org/node/2152217
81 // @see https://www.drupal.org/node/2274631
82 .form-required:after {
83   background-image: url(../images/required.svg);
84   background-size: 10px 7px;
85   content:"";
86   display: inline-block;
87   line-height:1;
88   height: 7px;
89   width: 10px;
90 }
91
92 // Form action buttons.
93 .form-actions {
94   .btn, .btn-group {
95     margin-right: 10px;
96   }
97   .btn-group {
98     .btn {
99       margin-right: 0;
100     }
101   }
102 }