playbook_ui 13.26.0.pre.alpha.PBNTR291Dropdownrailsv22840 → 13.26.0.pre.alpha.jasoncypretpatch12816
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +10 -14
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +5 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -6
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +1 -6
- data/app/pb_kits/playbook/pb_background/background.html.erb +2 -11
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +1 -6
- data/app/pb_kits/playbook/pb_body/body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +2 -7
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -0
- data/app/pb_kits/playbook/pb_button/button.html.erb +2 -3
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +2 -7
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +1 -6
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -7
- data/app/pb_kits/playbook/pb_card/card_body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_card/card_header.html.erb +1 -6
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -6
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -7
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +1 -6
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +1 -6
- data/app/pb_kits/playbook/pb_date/date.html.erb +1 -6
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -6
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +1 -5
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +1 -5
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +1 -5
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -6
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +1 -7
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +1 -5
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +2 -7
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +1 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +2 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +2 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +2 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -9
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +2 -4
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -6
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +1 -5
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +2 -6
- data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -6
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +1 -5
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +1 -5
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +2 -7
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +1 -6
- data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +1 -6
- data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +1 -6
- data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +1 -6
- data/app/pb_kits/playbook/pb_layout/body.html.erb +1 -5
- data/app/pb_kits/playbook/pb_layout/footer.html.erb +1 -5
- data/app/pb_kits/playbook/pb_layout/header.html.erb +1 -5
- data/app/pb_kits/playbook/pb_layout/item.html.erb +1 -5
- data/app/pb_kits/playbook/pb_layout/layout.html.erb +1 -5
- data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +1 -5
- data/app/pb_kits/playbook/pb_list/item.html.erb +2 -8
- data/app/pb_kits/playbook/pb_list/list.html.erb +2 -8
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -6
- data/app/pb_kits/playbook/pb_message/message.html.erb +1 -6
- data/app/pb_kits/playbook/pb_message/message_mention.html.erb +1 -6
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +1 -6
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +1 -6
- data/app/pb_kits/playbook/pb_nav/item.html.erb +3 -14
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +1 -6
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +2 -6
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +1 -6
- data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -1
- data/app/pb_kits/playbook/pb_person/person.html.erb +7 -12
- data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +1 -6
- data/app/pb_kits/playbook/pb_pill/pill.html.erb +1 -6
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -6
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +2 -6
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +3 -6
- data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +1 -5
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +1 -5
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +2 -8
- data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +1 -6
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +1 -6
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +1 -6
- data/app/pb_kits/playbook/pb_source/source.html.erb +1 -5
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +1 -5
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +1 -5
- data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +1 -5
- data/app/pb_kits/playbook/pb_table/table.html.erb +2 -12
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +6 -16
- data/app/pb_kits/playbook/pb_table/table_cell.html.erb +6 -16
- data/app/pb_kits/playbook/pb_table/table_head.html.erb +6 -16
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +4 -13
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +6 -16
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +1 -5
- data/app/pb_kits/playbook/pb_time/time.html.erb +1 -5
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +1 -5
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +1 -5
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +3 -7
- data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +1 -5
- data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +1 -6
- data/app/pb_kits/playbook/pb_title/title.html.erb +1 -6
- data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +1 -6
- data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +1 -5
- data/app/pb_kits/playbook/pb_toggle/toggle.html.erb +1 -6
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +1 -5
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +1 -6
- data/app/pb_kits/playbook/playbook-rails.js +0 -3
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/kit_base.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.html.erb +0 -17
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.html.erb +0 -60
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.html.erb +0 -45
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +0 -17
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.html.erb +0 -47
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -26
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -20
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +0 -21
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +0 -27
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +0 -22
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +0 -43
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +0 -30
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -153
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +0 -77
data/lib/playbook/kit_base.rb
CHANGED
@@ -81,7 +81,7 @@ module Playbook
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# rubocop:disable Style/OptionalBooleanParameter
|
84
|
-
def pb_content_tag(name, content_or_options_with_block =
|
84
|
+
def pb_content_tag(name = :div, content_or_options_with_block = {}, options = {}, escape = true, &block)
|
85
85
|
combined_options = options
|
86
86
|
.merge(combined_html_options)
|
87
87
|
.merge(default_options.merge(content_or_options_with_block))
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.26.0.pre.alpha.
|
4
|
+
version: 13.26.0.pre.alpha.jasoncypretpatch12816
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-05-
|
12
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1044,48 +1044,31 @@ files:
|
|
1044
1044
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.scss
|
1045
1045
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.tsx
|
1046
1046
|
- app/pb_kits/playbook/pb_dropdown/context/index.tsx
|
1047
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb
|
1048
1047
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx
|
1049
1048
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md
|
1050
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.html.erb
|
1051
1049
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx
|
1052
1050
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md
|
1053
1051
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx
|
1054
1052
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.md
|
1055
1053
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx
|
1056
1054
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.md
|
1057
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.html.erb
|
1058
1055
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx
|
1059
1056
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md
|
1060
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.html.erb
|
1061
1057
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
|
1062
1058
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md
|
1063
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb
|
1064
1059
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx
|
1065
1060
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md
|
1066
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.html.erb
|
1067
1061
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx
|
1068
1062
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md
|
1069
1063
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
|
1070
1064
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_hook.jsx
|
1071
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb
|
1072
1065
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx
|
1073
1066
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md
|
1074
1067
|
- app/pb_kits/playbook/pb_dropdown/docs/example.yml
|
1075
1068
|
- app/pb_kits/playbook/pb_dropdown/docs/index.js
|
1076
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown.html.erb
|
1077
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown.rb
|
1078
1069
|
- app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx
|
1079
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb
|
1080
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_container.rb
|
1081
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb
|
1082
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_option.rb
|
1083
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb
|
1084
|
-
- app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb
|
1085
1070
|
- app/pb_kits/playbook/pb_dropdown/hooks/useDropdown.tsx
|
1086
1071
|
- app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx
|
1087
|
-
- app/pb_kits/playbook/pb_dropdown/index.js
|
1088
|
-
- app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js
|
1089
1072
|
- app/pb_kits/playbook/pb_dropdown/scss_partials/_dropdown_animation.scss
|
1090
1073
|
- app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx
|
1091
1074
|
- app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
-
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
|
-
]
|
7
|
-
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
11
|
-
<%= pb_rails("dropdown/dropdown_trigger") %>
|
12
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
13
|
-
<% options.each do |option| %>
|
14
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
@@ -1,60 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{
|
4
|
-
label: "Jasper Furniss",
|
5
|
-
value: "Jasper Furniss",
|
6
|
-
territory: "PHL",
|
7
|
-
title: "Senior UX Engineer",
|
8
|
-
id: "jasper-furniss",
|
9
|
-
status: "Offline"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
label: "Ramon Ruiz",
|
13
|
-
value: "Ramon Ruiz",
|
14
|
-
territory: "PHL",
|
15
|
-
title: "Senior UX Designer",
|
16
|
-
id: "ramon-ruiz",
|
17
|
-
status: "Away"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
label: "Jason Cypret",
|
21
|
-
value: "Jason Cypret",
|
22
|
-
territory: "PHL",
|
23
|
-
title: "VP of User Experience",
|
24
|
-
id: "jason-cypret",
|
25
|
-
status: "Online"
|
26
|
-
},
|
27
|
-
{
|
28
|
-
label: "Courtney Long",
|
29
|
-
value: "Courtney Long",
|
30
|
-
territory: "PHL",
|
31
|
-
title: "UX Design Mentor",
|
32
|
-
id: "courtney-long",
|
33
|
-
status: "Online"
|
34
|
-
}
|
35
|
-
]
|
36
|
-
|
37
|
-
%>
|
38
|
-
|
39
|
-
<%
|
40
|
-
custom_display = capture do
|
41
|
-
pb_rails("avatar", props: { name: "Courtney Long", size: "xs" })
|
42
|
-
end
|
43
|
-
%>
|
44
|
-
|
45
|
-
|
46
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
47
|
-
<%= pb_rails("dropdown/dropdown_trigger", props: {placeholder: "Select a User", custom_display: custom_display}) %>
|
48
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
49
|
-
<% options.each do |option| %>
|
50
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
51
|
-
<%= pb_rails("flex/flex_item") do %>
|
52
|
-
<%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
|
53
|
-
<% end %>
|
54
|
-
<%= pb_rails("flex/flex_item") do %>
|
55
|
-
<%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
|
56
|
-
<% end %>
|
57
|
-
<% end %>
|
58
|
-
<% end %>
|
59
|
-
<% end %>
|
60
|
-
<% end %>
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{
|
4
|
-
label: "United States",
|
5
|
-
value: "United States",
|
6
|
-
areaCode: "+1",
|
7
|
-
icon: "🇺🇸",
|
8
|
-
id: "us"
|
9
|
-
},
|
10
|
-
{
|
11
|
-
label: "Canada",
|
12
|
-
value: "Canada",
|
13
|
-
areaCode: "+1",
|
14
|
-
icon: "🇨🇦",
|
15
|
-
id: "ca"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
label: "Pakistan",
|
19
|
-
value: "Pakistan",
|
20
|
-
areaCode: "+92",
|
21
|
-
icon: "🇵🇰",
|
22
|
-
id: "pk"
|
23
|
-
}
|
24
|
-
]
|
25
|
-
|
26
|
-
%>
|
27
|
-
|
28
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
29
|
-
<%= pb_rails("dropdown/dropdown_trigger") %>
|
30
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
31
|
-
<% options.each do |option| %>
|
32
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
33
|
-
<%= pb_rails("flex/flex_item") do %>
|
34
|
-
<%= pb_rails("flex") do %>
|
35
|
-
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
36
|
-
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
37
|
-
<% end %>
|
38
|
-
<% end %>
|
39
|
-
<%= pb_rails("flex/flex_item") do %>
|
40
|
-
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
41
|
-
<% end %>
|
42
|
-
<% end %>
|
43
|
-
<% end %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
-
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
|
-
]
|
7
|
-
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
11
|
-
<%= pb_rails("dropdown/dropdown_trigger") %>
|
12
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
13
|
-
<% options.each do |option| %>
|
14
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option, padding:"sm"}) %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{
|
4
|
-
label: "United States",
|
5
|
-
value: "United States",
|
6
|
-
areaCode: "+1",
|
7
|
-
icon: "🇺🇸",
|
8
|
-
id: "us"
|
9
|
-
},
|
10
|
-
{
|
11
|
-
label: "Canada",
|
12
|
-
value: "Canada",
|
13
|
-
areaCode: "+1",
|
14
|
-
icon: "🇨🇦",
|
15
|
-
id: "ca"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
label: "Pakistan",
|
19
|
-
value: "Pakistan",
|
20
|
-
areaCode: "+92",
|
21
|
-
icon: "🇵🇰",
|
22
|
-
id: "pk"
|
23
|
-
}
|
24
|
-
]
|
25
|
-
|
26
|
-
%>
|
27
|
-
|
28
|
-
<%= pb_rails("dropdown", props: {options: options}) do %>
|
29
|
-
<%= pb_rails("dropdown/dropdown_trigger") do %>
|
30
|
-
<%= pb_rails("icon_circle", props: {icon:"flag", cursor: "pointer", variant:"royal"}) %>
|
31
|
-
<% end %>
|
32
|
-
<%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs"}) do %>
|
33
|
-
<% options.each do |option| %>
|
34
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
35
|
-
<%= pb_rails("flex/flex_item") do %>
|
36
|
-
<%= pb_rails("flex") do %>
|
37
|
-
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
38
|
-
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
39
|
-
<% end %>
|
40
|
-
<% end %>
|
41
|
-
<%= pb_rails("flex/flex_item") do %>
|
42
|
-
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
43
|
-
<% end %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
<% end %>
|
47
|
-
<% end %>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
-
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
|
-
]
|
7
|
-
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%= pb_rails("dropdown", props: {options: options, label: "Select a Country"}) %>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
7
|
-
<% if object.label.present? %>
|
8
|
-
<%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
|
9
|
-
<% end %>
|
10
|
-
<div class="dropdown_wrapper" style="position: relative">
|
11
|
-
<input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value=""/>
|
12
|
-
<% if content.present? %>
|
13
|
-
<%= content.presence %>
|
14
|
-
<% else %>
|
15
|
-
<%= pb_rails("dropdown/dropdown_trigger") %>
|
16
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
17
|
-
<% if object.options.present? %>
|
18
|
-
<% object.options.each do |option| %>
|
19
|
-
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) %>
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
</div>
|
25
|
-
<% end %>
|
26
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDropdown
|
5
|
-
class Dropdown < Playbook::KitBase
|
6
|
-
prop :options, type: Playbook::Props::Array,
|
7
|
-
default: []
|
8
|
-
prop :label, type: Playbook::Props::String
|
9
|
-
prop :name, type: Playbook::Props::String
|
10
|
-
|
11
|
-
def data
|
12
|
-
Hash(prop(:data)).merge(pb_dropdown: true)
|
13
|
-
end
|
14
|
-
|
15
|
-
def classname
|
16
|
-
generate_classname("pb_dropdown")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
style: object.container_style,
|
7
|
-
**combined_html_options) do %>
|
8
|
-
<%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
|
9
|
-
<% if content.present? %>
|
10
|
-
<%= content.presence %>
|
11
|
-
<% else %>
|
12
|
-
<%= pb_rails("list/item", props: {
|
13
|
-
display: "flex",
|
14
|
-
justify_content: "center",
|
15
|
-
padding:"xs",
|
16
|
-
}) do %>
|
17
|
-
<%= pb_rails("body", props: {text: "No option"}) %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDropdown
|
5
|
-
class DropdownContainer < Playbook::KitBase
|
6
|
-
def classname
|
7
|
-
generate_classname("pb_dropdown_container", "close", separator: " ")
|
8
|
-
end
|
9
|
-
|
10
|
-
def container_style
|
11
|
-
"position: absolute"
|
12
|
-
end
|
13
|
-
|
14
|
-
def data
|
15
|
-
Hash(prop(:data)).merge(dropdown_container: true)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.option[:id],
|
6
|
-
**combined_html_options) do %>
|
7
|
-
<%= pb_rails("list/item", props: {
|
8
|
-
display: "flex",
|
9
|
-
justify_content: "center",
|
10
|
-
padding:"none",
|
11
|
-
cursor: "pointer"
|
12
|
-
}) do %>
|
13
|
-
<%= pb_rails("flex", props: {
|
14
|
-
align: "center",
|
15
|
-
classname:"dropdown_option_wrapper",
|
16
|
-
justify: "between",
|
17
|
-
padding_x:"sm",
|
18
|
-
padding_y:"xxs",
|
19
|
-
}) do %>
|
20
|
-
<% if content.present? %>
|
21
|
-
<%= content.presence %>
|
22
|
-
<% else %>
|
23
|
-
<%= pb_rails("body", props: {text: object.option[:label]}) %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
26
|
-
<% end %>
|
27
|
-
<% end %>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDropdown
|
5
|
-
class DropdownOption < Playbook::KitBase
|
6
|
-
prop :option, type: Playbook::Props::String
|
7
|
-
prop :id, type: Playbook::Props::String
|
8
|
-
|
9
|
-
def data
|
10
|
-
Hash(prop(:data)).merge("dropdown_option_label": option)
|
11
|
-
end
|
12
|
-
|
13
|
-
def padding_helper
|
14
|
-
" p_xs"
|
15
|
-
end
|
16
|
-
|
17
|
-
def classname
|
18
|
-
generate_classname("pb_dropdown_option", "list") + padding_helper
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<%= content_tag(:div,
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
7
|
-
<% if content.present? %>
|
8
|
-
<div style="display: inline-block" tabindex="0" data-dropdown-custom-trigger>
|
9
|
-
<%= content.presence %>
|
10
|
-
</div>
|
11
|
-
<% else %>
|
12
|
-
<%= pb_rails("flex", props: {
|
13
|
-
align: "center",
|
14
|
-
border_radius:"lg",
|
15
|
-
classname: object.trigger_wrapper_classes,
|
16
|
-
cursor: "pointer",
|
17
|
-
justify: "between",
|
18
|
-
padding_x:"sm",
|
19
|
-
padding_y:"xs",
|
20
|
-
html_options: {tabindex:"0"}
|
21
|
-
}) do %>
|
22
|
-
<%= pb_rails("flex/flex_item") do %>
|
23
|
-
<%= pb_rails("flex", props: {align: "center"}) do %>
|
24
|
-
<% if object.custom_display.present? %>
|
25
|
-
<%= pb_rails("flex", props: {align: "center"}) do %>
|
26
|
-
<div id="dropdown_trigger_custom_display" style="display: none;">
|
27
|
-
<%= object.custom_display %>
|
28
|
-
</div>
|
29
|
-
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
30
|
-
<% end %>
|
31
|
-
<% else %>
|
32
|
-
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<% end %>
|
36
|
-
<%= pb_rails("body", props: {display: "flex"}) do %>
|
37
|
-
<%= pb_rails("icon", props: {icon: "chevron-down", cursor: "pointer", size:"sm", id: "dropdown_open_icon"}) %>
|
38
|
-
<%= pb_rails("icon", props: {icon: "chevron-up", cursor: "pointer", size:"sm", id: "dropdown_close_icon"}) %>
|
39
|
-
<% end %>
|
40
|
-
<% end %>
|
41
|
-
<% end %>
|
42
|
-
<% end %>
|
43
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbDropdown
|
5
|
-
class DropdownTrigger < Playbook::KitBase
|
6
|
-
prop :options, type: Playbook::Props::Array,
|
7
|
-
default: []
|
8
|
-
prop :id, type: Playbook::Props::String,
|
9
|
-
default: ""
|
10
|
-
prop :placeholder, type: Playbook::Props::String
|
11
|
-
prop :custom_display
|
12
|
-
|
13
|
-
def data
|
14
|
-
Hash(prop(:data)).merge(dropdown_trigger: true)
|
15
|
-
end
|
16
|
-
|
17
|
-
def classname
|
18
|
-
generate_classname("pb_dropdown_trigger")
|
19
|
-
end
|
20
|
-
|
21
|
-
def default_display_placeholder
|
22
|
-
placeholder || "Select..."
|
23
|
-
end
|
24
|
-
|
25
|
-
def trigger_wrapper_classes
|
26
|
-
generate_classname("dropdown_trigger_wrapper", "select_only")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
-
import { PbDropdownKeyboard } from "./keyboard_accessibility";
|
3
|
-
|
4
|
-
const DROPDOWN_SELECTOR = "[data-pb-dropdown]";
|
5
|
-
const TRIGGER_SELECTOR = "[data-dropdown-trigger]";
|
6
|
-
const CONTAINER_SELECTOR = "[data-dropdown-container]";
|
7
|
-
const DOWN_ARROW_SELECTOR = "#dropdown_open_icon";
|
8
|
-
const UP_ARROW_SELECTOR = "#dropdown_close_icon";
|
9
|
-
const OPTION_SELECTOR = "[data-dropdown-option-label]";
|
10
|
-
const CUSTOM_DISPLAY_SELECTOR = "[data-dropdown-custom-trigger]";
|
11
|
-
|
12
|
-
export default class PbDropdown extends PbEnhancedElement {
|
13
|
-
static get selector() {
|
14
|
-
return DROPDOWN_SELECTOR;
|
15
|
-
}
|
16
|
-
|
17
|
-
connect() {
|
18
|
-
this.keyboardHandler = new PbDropdownKeyboard(this);
|
19
|
-
this.bindEventListeners();
|
20
|
-
this.updateArrowDisplay(false);
|
21
|
-
}
|
22
|
-
|
23
|
-
bindEventListeners() {
|
24
|
-
const customTrigger =
|
25
|
-
this.element.querySelector(CUSTOM_DISPLAY_SELECTOR) || this.element;
|
26
|
-
customTrigger.addEventListener("click", () =>
|
27
|
-
this.toggleElement(this.target)
|
28
|
-
);
|
29
|
-
|
30
|
-
this.target.addEventListener("click", this.handleOptionClick.bind(this));
|
31
|
-
document.addEventListener(
|
32
|
-
"click",
|
33
|
-
this.handleDocumentClick.bind(this),
|
34
|
-
true
|
35
|
-
);
|
36
|
-
}
|
37
|
-
|
38
|
-
handleOptionClick(event) {
|
39
|
-
const option = event.target.closest(OPTION_SELECTOR);
|
40
|
-
const hiddenInput = this.element.querySelector("#dropdown-selected-option");
|
41
|
-
if (option) {
|
42
|
-
const value = option.dataset.dropdownOptionLabel;
|
43
|
-
hiddenInput.value = JSON.parse(value).id;
|
44
|
-
this.onOptionSelected(value, option);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
handleDocumentClick(event) {
|
49
|
-
if (this.isClickOutside(event) && this.target.classList.contains("open")) {
|
50
|
-
this.hideElement(this.target);
|
51
|
-
this.updateArrowDisplay(false);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
isClickOutside(event) {
|
56
|
-
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
57
|
-
if (customTrigger) {
|
58
|
-
return !customTrigger.contains(event.target);
|
59
|
-
} else {
|
60
|
-
const triggerElement = this.element.querySelector(TRIGGER_SELECTOR);
|
61
|
-
const containerElement =
|
62
|
-
this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
63
|
-
|
64
|
-
const isOutsideTrigger = triggerElement
|
65
|
-
? !triggerElement.contains(event.target)
|
66
|
-
: true;
|
67
|
-
const isOutsideContainer = containerElement
|
68
|
-
? !containerElement.contains(event.target)
|
69
|
-
: true;
|
70
|
-
|
71
|
-
return isOutsideTrigger && isOutsideContainer;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
onOptionSelected(value, selectedOption) {
|
76
|
-
const triggerElement = this.element.querySelector(
|
77
|
-
"#dropdown_trigger_display"
|
78
|
-
);
|
79
|
-
const customDisplayElement = this.element.querySelector(
|
80
|
-
"#dropdown_trigger_custom_display"
|
81
|
-
);
|
82
|
-
if (triggerElement) {
|
83
|
-
const selectedLabel = JSON.parse(value).label;
|
84
|
-
triggerElement.textContent = selectedLabel;
|
85
|
-
if (customDisplayElement) {
|
86
|
-
customDisplayElement.style.display = "block";
|
87
|
-
customDisplayElement.style.paddingRight = "8px";
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
92
|
-
if (customTrigger) {
|
93
|
-
if (this.target.classList.contains("open")) {
|
94
|
-
this.hideElement(this.target);
|
95
|
-
this.updateArrowDisplay(false);
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
100
|
-
options.forEach((option) => {
|
101
|
-
option.classList.remove("pb_dropdown_option_selected");
|
102
|
-
});
|
103
|
-
selectedOption.classList.add("pb_dropdown_option_selected");
|
104
|
-
}
|
105
|
-
|
106
|
-
get target() {
|
107
|
-
return this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
108
|
-
}
|
109
|
-
|
110
|
-
showElement(elem) {
|
111
|
-
elem.classList.remove("close");
|
112
|
-
elem.classList.add("open");
|
113
|
-
elem.style.height = elem.scrollHeight + "px";
|
114
|
-
}
|
115
|
-
|
116
|
-
hideElement(elem) {
|
117
|
-
elem.style.height = elem.scrollHeight + "px";
|
118
|
-
window.setTimeout(() => {
|
119
|
-
elem.classList.add("close");
|
120
|
-
elem.classList.remove("open");
|
121
|
-
this.resetFocus();
|
122
|
-
}, 0);
|
123
|
-
}
|
124
|
-
|
125
|
-
resetFocus() {
|
126
|
-
if (this.keyboardHandler) {
|
127
|
-
this.keyboardHandler.focusedOptionIndex = -1;
|
128
|
-
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
129
|
-
options.forEach((option) =>
|
130
|
-
option.classList.remove("pb_dropdown_option_focused")
|
131
|
-
);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
toggleElement(elem) {
|
136
|
-
if (elem.classList.contains("open")) {
|
137
|
-
this.hideElement(elem);
|
138
|
-
this.updateArrowDisplay(false);
|
139
|
-
return;
|
140
|
-
}
|
141
|
-
this.showElement(elem);
|
142
|
-
this.updateArrowDisplay(true);
|
143
|
-
}
|
144
|
-
|
145
|
-
updateArrowDisplay(isOpen) {
|
146
|
-
const downArrow = this.element.querySelector(DOWN_ARROW_SELECTOR);
|
147
|
-
const upArrow = this.element.querySelector(UP_ARROW_SELECTOR);
|
148
|
-
if (downArrow && upArrow) {
|
149
|
-
downArrow.style.display = isOpen ? "none" : "inline-block";
|
150
|
-
upArrow.style.display = isOpen ? "inline-block" : "none";
|
151
|
-
}
|
152
|
-
}
|
153
|
-
}
|