primer_view_components 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -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 +1 -1
- data/app/components/primer/alpha/action_list/heading.html.erb +2 -2
- data/app/components/primer/alpha/action_list/heading.rb +9 -5
- data/app/components/primer/alpha/action_list/item.rb +1 -3
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.html.erb +1 -0
- data/app/components/primer/alpha/action_list.pcss +5 -0
- data/app/components/primer/alpha/action_list.rb +14 -11
- data/app/components/primer/alpha/action_menu.rb +1 -1
- data/app/components/primer/alpha/dialog.rb +4 -0
- data/app/components/primer/alpha/modal_dialog.js +6 -0
- data/app/components/primer/alpha/modal_dialog.ts +6 -0
- data/app/components/primer/alpha/nav_list/divider.rb +14 -0
- data/app/components/primer/alpha/nav_list/group.html.erb +7 -0
- data/app/components/primer/alpha/nav_list/group.rb +24 -11
- data/app/components/primer/alpha/nav_list/item.rb +4 -0
- data/app/components/primer/alpha/nav_list.d.ts +0 -1
- data/app/components/primer/alpha/nav_list.html.erb +9 -4
- data/app/components/primer/alpha/nav_list.js +3 -4
- data/app/components/primer/alpha/nav_list.rb +87 -10
- data/app/components/primer/alpha/nav_list.ts +3 -2
- data/app/components/primer/alpha/overlay/header.html.erb +5 -3
- data/app/components/primer/alpha/overlay/header.rb +4 -1
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +1 -1
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +1 -1
- data/app/components/primer/alpha/overlay.rb +1 -0
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +2 -2
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +10 -8
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +11 -11
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +2 -2
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.json +11 -11
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.d.ts +1 -1
- data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
- data/app/components/primer/alpha/toggle_switch.js +44 -42
- data/app/components/primer/alpha/toggle_switch.pcss +4 -4
- data/app/components/primer/alpha/toggle_switch.rb +7 -0
- data/app/components/primer/alpha/toggle_switch.ts +50 -41
- data/app/components/primer/beta/auto_complete.rb +1 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +2 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +9 -0
- data/app/components/primer/component.rb +3 -96
- data/app/components/primer/focus_group.js +10 -6
- data/app/components/primer/focus_group.ts +10 -5
- data/app/lib/primer/attributes_helper.rb +105 -0
- data/lib/primer/forms/dsl/input.rb +4 -8
- data/lib/primer/forms/dsl/text_field_input.rb +0 -4
- data/lib/primer/forms/dsl/toggle_switch_input.rb +4 -0
- data/lib/primer/forms/form_control.html.erb +3 -5
- data/lib/primer/forms/primer_base_component_wrapper.html.erb +3 -0
- data/lib/primer/forms/primer_base_component_wrapper.rb +24 -0
- data/lib/primer/forms/text_field.rb +6 -0
- data/lib/primer/forms/toggle_switch.html.erb +3 -3
- data/lib/primer/forms/toggle_switch.rb +6 -2
- data/lib/primer/forms/toggle_switch_input.js +7 -2
- data/lib/primer/forms/toggle_switch_input.ts +9 -2
- data/lib/primer/static/generate_info_arch.rb +3 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/component_manifest.rb +1 -1
- data/lib/primer/yard/lookbook_pages_backend.rb +7 -1
- data/lib/primer/yard/registry.rb +4 -0
- data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +10 -10
- data/previews/primer/alpha/nav_list_preview.rb +37 -16
- data/previews/primer/alpha/overlay_preview/middle_of_page_with_relative_container.html.erb +19 -0
- data/previews/primer/alpha/overlay_preview.rb +31 -0
- data/previews/primer/beta/button_preview/trailing_counter.html.erb +11 -0
- data/previews/primer/beta/button_preview.rb +15 -0
- data/previews/primer/box_preview.rb +28 -0
- data/static/arguments.json +29 -13
- data/static/audited_at.json +1 -0
- data/static/classes.json +3 -0
- data/static/constants.json +3 -0
- data/static/info_arch.json +448 -20
- data/static/previews.json +43 -0
- data/static/statuses.json +1 -0
- metadata +10 -9
- data/lib/tasks/docs.rake +0 -185
- data/lib/tasks/helpers/ast_processor.rb +0 -44
- data/lib/tasks/helpers/ast_traverser.rb +0 -77
- data/lib/tasks/primer_view_components.rake +0 -47
- data/lib/tasks/static.rake +0 -29
- data/lib/tasks/test.rake +0 -83
- data/lib/tasks/utilities.rake +0 -109
@@ -6,13 +6,11 @@ module Primer
|
|
6
6
|
class NavListPreview < ViewComponent::Preview
|
7
7
|
# @label Playground
|
8
8
|
def playground
|
9
|
-
render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
|
10
|
-
list.
|
11
|
-
group.with_heading(title: "Repository settings")
|
9
|
+
render(Primer::Alpha::NavList.new(aria: { label: "Repository settings" }, selected_item_id: :code_review_limits)) do |list|
|
10
|
+
list.with_heading(title: "Repository settings")
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
12
|
+
list.with_item(label: "General", href: "/general") do |item|
|
13
|
+
item.with_leading_visual_icon(icon: :gear)
|
16
14
|
end
|
17
15
|
|
18
16
|
list.with_group do |group|
|
@@ -35,13 +33,17 @@ module Primer
|
|
35
33
|
|
36
34
|
# @label Default
|
37
35
|
def default
|
38
|
-
render(Primer::Alpha::NavList.new(selected_item_id: :code_review_limits)) do |list|
|
39
|
-
list.
|
40
|
-
group.with_heading(title: "Repository settings")
|
36
|
+
render(Primer::Alpha::NavList.new(aria: { label: "Repository settings" }, selected_item_id: :code_review_limits)) do |list|
|
37
|
+
list.with_heading(title: "Repository settings")
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
list.with_item(label: "General", href: "/general") do |item|
|
40
|
+
item.with_leading_visual_icon(icon: :gear)
|
41
|
+
end
|
42
|
+
|
43
|
+
list.with_divider
|
44
|
+
|
45
|
+
list.with_item(label: "Settings", href: "/settings") do |item|
|
46
|
+
item.with_leading_visual_icon(icon: :beaker)
|
45
47
|
end
|
46
48
|
|
47
49
|
list.with_group do |group|
|
@@ -62,21 +64,40 @@ module Primer
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
67
|
+
# @label Top-level items
|
68
|
+
#
|
69
|
+
def top_level_items
|
70
|
+
render(Primer::Alpha::NavList.new(aria: { label: "Account settings" })) do |list|
|
71
|
+
list.with_heading(title: "Account settings")
|
72
|
+
|
73
|
+
list.with_item(label: "General", href: "/general") do |item|
|
74
|
+
item.with_leading_visual_icon(icon: :gear)
|
75
|
+
end
|
76
|
+
|
77
|
+
list.with_item(label: "Billing", href: "/billing") do |item|
|
78
|
+
item.with_leading_visual_icon(icon: :"credit-card")
|
79
|
+
end
|
80
|
+
|
81
|
+
list.with_item(label: "Change password", href: "/change_password") do |item|
|
82
|
+
item.with_leading_visual_icon(icon: :key)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
65
87
|
# @label Show more item
|
66
88
|
def show_more_item
|
67
|
-
render(Primer::Alpha::NavList.new) do |list|
|
89
|
+
render(Primer::Alpha::NavList.new(aria: { label: "My favorite foods" })) do |list|
|
68
90
|
list.with_group do |group|
|
69
91
|
group.with_heading(title: "My favorite foods")
|
70
92
|
group.with_item(label: "Popplers", href: "/foods/popplers")
|
71
93
|
group.with_item(label: "Slurm", href: "/foods/slurm")
|
72
|
-
group.with_show_more_item(label: "Show more", src:
|
94
|
+
group.with_show_more_item(label: "Show more foods", src: UrlHelpers.nav_list_items_path, pages: 2)
|
73
95
|
end
|
74
96
|
end
|
75
97
|
end
|
76
98
|
|
77
99
|
# @label Trailing action
|
78
|
-
def trailing_action
|
79
|
-
end
|
100
|
+
def trailing_action; end
|
80
101
|
end
|
81
102
|
end
|
82
103
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div style="width:100%; height: 400px; display: flex; justify-content: center; align-items: center;">
|
2
|
+
<div style="position:relative;">
|
3
|
+
<%= render(Primer::Alpha::Overlay.new(
|
4
|
+
title: title,
|
5
|
+
subtitle: subtitle,
|
6
|
+
role: role,
|
7
|
+
size: size,
|
8
|
+
placement: placement,
|
9
|
+
anchor_align: anchor_align,
|
10
|
+
anchor_side: anchor_side,
|
11
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
12
|
+
visually_hide_title: visually_hide_title,
|
13
|
+
)) do |d| %>
|
14
|
+
<% d.with_header(title: title, size: header_size) %>
|
15
|
+
<% d.with_show_button { button_text } %>
|
16
|
+
<% d.with_body { body_text } %>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -132,6 +132,37 @@ module Primer
|
|
132
132
|
body_text: body_text
|
133
133
|
})
|
134
134
|
end
|
135
|
+
|
136
|
+
# @label Middle Of Page with relative container
|
137
|
+
#
|
138
|
+
# @param title [String] text
|
139
|
+
# @param subtitle [String] text
|
140
|
+
# @param role [Symbol] select [dialog, menu]
|
141
|
+
# @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
|
142
|
+
# @param anchor_align [Symbol] select [start, center, end]
|
143
|
+
# @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
|
144
|
+
# @param allow_out_of_bounds [Boolean] toggle
|
145
|
+
# @param visually_hide_title [Boolean] toggle
|
146
|
+
#
|
147
|
+
# @param header_size [Symbol] select [medium, large]
|
148
|
+
# @param button_text [String] text
|
149
|
+
# @param body_text [String] text
|
150
|
+
def middle_of_page_with_relative_container(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: "")
|
151
|
+
render_with_template(locals: {
|
152
|
+
title: title,
|
153
|
+
subtitle: subtitle,
|
154
|
+
role: role,
|
155
|
+
size: size,
|
156
|
+
placement: placement,
|
157
|
+
anchor_align: anchor_align,
|
158
|
+
anchor_side: anchor_side,
|
159
|
+
allow_out_of_bounds: allow_out_of_bounds,
|
160
|
+
visually_hide_title: visually_hide_title,
|
161
|
+
header_size: header_size,
|
162
|
+
button_text: button_text,
|
163
|
+
body_text: body_text
|
164
|
+
})
|
165
|
+
end
|
135
166
|
end
|
136
167
|
end
|
137
168
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render(Primer::Beta::Button.new(
|
2
|
+
scheme: :primary,
|
3
|
+
size: :medium,
|
4
|
+
block: block,
|
5
|
+
id: id,
|
6
|
+
align_content: align_content
|
7
|
+
)) do |component| %>
|
8
|
+
<% component.with_leading_visual_icon(icon: :star) %>
|
9
|
+
<% component.with_trailing_visual_counter(count: 15) %>
|
10
|
+
Button
|
11
|
+
<% end %>
|
@@ -266,6 +266,21 @@ module Primer
|
|
266
266
|
})
|
267
267
|
end
|
268
268
|
|
269
|
+
# @label Trailing Counter
|
270
|
+
# @param block toggle
|
271
|
+
# @param align_content select [center, start]
|
272
|
+
def trailing_counter(
|
273
|
+
block: false,
|
274
|
+
id: "button-preview",
|
275
|
+
align_content: :center
|
276
|
+
)
|
277
|
+
render_with_template(locals: {
|
278
|
+
block: block,
|
279
|
+
id: id,
|
280
|
+
align_content: align_content
|
281
|
+
})
|
282
|
+
end
|
283
|
+
|
269
284
|
# @label With tooltip
|
270
285
|
# @param scheme select [default, primary, danger, invisible, link]
|
271
286
|
# @param size select [small, medium]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# @label Box
|
5
|
+
class BoxPreview < ViewComponent::Preview
|
6
|
+
# @label Playground
|
7
|
+
#
|
8
|
+
# @param content [String] text
|
9
|
+
def playground(content: "Playground")
|
10
|
+
render(Primer::Box.new) { content }
|
11
|
+
end
|
12
|
+
|
13
|
+
# @label Default
|
14
|
+
def default(content: "Default")
|
15
|
+
render(Primer::Box.new) { content }
|
16
|
+
end
|
17
|
+
|
18
|
+
# @label Border
|
19
|
+
def border(content: "Box with border")
|
20
|
+
render(Primer::Box.new(border: true, p: 3)) { content }
|
21
|
+
end
|
22
|
+
|
23
|
+
# @label Border Bottom
|
24
|
+
def border_bottom(content: "Box with bottom border")
|
25
|
+
render(Primer::Box.new(border: :bottom, p: 3)) { content }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/static/arguments.json
CHANGED
@@ -98,12 +98,6 @@
|
|
98
98
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_list/heading.rb",
|
99
99
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_list/heading/default/",
|
100
100
|
"parameters": [
|
101
|
-
{
|
102
|
-
"name": "id",
|
103
|
-
"type": "String",
|
104
|
-
"default": "`self.class.generate_id`",
|
105
|
-
"description": "The group's identifier (ID attribute in HTML)."
|
106
|
-
},
|
107
101
|
{
|
108
102
|
"name": "title",
|
109
103
|
"type": "String",
|
@@ -128,12 +122,6 @@
|
|
128
122
|
"default": "`:subtle`",
|
129
123
|
"description": "Display a background color if scheme is `filled`."
|
130
124
|
},
|
131
|
-
{
|
132
|
-
"name": "tag",
|
133
|
-
"type": "Integer",
|
134
|
-
"default": "N/A",
|
135
|
-
"description": "Semantic tag for the heading."
|
136
|
-
},
|
137
125
|
{
|
138
126
|
"name": "system_arguments",
|
139
127
|
"type": "Hash",
|
@@ -1396,6 +1384,28 @@
|
|
1396
1384
|
}
|
1397
1385
|
]
|
1398
1386
|
},
|
1387
|
+
{
|
1388
|
+
"component": "NavList::Divider",
|
1389
|
+
"status": "alpha",
|
1390
|
+
"a11y_reviewed": false,
|
1391
|
+
"short_name": "NavListDivider",
|
1392
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/nav_list/divider.rb",
|
1393
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/nav_list/divider/default/",
|
1394
|
+
"parameters": [
|
1395
|
+
{
|
1396
|
+
"name": "scheme",
|
1397
|
+
"type": "Symbol",
|
1398
|
+
"default": "`:subtle`",
|
1399
|
+
"description": "Display a background color if scheme is `filled`."
|
1400
|
+
},
|
1401
|
+
{
|
1402
|
+
"name": "system_arguments",
|
1403
|
+
"type": "Hash",
|
1404
|
+
"default": "N/A",
|
1405
|
+
"description": "[System arguments](/system-arguments)"
|
1406
|
+
}
|
1407
|
+
]
|
1408
|
+
},
|
1399
1409
|
{
|
1400
1410
|
"component": "NavList::Group",
|
1401
1411
|
"status": "alpha",
|
@@ -1682,7 +1692,13 @@
|
|
1682
1692
|
"name": "subtitle",
|
1683
1693
|
"type": "String",
|
1684
1694
|
"default": "`nil`",
|
1685
|
-
"description": "Provides
|
1695
|
+
"description": "Provides additional context for the Overlay, also setting the `aria-describedby` attribute."
|
1696
|
+
},
|
1697
|
+
{
|
1698
|
+
"name": "overlay_id",
|
1699
|
+
"type": "String",
|
1700
|
+
"default": "`nil`",
|
1701
|
+
"description": "Provides the id of the overlay element so the close button can close it"
|
1686
1702
|
},
|
1687
1703
|
{
|
1688
1704
|
"name": "size",
|
data/static/audited_at.json
CHANGED
data/static/classes.json
CHANGED
data/static/constants.json
CHANGED
@@ -381,9 +381,12 @@
|
|
381
381
|
"Primer::Alpha::MultiInput": {
|
382
382
|
},
|
383
383
|
"Primer::Alpha::NavList": {
|
384
|
+
"Divider": "Primer::Alpha::NavList::Divider",
|
384
385
|
"Group": "Primer::Alpha::NavList::Group",
|
385
386
|
"Item": "Primer::Alpha::NavList::Item"
|
386
387
|
},
|
388
|
+
"Primer::Alpha::NavList::Divider": {
|
389
|
+
},
|
387
390
|
"Primer::Alpha::NavList::Group": {
|
388
391
|
},
|
389
392
|
"Primer::Alpha::NavList::Item": {
|