playbook_ui 13.27.0 → 13.28.0
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/Utilities/GetPlacementPropsHelper.tsx +16 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +16 -0
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +4 -0
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +47 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +46 -66
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +8 -29
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +13 -33
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +48 -67
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +0 -20
- 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 +1 -6
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +1 -6
- data/app/pb_kits/playbook/pb_body/_body.scss +3 -0
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +4 -3
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +1 -6
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +5 -0
- data/app/pb_kits/playbook/pb_card/card.rb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +20 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +41 -1
- 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 +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_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 +6 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -6
- 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.md +5 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +3 -3
- 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} +16 -11
- 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.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.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} +16 -11
- 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.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 +1 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +3 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +2 -6
- data/app/pb_kits/playbook/pb_dropdown/index.js +2 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +6 -14
- 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_form_group/_form_group.scss +15 -0
- 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.scss +8 -0
- 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.scss +1 -1
- 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/_title.scss +5 -1
- 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_weekday_stacked/weekday_stacked.html.erb +1 -6
- data/app/pb_kits/playbook/tokens/_titles.scss +5 -1
- 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 +2 -2
- metadata +42 -6
@@ -28,6 +28,7 @@ $pb_button_border_width: 0px;
|
|
28
28
|
font-size: $font_small;
|
29
29
|
font-weight: $bold;
|
30
30
|
text-align: center;
|
31
|
+
text-decoration: none;
|
31
32
|
vertical-align: middle;
|
32
33
|
text-transform: none;
|
33
34
|
border-width: $pb_button_border_width;
|
@@ -197,16 +198,16 @@ $pb_button_border_width: 0px;
|
|
197
198
|
|
198
199
|
// Dark Link =============
|
199
200
|
@mixin pb_button_link_dark {
|
200
|
-
@include pb_button_variant($transparent, $
|
201
|
+
@include pb_button_variant($transparent, $active_dark);
|
201
202
|
|
202
203
|
@media (hover:hover) {
|
203
204
|
&:hover {
|
204
205
|
@include pb_button_hover($transparent);
|
205
|
-
color: rgba($
|
206
|
+
color: rgba($active_dark, $opacity_6)
|
206
207
|
}
|
207
208
|
&:active {
|
208
209
|
transition: none;
|
209
|
-
@include pb_button_variant($transparent, $
|
210
|
+
@include pb_button_variant($transparent, $active_dark);
|
210
211
|
}
|
211
212
|
}
|
212
213
|
}
|
@@ -17,6 +17,11 @@ $additional_colors: (
|
|
17
17
|
"light": $bg_light,
|
18
18
|
"white": $white,
|
19
19
|
"none": none,
|
20
|
+
"success_subtle": $success_subtle,
|
21
|
+
"warning_subtle": $warning_subtle,
|
22
|
+
"error_subtle": $error_subtle,
|
23
|
+
"info_subtle": $info_subtle,
|
24
|
+
"neutral_subtle": $neutral_subtle,
|
20
25
|
);
|
21
26
|
$background_colors: map-merge($product_colors, $additional_colors);
|
22
27
|
$pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors), $category_colors);
|
@@ -15,7 +15,7 @@ module Playbook
|
|
15
15
|
values: %w[xs sm md lg xl none rounded],
|
16
16
|
default: "md"
|
17
17
|
prop :background, type: Playbook::Props::Enum,
|
18
|
-
values: %w[white light dark product_1_background product_1_highlight product_2_background product_2_highlight product_3_background product_3_highlight product_4_background product_4_highlight product_5_background product_5_highlight product_6_background product_6_highlight product_7_background product_7_highlight product_8_background product_8_highlight product_9_background product_9_highlight product_10_background product_10_highlight windows siding doors solar roofing gutters insulation none],
|
18
|
+
values: %w[white light dark product_1_background product_1_highlight product_2_background product_2_highlight product_3_background product_3_highlight product_4_background product_4_highlight product_5_background product_5_highlight product_6_background product_6_highlight product_7_background product_7_highlight product_8_background product_8_highlight product_9_background product_9_highlight product_10_background product_10_highlight windows siding doors solar roofing gutters insulation none success_subtle warning_subtle error_subtle info_subtle neutral_subtle],
|
19
19
|
default: "none"
|
20
20
|
|
21
21
|
def classname
|
@@ -42,3 +42,23 @@
|
|
42
42
|
dark: true
|
43
43
|
}) %>
|
44
44
|
<% end %>
|
45
|
+
|
46
|
+
<%= pb_rails("title", props: { text: "Subtle Status Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %>
|
47
|
+
|
48
|
+
<%= pb_rails("card", props: { background: "success_subtle", margin_bottom: "sm" }) do %>
|
49
|
+
<%= pb_rails("body", props: {
|
50
|
+
text: "Success Subtle"
|
51
|
+
}) %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<%= pb_rails("card", props: { background: "warning_subtle", margin_bottom: "sm" }) do %>
|
55
|
+
<%= pb_rails("body", props: {
|
56
|
+
text: "Warning Subtle"
|
57
|
+
}) %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<%= pb_rails("card", props: { background: "info_subtle", margin_bottom: "sm" }) do %>
|
61
|
+
<%= pb_rails("body", props: {
|
62
|
+
text: "Info Subtle"
|
63
|
+
}) %>
|
64
|
+
<% end %>
|
@@ -90,7 +90,47 @@ const CardBackground = (props) => {
|
|
90
90
|
/>
|
91
91
|
</Card>
|
92
92
|
|
93
|
-
|
93
|
+
|
94
|
+
<Title
|
95
|
+
{...props}
|
96
|
+
marginBottom="sm"
|
97
|
+
size={4}
|
98
|
+
tag="h4"
|
99
|
+
text="Subtle Status Colors"
|
100
|
+
/>
|
101
|
+
|
102
|
+
<Card
|
103
|
+
background="success_subtle"
|
104
|
+
marginBottom="sm"
|
105
|
+
{...props}
|
106
|
+
>
|
107
|
+
<Body
|
108
|
+
text="Success Subtle"
|
109
|
+
{...props}
|
110
|
+
/>
|
111
|
+
</Card>
|
112
|
+
|
113
|
+
<Card
|
114
|
+
background="warning_subtle"
|
115
|
+
marginBottom="sm"
|
116
|
+
{...props}
|
117
|
+
>
|
118
|
+
<Body
|
119
|
+
text="Warning Subtle"
|
120
|
+
{...props}
|
121
|
+
/>
|
122
|
+
</Card>
|
123
|
+
|
124
|
+
<Card
|
125
|
+
background="info_subtle"
|
126
|
+
marginBottom="sm"
|
127
|
+
{...props}
|
128
|
+
>
|
129
|
+
<Body
|
130
|
+
text="Info Subtle"
|
131
|
+
{...props}
|
132
|
+
/>
|
133
|
+
</Card>
|
94
134
|
</div>
|
95
135
|
)
|
96
136
|
}
|
@@ -1 +1 @@
|
|
1
|
-
Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">here</a> under Product Colors.
|
1
|
+
Add a background color by passing the color name to background. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">here</a> under Product Colors and Status: Subtle Variations.
|
@@ -1 +1 @@
|
|
1
|
-
Card headers pass category, product, and background colors only. List of all category, product, and background colors can be viewed <a href="https://playbook.powerapp.cloud/
|
1
|
+
Card headers pass category, product, and background colors only. List of all category, product, and background colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
|
@@ -1 +1 @@
|
|
1
|
-
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/
|
1
|
+
Card highlight can pass status, product, and category colors. List of all colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
|
@@ -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("button", props: {type: object.type, link: object.link, new_window:object.new_window, variant: object.variant, disabled: object.disabled, dark: object.dark}) do %>
|
8
3
|
<%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
|
9
4
|
<% end %>
|
@@ -9,6 +9,7 @@ import CollapsibleContent from './child_kits/CollapsibleContent'
|
|
9
9
|
import CollapsibleMain from './child_kits/CollapsibleMain'
|
10
10
|
import CollapsibleContext from './context'
|
11
11
|
import { IconSizes } from "../pb_icon/_icon"
|
12
|
+
import CollapsibleIcon from './child_kits/CollapsibleIcon'
|
12
13
|
|
13
14
|
|
14
15
|
type CollapsibleProps = {
|
@@ -52,12 +53,15 @@ const Collapsible = ({
|
|
52
53
|
if (CollapsibleParent.length !== 2) {
|
53
54
|
throw new Error('Collapsible requires <CollapsibleMain> and <CollapsibleContent> to function properly.')
|
54
55
|
}
|
56
|
+
const FirstChild = CollapsibleParent[0]
|
57
|
+
const SecondChild = CollapsibleParent[1]
|
55
58
|
|
56
|
-
const Main =
|
57
|
-
const Content =
|
59
|
+
const Main = FirstChild.type === CollapsibleMain ? FirstChild : null
|
60
|
+
const Content = SecondChild.type === CollapsibleContent ? SecondChild : null
|
58
61
|
|
59
|
-
|
60
|
-
const { children:
|
62
|
+
|
63
|
+
const { children: mainChildren = null, ...mainProps } = Main ? Main.props : {}
|
64
|
+
const { children: contentChildren = null, ...contentProps } = Content ? Content.props : {}
|
61
65
|
const ariaProps = buildAriaProps(aria)
|
62
66
|
const dataProps = buildDataProps(data)
|
63
67
|
const htmlProps = buildHtmlProps(htmlOptions)
|
@@ -75,13 +79,19 @@ const Collapsible = ({
|
|
75
79
|
className={classes}
|
76
80
|
id={id}
|
77
81
|
>
|
78
|
-
|
79
|
-
{
|
80
|
-
|
82
|
+
{Main ? (
|
83
|
+
<CollapsibleMain {...mainProps}>
|
84
|
+
{mainChildren}
|
85
|
+
</CollapsibleMain>
|
86
|
+
) : (
|
87
|
+
FirstChild
|
88
|
+
)}
|
81
89
|
|
82
|
-
|
83
|
-
{
|
84
|
-
|
90
|
+
{Content && (
|
91
|
+
<CollapsibleContent {...contentProps}>
|
92
|
+
{contentChildren}
|
93
|
+
</CollapsibleContent>
|
94
|
+
)}
|
85
95
|
</div>
|
86
96
|
</CollapsibleContext.Provider>
|
87
97
|
)
|
@@ -89,5 +99,6 @@ const Collapsible = ({
|
|
89
99
|
|
90
100
|
Collapsible.Main = CollapsibleMain
|
91
101
|
Collapsible.Content = CollapsibleContent
|
102
|
+
Collapsible.Icon = CollapsibleIcon
|
92
103
|
|
93
104
|
export default Collapsible
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import Icon, { IconSizes } from "../../pb_icon/_icon";
|
3
|
+
|
4
|
+
type IconColors =
|
5
|
+
| "default"
|
6
|
+
| "light"
|
7
|
+
| "lighter"
|
8
|
+
| "link"
|
9
|
+
| "error"
|
10
|
+
| "success";
|
11
|
+
|
12
|
+
type IconProps = {
|
13
|
+
collapsed: boolean | (() => void);
|
14
|
+
icon?: string[] | string;
|
15
|
+
iconColor?: IconColors;
|
16
|
+
iconSize?: IconSizes;
|
17
|
+
onIconClick?: () => void;
|
18
|
+
};
|
19
|
+
|
20
|
+
type colorMap = {
|
21
|
+
default: string;
|
22
|
+
light: string;
|
23
|
+
lighter: string;
|
24
|
+
link: string;
|
25
|
+
error: string;
|
26
|
+
success: string;
|
27
|
+
};
|
28
|
+
|
29
|
+
const colorMap = {
|
30
|
+
default: "#242B42",
|
31
|
+
light: "#687887",
|
32
|
+
lighter: "#C1CDD6",
|
33
|
+
link: "#0056CF",
|
34
|
+
error: "#FF2229",
|
35
|
+
success: "#00CA74",
|
36
|
+
};
|
37
|
+
|
38
|
+
const CollapsibleIcon = ({
|
39
|
+
collapsed,
|
40
|
+
icon,
|
41
|
+
iconSize,
|
42
|
+
iconColor,
|
43
|
+
onIconClick,
|
44
|
+
}: IconProps) => {
|
45
|
+
const color = colorMap[iconColor];
|
46
|
+
|
47
|
+
const showIcon = (icon: string | string[]) => {
|
48
|
+
if (typeof icon === "string") {
|
49
|
+
return [icon, icon];
|
50
|
+
}
|
51
|
+
return icon;
|
52
|
+
};
|
53
|
+
|
54
|
+
const handleIconClick = (e: React.MouseEvent<HTMLElement>) => {
|
55
|
+
if (onIconClick) {
|
56
|
+
e.stopPropagation();
|
57
|
+
onIconClick();
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
return (
|
62
|
+
<>
|
63
|
+
{collapsed ? (
|
64
|
+
<div
|
65
|
+
className="icon_wrapper"
|
66
|
+
key={icon ? showIcon(icon)[0] : "chevron-down"}
|
67
|
+
onClick={(e) => handleIconClick(e)}
|
68
|
+
style={{ verticalAlign: "middle", color: color }}
|
69
|
+
>
|
70
|
+
<Icon
|
71
|
+
icon={icon ? showIcon(icon)[0] : "chevron-down"}
|
72
|
+
size={iconSize}
|
73
|
+
/>
|
74
|
+
</div>
|
75
|
+
) : (
|
76
|
+
<div
|
77
|
+
className="icon_wrapper"
|
78
|
+
key={icon ? showIcon(icon)[1] : "chevron-up"}
|
79
|
+
onClick={(e) => handleIconClick(e)}
|
80
|
+
style={{ verticalAlign: "middle", color: color }}
|
81
|
+
>
|
82
|
+
<Icon
|
83
|
+
icon={icon ? showIcon(icon)[1] : "chevron-up"}
|
84
|
+
size={iconSize}
|
85
|
+
/>
|
86
|
+
</div>
|
87
|
+
)}
|
88
|
+
</>
|
89
|
+
);
|
90
|
+
};
|
91
|
+
|
92
|
+
export default CollapsibleIcon;
|
@@ -7,27 +7,9 @@ import { globalProps } from '../../utilities/globalProps'
|
|
7
7
|
|
8
8
|
import Flex from '../../pb_flex/_flex'
|
9
9
|
import FlexItem from '../../pb_flex/_flex_item'
|
10
|
-
import
|
10
|
+
import { IconSizes } from "../../pb_icon/_icon"
|
11
11
|
import CollapsibleContext from '../context'
|
12
|
-
|
13
|
-
|
14
|
-
type colorMap = {
|
15
|
-
default: string,
|
16
|
-
light: string,
|
17
|
-
lighter: string,
|
18
|
-
link: string,
|
19
|
-
error: string,
|
20
|
-
success: string
|
21
|
-
}
|
22
|
-
|
23
|
-
const colorMap = {
|
24
|
-
default: "#242B42",
|
25
|
-
light: "#687887",
|
26
|
-
lighter: "#C1CDD6",
|
27
|
-
link: "#0056CF",
|
28
|
-
error: "#FF2229",
|
29
|
-
success: "#00CA74",
|
30
|
-
}
|
12
|
+
import CollapsibleIcon from './CollapsibleIcon'
|
31
13
|
|
32
14
|
type CollapsibleMainProps = {
|
33
15
|
children: React.ReactNode[] | React.ReactNode,
|
@@ -38,60 +20,6 @@ type CollapsibleMainProps = {
|
|
38
20
|
}
|
39
21
|
type IconColors = "default" | "light" | "lighter" | "link" | "error" | "success"
|
40
22
|
|
41
|
-
type IconProps = {
|
42
|
-
collapsed: boolean | (()=> void)
|
43
|
-
icon?: string[] | string
|
44
|
-
iconColor?: IconColors
|
45
|
-
iconSize?: IconSizes
|
46
|
-
onIconClick?: ()=> void
|
47
|
-
}
|
48
|
-
|
49
|
-
const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, onIconClick }: IconProps) => {
|
50
|
-
const color = colorMap[iconColor]
|
51
|
-
|
52
|
-
const showIcon = (icon: string |string[]) => {
|
53
|
-
if (typeof icon === "string") {
|
54
|
-
return [icon, icon]
|
55
|
-
}
|
56
|
-
return icon
|
57
|
-
}
|
58
|
-
|
59
|
-
const handleIconClick = (e: React.MouseEvent<HTMLElement>) => {
|
60
|
-
if (onIconClick) {
|
61
|
-
e.stopPropagation();
|
62
|
-
onIconClick()
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
return (
|
67
|
-
<>
|
68
|
-
{collapsed ? (
|
69
|
-
<div
|
70
|
-
className="icon_wrapper"
|
71
|
-
key={icon ? showIcon(icon)[0] : "chevron-down"}
|
72
|
-
onClick={(e)=> handleIconClick(e)}
|
73
|
-
style={{ verticalAlign: "middle", color: color }}
|
74
|
-
>
|
75
|
-
<Icon icon={icon ? showIcon(icon)[0] : "chevron-down"}
|
76
|
-
size={iconSize}
|
77
|
-
/>
|
78
|
-
</div>
|
79
|
-
) : (
|
80
|
-
<div
|
81
|
-
className="icon_wrapper"
|
82
|
-
key={icon ? showIcon(icon)[1] : "chevron-up"}
|
83
|
-
onClick={(e)=> handleIconClick(e)}
|
84
|
-
style={{ verticalAlign: "middle", color: color }}
|
85
|
-
>
|
86
|
-
<Icon icon={icon ? showIcon(icon)[1] : "chevron-up"}
|
87
|
-
size={iconSize}
|
88
|
-
/>
|
89
|
-
</div>
|
90
|
-
)}
|
91
|
-
</>
|
92
|
-
);
|
93
|
-
}
|
94
|
-
|
95
23
|
const CollapsibleMain = ({
|
96
24
|
children,
|
97
25
|
className,
|
@@ -120,7 +48,7 @@ const CollapsibleMain = ({
|
|
120
48
|
>
|
121
49
|
<FlexItem>{children}</FlexItem>
|
122
50
|
<FlexItem>
|
123
|
-
<
|
51
|
+
<CollapsibleIcon
|
124
52
|
collapsed={collapsed as () => void}
|
125
53
|
icon={icon as string[] | string}
|
126
54
|
iconColor={iconColor as IconColors}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
aria: object.aria,
|
6
|
+
style: "color: #{object.icon_color};",
|
7
|
+
**combined_html_options) do %>
|
8
|
+
<% if object.icon.present? %>
|
9
|
+
<%= pb_rails("icon", props: { icon: object.show_icon(object.icon)[0], id:"collapsible_open_icon", size: object.size }) %>
|
10
|
+
<%= pb_rails("icon", props: { icon: object.show_icon(object.icon)[1], id:"collapsible_close_icon", size: object.size }) %>
|
11
|
+
<% else %>
|
12
|
+
<%= pb_rails("icon", props: { icon: "chevron-down", id:"collapsible_open_icon", size: object.size }) %>
|
13
|
+
<%= pb_rails("icon", props: { icon: "chevron-up", id:"collapsible_close_icon", size: object.size }) %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbCollapsible
|
5
|
+
class CollapsibleIcon < Playbook::KitBase
|
6
|
+
prop :collapsed, type: Playbook::Props::Boolean,
|
7
|
+
default: true
|
8
|
+
prop :color, type: Playbook::Props::Enum,
|
9
|
+
values: %w[default light lighter link success error],
|
10
|
+
default: "default"
|
11
|
+
prop :icon
|
12
|
+
prop :size, type: Playbook::Props::Enum,
|
13
|
+
values: ["lg", "xs", "sm", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x", nil],
|
14
|
+
default: nil
|
15
|
+
|
16
|
+
def classname
|
17
|
+
generate_classname("pb_collapsible_icon_kit", separator: " ")
|
18
|
+
end
|
19
|
+
|
20
|
+
def show_icon(icon)
|
21
|
+
case icon
|
22
|
+
when ::String
|
23
|
+
[icon, icon]
|
24
|
+
when ::Array
|
25
|
+
icon
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def icon_color
|
30
|
+
return "" if color.nil?
|
31
|
+
|
32
|
+
color_object = { light: "#687887", lighter: "#C1CDD6", link: "#0056CF", success: "#00CA74", error: "#FF2229", default: "#242B42" }
|
33
|
+
color_object[color.to_sym]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,9 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
id: object.id,
|
3
|
-
data: object.data,
|
4
|
-
class: object.classname,
|
5
|
-
aria: object.aria,
|
6
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
7
2
|
|
8
3
|
<%= pb_rails("flex", props: {vertical: "center", spacing: "between", cursor: "pointer"}) do %>
|
9
4
|
<%= pb_rails("flex/flex_item") do %>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Collapsible, useCollapsible, Background, Flex, Title, List, ListItem } from '../..'
|
3
|
+
|
4
|
+
const CollapsibleCustomMain = () => {
|
5
|
+
const [isCollapsed, setIsCollapsed] = useCollapsible(true)
|
6
|
+
|
7
|
+
return (
|
8
|
+
<>
|
9
|
+
<Collapsible
|
10
|
+
collapsed={isCollapsed}
|
11
|
+
>
|
12
|
+
<Background
|
13
|
+
backgroundColor="white"
|
14
|
+
cursor="pointer"
|
15
|
+
htmlOptions={{onClick:() => setIsCollapsed(!isCollapsed)}}
|
16
|
+
position="sticky"
|
17
|
+
top="0"
|
18
|
+
>
|
19
|
+
<Flex
|
20
|
+
align="center"
|
21
|
+
gap="sm"
|
22
|
+
justify="between"
|
23
|
+
>
|
24
|
+
<Title
|
25
|
+
size={4}
|
26
|
+
text="Custom Main Section"
|
27
|
+
/>
|
28
|
+
</Flex>
|
29
|
+
</Background>
|
30
|
+
<Collapsible.Content padding="none">
|
31
|
+
<div>
|
32
|
+
<List>
|
33
|
+
<ListItem
|
34
|
+
align="stretch"
|
35
|
+
flexDirection="column"
|
36
|
+
>
|
37
|
+
Checklist item
|
38
|
+
</ListItem>
|
39
|
+
<ListItem
|
40
|
+
align="stretch"
|
41
|
+
flexDirection="column"
|
42
|
+
>
|
43
|
+
Checklist item
|
44
|
+
</ListItem>
|
45
|
+
<ListItem
|
46
|
+
align="stretch"
|
47
|
+
flexDirection="column"
|
48
|
+
>
|
49
|
+
Checklist item
|
50
|
+
</ListItem>
|
51
|
+
<ListItem
|
52
|
+
align="stretch"
|
53
|
+
flexDirection="column"
|
54
|
+
>
|
55
|
+
Checklist item
|
56
|
+
</ListItem>
|
57
|
+
<ListItem
|
58
|
+
align="stretch"
|
59
|
+
flexDirection="column"
|
60
|
+
>
|
61
|
+
Checklist item
|
62
|
+
</ListItem>
|
63
|
+
</List>
|
64
|
+
</div>
|
65
|
+
</Collapsible.Content>
|
66
|
+
</Collapsible>
|
67
|
+
|
68
|
+
</>
|
69
|
+
)
|
70
|
+
}
|
71
|
+
|
72
|
+
export default CollapsibleCustomMain
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Optionally replace your `Collapsible.Main` with any component to customize your Main section's contents and/or style. This gives you full control over that subcomponent. For example, here we are using global props to make that custom Main 'sticky' on scroll.
|
2
|
+
|
3
|
+
__NOTE__: Custom main sections requires the `useCollapsible` hook to ensure the collapsible's toggle action works correctly.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= pb_rails("collapsible", props: { name: "default-example" }) do %>
|
2
|
+
<%= pb_rails("background", props: { background_color: "white", position: "sticky", top: "0", cursor:"pointer", data: {"collapsible-main": "true"} }) do %>
|
3
|
+
<%= pb_rails("flex", props: {align:"center", gap:"sm", justify:"between"}) do %>
|
4
|
+
<%= pb_rails("title", props: { text: "Custom Main Section", tag: "h4", size: 4 }) %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
<%= pb_rails("flex", props: { align: "center", justify: "between" }) do %>
|
8
|
+
<% end %>
|
9
|
+
<%= pb_rails("collapsible/collapsible_content", props: { padding: "none" }) do %>
|
10
|
+
<%= pb_rails("list", props: {ordered: false, dark: false, borderless: false}) do %>
|
11
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
12
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
13
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
14
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
15
|
+
<%= pb_rails("list/item") do %> Checklist Item <% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Optionally replace your `collapsible/collapsible_main` with any component to customize your Main section's contents and/or style. This gives you full control over that subcomponent. For example, here we are using global props to make that custom Main 'sticky' on scroll.
|
2
|
+
|
3
|
+
__NOTE__: Custom main sections require `data: {"collapsible-main": "true"}` to ensure the collapsible's toggle action works correctly.
|