primer_view_components 0.13.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -0
  3. data/app/assets/javascripts/app/components/primer/alpha/action_menu/action_menu_element.d.ts +20 -0
  4. data/app/assets/javascripts/app/components/primer/beta/nav_list.d.ts +0 -11
  5. data/app/assets/javascripts/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
  6. data/app/assets/javascripts/app/components/primer/primer.d.ts +1 -0
  7. data/app/assets/javascripts/primer_view_components.js +1 -1
  8. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  9. data/app/assets/styles/primer_view_components.css +1 -1
  10. data/app/assets/styles/primer_view_components.css.map +1 -1
  11. data/app/components/primer/alpha/action_bar.css +1 -1
  12. data/app/components/primer/alpha/action_bar.css.json +1 -4
  13. data/app/components/primer/alpha/action_bar.css.map +1 -1
  14. data/app/components/primer/alpha/action_bar.pcss +1 -17
  15. data/app/components/primer/alpha/action_bar_element.js +21 -9
  16. data/app/components/primer/alpha/action_list/item.rb +13 -3
  17. data/app/components/primer/alpha/action_list.css +1 -1
  18. data/app/components/primer/alpha/action_list.css.json +1 -0
  19. data/app/components/primer/alpha/action_list.css.map +1 -1
  20. data/app/components/primer/alpha/action_list.pcss +3 -1
  21. data/app/components/primer/alpha/action_list.rb +5 -5
  22. data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +20 -0
  23. data/app/components/primer/alpha/action_menu/action_menu_element.js +126 -28
  24. data/app/components/primer/alpha/action_menu/action_menu_element.ts +110 -12
  25. data/app/components/primer/alpha/action_menu/group.rb +23 -0
  26. data/app/components/primer/alpha/action_menu/heading.rb +17 -0
  27. data/app/components/primer/alpha/action_menu/list.html.erb +1 -0
  28. data/app/components/primer/alpha/action_menu/list.rb +62 -60
  29. data/app/components/primer/alpha/action_menu/list_wrapper.rb +40 -0
  30. data/app/components/primer/alpha/action_menu.html.erb +20 -18
  31. data/app/components/primer/alpha/action_menu.rb +38 -1
  32. data/app/components/primer/alpha/auto_complete.css +1 -1
  33. data/app/components/primer/alpha/auto_complete.css.map +1 -1
  34. data/app/components/primer/alpha/button_marketing.css +1 -1
  35. data/app/components/primer/alpha/button_marketing.css.map +1 -1
  36. data/app/components/primer/alpha/dialog/header.rb +1 -1
  37. data/app/components/primer/alpha/dropdown.css +1 -1
  38. data/app/components/primer/alpha/dropdown.css.map +1 -1
  39. data/app/components/primer/alpha/layout.css +1 -1
  40. data/app/components/primer/alpha/layout.css.map +1 -1
  41. data/app/components/primer/alpha/menu.css +1 -1
  42. data/app/components/primer/alpha/menu.css.map +1 -1
  43. data/app/components/primer/alpha/nav_list/divider.rb +1 -0
  44. data/app/components/primer/alpha/nav_list/group.rb +1 -0
  45. data/app/components/primer/alpha/nav_list/heading.rb +1 -0
  46. data/app/components/primer/alpha/nav_list/item.rb +1 -0
  47. data/app/components/primer/alpha/nav_list.rb +1 -0
  48. data/app/components/primer/alpha/octicon_symbols.html.erb +1 -1
  49. data/app/components/primer/alpha/overlay.css +1 -1
  50. data/app/components/primer/alpha/overlay.css.json +2 -2
  51. data/app/components/primer/alpha/overlay.css.map +1 -1
  52. data/app/components/primer/alpha/overlay.pcss +6 -2
  53. data/app/components/primer/alpha/segmented_control.css +1 -1
  54. data/app/components/primer/alpha/segmented_control.css.json +0 -1
  55. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  56. data/app/components/primer/alpha/segmented_control.js +2 -1
  57. data/app/components/primer/alpha/segmented_control.pcss +0 -4
  58. data/app/components/primer/alpha/tab_nav.css +1 -1
  59. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  60. data/app/components/primer/alpha/text_field.css +1 -1
  61. data/app/components/primer/alpha/text_field.css.json +11 -5
  62. data/app/components/primer/alpha/text_field.css.map +1 -1
  63. data/app/components/primer/alpha/text_field.pcss +10 -1
  64. data/app/components/primer/alpha/toggle_switch.css +1 -1
  65. data/app/components/primer/alpha/toggle_switch.css.map +1 -1
  66. data/app/components/primer/alpha/tool_tip.js +8 -4
  67. data/app/components/primer/alpha/tool_tip.ts +9 -4
  68. data/app/components/primer/alpha/underline_nav.css +1 -1
  69. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  70. data/app/components/primer/alpha/x_banner.js +2 -1
  71. data/app/components/primer/anchored_position.js +2 -1
  72. data/app/components/primer/beta/auto_complete/auto_complete.html.erb +1 -7
  73. data/app/components/primer/beta/auto_complete/item.rb +2 -2
  74. data/app/components/primer/beta/auto_complete.rb +6 -1
  75. data/app/components/primer/beta/avatar.rb +1 -1
  76. data/app/components/primer/beta/base_button.rb +3 -4
  77. data/app/components/primer/beta/blankslate.css +1 -1
  78. data/app/components/primer/beta/blankslate.css.json +1 -0
  79. data/app/components/primer/beta/blankslate.css.map +1 -1
  80. data/app/components/primer/beta/blankslate.html.erb +16 -14
  81. data/app/components/primer/beta/blankslate.pcss +52 -2
  82. data/app/components/primer/beta/border_box.css +1 -1
  83. data/app/components/primer/beta/border_box.css.map +1 -1
  84. data/app/components/primer/beta/button.css +1 -1
  85. data/app/components/primer/beta/button.css.json +9 -9
  86. data/app/components/primer/beta/button.css.map +1 -1
  87. data/app/components/primer/beta/button.html.erb +18 -20
  88. data/app/components/primer/beta/button.pcss +15 -16
  89. data/app/components/primer/beta/button.rb +3 -0
  90. data/app/components/primer/beta/button_group.css +1 -1
  91. data/app/components/primer/beta/button_group.css.json +2 -4
  92. data/app/components/primer/beta/button_group.css.map +1 -1
  93. data/app/components/primer/beta/button_group.html.erb +3 -1
  94. data/app/components/primer/beta/button_group.pcss +2 -4
  95. data/app/components/primer/beta/button_group.rb +41 -12
  96. data/app/components/primer/beta/clipboard_copy.rb +4 -0
  97. data/app/components/primer/beta/clipboard_copy_button.rb +25 -0
  98. data/app/components/primer/beta/counter.rb +1 -1
  99. data/app/components/primer/beta/flash.html.erb +1 -1
  100. data/app/components/primer/beta/icon_button.html.erb +4 -6
  101. data/app/components/primer/beta/icon_button.rb +1 -3
  102. data/app/components/primer/beta/label.css +1 -1
  103. data/app/components/primer/beta/label.css.map +1 -1
  104. data/app/components/primer/beta/link.css +1 -1
  105. data/app/components/primer/beta/link.css.map +1 -1
  106. data/app/components/primer/beta/nav_list/group.html.erb +7 -5
  107. data/app/components/primer/beta/nav_list/group.rb +2 -2
  108. data/app/components/primer/beta/nav_list.d.ts +0 -11
  109. data/app/components/primer/beta/nav_list.js +14 -90
  110. data/app/components/primer/beta/nav_list.ts +1 -85
  111. data/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
  112. data/app/components/primer/beta/nav_list_group_element.js +108 -0
  113. data/app/components/primer/beta/nav_list_group_element.ts +97 -0
  114. data/app/components/primer/beta/relative_time.rb +4 -4
  115. data/app/components/primer/beta/subhead.css +1 -1
  116. data/app/components/primer/beta/subhead.css.json +2 -0
  117. data/app/components/primer/beta/subhead.css.map +1 -1
  118. data/app/components/primer/beta/subhead.pcss +8 -1
  119. data/app/components/primer/beta/subhead.rb +9 -1
  120. data/app/components/primer/component.rb +3 -0
  121. data/app/components/primer/focus_group.js +2 -1
  122. data/app/components/primer/primer.d.ts +1 -0
  123. data/app/components/primer/primer.js +1 -0
  124. data/app/components/primer/primer.ts +1 -0
  125. data/app/forms/action_menu_form.rb +20 -0
  126. data/app/forms/immediate_validation_form.rb +2 -2
  127. data/app/lib/primer/experimental_render_helpers.rb +32 -0
  128. data/app/lib/primer/experimental_slot_helpers.rb +30 -0
  129. data/app/lib/primer/fetch_or_fallback_helper.rb +0 -1
  130. data/app/lib/primer/octicon/cache.rb +1 -1
  131. data/lib/primer/classify.rb +0 -2
  132. data/lib/primer/forms/action_menu.html.erb +6 -0
  133. data/lib/primer/forms/action_menu.rb +25 -0
  134. data/lib/primer/forms/acts_as_component.rb +0 -3
  135. data/lib/primer/forms/base.rb +0 -1
  136. data/lib/primer/forms/base_component.rb +0 -2
  137. data/lib/primer/forms/dsl/action_menu_input.rb +36 -0
  138. data/lib/primer/forms/dsl/input.rb +8 -1
  139. data/lib/primer/forms/dsl/input_methods.rb +9 -0
  140. data/lib/primer/forms/dsl/text_field_input.rb +8 -0
  141. data/lib/primer/forms/primer_base_component_wrapper.rb +0 -2
  142. data/lib/primer/forms/primer_text_field.js +40 -5
  143. data/lib/primer/forms/primer_text_field.ts +39 -7
  144. data/lib/primer/forms/validation_message.html.erb +2 -1
  145. data/lib/primer/static/generate_info_arch.rb +1 -2
  146. data/lib/primer/static/generate_previews.rb +0 -2
  147. data/lib/primer/view_components/engine.rb +5 -1
  148. data/lib/primer/view_components/linters/base_linter.rb +3 -2
  149. data/lib/primer/view_components/linters/deprecated_components_counter.rb +1 -1
  150. data/lib/primer/view_components/linters/disallow_action_list.rb +1 -0
  151. data/lib/primer/view_components/linters/severity_schema.rb +1 -0
  152. data/lib/primer/view_components/version.rb +2 -3
  153. data/lib/primer/yard/lookbook_pages_backend.rb +2 -4
  154. data/lib/rubocop/cop/primer/base_cop.rb +1 -1
  155. data/lib/rubocop/cop/primer/deprecated_arguments.rb +0 -2
  156. data/lib/rubocop/cop/primer/deprecated_components.rb +1 -1
  157. data/lib/rubocop/cop/primer/deprecated_label_schemes.rb +1 -1
  158. data/lib/rubocop/cop/primer/deprecated_label_variants.rb +1 -1
  159. data/previews/primer/alpha/action_menu_preview.rb +73 -7
  160. data/previews/primer/alpha/dialog_preview/with_auto_complete.html.erb +8 -0
  161. data/previews/primer/alpha/dialog_preview.rb +17 -0
  162. data/previews/primer/alpha/octicon_symbols_preview/default.html.erb +6 -0
  163. data/previews/primer/alpha/octicon_symbols_preview/playground.html.erb +13 -0
  164. data/previews/primer/alpha/octicon_symbols_preview.rb +21 -0
  165. data/previews/primer/alpha/text_field_preview.rb +5 -0
  166. data/previews/primer/beta/avatar_preview.rb +6 -0
  167. data/previews/primer/beta/blankslate_preview/inside_flex_container.html.erb +6 -0
  168. data/previews/primer/beta/blankslate_preview.rb +3 -0
  169. data/previews/primer/beta/button_group_preview.rb +11 -0
  170. data/previews/primer/beta/clipboard_copy_button_preview.rb +29 -0
  171. data/previews/primer/beta/nav_list_preview.rb +10 -1
  172. data/previews/primer/beta/subhead_preview.rb +32 -4
  173. data/previews/primer/forms_preview/action_menu_form.html.erb +3 -0
  174. data/previews/primer/forms_preview.rb +4 -0
  175. data/static/arguments.json +167 -14
  176. data/static/audited_at.json +6 -1
  177. data/static/classes.json +12 -3
  178. data/static/constants.json +25 -1
  179. data/static/info_arch.json +585 -78
  180. data/static/previews.json +198 -0
  181. data/static/statuses.json +5 -0
  182. metadata +24 -2
@@ -52,6 +52,67 @@ module Primer
52
52
  end
53
53
  end
54
54
 
55
+ # @label With groups
56
+ #
57
+ # @snapshot interactive
58
+ def with_groups
59
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
60
+ menu.with_show_button do |button|
61
+ button.with_trailing_action_icon(icon: :"triangle-down")
62
+ "Favorite character"
63
+ end
64
+
65
+ menu.with_group do |group|
66
+ group.with_heading(title: "Battlestar Galactica")
67
+ group.with_item(label: "William Adama")
68
+ group.with_item(label: 'Kara "Starbuck" Thrace')
69
+ group.with_item(label: 'Sharon "Boomer" Valerii')
70
+ group.with_item(label: "Gaius Baltar")
71
+ end
72
+
73
+ menu.with_group do |group|
74
+ group.with_heading(title: "Star Trek")
75
+ group.with_item(label: "Capt. Jean-luc Picard")
76
+ group.with_item(label: "Capt. Kathryn M. Janeway")
77
+ group.with_item(label: "Capt. Benjamin L. Sisko")
78
+ group.with_item(label: "Capt. James T. Kirk")
79
+ end
80
+
81
+ menu.with_group do |group|
82
+ group.with_heading(title: "Star Wars")
83
+ group.with_item(label: "Leia Organa")
84
+ group.with_item(label: "Luke Skywalker")
85
+ group.with_item(label: "Han Solo")
86
+ group.with_item(label: "Chewbacca")
87
+ end
88
+ end
89
+ end
90
+
91
+ # @label With items and groups
92
+ #
93
+ # @snapshot interactive
94
+ def with_items_and_groups
95
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
96
+ menu.with_show_button do |button|
97
+ button.with_trailing_action_icon(icon: :"triangle-down")
98
+ "Meal preference"
99
+ end
100
+
101
+ menu.with_item(label: "Meat option")
102
+ menu.with_divider
103
+
104
+ menu.with_group do |group|
105
+ group.with_heading(title: "Vegetarian options")
106
+ group.with_item(label: "Grilled portbello mushroom")
107
+ group.with_item(label: "Polenta")
108
+ group.with_item(label: "Seitan")
109
+ end
110
+
111
+ menu.with_divider
112
+ menu.with_item(label: "Fish option")
113
+ end
114
+ end
115
+
55
116
  # @label Wide
56
117
  #
57
118
  # @snapshot interactive
@@ -87,10 +148,12 @@ module Primer
87
148
  def single_select
88
149
  render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu|
89
150
  menu.with_show_button { "Menu" }
90
- menu.with_item(label: "Fast forward")
91
- menu.with_item(label: "Recursive")
92
- menu.with_item(label: "Ours")
93
- menu.with_item(label: "Resolve")
151
+ menu.with_item(label: "Fast forward", item_id: :fast_forward)
152
+ menu.with_item(label: "Recursive", item_id: :recursive)
153
+ menu.with_item(label: "Ours", item_id: :ours)
154
+ menu.with_item(label: "Resolve", item_id: :resolve)
155
+ menu.with_item(label: "Disabled", disabled: true, item_id: :disabled)
156
+ menu.with_item(label: "Hidden", hidden: true, disabled: true, item_id: :hidden)
94
157
  end
95
158
  end
96
159
 
@@ -105,7 +168,8 @@ module Primer
105
168
  username: "langermank",
106
169
  full_name: "Katie Langerman",
107
170
  full_name_scheme: :inline,
108
- avatar_arguments: { shape: :square }
171
+ avatar_arguments: { shape: :square },
172
+ item_id: :katie
109
173
  )
110
174
 
111
175
  menu.with_avatar_item(
@@ -113,7 +177,8 @@ module Primer
113
177
  username: "jonrohan",
114
178
  full_name: "Jon Rohan",
115
179
  full_name_scheme: :inline,
116
- avatar_arguments: { shape: :square }
180
+ avatar_arguments: { shape: :square },
181
+ item_id: :jon
117
182
  )
118
183
 
119
184
  menu.with_avatar_item(
@@ -121,7 +186,8 @@ module Primer
121
186
  username: "broccolinisoup",
122
187
  full_name: "Armağan Ersöz",
123
188
  full_name_scheme: :inline,
124
- avatar_arguments: { shape: :square }
189
+ avatar_arguments: { shape: :square },
190
+ item_id: :armagan
125
191
  )
126
192
  end
127
193
  end
@@ -0,0 +1,8 @@
1
+ <%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
2
+ <% d.with_show_button { button_text } %>
3
+ <% d.with_body do %>
4
+ <%= render(Primer::Beta::AutoComplete.new(src: url, label_text: "Search", list_id: "list", input_id: "input")) do |a| %>
5
+ <% a.with_leading_visual_icon(icon: :search) %>
6
+ <% end %>
7
+ <% end %>
8
+ <% end %>
@@ -152,6 +152,23 @@ module Primer
152
152
  })
153
153
  end
154
154
 
155
+ # @label Dialog with AutoComplete text input
156
+ #
157
+ # @param title [String] text
158
+ # @param subtitle [String] text
159
+ # @param button_text [String] text
160
+ # @param show_divider [Boolean] toggle
161
+ # @snapshot interactive
162
+ def with_auto_complete(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true)
163
+ render_with_template(locals: {
164
+ title: title,
165
+ subtitle: subtitle,
166
+ button_text: button_text,
167
+ show_divider: show_divider,
168
+ url: UrlHelpers.autocomplete_index_path
169
+ })
170
+ end
171
+
155
172
  # @label Page with scrollbar and dialog
156
173
  #
157
174
  # @param title [String] text
@@ -0,0 +1,6 @@
1
+ <%= render(Primer::Alpha::OcticonSymbols.new(icons: [{ symbol: :container, size: :medium }])) %>
2
+
3
+ <svg xmlns="http://www.w3.org/2000/svg" height="40" width="40" aria-label="Circled container icon" tabindex="0">
4
+ <circle cx="20" cy="20" r="18" stroke="green" stroke-width="3px" fill="white" />
5
+ <use href="#octicon_container_24" x="8" y="8" />
6
+ </svg>
@@ -0,0 +1,13 @@
1
+ <p style="max-width: 500px">
2
+ Below is an SVG image containing the chosen octicon surrounded by a green circle. The octicon has been emitted
3
+ onto the page as an SVG &lt;symbol&gt; element and included into the SVG you see below with the &lt;use&gt; element.
4
+ See the <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/symbol" target="_blank">MDN docs</a> for
5
+ more information.
6
+ </p>
7
+
8
+ <%= render(Primer::Alpha::OcticonSymbols.new(icons: [{ symbol: octicon, size: :medium }])) %>
9
+
10
+ <svg xmlns="http://www.w3.org/2000/svg" height="40" width="40" aria-label="Circled <%= octicon %> icon" tabindex="0">
11
+ <circle cx="20" cy="20" r="18" stroke="green" stroke-width="3px" fill="white" />
12
+ <use href="#octicon_<%= octicon %>_24" x="8" y="8" />
13
+ </svg>
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # @label OcticonSymbols
6
+ class OcticonSymbolsPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ #
9
+ # @param octicon [Symbol] medium_octicon
10
+ def playground(octicon: :container)
11
+ render_with_template(locals: { octicon: octicon })
12
+ end
13
+
14
+ # @label Default
15
+ #
16
+ # @snapshot
17
+ def default
18
+ end
19
+ end
20
+ end
21
+ end
@@ -176,6 +176,11 @@ module Primer
176
176
  render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_ok_path, name: "my-text-field", label: "My text field"))
177
177
  end
178
178
 
179
+ # @label Auto check request accepted
180
+ def with_auto_check_accepted
181
+ render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_accepted_path, name: "my-text-field", label: "My text field"))
182
+ end
183
+
179
184
  # @label Auto check request error
180
185
  def with_auto_check_error
181
186
  render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_error_path, name: "my-text-field", label: "My text field"))
@@ -64,6 +64,12 @@ module Primer
64
64
  render(Primer::Beta::Avatar.new(size: 48, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
65
65
  end
66
66
 
67
+ # @label 64px
68
+ # @snapshot
69
+ def size_64
70
+ render(Primer::Beta::Avatar.new(size: 64, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
71
+ end
72
+
67
73
  # @label 80px
68
74
  # @snapshot
69
75
  def size_80
@@ -0,0 +1,6 @@
1
+ <div style="display: flex">
2
+ <%= render Primer::Beta::Blankslate.new do |component| %>
3
+ <% component.with_heading(tag: :h2) { "Heading" } %>
4
+ <% component.with_description { "Description" } %>
5
+ <% end %>
6
+ </div>
@@ -134,6 +134,9 @@ module Primer
134
134
  component.with_secondary_action(href: "#").with_content("Learn more about vulnerabilities")
135
135
  end
136
136
  end
137
+
138
+ def inside_flex_container
139
+ end
137
140
  end
138
141
  end
139
142
  end
@@ -69,6 +69,17 @@ module Primer
69
69
  end
70
70
  end
71
71
  end
72
+
73
+ # @label With clipboard copy button
74
+ # @snapshot
75
+ def with_clipboard_copy_button(size: :medium, scheme: :default)
76
+ render(Primer::Beta::ButtonGroup.new(size: size, scheme: scheme)) do |component|
77
+ component.with_button { "Button 1" }
78
+ component.with_clipboard_copy_button(id: "button-2", value: "Copyable value", aria: { label: "Copy some text" }) do |button|
79
+ button.with_tooltip(text: "Copy some text")
80
+ end
81
+ end
82
+ end
72
83
  end
73
84
  end
74
85
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # @label ClipboardCopyButton
6
+ class ClipboardCopyButtonPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ #
9
+ # @param text [String]
10
+ def playground(text: "Text to copy")
11
+ render(Primer::Beta::ClipboardCopyButton.new(id: "clipboard-button", aria: { label: "Copy" }, value: text))
12
+ end
13
+
14
+ # @label Playground
15
+ # @snapshot
16
+ def default
17
+ render(Primer::Beta::ClipboardCopyButton.new(id: "clipboard-button", aria: { label: "Copy" }, value: "Text to copy"))
18
+ end
19
+
20
+ # @label With tooltip
21
+ # @snapshot
22
+ def with_tooltip
23
+ render(Primer::Beta::ClipboardCopyButton.new(id: "clipboard-button", aria: { label: "Copy" }, value: "Text to copy")) do |button|
24
+ button.with_tooltip(text: "Copy some text")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -106,7 +106,7 @@ module Primer
106
106
  # @snapshot
107
107
  def show_more_item
108
108
  render(Primer::Beta::NavList.new(aria: { label: "My favorite foods" })) do |list|
109
- list.with_group do |group|
109
+ list.with_group(id: "foods") do |group|
110
110
  group.with_heading(title: "My favorite foods")
111
111
  group.with_item(label: "Popplers", href: "/foods/popplers")
112
112
  group.with_item(label: "Slurm", href: "/foods/slurm")
@@ -114,6 +114,15 @@ module Primer
114
114
  item.with_trailing_visual_icon(icon: :plus)
115
115
  end
116
116
  end
117
+
118
+ list.with_group(id: "snacks") do |group|
119
+ group.with_heading(title: "My favorite snacks")
120
+ group.with_item(label: "Popplers", href: "/foods/popplers")
121
+ group.with_item(label: "Slurm", href: "/foods/slurm")
122
+ group.with_show_more_item(label: "Show more snacks", src: UrlHelpers.nav_list_items_path, pages: 4) do |item|
123
+ item.with_trailing_visual_icon(icon: :plus)
124
+ end
125
+ end
117
126
  end
118
127
  end
119
128
 
@@ -9,10 +9,11 @@ module Primer
9
9
  # @param spacious [Boolean]
10
10
  # @param hide_border [Boolean]
11
11
  # @param heading_danger [Boolean]
12
+ # @param heading_size [Symbol] select [medium, large]
12
13
  # @param heading_tag [Symbol] select [div, h1, h2, h3, h4, h5, h6]
13
- def playground(spacious: false, hide_border: false, heading_tag: :div, heading_danger: false)
14
+ def playground(spacious: false, hide_border: false, heading_tag: :div, heading_size: Primer::Beta::Subhead::DEFAULT_HEADING_SIZE, heading_danger: false)
14
15
  render(Primer::Beta::Subhead.new(spacious: spacious, hide_border: hide_border)) do |component|
15
- component.with_heading(tag: heading_tag, danger: heading_danger) do
16
+ component.with_heading(tag: heading_tag, size: heading_size, danger: heading_danger) do
16
17
  "My Heading"
17
18
  end
18
19
  component.with_description do
@@ -26,11 +27,12 @@ module Primer
26
27
  # @param spacious [Boolean]
27
28
  # @param hide_border [Boolean]
28
29
  # @param heading_danger [Boolean]
30
+ # @param heading_size [Symbol] select [medium, large]
29
31
  # @param heading_tag [Symbol] select [div, h1, h2, h3, h4, h5, h6]
30
32
  # @snapshot
31
- def default(spacious: false, hide_border: false, heading_tag: :div, heading_danger: false)
33
+ def default(spacious: false, hide_border: false, heading_tag: :div, heading_size: Primer::Beta::Subhead::DEFAULT_HEADING_SIZE, heading_danger: false)
32
34
  render(Primer::Beta::Subhead.new(spacious: spacious, hide_border: hide_border)) do |component|
33
- component.with_heading(tag: heading_tag, danger: heading_danger) do
35
+ component.with_heading(tag: heading_tag, size: heading_size, danger: heading_danger) do
34
36
  "My Heading"
35
37
  end
36
38
  component.with_description do
@@ -98,6 +100,32 @@ module Primer
98
100
  end
99
101
  #
100
102
  # @!endgroup
103
+
104
+ # @!group Header size
105
+ #
106
+ # @label Large
107
+ def large_header
108
+ render(Primer::Beta::Subhead.new) do |component|
109
+ component.with_heading(size: :large) do
110
+ "Large Header"
111
+ end
112
+ component.with_description do
113
+ "Description"
114
+ end
115
+ end
116
+ end
117
+
118
+ # @label Medium
119
+ def medium_header
120
+ render(Primer::Beta::Subhead.new) do |component|
121
+ component.with_heading(size: :medium) do
122
+ "Medium Header"
123
+ end
124
+ component.with_description do
125
+ "Description"
126
+ end
127
+ end
128
+ end
101
129
  end
102
130
  end
103
131
  end
@@ -0,0 +1,3 @@
1
+ <%= primer_form_with(url: action_menu_form_action_path(format: route_format)) do |f| %>
2
+ <%= render(ActionMenuForm.new(f)) %>
3
+ <% end %>
@@ -23,6 +23,10 @@ module Primer
23
23
 
24
24
  def select_form; end
25
25
 
26
+ def action_menu_form(route_format: :html)
27
+ render_with_template(locals: { route_format: route_format })
28
+ end
29
+
26
30
  def radio_button_with_nested_form; end
27
31
 
28
32
  def check_box_with_nested_form; end
@@ -217,6 +217,12 @@
217
217
  "default": "`nil`",
218
218
  "description": "Item label. If no label is provided, content is used."
219
219
  },
220
+ {
221
+ "name": "item_id",
222
+ "type": "String",
223
+ "default": "`nil`",
224
+ "description": "An ID that will be attached to the item's `<li>` element as `data-item-id` for distinguishing between items, perhaps in JavaScript."
225
+ },
220
226
  {
221
227
  "name": "label_classes",
222
228
  "type": "String",
@@ -386,12 +392,97 @@
386
392
  ]
387
393
  },
388
394
  {
389
- "component": "ActionMenu::List",
395
+ "component": "ActionMenu::Group",
390
396
  "status": "alpha",
391
397
  "a11y_reviewed": true,
398
+ "short_name": "ActionMenuGroup",
399
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/group.rb",
400
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/group/default/",
401
+ "parameters": [
402
+ {
403
+ "name": "id",
404
+ "type": "String",
405
+ "default": "`self.class.generate_id`",
406
+ "description": "HTML ID value."
407
+ },
408
+ {
409
+ "name": "role",
410
+ "type": "Boolean",
411
+ "default": "`nil`",
412
+ "description": "ARIA role describing the function of the list. listbox and menu are a common values."
413
+ },
414
+ {
415
+ "name": "item_classes",
416
+ "type": "String",
417
+ "default": "`nil`",
418
+ "description": "Additional CSS classes to attach to items."
419
+ },
420
+ {
421
+ "name": "scheme",
422
+ "type": "Symbol",
423
+ "default": "`:full`",
424
+ "description": "One of `:full` or `:inset`. `inset` children are offset (vertically and horizontally) from list edges. `full` (default) children are flush (vertically and horizontally) with list edges."
425
+ },
426
+ {
427
+ "name": "show_dividers",
428
+ "type": "Boolean",
429
+ "default": "`false`",
430
+ "description": "Display a divider above each item in the list when it does not follow a header or divider."
431
+ },
432
+ {
433
+ "name": "select_variant",
434
+ "type": "Symbol",
435
+ "default": "`:none`",
436
+ "description": "How items may be selected in the list. One of `:multiple`, `:multiple_checkbox`, `:none`, or `:single`."
437
+ },
438
+ {
439
+ "name": "form_arguments",
440
+ "type": "Hash",
441
+ "default": "`{}`",
442
+ "description": "Allows an `ActionList` to act as a select list in multi- and single-select modes. Pass the `builder:` and `name:` options to this hash. `builder:` should be an instance of `ActionView::Helpers::FormBuilder`, which are created by the standard Rails `#form_with` and `#form_for` helpers. The `name:` option is the desired name of the field that will be included in the params sent to the server on form submission. *NOTE*: Consider using an [ActionMenu](/components/alpha/actionmenu) instead of using this feature directly."
443
+ },
444
+ {
445
+ "name": "system_arguments",
446
+ "type": "Hash",
447
+ "default": "N/A",
448
+ "description": "[System arguments](/system-arguments)"
449
+ }
450
+ ]
451
+ },
452
+ {
453
+ "component": "ActionMenu::Heading",
454
+ "status": "alpha",
455
+ "a11y_reviewed": false,
456
+ "short_name": "ActionMenuHeading",
457
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/heading.rb",
458
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/heading/default/",
459
+ "parameters": [
460
+
461
+ ]
462
+ },
463
+ {
464
+ "component": "ActionMenu::List",
465
+ "status": "alpha",
466
+ "a11y_reviewed": false,
392
467
  "short_name": "ActionMenuList",
393
468
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/list.rb",
394
469
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/list/default/",
470
+ "parameters": [
471
+ {
472
+ "name": "system_arguments",
473
+ "type": "Hash",
474
+ "default": "N/A",
475
+ "description": "The arguments accepted by [ActionList](/components/alpha/actionlist)"
476
+ }
477
+ ]
478
+ },
479
+ {
480
+ "component": "ActionMenu::ListWrapper",
481
+ "status": "alpha",
482
+ "a11y_reviewed": true,
483
+ "short_name": "ActionMenuListWrapper",
484
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_menu/list_wrapper.rb",
485
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_menu/list_wrapper/default/",
395
486
  "parameters": [
396
487
  {
397
488
  "name": "menu_id",
@@ -923,7 +1014,7 @@
923
1014
  "name": "subtitle",
924
1015
  "type": "String",
925
1016
  "default": "`nil`",
926
- "description": "Provides dditional context for the dialog, also setting the `aria-describedby` attribute."
1017
+ "description": "Provides additional context for the dialog, also setting the `aria-describedby` attribute."
927
1018
  },
928
1019
  {
929
1020
  "name": "show_divider",
@@ -3034,7 +3125,7 @@
3034
3125
  "name": "size",
3035
3126
  "type": "Integer",
3036
3127
  "default": "`20`",
3037
- "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, or `80`."
3128
+ "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, `64`, or `80`."
3038
3129
  },
3039
3130
  {
3040
3131
  "name": "shape",
@@ -3108,7 +3199,7 @@
3108
3199
  "name": "tag",
3109
3200
  "type": "Symbol",
3110
3201
  "default": "`:button`",
3111
- "description": "One of `:a`, `:button`, or `:summary`."
3202
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3112
3203
  },
3113
3204
  {
3114
3205
  "name": "type",
@@ -3249,6 +3340,12 @@
3249
3340
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/button.rb",
3250
3341
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/button/default/",
3251
3342
  "parameters": [
3343
+ {
3344
+ "name": "base_button_class",
3345
+ "type": "Class",
3346
+ "default": "`Primer::Beta::BaseButton`",
3347
+ "description": "The button class to render."
3348
+ },
3252
3349
  {
3253
3350
  "name": "scheme",
3254
3351
  "type": "Symbol",
@@ -3277,7 +3374,7 @@
3277
3374
  "name": "tag",
3278
3375
  "type": "Symbol",
3279
3376
  "default": "`:button`",
3280
- "description": "One of `:a`, `:button`, or `:summary`."
3377
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3281
3378
  },
3282
3379
  {
3283
3380
  "name": "type",
@@ -3361,6 +3458,68 @@
3361
3458
  }
3362
3459
  ]
3363
3460
  },
3461
+ {
3462
+ "component": "ClipboardCopyBaseButton",
3463
+ "status": "beta",
3464
+ "a11y_reviewed": false,
3465
+ "short_name": "ClipboardCopyBaseButton",
3466
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/clipboard_copy_base_button.rb",
3467
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/clipboard_copy_base_button/default/",
3468
+ "parameters": [
3469
+ {
3470
+ "name": "tag",
3471
+ "type": "Symbol",
3472
+ "default": "`:button`",
3473
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3474
+ },
3475
+ {
3476
+ "name": "type",
3477
+ "type": "Symbol",
3478
+ "default": "`:button`",
3479
+ "description": "One of `:button`, `:reset`, or `:submit`."
3480
+ },
3481
+ {
3482
+ "name": "block",
3483
+ "type": "Boolean",
3484
+ "default": "`false`",
3485
+ "description": "Whether button is full-width with `display: block`."
3486
+ },
3487
+ {
3488
+ "name": "disabled",
3489
+ "type": "Boolean",
3490
+ "default": "`false`",
3491
+ "description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
3492
+ },
3493
+ {
3494
+ "name": "inactive",
3495
+ "type": "Boolean",
3496
+ "default": "`false`",
3497
+ "description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
3498
+ },
3499
+ {
3500
+ "name": "system_arguments",
3501
+ "type": "Hash",
3502
+ "default": "N/A",
3503
+ "description": "[System arguments](/system-arguments)"
3504
+ }
3505
+ ]
3506
+ },
3507
+ {
3508
+ "component": "ClipboardCopyButton",
3509
+ "status": "beta",
3510
+ "a11y_reviewed": false,
3511
+ "short_name": "ClipboardCopyButton",
3512
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/clipboard_copy_button.rb",
3513
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/clipboard_copy_button/default/",
3514
+ "parameters": [
3515
+ {
3516
+ "name": "system_arguments",
3517
+ "type": "Hash",
3518
+ "default": "N/A",
3519
+ "description": "The arguments accepted by [Button](/components/beta/button) and [ClipboardCopy](/components/beta/clipboardcopy)."
3520
+ }
3521
+ ]
3522
+ },
3364
3523
  {
3365
3524
  "component": "CloseButton",
3366
3525
  "status": "beta",
@@ -3561,13 +3720,7 @@
3561
3720
  "name": "tag",
3562
3721
  "type": "Symbol",
3563
3722
  "default": "N/A",
3564
- "description": "One of `:a`, `:button`, or `:summary`."
3565
- },
3566
- {
3567
- "name": "wrapper_arguments",
3568
- "type": "Hash",
3569
- "default": "`{}`",
3570
- "description": "Optional keyword arguments to be passed to the wrapper `<div>` tag."
3723
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3571
3724
  },
3572
3725
  {
3573
3726
  "name": "scheme",
@@ -4399,7 +4552,7 @@
4399
4552
  "name": "tag",
4400
4553
  "type": "Symbol",
4401
4554
  "default": "`:button`",
4402
- "description": "One of `:a`, `:button`, or `:summary`."
4555
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
4403
4556
  },
4404
4557
  {
4405
4558
  "name": "type",
@@ -4490,7 +4643,7 @@
4490
4643
  "name": "tag",
4491
4644
  "type": "Symbol",
4492
4645
  "default": "N/A",
4493
- "description": "One of `:a`, `:button`, or `:summary`."
4646
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
4494
4647
  },
4495
4648
  {
4496
4649
  "name": "type",