playbook_ui 13.27.0.pre.alpha.PBNTR294paginationstylingfix2899 → 13.27.0.pre.alpha.PLAY888Cardkithighlightoverflowtooltiperror2930
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 +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -5
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +1 -6
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +1 -6
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -0
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +1 -6
- data/app/pb_kits/playbook/pb_card/_card.scss +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +21 -10
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +92 -0
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +3 -75
- 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_icon.html.erb +15 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.rb +37 -0
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -6
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +72 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +73 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_collapsible/index.js +16 -6
- 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_range_inline/date_range_inline.html.erb +1 -5
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +61 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +4 -1
- 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_stacked/docs/_date_stacked_bold_swift.md +32 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +17 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +19 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +10 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +17 -0
- data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -6
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +39 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +39 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +15 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +78 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +1 -6
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +1 -5
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default_swift.md +20 -0
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_props_swift.md +6 -0
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +5 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.md +6 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -3
- 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_display.html.erb → _dropdown_with_custom_display_rails.html.erb} +11 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +5 -2
- 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_options.html.erb → _dropdown_with_custom_options_rails.html.erb} +13 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.md +1 -0
- 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.jsx +5 -2
- 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_custom_trigger.html.erb → _dropdown_with_custom_trigger_rails.html.erb} +13 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.md +1 -0
- 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.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +2 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +2 -6
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +2 -12
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +23 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +7 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +9 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +22 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +9 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +62 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -6
- 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_icon_circle/icon_circle.html.erb +1 -6
- 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_loading_inline/loading_inline.html.erb +1 -5
- 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 +1 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +1 -6
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +1 -6
- data/app/pb_kits/playbook/pb_person/person.html.erb +1 -6
- 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_section_separator/section_separator.html.erb +1 -6
- data/app/pb_kits/playbook/pb_select/_select.scss +8 -0
- data/app/pb_kits/playbook/pb_source/source.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_text_input/_text_input.scss +19 -0
- 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 +1 -5
- 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_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_tooltip/index.js +1 -0
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +1 -6
- data/dist/menu.yml +2 -2
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/forms/builder/phone_number_field.rb +12 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/kit_base.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +42 -6
- /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
The dropdown is built using all of the following required subcomponents:
|
2
|
+
|
3
|
+
`dropdown/dropdown_trigger` is the UI component that users interact with to toggle the dropdown.
|
4
|
+
`dropdown/dropdown_container` is the floating container that wraps the list of dropdown options.
|
5
|
+
`dropdown/dropdown_option` renders options that are passed to the container.
|
6
|
+
Each of these subcomponents can be altered using global props and/or their respective props. See doc examples below for more information on each.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Dropdown, User, FlexItem, Badge, Avatar } from '../../'
|
2
|
+
import { Dropdown, User, Flex, FlexItem, Badge, Avatar } from '../../'
|
3
3
|
|
4
4
|
const DropdownWithCustomDisplay = (props) => {
|
5
5
|
const [selectedOption, setSelectedOption] = useState();
|
@@ -69,7 +69,10 @@ const DropdownWithCustomDisplay = (props) => {
|
|
69
69
|
<Dropdown.Option key={option.id}
|
70
70
|
option={option}
|
71
71
|
>
|
72
|
-
|
72
|
+
<Flex
|
73
|
+
align="center"
|
74
|
+
justify="between"
|
75
|
+
>
|
73
76
|
<FlexItem>
|
74
77
|
<User
|
75
78
|
align="left"
|
@@ -93,7 +96,7 @@ const DropdownWithCustomDisplay = (props) => {
|
|
93
96
|
}`}
|
94
97
|
/>
|
95
98
|
</FlexItem>
|
96
|
-
|
99
|
+
</Flex>
|
97
100
|
</Dropdown.Option>
|
98
101
|
))}
|
99
102
|
</Dropdown>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. The component passed to customDisplay 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 Trigger
|
3
|
+
The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
|
4
4
|
|
5
|
-
The `onSelect` prop
|
5
|
+
The `onSelect` prop returns the selected option as an object to be utilized by the dev. In this example we are using the `onSelect` to set a state with the selected option and using it to customize the `customDisplay`.
|
@@ -48,12 +48,17 @@
|
|
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
|
-
|
51
|
+
<%= pb_rails("flex", props: {
|
52
|
+
align: "center",
|
53
|
+
justify: "between",
|
54
|
+
}) do %>
|
55
|
+
<%= pb_rails("flex/flex_item") do %>
|
56
|
+
<%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
|
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 %>
|
57
62
|
<% end %>
|
58
63
|
<% end %>
|
59
64
|
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. The component passed to custom_display will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
|
2
|
+
|
3
|
+
The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
|
4
|
+
|
5
|
+
The dropdown follows the typical rails pattern of utilizing hidden inputs for form submission. The hidden input value is the selected options' id.
|
@@ -38,7 +38,10 @@ const DropdownWithCustomOptions = (props) => {
|
|
38
38
|
<Dropdown.Option key={option.id}
|
39
39
|
option={option}
|
40
40
|
>
|
41
|
-
|
41
|
+
<Flex
|
42
|
+
align="center"
|
43
|
+
justify="between"
|
44
|
+
>
|
42
45
|
<FlexItem>
|
43
46
|
<Flex>
|
44
47
|
<Icon icon={option.icon}
|
@@ -52,7 +55,7 @@ const DropdownWithCustomOptions = (props) => {
|
|
52
55
|
text={option.areaCode}
|
53
56
|
/>
|
54
57
|
</FlexItem>
|
55
|
-
|
58
|
+
</Flex>
|
56
59
|
</Dropdown.Option>
|
57
60
|
))}
|
58
61
|
</Dropdown>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
`Dropdown.Option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
|
@@ -30,14 +30,19 @@
|
|
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
|
-
|
33
|
+
<%= pb_rails("flex", props: {
|
34
|
+
align: "center",
|
35
|
+
justify: "between",
|
36
|
+
}) do %>
|
37
|
+
<%= pb_rails("flex/flex_item") do %>
|
38
|
+
<%= pb_rails("flex") do %>
|
39
|
+
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
40
|
+
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<%= pb_rails("flex/flex_item") do %>
|
44
|
+
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
45
|
+
<% end %>
|
41
46
|
<% end %>
|
42
47
|
<% end %>
|
43
48
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
`dropdown/dropdown_option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
|
@@ -1 +1 @@
|
|
1
|
-
By default,
|
1
|
+
By default, dropdown option paddingX is set to `sm` and paddingY is set to `xs`, but this padding can be overridden using our global padding props. In this example we are setting the option padding to `sm` all around.
|
@@ -51,7 +51,10 @@ const [selectedOption, setSelectedOption] = useState();
|
|
51
51
|
<Dropdown.Option key={option.id}
|
52
52
|
option={option}
|
53
53
|
>
|
54
|
-
|
54
|
+
<Flex
|
55
|
+
align="center"
|
56
|
+
justify="between"
|
57
|
+
>
|
55
58
|
<FlexItem>
|
56
59
|
<Flex>
|
57
60
|
<Icon icon={option.icon}
|
@@ -65,7 +68,7 @@ const [selectedOption, setSelectedOption] = useState();
|
|
65
68
|
text={option.areaCode}
|
66
69
|
/>
|
67
70
|
</FlexItem>
|
68
|
-
|
71
|
+
</Flex>
|
69
72
|
</Dropdown.Option>
|
70
73
|
))}
|
71
74
|
</Dropdown.Container>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Optionally replace the default trigger's select element by passing child components directly to the `Dropdown.Trigger`.
|
@@ -32,15 +32,20 @@
|
|
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 %>
|
35
39
|
<%= pb_rails("flex/flex_item") do %>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
<%= pb_rails("flex") do %>
|
41
|
+
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
42
|
+
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<%= pb_rails("flex/flex_item") do %>
|
46
|
+
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
44
49
|
<% end %>
|
45
50
|
<% end %>
|
46
51
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Optionally replace the default trigger's select element by passing child components directly to the `dropdown/dropdown_trigger`.
|
@@ -1 +1 @@
|
|
1
|
-
The
|
1
|
+
The top-level Dropdown component optionally accepts any string through a `label` prop to produce a label above your trigger element.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
-
|
4
|
+
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
5
5
|
- dropdown_with_label: With Label
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- dropdown_with_custom_padding: Custom Padding
|
6
|
+
- dropdown_with_custom_options_rails: Custom Options
|
7
|
+
- dropdown_with_custom_display_rails: Custom Display
|
8
|
+
- dropdown_with_custom_trigger_rails: Custom Trigger
|
9
|
+
- dropdown_with_custom_padding: Custom Option Padding
|
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 Padding
|
18
|
+
- dropdown_with_custom_padding: Custom Option Padding
|
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
|
@@ -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')
|
207
207
|
})
|
@@ -10,18 +10,12 @@
|
|
10
10
|
padding:"none",
|
11
11
|
cursor: "pointer"
|
12
12
|
}) do %>
|
13
|
-
|
14
|
-
align: "center",
|
15
|
-
classname:"dropdown_option_wrapper",
|
16
|
-
justify: "between",
|
17
|
-
padding_x:"sm",
|
18
|
-
padding_y:"xxs",
|
19
|
-
}) do %>
|
13
|
+
<div class="dropdown_option_wrapper">
|
20
14
|
<% if content.present? %>
|
21
15
|
<%= content.presence %>
|
22
16
|
<% else %>
|
23
17
|
<%= pb_rails("body", props: {text: object.option[:label]}) %>
|
24
18
|
<% end %>
|
25
|
-
|
19
|
+
</div>
|
26
20
|
<% end %>
|
27
21
|
<% end %>
|
@@ -3,19 +3,15 @@
|
|
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::HashProp
|
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
|
-
|
17
13
|
def classname
|
18
|
-
generate_classname("pb_dropdown_option", "list")
|
14
|
+
generate_classname("pb_dropdown_option", "list")
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -10,7 +10,6 @@ import { globalProps, GlobalProps } from "../../utilities/globalProps";
|
|
10
10
|
|
11
11
|
import DropdownContext from "../context";
|
12
12
|
|
13
|
-
import Flex from "../../pb_flex/_flex";
|
14
13
|
import Body from "../../pb_body/_body";
|
15
14
|
import ListItem from "../../pb_list/_list_item";
|
16
15
|
import { GenericObject } from "../../types";
|
@@ -39,7 +38,6 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
39
38
|
id,
|
40
39
|
key,
|
41
40
|
option,
|
42
|
-
padding = "xs",
|
43
41
|
} = props;
|
44
42
|
|
45
43
|
const {
|
@@ -77,7 +75,7 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
77
75
|
selectedClass,
|
78
76
|
focusedClass,
|
79
77
|
),
|
80
|
-
globalProps(props
|
78
|
+
globalProps(props),
|
81
79
|
className
|
82
80
|
);
|
83
81
|
|
@@ -98,20 +96,12 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
98
96
|
key={option.label}
|
99
97
|
padding="none"
|
100
98
|
>
|
101
|
-
<Flex
|
102
|
-
align="center"
|
103
|
-
className="dropdown_option_wrapper"
|
104
|
-
justify="between"
|
105
|
-
paddingX="sm"
|
106
|
-
paddingY="xxs"
|
107
|
-
>
|
108
99
|
{children ?
|
109
|
-
|
100
|
+
<div className="dropdown_option_wrapper">{children}</div> :
|
110
101
|
<Body dark={dark}
|
111
102
|
text={option.label}
|
112
103
|
/>
|
113
104
|
}
|
114
|
-
</Flex>
|
115
105
|
</ListItem>
|
116
106
|
</div>
|
117
107
|
);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
![Children-Toast](https://github.com/powerhome/playbook-swift/assets/54749071/55aebd12-43c4-4061-92d3-6aebb07ff349)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBToast(
|
6
|
+
text: message,
|
7
|
+
variant: .success,
|
8
|
+
actionView: .custom(AnyView(Text("Undo").pbFont(.title4, color: .white))),
|
9
|
+
dismissAction: closeToast
|
10
|
+
)
|
11
|
+
PBToast(
|
12
|
+
variant: .custom(nil, .pbPrimary),
|
13
|
+
actionView: .custom(
|
14
|
+
AnyView(
|
15
|
+
HStack {
|
16
|
+
Text("Undo action").pbFont(.caption, color: .white)
|
17
|
+
PBButton(variant: .primary, title: "Undo").disabled(true)
|
18
|
+
}
|
19
|
+
)),
|
20
|
+
dismissAction: closeToast
|
21
|
+
)
|
22
|
+
}
|
23
|
+
```
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
```swift
|
2
|
+
VStack(alignment: .leading) {
|
3
|
+
PBToast(text: "Error Message", variant: .error, actionView: .default, dismissAction: closeToast)
|
4
|
+
PBToast(text: "Items Successfully Moved", variant: .success, actionView: .default, dismissAction: closeToast)
|
5
|
+
PBToast(text: "Scan to Assign Selected Items", variant: .neutral, actionView: .default, dismissAction: closeToast)
|
6
|
+
}
|
7
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
![Default-Toast](https://github.com/powerhome/playbook-swift/assets/54749071/cc465b1b-85ba-4492-a832-b06b842a1555)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
VStack(alignment: .leading) {
|
5
|
+
PBToast(text: "Error Message", variant: .error, dismissAction: closeToast)
|
6
|
+
PBToast(text: "Items Successfully Moved", variant: .success, dismissAction: closeToast)
|
7
|
+
PBToast(text: "Scan to Assign Selected Items", variant: .neutral, dismissAction: closeToast)
|
8
|
+
}
|
9
|
+
```
|
@@ -0,0 +1,22 @@
|
|
1
|
+
```swift
|
2
|
+
HStack {
|
3
|
+
PBButton(variant: .secondary, title: "Top Center") {
|
4
|
+
position = .top
|
5
|
+
toastView = PBToast(
|
6
|
+
text: "Top Center",
|
7
|
+
variant: .neutral,
|
8
|
+
actionView: .withTimer(3),
|
9
|
+
dismissAction: closeToast
|
10
|
+
)
|
11
|
+
}
|
12
|
+
PBButton(variant: .secondary, title: "Bottom Center") {
|
13
|
+
position = .bottom
|
14
|
+
toastView = PBToast(
|
15
|
+
text: "Bottom Center",
|
16
|
+
variant: .neutral,
|
17
|
+
actionView: .withTimer(2),
|
18
|
+
dismissAction: closeToast
|
19
|
+
)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
```
|
@@ -0,0 +1,62 @@
|
|
1
|
+
```swift
|
2
|
+
GridRow {
|
3
|
+
PBButton(variant: .secondary, title: "Top Left") {
|
4
|
+
position = .topLeft
|
5
|
+
toastView = PBToast(
|
6
|
+
text: "Top Left",
|
7
|
+
variant: .neutral,
|
8
|
+
actionView: .default,
|
9
|
+
dismissAction: closeToast
|
10
|
+
)
|
11
|
+
}
|
12
|
+
PBButton(variant: .secondary, title: "Top Right") {
|
13
|
+
position = .topRight
|
14
|
+
toastView = PBToast(
|
15
|
+
text: "Top Right",
|
16
|
+
variant: .neutral,
|
17
|
+
actionView: .default,
|
18
|
+
dismissAction: closeToast
|
19
|
+
)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
GridRow {
|
23
|
+
PBButton(variant: .secondary, title: "Top Center") {
|
24
|
+
position = .top
|
25
|
+
toastView = PBToast(
|
26
|
+
text: "Top Center",
|
27
|
+
variant: .neutral,
|
28
|
+
actionView: .default,
|
29
|
+
dismissAction: closeToast
|
30
|
+
)
|
31
|
+
}
|
32
|
+
PBButton(variant: .secondary, title: "Bottom Center") {
|
33
|
+
position = .bottom
|
34
|
+
toastView = PBToast(
|
35
|
+
text: "Bottom Center",
|
36
|
+
variant: .custom(.user, .status(.neutral)),
|
37
|
+
actionView: .default,
|
38
|
+
dismissAction: closeToast
|
39
|
+
)
|
40
|
+
}
|
41
|
+
}
|
42
|
+
GridRow {
|
43
|
+
PBButton(variant: .secondary, title: "Bottom Left") {
|
44
|
+
position = .bottomLeft
|
45
|
+
toastView = PBToast(
|
46
|
+
text: "Bottom Left",
|
47
|
+
variant: .custom(.user, .status(.neutral)),
|
48
|
+
actionView: .default,
|
49
|
+
dismissAction: closeToast
|
50
|
+
)
|
51
|
+
}
|
52
|
+
PBButton(variant: .secondary, title: "Bottom Right") {
|
53
|
+
position = .bottomRight
|
54
|
+
toastView = PBToast(
|
55
|
+
text: "Bottom Right",
|
56
|
+
variant: .custom(.user, .status(.neutral)),
|
57
|
+
actionView: .default,
|
58
|
+
dismissAction: closeToast
|
59
|
+
)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
```
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **text** | `String` |`Value for the toast message` | `nil` | |
|
5
|
+
| **variant** | `Variant` | `Determines the type pf toast message being displayed` | `.custom()` | `error`, `success`,
|
6
|
+
`neutral`, `custom()` |
|
7
|
+
| **actionView** | `dismissAction` | Dismisses the toast message | `.default` | `default` `custom()` `withTimer()` |
|
8
|
+
| **dismissAction** | `(() -> Void)` | `Triggers the dismiss action` | | |
|
@@ -14,3 +14,12 @@ 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,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
id: object.id,
|
4
|
-
data: object.data,
|
5
|
-
class: object.classname,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
8
3
|
|
9
4
|
<% 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.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
|
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.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
|
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)." } } %>
|
@@ -1,8 +1,3 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<%= pb_rails("icon", props: { dark: object.dark, icon: object.icon, fixed_width: true }) %>
|
8
3
|
<% end %>
|
@@ -1,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
8
3
|
<%= pb_rails("icon", props: { icon: object.icon, fixed_width: true }) %>
|
9
4
|
<%= object.text %>
|
@@ -1,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
id: object.id,
|
4
|
-
data: object.data,
|
5
|
-
class: object.classname,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<%= pb_rails("caption", props: { text: object.label, classname: "pb_label_pill_label"}) %>
|
8
3
|
<%= pb_rails("pill", props: { text: object.pill_value, variant: object.variant, classname: "pb_label_pill_pill" }) %>
|
9
4
|
<% end %>
|
@@ -1,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
id: object.id,
|
4
|
-
data: object.data,
|
5
|
-
class: object.classname,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
|
8
3
|
<% if object.variant == "details" %>
|
9
4
|
<%= pb_rails("flex", props: {inline: true, vertical: "center"}) do %>
|
@@ -1,8 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
id: object.id,
|
3
|
-
data: object.data,
|
4
|
-
class: object.classname,
|
5
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
6
2
|
|
7
3
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
8
4
|
<%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: "spinner", pulse: true }) %> <%= object.text %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= content_tag(:div,
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
aria: object.aria,
|
6
|
+
**combined_html_options) do %>
|
7
|
+
<%= content %>
|
8
8
|
<% end %>
|
@@ -1,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
<% object.users.take(object.display_count).each do |user| %>
|
8
3
|
<%= pb_rails("avatar", props: user.merge({size: object.size, classname: "pb_multiple_users_item", dark: object.dark}) ) %>
|
9
4
|
<% end %>
|