govuk-components 1.1.7 → 2.0.0b2

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/app/components/govuk_component/{accordion.html.erb → accordion_component.html.erb} +2 -2
  4. data/app/components/govuk_component/{accordion.rb → accordion_component.rb} +7 -6
  5. data/app/components/govuk_component/{back_link.rb → back_link_component.rb} +5 -1
  6. data/app/components/govuk_component/base.rb +9 -7
  7. data/app/components/govuk_component/{breadcrumbs.html.erb → breadcrumbs_component.html.erb} +3 -6
  8. data/app/components/govuk_component/{breadcrumbs.rb → breadcrumbs_component.rb} +1 -1
  9. data/app/components/govuk_component/{cookie_banner.html.erb → cookie_banner_component.html.erb} +2 -6
  10. data/app/components/govuk_component/{cookie_banner.rb → cookie_banner_component.rb} +3 -2
  11. data/app/components/govuk_component/details_component.rb +34 -0
  12. data/app/components/govuk_component/{footer.html.erb → footer_component.html.erb} +3 -5
  13. data/app/components/govuk_component/{footer.rb → footer_component.rb} +3 -8
  14. data/app/components/govuk_component/header_component.html.erb +49 -0
  15. data/app/components/govuk_component/header_component.rb +110 -0
  16. data/app/components/govuk_component/{inset_text.rb → inset_text_component.rb} +3 -3
  17. data/app/components/govuk_component/notification_banner_component.html.erb +14 -0
  18. data/app/components/govuk_component/{notification_banner.rb → notification_banner_component.rb} +28 -14
  19. data/app/components/govuk_component/panel_component.rb +46 -0
  20. data/app/components/govuk_component/phase_banner_component.html.erb +6 -0
  21. data/app/components/govuk_component/phase_banner_component.rb +20 -0
  22. data/app/components/govuk_component/start_button_component.rb +47 -0
  23. data/app/components/govuk_component/summary_list_component.html.erb +11 -0
  24. data/app/components/govuk_component/summary_list_component.rb +61 -0
  25. data/app/components/govuk_component/tab_component.html.erb +11 -0
  26. data/app/components/govuk_component/{tabs.rb → tab_component.rb} +23 -12
  27. data/app/components/govuk_component/{tag.rb → tag_component.rb} +21 -3
  28. data/app/components/govuk_component/warning_text_component.rb +38 -0
  29. data/app/helpers/govuk_components_helper.rb +16 -16
  30. data/lib/govuk/components.rb +1 -0
  31. data/lib/govuk/components/helpers/css_utilities.rb +22 -0
  32. data/lib/govuk/components/version.rb +1 -1
  33. metadata +52 -42
  34. data/app/components/govuk_component/back_link.html.erb +0 -1
  35. data/app/components/govuk_component/details.html.erb +0 -10
  36. data/app/components/govuk_component/details.rb +0 -16
  37. data/app/components/govuk_component/header.html.erb +0 -47
  38. data/app/components/govuk_component/header.rb +0 -53
  39. data/app/components/govuk_component/notification_banner.html.erb +0 -23
  40. data/app/components/govuk_component/panel.html.erb +0 -13
  41. data/app/components/govuk_component/panel.rb +0 -28
  42. data/app/components/govuk_component/phase_banner.html.erb +0 -8
  43. data/app/components/govuk_component/phase_banner.rb +0 -16
  44. data/app/components/govuk_component/start_now_button.html.erb +0 -6
  45. data/app/components/govuk_component/start_now_button.rb +0 -16
  46. data/app/components/govuk_component/summary_list.html.erb +0 -19
  47. data/app/components/govuk_component/summary_list.rb +0 -34
  48. data/app/components/govuk_component/tabs.html.erb +0 -19
  49. data/app/components/govuk_component/warning.html.erb +0 -7
  50. data/app/components/govuk_component/warning.rb +0 -14
@@ -1,16 +0,0 @@
1
- class GovukComponent::StartNowButton < GovukComponent::Base
2
- attr_accessor :text, :href
3
-
4
- def initialize(text:, href:, classes: [], html_attributes: {})
5
- super(classes: classes, html_attributes: html_attributes)
6
-
7
- @text = text
8
- @href = href
9
- end
10
-
11
- private
12
-
13
- def default_classes
14
- %w(govuk-button govuk-button--start)
15
- end
16
- end
@@ -1,19 +0,0 @@
1
- <%= tag.dl(class: classes, **html_attributes) do %>
2
- <% rows.each do |row| %>
3
- <%= tag.div(class: row.classes, **row.html_attributes) do %>
4
- <dt class="govuk-summary-list__key">
5
- <%= row.key %>
6
- </dt>
7
-
8
- <dd class="govuk-summary-list__value">
9
- <%= row.value %>
10
- </dd>
11
-
12
- <% if any_row_has_actions? %>
13
- <dd class="govuk-summary-list__actions">
14
- <%= row.action %>
15
- </dd>
16
- <% end %>
17
- <% end %>
18
- <% end %>
19
- <% end %>
@@ -1,34 +0,0 @@
1
- class GovukComponent::SummaryList < GovukComponent::Base
2
- include ViewComponent::Slotable
3
-
4
- with_slot :row, collection: true, class_name: 'Row'
5
- wrap_slot :row
6
-
7
- def any_row_has_actions?
8
- rows.any? { |r| r.action.present? }
9
- end
10
-
11
- private
12
-
13
- def default_classes
14
- %w(govuk-summary-list)
15
- end
16
-
17
- class Row < GovukComponent::Slot
18
- attr_accessor :key, :value, :action
19
-
20
- def initialize(key:, value:, action: nil, classes: [], html_attributes: {})
21
- super(classes: classes, html_attributes: html_attributes)
22
-
23
- self.key = key
24
- self.value = value
25
- self.action = action
26
- end
27
-
28
- private
29
-
30
- def default_classes
31
- %w(govuk-summary-list__row)
32
- end
33
- end
34
- end
@@ -1,19 +0,0 @@
1
- <%= tag.div(class: classes, data: { module: 'govuk-tabs' }, **html_attributes) do %>
2
- <h2 class="govuk-tabs__title">
3
- <%= title %>
4
- </h2>
5
- <ul class="govuk-tabs__list">
6
- <% tabs.each.with_index do |tab, i| %>
7
- <li class="govuk-tabs__list-item <%= 'govuk-tabs__list-item--selected' if i.zero? %>">
8
- <a class="govuk-tabs__tab" href="<%= tab.id(prefix: '#') %>">
9
- <%= tab.title %>
10
- </a>
11
- </li>
12
- <% end %>
13
- </ul>
14
- <% tabs.each.with_index do |tab, i| %>
15
- <%= tag.div(class: tab.classes.append(tab.hidden_class(i)), id: tab.id, **tab.html_attributes) do %>
16
- <%= tab.content %>
17
- <% end %>
18
- <% end %>
19
- <% end %>
@@ -1,7 +0,0 @@
1
- <%= content_tag('div', class: classes, **html_attributes) do %>
2
- <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
3
- <strong class="govuk-warning-text__text">
4
- <span class="govuk-warning-text__assistive"><%= @icon_fallback_text %></span>
5
- <%= @text %>
6
- </strong>
7
- <% end %>
@@ -1,14 +0,0 @@
1
- class GovukComponent::Warning < GovukComponent::Base
2
- def initialize(text:, icon_fallback_text: 'Warning', classes: [], html_attributes: {})
3
- super(classes: classes, html_attributes: html_attributes)
4
-
5
- @text = text
6
- @icon_fallback_text = icon_fallback_text
7
- end
8
-
9
- private
10
-
11
- def default_classes
12
- %w(govuk-warning-text)
13
- end
14
- end