primer_view_components 0.1.0 → 0.1.2

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/divider.rb +2 -2
  8. data/app/components/primer/alpha/action_list/heading.html.erb +1 -1
  9. data/app/components/primer/alpha/action_list/heading.rb +11 -5
  10. data/app/components/primer/alpha/action_list/item.rb +19 -15
  11. data/app/components/primer/alpha/action_list.html.erb +7 -8
  12. data/app/components/primer/alpha/action_list.rb +16 -11
  13. data/app/components/primer/alpha/nav_list/{section.rb → group.rb} +5 -5
  14. data/app/components/primer/alpha/nav_list/item.html.erb +1 -1
  15. data/app/components/primer/alpha/nav_list/item.rb +15 -1
  16. data/app/components/primer/alpha/nav_list.d.ts +1 -0
  17. data/app/components/primer/alpha/nav_list.html.erb +8 -8
  18. data/app/components/primer/alpha/nav_list.js +21 -0
  19. data/app/components/primer/alpha/nav_list.rb +30 -34
  20. data/app/components/primer/alpha/nav_list.ts +23 -0
  21. data/app/components/primer/alpha/navigation/tab.rb +168 -0
  22. data/app/components/primer/alpha/overlay/header.html.erb +2 -2
  23. data/app/components/primer/alpha/overlay.rb +29 -9
  24. data/app/components/primer/alpha/tab_nav.rb +10 -3
  25. data/app/components/primer/alpha/tab_panels.rb +2 -2
  26. data/app/components/primer/alpha/underline_nav.css +1 -1
  27. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  28. data/app/components/primer/alpha/underline_nav.pcss +1 -0
  29. data/app/components/primer/alpha/underline_nav.rb +2 -2
  30. data/app/components/primer/alpha/underline_panels.rb +2 -2
  31. data/app/components/primer/beta/button.html.erb +1 -1
  32. data/app/components/primer/beta/button.rb +2 -1
  33. data/app/components/primer/component.rb +34 -0
  34. data/app/components/primer/navigation/tab_component.rb +3 -157
  35. data/app/components/primer/truncate.rb +1 -1
  36. data/lib/primer/deprecations.yml +9 -0
  37. data/lib/primer/forms/dsl/text_field_input.rb +1 -1
  38. data/lib/primer/forms/primer_text_field.js +17 -6
  39. data/lib/primer/forms/primer_text_field.ts +15 -7
  40. data/lib/primer/forms/text_field.html.erb +3 -3
  41. data/lib/primer/view_components/version.rb +1 -1
  42. data/lib/primer/yard/component_manifest.rb +2 -1
  43. data/lib/tasks/docs.rake +1 -1
  44. data/previews/primer/alpha/action_list_preview.rb +41 -29
  45. data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +19 -0
  46. data/previews/primer/alpha/nav_list_preview.rb +19 -30
  47. data/previews/primer/alpha/overlay_preview.rb +34 -4
  48. data/previews/primer/alpha/tab_nav_preview/with_extra.html.erb +8 -0
  49. data/previews/primer/alpha/tab_nav_preview.rb +5 -0
  50. data/previews/primer/alpha/tab_panels_preview/with_extra.html.erb +17 -0
  51. data/previews/primer/alpha/tab_panels_preview.rb +5 -0
  52. data/static/arguments.json +64 -8
  53. data/static/audited_at.json +2 -1
  54. data/static/constants.json +20 -8
  55. data/static/previews.json +20 -5
  56. data/static/statuses.json +4 -3
  57. metadata +10 -8
  58. data/app/components/primer/alpha/nav_list/section.html.erb +0 -3
  59. data/previews/primer/alpha/action_list_preview/heading.html.erb +0 -4
  60. /data/app/components/primer/{navigation/tab_component.html.erb → alpha/navigation/tab.html.erb} +0 -0
@@ -32,7 +32,7 @@ module Primer
32
32
 
33
33
  super(**system_arguments)
34
34
 
35
- add_input_data(:target, "primer-text-field.inputElement") if auto_check_src.present?
35
+ add_input_data(:target, "primer-text-field.inputElement")
36
36
  add_input_classes("FormControl-inset") if inset?
37
37
  add_input_classes("FormControl-monospace") if monospace?
38
38
  end
@@ -18,7 +18,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
18
18
  var _PrimerTextFieldElement_abortController;
19
19
  import '@github/auto-check-element';
20
20
  import { controller, target } from '@github/catalyst';
21
- let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
21
+ // eslint-disable-next-line custom-elements/expose-class-on-global
22
+ let PrimerTextFieldElement =
23
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
+ class PrimerTextFieldElement extends HTMLElement {
22
25
  constructor() {
23
26
  super(...arguments);
24
27
  _PrimerTextFieldElement_abortController.set(this, void 0);
@@ -27,22 +30,29 @@ let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
27
30
  var _a;
28
31
  (_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
29
32
  const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
30
- this.inputElement.addEventListener('auto-check-success', () => { this.clearError(); }, { signal });
31
- this.inputElement.addEventListener('auto-check-error', (event) => {
32
- event.detail.response.text().then((error_message) => { this.setError(error_message); });
33
+ this.inputElement.addEventListener('auto-check-success', () => {
34
+ this.clearError();
35
+ }, { signal });
36
+ this.inputElement.addEventListener('auto-check-error', async (event) => {
37
+ const errorMessage = await event.detail.response.text();
38
+ this.setError(errorMessage);
33
39
  }, { signal });
34
40
  }
35
41
  disconnectedCallback() {
36
42
  var _a;
37
43
  (_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
38
44
  }
45
+ clearContents() {
46
+ this.inputElement.value = '';
47
+ this.inputElement.focus();
48
+ }
39
49
  clearError() {
40
50
  this.inputElement.removeAttribute('invalid');
41
51
  this.validationElement.hidden = true;
42
- this.validationMessageElement.innerText = '';
52
+ this.validationMessageElement.textContent = '';
43
53
  }
44
54
  setError(message) {
45
- this.validationMessageElement.innerText = message;
55
+ this.validationMessageElement.textContent = message;
46
56
  this.validationElement.hidden = false;
47
57
  this.inputElement.setAttribute('invalid', 'true');
48
58
  }
@@ -59,4 +69,5 @@ __decorate([
59
69
  ], PrimerTextFieldElement.prototype, "validationMessageElement", void 0);
60
70
  PrimerTextFieldElement = __decorate([
61
71
  controller
72
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
62
73
  ], PrimerTextFieldElement);
@@ -1,7 +1,9 @@
1
1
  import '@github/auto-check-element'
2
2
  import {controller, target} from '@github/catalyst'
3
3
 
4
+ // eslint-disable-next-line custom-elements/expose-class-on-global
4
5
  @controller
6
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
5
7
  class PrimerTextFieldElement extends HTMLElement {
6
8
  @target inputElement: HTMLInputElement
7
9
  @target validationElement: HTMLElement
@@ -15,16 +17,17 @@ class PrimerTextFieldElement extends HTMLElement {
15
17
 
16
18
  this.inputElement.addEventListener(
17
19
  'auto-check-success',
18
- () => { this.clearError() },
20
+ () => {
21
+ this.clearError()
22
+ },
19
23
  {signal}
20
24
  )
21
25
 
22
26
  this.inputElement.addEventListener(
23
27
  'auto-check-error',
24
- (event: any) => {
25
- event.detail.response.text().then(
26
- (error_message: string) => { this.setError(error_message) }
27
- )
28
+ async (event: any) => {
29
+ const errorMessage = await event.detail.response.text()
30
+ this.setError(errorMessage)
28
31
  },
29
32
  {signal}
30
33
  )
@@ -34,14 +37,19 @@ class PrimerTextFieldElement extends HTMLElement {
34
37
  this.#abortController?.abort()
35
38
  }
36
39
 
40
+ clearContents() {
41
+ this.inputElement.value = ''
42
+ this.inputElement.focus()
43
+ }
44
+
37
45
  clearError(): void {
38
46
  this.inputElement.removeAttribute('invalid')
39
47
  this.validationElement.hidden = true
40
- this.validationMessageElement.innerText = ''
48
+ this.validationMessageElement.textContent = ''
41
49
  }
42
50
 
43
51
  setError(message: string): void {
44
- this.validationMessageElement.innerText = message
52
+ this.validationMessageElement.textContent = message
45
53
  this.validationElement.hidden = false
46
54
  this.inputElement.setAttribute('invalid', 'true')
47
55
  }
@@ -1,4 +1,4 @@
1
- <%= render Primer::ConditionalWrapper.new(condition: @input.auto_check_src, tag: "primer-text-field") do %>
1
+ <primer-text-field>
2
2
  <%= render(FormControl.new(input: @input)) do %>
3
3
  <%= content_tag(:div, **@field_wrap_arguments) do %>
4
4
  <% if @input.leading_visual %>
@@ -10,10 +10,10 @@
10
10
  <%= builder.text_field(@input.name, **@input.input_arguments) %>
11
11
  <% end %>
12
12
  <% if @input.show_clear_button? %>
13
- <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear">
13
+ <button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear" data-action="click:primer-text-field#clearContents">
14
14
  <%= render(Primer::Beta::Octicon.new(icon: :"x-circle-fill")) %>
15
15
  </button>
16
16
  <% end %>
17
17
  <% end %>
18
18
  <% end %>
19
- <% end %>
19
+ </primer-text-field>
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 1
9
- PATCH = 0
9
+ PATCH = 2
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -45,6 +45,7 @@ module Primer
45
45
  Primer::Beta::Markdown => {},
46
46
  Primer::Alpha::Menu => {},
47
47
  Primer::Navigation::TabComponent => {},
48
+ Primer::Alpha::Navigation::Tab => {},
48
49
  Primer::Beta::Octicon => {},
49
50
  Primer::Beta::Popover => {},
50
51
  Primer::Beta::ProgressBar => {},
@@ -68,7 +69,7 @@ module Primer
68
69
  # Examples can be seen in the NavList docs
69
70
  Primer::Alpha::NavList => { js: true },
70
71
  Primer::Alpha::NavList::Item => { js: true, examples: false },
71
- Primer::Alpha::NavList::Section => { js: true, examples: false },
72
+ Primer::Alpha::NavList::Group => { js: true, examples: false },
72
73
 
73
74
  # ActionList is a base component that should not be used by itself, and thus
74
75
  # does not have examples of its own
data/lib/tasks/docs.rake CHANGED
@@ -64,7 +64,7 @@ namespace :docs do
64
64
 
65
65
  if components_needing_docs.any?
66
66
  puts
67
- puts "The following components needs docs. Care to contribute them? #{components_needing_docs.map(&:name).join(', ')}"
67
+ puts "The following components need docs. Care to contribute them? #{components_needing_docs.map(&:name).join(', ')}"
68
68
  end
69
69
  end
70
70
 
@@ -17,8 +17,7 @@ module Primer
17
17
  render(Primer::Alpha::ActionList.new(
18
18
  role: role,
19
19
  scheme: scheme,
20
- show_dividers: show_dividers,
21
- aria: { label: "Action List" }
20
+ show_dividers: show_dividers
22
21
  )) do |component|
23
22
  component.with_heading(title: "Action List")
24
23
  component.with_item(label: "Item one", href: "/") do |item|
@@ -46,8 +45,7 @@ module Primer
46
45
  render(Primer::Alpha::ActionList.new(
47
46
  role: role,
48
47
  scheme: scheme,
49
- show_dividers: show_dividers,
50
- aria: { label: "Action List" }
48
+ show_dividers: show_dividers
51
49
  )) do |component|
52
50
  component.with_heading(title: "Action List")
53
51
  component.with_item(label: "Item one", href: "/") do |item|
@@ -75,8 +73,7 @@ module Primer
75
73
  render(Primer::Alpha::ActionList.new(
76
74
  role: role,
77
75
  scheme: scheme,
78
- show_dividers: show_dividers,
79
- aria: { label: "Action List" }
76
+ show_dividers: show_dividers
80
77
  )) do |component|
81
78
  component.with_heading(title: "Action List")
82
79
  component.with_item(label: "Leading SVG visual", href: "/") do |item|
@@ -92,6 +89,39 @@ module Primer
92
89
  end
93
90
  end
94
91
 
92
+ # @label With manual dividers
93
+ #
94
+ # @param role text
95
+ # @param scheme [Symbol] select [full, inset]
96
+ # @param show_dividers toggle
97
+ def with_manual_dividers(
98
+ role: Primer::Alpha::ActionList::DEFAULT_ROLE,
99
+ scheme: Primer::Alpha::ActionList::DEFAULT_SCHEME,
100
+ show_dividers: false
101
+ )
102
+ render(Primer::Alpha::ActionList.new(
103
+ role: role,
104
+ scheme: scheme,
105
+ show_dividers: show_dividers
106
+ )) do |component|
107
+ component.with_heading(title: "Action List")
108
+ component.with_item(label: "Item one", href: "/") do |item|
109
+ item.with_leading_visual_icon(icon: :gear)
110
+ end
111
+ component.with_divider
112
+ component.with_item(label: "Item two", href: "/") do |item|
113
+ item.with_leading_visual_icon(icon: :star)
114
+ end
115
+ component.with_item(label: "Item three", href: "/") do |item|
116
+ item.with_leading_visual_icon(icon: :heart)
117
+ end
118
+ component.with_divider
119
+ component.with_item(label: "Item four", href: "/") do |item|
120
+ item.with_leading_visual_icon(icon: :bug)
121
+ end
122
+ end
123
+ end
124
+
95
125
  # @label Divider
96
126
  #
97
127
  # @param scheme [Symbol] select [subtle, filled]
@@ -113,14 +143,9 @@ module Primer
113
143
  list_id: "unique-id",
114
144
  subtitle: "This is a subtitle"
115
145
  )
116
- render_with_template(
117
- locals: {
118
- scheme: scheme,
119
- title: title,
120
- list_id: list_id,
121
- subtitle: subtitle
122
- }
123
- )
146
+ render(Primer::Alpha::ActionList::Heading.new(
147
+ scheme: scheme, list_id: list_id, title: title, subtitle: subtitle
148
+ ))
124
149
  end
125
150
 
126
151
  # @label Item [playground]
@@ -143,7 +168,6 @@ module Primer
143
168
  # @param private_leading_action_icon [Symbol] octicon
144
169
  # @param private_trailing_action_icon [Symbol] octicon
145
170
  # @param trailing_action toggle
146
- # @param trailing_action_on_hover toggle
147
171
  # @param tooltip toggle
148
172
  def item(
149
173
  label: "Label",
@@ -164,7 +188,6 @@ module Primer
164
188
  trailing_visual_text: nil,
165
189
  private_leading_action_icon: nil,
166
190
  private_trailing_action_icon: nil,
167
- trailing_action_on_hover: false,
168
191
  trailing_action: false,
169
192
  tooltip: false
170
193
  )
@@ -203,7 +226,7 @@ module Primer
203
226
  item.with_private_trailing_action_icon(icon: private_trailing_action_icon)
204
227
  end
205
228
 
206
- item.with_trailing_action(show_on_hover: trailing_action_on_hover, icon: "plus", "aria-label": "Button tooltip", size: :medium) if trailing_action && trailing_action != :none
229
+ item.with_trailing_action(icon: "plus", "aria-label": "Button tooltip", size: :medium) if trailing_action && trailing_action != :none
207
230
 
208
231
  item.description { description } if description
209
232
 
@@ -302,18 +325,7 @@ module Primer
302
325
  aria: { label: "List heading" }
303
326
  )) do |component|
304
327
  component.with_item(label: "Default item", href: "/") do |item|
305
- item.with_trailing_action(show_on_hover: false, icon: "plus", "aria-label": "Button tooltip", size: :medium)
306
- end
307
- end
308
- end
309
-
310
- # @label Item [trailing action on hover]
311
- def item_trailing_action_hover
312
- render(Primer::Alpha::ActionList.new(
313
- aria: { label: "List heading" }
314
- )) do |component|
315
- component.with_item(label: "Default item", href: "/") do |item|
316
- item.with_trailing_action(show_on_hover: true, icon: "plus", "aria-label": "Button tooltip", size: :medium)
328
+ item.with_trailing_action(icon: "plus", "aria-label": "Button tooltip", size: :medium)
317
329
  end
318
330
  end
319
331
  end
@@ -0,0 +1,19 @@
1
+ <%= render(Primer::Alpha::NavList.new) do |list| %>
2
+ <% list.with_group do |group| %>
3
+ <%= group.with_heading(title: "Shopping list") %>
4
+ <% group.with_item(label: "Bread", href: "/list/1") do |item| %>
5
+ <%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "bread_button") %>
6
+ <% end %>
7
+ <% group.with_item(label: "Cheese", href: "/list/2") do |item| %>
8
+ <%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "cheese_button") %>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
12
+
13
+ <script type="text/javascript" data-eval="true">
14
+ const breadButton = document.querySelector("[name=bread_button]")
15
+ breadButton.addEventListener("click", () => alert("You selected bread."))
16
+
17
+ const cheeseButton = document.querySelector("[name=cheese_button]")
18
+ cheeseButton.addEventListener("click", () => alert("You selected cheese."))
19
+ </script>
@@ -7,22 +7,22 @@ module Primer
7
7
  # @label Playground
8
8
  def playground
9
9
  render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
10
- list.with_section(aria: { label: "Repository settings" }) do |section|
11
- section.with_heading(title: "Repository settings")
10
+ list.with_group do |group|
11
+ group.with_heading(title: "Repository settings")
12
12
 
13
- section.with_item(label: "General", href: "/general") do |item|
13
+ group.with_item(label: "General", href: "/general") do |item|
14
14
  item.with_leading_visual_icon(icon: :gear)
15
15
  end
16
16
  end
17
17
 
18
- list.with_section(aria: { label: "Access" }) do |section|
19
- section.with_heading(title: "Access")
18
+ list.with_group do |group|
19
+ group.with_heading(title: "Access")
20
20
 
21
- section.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
21
+ group.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
22
22
  item.with_leading_visual_icon(icon: :people)
23
23
  end
24
24
 
25
- section.with_item(label: "Moderation options", href: "/moderation") do |item|
25
+ group.with_item(label: "Moderation options") do |item|
26
26
  item.with_leading_visual_icon(icon: :"comment-discussion")
27
27
 
28
28
  item.with_item(label: "Interaction limits", href: "/interaction-limits", selected_by_ids: :interaction_limits)
@@ -36,22 +36,22 @@ module Primer
36
36
  # @label Default
37
37
  def default
38
38
  render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
39
- list.with_section(aria: { label: "Repository settings" }) do |section|
40
- section.with_heading(title: "Repository settings")
39
+ list.with_group do |group|
40
+ group.with_heading(title: "Repository settings")
41
41
 
42
- section.with_item(label: "General", href: "/general") do |item|
42
+ group.with_item(label: "General", href: "/general") do |item|
43
43
  item.with_leading_visual_icon(icon: :gear)
44
44
  end
45
45
  end
46
46
 
47
- list.with_section(aria: { label: "Access" }) do |section|
48
- section.with_heading(title: "Access")
47
+ list.with_group do |group|
48
+ group.with_heading(title: "Access")
49
49
 
50
- section.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
50
+ group.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
51
51
  item.with_leading_visual_icon(icon: :people)
52
52
  end
53
53
 
54
- section.with_item(label: "Moderation options", href: "/moderation") do |item|
54
+ group.with_item(label: "Moderation options") do |item|
55
55
  item.with_leading_visual_icon(icon: :"comment-discussion")
56
56
 
57
57
  item.with_item(label: "Interaction limits", href: "/interaction-limits", selected_by_ids: :interaction_limits)
@@ -65,28 +65,17 @@ module Primer
65
65
  # @label Show more item
66
66
  def show_more_item
67
67
  render(Primer::Alpha::NavList.new) do |list|
68
- list.with_section(aria: { label: "List of foods" }) do |section|
69
- section.with_heading(title: "My favorite foods")
70
- section.with_item(label: "Popplers", href: "/foods/popplers")
71
- section.with_item(label: "Slurm", href: "/foods/slurm")
72
- section.with_show_more_item(label: "Show more", src: "/nav_list_items", pages: 2)
68
+ list.with_group do |group|
69
+ group.with_heading(title: "My favorite foods")
70
+ group.with_item(label: "Popplers", href: "/foods/popplers")
71
+ group.with_item(label: "Slurm", href: "/foods/slurm")
72
+ group.with_show_more_item(label: "Show more", src: "/nav_list_items", pages: 2)
73
73
  end
74
74
  end
75
75
  end
76
76
 
77
77
  # @label Trailing action
78
78
  def trailing_action
79
- render(Primer::Alpha::NavList.new) do |list|
80
- list.with_section(aria: { label: "List of items to buy" }) do |section|
81
- section.with_heading(title: "Shopping list")
82
- section.with_item(label: "Bread", href: "/list/1") do |item|
83
- item.with_trailing_action(show_on_hover: true, icon: :plus, aria: { label: "Button tooltip" })
84
- end
85
- section.with_item(label: "Cheese", href: "/list/2") do |item|
86
- item.with_trailing_action(icon: :plus, aria: { label: "Button tooltip" })
87
- end
88
- end
89
- end
90
79
  end
91
80
  end
92
81
  end
@@ -20,7 +20,8 @@ module Primer
20
20
  # @param header_size [Symbol] select [medium, large]
21
21
  # @param button_text [String] text
22
22
  # @param body_text [String] text
23
- def playground(title: "Test Overlay", subtitle: nil, role: :dialog, size: :auto, padding: :normal, anchor_align: :center, anchor_offset: :normal, anchor_side: :outside_bottom, allow_out_of_bounds: false, visually_hide_title: false, header_size: :medium, button_text: "Show Overlay", body_text: "")
23
+ # @param icon [Symbol] octicon
24
+ def playground(title: "Test Overlay", subtitle: nil, role: :dialog, size: :auto, padding: :normal, anchor_align: :center, anchor_offset: :normal, anchor_side: :outside_bottom, allow_out_of_bounds: false, visually_hide_title: false, header_size: :medium, button_text: "Show Overlay", body_text: "", icon: :none)
24
25
  render(Primer::Alpha::Overlay.new(
25
26
  title: title,
26
27
  subtitle: subtitle,
@@ -31,10 +32,14 @@ module Primer
31
32
  anchor_offset: anchor_offset,
32
33
  anchor_side: anchor_side,
33
34
  allow_out_of_bounds: allow_out_of_bounds,
34
- visually_hide_title: visually_hide_title,
35
+ visually_hide_title: visually_hide_title
35
36
  )) do |d|
36
37
  d.with_header(title: title, size: header_size)
37
- d.with_show_button { button_text }
38
+ if icon.present? && (icon != :none)
39
+ d.with_show_button(icon: icon, "aria-label": icon.to_s)
40
+ else
41
+ d.with_show_button { button_text }
42
+ end
38
43
  d.with_body { body_text }
39
44
  end
40
45
  end
@@ -64,7 +69,7 @@ module Primer
64
69
  anchor_align: anchor_align,
65
70
  anchor_side: anchor_side,
66
71
  allow_out_of_bounds: allow_out_of_bounds,
67
- visually_hide_title: visually_hide_title,
72
+ visually_hide_title: visually_hide_title
68
73
  )) do |d|
69
74
  d.with_header(title: title, size: header_size)
70
75
  d.with_show_button { button_text }
@@ -72,6 +77,31 @@ module Primer
72
77
  end
73
78
  end
74
79
 
80
+ # @label Menu No Header
81
+ #
82
+ # @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
83
+ # @param padding [Symbol] select [normal, condensed, none]
84
+ # @param anchor_align [Symbol] select [start, center, end]
85
+ # @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
86
+ # @param allow_out_of_bounds [Boolean] toggle
87
+ #
88
+ # @param button_text [String] text
89
+ # @param body_text [String] text
90
+ def menu_no_header(size: :auto, padding: :normal, anchor_align: :center, anchor_side: :outside_bottom, allow_out_of_bounds: false, button_text: "Show Overlay Menu", body_text: "This is a menu")
91
+ render(Primer::Alpha::Overlay.new(
92
+ title: "Menu",
93
+ role: :menu,
94
+ size: size,
95
+ padding: padding,
96
+ anchor_align: anchor_align,
97
+ anchor_side: anchor_side,
98
+ allow_out_of_bounds: allow_out_of_bounds
99
+ )) do |d|
100
+ d.with_show_button { button_text }
101
+ d.with_body { body_text }
102
+ end
103
+ end
104
+
75
105
  # @label Middle Of Page
76
106
  #
77
107
  # @param title [String] text
@@ -0,0 +1,8 @@
1
+ <%= render(Primer::Alpha::TabNav.new(label: "With icons and counters")) do |component| %>
2
+ <% component.with_tab(selected: true, href: "#") { "Tab 1" } %>
3
+ <% component.with_tab(href: "#") { "Tab 2" } %>
4
+ <% component.with_tab(href: "#") { "Tab 3" } %>
5
+ <% component.with_extra(align: align) do %>
6
+ <%= render(Primer::Beta::Button.new) { "Extra Button" } %>
7
+ <% end %>
8
+ <% end %>
@@ -50,6 +50,11 @@ module Primer
50
50
  end
51
51
  end
52
52
  end
53
+
54
+ # @param align [Symbol] select [left, right]
55
+ def with_extra(align: :right)
56
+ render_with_template(locals: { align: align })
57
+ end
53
58
  end
54
59
  end
55
60
  end
@@ -0,0 +1,17 @@
1
+ <%= render(Primer::Alpha::TabPanels.new(label: "label")) do |component| %>
2
+ <% component.with_tab(selected: true, id: "tab-1") do |tab| %>
3
+ <% tab.with_panel { "Panel 1" } %>
4
+ <% tab.with_text { "Tab 1" } %>
5
+ <% end %>
6
+ <% component.with_tab(id: "tab-2") do |tab| %>
7
+ <% tab.with_panel { "Panel 2" } %>
8
+ <% tab.with_text { "Tab 2" } %>
9
+ <% end %>
10
+ <% component.with_tab(id: "tab-3") do |tab| %>
11
+ <% tab.with_panel { "Panel 3" } %>
12
+ <% tab.with_text { "Tab 3" } %>
13
+ <% end %>
14
+ <% component.with_extra(align: align) do %>
15
+ <%= render(Primer::Beta::Button.new) { "Extra Button" } %>
16
+ <% end %>
17
+ <% end %>
@@ -33,6 +33,11 @@ module Primer
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ # @param align [Symbol] select [left, right]
38
+ def with_extra(align: :right)
39
+ render_with_template(locals: { align: align })
40
+ end
36
41
  end
37
42
  end
38
43
  end
@@ -1445,7 +1445,7 @@
1445
1445
  },
1446
1446
  {
1447
1447
  "component": "Navigation::Tab",
1448
- "status": "alpha",
1448
+ "status": "deprecated",
1449
1449
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/navigation/tab_component.rb",
1450
1450
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/navigation/tab/default/",
1451
1451
  "parameters": [
@@ -1493,6 +1493,56 @@
1493
1493
  }
1494
1494
  ]
1495
1495
  },
1496
+ {
1497
+ "component": "Navigation::Tab",
1498
+ "status": "alpha",
1499
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/navigation/tab.rb",
1500
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/navigation/tab/default/",
1501
+ "parameters": [
1502
+ {
1503
+ "name": "list",
1504
+ "type": "Boolean",
1505
+ "default": "`false`",
1506
+ "description": "Whether the Tab is an item in a `<ul>` list."
1507
+ },
1508
+ {
1509
+ "name": "selected",
1510
+ "type": "Boolean",
1511
+ "default": "`false`",
1512
+ "description": "Whether the Tab is selected or not."
1513
+ },
1514
+ {
1515
+ "name": "with_panel",
1516
+ "type": "Boolean",
1517
+ "default": "`false`",
1518
+ "description": "Whether the Tab has an associated panel."
1519
+ },
1520
+ {
1521
+ "name": "panel_id",
1522
+ "type": "String",
1523
+ "default": "`\"\"`",
1524
+ "description": "Only applies if `with_panel` is `true`. Unique id of panel."
1525
+ },
1526
+ {
1527
+ "name": "icon_classes",
1528
+ "type": "Boolean",
1529
+ "default": "`\"\"`",
1530
+ "description": "Classes that must always be applied to icons."
1531
+ },
1532
+ {
1533
+ "name": "wrapper_arguments",
1534
+ "type": "Hash",
1535
+ "default": "`{}`",
1536
+ "description": "[System arguments](/system-arguments) to be used in the `<li>` wrapper when the tab is an item in a list."
1537
+ },
1538
+ {
1539
+ "name": "system_arguments",
1540
+ "type": "Hash",
1541
+ "default": "N/A",
1542
+ "description": "[System arguments](/system-arguments)"
1543
+ }
1544
+ ]
1545
+ },
1496
1546
  {
1497
1547
  "component": "Octicon",
1498
1548
  "status": "beta",
@@ -1755,7 +1805,7 @@
1755
1805
  },
1756
1806
  {
1757
1807
  "component": "Truncate",
1758
- "status": "beta",
1808
+ "status": "deprecated",
1759
1809
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/truncate.rb",
1760
1810
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/truncate/default/",
1761
1811
  "parameters": [
@@ -2196,10 +2246,10 @@
2196
2246
  ]
2197
2247
  },
2198
2248
  {
2199
- "component": "NavList::Section",
2249
+ "component": "NavList::Group",
2200
2250
  "status": "alpha",
2201
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/nav_list/section.rb",
2202
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/nav_list/section/default/",
2251
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/nav_list/group.rb",
2252
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/nav_list/group/default/",
2203
2253
  "parameters": [
2204
2254
  {
2205
2255
  "name": "selected_item_id",
@@ -2291,6 +2341,12 @@
2291
2341
  "default": "N/A",
2292
2342
  "description": "Sub list title."
2293
2343
  },
2344
+ {
2345
+ "name": "heading_level",
2346
+ "type": "Integer",
2347
+ "default": "`3`",
2348
+ "description": "Heading level. Level 2 results in an `<h2>` tag, level 3 an `<h3>` tag, etc."
2349
+ },
2294
2350
  {
2295
2351
  "name": "subtitle",
2296
2352
  "type": "String",
@@ -2305,8 +2361,8 @@
2305
2361
  },
2306
2362
  {
2307
2363
  "name": "tag",
2308
- "type": "Symbol",
2309
- "default": "`:h3`",
2364
+ "type": "Integer",
2365
+ "default": "N/A",
2310
2366
  "description": "Semantic tag for the heading."
2311
2367
  },
2312
2368
  {
@@ -2374,7 +2430,7 @@
2374
2430
  {
2375
2431
  "name": "role",
2376
2432
  "type": "String",
2377
- "default": "`:listitem`",
2433
+ "default": "`nil`",
2378
2434
  "description": "ARIA role describing the function of the item."
2379
2435
  },
2380
2436
  {