govuk-frontend
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -6,3 +6,3 @@ [ | ||
"required": true, | ||
"description": "Must be **unique** across the domain of your service (as the expanded state of individual instances of the component persists across page loads using [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)). Used as an `id` in the HTML for the accordion as a whole, and also as a prefix for the `id`s of the section contents and the buttons that open them, so that those `id`s can be the target of `aria-labelledby` and `aria-control` attributes." | ||
"description": "Must be **unique** across the domain of your service (as the expanded state of individual instances of the component persists across page loads using [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)). Used as an `id` in the HTML for the accordion as a whole, and also as a prefix for the `id`s of the section contents and the buttons that open them, so that those `id`s can be the target of `aria-labelledby` and `aria-control` attributes." | ||
}, | ||
@@ -9,0 +9,0 @@ { |
@@ -15,2 +15,2 @@ # Accordion | ||
See [options table](https://design-system.service.gov.uk/components/accordion/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/accordion/#options-accordion-example) for details. |
@@ -15,2 +15,2 @@ # Back link | ||
See [options table](https://design-system.service.gov.uk/components/back-link/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/back-link/#options-back-link-example) for details. |
@@ -15,2 +15,2 @@ # Breadcrumbs | ||
See [options table](https://design-system.service.gov.uk/components/breadcrumbs/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/breadcrumbs/#options-breadcrumbs-example) for details. |
@@ -23,3 +23,3 @@ [ | ||
"type": "string", | ||
"required": true, | ||
"required": false, | ||
"description": "Name for the `input` or `button`. This has no effect on `a` elements." | ||
@@ -30,3 +30,3 @@ }, | ||
"type": "string", | ||
"required": true, | ||
"required": false, | ||
"description": "Type of `input` or `button` – `button`, `submit` or `reset`. Defaults to `submit`. This has no effect on `a` elements." | ||
@@ -37,3 +37,3 @@ }, | ||
"type": "string", | ||
"required": true, | ||
"required": false, | ||
"description": "Value for the `button` tag. This has no effect on `a` or `input` elements." | ||
@@ -40,0 +40,0 @@ }, |
@@ -15,2 +15,2 @@ # Button | ||
See [options table](https://design-system.service.gov.uk/components/button/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/button/#options-button-example) for details. |
@@ -1020,2 +1020,5 @@ (function (global, factory) { | ||
this.$textarea = $module.querySelector('.govuk-js-character-count'); | ||
if (this.$textarea) { | ||
this.$countMessage = $module.querySelector('[id=' + this.$textarea.id + '-info]'); | ||
} | ||
} | ||
@@ -1033,6 +1036,12 @@ | ||
var $textarea = this.$textarea; | ||
if (!$textarea) { | ||
var $countMessage = this.$countMessage; | ||
if (!$textarea || !$countMessage) { | ||
return | ||
} | ||
// We move count message right after the field | ||
// Kept for backwards compatibility | ||
$textarea.insertAdjacentElement('afterend', $countMessage); | ||
// Read options set using dataset ('data-' values) | ||
@@ -1055,19 +1064,12 @@ this.options = this.getDataset($module); | ||
// Generate and reference message | ||
var boundCreateCountMessage = this.createCountMessage.bind(this); | ||
this.countMessage = boundCreateCountMessage(); | ||
// Remove hard limit if set | ||
$module.removeAttribute('maxlength'); | ||
// If there's a maximum length defined and the count message exists | ||
if (this.countMessage) { | ||
// Remove hard limit if set | ||
$module.removeAttribute('maxlength'); | ||
// Bind event changes to the textarea | ||
var boundChangeEvents = this.bindChangeEvents.bind(this); | ||
boundChangeEvents(); | ||
// Bind event changes to the textarea | ||
var boundChangeEvents = this.bindChangeEvents.bind(this); | ||
boundChangeEvents(); | ||
// Update count message | ||
var boundUpdateCountMessage = this.updateCountMessage.bind(this); | ||
boundUpdateCountMessage(); | ||
} | ||
// Update count message | ||
var boundUpdateCountMessage = this.updateCountMessage.bind(this); | ||
boundUpdateCountMessage(); | ||
}; | ||
@@ -1103,23 +1105,2 @@ | ||
// Generate count message and bind it to the input | ||
// returns reference to the generated element | ||
CharacterCount.prototype.createCountMessage = function () { | ||
var countElement = this.$textarea; | ||
var elementId = countElement.id; | ||
// Check for existing info count message | ||
var countMessage = document.getElementById(elementId + '-info'); | ||
// If there is no existing info count message we add one right after the field | ||
if (elementId && !countMessage) { | ||
countElement.insertAdjacentHTML('afterend', '<span id="' + elementId + '-info" class="govuk-hint govuk-character-count__message" aria-live="polite"></span>'); | ||
this.describedBy = countElement.getAttribute('aria-describedby'); | ||
this.describedByInfo = this.describedBy + ' ' + elementId + '-info'; | ||
countElement.setAttribute('aria-describedby', this.describedByInfo); | ||
countMessage = document.getElementById(elementId + '-info'); | ||
} else { | ||
// If there is an existing info count message we move it right after the field | ||
countElement.insertAdjacentElement('afterend', countMessage); | ||
} | ||
return countMessage | ||
}; | ||
// Bind input propertychange to the elements and update based on the change | ||
@@ -1151,3 +1132,3 @@ CharacterCount.prototype.bindChangeEvents = function () { | ||
var options = this.options; | ||
var countMessage = this.countMessage; | ||
var countMessage = this.$countMessage; | ||
@@ -1154,0 +1135,0 @@ // Determine the remaining number of characters/words |
@@ -15,2 +15,2 @@ # Character count | ||
See [options table](https://design-system.service.gov.uk/components/character-count/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/character-count/#options-character-count-example) for details. |
@@ -15,2 +15,2 @@ # Checkboxes | ||
See [options table](https://design-system.service.gov.uk/components/checkboxes/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/checkboxes/#options-checkboxes-example) for details. |
@@ -15,2 +15,2 @@ # Date input | ||
See [options table](https://design-system.service.gov.uk/components/date-input/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/date-input/#options-date-input-example) for details. |
@@ -15,2 +15,2 @@ # Details | ||
See [options table](https://design-system.service.gov.uk/components/details/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/details/#options-details-example) for details. |
@@ -15,2 +15,2 @@ # Error message | ||
See [options table](https://design-system.service.gov.uk/components/error-message/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/error-message/#options-error-message-example) for details. |
@@ -15,2 +15,2 @@ # Error summary | ||
See [options table](https://design-system.service.gov.uk/components/error-summary/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/error-summary/#options-error-summary-example) for details. |
@@ -62,4 +62,4 @@ [ | ||
"required": false, | ||
"description": "Not strictly a parameter but [Nunjucks code convention](https://mozilla.github.io/nunjucks/templating.html#call). Using a `call` block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire fielset component in a `call` block. See [checkboxes component](https://github.com/alphagov/govuk-frontend/blob/master/src/components/checkboxes/template.njk#L86) for an example." | ||
"description": "Not strictly a parameter but [Nunjucks code convention](https://mozilla.github.io/nunjucks/templating.html#call). Using a `call` block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire fielset component in a `call` block." | ||
} | ||
] |
@@ -15,2 +15,2 @@ # Fieldset | ||
See [options table](https://design-system.service.gov.uk/components/fieldset/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/fieldset/#options-fieldset-example) for details. |
@@ -15,2 +15,2 @@ # File upload | ||
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-file-upload-example) for details. |
@@ -15,2 +15,2 @@ # Footer | ||
See [options table](https://design-system.service.gov.uk/components/footer/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/footer/#options-footer-example) for details. |
@@ -15,2 +15,2 @@ # Header | ||
See [options table](https://design-system.service.gov.uk/components/header/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/header/#options-header-example) for details. |
@@ -15,2 +15,2 @@ # Hint | ||
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--hint) for details. | ||
See [options table](https://design-system.service.gov.uk/components/text-input/#options-text-input-example--hint) for details. |
@@ -15,2 +15,2 @@ # Input | ||
See [options table](https://design-system.service.gov.uk/components/text-input/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/text-input/#options-input-example) for details. |
@@ -15,2 +15,2 @@ # Inset text | ||
See [options table](https://design-system.service.gov.uk/components/inset-text/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/inset-text/#options-inset-text-example) for details. |
@@ -15,2 +15,2 @@ # Label | ||
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--label) for details. | ||
See [options table](https://design-system.service.gov.uk/components/text-input/#options-text-input-example--label) for details. |
@@ -15,2 +15,2 @@ # Panel | ||
See [options table](https://design-system.service.gov.uk/components/panel/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/panel/#options-panel-example) for details. |
@@ -15,2 +15,2 @@ # Phase banner | ||
See [options table](https://design-system.service.gov.uk/components/phase-banner/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/phase-banner/#options-phase-banner-example) for details. |
@@ -15,2 +15,2 @@ # Radios | ||
See [options table](https://design-system.service.gov.uk/components/radios/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/radios/#options-radios-example) for details. |
@@ -15,2 +15,2 @@ # Select | ||
See [options table](https://design-system.service.gov.uk/components/select/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/select/#options-select-example) for details. |
@@ -15,2 +15,2 @@ # Skip link | ||
See [options table](https://design-system.service.gov.uk/components/skip-link/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/skip-link/#options-skip-link-example) for details. |
@@ -15,2 +15,2 @@ # Summary list | ||
See [options table](https://design-system.service.gov.uk/components/summary-list/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/summary-list/#options-summary-list-example) for details. |
@@ -15,2 +15,2 @@ # Table | ||
See [options table](https://design-system.service.gov.uk/components/table/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/table/#options-table-example) for details. |
@@ -15,2 +15,2 @@ # Tabs | ||
See [options table](https://design-system.service.gov.uk/components/tabs/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/tabs/#options-tabs-example) for details. |
@@ -15,2 +15,2 @@ # Tag | ||
See [options table](https://design-system.service.gov.uk/components/tag/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/tag/#options-tag-example) for details. |
@@ -15,2 +15,2 @@ # Textarea | ||
See [options table](https://design-system.service.gov.uk/components/textarea/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/textarea/#options-textarea-example) for details. |
@@ -15,2 +15,2 @@ # Warning text | ||
See [options table](https://design-system.service.gov.uk/components/warning-text/#options-example-default) for details. | ||
See [options table](https://design-system.service.gov.uk/components/warning-text/#options-warning-text-example) for details. |
{ | ||
"name": "govuk-frontend", | ||
"description": "GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"main": "govuk/all.js", | ||
@@ -6,0 +6,0 @@ "sass": "govuk/all.scss", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1026035
13449