govuk_publishing_components 62.2.1 → 63.0.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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +1 -11
  3. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -47
  5. data/app/views/govuk_publishing_components/components/_image_card.html.erb +0 -1
  6. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +17 -10
  7. data/app/views/govuk_publishing_components/components/_pagination.html.erb +40 -0
  8. data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -23
  9. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +6 -0
  10. data/app/views/govuk_publishing_components/components/docs/{previous_and_next_navigation.yml → pagination.yml} +68 -13
  11. data/config/locales/ar.yml +1 -1
  12. data/config/locales/az.yml +1 -1
  13. data/config/locales/be.yml +1 -1
  14. data/config/locales/bg.yml +1 -1
  15. data/config/locales/bn.yml +1 -1
  16. data/config/locales/cs.yml +1 -1
  17. data/config/locales/cy.yml +2 -2
  18. data/config/locales/da.yml +1 -1
  19. data/config/locales/de.yml +1 -1
  20. data/config/locales/dr.yml +1 -1
  21. data/config/locales/el.yml +1 -1
  22. data/config/locales/en.yml +1 -1
  23. data/config/locales/es-419.yml +1 -1
  24. data/config/locales/es.yml +1 -1
  25. data/config/locales/et.yml +1 -1
  26. data/config/locales/fa.yml +1 -1
  27. data/config/locales/fi.yml +1 -1
  28. data/config/locales/fr.yml +1 -1
  29. data/config/locales/gd.yml +1 -1
  30. data/config/locales/gu.yml +1 -1
  31. data/config/locales/he.yml +1 -1
  32. data/config/locales/hi.yml +1 -1
  33. data/config/locales/hr.yml +1 -1
  34. data/config/locales/hu.yml +1 -1
  35. data/config/locales/hy.yml +1 -1
  36. data/config/locales/id.yml +1 -1
  37. data/config/locales/is.yml +1 -1
  38. data/config/locales/it.yml +1 -1
  39. data/config/locales/ja.yml +1 -1
  40. data/config/locales/ka.yml +1 -1
  41. data/config/locales/kk.yml +1 -1
  42. data/config/locales/ko.yml +1 -1
  43. data/config/locales/ku.yml +1 -1
  44. data/config/locales/ky.yml +1 -1
  45. data/config/locales/lt.yml +1 -1
  46. data/config/locales/lv.yml +1 -1
  47. data/config/locales/ms.yml +1 -1
  48. data/config/locales/mt.yml +1 -1
  49. data/config/locales/ne.yml +1 -1
  50. data/config/locales/nl.yml +1 -1
  51. data/config/locales/no.yml +1 -1
  52. data/config/locales/pa-pk.yml +1 -1
  53. data/config/locales/pa.yml +1 -1
  54. data/config/locales/pl.yml +1 -1
  55. data/config/locales/ps.yml +1 -1
  56. data/config/locales/pt.yml +1 -1
  57. data/config/locales/ro.yml +1 -1
  58. data/config/locales/ru.yml +1 -1
  59. data/config/locales/si.yml +1 -1
  60. data/config/locales/sk.yml +1 -1
  61. data/config/locales/sl.yml +1 -1
  62. data/config/locales/so.yml +1 -1
  63. data/config/locales/sq.yml +1 -1
  64. data/config/locales/sr.yml +1 -1
  65. data/config/locales/sv.yml +1 -1
  66. data/config/locales/sw.yml +1 -1
  67. data/config/locales/ta.yml +1 -1
  68. data/config/locales/th.yml +1 -1
  69. data/config/locales/ti.yml +1 -1
  70. data/config/locales/tk.yml +1 -1
  71. data/config/locales/tr.yml +1 -1
  72. data/config/locales/uk.yml +1 -1
  73. data/config/locales/ur.yml +1 -1
  74. data/config/locales/uz.yml +1 -1
  75. data/config/locales/vi.yml +1 -1
  76. data/config/locales/zh-hk.yml +1 -1
  77. data/config/locales/zh-tw.yml +1 -1
  78. data/config/locales/zh.yml +1 -1
  79. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +3 -0
  80. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -56
  81. data/lib/govuk_publishing_components/presenters/pagination_helper.rb +106 -0
  82. data/lib/govuk_publishing_components/version.rb +1 -1
  83. data/lib/govuk_publishing_components.rb +1 -0
  84. metadata +6 -8
  85. data/app/assets/images/govuk_publishing_components/youtube-play-icon.png +0 -0
  86. data/app/assets/images/govuk_publishing_components/youtube-play-icon.svg +0 -4
  87. data/app/assets/javascripts/govuk_publishing_components/components/image-card.js +0 -19
  88. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -73
  89. /data/app/assets/stylesheets/govuk_publishing_components/components/{_previous-and-next-navigation.scss → _pagination.scss} +0 -0
@@ -163,7 +163,7 @@ id:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginasi
169
169
  previous:
@@ -163,7 +163,7 @@ is:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Síðuuppsetning
169
169
  previous:
@@ -163,7 +163,7 @@ it:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Impaginazione
169
169
  previous:
@@ -159,7 +159,7 @@ ja:
159
159
  label:
160
160
  password_hidden_announcement:
161
161
  password_shown_announcement:
162
- previous_and_next_navigation:
162
+ pagination:
163
163
  next:
164
164
  pagination: ページ付け
165
165
  previous:
@@ -166,7 +166,7 @@ ka:
166
166
  label:
167
167
  password_hidden_announcement:
168
168
  password_shown_announcement:
169
- previous_and_next_navigation:
169
+ pagination:
170
170
  next:
171
171
  pagination: პაგინაცია
172
172
  previous:
@@ -163,7 +163,7 @@ kk:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Беттеу
169
169
  previous:
@@ -158,7 +158,7 @@ ko:
158
158
  label:
159
159
  password_hidden_announcement:
160
160
  password_shown_announcement:
161
- previous_and_next_navigation:
161
+ pagination:
162
162
  next:
163
163
  pagination:
164
164
  previous:
@@ -162,7 +162,7 @@ ku:
162
162
  label: ووشەی نهێنی
163
163
  password_hidden_announcement: وشەی نهێنی تۆ شاراوەتەوە
164
164
  password_shown_announcement: وشەی نهێنی تۆ دیارە
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next: داهاتوو
167
167
  pagination: لاپەڕەسازی
168
168
  previous: پێشووتر
@@ -159,7 +159,7 @@ ky:
159
159
  label: Сырсөз
160
160
  password_hidden_announcement: Сырсөзүңүз жашырылган
161
161
  password_shown_announcement: Сырсөзүңүз көрсөтүлгөн
162
- previous_and_next_navigation:
162
+ pagination:
163
163
  next: Кийинки
164
164
  pagination: Барактоо
165
165
  previous: Мурунку
@@ -168,7 +168,7 @@ lt:
168
168
  label:
169
169
  password_hidden_announcement:
170
170
  password_shown_announcement:
171
- previous_and_next_navigation:
171
+ pagination:
172
172
  next:
173
173
  pagination: Suskirstymas puslapiais
174
174
  previous:
@@ -167,7 +167,7 @@ lv:
167
167
  label:
168
168
  password_hidden_announcement:
169
169
  password_shown_announcement:
170
- previous_and_next_navigation:
170
+ pagination:
171
171
  next:
172
172
  pagination: Numerācija
173
173
  previous:
@@ -162,7 +162,7 @@ ms:
162
162
  label:
163
163
  password_hidden_announcement:
164
164
  password_shown_announcement:
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next:
167
167
  pagination: Penomboran
168
168
  previous:
@@ -165,7 +165,7 @@ mt:
165
165
  label:
166
166
  password_hidden_announcement:
167
167
  password_shown_announcement:
168
- previous_and_next_navigation:
168
+ pagination:
169
169
  next:
170
170
  pagination: Paġinazzjoni
171
171
  previous:
@@ -159,7 +159,7 @@ ne:
159
159
  label:
160
160
  password_hidden_announcement:
161
161
  password_shown_announcement:
162
- previous_and_next_navigation:
162
+ pagination:
163
163
  next:
164
164
  pagination:
165
165
  previous:
@@ -163,7 +163,7 @@ nl:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginering
169
169
  previous:
@@ -163,7 +163,7 @@
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginering
169
169
  previous:
@@ -159,7 +159,7 @@ pa-pk:
159
159
  label:
160
160
  password_hidden_announcement:
161
161
  password_shown_announcement:
162
- previous_and_next_navigation:
162
+ pagination:
163
163
  next:
164
164
  pagination: ورقہ بندی
165
165
  previous:
@@ -163,7 +163,7 @@ pa:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: ਪੰਨਾ
169
169
  previous:
@@ -167,7 +167,7 @@ pl:
167
167
  label:
168
168
  password_hidden_announcement:
169
169
  password_shown_announcement:
170
- previous_and_next_navigation:
170
+ pagination:
171
171
  next:
172
172
  pagination: Numeracja stron
173
173
  previous:
@@ -160,7 +160,7 @@ ps:
160
160
  label:
161
161
  password_hidden_announcement:
162
162
  password_shown_announcement:
163
- previous_and_next_navigation:
163
+ pagination:
164
164
  next:
165
165
  pagination: مخینه
166
166
  previous:
@@ -163,7 +163,7 @@ pt:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginação
169
169
  previous:
@@ -164,7 +164,7 @@ ro:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Paginație
170
170
  previous:
@@ -167,7 +167,7 @@ ru:
167
167
  label:
168
168
  password_hidden_announcement:
169
169
  password_shown_announcement:
170
- previous_and_next_navigation:
170
+ pagination:
171
171
  next:
172
172
  pagination: Разбивка
173
173
  previous:
@@ -163,7 +163,7 @@ si:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: පිටු අංකය
169
169
  previous:
@@ -168,7 +168,7 @@ sk:
168
168
  label:
169
169
  password_hidden_announcement:
170
170
  password_shown_announcement:
171
- previous_and_next_navigation:
171
+ pagination:
172
172
  next:
173
173
  pagination: Stránkovanie
174
174
  previous:
@@ -170,7 +170,7 @@ sl:
170
170
  label:
171
171
  password_hidden_announcement:
172
172
  password_shown_announcement:
173
- previous_and_next_navigation:
173
+ pagination:
174
174
  next:
175
175
  pagination: Oštevilčenje
176
176
  previous:
@@ -163,7 +163,7 @@ so:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Lambar siinta boga
169
169
  previous:
@@ -163,7 +163,7 @@ sq:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Numërtimi
169
169
  previous:
@@ -164,7 +164,7 @@ sr:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Broj stranice
170
170
  previous:
@@ -163,7 +163,7 @@ sv:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Paginering
169
169
  previous:
@@ -163,7 +163,7 @@ sw:
163
163
  label:
164
164
  password_hidden_announcement:
165
165
  password_shown_announcement:
166
- previous_and_next_navigation:
166
+ pagination:
167
167
  next:
168
168
  pagination: Nambari za kurasa
169
169
  previous:
@@ -164,7 +164,7 @@ ta:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: பக்கமிடுதல்
170
170
  previous:
@@ -161,7 +161,7 @@ th:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: การแบ่งหน้า
167
167
  previous:
@@ -162,7 +162,7 @@ ti:
162
162
  label: መሕለፊ ቓል/ፓስዎርድ
163
163
  password_hidden_announcement: መሕለፊ ቓል/ፓስዎርድካ ተሓቢኡ ኣሎ
164
164
  password_shown_announcement: መሕለፊ ቓል/ፓስዎርድካ ይርአ ኣሎ
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next: ዝቅጽል
167
167
  pagination: ገጻት ምግባር
168
168
  previous: ዝሓለፈ
@@ -164,7 +164,7 @@ tk:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Sahypa
170
170
  previous:
@@ -164,7 +164,7 @@ tr:
164
164
  label:
165
165
  password_hidden_announcement:
166
166
  password_shown_announcement:
167
- previous_and_next_navigation:
167
+ pagination:
168
168
  next:
169
169
  pagination: Sayfa
170
170
  previous:
@@ -170,7 +170,7 @@ uk:
170
170
  label:
171
171
  password_hidden_announcement:
172
172
  password_shown_announcement:
173
- previous_and_next_navigation:
173
+ pagination:
174
174
  next:
175
175
  pagination: Поділ на сторінки
176
176
  previous:
@@ -160,7 +160,7 @@ ur:
160
160
  label:
161
161
  password_hidden_announcement:
162
162
  password_shown_announcement:
163
- previous_and_next_navigation:
163
+ pagination:
164
164
  next:
165
165
  pagination: صفحہ بندی
166
166
  previous:
@@ -165,7 +165,7 @@ uz:
165
165
  label:
166
166
  password_hidden_announcement:
167
167
  password_shown_announcement:
168
- previous_and_next_navigation:
168
+ pagination:
169
169
  next:
170
170
  pagination: Саҳифаларнинг рақамланиши
171
171
  previous:
@@ -162,7 +162,7 @@ vi:
162
162
  label:
163
163
  password_hidden_announcement:
164
164
  password_shown_announcement:
165
- previous_and_next_navigation:
165
+ pagination:
166
166
  next:
167
167
  pagination: Phân trang
168
168
  previous:
@@ -161,7 +161,7 @@ zh-hk:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分頁
167
167
  previous:
@@ -161,7 +161,7 @@ zh-tw:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分頁
167
167
  previous:
@@ -161,7 +161,7 @@ zh:
161
161
  label:
162
162
  password_hidden_announcement:
163
163
  password_shown_announcement:
164
- previous_and_next_navigation:
164
+ pagination:
165
165
  next:
166
166
  pagination: 分页
167
167
  previous:
@@ -184,6 +184,9 @@ module GovukPublishingComponents
184
184
  return if lang.blank?
185
185
 
186
186
  langs = %w[ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh zh-Hans zh-Hant zh-hk zh-tw cv kw co cr hr cs da dv nl dz dr en eo et ee fo fj fi fr ff gl gd gv ka de el kl gn gu ht ha he hz hi ho hu is io ig id in ia ie iu ik ga it ja jv kl kn kr ks kk km ki rw rn ky kv kg ko ku kj lo la lv li ln lt lu lg lb gv mk mg ms ml mt mi mr mh mo mn na nv ng nd ne no nb nn ii oc oj cu or om os pi ps fa pl pt pa pa-pk qu rm ro ru se sm sg sa sr sh st tn sn ii sd si ss sk sl so nr es es-419 su sw ss sv tl ty tg ta tt te th bo ti to ts tr tk tw ug uk ur uz ve vi vo wa cy wo fy xh yi ji yo za zu]
187
+
188
+ lang = lang.to_s
189
+
187
190
  unless langs.include? lang
188
191
  raise(ArgumentError, "lang attribute (#{lang}) is not recognised")
189
192
  end
@@ -4,14 +4,13 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :youtube_video_id, :image_src, :two_thirds, :large_font_size_mobile
7
+ attr_reader :href, :large, :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :image_src, :two_thirds, :large_font_size_mobile
8
8
 
9
9
  def initialize(local_assigns, brand_helper)
10
10
  @href = local_assigns[:href]
11
11
  @extra_details = local_assigns[:extra_details] || []
12
12
  @image_src = local_assigns[:image_src]
13
13
  @image_alt = local_assigns[:image_alt] || ""
14
- @youtube_video_alt = local_assigns[:youtube_video_alt]
15
14
  @image_loading = local_assigns[:image_loading] || "auto"
16
15
  @srcset = local_assigns[:srcset] || nil
17
16
  @sizes = local_assigns[:sizes] || nil
@@ -25,24 +24,10 @@ module GovukPublishingComponents
25
24
  @extra_details_no_indent = local_assigns[:extra_details_no_indent]
26
25
  @metadata = local_assigns[:metadata]
27
26
  @lang = local_assigns[:lang]
28
- @youtube_video_id = local_assigns[:youtube_video_id] || nil
29
27
 
30
28
  @brand_helper = brand_helper
31
29
  end
32
30
 
33
- def href
34
- return youtube_href if @youtube_video_id
35
-
36
- @href
37
- end
38
-
39
- def large
40
- # if youtube video, we don't want to use
41
- # the small variant, large will be always
42
- # true if a youtube_video_id is supplied
43
- @youtube_video_id || @large
44
- end
45
-
46
31
  def large_mobile_font_size?
47
32
  # allow the font-size to be 19px on mobile
48
33
  # for the two-thirds varation of the
@@ -51,8 +36,6 @@ module GovukPublishingComponents
51
36
  end
52
37
 
53
38
  def media
54
- return youtube_link if @youtube_video_id
55
-
56
39
  image
57
40
  end
58
41
 
@@ -103,44 +86,6 @@ module GovukPublishingComponents
103
86
 
104
87
  content_tag(:div, @description, class: "gem-c-image-card__description") if @description
105
88
  end
106
-
107
- def youtube_href
108
- "https://www.youtube.com/watch?v=#{@youtube_video_id}"
109
- end
110
-
111
- def youtube_thumbnail_url
112
- "https://img.youtube.com/vi/#{@youtube_video_id}/maxresdefault.jpg"
113
- end
114
-
115
- def youtube_thumbnail
116
- thumbnail = content_tag(:div, class: "gem-c-image-card__youtube-thumbnail-image-container") do
117
- image_tag(
118
- youtube_thumbnail_url,
119
- class: "gem-c-image-card__image gem-c-image-card__youtube-thumbnail-image",
120
- alt: "",
121
- loading: @image_loading,
122
- )
123
- end
124
- thumbnail + content_tag(:figcaption, @youtube_video_alt, class: "gem-c-image-card__youtube-thumbnail-container-text govuk-link #{@brand_helper.color_class}")
125
- end
126
-
127
- def youtube_link
128
- content_tag(
129
- :figure,
130
- class: "gem-c-image-card__image-wrapper gem-c-image-card__image-wrapper--youtube-embed",
131
- ) do
132
- content_tag(:div) do
133
- link_to(
134
- href,
135
- {
136
- class: "govuk-body govuk-link gem-c-image-card__youtube-thumbnail-container js-youtube-card-embed",
137
- },
138
- ) do
139
- youtube_thumbnail
140
- end
141
- end
142
- end
143
- end
144
89
  end
145
90
  end
146
91
  end
@@ -0,0 +1,106 @@
1
+ module GovukPublishingComponents
2
+ module Presenters
3
+ class PaginationHelper
4
+ include ActionView::Helpers
5
+ include ActionView::Context
6
+
7
+ attr_reader :prev_link, :next_link, :page_links, :ga4_type
8
+
9
+ def initialize(local_assigns)
10
+ @arrow_links = {
11
+ next: local_assigns[:next_page] || nil,
12
+ prev: local_assigns[:previous_page] || nil,
13
+ }
14
+ @items = local_assigns[:items] || nil
15
+
16
+ @disable_ga4 = local_assigns[:disable_ga4] || nil
17
+ @ga4_type = has_pages? ? "pagination" : "previous and next"
18
+ @prev_link = arrow_link_helper(direction: "prev")
19
+ @next_link = arrow_link_helper(direction: "next")
20
+ @page_links = pages_link_helper
21
+ end
22
+
23
+ def ga4_link_event(text:, section:)
24
+ unless @disable_ga4
25
+ {
26
+ event_name: "navigation",
27
+ type: @ga4_type,
28
+ text:,
29
+ section:,
30
+ }.to_json
31
+ end
32
+ end
33
+
34
+ def has_links?
35
+ has_pages? || @prev_link || @next_link
36
+ end
37
+
38
+ def has_pages?
39
+ @items.present?
40
+ end
41
+
42
+ def pages_link_helper
43
+ return unless has_pages?
44
+
45
+ page_links = @items.each_with_index.map do |item, index|
46
+ { href: nil, ellipsis: nil, current: nil, number: nil, visually_hidden_text: nil, **item.symbolize_keys } => { href:, ellipsis:, current:, number:, visually_hidden_text: }
47
+
48
+ raise ArgumentError, "Number or ellipsis value required for item #{index}" if ellipsis.blank? && number.blank?
49
+
50
+ list_item_classes = %w[govuk-pagination__item]
51
+ list_item_classes << "govuk-pagination__item--ellipsis" if ellipsis
52
+ list_item_classes << "govuk-pagination__item--current" if current
53
+
54
+ item_aria_label = visually_hidden_text || "Page #{number}"
55
+
56
+ ga4_link = ga4_link_event(text: number, section: "Pagination list")
57
+
58
+ content_tag(:li, class: list_item_classes) do
59
+ if ellipsis
60
+ "&ctdot;".html_safe
61
+ else
62
+ content_tag(:a, number, class: "govuk-link govuk-pagination__link", href:, aria: { label: item_aria_label, current: current ? "page" : nil }, data: { ga4_link: })
63
+ end
64
+ end
65
+ end
66
+
67
+ content_tag(:ul, class: "govuk-pagination__list") do
68
+ page_links.collect { |page_link| concat(page_link) }
69
+ end
70
+ end
71
+
72
+ def arrow_link_helper(direction:)
73
+ arrow_link_options = @arrow_links[direction.to_sym]
74
+
75
+ return if arrow_link_options.blank?
76
+
77
+ { href: nil, label: nil, title: nil, icon: nil, **arrow_link_options.symbolize_keys } => { href:, label:, title:, icon: }
78
+
79
+ title ||= {
80
+ "prev": t("components.pagination.previous"),
81
+ "next": t("components.pagination.next"),
82
+ }[direction.to_sym]
83
+
84
+ section = {
85
+ prev: "Previous",
86
+ next: "Next",
87
+ }[direction.to_sym]
88
+
89
+ ga4_link = ga4_link_event(text: label || title, section:)
90
+
91
+ link_text_classes = %w[govuk-pagination__link-title]
92
+ link_text_classes << "govuk-pagination__link-title--decorated" if label.blank?
93
+
94
+ content_tag(:div, class: "govuk-pagination__#{direction}") do
95
+ content_tag(:a, href:, class: "govuk-link govuk-pagination__link", data: { ga4_link: }) do
96
+ concat icon if direction == "prev" || !has_pages? && direction == "next"
97
+ concat content_tag(:span, title, class: link_text_classes)
98
+ concat icon if has_pages? && direction == "next"
99
+ concat content_tag(:span, ":", class: "govuk-visually-hidden") if label.present?
100
+ concat content_tag(:span, label, class: "govuk-pagination__link-label") if label.present?
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "62.2.1".freeze
2
+ VERSION = "63.0.0".freeze
3
3
  end