design_system 0.16.0 → 0.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86b229cbfe82c0d8b0b7d9c88dfeec1b5993a5524ad04fa4b6f5baaa7507d269
4
- data.tar.gz: 2b33b73ffabdd0381e2842f3d3f645476563698fec7b912e0d4e67a65d35dfd9
3
+ metadata.gz: cb797f5d8de4db2fa7a4b83c6d451a2b24b3cbb0abf6268e5ab5fa6c689c6622
4
+ data.tar.gz: 261263af1a12f6ca8de4fd08344922e302550d4f955b67e302111df125a03f7f
5
5
  SHA512:
6
- metadata.gz: 7da95f367410b3780f36f11a6de15d028b82b1a410b4ce83aa63cc58ccd3a5dd965c6bae1b3eb0ade6308c8dfa2dfce577afa569bef90f01f04d455e262b45a9
7
- data.tar.gz: 0c70a3bafd6638771780d1d098beff10eec4f63bfa8983a8cde25964c0a7940e6ca48f2255491d0f37d3de5d6380b9514be95adfe465c5e1e3a005192f7c9edd
6
+ metadata.gz: 015b3c2907397ff7c1f25efd042ef04e6859c774e84e71030e76e32391f67de6ef58832286101231cc89e77283850e4af0fa10eca42b102ee3e219bc76696ac5
7
+ data.tar.gz: 58c317d53b129d0b3e5185979b4fe05fd00e41a1a05df2bf0595ec5d88830e7a78b6ead981af6f1f9af308e29ae05ef9fdb8f02eac0e295a41fcb4be67417bfb
@@ -1,6 +1,6 @@
1
1
  <div class="<%= brand %>-card">
2
2
  <div class="<%= brand %>-card__heading-container">
3
- <%= ds_heading(title, class: "#{brand}-card__heading #{brand}-heading-m") %>
3
+ <%= ds_heading(title, class: "#{brand}-card__heading #{brand}-heading-m", level: heading_level) %>
4
4
  <% if actions.any? %>
5
5
  <ul class="<%= brand %>-card__actions">
6
6
  <% actions.each do |action| %>
@@ -10,13 +10,14 @@ module DesignSystem
10
10
  class SummaryCardComponent < DesignSystem::BaseComponent
11
11
  include DesignSystemHelper
12
12
 
13
- def initialize(title:, actions: [])
13
+ def initialize(title:, actions: [], heading_level: 2)
14
14
  super()
15
15
  @title = title
16
16
  @actions = Array(actions)
17
+ @heading_level = heading_level
17
18
  end
18
19
 
19
- attr_reader :title, :actions
20
+ attr_reader :title, :actions, :heading_level
20
21
 
21
22
  def render_action(action)
22
23
  link_to(action[:href] || '#', class: "#{brand}-link") do
@@ -1,6 +1,6 @@
1
1
  <div class="<%= brand %>-summary-card">
2
2
  <div class="<%= brand %>-summary-card__title-wrapper">
3
- <%= ds_heading(title, class: "#{brand}-summary-card__title") %>
3
+ <%= ds_heading(title, class: "#{brand}-summary-card__title", level: heading_level) %>
4
4
  <% if actions.any? %>
5
5
  <ul class="<%= brand %>-summary-card__actions">
6
6
  <% actions.each do |action| %>
@@ -117,8 +117,8 @@ module DesignSystemHelper
117
117
  render DesignSystem::Registry.component(brand, :panel).new(title:, body:)
118
118
  end
119
119
 
120
- def ds_summary_card(title:, actions: [], &block)
121
- component = DesignSystem::Registry.component(brand, :summary_card).new(title:, actions:)
120
+ def ds_summary_card(title:, actions: [], heading_level: 2, &block)
121
+ component = DesignSystem::Registry.component(brand, :summary_card).new(title:, actions:, heading_level:)
122
122
  render(component) { block ? capture(&block) : nil }
123
123
  end
124
124
 
@@ -21,8 +21,29 @@ module DesignSystem
21
21
  end
22
22
  end
23
23
 
24
+ def to_html
25
+ previous_page_item, *page_items, next_page_item = pagination.map do |item|
26
+ item.is_a?(Integer) ? page_number(item) : send(item)
27
+ end
28
+
29
+ html_fragments = [
30
+ previous_page_item,
31
+ tag(:ul, page_items.join, class: 'govuk-pagination__list'),
32
+ next_page_item
33
+ ]
34
+
35
+ html_container(html_fragments.join)
36
+ end
37
+
24
38
  private
25
39
 
40
+ # GOV.UK renders the gap between page numbers as a list item with the
41
+ # ellipses modifier, not will_paginate's default bare <span class="gap">,
42
+ # which would be an invalid child of <ul class="govuk-pagination__list">.
43
+ def gap
44
+ tag(:li, '&ctdot;', class: 'govuk-pagination__item govuk-pagination__item--ellipses')
45
+ end
46
+
26
47
  def link_with_prev_title(_text, target, aria_label)
27
48
  tag(:a,
28
49
  govuk_icon('previous') + tag(:span,
@@ -47,12 +68,12 @@ module DesignSystem
47
68
  if page == current_page
48
69
  tag(:li,
49
70
  tag(:a, page, class: 'govuk-link govuk-pagination__link', href: '#',
50
- aria: { label: "Page #{page}", current: 'page' }),
71
+ 'aria-label': "Page #{page}", 'aria-current': 'page'),
51
72
  class: 'govuk-pagination__item govuk-pagination__item--current')
52
73
  else
53
74
  tag(:li,
54
75
  tag(:a, page, class: 'govuk-link govuk-pagination__link', href: url(page),
55
- aria: { label: "Page #{page}" }),
76
+ 'aria-label': "Page #{page}"),
56
77
  class: 'govuk-pagination__item')
57
78
  end
58
79
  end
@@ -1,3 +1,3 @@
1
1
  module DesignSystem
2
- VERSION = '0.16.0'.freeze
2
+ VERSION = '0.17.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: design_system
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filis Liu
@@ -524,7 +524,7 @@ files:
524
524
  - lib/tasks/design_system_tasks.rake
525
525
  - lib/tasks/govuk.rake
526
526
  - lib/tasks/nhsuk.rake
527
- - public/design_system/static/design_system-0.16.0/design_system.js
527
+ - public/design_system/static/design_system-0.17.0/design_system.js
528
528
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-affa96571d-v2.woff
529
529
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-b542beb274-v2.woff2
530
530
  - public/design_system/static/govuk-frontend-5.11.1/fonts/light-94a07e06a1-v2.woff2