openproject-primer_view_components 0.23.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/README.md +1 -0
  4. data/app/assets/javascripts/app/components/primer/alpha/action_list.d.ts +16 -0
  5. data/app/assets/javascripts/app/components/primer/beta/nav_list.d.ts +3 -0
  6. data/app/assets/javascripts/app/components/primer/open_project/page_header_element.d.ts +9 -0
  7. data/app/assets/javascripts/app/components/primer/primer.d.ts +2 -0
  8. data/app/assets/javascripts/primer_view_components.js +1 -1
  9. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  10. data/app/assets/styles/primer_view_components.css +1 -1
  11. data/app/assets/styles/primer_view_components.css.map +1 -1
  12. data/app/components/primer/alpha/action_list/item.rb +19 -6
  13. data/app/components/primer/alpha/action_list.css +1 -1
  14. data/app/components/primer/alpha/action_list.css.json +2 -0
  15. data/app/components/primer/alpha/action_list.css.map +1 -1
  16. data/app/components/primer/alpha/action_list.d.ts +16 -0
  17. data/app/components/primer/alpha/action_list.html.erb +19 -17
  18. data/app/components/primer/alpha/action_list.js +69 -0
  19. data/app/components/primer/alpha/action_list.pcss +8 -0
  20. data/app/components/primer/alpha/action_list.ts +58 -0
  21. data/app/components/primer/alpha/dialog.css +1 -1
  22. data/app/components/primer/alpha/dialog.css.json +1 -0
  23. data/app/components/primer/alpha/dialog.css.map +1 -1
  24. data/app/components/primer/alpha/dialog.pcss +10 -0
  25. data/app/components/primer/alpha/dropdown.css +1 -1
  26. data/app/components/primer/alpha/dropdown.css.map +1 -1
  27. data/app/components/primer/alpha/dropdown.pcss +1 -1
  28. data/app/components/primer/alpha/segmented_control.css +1 -1
  29. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  30. data/app/components/primer/alpha/segmented_control.pcss +1 -0
  31. data/app/components/primer/alpha/text_field.css +1 -1
  32. data/app/components/primer/alpha/text_field.css.json +2 -0
  33. data/app/components/primer/alpha/text_field.css.map +1 -1
  34. data/app/components/primer/alpha/text_field.pcss +10 -0
  35. data/app/components/primer/alpha/toggle_switch.rb +2 -2
  36. data/app/components/primer/alpha/tool_tip.js +46 -77
  37. data/app/components/primer/alpha/tool_tip.ts +46 -77
  38. data/app/components/primer/beta/auto_complete/auto_complete.html.erb +9 -9
  39. data/app/components/primer/beta/breadcrumbs.css +1 -1
  40. data/app/components/primer/beta/breadcrumbs.css.map +1 -1
  41. data/app/components/primer/beta/breadcrumbs.pcss +3 -1
  42. data/app/components/primer/beta/button.css +1 -1
  43. data/app/components/primer/beta/button.css.json +1 -0
  44. data/app/components/primer/beta/button.css.map +1 -1
  45. data/app/components/primer/beta/button.pcss +4 -0
  46. data/app/components/primer/beta/nav_list.d.ts +3 -0
  47. data/app/components/primer/beta/nav_list.html.erb +1 -1
  48. data/app/components/primer/beta/nav_list.js +25 -2
  49. data/app/components/primer/beta/nav_list.ts +18 -1
  50. data/app/components/primer/beta/nav_list_group_element.js +4 -1
  51. data/app/components/primer/beta/nav_list_group_element.ts +3 -0
  52. data/app/components/primer/beta/popover.css +1 -1
  53. data/app/components/primer/beta/popover.css.map +1 -1
  54. data/app/components/primer/beta/popover.pcss +3 -0
  55. data/app/components/primer/beta/popover.rb +0 -1
  56. data/app/components/primer/open_project/page_header.css +1 -1
  57. data/app/components/primer/open_project/page_header.css.json +3 -4
  58. data/app/components/primer/open_project/page_header.css.map +1 -1
  59. data/app/components/primer/open_project/page_header.html.erb +16 -5
  60. data/app/components/primer/open_project/page_header.pcss +12 -15
  61. data/app/components/primer/open_project/page_header.rb +164 -57
  62. data/app/components/primer/open_project/page_header_element.d.ts +9 -0
  63. data/app/components/primer/open_project/page_header_element.js +23 -0
  64. data/app/components/primer/open_project/page_header_element.ts +25 -0
  65. data/app/components/primer/primer.d.ts +2 -0
  66. data/app/components/primer/primer.js +2 -0
  67. data/app/components/primer/primer.ts +2 -0
  68. data/app/forms/auto_complete_form.rb +18 -0
  69. data/app/forms/select_form.rb +10 -0
  70. data/lib/primer/forms/auto_complete.html.erb +6 -0
  71. data/lib/primer/forms/auto_complete.rb +56 -0
  72. data/lib/primer/forms/builder.rb +19 -0
  73. data/lib/primer/forms/check_box_group.html.erb +4 -4
  74. data/lib/primer/forms/check_box_group.rb +0 -3
  75. data/lib/primer/forms/dsl/auto_complete_input.rb +33 -0
  76. data/lib/primer/forms/dsl/check_box_group_input.rb +8 -0
  77. data/lib/primer/forms/dsl/input.rb +8 -2
  78. data/lib/primer/forms/dsl/input_methods.rb +9 -0
  79. data/lib/primer/forms/dsl/radio_button_group_input.rb +8 -0
  80. data/lib/primer/forms/dsl/select_input.rb +5 -1
  81. data/lib/primer/forms/form_control.rb +1 -2
  82. data/lib/primer/forms/primer_text_field.js +2 -2
  83. data/lib/primer/forms/primer_text_field.ts +2 -2
  84. data/lib/primer/forms/radio_button_group.html.erb +4 -4
  85. data/lib/primer/forms/radio_button_group.rb +0 -3
  86. data/lib/primer/forms/select.html.erb +1 -0
  87. data/lib/primer/forms/select.rb +9 -5
  88. data/lib/primer/view_components/version.rb +1 -1
  89. data/previews/primer/alpha/action_list_preview.rb +42 -0
  90. data/previews/primer/alpha/action_menu_preview.rb +1 -1
  91. data/previews/primer/alpha/select_preview.rb +12 -1
  92. data/previews/primer/alpha/text_area_preview.rb +7 -1
  93. data/previews/primer/alpha/text_field_preview.rb +7 -1
  94. data/previews/primer/alpha/tooltip_preview/tooltip_e.html.erb +6 -0
  95. data/previews/primer/alpha/tooltip_preview/tooltip_n.html.erb +6 -0
  96. data/previews/primer/alpha/tooltip_preview/tooltip_ne.html.erb +6 -0
  97. data/previews/primer/alpha/tooltip_preview/tooltip_nw.html.erb +6 -0
  98. data/previews/primer/alpha/tooltip_preview/tooltip_s.html.erb +6 -0
  99. data/previews/primer/alpha/tooltip_preview/tooltip_se.html.erb +6 -0
  100. data/previews/primer/alpha/tooltip_preview/tooltip_sw.html.erb +6 -0
  101. data/previews/primer/alpha/tooltip_preview/tooltip_w.html.erb +6 -0
  102. data/previews/primer/alpha/tooltip_preview.rb +80 -0
  103. data/previews/primer/beta/nav_list_preview.rb +43 -0
  104. data/previews/primer/forms_preview/auto_complete_form.html.erb +3 -0
  105. data/previews/primer/forms_preview/select_form.html.erb +1 -1
  106. data/previews/primer/forms_preview.rb +2 -0
  107. data/previews/primer/open_project/border_grid_preview.rb +2 -2
  108. data/previews/primer/open_project/input_group_preview.rb +5 -5
  109. data/previews/primer/open_project/page_header_preview/actions.html.erb +18 -15
  110. data/previews/primer/open_project/page_header_preview/playground.html.erb +9 -24
  111. data/previews/primer/open_project/page_header_preview.rb +24 -50
  112. data/static/arguments.json +41 -8
  113. data/static/audited_at.json +1 -0
  114. data/static/classes.json +4 -4
  115. data/static/constants.json +29 -16
  116. data/static/info_arch.json +311 -69
  117. data/static/previews.json +251 -30
  118. data/static/statuses.json +1 -0
  119. metadata +23 -3
  120. data/previews/primer/open_project/page_header_preview/context_bar_actions.html.erb +0 -25
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-n")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :n) %>
4
+ Tooltip north
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-ne")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :ne) %>
4
+ Tooltip northeast
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-nw")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :nw) %>
4
+ Tooltip northwest
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-s")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :s) %>
4
+ Tooltip south
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-se")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :se) %>
4
+ Tooltip southeast
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-sw")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :sw) %>
4
+ Tooltip southwest
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center; margin-top: 4rem;">
2
+ <%= render(Primer::Beta::Button.new(id: "tooltip-w")) do |b| %>
3
+ <% b.with_tooltip(text: "This is a tooltip", direction: :w) %>
4
+ Tooltip west
5
+ <% end %>
6
+ </div>
@@ -88,6 +88,86 @@ module Primer
88
88
  def tooltip_with_dialog_moving_focus_to_input
89
89
  render_with_template(locals: {})
90
90
  end
91
+
92
+ # @label Direction: North
93
+ # @snapshot interactive
94
+ def tooltip_n(type: :description)
95
+ render_with_template(
96
+ locals: {
97
+ type: type,
98
+ }
99
+ )
100
+ end
101
+
102
+ # @label Direction: South
103
+ # @snapshot interactive
104
+ def tooltip_s(type: :description)
105
+ render_with_template(
106
+ locals: {
107
+ type: type,
108
+ }
109
+ )
110
+ end
111
+
112
+ # @label Direction: East
113
+ # @snapshot interactive
114
+ def tooltip_e(type: :description)
115
+ render_with_template(
116
+ locals: {
117
+ type: type,
118
+ }
119
+ )
120
+ end
121
+
122
+ # @label Direction: West
123
+ # @snapshot interactive
124
+ def tooltip_w(type: :description)
125
+ render_with_template(
126
+ locals: {
127
+ type: type,
128
+ }
129
+ )
130
+ end
131
+
132
+ # @label Direction: Southeast
133
+ # @snapshot interactive
134
+ def tooltip_se(type: :description)
135
+ render_with_template(
136
+ locals: {
137
+ type: type,
138
+ }
139
+ )
140
+ end
141
+
142
+ # @label Direction: Southwest
143
+ # @snapshot interactive
144
+ def tooltip_sw(type: :description)
145
+ render_with_template(
146
+ locals: {
147
+ type: type,
148
+ }
149
+ )
150
+ end
151
+
152
+ # @label Direction: Northeast
153
+ # @snapshot interactive
154
+ def tooltip_ne(type: :description)
155
+ render_with_template(
156
+ locals: {
157
+ type: type,
158
+ }
159
+ )
160
+ end
161
+
162
+ # @label Direction: Northwest
163
+ # @snapshot interactive
164
+ def tooltip_nw(type: :description)
165
+ render_with_template(
166
+ locals: {
167
+ type: type,
168
+ }
169
+ )
170
+ end
91
171
  end
92
172
  end
93
173
  end
@@ -129,6 +129,49 @@ module Primer
129
129
  # @label Trailing action
130
130
  # @snapshot
131
131
  def trailing_action; end
132
+
133
+ # @label Long label truncate overflow
134
+ #
135
+ # @param truncate_label [Symbol] select [none, truncate, show_tooltip]
136
+ # @snapshot
137
+ def long_label_with_tooltip(truncate_label: :show_tooltip)
138
+ render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
139
+ component.with_item(
140
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
141
+ truncate_label: truncate_label
142
+ ) do |item|
143
+ item.with_trailing_visual_icon(icon: :plus)
144
+ end
145
+ end
146
+ end
147
+
148
+ def long_label_wrap(truncate_label: :none)
149
+ render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
150
+ component.with_item(
151
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
152
+ truncate_label: truncate_label
153
+ )
154
+ end
155
+ end
156
+
157
+ def long_label_truncate_no_tooltip(truncate_label: :truncate)
158
+ render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
159
+ component.with_item(
160
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
161
+ truncate_label: truncate_label
162
+ )
163
+ end
164
+ end
165
+
166
+ def long_label_show_tooltip_no_truncate_label
167
+ render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
168
+ component.with_item(
169
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
170
+ ) do |item|
171
+ item.with_tooltip(text: "this is a tooltip")
172
+ end
173
+ end
174
+ end
132
175
  end
133
176
  end
134
177
  end
@@ -0,0 +1,3 @@
1
+ <%= primer_form_with(url: generic_form_submission_path) do |f| %>
2
+ <%= render(AutoCompleteForm.new(f)) %>
3
+ <% end %>
@@ -1,3 +1,3 @@
1
- <%= primer_form_with(url: "/foo") do |f| %>
1
+ <%= primer_form_with(url: generic_form_submission_path) do |f| %>
2
2
  <%= render(SelectForm.new(f)) %>
3
3
  <% end %>
@@ -46,5 +46,7 @@ module Primer
46
46
  def immediate_validation_form; end
47
47
 
48
48
  def example_toggle_switch_form; end
49
+
50
+ def auto_complete_form; end
49
51
  end
50
52
  end
@@ -21,7 +21,7 @@ module Primer
21
21
  # @label Default Options
22
22
  #
23
23
  # @snapshot
24
- def default()
24
+ def default
25
25
  render(Primer::OpenProject::BorderGrid.new) do |grid|
26
26
  grid.with_row { "Block 1" }
27
27
  grid.with_row { "Block 2" }
@@ -30,7 +30,7 @@ module Primer
30
30
  end
31
31
 
32
32
  # @label Spacious
33
- def spacious()
33
+ def spacious
34
34
  render(Primer::OpenProject::BorderGrid.new(spacious: true)) do |grid|
35
35
  grid.with_row { "Block 1" }
36
36
  grid.with_row { "Block 2" }
@@ -11,7 +11,7 @@ module Primer
11
11
  # @snapshot
12
12
  def default
13
13
  render(Primer::OpenProject::InputGroup.new) do |menu|
14
- menu.with_text_input(name: 'a name', label: 'My input group', value: "Copyable value")
14
+ menu.with_text_input(name: "a name", label: "My input group", value: "Copyable value")
15
15
  menu.with_trailing_action_clipboard_copy_button(id: "button", value: "Copyable value", aria: { label: "Copy some text" })
16
16
  end
17
17
  end
@@ -24,13 +24,13 @@ module Primer
24
24
  # @param input_width [Symbol] select [auto, small, medium, large, xlarge, xxlarge]
25
25
  def playground(
26
26
  trailing_action: :clipboardCopy,
27
- value: 'Copyable value',
27
+ value: "Copyable value",
28
28
  visually_hide_label: false,
29
29
  readonly: true,
30
30
  input_width: :medium
31
31
  )
32
32
  render(Primer::OpenProject::InputGroup.new(input_width: input_width)) do |menu|
33
- menu.with_text_input(name: 'Test', label: 'My input group', visually_hide_label: visually_hide_label, value: value, readonly: readonly)
33
+ menu.with_text_input(name: "Test", label: "My input group", visually_hide_label: visually_hide_label, value: value, readonly: readonly)
34
34
 
35
35
  case trailing_action
36
36
  when :icon
@@ -46,7 +46,7 @@ module Primer
46
46
  # @label With icon button
47
47
  def icon_button
48
48
  render(Primer::OpenProject::InputGroup.new) do |menu|
49
- menu.with_text_input(name: 'a name', label: 'My input group', value: "Some value")
49
+ menu.with_text_input(name: "a name", label: "My input group", value: "Some value")
50
50
  menu.with_trailing_action_icon(icon: :check, aria: { label: "Successful" })
51
51
  end
52
52
  end
@@ -54,7 +54,7 @@ module Primer
54
54
  # @label With a small input
55
55
  def small_input_width
56
56
  render(Primer::OpenProject::InputGroup.new(input_width: :small)) do |menu|
57
- menu.with_text_input(name: 'a name', label: 'My input group', value: "Some value")
57
+ menu.with_text_input(name: "a name", label: "My input group", value: "Some value")
58
58
  menu.with_trailing_action_clipboard_copy_button(id: "button-4", value: "Some value", aria: { label: "Copy some text" })
59
59
  end
60
60
  end
@@ -1,22 +1,25 @@
1
1
  <%= render(Primer::OpenProject::PageHeader.new) do |component| %>
2
- <% component.with_title(tag: :h1) do %>
3
- A title
2
+ <% component.with_title do %>
3
+ Great news
4
4
  <% end %>
5
5
  <% component.with_description do %>
6
- A description with actions
6
+ This example lists all possible actions of a PageHeader. Of course, you will most likely never need all of them on the same page as it is shown here.
7
7
  <% end %>
8
- <% component.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
- ) %>
8
+ <% component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]) %>
9
+ <% component.with_action_text { "An additional hint" } %>
10
+ <% component.with_action_link(mobile_icon: "link", mobile_label: "Community", href: "https://community.openproject.com", target: "_blank") { "Go to community" } %>
11
+ <% component.with_action_button(mobile_icon: "star", mobile_label: "Star") do |button|%>
12
+ <% button.with_leading_visual_icon(icon: "star") %>
13
+ Star
14
+ <% end %>
15
+ <% component.with_action_button(mobile_icon: nil, mobile_label: nil) { "Hide on mobile" } %>
16
+ <% component.with_action_icon_button(icon: "trash", mobile_icon: "trash", label: "Delete", scheme: :danger) %>
17
+ <% component.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "op-kebab-vertical", "aria-label": "Some actions" }) do |menu, button| %>
18
+ <% menu.with_item(label: "Subitem 1") do |item| %>
19
+ <% item.with_leading_visual_icon(icon: :paste) %>
20
+ <% end %>
21
+ <% menu.with_item(label: "Subitem 2") do |item| %>
22
+ <% item.with_leading_visual_icon(icon: :log) %>
19
23
  <% end %>
20
24
  <% end %>
21
25
  <% end %>
22
-
@@ -1,32 +1,17 @@
1
1
  <%= render Primer::OpenProject::PageHeader.new do |header| %>
2
2
  <%= header.with_title(variant: variant) { title } %>
3
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 %>
4
+ <%= header.with_leading_action(icon: with_leading_action, href: '#', 'aria-label': "A leading action") if with_leading_action && with_leading_action != :none %>
5
+ <%= header.with_breadcrumbs(breadcrumb_items) %>
7
6
  <% 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
- ) %>
7
+ <% header.with_action_icon_button(icon: 'pencil', mobile_icon: 'pencil', label: 'Edit') %>
8
+ <% header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "op-kebab-vertical", "aria-label": "Menu" }) do |menu, button| %>
9
+ <% menu.with_item(label: "Subitem 1") do |item| %>
10
+ <% item.with_leading_visual_icon(icon: :unlock) %>
11
+ <% end %>
12
+ <% menu.with_item(label: "Subitem 2", scheme: :danger) do |item| %>
13
+ <% item.with_leading_visual_icon(icon: :trash) %>
19
14
  <% 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
15
  <% end %>
31
16
  <% end %>
32
17
  <% end %>
@@ -8,9 +8,12 @@ module Primer
8
8
  # @label Default
9
9
  # @snapshot
10
10
  def default
11
+ breadcrumb_items = [{ href: "/foo", text: "Grandparent" }, { href: "/bar", text: "Parent" }, "Hello"]
12
+
11
13
  render(Primer::OpenProject::PageHeader.new) do |header|
12
14
  header.with_title { "Hello" }
13
15
  header.with_description { "Last updated 5 minutes ago by XYZ." }
16
+ header.with_breadcrumbs(breadcrumb_items)
14
17
  end
15
18
  end
16
19
 
@@ -18,42 +21,33 @@ module Primer
18
21
  # @param variant [Symbol] select [medium, large]
19
22
  # @param title [String] text
20
23
  # @param description [String] text
21
- # @param with_back_button [Boolean]
22
- # @param back_button_size [Symbol] select [small, medium, large]
23
- # @param with_breadcrumbs [Boolean]
24
+ # @param with_leading_action [Symbol] octicon
24
25
  # @param with_actions [Boolean]
25
- # @param with_context_bar_actions [Boolean]
26
- # @param with_parent_link [Boolean]
27
26
  def playground(
28
- variant: :large,
27
+ variant: :medium,
29
28
  title: "Hello",
30
29
  description: "Last updated 5 minutes ago by XYZ.",
31
- with_back_button: false,
32
- back_button_size: :medium,
33
- with_breadcrumbs: false,
34
- with_actions: false,
35
- with_context_bar_actions: false,
36
- with_parent_link: false
30
+ with_leading_action: :"none",
31
+ with_actions: true
37
32
  )
38
33
  breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
39
34
 
40
35
  render_with_template(locals: { variant: variant,
41
36
  title: title,
42
37
  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,
38
+ with_leading_action: with_leading_action,
47
39
  with_actions: with_actions,
48
- with_context_bar_actions: with_context_bar_actions,
49
40
  breadcrumb_items: breadcrumb_items })
50
41
  end
51
42
 
52
- # @label Medium title
53
- def medium_title
43
+ # @label Large title
44
+ def large_title
45
+ breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
46
+
54
47
  render(Primer::OpenProject::PageHeader.new) do |header|
55
- header.with_title(variant: :medium) { "Hello" }
48
+ header.with_title(variant: :large) { "Hello" }
56
49
  header.with_description { "Last updated 5 minutes ago by XYZ." }
50
+ header.with_breadcrumbs(breadcrumb_items)
57
51
  end
58
52
  end
59
53
 
@@ -62,25 +56,26 @@ module Primer
62
56
  render_with_template(locals: {})
63
57
  end
64
58
 
65
- # @label With back button (on wide)
66
- # **Back button** is only shown on **wider than narrow screens** by default.
59
+ # @label With leading action (on wide)
60
+ # **Leading action** is only shown on **wide screens** by default.
67
61
  # If you want to override that behaviour please use the system_argument: **display**
68
62
  # e.g. **component.with\_breadcrumbs(display: [:block, :block])**
69
63
  #
70
64
  # @param href [String] text
71
- # @param size [Symbol] select [small, medium, large]
72
- # @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
73
- def back_button(href: "#", size: :medium, icon: "arrow-left")
65
+ # @param icon [Symbol] octicon
66
+ def leading_action(href: "#", icon: :"arrow-left")
67
+ breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
68
+
74
69
  render(Primer::OpenProject::PageHeader.new) do |header|
75
70
  header.with_title { "Hello" }
76
- header.with_back_button(href: href, size: size, icon: icon, 'aria-label': "Back")
71
+ header.with_leading_action(icon: icon, href: href, 'aria-label': "Back")
72
+ header.with_breadcrumbs(breadcrumb_items)
77
73
  end
78
74
  end
79
75
 
80
- # @label With breadcrumbs (on wide)
76
+ # @label With breadcrumbs
81
77
  # **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])**
78
+ # A parent link is shown instead in narrow screens
84
79
  #
85
80
  def breadcrumbs
86
81
  breadcrumb_items = [
@@ -93,27 +88,6 @@ module Primer
93
88
  header.with_breadcrumbs(breadcrumb_items)
94
89
  end
95
90
  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
117
91
  end
118
92
  end
119
93
  end
@@ -249,9 +249,9 @@
249
249
  },
250
250
  {
251
251
  "name": "truncate_label",
252
- "type": "Boolean",
253
- "default": "`false`",
254
- "description": "Truncate label with ellipsis."
252
+ "type": "Boolean | Symbol",
253
+ "default": "`:none`",
254
+ "description": "How the label should be truncated when the text does not fit inside the bounds of the list item. One of `false`, `:none`, `:show_tooltip`, `:truncate`, or `true`. Pass `false` or `:none` to wrap label text. Pass `true` or `:truncate` to truncate labels with ellipses. Pass `:show_tooltip` to show the entire label contents in a tooltip when the item is hovered."
255
255
  },
256
256
  {
257
257
  "name": "href",
@@ -2494,7 +2494,7 @@
2494
2494
  "name": "full_width",
2495
2495
  "type": "Boolean",
2496
2496
  "default": "N/A",
2497
- "description": "When set to `true`, the field will take up all the horizontal space allowed by its container."
2497
+ "description": "When set to `true`, the field will take up all the horizontal space allowed by its container. Defaults to `true`."
2498
2498
  },
2499
2499
  {
2500
2500
  "name": "name",
@@ -2624,7 +2624,7 @@
2624
2624
  "name": "full_width",
2625
2625
  "type": "Boolean",
2626
2626
  "default": "N/A",
2627
- "description": "When set to `true`, the field will take up all the horizontal space allowed by its container."
2627
+ "description": "When set to `true`, the field will take up all the horizontal space allowed by its container. Defaults to `true`."
2628
2628
  },
2629
2629
  {
2630
2630
  "name": "name",
@@ -2814,13 +2814,13 @@
2814
2814
  "name": "size",
2815
2815
  "type": "Symbol",
2816
2816
  "default": "`:medium`",
2817
- "description": "What size toggle switch to render. One of `:end` or `:start`."
2817
+ "description": "What size toggle switch to render. One of `:medium` or `:small`."
2818
2818
  },
2819
2819
  {
2820
2820
  "name": "status_label_position",
2821
2821
  "type": "Symbol",
2822
2822
  "default": "`:start`",
2823
- "description": "Which side of the toggle switch to render the status label. One of `:medium` or `:small`."
2823
+ "description": "Which side of the toggle switch to render the status label. One of `:end` or `:start`."
2824
2824
  },
2825
2825
  {
2826
2826
  "name": "system_arguments",
@@ -4959,7 +4959,40 @@
4959
4959
  "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/page_header.rb",
4960
4960
  "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/page_header/default/",
4961
4961
  "parameters": [
4962
-
4962
+ {
4963
+ "name": "mobile_menu_label",
4964
+ "type": "String",
4965
+ "default": "`I18n.t(\"label_more\")`",
4966
+ "description": "The tooltip label of the mobile menu"
4967
+ },
4968
+ {
4969
+ "name": "system_arguments",
4970
+ "type": "Hash",
4971
+ "default": "N/A",
4972
+ "description": "[System arguments](/system-arguments)"
4973
+ }
4974
+ ]
4975
+ },
4976
+ {
4977
+ "component": "OpenProject::PageHeader::PageHeaderActionMenu",
4978
+ "status": "open_project",
4979
+ "a11y_reviewed": false,
4980
+ "short_name": "OpenProjectPageHeaderPageHeaderActionMenu",
4981
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/page_header/page_header_action_menu.rb",
4982
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/page_header/page_header_action_menu/default/",
4983
+ "parameters": [
4984
+ {
4985
+ "name": "menu_arguments",
4986
+ "type": "Hash",
4987
+ "default": "`{}`",
4988
+ "description": "The arguments accepted by [ActionMenu](/components/alpha/actionmenu)."
4989
+ },
4990
+ {
4991
+ "name": "button_arguments",
4992
+ "type": "Hash",
4993
+ "default": "`{}`",
4994
+ "description": "The arguments accepted by [Button](/components/beta/button) or [IconButton](/components/beta/iconbutton), depending on the value of the `icon:` argument."
4995
+ }
4963
4996
  ]
4964
4997
  },
4965
4998
  {
@@ -121,6 +121,7 @@
121
121
  "Primer::OpenProject::GridLayout::Area": "",
122
122
  "Primer::OpenProject::InputGroup": "",
123
123
  "Primer::OpenProject::PageHeader": "",
124
+ "Primer::OpenProject::PageHeader::PageHeaderActionMenu": "",
124
125
  "Primer::Tooltip": "",
125
126
  "Primer::Truncate": ""
126
127
  }
data/static/classes.json CHANGED
@@ -423,10 +423,10 @@
423
423
  "PageHeader": [
424
424
  "Primer::OpenProject::PageHeader"
425
425
  ],
426
- "PageHeader-actions": [
426
+ "PageHeader--singleAction": [
427
427
  "Primer::OpenProject::PageHeader"
428
428
  ],
429
- "PageHeader-backButton": [
429
+ "PageHeader-actions": [
430
430
  "Primer::OpenProject::PageHeader"
431
431
  ],
432
432
  "PageHeader-breadcrumbs": [
@@ -435,10 +435,10 @@
435
435
  "PageHeader-contextBar": [
436
436
  "Primer::OpenProject::PageHeader"
437
437
  ],
438
- "PageHeader-contextBarActions": [
438
+ "PageHeader-description": [
439
439
  "Primer::OpenProject::PageHeader"
440
440
  ],
441
- "PageHeader-description": [
441
+ "PageHeader-leadingAction": [
442
442
  "Primer::OpenProject::PageHeader"
443
443
  ],
444
444
  "PageHeader-parentLink": [