primer_view_components 0.0.27 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -0
  3. data/README.md +1 -1
  4. data/app/assets/javascripts/primer_view_components.js +1 -1
  5. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  6. data/app/components/primer/auto_complete_component.d.ts +1 -0
  7. data/app/components/primer/auto_complete_component.html.erb +5 -0
  8. data/app/components/primer/auto_complete_component.rb +96 -0
  9. data/app/components/primer/auto_complete_component.ts +1 -0
  10. data/app/components/primer/auto_complete_item_component.rb +38 -0
  11. data/app/components/primer/avatar_component.rb +6 -5
  12. data/app/components/primer/avatar_stack_component.rb +0 -2
  13. data/app/components/primer/base_component.rb +2 -2
  14. data/app/components/primer/blankslate_component.html.erb +1 -5
  15. data/app/components/primer/blankslate_component.rb +0 -2
  16. data/app/components/primer/border_box_component.rb +29 -3
  17. data/app/components/primer/box_component.rb +1 -1
  18. data/app/components/primer/breadcrumb_component.rb +0 -1
  19. data/app/components/primer/button_group_component.rb +0 -2
  20. data/app/components/primer/component.rb +2 -1
  21. data/app/components/primer/counter_component.rb +15 -5
  22. data/app/components/primer/details_component.rb +1 -1
  23. data/app/components/primer/dropdown/menu_component.rb +0 -2
  24. data/app/components/primer/dropdown_component.rb +0 -2
  25. data/app/components/primer/flash_component.html.erb +2 -2
  26. data/app/components/primer/flash_component.rb +0 -2
  27. data/app/components/primer/flex_component.rb +16 -16
  28. data/app/components/primer/heading_component.rb +1 -1
  29. data/app/components/primer/label_component.rb +3 -7
  30. data/app/components/primer/layout_component.rb +0 -2
  31. data/app/components/primer/link_component.rb +37 -7
  32. data/app/components/primer/menu_component.rb +2 -4
  33. data/app/components/primer/navigation/tab_component.html.erb +9 -0
  34. data/app/components/primer/navigation/tab_component.rb +102 -0
  35. data/app/components/primer/octicon_component.rb +5 -5
  36. data/app/components/primer/popover_component.html.erb +3 -7
  37. data/app/components/primer/popover_component.rb +75 -63
  38. data/app/components/primer/primer.d.ts +3 -0
  39. data/app/components/primer/primer.js +1 -0
  40. data/app/components/primer/primer.ts +1 -0
  41. data/app/components/primer/progress_bar_component.rb +5 -6
  42. data/app/components/primer/spinner_component.html.erb +1 -3
  43. data/app/components/primer/spinner_component.rb +1 -0
  44. data/app/components/primer/subhead_component.rb +0 -2
  45. data/app/components/primer/tab_container_component.d.ts +1 -0
  46. data/app/components/primer/tab_nav_component.html.erb +9 -11
  47. data/app/components/primer/tab_nav_component.rb +46 -73
  48. data/app/components/primer/text_component.rb +3 -1
  49. data/app/components/primer/time_ago_component.d.ts +1 -0
  50. data/app/components/primer/time_ago_component.rb +2 -1
  51. data/app/components/primer/timeline_item_component.rb +3 -3
  52. data/app/components/primer/underline_nav_component.html.erb +19 -7
  53. data/app/components/primer/underline_nav_component.rb +80 -14
  54. data/app/lib/primer/classify.rb +15 -18
  55. data/app/lib/primer/classify/cache.rb +8 -3
  56. data/app/lib/primer/classify/functional_background_colors.rb +61 -0
  57. data/app/lib/primer/classify/functional_border_colors.rb +51 -0
  58. data/app/lib/primer/classify/functional_colors.rb +68 -0
  59. data/app/lib/primer/classify/functional_text_colors.rb +62 -0
  60. data/app/lib/primer/fetch_or_fallback_helper.rb +17 -4
  61. data/app/lib/primer/tabbed_component_helper.rb +37 -0
  62. data/app/lib/primer/view_helper.rb +10 -12
  63. data/lib/primer/view_components/engine.rb +4 -0
  64. data/lib/primer/view_components/version.rb +1 -1
  65. data/static/statuses.json +1 -1
  66. metadata +31 -5
  67. data/app/components/primer/slot.rb +0 -10
  68. data/app/lib/primer/classify/functional_colors.rb.orig +0 -124
  69. data/app/lib/primer/view_helper/dsl.rb +0 -34
@@ -0,0 +1,3 @@
1
+ import './auto_complete_component';
2
+ import './tab_container_component';
3
+ import './time_ago_component';
@@ -1,2 +1,3 @@
1
+ import './auto_complete_component';
1
2
  import './tab_container_component';
2
3
  import './time_ago_component';
@@ -1,2 +1,3 @@
1
+ import './auto_complete_component'
1
2
  import './tab_container_component'
2
3
  import './time_ago_component'
@@ -3,7 +3,6 @@
3
3
  module Primer
4
4
  # Use ProgressBar to visualize task completion.
5
5
  class ProgressBarComponent < Primer::Component
6
- include ViewComponent::SlotableV2
7
6
  status :beta
8
7
 
9
8
  # Use the Item slot to add an item to the progress bas
@@ -11,7 +10,7 @@ module Primer
11
10
  # @param percentage [Integer] The percent complete
12
11
  # @param bg [Symbol] The background color
13
12
  # @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
14
- renders_many :items, lambda { |percentage: 0, bg: :green, **system_arguments|
13
+ renders_many :items, lambda { |percentage: 0, bg: :success_inverse, **system_arguments|
15
14
  percentage = percentage
16
15
  system_arguments = system_arguments
17
16
 
@@ -39,19 +38,19 @@ module Primer
39
38
  #
40
39
  # @example Small
41
40
  # <%= render(Primer::ProgressBarComponent.new(size: :small)) do |component| %>
42
- # <% component.item(bg: :blue_4, percentage: 50) %>
41
+ # <% component.item(bg: :info_inverse, percentage: 50) %>
43
42
  # <% end %>
44
43
  #
45
44
  # @example Large
46
45
  # <%= render(Primer::ProgressBarComponent.new(size: :large)) do |component| %>
47
- # <% component.item(bg: :red_4, percentage: 75) %>
46
+ # <% component.item(bg: :danger_inverse, percentage: 75) %>
48
47
  # <% end %>
49
48
  #
50
49
  # @example Multiple items
51
50
  # <%= render(Primer::ProgressBarComponent.new) do |component| %>
52
51
  # <% component.item(percentage: 10) %>
53
- # <% component.item(bg: :blue_4, percentage: 20) %>
54
- # <% component.item(bg: :red_4, percentage: 30) %>
52
+ # <% component.item(bg: :info_inverse, percentage: 20) %>
53
+ # <% component.item(bg: :danger_inverse, percentage: 30) %>
55
54
  # <% end %>
56
55
  #
57
56
  # @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
@@ -1,6 +1,4 @@
1
1
  <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
2
  <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" />
3
- <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke">
4
- <animateTransform attributeName="transform" type="rotate" from="0 8 8" to="360 8 8" dur="1s" repeatCount="indefinite" />
5
- </path>
3
+ <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" />
6
4
  <% end %>
@@ -31,6 +31,7 @@ module Primer
31
31
  @system_arguments = system_arguments
32
32
  @system_arguments[:tag] = :svg
33
33
  @system_arguments[:style] ||= DEFAULT_STYLE
34
+ @system_arguments[:animation] = :rotate
34
35
  @system_arguments[:width] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
35
36
  @system_arguments[:height] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
36
37
  @system_arguments[:viewBox] = "0 0 16 16"
@@ -5,8 +5,6 @@ module Primer
5
5
  class SubheadComponent < Primer::Component
6
6
  status :beta
7
7
 
8
- include ViewComponent::SlotableV2
9
-
10
8
  # The heading
11
9
  #
12
10
  # @param danger [Boolean] Whether to style the heading as dangerous.
@@ -0,0 +1 @@
1
+ import '@github/tab-container-element';
@@ -1,17 +1,15 @@
1
- <%= render wrapper.new(**@system_arguments) do %>
2
- <nav role="tablist" aria-label="<%= @aria_label %>" class="tabnav-tabs">
3
- <% tabs.each do |tab| %>
4
- <%= tab %>
5
- <% end %>
6
- </nav >
1
+ <%= wrapper do %>
2
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
3
+ <nav role="tablist" aria-label="<%= @aria_label %>" class="tabnav-tabs">
4
+ <% tabs.each do |tab| %>
5
+ <%= tab %>
6
+ <% end %>
7
+ </nav>
8
+ <% end %>
7
9
 
8
10
  <% if @with_panel %>
9
11
  <% tabs.each do |tab| %>
10
- <% if tab.panel.present? %>
11
- <div role="tabpanel" <%= "hidden" if tab.hidden? %>>
12
- <%= tab.panel %>
13
- </div>
14
- <% end %>
12
+ <%= tab.panel %>
15
13
  <% end %>
16
14
  <% end %>
17
15
  <% end %>
@@ -3,34 +3,64 @@
3
3
  module Primer
4
4
  # Use TabNav to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page.
5
5
  class TabNavComponent < Primer::Component
6
- include ViewComponent::SlotableV2
6
+ include Primer::TabbedComponentHelper
7
7
 
8
- class MultipleSelectedTabsError < StandardError; end
9
- class NoSelectedTabsError < StandardError; end
10
-
11
- # Tabs to be rendered.
8
+ # Tabs to be rendered. For more information, refer to <%= link_to_component(Primer::Navigation::TabComponent) %>.
12
9
  #
13
- # @param title [String] Text to be rendered by the tab.
14
10
  # @param selected [Boolean] Whether the tab is selected.
15
11
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
16
- renders_many :tabs, lambda { |**system_arguments|
17
- return TabComponent.new(**system_arguments) unless @with_panel
18
-
19
- TabComponent.new(tag: :button, type: :button, **system_arguments)
12
+ renders_many :tabs, lambda { |selected: false, **system_arguments|
13
+ system_arguments[:classes] = class_names(
14
+ "tabnav-tab",
15
+ system_arguments[:classes]
16
+ )
17
+ Primer::Navigation::TabComponent.new(selected: selected, with_panel: @with_panel, **system_arguments)
20
18
  }
21
19
 
22
20
  # @example Default
23
21
  # <%= render(Primer::TabNavComponent.new) do |c| %>
24
- # <% c.tab(selected: true, title: "Tab 1", href: "#") %>
25
- # <% c.tab(title: "Tab 2", href: "#") %>
26
- # <% c.tab(title: "Tab 3", href: "#") %>
22
+ # <% c.tab(selected: true, href: "#") { "Tab 1" }%>
23
+ # <% c.tab(href: "#") { "Tab 2" } %>
24
+ # <% c.tab(href: "#") { "Tab 3" } %>
25
+ # <% end %>
26
+ #
27
+ # @example With icons and counters
28
+ # <%= render(Primer::TabNavComponent.new) do |component| %>
29
+ # <% component.tab(href: "#", selected: true) do |t| %>
30
+ # <% t.icon(icon: :star) %>
31
+ # <% t.text { "Item 1" } %>
32
+ # <% end %>
33
+ # <% component.tab(href: "#") do |t| %>
34
+ # <% t.icon(icon: :star) %>
35
+ # <% t.text { "Item 2" } %>
36
+ # <% t.counter(count: 10) %>
37
+ # <% end %>
38
+ # <% component.tab(href: "#") do |t| %>
39
+ # <% t.text { "Item 3" } %>
40
+ # <% t.counter(count: 10) %>
41
+ # <% end %>
27
42
  # <% end %>
28
43
  #
29
44
  # @example With panels
30
45
  # <%= render(Primer::TabNavComponent.new(with_panel: true)) do |c| %>
31
- # <% c.tab(selected: true, title: "Tab 1") { "Panel 1" } %>
32
- # <% c.tab(title: "Tab 2") { "Panel 1" } %>
33
- # <% c.tab(title: "Tab 3") { "Panel 1" } %>
46
+ # <% c.tab(selected: true) do |t| %>
47
+ # <% t.text { "Tab 1" } %>
48
+ # <% t.panel do %>
49
+ # Panel 1
50
+ # <% end %>
51
+ # <% end %>
52
+ # <% c.tab do |t| %>
53
+ # <% t.text { "Tab 2" } %>
54
+ # <% t.panel do %>
55
+ # Panel 2
56
+ # <% end %>
57
+ # <% end %>
58
+ # <% c.tab do |t| %>
59
+ # <% t.text { "Tab 3" } %>
60
+ # <% t.panel do %>
61
+ # Panel 3
62
+ # <% end %>
63
+ # <% end %>
34
64
  # <% end %>
35
65
  #
36
66
  # @param aria_label [String] Used to set the `aria-label` on the top level `<nav>` element.
@@ -47,62 +77,5 @@ module Primer
47
77
  system_arguments[:classes]
48
78
  )
49
79
  end
50
-
51
- def before_render
52
- validate_single_selected_tab
53
- end
54
-
55
- private
56
-
57
- def wrapper
58
- @with_panel ? Primer::TabContainerComponent : Primer::BaseComponent
59
- end
60
-
61
- def validate_single_selected_tab
62
- raise MultipleSelectedTabsError, "only one tab can be selected" if selected_tabs_count > 1
63
- raise NoSelectedTabsError, "a tab must be selected" if selected_tabs_count != 1
64
- end
65
-
66
- def selected_tabs_count
67
- @selected_tabs_count ||= tabs.count(&:selected)
68
- end
69
-
70
- # Tabs to be rendered.
71
- class TabComponent < Primer::Component
72
- attr_reader :selected
73
-
74
- def initialize(title:, selected: false, **system_arguments)
75
- @title = title
76
- @selected = selected
77
- @system_arguments = system_arguments
78
- @system_arguments[:tag] ||= :a
79
- @system_arguments[:role] = :tab
80
-
81
- if selected
82
- if @system_arguments[:tag] == :a
83
- @system_arguments[:"aria-current"] = :page
84
- else
85
- @system_arguments[:"aria-selected"] = true
86
- end
87
- end
88
-
89
- @system_arguments[:classes] = class_names(
90
- "tabnav-tab",
91
- system_arguments[:classes]
92
- )
93
- end
94
-
95
- def call
96
- render(Primer::BaseComponent.new(**@system_arguments)) { @title }
97
- end
98
-
99
- def panel
100
- content
101
- end
102
-
103
- def hidden?
104
- !@selected
105
- end
106
- end
107
80
  end
108
81
  end
@@ -3,9 +3,11 @@
3
3
  module Primer
4
4
  # The Text component is a wrapper component that will apply typography styles to the text inside.
5
5
  class TextComponent < Primer::Component
6
+ status :beta
7
+
6
8
  # @example Default
7
9
  # <%= render(Primer::TextComponent.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
8
- # <%= render(Primer::TextComponent.new(tag: :p, color: :red_5)) { "Red Text" } %>
10
+ # <%= render(Primer::TextComponent.new(tag: :p, color: :text_danger)) { "Danger Text" } %>
9
11
  #
10
12
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
11
13
  def initialize(**system_arguments)
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -3,7 +3,8 @@
3
3
  module Primer
4
4
  # Use Primer::TimeAgoComponent to display a time relative to how long ago it was. This component requires JavaScript.
5
5
  class TimeAgoComponent < Primer::Component
6
- #
6
+ status :beta
7
+
7
8
  # @example Default
8
9
  # <%= render(Primer::TimeAgoComponent.new(time: Time.at(628232400))) %>
9
10
  #
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # Use `TimelineItem` to display items on a vertical timeline, connected by badge elements.
5
5
  class TimelineItemComponent < Primer::Component
6
- include ViewComponent::SlotableV2
6
+ status :beta
7
7
 
8
8
  # Avatar to be rendered to the left of the Badge.
9
9
  #
@@ -40,7 +40,7 @@ module Primer
40
40
  # <div style="padding-left: 60px">
41
41
  # <%= render(Primer::TimelineItemComponent.new) do |component| %>
42
42
  # <% component.avatar(src: "https://github.com/github.png", alt: "github") %>
43
- # <% component.badge(bg: :green, color: :white, icon: :check) %>
43
+ # <% component.badge(bg: :success_inverse, color: :text_white, icon: :check) %>
44
44
  # <% component.body { "Success!" } %>
45
45
  # <% end %>
46
46
  # </div>
@@ -77,7 +77,7 @@ module Primer
77
77
 
78
78
  def call
79
79
  render(Primer::BaseComponent.new(**@system_arguments)) do
80
- render(Primer::OcticonComponent.new(icon: @icon))
80
+ render(Primer::OcticonComponent.new(@icon))
81
81
  end
82
82
  end
83
83
  end
@@ -1,11 +1,23 @@
1
- <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
- <% if @align == :right %>
3
- <%= actions %>
4
- <% end %>
1
+ <%= wrapper do %>
2
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
3
+ <% if @align == :right %>
4
+ <%= actions %>
5
+ <% end %>
6
+
7
+ <%= render body do %>
8
+ <% tabs.each do |tab| %>
9
+ <%= tab %>
10
+ <% end %>
11
+ <% end %>
5
12
 
6
- <%= body %>
13
+ <% if @align == :left %>
14
+ <%= actions %>
15
+ <% end %>
16
+ <% end %>
7
17
 
8
- <% if @align == :left %>
9
- <%= actions %>
18
+ <% if @with_panel %>
19
+ <% tabs.each do |tab| %>
20
+ <%= tab.panel %>
21
+ <% end %>
10
22
  <% end %>
11
23
  <% end %>
@@ -5,34 +5,61 @@ module Primer
5
5
  # underlined selected state, typically used for navigation placed at the top
6
6
  # of the page.
7
7
  class UnderlineNavComponent < Primer::Component
8
- include ViewComponent::SlotableV2
8
+ include Primer::TabbedComponentHelper
9
9
 
10
10
  ALIGN_DEFAULT = :left
11
11
  ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
12
12
 
13
- # Use the body for the navigation items
13
+ # Use the tabs to list navigation items. For more information, refer to <%= link_to_component(Primer::Navigation::TabComponent) %>.
14
14
  #
15
+ # @param selected [Boolean] Whether the tab is selected.
15
16
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
16
- renders_one :body, lambda { |**system_arguments|
17
- system_arguments[:classes] = class_names("UnderlineNav-body", "list-style-none", system_arguments[:classes])
18
- system_arguments[:tag] ||= :ul
19
-
20
- Primer::BaseComponent.new(**system_arguments) { content }
17
+ renders_many :tabs, lambda { |selected: false, **system_arguments|
18
+ system_arguments[:classes] = class_names(
19
+ "UnderlineNav-item",
20
+ system_arguments[:classes]
21
+ )
22
+ Primer::Navigation::TabComponent.new(
23
+ selected: selected,
24
+ with_panel: @with_panel,
25
+ icon_classes: "UnderlineNav-octicon",
26
+ **system_arguments
27
+ )
21
28
  }
22
29
 
23
- # Use actions for a call to action
30
+ # Use actions for a call to action.
24
31
  #
25
32
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
26
33
  renders_one :actions, lambda { |**system_arguments|
27
34
  system_arguments[:tag] ||= :div
28
35
  system_arguments[:classes] = class_names("UnderlineNav-actions", system_arguments[:classes])
29
- Primer::BaseComponent.new(**system_arguments) { content }
36
+
37
+ Primer::BaseComponent.new(**system_arguments)
30
38
  }
31
39
 
32
40
  # @example Default
33
41
  # <%= render(Primer::UnderlineNavComponent.new) do |component| %>
34
- # <% component.body do %>
35
- # <%= render(Primer::LinkComponent.new(href: "#url")) { "Item 1" } %>
42
+ # <% component.tab(href: "#", selected: true) { "Item 1" } %>
43
+ # <% component.tab(href: "#") { "Item 2" } %>
44
+ # <% component.actions do %>
45
+ # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
46
+ # <% end %>
47
+ # <% end %>
48
+ #
49
+ # @example With icons and counters
50
+ # <%= render(Primer::UnderlineNavComponent.new) do |component| %>
51
+ # <% component.tab(href: "#", selected: true) do |t| %>
52
+ # <% t.icon(icon: :star) %>
53
+ # <% t.text { "Item 1" } %>
54
+ # <% end %>
55
+ # <% component.tab(href: "#") do |t| %>
56
+ # <% t.icon(icon: :star) %>
57
+ # <% t.text { "Item 2" } %>
58
+ # <% t.counter(count: 10) %>
59
+ # <% end %>
60
+ # <% component.tab(href: "#") do |t| %>
61
+ # <% t.text { "Item 3" } %>
62
+ # <% t.counter(count: 10) %>
36
63
  # <% end %>
37
64
  # <% component.actions do %>
38
65
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
@@ -41,26 +68,65 @@ module Primer
41
68
  #
42
69
  # @example Align right
43
70
  # <%= render(Primer::UnderlineNavComponent.new(align: :right)) do |component| %>
44
- # <% component.body do %>
45
- # <%= render(Primer::LinkComponent.new(href: "#url")) { "Item 1" } %>
71
+ # <% component.tab(href: "#", selected: true) do |t| %>
72
+ # <% t.text { "Item 1" } %>
73
+ # <% end %>
74
+ # <% component.tab(href: "#") do |t| %>
75
+ # <% t.text { "Item 2" } %>
76
+ # <% end %>
77
+ # <% component.actions do %>
78
+ # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
79
+ # <% end %>
80
+ # <% end %>
81
+ #
82
+ # @example With panels
83
+ # <%= render(Primer::UnderlineNavComponent.new(with_panel: true)) do |component| %>
84
+ # <% component.tab(selected: true) do |t| %>
85
+ # <% t.text { "Item 1" } %>
86
+ # <% t.panel do %>
87
+ # Panel 1
88
+ # <% end %>
89
+ # <% end %>
90
+ # <% component.tab do |t| %>
91
+ # <% t.text { "Item 2" } %>
92
+ # <% t.panel do %>
93
+ # Panel 2
94
+ # <% end %>
46
95
  # <% end %>
47
96
  # <% component.actions do %>
48
97
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
49
98
  # <% end %>
50
99
  # <% end %>
51
100
  #
101
+ # @param with_panel [Boolean] Whether the TabNav should navigate through pages or panels.
52
102
  # @param align [Symbol] <%= one_of(Primer::UnderlineNavComponent::ALIGN_OPTIONS) %> - Defaults to <%= Primer::UnderlineNavComponent::ALIGN_DEFAULT %>
53
103
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
54
- def initialize(align: ALIGN_DEFAULT, **system_arguments)
104
+ def initialize(with_panel: false, align: ALIGN_DEFAULT, body_classes: "", **system_arguments)
105
+ @with_panel = with_panel
55
106
  @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT)
56
107
 
57
108
  @system_arguments = system_arguments
58
109
  @system_arguments[:tag] = :nav
110
+ @system_arguments[:role] = :tablist
59
111
  @system_arguments[:classes] = class_names(
60
112
  @system_arguments[:classes],
61
113
  "UnderlineNav",
62
114
  "UnderlineNav--right" => @align == :right
63
115
  )
116
+
117
+ @body_arguments = {
118
+ tag: :div,
119
+ classes: class_names(
120
+ "UnderlineNav-body",
121
+ body_classes
122
+ )
123
+ }
124
+ end
125
+
126
+ private
127
+
128
+ def body
129
+ Primer::BaseComponent.new(**@body_arguments)
64
130
  end
65
131
  end
66
132
  end