primer_view_components 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -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 +2 -2
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/heading.html.erb +1 -1
  8. data/app/components/primer/alpha/action_list/heading.rb +5 -3
  9. data/app/components/primer/alpha/action_list/item.html.erb +9 -0
  10. data/app/components/primer/alpha/action_list/item.rb +31 -10
  11. data/app/components/primer/alpha/action_list.css +1 -1
  12. data/app/components/primer/alpha/action_list.css.json +4 -41
  13. data/app/components/primer/alpha/action_list.css.map +1 -1
  14. data/app/components/primer/alpha/action_list.pcss +19 -20
  15. data/app/components/primer/alpha/action_list.rb +54 -6
  16. data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +22 -0
  17. data/app/components/primer/alpha/action_menu/action_menu_element.js +139 -0
  18. data/app/components/primer/alpha/action_menu/action_menu_element.ts +137 -0
  19. data/app/components/primer/alpha/action_menu/list.rb +81 -0
  20. data/app/components/primer/alpha/action_menu.html.erb +26 -0
  21. data/app/components/primer/alpha/action_menu.rb +322 -0
  22. data/app/components/primer/alpha/auto_complete.css.json +0 -11
  23. data/app/components/primer/alpha/banner.css.json +0 -14
  24. data/app/components/primer/alpha/button_marketing.css.json +0 -10
  25. data/app/components/primer/alpha/dialog.css.json +0 -63
  26. data/app/components/primer/alpha/dialog.rb +6 -2
  27. data/app/components/primer/alpha/dropdown.css.json +0 -21
  28. data/app/components/primer/alpha/layout.css.json +0 -27
  29. data/app/components/primer/alpha/menu.css.json +0 -11
  30. data/app/components/primer/alpha/nav_list/item.rb +5 -0
  31. data/app/components/primer/alpha/overlay.css +1 -1
  32. data/app/components/primer/alpha/overlay.css.json +0 -3
  33. data/app/components/primer/alpha/overlay.css.map +1 -1
  34. data/app/components/primer/alpha/overlay.pcss +1 -0
  35. data/app/components/primer/alpha/overlay.rb +14 -18
  36. data/app/components/primer/alpha/segmented_control.css.json +0 -15
  37. data/app/components/primer/alpha/tab_nav.css.json +0 -10
  38. data/app/components/primer/alpha/text_field.css.json +0 -38
  39. data/app/components/primer/alpha/toggle_switch.css.json +0 -16
  40. data/app/components/primer/alpha/underline_nav.css.json +0 -13
  41. data/app/components/primer/beta/avatar.css.json +0 -14
  42. data/app/components/primer/beta/avatar_stack.css.json +0 -9
  43. data/app/components/primer/beta/blankslate.css.json +0 -12
  44. data/app/components/primer/beta/border_box.css.json +0 -32
  45. data/app/components/primer/beta/border_box.rb +3 -3
  46. data/app/components/primer/beta/breadcrumbs.css.json +0 -4
  47. data/app/components/primer/beta/button.css +1 -1
  48. data/app/components/primer/beta/button.css.json +0 -22
  49. data/app/components/primer/beta/button.css.map +1 -1
  50. data/app/components/primer/beta/button.pcss +3 -3
  51. data/app/components/primer/beta/counter.css.json +0 -6
  52. data/app/components/primer/beta/flash.css.json +0 -15
  53. data/app/components/primer/beta/label.css.json +0 -20
  54. data/app/components/primer/beta/link.css.json +0 -8
  55. data/app/components/primer/beta/popover.css.json +0 -18
  56. data/app/components/primer/beta/progress_bar.css.json +0 -6
  57. data/app/components/primer/beta/state.css.json +0 -10
  58. data/app/components/primer/beta/subhead.css.json +0 -8
  59. data/app/components/primer/beta/timeline_item.css.json +0 -9
  60. data/app/components/primer/beta/truncate.css.json +0 -6
  61. data/app/components/primer/focus_group.d.ts +19 -0
  62. data/app/components/primer/focus_group.js +144 -0
  63. data/app/components/primer/focus_group.ts +137 -0
  64. data/app/components/primer/icon_button.rb +1 -1
  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/components/primer/truncate.css.json +0 -7
  69. data/app/lib/primer/css/layout.css.json +0 -263
  70. data/app/lib/primer/css/utilities.css.json +0 -1636
  71. data/lib/primer/static/generate_arguments.rb +55 -0
  72. data/lib/primer/static/generate_audited_at.rb +17 -0
  73. data/lib/primer/static/generate_constants.rb +19 -0
  74. data/lib/primer/static/generate_info_arch.rb +156 -0
  75. data/lib/primer/static/generate_previews.rb +45 -0
  76. data/lib/primer/static/generate_statuses.rb +17 -0
  77. data/lib/primer/static.rb +72 -0
  78. data/lib/primer/view_components/linters/disallow_component_css_counter.rb +43 -4
  79. data/lib/primer/view_components/version.rb +1 -1
  80. data/lib/primer/view_components.rb +0 -48
  81. data/lib/primer/yard/component_manifest.rb +1 -0
  82. data/lib/primer/yard/component_ref.rb +14 -0
  83. data/lib/primer/yard/docs_helper.rb +3 -0
  84. data/lib/primer/yard/info_arch_docs_helper.rb +31 -0
  85. data/lib/primer/yard/legacy_gatsby_backend.rb +3 -35
  86. data/lib/primer/yard/registry.rb +2 -1
  87. data/lib/primer/yard.rb +1 -0
  88. data/lib/tasks/docs.rake +10 -12
  89. data/lib/tasks/static.rake +20 -28
  90. data/previews/primer/alpha/action_list_preview.rb +4 -1
  91. data/previews/primer/alpha/action_menu_preview/align_end.html.erb +6 -0
  92. data/previews/primer/alpha/action_menu_preview/opens_dialog.html.erb +21 -0
  93. data/previews/primer/alpha/action_menu_preview.rb +238 -0
  94. data/previews/primer/alpha/dialog_preview/body_has_scrollbar_overflow.html.erb +2 -2
  95. data/previews/primer/alpha/dialog_preview/custom_header.html.erb +3 -3
  96. data/previews/primer/alpha/dialog_preview/nested_dialog.html.erb +4 -4
  97. data/previews/primer/alpha/dialog_preview/test.html.erb +3 -3
  98. data/previews/primer/alpha/dialog_preview/with_footer.html.erb +3 -3
  99. data/previews/primer/alpha/dialog_preview/with_form.html.erb +1 -1
  100. data/previews/primer/alpha/dialog_preview/with_text_input.html.erb +2 -2
  101. data/previews/primer/alpha/dialog_preview.rb +7 -2
  102. data/previews/primer/beta/auto_complete_item_preview.rb +1 -0
  103. data/static/arguments.json +3078 -1404
  104. data/static/audited_at.json +2 -0
  105. data/static/classes.json +576 -311
  106. data/static/constants.json +42 -2
  107. data/static/info_arch.json +8859 -0
  108. data/static/previews.json +221 -101
  109. data/static/statuses.json +2 -0
  110. metadata +23 -2
data/lib/primer/yard.rb CHANGED
@@ -6,6 +6,7 @@ module Primer
6
6
  autoload :ComponentManifest, "primer/yard/component_manifest"
7
7
  autoload :ComponentRef, "primer/yard/component_ref"
8
8
  autoload :DocsHelper, "primer/yard/docs_helper"
9
+ autoload :InfoArchDocsHelper, "primer/yard/info_arch_docs_helper"
9
10
  autoload :LegacyGatsbyBackend, "primer/yard/legacy_gatsby_backend"
10
11
  autoload :Registry, "primer/yard/registry"
11
12
  autoload :RendersManyHandler, "primer/yard/renders_many_handler"
data/lib/tasks/docs.rake CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  require "active_support/inflector"
4
4
 
5
+ task :init_pvc do
6
+ ENV["RAILS_ENV"] = "test"
7
+ ENV["VC_COMPAT_PATCH_ENABLED"] = "true"
8
+
9
+ require File.expand_path("./../../demo/config/environment.rb", __dir__)
10
+ Dir[File.expand_path("../../app/components/primer/**/*.rb", __dir__)].sort.each { |file| require file }
11
+ end
12
+
5
13
  namespace :docs do
6
14
  task :livereload do
7
15
  require "listen"
@@ -39,7 +47,7 @@ namespace :docs do
39
47
 
40
48
  manifest = Primer::Yard::ComponentManifest.where(published: true)
41
49
  backend = Primer::Yard::LegacyGatsbyBackend.new(registry, manifest)
42
- args_for_components, errors = backend.generate
50
+ errors = backend.generate
43
51
 
44
52
  unless errors.empty?
45
53
  puts "==============================================="
@@ -50,11 +58,7 @@ namespace :docs do
50
58
  puts "==============================================="
51
59
  puts "==============================================="
52
60
 
53
- raise
54
- end
55
-
56
- File.open("static/arguments.json", "w") do |f|
57
- f.puts JSON.pretty_generate(args_for_components)
61
+ raise
58
62
  end
59
63
 
60
64
  puts "Markdown compiled."
@@ -162,12 +166,6 @@ namespace :docs do
162
166
  end
163
167
  end
164
168
 
165
- task :init_pvc do
166
- ENV["RAILS_ENV"] = "test"
167
- require File.expand_path("./../../demo/config/environment.rb", __dir__)
168
- Dir[File.expand_path("../../app/components/primer/**/*.rb", __dir__)].sort.each { |file| require file }
169
- end
170
-
171
169
  task build_yard_registry: :init_pvc do
172
170
  require "primer/yard"
173
171
 
@@ -1,37 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :static do
4
- task :dump do
5
- ENV["RAILS_ENV"] = "test"
6
- require File.expand_path("./../../demo/config/environment.rb", __dir__)
7
- require "primer/view_components"
8
- require "lookbook"
9
- # Loads all components for `.descendants` to work properly
10
- Dir["./app/components/primer/**/*.rb"].sort.each { |file| require file }
4
+ task dump: [:dump_statuses, :dump_constants, :dump_audited_at, :dump_previews, :dump_arguments, :dump_info_arch]
11
5
 
12
- Primer::ViewComponents.dump(:statuses)
13
- Primer::ViewComponents.dump(:constants)
14
- Primer::ViewComponents.dump(:audited_at)
6
+ task dump_statuses: :init_pvc do
7
+ Primer::Static.dump(:statuses)
8
+ end
9
+
10
+ task dump_constants: :init_pvc do
11
+ Primer::Static.dump(:constants)
12
+ end
15
13
 
16
- previews = Lookbook.previews.map do |preview|
17
- {
18
- name: preview.name,
19
- lookup_path: preview.lookup_path,
20
- examples: preview.examples.map { |example|
21
- {
22
- inspect_path: example.url_path,
23
- preview_path: example.url_path.sub("/inspect/", "/preview/"),
24
- name: example.name
25
- }
26
- }
27
- }
28
- end
14
+ task dump_audited_at: :init_pvc do
15
+ Primer::Static.dump(:audited_at)
16
+ end
29
17
 
30
- require "json"
18
+ task dump_previews: :init_pvc do
19
+ Primer::Static.dump(:previews)
20
+ end
21
+
22
+ task dump_arguments: ["docs:build_yard_registry", :init_pvc] do
23
+ Primer::Static.dump(:arguments)
24
+ end
31
25
 
32
- File.open(File.join(Primer::ViewComponents::DEFAULT_STATIC_PATH, "previews.json"), "w") do |f|
33
- f.write(JSON.pretty_generate(previews))
34
- f.write($INPUT_RECORD_SEPARATOR)
35
- end
26
+ task dump_info_arch: ["docs:build_yard_registry", :dump_previews, :dump_arguments] do
27
+ Primer::Static.dump(:info_arch)
36
28
  end
37
29
  end
@@ -344,7 +344,10 @@ module Primer
344
344
  render(Primer::Alpha::ActionList.new(
345
345
  aria: { label: "List heading" }
346
346
  )) do |component|
347
- component.with_item(label: "Disabled item", href: "/", disabled: true)
347
+ component.with_item(label: "Disabled item", href: "/", disabled: true) do |item|
348
+ item.with_description { "Item description" }
349
+ item.with_leading_visual_icon(icon: :gear)
350
+ end
348
351
  end
349
352
  end
350
353
 
@@ -0,0 +1,6 @@
1
+ <div style="display: grid; place-content: center;">
2
+ <%= render(Primer::Alpha::ActionMenu.new(anchor_align: :end)) do |component| %>
3
+ <% component.with_show_button { "Menu" } %>
4
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
5
+ <% end %>
6
+ </div>
@@ -0,0 +1,21 @@
1
+ <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
2
+ <% component.with_show_button { "Menu" } %>
3
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
4
+ <% component.with_item(
5
+ label: "Show dialog",
6
+ tag: :button,
7
+ content_arguments: { "data-show-dialog-id": "my-dialog" },
8
+ value: "",
9
+ scheme: :danger
10
+ ) %>
11
+ <% end %>
12
+
13
+ <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: "Confirm deletion")) do |d| %>
14
+ <%= render(Primer::Alpha::Dialog::Body.new()) do %>
15
+ Are you sure you want to delete this?
16
+ <% end %>
17
+ <%= render(Primer::Alpha::Dialog::Footer.new()) do %>
18
+ <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
19
+ <%= render(Primer::Beta::Button.new(scheme: :danger)) { "Delete" } %>
20
+ <% end %>
21
+ <% end %>
@@ -0,0 +1,238 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # @label ActionMenu
6
+ class ActionMenuPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ #
9
+ # @param select_variant [Symbol] select [single, multiple, none]
10
+ # @param anchor_align [Symbol] select [start, center, end]
11
+ # @param anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
12
+ def playground(
13
+ select_variant: Primer::Alpha::ActionMenu::DEFAULT_SELECT_VARIANT, anchor_align: Primer::Alpha::Overlay::DEFAULT_ANCHOR_ALIGN, anchor_side: Primer::Alpha::Overlay::DEFAULT_ANCHOR_SIDE
14
+ )
15
+ render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, anchor_align: anchor_align, anchor_side: anchor_side)) do |menu|
16
+ menu.with_show_button { "Menu" }
17
+ menu.with_item(label: "Copy link", value: "")
18
+ menu.with_item(label: "Quote reply", value: "")
19
+ menu.with_item(label: "Reference in new issue", value: "")
20
+ menu.with_divider
21
+ menu.with_item(label: "Edit", value: "")
22
+ menu.with_item(label: "Delete", scheme: :danger, value: "")
23
+ end
24
+ end
25
+
26
+ # @label Default
27
+ #
28
+ def default
29
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
30
+ menu.with_show_button { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Menu" }
31
+ menu.with_item(label: "Copy link", value: "")
32
+ menu.with_item(label: "Quote reply", value: "")
33
+ menu.with_item(label: "Reference in new issue", value: "")
34
+ menu.with_divider
35
+ menu.with_item(label: "Edit", value: "") do |item|
36
+ item.with_description.with_content("Change settings")
37
+ end
38
+ menu.with_item(label: "Delete", scheme: :danger, value: "") do |item|
39
+ item.with_description.with_content("Sayonara")
40
+ end
41
+ end
42
+ end
43
+
44
+ # @label With icon button
45
+ #
46
+ def with_icon_button
47
+ render(Primer::Alpha::ActionMenu.new) do |menu|
48
+ menu.with_show_button(icon: :star, "aria-label": "Menu")
49
+ menu.with_item(label: "Does something", value: "")
50
+ end
51
+ end
52
+
53
+ # @label Single select
54
+ #
55
+ def single_select
56
+ render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu|
57
+ menu.with_show_button { "Menu" }
58
+ menu.with_item(label: "Fast forward", value: "")
59
+ menu.with_item(label: "Recursive", value: "")
60
+ menu.with_item(label: "Ours", value: "")
61
+ menu.with_item(label: "Resolve", value: "")
62
+ end
63
+ end
64
+
65
+ # @label Multiple select
66
+ #
67
+ def multiple_select
68
+ render(Primer::Alpha::ActionMenu.new(select_variant: :multiple)) do |menu|
69
+ menu.with_show_button { "Menu" }
70
+ menu.with_item(label: "langermank", description_scheme: :inline, value: "") do |item|
71
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/18661030?v=4", alt: "Katie Langerman")
72
+ item.with_description.with_content("Katie Langerman")
73
+ end
74
+ menu.with_item(label: "jonrohan", description_scheme: :inline, value: "") do |item|
75
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/54012?s=96&v=4", alt: "Jon Rohan")
76
+ item.with_description.with_content("Jon Rohan")
77
+ end
78
+ menu.with_item(label: "broccolinisoup", description_scheme: :inline, value: "") do |item|
79
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/1446503?v=4", alt: "Armağan Ersöz")
80
+ item.with_description.with_content("Armağan Ersöz")
81
+ end
82
+ end
83
+ end
84
+
85
+ # @label Links
86
+ #
87
+ def links
88
+ render(Primer::Alpha::ActionMenu.new) do |menu|
89
+ menu.with_show_button { "Menu" }
90
+ menu.with_item(label: "Settings", href: "/")
91
+ menu.with_item(label: "Your repositories", href: "/")
92
+ menu.with_item(label: "Disabled", href: "/", disabled: true)
93
+ end
94
+ end
95
+
96
+ # @label Single item selected
97
+ #
98
+ def single_selected_item
99
+ render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu|
100
+ menu.with_show_button { "Menu" }
101
+ menu.with_item(label: "Copy link", value: "")
102
+ menu.with_item(label: "Quote reply", active: true, value: "")
103
+ menu.with_item(label: "Reference in new issue", value: "")
104
+ end
105
+ end
106
+
107
+ # @label Single Select with Internal Label
108
+ #
109
+ def single_select_with_internal_label
110
+ render(Primer::Alpha::ActionMenu.new(select_variant: :single, dynamic_label: true, dynamic_label_prefix: "Menu")) do |menu|
111
+ menu.with_show_button { "Menu" }
112
+ menu.with_item(label: "Copy link", value: "")
113
+ menu.with_item(label: "Quote reply", active: true, value: "")
114
+ menu.with_item(label: "Reference in new issue", value: "")
115
+ end
116
+ end
117
+
118
+ # @label Multiple items selected
119
+ #
120
+ def multiple_selected_items
121
+ render(Primer::Alpha::ActionMenu.new(select_variant: :multiple)) do |menu|
122
+ menu.with_show_button { "Menu" }
123
+ menu.with_item(label: "langermank", description_scheme: :inline, value: "", active: true) do |item|
124
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/18661030?v=4", alt: "Katie Langerman")
125
+ item.with_description.with_content("Katie Langerman")
126
+ end
127
+ menu.with_item(label: "jonrohan", description_scheme: :inline, value: "") do |item|
128
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/54012?s=96&v=4", alt: "Jon Rohan")
129
+ item.with_description.with_content("Jon Rohan")
130
+ end
131
+ menu.with_item(label: "broccolinisoup", description_scheme: :inline, value: "", active: true) do |item|
132
+ item.with_leading_visual_avatar(src: "https://avatars.githubusercontent.com/u/1446503?v=4", alt: "Armağan Ersöz")
133
+ item.with_description.with_content("Armağan Ersöz")
134
+ end
135
+ end
136
+ end
137
+
138
+ # @label With deferred content
139
+ #
140
+ def with_deferred_content
141
+ render(Primer::Alpha::ActionMenu.new(menu_id: "deferred", src: UrlHelpers.action_menu_deferred_path)) do |menu|
142
+ menu.with_show_button { "Menu with deferred content" }
143
+ end
144
+ end
145
+
146
+ # @label With deferred preloaded content
147
+ #
148
+ def with_deferred_preloaded_content
149
+ render(Primer::Alpha::ActionMenu.new(menu_id: "deferred-preload", preload: true, src: UrlHelpers.action_menu_deferred_preload_path)) do |menu|
150
+ menu.with_show_button { "Menu with deferred and preloaded content" }
151
+ end
152
+ end
153
+
154
+ # @label With actions
155
+ #
156
+ def with_actions
157
+ render(Primer::Alpha::ActionMenu.new) do |component|
158
+ component.with_show_button { "Trigger" }
159
+ component.with_item(label: "Does something", tag: :button, classes: "do-something-js")
160
+ component.with_item(label: "Site", tag: :a, href: "/")
161
+ component.with_item(label: "Copy text", tag: :"clipboard-copy", value: "Text to copy")
162
+ end
163
+ end
164
+
165
+ # @label With disabled items
166
+ #
167
+ def with_disabled_items
168
+ render(Primer::Alpha::ActionMenu.new) do |component|
169
+ component.with_show_button { "Trigger" }
170
+ component.with_item(label: "Does something", tag: :button, value: "", disabled: true)
171
+ component.with_item(label: "Site", tag: :a, href: "/", disabled: true)
172
+ end
173
+ end
174
+
175
+ # @label Opens a dialog
176
+ #
177
+ def opens_dialog(menu_id: "menu-1")
178
+ render_with_template(locals: {
179
+ menu_id: menu_id
180
+ })
181
+ end
182
+
183
+ # @label Align end
184
+ #
185
+ def align_end(menu_id: "menu-1")
186
+ render_with_template(locals: {
187
+ menu_id: menu_id
188
+ })
189
+ end
190
+
191
+ # @label [Item] Block description
192
+ #
193
+ def block_description
194
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
195
+ menu.with_show_button { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Menu" }
196
+ menu.with_item(label: "Item label", value: "") do |item|
197
+ item.with_description.with_content("Block description")
198
+ end
199
+ end
200
+ end
201
+
202
+ # @label [Item] Inline description
203
+ #
204
+ def inline_description
205
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
206
+ menu.with_show_button { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Menu" }
207
+ menu.with_item(label: "Item label", value: "", description_scheme: :inline) do |item|
208
+ item.with_description.with_content("Inline description")
209
+ end
210
+ end
211
+ end
212
+
213
+ # @label [Item] Leading visual
214
+ #
215
+ def leading_visual
216
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1")) do |menu|
217
+ menu.with_show_button { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Menu" }
218
+ menu.with_item(label: "Item label", value: "", description_scheme: :inline) do |item|
219
+ item.with_leading_visual_icon(icon: :gear)
220
+ item.with_description.with_content("Inline description")
221
+ end
222
+ end
223
+ end
224
+
225
+ # @label [Item] Leading visual single select
226
+ #
227
+ def leading_visual_single_select
228
+ render(Primer::Alpha::ActionMenu.new(menu_id: "menu-1", select_variant: :single)) do |menu|
229
+ menu.with_show_button { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Menu" }
230
+ menu.with_item(label: "Item label", value: "", description_scheme: :inline) do |item|
231
+ item.with_leading_visual_icon(icon: :gear)
232
+ item.with_description.with_content("Inline description")
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end
@@ -1,8 +1,8 @@
1
1
  <div>
2
2
  <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
3
3
  <%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
4
- <% d.show_button { button_text } %>
5
- <% d.body do %>
4
+ <% d.with_show_button { button_text } %>
5
+ <% d.with_body do %>
6
6
  <p>Dialog</p>
7
7
  <% end %>
8
8
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
2
- <% d.header(show_divider: show_divider) do %>
2
+ <% d.with_header(show_divider: show_divider) do %>
3
3
  <button class="btn">Custom Header Controls</button>
4
4
  <% end %>
5
- <% d.show_button { button_text } %>
6
- <% d.body { "Hello World" } %>
5
+ <% d.with_show_button { button_text } %>
6
+ <% d.with_body { "Hello World" } %>
7
7
  <% end %>
@@ -1,12 +1,12 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
2
- <% d.show_button { button_text } %>
3
- <% d.body do %>
2
+ <% d.with_show_button { button_text } %>
3
+ <% d.with_body do %>
4
4
  <p>Dialog One!</p>
5
5
 
6
6
  <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
7
7
  <%= render(Primer::Alpha::Dialog.new(id: "dialog-two", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
8
- <% d.show_button { button_text } %>
9
- <% d.body do %>
8
+ <% d.with_show_button { button_text } %>
9
+ <% d.with_body do %>
10
10
  Dialog Two!
11
11
  <% end %>
12
12
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(title: title, subtitle: subtitle)) do |d| %>
2
- <% d.show_button { @button_text } %>
3
- <% d.body { "Content" } %>
4
- <% d.footer do %>
2
+ <% d.with_show_button { @button_text } %>
3
+ <% d.with_body { "Content" } %>
4
+ <% d.with_footer do %>
5
5
  render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" }
6
6
  <% end %>
7
7
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle)) do |d| %>
2
- <% d.show_button { button_text } %>
3
- <% d.body { "Content" } %>
4
- <% d.footer(show_divider: show_divider) do %>
2
+ <% d.with_show_button { button_text } %>
3
+ <% d.with_body { "Content" } %>
4
+ <% d.with_footer(show_divider: show_divider) do %>
5
5
  <%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
6
6
  <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" } %>
7
7
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle)) do |d| %>
2
- <% d.show_button { button_text } %>
2
+ <% d.with_show_button { button_text } %>
3
3
  <form class="pt-3">
4
4
  <%= render(Primer::Alpha::Dialog::Body.new) do %>
5
5
  This is a custom dialog with the body and footer wrapped in a form tag.
@@ -1,6 +1,6 @@
1
1
  <%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
2
- <% d.show_button { button_text } %>
3
- <% d.body do %>
2
+ <% d.with_show_button { button_text } %>
3
+ <% d.with_body do %>
4
4
  <p>Dialog One!</p>
5
5
 
6
6
  <form>
@@ -14,9 +14,14 @@ module Primer
14
14
  # @param visually_hide_title [Boolean] toggle
15
15
  # @param button_text [String] text
16
16
  # @param body_text [String] text
17
- def playground(title: "Test Dialog", subtitle: nil, size: :medium, button_text: "Show Dialog", body_text: "Content", position: :center, position_narrow: :fullscreen, visually_hide_title: false)
17
+ # @param icon [Symbol] octicon
18
+ def playground(title: "Test Dialog", subtitle: nil, size: :medium, button_text: "Show Dialog", body_text: "Content", position: :center, position_narrow: :fullscreen, visually_hide_title: false, icon: nil)
18
19
  render(Primer::Alpha::Dialog.new(title: title, subtitle: subtitle, size: size, position: position, position_narrow: position_narrow, visually_hide_title: visually_hide_title)) do |d|
19
- d.with_show_button { button_text }
20
+ if icon.present? && (icon != :none)
21
+ d.with_show_button(icon: icon, "aria-label": icon.to_s)
22
+ else
23
+ d.with_show_button { button_text }
24
+ end
20
25
  d.with_body { body_text }
21
26
  end
22
27
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Primer
4
4
  module Beta
5
+ # @component Primer::Beta::AutoComplete::Item
5
6
  # @label AutoCompleteItem
6
7
  class AutoCompleteItemPreview < ViewComponent::Preview
7
8
  # @label Playground