crown_marketplace_utils 0.1.0.beta.3 → 0.1.0.beta.5

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Gemfile.lock +5 -5
  4. data/README.md +3 -4
  5. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/accordion.rb +116 -0
  6. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/back_link.rb +34 -0
  7. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/breadcrumbs.rb +2 -2
  8. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/button.rb +13 -19
  9. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/details.rb +1 -1
  10. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/error_message.rb +1 -1
  11. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/field/character_count.rb +40 -68
  12. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/field/checkboxes.rb +65 -71
  13. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field/date_input.rb +153 -0
  14. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field/file_upload.rb +94 -0
  15. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field/input.rb +156 -0
  16. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/field/radios.rb +65 -67
  17. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field/select.rb +134 -0
  18. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field/textarea.rb +105 -0
  19. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/field.rb +215 -0
  20. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/fieldset.rb +2 -2
  21. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/form_group.rb +10 -21
  22. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/header.rb +3 -3
  23. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/hint.rb +1 -1
  24. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/label.rb +88 -0
  25. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/notification_banner.rb +1 -1
  26. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/pagination.rb +338 -0
  27. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/step_by_step_navigation.rb +1 -1
  28. data/lib/crown_marketplace_utils/{gov_uk_helper → helpers/gov_uk_helper}/tag.rb +1 -1
  29. data/lib/crown_marketplace_utils/helpers/gov_uk_helper/warning_text.rb +52 -0
  30. data/lib/crown_marketplace_utils/{gov_uk_helper.rb → helpers/gov_uk_helper.rb} +11 -1
  31. data/lib/crown_marketplace_utils/version.rb +1 -1
  32. data/lib/crown_marketplace_utils.rb +1 -1
  33. metadata +28 -23
  34. data/lib/crown_marketplace_utils/gov_uk_helper/field/input.rb +0 -160
  35. data/lib/crown_marketplace_utils/gov_uk_helper/field/select.rb +0 -166
  36. data/lib/crown_marketplace_utils/gov_uk_helper/field/textarea.rb +0 -127
  37. data/lib/crown_marketplace_utils/gov_uk_helper/field.rb +0 -263
  38. data/lib/crown_marketplace_utils/gov_uk_helper/label.rb +0 -97
  39. data/lib/crown_marketplace_utils/gov_uk_helper/pagination.rb +0 -214
@@ -0,0 +1,338 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'action_view'
4
+
5
+ module CrownMarketplaceUtils::Helpers
6
+ module GovUkHelper
7
+ # rubocop:disable Metrics/ModuleLength
8
+
9
+ # = GOV.UK Pagination
10
+ #
11
+ # This helper is used for generating the pagination component from the
12
+ # {https://design-system.service.gov.uk/components/pagination GDS - Components - Pagination}
13
+
14
+ module Pagination
15
+ include ActionView::Context
16
+ include ActionView::Helpers::TagHelper
17
+ include ActionView::Helpers::TextHelper
18
+ include ActionView::Helpers::UrlHelper
19
+
20
+ # Generates the HTML for the GOV.UK Pagination component
21
+ #
22
+ # @param (see _govuk_pagination)
23
+ #
24
+ # @option (see _govuk_pagination)
25
+ #
26
+ # @return [ActiveSupport::SafeBuffer] the HTML for the GOV.UK Pagination
27
+ # which can then be rendered on the page
28
+
29
+ def govuk_pagination(**govuk_pagination_options)
30
+ _govuk_pagination(**govuk_pagination_options) do |block_is_level|
31
+ capture do
32
+ concat(govuk_pagination_previous(block_is_level, form: govuk_pagination_options[:form], **govuk_pagination_options[:previous])) if govuk_pagination_options[:previous]
33
+ concat(govuk_pagination_items(govuk_pagination_options[:items], form: govuk_pagination_options[:form])) if govuk_pagination_options[:items]
34
+ concat(govuk_pagination_next(block_is_level, form: govuk_pagination_options[:form], **govuk_pagination_options[:next])) if govuk_pagination_options[:next]
35
+ end
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ # Wrapper method used by {govuk_pagination}
42
+ #
43
+ # @param govuk_pagination_options [Hash] options that will be used in customising the HTML
44
+ #
45
+ # @option govuk_pagination_options [ActionView::Helpers::FormBuilder] :form (nil) optional form builder used to create pagination buttons
46
+ # @option govuk_pagination_options [String] :classes additional CSS classes for the pagination HTML
47
+ # @option govuk_pagination_options [Array] :items an array of items for the pagination (see: {govuk_pagination_items})
48
+ # @option govuk_pagination_options [Hash] :previous the previous link (see: {govuk_pagination_previous})
49
+ # @option govuk_pagination_options [Hash] :next the next link (see: {govuk_pagination_next})
50
+ # @option govuk_pagination_options [Hash] :attributes ({role: 'navigation', aria: { label: 'results' }})
51
+ # any additional attributes that will added as part of the HTML
52
+ #
53
+ # @yield the pagination HTML generated by {govuk_pagination}
54
+ #
55
+ # @yieldparam block_is_level [Boolean] flag to indicate if there are no items
56
+ #
57
+ # @return [ActiveSupport::SafeBuffer] the HTML for the Pagination
58
+ # which is used in {govuk_pagination}
59
+
60
+ def _govuk_pagination(**govuk_pagination_options)
61
+ govuk_pagination_options[:attributes] ||= {}
62
+ govuk_pagination_options[:attributes][:class] = "govuk-pagination #{govuk_pagination_options[:classes]}".rstrip
63
+
64
+ block_is_level = govuk_pagination_options[:items].blank? && (govuk_pagination_options[:next].present? || govuk_pagination_options[:previous].present?)
65
+
66
+ govuk_pagination_options[:attributes][:class] << ' govuk-pagination--block' if block_is_level
67
+
68
+ govuk_pagination_options[:attributes].merge!({ role: 'navigation' })
69
+ (govuk_pagination_options[:attributes][:aria] ||= {})[:label] ||= 'results'
70
+
71
+ tag.nav(**govuk_pagination_options[:attributes]) do
72
+ yield(block_is_level)
73
+ end
74
+ end
75
+
76
+ # Generates the previous link for {govuk_pagination}
77
+ #
78
+ # @param (see govuk_pagination_previous_content)
79
+ #
80
+ # @option (see govuk_pagination_previous_content)
81
+ #
82
+ # @return [ActiveSupport::SafeBuffer] the HTML for the previous link which is used in {govuk_pagination}
83
+
84
+ def govuk_pagination_previous(block_is_level, **govuk_pagination_previous_options)
85
+ govuk_pagination_previous_options[:attributes] ||= {}
86
+ govuk_pagination_previous_options[:attributes][:class] = "govuk-link govuk-pagination__link #{'pagination--button_as_link' if govuk_pagination_previous_options[:form]}".rstrip
87
+ govuk_pagination_previous_options[:attributes][:rel] = 'prev'
88
+
89
+ pagination_previous_content = govuk_pagination_previous_content(block_is_level, govuk_pagination_previous_options)
90
+
91
+ tag.div(class: 'govuk-pagination__prev') do
92
+ if govuk_pagination_previous_options[:form]
93
+ govuk_pagination_previous_options[:form].button(pagination_previous_content, **govuk_pagination_previous_options[:attributes])
94
+ else
95
+ link_to(pagination_previous_content, govuk_pagination_previous_options[:href], **govuk_pagination_previous_options[:attributes])
96
+ end
97
+ end
98
+ end
99
+
100
+ # Used by {govuk_pagination_previous}
101
+ # to generate the previous link content
102
+ #
103
+ # @param block_is_level [Boolean] when there are no items, this will be true and will add extra classes
104
+ # to the link to make the next and previous pagination links level
105
+ # @param govuk_pagination_previous_options [Hash] options that will be used in customising the HTML
106
+ #
107
+ # @option govuk_pagination_previous_options [ActionView::Helpers::FormBuilder] :form (nil) optional form builder used to create previous button
108
+ # @option govuk_pagination_previous_options [String] :href the URL for the link
109
+ # @option govuk_pagination_previous_options [String] :text ('Previous') the text for the link
110
+ # @option govuk_pagination_previous_options [String] :lable_text additional text for the link when the pagination block is level
111
+ # @option govuk_pagination_previous_options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
112
+ #
113
+ # @return [ActiveSupport::SafeBuffer] the HTML for the previous link/button
114
+
115
+ def govuk_pagination_previous_content(block_is_level, govuk_pagination_previous_options)
116
+ capture do
117
+ concat(govuk_pagination_icon(:prev))
118
+ concat(tag.span(govuk_pagination_previous_options[:text] || 'Previous', class: pagination_next_and_previous_classes(block_is_level, govuk_pagination_previous_options)))
119
+ concat(govuk_pagination_icon_label_text(block_is_level, govuk_pagination_previous_options[:lable_text]))
120
+ end
121
+ end
122
+
123
+ # Generates the next link for {govuk_pagination}
124
+ #
125
+ # @param (see govuk_pagination_next_content)
126
+ #
127
+ # @option (see govuk_pagination_next_content)
128
+ #
129
+ # @return [ActiveSupport::SafeBuffer] the HTML for the next link which is used in {govuk_pagination}
130
+
131
+ def govuk_pagination_next(block_is_level, **govuk_pagination_next_options)
132
+ govuk_pagination_next_options[:attributes] ||= {}
133
+ govuk_pagination_next_options[:attributes][:class] = "govuk-link govuk-pagination__link #{'pagination--button_as_link' if govuk_pagination_next_options[:form]}".rstrip
134
+ govuk_pagination_next_options[:attributes][:rel] = 'next'
135
+
136
+ pagination_next_content = govuk_pagination_next_content(block_is_level, govuk_pagination_next_options)
137
+
138
+ tag.div(class: 'govuk-pagination__next') do
139
+ if govuk_pagination_next_options[:form]
140
+ govuk_pagination_next_options[:form].button(pagination_next_content, **govuk_pagination_next_options[:attributes])
141
+ else
142
+ link_to(pagination_next_content, govuk_pagination_next_options[:href], **govuk_pagination_next_options[:attributes])
143
+ end
144
+ end
145
+ end
146
+
147
+ # Used by {govuk_pagination_next} to generate the next link content
148
+ #
149
+ # @param block_is_level [Boolean] when there are no items, this will be true and will add extra classe
150
+ # to the link to make the next and previous pagination links level
151
+ # @param govuk_pagination_next_options [Hash] options that will be used in customising the HTML
152
+ #
153
+ # @option govuk_pagination_next_options [ActionView::Helpers::FormBuilder] :form (nil) optional form builder used to create next button
154
+ # @option govuk_pagination_next_options [String] :href the URL for the link
155
+ # @option govuk_pagination_next_options [String] :text ('Next') the text for the link
156
+ # @option govuk_pagination_next_options [String] :lable_text additional text for the link when the pagination block is level
157
+ # @option govuk_pagination_next_options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
158
+ #
159
+ # @return [ActiveSupport::SafeBuffer] the HTML for the next link/button
160
+
161
+ def govuk_pagination_next_content(block_is_level, **govuk_pagination_next_options)
162
+ capture do
163
+ concat(govuk_pagination_icon(:next)) if block_is_level
164
+ concat(tag.span(govuk_pagination_next_options[:text] || 'Next', class: pagination_next_and_previous_classes(block_is_level, govuk_pagination_next_options)))
165
+ concat(govuk_pagination_icon_label_text(block_is_level, govuk_pagination_next_options[:lable_text]))
166
+ concat(govuk_pagination_icon(:next)) unless block_is_level
167
+ end
168
+ end
169
+
170
+ # Returns the classes for the previous and next link/button label
171
+ #
172
+ # @param (see govuk_pagination_next_content)
173
+
174
+ def pagination_next_and_previous_classes(block_is_level, govuk_pagination_options)
175
+ "govuk-pagination__link-title #{'govuk-pagination__link-title--decorated' if block_is_level && !govuk_pagination_options[:lable_text]}".rstrip
176
+ end
177
+
178
+ # Generates the item links for {govuk_pagination}
179
+ #
180
+ # @param (see _govuk_pagination_items)
181
+ # @param form [ActionView::Helpers::FormBuilder] optional form builder used to create the item buttons
182
+ #
183
+ # @return [ActiveSupport::SafeBuffer] the HTML for the lits of items which is used in {govuk_pagination}
184
+
185
+ def govuk_pagination_items(govuk_pagination_items, form:)
186
+ if form
187
+ _govuk_pagination_items(govuk_pagination_items) do |govuk_pagination_item|
188
+ govuk_pagination_item_number_form(form, govuk_pagination_item)
189
+ end
190
+ else
191
+ _govuk_pagination_items(govuk_pagination_items) do |govuk_pagination_item|
192
+ govuk_pagination_item_number_tag(govuk_pagination_item)
193
+ end
194
+ end
195
+ end
196
+
197
+ # Wrapper method used by {govuk_pagination_items}
198
+ # to generate the pagination items HTML
199
+ #
200
+ # @param govuk_pagination_items [Array(Hash)] an array of item hashes for the pagination.
201
+ # There are two types of item:
202
+ # - {govuk_pagination_item_ellipsis ellipsis item}
203
+ # - {govuk_pagination_item_number_tag number item}
204
+ #
205
+ # @yield the pagination number item HTML generated by {govuk_pagination_items}
206
+ #
207
+ # @yieldparam govuk_pagination_item [Hash] the current pagination item in the loop
208
+ #
209
+ # @return [ActiveSupport::SafeBuffer] the HTML for the lits of items which is
210
+ # used in {govuk_pagination_items}
211
+
212
+ def _govuk_pagination_items(govuk_pagination_items)
213
+ tag.ul(class: 'govuk-pagination__list') do
214
+ capture do
215
+ govuk_pagination_items.each do |govuk_pagination_item|
216
+ case govuk_pagination_item[:type]
217
+ when :ellipsis
218
+ concat(govuk_pagination_item_ellipsis)
219
+ when :number
220
+ concat(yield(govuk_pagination_item))
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
226
+
227
+ # Generates the icon for:
228
+ # - {govuk_pagination_previous}
229
+ # - {govuk_pagination_next}
230
+ #
231
+ # @param type [Symbol] the type of the pagination icon (+:prev+ or +:next+)
232
+ #
233
+ # @return [ActiveSupport::SafeBuffer]
234
+
235
+ def govuk_pagination_icon(type)
236
+ tag.svg(class: "govuk-pagination__icon govuk-pagination__icon--#{type}", xmlns: 'http://www.w3.org/2000/svg', height: '13', width: '15', aria: { hidden: 'true' }, focusable: 'false', viewBox: '0 0 15 13') do
237
+ tag.path(d: PAGINATION_ICON_PATHS[type])
238
+ end
239
+ end
240
+
241
+ # Generates the label text for:
242
+ # - {govuk_pagination_previous}
243
+ # - {govuk_pagination_next}
244
+ #
245
+ # @param block_is_level [Boolean] when there are no items, this will be true
246
+ # @param label_text [String] the additional text for the link
247
+ #
248
+ # @return [ActiveSupport::SafeBuffer]
249
+
250
+ def govuk_pagination_icon_label_text(block_is_level, label_text)
251
+ return unless block_is_level && label_text
252
+
253
+ capture do
254
+ concat(tag.span(':', class: 'govuk-visually-hidden'))
255
+ concat(tag.span(label_text, class: 'govuk-pagination__link-label'))
256
+ end
257
+ end
258
+
259
+ # Generates the ellipsis HTML for {govuk_pagination_items}
260
+ #
261
+ # @return [ActiveSupport::SafeBuffer] the HTML for an ellipsis item which is used in {govuk_pagination_items}
262
+
263
+ def govuk_pagination_item_ellipsis
264
+ tag.li('⋯', class: 'govuk-pagination__item govuk-pagination__item--ellipses')
265
+ end
266
+
267
+ # Generates the number item HTML for {govuk_pagination_items}
268
+ #
269
+ # @param (see _govuk_pagination_item_number)
270
+ #
271
+ # @option (see _govuk_pagination_item_number)
272
+ #
273
+ # @return [ActiveSupport::SafeBuffer] the HTML for an number item which is used in {govuk_pagination_items}
274
+
275
+ def govuk_pagination_item_number_tag(govuk_pagination_item)
276
+ _govuk_pagination_item_number(govuk_pagination_item) do
277
+ link_to(govuk_pagination_item[:number], govuk_pagination_item[:href], **govuk_pagination_item[:attributes])
278
+ end
279
+ end
280
+
281
+ # Generates the number item HTML for {govuk_pagination_items} when there is a ActionView::Helpers::FormBuilder
282
+ #
283
+ # @param form [ActionView::Helpers::FormBuilder] the form builder used to create the item button
284
+ # @param (see _govuk_pagination_item_number)
285
+ #
286
+ # @option (see _govuk_pagination_item_number)
287
+ #
288
+ # @return (see govuk_pagination_item_number_tag)
289
+
290
+ def govuk_pagination_item_number_form(form, govuk_pagination_item)
291
+ govuk_pagination_item[:classes] = 'pagination-number--button_as_link'
292
+
293
+ _govuk_pagination_item_number(govuk_pagination_item) do
294
+ form.button(govuk_pagination_item[:number], **govuk_pagination_item[:attributes])
295
+ end
296
+ end
297
+
298
+ # Wrapper method used by {govuk_pagination_item_number_tag} and {govuk_pagination_item_number_form}
299
+ # to generate the pagination number item HTML
300
+ #
301
+ # @param govuk_pagination_item [Hash] options that will be used in customising the HTML
302
+ #
303
+ # @option govuk_pagination_item [String] :href the URL for the link
304
+ # @option govuk_pagination_item [String] :number the number for the link
305
+ # @option govuk_pagination_item [String] :current is this item the current page
306
+ # @option govuk_pagination_item [Hash] :attributes ({aria: { label: 'Page <NUMBER>' } })
307
+ # any additional attributes that will added as part of the HTML
308
+ #
309
+ # @yield the pagination number item link (when {govuk_pagination_item_number_tag}) or button (when {govuk_pagination_item_number_form})
310
+ #
311
+ # @return [ActiveSupport::SafeBuffer] the HTML for an number item which is used
312
+ # in {govuk_pagination_item_number_tag} or {govuk_pagination_item_number_form}
313
+
314
+ def _govuk_pagination_item_number(govuk_pagination_item, &block)
315
+ (govuk_pagination_item[:attributes] ||= {})[:aria] ||= {}
316
+ govuk_pagination_item[:attributes][:class] = "govuk-link govuk-pagination__link #{govuk_pagination_item[:classes]}".rstrip
317
+ govuk_pagination_item[:attributes][:aria][:label] ||= "Page #{govuk_pagination_item[:number]}"
318
+
319
+ govuk_pagination_list_classes = +'govuk-pagination__item'
320
+
321
+ if govuk_pagination_item[:current]
322
+ govuk_pagination_list_classes << ' govuk-pagination__item--current'
323
+ govuk_pagination_item[:attributes][:aria][:current] = 'page'
324
+ end
325
+
326
+ tag.li(class: govuk_pagination_list_classes, &block)
327
+ end
328
+
329
+ # The paths for the pagination next and previous icons
330
+
331
+ PAGINATION_ICON_PATHS = {
332
+ prev: 'm6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z',
333
+ next: 'm8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z'
334
+ }.freeze
335
+ end
336
+ # rubocop:enable Metrics/ModuleLength
337
+ end
338
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'action_view'
4
4
 
5
- module CrownMarketplaceUtils
5
+ module CrownMarketplaceUtils::Helpers
6
6
  module GovUkHelper
7
7
  # = GOV.UK Step by step navigation
8
8
  #
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'action_view'
4
4
 
5
- module CrownMarketplaceUtils
5
+ module CrownMarketplaceUtils::Helpers
6
6
  module GovUkHelper
7
7
  # = GOV.UK Tag
8
8
  #
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'action_view'
4
+
5
+ module CrownMarketplaceUtils::Helpers
6
+ module GovUkHelper
7
+ # = GOV.UK Warning text
8
+ #
9
+ # This helper is used for generating the warning text component from the
10
+ # {https://design-system.service.gov.uk/components/warning-text GDS - Components - Warning text}
11
+
12
+ module WarningText
13
+ include ActionView::Context
14
+ include ActionView::Helpers::TagHelper
15
+ include ActionView::Helpers::TextHelper
16
+
17
+ # Generates the HTML for the GOV.UK Warning text component
18
+ #
19
+ # @param text [String] (nil) the text for the warning
20
+ # @param govuk_warning_text_options [Hash] options that will be used in customising the HTML
21
+ #
22
+ # @option govuk_warning_text_options [String] :classes additional CSS classes for the tag HTML
23
+ # @option govuk_warning_text_options [String] :icon_fallback_text the fallback text for the icon (default: +'Warning'+)
24
+ # @option govuk_warning_text_options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
25
+ #
26
+ # @yield HTML that will be used in the warning text. Ignored if text is passed.
27
+ #
28
+ # @return [ActiveSupport::SafeBuffer] the HTML for the GOV.UK Warning text
29
+ # which can then be rendered on the page
30
+
31
+ def govuk_warning_text(text = nil, **govuk_warning_text_options)
32
+ govuk_warning_text_options[:class] = "govuk-warning-text #{govuk_warning_text_options[:classes]}".rstrip
33
+
34
+ tag.div(class: govuk_warning_text_options[:class], **(govuk_warning_text_options[:attributes] || {})) do
35
+ capture do
36
+ concat(tag.span('!', class: 'govuk-warning-text__icon'))
37
+ concat(tag.strong(class: 'govuk-warning-text__text') do
38
+ capture do
39
+ concat(tag.span(govuk_warning_text_options[:icon_fallback_text] || 'Warning', class: 'govuk-warning-text__assistive'))
40
+ if text
41
+ concat(text)
42
+ else
43
+ yield
44
+ end
45
+ end
46
+ end)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'gov_uk_helper/accordion'
4
+ require_relative 'gov_uk_helper/back_link'
3
5
  require_relative 'gov_uk_helper/breadcrumbs'
4
6
  require_relative 'gov_uk_helper/button'
5
7
  require_relative 'gov_uk_helper/details'
@@ -7,6 +9,8 @@ require_relative 'gov_uk_helper/error_message'
7
9
  require_relative 'gov_uk_helper/field'
8
10
  require_relative 'gov_uk_helper/field/character_count'
9
11
  require_relative 'gov_uk_helper/field/checkboxes'
12
+ require_relative 'gov_uk_helper/field/date_input'
13
+ require_relative 'gov_uk_helper/field/file_upload'
10
14
  require_relative 'gov_uk_helper/field/input'
11
15
  require_relative 'gov_uk_helper/field/select'
12
16
  require_relative 'gov_uk_helper/field/textarea'
@@ -20,12 +24,15 @@ require_relative 'gov_uk_helper/notification_banner'
20
24
  require_relative 'gov_uk_helper/pagination'
21
25
  require_relative 'gov_uk_helper/step_by_step_navigation'
22
26
  require_relative 'gov_uk_helper/tag'
27
+ require_relative 'gov_uk_helper/warning_text'
23
28
 
24
- module CrownMarketplaceUtils
29
+ module CrownMarketplaceUtils::Helpers
25
30
  # This module loads in all the GOV.UK Helper methods.
26
31
  # These are a collection of view helpers to help render GOV.UK components
27
32
 
28
33
  module GovUkHelper
34
+ include Accordion
35
+ include BackLink
29
36
  include Breadcrumbs
30
37
  include Button
31
38
  include Details
@@ -33,6 +40,8 @@ module CrownMarketplaceUtils
33
40
  include Field
34
41
  include Field::CharacterCount
35
42
  include Field::Checkboxes
43
+ include Field::DateInput
44
+ include Field::FileUpload
36
45
  include Field::Input
37
46
  include Field::Radios
38
47
  include Field::Select
@@ -46,5 +55,6 @@ module CrownMarketplaceUtils
46
55
  include Pagination
47
56
  include StepByStepNavigation
48
57
  include Tag
58
+ include WarningText
49
59
  end
50
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CrownMarketplaceUtils
4
- VERSION = '0.1.0.beta.3'
4
+ VERSION = '0.1.0.beta.5'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'crown_marketplace_utils/gov_uk_helper'
3
+ require 'crown_marketplace_utils/helpers/gov_uk_helper'
4
4
 
5
5
  require_relative 'crown_marketplace_utils/version'
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crown_marketplace_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta.3
4
+ version: 0.1.0.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - tim-s-ccs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-02 00:00:00.000000000 Z
11
+ date: 2022-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -168,27 +168,32 @@ files:
168
168
  - Rakefile
169
169
  - crown_marketplace_utils.gemspec
170
170
  - lib/crown_marketplace_utils.rb
171
- - lib/crown_marketplace_utils/gov_uk_helper.rb
172
- - lib/crown_marketplace_utils/gov_uk_helper/breadcrumbs.rb
173
- - lib/crown_marketplace_utils/gov_uk_helper/button.rb
174
- - lib/crown_marketplace_utils/gov_uk_helper/details.rb
175
- - lib/crown_marketplace_utils/gov_uk_helper/error_message.rb
176
- - lib/crown_marketplace_utils/gov_uk_helper/field.rb
177
- - lib/crown_marketplace_utils/gov_uk_helper/field/character_count.rb
178
- - lib/crown_marketplace_utils/gov_uk_helper/field/checkboxes.rb
179
- - lib/crown_marketplace_utils/gov_uk_helper/field/input.rb
180
- - lib/crown_marketplace_utils/gov_uk_helper/field/radios.rb
181
- - lib/crown_marketplace_utils/gov_uk_helper/field/select.rb
182
- - lib/crown_marketplace_utils/gov_uk_helper/field/textarea.rb
183
- - lib/crown_marketplace_utils/gov_uk_helper/fieldset.rb
184
- - lib/crown_marketplace_utils/gov_uk_helper/form_group.rb
185
- - lib/crown_marketplace_utils/gov_uk_helper/header.rb
186
- - lib/crown_marketplace_utils/gov_uk_helper/hint.rb
187
- - lib/crown_marketplace_utils/gov_uk_helper/label.rb
188
- - lib/crown_marketplace_utils/gov_uk_helper/notification_banner.rb
189
- - lib/crown_marketplace_utils/gov_uk_helper/pagination.rb
190
- - lib/crown_marketplace_utils/gov_uk_helper/step_by_step_navigation.rb
191
- - lib/crown_marketplace_utils/gov_uk_helper/tag.rb
171
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper.rb
172
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/accordion.rb
173
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/back_link.rb
174
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/breadcrumbs.rb
175
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/button.rb
176
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/details.rb
177
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/error_message.rb
178
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field.rb
179
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/character_count.rb
180
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/checkboxes.rb
181
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/date_input.rb
182
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/file_upload.rb
183
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/input.rb
184
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/radios.rb
185
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/select.rb
186
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/field/textarea.rb
187
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/fieldset.rb
188
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/form_group.rb
189
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/header.rb
190
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/hint.rb
191
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/label.rb
192
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/notification_banner.rb
193
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/pagination.rb
194
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/step_by_step_navigation.rb
195
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/tag.rb
196
+ - lib/crown_marketplace_utils/helpers/gov_uk_helper/warning_text.rb
192
197
  - lib/crown_marketplace_utils/version.rb
193
198
  - sig/crown_marketplace_utils.rbs
194
199
  homepage: https://github.com/tim-s-ccs/crown_marketplace_utils