primer_view_components 0.0.116 → 0.0.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -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 +2 -2
- 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.json +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/auto_complete/item.rb +4 -4
- data/app/components/primer/alpha/auto_complete.rb +6 -6
- data/app/components/primer/alpha/dialog.rb +0 -2
- data/app/components/primer/alpha/dropdown.rb +53 -53
- data/app/components/primer/alpha/hellip_button.rb +41 -0
- data/app/components/primer/alpha/hidden_text_expander.rb +1 -1
- data/app/components/primer/alpha/layout.rb +48 -48
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.json +1 -1
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/menu.rb +5 -5
- data/app/components/primer/alpha/segmented_control.rb +20 -20
- data/app/components/primer/{tab_container_component.d.ts → alpha/tab_container.d.ts} +0 -0
- data/app/components/primer/{tab_container_component.js → alpha/tab_container.js} +0 -0
- data/app/components/primer/alpha/tab_container.rb +43 -0
- data/app/components/primer/{tab_container_component.ts → alpha/tab_container.ts} +0 -0
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.json +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.rb +32 -32
- data/app/components/primer/alpha/tool_tip.js +3 -7
- data/app/components/primer/alpha/tool_tip.ts +3 -7
- data/app/components/primer/alpha/tooltip.rb +18 -18
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.json +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.rb +18 -18
- data/app/components/primer/beta/auto_complete/item.rb +2 -3
- data/app/components/primer/beta/auto_complete.rb +14 -16
- data/app/components/primer/beta/avatar_stack.rb +12 -14
- data/app/components/primer/beta/blankslate.rb +0 -1
- data/app/components/primer/beta/border_box/header.rb +0 -2
- data/app/components/primer/beta/border_box.rb +0 -2
- data/app/components/primer/beta/breadcrumbs.css +1 -1
- data/app/components/primer/beta/breadcrumbs.css.json +1 -1
- data/app/components/primer/beta/breadcrumbs.css.map +1 -1
- data/app/components/primer/beta/breadcrumbs.rb +0 -1
- data/app/components/primer/beta/button.rb +9 -10
- data/app/components/primer/beta/button_group.rb +0 -1
- data/app/components/primer/beta/details.rb +0 -1
- data/app/components/primer/beta/flash.rb +0 -1
- data/app/components/primer/beta/link.rb +2 -3
- data/app/components/primer/beta/octicon.rb +0 -1
- data/app/components/primer/beta/popover.rb +0 -1
- data/app/components/primer/{state_component.css → beta/state.css} +0 -0
- data/app/components/primer/beta/state.css.json +1 -0
- data/app/components/primer/beta/state.css.map +1 -0
- data/app/components/primer/{state_component.pcss → beta/state.pcss} +0 -0
- data/app/components/primer/beta/state.rb +76 -0
- data/app/components/primer/{subhead_component.css → beta/subhead.css} +0 -0
- data/app/components/primer/beta/subhead.css.json +1 -0
- data/app/components/primer/beta/subhead.css.map +1 -0
- data/app/components/primer/{subhead_component.html.erb → beta/subhead.html.erb} +0 -0
- data/app/components/primer/{subhead_component.pcss → beta/subhead.pcss} +0 -0
- data/app/components/primer/beta/subhead.rb +135 -0
- data/app/components/primer/{timeline_item_component.css → beta/timeline_item.css} +0 -0
- data/app/components/primer/beta/timeline_item.css.json +1 -0
- data/app/components/primer/beta/timeline_item.css.map +1 -0
- data/app/components/primer/{timeline_item_component.html.erb → beta/timeline_item.html.erb} +0 -0
- data/app/components/primer/{timeline_item_component.pcss → beta/timeline_item.pcss} +0 -0
- data/app/components/primer/beta/timeline_item.rb +90 -0
- data/app/components/primer/beta/truncate.css +1 -1
- data/app/components/primer/beta/truncate.css.json +1 -1
- data/app/components/primer/beta/truncate.css.map +1 -1
- data/app/components/primer/beta/truncate.rb +0 -1
- data/app/components/primer/button_component.rb +9 -9
- data/app/components/primer/component.rb +0 -1
- data/app/components/primer/hellip_button.rb +2 -34
- data/app/components/primer/navigation/tab_component.rb +16 -16
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +3 -3
- data/app/components/primer/primer.ts +1 -1
- data/app/components/primer/state_component.rb +2 -69
- data/app/components/primer/subhead_component.rb +2 -128
- data/app/components/primer/tab_container_component.rb +2 -36
- data/app/components/primer/timeline_item_component.rb +5 -78
- data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -0
- data/app/forms/example_toggle_switch_form.rb +8 -0
- data/app/forms/submit_button_form.rb +4 -4
- data/app/lib/primer/tabbed_component_helper.rb +1 -1
- data/lib/primer/deprecations.rb +7 -13
- data/lib/primer/deprecations.yml +24 -0
- data/lib/primer/forms/button.html.erb +2 -2
- data/lib/primer/forms/dsl/toggle_switch_input.rb +35 -0
- data/lib/primer/forms/toggle_switch.html.erb +17 -0
- data/lib/primer/forms/toggle_switch.rb +19 -0
- data/lib/primer/forms/toggle_switch_form.rb +74 -0
- data/lib/primer/view_components/linters/subhead_component_migration_counter.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/component_name_migration.rb +2 -1
- data/lib/tasks/docs.rake +6 -6
- data/previews/primer/alpha/action_list_preview.rb +44 -44
- data/previews/primer/alpha/dropdown_preview.rb +97 -97
- data/previews/primer/alpha/hellip_button_preview.rb +24 -0
- data/previews/primer/alpha/layout_preview.rb +63 -63
- data/previews/primer/alpha/menu_preview/default.html.erb +5 -5
- data/previews/primer/alpha/menu_preview/playground.html.erb +5 -5
- data/previews/primer/alpha/segmented_control_preview.rb +60 -60
- data/previews/primer/alpha/tab_nav_preview.rb +22 -22
- data/previews/primer/alpha/tab_panels_preview.rb +2 -2
- data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +6 -6
- data/previews/primer/alpha/tooltip_preview.rb +12 -12
- data/previews/primer/alpha/underline_nav_preview.rb +4 -4
- data/previews/primer/alpha/underline_panels_preview.rb +8 -8
- data/previews/primer/beta/auto_complete_item_preview/default.html.erb +2 -2
- data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +2 -2
- data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +3 -3
- data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +2 -2
- data/previews/primer/beta/auto_complete_preview.rb +18 -18
- data/previews/primer/beta/avatar_stack_preview.rb +32 -32
- data/previews/primer/beta/blankslate_preview.rb +40 -40
- data/previews/primer/beta/border_box_preview.rb +38 -38
- data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
- data/previews/primer/beta/button_group_preview.rb +10 -10
- data/previews/primer/beta/button_preview/all_schemes.html.erb +4 -4
- data/previews/primer/beta/button_preview/invisible_all_visuals.html.erb +16 -16
- data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
- data/previews/primer/beta/button_preview/trailing_action.html.erb +2 -2
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -2
- data/previews/primer/beta/button_preview/with_tooltip.html.erb +2 -2
- data/previews/primer/beta/details_preview.rb +6 -6
- data/previews/primer/beta/state_preview.rb +66 -0
- data/previews/primer/beta/subhead_preview/actions.html.erb +14 -0
- data/previews/primer/beta/subhead_preview.rb +99 -0
- data/previews/primer/beta/timeline_item_preview.rb +30 -0
- data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +1 -0
- data/previews/primer/forms/forms_preview.rb +2 -0
- data/static/arguments.json +118 -118
- data/static/audited_at.json +6 -0
- data/static/constants.json +67 -54
- data/static/statuses.json +12 -6
- metadata +36 -23
- data/app/components/primer/state_component.css.json +0 -1
- data/app/components/primer/state_component.css.map +0 -1
- data/app/components/primer/subhead_component.css.json +0 -1
- data/app/components/primer/subhead_component.css.map +0 -1
- data/app/components/primer/timeline_item_component.css.json +0 -1
- data/app/components/primer/timeline_item_component.css.map +0 -1
- data/previews/primer/hellip_button_preview.rb +0 -22
- data/previews/primer/state_component_preview.rb +0 -26
- data/previews/primer/subhead_component_preview.rb +0 -40
- data/previews/primer/timeline_item_component_preview.rb +0 -28
@@ -19,15 +19,15 @@ module Primer
|
|
19
19
|
scheme: scheme,
|
20
20
|
show_dividers: show_dividers,
|
21
21
|
aria: { label: "Action List" }
|
22
|
-
)) do |
|
23
|
-
|
24
|
-
|
22
|
+
)) do |component|
|
23
|
+
component.with_heading(title: "Action List")
|
24
|
+
component.with_item(label: "Item one", href: "/") do |item|
|
25
25
|
item.with_leading_visual_icon(icon: :gear)
|
26
26
|
end
|
27
|
-
|
27
|
+
component.with_item(label: "Item two", href: "/") do |item|
|
28
28
|
item.with_leading_visual_icon(icon: :star)
|
29
29
|
end
|
30
|
-
|
30
|
+
component.with_item(label: "Item three", href: "/") do |item|
|
31
31
|
item.with_leading_visual_icon(icon: :heart)
|
32
32
|
end
|
33
33
|
end
|
@@ -48,15 +48,15 @@ module Primer
|
|
48
48
|
scheme: scheme,
|
49
49
|
show_dividers: show_dividers,
|
50
50
|
aria: { label: "Action List" }
|
51
|
-
)) do |
|
52
|
-
|
53
|
-
|
51
|
+
)) do |component|
|
52
|
+
component.with_heading(title: "Action List")
|
53
|
+
component.with_item(label: "Item one", href: "/") do |item|
|
54
54
|
item.with_leading_visual_icon(icon: :gear)
|
55
55
|
end
|
56
|
-
|
56
|
+
component.with_item(label: "Item two", href: "/") do |item|
|
57
57
|
item.with_leading_visual_icon(icon: :star)
|
58
58
|
end
|
59
|
-
|
59
|
+
component.with_item(label: "Item three", href: "/") do |item|
|
60
60
|
item.with_leading_visual_icon(icon: :heart)
|
61
61
|
end
|
62
62
|
end
|
@@ -77,14 +77,14 @@ module Primer
|
|
77
77
|
scheme: scheme,
|
78
78
|
show_dividers: show_dividers,
|
79
79
|
aria: { label: "Action List" }
|
80
|
-
)) do |
|
81
|
-
|
82
|
-
|
80
|
+
)) do |component|
|
81
|
+
component.with_heading(title: "Action List")
|
82
|
+
component.with_item(label: "Leading SVG visual", href: "/") do |item|
|
83
83
|
item.with_leading_visual_svg do
|
84
84
|
'<path d="M8 16a2 2 0 001.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 008 16z"></path><path fill-rule="evenodd" d="M8 1.5A3.5 3.5 0 004.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.018.018 0 00-.003.01l.001.006c0 .002.002.004.004.006a.017.017 0 00.006.004l.007.001h10.964l.007-.001a.016.016 0 00.006-.004.016.016 0 00.004-.006l.001-.007a.017.017 0 00-.003-.01l-1.703-2.554a1.75 1.75 0 01-.294-.97V5A3.5 3.5 0 008 1.5zM3 5a5 5 0 0110 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.518 1.518 0 0113.482 13H2.518a1.518 1.518 0 01-1.263-2.36l1.703-2.554A.25.25 0 003 7.947V5z"></path>'.html_safe
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
87
|
+
component.with_item(label: "Custom content", href: "/") do |item|
|
88
88
|
item.with_leading_visual_content do
|
89
89
|
'<span style="width: 16px; height: 16px; display: block; text-align: center; line-height: 16px">A</span>'.html_safe
|
90
90
|
end
|
@@ -217,8 +217,8 @@ module Primer
|
|
217
217
|
def item_default
|
218
218
|
render(Primer::Alpha::ActionList.new(
|
219
219
|
aria: { label: "List heading" }
|
220
|
-
)) do |
|
221
|
-
|
220
|
+
)) do |component|
|
221
|
+
component.with_item(label: "Default item", href: "/")
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -226,8 +226,8 @@ module Primer
|
|
226
226
|
def item_size_large
|
227
227
|
render(Primer::Alpha::ActionList.new(
|
228
228
|
aria: { label: "List heading" }
|
229
|
-
)) do |
|
230
|
-
|
229
|
+
)) do |component|
|
230
|
+
component.with_item(label: "Default item", href: "/", size: :large)
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
@@ -235,8 +235,8 @@ module Primer
|
|
235
235
|
def item_size_xlarge
|
236
236
|
render(Primer::Alpha::ActionList.new(
|
237
237
|
aria: { label: "List heading" }
|
238
|
-
)) do |
|
239
|
-
|
238
|
+
)) do |component|
|
239
|
+
component.with_item(label: "Default item", href: "/", size: :xlarge)
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
@@ -244,8 +244,8 @@ module Primer
|
|
244
244
|
def item_leading_visual
|
245
245
|
render(Primer::Alpha::ActionList.new(
|
246
246
|
aria: { label: "List heading" }
|
247
|
-
)) do |
|
248
|
-
|
247
|
+
)) do |component|
|
248
|
+
component.with_item(label: "Item with leading visual", href: "/") do |item|
|
249
249
|
item.with_leading_visual_icon(icon: :star)
|
250
250
|
end
|
251
251
|
end
|
@@ -255,8 +255,8 @@ module Primer
|
|
255
255
|
def item_trailing_visual
|
256
256
|
render(Primer::Alpha::ActionList.new(
|
257
257
|
aria: { label: "List heading" }
|
258
|
-
)) do |
|
259
|
-
|
258
|
+
)) do |component|
|
259
|
+
component.with_item(label: "Item with trailing visual", href: "/") do |item|
|
260
260
|
item.with_trailing_visual_icon(icon: :star)
|
261
261
|
end
|
262
262
|
end
|
@@ -266,8 +266,8 @@ module Primer
|
|
266
266
|
def item_leading_trailing_visual
|
267
267
|
render(Primer::Alpha::ActionList.new(
|
268
268
|
aria: { label: "List heading" }
|
269
|
-
)) do |
|
270
|
-
|
269
|
+
)) do |component|
|
270
|
+
component.with_item(label: "Item with trailing visual", href: "/") do |item|
|
271
271
|
item.with_leading_visual_icon(icon: :heart)
|
272
272
|
item.with_trailing_visual_icon(icon: :star)
|
273
273
|
end
|
@@ -278,8 +278,8 @@ module Primer
|
|
278
278
|
def item_with_description
|
279
279
|
render(Primer::Alpha::ActionList.new(
|
280
280
|
aria: { label: "List heading" }
|
281
|
-
)) do |
|
282
|
-
|
281
|
+
)) do |component|
|
282
|
+
component.with_item(label: "Default item", href: "/") do |item|
|
283
283
|
item.with_description.with_content("This is a description")
|
284
284
|
end
|
285
285
|
end
|
@@ -289,8 +289,8 @@ module Primer
|
|
289
289
|
def item_with_description_inline
|
290
290
|
render(Primer::Alpha::ActionList.new(
|
291
291
|
aria: { label: "List heading" }
|
292
|
-
)) do |
|
293
|
-
|
292
|
+
)) do |component|
|
293
|
+
component.with_item(label: "Default item", href: "/", description_scheme: :inline) do |item|
|
294
294
|
item.with_description.with_content("This is a description")
|
295
295
|
end
|
296
296
|
end
|
@@ -300,8 +300,8 @@ module Primer
|
|
300
300
|
def item_trailing_action
|
301
301
|
render(Primer::Alpha::ActionList.new(
|
302
302
|
aria: { label: "List heading" }
|
303
|
-
)) do |
|
304
|
-
|
303
|
+
)) do |component|
|
304
|
+
component.with_item(label: "Default item", href: "/") do |item|
|
305
305
|
item.with_trailing_action(show_on_hover: false, icon: "plus", "aria-label": "Button tooltip", size: :medium)
|
306
306
|
end
|
307
307
|
end
|
@@ -311,8 +311,8 @@ module Primer
|
|
311
311
|
def item_trailing_action_hover
|
312
312
|
render(Primer::Alpha::ActionList.new(
|
313
313
|
aria: { label: "List heading" }
|
314
|
-
)) do |
|
315
|
-
|
314
|
+
)) do |component|
|
315
|
+
component.with_item(label: "Default item", href: "/") do |item|
|
316
316
|
item.with_trailing_action(show_on_hover: true, icon: "plus", "aria-label": "Button tooltip", size: :medium)
|
317
317
|
end
|
318
318
|
end
|
@@ -322,8 +322,8 @@ module Primer
|
|
322
322
|
def item_danger
|
323
323
|
render(Primer::Alpha::ActionList.new(
|
324
324
|
aria: { label: "List heading" }
|
325
|
-
)) do |
|
326
|
-
|
325
|
+
)) do |component|
|
326
|
+
component.with_item(label: "Danger item", href: "/", scheme: :danger)
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
@@ -331,8 +331,8 @@ module Primer
|
|
331
331
|
def item_disabled
|
332
332
|
render(Primer::Alpha::ActionList.new(
|
333
333
|
aria: { label: "List heading" }
|
334
|
-
)) do |
|
335
|
-
|
334
|
+
)) do |component|
|
335
|
+
component.with_item(label: "Disabled item", href: "/", disabled: true)
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
@@ -340,8 +340,8 @@ module Primer
|
|
340
340
|
def item_wrap_label
|
341
341
|
render(Primer::Alpha::ActionList.new(
|
342
342
|
aria: { label: "List heading" }
|
343
|
-
)) do |
|
344
|
-
|
343
|
+
)) do |component|
|
344
|
+
component.with_item(label: "This is a very long string of text that will wrap if it runs out of horizontal space", href: "/")
|
345
345
|
end
|
346
346
|
end
|
347
347
|
|
@@ -349,8 +349,8 @@ module Primer
|
|
349
349
|
def item_truncate_label
|
350
350
|
render(Primer::Alpha::ActionList.new(
|
351
351
|
aria: { label: "List heading" }
|
352
|
-
)) do |
|
353
|
-
|
352
|
+
)) do |component|
|
353
|
+
component.with_item(label: "This is a very long string of text that will truncate if it runs out of horizontal space", href: "/", truncate_label: true)
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
@@ -358,8 +358,8 @@ module Primer
|
|
358
358
|
def item_active
|
359
359
|
render(Primer::Alpha::ActionList.new(
|
360
360
|
aria: { label: "List heading" }
|
361
|
-
)) do |
|
362
|
-
|
361
|
+
)) do |component|
|
362
|
+
component.with_item(label: "Active item", href: "/", active: true)
|
363
363
|
end
|
364
364
|
end
|
365
365
|
end
|
@@ -9,15 +9,15 @@ module Primer
|
|
9
9
|
# @param with_caret [Boolean] toggle
|
10
10
|
# @param overlay [Symbol] select [none, default, dark]
|
11
11
|
def playground(overlay: :default, with_caret: false)
|
12
|
-
render(Primer::Alpha::Dropdown.new(overlay: overlay, with_caret: with_caret)) do |
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
render(Primer::Alpha::Dropdown.new(overlay: overlay, with_caret: with_caret)) do |component|
|
13
|
+
component.with_button { "Dropdown" }
|
14
|
+
|
15
|
+
component.with_menu(header: "Header") do |menu|
|
16
|
+
menu.with_item { "Item 1" }
|
17
|
+
menu.with_item { "Item 2" }
|
18
|
+
menu.with_item(divider: true)
|
19
|
+
menu.with_item { "Item 3" }
|
20
|
+
menu.with_item { "Item 4" }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -25,12 +25,12 @@ module Primer
|
|
25
25
|
# @label Default
|
26
26
|
#
|
27
27
|
def default
|
28
|
-
render(Primer::Alpha::Dropdown.new) do |
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
render(Primer::Alpha::Dropdown.new) do |component|
|
29
|
+
component.with_button { "Dropdown" }
|
30
|
+
component.with_menu do |menu|
|
31
|
+
menu.with_item { "Item 1" }
|
32
|
+
menu.with_item { "Item 2" }
|
33
|
+
menu.with_item { "Item 3" }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -41,12 +41,12 @@ module Primer
|
|
41
41
|
# @param direction [Symbol] select [se, sw, w, e, ne, s]
|
42
42
|
# @param scheme [Symbol] select [default, dark]
|
43
43
|
def menu(as: :default, direction: :se, scheme: :default)
|
44
|
-
render(Primer::Alpha::Dropdown::Menu.new(as: as, direction: direction, scheme: scheme, header: "Header")) do |
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
render(Primer::Alpha::Dropdown::Menu.new(as: as, direction: direction, scheme: scheme, header: "Header")) do |menu|
|
45
|
+
menu.with_item { "Item 1" }
|
46
|
+
menu.with_item { "Item 2" }
|
47
|
+
menu.with_item(divider: true)
|
48
|
+
menu.with_item { "Item 3" }
|
49
|
+
menu.with_item { "Item 4" }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,72 +54,72 @@ module Primer
|
|
54
54
|
#
|
55
55
|
# @label Direction e
|
56
56
|
def direction_e
|
57
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
58
|
+
component.with_button { "Dropdown" }
|
59
|
+
component.with_menu(direction: :e) do |menu|
|
60
|
+
menu.with_item { "Item 1" }
|
61
|
+
menu.with_item { "Item 2" }
|
62
|
+
menu.with_item { "Item 3" }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
# @label Direction ne
|
68
68
|
def direction_ne
|
69
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
70
|
+
component.with_button { "Dropdown" }
|
71
|
+
component.with_menu(direction: :ne) do |menu|
|
72
|
+
menu.with_item { "Item 1" }
|
73
|
+
menu.with_item { "Item 2" }
|
74
|
+
menu.with_item { "Item 3" }
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
# @label Direction s
|
80
80
|
def direction_s
|
81
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
82
|
+
component.with_button { "Dropdown" }
|
83
|
+
component.with_menu(direction: :s) do |menu|
|
84
|
+
menu.with_item { "Item 1" }
|
85
|
+
menu.with_item { "Item 2" }
|
86
|
+
menu.with_item { "Item 3" }
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
# @label Direction se
|
92
92
|
def direction_se
|
93
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
94
|
+
component.with_button { "Dropdown" }
|
95
|
+
component.with_menu(direction: :se) do |menu|
|
96
|
+
menu.with_item { "Item 1" }
|
97
|
+
menu.with_item { "Item 2" }
|
98
|
+
menu.with_item { "Item 3" }
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
# @label Direction sw
|
104
104
|
def direction_sw
|
105
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
105
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
106
|
+
component.with_button { "Dropdown" }
|
107
|
+
component.with_menu(direction: :sw) do |menu|
|
108
|
+
menu.with_item { "Item 1" }
|
109
|
+
menu.with_item { "Item 2" }
|
110
|
+
menu.with_item { "Item 3" }
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
# @label Direction w
|
116
116
|
def direction_w
|
117
|
-
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
render(Primer::Alpha::Dropdown.new(display: :inline_block)) do |component|
|
118
|
+
component.with_button { "Dropdown" }
|
119
|
+
component.with_menu(direction: :w) do |menu|
|
120
|
+
menu.with_item { "Item 1" }
|
121
|
+
menu.with_item { "Item 2" }
|
122
|
+
menu.with_item { "Item 3" }
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -130,76 +130,76 @@ module Primer
|
|
130
130
|
#
|
131
131
|
# @label With caret
|
132
132
|
def options_with_caret
|
133
|
-
render(Primer::Alpha::Dropdown.new(with_caret: true)) do |
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
render(Primer::Alpha::Dropdown.new(with_caret: true)) do |component|
|
134
|
+
component.with_button { "Dropdown" }
|
135
|
+
component.with_menu do |menu|
|
136
|
+
menu.with_item { "Item 1" }
|
137
|
+
menu.with_item { "Item 2" }
|
138
|
+
menu.with_item { "Item 3" }
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
# @label With header
|
144
144
|
def options_with_header
|
145
|
-
render(Primer::Alpha::Dropdown.new) do |
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
145
|
+
render(Primer::Alpha::Dropdown.new) do |component|
|
146
|
+
component.with_button { "Dropdown" }
|
147
|
+
component.with_menu(header: "Header") do |menu|
|
148
|
+
menu.with_item { "Item 1" }
|
149
|
+
menu.with_item { "Item 2" }
|
150
|
+
menu.with_item { "Item 3" }
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
155
|
# @label With dividers
|
156
156
|
def options_with_dividers
|
157
|
-
render(Primer::Alpha::Dropdown.new) do |
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
157
|
+
render(Primer::Alpha::Dropdown.new) do |component|
|
158
|
+
component.with_button { "Dropdown" }
|
159
|
+
component.with_menu do |menu|
|
160
|
+
menu.with_item { "Item 1" }
|
161
|
+
menu.with_item { "Item 2" }
|
162
|
+
menu.with_item(divider: true)
|
163
|
+
menu.with_item { "Item 3" }
|
164
|
+
menu.with_item { "Item 4" }
|
165
|
+
menu.with_item(divider: true)
|
166
|
+
menu.with_item { "Item 5" }
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
171
|
# @label As list
|
172
172
|
def options_as_list
|
173
|
-
render(Primer::Alpha::Dropdown.new) do |
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
173
|
+
render(Primer::Alpha::Dropdown.new) do |component|
|
174
|
+
component.with_button { "Dropdown" }
|
175
|
+
component.with_menu(as: :list) do |menu|
|
176
|
+
menu.with_item { "Item 1" }
|
177
|
+
menu.with_item { "Item 2" }
|
178
|
+
menu.with_item { "Item 3" }
|
179
179
|
end
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
# @label Overlay none
|
184
184
|
def options_overlay_none
|
185
|
-
render(Primer::Alpha::Dropdown.new(overlay: :none)) do |
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
185
|
+
render(Primer::Alpha::Dropdown.new(overlay: :none)) do |component|
|
186
|
+
component.with_button { "Dropdown" }
|
187
|
+
component.with_menu do |menu|
|
188
|
+
menu.with_item { "Item 1" }
|
189
|
+
menu.with_item { "Item 2" }
|
190
|
+
menu.with_item { "Item 3" }
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
195
|
# @label Overlay dark
|
196
196
|
def options_overlay_dark
|
197
|
-
render(Primer::Alpha::Dropdown.new(overlay: :dark)) do |
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
197
|
+
render(Primer::Alpha::Dropdown.new(overlay: :dark)) do |component|
|
198
|
+
component.with_button { "Dropdown" }
|
199
|
+
component.with_menu do |menu|
|
200
|
+
menu.with_item { "Item 1" }
|
201
|
+
menu.with_item { "Item 2" }
|
202
|
+
menu.with_item { "Item 3" }
|
203
203
|
end
|
204
204
|
end
|
205
205
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
# @label HellipButton
|
6
|
+
class HellipButtonPreview < ViewComponent::Preview
|
7
|
+
# @label Default Options
|
8
|
+
#
|
9
|
+
# @param aria_label [String]
|
10
|
+
# @param inline [Boolean]
|
11
|
+
def default(inline: false, aria_label: "No effect")
|
12
|
+
render(Primer::Alpha::HellipButton.new(inline: inline, "aria-label": aria_label))
|
13
|
+
end
|
14
|
+
|
15
|
+
# @label Playground
|
16
|
+
#
|
17
|
+
# @param aria_label [String]
|
18
|
+
# @param inline [Boolean]
|
19
|
+
def playground(inline: false, aria_label: "No effect")
|
20
|
+
render(Primer::Alpha::HellipButton.new(inline: inline, "aria-label": aria_label))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|