primer_view_components 0.30.0 → 0.32.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 +51 -0
- data/app/assets/javascripts/app/components/primer/alpha/select_panel_element.d.ts +0 -1
- data/app/assets/javascripts/app/components/primer/shared_events.d.ts +2 -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_list/item.html.erb +1 -5
- data/app/components/primer/alpha/action_list/item.rb +10 -3
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +33 -50
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +20 -7
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +20 -7
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.json +3 -5
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.json +5 -5
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/button_marketing.css +1 -1
- data/app/components/primer/alpha/button_marketing.css.json +1 -4
- data/app/components/primer/alpha/button_marketing.css.map +1 -1
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +7 -7
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.json +9 -15
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.json +1 -3
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +5 -5
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +1 -0
- data/app/components/primer/alpha/select_panel.rb +5 -4
- data/app/components/primer/alpha/select_panel_element.d.ts +0 -1
- data/app/components/primer/alpha/select_panel_element.js +55 -26
- data/app/components/primer/alpha/select_panel_element.ts +53 -29
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.json +1 -3
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +37 -78
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.json +1 -1
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.rb +2 -1
- data/app/components/primer/alpha/tool_tip.js +2 -2
- data/app/components/primer/alpha/tool_tip.ts +2 -2
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.json +2 -4
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/beta/avatar_stack.css +1 -1
- data/app/components/primer/beta/avatar_stack.css.json +8 -8
- data/app/components/primer/beta/avatar_stack.css.map +1 -1
- data/app/components/primer/beta/border_box.css +1 -1
- data/app/components/primer/beta/border_box.css.json +4 -4
- data/app/components/primer/beta/border_box.css.map +1 -1
- data/app/components/primer/beta/breadcrumbs.css +1 -1
- data/app/components/primer/beta/breadcrumbs.css.json +1 -2
- data/app/components/primer/beta/breadcrumbs.css.map +1 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +6 -8
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button_group.css +1 -1
- data/app/components/primer/beta/button_group.css.json +3 -3
- data/app/components/primer/beta/button_group.css.map +1 -1
- data/app/components/primer/beta/label.css +1 -1
- data/app/components/primer/beta/label.css.json +1 -2
- data/app/components/primer/beta/label.css.map +1 -1
- data/app/components/primer/beta/link.css +1 -1
- data/app/components/primer/beta/link.css.json +1 -3
- data/app/components/primer/beta/link.css.map +1 -1
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.json +16 -22
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/relative_time.rb +4 -4
- data/app/components/primer/beta/spinner.html.erb +1 -1
- data/app/components/primer/beta/state.css +1 -1
- data/app/components/primer/beta/state.css.map +1 -1
- data/app/components/primer/beta/state.pcss +4 -0
- data/app/components/primer/beta/truncate.css +1 -1
- data/app/components/primer/beta/truncate.css.json +5 -5
- data/app/components/primer/beta/truncate.css.map +1 -1
- data/app/components/primer/shared_events.d.ts +2 -0
- data/app/components/primer/shared_events.ts +2 -0
- data/lib/primer/forms/primer_text_field.js +3 -0
- data/lib/primer/forms/primer_text_field.ts +4 -0
- data/lib/primer/view_components/linters/details_menu_migration.rb +30 -1
- data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/alpha/action_list_preview.rb +1 -1
- data/previews/primer/alpha/select_panel_preview/list_of_links.html.erb +16 -0
- data/previews/primer/alpha/select_panel_preview/no_values.html.erb +19 -0
- data/previews/primer/alpha/select_panel_preview/playground.html.erb +2 -1
- data/previews/primer/alpha/select_panel_preview/remote_fetch.html.erb +4 -1
- data/previews/primer/alpha/select_panel_preview/single_select.html.erb +4 -4
- data/previews/primer/alpha/select_panel_preview.rb +23 -7
- data/static/arguments.json +6 -6
- data/static/classes.json +39 -21
- data/static/info_arch.json +72 -13
- data/static/previews.json +26 -0
- metadata +4 -2
@@ -19,6 +19,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
19
19
|
var _PrimerTextFieldElement_abortController;
|
20
20
|
import '@github/auto-check-element';
|
21
21
|
import { controller, target } from '@github/catalyst';
|
22
|
+
const SCREENREADER_TEXT_CLASSNAME = 'spinner-screenreader-text';
|
22
23
|
let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
23
24
|
constructor() {
|
24
25
|
super(...arguments);
|
@@ -83,10 +84,12 @@ let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
|
83
84
|
}
|
84
85
|
showLeadingSpinner() {
|
85
86
|
this.leadingSpinner?.removeAttribute('hidden');
|
87
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.removeAttribute('hidden');
|
86
88
|
this.leadingVisual?.setAttribute('hidden', '');
|
87
89
|
}
|
88
90
|
hideLeadingSpinner() {
|
89
91
|
this.leadingSpinner?.setAttribute('hidden', '');
|
92
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.setAttribute('hidden', '');
|
90
93
|
this.leadingVisual?.removeAttribute('hidden');
|
91
94
|
}
|
92
95
|
};
|
@@ -10,6 +10,8 @@ declare global {
|
|
10
10
|
'auto-check-error': AutoCheckErrorEvent
|
11
11
|
}
|
12
12
|
}
|
13
|
+
|
14
|
+
const SCREENREADER_TEXT_CLASSNAME = 'spinner-screenreader-text'
|
13
15
|
@controller
|
14
16
|
export class PrimerTextFieldElement extends HTMLElement {
|
15
17
|
@target inputElement: HTMLInputElement
|
@@ -97,11 +99,13 @@ export class PrimerTextFieldElement extends HTMLElement {
|
|
97
99
|
|
98
100
|
showLeadingSpinner(): void {
|
99
101
|
this.leadingSpinner?.removeAttribute('hidden')
|
102
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.removeAttribute('hidden')
|
100
103
|
this.leadingVisual?.setAttribute('hidden', '')
|
101
104
|
}
|
102
105
|
|
103
106
|
hideLeadingSpinner(): void {
|
104
107
|
this.leadingSpinner?.setAttribute('hidden', '')
|
108
|
+
this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.setAttribute('hidden', '')
|
105
109
|
this.leadingVisual?.removeAttribute('hidden')
|
106
110
|
}
|
107
111
|
}
|
@@ -14,6 +14,13 @@ module ERBLint
|
|
14
14
|
" https://primer.style/design/components/action-menu/rails/alpha"
|
15
15
|
DETAILS_MENU_RUBY_PATTERN = /tag:?\s+:"details-menu"/.freeze
|
16
16
|
|
17
|
+
# Allow custom pattern matching for ERB nodes
|
18
|
+
class ConfigSchema < LinterConfig
|
19
|
+
property :custom_erb_pattern, accepts: array_of?(Regexp),
|
20
|
+
default: -> { [] }
|
21
|
+
end
|
22
|
+
self.config_schema = ConfigSchema
|
23
|
+
|
17
24
|
def run(processed_source)
|
18
25
|
# HTML tags
|
19
26
|
tags(processed_source).each do |tag|
|
@@ -25,9 +32,31 @@ module ERBLint
|
|
25
32
|
# ERB nodes
|
26
33
|
erb_nodes(processed_source).each do |node|
|
27
34
|
code = extract_ruby_from_erb_node(node)
|
28
|
-
|
35
|
+
|
36
|
+
if contains_offense?(code)
|
37
|
+
generate_node_offense(self.class, processed_source, node, MIGRATE_FROM_DETAILS_MENU)
|
38
|
+
end
|
29
39
|
end
|
30
40
|
end
|
41
|
+
|
42
|
+
def contains_offense?(code)
|
43
|
+
return true if code.match?(DETAILS_MENU_RUBY_PATTERN)
|
44
|
+
return code.match?(custom_erb_pattern) if custom_erb_pattern
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def custom_erb_pattern
|
49
|
+
unless defined?(@custom_erb_pattern)
|
50
|
+
@custom_erb_pattern =
|
51
|
+
if @config.custom_erb_pattern.empty?
|
52
|
+
nil
|
53
|
+
else
|
54
|
+
Regexp.new(@config.custom_erb_pattern.join("|"), true)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
@custom_erb_pattern
|
59
|
+
end
|
31
60
|
end
|
32
61
|
end
|
33
62
|
end
|
@@ -10,7 +10,7 @@ module ERBLint
|
|
10
10
|
include LinterRegistry
|
11
11
|
include Helpers::RuleHelpers
|
12
12
|
|
13
|
-
MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated.
|
13
|
+
MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated. Due to major accessibility concerns with using this tooltip, please migrate to a Primer Tooltip component or rework the design to eliminate the tooltip. See https://primer.style/guides/rails/migration-guides/primer-css-tooltipped."
|
14
14
|
TOOLTIPPED_RUBY_PATTERN = /classes:.*tooltipped|class:.*tooltipped/.freeze
|
15
15
|
|
16
16
|
def run(processed_source)
|
@@ -380,7 +380,7 @@ module Primer
|
|
380
380
|
aria: { label: "List heading" }
|
381
381
|
)) do |component|
|
382
382
|
component.with_item(label: "Default item", href: "/") do |item|
|
383
|
-
item.with_description.with_content("This is a description")
|
383
|
+
item.with_description(test_selector: "some-selector").with_content("This is a description")
|
384
384
|
end
|
385
385
|
end
|
386
386
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
select_variant: :single,
|
6
|
+
fetch_strategy: :local,
|
7
|
+
open_on_load: open_on_load
|
8
|
+
)) do |panel| %>
|
9
|
+
<% panel.with_show_button { "Panel" } %>
|
10
|
+
<% panel.with_item(label: "GitHub", href: "https://github.com") %>
|
11
|
+
<% panel.with_item(label: "Microsoft", href: "https://microsoft.com") %>
|
12
|
+
<% panel.with_item(label: "Primer", href: "https://primer.style") %>
|
13
|
+
<% panel.with_item(label: "Catalyst", href: "https://catalyst.rocks") %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
select_variant: :single,
|
6
|
+
fetch_strategy: :local,
|
7
|
+
open_on_load: open_on_load
|
8
|
+
)) do |panel| %>
|
9
|
+
<% panel.with_show_button { "Choose item" } %>
|
10
|
+
<% panel.with_item(label: "Item 1") %>
|
11
|
+
<% panel.with_item(label: "Item 2") %>
|
12
|
+
<% panel.with_item(label: "Item 3") %>
|
13
|
+
<% panel.with_item(label: "Item 4") %>
|
14
|
+
<% panel.with_footer(show_divider: true) do %>
|
15
|
+
I'm a footer!
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
<%= render(Primer::Alpha::SelectPanel.new(
|
4
4
|
data: { interaction_subject: subject_id },
|
5
|
-
src: select_panel_items_path
|
5
|
+
src: select_panel_items_path(
|
6
|
+
select_variant: :multiple,
|
7
|
+
selected_items: selected_items,
|
8
|
+
),
|
6
9
|
select_variant: :multiple,
|
7
10
|
fetch_strategy: :remote,
|
8
11
|
open_on_load: open_on_load
|
@@ -7,10 +7,10 @@
|
|
7
7
|
open_on_load: open_on_load
|
8
8
|
)) do |panel| %>
|
9
9
|
<% panel.with_show_button { "Choose item" } %>
|
10
|
-
<% panel.with_item(label: "Item 1", item_id: :item1) %>
|
11
|
-
<% panel.with_item(label: "Item 2", item_id: :item2) %>
|
12
|
-
<% panel.with_item(label: "Item 3", item_id: :item3) %>
|
13
|
-
<% panel.with_item(label: "Item 4", item_id: :item4) %>
|
10
|
+
<% panel.with_item(label: "Item 1", item_id: :item1, content_arguments: { data: { value: 1 } }) %>
|
11
|
+
<% panel.with_item(label: "Item 2", item_id: :item2, content_arguments: { data: { value: 2 } }) %>
|
12
|
+
<% panel.with_item(label: "Item 3", item_id: :item3, content_arguments: { data: { value: 3 } }) %>
|
13
|
+
<% panel.with_item(label: "Item 4", item_id: :item4, content_arguments: { data: { value: 4 } }) %>
|
14
14
|
<% panel.with_item(label: "Disabled", disabled: true, item_id: :disabled) %>
|
15
15
|
<% panel.with_footer(show_divider: true) do %>
|
16
16
|
I'm a footer!
|
@@ -18,6 +18,7 @@ module Primer
|
|
18
18
|
# @param open_on_load toggle
|
19
19
|
# @param anchor_align [Symbol] select [start, center, end]
|
20
20
|
# @param anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
|
21
|
+
# @param selected_items text
|
21
22
|
def playground(
|
22
23
|
title: "Sci-fi equipment",
|
23
24
|
subtitle: "Various tools from your favorite shows",
|
@@ -31,10 +32,12 @@ module Primer
|
|
31
32
|
show_filter: true,
|
32
33
|
open_on_load: false,
|
33
34
|
anchor_align: :start,
|
34
|
-
anchor_side: :outside_bottom
|
35
|
+
anchor_side: :outside_bottom,
|
36
|
+
selected_items: "Phaser"
|
35
37
|
)
|
36
38
|
render_with_template(locals: {
|
37
39
|
subtitle: subtitle,
|
40
|
+
selected_items: selected_items,
|
38
41
|
system_arguments: {
|
39
42
|
title: title,
|
40
43
|
size: size,
|
@@ -62,8 +65,6 @@ module Primer
|
|
62
65
|
})
|
63
66
|
end
|
64
67
|
|
65
|
-
# @!group Fetch strategies
|
66
|
-
|
67
68
|
# @label Local fetch
|
68
69
|
#
|
69
70
|
# @snapshot interactive
|
@@ -84,8 +85,9 @@ module Primer
|
|
84
85
|
#
|
85
86
|
# @snapshot interactive
|
86
87
|
# @param open_on_load toggle
|
87
|
-
|
88
|
-
|
88
|
+
# @param selected_items text
|
89
|
+
def remote_fetch(open_on_load: false, selected_items: "Phaser")
|
90
|
+
render_with_template(locals: { open_on_load: open_on_load, selected_items: selected_items })
|
89
91
|
end
|
90
92
|
|
91
93
|
# @label Local fetch (no results)
|
@@ -112,8 +114,6 @@ module Primer
|
|
112
114
|
render_with_template(locals: { open_on_load: open_on_load })
|
113
115
|
end
|
114
116
|
|
115
|
-
# @!endgroup
|
116
|
-
|
117
117
|
# @label Single select
|
118
118
|
#
|
119
119
|
# @snapshot interactive
|
@@ -234,6 +234,22 @@ module Primer
|
|
234
234
|
def multiselect_form(open_on_load: false, route_format: :html)
|
235
235
|
render_with_template(locals: { open_on_load: open_on_load, route_format: route_format })
|
236
236
|
end
|
237
|
+
|
238
|
+
# @label List of links
|
239
|
+
#
|
240
|
+
# @snapshot interactive
|
241
|
+
# @param open_on_load toggle
|
242
|
+
def list_of_links(open_on_load: false)
|
243
|
+
render_with_template(locals: { open_on_load: open_on_load })
|
244
|
+
end
|
245
|
+
|
246
|
+
# @label No values
|
247
|
+
#
|
248
|
+
# @snapshot interactive
|
249
|
+
# @param open_on_load toggle
|
250
|
+
def no_values(open_on_load: false)
|
251
|
+
render_with_template(locals: { open_on_load: open_on_load })
|
252
|
+
end
|
237
253
|
end
|
238
254
|
end
|
239
255
|
end
|
data/static/arguments.json
CHANGED
@@ -2388,7 +2388,7 @@
|
|
2388
2388
|
"name": "select_variant",
|
2389
2389
|
"type": "Symbol",
|
2390
2390
|
"default": "`:single`",
|
2391
|
-
"description": "One of `:multiple`, `:
|
2391
|
+
"description": "One of `:multiple`, `:none`, or `:single`."
|
2392
2392
|
},
|
2393
2393
|
{
|
2394
2394
|
"name": "fetch_strategy",
|
@@ -4336,9 +4336,9 @@
|
|
4336
4336
|
},
|
4337
4337
|
{
|
4338
4338
|
"name": "prefix",
|
4339
|
-
"type": "
|
4339
|
+
"type": "String",
|
4340
4340
|
"default": "`nil`",
|
4341
|
-
"description": "What to prefix the relative
|
4341
|
+
"description": "What to prefix the relative time display with."
|
4342
4342
|
},
|
4343
4343
|
{
|
4344
4344
|
"name": "second",
|
@@ -4390,7 +4390,7 @@
|
|
4390
4390
|
},
|
4391
4391
|
{
|
4392
4392
|
"name": "threshold",
|
4393
|
-
"type": "
|
4393
|
+
"type": "String",
|
4394
4394
|
"default": "`nil`",
|
4395
4395
|
"description": "The threshold, in ISO-8601 'durations' format, at which relative time displays become absolute."
|
4396
4396
|
},
|
@@ -4414,13 +4414,13 @@
|
|
4414
4414
|
},
|
4415
4415
|
{
|
4416
4416
|
"name": "lang",
|
4417
|
-
"type": "
|
4417
|
+
"type": "String",
|
4418
4418
|
"default": "`nil`",
|
4419
4419
|
"description": "The language to use."
|
4420
4420
|
},
|
4421
4421
|
{
|
4422
4422
|
"name": "title",
|
4423
|
-
"type": "
|
4423
|
+
"type": "String",
|
4424
4424
|
"default": "`nil`",
|
4425
4425
|
"description": "Provide a custom title to the element."
|
4426
4426
|
},
|
data/static/classes.json
CHANGED
@@ -251,6 +251,9 @@
|
|
251
251
|
"FormControl-checkbox-wrap": [
|
252
252
|
"Primer::Alpha::TextField"
|
253
253
|
],
|
254
|
+
"FormControl-error": [
|
255
|
+
"Primer::Alpha::TextField"
|
256
|
+
],
|
254
257
|
"FormControl-horizontalGroup": [
|
255
258
|
"Primer::Alpha::TextField"
|
256
259
|
],
|
@@ -266,12 +269,27 @@
|
|
266
269
|
"FormControl-input": [
|
267
270
|
"Primer::Alpha::TextField"
|
268
271
|
],
|
272
|
+
"FormControl-input-trailingAction--divider": [
|
273
|
+
"Primer::Alpha::TextField"
|
274
|
+
],
|
269
275
|
"FormControl-input-wrap": [
|
270
276
|
"Primer::Alpha::TextField"
|
271
277
|
],
|
278
|
+
"FormControl-inset": [
|
279
|
+
"Primer::Alpha::TextField"
|
280
|
+
],
|
272
281
|
"FormControl-label": [
|
273
282
|
"Primer::Alpha::TextField"
|
274
283
|
],
|
284
|
+
"FormControl-large": [
|
285
|
+
"Primer::Alpha::TextField"
|
286
|
+
],
|
287
|
+
"FormControl-medium": [
|
288
|
+
"Primer::Alpha::TextField"
|
289
|
+
],
|
290
|
+
"FormControl-monospace": [
|
291
|
+
"Primer::Alpha::TextField"
|
292
|
+
],
|
275
293
|
"FormControl-radio-group-wrap": [
|
276
294
|
"Primer::Alpha::TextField"
|
277
295
|
],
|
@@ -284,15 +302,24 @@
|
|
284
302
|
"FormControl-select-wrap": [
|
285
303
|
"Primer::Alpha::TextField"
|
286
304
|
],
|
305
|
+
"FormControl-small": [
|
306
|
+
"Primer::Alpha::TextField"
|
307
|
+
],
|
287
308
|
"FormControl-spacingWrapper": [
|
288
309
|
"Primer::Alpha::TextField"
|
289
310
|
],
|
311
|
+
"FormControl-success": [
|
312
|
+
"Primer::Alpha::TextField"
|
313
|
+
],
|
290
314
|
"FormControl-textarea": [
|
291
315
|
"Primer::Alpha::TextField"
|
292
316
|
],
|
293
317
|
"FormControl-toggleSwitchInput": [
|
294
318
|
"Primer::Alpha::TextField"
|
295
319
|
],
|
320
|
+
"FormControl-warning": [
|
321
|
+
"Primer::Alpha::TextField"
|
322
|
+
],
|
296
323
|
"Label": [
|
297
324
|
"Primer::Beta::Label"
|
298
325
|
],
|
@@ -347,6 +374,12 @@
|
|
347
374
|
"Layout-divider": [
|
348
375
|
"Primer::Alpha::Layout"
|
349
376
|
],
|
377
|
+
"Layout-divider--flowRow-hidden": [
|
378
|
+
"Primer::Alpha::Layout"
|
379
|
+
],
|
380
|
+
"Layout-divider--flowRow-shallow": [
|
381
|
+
"Primer::Alpha::Layout"
|
382
|
+
],
|
350
383
|
"Layout-main": [
|
351
384
|
"Primer::Alpha::Layout"
|
352
385
|
],
|
@@ -414,9 +447,6 @@
|
|
414
447
|
"Popover-message": [
|
415
448
|
"Primer::Beta::Popover"
|
416
449
|
],
|
417
|
-
"Popover-message--bottom": [
|
418
|
-
"Primer::Beta::Popover"
|
419
|
-
],
|
420
450
|
"Popover-message--bottom-left": [
|
421
451
|
"Primer::Beta::Popover"
|
422
452
|
],
|
@@ -426,27 +456,9 @@
|
|
426
456
|
"Popover-message--large": [
|
427
457
|
"Primer::Beta::Popover"
|
428
458
|
],
|
429
|
-
"Popover-message--left": [
|
430
|
-
"Primer::Beta::Popover"
|
431
|
-
],
|
432
|
-
"Popover-message--left-bottom": [
|
433
|
-
"Primer::Beta::Popover"
|
434
|
-
],
|
435
|
-
"Popover-message--left-top": [
|
436
|
-
"Primer::Beta::Popover"
|
437
|
-
],
|
438
459
|
"Popover-message--no-caret": [
|
439
460
|
"Primer::Beta::Popover"
|
440
461
|
],
|
441
|
-
"Popover-message--right": [
|
442
|
-
"Primer::Beta::Popover"
|
443
|
-
],
|
444
|
-
"Popover-message--right-bottom": [
|
445
|
-
"Primer::Beta::Popover"
|
446
|
-
],
|
447
|
-
"Popover-message--right-top": [
|
448
|
-
"Primer::Beta::Popover"
|
449
|
-
],
|
450
462
|
"Popover-message--top-left": [
|
451
463
|
"Primer::Beta::Popover"
|
452
464
|
],
|
@@ -591,6 +603,12 @@
|
|
591
603
|
"Truncate": [
|
592
604
|
"Primer::Beta::Truncate"
|
593
605
|
],
|
606
|
+
"Truncate-text--expandable": [
|
607
|
+
"Primer::Beta::Truncate"
|
608
|
+
],
|
609
|
+
"Truncate-text--primary": [
|
610
|
+
"Primer::Beta::Truncate"
|
611
|
+
],
|
594
612
|
"UnderlineNav": [
|
595
613
|
"Primer::Alpha::UnderlineNav"
|
596
614
|
],
|
data/static/info_arch.json
CHANGED
@@ -989,9 +989,20 @@
|
|
989
989
|
"slots": [
|
990
990
|
{
|
991
991
|
"name": "description",
|
992
|
-
"description": "Description content that complements the item's label
|
992
|
+
"description": "Description content that complements the item's label, with optional test_selector.\nSee `ActionList`'s `description_scheme` argument for layout options.",
|
993
993
|
"parameters": [
|
994
|
-
|
994
|
+
{
|
995
|
+
"name": "legacy_content",
|
996
|
+
"type": "String",
|
997
|
+
"default": "N/A",
|
998
|
+
"description": "Slot content, provided for backwards-compatibility. Pass a content block instead, or call `with_content`, eg. `component.with_description { \"My description\" }` or `component.with_description.with_content(\"My description\")`."
|
999
|
+
},
|
1000
|
+
{
|
1001
|
+
"name": "test_selector",
|
1002
|
+
"type": "String",
|
1003
|
+
"default": "N/A",
|
1004
|
+
"description": "The value of this argument is set as the value of a `data-test-selector` HTML attribute on the description element."
|
1005
|
+
}
|
995
1006
|
]
|
996
1007
|
},
|
997
1008
|
{
|
@@ -5547,9 +5558,20 @@
|
|
5547
5558
|
},
|
5548
5559
|
{
|
5549
5560
|
"name": "description",
|
5550
|
-
"description": "Description content that complements the item's label
|
5561
|
+
"description": "Description content that complements the item's label, with optional test_selector.\nSee `ActionList`'s `description_scheme` argument for layout options.",
|
5551
5562
|
"parameters": [
|
5552
|
-
|
5563
|
+
{
|
5564
|
+
"name": "legacy_content",
|
5565
|
+
"type": "String",
|
5566
|
+
"default": "N/A",
|
5567
|
+
"description": "Slot content, provided for backwards-compatibility. Pass a content block instead, or call `with_content`, eg. `component.with_description { \"My description\" }` or `component.with_description.with_content(\"My description\")`."
|
5568
|
+
},
|
5569
|
+
{
|
5570
|
+
"name": "test_selector",
|
5571
|
+
"type": "String",
|
5572
|
+
"default": "N/A",
|
5573
|
+
"description": "The value of this argument is set as the value of a `data-test-selector` HTML attribute on the description element."
|
5574
|
+
}
|
5553
5575
|
]
|
5554
5576
|
},
|
5555
5577
|
{
|
@@ -7511,7 +7533,7 @@
|
|
7511
7533
|
},
|
7512
7534
|
{
|
7513
7535
|
"fully_qualified_name": "Primer::Alpha::SelectPanel",
|
7514
|
-
"description": "Select panels allow for selecting from a large number of options and can be thought of as a more capable\nversion of the traditional HTML `<select>` element.\n\nSelect panels:\n\n1. feature an input field at the top that allows an end user to filter the list of results.\n1. can render their items statically or dynamically by fetching results from the server.\n1. allow selecting a single item or multiple items.\n1. permit leading visuals like Octicons, avatars, and custom SVGs.\n1. can be used as form inputs in Rails forms.\n\n## Static list items\n\nThe Rails `SelectPanel` component allows items to be provided statically or loaded dynamically from the\nserver. Providing items statically is done using a fetch strategy of `:local` in combination with the\n`item` slot:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new(fetch_strategy: :local))) do |panel| %>\n <% panel.with_show_button { \"Select item\" } %>\n <% panel.with_item(label: \"Item 1\") %>\n <% panel.with_item(label: \"Item 2\") %>\n<% end %>\n```\n\n## Dynamic list items\n\nList items can also be fetched dynamically from the server and will require creating a Rails controller action\nto respond with the list of items in addition to rendering the `SelectPanel` instance. Render the instance as\nnormal, providing your desired [fetch strategy](#fetch-strategies):\n\n```erb\n<%= render(\n Primer::Alpha::SelectPanel.new(\n fetch_strategy: :remote,\n src: search_items_path # perhaps a Rails URL helper\n )\n) %>\n```\n\nDefine a controller action to serve the list of items. The `SelectPanel` component passes any filter text in\nthe `q=` URL parameter.\n\n```ruby\nclass SearchItemsController < ApplicationController\n def show\n # NOTE: params[:q] may be nil since there is no filter string available\n # when the panel is first opened\n @results = SomeModel.search(params[:q] || \"\")\n end\nend\n```\n\nResponses must be HTML fragments, eg. have a content type of `text/html+fragment`. This content type isn't\navailable by default in Rails, so you may have to register it eg. in an initializer:\n\n```ruby\nMime::Type.register(\"text/fragment+html\", :html_fragment)\n```\n\nRender a `Primer::Alpha::SelectPanel::ItemList` in the action's template, search_items/show.html_fragment.erb:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% @results.each do |result| %>\n <% list.with_item(label: result.title) do |item| %>\n <% item.with_description(result.description) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\n### Selection consistency\n\nThe `SelectPanel` component automatically \"remembers\" which items have been selected across item fetch requests,\nmeaning the controller that renders dynamic list items does not (and should not) remember these selections or\npersist them until the user has confirmed them, either by submitting the form or otherwise indicating completion.\nThe `SelectPanel` component does not include unconfirmed selection data in requests.\n\n## Fetch strategies\n\nThe list of items can be fetched from a remote URL, or provided as a static list, configured using the\n`fetch_strategy` attribute. Fetch strategies are summarized below.\n\n1. `:remote`: a query is made to the URL in the `src` attribute every time the input field changes.\n\n2. `:eventually_local`: a query is made to the URL in the `src` attribute when the panel is first opened. The\n results are \"remembered\" and filtered in-memory for all subsequent filter operations, i.e. when the input\n field changes.\n\n3. `:local`: the list of items is provided statically ahead of time and filtered in-memory. No requests are made\n to the server.\n\n## Customizing filter behavior\n\nIf the fetch strategy is `:remote`, then filtering is handled server-side. The server should render a\n`Primer::Alpha::SelectPanel::ItemList` (an alias of {{#link_to_component}}Primer::Alpha::ActionList{{/link_to_component}})\nin the response containing the filtered list of items. The component achieves remote fetching via the\n[remote-input-element](https://github.com/github/remote-input-element), which sends a request to the\nserver with the filter string in the `q=` parameter. Responses must be HTML fragments, eg. have a content\ntype of `text/html+fragment`.\n\n### Local filtering\n\nIf the fetch strategy is `:local` or `:eventually_local`, filtering is performed client-side. Filter behavior can\nbe customized in JavaScript by setting the `filterFn` attribute on the instance of `SelectPanelElement`, eg:\n\n```javascript\ndocument.querySelector(\"select-panel\").filterFn = (item: HTMLElement, query: string): boolean => {\n // return true if the item should be displayed, false otherwise\n}\n```\n\nThe element's default filter function uses the value of the `data-filter-string` attribute, falling back to the\nelement's `innerText` property. It performs a case-insensitive substring match against the filter string.\n\n### `SelectPanel`s as form inputs\n\n`SelectPanel`s can be used as form inputs. They behave very similarly to how HTML `<select>` boxes behave, and\nplay nicely with Rails' built-in form mechanisms. Pass arguments via the `form_arguments:` argument, including\nthe Rails form builder object and the name of the field. Each list item must also have a value specified in\n`content_arguments: { data: { value: } }`.\n\n```erb\n<% form_with(model: Address.new) do |f| %>\n <%= render(Primer::Alpha::SelectPanel.new(form_arguments: { builder: f, name: \"country\" })) do |menu| %>\n <% countries.each do |country|\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\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. `\"country\"`). If no value is provided for an item, the value of that item is the item's label. Here's the\ncorresponding `AddressesController` that might be written to handle the form above:\n\n```ruby\nclass AddressesController < ApplicationController\n def create\n puts \"You chose #{address_params[:country]} as your country\"\n end\n\n private\n\n def address_params\n params.require(:address).permit(:country)\n end\nend\n```\n\nIf items are provided dynamically, things become a bit more complicated. The `form_for` or `form_with` method call\nhappens in the view that renders the `SelectPanel`, which means the form builder object but isn't available in the\nview that renders the list items. In such a case, it can be useful to create an instance of the form builder maually:\n\n```erb\n<% builder = ActionView::Helpers::FormBuilder.new(\n \"address\", # the name of the model, used to wrap input names, eg 'address[country_code]'\n nil, # object (eg. the Address instance, which we can omit)\n self, # template\n {} # options\n) %>\n<%= render(Primer::Alpha::SelectPanel::ItemList.new(\n form_arguments: { builder: builder, name: \"country\" }\n)) do |list| %>\n <% countries.each do |country| %>\n <% menu.with_item(label: country.name, data: { value: country.code }) %>\n <% end %>\n<% end %>\n```\n\n### JavaScript API\n\n`SelectPanel`s render a `<select-panel>` custom element that exposes behavior to the client.\n\n#### Utility methods\n\n* `show()`: Manually open the panel. Under normal circumstances, a show button is used to show the panel, but this method exists to support unusual use-cases.\n* `hide()`: Manually hides (closes) the panel.\n\n#### Query methods\n\n* `getItemById(itemId: string): Element`: Returns the item's HTML `<li>` element. The return value can be passed as the `item` argument to the other methods listed below.\n* `isItemChecked(item: Element): boolean`: Returns `true` if the item is checked, `false` otherwise.\n* `isItemHidden(item: Element): boolean`: Returns `true` if the item is hidden, `false` otherwise.\n* `isItemDisabled(item: Element): boolean`: Returns `true` if the item is disabled, `false` otherwise.\n\nNOTE: Item IDs are special values provided by the user that are attached to `SelectPanel` list items as the `data-item-id`\nHTML attribute. Item IDs can be provided by passing an `item_id:` attribute when adding items to the panel, eg:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new) do |panel| %>\n <% panel.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\nThe same is true when rendering `ItemList`s:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% list.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\n#### State methods\n\n* `enableItem(item: Element)`: Enables the item, i.e. makes it clickable by the mouse and keyboard.\n* `disableItem(item: Element)`: Disables the item, i.e. makes it unclickable by the mouse and keyboard.\n* `checkItem(item: Element)`: Checks the item. Only has an effect in single- and multi-select modes.\n* `uncheckItem(item: Element)`: Unchecks the item. Only has an effect in multi-select mode, since items cannot be unchecked in single-select mode.\n\n#### Events\n\n|Name |Type |Bubbles |Cancelable |\n|:--------------------|:------------------------------------------|:-------|:----------|\n|`itemActivated` |`CustomEvent<ItemActivatedEvent>` |Yes |No |\n|`beforeItemActivated`|`CustomEvent<ItemActivatedEvent>` |Yes |Yes |\n|`dialog:open` |`CustomEvent<{dialog: HTMLDialogElement}>` |No |No |\n|`panelClosed` |`CustomEvent<{panel: SelectPanelElement}>` |Yes |No |\n\n_Item activation_\n\nThe `<select-panel>` element fires an `itemActivated` event whenever an item is activated (eg. clicked) via the mouse or keyboard.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"itemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n }\n)\n```\n\nThe `beforeItemActivated` event fires before an item is activated. Canceling this event will prevent the item\nfrom being activated.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"beforeItemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n event.preventDefault() // Cancel the event to prevent activation (eg. checking/unchecking)\n }\n)\n```",
|
7536
|
+
"description": "Select panels allow for selecting from a large number of options and can be thought of as a more capable\nversion of the traditional HTML `<select>` element.\n\nSelect panels:\n\n1. feature an input field at the top that allows an end user to filter the list of results.\n1. can render their items statically or dynamically by fetching results from the server.\n1. allow selecting a single item or multiple items.\n1. permit leading visuals like Octicons, avatars, and custom SVGs.\n1. can be used as form inputs in Rails forms.\n\n## Static list items\n\nThe Rails `SelectPanel` component allows items to be provided statically or loaded dynamically from the\nserver. Providing items statically is done using a fetch strategy of `:local` in combination with the\n`item` slot:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new(fetch_strategy: :local))) do |panel| %>\n <% panel.with_show_button { \"Select item\" } %>\n <% panel.with_item(label: \"Item 1\") %>\n <% panel.with_item(label: \"Item 2\") %>\n<% end %>\n```\n\n## Dynamic list items\n\nList items can also be fetched dynamically from the server and will require creating a Rails controller action\nto respond with the list of items in addition to rendering the `SelectPanel` instance. Render the instance as\nnormal, providing your desired [fetch strategy](#fetch-strategies):\n\n```erb\n<%= render(\n Primer::Alpha::SelectPanel.new(\n fetch_strategy: :remote,\n src: search_items_path # perhaps a Rails URL helper\n )\n) %>\n```\n\nDefine a controller action to serve the list of items. The `SelectPanel` component passes any filter text in\nthe `q=` URL parameter.\n\n```ruby\nclass SearchItemsController < ApplicationController\n def show\n # NOTE: params[:q] may be nil since there is no filter string available\n # when the panel is first opened\n @results = SomeModel.search(params[:q] || \"\")\n end\nend\n```\n\nResponses must be HTML fragments, eg. have a content type of `text/html+fragment`. This content type isn't\navailable by default in Rails, so you may have to register it eg. in an initializer:\n\n```ruby\nMime::Type.register(\"text/fragment+html\", :html_fragment)\n```\n\nRender a `Primer::Alpha::SelectPanel::ItemList` in the action's template, search_items/show.html_fragment.erb:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% @results.each do |result| %>\n <% list.with_item(label: result.title) do |item| %>\n <% item.with_description(result.description) %>\n <% end %>\n <% end %>\n<% end %>\n```\n\n### Selection consistency\n\nThe `SelectPanel` component automatically \"remembers\" which items have been selected across item fetch requests,\nmeaning the controller that renders dynamic list items does not (and should not) remember these selections or\npersist them until the user has confirmed them, either by submitting the form or otherwise indicating completion.\nThe `SelectPanel` component does not include unconfirmed selection data in requests.\n\n## Fetch strategies\n\nThe list of items can be fetched from a remote URL, or provided as a static list, configured using the\n`fetch_strategy` attribute. Fetch strategies are summarized below.\n\n1. `:remote`: a query is made to the URL in the `src` attribute every time the input field changes.\n\n2. `:eventually_local`: a query is made to the URL in the `src` attribute when the panel is first opened. The\n results are \"remembered\" and filtered in-memory for all subsequent filter operations, i.e. when the input\n field changes.\n\n3. `:local`: the list of items is provided statically ahead of time and filtered in-memory. No requests are made\n to the server.\n\n## Customizing filter behavior\n\nIf the fetch strategy is `:remote`, then filtering is handled server-side. The server should render a\n`Primer::Alpha::SelectPanel::ItemList` (an alias of {{#link_to_component}}Primer::Alpha::ActionList{{/link_to_component}})\nin the response containing the filtered list of items. The component achieves remote fetching via the\n[remote-input-element](https://github.com/github/remote-input-element), which sends a request to the\nserver with the filter string in the `q=` parameter. Responses must be HTML fragments, eg. have a content\ntype of `text/html+fragment`.\n\n### Local filtering\n\nIf the fetch strategy is `:local` or `:eventually_local`, filtering is performed client-side. Filter behavior can\nbe customized in JavaScript by setting the `filterFn` attribute on the instance of `SelectPanelElement`, eg:\n\n```javascript\ndocument.querySelector(\"select-panel\").filterFn = (item: HTMLElement, query: string): boolean => {\n // return true if the item should be displayed, false otherwise\n}\n```\n\nThe element's default filter function uses the value of the `data-filter-string` attribute, falling back to the\nelement's `innerText` property. It performs a case-insensitive substring match against the filter string.\n\n### `SelectPanel`s as form inputs\n\n`SelectPanel`s can be used as form inputs. They behave very similarly to how HTML `<select>` boxes behave, and\nplay nicely with Rails' built-in form mechanisms. Pass arguments via the `form_arguments:` argument, including\nthe Rails form builder object and the name of the field. Each list item must also have a value specified in\n`content_arguments: { data: { value: } }`.\n\n```erb\n<% form_with(model: Address.new) do |f| %>\n <%= render(Primer::Alpha::SelectPanel.new(form_arguments: { builder: f, name: \"country\" })) do |menu| %>\n <% countries.each do |country|\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\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. `\"country\"`). If no value is provided for an item, the value of that item is the item's label. Here's the\ncorresponding `AddressesController` that might be written to handle the form above:\n\n```ruby\nclass AddressesController < ApplicationController\n def create\n puts \"You chose #{address_params[:country]} as your country\"\n end\n\n private\n\n def address_params\n params.require(:address).permit(:country)\n end\nend\n```\n\nIf items are provided dynamically, things become a bit more complicated. The `form_for` or `form_with` method call\nhappens in the view that renders the `SelectPanel`, which means the form builder object but isn't available in the\nview that renders the list items. In such a case, it can be useful to create an instance of the form builder maually:\n\n```erb\n<% builder = ActionView::Helpers::FormBuilder.new(\n \"address\", # the name of the model, used to wrap input names, eg 'address[country]'\n nil, # object (eg. the Address instance, which we can omit)\n self, # template\n {} # options\n) %>\n<%= render(Primer::Alpha::SelectPanel::ItemList.new(\n form_arguments: { builder: builder, name: \"country\" }\n)) do |list| %>\n <% countries.each do |country| %>\n <% menu.with_item(label: country.name, content_arguments: { data: { value: country.code } }) %>\n <% end %>\n<% end %>\n```\n\n### JavaScript API\n\n`SelectPanel`s render a `<select-panel>` custom element that exposes behavior to the client.\n\n#### Utility methods\n\n* `show()`: Manually open the panel. Under normal circumstances, a show button is used to show the panel, but this method exists to support unusual use-cases.\n* `hide()`: Manually hides (closes) the panel.\n\n#### Query methods\n\n* `getItemById(itemId: string): Element`: Returns the item's HTML `<li>` element. The return value can be passed as the `item` argument to the other methods listed below.\n* `isItemChecked(item: Element): boolean`: Returns `true` if the item is checked, `false` otherwise.\n* `isItemHidden(item: Element): boolean`: Returns `true` if the item is hidden, `false` otherwise.\n* `isItemDisabled(item: Element): boolean`: Returns `true` if the item is disabled, `false` otherwise.\n\nNOTE: Item IDs are special values provided by the user that are attached to `SelectPanel` list items as the `data-item-id`\nHTML attribute. Item IDs can be provided by passing an `item_id:` attribute when adding items to the panel, eg:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel.new) do |panel| %>\n <% panel.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\nThe same is true when rendering `ItemList`s:\n\n```erb\n<%= render(Primer::Alpha::SelectPanel::ItemList.new) do |list| %>\n <% list.with_item(item_id: \"my-id\") %>\n<% end %>\n```\n\n#### State methods\n\n* `enableItem(item: Element)`: Enables the item, i.e. makes it clickable by the mouse and keyboard.\n* `disableItem(item: Element)`: Disables the item, i.e. makes it unclickable by the mouse and keyboard.\n* `checkItem(item: Element)`: Checks the item. Only has an effect in single- and multi-select modes.\n* `uncheckItem(item: Element)`: Unchecks the item. Only has an effect in multi-select mode, since items cannot be unchecked in single-select mode.\n\n#### Events\n\n|Name |Type |Bubbles |Cancelable |\n|:--------------------|:------------------------------------------|:-------|:----------|\n|`itemActivated` |`CustomEvent<ItemActivatedEvent>` |Yes |No |\n|`beforeItemActivated`|`CustomEvent<ItemActivatedEvent>` |Yes |Yes |\n|`dialog:open` |`CustomEvent<{dialog: HTMLDialogElement}>` |No |No |\n|`panelClosed` |`CustomEvent<{panel: SelectPanelElement}>` |Yes |No |\n\n_Item activation_\n\nThe `<select-panel>` element fires an `itemActivated` event whenever an item is activated (eg. clicked) via the mouse or keyboard.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"itemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n }\n)\n```\n\nThe `beforeItemActivated` event fires before an item is activated. Canceling this event will prevent the item\nfrom being activated.\n\n```typescript\ndocument.querySelector(\"select-panel\").addEventListener(\n \"beforeItemActivated\",\n (event: CustomEvent<ItemActivatedEvent>) => {\n event.detail.item // Element: the <li> item that was activated\n event.detail.checked // boolean: whether or not the result of the activation checked the item\n event.preventDefault() // Cancel the event to prevent activation (eg. checking/unchecking)\n }\n)\n```",
|
7515
7537
|
"accessibility_docs": null,
|
7516
7538
|
"is_form_component": false,
|
7517
7539
|
"is_published": true,
|
@@ -7551,7 +7573,7 @@
|
|
7551
7573
|
"name": "select_variant",
|
7552
7574
|
"type": "Symbol",
|
7553
7575
|
"default": "`:single`",
|
7554
|
-
"description": "One of `:multiple`, `:
|
7576
|
+
"description": "One of `:multiple`, `:none`, or `:single`."
|
7555
7577
|
},
|
7556
7578
|
{
|
7557
7579
|
"name": "fetch_strategy",
|
@@ -8083,6 +8105,32 @@
|
|
8083
8105
|
"color-contrast"
|
8084
8106
|
]
|
8085
8107
|
}
|
8108
|
+
},
|
8109
|
+
{
|
8110
|
+
"preview_path": "primer/alpha/select_panel/list_of_links",
|
8111
|
+
"name": "list_of_links",
|
8112
|
+
"snapshot": "interactive",
|
8113
|
+
"skip_rules": {
|
8114
|
+
"wont_fix": [
|
8115
|
+
"region"
|
8116
|
+
],
|
8117
|
+
"will_fix": [
|
8118
|
+
"color-contrast"
|
8119
|
+
]
|
8120
|
+
}
|
8121
|
+
},
|
8122
|
+
{
|
8123
|
+
"preview_path": "primer/alpha/select_panel/no_values",
|
8124
|
+
"name": "no_values",
|
8125
|
+
"snapshot": "interactive",
|
8126
|
+
"skip_rules": {
|
8127
|
+
"wont_fix": [
|
8128
|
+
"region"
|
8129
|
+
],
|
8130
|
+
"will_fix": [
|
8131
|
+
"color-contrast"
|
8132
|
+
]
|
8133
|
+
}
|
8086
8134
|
}
|
8087
8135
|
],
|
8088
8136
|
"subcomponents": [
|
@@ -14687,9 +14735,20 @@
|
|
14687
14735
|
},
|
14688
14736
|
{
|
14689
14737
|
"name": "description",
|
14690
|
-
"description": "Description content that complements the item's label
|
14738
|
+
"description": "Description content that complements the item's label, with optional test_selector.\nSee `ActionList`'s `description_scheme` argument for layout options.",
|
14691
14739
|
"parameters": [
|
14692
|
-
|
14740
|
+
{
|
14741
|
+
"name": "legacy_content",
|
14742
|
+
"type": "String",
|
14743
|
+
"default": "N/A",
|
14744
|
+
"description": "Slot content, provided for backwards-compatibility. Pass a content block instead, or call `with_content`, eg. `component.with_description { \"My description\" }` or `component.with_description.with_content(\"My description\")`."
|
14745
|
+
},
|
14746
|
+
{
|
14747
|
+
"name": "test_selector",
|
14748
|
+
"type": "String",
|
14749
|
+
"default": "N/A",
|
14750
|
+
"description": "The value of this argument is set as the value of a `data-test-selector` HTML attribute on the description element."
|
14751
|
+
}
|
14693
14752
|
]
|
14694
14753
|
},
|
14695
14754
|
{
|
@@ -15349,9 +15408,9 @@
|
|
15349
15408
|
},
|
15350
15409
|
{
|
15351
15410
|
"name": "prefix",
|
15352
|
-
"type": "
|
15411
|
+
"type": "String",
|
15353
15412
|
"default": "`nil`",
|
15354
|
-
"description": "What to prefix the relative
|
15413
|
+
"description": "What to prefix the relative time display with."
|
15355
15414
|
},
|
15356
15415
|
{
|
15357
15416
|
"name": "second",
|
@@ -15403,7 +15462,7 @@
|
|
15403
15462
|
},
|
15404
15463
|
{
|
15405
15464
|
"name": "threshold",
|
15406
|
-
"type": "
|
15465
|
+
"type": "String",
|
15407
15466
|
"default": "`nil`",
|
15408
15467
|
"description": "The threshold, in ISO-8601 'durations' format, at which relative time displays become absolute."
|
15409
15468
|
},
|
@@ -15427,13 +15486,13 @@
|
|
15427
15486
|
},
|
15428
15487
|
{
|
15429
15488
|
"name": "lang",
|
15430
|
-
"type": "
|
15489
|
+
"type": "String",
|
15431
15490
|
"default": "`nil`",
|
15432
15491
|
"description": "The language to use."
|
15433
15492
|
},
|
15434
15493
|
{
|
15435
15494
|
"name": "title",
|
15436
|
-
"type": "
|
15495
|
+
"type": "String",
|
15437
15496
|
"default": "`nil`",
|
15438
15497
|
"description": "Provide a custom title to the element."
|
15439
15498
|
},
|