primer_view_components 0.0.116 → 0.0.117

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -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 +2 -2
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list.css +1 -1
  8. data/app/components/primer/alpha/action_list.css.json +1 -1
  9. data/app/components/primer/alpha/action_list.css.map +1 -1
  10. data/app/components/primer/alpha/auto_complete/item.rb +4 -4
  11. data/app/components/primer/alpha/auto_complete.rb +6 -6
  12. data/app/components/primer/alpha/dialog.rb +0 -2
  13. data/app/components/primer/alpha/dropdown.rb +53 -53
  14. data/app/components/primer/alpha/hellip_button.rb +41 -0
  15. data/app/components/primer/alpha/hidden_text_expander.rb +1 -1
  16. data/app/components/primer/alpha/layout.rb +48 -48
  17. data/app/components/primer/alpha/menu.css +1 -1
  18. data/app/components/primer/alpha/menu.css.json +1 -1
  19. data/app/components/primer/alpha/menu.css.map +1 -1
  20. data/app/components/primer/alpha/menu.rb +5 -5
  21. data/app/components/primer/alpha/segmented_control.rb +20 -20
  22. data/app/components/primer/{tab_container_component.d.ts → alpha/tab_container.d.ts} +0 -0
  23. data/app/components/primer/{tab_container_component.js → alpha/tab_container.js} +0 -0
  24. data/app/components/primer/alpha/tab_container.rb +43 -0
  25. data/app/components/primer/{tab_container_component.ts → alpha/tab_container.ts} +0 -0
  26. data/app/components/primer/alpha/tab_nav.css +1 -1
  27. data/app/components/primer/alpha/tab_nav.css.json +1 -1
  28. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  29. data/app/components/primer/alpha/tab_nav.rb +32 -32
  30. data/app/components/primer/alpha/tool_tip.js +3 -7
  31. data/app/components/primer/alpha/tool_tip.ts +3 -7
  32. data/app/components/primer/alpha/tooltip.rb +18 -18
  33. data/app/components/primer/alpha/underline_nav.css +1 -1
  34. data/app/components/primer/alpha/underline_nav.css.json +1 -1
  35. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  36. data/app/components/primer/alpha/underline_nav.rb +18 -18
  37. data/app/components/primer/beta/auto_complete/item.rb +2 -3
  38. data/app/components/primer/beta/auto_complete.rb +14 -16
  39. data/app/components/primer/beta/avatar_stack.rb +12 -14
  40. data/app/components/primer/beta/blankslate.rb +0 -1
  41. data/app/components/primer/beta/border_box/header.rb +0 -2
  42. data/app/components/primer/beta/border_box.rb +0 -2
  43. data/app/components/primer/beta/breadcrumbs.css +1 -1
  44. data/app/components/primer/beta/breadcrumbs.css.json +1 -1
  45. data/app/components/primer/beta/breadcrumbs.css.map +1 -1
  46. data/app/components/primer/beta/breadcrumbs.rb +0 -1
  47. data/app/components/primer/beta/button.rb +9 -10
  48. data/app/components/primer/beta/button_group.rb +0 -1
  49. data/app/components/primer/beta/details.rb +0 -1
  50. data/app/components/primer/beta/flash.rb +0 -1
  51. data/app/components/primer/beta/link.rb +2 -3
  52. data/app/components/primer/beta/octicon.rb +0 -1
  53. data/app/components/primer/beta/popover.rb +0 -1
  54. data/app/components/primer/{state_component.css → beta/state.css} +0 -0
  55. data/app/components/primer/beta/state.css.json +1 -0
  56. data/app/components/primer/beta/state.css.map +1 -0
  57. data/app/components/primer/{state_component.pcss → beta/state.pcss} +0 -0
  58. data/app/components/primer/beta/state.rb +76 -0
  59. data/app/components/primer/{subhead_component.css → beta/subhead.css} +0 -0
  60. data/app/components/primer/beta/subhead.css.json +1 -0
  61. data/app/components/primer/beta/subhead.css.map +1 -0
  62. data/app/components/primer/{subhead_component.html.erb → beta/subhead.html.erb} +0 -0
  63. data/app/components/primer/{subhead_component.pcss → beta/subhead.pcss} +0 -0
  64. data/app/components/primer/beta/subhead.rb +135 -0
  65. data/app/components/primer/{timeline_item_component.css → beta/timeline_item.css} +0 -0
  66. data/app/components/primer/beta/timeline_item.css.json +1 -0
  67. data/app/components/primer/beta/timeline_item.css.map +1 -0
  68. data/app/components/primer/{timeline_item_component.html.erb → beta/timeline_item.html.erb} +0 -0
  69. data/app/components/primer/{timeline_item_component.pcss → beta/timeline_item.pcss} +0 -0
  70. data/app/components/primer/beta/timeline_item.rb +90 -0
  71. data/app/components/primer/beta/truncate.css +1 -1
  72. data/app/components/primer/beta/truncate.css.json +1 -1
  73. data/app/components/primer/beta/truncate.css.map +1 -1
  74. data/app/components/primer/beta/truncate.rb +0 -1
  75. data/app/components/primer/button_component.rb +9 -9
  76. data/app/components/primer/component.rb +0 -1
  77. data/app/components/primer/hellip_button.rb +2 -34
  78. data/app/components/primer/navigation/tab_component.rb +16 -16
  79. data/app/components/primer/primer.d.ts +1 -1
  80. data/app/components/primer/primer.js +1 -1
  81. data/app/components/primer/primer.pcss +3 -3
  82. data/app/components/primer/primer.ts +1 -1
  83. data/app/components/primer/state_component.rb +2 -69
  84. data/app/components/primer/subhead_component.rb +2 -128
  85. data/app/components/primer/tab_container_component.rb +2 -36
  86. data/app/components/primer/timeline_item_component.rb +5 -78
  87. data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -0
  88. data/app/forms/example_toggle_switch_form.rb +8 -0
  89. data/app/forms/submit_button_form.rb +4 -4
  90. data/app/lib/primer/tabbed_component_helper.rb +1 -1
  91. data/lib/primer/deprecations.rb +7 -13
  92. data/lib/primer/deprecations.yml +24 -0
  93. data/lib/primer/forms/button.html.erb +2 -2
  94. data/lib/primer/forms/dsl/toggle_switch_input.rb +35 -0
  95. data/lib/primer/forms/toggle_switch.html.erb +17 -0
  96. data/lib/primer/forms/toggle_switch.rb +19 -0
  97. data/lib/primer/forms/toggle_switch_form.rb +74 -0
  98. data/lib/primer/view_components/linters/subhead_component_migration_counter.rb +1 -1
  99. data/lib/primer/view_components/version.rb +1 -1
  100. data/lib/rubocop/cop/primer/component_name_migration.rb +2 -1
  101. data/lib/tasks/docs.rake +6 -6
  102. data/previews/primer/alpha/action_list_preview.rb +44 -44
  103. data/previews/primer/alpha/dropdown_preview.rb +97 -97
  104. data/previews/primer/alpha/hellip_button_preview.rb +24 -0
  105. data/previews/primer/alpha/layout_preview.rb +63 -63
  106. data/previews/primer/alpha/menu_preview/default.html.erb +5 -5
  107. data/previews/primer/alpha/menu_preview/playground.html.erb +5 -5
  108. data/previews/primer/alpha/segmented_control_preview.rb +60 -60
  109. data/previews/primer/alpha/tab_nav_preview.rb +22 -22
  110. data/previews/primer/alpha/tab_panels_preview.rb +2 -2
  111. data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +6 -6
  112. data/previews/primer/alpha/tooltip_preview.rb +12 -12
  113. data/previews/primer/alpha/underline_nav_preview.rb +4 -4
  114. data/previews/primer/alpha/underline_panels_preview.rb +8 -8
  115. data/previews/primer/beta/auto_complete_item_preview/default.html.erb +2 -2
  116. data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +2 -2
  117. data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +3 -3
  118. data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +2 -2
  119. data/previews/primer/beta/auto_complete_preview.rb +18 -18
  120. data/previews/primer/beta/avatar_stack_preview.rb +32 -32
  121. data/previews/primer/beta/blankslate_preview.rb +40 -40
  122. data/previews/primer/beta/border_box_preview.rb +38 -38
  123. data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
  124. data/previews/primer/beta/button_group_preview.rb +10 -10
  125. data/previews/primer/beta/button_preview/all_schemes.html.erb +4 -4
  126. data/previews/primer/beta/button_preview/invisible_all_visuals.html.erb +16 -16
  127. data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
  128. data/previews/primer/beta/button_preview/trailing_action.html.erb +2 -2
  129. data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -2
  130. data/previews/primer/beta/button_preview/with_tooltip.html.erb +2 -2
  131. data/previews/primer/beta/details_preview.rb +6 -6
  132. data/previews/primer/beta/state_preview.rb +66 -0
  133. data/previews/primer/beta/subhead_preview/actions.html.erb +14 -0
  134. data/previews/primer/beta/subhead_preview.rb +99 -0
  135. data/previews/primer/beta/timeline_item_preview.rb +30 -0
  136. data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +1 -0
  137. data/previews/primer/forms/forms_preview.rb +2 -0
  138. data/static/arguments.json +118 -118
  139. data/static/audited_at.json +6 -0
  140. data/static/constants.json +67 -54
  141. data/static/statuses.json +12 -6
  142. metadata +36 -23
  143. data/app/components/primer/state_component.css.json +0 -1
  144. data/app/components/primer/state_component.css.map +0 -1
  145. data/app/components/primer/subhead_component.css.json +0 -1
  146. data/app/components/primer/subhead_component.css.map +0 -1
  147. data/app/components/primer/timeline_item_component.css.json +0 -1
  148. data/app/components/primer/timeline_item_component.css.map +0 -1
  149. data/previews/primer/hellip_button_preview.rb +0 -22
  150. data/previews/primer/state_component_preview.rb +0 -26
  151. data/previews/primer/subhead_component_preview.rb +0 -40
  152. data/previews/primer/timeline_item_component_preview.rb +0 -28
@@ -8,8 +8,8 @@ module Primer
8
8
  # @param direction select [s, n, e, w, ne, nw, se, sw]
9
9
  # @param tooltip_text text
10
10
  def playground(type: :description, direction: :s, tooltip_text: "Tooltip text")
11
- render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |c|
12
- c.tooltip(text: tooltip_text, type: type, direction: direction)
11
+ render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |component|
12
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
13
13
  "Button"
14
14
  end
15
15
  end
@@ -18,8 +18,8 @@ module Primer
18
18
  # @param direction select [s, n, e, w, ne, nw, se, sw]
19
19
  # @param tooltip_text text
20
20
  def default(type: :description, direction: :s, tooltip_text: "Tooltip text")
21
- render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |c|
22
- c.tooltip(text: tooltip_text, type: type, direction: direction)
21
+ render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |component|
22
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
23
23
  "Button"
24
24
  end
25
25
  end
@@ -27,8 +27,8 @@ module Primer
27
27
  # @param direction select [s, n, e, w, ne, nw, se, sw]
28
28
  # @param tooltip_text text
29
29
  def label_tooltip_on_button_with_existing_labelledby(type: :label, direction: :s, tooltip_text: "Tooltip text")
30
- render(Primer::Beta::Button.new(id: "button-with-existing-label", "aria-labelledby": "existing-label-id")) do |c|
31
- c.tooltip(text: tooltip_text, type: type, direction: direction)
30
+ render(Primer::Beta::Button.new(id: "button-with-existing-label", "aria-labelledby": "existing-label-id")) do |component|
31
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
32
32
  "Button"
33
33
  end
34
34
  end
@@ -36,8 +36,8 @@ module Primer
36
36
  # @param direction select [s, n, e, w, ne, nw, se, sw]
37
37
  # @param tooltip_text text
38
38
  def description_tooltip_on_button_with_existing_describedby(type: :description, direction: :s, tooltip_text: "Tooltip text")
39
- render(Primer::Beta::Button.new(id: "button-with-existing-description", "aria-describedby": "existing-description-id")) do |c|
40
- c.tooltip(text: tooltip_text, type: type, direction: direction)
39
+ render(Primer::Beta::Button.new(id: "button-with-existing-description", "aria-describedby": "existing-description-id")) do |component|
40
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
41
41
  "Button"
42
42
  end
43
43
  end
@@ -69,16 +69,16 @@ module Primer
69
69
  # @!group Tooltip enabled elements
70
70
  # @label Tooltip with Primer::Beta::Button
71
71
  def tooltip_with_button(type: :description, direction: :s, tooltip_text: "Tooltip text")
72
- render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |c|
73
- c.tooltip(text: tooltip_text, type: type, direction: direction)
72
+ render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |component|
73
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
74
74
  "Button"
75
75
  end
76
76
  end
77
77
 
78
78
  # @label Tooltip with Primer::Beta::Link
79
79
  def tooltip_with_link(type: :description, direction: :s, tooltip_text: "Tooltip text")
80
- render(Primer::Beta::Link.new(href: "#link-with-tooltip", id: "link-with-tooltip")) do |c|
81
- c.tooltip(text: tooltip_text, type: type, direction: direction)
80
+ render(Primer::Beta::Link.new(href: "#link-with-tooltip", id: "link-with-tooltip")) do |component|
81
+ component.with_tooltip(text: tooltip_text, type: type, direction: direction)
82
82
  "Button"
83
83
  end
84
84
  end
@@ -43,10 +43,10 @@ module Primer
43
43
  def with_icons_and_counters(label: "With icons and counters", number_of_panels: 3, align: :left, tag: :nav)
44
44
  render(Primer::Alpha::UnderlineNav.new(label: label, tag: tag, align: align)) do |component|
45
45
  Array.new(number_of_panels || 3) do |i|
46
- component.with_tab(href: "#", selected: i.zero?) do |t|
47
- t.icon(icon: :star)
48
- t.text { "Item #{i + 1}" }
49
- t.counter(count: (i + 1) * 5)
46
+ component.with_tab(href: "#", selected: i.zero?) do |tab|
47
+ tab.with_icon(icon: :star)
48
+ tab.with_text { "Item #{i + 1}" }
49
+ tab.with_counter(count: (i + 1) * 5)
50
50
  end
51
51
  end
52
52
  end
@@ -9,11 +9,11 @@ module Primer
9
9
  # @param number_of_panels [Integer] number
10
10
  # @param align [Symbol] select [left, right]
11
11
  def playground(number_of_panels: 3, align: :left)
12
- render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |c|
12
+ render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |component|
13
13
  Array.new(number_of_panels || 3) do |i|
14
- c.tab(selected: i.zero?, id: "tab-#{i + 1}") do |t|
15
- t.panel { "Panel #{i + 1}" }
16
- t.text { "Tab #{i + 1}" }
14
+ component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
15
+ tab.with_panel { "Panel #{i + 1}" }
16
+ tab.with_text { "Tab #{i + 1}" }
17
17
  end
18
18
  end
19
19
  end
@@ -24,11 +24,11 @@ module Primer
24
24
  # @param number_of_panels [Integer] number
25
25
  # @param align [Symbol] select [left, right]
26
26
  def default(number_of_panels: 3, align: :left)
27
- render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |c|
27
+ render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |component|
28
28
  Array.new(number_of_panels || 3) do |i|
29
- c.tab(selected: i.zero?, id: "tab-#{i + 1}") do |t|
30
- t.panel { "Panel #{i + 1}" }
31
- t.text { "Tab #{i + 1}" }
29
+ component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
30
+ tab.with_panel { "Panel #{i + 1}" }
31
+ tab.with_text { "Tab #{i + 1}" }
32
32
  end
33
33
  end
34
34
  end
@@ -3,7 +3,7 @@
3
3
  selected: selected,
4
4
  disabled: disabled,
5
5
  value: ''
6
- )) do |c| %>
7
- <% c.leading_visual_icon(icon: :search) %>
6
+ )) do |component| %>
7
+ <% component.with_leading_visual_icon(icon: :search) %>
8
8
  Label text
9
9
  <% end %>
@@ -3,7 +3,7 @@
3
3
  selected: selected,
4
4
  disabled: disabled,
5
5
  value: ''
6
- )) do |c| %>
7
- <% c.leading_visual_icon(icon: :search) %>
6
+ )) do |component| %>
7
+ <% component.with_leading_visual_icon(icon: :search) %>
8
8
  Label text
9
9
  <% end %>
@@ -4,8 +4,8 @@
4
4
  selected: selected,
5
5
  disabled: disabled,
6
6
  value: ''
7
- )) do |c| %>
8
- <% c.leading_visual_icon(icon: :search) %>
9
- <% c.description { "Description" } %>
7
+ )) do |component| %>
8
+ <% component.with_leading_visual_icon(icon: :search) %>
9
+ <% component.with_description { "Description" } %>
10
10
  Label text
11
11
  <% end %>
@@ -13,8 +13,8 @@
13
13
  disabled: disabled,
14
14
  invalid: invalid,
15
15
  input_name: input_name
16
- )) do |c| %>
17
- <% c.leading_visual_icon(icon: :search) %>
16
+ )) do |component| %>
17
+ <% component.with_leading_visual_icon(icon: :search) %>
18
18
  <% end %>
19
19
  <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" } %>
20
20
  </div>
@@ -21,8 +21,8 @@ module Primer
21
21
  # @param inset toggle
22
22
  # @param monospace toggle
23
23
  def playground(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id", inset: false, monospace: false)
24
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |c|
25
- c.leading_visual_icon(icon: :search)
24
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
25
+ component.with_leading_visual_icon(icon: :search)
26
26
  end
27
27
  end
28
28
 
@@ -41,8 +41,8 @@ module Primer
41
41
  # @param inset toggle
42
42
  # @param monospace toggle
43
43
  def default(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id", inset: false, monospace: false)
44
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |c|
45
- c.leading_visual_icon(icon: :search)
44
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
45
+ component.with_leading_visual_icon(icon: :search)
46
46
  end
47
47
  end
48
48
 
@@ -87,8 +87,8 @@ module Primer
87
87
  # @param list_id text
88
88
  # @param input_name text
89
89
  def leading_visual(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
90
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
91
- c.leading_visual_icon(icon: :search)
90
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
91
+ component.with_leading_visual_icon(icon: :search)
92
92
  end
93
93
  end
94
94
 
@@ -121,8 +121,8 @@ module Primer
121
121
  # @param list_id text
122
122
  # @param input_name text
123
123
  def full_width(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: true, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
124
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
125
- c.leading_visual_icon(icon: :search)
124
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
125
+ component.with_leading_visual_icon(icon: :search)
126
126
  end
127
127
  end
128
128
 
@@ -139,8 +139,8 @@ module Primer
139
139
  # @param list_id text
140
140
  # @param input_name text
141
141
  def visually_hide_label(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: true, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
142
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
143
- c.leading_visual_icon(icon: :search)
142
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
143
+ component.with_leading_visual_icon(icon: :search)
144
144
  end
145
145
  end
146
146
 
@@ -158,8 +158,8 @@ module Primer
158
158
  # @param list_id text
159
159
  # @param input_name text
160
160
  def small(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :small, full_width: false, disabled: false, invalid: false, input_id: "input-id-1", list_id: "list-id-1", input_name: "input-id-1")
161
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
162
- c.leading_visual_icon(icon: :search)
161
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
162
+ component.with_leading_visual_icon(icon: :search)
163
163
  end
164
164
  end
165
165
 
@@ -175,8 +175,8 @@ module Primer
175
175
  # @param list_id text
176
176
  # @param input_name text
177
177
  def medium(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id-2", list_id: "list-id-2", input_name: "input-id-2")
178
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
179
- c.leading_visual_icon(icon: :search)
178
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
179
+ component.with_leading_visual_icon(icon: :search)
180
180
  end
181
181
  end
182
182
 
@@ -192,8 +192,8 @@ module Primer
192
192
  # @param list_id text
193
193
  # @param input_name text
194
194
  def large(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :large, full_width: false, disabled: false, invalid: false, input_id: "input-id-3", list_id: "list-id-3", input_name: "input-id-3")
195
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |c|
196
- c.leading_visual_icon(icon: :search)
195
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
196
+ component.with_leading_visual_icon(icon: :search)
197
197
  end
198
198
  end
199
199
 
@@ -238,8 +238,8 @@ module Primer
238
238
 
239
239
  # @hidden
240
240
  def with_icon
241
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path)) do |c|
242
- c.leading_visual_icon(icon: :search)
241
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path)) do |component|
242
+ component.with_leading_visual_icon(icon: :search)
243
243
  end
244
244
  end
245
245
 
@@ -12,17 +12,17 @@ module Primer
12
12
  # @param tooltipped toggle
13
13
  # @param tooltip_label text
14
14
  def playground(number_of_avatars: 1, tag: :div, align: :left, tooltipped: false, tooltip_label: "This is a tooltip!")
15
- render(Primer::Beta::AvatarStack.new(tag: tag, align: align, tooltipped: tooltipped, body_arguments: { label: tooltip_label })) do |c|
15
+ render(Primer::Beta::AvatarStack.new(tag: tag, align: align, tooltipped: tooltipped, body_arguments: { label: tooltip_label })) do |component|
16
16
  Array.new(number_of_avatars || 1) do
17
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
17
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
22
  # @label Default
23
23
  def default
24
- render(Primer::Beta::AvatarStack.new) do |c|
25
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
24
+ render(Primer::Beta::AvatarStack.new) do |component|
25
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
26
26
  end
27
27
  end
28
28
 
@@ -30,46 +30,46 @@ module Primer
30
30
  #
31
31
  # @label 1 avatar
32
32
  def avatar_1
33
- render(Primer::Beta::AvatarStack.new) do |c|
34
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
33
+ render(Primer::Beta::AvatarStack.new) do |component|
34
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
35
35
  end
36
36
  end
37
37
 
38
38
  # @label 2 avatars
39
39
  def avatar_2
40
- render(Primer::Beta::AvatarStack.new) do |c|
41
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
42
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
40
+ render(Primer::Beta::AvatarStack.new) do |component|
41
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
42
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
43
43
  end
44
44
  end
45
45
 
46
46
  # @label 3 avatars
47
47
  def avatar_3
48
- render(Primer::Beta::AvatarStack.new) do |c|
49
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
50
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
51
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
48
+ render(Primer::Beta::AvatarStack.new) do |component|
49
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
50
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
51
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
52
52
  end
53
53
  end
54
54
 
55
55
  # @label 4 avatars
56
56
  def avatar_4
57
- render(Primer::Beta::AvatarStack.new) do |c|
58
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
59
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
60
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
61
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
57
+ render(Primer::Beta::AvatarStack.new) do |component|
58
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
59
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
60
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
61
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
62
62
  end
63
63
  end
64
64
 
65
65
  # @label 5 avatars
66
66
  def avatar_5
67
- render(Primer::Beta::AvatarStack.new) do |c|
68
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
69
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
70
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
71
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
72
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
67
+ render(Primer::Beta::AvatarStack.new) do |component|
68
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
69
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
70
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
71
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
72
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
73
73
  end
74
74
  end
75
75
  #
@@ -79,19 +79,19 @@ module Primer
79
79
  #
80
80
  # @label Align right
81
81
  def align_right
82
- render(Primer::Beta::AvatarStack.new(align: :right)) do |c|
83
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
84
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
85
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
82
+ render(Primer::Beta::AvatarStack.new(align: :right)) do |component|
83
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
84
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
85
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
86
86
  end
87
87
  end
88
88
 
89
89
  # @label With tooltip
90
90
  def with_tooltip
91
- render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: "This is a tooltip!" })) do |c|
92
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
93
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
94
- c.avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
91
+ render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: "This is a tooltip!" })) do |component|
92
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
93
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
94
+ component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
95
95
  end
96
96
  end
97
97
  #
@@ -10,17 +10,17 @@ module Primer
10
10
  # @param spacious [Boolean] toggle
11
11
  # @param border [Boolean] toggle
12
12
  def playground(narrow: false, spacious: false, border: false)
13
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
14
- c.heading(tag: :h2).with_content("Title")
15
- c.description { "Description" }
13
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
14
+ component.with_heading(tag: :h2).with_content("Title")
15
+ component.with_description { "Description" }
16
16
  end
17
17
  end
18
18
 
19
19
  # @label Default options
20
20
  def default
21
- render Primer::Beta::Blankslate.new do |c|
22
- c.heading(tag: :h2).with_content("Title")
23
- c.description { "Description" }
21
+ render Primer::Beta::Blankslate.new do |component|
22
+ component.with_heading(tag: :h2).with_content("Title")
23
+ component.with_description { "Description" }
24
24
  end
25
25
  end
26
26
 
@@ -28,25 +28,25 @@ module Primer
28
28
  #
29
29
  # @label Narrow
30
30
  def option_narrow
31
- render Primer::Beta::Blankslate.new(narrow: true) do |c|
32
- c.heading(tag: :h2).with_content("Title")
33
- c.description { "Description" }
31
+ render Primer::Beta::Blankslate.new(narrow: true) do |component|
32
+ component.with_heading(tag: :h2).with_content("Title")
33
+ component.with_description { "Description" }
34
34
  end
35
35
  end
36
36
 
37
37
  # @label Spacious
38
38
  def option_spacious
39
- render Primer::Beta::Blankslate.new(spacious: true) do |c|
40
- c.heading(tag: :h2).with_content("Title")
41
- c.description { "Description" }
39
+ render Primer::Beta::Blankslate.new(spacious: true) do |component|
40
+ component.with_heading(tag: :h2).with_content("Title")
41
+ component.with_description { "Description" }
42
42
  end
43
43
  end
44
44
 
45
45
  # @label Border
46
46
  def option_border
47
- render Primer::Beta::Blankslate.new(border: true) do |c|
48
- c.heading(tag: :h2).with_content("Title")
49
- c.description { "Description" }
47
+ render Primer::Beta::Blankslate.new(border: true) do |component|
48
+ component.with_heading(tag: :h2).with_content("Title")
49
+ component.with_description { "Description" }
50
50
  end
51
51
  end
52
52
  #
@@ -56,9 +56,9 @@ module Primer
56
56
  # @param spacious [Boolean] toggle
57
57
  # @param border [Boolean] toggle
58
58
  def with_icon(narrow: false, spacious: false, border: false)
59
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
60
- c.visual_icon(icon: :shield)
61
- c.heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
59
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
60
+ component.with_visual_icon(icon: :shield)
61
+ component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
62
62
  end
63
63
  end
64
64
 
@@ -66,9 +66,9 @@ module Primer
66
66
  # @param spacious [Boolean] toggle
67
67
  # @param border [Boolean] toggle
68
68
  def with_image(narrow: false, spacious: false, border: false)
69
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
70
- c.heading(tag: :h2).with_content("Millions of teams trust GitHub to keep their work safe")
71
- c.visual_image(src: Primer::ExampleImage::BASE64_SRC, alt: "Security - secure vault")
69
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
70
+ component.with_heading(tag: :h2).with_content("Millions of teams trust GitHub to keep their work safe")
71
+ component.with_visual_image(src: Primer::ExampleImage::BASE64_SRC, alt: "Security - secure vault")
72
72
  end
73
73
  end
74
74
 
@@ -76,10 +76,10 @@ module Primer
76
76
  # @param spacious [Boolean] toggle
77
77
  # @param border [Boolean] toggle
78
78
  def loading(narrow: false, spacious: false, border: false)
79
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
80
- c.heading(tag: :h2).with_content("Mirroring your repository")
81
- c.description { "We’re currently mirroring this repository. It should take anywhere from a few minutes to a couple of hours depending on the size of the repository." }
82
- c.visual_spinner(size: :large)
79
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
80
+ component.with_heading(tag: :h2).with_content("Mirroring your repository")
81
+ component.with_description { "We’re currently mirroring this repository. It should take anywhere from a few minutes to a couple of hours depending on the size of the repository." }
82
+ component.with_visual_spinner(size: :large)
83
83
  end
84
84
  end
85
85
 
@@ -87,9 +87,9 @@ module Primer
87
87
  # @param spacious [Boolean] toggle
88
88
  # @param border [Boolean] toggle
89
89
  def description(narrow: false, spacious: false, border: false)
90
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
91
- c.heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
92
- c.description { "Millions of teams trust GitHub to keep their work safe" }
90
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
91
+ component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
92
+ component.with_description { "Millions of teams trust GitHub to keep their work safe" }
93
93
  end
94
94
  end
95
95
 
@@ -97,9 +97,9 @@ module Primer
97
97
  # @param spacious [Boolean] toggle
98
98
  # @param border [Boolean] toggle
99
99
  def primary_action(narrow: false, spacious: false, border: false)
100
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
101
- c.heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
102
- c.primary_action(href: "#").with_content("Fix issue")
100
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
101
+ component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
102
+ component.with_primary_action(href: "#").with_content("Fix issue")
103
103
  end
104
104
  end
105
105
 
@@ -107,9 +107,9 @@ module Primer
107
107
  # @param spacious [Boolean] toggle
108
108
  # @param border [Boolean] toggle
109
109
  def secondary_action(narrow: false, spacious: false, border: false)
110
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
111
- c.heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
112
- c.secondary_action(href: "#").with_content("Fix issue")
110
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
111
+ component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
112
+ component.with_secondary_action(href: "#").with_content("Fix issue")
113
113
  end
114
114
  end
115
115
 
@@ -117,12 +117,12 @@ module Primer
117
117
  # @param spacious [Boolean] toggle
118
118
  # @param border [Boolean] toggle
119
119
  def full(narrow: false, spacious: false, border: false)
120
- render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |c|
121
- c.visual_icon(icon: :shield)
122
- c.heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
123
- c.description { "Millions of teams trust GitHub to keep their work safe" }
124
- c.primary_action(href: "#").with_content("Fix issue")
125
- c.secondary_action(href: "#").with_content("Learn more about vulnerabilities")
120
+ render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
121
+ component.with_visual_icon(icon: :shield)
122
+ component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
123
+ component.with_description { "Millions of teams trust GitHub to keep their work safe" }
124
+ component.with_primary_action(href: "#").with_content("Fix issue")
125
+ component.with_secondary_action(href: "#").with_content("Learn more about vulnerabilities")
126
126
  end
127
127
  end
128
128
  end