openproject-primer_view_components 0.10.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -0
  3. data/app/assets/javascripts/app/components/primer/primer.d.ts +1 -1
  4. data/app/assets/javascripts/primer_view_components.js +1 -1
  5. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  6. data/app/assets/styles/primer_view_components.css +1 -1
  7. data/app/assets/styles/primer_view_components.css.map +1 -1
  8. data/app/components/primer/alpha/action_menu/action_menu_element.js +2 -1
  9. data/app/components/primer/alpha/action_menu/action_menu_element.ts +2 -1
  10. data/app/components/primer/alpha/check_box_group.rb +2 -0
  11. data/app/components/primer/alpha/dialog/header.rb +12 -0
  12. data/app/components/primer/alpha/dialog.rb +1 -1
  13. data/app/components/primer/alpha/nav_list/divider.rb +2 -5
  14. data/app/components/primer/alpha/nav_list/group.rb +2 -98
  15. data/app/components/primer/alpha/nav_list/heading.rb +2 -27
  16. data/app/components/primer/alpha/nav_list/item.rb +2 -147
  17. data/app/components/primer/alpha/nav_list.rb +2 -205
  18. data/app/components/primer/alpha/overlay.css +1 -1
  19. data/app/components/primer/alpha/overlay.css.map +1 -1
  20. data/app/components/primer/alpha/overlay.pcss +1 -7
  21. data/app/components/primer/alpha/overlay.rb +6 -4
  22. data/app/components/primer/alpha/radio_button_group.rb +2 -0
  23. data/app/components/primer/alpha/text_field.css +1 -1
  24. data/app/components/primer/alpha/text_field.css.json +4 -1
  25. data/app/components/primer/alpha/text_field.css.map +1 -1
  26. data/app/components/primer/alpha/text_field.pcss +18 -3
  27. data/app/components/primer/alpha/tooltip.rb +3 -1
  28. data/app/components/primer/beta/button.css +1 -1
  29. data/app/components/primer/beta/button.css.json +2 -0
  30. data/app/components/primer/beta/button.css.map +1 -1
  31. data/app/components/primer/beta/button.pcss +11 -3
  32. data/app/components/primer/beta/icon_button.html.erb +1 -1
  33. data/app/components/primer/beta/icon_button.rb +8 -1
  34. data/app/components/primer/beta/link.css +1 -1
  35. data/app/components/primer/beta/link.css.json +1 -0
  36. data/app/components/primer/beta/link.css.map +1 -1
  37. data/app/components/primer/beta/link.pcss +5 -0
  38. data/app/components/primer/beta/link.rb +2 -2
  39. data/app/components/primer/beta/nav_list/divider.rb +14 -0
  40. data/app/components/primer/beta/nav_list/group.rb +107 -0
  41. data/app/components/primer/beta/nav_list/heading.rb +36 -0
  42. data/app/components/primer/beta/nav_list/item.rb +156 -0
  43. data/app/components/primer/beta/nav_list.rb +212 -0
  44. data/app/components/primer/focus_group.js +2 -1
  45. data/app/components/primer/focus_group.ts +2 -1
  46. data/app/components/primer/open_project/border_grid/cell.html.erb +3 -0
  47. data/app/components/primer/open_project/border_grid/cell.rb +25 -0
  48. data/app/components/primer/open_project/border_grid.css +1 -0
  49. data/app/components/primer/open_project/border_grid.css.json +11 -0
  50. data/app/components/primer/open_project/border_grid.css.map +1 -0
  51. data/app/components/primer/open_project/border_grid.html.erb +7 -0
  52. data/app/components/primer/open_project/border_grid.pcss +35 -0
  53. data/app/components/primer/open_project/border_grid.rb +36 -0
  54. data/app/components/primer/open_project/drag_handle.css +1 -0
  55. data/app/components/primer/open_project/drag_handle.css.json +6 -0
  56. data/app/components/primer/open_project/drag_handle.css.map +1 -0
  57. data/app/components/primer/open_project/drag_handle.html.erb +6 -0
  58. data/app/components/primer/open_project/drag_handle.pcss +6 -0
  59. data/app/components/primer/open_project/drag_handle.rb +28 -0
  60. data/app/components/primer/open_project/flex_layout.html.erb +23 -0
  61. data/app/components/primer/open_project/flex_layout.rb +52 -0
  62. data/app/components/primer/open_project/grid_layout/area.rb +38 -0
  63. data/app/components/primer/open_project/grid_layout.html.erb +11 -0
  64. data/app/components/primer/open_project/grid_layout.rb +34 -0
  65. data/app/components/primer/open_project/page_header.css +1 -1
  66. data/app/components/primer/open_project/page_header.css.map +1 -1
  67. data/app/components/primer/open_project/page_header.pcss +4 -0
  68. data/app/components/primer/primer.d.ts +1 -1
  69. data/app/components/primer/primer.js +1 -1
  70. data/app/components/primer/primer.pcss +2 -0
  71. data/app/components/primer/primer.ts +1 -1
  72. data/app/helpers/primer/form_helper.rb +10 -0
  73. data/lib/primer/deprecations.yml +20 -0
  74. data/lib/primer/forms/check_box_group.html.erb +3 -0
  75. data/lib/primer/forms/dsl/check_box_group_input.rb +1 -5
  76. data/lib/primer/forms/dsl/check_box_input.rb +5 -0
  77. data/lib/primer/forms/dsl/radio_button_input.rb +5 -0
  78. data/lib/primer/forms/form_control.html.erb +1 -4
  79. data/lib/primer/forms/radio_button_group.html.erb +3 -0
  80. data/lib/primer/forms/utils.rb +2 -0
  81. data/lib/primer/forms/validation_message.html.erb +4 -0
  82. data/lib/primer/forms/validation_message.rb +14 -0
  83. data/lib/primer/forms.rb +16 -0
  84. data/lib/primer/view_components/version.rb +2 -2
  85. data/lib/primer/yard/component_manifest.rb +4 -0
  86. data/previews/primer/alpha/check_box_group_preview.rb +13 -0
  87. data/previews/primer/alpha/dialog_preview/with_header.html.erb +5 -0
  88. data/previews/primer/alpha/dialog_preview.rb +17 -0
  89. data/previews/primer/alpha/overlay_preview.rb +1 -1
  90. data/previews/primer/alpha/radio_button_group_preview.rb +13 -0
  91. data/previews/primer/alpha/radio_button_preview.rb +1 -1
  92. data/previews/primer/alpha/text_field_preview/input_group_leading_action_menu.html.erb +21 -0
  93. data/previews/primer/alpha/text_field_preview/input_group_leading_button.html.erb +18 -0
  94. data/previews/primer/alpha/text_field_preview/input_group_trailing_button.html.erb +18 -0
  95. data/previews/primer/alpha/text_field_preview.rb +21 -0
  96. data/previews/primer/beta/button_preview.rb +1 -1
  97. data/previews/primer/{alpha → beta}/nav_list_preview/trailing_action.html.erb +1 -1
  98. data/previews/primer/{alpha → beta}/nav_list_preview.rb +5 -5
  99. data/previews/primer/open_project/border_grid_preview.rb +42 -0
  100. data/previews/primer/open_project/drag_handle_preview.rb +23 -0
  101. data/previews/primer/open_project/flex_layout_preview.rb +73 -0
  102. data/previews/primer/open_project/grid_layout_preview.rb +37 -0
  103. data/static/arguments.json +314 -6
  104. data/static/audited_at.json +11 -0
  105. data/static/classes.json +18 -0
  106. data/static/constants.json +48 -0
  107. data/static/info_arch.json +1867 -955
  108. data/static/previews.json +273 -7
  109. data/static/statuses.json +16 -5
  110. metadata +46 -11
  111. /data/app/assets/javascripts/app/components/primer/{alpha → beta}/nav_list.d.ts +0 -0
  112. /data/app/components/primer/{alpha → beta}/nav_list/group.html.erb +0 -0
  113. /data/app/components/primer/{alpha → beta}/nav_list/item.html.erb +0 -0
  114. /data/app/components/primer/{alpha → beta}/nav_list.d.ts +0 -0
  115. /data/app/components/primer/{alpha → beta}/nav_list.html.erb +0 -0
  116. /data/app/components/primer/{alpha → beta}/nav_list.js +0 -0
  117. /data/app/components/primer/{alpha → beta}/nav_list.ts +0 -0
@@ -0,0 +1,18 @@
1
+
2
+ <%= render(Primer::BaseComponent.new(tag: :div, flex_items: :center, display: :flex)) do %>
3
+ <%= render(Primer::Alpha::TextField.new(
4
+ name: "message",
5
+ placeholder: "What's happening?",
6
+ label: "What is your current status?",
7
+ classes: "rounded-right-0",
8
+ visually_hide_label: true,
9
+ value: "Some value",
10
+ inset: true,
11
+ )) %>
12
+ <%= render(Primer::Beta::IconButton.new(
13
+ classes: "rounded-left-0 border-left-0",
14
+ icon: :smiley,
15
+ aria: { label: "Emoji" }
16
+ )
17
+ ) %>
18
+ <% end %>
@@ -189,6 +189,27 @@ module Primer
189
189
  end
190
190
  #
191
191
  # @!endgroup
192
+
193
+ # @label Input group with leading button
194
+ #
195
+ # @snapshot
196
+ def input_group_leading_button
197
+ render_with_template
198
+ end
199
+
200
+ # @label Input group with trailing button
201
+ #
202
+ # @snapshot
203
+ def input_group_trailing_button
204
+ render_with_template
205
+ end
206
+
207
+ # @label Input group with ActionMenu
208
+ #
209
+ # @snapshot
210
+ def input_group_leading_action_menu(route_format: :html)
211
+ render_with_template(locals: { route_format: route_format })
212
+ end
192
213
  end
193
214
  end
194
215
  end
@@ -166,7 +166,7 @@ module Primer
166
166
  disabled: false
167
167
  )
168
168
  render_with_template(locals: {
169
- disabled: disabled,
169
+ disabled: disabled
170
170
  })
171
171
  end
172
172
 
@@ -1,4 +1,4 @@
1
- <%= render(Primer::Alpha::NavList.new(aria: { label: "Workflow results" })) do |list| %>
1
+ <%= render(Primer::Beta::NavList.new(aria: { label: "Workflow results" })) do |list| %>
2
2
  <% list.with_group do |group| %>
3
3
  <% group.with_heading(title: "Workflows") %>
4
4
  <% group.with_item(label: "Build and Test", href: "/workflows/1") do |item| %>
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- module Alpha
4
+ module Beta
5
5
  # @label NavList
6
6
  class NavListPreview < ViewComponent::Preview
7
7
  # @label Playground
8
8
  def playground
9
- render(Primer::Alpha::NavList.new(selected_item_id: :collaborators)) do |list|
9
+ render(Primer::Beta::NavList.new(selected_item_id: :collaborators)) do |list|
10
10
  list.with_heading(title: "Repository settings")
11
11
 
12
12
  list.with_item(label: "General", href: "/general") do |item|
@@ -34,7 +34,7 @@ module Primer
34
34
  # @label Default
35
35
  # @snapshot
36
36
  def default
37
- render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
37
+ render(Primer::Beta::NavList.new(selected_item_id: :code_review_limits)) do |list|
38
38
  list.with_heading(title: "Repository settings")
39
39
 
40
40
  list.with_item(label: "General", href: "/general") do |item|
@@ -77,7 +77,7 @@ module Primer
77
77
  # @label Top-level items
78
78
  #
79
79
  def top_level_items
80
- render(Primer::Alpha::NavList.new) do |list|
80
+ render(Primer::Beta::NavList.new) do |list|
81
81
  list.with_heading(title: "Account settings")
82
82
 
83
83
  list.with_item(label: "General", href: "/general") do |item|
@@ -105,7 +105,7 @@ module Primer
105
105
  # @label Show more item
106
106
  # @snapshot
107
107
  def show_more_item
108
- render(Primer::Alpha::NavList.new(aria: { label: "My favorite foods" })) do |list|
108
+ render(Primer::Beta::NavList.new(aria: { label: "My favorite foods" })) do |list|
109
109
  list.with_group do |group|
110
110
  group.with_heading(title: "My favorite foods")
111
111
  group.with_item(label: "Popplers", href: "/foods/popplers")
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Setup Playground to use all available component props
4
+ # Setup Features to use individual component props and combinations
5
+
6
+ module Primer
7
+ module OpenProject
8
+ # @label BorderGrid
9
+ class BorderGridPreview < ViewComponent::Preview
10
+
11
+ # @label Playground
12
+ # @param spacious [Boolean] toggle
13
+ def playground(spacious: false)
14
+ render(Primer::OpenProject::BorderGrid.new(spacious: spacious)) do |grid|
15
+ grid.with_row { "Block 1" }
16
+ grid.with_row { "Block 2" }
17
+ grid.with_row { "Block 3" }
18
+ end
19
+ end
20
+
21
+ # @label Default Options
22
+ #
23
+ # @snapshot
24
+ def default()
25
+ render(Primer::OpenProject::BorderGrid.new) do |grid|
26
+ grid.with_row { "Block 1" }
27
+ grid.with_row { "Block 2" }
28
+ grid.with_row { "Block 3" }
29
+ end
30
+ end
31
+
32
+ # @label Spacious
33
+ def spacious()
34
+ render(Primer::OpenProject::BorderGrid.new(spacious: true)) do |grid|
35
+ grid.with_row { "Block 1" }
36
+ grid.with_row { "Block 2" }
37
+ grid.with_row { "Block 3" }
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Setup Playground to use all available component props
4
+ # Setup Features to use individual component props and combinations
5
+
6
+ module Primer
7
+ module OpenProject
8
+ # @label DragHandle
9
+ class DragHandlePreview < ViewComponent::Preview
10
+ # @label Default
11
+ # @snapshot
12
+ def default(size: :small)
13
+ render(Primer::OpenProject::DragHandle.new(size: size))
14
+ end
15
+
16
+ # @label Playground
17
+ # @param size [Symbol] select [xsmall, small, medium]
18
+ def playground(size: :small)
19
+ render(Primer::OpenProject::DragHandle.new(size: size))
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Setup Playground to use all available component props
4
+ # Setup Features to use individual component props and combinations
5
+
6
+ module Primer
7
+ module OpenProject
8
+ # @label FlexLayout
9
+ class FlexLayoutPreview < ViewComponent::Preview
10
+ # @label Playground
11
+ # @param direction [Symbol] select [column, column_reverse, row, row_reverse]
12
+ # @param justify_content [Symbol] select [space_between, space_around, center, flex_start, flex_end]
13
+ def playground(direction: :row, justify_content: :flex_start)
14
+ render(Primer::OpenProject::FlexLayout.new(direction: direction, justify_content: justify_content)) do |component|
15
+ component.with_box(bg: :attention, p: 6) do
16
+ "Block 1"
17
+ end
18
+ component.with_box(bg: :accent, p: 6) do
19
+ "Block 2"
20
+ end
21
+ end
22
+ end
23
+
24
+ # @label Default
25
+ def default
26
+ render(Primer::OpenProject::FlexLayout.new) do |component|
27
+ component.with_column(bg: :attention, p: 6) do
28
+ "Block 1"
29
+ end
30
+ component.with_column(bg: :accent, p: 6) do
31
+ "Block 2"
32
+ end
33
+ end
34
+ end
35
+
36
+ # @label Row layout
37
+ def row_layout
38
+ render(Primer::OpenProject::FlexLayout.new) do |component|
39
+ component.with_row(bg: :attention, p: 6) do
40
+ "Block 1"
41
+ end
42
+ component.with_row(bg: :accent, p: 6) do
43
+ "Block 2"
44
+ end
45
+ end
46
+ end
47
+
48
+ # @label Column layout
49
+ def column_layout
50
+ render(Primer::OpenProject::FlexLayout.new) do |component|
51
+ component.with_column(bg: :attention, p: 6) do
52
+ "Block 1"
53
+ end
54
+ component.with_column(bg: :accent, p: 6) do
55
+ "Block 2"
56
+ end
57
+ end
58
+ end
59
+
60
+ # @label Nested layout
61
+ def nested_layout
62
+ render(Primer::OpenProject::FlexLayout.new) do |component|
63
+ component.with_row(flex_layout: true) do |flex_child|
64
+ flex_child.with_column(bg: :attention, p: 3) { "Block 1" }
65
+ flex_child.with_column(bg: :success, p: 3) { "Block 2" }
66
+ end
67
+
68
+ component.with_row(bg: :accent, p: 6) { "Block 3" }
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Setup Playground to use all available component props
4
+ # Setup Features to use individual component props and combinations
5
+
6
+ module Primer
7
+ module OpenProject
8
+ # @label GridLayout
9
+ class GridLayoutPreview < ViewComponent::Preview
10
+ # @label Playground
11
+ def playground
12
+ render(Primer::OpenProject::GridLayout.new(css_class: "grid-layout", tag: :div)) do |component|
13
+ component.with_area(:area1, bg: :attention, p: 6) do
14
+ "Block 1"
15
+ end
16
+ component.with_area(:area2, bg: :accent, p: 6) do
17
+ "Block 2"
18
+ end
19
+ end
20
+ end
21
+
22
+ # The component can be used for easy layouting of multiple child components.
23
+ # The component sets classes as well the grid-area definitions. The actual grid template can then be defined a separate CSS file.
24
+ # @label Default
25
+ def default
26
+ render(Primer::OpenProject::GridLayout.new(css_class: "grid-layout", tag: :div)) do |component|
27
+ component.with_area(:area1, bg: :attention, p: 6) do
28
+ "Block 1"
29
+ end
30
+ component.with_area(:area2, bg: :accent, p: 6) do
31
+ "Block 2"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end