govuk_publishing_components 13.5.4 → 13.6.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/component_guide/filter-components.js +32 -0
- data/app/assets/stylesheets/component_guide/application.scss +13 -0
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +6 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c6e51c7088b181de04ef57ae76940aefae824b491ad96fd968803e88b7a898
|
4
|
+
data.tar.gz: 43288c76f2513aa1026a39994d6d4bbb199965c4cbdacafa891f33f2ed13814c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f043abefc18b6ac6ed2b9784de8db39c7d509414b01b2d54f45587a467361eca99ea7a695bb1761c522f02270076b779b48d3370aa88f0e6e42124059711d077
|
7
|
+
data.tar.gz: 1333493ea99ea646a7573948912ac95ae8b5c78a73df9d6b21c124536b173f37603274a15d68a372431acbb292b9fe546ee900808367b20f24ca9b8ee68aa980
|
@@ -0,0 +1,32 @@
|
|
1
|
+
(function() {
|
2
|
+
window.GOVUK = window.GOVUK || {};
|
3
|
+
|
4
|
+
window.GOVUK.FilterComponents = function filterList(searchTerm) {
|
5
|
+
var itemsToFilter = document.querySelectorAll('.component-list li');
|
6
|
+
|
7
|
+
for (var i = 0; i < itemsToFilter.length; i++ ) {
|
8
|
+
var currentComponent = itemsToFilter[i];
|
9
|
+
var componentText = currentComponent.innerText.toLowerCase();
|
10
|
+
|
11
|
+
if (componentText.includes(searchTerm.toLowerCase())) {
|
12
|
+
currentComponent.classList.remove('component-guide-hidden');
|
13
|
+
} else {
|
14
|
+
currentComponent.classList.add('component-guide-hidden');
|
15
|
+
}
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
var formElement = document.querySelector('[data-module=filter-components]');
|
20
|
+
|
21
|
+
if (formElement) {
|
22
|
+
var searchField = formElement.querySelector('input');
|
23
|
+
|
24
|
+
// We don't want the form to submit/refresh the page on enter key
|
25
|
+
formElement.addEventListener('submit', function(e) { e.preventDefault(); });
|
26
|
+
|
27
|
+
searchField.addEventListener('input', function(e) {
|
28
|
+
var searchTerm = searchField.value;
|
29
|
+
window.GOVUK.FilterComponents(searchTerm);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
})();
|
@@ -24,10 +24,23 @@
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
|
+
.component-search {
|
28
|
+
display: none;
|
29
|
+
|
30
|
+
.js-enabled & {
|
31
|
+
display: block;
|
32
|
+
margin-top: $govuk-gutter * 2;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
27
36
|
.component-body {
|
28
37
|
margin-bottom: $govuk-gutter * 1.5;
|
29
38
|
}
|
30
39
|
|
40
|
+
.component-guide-hidden {
|
41
|
+
display: none;
|
42
|
+
}
|
43
|
+
|
31
44
|
.component-doc {
|
32
45
|
@include govuk-font($size: 16);
|
33
46
|
|
@@ -10,6 +10,12 @@
|
|
10
10
|
<p>See the <a href="https://github.com/alphagov/govuk_publishing_components">govuk_publishing_components gem</a> for further details, or <a href="https://docs.publishing.service.gov.uk/manual/components.html#component-guides">a list of all component guides</a>.</p>
|
11
11
|
</div>
|
12
12
|
|
13
|
+
<form role="search" data-module="filter-components" class="component-search">
|
14
|
+
<%= render "govuk_publishing_components/components/search", {
|
15
|
+
label_text: "Search components"
|
16
|
+
} %>
|
17
|
+
</form>
|
18
|
+
|
13
19
|
<h2 class="component-doc-h2">Components in this application</h2>
|
14
20
|
|
15
21
|
<ul class="component-list">
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.
|
4
|
+
version: 13.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govspeak
|
@@ -304,6 +304,7 @@ files:
|
|
304
304
|
- app/assets/images/govuk_publishing_components/search-button.png
|
305
305
|
- app/assets/javascripts/component_guide/accessibility-test.js
|
306
306
|
- app/assets/javascripts/component_guide/application.js
|
307
|
+
- app/assets/javascripts/component_guide/filter-components.js
|
307
308
|
- app/assets/javascripts/component_guide/vendor/axe.min.js
|
308
309
|
- app/assets/javascripts/component_guide/vendor/matches-polyfill.min.js
|
309
310
|
- app/assets/javascripts/component_guide/visual-regression.js
|