primer_view_components 0.3.1 → 0.4.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 +16 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_bar_element.d.ts +16 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_menu/action_menu_element.d.ts +30 -0
- data/app/assets/javascripts/app/components/primer/alpha/dropdown/menu.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/alpha/dropdown.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/alpha/image_crop.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/alpha/modal_dialog.d.ts +18 -0
- data/app/assets/javascripts/app/components/primer/alpha/nav_list.d.ts +28 -0
- data/app/assets/javascripts/app/components/primer/alpha/segmented_control.d.ts +12 -0
- data/app/assets/javascripts/app/components/primer/alpha/tab_container.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/alpha/toggle_switch.d.ts +30 -0
- data/app/assets/javascripts/app/components/primer/alpha/tool_tip.d.ts +26 -0
- data/app/assets/javascripts/app/components/primer/alpha/x_banner.d.ts +11 -0
- data/app/assets/javascripts/app/components/primer/anchored_position.d.ts +27 -0
- data/app/assets/javascripts/app/components/primer/beta/auto_complete/auto_complete.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/beta/clipboard_copy.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/beta/relative_time.d.ts +1 -0
- data/app/assets/javascripts/app/components/primer/focus_group.d.ts +19 -0
- data/app/assets/javascripts/app/components/primer/primer.d.ts +21 -0
- data/app/assets/javascripts/lib/primer/forms/primer_multi_input.d.ts +10 -0
- data/app/assets/javascripts/lib/primer/forms/primer_text_field.d.ts +1 -0
- data/app/assets/javascripts/lib/primer/forms/toggle_switch_input.d.ts +5 -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_bar/divider.rb +30 -0
- data/app/components/primer/alpha/action_bar/item.rb +26 -0
- data/app/components/primer/alpha/action_bar.css +1 -0
- data/app/components/primer/alpha/action_bar.css.json +17 -0
- data/app/components/primer/alpha/action_bar.css.map +1 -0
- data/app/components/primer/alpha/action_bar.html.erb +12 -0
- data/app/components/primer/alpha/action_bar.pcss +69 -0
- data/app/components/primer/alpha/action_bar.rb +110 -0
- data/app/components/primer/alpha/action_bar_element.d.ts +16 -0
- data/app/components/primer/alpha/action_bar_element.js +172 -0
- data/app/components/primer/alpha/action_bar_element.ts +175 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -2
- data/app/components/primer/alpha/tool_tip.d.ts +3 -2
- data/app/components/primer/alpha/tool_tip.js +89 -44
- data/app/components/primer/alpha/tool_tip.ts +88 -41
- data/app/components/primer/alpha/tooltip.rb +1 -0
- data/app/components/primer/beta/link.css +1 -1
- data/app/components/primer/beta/link.css.map +1 -1
- data/app/components/primer/beta/link.pcss +4 -0
- data/app/components/primer/beta/link.rb +6 -10
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.pcss +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/lib/primer/static/generate_previews.rb +9 -0
- data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -3
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/yard.rb +5 -0
- data/previews/primer/alpha/action_bar_preview/inline.html.erb +16 -0
- data/previews/primer/alpha/action_bar_preview.rb +77 -0
- data/previews/primer/alpha/action_list_preview.rb +10 -0
- data/previews/primer/alpha/action_menu_preview.rb +5 -0
- data/previews/primer/alpha/auto_complete_preview.rb +1 -0
- data/previews/primer/alpha/banner_preview.rb +9 -1
- data/previews/primer/alpha/button_marketing_preview.rb +2 -0
- data/previews/primer/alpha/check_box_group_preview.rb +1 -0
- data/previews/primer/alpha/check_box_preview.rb +6 -0
- data/previews/primer/alpha/dialog_preview.rb +1 -0
- data/previews/primer/alpha/dropdown_preview.rb +1 -0
- data/previews/primer/alpha/hellip_button_preview.rb +1 -0
- data/previews/primer/alpha/hidden_text_expander_preview.rb +1 -0
- data/previews/primer/alpha/layout_preview.rb +4 -0
- data/previews/primer/alpha/menu_preview.rb +1 -0
- data/previews/primer/alpha/multi_input_preview.rb +4 -0
- data/previews/primer/alpha/nav_list_preview.rb +3 -0
- data/previews/primer/alpha/radio_button_group_preview.rb +2 -0
- data/previews/primer/alpha/radio_button_preview.rb +10 -0
- data/previews/primer/alpha/segmented_control_preview.rb +13 -0
- data/previews/primer/alpha/select_preview.rb +6 -0
- data/previews/primer/alpha/tab_nav_preview.rb +3 -0
- data/previews/primer/alpha/tab_panels_preview.rb +1 -0
- data/previews/primer/alpha/text_area_preview.rb +7 -0
- data/previews/primer/alpha/text_field_preview.rb +15 -0
- data/previews/primer/alpha/toggle_switch_preview.rb +7 -0
- data/previews/primer/alpha/tooltip_preview/tooltip_inside_primer_overlay.html.erb +20 -0
- data/previews/primer/alpha/tooltip_preview.rb +7 -0
- data/previews/primer/alpha/underline_nav_preview.rb +2 -0
- data/previews/primer/beta/auto_complete_item_preview.rb +2 -0
- data/previews/primer/beta/auto_complete_preview.rb +7 -0
- data/previews/primer/beta/avatar_preview.rb +10 -0
- data/previews/primer/beta/avatar_stack_preview.rb +3 -0
- data/previews/primer/beta/blankslate_preview.rb +9 -0
- data/previews/primer/beta/border_box_preview.rb +4 -0
- data/previews/primer/beta/breadcrumbs_preview.rb +1 -0
- data/previews/primer/beta/button_group_preview.rb +4 -0
- data/previews/primer/beta/button_preview.rb +10 -0
- data/previews/primer/beta/clipboard_copy_preview.rb +2 -0
- data/previews/primer/beta/close_button_preview.rb +1 -0
- data/previews/primer/beta/counter_preview.rb +11 -0
- data/previews/primer/beta/flash_preview.rb +8 -0
- data/previews/primer/beta/heading_preview.rb +1 -0
- data/previews/primer/beta/icon_button_preview.rb +3 -0
- data/previews/primer/beta/label_preview.rb +13 -0
- data/previews/primer/beta/link_preview.rb +11 -9
- data/previews/primer/beta/markdown_preview.rb +1 -0
- data/previews/primer/beta/octicon_preview.rb +1 -0
- data/previews/primer/beta/popover_preview.rb +6 -0
- data/previews/primer/beta/progress_bar_preview.rb +4 -0
- data/previews/primer/beta/spinner_preview.rb +1 -0
- data/previews/primer/beta/state_preview.rb +6 -0
- data/previews/primer/beta/subhead_preview.rb +4 -0
- data/previews/primer/beta/text_preview.rb +1 -0
- data/previews/primer/beta/timeline_item_preview.rb +1 -0
- data/previews/primer/beta/truncate_preview.rb +1 -0
- data/previews/primer/box_preview.rb +2 -0
- data/static/arguments.json +51 -7
- data/static/audited_at.json +3 -0
- data/static/classes.json +21 -0
- data/static/constants.json +20 -6
- data/static/info_arch.json +669 -7
- data/static/previews.json +571 -0
- data/static/statuses.json +3 -0
- metadata +43 -8
@@ -22,6 +22,7 @@ module Primer
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# @label Default
|
25
|
+
# @snapshot
|
25
26
|
def default
|
26
27
|
render(Primer::Alpha::TabNav.new(label: "Default")) do |component|
|
27
28
|
component.with_tab(selected: true, href: "#") { "Tab 1" }
|
@@ -31,6 +32,7 @@ module Primer
|
|
31
32
|
end
|
32
33
|
|
33
34
|
# @label With icons and counters
|
35
|
+
# @snapshot
|
34
36
|
def with_icons_and_counters
|
35
37
|
render(Primer::Alpha::TabNav.new(label: "With icons and counters")) do |component|
|
36
38
|
component.with_tab(href: "#1", selected: true) do |tab|
|
@@ -52,6 +54,7 @@ module Primer
|
|
52
54
|
end
|
53
55
|
|
54
56
|
# @param align [Symbol] select [left, right]
|
57
|
+
# @snapshot
|
55
58
|
def with_extra(align: :right)
|
56
59
|
render_with_template(locals: { align: align })
|
57
60
|
end
|
@@ -23,6 +23,7 @@ module Primer
|
|
23
23
|
#
|
24
24
|
# @param number_of_panels [Integer] number
|
25
25
|
# @param align [Symbol] select [left, right]
|
26
|
+
# @snapshot
|
26
27
|
def default(number_of_panels: 3, align: :left)
|
27
28
|
render(Primer::Alpha::TabPanels.new(label: "label", align: align)) do |component|
|
28
29
|
Array.new(number_of_panels || 3) do |i|
|
@@ -45,6 +45,7 @@ module Primer
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# @label Default
|
48
|
+
# @snapshot
|
48
49
|
def default
|
49
50
|
render(Primer::Alpha::TextArea.new(name: "my-text-area", label: "Tell me about yourself"))
|
50
51
|
end
|
@@ -52,31 +53,37 @@ module Primer
|
|
52
53
|
# @!group Options
|
53
54
|
#
|
54
55
|
# @label With caption
|
56
|
+
# @snapshot
|
55
57
|
def with_caption
|
56
58
|
render(Primer::Alpha::TextArea.new(caption: "With a caption", name: "my-text-area", label: "Tell me about yourself"))
|
57
59
|
end
|
58
60
|
|
59
61
|
# @label Visually hidden label
|
62
|
+
# @snapshot
|
60
63
|
def visually_hide_label
|
61
64
|
render(Primer::Alpha::TextArea.new(visually_hide_label: true, name: "my-text-area", label: "Tell me about yourself"))
|
62
65
|
end
|
63
66
|
|
64
67
|
# @label Full width
|
68
|
+
# @snapshot
|
65
69
|
def full_width
|
66
70
|
render(Primer::Alpha::TextArea.new(full_width: true, name: "my-text-area", label: "Tell me about yourself"))
|
67
71
|
end
|
68
72
|
|
69
73
|
# @label Disabled
|
74
|
+
# @snapshot
|
70
75
|
def disabled
|
71
76
|
render(Primer::Alpha::TextArea.new(disabled: true, name: "my-text-area", label: "Tell me about yourself"))
|
72
77
|
end
|
73
78
|
|
74
79
|
# @label Invalid
|
80
|
+
# @snapshot
|
75
81
|
def invalid
|
76
82
|
render(Primer::Alpha::TextArea.new(invalid: true, name: "my-text-area", label: "Tell me about yourself"))
|
77
83
|
end
|
78
84
|
|
79
85
|
# @label With validation message
|
86
|
+
# @snapshot
|
80
87
|
def with_validation_message
|
81
88
|
render(Primer::Alpha::TextArea.new(validation_message: "An error occurred!", name: "my-text-area", label: "Tell me about yourself"))
|
82
89
|
end
|
@@ -72,6 +72,7 @@ module Primer
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# @label Default
|
75
|
+
# @snapshot
|
75
76
|
def default
|
76
77
|
render(Primer::Alpha::TextField.new(name: "my-text-field", label: "My text field"))
|
77
78
|
end
|
@@ -79,16 +80,19 @@ module Primer
|
|
79
80
|
# @!group Sizes
|
80
81
|
#
|
81
82
|
# @label Small
|
83
|
+
# @snapshot
|
82
84
|
def size_small
|
83
85
|
render(Primer::Alpha::TextField.new(size: :small, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
84
86
|
end
|
85
87
|
|
86
88
|
# @label Medium
|
89
|
+
# @snapshot
|
87
90
|
def size_medium
|
88
91
|
render(Primer::Alpha::TextField.new(size: :medium, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
89
92
|
end
|
90
93
|
|
91
94
|
# @label Large
|
95
|
+
# @snapshot
|
92
96
|
def size_large
|
93
97
|
render(Primer::Alpha::TextField.new(size: :large, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
94
98
|
end
|
@@ -98,56 +102,67 @@ module Primer
|
|
98
102
|
# @!group Options
|
99
103
|
#
|
100
104
|
# @label With caption
|
105
|
+
# @snapshot
|
101
106
|
def with_caption
|
102
107
|
render(Primer::Alpha::TextField.new(caption: "With a caption", name: "my-text-field", label: "My text field"))
|
103
108
|
end
|
104
109
|
|
105
110
|
# @label Visually hidden label
|
111
|
+
# @snapshot
|
106
112
|
def visually_hide_label
|
107
113
|
render(Primer::Alpha::TextField.new(visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
108
114
|
end
|
109
115
|
|
110
116
|
# @label Show clear button
|
117
|
+
# @snapshot
|
111
118
|
def show_clear_button
|
112
119
|
render(Primer::Alpha::TextField.new(show_clear_button: true, name: "my-text-field", label: "My text field"))
|
113
120
|
end
|
114
121
|
|
115
122
|
# @label Full width
|
123
|
+
# @snapshot
|
116
124
|
def full_width
|
117
125
|
render(Primer::Alpha::TextField.new(full_width: true, name: "my-text-field", label: "My text field"))
|
118
126
|
end
|
119
127
|
|
120
128
|
# @label Disabled
|
129
|
+
# @snapshot
|
121
130
|
def disabled
|
122
131
|
render(Primer::Alpha::TextField.new(disabled: true, name: "my-text-field", label: "My text field"))
|
123
132
|
end
|
124
133
|
|
125
134
|
# @label Invalid
|
135
|
+
# @snapshot
|
126
136
|
def invalid
|
127
137
|
render(Primer::Alpha::TextField.new(invalid: true, name: "my-text-field", label: "My text field"))
|
128
138
|
end
|
129
139
|
|
130
140
|
# @label With placeholder
|
141
|
+
# @snapshot
|
131
142
|
def with_placeholder
|
132
143
|
render(Primer::Alpha::TextField.new(placeholder: "with a placeholder", name: "my-text-field", label: "My text field"))
|
133
144
|
end
|
134
145
|
|
135
146
|
# @label Inset
|
147
|
+
# @snapshot
|
136
148
|
def inset
|
137
149
|
render(Primer::Alpha::TextField.new(inset: true, name: "my-text-field", label: "My text field"))
|
138
150
|
end
|
139
151
|
|
140
152
|
# @label Monospace
|
153
|
+
# @snapshot
|
141
154
|
def monospace
|
142
155
|
render(Primer::Alpha::TextField.new(monospace: true, name: "my-text-field", label: "My text field"))
|
143
156
|
end
|
144
157
|
|
145
158
|
# @label With leading visual
|
159
|
+
# @snapshot
|
146
160
|
def with_leading_visual
|
147
161
|
render(Primer::Alpha::TextField.new(leading_visual: { icon: :search }, name: "my-text-field", label: "My text field"))
|
148
162
|
end
|
149
163
|
|
150
164
|
# @label With validation message
|
165
|
+
# @snapshot
|
151
166
|
def with_validation_message
|
152
167
|
render(Primer::Alpha::TextField.new(validation_message: "An error occurred!", name: "my-text-field", label: "My text field"))
|
153
168
|
end
|
@@ -12,30 +12,37 @@ module Primer
|
|
12
12
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
|
13
13
|
end
|
14
14
|
|
15
|
+
# @snapshot
|
15
16
|
def default
|
16
17
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
|
17
18
|
end
|
18
19
|
|
20
|
+
# @snapshot
|
19
21
|
def checked
|
20
22
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true))
|
21
23
|
end
|
22
24
|
|
25
|
+
# @snapshot
|
23
26
|
def disabled
|
24
27
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, enabled: false))
|
25
28
|
end
|
26
29
|
|
30
|
+
# @snapshot
|
27
31
|
def checked_disabled
|
28
32
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true, enabled: false))
|
29
33
|
end
|
30
34
|
|
35
|
+
# @snapshot
|
31
36
|
def small
|
32
37
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, size: :small))
|
33
38
|
end
|
34
39
|
|
40
|
+
# @snapshot
|
35
41
|
def with_status_label_position_end
|
36
42
|
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, status_label_position: :end))
|
37
43
|
end
|
38
44
|
|
45
|
+
# @snapshot
|
39
46
|
def with_a_bad_src
|
40
47
|
render(ToggleSwitch.new(src: "/foo"))
|
41
48
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= render(Primer::Alpha::Overlay.new(
|
2
|
+
title: "Menu",
|
3
|
+
role: :dialog,
|
4
|
+
)) do |d| %>
|
5
|
+
<% d.with_show_button do |b| %>
|
6
|
+
Open Overlay
|
7
|
+
<% b.with_tooltip(text: "Opens an overlay") %>
|
8
|
+
<% end %>
|
9
|
+
<% d.with_header do %>
|
10
|
+
An overlay
|
11
|
+
<% end %>
|
12
|
+
<% d.with_body do %>
|
13
|
+
|
14
|
+
<%= render(Primer::Beta::Button.new(id: "overlay-button")) do |b| %>
|
15
|
+
<% b.with_tooltip(text: "This is a tooltip in an Overlay") %>
|
16
|
+
A button
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
@@ -88,6 +88,13 @@ module Primer
|
|
88
88
|
render(Primer::Beta::IconButton.new(icon: :search, "aria-label": tooltip_text, tooltip_direction: direction))
|
89
89
|
end
|
90
90
|
# @!endgroup
|
91
|
+
|
92
|
+
# @label Tooltip inside Primer::Alpha::Overlay
|
93
|
+
def tooltip_inside_primer_overlay(direction: :s, tooltip_text: "You can press a button")
|
94
|
+
render_with_template(
|
95
|
+
locals: {}
|
96
|
+
)
|
97
|
+
end
|
91
98
|
end
|
92
99
|
end
|
93
100
|
end
|
@@ -20,6 +20,7 @@ module Primer
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @label Default options
|
23
|
+
# @snapshot
|
23
24
|
#
|
24
25
|
# @param label [String] text
|
25
26
|
# @param tag [Symbol] select [div, nav]
|
@@ -35,6 +36,7 @@ module Primer
|
|
35
36
|
end
|
36
37
|
|
37
38
|
# @label With icons and counters
|
39
|
+
# @snapshot
|
38
40
|
#
|
39
41
|
# @param label [String] text
|
40
42
|
# @param tag [Symbol] select [div, nav]
|
@@ -23,6 +23,7 @@ module Primer
|
|
23
23
|
# @param selected toggle
|
24
24
|
# @param disabled toggle
|
25
25
|
# @param value text
|
26
|
+
# @snapshot
|
26
27
|
def default(value: "", selected: false, disabled: false)
|
27
28
|
render_with_template(
|
28
29
|
locals: {
|
@@ -38,6 +39,7 @@ module Primer
|
|
38
39
|
# @param selected toggle
|
39
40
|
# @param disabled toggle
|
40
41
|
# @param value text
|
42
|
+
# @snapshot
|
41
43
|
def with_description(description_variant: "block", value: "", selected: false, disabled: false)
|
42
44
|
description_variant = description_variant.to_sym
|
43
45
|
|
@@ -79,6 +79,7 @@ module Primer
|
|
79
79
|
end
|
80
80
|
|
81
81
|
# @label Leading visual
|
82
|
+
# @snapshot
|
82
83
|
# @param label_text text
|
83
84
|
# @param show_clear_button toggle
|
84
85
|
# @param visually_hide_label toggle
|
@@ -98,6 +99,7 @@ module Primer
|
|
98
99
|
end
|
99
100
|
|
100
101
|
# @label Trailing action
|
102
|
+
# @snapshot
|
101
103
|
# @param label_text text
|
102
104
|
# @param show_clear_button toggle
|
103
105
|
# @param visually_hide_label toggle
|
@@ -115,6 +117,7 @@ module Primer
|
|
115
117
|
end
|
116
118
|
|
117
119
|
# @label Full width
|
120
|
+
# @snapshot
|
118
121
|
# @param label_text text
|
119
122
|
# @param show_clear_button toggle
|
120
123
|
# @param visually_hide_label toggle
|
@@ -134,6 +137,7 @@ module Primer
|
|
134
137
|
end
|
135
138
|
|
136
139
|
# @label Visually hide label
|
140
|
+
# @snapshot
|
137
141
|
# @param label_text text
|
138
142
|
# @param show_clear_button toggle
|
139
143
|
# @param visually_hide_label toggle
|
@@ -166,6 +170,7 @@ module Primer
|
|
166
170
|
# @param input_id text
|
167
171
|
# @param list_id text
|
168
172
|
# @param input_name text
|
173
|
+
# @snapshot
|
169
174
|
def small(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :small, full_width: false, width: :auto, disabled: false, invalid: false, input_id: "input-id-1", list_id: "list-id-1", input_name: "input-id-1")
|
170
175
|
render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, width: width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
|
171
176
|
component.with_leading_visual_icon(icon: :search)
|
@@ -184,6 +189,7 @@ module Primer
|
|
184
189
|
# @param input_id text
|
185
190
|
# @param list_id text
|
186
191
|
# @param input_name text
|
192
|
+
# @snapshot
|
187
193
|
def medium(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, width: :auto, disabled: false, invalid: false, input_id: "input-id-2", list_id: "list-id-2", input_name: "input-id-2")
|
188
194
|
render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, width: width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
|
189
195
|
component.with_leading_visual_icon(icon: :search)
|
@@ -202,6 +208,7 @@ module Primer
|
|
202
208
|
# @param input_id text
|
203
209
|
# @param list_id text
|
204
210
|
# @param input_name text
|
211
|
+
# @snapshot
|
205
212
|
def large(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :large, full_width: false, width: :auto, disabled: false, invalid: false, input_id: "input-id-3", list_id: "list-id-3", input_name: "input-id-3")
|
206
213
|
render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, width: width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
|
207
214
|
component.with_leading_visual_icon(icon: :search)
|
@@ -14,6 +14,7 @@ module Primer
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# @label Default
|
17
|
+
# @snapshot
|
17
18
|
def default
|
18
19
|
render(Primer::Beta::Avatar.new(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
19
20
|
end
|
@@ -28,36 +29,43 @@ module Primer
|
|
28
29
|
# @!group Sizes
|
29
30
|
#
|
30
31
|
# @label 16px
|
32
|
+
# @snapshot
|
31
33
|
def size_16
|
32
34
|
render(Primer::Beta::Avatar.new(size: 16, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
33
35
|
end
|
34
36
|
|
35
37
|
# @label 20px
|
38
|
+
# @snapshot
|
36
39
|
def size_20
|
37
40
|
render(Primer::Beta::Avatar.new(size: 20, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
38
41
|
end
|
39
42
|
|
40
43
|
# @label 24px
|
44
|
+
# @snapshot
|
41
45
|
def size_24
|
42
46
|
render(Primer::Beta::Avatar.new(size: 24, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
43
47
|
end
|
44
48
|
|
45
49
|
# @label 32px
|
50
|
+
# @snapshot
|
46
51
|
def size_32
|
47
52
|
render(Primer::Beta::Avatar.new(size: 32, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
48
53
|
end
|
49
54
|
|
50
55
|
# @label 40px
|
56
|
+
# @snapshot
|
51
57
|
def size_40
|
52
58
|
render(Primer::Beta::Avatar.new(size: 40, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
53
59
|
end
|
54
60
|
|
55
61
|
# @label 48px
|
62
|
+
# @snapshot
|
56
63
|
def size_48
|
57
64
|
render(Primer::Beta::Avatar.new(size: 48, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
58
65
|
end
|
59
66
|
|
60
67
|
# @label 80px
|
68
|
+
# @snapshot
|
61
69
|
def size_80
|
62
70
|
render(Primer::Beta::Avatar.new(size: 80, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
63
71
|
end
|
@@ -67,11 +75,13 @@ module Primer
|
|
67
75
|
# @!group Shape
|
68
76
|
#
|
69
77
|
# @label Circle
|
78
|
+
# @snapshot
|
70
79
|
def shape_circle
|
71
80
|
render(Primer::Beta::Avatar.new(shape: :circle, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
72
81
|
end
|
73
82
|
|
74
83
|
# @label Square
|
84
|
+
# @snapshot
|
75
85
|
def shape_square
|
76
86
|
render(Primer::Beta::Avatar.new(shape: :square, src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser"))
|
77
87
|
end
|
@@ -20,6 +20,7 @@ module Primer
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @label Default
|
23
|
+
# @snapshot
|
23
24
|
def default
|
24
25
|
render(Primer::Beta::AvatarStack.new) do |component|
|
25
26
|
component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
|
@@ -36,6 +37,7 @@ module Primer
|
|
36
37
|
end
|
37
38
|
|
38
39
|
# @label 2 avatars
|
40
|
+
# @snapshot
|
39
41
|
def avatar_2
|
40
42
|
render(Primer::Beta::AvatarStack.new) do |component|
|
41
43
|
component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
|
@@ -44,6 +46,7 @@ module Primer
|
|
44
46
|
end
|
45
47
|
|
46
48
|
# @label 3 avatars
|
49
|
+
# @snapshot
|
47
50
|
def avatar_3
|
48
51
|
render(Primer::Beta::AvatarStack.new) do |component|
|
49
52
|
component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
|
@@ -17,6 +17,7 @@ module Primer
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# @label Default options
|
20
|
+
# @snapshot
|
20
21
|
def default
|
21
22
|
render Primer::Beta::Blankslate.new do |component|
|
22
23
|
component.with_heading(tag: :h2).with_content("Title")
|
@@ -43,6 +44,7 @@ module Primer
|
|
43
44
|
end
|
44
45
|
|
45
46
|
# @label Border
|
47
|
+
# @snapshot
|
46
48
|
def option_border
|
47
49
|
render Primer::Beta::Blankslate.new(border: true) do |component|
|
48
50
|
component.with_heading(tag: :h2).with_content("Title")
|
@@ -55,6 +57,7 @@ module Primer
|
|
55
57
|
# @param narrow [Boolean] toggle
|
56
58
|
# @param spacious [Boolean] toggle
|
57
59
|
# @param border [Boolean] toggle
|
60
|
+
# @snapshot
|
58
61
|
def with_icon(narrow: false, spacious: false, border: false)
|
59
62
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
60
63
|
component.with_visual_icon(icon: :shield)
|
@@ -65,6 +68,7 @@ module Primer
|
|
65
68
|
# @param narrow [Boolean] toggle
|
66
69
|
# @param spacious [Boolean] toggle
|
67
70
|
# @param border [Boolean] toggle
|
71
|
+
# @snapshot
|
68
72
|
def with_image(narrow: false, spacious: false, border: false)
|
69
73
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
70
74
|
component.with_heading(tag: :h2).with_content("Millions of teams trust GitHub to keep their work safe")
|
@@ -75,6 +79,7 @@ module Primer
|
|
75
79
|
# @param narrow [Boolean] toggle
|
76
80
|
# @param spacious [Boolean] toggle
|
77
81
|
# @param border [Boolean] toggle
|
82
|
+
# @snapshot
|
78
83
|
def loading(narrow: false, spacious: false, border: false)
|
79
84
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
80
85
|
component.with_heading(tag: :h2).with_content("Mirroring your repository")
|
@@ -86,6 +91,7 @@ module Primer
|
|
86
91
|
# @param narrow [Boolean] toggle
|
87
92
|
# @param spacious [Boolean] toggle
|
88
93
|
# @param border [Boolean] toggle
|
94
|
+
# @snapshot
|
89
95
|
def description(narrow: false, spacious: false, border: false)
|
90
96
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
91
97
|
component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
|
@@ -96,6 +102,7 @@ module Primer
|
|
96
102
|
# @param narrow [Boolean] toggle
|
97
103
|
# @param spacious [Boolean] toggle
|
98
104
|
# @param border [Boolean] toggle
|
105
|
+
# @snapshot
|
99
106
|
def primary_action(narrow: false, spacious: false, border: false)
|
100
107
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
101
108
|
component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
|
@@ -106,6 +113,7 @@ module Primer
|
|
106
113
|
# @param narrow [Boolean] toggle
|
107
114
|
# @param spacious [Boolean] toggle
|
108
115
|
# @param border [Boolean] toggle
|
116
|
+
# @snapshot
|
109
117
|
def secondary_action(narrow: false, spacious: false, border: false)
|
110
118
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
111
119
|
component.with_heading(tag: :h2).with_content("It looks like we have discovered a vulnerability")
|
@@ -116,6 +124,7 @@ module Primer
|
|
116
124
|
# @param narrow [Boolean] toggle
|
117
125
|
# @param spacious [Boolean] toggle
|
118
126
|
# @param border [Boolean] toggle
|
127
|
+
# @snapshot
|
119
128
|
def full(narrow: false, spacious: false, border: false)
|
120
129
|
render Primer::Beta::Blankslate.new(narrow: narrow, spacious: spacious, border: border) do |component|
|
121
130
|
component.with_visual_icon(icon: :shield)
|
@@ -20,6 +20,7 @@ module Primer
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @label Default
|
23
|
+
# @snapshot
|
23
24
|
def default
|
24
25
|
render(Primer::Beta::BorderBox.new) do |component|
|
25
26
|
component.with_header { "Header" }
|
@@ -45,6 +46,7 @@ module Primer
|
|
45
46
|
end
|
46
47
|
|
47
48
|
# @label Row colors
|
49
|
+
# @snapshot
|
48
50
|
def row_colors
|
49
51
|
render(Primer::Beta::BorderBox.new) do |component|
|
50
52
|
component.with_row(scheme: :default) { "Default" }
|
@@ -69,6 +71,7 @@ module Primer
|
|
69
71
|
end
|
70
72
|
|
71
73
|
# @label Condensed
|
74
|
+
# @snapshot
|
72
75
|
def padding_condensed
|
73
76
|
render(Primer::Beta::BorderBox.new(padding: :condensed)) do |component|
|
74
77
|
component.with_header { "Header" }
|
@@ -81,6 +84,7 @@ module Primer
|
|
81
84
|
end
|
82
85
|
|
83
86
|
# @label Spacious
|
87
|
+
# @snapshot
|
84
88
|
def padding_spacious
|
85
89
|
render(Primer::Beta::BorderBox.new(padding: :spacious)) do |component|
|
86
90
|
component.with_header { "Header" }
|
@@ -19,6 +19,7 @@ module Primer
|
|
19
19
|
# @label Default options
|
20
20
|
#
|
21
21
|
# @param size [Symbol] select [medium, small]
|
22
|
+
# @snapshot
|
22
23
|
def default(size: :medium)
|
23
24
|
render(Primer::Beta::ButtonGroup.new(size: size)) do |component|
|
24
25
|
component.with_button { "Button 1" }
|
@@ -30,6 +31,7 @@ module Primer
|
|
30
31
|
# @label Split button
|
31
32
|
#
|
32
33
|
# @param size [Symbol] select [medium, small]
|
34
|
+
# @snapshot
|
33
35
|
def split_button(size: :medium)
|
34
36
|
render(Primer::Beta::ButtonGroup.new(size: size)) do |component|
|
35
37
|
component.with_button { "Button 1" }
|
@@ -40,6 +42,7 @@ module Primer
|
|
40
42
|
# @label Icon buttons
|
41
43
|
#
|
42
44
|
# @param size [Symbol] select [medium, small]
|
45
|
+
# @snapshot
|
43
46
|
def icon_buttons(size: :medium)
|
44
47
|
render(Primer::Beta::ButtonGroup.new(size: size)) do |component|
|
45
48
|
component.with_button(icon: :note, "aria-label": "button 1")
|
@@ -49,6 +52,7 @@ module Primer
|
|
49
52
|
end
|
50
53
|
|
51
54
|
# @label Button group with all tags
|
55
|
+
# @snapshot
|
52
56
|
def all_tags
|
53
57
|
render(Primer::Beta::ButtonGroup.new) do |component|
|
54
58
|
component.with_button(id: "button-1", tag: :button) do |component|
|
@@ -12,6 +12,7 @@ module Primer
|
|
12
12
|
# | :outline | :default or :invisible | option for :scheme |
|
13
13
|
# | dropdown | trailing action icon slot | see trailing action preview for markup |
|
14
14
|
#
|
15
|
+
|
15
16
|
# @label Playground
|
16
17
|
# @param scheme select [default, primary, danger, invisible, link]
|
17
18
|
# @param size select [small, medium, large]
|
@@ -130,6 +131,7 @@ module Primer
|
|
130
131
|
end
|
131
132
|
|
132
133
|
# @label Invisible all visuals
|
134
|
+
# @snapshot
|
133
135
|
def invisible_all_visuals
|
134
136
|
render_with_template(locals: {})
|
135
137
|
end
|
@@ -138,6 +140,7 @@ module Primer
|
|
138
140
|
# @param block toggle
|
139
141
|
# @param disabled toggle
|
140
142
|
# @param tag select [a, summary, button]
|
143
|
+
# @snapshot
|
141
144
|
def link(
|
142
145
|
id: "button-preview",
|
143
146
|
block: false,
|
@@ -157,6 +160,7 @@ module Primer
|
|
157
160
|
end
|
158
161
|
|
159
162
|
# @label All schemes
|
163
|
+
# @snapshot
|
160
164
|
def all_schemes
|
161
165
|
render_with_template(locals: {})
|
162
166
|
end
|
@@ -164,6 +168,7 @@ module Primer
|
|
164
168
|
# @label Full width
|
165
169
|
# @param disabled toggle
|
166
170
|
# @param tag select [a, summary, button]
|
171
|
+
# @snapshot
|
167
172
|
def full_width(
|
168
173
|
id: "button-preview",
|
169
174
|
tag: :button,
|
@@ -186,6 +191,7 @@ module Primer
|
|
186
191
|
# @param size select [small, medium]
|
187
192
|
# @param block toggle
|
188
193
|
# @param align_content select [center, start]
|
194
|
+
# @snapshot
|
189
195
|
def link_as_button(
|
190
196
|
scheme: :default,
|
191
197
|
size: :medium,
|
@@ -212,6 +218,7 @@ module Primer
|
|
212
218
|
# @param block toggle
|
213
219
|
# @param align_content select [center, start]
|
214
220
|
# @param tag select [a, summary, button]
|
221
|
+
# @snapshot
|
215
222
|
def trailing_visual(
|
216
223
|
scheme: :default,
|
217
224
|
size: :medium,
|
@@ -235,6 +242,7 @@ module Primer
|
|
235
242
|
# @param size select [small, medium]
|
236
243
|
# @param block toggle
|
237
244
|
# @param align_content select [center, start]
|
245
|
+
# @snapshot
|
238
246
|
def leading_visual(
|
239
247
|
scheme: :invisible,
|
240
248
|
size: :medium,
|
@@ -254,6 +262,7 @@ module Primer
|
|
254
262
|
# @label Trailing action
|
255
263
|
# @param block toggle
|
256
264
|
# @param align_content select [center, start]
|
265
|
+
# @snapshot
|
257
266
|
def trailing_action(
|
258
267
|
block: false,
|
259
268
|
id: "button-preview",
|
@@ -270,6 +279,7 @@ module Primer
|
|
270
279
|
# @param block toggle
|
271
280
|
# @param align_content select [center, start]
|
272
281
|
# @param scheme select [default, primary, danger, invisible]
|
282
|
+
# @snapshot
|
273
283
|
def trailing_counter(
|
274
284
|
block: false,
|
275
285
|
id: "button-preview",
|
@@ -16,6 +16,7 @@ module Primer
|
|
16
16
|
#
|
17
17
|
# @param aria_label [String]
|
18
18
|
# @param value [String]
|
19
|
+
# @snapshot
|
19
20
|
def default(value: "Text to copy", aria_label: "Copy text to the system clipboard")
|
20
21
|
render(Primer::Beta::ClipboardCopy.new(value: value, "aria-label": aria_label))
|
21
22
|
end
|
@@ -24,6 +25,7 @@ module Primer
|
|
24
25
|
#
|
25
26
|
# @param aria_label [String]
|
26
27
|
# @param value [String]
|
28
|
+
# @snapshot
|
27
29
|
def text(value: "Text to copy", aria_label: "Click to copy!")
|
28
30
|
render(Primer::Beta::ClipboardCopy.new(value: value, "aria-label": aria_label)) { "Click to copy!" }
|
29
31
|
end
|