playbook_ui 13.27.0.pre.alpha.PBNTR48phonenumberform2852 → 13.27.0.pre.alpha.PLAY888Cardkithighlightoverflowtooltiperror2930

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -5
  3. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -5
  4. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -5
  6. data/app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx +16 -0
  7. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +16 -0
  8. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_avatar/avatar.rb +4 -0
  10. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +47 -0
  11. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +46 -66
  12. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +8 -29
  13. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.md +3 -0
  14. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +13 -33
  15. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +48 -67
  16. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.md +3 -0
  17. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +0 -20
  18. data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -2
  19. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +1 -6
  20. data/app/pb_kits/playbook/pb_badge/badge.html.erb +1 -6
  21. data/app/pb_kits/playbook/pb_body/_body.scss +3 -0
  22. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -1
  23. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +4 -3
  24. data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +1 -6
  25. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
  26. data/app/pb_kits/playbook/pb_card/_card.scss +1 -1
  27. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +5 -0
  28. data/app/pb_kits/playbook/pb_card/card.rb +1 -1
  29. data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +20 -0
  30. data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +41 -1
  31. data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
  32. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
  33. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  34. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  35. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -6
  36. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +21 -10
  37. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +92 -0
  38. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +3 -75
  39. data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -6
  40. data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +1 -6
  41. data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.html.erb +15 -0
  42. data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.rb +37 -0
  43. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -6
  44. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +72 -0
  45. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.md +3 -0
  46. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +19 -0
  47. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.md +3 -0
  48. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +73 -0
  49. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.md +3 -0
  50. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +20 -0
  51. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.md +3 -0
  52. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -0
  53. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +3 -1
  54. data/app/pb_kits/playbook/pb_collapsible/index.js +16 -6
  55. data/app/pb_kits/playbook/pb_contact/contact.html.erb +1 -6
  56. data/app/pb_kits/playbook/pb_currency/currency.html.erb +1 -6
  57. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +1 -6
  58. data/app/pb_kits/playbook/pb_date/date.html.erb +1 -6
  59. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +1 -5
  60. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +61 -0
  61. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +11 -0
  62. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +4 -1
  63. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +1 -5
  64. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +1 -5
  65. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold_swift.md +32 -0
  66. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +17 -0
  67. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +19 -0
  68. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +10 -0
  69. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +17 -0
  70. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +7 -0
  71. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -6
  72. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +39 -0
  73. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +39 -0
  74. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +15 -0
  75. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +78 -0
  76. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +6 -0
  77. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +1 -6
  78. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +1 -5
  79. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default_swift.md +20 -0
  80. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_props_swift.md +6 -0
  81. data/app/pb_kits/playbook/pb_date_year_stacked/docs/example.yml +4 -0
  82. data/app/pb_kits/playbook/pb_detail/_detail_mixins.scss +1 -1
  83. data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +3 -3
  84. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +6 -1
  85. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -6
  86. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +3 -3
  87. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -1
  88. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +5 -6
  89. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +3 -3
  90. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.md +6 -0
  91. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -3
  92. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -3
  93. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_display.html.erb → _dropdown_with_custom_display_rails.html.erb} +11 -6
  94. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +5 -0
  95. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +5 -2
  96. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -1
  97. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_options.html.erb → _dropdown_with_custom_options_rails.html.erb} +16 -11
  98. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.md +1 -0
  99. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
  100. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -1
  101. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +5 -2
  102. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +1 -1
  103. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_trigger.html.erb → _dropdown_with_custom_trigger_rails.html.erb} +16 -11
  104. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.md +1 -0
  105. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
  106. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -1
  107. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -6
  108. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +1 -0
  109. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -0
  110. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
  111. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +3 -9
  112. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +2 -6
  113. data/app/pb_kits/playbook/pb_dropdown/index.js +2 -1
  114. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +6 -14
  115. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +23 -0
  116. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +7 -0
  117. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +9 -0
  118. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +22 -0
  119. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +9 -0
  120. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +62 -0
  121. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +8 -0
  122. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
  123. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -6
  124. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +15 -0
  125. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +1 -6
  126. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +1 -6
  127. data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +1 -6
  128. data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +1 -6
  129. data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +1 -6
  130. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -5
  131. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -6
  132. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +8 -0
  133. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -6
  134. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +1 -6
  135. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +1 -1
  136. data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +1 -6
  137. data/app/pb_kits/playbook/pb_person/person.html.erb +1 -6
  138. data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +1 -6
  139. data/app/pb_kits/playbook/pb_pill/pill.html.erb +1 -6
  140. data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +1 -6
  141. data/app/pb_kits/playbook/pb_select/_select.scss +8 -0
  142. data/app/pb_kits/playbook/pb_source/source.html.erb +1 -5
  143. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +1 -5
  144. data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +1 -5
  145. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +19 -0
  146. data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +1 -5
  147. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +1 -5
  148. data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -5
  149. data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +1 -5
  150. data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +1 -6
  151. data/app/pb_kits/playbook/pb_title/_title.scss +5 -1
  152. data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +1 -6
  153. data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +1 -5
  154. data/app/pb_kits/playbook/pb_tooltip/index.js +1 -0
  155. data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +1 -6
  156. data/app/pb_kits/playbook/tokens/_titles.scss +5 -1
  157. data/dist/menu.yml +2 -2
  158. data/dist/playbook-rails.js +5 -5
  159. data/lib/playbook/kit_base.rb +1 -1
  160. data/lib/playbook/version.rb +1 -1
  161. metadata +43 -6
@@ -1,8 +1,3 @@
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 %>
1
+ <%= pb_content_tag do %>
7
2
  <span><%= object.text %></span>
8
3
  <% end %>
@@ -45,6 +45,9 @@
45
45
  }
46
46
 
47
47
  &[class*=dark] {
48
+ a {
49
+ color: $active_dark;
50
+ }
48
51
  @include pb_body_dark();
49
52
  @each $dark_color_name, $dark_color_value in $pb_dark_body_colors{
50
53
  &[class*=_#{$dark_color_name}][class*=dark]{
@@ -15,7 +15,7 @@ $pb_dark_body_colors: (
15
15
  default: $text_dk_default,
16
16
  light: $text_dk_light,
17
17
  lighter: $text_dk_lighter,
18
- link: $primary_action_dark,
18
+ link: $active_dark,
19
19
  error: $error,
20
20
  success: $text_dk_success_sm,
21
21
  );
@@ -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, $white);
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($white, $opacity_6)
206
+ color: rgba($active_dark, $opacity_6)
206
207
  }
207
208
  &:active {
208
209
  transition: none;
209
- @include pb_button_variant($transparent, $white);
210
+ @include pb_button_variant($transparent, $active_dark);
210
211
  }
211
212
  }
212
213
  }
@@ -1,8 +1,3 @@
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 %>
1
+ <%= pb_content_tag do %>
7
2
  <%= content.presence || object.text %>
8
3
  <% end %>
@@ -13,7 +13,7 @@ $pb_caption_colors: (
13
13
  $pb_dark_caption_colors: (
14
14
  default: $text_dk_default,
15
15
  light: $text_dk_light,
16
- link: $primary,
16
+ link: $active_dark,
17
17
  success: $text_dk_success_sm,
18
18
  error: $error,
19
19
  );
@@ -81,4 +81,4 @@
81
81
  }
82
82
  }
83
83
  }
84
- }
84
+ }
@@ -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.
@@ -67,4 +67,4 @@
67
67
  <%= pb_rails("card/card_body", props: { padding: "md", }) do %>
68
68
  Body
69
69
  <% end %>
70
- <% end %>
70
+ <% end %>
@@ -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/utilities" target="_blank">here</a>.
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/utilities" target="_blank">here</a>.
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
- <%= content_tag(:div,
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 = CollapsibleParent[0]
57
- const Content = CollapsibleParent[1]
59
+ const Main = FirstChild.type === CollapsibleMain ? FirstChild : null
60
+ const Content = SecondChild.type === CollapsibleContent ? SecondChild : null
58
61
 
59
- const { children: mainChildren, ...mainProps } = Main.props
60
- const { children: contentChildren, ...contentProps } = Content.props
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
- <CollapsibleMain {...mainProps}>
79
- {mainChildren}
80
- </CollapsibleMain>
82
+ {Main ? (
83
+ <CollapsibleMain {...mainProps}>
84
+ {mainChildren}
85
+ </CollapsibleMain>
86
+ ) : (
87
+ FirstChild
88
+ )}
81
89
 
82
- <CollapsibleContent {...contentProps}>
83
- {contentChildren}
84
- </CollapsibleContent>
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 Icon, { IconSizes } from "../../pb_icon/_icon"
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
- <ToggleIcon
51
+ <CollapsibleIcon
124
52
  collapsed={collapsed as () => void}
125
53
  icon={icon as string[] | string}
126
54
  iconColor={iconColor as IconColors}
@@ -1,8 +1,3 @@
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 %>
1
+ <%= pb_content_tag do %>
7
2
  <%= content.presence %>
8
3
  <% end %>
@@ -1,8 +1,3 @@
1
- <%= content_tag(:div,
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
  <%= content.presence %>
8
3
  <% end %>
@@ -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
- <%= content_tag(:div,
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.