primer_view_components 0.18.2 → 0.20.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 +46 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_list.d.ts +16 -0
- data/app/assets/javascripts/app/components/primer/beta/nav_list.d.ts +3 -0
- data/app/assets/javascripts/app/components/primer/primer.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_element.js +4 -6
- data/app/components/primer/alpha/action_list/item.rb +19 -6
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +2 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.d.ts +16 -0
- data/app/components/primer/alpha/action_list.html.erb +19 -17
- data/app/components/primer/alpha/action_list.js +69 -0
- data/app/components/primer/alpha/action_list.pcss +8 -0
- data/app/components/primer/alpha/action_list.ts +58 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.js +12 -19
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +4 -4
- data/app/components/primer/alpha/banner.rb +17 -3
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +2 -0
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.pcss +9 -0
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/dropdown.pcss +1 -1
- data/app/components/primer/alpha/modal_dialog.js +8 -10
- data/app/components/primer/alpha/segmented_control.js +2 -3
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +2 -0
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +10 -0
- data/app/components/primer/alpha/toggle_switch.rb +2 -2
- data/app/components/primer/alpha/tool_tip.js +5 -7
- data/app/components/primer/beta/auto_complete/auto_complete.html.erb +9 -9
- data/app/components/primer/beta/breadcrumbs.css +1 -1
- data/app/components/primer/beta/breadcrumbs.css.map +1 -1
- data/app/components/primer/beta/breadcrumbs.pcss +3 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +1 -1
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +5 -5
- data/app/components/primer/beta/button_group.rb +53 -1
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/flash.pcss +4 -4
- data/app/components/primer/beta/flash.rb +3 -1
- data/app/components/primer/beta/nav_list.d.ts +3 -0
- data/app/components/primer/beta/nav_list.html.erb +1 -1
- data/app/components/primer/beta/nav_list.js +31 -12
- data/app/components/primer/beta/nav_list.ts +18 -1
- data/app/components/primer/beta/nav_list_group_element.js +6 -4
- data/app/components/primer/beta/nav_list_group_element.ts +3 -0
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.pcss +3 -0
- data/app/components/primer/beta/popover.rb +0 -1
- data/app/components/primer/dialog_helper.js +5 -7
- data/app/components/primer/focus_group.js +9 -12
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/forms/auto_complete_form.rb +18 -0
- data/app/forms/select_form.rb +10 -0
- data/lib/primer/deprecations.yml +5 -0
- data/lib/primer/forms/auto_complete.html.erb +6 -0
- data/lib/primer/forms/auto_complete.rb +56 -0
- data/lib/primer/forms/builder.rb +19 -0
- data/lib/primer/forms/check_box_group.html.erb +4 -4
- data/lib/primer/forms/check_box_group.rb +0 -3
- data/lib/primer/forms/dsl/auto_complete_input.rb +33 -0
- data/lib/primer/forms/dsl/check_box_group_input.rb +8 -0
- data/lib/primer/forms/dsl/input.rb +8 -2
- data/lib/primer/forms/dsl/input_methods.rb +9 -0
- data/lib/primer/forms/dsl/radio_button_group_input.rb +8 -0
- data/lib/primer/forms/dsl/select_input.rb +5 -1
- data/lib/primer/forms/form_control.rb +1 -2
- data/lib/primer/forms/primer_multi_input.js +2 -3
- data/lib/primer/forms/primer_text_field.js +4 -6
- data/lib/primer/forms/primer_text_field.ts +2 -2
- data/lib/primer/forms/radio_button_group.html.erb +4 -4
- data/lib/primer/forms/radio_button_group.rb +0 -3
- data/lib/primer/forms/select.html.erb +1 -0
- data/lib/primer/forms/select.rb +9 -5
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/alpha/action_list_preview.rb +42 -0
- data/previews/primer/alpha/select_preview.rb +12 -1
- data/previews/primer/alpha/text_area_preview.rb +7 -1
- data/previews/primer/alpha/text_field_preview.rb +7 -1
- data/previews/primer/beta/button_group_preview/with_menu_button.html.erb +7 -0
- data/previews/primer/beta/button_group_preview.rb +6 -0
- data/previews/primer/beta/nav_list_preview.rb +43 -0
- data/previews/primer/forms_preview/auto_complete_form.html.erb +3 -0
- data/previews/primer/forms_preview/select_form.html.erb +1 -1
- data/previews/primer/forms_preview.rb +2 -0
- data/static/arguments.json +30 -8
- data/static/audited_at.json +1 -0
- data/static/constants.json +18 -0
- data/static/info_arch.json +218 -11
- data/static/previews.json +157 -1
- data/static/statuses.json +2 -1
- metadata +12 -3
- data/previews/primer/beta/button_group_preview/action_menus.html.erb +0 -8
@@ -31,7 +31,7 @@ module Primer
|
|
31
31
|
# @param size [Symbol] The size of the field. <%= one_of(Primer::Forms::Dsl::Input::SIZE_OPTIONS) %>
|
32
32
|
|
33
33
|
# @!macro [new] form_full_width_arguments
|
34
|
-
# @param full_width [Boolean] When set to `true`, the field will take up all the horizontal space allowed by its container.
|
34
|
+
# @param full_width [Boolean] When set to `true`, the field will take up all the horizontal space allowed by its container. Defaults to `true`.
|
35
35
|
|
36
36
|
# @!macro [new] form_system_arguments
|
37
37
|
# @param system_arguments [Hash] A hash of attributes passed to the underlying Rails builder methods. These options may mean something special depending on the type of input, otherwise they are emitted as HTML attributes. See the [Rails documentation](https://guides.rubyonrails.org/form_helpers.html) for more information. In addition, the usual Primer utility arguments are accepted in system arguments. For example, passing `mt: 2` will add the `mt-2` class to the input. See the Primer system arguments docs for details.
|
@@ -56,7 +56,9 @@ module Primer
|
|
56
56
|
@form = form
|
57
57
|
|
58
58
|
@input_arguments = system_arguments
|
59
|
+
@input_arguments.delete(:id) unless @input_arguments[:id].present?
|
59
60
|
@label_arguments = @input_arguments.delete(:label_arguments) || {}
|
61
|
+
@label_arguments[:for] = id if id.present?
|
60
62
|
|
61
63
|
@label_arguments[:class] = class_names(
|
62
64
|
@label_arguments[:class],
|
@@ -71,7 +73,7 @@ module Primer
|
|
71
73
|
@caption = @input_arguments.delete(:caption)
|
72
74
|
@validation_message = @input_arguments.delete(:validation_message)
|
73
75
|
@invalid = @input_arguments.delete(:invalid)
|
74
|
-
@full_width = @input_arguments.delete(:full_width)
|
76
|
+
@full_width = @input_arguments.delete(:full_width) { true }
|
75
77
|
@size = @input_arguments.delete(:size)
|
76
78
|
|
77
79
|
# If scope_name_to_model is false, the name of the input for eg. `my_field`
|
@@ -240,6 +242,10 @@ module Primer
|
|
240
242
|
input_arguments[:autofocus] = true
|
241
243
|
end
|
242
244
|
|
245
|
+
def id
|
246
|
+
@input_arguments[:id]
|
247
|
+
end
|
248
|
+
|
243
249
|
# :nocov:
|
244
250
|
def name
|
245
251
|
raise_for_abstract_method!(__method__)
|
@@ -68,6 +68,15 @@ module Primer
|
|
68
68
|
add_input TextFieldInput.new(builder: builder, form: form, **options, &block)
|
69
69
|
end
|
70
70
|
|
71
|
+
# Adds an autocomplete text field to this form.
|
72
|
+
#
|
73
|
+
# @param options [Hash] The options accepted by the autocomplete input (see forms docs).
|
74
|
+
# @param block [Proc] A block that will be yielded a reference to the input object so it can be customized.
|
75
|
+
def auto_complete(**options, &block)
|
76
|
+
options = decorate_options(**options)
|
77
|
+
add_input AutoCompleteInput.new(builder: builder, form: form, **options, &block)
|
78
|
+
end
|
79
|
+
|
71
80
|
# Adds a text area to this form.
|
72
81
|
#
|
73
82
|
# @param options [Hash] The options accepted by the text area input (see forms docs).
|
@@ -25,6 +25,14 @@ module Primer
|
|
25
25
|
:radio_button_group
|
26
26
|
end
|
27
27
|
|
28
|
+
def autofocus!
|
29
|
+
@radio_buttons.first&.autofocus!
|
30
|
+
end
|
31
|
+
|
32
|
+
def focusable?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
28
36
|
def radio_button(**system_arguments, &block)
|
29
37
|
@radio_buttons << RadioButtonInput.new(
|
30
38
|
builder: @builder, form: @form, name: @name, disabled: disabled?,
|
@@ -5,7 +5,7 @@ module Primer
|
|
5
5
|
module Dsl
|
6
6
|
# :nodoc:
|
7
7
|
class SelectInput < Input
|
8
|
-
SELECT_ARGUMENTS = %i[multiple include_blank prompt].freeze
|
8
|
+
SELECT_ARGUMENTS = %i[multiple include_blank include_hidden prompt].freeze
|
9
9
|
|
10
10
|
# :nodoc:
|
11
11
|
class Option
|
@@ -38,6 +38,10 @@ module Primer
|
|
38
38
|
yield(self) if block_given?
|
39
39
|
end
|
40
40
|
|
41
|
+
def multiple?
|
42
|
+
@select_arguments.fetch(:multiple, false)
|
43
|
+
end
|
44
|
+
|
41
45
|
def option(**system_arguments)
|
42
46
|
@options << Option.new(**system_arguments)
|
43
47
|
end
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
import { controller, targets } from '@github/catalyst';
|
9
9
|
let PrimerMultiInputElement = class PrimerMultiInputElement extends HTMLElement {
|
10
10
|
activateField(name) {
|
11
|
-
var _a, _b;
|
12
11
|
const fieldWithName = this.findField(name);
|
13
12
|
if (!fieldWithName)
|
14
13
|
return;
|
@@ -17,11 +16,11 @@ let PrimerMultiInputElement = class PrimerMultiInputElement extends HTMLElement
|
|
17
16
|
continue;
|
18
17
|
field.setAttribute('disabled', 'disabled');
|
19
18
|
field.setAttribute('hidden', 'hidden');
|
20
|
-
|
19
|
+
field.parentElement?.setAttribute('hidden', 'hidden');
|
21
20
|
}
|
22
21
|
fieldWithName.removeAttribute('disabled');
|
23
22
|
fieldWithName.removeAttribute('hidden');
|
24
|
-
|
23
|
+
fieldWithName.parentElement?.removeAttribute('hidden');
|
25
24
|
}
|
26
25
|
findField(name) {
|
27
26
|
for (const field of this.fields) {
|
@@ -27,10 +27,9 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
27
27
|
_PrimerTextFieldElement_abortController.set(this, void 0);
|
28
28
|
}
|
29
29
|
connectedCallback() {
|
30
|
-
|
31
|
-
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
30
|
+
__classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")?.abort();
|
32
31
|
const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
|
33
|
-
this.
|
32
|
+
this.addEventListener('auto-check-success', async (event) => {
|
34
33
|
const message = await event.detail.response.text();
|
35
34
|
if (message && message.length > 0) {
|
36
35
|
this.setSuccess(message);
|
@@ -39,14 +38,13 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
39
38
|
this.clearError();
|
40
39
|
}
|
41
40
|
}, { signal });
|
42
|
-
this.
|
41
|
+
this.addEventListener('auto-check-error', async (event) => {
|
43
42
|
const errorMessage = await event.detail.response.text();
|
44
43
|
this.setError(errorMessage);
|
45
44
|
}, { signal });
|
46
45
|
}
|
47
46
|
disconnectedCallback() {
|
48
|
-
|
49
|
-
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
47
|
+
__classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")?.abort();
|
50
48
|
}
|
51
49
|
clearContents() {
|
52
50
|
this.inputElement.value = '';
|
@@ -17,7 +17,7 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
17
17
|
this.#abortController?.abort()
|
18
18
|
const {signal} = (this.#abortController = new AbortController())
|
19
19
|
|
20
|
-
this.
|
20
|
+
this.addEventListener(
|
21
21
|
'auto-check-success',
|
22
22
|
async (event: any) => {
|
23
23
|
const message = await event.detail.response.text()
|
@@ -30,7 +30,7 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
30
30
|
{signal},
|
31
31
|
)
|
32
32
|
|
33
|
-
this.
|
33
|
+
this.addEventListener(
|
34
34
|
'auto-check-error',
|
35
35
|
async (event: any) => {
|
36
36
|
const errorMessage = await event.detail.response.text()
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<div class="FormControl-radio-group-wrap">
|
2
|
+
<%= content_tag(:fieldset, **@input.input_arguments) do %>
|
3
3
|
<% if @input.label %>
|
4
4
|
<%= content_tag(:legend, **@input.label_arguments) do %>
|
5
5
|
<%= @input.label %>
|
@@ -10,11 +10,11 @@
|
|
10
10
|
<%= render(radio_button.to_component) %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
|
-
|
13
|
+
<% end %>
|
14
14
|
<div class="mt-2">
|
15
15
|
<%= render(ValidationMessage.new(input: @input)) %>
|
16
16
|
</div>
|
17
17
|
<div class="mt-2">
|
18
18
|
<%= render(Caption.new(input: @input)) %>
|
19
19
|
</div>
|
20
|
-
|
20
|
+
</div>
|
data/lib/primer/forms/select.rb
CHANGED
@@ -8,14 +8,18 @@ module Primer
|
|
8
8
|
|
9
9
|
def initialize(input:)
|
10
10
|
@input = input
|
11
|
-
@input.add_input_classes(
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
@input.add_input_classes("FormControl-select")
|
12
|
+
|
13
|
+
if !input.multiple?
|
14
|
+
@input.add_input_classes(
|
15
|
+
Primer::Forms::Dsl::Input::SIZE_MAPPINGS[@input.size]
|
16
|
+
)
|
17
|
+
end
|
15
18
|
|
16
19
|
@field_wrap_arguments = {
|
17
20
|
class: "FormControl-select-wrap",
|
18
|
-
hidden: @input.hidden
|
21
|
+
hidden: @input.hidden?,
|
22
|
+
data: { multiple: input.multiple? }
|
19
23
|
}
|
20
24
|
end
|
21
25
|
|
@@ -459,6 +459,48 @@ module Primer
|
|
459
459
|
component.with_item(label: "Active item", href: "/", active: true)
|
460
460
|
end
|
461
461
|
end
|
462
|
+
|
463
|
+
# @label Long label
|
464
|
+
#
|
465
|
+
# @param truncate_label [Symbol] select [none, truncate, show_tooltip]
|
466
|
+
# @snapshot
|
467
|
+
def long_label_with_tooltip(truncate_label: :show_tooltip)
|
468
|
+
render(Primer::Alpha::ActionList.new(aria: { label: "List heading" })) do |component|
|
469
|
+
component.with_item(
|
470
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
471
|
+
truncate_label: truncate_label
|
472
|
+
)
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
def long_label_wrap(truncate_label: :none)
|
477
|
+
render(Primer::Alpha::ActionList.new(aria: { label: "List heading" })) do |component|
|
478
|
+
component.with_item(
|
479
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
480
|
+
truncate_label: truncate_label
|
481
|
+
)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
def long_label_truncate_no_tooltip(truncate_label: :truncate)
|
486
|
+
render(Primer::Alpha::ActionList.new(aria: { label: "List heading" })) do |component|
|
487
|
+
component.with_item(
|
488
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
489
|
+
truncate_label: truncate_label
|
490
|
+
)
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
def long_label_show_tooltip_with_truncate_label(truncate_label: :none)
|
495
|
+
render(Primer::Alpha::ActionList.new(aria: { label: "List heading" })) do |component|
|
496
|
+
component.with_item(
|
497
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
498
|
+
truncate_label: truncate_label
|
499
|
+
) do |item|
|
500
|
+
item.with_tooltip(text: "this is a tooltip")
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
462
504
|
end
|
463
505
|
end
|
464
506
|
end
|
@@ -25,7 +25,7 @@ module Primer
|
|
25
25
|
required: false,
|
26
26
|
visually_hide_label: false,
|
27
27
|
size: Primer::Forms::Dsl::Input::DEFAULT_SIZE.to_s,
|
28
|
-
full_width:
|
28
|
+
full_width: true,
|
29
29
|
disabled: false,
|
30
30
|
invalid: false,
|
31
31
|
validation_message: nil
|
@@ -97,6 +97,17 @@ module Primer
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
# @label Not full width
|
101
|
+
# @snapshot
|
102
|
+
def not_full_width
|
103
|
+
render(Primer::Alpha::Select.new(full_width: false, name: "my-select-list", label: "Favorite place to visit")) do |component|
|
104
|
+
component.option(label: "Lopez Island", value: "lopez")
|
105
|
+
component.option(label: "Shaw Island", value: "shaw")
|
106
|
+
component.option(label: "Orcas Island", value: "orcas")
|
107
|
+
component.option(label: "San Juan Island", value: "san_juan")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
100
111
|
# @label Disabled
|
101
112
|
# @snapshot
|
102
113
|
def disabled
|
@@ -23,7 +23,7 @@ module Primer
|
|
23
23
|
caption: "You can trust me, I'm a website",
|
24
24
|
required: false,
|
25
25
|
visually_hide_label: false,
|
26
|
-
full_width:
|
26
|
+
full_width: true,
|
27
27
|
disabled: false,
|
28
28
|
invalid: false,
|
29
29
|
validation_message: nil
|
@@ -70,6 +70,12 @@ module Primer
|
|
70
70
|
render(Primer::Alpha::TextArea.new(full_width: true, name: "my-text-area", label: "Tell me about yourself"))
|
71
71
|
end
|
72
72
|
|
73
|
+
# @label Not full width
|
74
|
+
# @snapshot
|
75
|
+
def not_full_width
|
76
|
+
render(Primer::Alpha::TextArea.new(full_width: false, name: "my-text-area", label: "Tell me about yourself"))
|
77
|
+
end
|
78
|
+
|
73
79
|
# @label Disabled
|
74
80
|
# @snapshot
|
75
81
|
def disabled
|
@@ -33,7 +33,7 @@ module Primer
|
|
33
33
|
size: Primer::Forms::Dsl::Input::DEFAULT_SIZE.to_s,
|
34
34
|
show_clear_button: false,
|
35
35
|
clear_button_id: "my-text-field-clear-button",
|
36
|
-
full_width:
|
36
|
+
full_width: true,
|
37
37
|
disabled: false,
|
38
38
|
invalid: false,
|
39
39
|
validation_message: nil,
|
@@ -125,6 +125,12 @@ module Primer
|
|
125
125
|
render(Primer::Alpha::TextField.new(full_width: true, name: "my-text-field", label: "My text field"))
|
126
126
|
end
|
127
127
|
|
128
|
+
# @label Not full width
|
129
|
+
# @snapshot
|
130
|
+
def not_full_width
|
131
|
+
render(Primer::Alpha::TextField.new(full_width: false, name: "my-text-field", label: "My text field"))
|
132
|
+
end
|
133
|
+
|
128
134
|
# @label Disabled
|
129
135
|
# @snapshot
|
130
136
|
def disabled
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%= render(Primer::Beta::ButtonGroup.new) do |component| %>
|
2
|
+
<% component.with_button { "Main menu" } %>
|
3
|
+
<% component.with_menu_button(button_arguments: { "aria-label": "secondary menu" }, menu_arguments: { anchor_align: :end }) do |menu, button| %>
|
4
|
+
<% menu.with_item(label: "Item 1", item_id: :item1) %>
|
5
|
+
<% menu.with_item(label: "Item 2", item_id: :item2) %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
@@ -129,6 +129,49 @@ module Primer
|
|
129
129
|
# @label Trailing action
|
130
130
|
# @snapshot
|
131
131
|
def trailing_action; end
|
132
|
+
|
133
|
+
# @label Long label truncate overflow
|
134
|
+
#
|
135
|
+
# @param truncate_label [Symbol] select [none, truncate, show_tooltip]
|
136
|
+
# @snapshot
|
137
|
+
def long_label_with_tooltip(truncate_label: :show_tooltip)
|
138
|
+
render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
|
139
|
+
component.with_item(
|
140
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
141
|
+
truncate_label: truncate_label
|
142
|
+
) do |item|
|
143
|
+
item.with_trailing_visual_icon(icon: :plus)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def long_label_wrap(truncate_label: :none)
|
149
|
+
render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
|
150
|
+
component.with_item(
|
151
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
152
|
+
truncate_label: truncate_label
|
153
|
+
)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def long_label_truncate_no_tooltip(truncate_label: :truncate)
|
158
|
+
render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
|
159
|
+
component.with_item(
|
160
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
161
|
+
truncate_label: truncate_label
|
162
|
+
)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def long_label_show_tooltip_no_truncate_label
|
167
|
+
render(Primer::Beta::NavList.new(aria: { label: "List heading" })) do |component|
|
168
|
+
component.with_item(
|
169
|
+
label: "Really really long label that may wrap, truncate, or appear as a tooltip",
|
170
|
+
) do |item|
|
171
|
+
item.with_tooltip(text: "this is a tooltip")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
132
175
|
end
|
133
176
|
end
|
134
177
|
end
|
data/static/arguments.json
CHANGED
@@ -249,9 +249,9 @@
|
|
249
249
|
},
|
250
250
|
{
|
251
251
|
"name": "truncate_label",
|
252
|
-
"type": "Boolean",
|
253
|
-
"default": "`
|
254
|
-
"description": "
|
252
|
+
"type": "Boolean | Symbol",
|
253
|
+
"default": "`:none`",
|
254
|
+
"description": "How the label should be truncated when the text does not fit inside the bounds of the list item. One of `false`, `:none`, `:show_tooltip`, `:truncate`, or `true`. Pass `false` or `:none` to wrap label text. Pass `true` or `:truncate` to truncate labels with ellipses. Pass `:show_tooltip` to show the entire label contents in a tooltip when the item is hovered."
|
255
255
|
},
|
256
256
|
{
|
257
257
|
"name": "href",
|
@@ -2494,7 +2494,7 @@
|
|
2494
2494
|
"name": "full_width",
|
2495
2495
|
"type": "Boolean",
|
2496
2496
|
"default": "N/A",
|
2497
|
-
"description": "When set to `true`, the field will take up all the horizontal space allowed by its container."
|
2497
|
+
"description": "When set to `true`, the field will take up all the horizontal space allowed by its container. Defaults to `true`."
|
2498
2498
|
},
|
2499
2499
|
{
|
2500
2500
|
"name": "name",
|
@@ -2624,7 +2624,7 @@
|
|
2624
2624
|
"name": "full_width",
|
2625
2625
|
"type": "Boolean",
|
2626
2626
|
"default": "N/A",
|
2627
|
-
"description": "When set to `true`, the field will take up all the horizontal space allowed by its container."
|
2627
|
+
"description": "When set to `true`, the field will take up all the horizontal space allowed by its container. Defaults to `true`."
|
2628
2628
|
},
|
2629
2629
|
{
|
2630
2630
|
"name": "name",
|
@@ -2814,13 +2814,13 @@
|
|
2814
2814
|
"name": "size",
|
2815
2815
|
"type": "Symbol",
|
2816
2816
|
"default": "`:medium`",
|
2817
|
-
"description": "What size toggle switch to render. One of `:
|
2817
|
+
"description": "What size toggle switch to render. One of `:medium` or `:small`."
|
2818
2818
|
},
|
2819
2819
|
{
|
2820
2820
|
"name": "status_label_position",
|
2821
2821
|
"type": "Symbol",
|
2822
2822
|
"default": "`:start`",
|
2823
|
-
"description": "Which side of the toggle switch to render the status label. One of `:
|
2823
|
+
"description": "Which side of the toggle switch to render the status label. One of `:end` or `:start`."
|
2824
2824
|
},
|
2825
2825
|
{
|
2826
2826
|
"name": "system_arguments",
|
@@ -3436,6 +3436,28 @@
|
|
3436
3436
|
}
|
3437
3437
|
]
|
3438
3438
|
},
|
3439
|
+
{
|
3440
|
+
"component": "ButtonGroup::MenuButton",
|
3441
|
+
"status": "alpha",
|
3442
|
+
"a11y_reviewed": false,
|
3443
|
+
"short_name": "ButtonGroupMenuButton",
|
3444
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/button_group/menu_button.rb",
|
3445
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/button_group/menu_button/default/",
|
3446
|
+
"parameters": [
|
3447
|
+
{
|
3448
|
+
"name": "menu_arguments",
|
3449
|
+
"type": "Hash",
|
3450
|
+
"default": "`{}`",
|
3451
|
+
"description": "The arguments accepted by [ActionMenu](/components/alpha/actionmenu)."
|
3452
|
+
},
|
3453
|
+
{
|
3454
|
+
"name": "button_arguments",
|
3455
|
+
"type": "Hash",
|
3456
|
+
"default": "`{}`",
|
3457
|
+
"description": "The arguments accepted by [Button](/components/beta/button) or [IconButton](/components/beta/iconbutton), depending on the value of the `icon:` argument."
|
3458
|
+
}
|
3459
|
+
]
|
3460
|
+
},
|
3439
3461
|
{
|
3440
3462
|
"component": "ClipboardCopy",
|
3441
3463
|
"status": "beta",
|
@@ -3648,7 +3670,7 @@
|
|
3648
3670
|
},
|
3649
3671
|
{
|
3650
3672
|
"component": "Flash",
|
3651
|
-
"status": "
|
3673
|
+
"status": "deprecated",
|
3652
3674
|
"a11y_reviewed": false,
|
3653
3675
|
"short_name": "Flash",
|
3654
3676
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/flash.rb",
|
data/static/audited_at.json
CHANGED
@@ -75,6 +75,7 @@
|
|
75
75
|
"Primer::Beta::Breadcrumbs::Item": "",
|
76
76
|
"Primer::Beta::Button": "",
|
77
77
|
"Primer::Beta::ButtonGroup": "",
|
78
|
+
"Primer::Beta::ButtonGroup::MenuButton": "",
|
78
79
|
"Primer::Beta::ClipboardCopy": "",
|
79
80
|
"Primer::Beta::ClipboardCopyBaseButton": "",
|
80
81
|
"Primer::Beta::ClipboardCopyButton": "",
|
data/static/constants.json
CHANGED
@@ -95,6 +95,7 @@
|
|
95
95
|
"DEFAULT_DESCRIPTION_SCHEME": "block",
|
96
96
|
"DEFAULT_SCHEME": "default",
|
97
97
|
"DEFAULT_SIZE": "medium",
|
98
|
+
"DEFAULT_TRUNCATION_BEHAVIOR": "none",
|
98
99
|
"DESCRIPTION_SCHEME_MAPPINGS": {
|
99
100
|
"inline": "ActionListItem-descriptionWrap--inline",
|
100
101
|
"block": "ActionListItem-descriptionWrap"
|
@@ -120,6 +121,20 @@
|
|
120
121
|
"medium",
|
121
122
|
"large",
|
122
123
|
"xlarge"
|
124
|
+
],
|
125
|
+
"TRUNCATION_BEHAVIOR_MAPPINGS": {
|
126
|
+
"none": null,
|
127
|
+
"false": null,
|
128
|
+
"show_tooltip": "ActionListItem-label--truncate",
|
129
|
+
"truncate": "ActionListItem-label--truncate",
|
130
|
+
"true": "ActionListItem-label--truncate"
|
131
|
+
},
|
132
|
+
"TRUNCATION_BEHAVIOR_OPTIONS": [
|
133
|
+
"none",
|
134
|
+
false,
|
135
|
+
"show_tooltip",
|
136
|
+
"truncate",
|
137
|
+
true
|
123
138
|
]
|
124
139
|
},
|
125
140
|
"Primer::Alpha::ActionMenu": {
|
@@ -848,6 +863,9 @@
|
|
848
863
|
]
|
849
864
|
},
|
850
865
|
"Primer::Beta::ButtonGroup": {
|
866
|
+
"MenuButton": "Primer::Beta::ButtonGroup::MenuButton"
|
867
|
+
},
|
868
|
+
"Primer::Beta::ButtonGroup::MenuButton": {
|
851
869
|
},
|
852
870
|
"Primer::Beta::ClipboardCopy": {
|
853
871
|
},
|