primer_view_components 0.0.123 → 0.1.1
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/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/divider.rb +2 -2
- data/app/components/primer/alpha/action_list/heading.html.erb +1 -1
- data/app/components/primer/alpha/action_list/heading.rb +10 -4
- data/app/components/primer/alpha/action_list/item.rb +7 -3
- data/app/components/primer/alpha/action_list.css.json +41 -0
- data/app/components/primer/alpha/action_list.html.erb +6 -8
- data/app/components/primer/alpha/action_list.rb +5 -10
- data/app/components/primer/alpha/auto_complete.css.json +11 -0
- data/app/components/primer/alpha/banner.css.json +14 -0
- data/app/components/primer/alpha/button_marketing.css.json +10 -0
- data/app/components/primer/alpha/dialog.css.json +63 -0
- data/app/components/primer/alpha/dropdown.css.json +21 -0
- data/app/components/primer/alpha/layout.css.json +27 -0
- data/app/components/primer/alpha/menu.css.json +11 -0
- data/app/components/primer/alpha/nav_list/{section.rb → group.rb} +9 -9
- data/app/components/primer/alpha/nav_list/item.html.erb +1 -1
- data/app/components/primer/alpha/nav_list/item.rb +18 -2
- data/app/components/primer/alpha/nav_list.d.ts +1 -0
- data/app/components/primer/alpha/nav_list.html.erb +8 -8
- data/app/components/primer/alpha/nav_list.js +24 -0
- data/app/components/primer/alpha/nav_list.rb +28 -32
- data/app/components/primer/alpha/nav_list.ts +27 -0
- data/app/components/primer/alpha/navigation/tab.rb +168 -0
- data/app/components/primer/alpha/overlay/body.rb +26 -0
- data/app/components/primer/alpha/overlay/footer.rb +41 -0
- data/app/components/primer/alpha/overlay/header.html.erb +15 -0
- data/app/components/primer/alpha/overlay/header.rb +47 -0
- data/app/components/primer/alpha/overlay.css +1 -0
- data/app/components/primer/alpha/overlay.css.json +11 -0
- data/app/components/primer/alpha/overlay.css.map +1 -0
- data/app/components/primer/alpha/overlay.html.erb +11 -0
- data/app/components/primer/alpha/overlay.pcss +14 -0
- data/app/components/primer/alpha/overlay.rb +207 -0
- data/app/components/primer/alpha/segmented_control.css.json +15 -0
- data/app/components/primer/alpha/tab_nav.css.json +10 -0
- data/app/components/primer/alpha/tab_nav.rb +10 -3
- data/app/components/primer/alpha/tab_panels.rb +2 -2
- data/app/components/primer/alpha/text_field.css.json +38 -0
- data/app/components/primer/alpha/toggle_switch.css.json +16 -0
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.json +13 -0
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.pcss +1 -0
- data/app/components/primer/alpha/underline_nav.rb +2 -2
- data/app/components/primer/alpha/underline_panels.rb +2 -2
- data/app/components/primer/anchored_position.d.ts +27 -0
- data/app/components/primer/anchored_position.js +149 -0
- data/app/components/primer/anchored_position.ts +167 -0
- data/app/components/primer/beta/avatar.css.json +14 -0
- data/app/components/primer/beta/avatar_stack.css.json +9 -0
- data/app/components/primer/beta/blankslate.css.json +12 -0
- data/app/components/primer/beta/border_box.css.json +32 -0
- data/app/components/primer/beta/breadcrumbs.css.json +4 -0
- data/app/components/primer/beta/button.css.json +22 -0
- data/app/components/primer/beta/button.html.erb +1 -1
- data/app/components/primer/beta/button.rb +2 -1
- data/app/components/primer/beta/counter.css.json +6 -0
- data/app/components/primer/beta/flash.css.json +15 -0
- data/app/components/primer/beta/flash.html.erb +1 -2
- data/app/components/primer/beta/label.css.json +20 -0
- data/app/components/primer/beta/link.css.json +8 -0
- data/app/components/primer/beta/popover.css.json +18 -0
- data/app/components/primer/beta/progress_bar.css.json +6 -0
- data/app/components/primer/beta/state.css.json +10 -0
- data/app/components/primer/beta/subhead.css.json +8 -0
- data/app/components/primer/beta/timeline_item.css.json +9 -0
- data/app/components/primer/beta/truncate.css.json +6 -0
- data/app/components/primer/component.rb +34 -0
- data/app/components/primer/navigation/tab_component.rb +3 -157
- data/app/components/primer/primer.d.ts +2 -0
- data/app/components/primer/primer.js +2 -0
- data/app/components/primer/primer.pcss +3 -0
- data/app/components/primer/primer.ts +2 -0
- data/app/components/primer/truncate.css.json +7 -0
- data/app/lib/primer/css/layout.css.json +263 -0
- data/app/lib/primer/css/utilities.css.json +1636 -0
- data/lib/primer/deprecations.yml +4 -0
- data/lib/primer/view_components/linters/base_linter.rb +1 -1
- data/lib/primer/view_components/linters/disallow_component_css_counter.rb +30 -0
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/yard/component_manifest.rb +3 -1
- data/lib/tasks/docs.rake +1 -1
- data/previews/primer/alpha/action_list_preview.rb +6 -14
- data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +19 -0
- data/previews/primer/alpha/nav_list_preview.rb +19 -30
- data/previews/primer/alpha/overlay_preview/middle_of_page.html.erb +17 -0
- data/previews/primer/alpha/overlay_preview.rb +112 -0
- data/previews/primer/alpha/tab_nav_preview/with_extra.html.erb +8 -0
- data/previews/primer/alpha/tab_nav_preview.rb +5 -0
- data/previews/primer/alpha/tab_panels_preview/with_extra.html.erb +17 -0
- data/previews/primer/alpha/tab_panels_preview.rb +5 -0
- data/static/arguments.json +167 -7
- data/static/audited_at.json +6 -1
- data/static/classes.json +311 -0
- data/static/constants.json +122 -8
- data/static/previews.json +31 -0
- data/static/statuses.json +7 -2
- metadata +25 -6
- data/app/components/primer/alpha/nav_list/section.html.erb +0 -3
- data/previews/primer/alpha/action_list_preview/heading.html.erb +0 -4
- /data/app/components/primer/{navigation/tab_component.html.erb → alpha/navigation/tab.html.erb} +0 -0
data/lib/primer/deprecations.yml
CHANGED
@@ -26,6 +26,10 @@ deprecations:
|
|
26
26
|
autocorrect: true
|
27
27
|
replacement: "Primer::Beta::IconButton"
|
28
28
|
|
29
|
+
- component: "Primer::Navigation::TabComponent"
|
30
|
+
autocorrect: true
|
31
|
+
replacement: "Primer::Alpha::Navigation::Tab"
|
32
|
+
|
29
33
|
- component: "Primer::Tooltip"
|
30
34
|
autocorrect: true
|
31
35
|
replacement: "Primer::Alpha::Tooltip"
|
@@ -40,7 +40,7 @@ module ERBLint
|
|
40
40
|
|
41
41
|
tags.each do |tag|
|
42
42
|
next if tag.closing?
|
43
|
-
next
|
43
|
+
next if self.class::TAGS&.none?(tag.name)
|
44
44
|
|
45
45
|
classes = tag.attributes["class"]&.value&.split(" ") || []
|
46
46
|
tag_tree[tag][:offense] = false
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_linter"
|
4
|
+
|
5
|
+
# Load all the other linters so we can filter out their restricted
|
6
|
+
# CLASSES—they will be responsible for complaining about the use of
|
7
|
+
# those HTML classes.
|
8
|
+
Dir[File.join(__dir__, "*.rb")].sort.each do |file|
|
9
|
+
require file unless file == __FILE__
|
10
|
+
end
|
11
|
+
|
12
|
+
module ERBLint
|
13
|
+
module Linters
|
14
|
+
# Counts the number of times a class reserved for ViewComponents is used
|
15
|
+
class DisallowComponentCssCounter < BaseLinter
|
16
|
+
CLASSES = (
|
17
|
+
JSON.parse(
|
18
|
+
File.read(
|
19
|
+
File.join(__dir__, "..", "..", "..", "..", "static", "classes.json")
|
20
|
+
)
|
21
|
+
) - BaseLinter.subclasses.reduce([]) do |html_classes, klass|
|
22
|
+
html_classes.concat(klass.const_get(:CLASSES))
|
23
|
+
end
|
24
|
+
).freeze
|
25
|
+
|
26
|
+
TAGS = nil
|
27
|
+
MESSAGE = "Primer ViewComponents defines some HTML classes with associated styles that should not be used outside those components. (These classes might have their styles changed or even disappear in the future.) Instead of using this class directly, please use its component if appropriate or define the styles you need some other way."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -45,6 +45,7 @@ module Primer
|
|
45
45
|
Primer::Beta::Markdown => {},
|
46
46
|
Primer::Alpha::Menu => {},
|
47
47
|
Primer::Navigation::TabComponent => {},
|
48
|
+
Primer::Alpha::Navigation::Tab => {},
|
48
49
|
Primer::Beta::Octicon => {},
|
49
50
|
Primer::Beta::Popover => {},
|
50
51
|
Primer::Beta::ProgressBar => {},
|
@@ -63,11 +64,12 @@ module Primer
|
|
63
64
|
Primer::Alpha::TabPanels => { js: true },
|
64
65
|
Primer::Alpha::Tooltip => { js: true },
|
65
66
|
Primer::Alpha::ToggleSwitch => { js: true },
|
67
|
+
Primer::Alpha::Overlay => { js: true },
|
66
68
|
|
67
69
|
# Examples can be seen in the NavList docs
|
68
70
|
Primer::Alpha::NavList => { js: true },
|
69
71
|
Primer::Alpha::NavList::Item => { js: true, examples: false },
|
70
|
-
Primer::Alpha::NavList::
|
72
|
+
Primer::Alpha::NavList::Group => { js: true, examples: false },
|
71
73
|
|
72
74
|
# ActionList is a base component that should not be used by itself, and thus
|
73
75
|
# does not have examples of its own
|
data/lib/tasks/docs.rake
CHANGED
@@ -64,7 +64,7 @@ namespace :docs do
|
|
64
64
|
|
65
65
|
if components_needing_docs.any?
|
66
66
|
puts
|
67
|
-
puts "The following components
|
67
|
+
puts "The following components need docs. Care to contribute them? #{components_needing_docs.map(&:name).join(', ')}"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -17,8 +17,7 @@ module Primer
|
|
17
17
|
render(Primer::Alpha::ActionList.new(
|
18
18
|
role: role,
|
19
19
|
scheme: scheme,
|
20
|
-
show_dividers: show_dividers
|
21
|
-
aria: { label: "Action List" }
|
20
|
+
show_dividers: show_dividers
|
22
21
|
)) do |component|
|
23
22
|
component.with_heading(title: "Action List")
|
24
23
|
component.with_item(label: "Item one", href: "/") do |item|
|
@@ -46,8 +45,7 @@ module Primer
|
|
46
45
|
render(Primer::Alpha::ActionList.new(
|
47
46
|
role: role,
|
48
47
|
scheme: scheme,
|
49
|
-
show_dividers: show_dividers
|
50
|
-
aria: { label: "Action List" }
|
48
|
+
show_dividers: show_dividers
|
51
49
|
)) do |component|
|
52
50
|
component.with_heading(title: "Action List")
|
53
51
|
component.with_item(label: "Item one", href: "/") do |item|
|
@@ -75,8 +73,7 @@ module Primer
|
|
75
73
|
render(Primer::Alpha::ActionList.new(
|
76
74
|
role: role,
|
77
75
|
scheme: scheme,
|
78
|
-
show_dividers: show_dividers
|
79
|
-
aria: { label: "Action List" }
|
76
|
+
show_dividers: show_dividers
|
80
77
|
)) do |component|
|
81
78
|
component.with_heading(title: "Action List")
|
82
79
|
component.with_item(label: "Leading SVG visual", href: "/") do |item|
|
@@ -113,14 +110,9 @@ module Primer
|
|
113
110
|
list_id: "unique-id",
|
114
111
|
subtitle: "This is a subtitle"
|
115
112
|
)
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
title: title,
|
120
|
-
list_id: list_id,
|
121
|
-
subtitle: subtitle
|
122
|
-
}
|
123
|
-
)
|
113
|
+
render(Primer::Alpha::ActionList::Heading.new(
|
114
|
+
scheme: scheme, list_id: list_id, title: title, subtitle: subtitle
|
115
|
+
))
|
124
116
|
end
|
125
117
|
|
126
118
|
# @label Item [playground]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render(Primer::Alpha::NavList.new) do |list| %>
|
2
|
+
<% list.with_group do |group| %>
|
3
|
+
<%= group.with_heading(title: "Shopping list") %>
|
4
|
+
<% group.with_item(label: "Bread", href: "/list/1") do |item| %>
|
5
|
+
<%= item.with_trailing_action(show_on_hover: true, icon: :plus, aria: { label: "Activate alert" }, name: "bread_button") %>
|
6
|
+
<% end %>
|
7
|
+
<% group.with_item(label: "Cheese", href: "/list/2") do |item| %>
|
8
|
+
<%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "cheese_button") %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<script type="text/javascript" data-eval="true">
|
14
|
+
const breadButton = document.querySelector("[name=bread_button]")
|
15
|
+
breadButton.addEventListener("click", () => alert("You selected bread."))
|
16
|
+
|
17
|
+
const cheeseButton = document.querySelector("[name=cheese_button]")
|
18
|
+
cheeseButton.addEventListener("click", () => alert("You selected cheese."))
|
19
|
+
</script>
|
@@ -7,22 +7,22 @@ module Primer
|
|
7
7
|
# @label Playground
|
8
8
|
def playground
|
9
9
|
render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
|
10
|
-
list.
|
11
|
-
|
10
|
+
list.with_group do |group|
|
11
|
+
group.with_heading(title: "Repository settings")
|
12
12
|
|
13
|
-
|
13
|
+
group.with_item(label: "General", href: "/general") do |item|
|
14
14
|
item.with_leading_visual_icon(icon: :gear)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
list.
|
19
|
-
|
18
|
+
list.with_group do |group|
|
19
|
+
group.with_heading(title: "Access")
|
20
20
|
|
21
|
-
|
21
|
+
group.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
|
22
22
|
item.with_leading_visual_icon(icon: :people)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
group.with_item(label: "Moderation options") do |item|
|
26
26
|
item.with_leading_visual_icon(icon: :"comment-discussion")
|
27
27
|
|
28
28
|
item.with_item(label: "Interaction limits", href: "/interaction-limits", selected_by_ids: :interaction_limits)
|
@@ -36,22 +36,22 @@ module Primer
|
|
36
36
|
# @label Default
|
37
37
|
def default
|
38
38
|
render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
|
39
|
-
list.
|
40
|
-
|
39
|
+
list.with_group do |group|
|
40
|
+
group.with_heading(title: "Repository settings")
|
41
41
|
|
42
|
-
|
42
|
+
group.with_item(label: "General", href: "/general") do |item|
|
43
43
|
item.with_leading_visual_icon(icon: :gear)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
list.
|
48
|
-
|
47
|
+
list.with_group do |group|
|
48
|
+
group.with_heading(title: "Access")
|
49
49
|
|
50
|
-
|
50
|
+
group.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
|
51
51
|
item.with_leading_visual_icon(icon: :people)
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
group.with_item(label: "Moderation options") do |item|
|
55
55
|
item.with_leading_visual_icon(icon: :"comment-discussion")
|
56
56
|
|
57
57
|
item.with_item(label: "Interaction limits", href: "/interaction-limits", selected_by_ids: :interaction_limits)
|
@@ -65,28 +65,17 @@ module Primer
|
|
65
65
|
# @label Show more item
|
66
66
|
def show_more_item
|
67
67
|
render(Primer::Alpha::NavList.new) do |list|
|
68
|
-
list.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
list.with_group do |group|
|
69
|
+
group.with_heading(title: "My favorite foods")
|
70
|
+
group.with_item(label: "Popplers", href: "/foods/popplers")
|
71
|
+
group.with_item(label: "Slurm", href: "/foods/slurm")
|
72
|
+
group.with_show_more_item(label: "Show more", src: "/nav_list_items", pages: 2)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
# @label Trailing action
|
78
78
|
def trailing_action
|
79
|
-
render(Primer::Alpha::NavList.new) do |list|
|
80
|
-
list.with_section(aria: { label: "List of items to buy" }) do |section|
|
81
|
-
section.with_heading(title: "Shopping list")
|
82
|
-
section.with_item(label: "Bread", href: "/list/1") do |item|
|
83
|
-
item.with_trailing_action(show_on_hover: true, icon: :plus, aria: { label: "Button tooltip" })
|
84
|
-
end
|
85
|
-
section.with_item(label: "Cheese", href: "/list/2") do |item|
|
86
|
-
item.with_trailing_action(icon: :plus, aria: { label: "Button tooltip" })
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
79
|
end
|
91
80
|
end
|
92
81
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div style="width:100%; height: 400px; display: flex; justify-content: center; align-items: center;">
|
2
|
+
<%= render(Primer::Alpha::Overlay.new(
|
3
|
+
title: title,
|
4
|
+
subtitle: subtitle,
|
5
|
+
role: role,
|
6
|
+
size: size,
|
7
|
+
placement: placement,
|
8
|
+
anchor_align: anchor_align,
|
9
|
+
anchor_side: anchor_side,
|
10
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
11
|
+
visually_hide_title: visually_hide_title,
|
12
|
+
)) do |d| %>
|
13
|
+
<% d.with_header(title: title, size: header_size) %>
|
14
|
+
<% d.with_show_button { button_text } %>
|
15
|
+
<% d.with_body { body_text } %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
# @label Overlay
|
6
|
+
class OverlayPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param title [String] text
|
10
|
+
# @param subtitle [String] text
|
11
|
+
# @param role [Symbol] select [dialog, menu]
|
12
|
+
# @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
|
13
|
+
# @param padding [Symbol] select [normal, condensed, none]
|
14
|
+
# @param anchor_align [Symbol] select [start, center, end]
|
15
|
+
# @param anchor_offset [Symbol] select [normal, spacious]
|
16
|
+
# @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
|
17
|
+
# @param allow_out_of_bounds [Boolean] toggle
|
18
|
+
# @param visually_hide_title [Boolean] toggle
|
19
|
+
#
|
20
|
+
# @param header_size [Symbol] select [medium, large]
|
21
|
+
# @param button_text [String] text
|
22
|
+
# @param body_text [String] text
|
23
|
+
# @param icon [Symbol] octicon
|
24
|
+
def playground(title: "Test Overlay", subtitle: nil, role: :dialog, size: :auto, padding: :normal, anchor_align: :center, anchor_offset: :normal, anchor_side: :outside_bottom, allow_out_of_bounds: false, visually_hide_title: false, header_size: :medium, button_text: "Show Overlay", body_text: "", icon: :none)
|
25
|
+
render(Primer::Alpha::Overlay.new(
|
26
|
+
title: title,
|
27
|
+
subtitle: subtitle,
|
28
|
+
role: role,
|
29
|
+
size: size,
|
30
|
+
padding: padding,
|
31
|
+
anchor_align: anchor_align,
|
32
|
+
anchor_offset: anchor_offset,
|
33
|
+
anchor_side: anchor_side,
|
34
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
35
|
+
visually_hide_title: visually_hide_title,
|
36
|
+
)) do |d|
|
37
|
+
d.with_header(title: title, size: header_size)
|
38
|
+
if icon.present? and icon != :none
|
39
|
+
d.with_show_button(icon: icon, "aria-label": icon.to_s)
|
40
|
+
else
|
41
|
+
d.with_show_button { button_text }
|
42
|
+
end
|
43
|
+
d.with_body { body_text }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# @label Default
|
48
|
+
#
|
49
|
+
# @param title [String] text
|
50
|
+
# @param subtitle [String] text
|
51
|
+
# @param role [Symbol] select [dialog, menu]
|
52
|
+
# @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
|
53
|
+
# @param padding [Symbol] select [normal, condensed, none]
|
54
|
+
# @param anchor_align [Symbol] select [start, center, end]
|
55
|
+
# @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
|
56
|
+
# @param allow_out_of_bounds [Boolean] toggle
|
57
|
+
# @param visually_hide_title [Boolean] toggle
|
58
|
+
#
|
59
|
+
# @param header_size [Symbol] select [medium, large]
|
60
|
+
# @param button_text [String] text
|
61
|
+
# @param body_text [String] text
|
62
|
+
def default(title: "Test Overlay", subtitle: nil, role: :dialog, size: :auto, padding: :normal, anchor_align: :center, anchor_side: :outside_bottom, allow_out_of_bounds: false, visually_hide_title: false, header_size: :medium, button_text: "Show Overlay", body_text: "")
|
63
|
+
render(Primer::Alpha::Overlay.new(
|
64
|
+
title: title,
|
65
|
+
subtitle: subtitle,
|
66
|
+
role: role,
|
67
|
+
size: size,
|
68
|
+
padding: padding,
|
69
|
+
anchor_align: anchor_align,
|
70
|
+
anchor_side: anchor_side,
|
71
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
72
|
+
visually_hide_title: visually_hide_title,
|
73
|
+
)) do |d|
|
74
|
+
d.with_header(title: title, size: header_size)
|
75
|
+
d.with_show_button { button_text }
|
76
|
+
d.with_body { body_text }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# @label Middle Of Page
|
81
|
+
#
|
82
|
+
# @param title [String] text
|
83
|
+
# @param subtitle [String] text
|
84
|
+
# @param role [Symbol] select [dialog, menu]
|
85
|
+
# @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
|
86
|
+
# @param anchor_align [Symbol] select [start, center, end]
|
87
|
+
# @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
|
88
|
+
# @param allow_out_of_bounds [Boolean] toggle
|
89
|
+
# @param visually_hide_title [Boolean] toggle
|
90
|
+
#
|
91
|
+
# @param header_size [Symbol] select [medium, large]
|
92
|
+
# @param button_text [String] text
|
93
|
+
# @param body_text [String] text
|
94
|
+
def middle_of_page(title: "Test Overlay", subtitle: nil, role: :dialog, size: :auto, placement: :anchored, anchor_align: :center, anchor_side: :outside_bottom, allow_out_of_bounds: false, visually_hide_title: false, header_size: :medium, button_text: "Show Overlay", body_text: "")
|
95
|
+
render_with_template(locals: {
|
96
|
+
title: title,
|
97
|
+
subtitle: subtitle,
|
98
|
+
role: role,
|
99
|
+
size: size,
|
100
|
+
placement: placement,
|
101
|
+
anchor_align: anchor_align,
|
102
|
+
anchor_side: anchor_side,
|
103
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
104
|
+
visually_hide_title: visually_hide_title,
|
105
|
+
header_size: header_size,
|
106
|
+
button_text: button_text,
|
107
|
+
body_text: body_text
|
108
|
+
})
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render(Primer::Alpha::TabNav.new(label: "With icons and counters")) do |component| %>
|
2
|
+
<% component.with_tab(selected: true, href: "#") { "Tab 1" } %>
|
3
|
+
<% component.with_tab(href: "#") { "Tab 2" } %>
|
4
|
+
<% component.with_tab(href: "#") { "Tab 3" } %>
|
5
|
+
<% component.with_extra(align: align) do %>
|
6
|
+
<%= render(Primer::Beta::Button.new) { "Extra Button" } %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= render(Primer::Alpha::TabPanels.new(label: "label")) do |component| %>
|
2
|
+
<% component.with_tab(selected: true, id: "tab-1") do |tab| %>
|
3
|
+
<% tab.with_panel { "Panel 1" } %>
|
4
|
+
<% tab.with_text { "Tab 1" } %>
|
5
|
+
<% end %>
|
6
|
+
<% component.with_tab(id: "tab-2") do |tab| %>
|
7
|
+
<% tab.with_panel { "Panel 2" } %>
|
8
|
+
<% tab.with_text { "Tab 2" } %>
|
9
|
+
<% end %>
|
10
|
+
<% component.with_tab(id: "tab-3") do |tab| %>
|
11
|
+
<% tab.with_panel { "Panel 3" } %>
|
12
|
+
<% tab.with_text { "Tab 3" } %>
|
13
|
+
<% end %>
|
14
|
+
<% component.with_extra(align: align) do %>
|
15
|
+
<%= render(Primer::Beta::Button.new) { "Extra Button" } %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|