openproject-primer_view_components 0.17.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +49 -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_list/item.rb +13 -1
  12. data/app/components/primer/alpha/action_list.css +1 -1
  13. data/app/components/primer/alpha/action_list.css.json +1 -0
  14. data/app/components/primer/alpha/action_list.css.map +1 -1
  15. data/app/components/primer/alpha/action_list.pcss +3 -1
  16. data/app/components/primer/alpha/action_list.rb +5 -4
  17. data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +20 -0
  18. data/app/components/primer/alpha/action_menu/action_menu_element.js +85 -11
  19. data/app/components/primer/alpha/action_menu/action_menu_element.ts +110 -12
  20. data/app/components/primer/alpha/action_menu/group.rb +23 -0
  21. data/app/components/primer/alpha/action_menu/heading.rb +17 -0
  22. data/app/components/primer/alpha/action_menu/list.html.erb +1 -0
  23. data/app/components/primer/alpha/action_menu/list.rb +62 -51
  24. data/app/components/primer/alpha/action_menu/list_wrapper.rb +40 -0
  25. data/app/components/primer/alpha/action_menu.rb +38 -1
  26. data/app/components/primer/alpha/overlay.css +1 -1
  27. data/app/components/primer/alpha/overlay.css.json +2 -1
  28. data/app/components/primer/alpha/overlay.css.map +1 -1
  29. data/app/components/primer/alpha/overlay.pcss +6 -2
  30. data/app/components/primer/alpha/text_field.css +1 -1
  31. data/app/components/primer/alpha/text_field.css.map +1 -1
  32. data/app/components/primer/alpha/text_field.pcss +3 -3
  33. data/app/components/primer/alpha/tool_tip.js +8 -4
  34. data/app/components/primer/alpha/tool_tip.ts +9 -4
  35. data/app/components/primer/beta/auto_complete/auto_complete.html.erb +1 -7
  36. data/app/components/primer/beta/auto_complete/item.rb +1 -1
  37. data/app/components/primer/beta/auto_complete.rb +6 -1
  38. data/app/components/primer/beta/base_button.rb +2 -3
  39. data/app/components/primer/beta/blankslate.css +1 -1
  40. data/app/components/primer/beta/blankslate.css.map +1 -1
  41. data/app/components/primer/beta/blankslate.pcss +3 -3
  42. data/app/components/primer/beta/border_box.rb +3 -0
  43. data/app/components/primer/beta/button.css +1 -1
  44. data/app/components/primer/beta/button.css.json +9 -8
  45. data/app/components/primer/beta/button.css.map +1 -1
  46. data/app/components/primer/beta/button.pcss +15 -11
  47. data/app/components/primer/beta/nav_list/group.html.erb +7 -5
  48. data/app/components/primer/beta/nav_list/group.rb +2 -2
  49. data/app/components/primer/beta/nav_list.d.ts +0 -11
  50. data/app/components/primer/beta/nav_list.js +2 -85
  51. data/app/components/primer/beta/nav_list.ts +1 -85
  52. data/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
  53. data/app/components/primer/beta/nav_list_group_element.js +108 -0
  54. data/app/components/primer/beta/nav_list_group_element.ts +97 -0
  55. data/app/components/primer/beta/relative_time.rb +4 -4
  56. data/app/components/primer/component.rb +3 -0
  57. data/app/components/primer/open_project/input_group.css +1 -0
  58. data/app/components/primer/open_project/input_group.css.json +11 -0
  59. data/app/components/primer/open_project/input_group.css.map +1 -0
  60. data/app/components/primer/open_project/input_group.html.erb +4 -0
  61. data/app/components/primer/open_project/input_group.pcss +25 -0
  62. data/app/components/primer/open_project/input_group.rb +93 -0
  63. data/app/components/primer/primer.d.ts +1 -0
  64. data/app/components/primer/primer.js +1 -0
  65. data/app/components/primer/primer.pcss +1 -0
  66. data/app/components/primer/primer.ts +1 -0
  67. data/app/lib/primer/experimental_render_helpers.rb +32 -0
  68. data/app/lib/primer/experimental_slot_helpers.rb +30 -0
  69. data/lib/primer/view_components/version.rb +2 -2
  70. data/lib/primer/yard/lookbook_pages_backend.rb +2 -2
  71. data/previews/primer/alpha/action_menu_preview.rb +73 -7
  72. data/previews/primer/alpha/dialog_preview/with_auto_complete.html.erb +8 -0
  73. data/previews/primer/alpha/dialog_preview.rb +17 -0
  74. data/previews/primer/beta/blankslate_preview/inside_flex_container.html.erb +6 -0
  75. data/previews/primer/beta/blankslate_preview.rb +3 -0
  76. data/previews/primer/beta/border_box_preview.rb +3 -2
  77. data/previews/primer/beta/nav_list_preview.rb +10 -1
  78. data/previews/primer/open_project/input_group_preview.rb +63 -0
  79. data/static/arguments.json +108 -1
  80. data/static/audited_at.json +5 -1
  81. data/static/classes.json +6 -0
  82. data/static/constants.json +28 -0
  83. data/static/info_arch.json +365 -52
  84. data/static/previews.json +112 -0
  85. data/static/statuses.json +4 -0
  86. metadata +21 -2
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module OpenProject
5
+ # `InputGroup` is composed of a text field input with a trailing action
6
+ class InputGroup < Primer::Component
7
+ status :open_project
8
+
9
+ DEFAULT_INPUT_WIDTH = :auto
10
+ INPUT_WIDTH_MAPPINGS = {
11
+ DEFAULT_INPUT_WIDTH => "InputGroup-input-width--auto",
12
+ :small => "InputGroup-input-width--small",
13
+ :medium => "InputGroup-input-width--medium",
14
+ :large => "InputGroup-input-width--large",
15
+ :xlarge => "InputGroup-input-width--xlarge",
16
+ :xxlarge => "InputGroup-input-width--xxlarge"
17
+ }.freeze
18
+ INPUT_WIDTH_OPTIONS = INPUT_WIDTH_MAPPINGS.keys
19
+
20
+ # A component that will render to the right of the label.
21
+ #
22
+ # To render a clipboardCopyButton, call the `with_trailing_action_clipboard_copy_button` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::ClipboardCopyButton) %>.
23
+ #
24
+ # To render an iconButton, call the `with_trailing_action_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Octicon) %>.
25
+ renders_one :trailing_action, types: {
26
+ clipboard_copy_button: lambda { |**system_arguments, &block|
27
+ system_arguments[:classes] = class_names(
28
+ system_arguments[:classes],
29
+ "rounded-left-0 border-left-0"
30
+ )
31
+ Primer::Beta::ClipboardCopyButton.new(**system_arguments, &block)
32
+ },
33
+ icon: lambda { |icon: nil, **system_arguments, &block|
34
+ system_arguments[:classes] = class_names(
35
+ system_arguments[:classes],
36
+ "rounded-left-0 border-left-0"
37
+ )
38
+ Primer::Beta::IconButton.new(icon: icon, **system_arguments, &block)
39
+ }
40
+ }
41
+
42
+ # Input that is the central part of the input group
43
+ #
44
+ # Since the central use case of this component is a copyClipboard Button next to the input, it is readonly by default
45
+ #
46
+ # @param readonly [Boolean] Shall the text field be editable.
47
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
48
+ renders_one :text_input, lambda { |readonly: true, **system_arguments|
49
+ deny_single_argument(:input_width, "Set the `input_width` on the `InputGroup`", **system_arguments)
50
+ system_arguments[:input_width] = @system_arguments[:input_width]
51
+
52
+ system_arguments[:classes] = class_names(
53
+ system_arguments[:classes],
54
+ "rounded-right-0"
55
+ )
56
+
57
+ if readonly
58
+ system_arguments[:readonly] = readonly
59
+ system_arguments[:aria] = merge_aria(
60
+ system_arguments,
61
+ { aria: { readonly: "true" } }
62
+ )
63
+ end
64
+
65
+ Primer::Alpha::TextField.new(**system_arguments)
66
+ }
67
+
68
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
69
+ def initialize(**system_arguments)
70
+ @system_arguments = system_arguments
71
+ @system_arguments[:tag] = :div
72
+ @system_arguments[:display] = :flex
73
+ @system_arguments[:align_items] = :flex_end
74
+
75
+ @system_arguments[:input_width] = fetch_or_fallback(
76
+ Primer::OpenProject::InputGroup::INPUT_WIDTH_OPTIONS,
77
+ @system_arguments[:input_width] || Primer::OpenProject::InputGroup::DEFAULT_INPUT_WIDTH,
78
+ Primer::OpenProject::InputGroup::DEFAULT_INPUT_WIDTH
79
+ )
80
+
81
+ system_arguments[:classes] = class_names(
82
+ system_arguments[:classes],
83
+ "InputGroup",
84
+ INPUT_WIDTH_MAPPINGS[@system_arguments[:input_width]]
85
+ )
86
+ end
87
+
88
+ def render?
89
+ text_input? && trailing_action?
90
+ end
91
+ end
92
+ end
93
+ end
@@ -6,6 +6,7 @@ import './focus_group';
6
6
  import './alpha/image_crop';
7
7
  import './alpha/modal_dialog';
8
8
  import './beta/nav_list';
9
+ import './beta/nav_list_group_element';
9
10
  import './alpha/segmented_control';
10
11
  import './alpha/toggle_switch';
11
12
  import './alpha/tool_tip';
@@ -6,6 +6,7 @@ import './focus_group';
6
6
  import './alpha/image_crop';
7
7
  import './alpha/modal_dialog';
8
8
  import './beta/nav_list';
9
+ import './beta/nav_list_group_element';
9
10
  import './alpha/segmented_control';
10
11
  import './alpha/toggle_switch';
11
12
  import './alpha/tool_tip';
@@ -43,3 +43,4 @@
43
43
  @import "./open_project/page_header.pcss";
44
44
  @import "./open_project/drag_handle.pcss";
45
45
  @import "./open_project/border_grid.pcss";
46
+ @import "./open_project/input_group.pcss";
@@ -6,6 +6,7 @@ import './focus_group'
6
6
  import './alpha/image_crop'
7
7
  import './alpha/modal_dialog'
8
8
  import './beta/nav_list'
9
+ import './beta/nav_list_group_element'
9
10
  import './alpha/segmented_control'
10
11
  import './alpha/toggle_switch'
11
12
  import './alpha/tool_tip'
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # :nodoc:
5
+ module ExperimentalRenderHelpers
6
+ def self.included(base)
7
+ base.include(InstanceMethods)
8
+ end
9
+
10
+ # :nodoc:
11
+ module InstanceMethods
12
+ def evaluate_block(*args, **kwargs, &block)
13
+ # Prevent double renders by using the capture method on the component
14
+ # that originally received the block.
15
+ #
16
+ # Handle blocks that originate from C code such as `&:method` by checking
17
+ # source_location. Such blocks don't allow access to their receiver.
18
+ return unless block
19
+
20
+ return yield(*args, **kwargs) if block&.source_location.nil?
21
+
22
+ block_context = block.binding.receiver
23
+
24
+ if block_context.class < ActionView::Base
25
+ block_context.capture(*args, &block)
26
+ else
27
+ capture(*args, &block)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # :nodoc:
5
+ module ExperimentalSlotHelpers
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ # :nodoc:
11
+ module ClassMethods
12
+ def add_polymorphic_slot_type(slot_name:, type:, callable:)
13
+ slot_def = registered_slots[slot_name]
14
+ raise "Unknown slot '#{slot_name}'" unless slot_def
15
+
16
+ poly_def = define_slot(
17
+ type,
18
+ collection: slot_def[:collection],
19
+ callable: callable
20
+ )
21
+
22
+ registered_slots[slot_name][:renderable_hash][type] = poly_def
23
+
24
+ define_method(:"with_#{type}") do |**system_arguments, &block|
25
+ set_slot(slot_name, poly_def, **system_arguments, &block)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 17
9
- PATCH = 1
8
+ MINOR = 19
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -218,8 +218,8 @@ module Primer
218
218
  path, <<~ERB
219
219
  #{YAML.dump(frontmatter)}
220
220
  ---
221
- <%= @page.data[:description_md] %>
222
- <%= @page.data[:args_md] %>
221
+ <%= @page.data[:description_md].html_safe %>
222
+ <%= @page.data[:args_md].html_safe %>
223
223
  ERB
224
224
  )
225
225
  end
@@ -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
+ <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
@@ -8,8 +8,9 @@ module Primer
8
8
  #
9
9
  # @param padding [Symbol] select [default, condensed, spacious]
10
10
  # @param scheme [Symbol] select [default, neutral, info, warning]
11
- def playground(padding: :default, scheme: :default)
12
- render(Primer::Beta::BorderBox.new(padding: padding)) do |component|
11
+ # @param list_id [String] text
12
+ def playground(padding: :default, scheme: :default, list_id: nil)
13
+ render(Primer::Beta::BorderBox.new(padding: padding, list_id: list_id)) do |component|
13
14
  component.with_header { "Header" }
14
15
  component.with_body { "Body" }
15
16
  component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row one" }
@@ -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
 
@@ -0,0 +1,63 @@
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 InputGroup
9
+ class InputGroupPreview < ViewComponent::Preview
10
+ # @label Default
11
+ # @snapshot
12
+ def default
13
+ render(Primer::OpenProject::InputGroup.new) do |menu|
14
+ menu.with_text_input(name: 'a name', label: 'My input group', value: "Copyable value")
15
+ menu.with_trailing_action_clipboard_copy_button(id: "button", value: "Copyable value", aria: { label: "Copy some text" })
16
+ end
17
+ end
18
+
19
+ # @label Playground
20
+ # @param trailing_action [Symbol] select [clipboardCopy, icon]
21
+ # @param value [String]
22
+ # @param visually_hide_label toggle
23
+ # @param readonly toggle
24
+ # @param input_width [Symbol] select [auto, small, medium, large, xlarge, xxlarge]
25
+ def playground(
26
+ trailing_action: :clipboardCopy,
27
+ value: 'Copyable value',
28
+ visually_hide_label: false,
29
+ readonly: true,
30
+ input_width: :medium
31
+ )
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)
34
+
35
+ case trailing_action
36
+ when :icon
37
+ menu.with_trailing_action_icon(icon: :check, aria: { label: "Successful" })
38
+ when :clipboardCopy
39
+ menu.with_trailing_action_clipboard_copy_button(id: "button-2", value: value, aria: { label: "Copy some text" })
40
+ else
41
+ menu.with_trailing_action_clipboard_copy_button(id: "button-3", value: value, aria: { label: "Copy some text" })
42
+ end
43
+ end
44
+ end
45
+
46
+ # @label With icon button
47
+ def icon_button
48
+ render(Primer::OpenProject::InputGroup.new) do |menu|
49
+ menu.with_text_input(name: 'a name', label: 'My input group', value: "Some value")
50
+ menu.with_trailing_action_icon(icon: :check, aria: { label: "Successful" })
51
+ end
52
+ end
53
+
54
+ # @label With a small input
55
+ def small_input_width
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")
58
+ menu.with_trailing_action_clipboard_copy_button(id: "button-4", value: "Some value", aria: { label: "Copy some text" })
59
+ end
60
+ end
61
+ end
62
+ end
63
+ 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",
@@ -4810,6 +4901,22 @@
4810
4901
  }
4811
4902
  ]
4812
4903
  },
4904
+ {
4905
+ "component": "OpenProject::InputGroup",
4906
+ "status": "open_project",
4907
+ "a11y_reviewed": false,
4908
+ "short_name": "OpenProjectInputGroup",
4909
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/input_group.rb",
4910
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/input_group/default/",
4911
+ "parameters": [
4912
+ {
4913
+ "name": "system_arguments",
4914
+ "type": "Hash",
4915
+ "default": "N/A",
4916
+ "description": "[System arguments](/system-arguments)"
4917
+ }
4918
+ ]
4919
+ },
4813
4920
  {
4814
4921
  "component": "OpenProject::PageHeader",
4815
4922
  "status": "open_project",
@@ -8,7 +8,10 @@
8
8
  "Primer::Alpha::ActionList::Heading": "",
9
9
  "Primer::Alpha::ActionList::Item": "",
10
10
  "Primer::Alpha::ActionMenu": "",
11
- "Primer::Alpha::ActionMenu::List": "2023-07-10",
11
+ "Primer::Alpha::ActionMenu::Group": "2023-07-10",
12
+ "Primer::Alpha::ActionMenu::Heading": "",
13
+ "Primer::Alpha::ActionMenu::List": "",
14
+ "Primer::Alpha::ActionMenu::ListWrapper": "2023-07-10",
12
15
  "Primer::Alpha::AutoComplete": "",
13
16
  "Primer::Alpha::AutoComplete::Item": "",
14
17
  "Primer::Alpha::Banner": "",
@@ -115,6 +118,7 @@
115
118
  "Primer::OpenProject::FlexLayout": "",
116
119
  "Primer::OpenProject::GridLayout": "",
117
120
  "Primer::OpenProject::GridLayout::Area": "",
121
+ "Primer::OpenProject::InputGroup": "",
118
122
  "Primer::OpenProject::PageHeader": "",
119
123
  "Primer::Tooltip": "",
120
124
  "Primer::Truncate": ""
data/static/classes.json CHANGED
@@ -191,6 +191,9 @@
191
191
  "Button--iconOnly": [
192
192
  "Primer::Beta::Button"
193
193
  ],
194
+ "Button--inactive": [
195
+ "Primer::Beta::Button"
196
+ ],
194
197
  "Button--invisible": [
195
198
  "Primer::Beta::Button"
196
199
  ],
@@ -302,6 +305,9 @@
302
305
  "FormControl-toggleSwitchInput": [
303
306
  "Primer::Alpha::TextField"
304
307
  ],
308
+ "InputGroup": [
309
+ "Primer::OpenProject::InputGroup"
310
+ ],
305
311
  "Label": [
306
312
  "Primer::Beta::Label"
307
313
  ],