openproject-primer_view_components 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/app/assets/javascripts/app/components/primer/alpha/tool_tip.d.ts +1 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_bar/item.rb +7 -4
- data/app/components/primer/alpha/action_bar.rb +2 -2
- data/app/components/primer/alpha/action_bar_element.js +11 -4
- data/app/components/primer/alpha/action_bar_element.ts +11 -2
- data/app/components/primer/alpha/action_list/form_wrapper.html.erb +4 -2
- data/app/components/primer/alpha/action_list/form_wrapper.rb +20 -9
- data/app/components/primer/alpha/action_menu/action_menu_element.js +174 -84
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +218 -81
- data/app/components/primer/alpha/action_menu/list.rb +0 -2
- data/app/components/primer/alpha/action_menu.rb +120 -3
- data/app/components/primer/alpha/modal_dialog.js +10 -13
- data/app/components/primer/alpha/modal_dialog.ts +10 -13
- data/app/components/primer/alpha/segmented_control/item.html.erb +1 -8
- data/app/components/primer/alpha/segmented_control/item.rb +38 -4
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +14 -13
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +75 -66
- data/app/components/primer/alpha/segmented_control.rb +10 -0
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/tool_tip.d.ts +1 -0
- data/app/components/primer/alpha/tool_tip.js +34 -28
- data/app/components/primer/alpha/tool_tip.ts +33 -26
- data/app/components/primer/beta/base_button.rb +4 -0
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +6 -2
- data/app/components/primer/focus_group.js +28 -3
- data/app/components/primer/focus_group.ts +27 -1
- data/lib/primer/static/generate_info_arch.rb +86 -5
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/alpha/action_menu_preview/single_select_form_items.html.erb +31 -0
- data/previews/primer/alpha/action_menu_preview/with_actions.html.erb +6 -5
- data/previews/primer/alpha/action_menu_preview.rb +10 -1
- data/previews/primer/alpha/check_box_preview.rb +0 -2
- data/previews/primer/alpha/dialog_preview/autofocus_element.html.erb +8 -0
- data/previews/primer/alpha/dialog_preview/with_text_input.html.erb +2 -1
- data/previews/primer/alpha/dialog_preview.rb +5 -0
- data/previews/primer/alpha/radio_button_preview.rb +0 -2
- data/previews/primer/alpha/segmented_control_preview.rb +35 -0
- data/previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb +23 -0
- data/previews/primer/alpha/tooltip_preview.rb +6 -1
- data/previews/primer/beta/button_group_preview.rb +6 -6
- data/previews/primer/beta/button_preview.rb +20 -2
- data/previews/primer/beta/icon_button_preview.rb +3 -0
- data/static/arguments.json +18 -1
- data/static/classes.json +12 -0
- data/static/constants.json +12 -1
- data/static/info_arch.json +135 -5
- data/static/previews.json +91 -0
- metadata +5 -310
@@ -8,14 +8,15 @@
|
|
8
8
|
|
9
9
|
<%= render(Primer::Alpha::ActionMenu.new) do |component| %>
|
10
10
|
<% component.with_show_button { "Trigger" } %>
|
11
|
-
<% component.with_item(label: "Alert", tag: :button, id: "alert-item") %>
|
12
|
-
<% component.with_item(label: "Navigate", tag: :a, content_arguments: { href: action_menu_landing_path }) %>
|
13
|
-
<% component.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }) %>
|
11
|
+
<% component.with_item(label: "Alert", tag: :button, id: "alert-item", disabled: disable_items) %>
|
12
|
+
<% component.with_item(label: "Navigate", tag: :a, content_arguments: { href: action_menu_landing_path }, disabled: disable_items) %>
|
13
|
+
<% component.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }, disabled: disable_items) %>
|
14
14
|
<% component.with_item(
|
15
15
|
label: "Submit form",
|
16
|
-
href: action_menu_form_action_path,
|
16
|
+
href: action_menu_form_action_path(format: route_format),
|
17
17
|
form_arguments: {
|
18
18
|
name: "foo", value: "bar", method: :post
|
19
|
-
}
|
19
|
+
},
|
20
|
+
disabled: disable_items
|
20
21
|
) %>
|
21
22
|
<% end %>
|
@@ -216,7 +216,10 @@ module Primer
|
|
216
216
|
|
217
217
|
# @label With actions
|
218
218
|
#
|
219
|
-
|
219
|
+
# @param disable_items toggle
|
220
|
+
def with_actions(disable_items: false, route_format: :html)
|
221
|
+
render_with_template(locals: { disable_items: disable_items, route_format: route_format })
|
222
|
+
end
|
220
223
|
|
221
224
|
# @label Single select form
|
222
225
|
#
|
@@ -224,6 +227,12 @@ module Primer
|
|
224
227
|
render_with_template(locals: { route_format: route_format })
|
225
228
|
end
|
226
229
|
|
230
|
+
# @label Single select form items
|
231
|
+
#
|
232
|
+
def single_select_form_items(route_format: :html)
|
233
|
+
render_with_template(locals: { route_format: route_format })
|
234
|
+
end
|
235
|
+
|
227
236
|
# @label Multiple select form
|
228
237
|
#
|
229
238
|
def multiple_select_form(route_format: :html)
|
@@ -7,7 +7,6 @@ module Primer
|
|
7
7
|
# @label Playground
|
8
8
|
#
|
9
9
|
# @param name text
|
10
|
-
# @param id text
|
11
10
|
# @param value text
|
12
11
|
# @param label text
|
13
12
|
# @param caption text
|
@@ -15,7 +14,6 @@ module Primer
|
|
15
14
|
# @param disabled toggle
|
16
15
|
def playground(
|
17
16
|
name: "my-check-box",
|
18
|
-
id: nil,
|
19
17
|
value: "picard",
|
20
18
|
label: "Jean-Luc Picard",
|
21
19
|
caption: "Make it so",
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: "Dialog")) do |d| %>
|
2
|
+
<% d.with_show_button { "Show Dialog" } %>
|
3
|
+
<% d.with_body do %>
|
4
|
+
<form>
|
5
|
+
<input type="text" placeholder="This element is focused on open" autofocus>
|
6
|
+
</form>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<p>Dialog One!</p>
|
5
5
|
|
6
6
|
<form>
|
7
|
-
<
|
7
|
+
<label for="dialog-text-input-example">Example input</label>
|
8
|
+
<input id="dialog-text-input-example" type="text" value="Some text goes in here">
|
8
9
|
</form>
|
9
10
|
<% end %>
|
10
11
|
<% end %>
|
@@ -7,7 +7,6 @@ module Primer
|
|
7
7
|
# @label Playground
|
8
8
|
#
|
9
9
|
# @param name text
|
10
|
-
# @param id text
|
11
10
|
# @param value text
|
12
11
|
# @param label text
|
13
12
|
# @param caption text
|
@@ -15,7 +14,6 @@ module Primer
|
|
15
14
|
# @param disabled toggle
|
16
15
|
def playground(
|
17
16
|
name: "my-radio-button",
|
18
|
-
id: nil,
|
19
17
|
value: "bsg",
|
20
18
|
label: "Battlestar Galactica",
|
21
19
|
caption: "A pretty good show",
|
@@ -100,6 +100,41 @@ module Primer
|
|
100
100
|
end
|
101
101
|
# @!endgroup
|
102
102
|
|
103
|
+
# @!group Trailing Label
|
104
|
+
# @label Size small
|
105
|
+
# @snapshot
|
106
|
+
def trailing_label_width_small
|
107
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "Billing duration", size: :small)) do |component|
|
108
|
+
component.with_item(label: "Monthly")
|
109
|
+
component.with_item(label: "Yearly", selected: true) do |button|
|
110
|
+
button.with_trailing_visual_label(scheme: :accent) { "-8%" }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# @label Size medium
|
116
|
+
# @snapshot
|
117
|
+
def trailing_label_width_medium
|
118
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "Billing duration", size: :medium)) do |component|
|
119
|
+
component.with_item(label: "Monthly")
|
120
|
+
component.with_item(label: "Yearly", selected: true) do |button|
|
121
|
+
button.with_trailing_visual_label(scheme: :accent) { "-8%" }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# @label Size large
|
127
|
+
# @snapshot
|
128
|
+
def trailing_label_width_large
|
129
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "Billing duration", size: :large)) do |component|
|
130
|
+
component.with_item(label: "Monthly")
|
131
|
+
component.with_item(label: "Yearly", selected: true) do |button|
|
132
|
+
button.with_trailing_visual_label(scheme: :accent) { "-8%" }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
# @!endgroup
|
137
|
+
|
103
138
|
# @!group Icons only
|
104
139
|
# @label Size small
|
105
140
|
# @snapshot
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: "Confirm focus")) do |d| %>
|
2
|
+
<%= render(Primer::Alpha::Dialog::Body.new()) do %>
|
3
|
+
Are you sure you want to focus the input?
|
4
|
+
<% end %>
|
5
|
+
<%= render(Primer::Alpha::Dialog::Footer.new()) do %>
|
6
|
+
<%= render(Primer::Beta::Button.new(id: "yes-button", data: { "close-dialog-id": "my-dialog" })) { "Yes" } %>
|
7
|
+
<%= render(Primer::Beta::Button.new(scheme: :primary, data: { "close-dialog-id": "my-dialog" })) { "Yes but in green" } %>
|
8
|
+
<% end %>
|
9
|
+
<% d.with_show_button do |b| %>
|
10
|
+
Focus input
|
11
|
+
<% b.with_tooltip(text: "This is a tooltip in an Overlay") %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<label>
|
15
|
+
An input
|
16
|
+
<input type="text" id="input">
|
17
|
+
</label>
|
18
|
+
<script>
|
19
|
+
document.querySelector('#my-dialog').addEventListener('cancel', function () {
|
20
|
+
console.log('!!')
|
21
|
+
setTimeout(() => document.querySelector('#input').focus(), 0);
|
22
|
+
});
|
23
|
+
</script>
|
@@ -78,11 +78,16 @@ module Primer
|
|
78
78
|
# @!endgroup
|
79
79
|
|
80
80
|
# @label Tooltip inside Primer::Alpha::Overlay
|
81
|
-
def tooltip_inside_primer_overlay
|
81
|
+
def tooltip_inside_primer_overlay
|
82
82
|
render_with_template(
|
83
83
|
locals: {}
|
84
84
|
)
|
85
85
|
end
|
86
|
+
|
87
|
+
# @label Tooltip with button moving focus to input
|
88
|
+
def tooltip_with_dialog_moving_focus_to_input
|
89
|
+
render_with_template(locals: {})
|
90
|
+
end
|
86
91
|
end
|
87
92
|
end
|
88
93
|
end
|
@@ -55,16 +55,16 @@ module Primer
|
|
55
55
|
# @snapshot
|
56
56
|
def all_tags
|
57
57
|
render(Primer::Beta::ButtonGroup.new) do |component|
|
58
|
-
component.with_button(id: "button-1", tag: :button) do |
|
59
|
-
|
58
|
+
component.with_button(id: "button-1", tag: :button) do |button|
|
59
|
+
button.with_tooltip(text: "Button Tooltip")
|
60
60
|
"Button 1"
|
61
61
|
end
|
62
|
-
component.with_button(id: "button-2", tag: :a) do |
|
63
|
-
|
62
|
+
component.with_button(id: "button-2", tag: :a) do |button|
|
63
|
+
button.with_tooltip(text: "Button Tooltip")
|
64
64
|
"Button 2"
|
65
65
|
end
|
66
|
-
component.with_button(id: "button-3", tag: :summary) do |
|
67
|
-
|
66
|
+
component.with_button(id: "button-3", tag: :summary) do |button|
|
67
|
+
button.with_tooltip(text: "Button Tooltip")
|
68
68
|
"Button 3"
|
69
69
|
end
|
70
70
|
end
|
@@ -18,6 +18,7 @@ module Primer
|
|
18
18
|
# @param size select [small, medium, large]
|
19
19
|
# @param block toggle
|
20
20
|
# @param disabled toggle
|
21
|
+
# @param inactive toggle
|
21
22
|
# @param align_content select [center, start]
|
22
23
|
# @param tag select [a, summary, button]
|
23
24
|
def playground(
|
@@ -27,7 +28,8 @@ module Primer
|
|
27
28
|
id: "button-preview",
|
28
29
|
align_content: :center,
|
29
30
|
tag: :button,
|
30
|
-
disabled: false
|
31
|
+
disabled: false,
|
32
|
+
inactive: false
|
31
33
|
)
|
32
34
|
render(Primer::Beta::Button.new(
|
33
35
|
scheme: scheme,
|
@@ -36,7 +38,8 @@ module Primer
|
|
36
38
|
id: id,
|
37
39
|
align_content: align_content,
|
38
40
|
tag: tag,
|
39
|
-
disabled: disabled
|
41
|
+
disabled: disabled,
|
42
|
+
inactive: inactive
|
40
43
|
)) do |_c|
|
41
44
|
"Button"
|
42
45
|
end
|
@@ -341,6 +344,21 @@ module Primer
|
|
341
344
|
align_content: align_content
|
342
345
|
})
|
343
346
|
end
|
347
|
+
|
348
|
+
# @label Inactive
|
349
|
+
# @param inactive toggle
|
350
|
+
# @snapshot
|
351
|
+
def inactive(
|
352
|
+
id: "button-preview",
|
353
|
+
inactive: true
|
354
|
+
)
|
355
|
+
render(Primer::Beta::Button.new(
|
356
|
+
id: id,
|
357
|
+
inactive: inactive
|
358
|
+
)) do |_c|
|
359
|
+
"Button"
|
360
|
+
end
|
361
|
+
end
|
344
362
|
end
|
345
363
|
end
|
346
364
|
end
|
@@ -9,6 +9,7 @@ module Primer
|
|
9
9
|
# @param size select [small, medium, large]
|
10
10
|
# @param aria_label text
|
11
11
|
# @param disabled toggle
|
12
|
+
# @param inactive toggle
|
12
13
|
# @param tag select [a, summary, button]
|
13
14
|
# @param icon [Symbol] octicon
|
14
15
|
# @param show_tooltip toggle
|
@@ -18,6 +19,7 @@ module Primer
|
|
18
19
|
id: "button-preview",
|
19
20
|
tag: :button,
|
20
21
|
disabled: false,
|
22
|
+
inactive: false,
|
21
23
|
icon: :plus,
|
22
24
|
aria_label: "Button",
|
23
25
|
show_tooltip: true
|
@@ -28,6 +30,7 @@ module Primer
|
|
28
30
|
id: id,
|
29
31
|
tag: tag,
|
30
32
|
disabled: disabled,
|
33
|
+
inactive: inactive,
|
31
34
|
icon: icon,
|
32
35
|
"aria-label": aria_label,
|
33
36
|
show_tooltip: show_tooltip
|
data/static/arguments.json
CHANGED
@@ -46,7 +46,18 @@
|
|
46
46
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_bar/item.rb",
|
47
47
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_bar/item/default/",
|
48
48
|
"parameters": [
|
49
|
-
|
49
|
+
{
|
50
|
+
"name": "item_content",
|
51
|
+
"type": "String",
|
52
|
+
"default": "N/A",
|
53
|
+
"description": "The content to render inside the item."
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"name": "item_arguments",
|
57
|
+
"type": "Hash",
|
58
|
+
"default": "N/A",
|
59
|
+
"description": "[System arguments](/system-arguments)"
|
60
|
+
}
|
50
61
|
]
|
51
62
|
},
|
52
63
|
{
|
@@ -3117,6 +3128,12 @@
|
|
3117
3128
|
"default": "`false`",
|
3118
3129
|
"description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
|
3119
3130
|
},
|
3131
|
+
{
|
3132
|
+
"name": "inactive",
|
3133
|
+
"type": "Boolean",
|
3134
|
+
"default": "`false`",
|
3135
|
+
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
|
3136
|
+
},
|
3120
3137
|
{
|
3121
3138
|
"name": "system_arguments",
|
3122
3139
|
"type": "Hash",
|
data/static/classes.json
CHANGED
@@ -507,6 +507,18 @@
|
|
507
507
|
"SegmentedControl--fullWidth": [
|
508
508
|
"Primer::Alpha::SegmentedControl"
|
509
509
|
],
|
510
|
+
"SegmentedControl--iconOnly": [
|
511
|
+
"Primer::Alpha::SegmentedControl"
|
512
|
+
],
|
513
|
+
"SegmentedControl--large": [
|
514
|
+
"Primer::Alpha::SegmentedControl"
|
515
|
+
],
|
516
|
+
"SegmentedControl--medium": [
|
517
|
+
"Primer::Alpha::SegmentedControl"
|
518
|
+
],
|
519
|
+
"SegmentedControl--small": [
|
520
|
+
"Primer::Alpha::SegmentedControl"
|
521
|
+
],
|
510
522
|
"SegmentedControl-item": [
|
511
523
|
"Primer::Alpha::SegmentedControl"
|
512
524
|
],
|
data/static/constants.json
CHANGED
@@ -544,9 +544,20 @@
|
|
544
544
|
"Primer::Alpha::RadioButtonGroup": {
|
545
545
|
},
|
546
546
|
"Primer::Alpha::SegmentedControl": {
|
547
|
+
"DEFAULT_SIZE": "medium",
|
547
548
|
"FULL_WIDTH_DEFAULT": false,
|
548
549
|
"HIDE_LABELS_DEFAULT": false,
|
549
|
-
"Item": "Primer::Alpha::SegmentedControl::Item"
|
550
|
+
"Item": "Primer::Alpha::SegmentedControl::Item",
|
551
|
+
"SIZE_MAPPINGS": {
|
552
|
+
"small": "SegmentedControl--small",
|
553
|
+
"medium": "SegmentedControl--medium",
|
554
|
+
"large": "SegmentedControl--large"
|
555
|
+
},
|
556
|
+
"SIZE_OPTIONS": [
|
557
|
+
"small",
|
558
|
+
"medium",
|
559
|
+
"large"
|
560
|
+
]
|
550
561
|
},
|
551
562
|
"Primer::Alpha::SegmentedControl::Item": {
|
552
563
|
},
|
data/static/info_arch.json
CHANGED
@@ -139,7 +139,18 @@
|
|
139
139
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/action_bar/item.rb",
|
140
140
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/action_bar/item/default/",
|
141
141
|
"parameters": [
|
142
|
-
|
142
|
+
{
|
143
|
+
"name": "item_content",
|
144
|
+
"type": "String",
|
145
|
+
"default": "N/A",
|
146
|
+
"description": "The content to render inside the item."
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"name": "item_arguments",
|
150
|
+
"type": "Hash",
|
151
|
+
"default": "N/A",
|
152
|
+
"description": "{{link_to_system_arguments_docs}}"
|
153
|
+
}
|
143
154
|
],
|
144
155
|
"slots": [
|
145
156
|
|
@@ -1117,8 +1128,8 @@
|
|
1117
1128
|
},
|
1118
1129
|
{
|
1119
1130
|
"fully_qualified_name": "Primer::Alpha::ActionMenu",
|
1120
|
-
"description": "ActionMenu is used for actions, navigation, to display secondary options, or single/multi select lists. They appear when
|
1121
|
-
"accessibility_docs": "The action for the menu item needs to be on the element with `role=\"menuitem\"`. Semantics are removed for everything
|
1131
|
+
"description": "ActionMenu is used for actions, navigation, to display secondary options, or single/multi select lists. They appear when\nusers interact with buttons, actions, or other controls.\n\nThe only allowed elements for the `Item` components are: `:a`, `:button`, and `:clipboard-copy`. The default is `:button`.\n\n### Select variants\n\nWhile `ActionMenu`s default to a list of buttons that can link to other pages, copy text to the clipboard, etc, they also support\n`single` and `multiple` select variants. The single select variant allows a single item to be \"selected\" (i.e. marked \"active\")\nwhen clicked, which will cause a check mark to appear to the left of the item text. When the `multiple` select variant is chosen,\nmultiple items may be selected and check marks will appear next to each selected item.\n\nUse the `select_variant:` option to control which variant the `ActionMenu` uses. For more information, see the documentation on\nsupported arguments below.\n\n### Dynamic labels\n\nWhen using the `single` select variant, an optional label indicating the selected item can be displayed inside the menu button.\nDynamic labels can also be prefixed with custom text.\n\nPass `dynamic_label: true` to enable dynamic label behavior, and pass `dynamic_label_prefix: \"<string>\"` to set a custom prefix.\nFor more information, see the documentation on supported arguments below.\n\n### `ActionMenu`s as form inputs\n\nWhen using either the `single` or `multiple` select variants, `ActionMenu`s can be used as form inputs. They behave very\nsimilarly to how HTML `<select>` boxes behave, and play nicely with Rails' built-in form mechanisms. Pass arguments via the\n`form_arguments:` argument, including the Rails form builder object and the name of the field:\n\n```erb\n<% form_with(url: update_merge_strategy_path) do |f| %>\n <%= render(Primer::Alpha::ActionMenu.new(form_arguments: { builder: f, name: \"merge_strategy\" })) do |menu| %>\n <% menu.with_item(label: \"Fast forward\", data: { value: \"fast_forward\" }) %>\n <% menu.with_item(label: \"Recursive\", data: { value: \"recursive\" }) %>\n <% menu.with_item(label: \"Ours\", data: { value: \"ours\" }) %>\n <% menu.with_item(label: \"Theirs\", data: { value: \"theirs\" }) %>\n <% end %>\n<% end %>\n```\n\nThe value of the `data: { value: ... }` argument is sent to the server on submit, keyed using the name provided above\n(eg. `\"merge_strategy\"`). If no value is provided for an item, the value of that item is the item's label. Here's the\ncorresponding `MergeStrategyController` that might be written to handle the form above:\n\n```ruby\nclass MergeStrategyController < ApplicationController\n def update\n puts \"You chose #{merge_strategy_params[:merge_strategy]}\"\n end\n\n private\n\n def merge_strategy_params\n params.permit(:merge_strategy)\n end\nend\n```\n\n### `ActionMenu` items that submit forms\n\nWhereas `ActionMenu` items normally permit navigation via `<a>` tags which make HTTP `get` requests, `ActionMenu` items\nalso permit navigation via `POST` requests. To enable this behavior, include the `href:` argument as normal, but also pass\nthe `form_arguments:` argument to the appropriate item:\n\n```erb\n<%= render(Primer::Alpha::ActionMenu.new) do |menu| %>\n <% menu.with_item(\n label: \"Repository\",\n href: update_repo_grouping_path,\n form_arguments: {\n method: :post,\n name: \"group_by\",\n value: \"repository\"\n }\n ) %>\n<% end %>\n```\n\nMake sure to specify `method: :post`, as the default is `:get`. When clicked, the list item will submit a POST request to\nthe URL passed in the `href:` argument, including a parameter named `\"group_by\"` with a value of `\"repository\"`. If no value\nis given, the name, eg. `\"group_by\"`, will be used as the value.\n\nIt is possible to include multiple fields on submit. Instead of passing the `name:` and `value:` arguments, pass an array via\nthe `inputs:` argument:\n\n```erb\n<%= render(Primer::Alpha::ActionMenu.new) do |menu| %>\n <% menu.with_show_button { \"Group By\" } %>\n <% menu.with_item(\n label: \"Repository\",\n href: update_repo_grouping_path,\n form_arguments: {\n method: :post,\n inputs: [{\n name: \"group_by\",\n value: \"repository\"\n }, {\n name: \"some_other_field\",\n value: \"some value\",\n }],\n }\n ) %>\n<% end %>\n```\n\n### Form arguments\n\nThe following table summarizes the arguments allowed in the `form_arguments:` hash mentioned above.\n\n|Name |Type |Default|Description|\n|:----------------|:-------------|:------|:----------|\n|`method` |`Symbol` |`:get` |The HTTP request method to use to submit the form. One of `:get`, `:post`, `:patch`, `:put`, `:delete`, or `:head`|\n|`name` |`String` |`nil` |The name of the field that will be sent to the server on submit.|\n|`value` |`String` |`nil` |The value of the field that will be sent to the server on submit.|\n|`input_arguments`|`Hash` |`{}` |Additional key/value pairs to emit as HTML attributes on the `<input type=\"hidden\">` element.|\n|`inputs` |`Array<Hash>` |`[]` |An array of hashes representing HTML `<input type=\"hidden\">` elements. Must contain at least `name:` and `value:` keys. If additional key/value pairs are provided, they are emitted as HTML attributes on the `<input>` element. This argument supercedes the `name:`, `value:`, and `:input_arguments` arguments listed above.|\n\nThe elements of the `inputs:` array will be emitted as HTML `<input type=\"hidden\">` elements.",
|
1132
|
+
"accessibility_docs": "The action for the menu item needs to be on the element with `role=\"menuitem\"`. Semantics are removed for everything\nnested inside of it. When a menu item is selected, the menu will close immediately.\n\nAdditional information around the keyboard functionality and implementation can be found on the\n[WAI-ARIA Authoring Practices](https://www.w3.org/TR/wai-aria-practices-1.2/#menu).",
|
1122
1133
|
"is_form_component": false,
|
1123
1134
|
"is_published": true,
|
1124
1135
|
"requires_js": true,
|
@@ -1519,6 +1530,19 @@
|
|
1519
1530
|
]
|
1520
1531
|
}
|
1521
1532
|
},
|
1533
|
+
{
|
1534
|
+
"preview_path": "primer/alpha/action_menu/single_select_form_items",
|
1535
|
+
"name": "single_select_form_items",
|
1536
|
+
"snapshot": "false",
|
1537
|
+
"skip_rules": {
|
1538
|
+
"wont_fix": [
|
1539
|
+
"region"
|
1540
|
+
],
|
1541
|
+
"will_fix": [
|
1542
|
+
"color-contrast"
|
1543
|
+
]
|
1544
|
+
}
|
1545
|
+
},
|
1522
1546
|
{
|
1523
1547
|
"preview_path": "primer/alpha/action_menu/multiple_select_form",
|
1524
1548
|
"name": "multiple_select_form",
|
@@ -3095,6 +3119,19 @@
|
|
3095
3119
|
"color-contrast"
|
3096
3120
|
]
|
3097
3121
|
}
|
3122
|
+
},
|
3123
|
+
{
|
3124
|
+
"preview_path": "primer/alpha/dialog/autofocus_element",
|
3125
|
+
"name": "autofocus_element",
|
3126
|
+
"snapshot": "false",
|
3127
|
+
"skip_rules": {
|
3128
|
+
"wont_fix": [
|
3129
|
+
"region"
|
3130
|
+
],
|
3131
|
+
"will_fix": [
|
3132
|
+
"color-contrast"
|
3133
|
+
]
|
3134
|
+
}
|
3098
3135
|
}
|
3099
3136
|
],
|
3100
3137
|
"subcomponents": [
|
@@ -6398,6 +6435,45 @@
|
|
6398
6435
|
]
|
6399
6436
|
}
|
6400
6437
|
},
|
6438
|
+
{
|
6439
|
+
"preview_path": "primer/alpha/segmented_control/trailing_label_width_small",
|
6440
|
+
"name": "trailing_label_width_small",
|
6441
|
+
"snapshot": "true",
|
6442
|
+
"skip_rules": {
|
6443
|
+
"wont_fix": [
|
6444
|
+
"region"
|
6445
|
+
],
|
6446
|
+
"will_fix": [
|
6447
|
+
"color-contrast"
|
6448
|
+
]
|
6449
|
+
}
|
6450
|
+
},
|
6451
|
+
{
|
6452
|
+
"preview_path": "primer/alpha/segmented_control/trailing_label_width_medium",
|
6453
|
+
"name": "trailing_label_width_medium",
|
6454
|
+
"snapshot": "true",
|
6455
|
+
"skip_rules": {
|
6456
|
+
"wont_fix": [
|
6457
|
+
"region"
|
6458
|
+
],
|
6459
|
+
"will_fix": [
|
6460
|
+
"color-contrast"
|
6461
|
+
]
|
6462
|
+
}
|
6463
|
+
},
|
6464
|
+
{
|
6465
|
+
"preview_path": "primer/alpha/segmented_control/trailing_label_width_large",
|
6466
|
+
"name": "trailing_label_width_large",
|
6467
|
+
"snapshot": "true",
|
6468
|
+
"skip_rules": {
|
6469
|
+
"wont_fix": [
|
6470
|
+
"region"
|
6471
|
+
],
|
6472
|
+
"will_fix": [
|
6473
|
+
"color-contrast"
|
6474
|
+
]
|
6475
|
+
}
|
6476
|
+
},
|
6401
6477
|
{
|
6402
6478
|
"preview_path": "primer/alpha/segmented_control/icon_only_small",
|
6403
6479
|
"name": "icon_only_small",
|
@@ -6557,10 +6633,32 @@
|
|
6557
6633
|
}
|
6558
6634
|
],
|
6559
6635
|
"slots": [
|
6560
|
-
|
6636
|
+
{
|
6637
|
+
"name": "trailing_visual_label",
|
6638
|
+
"description": "Optional trailing Label",
|
6639
|
+
"parameters": [
|
6640
|
+
{
|
6641
|
+
"name": "system_arguments",
|
6642
|
+
"type": "Hash",
|
6643
|
+
"default": "N/A",
|
6644
|
+
"description": "The arguments accepted by {{#link_to_component}}Primer::Beta::Button{{/link_to_component}}'s `with_trailing_visual_label` slot."
|
6645
|
+
}
|
6646
|
+
]
|
6647
|
+
}
|
6561
6648
|
],
|
6562
6649
|
"methods": [
|
6563
|
-
|
6650
|
+
{
|
6651
|
+
"name": "with_trailing_visual_label",
|
6652
|
+
"description": "Optional trailing label.",
|
6653
|
+
"parameters": [
|
6654
|
+
{
|
6655
|
+
"name": "system_arguments",
|
6656
|
+
"type": "Hash",
|
6657
|
+
"default": "N/A",
|
6658
|
+
"description": "The arguments accepted by {{#link_to_component}}Primer::Beta::Button{{/link_to_component}}'s `with_trailing_visual_label` slot."
|
6659
|
+
}
|
6660
|
+
]
|
6661
|
+
}
|
6564
6662
|
],
|
6565
6663
|
"previews": [
|
6566
6664
|
|
@@ -8341,6 +8439,19 @@
|
|
8341
8439
|
"color-contrast"
|
8342
8440
|
]
|
8343
8441
|
}
|
8442
|
+
},
|
8443
|
+
{
|
8444
|
+
"preview_path": "primer/alpha/tooltip/tooltip_with_dialog_moving_focus_to_input",
|
8445
|
+
"name": "tooltip_with_dialog_moving_focus_to_input",
|
8446
|
+
"snapshot": "false",
|
8447
|
+
"skip_rules": {
|
8448
|
+
"wont_fix": [
|
8449
|
+
"region"
|
8450
|
+
],
|
8451
|
+
"will_fix": [
|
8452
|
+
"color-contrast"
|
8453
|
+
]
|
8454
|
+
}
|
8344
8455
|
}
|
8345
8456
|
],
|
8346
8457
|
"subcomponents": [
|
@@ -9534,6 +9645,12 @@
|
|
9534
9645
|
"default": "`false`",
|
9535
9646
|
"description": "Whether or not the button is disabled. If true, this option forces `tag:` to `:button`."
|
9536
9647
|
},
|
9648
|
+
{
|
9649
|
+
"name": "inactive",
|
9650
|
+
"type": "Boolean",
|
9651
|
+
"default": "`false`",
|
9652
|
+
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
|
9653
|
+
},
|
9537
9654
|
{
|
9538
9655
|
"name": "system_arguments",
|
9539
9656
|
"type": "Hash",
|
@@ -10599,6 +10716,19 @@
|
|
10599
10716
|
"color-contrast"
|
10600
10717
|
]
|
10601
10718
|
}
|
10719
|
+
},
|
10720
|
+
{
|
10721
|
+
"preview_path": "primer/beta/button/inactive",
|
10722
|
+
"name": "inactive",
|
10723
|
+
"snapshot": "true",
|
10724
|
+
"skip_rules": {
|
10725
|
+
"wont_fix": [
|
10726
|
+
"region"
|
10727
|
+
],
|
10728
|
+
"will_fix": [
|
10729
|
+
"color-contrast"
|
10730
|
+
]
|
10731
|
+
}
|
10602
10732
|
}
|
10603
10733
|
],
|
10604
10734
|
"subcomponents": [
|