govuk_publishing_components 70.2.0 → 70.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: d1a6d5f7de8f25961e21640cb7b451099f2c1d5cf7b885b189a6c7f1db6229dd
4
- data.tar.gz: 319ae2c442a8165da752b22f7572c8efe3c14d35d9243cf6f76a4c238be8b538
3
+ metadata.gz: c7b177c9da6fb435cb1e67132c22ed5d934c3c4d1195ebbbad43f4bdf840db6b
4
+ data.tar.gz: b1e988e6f1af0ea310b5aee90fa639e7eab8f1081369224569185649d0564948
5
5
  SHA512:
6
- metadata.gz: 0ca7d6d4464fc5d4e604619e44f7c4e0cb8c579e12caa9c0d1b15ecc8adf712fc72677244f6253ff43dc60e36c8ddcc0a0ff3e20630d80ccf1eac771d824133e
7
- data.tar.gz: 8cabc09cbdbe57bdf87a68b141a58e9a199cfc47a6ed844c296a862214392a52444bb5a1c28aab06103250caf50d27c11d0524afdaa5a424527150d513f55f23
6
+ metadata.gz: 6d64abc0c3978040d42a6050dd242715afc67d72c1f23029a40a872c66949ece8dfcca0c5326f842ae9768121cc9c4203bd2694b5a0d667a866b4a16f730c9a6
7
+ data.tar.gz: 6e8a95eb759c7fad99b61bca15d2f889a181f0152dbb7e1c0911e4a720eaac5f38655105645f91574e856f8bb735701f98cfa4bd251bbb29a72d605f7fd82782
@@ -10,8 +10,8 @@
10
10
  // e.g. 1990/01/01 or 1990-01-01 or 1990-1-1 or 1990/1/1 or 1990\1\1 or 1990\01\01
11
11
  var DATE_PATTERN_NUMERIC_2 = /\d{4}([-\/\\])\d{1,2}([-\/\\])\d{1,2}/g // eslint-disable-line no-useless-escape
12
12
 
13
- // e.g. 12345678 (This originated from the UA PII Remover)
14
- var DATE_PATTERN_NUMERIC_3 = /[0-9]{8}/g
13
+ // e.g. Matches 8 digit date strings in either DDMMYYYY or YYYYMMDD format, constrained to years between 1900 and 2099.
14
+ const DATE_PATTERN_NUMERIC_3 = /\b(?:(?:0[1-9]|[12]\d|3[01])(?:0[1-9]|1[0-2])(?:19|20)\d{2}|(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01]))\b/g
15
15
 
16
16
  // e.g. 1(st) (of) Jan(uary) 1990 (or 90 or '90) - where the bracketed characters are optional parts that can be matched
17
17
  var DATE_PATTERN_STRING_1 = /\d{1,2}(?:st|nd|rd|th)?\s(?:of\s)?(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t)?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:')?(\d{4}|\d{2})/gi
@@ -33,7 +33,7 @@
33
33
 
34
34
  // 2 valid letters - optional +/space - 6 digits with optional +/spaces every 2 digits (to account for '12 34 56') - optional +/space - 1 valid letter. Case insensitive.
35
35
  // e.g. 'AB123456A', 'AB 12 34 56 A', 'ab 123456 a', 'ab 12 34 56 a', 'AB+12+34+56+A'
36
- var NATIONAL_INSURANCE_NUMBER = /[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]/gi
36
+ var NATIONAL_INSURANCE_NUMBER = /\b[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]\b/gi
37
37
 
38
38
  function shouldStripDates () {
39
39
  var metas = document.querySelectorAll('meta[name="govuk:ga4-strip-dates"]')
@@ -1,7 +1,6 @@
1
1
  module GovukPublishingComponents
2
2
  class ComponentGuideController < GovukPublishingComponents::ApplicationController
3
3
  append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.component_directory_name).to_s
4
- append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name).to_s
5
4
 
6
5
  MATCH_COMPONENTS = /(?<=govuk_publishing_components\/components\/)[\/a-zA-Z_-]+(?=['"])/
7
6
 
@@ -14,45 +13,29 @@ module GovukPublishingComponents
14
13
  @unused_components = unused_components_names.get_component_docs
15
14
  @components_in_use_sass = components_in_use_sass
16
15
  @components_in_use_js = components_in_use_js
17
- @flexible_section_docs = flexible_section_docs.all
18
16
  end
19
17
 
20
18
  def show
21
- if params[:flexible_section]
22
- @component_doc = flexible_section_docs.get(params[:flexible_section])
23
- @example_path = flexible_section_example_path(@component_doc.id, "default")
24
- @preview_path = flexible_section_preview_path(@component_doc.id, "default")
25
- @preview_all_path = flexible_section_preview_all_path(@component_doc.id)
26
-
27
- @guide_breadcrumbs = [index_breadcrumb, flexible_section_breadcrumb(@component_doc)]
28
- else
29
- @component_doc = component_docs.get(params[:component])
30
- @example_path = component_example_path(@component_doc.id, "default")
31
- @preview_path = component_preview_path(@component_doc.id, "default")
32
- @preview_all_path = component_preview_all_path(@component_doc.id)
33
-
34
- @guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
35
- end
19
+ @component_doc = component_docs.get(params[:component])
20
+ @guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
36
21
  end
37
22
 
38
23
  def example
39
- @component_doc = params[:flexible_section] ? flexible_section_docs.get(params[:flexible_section]) : component_docs.get(params[:component])
24
+ @component_doc = component_docs.get(params[:component])
40
25
  @component_example = @component_doc.examples.find { |f| f.id == params[:example] }
41
26
 
42
- @guide_breadcrumbs = [index_breadcrumb]
43
- if params[:flexible_section]
44
- @preview_path = flexible_section_preview_path(@component_doc.id, @component_example.id)
45
- @guide_breadcrumbs << flexible_section_breadcrumb(@component_doc, @component_example)
46
- else
47
- @preview_path = component_preview_path(@component_doc.id, @component_example.id)
48
- @guide_breadcrumbs << component_breadcrumb(@component_doc, @component_example)
49
- end
50
- @guide_breadcrumbs << { title: @component_example.name }
27
+ @guide_breadcrumbs = [
28
+ index_breadcrumb,
29
+ component_breadcrumb(@component_doc, @component_example),
30
+ {
31
+ title: @component_example.name,
32
+ },
33
+ ]
51
34
  end
52
35
 
53
36
  def preview
54
37
  @component_examples = []
55
- @component_doc = params[:flexible_section] ? flexible_section_docs.get(params[:flexible_section]) : component_docs.get(params[:component])
38
+ @component_doc = component_docs.get(params[:component])
56
39
  @preview = true
57
40
 
58
41
  if params[:example].present?
@@ -91,10 +74,6 @@ module GovukPublishingComponents
91
74
  @gem_component_docs ||= ComponentDocs.new(gem_components: true)
92
75
  end
93
76
 
94
- def flexible_section_docs
95
- @flexible_section_docs ||= ComponentDocs.new(flexible_sections: true)
96
- end
97
-
98
77
  def used_components_names
99
78
  @used_components_names ||= ComponentDocs.new(gem_components: true, limit_to: get_used_component_names)
100
79
  end
@@ -188,12 +167,5 @@ module GovukPublishingComponents
188
167
  h[:url] = component_doc_path(component_doc.id) if component_example
189
168
  end
190
169
  end
191
-
192
- def flexible_section_breadcrumb(component_doc, component_example = nil)
193
- {}.tap do |h|
194
- h[:title] = "#{component_doc.name} (flexible section)"
195
- h[:url] = flexible_section_doc_path(component_doc.id) if component_example
196
- end
197
- end
198
170
  end
199
171
  end
@@ -7,10 +7,9 @@ module GovukPublishingComponents
7
7
  :component,
8
8
  :accessibility_excluded_rules,
9
9
  :source,
10
- :embed,
11
- :type
10
+ :embed
12
11
 
13
- def initialize(component, type)
12
+ def initialize(component)
14
13
  @component = component
15
14
  @id = component[:id]
16
15
  @name = component[:name]
@@ -19,7 +18,6 @@ module GovukPublishingComponents
19
18
  @accessibility_excluded_rules = component[:accessibility_excluded_rules]
20
19
  @source = component[:source]
21
20
  @embed = component[:embed]
22
- @type = type
23
21
  end
24
22
 
25
23
  def accessibility_criteria
@@ -90,8 +88,6 @@ module GovukPublishingComponents
90
88
  def partial_path
91
89
  if source == "gem"
92
90
  "govuk_publishing_components/components/#{id}"
93
- elsif type == "flexible section"
94
- "#{GovukPublishingComponents::Config.flexible_sections_directory_name}/#{id}"
95
91
  else
96
92
  "#{GovukPublishingComponents::Config.component_directory_name}/#{id}"
97
93
  end
@@ -1,11 +1,9 @@
1
1
  module GovukPublishingComponents
2
2
  # @private
3
3
  class ComponentDocs
4
- def initialize(gem_components: false, limit_to: false, flexible_sections: false)
4
+ def initialize(gem_components: false, limit_to: false)
5
5
  @limit_to = limit_to
6
6
  @documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory
7
- @documentation_directory = flexible_sections_documentation_directory if flexible_sections
8
- @type = flexible_sections ? "flexible section" : "component"
9
7
  end
10
8
 
11
9
  def get(id)
@@ -24,7 +22,7 @@ module GovukPublishingComponents
24
22
  private
25
23
 
26
24
  def build(component)
27
- ComponentDoc.new(component, @type)
25
+ ComponentDoc.new(component)
28
26
  end
29
27
 
30
28
  def fetch_component_doc_files
@@ -58,9 +56,5 @@ module GovukPublishingComponents
58
56
  def gem_documentation_directory
59
57
  Pathname.new(GovukPublishingComponents::Config.gem_directory).join("app", "views", "govuk_publishing_components", "components", "docs")
60
58
  end
61
-
62
- def flexible_sections_documentation_directory
63
- Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name, "docs")
64
- end
65
59
  end
66
60
  end
@@ -5,11 +5,7 @@
5
5
  <ul class="govuk-list govuk-list--bullet govuk-list--spaced">
6
6
  <% local_assigns[:components].each do |component_doc| %>
7
7
  <li data-filter-item data-filter-item-search-terms="<%= component_doc.id %>">
8
- <% if local_assigns[:type] == "flexible_section" %>
9
- <%= link_to component_doc.name, flexible_section_doc_path(component_doc.id), class: "govuk-link" %>
10
- <% else %>
11
- <%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
12
- <% end %>
8
+ <%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
13
9
  <p class="govuk-body">
14
10
  <%= component_doc.description %>
15
11
  </p>
@@ -1,19 +1,11 @@
1
1
  <% content_for :body_classes, "gem-full-width__container", flush: true %>
2
- <%
3
- if @component_doc.type == "component"
4
- data = example.html_safe_data
5
- else
6
- flexible_section_class = "FlexiblePage::FlexibleSection::#{@component_doc.id.titleize.gsub(" ", "")}".constantize
7
- data = { flexible_section: flexible_section_class.new(**example.html_safe_data.deep_symbolize_keys)}
8
- end
9
- %>
10
2
  <% component = capture do %>
11
3
  <% if example.has_block? %>
12
- <%= render component_doc.partial_path, data do %>
4
+ <%= render component_doc.partial_path, example.html_safe_data do %>
13
5
  <%= render inline: example.block %>
14
6
  <% end %>
15
7
  <% else %>
16
- <%= render component_doc.partial_path, data %>
8
+ <%= render component_doc.partial_path, example.html_safe_data %>
17
9
  <% end %>
18
10
  <% end %>
19
11
 
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
  <h2 class="govuk-heading-m">
26
26
  How it looks
27
- <small class="govuk-!-font-size-16">(<a href="<%= @preview_path %>" class="govuk-link">preview</a>)</small>
27
+ <small class="govuk-!-font-size-16">(<a href="<%= component_preview_path(@component_doc.id, @component_example.id) %>" class="govuk-link">preview</a>)</small>
28
28
  </h2>
29
29
  <%= render partial: "govuk_publishing_components/component_guide/component_doc/preview", locals: { component_doc: @component_doc, example: @component_example } %>
30
30
 
@@ -18,13 +18,6 @@
18
18
 
19
19
  <div data-module="filter-list" data-filter-label="Search components">
20
20
  <% if !ENV["MAIN_COMPONENT_GUIDE"] %>
21
- <%= render partial: "component_list", locals: {
22
- heading: "Flexible sections in this application",
23
- size: @flexible_section_docs.length,
24
- components: @flexible_section_docs,
25
- type: "flexible_section",
26
- } %>
27
-
28
21
  <%= render partial: "component_list", locals: {
29
22
  heading: "Components in this application",
30
23
  size: @component_docs.length,
@@ -5,17 +5,9 @@
5
5
  <% end %>
6
6
 
7
7
  <% @component_examples.each do |example| %>
8
- <%
9
- if @component_doc.type == "component"
10
- example_path = component_example_path(@component_doc.id, example.id)
11
- else
12
- example_path = flexible_section_example_path(@component_doc.id, example.id)
13
- end
14
- %>
15
-
16
8
  <div class="component-guide-preview-page">
17
9
  <% if @component_examples.length > 1 %>
18
- <h2 class="preview-title"><a href="<%= example_path %>"><%= example.name %></a></h2>
10
+ <h2 class="preview-title"><a href="<%= component_example_path(@component_doc.id, example.id) %>"><%= example.name %></a></h2>
19
11
  <% end %>
20
12
  <div data-module="test-a11y" data-excluded-rules="<%= @component_doc.accessibility_excluded_rules %>">
21
13
  <%= render "govuk_publishing_components/component_guide/component_doc/component", component_doc: @component_doc, example: example, preview_page: true %>
@@ -1,4 +1,4 @@
1
- <% content_for :title, "#{@component_doc.name} #{@component_doc.type}" %>
1
+ <% content_for :title, "#{@component_doc.name} component" %>
2
2
 
3
3
  <% content_for :application_stylesheet do %>
4
4
  <% if @component_doc.source == "application" %>
@@ -8,7 +8,7 @@
8
8
 
9
9
  <%= render "govuk_publishing_components/components/heading", {
10
10
  text: @component_doc.name,
11
- context: @component_doc.type.capitalize,
11
+ context: "Component",
12
12
  heading_level: 1,
13
13
  font_size: "xl",
14
14
  margin_bottom: 8,
@@ -31,9 +31,7 @@
31
31
  </div>
32
32
  </div>
33
33
  <% end %>
34
- <% if @component_doc.type == "component" %>
35
- <p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %>.</p>
36
- <% end %>
34
+ <p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %>.</p>
37
35
  </div>
38
36
  </div>
39
37
 
@@ -56,7 +54,7 @@
56
54
  text: "Overview",
57
55
  items: [
58
56
  ({ href: "#how-it-looks", text: "How it looks" } if @component_doc.display_preview? || @component_doc.display_html?),
59
- { href: "#how-to-call-this-component", text: @component_doc.type == "component" ? "How to call this component" : "Passing data to this flexible section" },
57
+ { href: "#how-to-call-this-component", text: "How to call this component" },
60
58
  ({ href: "#govuk-design-system", text: "GOV.UK Design System" } if @component_doc.govuk_frontend_components.any?),
61
59
  ({ href: "#accessibility-acceptance-criteria", text: "Accessibility acceptance criteria" } if @component_doc.accessibility_criteria.present?),
62
60
  ].compact,
@@ -77,21 +75,14 @@
77
75
  <h2 class="govuk-heading-l" id="overview">Overview</h2>
78
76
  <% if @component_doc.display_preview? || @component_doc.display_html? %>
79
77
  <h3 class="govuk-heading-m" id="how-it-looks">
80
- <a href="<%= @example_path %>" class="govuk-link">How it looks</a>
81
- <small class="govuk-!-font-size-16">(<a href="<%= @preview_path %>" class="govuk-link">preview</a>)</small>
82
- <small class="govuk-!-font-size-16">(<a href="<%= @preview_all_path %>" class="govuk-link">preview all</a>)</small>
78
+ <a href="<%= component_example_path(@component_doc.id, "default") %>" class="govuk-link">How it looks</a>
79
+ <small class="govuk-!-font-size-16">(<a href="<%= component_preview_path(@component_doc.id, "default") %>" class="govuk-link">preview</a>)</small>
80
+ <small class="govuk-!-font-size-16">(<a href="<%= component_preview_all_path(@component_doc.id) %>" class="govuk-link">preview all</a>)</small>
83
81
  </h3>
84
82
  <%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: @component_doc.example %>
85
83
  <% end %>
86
84
 
87
- <% if @component_doc.type == "component" %>
88
- <h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">How to call this component</h3>
89
- <% else %>
90
- <h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">Passing data to this flexible section</h3>
91
- <div class="component-markdown component-markdown--no-margin">
92
- <p>Flexible sections are not called in the way shown below, however this information serves as a reference for the data required by this flexible section.</p>
93
- </div>
94
- <% end %>
85
+ <h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">How to call this component</h3>
95
86
  <%= render "govuk_publishing_components/component_guide/component_doc/call", component_doc: @component_doc, example: @component_doc.example %>
96
87
 
97
88
  <% if @component_doc.govuk_frontend_components.any? %>
@@ -139,17 +130,8 @@
139
130
  <% @component_doc.other_examples.each do |example| %>
140
131
  <div class="component-example" id="<%= example.id %>">
141
132
  <h3 class="govuk-heading-m">
142
- <%
143
- if @component_doc.type == "component"
144
- example_path = component_example_path(@component_doc.id, example.id)
145
- preview_path = component_preview_path(@component_doc.id, example.id)
146
- else
147
- example_path = flexible_section_example_path(@component_doc.id, example.id)
148
- preview_path = flexible_section_preview_path(@component_doc.id, example.id)
149
- end
150
- %>
151
- <a href="<%= example_path %>" class="govuk-link"><%= example.name %></a>
152
- <small>(<a href="<%= preview_path %>" class="govuk-link">preview</a>)</small>
133
+ <a href="<%= component_example_path(@component_doc.id, example.id) %>" class="govuk-link"><%= example.name %></a>
134
+ <small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>" class="govuk-link">preview</a>)</small>
153
135
  </h3>
154
136
  <% if example.html_description %>
155
137
  <div class="component-markdown component-markdown--no-margin">
@@ -1,9 +1,8 @@
1
1
  name: Service Navigation
2
- description: Renders a box with a link to sign up for email notifications
2
+ description: Helps users understand that they're using your service and lets them navigate around your service.
3
3
  accessibility_criteria: |
4
4
  - the component must use the correct heading level for the page
5
5
  - text should have a text contrast ratio higher than 4.5:1 against the background colour to meet WCAG AA
6
- - the icon must not be focusable or shown to screenreaders
7
6
  accessibility_excluded_rules:
8
7
  - landmark-unique
9
8
  uses_component_wrapper_helper: true
data/config/routes.rb CHANGED
@@ -2,13 +2,6 @@ GovukPublishingComponents::Engine.routes.draw do
2
2
  get "/audit" => "audit#show", as: :audit
3
3
  get "/applications" => "applications_page#show", as: :apps
4
4
 
5
- scope "/flexible-sections/" do
6
- get ":flexible_section" => "component_guide#show", as: :flexible_section_doc
7
- get ":flexible_section/preview" => "component_guide#preview", as: :flexible_section_preview_all
8
- get ":flexible_section/:example" => "component_guide#example", as: :flexible_section_example
9
- get ":flexible_section/:example/preview" => "component_guide#preview", as: :flexible_section_preview
10
- end
11
-
12
5
  root to: "component_guide#index", as: :component_guide
13
6
  get ":component" => "component_guide#show", as: :component_doc
14
7
  get ":component/preview" => "component_guide#preview", as: :component_preview_all
@@ -25,10 +25,6 @@ module GovukPublishingComponents
25
25
  APP_COMPONENT_DIRECTORY
26
26
  end
27
27
 
28
- def self.flexible_sections_directory_name
29
- "flexible_page/flexible_sections"
30
- end
31
-
32
28
  def self.gem_directory
33
29
  Gem::Specification.find_by_name("govuk_publishing_components").gem_dir
34
30
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "70.2.0".freeze
2
+ VERSION = "70.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: 70.2.0
4
+ version: 70.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -2117,7 +2117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2117
2117
  - !ruby/object:Gem::Version
2118
2118
  version: '0'
2119
2119
  requirements: []
2120
- rubygems_version: 4.0.21
2120
+ rubygems_version: 4.0.22
2121
2121
  specification_version: 4
2122
2122
  summary: A gem to document components in GOV.UK frontend applications
2123
2123
  test_files: []