openproject-primer_view_components 0.20.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/app/assets/javascripts/app/components/primer/dialog_helper.d.ts +15 -0
- data/app/assets/javascripts/app/components/primer/primer.d.ts +1 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +11 -33
- data/app/components/primer/alpha/action_menu/action_menu_element.js +8 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +8 -0
- data/app/components/primer/alpha/action_menu.rb +3 -1
- data/app/components/primer/alpha/banner.rb +7 -3
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +12 -27
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.html.erb +2 -2
- data/app/components/primer/alpha/dialog.pcss +78 -143
- data/app/components/primer/alpha/dialog.rb +10 -13
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +1 -0
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +1 -1
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +0 -4
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +1 -18
- data/app/components/primer/alpha/segmented_control.rb +0 -1
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/base_component.rb +1 -1
- data/app/components/primer/dialog_helper.d.ts +15 -0
- data/app/components/primer/dialog_helper.js +88 -0
- data/app/components/primer/dialog_helper.ts +92 -0
- data/app/components/primer/open_project/page_header.rb +3 -3
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/lib/primer/classify/utilities.rb +1 -1
- data/lib/primer/deprecations.yml +3 -3
- data/lib/primer/forms/dsl/button_input.rb +4 -0
- data/lib/primer/forms/dsl/check_box_input.rb +6 -0
- data/lib/primer/forms/dsl/hidden_input.rb +4 -0
- data/lib/primer/forms/dsl/input.rb +7 -3
- data/lib/primer/forms/dsl/radio_button_input.rb +6 -0
- data/lib/primer/forms/dsl/select_input.rb +3 -1
- data/lib/primer/forms/dsl/submit_button_input.rb +4 -0
- data/lib/primer/forms/form_control.html.erb +3 -1
- data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/docs_helper.rb +1 -1
- data/previews/primer/alpha/dialog_preview/nested_dialog.html.erb +1 -1
- data/previews/primer/alpha/dialog_preview/scroll_container.html.erb +35 -0
- data/previews/primer/alpha/dialog_preview.rb +61 -1
- data/previews/primer/alpha/segmented_control_preview.rb +1 -52
- data/previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb +2 -3
- data/previews/primer/alpha/tooltip_preview.rb +1 -1
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -1
- data/previews/primer/beta/button_preview.rb +4 -2
- data/previews/primer/forms_preview/custom_width_fields_form.html.erb +2 -0
- data/previews/primer/open_project/page_header_preview.rb +4 -4
- data/static/arguments.json +12 -0
- data/static/classes.json +5 -23
- data/static/constants.json +19 -15
- data/static/info_arch.json +67 -68
- data/static/previews.json +54 -67
- metadata +8 -3
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, position: position, subtitle: subtitle, visually_hide_title: false)) do |d| %>
|
2
|
+
<% d.with_show_button { button_text } %>
|
3
|
+
<% d.with_body { body_text} %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<!-- just some lorem ipsum -->
|
7
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
8
|
+
|
9
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
10
|
+
|
11
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
12
|
+
|
13
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
14
|
+
|
15
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|
16
|
+
|
17
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
18
|
+
|
19
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
20
|
+
|
21
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
22
|
+
|
23
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
24
|
+
|
25
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|
26
|
+
|
27
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
28
|
+
|
29
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
30
|
+
|
31
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
32
|
+
|
33
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
34
|
+
|
35
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|
@@ -128,10 +128,12 @@ module Primer
|
|
128
128
|
# @param subtitle [String] text
|
129
129
|
# @param button_text [String] text
|
130
130
|
# @param show_divider [Boolean] toggle
|
131
|
-
|
131
|
+
# @param position [Symbol] select [center, left, right]
|
132
|
+
def nested_dialog(title: "Test Dialog", subtitle: nil, position: :center, button_text: "Show Dialog", show_divider: true)
|
132
133
|
render_with_template(locals: {
|
133
134
|
title: title,
|
134
135
|
subtitle: subtitle,
|
136
|
+
position: position,
|
135
137
|
button_text: button_text,
|
136
138
|
show_divider: show_divider
|
137
139
|
})
|
@@ -188,6 +190,64 @@ module Primer
|
|
188
190
|
def autofocus_element
|
189
191
|
render_with_template(locals: {})
|
190
192
|
end
|
193
|
+
|
194
|
+
# @label Left Side
|
195
|
+
#
|
196
|
+
# @param title [String] text
|
197
|
+
# @param subtitle [String] text
|
198
|
+
# @param size [Symbol] select [small, medium, medium_portrait, large, xlarge]
|
199
|
+
# @param position_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
200
|
+
# @param visually_hide_title [Boolean] toggle
|
201
|
+
# @param button_text [String] text
|
202
|
+
# @param body_text [String] text
|
203
|
+
# @snapshot interactive
|
204
|
+
def left_side(title: "Test Dialog", subtitle: nil, size: :medium, button_text: "Show Dialog", body_text: "Content", position: :center, position_narrow: :fullscreen, visually_hide_title: false)
|
205
|
+
render(Primer::Alpha::Dialog.new(title: title, subtitle: subtitle, size: size, position: :left, position_narrow: position_narrow, visually_hide_title: visually_hide_title)) do |d|
|
206
|
+
d.with_show_button { button_text }
|
207
|
+
d.with_body { body_text }
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# @label Right Side
|
212
|
+
#
|
213
|
+
# @param title [String] text
|
214
|
+
# @param subtitle [String] text
|
215
|
+
# @param size [Symbol] select [small, medium, medium_portrait, large, xlarge]
|
216
|
+
# @param position_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
217
|
+
# @param visually_hide_title [Boolean] toggle
|
218
|
+
# @param button_text [String] text
|
219
|
+
# @param body_text [String] text
|
220
|
+
# @snapshot interactive
|
221
|
+
def right_side(title: "Test Dialog", subtitle: nil, size: :medium, button_text: "Show Dialog", body_text: "Content", position: :center, position_narrow: :fullscreen, visually_hide_title: false)
|
222
|
+
render(Primer::Alpha::Dialog.new(title: title, subtitle: subtitle, size: size, position: :right, position_narrow: position_narrow, visually_hide_title: visually_hide_title)) do |d|
|
223
|
+
d.with_show_button { button_text }
|
224
|
+
d.with_body { body_text }
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# @label Scroll container
|
229
|
+
#
|
230
|
+
# @param title [String] text
|
231
|
+
# @param subtitle [String] text
|
232
|
+
# @param size [Symbol] select [small, medium, medium_portrait, large, xlarge]
|
233
|
+
# @param position [Symbol] select [center, right, left]
|
234
|
+
# @param position_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
235
|
+
# @param visually_hide_title [Boolean] toggle
|
236
|
+
# @param button_text [String] text
|
237
|
+
# @param body_text [String] text
|
238
|
+
# @snapshot interactive
|
239
|
+
def scroll_container(title: "Test Dialog", subtitle: nil, position: :center, size: :medium, button_text: "Show Dialog", body_text: "Content", position_narrow: :fullscreen, visually_hide_title: false)
|
240
|
+
render_with_template(locals: {
|
241
|
+
title: title,
|
242
|
+
subtitle: subtitle,
|
243
|
+
position: position,
|
244
|
+
size: size,
|
245
|
+
button_text: button_text,
|
246
|
+
body_text: body_text,
|
247
|
+
position_narrow: position_narrow,
|
248
|
+
visually_hide_title: visually_hide_title
|
249
|
+
})
|
250
|
+
end
|
191
251
|
end
|
192
252
|
end
|
193
253
|
end
|
@@ -11,7 +11,7 @@ module Primer
|
|
11
11
|
# @param full_width [Boolean] toggle
|
12
12
|
# @param hide_labels [Boolean] toggle
|
13
13
|
# @param icon [Symbol] octicon
|
14
|
-
# @param size select [small, medium
|
14
|
+
# @param size select [small, medium]
|
15
15
|
def playground(full_width: false, hide_labels: false, size: :medium, icon: :none)
|
16
16
|
if icon == :none
|
17
17
|
icon = hide_labels ? :zap : nil
|
@@ -55,17 +55,6 @@ module Primer
|
|
55
55
|
component.with_item(label: "Blame")
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
59
|
-
# @label Size large
|
60
|
-
# @param hide_labels [Boolean] toggle
|
61
|
-
# @snapshot
|
62
|
-
def full_width_large(hide_labels: false)
|
63
|
-
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: hide_labels, full_width: true, size: :large)) do |component|
|
64
|
-
component.with_item(label: "Preview", selected: true)
|
65
|
-
component.with_item(label: "Raw")
|
66
|
-
component.with_item(label: "Blame")
|
67
|
-
end
|
68
|
-
end
|
69
58
|
# @!endgroup
|
70
59
|
|
71
60
|
# @!group Icons and text
|
@@ -88,16 +77,6 @@ module Primer
|
|
88
77
|
component.with_item(label: "Blame", icon: :people)
|
89
78
|
end
|
90
79
|
end
|
91
|
-
|
92
|
-
# @label Size large
|
93
|
-
# @snapshot
|
94
|
-
def icons_and_text_large
|
95
|
-
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", size: :large)) do |component|
|
96
|
-
component.with_item(label: "Preview", icon: :eye, selected: true)
|
97
|
-
component.with_item(label: "Raw", icon: :"file-code")
|
98
|
-
component.with_item(label: "Blame", icon: :people)
|
99
|
-
end
|
100
|
-
end
|
101
80
|
# @!endgroup
|
102
81
|
|
103
82
|
# @!group Trailing Label
|
@@ -122,17 +101,6 @@ module Primer
|
|
122
101
|
end
|
123
102
|
end
|
124
103
|
end
|
125
|
-
|
126
|
-
# @label Size large
|
127
|
-
# @snapshot
|
128
|
-
def trailing_label_width_large
|
129
|
-
render(Primer::Alpha::SegmentedControl.new("aria-label": "Billing duration", size: :large)) do |component|
|
130
|
-
component.with_item(label: "Monthly")
|
131
|
-
component.with_item(label: "Yearly", selected: true) do |button|
|
132
|
-
button.with_trailing_visual_label(scheme: :accent) { "-8%" }
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
104
|
# @!endgroup
|
137
105
|
|
138
106
|
# @!group Icons only
|
@@ -156,16 +124,6 @@ module Primer
|
|
156
124
|
end
|
157
125
|
end
|
158
126
|
|
159
|
-
# @label Size large
|
160
|
-
# @snapshot
|
161
|
-
def icon_only_large
|
162
|
-
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: true, size: :large)) do |component|
|
163
|
-
component.with_item(label: "Preview", icon: :eye, selected: true)
|
164
|
-
component.with_item(label: "Raw", icon: :"file-code")
|
165
|
-
component.with_item(label: "Blame", icon: :people)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
127
|
# @label Full width, size small
|
170
128
|
def icon_only_full_width_small
|
171
129
|
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: true, full_width: true, size: :small)) do |component|
|
@@ -183,15 +141,6 @@ module Primer
|
|
183
141
|
component.with_item(label: "Blame", icon: :people)
|
184
142
|
end
|
185
143
|
end
|
186
|
-
|
187
|
-
# @label Full width, size large
|
188
|
-
def icon_only_full_width_large
|
189
|
-
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: true, full_width: true, size: :large)) do |component|
|
190
|
-
component.with_item(label: "Preview", icon: :eye, selected: true)
|
191
|
-
component.with_item(label: "Raw", icon: :"file-code")
|
192
|
-
component.with_item(label: "Blame", icon: :people)
|
193
|
-
end
|
194
|
-
end
|
195
144
|
# @!endgroup
|
196
145
|
|
197
146
|
# NOTE: this preview uses a group to force it's display below the other groups
|
data/previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb
CHANGED
@@ -16,8 +16,7 @@
|
|
16
16
|
<input type="text" id="input">
|
17
17
|
</label>
|
18
18
|
<script>
|
19
|
-
document.querySelector('#my-dialog').addEventListener('
|
20
|
-
|
21
|
-
setTimeout(() => document.querySelector('#input').focus(), 0);
|
19
|
+
document.querySelector('#my-dialog').addEventListener('close', function () {
|
20
|
+
document.querySelector('#input').focus();
|
22
21
|
});
|
23
22
|
</script>
|
@@ -72,7 +72,7 @@ module Primer
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# @label Tooltip with Primer::IconButton
|
75
|
-
def tooltip_with_icon_button(direction: :s, tooltip_text: "
|
75
|
+
def tooltip_with_icon_button(direction: :s, tooltip_text: "Search")
|
76
76
|
render(Primer::Beta::IconButton.new(icon: :search, "aria-label": tooltip_text, tooltip_direction: direction))
|
77
77
|
end
|
78
78
|
# @!endgroup
|
@@ -206,7 +206,8 @@ module Primer
|
|
206
206
|
block: false,
|
207
207
|
id: "button-preview",
|
208
208
|
align_content: :center,
|
209
|
-
tag: :a
|
209
|
+
tag: :a,
|
210
|
+
href: "#"
|
210
211
|
)
|
211
212
|
render(Primer::Beta::Button.new(
|
212
213
|
scheme: scheme,
|
@@ -214,7 +215,8 @@ module Primer
|
|
214
215
|
block: block,
|
215
216
|
id: id,
|
216
217
|
align_content: align_content,
|
217
|
-
tag: tag
|
218
|
+
tag: tag,
|
219
|
+
href: href
|
218
220
|
)) do |_c|
|
219
221
|
"Button"
|
220
222
|
end
|
@@ -25,7 +25,7 @@ module Primer
|
|
25
25
|
# @param with_context_bar_actions [Boolean]
|
26
26
|
# @param with_parent_link [Boolean]
|
27
27
|
def playground(
|
28
|
-
variant: :
|
28
|
+
variant: :large,
|
29
29
|
title: "Hello",
|
30
30
|
description: "Last updated 5 minutes ago by XYZ.",
|
31
31
|
with_back_button: false,
|
@@ -49,10 +49,10 @@ module Primer
|
|
49
49
|
breadcrumb_items: breadcrumb_items })
|
50
50
|
end
|
51
51
|
|
52
|
-
# @label
|
53
|
-
def
|
52
|
+
# @label Medium title
|
53
|
+
def medium_title
|
54
54
|
render(Primer::OpenProject::PageHeader.new) do |header|
|
55
|
-
header.with_title(variant: :
|
55
|
+
header.with_title(variant: :medium) { "Hello" }
|
56
56
|
header.with_description { "Last updated 5 minutes ago by XYZ." }
|
57
57
|
end
|
58
58
|
end
|
data/static/arguments.json
CHANGED
@@ -610,6 +610,12 @@
|
|
610
610
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/banner.rb",
|
611
611
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/banner/default/",
|
612
612
|
"parameters": [
|
613
|
+
{
|
614
|
+
"name": "tag",
|
615
|
+
"type": "Symbol",
|
616
|
+
"default": "`:div`",
|
617
|
+
"description": "One of `:div` or `:section`."
|
618
|
+
},
|
613
619
|
{
|
614
620
|
"name": "full",
|
615
621
|
"type": "Boolean",
|
@@ -628,6 +634,12 @@
|
|
628
634
|
"default": "`:none`",
|
629
635
|
"description": "Whether the component can be dismissed with an \"x\" button. One of `:hide`, `:none`, or `:remove`."
|
630
636
|
},
|
637
|
+
{
|
638
|
+
"name": "dismiss_label",
|
639
|
+
"type": "String",
|
640
|
+
"default": "`Dismiss`",
|
641
|
+
"description": "The aria-label text of the dismiss \"x\" button"
|
642
|
+
},
|
631
643
|
{
|
632
644
|
"name": "description",
|
633
645
|
"type": "String",
|
data/static/classes.json
CHANGED
@@ -390,34 +390,19 @@
|
|
390
390
|
"Primer::Alpha::Dialog",
|
391
391
|
"Primer::Alpha::Overlay"
|
392
392
|
],
|
393
|
-
"Overlay--
|
394
|
-
"Primer::Alpha::Dialog"
|
395
|
-
],
|
396
|
-
"Overlay--visibilityHidden": [
|
397
|
-
"Primer::Alpha::Dialog"
|
398
|
-
],
|
399
|
-
"Overlay-backdrop--anchor": [
|
400
|
-
"Primer::Alpha::Dialog"
|
401
|
-
],
|
402
|
-
"Overlay-backdrop--anchor-whenNarrow": [
|
393
|
+
"Overlay--full": [
|
403
394
|
"Primer::Alpha::Dialog"
|
404
395
|
],
|
405
|
-
"Overlay-
|
396
|
+
"Overlay--full-whenNarrow": [
|
406
397
|
"Primer::Alpha::Dialog"
|
407
398
|
],
|
408
|
-
"Overlay
|
409
|
-
"Primer::Alpha::Dialog"
|
410
|
-
],
|
411
|
-
"Overlay-backdrop--full": [
|
412
|
-
"Primer::Alpha::Dialog"
|
413
|
-
],
|
414
|
-
"Overlay-backdrop--full-whenNarrow": [
|
399
|
+
"Overlay--hidden": [
|
415
400
|
"Primer::Alpha::Dialog"
|
416
401
|
],
|
417
|
-
"Overlay-
|
402
|
+
"Overlay--placement-right-whenNarrow": [
|
418
403
|
"Primer::Alpha::Dialog"
|
419
404
|
],
|
420
|
-
"Overlay
|
405
|
+
"Overlay--visibilityHidden": [
|
421
406
|
"Primer::Alpha::Dialog"
|
422
407
|
],
|
423
408
|
"Overlay-body": [
|
@@ -534,9 +519,6 @@
|
|
534
519
|
"SegmentedControl--iconOnly": [
|
535
520
|
"Primer::Alpha::SegmentedControl"
|
536
521
|
],
|
537
|
-
"SegmentedControl--large": [
|
538
|
-
"Primer::Alpha::SegmentedControl"
|
539
|
-
],
|
540
522
|
"SegmentedControl--medium": [
|
541
523
|
"Primer::Alpha::SegmentedControl"
|
542
524
|
],
|
data/static/constants.json
CHANGED
@@ -155,6 +155,7 @@
|
|
155
155
|
"Primer::Alpha::AutoComplete::Item": {
|
156
156
|
},
|
157
157
|
"Primer::Alpha::Banner": {
|
158
|
+
"DEFAULT_DISMISS_LABEL": "Dismiss",
|
158
159
|
"DEFAULT_DISMISS_SCHEME": "none",
|
159
160
|
"DEFAULT_ICONS": {
|
160
161
|
"default": "bell",
|
@@ -163,6 +164,7 @@
|
|
163
164
|
"success": "check-circle"
|
164
165
|
},
|
165
166
|
"DEFAULT_SCHEME": "default",
|
167
|
+
"DEFAULT_TAG": "div",
|
166
168
|
"DISMISS_SCHEMES": [
|
167
169
|
"none",
|
168
170
|
"remove",
|
@@ -179,7 +181,11 @@
|
|
179
181
|
"warning": "Banner--warning",
|
180
182
|
"danger": "Banner--error",
|
181
183
|
"success": "Banner--success"
|
182
|
-
}
|
184
|
+
},
|
185
|
+
"TAG_OPTIONS": [
|
186
|
+
"div",
|
187
|
+
"section"
|
188
|
+
]
|
183
189
|
},
|
184
190
|
"Primer::Alpha::ButtonMarketing": {
|
185
191
|
"DEFAULT_SCHEME": "default",
|
@@ -227,16 +233,16 @@
|
|
227
233
|
"Footer": "Primer::Alpha::Dialog::Footer",
|
228
234
|
"Header": "Primer::Alpha::Dialog::Header",
|
229
235
|
"POSITION_MAPPINGS": {
|
230
|
-
"center": "
|
231
|
-
"left": "Overlay
|
232
|
-
"right": "Overlay
|
236
|
+
"center": "",
|
237
|
+
"left": "Overlay--placement-left",
|
238
|
+
"right": "Overlay--placement-right"
|
233
239
|
},
|
234
240
|
"POSITION_NARROW_MAPPINGS": {
|
235
241
|
"inherit": "",
|
236
|
-
"bottom": "Overlay
|
237
|
-
"fullscreen": "Overlay
|
238
|
-
"left": "Overlay
|
239
|
-
"right": "Overlay
|
242
|
+
"bottom": "Overlay--placement-bottom-whenNarrow",
|
243
|
+
"fullscreen": "Overlay--full-whenNarrow",
|
244
|
+
"left": "Overlay--placement-left-whenNarrow",
|
245
|
+
"right": "Overlay--placement-right-whenNarrow"
|
240
246
|
},
|
241
247
|
"POSITION_NARROW_OPTIONS": [
|
242
248
|
"inherit",
|
@@ -559,13 +565,11 @@
|
|
559
565
|
"Item": "Primer::Alpha::SegmentedControl::Item",
|
560
566
|
"SIZE_MAPPINGS": {
|
561
567
|
"small": "SegmentedControl--small",
|
562
|
-
"medium": "SegmentedControl--medium"
|
563
|
-
"large": "SegmentedControl--large"
|
568
|
+
"medium": "SegmentedControl--medium"
|
564
569
|
},
|
565
570
|
"SIZE_OPTIONS": [
|
566
571
|
"small",
|
567
|
-
"medium"
|
568
|
-
"large"
|
572
|
+
"medium"
|
569
573
|
]
|
570
574
|
},
|
571
575
|
"Primer::Alpha::SegmentedControl::Item": {
|
@@ -1427,14 +1431,14 @@
|
|
1427
1431
|
"block",
|
1428
1432
|
"none"
|
1429
1433
|
],
|
1430
|
-
"DEFAULT_HEADER_VARIANT": "
|
1434
|
+
"DEFAULT_HEADER_VARIANT": "large",
|
1431
1435
|
"DEFAULT_PARENT_LINK_DISPLAY": [
|
1432
1436
|
"block",
|
1433
1437
|
"none"
|
1434
1438
|
],
|
1435
1439
|
"HEADER_VARIANT_OPTIONS": [
|
1436
|
-
"
|
1437
|
-
"
|
1440
|
+
"medium",
|
1441
|
+
"large"
|
1438
1442
|
],
|
1439
1443
|
"HEADING_TAG_FALLBACK": "h2",
|
1440
1444
|
"HEADING_TAG_OPTIONS": [
|