ccs-frontend_helpers 0.1.2 → 0.3.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -3
  3. data/CHANGELOG.md +40 -0
  4. data/Gemfile +7 -6
  5. data/Gemfile.lock +121 -114
  6. data/README.md +12 -0
  7. data/lib/ccs/components/ccs/footer.rb +0 -1
  8. data/lib/ccs/components/ccs/header.rb +0 -1
  9. data/lib/ccs/components/govuk/accordion/section/content.rb +1 -1
  10. data/lib/ccs/components/govuk/accordion.rb +11 -0
  11. data/lib/ccs/components/govuk/button.rb +4 -1
  12. data/lib/ccs/components/govuk/cookie_banner/action.rb +1 -0
  13. data/lib/ccs/components/govuk/cookie_banner/message.rb +1 -1
  14. data/lib/ccs/components/govuk/details.rb +1 -1
  15. data/lib/ccs/components/govuk/error_message.rb +5 -2
  16. data/lib/ccs/components/govuk/exit_this_page.rb +79 -0
  17. data/lib/ccs/components/govuk/field/input/character_count/count_message.rb +62 -0
  18. data/lib/ccs/components/govuk/field/input/character_count.rb +55 -42
  19. data/lib/ccs/components/govuk/field/input/password_input/show_hide_button.rb +72 -0
  20. data/lib/ccs/components/govuk/field/input/password_input.rb +101 -0
  21. data/lib/ccs/components/govuk/field/input/select.rb +2 -2
  22. data/lib/ccs/components/govuk/field/input/text_input.rb +23 -7
  23. data/lib/ccs/components/govuk/field/input.rb +4 -0
  24. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +8 -28
  25. data/lib/ccs/components/govuk/field/inputs/date_input.rb +4 -25
  26. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +1 -13
  27. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +1 -13
  28. data/lib/ccs/components/govuk/field/inputs/item.rb +24 -10
  29. data/lib/ccs/components/govuk/field/inputs/radios.rb +7 -23
  30. data/lib/ccs/components/govuk/field/inputs.rb +31 -7
  31. data/lib/ccs/components/govuk/field.rb +12 -2
  32. data/lib/ccs/components/govuk/fieldset.rb +1 -1
  33. data/lib/ccs/components/govuk/footer/meta.rb +1 -1
  34. data/lib/ccs/components/govuk/footer.rb +1 -2
  35. data/lib/ccs/components/govuk/header/navigation.rb +4 -2
  36. data/lib/ccs/components/govuk/header.rb +26 -8
  37. data/lib/ccs/components/govuk/pagination/increment/next.rb +6 -3
  38. data/lib/ccs/components/govuk/pagination/increment/previous.rb +6 -3
  39. data/lib/ccs/components/govuk/pagination/increment.rb +11 -3
  40. data/lib/ccs/components/govuk/pagination/item.rb +1 -1
  41. data/lib/ccs/components/govuk/pagination.rb +2 -3
  42. data/lib/ccs/components/govuk/summary_list/action/link.rb +18 -3
  43. data/lib/ccs/components/govuk/summary_list/card/actions.rb +3 -2
  44. data/lib/ccs/components/govuk/summary_list/card.rb +1 -1
  45. data/lib/ccs/components/govuk/summary_list/row/actions.rb +3 -2
  46. data/lib/ccs/components/govuk/summary_list/row.rb +7 -2
  47. data/lib/ccs/components/govuk/summary_list.rb +1 -1
  48. data/lib/ccs/components/govuk/tabs.rb +5 -3
  49. data/lib/ccs/components/govuk/task_list/item/status.rb +64 -0
  50. data/lib/ccs/components/govuk/task_list/item/title.rb +54 -0
  51. data/lib/ccs/components/govuk/task_list/item.rb +75 -0
  52. data/lib/ccs/components/govuk/task_list.rb +52 -0
  53. data/lib/ccs/components/govuk/warning_text.rb +1 -1
  54. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +1 -1
  55. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +1 -1
  56. data/lib/ccs/frontend_helpers/govuk_frontend/exit_this_page.rb +28 -0
  57. data/lib/ccs/frontend_helpers/govuk_frontend/password_input.rb +28 -0
  58. data/lib/ccs/frontend_helpers/govuk_frontend/task_list.rb +28 -0
  59. data/lib/ccs/frontend_helpers/govuk_frontend.rb +6 -0
  60. data/lib/ccs/frontend_helpers/version.rb +1 -1
  61. data/package.json +10 -0
  62. data/yarn.lock +8 -0
  63. metadata +15 -2
@@ -13,28 +13,32 @@ module CCS
13
13
  # @return [String] The href for the action link
14
14
  # @!attribute [r] visually_hidden_text
15
15
  # @return [String] Visually hidden text for the action link
16
+ # @!attribute [r] card_title
17
+ # @return [String] Card title text for the action link
16
18
 
17
19
  class Link < Base
18
20
  private
19
21
 
20
- attr_reader :text, :href, :visually_hidden_text
22
+ attr_reader :text, :href, :visually_hidden_text, :card_title
21
23
 
22
24
  public
23
25
 
24
26
  # @param text [String] the text for the action link
25
27
  # @param href [String] the href for the action link
26
28
  # @param visually_hidden_text [String] optional visually hidden text for the action link
29
+ # @param card_title [String] card title text for the action link
27
30
  # @param options [Hash] options that will be used in customising the HTML
28
31
  #
29
32
  # @option options [String] :classes additional CSS classes for the summary list action link HTML
30
33
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
34
 
32
- def initialize(text:, href:, visually_hidden_text: nil, **options)
35
+ def initialize(text:, href:, visually_hidden_text: nil, card_title: nil, **options)
33
36
  super(**options)
34
37
 
35
38
  @text = text
36
39
  @href = href
37
40
  @visually_hidden_text = visually_hidden_text
41
+ @card_title = card_title
38
42
  end
39
43
 
40
44
  # Generates the HTML for the GOV.UK Summary list action link
@@ -44,7 +48,18 @@ module CCS
44
48
  def render
45
49
  link_to(href, **@options[:attributes]) do
46
50
  concat(text)
47
- concat(tag.span(visually_hidden_text, class: 'govuk-visually-hidden')) if visually_hidden_text
51
+ if visually_hidden_text.present? || card_title.present?
52
+ concat(tag.span(class: 'govuk-visually-hidden') do
53
+ if visually_hidden_text
54
+ concat(' ')
55
+ concat(visually_hidden_text)
56
+ end
57
+ if card_title
58
+ concat(' ')
59
+ concat("(#{card_title})")
60
+ end
61
+ end)
62
+ end
48
63
  end
49
64
  end
50
65
 
@@ -20,14 +20,15 @@ module CCS
20
20
 
21
21
  # @param items [Array<Hash>] An array of attributes for the action links.
22
22
  # See {Components::GovUK::SummaryList::Action::Link#initialize Action::Link#initialize} for details of the items in the array.
23
+ # @param card_title [String] the text for the card title
23
24
  # @param options [Hash] options that will be used in customising the HTML
24
25
  #
25
26
  # @option options [String] :classes additional CSS classes for the summary list card actions HTML
26
27
 
27
- def initialize(items:, **options)
28
+ def initialize(items:, card_title:, **options)
28
29
  super(**options)
29
30
 
30
- @action_links = items.map { |item| Action::Link.new(context: @context, **item) }
31
+ @action_links = items.map { |item| Action::Link.new(context: @context, card_title: card_title, **item) }
31
32
  end
32
33
 
33
34
  # Generates the HTML for the GOV.UK Summary list card actions
@@ -34,7 +34,7 @@ module CCS
34
34
  super(**options)
35
35
 
36
36
  @title = Title.new(context: @context, **title) if title
37
- @actions = Actions.new(context: @context, **actions) if actions
37
+ @actions = Actions.new(context: @context, card_title: title&.dig(:text), **actions) if actions
38
38
  end
39
39
 
40
40
  # Generates the HTML for the GOV.UK Summary card
@@ -20,14 +20,15 @@ module CCS
20
20
 
21
21
  # @param items [Array<Hash>] An array of attributes for the action links.
22
22
  # See {Components::GovUK::SummaryList::Action::Link#initialize Action::Link#initialize} for details of the items in the array.
23
+ # @param card_title [String] the text for the card title
23
24
  # @param options [Hash] options that will be used in customising the HTML
24
25
  #
25
26
  # @option options [String] :classes additional CSS classes for the summary list row actions HTML
26
27
 
27
- def initialize(items:, **options)
28
+ def initialize(items:, card_title: nil, **options)
28
29
  super(**options)
29
30
 
30
- @action_links = items.map { |item| Action::Link.new(context: @context, **item) }
31
+ @action_links = items.map { |item| Action::Link.new(card_title: card_title, context: @context, **item) }
31
32
  end
32
33
 
33
34
  # Generates the HTML for the GOV.UK Summary list row actions
@@ -25,15 +25,18 @@ module CCS
25
25
 
26
26
  public
27
27
 
28
+ # rubocop:disable Metrics/ParameterLists
29
+
28
30
  # @param any_row_has_actions [Boolean] flag to indicate if any rows have actions
29
31
  # @param key [Hash] attributes for the key, see {CCS::Components::GovUK::SummaryList::Row::Key#initialize Key#initialize} for more details.
30
32
  # @param value [Hash] attributes for the value, see {CCS::Components::GovUK::SummaryList::Row::Value#initialize Value#initialize} for more details.
31
33
  # @param actions [Hash] attributes for the actions, see {CCS::Components::GovUK::SummaryList::Row::Actions#initialize Actions#initialize} for more details.
34
+ # @param card_title [String] the text for the card title
32
35
  # @param options [Hash] options that will be used in customising the HTML
33
36
  #
34
37
  # @option options [String] :classes additional CSS classes for the summary list row HTML
35
38
 
36
- def initialize(any_row_has_actions:, key:, value:, actions: nil, **options)
39
+ def initialize(any_row_has_actions:, key:, value:, actions: nil, card_title: nil, **options)
37
40
  super(**options)
38
41
 
39
42
  actions_present = actions && actions[:items].present?
@@ -42,9 +45,11 @@ module CCS
42
45
 
43
46
  @key = Key.new(context: @context, **key)
44
47
  @value = Value.new(context: @context, **value)
45
- @actions = Actions.new(context: @context, **actions) if actions_present
48
+ @actions = Actions.new(context: @context, card_title: card_title, **actions) if actions_present
46
49
  end
47
50
 
51
+ # rubocop:enable Metrics/ParameterLists
52
+
48
53
  # Generates the HTML for the GOV.UK Summary list row
49
54
  #
50
55
  # @return [ActiveSupport::SafeBuffer]
@@ -35,7 +35,7 @@ module CCS
35
35
 
36
36
  any_row_has_actions = summary_list_items.any? { |summary_list_item| summary_list_item.dig(:actions, :items).present? }
37
37
 
38
- @summary_list_rows = summary_list_items.map { |summary_list_item| Row.new(any_row_has_actions: any_row_has_actions, context: @context, **summary_list_item) }
38
+ @summary_list_rows = summary_list_items.map { |summary_list_item| Row.new(any_row_has_actions: any_row_has_actions, card_title: card&.dig(:title, :text), context: @context, **summary_list_item) }
39
39
  @card = Card.new(context: @context, **card) if card
40
40
  end
41
41
 
@@ -50,9 +50,11 @@ module CCS
50
50
  def render
51
51
  tag.div(**options[:attributes]) do
52
52
  concat(tag.h2(title, class: 'govuk-tabs__title'))
53
- concat(tag.ul(class: 'govuk-tabs__list') do
54
- @tabs.each { |tab| concat(tab.render) }
55
- end)
53
+ if @tabs.present?
54
+ concat(tag.ul(class: 'govuk-tabs__list') do
55
+ @tabs.each { |tab| concat(tab.render) }
56
+ end)
57
+ end
56
58
  @panels.each { |panel| concat(panel.render) }
57
59
  end
58
60
  end
@@ -0,0 +1,64 @@
1
+ require_relative '../../../base'
2
+ require_relative '../../tag'
3
+
4
+ module CCS
5
+ module Components
6
+ module GovUK
7
+ class TaskList < Base
8
+ class Item < Base
9
+ # = GOV.UK Task list item status
10
+ #
11
+ # @!attribute [r] text
12
+ # @return [String] Text for the status
13
+ # @!attribute [r] tag_component
14
+ # @return [Tag] Tag for the status
15
+
16
+ class Status < Base
17
+ private
18
+
19
+ attr_reader :tag_component, :text
20
+
21
+ public
22
+
23
+ # @param id_prefix [String] the id prefix for the task list item
24
+ # @param tag_options [Hash] paramters for the govuk tag (see {Components::GovUK::Tag Tag}).
25
+ # options are:
26
+ # - +text+
27
+ # - +colour+
28
+ # - +options+
29
+ # @param text [String] the text for the status. If tag is nil then this is used
30
+ # @param options [Hash] options that will be used in customising the HTML
31
+ #
32
+ # @option options [String] :classes additional CSS classes for the task list row status HTML
33
+
34
+ def initialize(id_prefix:, tag_options: nil, text: nil, **options)
35
+ super(**options)
36
+ @options[:attributes][:id] = "#{id_prefix}-status"
37
+
38
+ @text = text
39
+ @tag_component = Tag.new(context: @context, **tag_options) if tag_options
40
+ end
41
+
42
+ # Generates the HTML for the GOV.UK Task list item status
43
+ #
44
+ # @return [ActiveSupport::SafeBuffer]
45
+
46
+ def render
47
+ tag.div(class: @options[:attributes][:class], id: @options[:attributes][:id]) do
48
+ if tag_component
49
+ tag_component.render
50
+ else
51
+ text
52
+ end
53
+ end
54
+ end
55
+
56
+ # The default attributes for the task list item status
57
+
58
+ DEFAULT_ATTRIBUTES = { class: 'govuk-task-list__status' }.freeze
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,54 @@
1
+ require_relative '../../../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class TaskList < Base
7
+ class Item < Base
8
+ # = GOV.UK Task list item title
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the title
12
+ # @!attribute [r] href
13
+ # @return [String] Optional link for the title
14
+
15
+ class Title < Base
16
+ private
17
+
18
+ attr_reader :text, :href
19
+
20
+ public
21
+
22
+ # @param text [String] the text for the title
23
+ # @param id_prefix [String] the id prefix for the task list item
24
+ # @param href [String] optional link for the title
25
+ # @param hint_text [String] flag to indicate if there is a hint
26
+ # @param options [Hash] options that will be used in customising the HTML
27
+ #
28
+ # @option options [String] :classes additional CSS classes for the task list item title HTML
29
+
30
+ def initialize(text:, id_prefix:, href: nil, hint_text: nil, **options)
31
+ super(**options)
32
+ @options[:attributes][:aria] = { describedby: (hint_text ? "#{id_prefix}-hint " : '') + "#{id_prefix}-status" } if href
33
+
34
+ @text = text
35
+ @href = href
36
+ end
37
+
38
+ # Generates the HTML for the GOV.UK Task list item title
39
+ #
40
+ # @return [ActiveSupport::SafeBuffer]
41
+
42
+ def render
43
+ if href
44
+ link_to(text, href, class: "govuk-link govuk-task-list__link #{@options[:attributes][:class]}".rstrip, aria: { describedby: @options[:attributes][:aria][:describedby] })
45
+ else
46
+ tag.div(text, class: @options[:attributes][:class])
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,75 @@
1
+ require_relative '../../base'
2
+ require_relative 'item/title'
3
+ require_relative 'item/status'
4
+
5
+ module CCS
6
+ module Components
7
+ module GovUK
8
+ class TaskList < Base
9
+ # = GOV.UK Task list item
10
+ #
11
+ # The individual list item for the task list
12
+ #
13
+ # @!attribute [r] title
14
+ # @return [Title] Initialised task list item title
15
+ # @!attribute [r] status
16
+ # @return [Status] Initialised task list item status
17
+ # @!attribute [r] hint_text
18
+ # @return [String] optional hint text for the item
19
+ # @!attribute [r] id_prefix
20
+ # @return [String] ID prefix for the task list item
21
+
22
+ class Item < Base
23
+ private
24
+
25
+ attr_reader :id_prefix, :title, :hint_text, :status
26
+
27
+ public
28
+
29
+ # rubocop:disable Metrics/ParameterLists
30
+
31
+ # @param title [Hash] options for the item title.
32
+ # See {Components::GovUK::TaskList::Item::Title#initialize Title#initialize} for details of title.
33
+ # @param status [Hash] options for the item status.
34
+ # See {Components::GovUK::TaskList::Item::Status#initialize Status#initialize} for details of status.
35
+ # @param index [Integer] the index of the item
36
+ # @param id_prefix [String] the id prefix for the task list
37
+ # @param hint_text [String] optional hint text for the item
38
+ # @param options [Hash] options that will be used in customising the HTML
39
+ #
40
+ # @option options [String] :classes additional CSS classes for the task list item HTML
41
+
42
+ def initialize(title:, status:, index:, id_prefix:, hint_text: nil, **options)
43
+ super(**options)
44
+ @options[:attributes][:class] << ' govuk-task-list__item--with-link' if title[:href]
45
+
46
+ @id_prefix = "#{id_prefix}-#{index}"
47
+ @title = Title.new(context: @context, id_prefix: @id_prefix, hint_text: hint_text, **title)
48
+ @hint_text = hint_text
49
+ @status = Status.new(context: @context, id_prefix: @id_prefix, **status)
50
+ end
51
+
52
+ # rubocop:enable Metrics/ParameterLists
53
+
54
+ # Generates the HTML for the GOV.UK Task list item
55
+ #
56
+ # @return [ActiveSupport::SafeBuffer]
57
+
58
+ def render
59
+ tag.li(class: options[:attributes][:class]) do
60
+ concat(tag.div(class: 'govuk-task-list__name-and-hint') do
61
+ concat(title.render)
62
+ concat(tag.div(hint_text, class: 'govuk-task-list__hint', id: "#{id_prefix}-hint")) if hint_text
63
+ end)
64
+ concat(status.render)
65
+ end
66
+ end
67
+
68
+ # The default attributes for the task list item
69
+
70
+ DEFAULT_ATTRIBUTES = { class: 'govuk-task-list__item' }.freeze
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,52 @@
1
+ require_relative '../base'
2
+ require_relative 'task_list/item'
3
+
4
+ module CCS
5
+ module Components
6
+ module GovUK
7
+ # = GOV.UK Task list
8
+ #
9
+ # This is used to generate the task list component from the
10
+ # {https://design-system.service.gov.uk/components/task-list GDS - Components - Task list}
11
+ #
12
+ # @!attribute [r] task_list_items
13
+ # @return [Array<Link>] An array of the initialised task list items
14
+
15
+ class TaskList < Base
16
+ private
17
+
18
+ attr_reader :task_list_items
19
+
20
+ public
21
+
22
+ # @param task_list_items [Array<Hash>] An array of task list items.
23
+ # See {Components::GovUK::TaskList::Item#initialize Item#initialize} for details of the items in the array.
24
+ # @param options [Hash] options that will be used in customising the HTML
25
+ #
26
+ # @option options [String] :classes additional CSS classes for the task list HTML
27
+ # @option options [Sting] :id_prefix id prefix for the task list, defaults to +'task-list'+
28
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
29
+
30
+ def initialize(task_list_items:, id_prefix: nil, **options)
31
+ super(**options)
32
+
33
+ @task_list_items = task_list_items.map.with_index(1) { |task_list_item, index| Item.new(context: @context, index: index, id_prefix: id_prefix || 'task-list', **task_list_item) }
34
+ end
35
+
36
+ # Generates the HTML for the GOV.UK task list component
37
+ #
38
+ # @return [ActiveSupport::SafeBuffer]
39
+
40
+ def render
41
+ tag.ul(**options[:attributes]) do
42
+ task_list_items.each { |task_list_item| concat(task_list_item.render) }
43
+ end
44
+ end
45
+
46
+ # The default attributes for the task list
47
+
48
+ DEFAULT_ATTRIBUTES = { class: 'govuk-task-list' }.freeze
49
+ end
50
+ end
51
+ end
52
+ end
@@ -42,7 +42,7 @@ module CCS
42
42
  tag.div(**options[:attributes]) do
43
43
  concat(tag.span('!', class: 'govuk-warning-text__icon', aria: { hidden: true }))
44
44
  concat(tag.strong(class: 'govuk-warning-text__text') do
45
- concat(tag.span(options[:icon_fallback_text] || 'Warning', class: 'govuk-warning-text__assistive'))
45
+ concat(tag.span(options[:icon_fallback_text] || 'Warning', class: 'govuk-visually-hidden'))
46
46
  if text
47
47
  concat(text)
48
48
  else
@@ -19,7 +19,7 @@ module CCS
19
19
  #
20
20
  # @return (see CCS::Components::GovUK::Input::CharacterCount#render)
21
21
 
22
- def govuk_character_count(attribute, character_count_options, **options)
22
+ def govuk_character_count(attribute, character_count_options = {}, **options)
23
23
  Components::GovUK::Field::Input::CharacterCount.new(context: self, attribute: attribute, character_count_options: character_count_options, **options).render
24
24
  end
25
25
  end
@@ -19,7 +19,7 @@ module CCS
19
19
  #
20
20
  # @return (see CCS::Components::GovUK::ErrorMessage#render)
21
21
 
22
- def govuk_error_message(error_message, attribute, **options)
22
+ def govuk_error_message(error_message, attribute = nil, **options)
23
23
  Components::GovUK::ErrorMessage.new(context: self, message: error_message, attribute: attribute, **options).render
24
24
  end
25
25
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../components/govuk/exit_this_page'
4
+
5
+ module CCS
6
+ module FrontendHelpers
7
+ module GovUKFrontend
8
+ # = GOV.UK Exit this page
9
+ #
10
+ # This is used to generate the exit this page component from the
11
+ # {https://design-system.service.gov.uk/components/exit-this-page GDS - Components - Exit this page}
12
+
13
+ module ExitThisPage
14
+ # Generates the HTML for the GOV.UK Exit this page component
15
+ #
16
+ # @param (see CCS::Components::GovUK::ExitThisPage#initialize)
17
+ #
18
+ # @option (see CCS::Components::GovUK::ExitThisPage#initialize)
19
+ #
20
+ # @return (see CCS::Components::GovUK::ExitThisPage#render)
21
+
22
+ def govuk_exit_this_page(text = nil, redirect_url = nil, **options)
23
+ Components::GovUK::ExitThisPage.new(context: self, text: text, redirect_url: redirect_url, **options).render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../components/govuk/field/input/password_input'
4
+
5
+ module CCS
6
+ module FrontendHelpers
7
+ module GovUKFrontend
8
+ # = GOV.UK Password input
9
+ #
10
+ # This helper is used for generating the password input component from the
11
+ # {https://design-system.service.gov.uk/components/password-input GDS - Components - Password Input}
12
+
13
+ module PasswordInput
14
+ # Generates the HTML for the GOV.UK Password Input component
15
+ #
16
+ # @param (see CCS::Components::GovUK::Input::PasswordInput#initialize)
17
+ #
18
+ # @option (see CCS::Components::GovUK::Input::PasswordInput#initialize)
19
+ #
20
+ # @return (see CCS::Components::GovUK::Input::PasswordInput#render)
21
+
22
+ def govuk_password_input(attribute, **options)
23
+ Components::GovUK::Field::Input::PasswordInput.new(context: self, attribute: attribute, **options).render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../components/govuk/task_list'
4
+
5
+ module CCS
6
+ module FrontendHelpers
7
+ module GovUKFrontend
8
+ # = GOV.UK Task list
9
+ #
10
+ # This helper is used for generating the task list component from the
11
+ # {https://design-system.service.gov.uk/components/task-list GDS - Components - Task list}
12
+
13
+ module TaskList
14
+ # Generates the HTML for the GOV.UK Task list component
15
+ #
16
+ # @param (see CCS::Components::GovUK::TaskList#initialize)
17
+ #
18
+ # @option (see CCS::Components::GovUK::TaskList#initialize)
19
+ #
20
+ # @return (see CCS::Components::GovUK::TaskList#render)
21
+
22
+ def govuk_task_list(task_list_items, **options)
23
+ Components::GovUK::TaskList.new(context: self, task_list_items: task_list_items, **options).render
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -11,6 +11,7 @@ require_relative 'govuk_frontend/date_input'
11
11
  require_relative 'govuk_frontend/details'
12
12
  require_relative 'govuk_frontend/error_message'
13
13
  require_relative 'govuk_frontend/error_summary'
14
+ require_relative 'govuk_frontend/exit_this_page'
14
15
  require_relative 'govuk_frontend/fieldset'
15
16
  require_relative 'govuk_frontend/file_upload'
16
17
  require_relative 'govuk_frontend/footer'
@@ -23,6 +24,7 @@ require_relative 'govuk_frontend/label'
23
24
  require_relative 'govuk_frontend/notification_banner'
24
25
  require_relative 'govuk_frontend/pagination'
25
26
  require_relative 'govuk_frontend/panel'
27
+ require_relative 'govuk_frontend/password_input'
26
28
  require_relative 'govuk_frontend/phase_banner'
27
29
  require_relative 'govuk_frontend/radios'
28
30
  require_relative 'govuk_frontend/select'
@@ -32,6 +34,7 @@ require_relative 'govuk_frontend/summary_list'
32
34
  require_relative 'govuk_frontend/table'
33
35
  require_relative 'govuk_frontend/tabs'
34
36
  require_relative 'govuk_frontend/tag'
37
+ require_relative 'govuk_frontend/task_list'
35
38
  require_relative 'govuk_frontend/textarea'
36
39
  require_relative 'govuk_frontend/warning_text'
37
40
 
@@ -52,6 +55,7 @@ module CCS
52
55
  include Details
53
56
  include ErrorMessage
54
57
  include ErrorSummary
58
+ include ExitThisPage
55
59
  include FileUpload
56
60
  include Fieldset
57
61
  include Footer
@@ -64,6 +68,7 @@ module CCS
64
68
  include NotificationBanner
65
69
  include Pagination
66
70
  include Panel
71
+ include PasswordInput
67
72
  include PhaseBanner
68
73
  include Radios
69
74
  include Select
@@ -73,6 +78,7 @@ module CCS
73
78
  include Table
74
79
  include Tabs
75
80
  include Tag
81
+ include TaskList
76
82
  include Textarea
77
83
  include WarningText
78
84
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '0.1.2'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
data/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "private": true,
3
+ "name": "ccs-frontend_helpers",
4
+ "version": "0.0.0",
5
+ "author": "CCS",
6
+ "license": "MIT",
7
+ "devDependencies": {
8
+ "govuk-frontend": "^5.3.0"
9
+ }
10
+ }
data/yarn.lock ADDED
@@ -0,0 +1,8 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ govuk-frontend@^5.3.0:
6
+ version "5.3.0"
7
+ resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-5.3.0.tgz#f9a2b405925beada90d074e17939f9d8ddcd256e"
8
+ integrity sha512-w6yaaDU3nqhVmWJFnOuJKRIUEB/2RrTFGzoA3z5n4cTG9h292EseT/q+JJA/LYTf5IYzeTIVAUbE5fFjUxefiQ==