primer_view_components 0.26.1 → 0.28.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 +28 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_menu/action_menu_element.d.ts +0 -9
- data/app/assets/javascripts/app/components/primer/alpha/select_panel_element.d.ts +64 -0
- data/app/assets/javascripts/app/components/primer/aria_live.d.ts +8 -0
- data/app/assets/javascripts/app/components/primer/primer.d.ts +4 -0
- data/app/assets/javascripts/app/components/primer/shared_events.d.ts +9 -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.rb +5 -3
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +1 -0
- data/app/components/primer/alpha/action_list.rb +14 -2
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +0 -9
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +0 -11
- data/app/components/primer/alpha/action_menu.rb +17 -7
- data/app/components/primer/alpha/select_panel.html.erb +100 -0
- data/app/components/primer/alpha/select_panel.rb +473 -0
- data/app/components/primer/alpha/select_panel_element.d.ts +64 -0
- data/app/components/primer/alpha/select_panel_element.js +924 -0
- data/app/components/primer/alpha/select_panel_element.ts +1045 -0
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/aria_live.d.ts +8 -0
- data/app/components/primer/aria_live.js +38 -0
- data/app/components/primer/aria_live.ts +41 -0
- data/app/components/primer/base_component.rb +1 -1
- data/app/components/primer/focus_group.js +1 -1
- data/app/components/primer/focus_group.ts +1 -1
- data/app/components/primer/primer.d.ts +4 -0
- data/app/components/primer/primer.js +4 -0
- data/app/components/primer/primer.ts +4 -0
- data/app/components/primer/shared_events.d.ts +9 -0
- data/app/components/primer/shared_events.js +1 -0
- data/app/components/primer/shared_events.ts +10 -0
- data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -1
- data/lib/primer/classify/utilities.rb +13 -13
- data/lib/primer/forms/toggle_switch.html.erb +1 -2
- data/lib/primer/static/generate_info_arch.rb +3 -2
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/yard/component_manifest.rb +2 -0
- data/previews/primer/alpha/action_list_preview.rb +19 -0
- data/previews/primer/alpha/action_menu_preview.rb +1 -1
- data/previews/primer/alpha/select_panel_preview/_interaction_subject_js.html.erb +25 -0
- data/previews/primer/alpha/select_panel_preview/eventually_local_fetch.html.erb +16 -0
- data/previews/primer/alpha/select_panel_preview/eventually_local_fetch_initial_failure.html.erb +12 -0
- data/previews/primer/alpha/select_panel_preview/eventually_local_fetch_no_results.html.erb +16 -0
- data/previews/primer/alpha/select_panel_preview/footer_buttons.html.erb +23 -0
- data/previews/primer/alpha/select_panel_preview/local_fetch.html.erb +19 -0
- data/previews/primer/alpha/select_panel_preview/local_fetch_no_results.html.erb +15 -0
- data/previews/primer/alpha/select_panel_preview/multiselect.html.erb +17 -0
- data/previews/primer/alpha/select_panel_preview/multiselect_form.html.erb +31 -0
- data/previews/primer/alpha/select_panel_preview/playground.html.erb +19 -0
- data/previews/primer/alpha/select_panel_preview/remote_fetch.html.erb +16 -0
- data/previews/primer/alpha/select_panel_preview/remote_fetch_filter_failure.html.erb +13 -0
- data/previews/primer/alpha/select_panel_preview/remote_fetch_initial_failure.html.erb +12 -0
- data/previews/primer/alpha/select_panel_preview/remote_fetch_no_results.html.erb +16 -0
- data/previews/primer/alpha/select_panel_preview/single_select.html.erb +20 -0
- data/previews/primer/alpha/select_panel_preview/single_select_form.html.erb +33 -0
- data/previews/primer/alpha/select_panel_preview/with_avatar_items.html.erb +19 -0
- data/previews/primer/alpha/select_panel_preview/with_dynamic_label.html.erb +23 -0
- data/previews/primer/alpha/select_panel_preview/with_dynamic_label_and_aria_prefix.html.erb +24 -0
- data/previews/primer/alpha/select_panel_preview/with_leading_icons.html.erb +31 -0
- data/previews/primer/alpha/select_panel_preview/with_subtitle.html.erb +25 -0
- data/previews/primer/alpha/select_panel_preview/with_trailing_icons.html.erb +19 -0
- data/previews/primer/alpha/select_panel_preview.rb +239 -0
- data/static/arguments.json +136 -0
- data/static/audited_at.json +1 -0
- data/static/constants.json +22 -0
- data/static/info_arch.json +936 -117
- data/static/previews.json +307 -0
- data/static/statuses.json +1 -0
- metadata +39 -2
@@ -0,0 +1,16 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path,
|
6
|
+
select_variant: :multiple,
|
7
|
+
fetch_strategy: :eventually_local,
|
8
|
+
open_on_load: open_on_load
|
9
|
+
)) do |panel| %>
|
10
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
11
|
+
<% panel.with_footer(show_divider: true) do %>
|
12
|
+
I'm a footer!
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
data/previews/primer/alpha/select_panel_preview/eventually_local_fetch_initial_failure.html.erb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path(fail: "true"),
|
6
|
+
fetch_strategy: :eventually_local,
|
7
|
+
open_on_load: open_on_load
|
8
|
+
)) do |panel| %>
|
9
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path(show_results: "false"),
|
6
|
+
select_variant: :multiple,
|
7
|
+
fetch_strategy: :eventually_local,
|
8
|
+
open_on_load: open_on_load
|
9
|
+
)) do |panel| %>
|
10
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
11
|
+
<% panel.with_footer(show_divider: true) do %>
|
12
|
+
I'm a footer!
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
select_variant: :multiple,
|
6
|
+
fetch_strategy: :local,
|
7
|
+
dynamic_label: true,
|
8
|
+
dynamic_label_prefix: "Item",
|
9
|
+
dynamic_aria_label_prefix: "Selected item",
|
10
|
+
open_on_load: open_on_load
|
11
|
+
)) do |panel| %>
|
12
|
+
<% panel.with_show_button { "Choose item" } %>
|
13
|
+
<% panel.with_item(label: "Item 1") %>
|
14
|
+
<% panel.with_item(label: "Item 2") %>
|
15
|
+
<% panel.with_item(label: "Item 3") %>
|
16
|
+
<% panel.with_item(label: "Item 4") %>
|
17
|
+
<% panel.with_footer(show_divider: true) do %>
|
18
|
+
<%= render(Primer::Beta::Button.new(scheme: :default)) { "Cancel" } %>
|
19
|
+
<%= render(Primer::Beta::Button.new(scheme: :primary)) { "Save" } %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= 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: :multiple,
|
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: "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 } %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
select_variant: :multiple,
|
6
|
+
fetch_strategy: :local,
|
7
|
+
open_on_load: open_on_load
|
8
|
+
)) do |panel| %>
|
9
|
+
<% panel.with_show_button { "Panel" } %>
|
10
|
+
<% panel.with_footer(show_divider: true) do %>
|
11
|
+
I'm a footer!
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
select_variant: :multiple,
|
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", 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) %>
|
14
|
+
<% panel.with_item(label: "Disabled", disabled: true, item_id: :disabled) %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= form_with(url: generic_form_submission_path(format: route_format)) do |builder| %>
|
4
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
5
|
+
data: { interaction_subject: subject_id },
|
6
|
+
select_variant: :multiple,
|
7
|
+
fetch_strategy: :local,
|
8
|
+
open_on_load: open_on_load,
|
9
|
+
form_arguments: {
|
10
|
+
name: :item,
|
11
|
+
builder: builder
|
12
|
+
}
|
13
|
+
)) do |panel| %>
|
14
|
+
<% panel.with_show_button { "Panel" } %>
|
15
|
+
<% panel.with_item(label: "Item 1", content_arguments: { data: { value: "item1" } }, active: true) %>
|
16
|
+
<% panel.with_item(label: "Item 2", content_arguments: { data: { value: "item2" } }) %>
|
17
|
+
<% panel.with_item(label: "Item 3", content_arguments: { data: { value: "item3" } }) %>
|
18
|
+
<% panel.with_item(label: "Item 4", content_arguments: { data: { value: "item4" } }) %>
|
19
|
+
<% panel.with_footer(show_divider: true) do %>
|
20
|
+
I'm a footer!
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<hr>
|
25
|
+
|
26
|
+
<%= render(Primer::Beta::Button.new(type: :submit, scheme: :primary)) do %>
|
27
|
+
Submit
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= 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
|
+
<% title = system_arguments.delete(:title) %>
|
3
|
+
<% simulate_no_results = system_arguments.delete(:simulate_no_results) %>
|
4
|
+
<% simulate_failure = system_arguments.delete(:simulate_failure) %>
|
5
|
+
|
6
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
7
|
+
data: { interaction_subject: subject_id },
|
8
|
+
src: select_panel_items_path(show_results: !simulate_no_results, fail: simulate_failure),
|
9
|
+
select_variant: :single,
|
10
|
+
fetch_strategy: :remote,
|
11
|
+
**system_arguments
|
12
|
+
)) do |panel| %>
|
13
|
+
<% panel.with_show_button { title } %>
|
14
|
+
<% if subtitle %>
|
15
|
+
<% panel.with_subtitle { subtitle } %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path,
|
6
|
+
select_variant: :multiple,
|
7
|
+
fetch_strategy: :remote,
|
8
|
+
open_on_load: open_on_load
|
9
|
+
)) do |panel| %>
|
10
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
11
|
+
<% panel.with_footer(show_divider: true) do %>
|
12
|
+
I'm a footer!
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
# passing a uuid here causes the request to succeed the first time and fail all subsequent times
|
6
|
+
src: select_panel_items_path(fail: "true", uuid: SecureRandom.uuid),
|
7
|
+
fetch_strategy: :remote,
|
8
|
+
open_on_load: open_on_load
|
9
|
+
)) do |panel| %>
|
10
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path(fail: "true"),
|
6
|
+
fetch_strategy: :remote,
|
7
|
+
open_on_load: open_on_load
|
8
|
+
)) do |panel| %>
|
9
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
src: select_panel_items_path(show_results: "false"),
|
6
|
+
select_variant: :multiple,
|
7
|
+
fetch_strategy: :remote,
|
8
|
+
open_on_load: open_on_load
|
9
|
+
)) do |panel| %>
|
10
|
+
<% panel.with_show_button { "Sci-fi equipment" } %>
|
11
|
+
<% panel.with_footer(show_divider: true) do %>
|
12
|
+
I'm a footer!
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,20 @@
|
|
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", 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) %>
|
14
|
+
<% panel.with_item(label: "Disabled", disabled: true, item_id: :disabled) %>
|
15
|
+
<% panel.with_footer(show_divider: true) do %>
|
16
|
+
I'm a footer!
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= form_with(url: generic_form_submission_path(format: route_format)) do |builder| %>
|
4
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
5
|
+
data: { interaction_subject: subject_id },
|
6
|
+
select_variant: :single,
|
7
|
+
fetch_strategy: :local,
|
8
|
+
open_on_load: open_on_load,
|
9
|
+
dynamic_label: true,
|
10
|
+
dynamic_label_prefix: "Item",
|
11
|
+
form_arguments: {
|
12
|
+
name: :item,
|
13
|
+
builder: builder
|
14
|
+
}
|
15
|
+
)) do |panel| %>
|
16
|
+
<% panel.with_show_button { "Panel" } %>
|
17
|
+
<% panel.with_item(label: "Item 1", content_arguments: { data: { value: "item1" } }, active: true) %>
|
18
|
+
<% panel.with_item(label: "Item 2", content_arguments: { data: { value: "item2" } }) %>
|
19
|
+
<% panel.with_item(label: "Item 3", content_arguments: { data: { value: "item3" } }) %>
|
20
|
+
<% panel.with_item(label: "Item 4", content_arguments: { data: { value: "item4" } }) %>
|
21
|
+
<% panel.with_footer(show_divider: true) do %>
|
22
|
+
I'm a footer!
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<hr>
|
27
|
+
|
28
|
+
<%= render(Primer::Beta::Button.new(type: :submit, scheme: :primary)) do %>
|
29
|
+
Submit
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<%= 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
|
+
id: "with_avatar_items",
|
6
|
+
title: "Select users",
|
7
|
+
select_variant: :multiple,
|
8
|
+
fetch_strategy: :local,
|
9
|
+
open_on_load: open_on_load
|
10
|
+
)) do |panel| %>
|
11
|
+
<% panel.with_show_button { "Choose users" } %>
|
12
|
+
|
13
|
+
<% panel.with_avatar_item(
|
14
|
+
username: "hulk_smash",
|
15
|
+
src: "https://avatars.githubusercontent.com/u/103004183?v=4",
|
16
|
+
) %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
id: "with_avatar_items",
|
6
|
+
title: "Select users",
|
7
|
+
select_variant: :single,
|
8
|
+
fetch_strategy: :local,
|
9
|
+
dynamic_label: true,
|
10
|
+
dynamic_label_prefix: "Item",
|
11
|
+
open_on_load: open_on_load
|
12
|
+
)) do |panel| %>
|
13
|
+
<% panel.with_show_button { "Choose item" } %>
|
14
|
+
|
15
|
+
<% panel.with_item(label: "Item 1") %>
|
16
|
+
<% panel.with_item(label: "Item 2") %>
|
17
|
+
<% panel.with_item(label: "Item 3") %>
|
18
|
+
<% panel.with_item(label: "Item 4") %>
|
19
|
+
<% panel.with_item(label: "Item 5") %>
|
20
|
+
<% panel.with_item(label: "Item 6") %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% subject_id = SecureRandom.hex %>
|
2
|
+
|
3
|
+
<%= render(Primer::Alpha::SelectPanel.new(
|
4
|
+
data: { interaction_subject: subject_id },
|
5
|
+
id: "with_avatar_items",
|
6
|
+
title: "Select users",
|
7
|
+
select_variant: :single,
|
8
|
+
fetch_strategy: :local,
|
9
|
+
dynamic_label: true,
|
10
|
+
dynamic_label_prefix: "Item",
|
11
|
+
dynamic_aria_label_prefix: "Your item",
|
12
|
+
open_on_load: open_on_load
|
13
|
+
)) do |panel| %>
|
14
|
+
<% panel.with_show_button { "Choose item" } %>
|
15
|
+
|
16
|
+
<% panel.with_item(label: "Item 1") %>
|
17
|
+
<% panel.with_item(label: "Item 2") %>
|
18
|
+
<% panel.with_item(label: "Item 3") %>
|
19
|
+
<% panel.with_item(label: "Item 4") %>
|
20
|
+
<% panel.with_item(label: "Item 5") %>
|
21
|
+
<% panel.with_item(label: "Item 6") %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,31 @@
|
|
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
|
+
dynamic_label: true,
|
8
|
+
dynamic_label_prefix: "Item",
|
9
|
+
dynamic_aria_label_prefix: "Selected item",
|
10
|
+
open_on_load: open_on_load
|
11
|
+
)) do |panel| %>
|
12
|
+
<% panel.with_show_button { "Choose item" } %>
|
13
|
+
|
14
|
+
<% panel.with_item(label: "Leading SVG visual") do |item| %>
|
15
|
+
<% item.with_leading_visual_svg do %>
|
16
|
+
<path d="M8 16a2 2 0 001.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 008 16z"></path><path fill-rule="evenodd" d="M8 1.5A3.5 3.5 0 004.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.018.018 0 00-.003.01l.001.006c0 .002.002.004.004.006a.017.017 0 00.006.004l.007.001h10.964l.007-.001a.016.016 0 00.006-.004.016.016 0 00.004-.006l.001-.007a.017.017 0 00-.003-.01l-1.703-2.554a1.75 1.75 0 01-.294-.97V5A3.5 3.5 0 008 1.5zM3 5a5 5 0 0110 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.518 1.518 0 0113.482 13H2.518a1.518 1.518 0 01-1.263-2.36l1.703-2.554A.25.25 0 003 7.947V5z"></path>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% panel.with_item(label: "Custom content") do |item| %>
|
21
|
+
<% item.with_leading_visual_content do %>
|
22
|
+
<span style="width: 16px; height: 16px; display: block; text-align: center; line-height: 16px">A</span>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% panel.with_item(label: "Visual icons") do |item| %>
|
27
|
+
<% item.with_leading_visual_icon(icon: :star) %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|
@@ -0,0 +1,25 @@
|
|
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
|
+
dynamic_label: true,
|
8
|
+
dynamic_label_prefix: "Item",
|
9
|
+
dynamic_aria_label_prefix: "Selected item",
|
10
|
+
open_on_load: open_on_load
|
11
|
+
)) do |panel| %>
|
12
|
+
<% panel.with_show_button { "Choose item" } %>
|
13
|
+
<% panel.with_subtitle do %>
|
14
|
+
Choose the item you want to select
|
15
|
+
<% end %>
|
16
|
+
<% panel.with_item(label: "Item 1") %>
|
17
|
+
<% panel.with_item(label: "Item 2") %>
|
18
|
+
<% panel.with_item(label: "Item 3") %>
|
19
|
+
<% panel.with_item(label: "Item 4") %>
|
20
|
+
<% panel.with_footer(show_divider: true) do %>
|
21
|
+
I'm a footer!
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= 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
|
+
dynamic_label: true,
|
8
|
+
dynamic_label_prefix: "Item",
|
9
|
+
dynamic_aria_label_prefix: "Selected item",
|
10
|
+
open_on_load: open_on_load
|
11
|
+
)) do |panel| %>
|
12
|
+
<% panel.with_show_button { "Choose item" } %>
|
13
|
+
|
14
|
+
<% panel.with_item(label: "Visual icons") do |item| %>
|
15
|
+
<% item.with_trailing_visual_icon(icon: :star) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render partial: "primer/alpha/select_panel_preview/interaction_subject_js", locals: { subject_id: subject_id } %>
|