openproject-primer_view_components 0.15.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_bar.css +1 -1
  8. data/app/components/primer/alpha/action_bar.css.json +1 -4
  9. data/app/components/primer/alpha/action_bar.css.map +1 -1
  10. data/app/components/primer/alpha/action_bar.pcss +1 -17
  11. data/app/components/primer/alpha/action_bar_element.js +21 -9
  12. data/app/components/primer/alpha/action_list/item.rb +0 -2
  13. data/app/components/primer/alpha/action_list.css +1 -1
  14. data/app/components/primer/alpha/action_list.css.map +1 -1
  15. data/app/components/primer/alpha/action_list.rb +0 -1
  16. data/app/components/primer/alpha/action_menu/action_menu_element.js +44 -20
  17. data/app/components/primer/alpha/action_menu/list.rb +0 -9
  18. data/app/components/primer/alpha/action_menu.html.erb +20 -18
  19. data/app/components/primer/alpha/auto_complete.css +1 -1
  20. data/app/components/primer/alpha/auto_complete.css.map +1 -1
  21. data/app/components/primer/alpha/button_marketing.css +1 -1
  22. data/app/components/primer/alpha/button_marketing.css.map +1 -1
  23. data/app/components/primer/alpha/dialog/header.rb +1 -1
  24. data/app/components/primer/alpha/dropdown.css +1 -1
  25. data/app/components/primer/alpha/dropdown.css.map +1 -1
  26. data/app/components/primer/alpha/layout.css +1 -1
  27. data/app/components/primer/alpha/layout.css.map +1 -1
  28. data/app/components/primer/alpha/menu.css +1 -1
  29. data/app/components/primer/alpha/menu.css.map +1 -1
  30. data/app/components/primer/alpha/nav_list/divider.rb +1 -0
  31. data/app/components/primer/alpha/nav_list/group.rb +1 -0
  32. data/app/components/primer/alpha/nav_list/heading.rb +1 -0
  33. data/app/components/primer/alpha/nav_list/item.rb +1 -0
  34. data/app/components/primer/alpha/nav_list.rb +1 -0
  35. data/app/components/primer/alpha/octicon_symbols.html.erb +1 -1
  36. data/app/components/primer/alpha/overlay.css +1 -1
  37. data/app/components/primer/alpha/overlay.css.json +0 -1
  38. data/app/components/primer/alpha/overlay.css.map +1 -1
  39. data/app/components/primer/alpha/segmented_control.css +1 -1
  40. data/app/components/primer/alpha/segmented_control.css.json +0 -1
  41. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  42. data/app/components/primer/alpha/segmented_control.js +2 -1
  43. data/app/components/primer/alpha/segmented_control.pcss +0 -4
  44. data/app/components/primer/alpha/tab_nav.css +1 -1
  45. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  46. data/app/components/primer/alpha/text_field.css +1 -1
  47. data/app/components/primer/alpha/text_field.css.json +11 -5
  48. data/app/components/primer/alpha/text_field.css.map +1 -1
  49. data/app/components/primer/alpha/text_field.pcss +10 -1
  50. data/app/components/primer/alpha/toggle_switch.css +1 -1
  51. data/app/components/primer/alpha/toggle_switch.css.map +1 -1
  52. data/app/components/primer/alpha/underline_nav.css +1 -1
  53. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  54. data/app/components/primer/alpha/x_banner.js +2 -1
  55. data/app/components/primer/anchored_position.js +2 -1
  56. data/app/components/primer/beta/auto_complete/item.rb +1 -1
  57. data/app/components/primer/beta/avatar.rb +1 -1
  58. data/app/components/primer/beta/base_button.rb +1 -1
  59. data/app/components/primer/beta/blankslate.css +1 -1
  60. data/app/components/primer/beta/blankslate.css.json +1 -0
  61. data/app/components/primer/beta/blankslate.css.map +1 -1
  62. data/app/components/primer/beta/blankslate.html.erb +16 -14
  63. data/app/components/primer/beta/blankslate.pcss +52 -2
  64. data/app/components/primer/beta/border_box.css +1 -1
  65. data/app/components/primer/beta/border_box.css.map +1 -1
  66. data/app/components/primer/beta/button.css +1 -1
  67. data/app/components/primer/beta/button.css.json +0 -1
  68. data/app/components/primer/beta/button.css.map +1 -1
  69. data/app/components/primer/beta/button.html.erb +18 -20
  70. data/app/components/primer/beta/button.pcss +0 -5
  71. data/app/components/primer/beta/button.rb +3 -0
  72. data/app/components/primer/beta/button_group.css +1 -1
  73. data/app/components/primer/beta/button_group.css.json +2 -4
  74. data/app/components/primer/beta/button_group.css.map +1 -1
  75. data/app/components/primer/beta/button_group.html.erb +3 -1
  76. data/app/components/primer/beta/button_group.pcss +2 -4
  77. data/app/components/primer/beta/button_group.rb +41 -12
  78. data/app/components/primer/beta/clipboard_copy.rb +4 -0
  79. data/app/components/primer/beta/clipboard_copy_button.rb +25 -0
  80. data/app/components/primer/beta/counter.rb +1 -1
  81. data/app/components/primer/beta/flash.html.erb +1 -1
  82. data/app/components/primer/beta/icon_button.html.erb +4 -6
  83. data/app/components/primer/beta/icon_button.rb +1 -3
  84. data/app/components/primer/beta/label.css +1 -1
  85. data/app/components/primer/beta/label.css.map +1 -1
  86. data/app/components/primer/beta/link.css +1 -1
  87. data/app/components/primer/beta/link.css.map +1 -1
  88. data/app/components/primer/beta/nav_list.js +14 -7
  89. data/app/components/primer/beta/subhead.css +1 -1
  90. data/app/components/primer/beta/subhead.css.json +2 -0
  91. data/app/components/primer/beta/subhead.css.map +1 -1
  92. data/app/components/primer/beta/subhead.pcss +8 -1
  93. data/app/components/primer/beta/subhead.rb +9 -1
  94. data/app/components/primer/focus_group.js +2 -1
  95. data/app/components/primer/open_project/page_header.css +1 -1
  96. data/app/components/primer/open_project/page_header.css.json +4 -1
  97. data/app/components/primer/open_project/page_header.css.map +1 -1
  98. data/app/components/primer/open_project/page_header.html.erb +9 -1
  99. data/app/components/primer/open_project/page_header.pcss +19 -1
  100. data/app/components/primer/open_project/page_header.rb +38 -0
  101. data/app/forms/action_menu_form.rb +20 -0
  102. data/app/forms/immediate_validation_form.rb +2 -2
  103. data/app/lib/primer/fetch_or_fallback_helper.rb +0 -1
  104. data/app/lib/primer/octicon/cache.rb +1 -1
  105. data/lib/primer/classify.rb +0 -2
  106. data/lib/primer/forms/action_menu.html.erb +6 -0
  107. data/lib/primer/forms/action_menu.rb +25 -0
  108. data/lib/primer/forms/acts_as_component.rb +0 -3
  109. data/lib/primer/forms/base.rb +0 -1
  110. data/lib/primer/forms/base_component.rb +0 -2
  111. data/lib/primer/forms/dsl/action_menu_input.rb +36 -0
  112. data/lib/primer/forms/dsl/input.rb +8 -1
  113. data/lib/primer/forms/dsl/input_methods.rb +9 -0
  114. data/lib/primer/forms/dsl/text_field_input.rb +8 -0
  115. data/lib/primer/forms/primer_base_component_wrapper.rb +0 -2
  116. data/lib/primer/forms/primer_text_field.js +40 -5
  117. data/lib/primer/forms/primer_text_field.ts +39 -7
  118. data/lib/primer/forms/validation_message.html.erb +2 -1
  119. data/lib/primer/static/generate_info_arch.rb +1 -2
  120. data/lib/primer/static/generate_previews.rb +0 -2
  121. data/lib/primer/view_components/engine.rb +5 -1
  122. data/lib/primer/view_components/linters/base_linter.rb +3 -2
  123. data/lib/primer/view_components/linters/deprecated_components_counter.rb +1 -1
  124. data/lib/primer/view_components/linters/disallow_action_list.rb +1 -0
  125. data/lib/primer/view_components/linters/severity_schema.rb +1 -0
  126. data/lib/primer/view_components/version.rb +1 -2
  127. data/lib/primer/yard/lookbook_pages_backend.rb +0 -2
  128. data/lib/rubocop/cop/primer/base_cop.rb +1 -1
  129. data/lib/rubocop/cop/primer/deprecated_arguments.rb +0 -2
  130. data/lib/rubocop/cop/primer/deprecated_components.rb +1 -1
  131. data/lib/rubocop/cop/primer/deprecated_label_schemes.rb +1 -1
  132. data/lib/rubocop/cop/primer/deprecated_label_variants.rb +1 -1
  133. data/previews/primer/alpha/octicon_symbols_preview/default.html.erb +6 -0
  134. data/previews/primer/alpha/octicon_symbols_preview/playground.html.erb +13 -0
  135. data/previews/primer/alpha/octicon_symbols_preview.rb +21 -0
  136. data/previews/primer/alpha/text_field_preview.rb +5 -0
  137. data/previews/primer/beta/avatar_preview.rb +6 -0
  138. data/previews/primer/beta/button_group_preview.rb +11 -0
  139. data/previews/primer/beta/clipboard_copy_button_preview.rb +29 -0
  140. data/previews/primer/beta/subhead_preview.rb +32 -4
  141. data/previews/primer/forms_preview/action_menu_form.html.erb +3 -0
  142. data/previews/primer/forms_preview.rb +4 -0
  143. data/previews/primer/open_project/page_header_preview/context_bar_actions.html.erb +25 -0
  144. data/previews/primer/open_project/page_header_preview/playground.html.erb +32 -0
  145. data/previews/primer/open_project/page_header_preview.rb +48 -9
  146. data/static/arguments.json +75 -13
  147. data/static/audited_at.json +2 -0
  148. data/static/classes.json +18 -3
  149. data/static/constants.json +32 -1
  150. data/static/info_arch.json +381 -28
  151. data/static/previews.json +172 -0
  152. data/static/statuses.json +2 -0
  153. metadata +16 -4
@@ -4,6 +4,7 @@ require "erb_lint/utils/severity_levels"
4
4
 
5
5
  module ERBLint
6
6
  module Linters
7
+ # :nodoc:
7
8
  class SeveritySchema < LinterConfig
8
9
  # SEVERITY_NAMES :info, :refactor, :convention, :warning, :error, :fatal
9
10
  # see https://github.com/Shopify/erb-lint/blob/main/lib/erb_lint/utils/severity_levels.rb
@@ -5,7 +5,7 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 15
8
+ MINOR = 17
9
9
  PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -13,6 +13,5 @@ module Primer
13
13
  end
14
14
  end
15
15
 
16
- # rubocop:disable Rails/Output
17
16
  puts Primer::ViewComponents::VERSION::STRING if __FILE__ == $PROGRAM_NAME
18
17
  # rubocop:enable Rails/Output
@@ -42,14 +42,12 @@ module Primer
42
42
  ), __dir__
43
43
  )
44
44
 
45
- # rubocop:disable Lint/UselessAssignment
46
45
  documented_methods = docs.non_slot_methods.select do |mtd|
47
46
  [component.name, "Primer::Forms::Dsl::InputMethods"].include?(mtd.parent.title)
48
47
  end
49
48
 
50
49
  preview_methods = PREVIEW_MAP[component]
51
50
  preview_erbs = preview_methods.map do |preview_method|
52
- # rubocop:disable Style/IfUnlessModifier
53
51
  if Primer::FormsPreview.instance_methods.exclude?(preview_method)
54
52
  raise "Preview '#{preview_method}' does not exist in Primer::FormsPreview"
55
53
  end
@@ -12,7 +12,7 @@ module RuboCop
12
12
  # We only verify SystemArguments if it's a `.new` call on a component or
13
13
  # a ViewHeleper call.
14
14
  def valid_node?(node)
15
- return if node.nil?
15
+ return false if node.nil?
16
16
 
17
17
  view_helpers.include?(node.method_name) || (node.method_name == :new && !node.receiver.nil? && ::Primer::ViewComponents::STATUSES.key?(node.receiver.const_name))
18
18
  end
@@ -298,7 +298,6 @@ module RuboCop
298
298
  def extract_kv_from(pair)
299
299
  key = pair.key.value
300
300
 
301
- # rubocop:disable Lint/BooleanSymbol
302
301
  value = case pair.value.type
303
302
  when :sym, :str
304
303
  pair.value.value.to_sym
@@ -307,7 +306,6 @@ module RuboCop
307
306
  else
308
307
  return []
309
308
  end
310
- # rubocop:enable Lint/BooleanSymbol
311
309
 
312
310
  [key, value]
313
311
  end
@@ -3,7 +3,7 @@
3
3
  require "rubocop"
4
4
  require "json"
5
5
  require "parser/current"
6
- require_relative "./../../../primer/view_components/linters/helpers/deprecated_components_helpers"
6
+ require_relative "../../../primer/view_components/linters/helpers/deprecated_components_helpers"
7
7
 
8
8
  module RuboCop
9
9
  module Cop
@@ -58,7 +58,7 @@ module RuboCop
58
58
  private
59
59
 
60
60
  def label_node?(node)
61
- return if node.nil?
61
+ return false if node.nil?
62
62
 
63
63
  node.method_name == :new && !node.receiver.nil? && node.receiver.const_name == "Primer::Beta::Label"
64
64
  end
@@ -61,7 +61,7 @@ module RuboCop
61
61
  private
62
62
 
63
63
  def label_node?(node)
64
- return if node.nil?
64
+ return false if node.nil?
65
65
 
66
66
  node.method_name == :new && !node.receiver.nil? && node.receiver.const_name == "Primer::Beta::Label"
67
67
  end
@@ -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
@@ -179,6 +179,11 @@ module Primer
179
179
  render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_ok_path, name: "my-text-field", label: "My text field"))
180
180
  end
181
181
 
182
+ # @label Auto check request accepted
183
+ def with_auto_check_accepted
184
+ render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_accepted_path, name: "my-text-field", label: "My text field"))
185
+ end
186
+
182
187
  # @label Auto check request error
183
188
  def with_auto_check_error
184
189
  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
@@ -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
@@ -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 %>
@@ -25,6 +25,10 @@ module Primer
25
25
 
26
26
  def select_form; end
27
27
 
28
+ def action_menu_form(route_format: :html)
29
+ render_with_template(locals: { route_format: route_format })
30
+ end
31
+
28
32
  def radio_button_with_nested_form; end
29
33
 
30
34
  def check_box_with_nested_form; end
@@ -0,0 +1,25 @@
1
+ <%= render(Primer::OpenProject::PageHeader.new) do |component| %>
2
+ <% component.with_title(tag: :h1) do %>
3
+ A title
4
+ <% end %>
5
+ <% component.with_description do %>
6
+ A description with actions
7
+ <% end %>
8
+ <% component.with_parent_link(href: "#") do %>
9
+ Parent link
10
+ <% end %>
11
+ <% component.with_context_bar_actions do %>
12
+ <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
13
+ <% component.with_show_button { "Menu" } %>
14
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
15
+ <% component.with_item(
16
+ label: "Show dialog",
17
+ tag: :button,
18
+ content_arguments: { "data-show-dialog-id": "my-dialog" },
19
+ value: "",
20
+ scheme: :danger
21
+ ) %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
25
+
@@ -0,0 +1,32 @@
1
+ <%= render Primer::OpenProject::PageHeader.new do |header| %>
2
+ <%= header.with_title(variant: variant) { title } %>
3
+ <%= header.with_description { description } %>
4
+ <%= header.with_back_button(href: "#", size: back_button_size, 'aria-label': "Back") if with_back_button %>
5
+ <%= header.with_breadcrumbs(breadcrumb_items) if with_breadcrumbs %>
6
+ <%= header.with_parent_link(href: "#") { "Parent link" } if with_parent_link %>
7
+ <% if with_actions %>
8
+ <% header.with_actions do %>
9
+ <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
10
+ <% component.with_show_button { "Menu" } %>
11
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
12
+ <% component.with_item(
13
+ label: "Show dialog",
14
+ tag: :button,
15
+ content_arguments: { "data-show-dialog-id": "my-dialog" },
16
+ value: "",
17
+ scheme: :danger
18
+ ) %>
19
+ <% end %>
20
+ <% end %>
21
+ <% end %>
22
+ <% if with_context_bar_actions %>
23
+ <% header.with_context_bar_actions do %>
24
+ <%= render(Primer::Beta::IconButton.new(
25
+ scheme: :default,
26
+ size: :small,
27
+ icon: "pencil",
28
+ "aria-label": "aria_label"
29
+ )) %>
30
+ <% end %>
31
+ <% end %>
32
+ <% end %>
@@ -21,22 +21,32 @@ module Primer
21
21
  # @param with_back_button [Boolean]
22
22
  # @param back_button_size [Symbol] select [small, medium, large]
23
23
  # @param with_breadcrumbs [Boolean]
24
+ # @param with_actions [Boolean]
25
+ # @param with_context_bar_actions [Boolean]
26
+ # @param with_parent_link [Boolean]
24
27
  def playground(
25
28
  variant: :medium,
26
29
  title: "Hello",
27
30
  description: "Last updated 5 minutes ago by XYZ.",
28
31
  with_back_button: false,
29
32
  back_button_size: :medium,
30
- with_breadcrumbs: false
33
+ with_breadcrumbs: false,
34
+ with_actions: false,
35
+ with_context_bar_actions: false,
36
+ with_parent_link: false
31
37
  )
32
38
  breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
33
39
 
34
- render(Primer::OpenProject::PageHeader.new) do |header|
35
- header.with_title(variant: variant) { title }
36
- header.with_description { description }
37
- header.with_back_button(href: "#", size: back_button_size, 'aria-label': "Back") if with_back_button
38
- header.with_breadcrumbs(breadcrumb_items) if with_breadcrumbs
39
- end
40
+ render_with_template(locals: { variant: variant,
41
+ title: title,
42
+ description: description,
43
+ with_back_button: with_back_button,
44
+ back_button_size: back_button_size,
45
+ with_breadcrumbs: with_breadcrumbs,
46
+ with_parent_link: with_parent_link,
47
+ with_actions: with_actions,
48
+ with_context_bar_actions: with_context_bar_actions,
49
+ breadcrumb_items: breadcrumb_items })
40
50
  end
41
51
 
42
52
  # @label Large
@@ -52,7 +62,11 @@ module Primer
52
62
  render_with_template(locals: {})
53
63
  end
54
64
 
55
- # @label With back button
65
+ # @label With back button (on wide)
66
+ # **Back button** is only shown on **wider than narrow screens** by default.
67
+ # If you want to override that behaviour please use the system_argument: **display**
68
+ # e.g. **component.with\_breadcrumbs(display: [:block, :block])**
69
+ #
56
70
  # @param href [String] text
57
71
  # @param size [Symbol] select [small, medium, large]
58
72
  # @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
@@ -63,7 +77,11 @@ module Primer
63
77
  end
64
78
  end
65
79
 
66
- # @label With breadcrumbs
80
+ # @label With breadcrumbs (on wide)
81
+ # **Breadcrumbs** are only shown on **wider than narrow screens** by default.
82
+ # If you want to override that behaviour please use the system_argument: **display**
83
+ # e.g. **component.with\_breadcrumbs(display: [:block, :block])**
84
+ #
67
85
  def breadcrumbs
68
86
  breadcrumb_items = [
69
87
  { href: "/foo", text: "Foo" },
@@ -75,6 +93,27 @@ module Primer
75
93
  header.with_breadcrumbs(breadcrumb_items)
76
94
  end
77
95
  end
96
+
97
+ # @label With parent link (on narrow)
98
+ # **Parent link** is only shown on **narrow screens** by default.
99
+ # If you want to override that behaviour please use the system_argument: **display**
100
+ # e.g. **component.with\_parent\_link(display: [:block, :block])**
101
+ #
102
+ def parent_link
103
+ render(Primer::OpenProject::PageHeader.new) do |header|
104
+ header.with_title { "A title" }
105
+ header.with_parent_link(href: "test") { "Parent link" }
106
+ end
107
+ end
108
+
109
+ # @label With context bar actions (on narrow)
110
+ # **Context bar actions** are only shown on **narrow screens** by default.
111
+ # If you want to override that behaviour please use the system_argument: **display**
112
+ # e.g. **component.with\_context\_bar\_actions(display: [:block, :block])**
113
+ #
114
+ def context_bar_actions
115
+ render_with_template(locals: {})
116
+ end
78
117
  end
79
118
  end
80
119
  end
@@ -923,7 +923,7 @@
923
923
  "name": "subtitle",
924
924
  "type": "String",
925
925
  "default": "`nil`",
926
- "description": "Provides dditional context for the dialog, also setting the `aria-describedby` attribute."
926
+ "description": "Provides additional context for the dialog, also setting the `aria-describedby` attribute."
927
927
  },
928
928
  {
929
929
  "name": "show_divider",
@@ -3034,7 +3034,7 @@
3034
3034
  "name": "size",
3035
3035
  "type": "Integer",
3036
3036
  "default": "`20`",
3037
- "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, or `80`."
3037
+ "description": "One of `16`, `20`, `24`, `32`, `40`, `48`, `64`, or `80`."
3038
3038
  },
3039
3039
  {
3040
3040
  "name": "shape",
@@ -3108,7 +3108,7 @@
3108
3108
  "name": "tag",
3109
3109
  "type": "Symbol",
3110
3110
  "default": "`:button`",
3111
- "description": "One of `:a`, `:button`, or `:summary`."
3111
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3112
3112
  },
3113
3113
  {
3114
3114
  "name": "type",
@@ -3249,6 +3249,12 @@
3249
3249
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/button.rb",
3250
3250
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/button/default/",
3251
3251
  "parameters": [
3252
+ {
3253
+ "name": "base_button_class",
3254
+ "type": "Class",
3255
+ "default": "`Primer::Beta::BaseButton`",
3256
+ "description": "The button class to render."
3257
+ },
3252
3258
  {
3253
3259
  "name": "scheme",
3254
3260
  "type": "Symbol",
@@ -3277,7 +3283,7 @@
3277
3283
  "name": "tag",
3278
3284
  "type": "Symbol",
3279
3285
  "default": "`:button`",
3280
- "description": "One of `:a`, `:button`, or `:summary`."
3286
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3281
3287
  },
3282
3288
  {
3283
3289
  "name": "type",
@@ -3361,6 +3367,68 @@
3361
3367
  }
3362
3368
  ]
3363
3369
  },
3370
+ {
3371
+ "component": "ClipboardCopyBaseButton",
3372
+ "status": "beta",
3373
+ "a11y_reviewed": false,
3374
+ "short_name": "ClipboardCopyBaseButton",
3375
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/clipboard_copy_base_button.rb",
3376
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/clipboard_copy_base_button/default/",
3377
+ "parameters": [
3378
+ {
3379
+ "name": "tag",
3380
+ "type": "Symbol",
3381
+ "default": "`:button`",
3382
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3383
+ },
3384
+ {
3385
+ "name": "type",
3386
+ "type": "Symbol",
3387
+ "default": "`:button`",
3388
+ "description": "One of `:button`, `:reset`, or `:submit`."
3389
+ },
3390
+ {
3391
+ "name": "block",
3392
+ "type": "Boolean",
3393
+ "default": "`false`",
3394
+ "description": "Whether button is full-width with `display: block`."
3395
+ },
3396
+ {
3397
+ "name": "disabled",
3398
+ "type": "Boolean",
3399
+ "default": "`false`",
3400
+ "description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
3401
+ },
3402
+ {
3403
+ "name": "inactive",
3404
+ "type": "Boolean",
3405
+ "default": "`false`",
3406
+ "description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
3407
+ },
3408
+ {
3409
+ "name": "system_arguments",
3410
+ "type": "Hash",
3411
+ "default": "N/A",
3412
+ "description": "[System arguments](/system-arguments)"
3413
+ }
3414
+ ]
3415
+ },
3416
+ {
3417
+ "component": "ClipboardCopyButton",
3418
+ "status": "beta",
3419
+ "a11y_reviewed": false,
3420
+ "short_name": "ClipboardCopyButton",
3421
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/clipboard_copy_button.rb",
3422
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/clipboard_copy_button/default/",
3423
+ "parameters": [
3424
+ {
3425
+ "name": "system_arguments",
3426
+ "type": "Hash",
3427
+ "default": "N/A",
3428
+ "description": "The arguments accepted by [Button](/components/beta/button) and [ClipboardCopy](/components/beta/clipboardcopy)."
3429
+ }
3430
+ ]
3431
+ },
3364
3432
  {
3365
3433
  "component": "CloseButton",
3366
3434
  "status": "beta",
@@ -3561,13 +3629,7 @@
3561
3629
  "name": "tag",
3562
3630
  "type": "Symbol",
3563
3631
  "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."
3632
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
3571
3633
  },
3572
3634
  {
3573
3635
  "name": "scheme",
@@ -4399,7 +4461,7 @@
4399
4461
  "name": "tag",
4400
4462
  "type": "Symbol",
4401
4463
  "default": "`:button`",
4402
- "description": "One of `:a`, `:button`, or `:summary`."
4464
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
4403
4465
  },
4404
4466
  {
4405
4467
  "name": "type",
@@ -4490,7 +4552,7 @@
4490
4552
  "name": "tag",
4491
4553
  "type": "Symbol",
4492
4554
  "default": "N/A",
4493
- "description": "One of `:a`, `:button`, or `:summary`."
4555
+ "description": "One of `:a`, `:button`, `:clipboard-copy`, or `:summary`."
4494
4556
  },
4495
4557
  {
4496
4558
  "name": "type",
@@ -73,6 +73,8 @@
73
73
  "Primer::Beta::Button": "",
74
74
  "Primer::Beta::ButtonGroup": "",
75
75
  "Primer::Beta::ClipboardCopy": "",
76
+ "Primer::Beta::ClipboardCopyBaseButton": "",
77
+ "Primer::Beta::ClipboardCopyButton": "",
76
78
  "Primer::Beta::CloseButton": "",
77
79
  "Primer::Beta::Counter": "",
78
80
  "Primer::Beta::Details": "",
data/static/classes.json CHANGED
@@ -230,9 +230,6 @@
230
230
  "Button-visual": [
231
231
  "Primer::Beta::Button"
232
232
  ],
233
- "Button-withTooltip": [
234
- "Primer::Beta::Button"
235
- ],
236
233
  "ButtonGroup": [
237
234
  "Primer::Beta::ButtonGroup"
238
235
  ],
@@ -269,6 +266,9 @@
269
266
  "FormControl-inlineValidation": [
270
267
  "Primer::Alpha::TextField"
271
268
  ],
269
+ "FormControl-inlineValidation--success": [
270
+ "Primer::Alpha::TextField"
271
+ ],
272
272
  "FormControl-inlineValidation--visual": [
273
273
  "Primer::Alpha::TextField"
274
274
  ],
@@ -441,9 +441,18 @@
441
441
  "PageHeader-breadcrumbs": [
442
442
  "Primer::OpenProject::PageHeader"
443
443
  ],
444
+ "PageHeader-contextBar": [
445
+ "Primer::OpenProject::PageHeader"
446
+ ],
447
+ "PageHeader-contextBarActions": [
448
+ "Primer::OpenProject::PageHeader"
449
+ ],
444
450
  "PageHeader-description": [
445
451
  "Primer::OpenProject::PageHeader"
446
452
  ],
453
+ "PageHeader-parentLink": [
454
+ "Primer::OpenProject::PageHeader"
455
+ ],
447
456
  "PageHeader-title": [
448
457
  "Primer::OpenProject::PageHeader"
449
458
  ],
@@ -567,6 +576,12 @@
567
576
  "Subhead-heading--danger": [
568
577
  "Primer::Beta::Subhead"
569
578
  ],
579
+ "Subhead-heading--large": [
580
+ "Primer::Beta::Subhead"
581
+ ],
582
+ "Subhead-heading--medium": [
583
+ "Primer::Beta::Subhead"
584
+ ],
570
585
  "TimelineItem": [
571
586
  "Primer::Beta::TimelineItem"
572
587
  ],