govuk_publishing_components 64.1.0 → 64.1.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: 5a36e502c34c34ff4f3d4f3c68b2bdc3c73d2e0063e0681113d6fa86419256a1
4
- data.tar.gz: e7687186a40332b5fd8466c08bc37eaf061383053d571873b32efb1b19fe2140
3
+ metadata.gz: 6ce0c3f4602a7fc50dd1f1f38a9d177c256c320842afd37f83260571361c8aef
4
+ data.tar.gz: 851ec585153e68a005871ad0a242130d0e8df04e10902c888750f51186a63410
5
5
  SHA512:
6
- metadata.gz: 4e0e05ae52393e75403160be9fe4243b498d47f9241ef4245d75aad760093c614a9a6c636fa7b256deb1fb785a020f020142df49a06eb79710955689a71ec981
7
- data.tar.gz: 0146075f678ac78ee120d4bc495dc7a2251f93b93fd8c0a04478654f29d185151a97fe906db961ee0e46629cd43186031a4474ab95387fe211beca4432c9d2f4
6
+ metadata.gz: 994f0af2defdd9971a6c22b14e039e9afc801ef18d704527287fc6d355ba1a2d9ea2c898fd1a067992e7a6f289529c8844e4822f8e855b69cfbcdad204dd4ea7
7
+ data.tar.gz: b9b4edbc35f12d6373aca1df522393529da9124a65eb64b8598c120963815be5f405b29dede59ea5a9277123c1d1632e2753ecc9d9b727bcb0a62e5932cc9b3b
@@ -14,3 +14,7 @@ $search-icon-size: 40px;
14
14
  height: govuk-px-to-rem($search-icon-size);
15
15
  background: url("govuk_publishing_components/icon-search.svg") no-repeat -3px center;
16
16
  }
17
+
18
+ .gem-c-input--with-search-icon {
19
+ padding-left: govuk-spacing(6);
20
+ }
@@ -6,60 +6,61 @@
6
6
  component_helper.add_class(cb_helper.css_classes.join(" ")) # cb_helper.css_classes generates "gem-c-checkboxes"
7
7
  component_helper.add_data_attribute({ module: "gem-checkboxes govuk-checkboxes" })
8
8
  %>
9
+ <% if cb_helper.items.any? %>
10
+ <%= tag.div(**component_helper.all_attributes) do %>
11
+ <% if cb_helper.should_have_fieldset %>
12
+ <% if cb_helper.heading_markup %>
13
+ <%= tag.fieldset class: "govuk-fieldset", "aria-describedby": cb_helper.fieldset_describedby do %>
14
+ <%= cb_helper.heading_markup %>
9
15
 
10
- <%= tag.div(**component_helper.all_attributes) do %>
11
- <% if cb_helper.should_have_fieldset %>
12
- <% if cb_helper.heading_markup %>
13
- <%= tag.fieldset class: "govuk-fieldset", "aria-describedby": cb_helper.fieldset_describedby do %>
14
- <%= cb_helper.heading_markup %>
15
-
16
- <% if cb_helper.description %>
17
- <%= tag.div cb_helper.description, class: "govuk-body" %>
18
- <% end %>
16
+ <% if cb_helper.description %>
17
+ <%= tag.div cb_helper.description, class: "govuk-body" %>
18
+ <% end %>
19
19
 
20
- <% if cb_helper.hint_text %>
21
- <%= tag.div cb_helper.hint_text, id: "#{id}-hint", class: "govuk-hint" %>
22
- <% end %>
20
+ <% if cb_helper.hint_text %>
21
+ <%= tag.div cb_helper.hint_text, id: "#{id}-hint", class: "govuk-hint" %>
22
+ <% end %>
23
23
 
24
- <% if cb_helper.error %>
25
- <%= tag.p error, id: "#{id}-error", class: "govuk-error-message" %>
26
- <% end %>
24
+ <% if cb_helper.error %>
25
+ <%= tag.p error, id: "#{id}-error", class: "govuk-error-message" %>
26
+ <% end %>
27
27
 
28
- <%= tag.div class: "govuk-checkboxes", data: {
29
- module: ("govuk-checkboxes" if cb_helper.has_conditional),
30
- nested: ("true" if cb_helper.has_nested),
31
- } do %>
32
- <% cb_helper.items.each_with_index do |item, index| %>
33
- <% if item === :or %>
34
- <%= tag.div t("components.checkboxes.or"), class: "govuk-checkboxes__divider" %>
35
- <% else %>
36
- <%= tag.div class: "govuk-checkboxes__item" do %>
37
- <%= cb_helper.checkbox_markup(item, index) %>
28
+ <%= tag.div class: "govuk-checkboxes", data: {
29
+ module: ("govuk-checkboxes" if cb_helper.has_conditional),
30
+ nested: ("true" if cb_helper.has_nested),
31
+ } do %>
32
+ <% cb_helper.items.each_with_index do |item, index| %>
33
+ <% if item === :or %>
34
+ <%= tag.div t("components.checkboxes.or"), class: "govuk-checkboxes__divider" %>
35
+ <% else %>
36
+ <%= tag.div class: "govuk-checkboxes__item" do %>
37
+ <%= cb_helper.checkbox_markup(item, index) %>
38
38
 
39
- <% if item[:items].present? %>
40
- <%= tag.div id: "#{id}-nested-#{index}", class: "govuk-checkboxes--nested", data: { parent: "#{id}-#{index}" } do %>
41
- <% item[:items].each_with_index do |nested_item, nested_index| %>
42
- <%= tag.div class: "govuk-checkboxes__item" do %>
43
- <%= cb_helper.checkbox_markup(nested_item, "#{index}-#{nested_index}") %>
39
+ <% if item[:items].present? %>
40
+ <%= tag.div id: "#{id}-nested-#{index}", class: "govuk-checkboxes--nested", data: { parent: "#{id}-#{index}" } do %>
41
+ <% item[:items].each_with_index do |nested_item, nested_index| %>
42
+ <%= tag.div class: "govuk-checkboxes__item" do %>
43
+ <%= cb_helper.checkbox_markup(nested_item, "#{index}-#{nested_index}") %>
44
+ <% end %>
44
45
  <% end %>
45
46
  <% end %>
46
47
  <% end %>
47
48
  <% end %>
48
- <% end %>
49
49
 
50
- <% if item[:conditional] %>
51
- <%= tag.div item[:conditional], id: "#{id}-#{index}-conditional-#{index}", class: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" %>
52
- <% end %>
50
+ <% if item[:conditional] %>
51
+ <%= tag.div item[:conditional], id: "#{id}-#{index}-conditional-#{index}", class: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" %>
52
+ <% end %>
53
53
 
54
+ <% end %>
54
55
  <% end %>
55
56
  <% end %>
56
57
  <% end %>
57
58
  <% end %>
58
- <% end %>
59
59
 
60
- <% else %>
61
- <div class="govuk-checkboxes__item">
62
- <%= cb_helper.checkbox_markup(cb_helper.items[0], 0) %>
63
- </div>
60
+ <% else %>
61
+ <div class="govuk-checkboxes__item">
62
+ <%= cb_helper.checkbox_markup(cb_helper.items[0], 0) %>
63
+ </div>
64
+ <% end %>
64
65
  <% end %>
65
66
  <% end %>
@@ -28,13 +28,6 @@ examples:
28
28
  text: "What is the nature of your medical emergency?"
29
29
  name: "emergency-name"
30
30
  textarea_id: "emergency-id"
31
- with_margin_bottom:
32
- description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to a margin bottom of 6 (30px).
33
- data:
34
- margin_bottom: 9
35
- label:
36
- text: "Can you provide more detail?"
37
- name: "more-detail"
38
31
  specific_rows:
39
32
  description: Textarea with 10 rows
40
33
  data:
@@ -64,6 +57,12 @@ examples:
64
57
  href: '#example-error-1'
65
58
  - text: Descriptive link to the question with an error 2
66
59
  href: '#example-error-2'
60
+ with bold_label:
61
+ data:
62
+ label:
63
+ text: "Can you provide more detail?"
64
+ bold: true
65
+ name: "more-detail"
67
66
  with_label_as_page_heading:
68
67
  data:
69
68
  label:
@@ -106,7 +105,6 @@ examples:
106
105
  textarea_id: "contextual-guidance-id"
107
106
  label:
108
107
  text: "Title"
109
- bold: true
110
108
  name: "described"
111
109
  rows: 2
112
110
  describedby: "contextual-guidance"
@@ -17,6 +17,8 @@ module GovukPublishingComponents
17
17
 
18
18
  def initialize(options)
19
19
  @items = options[:items] || []
20
+ return unless @items.any?
21
+
20
22
  @name = options[:name]
21
23
  @css_classes = %w[gem-c-checkboxes govuk-form-group]
22
24
  @css_classes << "govuk-form-group--error" if options[:error]
@@ -24,8 +26,8 @@ module GovukPublishingComponents
24
26
  @error = true if options[:error]
25
27
 
26
28
  # check if any item is set as being conditional
27
- @has_conditional = options[:items].any? { |item| item.is_a?(Hash) && item[:conditional] }
28
- @has_nested = options[:items].any? { |item| item.is_a?(Hash) && item[:items] }
29
+ @has_conditional = @items.any? { |item| item.is_a?(Hash) && item[:conditional] }
30
+ @has_nested = @items.any? { |item| item.is_a?(Hash) && item[:items] }
29
31
 
30
32
  @id = options[:id] || "checkboxes-#{SecureRandom.hex(4)}"
31
33
  @heading = options[:heading] || nil
@@ -41,7 +43,7 @@ module GovukPublishingComponents
41
43
  # should have a fieldset if there's a heading, or if more than one checkbox
42
44
  # separate check is in the view for if more than one checkbox and no heading, in which case fail
43
45
  def should_have_fieldset
44
- @items.length > 1 || @heading
46
+ @items.length > 1 || !@heading.blank? # rubocop:disable Rails/Present
45
47
  end
46
48
 
47
49
  def fieldset_describedby
@@ -91,6 +93,7 @@ module GovukPublishingComponents
91
93
  checked = true if checkbox[:checked].present?
92
94
  data = checkbox[:data_attributes] || {}
93
95
  data[:controls] = controls
96
+ # aria-controls is set as a data attribute then applied properly using JS
94
97
  data["aria-controls"] = aria_controls
95
98
  data[:behaviour] = "exclusive" if checkbox[:exclusive]
96
99
 
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "64.1.0".freeze
2
+ VERSION = "64.1.1".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /**!
2
- * Sortable 1.15.6
2
+ * Sortable 1.15.7
3
3
  * @author RubaXa <trash@rubaxa.org>
4
4
  * @author owenm <owen23355@gmail.com>
5
5
  * @license MIT
@@ -10,131 +10,113 @@
10
10
  (global = global || self, global.Sortable = factory());
11
11
  }(this, (function () { 'use strict';
12
12
 
13
- function ownKeys(object, enumerableOnly) {
14
- var keys = Object.keys(object);
15
- if (Object.getOwnPropertySymbols) {
16
- var symbols = Object.getOwnPropertySymbols(object);
17
- if (enumerableOnly) {
18
- symbols = symbols.filter(function (sym) {
19
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20
- });
21
- }
22
- keys.push.apply(keys, symbols);
23
- }
24
- return keys;
25
- }
26
- function _objectSpread2(target) {
27
- for (var i = 1; i < arguments.length; i++) {
28
- var source = arguments[i] != null ? arguments[i] : {};
29
- if (i % 2) {
30
- ownKeys(Object(source), true).forEach(function (key) {
31
- _defineProperty(target, key, source[key]);
32
- });
33
- } else if (Object.getOwnPropertyDescriptors) {
34
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
35
- } else {
36
- ownKeys(Object(source)).forEach(function (key) {
37
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
38
- });
39
- }
40
- }
41
- return target;
13
+ function _arrayLikeToArray(r, a) {
14
+ (null == a || a > r.length) && (a = r.length);
15
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
16
+ return n;
42
17
  }
43
- function _typeof(obj) {
44
- "@babel/helpers - typeof";
45
-
46
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
47
- _typeof = function (obj) {
48
- return typeof obj;
49
- };
50
- } else {
51
- _typeof = function (obj) {
52
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
53
- };
54
- }
55
- return _typeof(obj);
56
- }
57
- function _defineProperty(obj, key, value) {
58
- if (key in obj) {
59
- Object.defineProperty(obj, key, {
60
- value: value,
61
- enumerable: true,
62
- configurable: true,
63
- writable: true
64
- });
65
- } else {
66
- obj[key] = value;
67
- }
68
- return obj;
18
+ function _arrayWithoutHoles(r) {
19
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
69
20
  }
70
- function _extends() {
71
- _extends = Object.assign || function (target) {
72
- for (var i = 1; i < arguments.length; i++) {
73
- var source = arguments[i];
74
- for (var key in source) {
75
- if (Object.prototype.hasOwnProperty.call(source, key)) {
76
- target[key] = source[key];
77
- }
78
- }
79
- }
80
- return target;
81
- };
82
- return _extends.apply(this, arguments);
83
- }
84
- function _objectWithoutPropertiesLoose(source, excluded) {
85
- if (source == null) return {};
86
- var target = {};
87
- var sourceKeys = Object.keys(source);
88
- var key, i;
89
- for (i = 0; i < sourceKeys.length; i++) {
90
- key = sourceKeys[i];
91
- if (excluded.indexOf(key) >= 0) continue;
92
- target[key] = source[key];
93
- }
94
- return target;
21
+ function _defineProperty(e, r, t) {
22
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
23
+ value: t,
24
+ enumerable: !0,
25
+ configurable: !0,
26
+ writable: !0
27
+ }) : e[r] = t, e;
95
28
  }
96
- function _objectWithoutProperties(source, excluded) {
97
- if (source == null) return {};
98
- var target = _objectWithoutPropertiesLoose(source, excluded);
99
- var key, i;
100
- if (Object.getOwnPropertySymbols) {
101
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
102
- for (i = 0; i < sourceSymbolKeys.length; i++) {
103
- key = sourceSymbolKeys[i];
104
- if (excluded.indexOf(key) >= 0) continue;
105
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
106
- target[key] = source[key];
29
+ function _extends() {
30
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
31
+ for (var e = 1; e < arguments.length; e++) {
32
+ var t = arguments[e];
33
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
107
34
  }
108
- }
109
- return target;
35
+ return n;
36
+ }, _extends.apply(null, arguments);
110
37
  }
111
- function _toConsumableArray(arr) {
112
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
38
+ function _iterableToArray(r) {
39
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
113
40
  }
114
- function _arrayWithoutHoles(arr) {
115
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
41
+ function _nonIterableSpread() {
42
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
116
43
  }
117
- function _iterableToArray(iter) {
118
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
44
+ function ownKeys(e, r) {
45
+ var t = Object.keys(e);
46
+ if (Object.getOwnPropertySymbols) {
47
+ var o = Object.getOwnPropertySymbols(e);
48
+ r && (o = o.filter(function (r) {
49
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
50
+ })), t.push.apply(t, o);
51
+ }
52
+ return t;
53
+ }
54
+ function _objectSpread2(e) {
55
+ for (var r = 1; r < arguments.length; r++) {
56
+ var t = null != arguments[r] ? arguments[r] : {};
57
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
58
+ _defineProperty(e, r, t[r]);
59
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
60
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
61
+ });
62
+ }
63
+ return e;
119
64
  }
120
- function _unsupportedIterableToArray(o, minLen) {
121
- if (!o) return;
122
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
123
- var n = Object.prototype.toString.call(o).slice(8, -1);
124
- if (n === "Object" && o.constructor) n = o.constructor.name;
125
- if (n === "Map" || n === "Set") return Array.from(o);
126
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
65
+ function _objectWithoutProperties(e, t) {
66
+ if (null == e) return {};
67
+ var o,
68
+ r,
69
+ i = _objectWithoutPropertiesLoose(e, t);
70
+ if (Object.getOwnPropertySymbols) {
71
+ var n = Object.getOwnPropertySymbols(e);
72
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
73
+ }
74
+ return i;
75
+ }
76
+ function _objectWithoutPropertiesLoose(r, e) {
77
+ if (null == r) return {};
78
+ var t = {};
79
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
80
+ if (-1 !== e.indexOf(n)) continue;
81
+ t[n] = r[n];
82
+ }
83
+ return t;
84
+ }
85
+ function _toConsumableArray(r) {
86
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
87
+ }
88
+ function _toPrimitive(t, r) {
89
+ if ("object" != typeof t || !t) return t;
90
+ var e = t[Symbol.toPrimitive];
91
+ if (void 0 !== e) {
92
+ var i = e.call(t, r || "default");
93
+ if ("object" != typeof i) return i;
94
+ throw new TypeError("@@toPrimitive must return a primitive value.");
95
+ }
96
+ return ("string" === r ? String : Number)(t);
127
97
  }
128
- function _arrayLikeToArray(arr, len) {
129
- if (len == null || len > arr.length) len = arr.length;
130
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
131
- return arr2;
98
+ function _toPropertyKey(t) {
99
+ var i = _toPrimitive(t, "string");
100
+ return "symbol" == typeof i ? i : i + "";
132
101
  }
133
- function _nonIterableSpread() {
134
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
102
+ function _typeof(o) {
103
+ "@babel/helpers - typeof";
104
+
105
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
106
+ return typeof o;
107
+ } : function (o) {
108
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
109
+ }, _typeof(o);
110
+ }
111
+ function _unsupportedIterableToArray(r, a) {
112
+ if (r) {
113
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
114
+ var t = {}.toString.call(r).slice(8, -1);
115
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
116
+ }
135
117
  }
136
118
 
137
- var version = "1.15.6";
119
+ var version = "1.15.7";
138
120
 
139
121
  function userAgent(pattern) {
140
122
  if (typeof window !== 'undefined' && window.navigator) {
@@ -177,7 +159,7 @@
177
159
  return false;
178
160
  }
179
161
  function getParentOrHost(el) {
180
- return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
162
+ return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
181
163
  }
182
164
  function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
183
165
  if (el) {
@@ -2061,8 +2043,11 @@
2061
2043
  _nulling: function _nulling() {
2062
2044
  pluginEvent('nulling', this);
2063
2045
  rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
2064
- savedInputChecked.forEach(function (el) {
2065
- el.checked = true;
2046
+ var el = this.el;
2047
+ savedInputChecked.forEach(function (checkEl) {
2048
+ if (el.contains(checkEl)) {
2049
+ checkEl.checked = true;
2050
+ }
2066
2051
  });
2067
2052
  savedInputChecked.length = lastDx = lastDy = 0;
2068
2053
  },