govuk_publishing_components 59.2.0 → 59.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41f82022780f797229d0b34e4198883f6cf2db82f52423ba99f1572f7fc8145a
4
- data.tar.gz: 23a2b1366c0b460fa28e92db4ba538fc0e994b42d4f41e3f02487052e61636d7
3
+ metadata.gz: 7417948ab55013ddbb82d195f372b4a68010acc0859b7afff3f04ad23968a2db
4
+ data.tar.gz: 81f599c8fd2535efb10a130941d2226a7f2738ab79ae1066a7341b687d326ae6
5
5
  SHA512:
6
- metadata.gz: a7c4703e1b53cb9d00b644dd1e4e4b72f5c2335dd85e981fe76e4dd1a96d45ae27ec5e8298154ea2b330f2816043031e3cf18c880499fb565f382a8e58fa1980
7
- data.tar.gz: f8efc7e2c88acfd7fd9b480b44cc0f827038ed50732747ae971366c237ef5d1a78cff10d9b5a6077907ade0ce01cbb434fb59b17e9e7f806ce9a67ce1367027e
6
+ metadata.gz: ae96349a76eabcf7bdc895efbb6fc9dc96fab3b09879f5a0da5ea86b0b4c165bb1a1b569fcb6102939f3e158d5e2294e877af4b9c7c343bf23b2a950bcc1cabc
7
+ data.tar.gz: 9a7913f2b23f58f8b82a27cdc47f55c20ea158b9212fa2eecd7642bd747e56aa7e42275274c97dae8043c5b79ab8d1221bdd84ef8f27003a359fefb66db63943
@@ -36,12 +36,12 @@
36
36
  // e.g. 'AB123456A', 'AB 12 34 56 A', 'ab 123456 a', 'ab 12 34 56 a', 'AB+12+34+56+A'
37
37
  var NATIONAL_INSURANCE_NUMBER = /[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]/gi
38
38
 
39
- var UK_MOBILE_NUMBER = /07\d{3}\s?\d{6}/g // 07123 123456 or 07123123456
40
- var UK_MOBILE_NUMBER_INTERNATIONAL = /\+447\d{3}\s?\d{6}/g // +447123 123456 or +447123123456
41
- var UK_LANDLINE_NUMBER = /0[1246]\d{1}\s?\d{3,4}\s?\d{4}/g // 020 123 1234 or 020 1234 1234 or 0201231234 or 02012341234
42
- var UK_LANDLINE_NUMBER_2 = /0[1246]\d{3}\s\d{6}/g // 02123 123456
43
- var UK_LANDLINE_NUMBER_INTERNATIONAL = /\+44[1246]\d{1}\s?\d{3,4}\s?\d{4}/g // +4420 123 1234 or +4420 1234 1234
44
- var UK_LANDLINE_NUMBER_INTERNATIONAL_2 = /\+44[1246]\d{3}\s\d{6}/g // +442123 123456
39
+ var UK_MOBILE_NUMBER = /07\d{3}[\s%20+]?\d{6,8}/g // 07123 123456 or 07123123456 or 07123+123456 or 07123%20123456
40
+ var UK_MOBILE_NUMBER_INTERNATIONAL = /(\+|%2B)?447\d{3}[\s%20+]?\d{6,8}/gi // +447123 123456 or +447123123456 or +447123%20123456 or +447123+123456 or %2B447123123456. Plus at start is optional.
41
+ var UK_LANDLINE_NUMBER = /0[1246]\d{1}[\s%20+]?\d{3,6}[\s%20+]?\d{4,6}/g // 020 123 1234 or 020 1234 1234 or 0201231234 or 02012341234 or 020+123+1234 or 020+1234+1234 or 020%20123%201234 or 020%201234%201234
42
+ var UK_LANDLINE_NUMBER_2 = /0[1246]\d{3}[\s%20+]\d{6,8}/g // 02123 123456 or 02123+123456 or 02123%20123456
43
+ var UK_LANDLINE_NUMBER_INTERNATIONAL = /(\+|%2B)?44[1246]\d{1}[\s%20+]?\d{3,6}[\s%20+]?\d{4,6}/g // // +4420 123 1234 or +4420 1234 1234 or +4420+123+1234 or +4420%20123%201234 or %2B4420 123 1234. Plus at start is optional.
44
+ var UK_LANDLINE_NUMBER_INTERNATIONAL_2 = /(\+|%2B)?44[1246]\d{3}[\s%20+]\d{6,8}/g // +442123 123456 or +442123%20123456 or +442123+123456 or %2B442123+123456. Plus at start is optional.
45
45
 
46
46
  function shouldStripDates () {
47
47
  var metas = document.querySelectorAll('meta[name="govuk:ga4-strip-dates"]')
@@ -5,7 +5,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
5
5
  function AddAnother (module) {
6
6
  this.module = module
7
7
  this.disableGa4 = this.module.dataset.disableGa4
8
- this.emptyFieldset = undefined
9
8
  this.addAnotherButton = undefined
10
9
  this.startIndex = Number(this.module.dataset.ga4StartIndex) || 1
11
10
  this.indexSectionCount = Number(this.module.dataset.ga4IndexSectionCount)
@@ -94,8 +93,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
94
93
  }
95
94
 
96
95
  AddAnother.prototype.removeEmptyFieldset = function () {
97
- this.emptyFieldset = this.module.querySelector('.js-add-another__empty')
98
- this.emptyFieldset.remove()
96
+ this.module.querySelector('.js-add-another__empty').remove()
99
97
  }
100
98
 
101
99
  AddAnother.prototype.updateFieldsetsAndButtons = function () {
@@ -129,15 +127,18 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
129
127
 
130
128
  AddAnother.prototype.addNewFieldset = function (event) {
131
129
  var button = event.target
132
- var newFieldset = this.emptyFieldset.cloneNode(true)
133
- newFieldset.classList.remove('js-add-another__empty')
130
+ var newFieldsetTemplate = this.module.querySelector('.js-add-another__empty-template')
131
+ var newFieldset = newFieldsetTemplate.content.cloneNode(true).children[0]
134
132
  newFieldset.classList.add('js-add-another__fieldset')
135
133
  this.createRemoveButton(newFieldset, this.removeNewFieldset.bind(this))
136
134
  button.before(newFieldset)
137
135
 
138
- this.incrementAttributes(this.emptyFieldset)
136
+ this.incrementAttributes(newFieldsetTemplate.content)
139
137
  this.updateFieldsetsAndButtons()
140
138
 
139
+ // Initialise any modules included in new fieldset
140
+ window.GOVUK.modules.start(newFieldset)
141
+
141
142
  // Move focus to first visible field in new set
142
143
  newFieldset
143
144
  .querySelector('input:not([type="hidden"]), select, textarea')
@@ -40,4 +40,13 @@
40
40
  } do %>
41
41
  <%= empty %>
42
42
  <% end %>
43
+ <template class="js-add-another__empty-template">
44
+ <%= render "govuk_publishing_components/components/fieldset", {
45
+ classes: "js-add-another__fieldset",
46
+ legend_text: "#{fieldset_legend} #{items.length + 1}",
47
+ heading_size: "m"
48
+ } do %>
49
+ <%= empty %>
50
+ <% end %>
51
+ </template>
43
52
  <% end %>
@@ -83,3 +83,41 @@ examples:
83
83
  <label for="employee_1_name" class="gem-c-label govuk-label">Full name</label>
84
84
  <input class="gem-c-input govuk-input" id="employee_1_name" name="employee[1]name">
85
85
  </div>
86
+
87
+ with_select_with_search:
88
+ description: Add another with a select with search input
89
+ data:
90
+ fieldset_legend: "Organisation"
91
+ add_button_text: "Add another organisation"
92
+ items:
93
+ - fields: >
94
+ <div class="govuk-form-group">
95
+ <label for="organisations_1">Select Organisation 1</label>
96
+ <select name="organisations[0][id]" id="organisations_1" class="govuk-select" data-module="select-with-search" tabindex="-1">
97
+ <option value="" selected="">Select one</option>
98
+ <option value="4dfe21ee-acfa-4fc1-9513-cc764e814205" selected="selected">Academy for Justice Commissioning</option>
99
+ <option value="b854f170-53c8-4098-bf77-e8ef42f93107">Academy for Social Justice</option>
100
+ <option value="ce357bdb-6396-426a-9f1f-8cbfb444cffd">Academy for Social Justice Commissioning</option>
101
+ <option value="a0f338c5-e94c-42f8-9c26-b9c2eb6850d3">Accelerated Access Review</option>
102
+ <option value="92bbe2da-8d5f-480b-8da1-50b18e317654">Accelerated Capability Environment</option>
103
+ </select>
104
+ </div>
105
+ destroy_checkbox: >
106
+ <div class="govuk-checkboxes" data-module="govuk-checkboxes">
107
+ <div class="govuk-checkboxes__item">
108
+ <input type="checkbox" name="organisations[0][_destroy]" id="organisation_0__destroy" class="govuk-checkboxes__input">
109
+ <label for="organisation_0__destroy" class="govuk-label govuk-checkboxes__label">Delete</label>
110
+ </div>
111
+ </div>
112
+ empty:
113
+ <div class="govuk-form-group">
114
+ <label for="organisations_2">Select Organisation 2</label>
115
+ <select name="organisations[1][id]" id="organisations_2" class="govuk-select" tabindex="-1" data-module="select-with-search">
116
+ <option value="" selected="">Select one</option>
117
+ <option value="4dfe21ee-acfa-4fc1-9513-cc764e814205">Academy for Justice Commissioning</option>
118
+ <option value="b854f170-53c8-4098-bf77-e8ef42f93107">Academy for Social Justice</option>
119
+ <option value="ce357bdb-6396-426a-9f1f-8cbfb444cffd">Academy for Social Justice Commissioning</option>
120
+ <option value="a0f338c5-e94c-42f8-9c26-b9c2eb6850d3">Accelerated Access Review</option>
121
+ <option value="92bbe2da-8d5f-480b-8da1-50b18e317654">Accelerated Capability Environment</option>
122
+ </select>
123
+ <div class="govuk-form-group">
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "59.2.0".freeze
2
+ VERSION = "59.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 59.2.0
4
+ version: 59.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev