playbook_ui 13.27.0.pre.alpha.PLAY888Cardkithighlightoverflowtooltiperror2930 → 13.27.0.pre.alpha.PLAY1122fixMultipleUserspaddingoverflow2844
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 +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +5 -1
- data/app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx +0 -16
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -16
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +0 -4
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +0 -47
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +66 -46
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +29 -8
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +33 -13
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +67 -48
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +20 -0
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +6 -1
- data/app/pb_kits/playbook/pb_body/_body.scss +0 -3
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +3 -4
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +6 -1
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_card/_card.scss +1 -1
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -5
- data/app/pb_kits/playbook/pb_card/card.rb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +0 -20
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -41
- data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +10 -21
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +75 -3
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_collapsible/index.js +6 -16
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_detail/_detail_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +6 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure_rails.html.erb → _dropdown_subcomponent_structure.html.erb} +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +6 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_display_rails.html.erb → _dropdown_with_custom_display.html.erb} +6 -11
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +3 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_options_rails.html.erb → _dropdown_with_custom_options.html.erb} +11 -16
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +2 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_trigger_rails.html.erb → _dropdown_with_custom_trigger.html.erb} +11 -16
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +2 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +9 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +6 -2
- data/app/pb_kits/playbook/pb_dropdown/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +14 -6
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +6 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +0 -15
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -6
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +6 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +1 -1
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +6 -1
- data/app/pb_kits/playbook/pb_person/person.html.erb +6 -1
- data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_pill/pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +6 -1
- data/app/pb_kits/playbook/pb_select/_select.scss +0 -8
- data/app/pb_kits/playbook/pb_source/source.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +5 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -19
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title/_title.scss +1 -5
- data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +5 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +0 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/tokens/_titles.scss +1 -5
- data/dist/menu.yml +2 -2
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/forms/builder.rb +0 -1
- data/lib/playbook/kit_base.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -44
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.md +0 -3
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.md +0 -3
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +0 -92
- data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.html.erb +0 -15
- data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.rb +0 -37
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +0 -72
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.md +0 -3
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.md +0 -3
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +0 -73
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.md +0 -3
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +0 -20
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.md +0 -3
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +0 -61
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +0 -11
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold_swift.md +0 -32
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +0 -17
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +0 -19
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +0 -10
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +0 -17
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +0 -39
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +0 -39
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +0 -15
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +0 -78
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default_swift.md +0 -20
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_props_swift.md +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.md +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.md +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +0 -23
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +0 -7
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +0 -9
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +0 -22
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +0 -9
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +0 -62
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +0 -8
- data/lib/playbook/forms/builder/phone_number_field.rb +0 -12
@@ -63,10 +63,6 @@
|
|
63
63
|
width: 100%;
|
64
64
|
|
65
65
|
[class*="pb_dropdown_option"] {
|
66
|
-
padding-left: $space_sm;
|
67
|
-
padding-right: $space_sm;
|
68
|
-
padding-top: $space_xs;
|
69
|
-
padding-bottom: $space_xs;
|
70
66
|
cursor: pointer;
|
71
67
|
&:hover {
|
72
68
|
background-color: $border_light;
|
@@ -81,9 +77,8 @@
|
|
81
77
|
}
|
82
78
|
&[class*="selected"] {
|
83
79
|
background-color: $primary;
|
84
|
-
color: $white;
|
85
80
|
[class^="pb_body"],
|
86
|
-
[class^="pb_title_kit"]
|
81
|
+
[class^="pb_title_kit"] {
|
87
82
|
color: $white !important;
|
88
83
|
}
|
89
84
|
&:hover {
|
@@ -4,6 +4,7 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../uti
|
|
4
4
|
import { globalProps } from "../utilities/globalProps";
|
5
5
|
import { GenericObject } from "../types";
|
6
6
|
|
7
|
+
import Body from "../pb_body/_body";
|
7
8
|
import Caption from "../pb_caption/_caption";
|
8
9
|
|
9
10
|
import DropdownContainer from "./subcomponents/DropdownContainer";
|
@@ -113,10 +114,8 @@ const Dropdown = (props: DropdownProps) => {
|
|
113
114
|
setIsDropDownClosed(isClosed)
|
114
115
|
},[isClosed])
|
115
116
|
|
116
|
-
const filteredOptions = options?.filter((option: GenericObject) =>
|
117
|
-
|
118
|
-
return String(label).toLowerCase().includes(filterItem.toLowerCase());
|
119
|
-
}
|
117
|
+
const filteredOptions = options?.filter((option: GenericObject) =>
|
118
|
+
option.label.toLowerCase().includes(filterItem.toLowerCase())
|
120
119
|
);
|
121
120
|
|
122
121
|
// For keyboard accessibility: Set focus within dropdown to selected item if it exists
|
@@ -234,7 +233,9 @@ const Dropdown = (props: DropdownProps) => {
|
|
234
233
|
options?.map((option: GenericObject) => (
|
235
234
|
<Dropdown.Option key={option.id}
|
236
235
|
option={option}
|
237
|
-
|
236
|
+
>
|
237
|
+
<Body text={option.label} />
|
238
|
+
</Dropdown.Option>
|
238
239
|
))}
|
239
240
|
</DropdownContainer>
|
240
241
|
</>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States'
|
4
|
-
{ label: 'Canada', value: 'Canada'
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan'
|
3
|
+
{ label: 'United States', value: 'United States' },
|
4
|
+
{ label: 'Canada', value: 'Canada' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
The Dropdown kit accepts an `options` array and renders each object from that array as a selectable option within a dropdown container. `options` is a required prop and must be an array of objects. Each object can contain as many key/value pairs as needed but MUST contain 'label' and 'value' as the only required items within each object.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States'
|
4
|
-
{ label: 'Canada', value: 'Canada'
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan'
|
3
|
+
{ label: 'United States', value: 'United States' },
|
4
|
+
{ label: 'Canada', value: 'Canada' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1,6 +1,7 @@
|
|
1
|
-
The dropdown
|
1
|
+
The dropdown comes with the following subcomponents that can be used to achieve various levels of customization:
|
2
2
|
|
3
|
-
`Dropdown.Trigger`
|
4
|
-
`Dropdown.Container`
|
5
|
-
`Dropdown.Option`
|
6
|
-
|
3
|
+
`Dropdown. Trigger` / `dropdown/dropdown_trigger`
|
4
|
+
`Dropdown.Container`/ `dropdown/dropdown_container`
|
5
|
+
`Dropdown.Option` / `dropdown/dropdown_option`
|
6
|
+
|
7
|
+
See the code snippet below for a visual on how to use the kit with subcomponents. Each subcomponent allows for GlobalProps in addition to any subcomponent specfic props.
|
@@ -48,17 +48,12 @@
|
|
48
48
|
<%= pb_rails("dropdown/dropdown_container") do %>
|
49
49
|
<% options.each do |option| %>
|
50
50
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
<% end %>
|
58
|
-
<%= pb_rails("flex/flex_item") do %>
|
59
|
-
<%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
|
60
|
-
<% end %>
|
61
|
-
<% end %>
|
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 %>
|
62
57
|
<% end %>
|
63
58
|
<% end %>
|
64
59
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Dropdown, User,
|
2
|
+
import { Dropdown, User, FlexItem, Badge, Avatar } from '../../'
|
3
3
|
|
4
4
|
const DropdownWithCustomDisplay = (props) => {
|
5
5
|
const [selectedOption, setSelectedOption] = useState();
|
@@ -69,10 +69,7 @@ const DropdownWithCustomDisplay = (props) => {
|
|
69
69
|
<Dropdown.Option key={option.id}
|
70
70
|
option={option}
|
71
71
|
>
|
72
|
-
|
73
|
-
align="center"
|
74
|
-
justify="between"
|
75
|
-
>
|
72
|
+
<>
|
76
73
|
<FlexItem>
|
77
74
|
<User
|
78
75
|
align="left"
|
@@ -96,7 +93,7 @@ const DropdownWithCustomDisplay = (props) => {
|
|
96
93
|
}`}
|
97
94
|
/>
|
98
95
|
</FlexItem>
|
99
|
-
|
96
|
+
</>
|
100
97
|
</Dropdown.Option>
|
101
98
|
))}
|
102
99
|
</Dropdown>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
The `customDisplay` prop can be used to customize the display of the selected item by allowing devs to pass in a component that will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
|
2
2
|
|
3
|
-
The `placeholder` prop can also be used to customize the placeholder text for the default
|
3
|
+
The `placeholder` prop can also be used to customize the placeholder text for the default Trigger.
|
4
4
|
|
5
|
-
The `onSelect` prop
|
5
|
+
The `onSelect` prop is a function that gives the dev one argument: the selected option. In this example we are using the `onSelect` to set a state with the selected option and using it to customize the `customDisplay`.
|
@@ -5,21 +5,21 @@
|
|
5
5
|
value: "United States",
|
6
6
|
areaCode: "+1",
|
7
7
|
icon: "🇺🇸",
|
8
|
-
id: "
|
8
|
+
id: "United-states"
|
9
9
|
},
|
10
10
|
{
|
11
11
|
label: "Canada",
|
12
12
|
value: "Canada",
|
13
13
|
areaCode: "+1",
|
14
14
|
icon: "🇨🇦",
|
15
|
-
id: "
|
15
|
+
id: "canada"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
label: "Pakistan",
|
19
19
|
value: "Pakistan",
|
20
20
|
areaCode: "+92",
|
21
21
|
icon: "🇵🇰",
|
22
|
-
id: "
|
22
|
+
id: "pakistan"
|
23
23
|
}
|
24
24
|
]
|
25
25
|
|
@@ -30,19 +30,14 @@
|
|
30
30
|
<%= pb_rails("dropdown/dropdown_container") do %>
|
31
31
|
<% options.each do |option| %>
|
32
32
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
<% end %>
|
42
|
-
<% end %>
|
43
|
-
<%= pb_rails("flex/flex_item") do %>
|
44
|
-
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
45
|
-
<% end %>
|
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]}) %>
|
46
41
|
<% end %>
|
47
42
|
<% end %>
|
48
43
|
<% end %>
|
@@ -38,10 +38,7 @@ const DropdownWithCustomOptions = (props) => {
|
|
38
38
|
<Dropdown.Option key={option.id}
|
39
39
|
option={option}
|
40
40
|
>
|
41
|
-
|
42
|
-
align="center"
|
43
|
-
justify="between"
|
44
|
-
>
|
41
|
+
<>
|
45
42
|
<FlexItem>
|
46
43
|
<Flex>
|
47
44
|
<Icon icon={option.icon}
|
@@ -55,7 +52,7 @@ const DropdownWithCustomOptions = (props) => {
|
|
55
52
|
text={option.areaCode}
|
56
53
|
/>
|
57
54
|
</FlexItem>
|
58
|
-
|
55
|
+
</>
|
59
56
|
</Dropdown.Option>
|
60
57
|
))}
|
61
58
|
</Dropdown>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
The Dropdown also allows for custom options that can be passed in as children to the `Dropdown.Option` subcomponent. If no children are passed to `Dropdown.Option`, the kit will render each option as text within a Body kit by default.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States'
|
4
|
-
{ label: 'Canada', value: 'Canada'
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan'
|
3
|
+
{ label: 'United States', value: 'United States' },
|
4
|
+
{ label: 'Canada', value: 'Canada' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1 +1 @@
|
|
1
|
-
By default,
|
1
|
+
By default, the padding on each option in the dropdown is set to `xs`. The `padding` Global Props however can be used to override this default. In this example, we are setting padding to `sm`.
|
@@ -5,21 +5,21 @@
|
|
5
5
|
value: "United States",
|
6
6
|
areaCode: "+1",
|
7
7
|
icon: "🇺🇸",
|
8
|
-
id: "
|
8
|
+
id: "United-states"
|
9
9
|
},
|
10
10
|
{
|
11
11
|
label: "Canada",
|
12
12
|
value: "Canada",
|
13
13
|
areaCode: "+1",
|
14
14
|
icon: "🇨🇦",
|
15
|
-
id: "
|
15
|
+
id: "canada"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
label: "Pakistan",
|
19
19
|
value: "Pakistan",
|
20
20
|
areaCode: "+92",
|
21
21
|
icon: "🇵🇰",
|
22
|
-
id: "
|
22
|
+
id: "pakistan"
|
23
23
|
}
|
24
24
|
]
|
25
25
|
|
@@ -32,20 +32,15 @@
|
|
32
32
|
<%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs"}) do %>
|
33
33
|
<% options.each do |option| %>
|
34
34
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
35
|
-
<%= pb_rails("flex", props: {
|
36
|
-
align: "center",
|
37
|
-
justify: "between",
|
38
|
-
}) do %>
|
39
35
|
<%= pb_rails("flex/flex_item") do %>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<% end %>
|
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 %>
|
49
44
|
<% end %>
|
50
45
|
<% end %>
|
51
46
|
<% end %>
|
@@ -51,10 +51,7 @@ const [selectedOption, setSelectedOption] = useState();
|
|
51
51
|
<Dropdown.Option key={option.id}
|
52
52
|
option={option}
|
53
53
|
>
|
54
|
-
|
55
|
-
align="center"
|
56
|
-
justify="between"
|
57
|
-
>
|
54
|
+
<>
|
58
55
|
<FlexItem>
|
59
56
|
<Flex>
|
60
57
|
<Icon icon={option.icon}
|
@@ -68,7 +65,7 @@ const [selectedOption, setSelectedOption] = useState();
|
|
68
65
|
text={option.areaCode}
|
69
66
|
/>
|
70
67
|
</FlexItem>
|
71
|
-
|
68
|
+
</>
|
72
69
|
</Dropdown.Option>
|
73
70
|
))}
|
74
71
|
</Dropdown.Container>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
The Dropdown can also be given a custom Trigger by passing children to the `Dropdown.Trigger` subcomponent as shown in this example. Here we are using the IconCircle kit.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%
|
2
2
|
options = [
|
3
|
-
{ label: 'United States', value: 'United States'
|
4
|
-
{ label: 'Canada', value: 'Canada'
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan'
|
3
|
+
{ label: 'United States', value: 'United States' },
|
4
|
+
{ label: 'Canada', value: 'Canada' },
|
5
|
+
{ label: 'Pakistan', value: 'Pakistan' },
|
6
6
|
]
|
7
7
|
|
8
8
|
%>
|
@@ -1 +1 @@
|
|
1
|
-
The
|
1
|
+
The optional `label` prop takes a string value that if present will render that string as the label for the Dropdown.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
-
|
4
|
+
- dropdown_subcomponent_structure: Subcomponent Structure
|
5
5
|
- dropdown_with_label: With Label
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- dropdown_with_custom_padding: Custom
|
6
|
+
- dropdown_with_custom_options: Custom Options
|
7
|
+
- dropdown_with_custom_display: Custom Display
|
8
|
+
- dropdown_with_custom_trigger: Custom Trigger
|
9
|
+
- dropdown_with_custom_padding: Custom Padding for Dropdown Options
|
10
10
|
|
11
11
|
react:
|
12
12
|
- dropdown_default: Default
|
@@ -15,7 +15,7 @@ examples:
|
|
15
15
|
- dropdown_with_custom_options: Custom Options
|
16
16
|
- dropdown_with_custom_display: Custom Display
|
17
17
|
- dropdown_with_custom_trigger: Custom Trigger
|
18
|
-
- dropdown_with_custom_padding: Custom
|
18
|
+
- dropdown_with_custom_padding: Custom Padding for Dropdown Options
|
19
19
|
# - dropdown_with_autocomplete: Autocomplete
|
20
20
|
# - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
|
21
21
|
# - dropdown_with_external_control: useDropdown Hook
|
@@ -8,7 +8,6 @@
|
|
8
8
|
<%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
|
9
9
|
<% end %>
|
10
10
|
<div class="dropdown_wrapper" style="position: relative">
|
11
|
-
<input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value=""/>
|
12
11
|
<% if content.present? %>
|
13
12
|
<%= content.presence %>
|
14
13
|
<% else %>
|
@@ -203,5 +203,5 @@ test('selected option on click', () => {
|
|
203
203
|
const kit = screen.getByTestId(testId)
|
204
204
|
const option = kit.querySelector('.pb_dropdown_option_list')
|
205
205
|
option.click()
|
206
|
-
expect(option).toHaveClass('pb_dropdown_option_selected')
|
206
|
+
expect(option).toHaveClass('pb_dropdown_option_selected p_xs')
|
207
207
|
})
|
@@ -2,7 +2,7 @@
|
|
2
2
|
aria: object.aria,
|
3
3
|
class: object.classname,
|
4
4
|
data: object.data,
|
5
|
-
id: object.
|
5
|
+
id: object.id,
|
6
6
|
**combined_html_options) do %>
|
7
7
|
<%= pb_rails("list/item", props: {
|
8
8
|
display: "flex",
|
@@ -10,12 +10,18 @@
|
|
10
10
|
padding:"none",
|
11
11
|
cursor: "pointer"
|
12
12
|
}) do %>
|
13
|
-
|
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 %>
|
14
20
|
<% if content.present? %>
|
15
21
|
<%= content.presence %>
|
16
22
|
<% else %>
|
17
23
|
<%= pb_rails("body", props: {text: object.option[:label]}) %>
|
18
24
|
<% end %>
|
19
|
-
|
25
|
+
<% end %>
|
20
26
|
<% end %>
|
21
27
|
<% end %>
|
@@ -3,15 +3,19 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbDropdown
|
5
5
|
class DropdownOption < Playbook::KitBase
|
6
|
-
prop :option, type: Playbook::Props::
|
6
|
+
prop :option, type: Playbook::Props::String
|
7
7
|
prop :id, type: Playbook::Props::String
|
8
8
|
|
9
9
|
def data
|
10
10
|
Hash(prop(:data)).merge("dropdown_option_label": option)
|
11
11
|
end
|
12
12
|
|
13
|
+
def padding_helper
|
14
|
+
" p_xs"
|
15
|
+
end
|
16
|
+
|
13
17
|
def classname
|
14
|
-
generate_classname("pb_dropdown_option", "list")
|
18
|
+
generate_classname("pb_dropdown_option", "list") + padding_helper
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -37,10 +37,8 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
37
37
|
|
38
38
|
handleOptionClick(event) {
|
39
39
|
const option = event.target.closest(OPTION_SELECTOR);
|
40
|
-
const hiddenInput = this.element.querySelector("#dropdown-selected-option");
|
41
40
|
if (option) {
|
42
41
|
const value = option.dataset.dropdownOptionLabel;
|
43
|
-
hiddenInput.value = JSON.parse(value).id;
|
44
42
|
this.onOptionSelected(value, option);
|
45
43
|
}
|
46
44
|
}
|
@@ -101,6 +99,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
101
99
|
option.classList.remove("pb_dropdown_option_selected");
|
102
100
|
});
|
103
101
|
selectedOption.classList.add("pb_dropdown_option_selected");
|
102
|
+
console.log(`Selected value: ${value}`);
|
104
103
|
}
|
105
104
|
|
106
105
|
get target() {
|
@@ -10,6 +10,7 @@ import { globalProps, GlobalProps } from "../../utilities/globalProps";
|
|
10
10
|
|
11
11
|
import DropdownContext from "../context";
|
12
12
|
|
13
|
+
import Flex from "../../pb_flex/_flex";
|
13
14
|
import Body from "../../pb_body/_body";
|
14
15
|
import ListItem from "../../pb_list/_list_item";
|
15
16
|
import { GenericObject } from "../../types";
|
@@ -38,6 +39,7 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
38
39
|
id,
|
39
40
|
key,
|
40
41
|
option,
|
42
|
+
padding = "xs",
|
41
43
|
} = props;
|
42
44
|
|
43
45
|
const {
|
@@ -48,10 +50,8 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
48
50
|
selected,
|
49
51
|
} = useContext(DropdownContext);
|
50
52
|
|
51
|
-
const isItemMatchingFilter = (option: GenericObject) =>
|
52
|
-
|
53
|
-
return String(label).toLowerCase().includes(filterItem.toLowerCase());
|
54
|
-
}
|
53
|
+
const isItemMatchingFilter = (option: GenericObject) =>
|
54
|
+
option?.label.toLowerCase().includes(filterItem.toLowerCase());
|
55
55
|
|
56
56
|
if (!isItemMatchingFilter(option)) {
|
57
57
|
return null;
|
@@ -75,7 +75,7 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
75
75
|
selectedClass,
|
76
76
|
focusedClass,
|
77
77
|
),
|
78
|
-
globalProps(props),
|
78
|
+
globalProps(props, {padding}),
|
79
79
|
className
|
80
80
|
);
|
81
81
|
|
@@ -96,12 +96,20 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
96
96
|
key={option.label}
|
97
97
|
padding="none"
|
98
98
|
>
|
99
|
+
<Flex
|
100
|
+
align="center"
|
101
|
+
className="dropdown_option_wrapper"
|
102
|
+
justify="between"
|
103
|
+
paddingX="sm"
|
104
|
+
paddingY="xxs"
|
105
|
+
>
|
99
106
|
{children ?
|
100
|
-
|
107
|
+
children :
|
101
108
|
<Body dark={dark}
|
102
109
|
text={option.label}
|
103
110
|
/>
|
104
111
|
}
|
112
|
+
</Flex>
|
105
113
|
</ListItem>
|
106
114
|
</div>
|
107
115
|
);
|
@@ -14,12 +14,3 @@ examples:
|
|
14
14
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
15
15
|
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
16
16
|
- fixed_confirmation_toast_children: Children
|
17
|
-
|
18
|
-
swift:
|
19
|
-
- fixed_confirmation_toast_default_swift: Default
|
20
|
-
- fixed_confirmation_toast_multi_line_swift: Multi Line
|
21
|
-
#- fixed_confirmation_toast_close_swift: Click to Close
|
22
|
-
#- fixed_confirmation_toast_positions_swift: Click to Show Positions
|
23
|
-
- fixed_confirmation_toast_children_swift: Children
|
24
|
-
#- fixed_confirmation_toast_dismiss_with_timer_swift: Timer
|
25
|
-
- fixed_confirmation_toast_props_swift: ""
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
3
8
|
|
4
9
|
<% if content %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
17
17
|
<%= form.typeahead :example_user, props: { data: { typeahead_example1: true, user: {} }, placeholder: "Search for a user" } %>
|
18
18
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
19
|
-
<%= form.
|
19
|
+
<%= form.telephone_field :example_phone_field, props: { label: true } %>
|
20
20
|
<%= form.email_field :example_email_field, props: { label: true } %>
|
21
21
|
<%= form.number_field :example_number_field, props: { label: true } %>
|
22
22
|
<%= form.search_field :example_search_field, props: { label: true } %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
<%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
|
17
17
|
<%= form.text_field :example_text_field, props: { label: true, required: true } %>
|
18
|
-
<%= form.
|
18
|
+
<%= form.telephone_field :example_phone_field, props: { label: true, required: true, validation: { pattern: "[0-9]{3}-[0-9]{3}-[0-9]{4}", message: "Please enter a valid phone number (example: 888-888-8888)." } } %>
|
19
19
|
<%= form.email_field :example_email_field, props: { label: true, required: true } %>
|
20
20
|
<%= form.number_field :example_number_field, props: { label: true, required: true } %>
|
21
21
|
<%= form.search_field :example_project_number, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
|
@@ -33,17 +33,6 @@
|
|
33
33
|
outline-offset: -1px;
|
34
34
|
}
|
35
35
|
}
|
36
|
-
.text_input_wrapper_add_on .add-on-right [class^=pb_card_kit] {
|
37
|
-
border-bottom-right-radius: 0;
|
38
|
-
border-top-right-radius: 0;
|
39
|
-
border-right-width: 0;
|
40
|
-
}
|
41
|
-
.text_input_wrapper_add_on .add-on-right.border_left_on .card-right-aligned {
|
42
|
-
border-left: 1px $border_light solid;
|
43
|
-
&.dark {
|
44
|
-
border-left: 1px rgba($white, 0.15) solid;
|
45
|
-
}
|
46
|
-
}
|
47
36
|
}
|
48
37
|
|
49
38
|
& > [class^=pb_text_input_kit]:not(:first-child) {
|
@@ -51,10 +40,6 @@
|
|
51
40
|
border-bottom-left-radius: 0;
|
52
41
|
border-top-left-radius: 0;
|
53
42
|
}
|
54
|
-
.text_input_wrapper_add_on .add-on-left [class^=pb_card_kit] {
|
55
|
-
border-bottom-left-radius: 0;
|
56
|
-
border-top-left-radius: 0;
|
57
|
-
}
|
58
43
|
}
|
59
44
|
|
60
45
|
& > [class^=pb_button_kit]:not(:last-child) {
|
@@ -1,3 +1,8 @@
|
|
1
|
-
<%=
|
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 %>
|
2
7
|
<%= pb_rails("icon", props: { dark: object.dark, icon: object.icon, fixed_width: true }) %>
|
3
8
|
<% end %>
|