Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5.0.0 #456

Merged
merged 75 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
983acfc
Add the new task list component
peteryates Aug 23, 2023
985cd70
Register the govuk_task_list helper
peteryates Aug 23, 2023
5872342
Add sample task list styles
peteryates Aug 23, 2023
98982db
Add guide page for the task list
peteryates Aug 23, 2023
44af816
Merge branch 'main' into add-task-list-component
frankieroberto Oct 26, 2023
509dc64
Update to use govuk-frontend v5
frankieroberto Oct 26, 2023
f50bab1
Update script
frankieroberto Oct 26, 2023
983a54b
Fix path
frankieroberto Oct 26, 2023
8193e01
Update script tag
frankieroberto Oct 26, 2023
5535296
Remove extra line break
frankieroberto Oct 26, 2023
8f8ae18
Update tags: capitalisation and new colour (light-blue)
frankieroberto Oct 26, 2023
7091dd5
Update class name of visually hidden text in warning component
frankieroberto Oct 26, 2023
1923443
Remove data-module from details
frankieroberto Oct 26, 2023
266d106
Remove crown fallback image
frankieroberto Oct 26, 2023
d156652
Remove disabled option from govuk_button_to
frankieroberto Oct 26, 2023
89bd24f
Update default aria label for pagination
frankieroberto Oct 26, 2023
4b77b60
Set supported Rails versions to 7.0.8 and 7.1.0
peteryates Oct 8, 2023
08f2cc5
Merge branch 'govuk-frontend-v5' into add-task-list-component
frankieroberto Oct 27, 2023
aac8008
Remove temporary css
frankieroberto Oct 27, 2023
627ae80
Simplify task list to not assume a tag in status
frankieroberto Oct 27, 2023
1e37f31
Use tag helper within tests
frankieroberto Oct 27, 2023
3ae6c35
Fix test
frankieroberto Oct 27, 2023
3efc941
Allow plain text statuses in the task list
peteryates Oct 27, 2023
257b497
Make task list statuses more flexible
peteryates Oct 27, 2023
a55bd88
Simplify class names
peteryates Oct 28, 2023
9386dc7
Add a hints example to the guide
peteryates Oct 28, 2023
2b699a6
Improve task list when hints/links missing
peteryates Oct 29, 2023
2bf5a18
Add aria-describedby links on title, status and hint
peteryates Oct 29, 2023
3ec2330
Remove aria attribute from div
frankieroberto Oct 30, 2023
7e6b039
Set the item id numbers sequentially
peteryates Oct 30, 2023
fa72072
Set a default id prefix for task lists
frankieroberto Oct 31, 2023
1169bcb
Update the docs a bit
frankieroberto Oct 31, 2023
fbf5ef8
Update docs
frankieroberto Oct 31, 2023
7fed473
Use slim syntax
frankieroberto Oct 31, 2023
f6cf2a7
Add example using custom classes and attributes
frankieroberto Oct 31, 2023
262f8c0
Trim multiple trailing lines
frankieroberto Oct 31, 2023
342eb42
Add task list component to the list in the README
peteryates Nov 2, 2023
b95a714
Update to second prerelease
frankieroberto Nov 3, 2023
40b2745
Add task list component (#445)
peteryates Nov 3, 2023
5287df1
Set supported Rails versions to 7.0.8 and 7.1.0 (#454)
frankieroberto Nov 24, 2023
09f5f7d
Merge branch 'main' into govuk-frontend-v5
peteryates Nov 26, 2023
8823090
Split out extract_button_link_args
peteryates Nov 26, 2023
04d38d6
Rework and simplify the link and button helpers
peteryates Nov 26, 2023
b71c4da
Update to use new combined logo svg
frankieroberto Nov 27, 2023
4ac9253
Remove the X-UA-Compatible meta tag
frankieroberto Nov 27, 2023
1e4f717
remove whitespace
frankieroberto Nov 27, 2023
5317863
Update to use new combined logo svg (#466)
frankieroberto Nov 27, 2023
f2de10d
Add GovukVisuallyHiddenHelper
peteryates Nov 27, 2023
ae8e273
Support inserting visually hidden text into links
peteryates Nov 27, 2023
5722bb0
Move the spaces inside the visually hidden span
peteryates Nov 27, 2023
c96c555
Add ARIA label to SVG title
frankieroberto Nov 28, 2023
5beb68a
Add docs on adding visually hidden text to links
peteryates Nov 28, 2023
e8a11a7
Move aria label
frankieroberto Nov 28, 2023
aa77c40
Add docs covering visually hidden helper standalone
peteryates Nov 28, 2023
f01217d
Add visually hidden prefix and suffix text to links and buttons (#465)
peteryates Nov 28, 2023
fd18679
Release version 5.0.0b1
peteryates Nov 28, 2023
67d716a
Fix module name in include
frankieroberto Nov 28, 2023
ad9521d
Add a basic test for govuk_visually_hidden
frankieroberto Nov 28, 2023
7d3bdb9
Drop focusable option from govuk_visually_hidden
frankieroberto Nov 29, 2023
475443d
Remove example from guide
frankieroberto Nov 29, 2023
94808a1
Remove argument from method definition
frankieroberto Nov 29, 2023
7f4965f
Drop focusable option from govuk_visually_hidden (#473)
frankieroberto Nov 29, 2023
a1bd5ee
Delete govuk-mask-icon.svg
frankieroberto Nov 29, 2023
5fa597d
Delete govuk-mask-icon.svg (#474)
frankieroberto Nov 29, 2023
85eeb17
Release version 5.0.0b2
peteryates Nov 29, 2023
98c0e6e
Refactor to allow blocks to be used in ERb
frankieroberto Nov 29, 2023
80c9528
Code style fix: add line break after guard clause
frankieroberto Nov 29, 2023
e4a6ab1
Refactor to allow blocks to be used in ERb (#475)
frankieroberto Nov 29, 2023
3151c54
Release version 5.0.0b3
peteryates Nov 29, 2023
b1a98c2
Fix block syntax for buttons
frankieroberto Nov 29, 2023
b29f7a9
Bump version
frankieroberto Nov 29, 2023
3bcf531
code style fix
frankieroberto Nov 29, 2023
1691036
Fix spelling of compatible
peteryates Nov 29, 2023
ab2d258
Fix spelling of compatible (#476)
peteryates Nov 29, 2023
a70be3e
Use released version
frankieroberto Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/govuk_component/details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(summary_text: nil, text: nil, classes: [], id: nil, open: nil, ht
end

def call
tag.details(data: { module: "#{brand}-details" }, id: id, open: open, **html_attributes) do
tag.details(id: id, open: open, **html_attributes) do
safe_join([summary, description])
end
end
Expand Down
6 changes: 0 additions & 6 deletions app/components/govuk_component/header_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
<!--<![endif]-->
<% end %>

<% if crown_fallback_image_path.present? %>
<!--[if IE 8]>
<%= image_tag(crown_fallback_image_path, **crown_fallback_image_attributes) %>
<![endif]-->
<% end %>

<%= tag.span(logotype, class: "#{brand}-header__logotype-text") %>
<% end %>
</span>
Expand Down
11 changes: 0 additions & 11 deletions app/components/govuk_component/header_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class GovukComponent::HeaderComponent < GovukComponent::Base

attr_reader :logotype,
:crown,
:crown_fallback_image_path,
:homepage_url,
:service_name,
:service_url,
Expand All @@ -18,7 +17,6 @@ def initialize(classes: [],
html_attributes: {},
logotype: config.default_header_logotype,
crown: true,
crown_fallback_image_path: nil,
homepage_url: config.default_header_homepage_url,
menu_button_label: config.default_header_menu_button_label,
navigation_classes: [],
Expand All @@ -29,7 +27,6 @@ def initialize(classes: [],

@logotype = logotype
@crown = crown
@crown_fallback_image_path = crown_fallback_image_path
@homepage_url = homepage_url
@service_name = service_name
@service_url = service_url
Expand Down Expand Up @@ -57,14 +54,6 @@ def container_html_attributes
{ class: ["#{brand}-header__container", "#{brand}-width-container"].append(custom_container_classes).compact }
end

def crown_fallback_image_attributes
{
class: "#{brand}-header__logotype-crown-fallback-image",
width: "36",
height: "32",
}
end

class NavigationItem < GovukComponent::Base
attr_reader :text, :href, :options, :active

Expand Down
2 changes: 1 addition & 1 deletion app/components/govuk_component/tag_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class GovukComponent::TagComponent < GovukComponent::Base
attr_reader :text, :colour

COLOURS = %w(grey green turquoise blue red purple pink orange yellow).freeze
COLOURS = %w(grey green turquoise blue light-blue red purple pink orange yellow).freeze
frankieroberto marked this conversation as resolved.
Show resolved Hide resolved

def initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {})
@text = text
Expand Down
6 changes: 3 additions & 3 deletions app/components/govuk_component/warning_text_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def icon_element

def warning_text
tag.strong(class: "#{brand}-warning-text__text") do
safe_join([assistive, (content || text)])
safe_join([visually_hidden_text, (content || text)])
end
end

def assistive
tag.span(icon_fallback_text, class: "#{brand}-warning-text__assistive")
def visually_hidden_text
tag.span(icon_fallback_text, class: "#{brand}-visually-hidden")
end

def default_attributes
Expand Down
1 change: 0 additions & 1 deletion app/helpers/govuk_link_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def link_styles

def button_styles
{
disabled: "#{brand}-button--disabled",
secondary: "#{brand}-button--secondary",
warning: "#{brand}-button--warning",
inverse: "#{brand}-button--inverse",
Expand Down
14 changes: 7 additions & 7 deletions guide/content/assets/images/govuk-mask-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion guide/content/components/start-button.slim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ p
span.govuk-warning-text__icon aria-hidden="true"
| !
strong.govuk-warning-text__text
span.govuk-warning-text__assistive Warning
span.govuk-visually-hidden Warning
| The GOV.UK Design system
=< link_to("advises against submitting data with a start button", "https://design-system.service.gov.uk/components/button/#start-buttons").html_safe

Expand Down
8 changes: 1 addition & 7 deletions guide/content/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $govuk-font-family: system-ui, sans-serif;
$govuk-brand-colour: #28a;

// Import GOV.UK Frontend
@import "govuk/all";
@import "dist/govuk/all";

// Application components
@import "components/breadcrumbs";
Expand Down Expand Up @@ -90,12 +90,6 @@ $govuk-inverse-button-shadow-colour: govuk-shade($govuk-inverse-button-text-colo
color: $govuk-inverse-button-text-colour;
}

@include _govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-inverse-button-text-colour;
}
}

&:hover {
background-color: $govuk-inverse-button-hover-colour;

Expand Down
7 changes: 4 additions & 3 deletions guide/layouts/example.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ html.govuk-template lang="en"
main#main-content
== yield

script src="/javascripts/govuk-frontend.js"
script
| window.GOVUKFrontend.initAll() ;
script type="module" src="/javascripts/govuk-frontend.min.js"
script type="module"
| import { initAll } from '{path-to-javascript}/govuk-frontend.min.js'
| initAll() ;
7 changes: 4 additions & 3 deletions guide/layouts/partials/footer.slim
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ footer.govuk-footer role="contentinfo"
.govuk-footer__meta-item
| © X-GOVUK

script src="/javascripts/govuk-frontend.js"
script
| window.GOVUKFrontend.initAll() ;
script type="module" src="/javascripts/govuk-frontend.min.js"
script type="module"
| import { initAll } from '/javascripts/govuk-frontend.min.js';
| initAll() ;
2 changes: 1 addition & 1 deletion guide/layouts/partials/header.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
script
| document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
| document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

a.govuk-skip-link href="#main-content"
| Skip to main content
Expand Down
4 changes: 2 additions & 2 deletions guide/lib/examples/tag_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def tag_normal

def tag_colours
<<~TAG
- %w(grey green turquoise blue red purple pink orange yellow).each do |colour|
= govuk_tag(text: colour, colour: colour)
- %w(Grey Green Turquoise Blue Light-blue Red Purple Pink Orange Yellow).each do |colour|
= govuk_tag(text: colour, colour: colour.downcase)
TAG
end
end
Expand Down
26 changes: 19 additions & 7 deletions guide/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions guide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"lib": "lib"
},
"scripts": {
"postinstall": "cp -R node_modules/govuk-frontend/govuk/assets/images content/assets && cp node_modules/govuk-frontend/govuk/all.js content/javascripts/govuk-frontend.js",
"postinstall": "cp -R node_modules/govuk-frontend/dist/govuk/assets/images content/assets && cp node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js content/javascripts/govuk-frontend.min.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"govuk-frontend": "^4.7.0",
"govuk-frontend": "5.0.0-beta.0",
"sass": "^1.52.1"
}
}
4 changes: 2 additions & 2 deletions lib/govuk/components/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def reset!
# +:default_footer_meta_text+ nil
# +:default_footer_copyright_text+ '© Crown copyright'
# +:default_footer_copyright_url+ "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
# +:default_pagination_landmark_label+ "results"
# +:default_pagination_landmark_label+ "Pagination"
# +:default_pagination_next_text+ Default 'next' text for pagination. An +Array+ where the first item is visible and the second visually hidden. Defaults to ["Next", "page"]
# +:default_pagination_previous_text+ Default 'previous' text for pagination. An +Array+ where the first item is visible and the second visually hidden. Defaults to ["Previous", "page"]
# +:default_phase_banner_tag+ nil
Expand Down Expand Up @@ -96,7 +96,7 @@ def reset!
default_footer_meta_text: nil,
default_footer_copyright_text: '© Crown copyright',
default_footer_copyright_url: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/",
default_pagination_landmark_label: "results",
default_pagination_landmark_label: "Pagination",
default_pagination_next_text: %w(Next page),
default_pagination_previous_text: %w(Previous page),
default_phase_banner_tag: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
subject! { render_inline(GovukComponent::WarningTextComponent.new(**kwargs)) }

specify "renders the warning text with overridden icon fallback text" do
expect(rendered_content).to have_tag("span", text: overridden_fallback_text, with: { class: "govuk-warning-text__assistive" })
expect(rendered_content).to have_tag("span", text: overridden_fallback_text, with: { class: "govuk-visually-hidden" })
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/components/govuk_component/details_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
before { render_inline(described_class.new(**kwargs)) }

specify 'contains a details element with the correct summary and text' do
expect(rendered_content).to have_tag('details', with: { class: 'govuk-details', 'data-module' => 'govuk-details' }) do
expect(rendered_content).to have_tag('details', with: { class: 'govuk-details' }) do
with_tag('summary', with: { class: 'govuk-details__summary' }) do
with_tag('span', with: { class: 'govuk-details__summary-text' }, text: summary_text)
end
Expand Down Expand Up @@ -53,7 +53,7 @@
end

specify 'contains a details element with the correct summary and text' do
expect(rendered_content).to have_tag('details', with: { class: 'govuk-details', 'data-module' => 'govuk-details' }) do
expect(rendered_content).to have_tag('details', with: { class: 'govuk-details' }) do
with_tag('summary', with: { class: 'govuk-details__summary' }) do
with_tag('span', with: { class: 'govuk-details__summary-text' }, text: summary_text)
end
Expand Down
13 changes: 0 additions & 13 deletions spec/components/govuk_component/header_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@
with_tag('svg', with: { class: 'govuk-header__logotype-crown', 'aria-hidden' => true })
end
end

context 'when a fallback image path is provided' do
let(:custom_path) { '/an-alternative-crown-file.jpg' }
let(:kwargs) { { crown_fallback_image_path: custom_path } }

specify 'renders the fallback image with the custom path' do
expect(rendered_content).to have_tag('.govuk-header__logotype') do |logotype|
# NOTE: it's rendered inside a IE8 conditional comment so we can't
# assert its presence normally, just ensure the path's included
expect(logotype.current_scope.inner_html).to include(custom_path)
end
end
end
end

context 'when the crown is disabled' do
Expand Down
4 changes: 2 additions & 2 deletions spec/components/govuk_component/pagination_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
expect(rendered_content).not_to have_tag("nav", with: { class: %w(govuk-pagination--block) })
end

specify "renders a default landmark label of 'results'" do
expect(rendered_content).to have_tag("nav", with: { "aria-label" => "results" })
specify "renders a default landmark label of 'Pagination'" do
expect(rendered_content).to have_tag("nav", with: { "aria-label" => "Pagination" })
end

specify "renders a previous link" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
specify 'the default assistive text is included' do
expect(rendered_content).to have_tag(component_css_class_matcher) do
with_tag('strong', with: { class: 'govuk-warning-text__text' }) do
with_tag('span', text: 'Warning', with: { class: 'govuk-warning-text__assistive' })
with_tag('span', text: 'Warning', with: { class: 'govuk-visually-hidden' })
end
end
end
Expand All @@ -32,7 +32,7 @@
specify 'the custom assistive text is included' do
expect(rendered_content).to have_tag('div', class: component_css_class) do
with_tag('strong', with: { class: 'govuk-warning-text__text' }) do
with_tag('span', text: custom_icon_fallback_text, with: { class: 'govuk-warning-text__assistive' })
with_tag('span', text: custom_icon_fallback_text, with: { class: 'govuk-visually-hidden' })
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"govuk-frontend": "^4.0.0",
"govuk-frontend": "5.0.0-beta.0",
"prismjs": "^1.27.0"
}
}
Loading