Skip to content

Commit

Permalink
Release v0.0.27-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
hannalaakso committed Apr 12, 2018
1 parent f6e62d5 commit 3500a8d
Show file tree
Hide file tree
Showing 163 changed files with 2,932 additions and 926 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Note: We're not following semantic versioning yet, we are going to talk about this soon.

## Unreleased
## 0.0.27-alpha (Breaking release)

Breaking changes:

Expand Down
2 changes: 1 addition & 1 deletion dist/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.26-alpha
0.0.27-alpha
14 changes: 4 additions & 10 deletions dist/components/all/_all-old-ie.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// To enable support for browsers that do not support @media queries,
// (IE <= 8, Firefox <= 3, Opera <= 9) set $mq-responsive to false
// Create a separate stylesheet served exclusively to these browsers,
// meaning @media queries will be rasterized, relying on the cascade itself
$mq-responsive: false;

// Set is-ie to true to output IE specific styles
// uses the IE helpers in globals/_helpers.scss
$govuk-is-ie: true;
$govuk-ie-version: 8;
// By setting $govuk-is-ie8 to true, we create a version of the stylesheet that
// targets IE8 – e.g. conditionally including or excluding styles, and
// rasterizing media queries.
$govuk-is-ie8: true;

@import "all";
2 changes: 2 additions & 0 deletions dist/components/back-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Find out when to use the Back link component in your service in the [GOV.UK Desi

#### Macro

{% from 'back-link/macro.njk' import govukBackLink %}

{{ govukBackLink({
"href": "https://gov.uk",
"text": "Back"
Expand Down
30 changes: 21 additions & 9 deletions dist/components/back-link/_back-link.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
@import "../globals/common";
@import "../globals/tools/exports";
@import "../globals/tools/compatibility";

@import "../globals/settings/colours-palette";
@import "../globals/settings/colours-applied";
@import "../globals/settings/compatibility";
@import "../globals/settings/spacing";
@import "../globals/settings/measurements";

@import "../globals/helpers/media-queries";
@import "../globals/helpers/focusable";
@import "../globals/helpers/shape-arrow";

@import "../globals/helpers/typography";
@import "../globals/settings/typography-font-stacks";
@import "../globals/settings/typography-font";
@import "../globals/settings/typography-responsive";

@import "../globals/core/links";

@include govuk-exports("back-link") {

.govuk-c-back-link {
@include govuk-font-regular-16;
@include govuk-focusable-fill;
@include govuk-link-common;
@include govuk-link-style-text;

display: inline-block;
position: relative;
Expand All @@ -22,13 +41,6 @@
// Underline is provided by a bottom border
text-decoration: none;

&:link,
&:visited,
&:hover,
&:active {
@include govuk-text-colour;
}

// Prepend left pointing arrow
&:before {
@include govuk-shape-arrow($direction: left, $base: 10px, $height: 6px);
Expand Down
10 changes: 10 additions & 0 deletions dist/components/breadcrumbs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Find out when to use the Breadcrumbs component in your service in the [GOV.UK De

#### Macro

{% from 'breadcrumbs/macro.njk' import govukBreadcrumbs %}

{{ govukBreadcrumbs({
"items": [
{
Expand Down Expand Up @@ -63,6 +65,8 @@ Find out when to use the Breadcrumbs component in your service in the [GOV.UK De

#### Macro

{% from 'breadcrumbs/macro.njk' import govukBreadcrumbs %}

{{ govukBreadcrumbs({
"items": [
{
Expand Down Expand Up @@ -102,6 +106,8 @@ Find out when to use the Breadcrumbs component in your service in the [GOV.UK De

#### Macro

{% from 'breadcrumbs/macro.njk' import govukBreadcrumbs %}

{{ govukBreadcrumbs({
"items": [
{
Expand Down Expand Up @@ -145,6 +151,8 @@ Find out when to use the Breadcrumbs component in your service in the [GOV.UK De

#### Macro

{% from 'breadcrumbs/macro.njk' import govukBreadcrumbs %}

{{ govukBreadcrumbs({
"items": [
{
Expand Down Expand Up @@ -182,6 +190,8 @@ Find out when to use the Breadcrumbs component in your service in the [GOV.UK De

#### Macro

{% from 'breadcrumbs/macro.njk' import govukBreadcrumbs %}

{{ govukBreadcrumbs({
"items": [
{
Expand Down
34 changes: 24 additions & 10 deletions dist/components/breadcrumbs/_breadcrumbs.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
@import "../globals/common";
@import "../globals/tools/exports";
@import "../globals/tools/compatibility";

@import "../globals/settings/colours-palette";
@import "../globals/settings/colours-applied";
@import "../globals/settings/compatibility";
@import "../globals/settings/spacing";
@import "../globals/settings/measurements";

@import "../globals/tools/ie8";

@import "../globals/helpers/clearfix";
@import "../globals/helpers/media-queries";
@import "../globals/helpers/focusable";

@import "../globals/helpers/typography";
@import "../globals/settings/typography-font-stacks";
@import "../globals/settings/typography-font";
@import "../globals/settings/typography-responsive";

@import "../globals/core/links";

@include govuk-exports("breadcrumbs") {

Expand Down Expand Up @@ -86,7 +106,7 @@
border-color: $chevron-border-colour;

// Fall back to a greater than sign for IE8
@include govuk-ie(8) {
@include govuk-if-ie8 {
content: "\003e"; // Greater than sign (>)
width: auto;
height: auto;
Expand All @@ -107,13 +127,7 @@
}

.govuk-c-breadcrumbs__link {
@include govuk-focusable-fill;

&:link,
&:visited,
&:hover,
&:active {
color: $govuk-text-colour;
}
@include govuk-link-common;
@include govuk-link-style-text;
}
}
14 changes: 14 additions & 0 deletions dist/components/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"text": "Save and continue"
}) }}
Expand All @@ -36,6 +38,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"text": "Disabled button",
"disabled": true
Expand All @@ -53,6 +57,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"text": "Link button",
"href": "/"
Expand All @@ -70,6 +76,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"text": "Disabled link button",
"href": "/",
Expand All @@ -88,6 +96,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"text": "Start now link button",
"href": "/",
Expand All @@ -106,6 +116,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"element": "button",
"name": "start-now",
Expand All @@ -124,6 +136,8 @@ Buttons are configured to perform an action and they can have a different look.

#### Macro

{% from 'button/macro.njk' import govukButton %}

{{ govukButton({
"element": "button",
"text": "Explicit button disabled",
Expand Down
36 changes: 34 additions & 2 deletions dist/components/button/_button.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
@import "../globals/common";
@import "../globals/tools/exports";
@import "../globals/tools/compatibility";
@import "../globals/tools/ie8";
@import "../globals/tools/iff";

@import "../globals/settings/colours-palette";
@import "../globals/settings/colours-applied";
@import "../globals/settings/compatibility";
@import "../globals/settings/spacing";
@import "../globals/settings/measurements";

@import "../globals/helpers/media-queries";
@import "../globals/helpers/focusable";
@import "../globals/helpers/spacing";
@import "../globals/helpers/device-pixels";

@import "../globals/helpers/typography";
@import "../globals/settings/typography-font-stacks";
@import "../globals/settings/typography-font";
@import "../globals/settings/typography-responsive";

@import "../globals/core/links";

@include govuk-exports("button") {

Expand Down Expand Up @@ -49,6 +70,17 @@
text-decoration: none;
}

// alphagov/govuk_template includes a specific a:link:focus selector
// designed to make unvisited links a slightly darker blue when focussed, so
// we need to override the text colour for that combination of selectors so
// so that unvisited links styled as buttons do not end up with dark blue
// text when focussed.
@include govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-button-text-colour;
}
}

// Fix unwanted button padding in Firefox
&:-moz-focus-inner {
padding: 0;
Expand Down Expand Up @@ -119,7 +151,7 @@
top: 0;
-webkit-box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour;
box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
@include govuk-ie-lte(8) {
@include govuk-if-ie8 {
border-bottom: $button-shadow-size solid $govuk-button-shadow-colour; // s0
}
}
Expand Down
95 changes: 95 additions & 0 deletions dist/components/button/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* JavaScript 'shim' to trigger the click event of element(s) when the space key is pressed.
*
* Created since some Assistive Technologies (for example some Screenreaders)
* will tell a user to press space on a 'button', so this functionality needs to be shimmed
* See https://github.com/alphagov/govuk_elements/pull/272#issuecomment-233028270
*
* Usage instructions:
* the 'shim' will be automatically initialised
*/
;(function (global) {
'use strict'

var GOVUK_FRONTEND = global.GOVUK_FRONTEND || {}
var KEY_SPACE = 32

GOVUK_FRONTEND.buttons = {

/**
* Add event construct for modern browsers or IE8
* which fires the callback with a pre-converted target reference
* @param {object} node element
* @param {string} type event type (e.g. click, load, or error)
* @param {function} callback function
*/
addEvent: function (node, type, callback) {
// Support: IE9+ and other browsers
if (node.addEventListener) {
node.addEventListener(type, function (e) {
callback(e, e.target)
}, false)
// Support: IE8
} else if (node.attachEvent) {
node.attachEvent('on' + type, function (e) {
callback(e, e.srcElement)
})
}
},

/**
* Cross-browser character code / key pressed
* @param {object} e event
* @returns {number} character code
*/
charCode: function (e) {
return (typeof e.which === 'number') ? e.which : e.keyCode
},

/**
* Cross-browser preventing default action
* @param {object} e event
*/
preventDefault: function (e) {
// Support: IE9+ and other browsers
if (e.preventDefault) {
e.preventDefault()
// Support: IE8
} else {
e.returnValue = false
}
},

/**
* Add event handler
* if the event target element has a role='button' and the event is key space pressed
* then it prevents the default event and triggers a click event
* @param {object} e event
*/
eventHandler: function (e) {
// get the target element
var target = e.target || e.srcElement
// if the element has a role='button' and the pressed key is a space, we'll simulate a click
if (target.getAttribute('role') === 'button' && GOVUK_FRONTEND.buttons.charCode(e) === KEY_SPACE) {
GOVUK_FRONTEND.buttons.preventDefault(e)
// trigger the target's click event
target.click()
}
},

/**
* Initialise an event listener for keydown at document level
* this will help listening for later inserted elements with a role="button"
*/
init: function () {
GOVUK_FRONTEND.buttons.addEvent(document, 'keydown', GOVUK_FRONTEND.buttons.eventHandler)
}

}

// hand back to global
global.GOVUK_FRONTEND = GOVUK_FRONTEND

// auto-initialise
GOVUK_FRONTEND.buttons.init()
})(window)
Loading

0 comments on commit 3500a8d

Please sign in to comment.