openproject-primer_view_components 0.12.1 → 0.13.0
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 +35 -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 +9 -4
- data/app/components/primer/alpha/action_bar_element.ts +9 -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 +160 -85
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +195 -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 +26 -93
- data/app/components/primer/alpha/tool_tip.ts +25 -91
- 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/accessibility.rb +3 -1
- data/lib/primer/static/generate_info_arch.rb +86 -5
- data/lib/primer/view_components/version.rb +2 -2
- 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 +1 -0
- data/previews/primer/alpha/dialog_preview/autofocus_element.html.erb +8 -0
- data/previews/primer/alpha/dialog_preview.rb +5 -0
- data/previews/primer/alpha/radio_button_preview.rb +1 -0
- 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 +137 -161
- data/static/previews.json +91 -172
- 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)
|
@@ -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 %>
|
@@ -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
|
},
|