govuk_elements_rails 0.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.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/LICENCE +20 -0
  3. data/README.md +54 -0
  4. data/lib/govuk_elements_rails.rb +4 -0
  5. data/lib/govuk_elements_rails/engine.rb +4 -0
  6. data/lib/govuk_elements_rails/version.rb +5 -0
  7. data/vendor/assets/javascripts/bind.js +40 -0
  8. data/vendor/assets/javascripts/details.polyfill.js +158 -0
  9. data/vendor/assets/javascripts/selection-buttons.js +137 -0
  10. data/vendor/assets/stylesheets/elements-page-ie6.scss +5 -0
  11. data/vendor/assets/stylesheets/elements-page-ie7.scss +4 -0
  12. data/vendor/assets/stylesheets/elements-page-ie8.scss +4 -0
  13. data/vendor/assets/stylesheets/elements-page.scss +333 -0
  14. data/vendor/assets/stylesheets/elements/_buttons.scss +44 -0
  15. data/vendor/assets/stylesheets/elements/_details.scss +39 -0
  16. data/vendor/assets/stylesheets/elements/_elements-typography.scss +179 -0
  17. data/vendor/assets/stylesheets/elements/_forms.scss +166 -0
  18. data/vendor/assets/stylesheets/elements/_helpers.scss +46 -0
  19. data/vendor/assets/stylesheets/elements/_icons.scss +224 -0
  20. data/vendor/assets/stylesheets/elements/_layout.scss +67 -0
  21. data/vendor/assets/stylesheets/elements/_lists.scss +32 -0
  22. data/vendor/assets/stylesheets/elements/_panels.scss +29 -0
  23. data/vendor/assets/stylesheets/elements/_reset.scss +33 -0
  24. data/vendor/assets/stylesheets/elements/_tables.scss +26 -0
  25. data/vendor/assets/stylesheets/elements/forms/_form-block-labels.scss +67 -0
  26. data/vendor/assets/stylesheets/elements/forms/_form-date.scss +46 -0
  27. data/vendor/assets/stylesheets/elements/forms/_form-validation.scss +68 -0
  28. data/vendor/assets/stylesheets/main-ie6.scss +5 -0
  29. data/vendor/assets/stylesheets/main-ie7.scss +4 -0
  30. data/vendor/assets/stylesheets/main-ie8.scss +4 -0
  31. data/vendor/assets/stylesheets/main.scss +36 -0
  32. data/vendor/assets/stylesheets/prism.scss +144 -0
  33. data/vendor/assets/stylesheets/service-design-manual/helpers/_breadcrumbs.scss +81 -0
  34. data/vendor/assets/stylesheets/service-design-manual/helpers/_page-header.scss +28 -0
  35. data/vendor/assets/stylesheets/service-design-manual/styleguide/_colours.scss +3 -0
  36. metadata +122 -0
@@ -0,0 +1,4 @@
1
+ $is-ie: true;
2
+ $ie-version: 7;
3
+
4
+ @import "elements-page";
@@ -0,0 +1,4 @@
1
+ $is-ie: true;
2
+ $ie-version: 8;
3
+
4
+ @import "elements-page";
@@ -0,0 +1,333 @@
1
+ @import "main";
2
+
3
+ // ==========================================================================
4
+ // GOV.UK template styles
5
+ // ==========================================================================
6
+ // Override here until updated in the GOV.UK template
7
+
8
+ #global-header-bar {
9
+ @extend %site-width-container;
10
+ }
11
+ #global-header-bar .inner-block {
12
+ padding: 0;
13
+ }
14
+
15
+
16
+ // ==========================================================================
17
+ // Service Design Manual styles
18
+ // ==========================================================================
19
+
20
+ @import "service-design-manual/helpers/page-header";
21
+ @import "service-design-manual/helpers/breadcrumbs";
22
+
23
+ // Remove margins set by Service Design Manual header
24
+ #global-breadcrumb,
25
+ .page-header {
26
+ margin-left: 0;
27
+ margin-right: 0;
28
+ }
29
+
30
+ // ==========================================================================
31
+ // Elements page styles
32
+ // ==========================================================================
33
+
34
+ // These are example styles, used only for the Elements page example boxes
35
+
36
+ // Headings
37
+ // Used with heading-large = 36px
38
+ .heading-with-border {
39
+ border-top: 1px solid $border-colour;
40
+ padding-top: em(45, 36);
41
+ }
42
+
43
+ // Text
44
+ .tight {
45
+ margin-bottom: 0;
46
+ }
47
+
48
+ // Lists
49
+ .list-bullet {
50
+ margin-bottom: ($gutter*1.5);
51
+ }
52
+
53
+
54
+ // Example boxes
55
+ // ==========================================================================
56
+
57
+ .example {
58
+ @extend %contain-floats;
59
+ position: relative;
60
+ overflow: hidden;
61
+ border: 1px solid $grey-2;
62
+ margin-top: $gutter-half;
63
+ margin-bottom: $gutter*1.5;
64
+
65
+ padding-top: $gutter;
66
+ padding-right: $gutter-half;
67
+ padding-bottom: $gutter-half;
68
+ padding-left: $gutter-half;
69
+
70
+ @include media(tablet) {
71
+ padding-top: $gutter*1.5;
72
+ padding-right: $gutter;
73
+ padding-bottom: $gutter;
74
+ padding-left: $gutter;
75
+ }
76
+
77
+ &:before {
78
+ content: "EXAMPLE";
79
+
80
+ position: absolute;
81
+ top: 0;
82
+ left: 0;
83
+
84
+ padding: em(4) em(15) em(4) em(15);
85
+
86
+ @include core-14;
87
+ background: $grey-2;
88
+ color: white;
89
+ }
90
+
91
+ // Blue text for heading sizes
92
+ .highlight {
93
+ font-style: normal;
94
+ color: $hm-government;
95
+ }
96
+
97
+ }
98
+
99
+
100
+ // 1. Layout
101
+ // ==========================================================================
102
+
103
+ // Grid layout boxes
104
+ .example-grid p {
105
+ width: 100%;
106
+ background: file-url("examples/grid.png") 0 0 repeat;
107
+ min-height: 30px;
108
+ margin-bottom: 0;
109
+ @include media(tablet) {
110
+ min-height: 60px;
111
+ }
112
+ overflow: hidden;
113
+ text-indent: -999em;
114
+ }
115
+
116
+
117
+ // 2. Typography
118
+ // ==========================================================================
119
+
120
+
121
+ // 3. Colour
122
+ // ==========================================================================
123
+
124
+ // Colour swatches
125
+ .swatch {
126
+ width: 60px;
127
+ height: 60px;
128
+ @include border-radius(100%);
129
+ @include media(mobile) {
130
+ clear: both;
131
+ float: left;
132
+ margin-right: $gutter-half;
133
+ margin-bottom: $gutter-half;
134
+ }
135
+ @include media(tablet) {
136
+ margin: 0 auto $gutter-half auto;
137
+ }
138
+ }
139
+
140
+ // Sass list for colour palette
141
+ $palette: (
142
+ ("purple", $purple),
143
+ ("mauve", $mauve),
144
+ ("fuschia", $fuschia),
145
+ ("pink", $pink),
146
+ ("baby-pink", $baby-pink),
147
+ ("red", $red),
148
+ ("mellow-red", $mellow-red),
149
+ ("orange", $orange),
150
+ ("brown", $brown),
151
+ ("yellow", $yellow),
152
+ ("green", $green),
153
+ ("grass-green", $grass-green),
154
+ ("turquoise", $turquoise),
155
+ ("light-blue", $light-blue)
156
+ );
157
+
158
+ @mixin color-swatches {
159
+ @each $color in $palette {
160
+ $color-name: nth($color, 1);
161
+ $color-var: nth($color, 2);
162
+ .swatch-#{$color-name} {
163
+ background-color: $color-var;
164
+ }
165
+ }
166
+ }
167
+
168
+ // Generate swatch classes for each colour in palette list
169
+ @include color-swatches;
170
+
171
+ .swatch-alpha {
172
+ background-color: $alpha-colour;
173
+ }
174
+
175
+ .swatch-beta {
176
+ background-color: $beta-colour;
177
+ }
178
+
179
+ .swatch-error {
180
+ background-color: $error-colour;
181
+ }
182
+
183
+ .swatch-focus {
184
+ background-color: $yellow;
185
+ }
186
+
187
+ .swatch-button-colour {
188
+ background-color: $button-colour;
189
+ }
190
+
191
+ .swatch-black {
192
+ background-color: $black;
193
+ }
194
+
195
+ .swatch-grey-1 {
196
+ background-color: $grey-1;
197
+ }
198
+
199
+ .swatch-grey-2 {
200
+ background-color: $grey-2;
201
+ }
202
+
203
+ .swatch-grey-3 {
204
+ background-color: $grey-3;
205
+ }
206
+
207
+ .swatch-grey-4 {
208
+ background-color: $grey-4;
209
+ }
210
+
211
+ .swatch-white {
212
+ background-color: $white;
213
+ border: 1px solid $grey-3;
214
+ }
215
+
216
+ .swatch-text-colour {
217
+ background-color: $text-colour;
218
+ }
219
+
220
+ .swatch-text-secondary {
221
+ background-color: $secondary-text-colour;
222
+ }
223
+
224
+ .swatch-page-colour {
225
+ background-color: $page-colour;
226
+ border: 1px solid $grey-3;
227
+ }
228
+
229
+ .swatch-button-colour {
230
+ background-color: $button-colour;
231
+ }
232
+
233
+ .swatch-link-colour {
234
+ background-color: $link-colour;
235
+ }
236
+
237
+ .swatch-link-colour-visited {
238
+ background-color: $link-visited-colour;
239
+ }
240
+
241
+ .swatch-link-colour-hover {
242
+ background-color: $link-hover-colour;
243
+ }
244
+
245
+ .swatch-border-colour {
246
+ background-color: $border-colour;
247
+ }
248
+
249
+ .swatch-panel-colour {
250
+ background-color: $panel-colour;
251
+ }
252
+
253
+ .swatch-highlight-colour {
254
+ background-color: $highlight-colour;
255
+ }
256
+
257
+ // Colour swatch layout
258
+ .swatch-wrapper {
259
+ @include media(tablet) {
260
+ float: left;
261
+ width: 20%;
262
+ text-align: center;
263
+ }
264
+
265
+ .heading-small {
266
+ margin-bottom: em(10);
267
+ }
268
+
269
+ ul {
270
+ padding-bottom: $gutter-half;
271
+ @include media(mobile) {
272
+ min-height: 50px;
273
+ padding-top: 10px;
274
+ }
275
+ }
276
+ li {
277
+ @include core-16;
278
+ }
279
+ b {
280
+ font-weight: bold;
281
+ text-transform: uppercase;
282
+ }
283
+ }
284
+
285
+
286
+ // 4. Images and icons
287
+ // ==========================================================================
288
+
289
+ .example-images img {
290
+ max-width: 100%;
291
+ vertical-align: top;
292
+ }
293
+
294
+
295
+ // 5. Data
296
+ // ==========================================================================
297
+
298
+ .data .bold-xlarge,
299
+ .data .bold-xxlarge {
300
+ line-height: 0.8;
301
+ }
302
+
303
+ .example .data p {
304
+ margin-bottom: 0;
305
+ }
306
+
307
+
308
+ // 6. Forms
309
+ // ==========================================================================
310
+
311
+
312
+ // 7. Buttons
313
+ // ==========================================================================
314
+
315
+ // Increase spacing under buttons in example boxes
316
+ .example-button .button {
317
+ margin-bottom: 15px;
318
+ }
319
+
320
+ // Remove top margin from "Creating buttons" example
321
+ .example-button .heading-small {
322
+ margin-top: 0;
323
+ }
324
+
325
+ // Make swatch wrapper full width for "Creating buttons" example
326
+ .example-button .swatch-wrapper {
327
+ width: 100%;
328
+ }
329
+
330
+ // Remove bottom padding to keep "Creating buttons" example
331
+ .example-button ul {
332
+ padding-bottom: 0;
333
+ }
@@ -0,0 +1,44 @@
1
+ // Buttons
2
+ // ==========================================================================
3
+ // GOV.UK front end toolkit dependencies
4
+ @import "design-patterns/buttons";
5
+ @import "measurements";
6
+ @import "typography";
7
+
8
+ .button {
9
+ @include button ($button-colour);
10
+ margin: 0 $gutter-half $gutter-half 0;
11
+ padding: em(10) em(15) em(5) em(15);
12
+ vertical-align: top;
13
+ }
14
+
15
+ .button:focus {
16
+ outline: 3px solid $yellow;
17
+ }
18
+
19
+ // Disabled buttons
20
+ .button[disabled="disabled"] {
21
+ background: $button-colour;
22
+ }
23
+
24
+ .button[disabled="disabled"]:focus {
25
+ outline: none;
26
+ }
27
+
28
+ // Start now buttons
29
+ .button-get-started {
30
+ @include bold-24;
31
+ background-image: file-url("icons/icon-pointer.png");
32
+ background-repeat: no-repeat;
33
+ background-position: 100% 50%;
34
+ padding: em(7) em(41) em(4) em(16);
35
+
36
+ @include device-pixel-ratio {
37
+ background-image: file-url("icons/icon-pointer-2x.png");
38
+ background-size: 30px 19px;
39
+ }
40
+
41
+ @include ie(6) {
42
+ background-image: file-url("icons/icon-pointer-2x.png");
43
+ }
44
+ }
@@ -0,0 +1,39 @@
1
+ // Details
2
+ // ==========================================================================
3
+ // GOV.UK front end toolkit dependencies
4
+ @import "colours";
5
+
6
+ details {
7
+ display: block;
8
+ }
9
+
10
+ details summary {
11
+ display: inline-block;
12
+ color: $govuk-blue;
13
+ cursor: pointer;
14
+ position: relative;
15
+ margin-bottom: em(5);
16
+ }
17
+
18
+ details summary:hover {
19
+ color: $link-hover-colour;
20
+ }
21
+
22
+ details summary:focus {
23
+ outline: 3px solid $yellow;
24
+ }
25
+
26
+ // Underline only summary text (not the arrow)
27
+ details .summary {
28
+ text-decoration: underline;
29
+ }
30
+
31
+ // Match fallback arrow spacing with -webkit default
32
+ details .arrow {
33
+ margin-right: 0.35em;
34
+ }
35
+
36
+ // Remove top margin from bordered panel
37
+ details .panel-indent {
38
+ margin-top: 0;
39
+ }
@@ -0,0 +1,179 @@
1
+ // Typography
2
+ // ==========================================================================
3
+
4
+ // GOV.UK front end toolkit dependencies
5
+ @import "typography";
6
+ @import "colours";
7
+
8
+ // Increase the base font size to 19px for the main content area
9
+ // Using the core-19 mixin from the govuk_toolkit _typography.scss file
10
+
11
+ main {
12
+ @include core-19;
13
+ -webkit-font-smoothing: antialiased;
14
+ }
15
+
16
+ // Core font sizes
17
+ .font-xxlarge {
18
+ @include core-80;
19
+ }
20
+ .font-xlarge {
21
+ @include core-48;
22
+ }
23
+ .font-large {
24
+ @include core-36;
25
+ }
26
+ .font-medium {
27
+ @include core-24;
28
+ }
29
+ .font-small {
30
+ @include core-19;
31
+ }
32
+ .font-xsmall {
33
+ @include core-16;
34
+ }
35
+
36
+ // Bold font sizes
37
+ .bold-xxlarge {
38
+ @include bold-80();
39
+ }
40
+ .bold-xlarge {
41
+ @include bold-48();
42
+ }
43
+ .bold-large {
44
+ @include bold-36();
45
+ }
46
+ .bold-medium {
47
+ @include bold-24();
48
+ }
49
+ .bold-small {
50
+ @include bold-19();
51
+ }
52
+ .bold-xsmall {
53
+ @include bold-16();
54
+ }
55
+
56
+ // Common heading sizes
57
+ // Using the bold-xx mixins from the govuk_toolkit _typography.scss file
58
+ // Spacing is set in em, using the px to em function in the elements _helpers.scss file
59
+
60
+ // Headings
61
+ .heading-xlarge {
62
+ @include bold-48();
63
+
64
+ margin-top: em(15, 32);
65
+ margin-bottom: em(30, 32);
66
+
67
+ @include media(tablet) {
68
+ margin-top: em(30, 48);
69
+ margin-bottom: em(60, 48);
70
+ }
71
+
72
+ .heading-secondary {
73
+ @include heading-27();
74
+
75
+ display: block;
76
+ color: $secondary-text-colour;
77
+ }
78
+
79
+ }
80
+
81
+ .heading-large {
82
+ @include bold-36();
83
+
84
+ margin-top: em(25, 24);
85
+ margin-bottom: em(10, 24);
86
+
87
+ @include media(tablet) {
88
+ margin-top: em(45, 36 );
89
+ margin-bottom: em(20, 36);
90
+ }
91
+
92
+ .heading-secondary {
93
+ @include heading-24();
94
+
95
+ display: block;
96
+ color: $secondary-text-colour;
97
+ }
98
+
99
+ }
100
+
101
+ .heading-medium {
102
+ @include bold-24();
103
+
104
+ margin-top: em(25, 20);
105
+ margin-bottom: em(10, 20);
106
+
107
+ @include media(tablet) {
108
+ margin-top: em(45, 24);
109
+ margin-bottom: em(20, 24);
110
+ }
111
+
112
+ }
113
+
114
+ .heading-small {
115
+ @include bold-19();
116
+
117
+ margin-top: em(10, 16);
118
+ margin-bottom: em(5, 16);
119
+
120
+ @include media(tablet) {
121
+ margin-top: em(20, 19);
122
+ }
123
+
124
+ }
125
+
126
+ // Text
127
+ p {
128
+ margin-top: em(5, 16 );
129
+ margin-bottom: em(20, 16);
130
+
131
+ @include media(tablet) {
132
+ margin-top: em(5);
133
+ margin-bottom: em(20);
134
+ }
135
+
136
+ }
137
+
138
+ // Lede, or intro text
139
+ .lede {
140
+ @include core-24;
141
+ }
142
+
143
+ // Set a max-width for text blocks
144
+ // Less than 75 characters per line of text
145
+ .text {
146
+ max-width: 30em;
147
+ }
148
+
149
+ .text-secondary {
150
+ color: $secondary-text-colour;
151
+ }
152
+
153
+ // Link styles
154
+ .link {
155
+ color: $link-colour;
156
+ text-decoration: underline;
157
+ }
158
+ .link:visited {
159
+ color: $link-visited-colour;
160
+ }
161
+ .link:hover {
162
+ color: $link-hover-colour;
163
+ }
164
+ .link:active {
165
+ color: $link-colour;
166
+ }
167
+
168
+ // Code styles
169
+ pre,
170
+ code {
171
+ font-size: 13px;
172
+ line-height: 19px;
173
+ color: $black;
174
+ background-color: $highlight-colour;
175
+ border: 1px solid $border-colour;
176
+ padding: 3px 7px;
177
+ }
178
+
179
+