primer_view_components 0.0.115 → 0.0.117

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -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/divider.rb +0 -2
  8. data/app/components/primer/alpha/action_list/heading.rb +0 -2
  9. data/app/components/primer/alpha/action_list/item.rb +0 -2
  10. data/app/components/primer/alpha/action_list.css +1 -1
  11. data/app/components/primer/alpha/action_list.css.json +1 -1
  12. data/app/components/primer/alpha/action_list.css.map +1 -1
  13. data/app/components/primer/alpha/action_list.rb +0 -1
  14. data/app/components/primer/alpha/auto_complete/item.rb +4 -5
  15. data/app/components/primer/alpha/auto_complete.rb +12 -13
  16. data/app/components/primer/alpha/banner.rb +0 -1
  17. data/app/components/primer/alpha/button_marketing.rb +0 -2
  18. data/app/components/primer/alpha/dialog.rb +0 -3
  19. data/app/components/primer/alpha/dropdown/menu.rb +2 -0
  20. data/app/components/primer/alpha/dropdown.html.erb +3 -3
  21. data/app/components/primer/alpha/dropdown.rb +53 -53
  22. data/app/components/primer/alpha/hellip_button.rb +41 -0
  23. data/app/components/primer/alpha/hidden_text_expander.rb +1 -1
  24. data/app/components/primer/alpha/image.rb +0 -1
  25. data/app/components/primer/alpha/layout.rb +49 -49
  26. data/app/components/primer/alpha/menu.css +1 -1
  27. data/app/components/primer/alpha/menu.css.json +1 -1
  28. data/app/components/primer/alpha/menu.css.map +1 -1
  29. data/app/components/primer/alpha/menu.rb +5 -5
  30. data/app/components/primer/alpha/octicon_symbols.rb +0 -2
  31. data/app/components/primer/alpha/segmented_control.css +1 -1
  32. data/app/components/primer/alpha/segmented_control.css.json +1 -1
  33. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  34. data/app/components/primer/alpha/segmented_control.pcss +12 -0
  35. data/app/components/primer/alpha/segmented_control.rb +20 -20
  36. data/app/components/primer/{tab_container_component.d.ts → alpha/tab_container.d.ts} +0 -0
  37. data/app/components/primer/{tab_container_component.js → alpha/tab_container.js} +0 -0
  38. data/app/components/primer/alpha/tab_container.rb +43 -0
  39. data/app/components/primer/{tab_container_component.ts → alpha/tab_container.ts} +0 -0
  40. data/app/components/primer/alpha/tab_nav.css +1 -1
  41. data/app/components/primer/alpha/tab_nav.css.json +1 -1
  42. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  43. data/app/components/primer/alpha/tab_nav.rb +32 -32
  44. data/app/components/primer/alpha/tab_panels.rb +6 -6
  45. data/app/components/primer/alpha/text_field.rb +0 -1
  46. data/app/components/primer/alpha/toggle_switch.rb +6 -8
  47. data/app/components/primer/alpha/tool_tip.js +3 -7
  48. data/app/components/primer/alpha/tool_tip.ts +3 -7
  49. data/app/components/primer/alpha/tooltip.rb +18 -20
  50. data/app/components/primer/alpha/underline_nav.css +1 -1
  51. data/app/components/primer/alpha/underline_nav.css.json +1 -1
  52. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  53. data/app/components/primer/alpha/underline_nav.rb +18 -18
  54. data/app/components/primer/alpha/underline_panels.rb +6 -6
  55. data/app/components/primer/beta/auto_complete/item.rb +2 -2
  56. data/app/components/primer/beta/auto_complete.rb +17 -17
  57. data/app/components/primer/beta/avatar.rb +0 -1
  58. data/app/components/primer/beta/avatar_stack.rb +12 -12
  59. data/app/components/primer/beta/base_button.rb +0 -1
  60. data/app/components/primer/beta/blankslate.rb +42 -42
  61. data/app/components/primer/beta/breadcrumbs.css +1 -1
  62. data/app/components/primer/beta/breadcrumbs.css.json +1 -1
  63. data/app/components/primer/beta/breadcrumbs.css.map +1 -1
  64. data/app/components/primer/beta/button.css +1 -1
  65. data/app/components/primer/beta/button.css.json +1 -1
  66. data/app/components/primer/beta/button.css.map +1 -1
  67. data/app/components/primer/beta/button.pcss +5 -0
  68. data/app/components/primer/beta/button.rb +9 -9
  69. data/app/components/primer/beta/button_group.rb +2 -0
  70. data/app/components/primer/beta/clipboard_copy.rb +0 -1
  71. data/app/components/primer/beta/close_button.rb +0 -1
  72. data/app/components/primer/beta/counter.rb +0 -1
  73. data/app/components/primer/beta/details.rb +5 -3
  74. data/app/components/primer/beta/heading.rb +0 -1
  75. data/app/components/primer/beta/icon_button.rb +0 -1
  76. data/app/components/primer/beta/label.rb +0 -1
  77. data/app/components/primer/beta/link.rb +2 -2
  78. data/app/components/primer/beta/markdown.rb +0 -1
  79. data/app/components/primer/beta/progress_bar.rb +7 -7
  80. data/app/components/primer/beta/relative_time.rb +0 -1
  81. data/app/components/primer/beta/spinner.rb +0 -1
  82. data/app/components/primer/{state_component.css → beta/state.css} +0 -0
  83. data/app/components/primer/beta/state.css.json +1 -0
  84. data/app/components/primer/beta/state.css.map +1 -0
  85. data/app/components/primer/{state_component.pcss → beta/state.pcss} +0 -0
  86. data/app/components/primer/beta/state.rb +76 -0
  87. data/app/components/primer/{subhead_component.css → beta/subhead.css} +0 -0
  88. data/app/components/primer/beta/subhead.css.json +1 -0
  89. data/app/components/primer/beta/subhead.css.map +1 -0
  90. data/app/components/primer/{subhead_component.html.erb → beta/subhead.html.erb} +0 -0
  91. data/app/components/primer/{subhead_component.pcss → beta/subhead.pcss} +0 -0
  92. data/app/components/primer/beta/subhead.rb +135 -0
  93. data/app/components/primer/beta/text.rb +0 -1
  94. data/app/components/primer/{timeline_item_component.css → beta/timeline_item.css} +0 -0
  95. data/app/components/primer/beta/timeline_item.css.json +1 -0
  96. data/app/components/primer/beta/timeline_item.css.map +1 -0
  97. data/app/components/primer/{timeline_item_component.html.erb → beta/timeline_item.html.erb} +0 -0
  98. data/app/components/primer/{timeline_item_component.pcss → beta/timeline_item.pcss} +0 -0
  99. data/app/components/primer/beta/timeline_item.rb +90 -0
  100. data/app/components/primer/beta/truncate.css +1 -1
  101. data/app/components/primer/beta/truncate.css.json +1 -1
  102. data/app/components/primer/beta/truncate.css.map +1 -1
  103. data/app/components/primer/beta/truncate.rb +2 -2
  104. data/app/components/primer/box.rb +0 -1
  105. data/app/components/primer/button_component.rb +11 -11
  106. data/app/components/primer/conditional_wrapper.rb +0 -2
  107. data/app/components/primer/dropdown_menu_component.rb +3 -3
  108. data/app/components/primer/hellip_button.rb +2 -36
  109. data/app/components/primer/icon_button.rb +0 -1
  110. data/app/components/primer/layout_component.rb +0 -2
  111. data/app/components/primer/local_time.rb +0 -1
  112. data/app/components/primer/navigation/tab_component.rb +16 -16
  113. data/app/components/primer/octicon_component.rb +0 -1
  114. data/app/components/primer/primer.d.ts +1 -1
  115. data/app/components/primer/primer.js +1 -1
  116. data/app/components/primer/primer.pcss +3 -3
  117. data/app/components/primer/primer.ts +1 -1
  118. data/app/components/primer/state_component.rb +2 -70
  119. data/app/components/primer/subhead_component.rb +2 -130
  120. data/app/components/primer/tab_container_component.rb +2 -38
  121. data/app/components/primer/time_ago_component.rb +0 -1
  122. data/app/components/primer/timeline_item_component.rb +5 -79
  123. data/app/components/primer/tooltip.rb +0 -1
  124. data/app/components/primer/truncate.rb +0 -2
  125. data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -0
  126. data/app/forms/example_toggle_switch_form.rb +8 -0
  127. data/app/forms/submit_button_form.rb +4 -4
  128. data/app/lib/primer/tabbed_component_helper.rb +1 -1
  129. data/lib/primer/deprecations.rb +7 -13
  130. data/lib/primer/deprecations.yml +24 -0
  131. data/lib/primer/forms/builder.rb +2 -3
  132. data/lib/primer/forms/button.html.erb +2 -2
  133. data/lib/primer/forms/dsl/form_reference_input.rb +25 -2
  134. data/lib/primer/forms/dsl/input.rb +27 -0
  135. data/lib/primer/forms/dsl/toggle_switch_input.rb +35 -0
  136. data/lib/primer/forms/form_reference.html.erb +1 -1
  137. data/lib/primer/forms/form_reference.rb +4 -0
  138. data/lib/primer/forms/toggle_switch.html.erb +17 -0
  139. data/lib/primer/forms/toggle_switch.rb +19 -0
  140. data/lib/primer/forms/toggle_switch_form.rb +74 -0
  141. data/lib/primer/view_components/linters/subhead_component_migration_counter.rb +1 -1
  142. data/lib/primer/view_components/version.rb +1 -1
  143. data/lib/rubocop/cop/primer/component_name_migration.rb +2 -1
  144. data/lib/tasks/docs.rake +6 -6
  145. data/previews/primer/alpha/action_list_preview.rb +44 -44
  146. data/previews/primer/alpha/dropdown_preview.rb +97 -97
  147. data/previews/primer/alpha/hellip_button_preview.rb +24 -0
  148. data/previews/primer/alpha/layout_preview.rb +63 -63
  149. data/previews/primer/alpha/menu_preview/default.html.erb +5 -5
  150. data/previews/primer/alpha/menu_preview/playground.html.erb +5 -5
  151. data/previews/primer/alpha/segmented_control_preview.rb +60 -60
  152. data/previews/primer/alpha/tab_nav_preview.rb +22 -22
  153. data/previews/primer/alpha/tab_panels_preview.rb +8 -8
  154. data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +6 -6
  155. data/previews/primer/alpha/tooltip_preview.rb +12 -12
  156. data/previews/primer/alpha/underline_nav_preview.rb +4 -4
  157. data/previews/primer/alpha/underline_panels_preview.rb +8 -8
  158. data/previews/primer/beta/auto_complete_item_preview/default.html.erb +2 -2
  159. data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +2 -2
  160. data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +3 -3
  161. data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +2 -2
  162. data/previews/primer/beta/auto_complete_preview.rb +18 -18
  163. data/previews/primer/beta/avatar_stack_preview.rb +32 -32
  164. data/previews/primer/beta/blankslate_preview.rb +40 -40
  165. data/previews/primer/beta/border_box_preview.rb +38 -38
  166. data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
  167. data/previews/primer/beta/button_group_preview.rb +10 -10
  168. data/previews/primer/beta/button_preview/all_schemes.html.erb +4 -4
  169. data/previews/primer/beta/button_preview/invisible_all_visuals.html.erb +16 -16
  170. data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
  171. data/previews/primer/beta/button_preview/trailing_action.html.erb +2 -2
  172. data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -2
  173. data/previews/primer/beta/button_preview/with_tooltip.html.erb +2 -2
  174. data/previews/primer/beta/details_preview.rb +12 -12
  175. data/previews/primer/beta/state_preview.rb +66 -0
  176. data/previews/primer/beta/subhead_preview/actions.html.erb +14 -0
  177. data/previews/primer/beta/subhead_preview.rb +99 -0
  178. data/previews/primer/beta/timeline_item_preview.rb +30 -0
  179. data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +1 -0
  180. data/previews/primer/forms/forms_preview.rb +2 -0
  181. data/previews/primer/local_time_component_preview.rb +3 -0
  182. data/previews/primer/time_ago_component_preview.rb +3 -0
  183. data/previews/primer/url_helpers.rb +2 -2
  184. data/static/arguments.json +118 -118
  185. data/static/audited_at.json +6 -0
  186. data/static/constants.json +67 -54
  187. data/static/statuses.json +12 -6
  188. metadata +36 -23
  189. data/app/components/primer/state_component.css.json +0 -1
  190. data/app/components/primer/state_component.css.map +0 -1
  191. data/app/components/primer/subhead_component.css.json +0 -1
  192. data/app/components/primer/subhead_component.css.map +0 -1
  193. data/app/components/primer/timeline_item_component.css.json +0 -1
  194. data/app/components/primer/timeline_item_component.css.map +0 -1
  195. data/previews/primer/hellip_button_preview.rb +0 -22
  196. data/previews/primer/state_component_preview.rb +0 -26
  197. data/previews/primer/subhead_component_preview.rb +0 -40
  198. data/previews/primer/timeline_item_component_preview.rb +0 -28
@@ -48,52 +48,52 @@ module Primer
48
48
  # @description
49
49
  # `<nav>` is a landmark and should be reserved for main navigation links. See <%= link_to_accessibility %>.
50
50
  # @code
51
- # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |c| %>
52
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" } %>
53
- # <% c.with_tab(href: "#") { "Tab 2" } %>
54
- # <% c.with_tab(href: "#") { "Tab 3" } %>
51
+ # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |component| %>
52
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" } %>
53
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
54
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
55
55
  # <% end %>
56
56
  #
57
57
  # @example Default with `<div>`
58
- # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |c| %>
59
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" } %>
60
- # <% c.with_tab(href: "#") { "Tab 2" } %>
61
- # <% c.with_tab(href: "#") { "Tab 3" } %>
58
+ # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |component| %>
59
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" } %>
60
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
61
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
62
62
  # <% end %>
63
63
  #
64
64
  # @example With icons and counters
65
65
  # <%= render(Primer::Alpha::TabNav.new(label: "With icons and counters")) do |component| %>
66
- # <% component.with_tab(href: "#", selected: true) do |t| %>
67
- # <% t.icon(icon: :star) %>
68
- # <% t.text { "Item 1" } %>
66
+ # <% component.with_tab(href: "#", selected: true) do |tab| %>
67
+ # <% tab.with_icon(icon: :star) %>
68
+ # <% tab.with_text { "Item 1" } %>
69
69
  # <% end %>
70
- # <% component.with_tab(href: "#") do |t| %>
71
- # <% t.icon(icon: :star) %>
72
- # <% t.text { "Item 2" } %>
73
- # <% t.counter(count: 10) %>
70
+ # <% component.with_tab(href: "#") do |tab| %>
71
+ # <% tab.with_icon(icon: :star) %>
72
+ # <% tab.with_text { "Item 2" } %>
73
+ # <% tab.with_counter(count: 10) %>
74
74
  # <% end %>
75
- # <% component.with_tab(href: "#") do |t| %>
76
- # <% t.text { "Item 3" } %>
77
- # <% t.counter(count: 10) %>
75
+ # <% component.with_tab(href: "#") do |tab| %>
76
+ # <% tab.with_text { "Item 3" } %>
77
+ # <% tab.with_counter(count: 10) %>
78
78
  # <% end %>
79
79
  # <% end %>
80
80
  #
81
81
  # @example With extra content
82
- # <%= render(Primer::Alpha::TabNav.new(label: "With extra content")) do |c| %>
83
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
84
- # <% c.with_tab(href: "#") { "Tab 2" } %>
85
- # <% c.with_tab(href: "#") { "Tab 3" } %>
86
- # <% c.with_extra do %>
82
+ # <%= render(Primer::Alpha::TabNav.new(label: "With extra content")) do |component| %>
83
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" }%>
84
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
85
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
86
+ # <% component.with_extra do %>
87
87
  # <%= render(Primer::ButtonComponent.new(float: :right)) { "Button" } %>
88
88
  # <% end %>
89
89
  # <% end %>
90
90
  #
91
91
  # @example Adding extra content after the tabs
92
- # <%= render(Primer::Alpha::TabNav.new(label: "Adding extra content after the tabs", display: :flex, body_arguments: { flex: 1 })) do |c| %>
93
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
94
- # <% c.with_tab(href: "#") { "Tab 2" } %>
95
- # <% c.with_tab(href: "#") { "Tab 3" } %>
96
- # <% c.with_extra(align: :right) do %>
92
+ # <%= render(Primer::Alpha::TabNav.new(label: "Adding extra content after the tabs", display: :flex, body_arguments: { flex: 1 })) do |component| %>
93
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" }%>
94
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
95
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
96
+ # <% component.with_extra(align: :right) do %>
97
97
  # <div>
98
98
  # <%= render(Primer::ButtonComponent.new) { "Button" } %>
99
99
  # </div>
@@ -101,10 +101,10 @@ module Primer
101
101
  # <% end %>
102
102
  #
103
103
  # @example Customizing the body
104
- # <%= render(Primer::Alpha::TabNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |c| %>
105
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
106
- # <% c.with_tab(href: "#") { "Tab 2" } %>
107
- # <% c.with_tab(href: "#") { "Tab 3" } %>
104
+ # <%= render(Primer::Alpha::TabNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |component| %>
105
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" }%>
106
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
107
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
108
108
  # <% end %>
109
109
  #
110
110
  # @param tag [Symbol] <%= one_of(Primer::Alpha::TabNav::TAG_OPTIONS) %>
@@ -43,15 +43,15 @@ module Primer
43
43
 
44
44
  # @example Default
45
45
  # <%= render(Primer::Alpha::TabPanels.new(label: "With panels")) do |component| %>
46
- # <% component.with_tab(id: "tab-1", selected: true) do |t| %>
47
- # <% t.text { "Tab 1" } %>
48
- # <% t.panel do %>
46
+ # <% component.with_tab(id: "tab-1", selected: true) do |tab| %>
47
+ # <% tab.with_text { "Tab 1" } %>
48
+ # <% tab.with_panel do %>
49
49
  # Panel 1
50
50
  # <% end %>
51
51
  # <% end %>
52
- # <% component.with_tab(id: "tab-2") do |t| %>
53
- # <% t.text { "Tab 2" } %>
54
- # <% t.panel do %>
52
+ # <% component.with_tab(id: "tab-2") do |tab| %>
53
+ # <% tab.with_text { "Tab 2" } %>
54
+ # <% tab.with_panel do %>
55
55
  # Panel 2
56
56
  # <% end %>
57
57
  # <% end %>
@@ -7,7 +7,6 @@ module Primer
7
7
  # A text field suitable for use outside a form. For a text field input suitable for use
8
8
  # within an HTML form, see the `Primer::Forms` namespace.
9
9
  class TextField < Primer::Component
10
- warn_on_deprecated_slot_setter
11
10
  status :alpha
12
11
 
13
12
  # @!method initialize
@@ -6,8 +6,6 @@ module Primer
6
6
  # settings that should cause an immediate update. If configured with a "src" attribute, the component will
7
7
  # make a POST request containing data of the form "value: 0 | 1".
8
8
  class ToggleSwitch < Primer::Component
9
- warn_on_deprecated_slot_setter
10
-
11
9
  SIZE_DEFAULT = :medium
12
10
  SIZE_MAPPINGS = {
13
11
  SIZE_DEFAULT => nil,
@@ -23,22 +21,22 @@ module Primer
23
21
  STATUS_LABEL_POSITION_OPTIONS = STATUS_LABEL_POSITION_MAPPINGS.keys.freeze
24
22
 
25
23
  # @example Default
26
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo")) %>
24
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch")) %>
27
25
  #
28
26
  # @example Checked
29
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo", checked: true)) %>
27
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch", checked: true)) %>
30
28
  #
31
29
  # @example Disabled
32
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo", enabled: false)) %>
30
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch", enabled: false)) %>
33
31
  #
34
32
  # @example Checked and Disabled
35
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo", checked: true, enabled: false)) %>
33
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch", checked: true, enabled: false)) %>
36
34
  #
37
35
  # @example Small
38
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo", size: :small)) %>
36
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch", size: :small)) %>
39
37
  #
40
38
  # @example With status label positioned at the end
41
- # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/foo", status_label_position: :end)) %>
39
+ # <%= render(Primer::Alpha::ToggleSwitch.new(src: "/view-components/rails-app/toggle_switch", status_label_position: :end)) %>
42
40
  #
43
41
  # @param src [String] The URL to POST to when the toggle switch is toggled. If `nil`, the toggle switch will not make any requests.
44
42
  # @param csrf_token [String] A CSRF token that will be sent to the server as "authenticity_token" when the toggle switch is toggled. Unused if `src` is `nil`.
@@ -191,13 +191,9 @@ class ToolTipElement extends HTMLElement {
191
191
  __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
192
192
  if (!this.shadowRoot) {
193
193
  const shadow = this.attachShadow({ mode: 'open' });
194
- // eslint-disable-next-line github/no-inner-html
195
- shadow.innerHTML = `
196
- <style>
197
- ${this.styles()}
198
- </style>
199
- <slot></slot>
200
- `;
194
+ const style = shadow.appendChild(document.createElement('style'));
195
+ style.textContent = this.styles();
196
+ shadow.appendChild(document.createElement('slot'));
201
197
  }
202
198
  this.hiddenFromView = true;
203
199
  __classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
@@ -190,13 +190,9 @@ class ToolTipElement extends HTMLElement {
190
190
  this.#updateDirection()
191
191
  if (!this.shadowRoot) {
192
192
  const shadow = this.attachShadow({mode: 'open'})
193
- // eslint-disable-next-line github/no-inner-html
194
- shadow.innerHTML = `
195
- <style>
196
- ${this.styles()}
197
- </style>
198
- <slot></slot>
199
- `
193
+ const style = shadow.appendChild(document.createElement('style'))
194
+ style.textContent = this.styles()
195
+ shadow.appendChild(document.createElement('slot'))
200
196
  }
201
197
  this.hiddenFromView = true
202
198
  this.#allowUpdatePosition = true
@@ -23,8 +23,6 @@ module Primer
23
23
  # - When there is no visible text on the trigger element and the tooltip content is appropriate as a label for the element, set `type: :label`.
24
24
  # `label` type is usually only appropriate for an icon-only control.
25
25
  class Tooltip < Primer::Component
26
- warn_on_deprecated_slot_setter
27
-
28
26
  DIRECTION_DEFAULT = :s
29
27
  DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :n, :e, :w, :ne, :nw, :se, :sw].freeze
30
28
 
@@ -35,8 +33,8 @@ module Primer
35
33
  # In this example, the button has a visible label text, "Save". `type: :description` is set because the tooltip content is supplementary.
36
34
  # A screen reader user who encounters this button will hear the accessible name, "Save" followed by the accessible description, "This will immediately impact all organization members".
37
35
  # @code
38
- # <%= render(Primer::ButtonComponent.new(id: "save-button")) do |c| %>
39
- # <% c.with_tooltip(text: "This will immediately impact all organization members", type: :description, direction: :ne) %>
36
+ # <%= render(Primer::ButtonComponent.new(id: "save-button")) do |component| %>
37
+ # <% component.with_tooltip(text: "This will immediately impact all organization members", type: :description, direction: :ne) %>
40
38
  # Save
41
39
  # <% end %>
42
40
  # @example As a label for an `IconButton`
@@ -57,36 +55,36 @@ module Primer
57
55
  # @description
58
56
  # Set direction of tooltip with `direction`. The tooltip is responsive and will automatically adjust direction to avoid cutting off.
59
57
  # @code
60
- # <%= render(Primer::ButtonComponent.new(id: "North", m: 2)) do |c| %>
61
- # <% c.with_tooltip(text: "This is a North-facing tooltip, and is responsive.", type: :description, direction: :n) %>
58
+ # <%= render(Primer::ButtonComponent.new(id: "North", m: 2)) do |component| %>
59
+ # <% component.with_tooltip(text: "This is a North-facing tooltip, and is responsive.", type: :description, direction: :n) %>
62
60
  # North
63
61
  # <% end %>
64
- # <%= render(Primer::ButtonComponent.new(id: "South", m: 2)) do |c| %>
65
- # <% c.with_tooltip(text: "This is a South-facing tooltip, and is responsive.", type: :description, direction: :s) %>
62
+ # <%= render(Primer::ButtonComponent.new(id: "South", m: 2)) do |component| %>
63
+ # <% component.with_tooltip(text: "This is a South-facing tooltip, and is responsive.", type: :description, direction: :s) %>
66
64
  # South
67
65
  # <% end %>
68
- # <%= render(Primer::ButtonComponent.new(id: "East", m: 2)) do |c| %>
69
- # <% c.with_tooltip(text: "This is a East-facing tooltip, and is responsive.", type: :description, direction: :e) %>
66
+ # <%= render(Primer::ButtonComponent.new(id: "East", m: 2)) do |component| %>
67
+ # <% component.with_tooltip(text: "This is a East-facing tooltip, and is responsive.", type: :description, direction: :e) %>
70
68
  # East
71
69
  # <% end %>
72
- # <%= render(Primer::ButtonComponent.new(id: "West", m: 2)) do |c| %>
73
- # <% c.with_tooltip(text: "This is a West-facing tooltip, and is responsive.", type: :description, direction: :w) %>
70
+ # <%= render(Primer::ButtonComponent.new(id: "West", m: 2)) do |component| %>
71
+ # <% component.with_tooltip(text: "This is a West-facing tooltip, and is responsive.", type: :description, direction: :w) %>
74
72
  # West
75
73
  # <% end %>
76
- # <%= render(Primer::ButtonComponent.new(id: "Northwest", m: 2)) do |c| %>
77
- # <% c.with_tooltip(text: "This is a Northwest-facing tooltip, and is responsive.", type: :description, direction: :nw) %>
74
+ # <%= render(Primer::ButtonComponent.new(id: "Northwest", m: 2)) do |component| %>
75
+ # <% component.with_tooltip(text: "This is a Northwest-facing tooltip, and is responsive.", type: :description, direction: :nw) %>
78
76
  # Northwest
79
77
  # <% end %>
80
- # <%= render(Primer::ButtonComponent.new(id: "Southwest", m: 2)) do |c| %>
81
- # <% c.with_tooltip(text: "This is a Southwest-facing tooltip, and is responsive.", type: :description, direction: :sw) %>
78
+ # <%= render(Primer::ButtonComponent.new(id: "Southwest", m: 2)) do |component| %>
79
+ # <% component.with_tooltip(text: "This is a Southwest-facing tooltip, and is responsive.", type: :description, direction: :sw) %>
82
80
  # Southwest
83
81
  # <% end %>
84
- # <%= render(Primer::ButtonComponent.new(id: "Northeast", m: 2)) do |c| %>
85
- # <% c.with_tooltip(text: "This is a Northeast-facing tooltip, and is responsive.", type: :description, direction: :ne) %>
82
+ # <%= render(Primer::ButtonComponent.new(id: "Northeast", m: 2)) do |component| %>
83
+ # <% component.with_tooltip(text: "This is a Northeast-facing tooltip, and is responsive.", type: :description, direction: :ne) %>
86
84
  # Northeast
87
85
  # <% end %>
88
- # <%= render(Primer::ButtonComponent.new(id: "Southeast", m: 2)) do |c| %>
89
- # <% c.with_tooltip(text: "This is a Southeast-facing tooltip, and is responsive.", type: :description, direction: :se) %>
86
+ # <%= render(Primer::ButtonComponent.new(id: "Southeast", m: 2)) do |component| %>
87
+ # <% component.with_tooltip(text: "This is a Southeast-facing tooltip, and is responsive.", type: :description, direction: :se) %>
90
88
  # Southeast
91
89
  # <% end %>
92
90
  # @example Directly using `Tooltip`
@@ -1 +1 @@
1
- .UnderlineNav{-webkit-overflow-scrolling:auto;box-shadow:inset 0 -1px 0 var(--color-border-muted);display:flex;justify-content:space-between;min-height:var(--base-size-48,48px);overflow-x:auto;overflow-y:hidden}.UnderlineNav .Counter{background-color:var(--color-neutral-muted);color:var(--color-fg-default);margin-left:var(--primer-control-medium-gap,8px)}.UnderlineNav .Counter--primary{background-color:var(--color-neutral-emphasis);color:var(--color-fg-on-emphasis)}.UnderlineNav-body{align-items:center;display:flex;gap:var(--primer-control-medium-gap,8px);list-style:none}.UnderlineNav-item{align-items:center;background-color:initial;border:0;border-radius:var(--primer-borderRadius-medium,6px);color:var(--color-fg-default);cursor:pointer;display:flex;font-size:var(--primer-text-body-size-medium,14px);line-height:30px;padding:0 var(--primer-control-medium-paddingInline-condensed,8px);position:relative;text-align:center;white-space:nowrap}.UnderlineNav-item:focus,.UnderlineNav-item:focus-visible,.UnderlineNav-item:hover{border-bottom-color:var(--color-neutral-muted);color:var(--color-fg-default);outline-offset:-2px;text-decoration:none;transition:border-bottom-color .12s ease-out}.UnderlineNav-item [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden}.UnderlineNav-item:before{content:"";height:100%;left:50%;min-height:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}@media (pointer:fine){.UnderlineNav-item:hover{background:var(--color-action-list-item-default-hover-bg);color:var(--color-fg-default);text-decoration:none;transition:background .12s ease-out}}.UnderlineNav-item.selected,.UnderlineNav-item[aria-current]:not([aria-current=false]),.UnderlineNav-item[role=tab][aria-selected=true]{border-bottom-color:var(--color-primer-border-active);color:var(--color-fg-default);font-weight:var(--base-text-weight-semibold,600)}:is(.UnderlineNav-item.selected,.UnderlineNav-item[role=tab][aria-selected=true],.UnderlineNav-item[aria-current]:not([aria-current=false])):after{background:var(--color-primer-border-active);border-radius:var(--primer-borderRadius-medium,6px);bottom:calc(50% - 25px);content:"";height:2px;position:absolute;right:50%;transform:translate(50%,-50%);width:100%}.UnderlineNav--right{justify-content:flex-end}.UnderlineNav--right .UnderlineNav-actions{flex:1 1 auto}.UnderlineNav-actions{align-self:center}.UnderlineNav--full{display:block}.UnderlineNav--full .UnderlineNav-body{min-height:var(--base-size-48,48px)}.UnderlineNav-octicon{fill:var(--color-fg-muted);color:var(--color-fg-muted);display:inline!important;margin-right:var(--primer-control-medium-gap,8px)}.UnderlineNav-container{display:flex;justify-content:space-between}
1
+ .UnderlineNav{-webkit-overflow-scrolling:auto;box-shadow:inset 0 -1px 0 var(--color-border-muted);display:flex;justify-content:space-between;min-height:var(--base-size-48,48px);overflow-x:auto;overflow-y:hidden}.UnderlineNav .Counter{background-color:var(--color-neutral-muted);color:var(--color-fg-default);margin-left:var(--primer-control-medium-gap,8px)}.UnderlineNav .Counter--primary{background-color:var(--color-neutral-emphasis);color:var(--color-fg-on-emphasis)}.UnderlineNav-body{align-items:center;display:flex;gap:var(--primer-control-medium-gap,8px);list-style:none}.UnderlineNav-item{align-items:center;background-color:initial;border:0;border-radius:var(--primer-borderRadius-medium,6px);color:var(--color-fg-default);cursor:pointer;display:flex;font-size:var(--primer-text-body-size-medium,14px);line-height:30px;padding:0 var(--primer-control-medium-paddingInline-condensed,8px);position:relative;text-align:center;white-space:nowrap}.UnderlineNav-item:focus,.UnderlineNav-item:focus-visible,.UnderlineNav-item:hover{border-bottom-color:var(--color-neutral-muted);color:var(--color-fg-default);outline-offset:-2px;text-decoration:none;transition:border-bottom-color .12s ease-out}.UnderlineNav-item [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden}.UnderlineNav-item:before{content:"";height:100%;left:50%;min-height:48px;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:100%}@media (pointer:fine){.UnderlineNav-item:hover{background:var(--color-action-list-item-default-hover-bg);color:var(--color-fg-default);text-decoration:none;transition:background .12s ease-out}}.UnderlineNav-item.selected,.UnderlineNav-item[aria-current]:not([aria-current=false]),.UnderlineNav-item[role=tab][aria-selected=true]{border-bottom-color:var(--color-primer-border-active);color:var(--color-fg-default);font-weight:var(--base-text-weight-semibold,600)}.UnderlineNav-item.selected:after,.UnderlineNav-item[aria-current]:not([aria-current=false]):after,.UnderlineNav-item[role=tab][aria-selected=true]:after{background:var(--color-primer-border-active);border-radius:var(--primer-borderRadius-medium,6px);bottom:calc(50% - 25px);content:"";height:2px;position:absolute;right:50%;transform:translate(50%,-50%);width:100%}.UnderlineNav--right{justify-content:flex-end}.UnderlineNav--right .UnderlineNav-actions{flex:1 1 auto}.UnderlineNav-actions{align-self:center}.UnderlineNav--full{display:block}.UnderlineNav--full .UnderlineNav-body{min-height:var(--base-size-48,48px)}.UnderlineNav-octicon{fill:var(--color-fg-muted);color:var(--color-fg-muted);display:inline!important;margin-right:var(--primer-control-medium-gap,8px)}.UnderlineNav-container{display:flex;justify-content:space-between}
@@ -1 +1 @@
1
- {"name":"alpha/underline_nav","selectors":[".UnderlineNav",".UnderlineNav .Counter",".UnderlineNav .Counter--primary",".UnderlineNav-body",".UnderlineNav-item",".UnderlineNav-item:focus",".UnderlineNav-item:focus-visible",".UnderlineNav-item:hover",".UnderlineNav-item [data-content]:before",".UnderlineNav-item:before",".UnderlineNav-item.selected",".UnderlineNav-item[aria-current]:not([aria-current=false])",".UnderlineNav-item[role=tab][aria-selected=true]",":is(.UnderlineNav-item.selected",".UnderlineNav-item[aria-current]:not([aria-current=false])):after",".UnderlineNav--right",".UnderlineNav--right .UnderlineNav-actions",".UnderlineNav-actions",".UnderlineNav--full",".UnderlineNav--full .UnderlineNav-body",".UnderlineNav-octicon",".UnderlineNav-container"]}
1
+ {"name":"alpha/underline_nav","selectors":[".UnderlineNav",".UnderlineNav .Counter",".UnderlineNav .Counter--primary",".UnderlineNav-body",".UnderlineNav-item",".UnderlineNav-item:focus",".UnderlineNav-item:focus-visible",".UnderlineNav-item:hover",".UnderlineNav-item [data-content]:before",".UnderlineNav-item:before",".UnderlineNav-item.selected",".UnderlineNav-item[aria-current]:not([aria-current=false])",".UnderlineNav-item[role=tab][aria-selected=true]",".UnderlineNav-item.selected:after",".UnderlineNav-item[aria-current]:not([aria-current=false]):after",".UnderlineNav-item[role=tab][aria-selected=true]:after",".UnderlineNav--right",".UnderlineNav--right .UnderlineNav-actions",".UnderlineNav-actions",".UnderlineNav--full",".UnderlineNav--full .UnderlineNav-body",".UnderlineNav-octicon",".UnderlineNav-container"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["underline_nav.pcss","<no source>"],"names":[],"mappings":"AAEA,cAME,+BAAgC,CADhC,mDAAoD,CAJpD,YAAa,CAMb,6BAA8B,CAL9B,mCAAqC,CACrC,eAAgB,CAChB,iBAeF,CAVE,uBAGE,2CAA4C,CAD5C,6BAA8B,CAD9B,gDAGF,CAEA,gCAEE,8CAA+C,CAD/C,iCAEF,CAGF,mBAEE,kBAAmB,CADnB,YAAa,CAEb,wCAA0C,CAC1C,eACF,CAEA,mBAaE,kBAAmB,CAHnB,wBAA6B,CAC7B,QAAS,CACT,mDAAqD,CANrD,6BAA8B,CAG9B,cAAe,CAPf,YAAa,CAEb,kDAAoD,CACpD,gBAAiB,CAFjB,kEAAoE,CAFpE,iBAAkB,CAMlB,iBAAkB,CAClB,kBA6DF,CAtDE,mFAKE,8CAA+C,CAF/C,6BAA8B,CAG9B,mBAAoB,CAFpB,oBAAqB,CAGrB,4CACF,CAGA,yCAKE,0BAA2B,CAJ3B,aAAc,CAEd,gDAAkD,CADlD,QAAS,CAET,iBAEF,CAIE,0BClEJ,WAAA,YAAA,SAAA,gBAAA,kBAAA,QAAA,4CAAA,UDkE8B,CAI5B,sBACE,yBAGE,yDAA0D,CAF1D,6BAA8B,CAC9B,oBAAqB,CAErB,mCACF,CACF,CAEA,wIAKE,qDAAsD,CADtD,6BAA8B,CAD9B,gDAgBF,CAXE,mJAOE,4CAA6C,CAC7C,mDAAqD,CALrD,uBAAwB,CAGxB,UAAW,CADX,UAAW,CAJX,iBAAkB,CAClB,SAAU,CAOV,6BAA+B,CAL/B,UAMF,CAIJ,qBACE,wBAKF,CAHE,2CACE,aACF,CAGF,sBACE,iBACF,CAEA,oBACE,aAMF,CAHE,uCACE,mCACF,CAGF,sBAIE,0BAA2B,CAD3B,2BAA4B,CAF5B,wBAA0B,CAC1B,iDAGF,CAEA,wBACE,YAAa,CACb,6BACF","file":"underline_nav.css","sourcesContent":["/* UnderlineNav */\n\n.UnderlineNav {\n display: flex;\n min-height: var(--base-size-48, 48px);\n overflow-x: auto;\n overflow-y: hidden;\n box-shadow: inset 0 -1px 0 var(--color-border-muted);\n -webkit-overflow-scrolling: auto;\n justify-content: space-between;\n\n & .Counter {\n margin-left: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-default);\n background-color: var(--color-neutral-muted);\n }\n\n & .Counter--primary {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n }\n}\n\n.UnderlineNav-body {\n display: flex;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n list-style: none;\n}\n\n.UnderlineNav-item {\n position: relative;\n display: flex;\n padding: 0 var(--primer-control-medium-paddingInline-condensed, 8px);\n font-size: var(--primer-text-body-size-medium, 14px);\n line-height: 30px;\n color: var(--color-fg-default);\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--primer-borderRadius-medium, 6px);\n align-items: center;\n\n &:hover,\n &:focus,\n &:focus-visible {\n color: var(--color-fg-default);\n text-decoration: none;\n border-bottom-color: var(--color-neutral-muted);\n outline-offset: -2px;\n transition: border-bottom-color 0.12s ease-out;\n }\n\n /* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n & [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold, 600);\n visibility: hidden;\n content: attr(data-content);\n }\n\n /* increase touch target area */\n &::before {\n @mixin minTouchTarget 48px;\n }\n\n /* hover state was \"sticking\" on mobile after click */\n @media (pointer: fine) {\n &:hover {\n color: var(--color-fg-default);\n text-decoration: none;\n background: var(--color-action-list-item-default-hover-bg);\n transition: background 0.12s ease-out;\n }\n }\n\n &.selected,\n &[role='tab'][aria-selected='true'],\n &[aria-current]:not([aria-current='false']) {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-fg-default);\n border-bottom-color: var(--color-primer-border-active);\n\n /* current/selected underline */\n &::after {\n position: absolute;\n right: 50%;\n bottom: calc(50% - 25px); /* 48px total height / 2 (24px) + 1px */\n width: 100%;\n height: 2px;\n content: '';\n background: var(--color-primer-border-active);\n border-radius: var(--primer-borderRadius-medium, 6px);\n transform: translate(50%, -50%);\n }\n }\n}\n\n.UnderlineNav--right {\n justify-content: flex-end;\n\n & .UnderlineNav-actions {\n flex: 1 1 auto;\n }\n}\n\n.UnderlineNav-actions {\n align-self: center;\n}\n\n.UnderlineNav--full {\n display: block;\n\n /* required for underline to align with additional wrapper element */\n & .UnderlineNav-body {\n min-height: var(--base-size-48, 48px);\n }\n}\n\n.UnderlineNav-octicon {\n display: inline !important;\n margin-right: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-muted);\n fill: var(--color-fg-muted);\n}\n\n.UnderlineNav-container {\n display: flex;\n justify-content: space-between;\n}\n",null]}
1
+ {"version":3,"sources":["underline_nav.pcss","<no source>"],"names":[],"mappings":"AAEA,cAME,+BAAgC,CADhC,mDAAoD,CAJpD,YAAa,CAMb,6BAA8B,CAL9B,mCAAqC,CACrC,eAAgB,CAChB,iBAeF,CAVE,uBAGE,2CAA4C,CAD5C,6BAA8B,CAD9B,gDAGF,CAEA,gCAEE,8CAA+C,CAD/C,iCAEF,CAGF,mBAEE,kBAAmB,CADnB,YAAa,CAEb,wCAA0C,CAC1C,eACF,CAEA,mBAaE,kBAAmB,CAHnB,wBAA6B,CAC7B,QAAS,CACT,mDAAqD,CANrD,6BAA8B,CAG9B,cAAe,CAPf,YAAa,CAEb,kDAAoD,CACpD,gBAAiB,CAFjB,kEAAoE,CAFpE,iBAAkB,CAMlB,iBAAkB,CAClB,kBA6DF,CAtDE,mFAKE,8CAA+C,CAF/C,6BAA8B,CAG9B,mBAAoB,CAFpB,oBAAqB,CAGrB,4CACF,CAGA,yCAKE,0BAA2B,CAJ3B,aAAc,CAEd,gDAAkD,CADlD,QAAS,CAET,iBAEF,CAIE,0BClEJ,WAAA,YAAA,SAAA,gBAAA,kBAAA,QAAA,4CAAA,UDkE8B,CAI5B,sBACE,yBAGE,yDAA0D,CAF1D,6BAA8B,CAC9B,oBAAqB,CAErB,mCACF,CACF,CAEA,wIAKE,qDAAsD,CADtD,6BAA8B,CAD9B,gDAgBF,CAXE,0JAOE,4CAA6C,CAC7C,mDAAqD,CALrD,uBAAwB,CAGxB,UAAW,CADX,UAAW,CAJX,iBAAkB,CAClB,SAAU,CAOV,6BAA+B,CAL/B,UAMF,CAIJ,qBACE,wBAKF,CAHE,2CACE,aACF,CAGF,sBACE,iBACF,CAEA,oBACE,aAMF,CAHE,uCACE,mCACF,CAGF,sBAIE,0BAA2B,CAD3B,2BAA4B,CAF5B,wBAA0B,CAC1B,iDAGF,CAEA,wBACE,YAAa,CACb,6BACF","file":"underline_nav.css","sourcesContent":["/* UnderlineNav */\n\n.UnderlineNav {\n display: flex;\n min-height: var(--base-size-48, 48px);\n overflow-x: auto;\n overflow-y: hidden;\n box-shadow: inset 0 -1px 0 var(--color-border-muted);\n -webkit-overflow-scrolling: auto;\n justify-content: space-between;\n\n & .Counter {\n margin-left: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-default);\n background-color: var(--color-neutral-muted);\n }\n\n & .Counter--primary {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n }\n}\n\n.UnderlineNav-body {\n display: flex;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n list-style: none;\n}\n\n.UnderlineNav-item {\n position: relative;\n display: flex;\n padding: 0 var(--primer-control-medium-paddingInline-condensed, 8px);\n font-size: var(--primer-text-body-size-medium, 14px);\n line-height: 30px;\n color: var(--color-fg-default);\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--primer-borderRadius-medium, 6px);\n align-items: center;\n\n &:hover,\n &:focus,\n &:focus-visible {\n color: var(--color-fg-default);\n text-decoration: none;\n border-bottom-color: var(--color-neutral-muted);\n outline-offset: -2px;\n transition: border-bottom-color 0.12s ease-out;\n }\n\n /* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n & [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold, 600);\n visibility: hidden;\n content: attr(data-content);\n }\n\n /* increase touch target area */\n &::before {\n @mixin minTouchTarget 48px;\n }\n\n /* hover state was \"sticking\" on mobile after click */\n @media (pointer: fine) {\n &:hover {\n color: var(--color-fg-default);\n text-decoration: none;\n background: var(--color-action-list-item-default-hover-bg);\n transition: background 0.12s ease-out;\n }\n }\n\n &.selected,\n &[role='tab'][aria-selected='true'],\n &[aria-current]:not([aria-current='false']) {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-fg-default);\n border-bottom-color: var(--color-primer-border-active);\n\n /* current/selected underline */\n &::after {\n position: absolute;\n right: 50%;\n bottom: calc(50% - 25px); /* 48px total height / 2 (24px) + 1px */\n width: 100%;\n height: 2px;\n content: '';\n background: var(--color-primer-border-active);\n border-radius: var(--primer-borderRadius-medium, 6px);\n transform: translate(50%, -50%);\n }\n }\n}\n\n.UnderlineNav--right {\n justify-content: flex-end;\n\n & .UnderlineNav-actions {\n flex: 1 1 auto;\n }\n}\n\n.UnderlineNav-actions {\n align-self: center;\n}\n\n.UnderlineNav--full {\n display: block;\n\n /* required for underline to align with additional wrapper element */\n & .UnderlineNav-body {\n min-height: var(--base-size-48, 48px);\n }\n}\n\n.UnderlineNav-octicon {\n display: inline !important;\n margin-right: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-muted);\n fill: var(--color-fg-muted);\n}\n\n.UnderlineNav-container {\n display: flex;\n justify-content: space-between;\n}\n",null]}
@@ -71,18 +71,18 @@ module Primer
71
71
  #
72
72
  # @example With icons and counters
73
73
  # <%= render(Primer::Alpha::UnderlineNav.new(label: "With icons and counters")) do |component| %>
74
- # <% component.with_tab(href: "#", selected: true) do |t| %>
75
- # <% t.icon(icon: :star) %>
76
- # <% t.text { "Item 1" } %>
74
+ # <% component.with_tab(href: "#", selected: true) do |tab| %>
75
+ # <% tab.with_icon(icon: :star) %>
76
+ # <% tab.with_text { "Item 1" } %>
77
77
  # <% end %>
78
- # <% component.with_tab(href: "#") do |t| %>
79
- # <% t.icon(icon: :star) %>
80
- # <% t.text { "Item 2" } %>
81
- # <% t.counter(count: 10) %>
78
+ # <% component.with_tab(href: "#") do |tab| %>
79
+ # <% tab.with_icon(icon: :star) %>
80
+ # <% tab.with_text { "Item 2" } %>
81
+ # <% tab.with_counter(count: 10) %>
82
82
  # <% end %>
83
- # <% component.with_tab(href: "#") do |t| %>
84
- # <% t.text { "Item 3" } %>
85
- # <% t.counter(count: 10) %>
83
+ # <% component.with_tab(href: "#") do |tab| %>
84
+ # <% tab.with_text { "Item 3" } %>
85
+ # <% tab.with_counter(count: 10) %>
86
86
  # <% end %>
87
87
  # <% component.with_actions do %>
88
88
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
@@ -91,11 +91,11 @@ module Primer
91
91
  #
92
92
  # @example Align right
93
93
  # <%= render(Primer::Alpha::UnderlineNav.new(label: "Align right", align: :right)) do |component| %>
94
- # <% component.with_tab(href: "#", selected: true) do |t| %>
95
- # <% t.text { "Item 1" } %>
94
+ # <% component.with_tab(href: "#", selected: true) do |tab| %>
95
+ # <% tab.with_text { "Item 1" } %>
96
96
  # <% end %>
97
- # <% component.with_tab(href: "#") do |t| %>
98
- # <% t.text { "Item 2" } %>
97
+ # <% component.with_tab(href: "#") do |tab| %>
98
+ # <% tab.with_text { "Item 2" } %>
99
99
  # <% end %>
100
100
  # <% component.with_actions do %>
101
101
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
@@ -103,10 +103,10 @@ module Primer
103
103
  # <% end %>
104
104
  #
105
105
  # @example Customizing the body
106
- # <%= render(Primer::Alpha::UnderlineNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |c| %>
107
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
108
- # <% c.with_tab(href: "#") { "Tab 2" } %>
109
- # <% c.with_tab(href: "#") { "Tab 3" } %>
106
+ # <%= render(Primer::Alpha::UnderlineNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |component| %>
107
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" }%>
108
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
109
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
110
110
  # <% end %>
111
111
  #
112
112
  # @param tag [Symbol] <%= one_of(Primer::Alpha::UnderlineNav::TAG_OPTIONS) %>
@@ -38,15 +38,15 @@ module Primer
38
38
 
39
39
  # @example Default
40
40
  # <%= render(Primer::Alpha::UnderlinePanels.new(label: "With panels")) do |component| %>
41
- # <% component.with_tab(id: "tab-1", selected: true) do |t| %>
42
- # <% t.text { "Tab 1" } %>
43
- # <% t.panel do %>
41
+ # <% component.with_tab(id: "tab-1", selected: true) do |tab| %>
42
+ # <% tab.with_text { "Tab 1" } %>
43
+ # <% tab.with_panel do %>
44
44
  # Panel 1
45
45
  # <% end %>
46
46
  # <% end %>
47
- # <% component.with_tab(id: "tab-2") do |t| %>
48
- # <% t.text { "Tab 2" } %>
49
- # <% t.panel do %>
47
+ # <% component.with_tab(id: "tab-2") do |tab| %>
48
+ # <% tab.with_text { "Tab 2" } %>
49
+ # <% tab.with_panel do %>
50
50
  # Panel 2
51
51
  # <% end %>
52
52
  # <% end %>
@@ -35,10 +35,10 @@ module Primer
35
35
  renders_one :description
36
36
 
37
37
  # @example Default
38
- # <%= render(Primer::Beta::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
38
+ # <%= render(Primer::Beta::AutoComplete::Item.new(selected: true, value: "value")) do %>
39
39
  # Selected
40
40
  # <% end %>
41
- # <%= render(Primer::Beta::AutoComplete::Item.new(value: "value")) do |c| %>
41
+ # <%= render(Primer::Beta::AutoComplete::Item.new(value: "value")) do %>
42
42
  # Not selected
43
43
  # <% end %>
44
44
  #
@@ -94,56 +94,56 @@ module Primer
94
94
  # @description
95
95
  # Display any Octicon as a leading visual within the field
96
96
  # @code
97
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", src: "/auto_complete", input_id:"input-id-1", list_id: "list-id-1")) do |c| %>
98
- # <% c.leading_visual_icon(icon: :search) %>
97
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", src: "/view-components/rails-app/auto_complete", input_id:"input-id-1", list_id: "list-id-1")) do |component| %>
98
+ # <% component.with_leading_visual_icon(icon: :search) %>
99
99
  # <% end %>
100
100
  #
101
101
  # @example Trailing action
102
102
  # @description
103
103
  # Show a clear button
104
104
  # @code
105
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-2", list_id: "list-id-2", src: "/auto_complete", show_clear_button: true )) %>
105
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-2", list_id: "list-id-2", src: "/view-components/rails-app/auto_complete", show_clear_button: true )) %>
106
106
  #
107
107
  # @example Visually hidden label
108
108
  # @description
109
109
  # A non-visible label may be rendered with `visually_hide_label: true`, but it is highly discouraged. See <%= link_to_accessibility %>.
110
110
  # @code
111
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-1", list_id: "fruits-popup--custom-result-1", src: "/auto_complete", visually_hide_label: true)) do |c| %>
112
- # <% c.leading_visual_icon(icon: :search) %>
111
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-1", list_id: "fruits-popup--custom-result-1", src: "/view-components/rails-app/auto_complete", visually_hide_label: true)) do |component| %>
112
+ # <% component.with_leading_visual_icon(icon: :search) %>
113
113
  # <% end %>
114
114
  #
115
115
  # @example Full width field
116
116
  # @description
117
117
  # To allow field to span width of its container, set `full_width` to `true`.
118
118
  # @code
119
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/auto_complete", full_width: true)) do |c| %>
120
- # <% c.leading_visual_icon(icon: :search) %>
119
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", full_width: true)) do |component| %>
120
+ # <% component.with_leading_visual_icon(icon: :search) %>
121
121
  # <% end %>
122
122
  #
123
123
  # @example Inset variant
124
124
  # @description
125
125
  # Use the `inset` variant to change the input background color to be subtle.
126
126
  # @code
127
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/auto_complete", inset: true)) do |c| %>
128
- # <% c.leading_visual_icon(icon: :search) %>
127
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", inset: true)) do |component| %>
128
+ # <% component.with_leading_visual_icon(icon: :search) %>
129
129
  # <% end %>
130
130
  #
131
131
  # @example Monospace variant
132
132
  # @description
133
133
  # Use the `monospace` variant to change the input font family.
134
134
  # @code
135
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/auto_complete", monospace: true)) do |c| %>
136
- # <% c.leading_visual_icon(icon: :search) %>
135
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", monospace: true)) do |component| %>
136
+ # <% component.with_leading_visual_icon(icon: :search) %>
137
137
  # <% end %>
138
138
  #
139
139
  # @example With custom classes for the input
140
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
141
- # <% c.with_input(classes: "custom-class") %>
140
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |component| %>
141
+ # <% component.with_input(classes: "custom-class") %>
142
142
  # <% end %>
143
143
  #
144
144
  # @example With custom classes for the results
145
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
146
- # <% c.with_results(classes: "custom-class") %>
145
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |component| %>
146
+ # <% component.with_results(classes: "custom-class") %>
147
147
  # <% end %>
148
148
  #
149
149
  # @param label_text [String] The label of the input.
@@ -192,8 +192,8 @@ module Primer
192
192
 
193
193
  # add `input` and `results` without needing to explicitly call them in the view
194
194
  def before_render
195
- results(classes: "") unless results
196
- input(classes: "") unless input
195
+ with_results(classes: "") unless results?
196
+ with_input(classes: "") unless input?
197
197
  end
198
198
  end
199
199
  end
@@ -17,7 +17,6 @@ module Primer
17
17
  # rather than `@kittenuser`.
18
18
  # [Learn more about best image practices (WAI Images)](https://www.w3.org/WAI/tutorials/images/)
19
19
  class Avatar < Primer::Component
20
- warn_on_deprecated_slot_setter
21
20
  status :beta
22
21
 
23
22
  DEFAULT_SIZE = 20
@@ -20,24 +20,24 @@ module Primer
20
20
  renders_many :avatars, "Primer::Beta::Avatar"
21
21
 
22
22
  # @example Default
23
- # <%= render(Primer::Beta::AvatarStack.new) do |c| %>
24
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
25
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
26
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
23
+ # <%= render(Primer::Beta::AvatarStack.new) do |component| %>
24
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
25
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
26
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
27
27
  # <% end %>
28
28
  #
29
29
  # @example Align right
30
- # <%= render(Primer::Beta::AvatarStack.new(align: :right)) do |c| %>
31
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
32
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
33
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
30
+ # <%= render(Primer::Beta::AvatarStack.new(align: :right)) do |component| %>
31
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
32
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
33
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
34
34
  # <% end %>
35
35
  #
36
36
  # @example With tooltip
37
- # <%= render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |c| %>
38
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
39
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
40
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
37
+ # <%= render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |component| %>
38
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
39
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
40
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
41
41
  # <% end %>
42
42
  #
43
43
  # @param tag [Symbol] <%= one_of(Primer::Beta::AvatarStack::TAG_OPTIONS) %>
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `BaseButton` to render an unstyled `<button>` tag that can be customized.
6
6
  class BaseButton < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  DEFAULT_TAG = :button