playbook_ui 13.25.0.pre.alpha.PBNTR291Dropdownrailsv22812 β†’ 13.25.0.pre.alpha.PLAY761globalpaddingpropsbuttons2713

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +0 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +14 -10
  4. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +9 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +6 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +6 -2
  7. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +6 -1
  8. data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
  9. data/app/pb_kits/playbook/pb_badge/badge.html.erb +6 -1
  10. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
  11. data/app/pb_kits/playbook/pb_body/_body.tsx +1 -1
  12. data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
  13. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
  14. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +7 -2
  15. data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
  16. data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +7 -2
  17. data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
  18. data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
  19. data/app/pb_kits/playbook/pb_card/card_body.html.erb +6 -1
  20. data/app/pb_kits/playbook/pb_card/card_header.html.erb +6 -1
  21. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +0 -49
  22. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +0 -3
  23. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
  24. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -2
  25. data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +0 -14
  26. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +0 -2
  27. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +0 -1
  28. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +6 -1
  29. data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +6 -1
  30. data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +6 -1
  31. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +7 -1
  32. data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -1
  33. data/app/pb_kits/playbook/pb_currency/currency.html.erb +6 -1
  34. data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -5
  35. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +6 -1
  36. data/app/pb_kits/playbook/pb_date/date.html.erb +6 -1
  37. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -2
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.md +1 -3
  39. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.md +1 -3
  40. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
  41. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +5 -1
  42. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +5 -1
  43. data/app/pb_kits/playbook/pb_date_range_stacked/docs/example.yml +0 -4
  44. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +5 -1
  45. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +6 -1
  46. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +7 -1
  47. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +5 -1
  48. data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
  49. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -4
  50. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
  51. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +7 -2
  52. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -1
  53. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -2
  54. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +35 -101
  55. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +26 -93
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +22 -4
  57. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -6
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +9 -6
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +5 -5
  60. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -16
  61. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -7
  62. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +10 -200
  63. data/app/pb_kits/playbook/pb_dropdown/hooks/useDropdown.tsx +2 -2
  64. data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +9 -14
  65. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +8 -22
  66. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +29 -56
  67. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +68 -130
  68. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +7 -9
  69. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +6 -1
  70. data/app/pb_kits/playbook/pb_filter/filter.html.erb +5 -1
  71. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +6 -1
  72. data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
  73. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -2
  74. data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +6 -1
  75. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  76. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
  77. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
  78. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
  79. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +7 -2
  80. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +6 -1
  81. data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +6 -1
  82. data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +6 -1
  83. data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +6 -1
  84. data/app/pb_kits/playbook/pb_layout/body.html.erb +5 -1
  85. data/app/pb_kits/playbook/pb_layout/footer.html.erb +5 -1
  86. data/app/pb_kits/playbook/pb_layout/header.html.erb +5 -1
  87. data/app/pb_kits/playbook/pb_layout/item.html.erb +5 -1
  88. data/app/pb_kits/playbook/pb_layout/layout.html.erb +5 -1
  89. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +5 -1
  90. data/app/pb_kits/playbook/pb_list/item.html.erb +8 -2
  91. data/app/pb_kits/playbook/pb_list/list.html.erb +8 -2
  92. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +6 -1
  93. data/app/pb_kits/playbook/pb_message/message.html.erb +6 -1
  94. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -1
  95. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
  96. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +6 -1
  97. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -1
  98. data/app/pb_kits/playbook/pb_nav/item.html.erb +14 -3
  99. data/app/pb_kits/playbook/pb_nav/nav.html.erb +6 -1
  100. data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -2
  101. data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +6 -1
  102. data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -1
  103. data/app/pb_kits/playbook/pb_person/person.html.erb +12 -7
  104. data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +6 -1
  105. data/app/pb_kits/playbook/pb_pill/pill.html.erb +6 -1
  106. data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
  107. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +6 -2
  108. data/app/pb_kits/playbook/pb_progress_simple/docs/example.yml +0 -2
  109. data/app/pb_kits/playbook/pb_progress_simple/docs/index.js +0 -1
  110. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +6 -3
  111. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +1 -1
  112. data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
  113. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
  114. data/app/pb_kits/playbook/pb_radio/_radio.scss +0 -35
  115. data/app/pb_kits/playbook/pb_radio/_radio.tsx +0 -3
  116. data/app/pb_kits/playbook/pb_radio/docs/_radio_alignment.jsx +1 -4
  117. data/app/pb_kits/playbook/pb_radio/docs/_radio_default.jsx +1 -4
  118. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.jsx +1 -2
  119. data/app/pb_kits/playbook/pb_radio/docs/example.yml +0 -2
  120. data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
  121. data/app/pb_kits/playbook/pb_radio/radio.html.erb +8 -2
  122. data/app/pb_kits/playbook/pb_radio/radio.rb +0 -5
  123. data/app/pb_kits/playbook/pb_radio/radio.test.js +0 -17
  124. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +2 -6
  125. data/app/pb_kits/playbook/pb_section_separator/_section_separator_mixin.scss +1 -11
  126. data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +6 -1
  127. data/app/pb_kits/playbook/pb_select/select.html.erb +5 -1
  128. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +5 -1
  129. data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +4 -1
  130. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +5 -1
  131. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +6 -1
  132. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +6 -1
  133. data/app/pb_kits/playbook/pb_source/source.html.erb +5 -1
  134. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +5 -1
  135. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +5 -1
  136. data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +5 -1
  137. data/app/pb_kits/playbook/pb_table/table.html.erb +12 -2
  138. data/app/pb_kits/playbook/pb_table/table_body.html.erb +16 -6
  139. data/app/pb_kits/playbook/pb_table/table_cell.html.erb +16 -6
  140. data/app/pb_kits/playbook/pb_table/table_head.html.erb +16 -6
  141. data/app/pb_kits/playbook/pb_table/table_header.html.erb +13 -4
  142. data/app/pb_kits/playbook/pb_table/table_row.html.erb +16 -6
  143. data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +5 -1
  144. data/app/pb_kits/playbook/pb_time/time.html.erb +5 -1
  145. data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +5 -1
  146. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +5 -1
  147. data/app/pb_kits/playbook/pb_timeline/item.html.erb +7 -3
  148. data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +5 -1
  149. data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +6 -1
  150. data/app/pb_kits/playbook/pb_title/title.html.erb +6 -1
  151. data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +6 -1
  152. data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +5 -1
  153. data/app/pb_kits/playbook/pb_toggle/toggle.html.erb +6 -1
  154. data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +5 -1
  155. data/app/pb_kits/playbook/pb_user/user.html.erb +6 -1
  156. data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +6 -1
  157. data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +6 -1
  158. data/app/pb_kits/playbook/playbook-rails.js +0 -3
  159. data/dist/playbook-rails.js +5 -5
  160. data/lib/playbook/kit_base.rb +1 -1
  161. data/lib/playbook/version.rb +1 -1
  162. metadata +2 -50
  163. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_disabled.html.erb +0 -23
  164. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_disabled.jsx +0 -29
  165. data/app/pb_kits/playbook/pb_currency/docs/_currency_alignment_swift.md +0 -43
  166. data/app/pb_kits/playbook/pb_currency/docs/_currency_props_swift.md +0 -12
  167. data/app/pb_kits/playbook/pb_currency/docs/_currency_size_swift.md +0 -31
  168. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_date_range_stacked_default_swift.md +0 -14
  169. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_date_range_stacked_props_swift.md +0 -9
  170. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
  171. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +0 -1
  172. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.html.erb +0 -17
  173. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +0 -42
  174. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +0 -7
  175. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +0 -84
  176. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.md +0 -1
  177. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +0 -101
  178. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.md +0 -1
  179. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.html.erb +0 -60
  180. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +0 -5
  181. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.html.erb +0 -45
  182. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +0 -1
  183. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +0 -17
  184. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +0 -48
  185. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +0 -1
  186. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.html.erb +0 -47
  187. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +0 -1
  188. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +0 -59
  189. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_hook.jsx +0 -72
  190. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +0 -10
  191. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +0 -39
  192. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +0 -1
  193. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -21
  194. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -20
  195. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +0 -15
  196. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +0 -19
  197. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +0 -22
  198. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +0 -22
  199. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +0 -38
  200. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +0 -30
  201. data/app/pb_kits/playbook/pb_dropdown/index.js +0 -154
  202. data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +0 -77
  203. data/app/pb_kits/playbook/pb_dropdown/scss_partials/_dropdown_animation.scss +0 -18
  204. data/app/pb_kits/playbook/pb_dropdown/utilities/clickOutsideHelper.tsx +0 -41
  205. data/app/pb_kits/playbook/pb_dropdown/utilities/index.ts +0 -2
  206. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.html.erb +0 -3
  207. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.jsx +0 -16
  208. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.md +0 -1
  209. data/app/pb_kits/playbook/pb_radio/docs/_radio_disabled.html.erb +0 -26
  210. data/app/pb_kits/playbook/pb_radio/docs/_radio_disabled.jsx +0 -31
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= pb_rails("title", props: { text: object.day_month, size: 4, dark: object.dark }) %>
3
7
  <%= pb_rails("body", props: { text: object.year, size: 4, color: "light", dark: object.dark }) %>
4
8
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag(object.tag) do %>
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <%= object.content %>
3
8
  <% end %>
@@ -235,11 +235,11 @@
235
235
  height: $space_xl * 2;
236
236
  }
237
237
  .dialog_footer {
238
- position: fixed;
238
+ position:fixed;
239
239
  bottom: 0;
240
240
  background-color: $white;
241
- max-width: 100%;
242
241
  }
242
+
243
243
  &[class*="_sm"] {
244
244
  width: $medium;
245
245
  .dialog_footer {
@@ -319,7 +319,6 @@
319
319
  position:fixed;
320
320
  bottom: 0;
321
321
  background-color: $white;
322
- max-width: 100%;
323
322
  }
324
323
  &[class*="_sm"] {
325
324
  width: $medium;
@@ -373,4 +372,3 @@
373
372
  cursor: pointer;
374
373
  }
375
374
  }
376
-
@@ -1,5 +1,10 @@
1
1
  <div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
2
- <%= pb_content_tag(:dialog) do %>
2
+ <%= content_tag(:dialog,
3
+ aria: object.aria,
4
+ data: object.data,
5
+ id: object.id,
6
+ class: object.classname,
7
+ **combined_html_options) do %>
3
8
  <% if object.status === "" && object.title %>
4
9
  <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
5
10
  <% end %>
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag do %>
2
- <%= content.presence || object.text %>
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 %>
7
+ <%= content.presence || object.text %>
3
8
  <% end %>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ aria: object.aria,
5
+ **combined_html_options) do %>
2
6
  <% if object.confirm_button && object.cancel_button %>
3
7
  <div class="dialog-pseudo-footer"></div>
4
8
  <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
@@ -1,5 +1,9 @@
1
- <%= pb_content_tag(:div,
2
- class: object.sticky_header) do %>
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.sticky_header,
5
+ aria: object.aria,
6
+ **combined_html_options) do %>
3
7
  <%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
4
8
  <%= content.presence || object.title %>
5
9
 
@@ -5,51 +5,46 @@
5
5
  @import "../tokens/shadows";
6
6
  @import "../tokens/positioning";
7
7
  @import "../pb_body/body_mixins";
8
- @import "../pb_textarea/textarea_mixin";
9
-
10
- @import "./scss_partials/dropdown_animation";
11
8
 
12
9
  .pb_dropdown {
13
10
  .dropdown_wrapper {
14
- [class*="dropdown_trigger_wrapper"] {
11
+ position: relative;
12
+ .dropdown_trigger_wrapper {
15
13
  @include pb_body;
16
14
  border: 1px solid $border_light;
17
15
  background-color: $white;
18
- height: 45px;
16
+ box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
19
17
  @media (hover: hover) {
20
18
  &:hover,
21
19
  &:active,
22
20
  &:focus {
23
21
  background-color: $focus_input_light;
24
- input {
25
- background-color: $focus_input_light;
26
- }
22
+ }
23
+ input {
24
+ background-color: $focus_input_light;
27
25
  }
28
26
  }
29
27
 
30
28
  .dropdown_input {
31
29
  @include pb_body;
32
30
  border: unset;
31
+ border-radius: $border_rad_heavier;
33
32
  padding: 0;
34
- background-color: $white;
33
+
35
34
  &:focus-visible {
36
35
  outline: none;
37
36
  }
38
37
  }
39
38
  &:focus {
40
- box-shadow: 0px 0px 0 1px $primary !important;
39
+ box-shadow: 0px 0px 0 1px $primary;
41
40
  outline: unset;
42
41
  transition: box-shadow 0.15s ease-in-out;
43
42
  }
43
+ }
44
44
 
45
- &[class*="_select_only"] {
46
- box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
47
- }
48
-
49
- &[class*="_focus"] {
50
- box-shadow: 0px 0px 0 1px $primary !important;
51
- transition: box-shadow 0.1s ease-in-out;
52
- }
45
+ .dropdown_trigger_wrapper_focus {
46
+ box-shadow: 0px 0px 0 1px $primary;
47
+ transition: box-shadow .10s ease-in-out;
53
48
  }
54
49
 
55
50
  .pb_dropdown_container {
@@ -59,106 +54,45 @@
59
54
  border-radius: $border_rad_heavier;
60
55
  border: 1px solid $border_light;
61
56
  margin-top: $space_xs;
57
+ position: absolute;
62
58
  z-index: $z_1;
63
59
  width: 100%;
60
+ transition: opacity 0.25s ease-in-out;
64
61
 
65
- [class*="pb_dropdown_option"] {
66
- cursor: pointer;
67
- &:hover {
68
- background-color: $border_light;
69
- }
70
-
71
- &[class*="_focused"] {
62
+ .pb_dropdown_option {
63
+ :hover {
72
64
  background-color: $border_light;
73
65
  }
66
+ }
74
67
 
75
- &[class*="_list"] {
76
- border-bottom: 1px solid $border_light;
77
- }
78
- &[class*="selected"] {
79
- background-color: $primary;
80
- [class^="pb_body"],
81
- [class^="pb_title_kit"] {
82
- color: $white !important;
83
- }
84
- &:hover {
85
- background-color: $primary !important;
86
- }
87
- }
68
+ .dropdown_option_focused {
69
+ background-color: $border_light;
88
70
  }
89
71
 
90
- .dropdown_option_wrapper {
72
+ .dropdown_option {
91
73
  width: 100%;
92
74
  }
93
- }
94
- .close {
95
- display: none;
96
- animation-name: fadeOut;
97
- animation-duration: 150ms;
98
- animation-timing-function: linear;
99
- animation-fill-mode: forwards;
100
- }
101
-
102
- .open {
103
- display: block;
104
- animation-name: fadeIn;
105
- animation-duration: 150ms;
106
- animation-timing-function: linear;
107
- animation-fill-mode: forwards;
108
- }
109
- }
110
75
 
111
- &.dark {
112
- .dropdown_wrapper {
113
- [class*="dropdown_trigger_wrapper"] {
114
- @include pb_body_light_dark;
115
- background-color: rgba($white, 0.1) !important;
116
- background: none;
117
- border-color: rgba($white, 0.15);
118
- @media (hover: hover) {
119
- &:hover,
120
- &:active,
121
- &:focus {
122
- background-color: rgba($white, 0.05) !important;
123
- }
124
- }
125
- [class^="pb_body"] {
126
- color: $white;
127
- }
128
- &[class*="_select_only"] {
129
- box-shadow: inset 0 -11px 20px rgba($white, 0.05);
76
+ .dropdown_option_list {
77
+ border-bottom: 1px solid $border_light;
78
+ }
79
+ .dropdown_option_selected {
80
+ background-color: $primary;
81
+ [class^="pb_body"],
82
+ [class^="pb_title_kit"] {
83
+ color: $white !important;
130
84
  }
131
- .dropdown_input {
85
+ :hover {
132
86
  background-color: unset;
133
- color: $white;
134
87
  }
135
88
  }
136
89
  }
137
- .pb_dropdown_container {
138
- background-color: $bg_dark !important;
139
- border-color: rgba($white, 0.15);
140
- color: $white;
141
- [class^="pb_body"],
142
- [class^="pb_title_kit"] {
143
- color: $white !important;
144
- }
145
-
146
- [class*="pb_dropdown_option"] {
147
- &:hover {
148
- background-color: $hover_dark;
149
- }
150
-
151
- &[class*="_focused"] {
152
- background-color: $hover_dark;
153
- }
90
+ .close {
91
+ display: none;
92
+ }
154
93
 
155
- &[class*="_list"] {
156
- border-color: rgba($white, 0.15);
157
- }
158
- &[class*="selected"] {
159
- background-color: $primary;
160
- }
161
- }
94
+ .open {
95
+ display: block;
162
96
  }
163
97
  }
164
98
  }
@@ -1,38 +1,31 @@
1
- import React, { useState, useRef, useEffect } from "react";
1
+ import React, { useState, useRef, useEffect, ReactElement } from "react";
2
2
  import classnames from "classnames";
3
- import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
3
+ import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
4
4
  import { globalProps } from "../utilities/globalProps";
5
- import { GenericObject } from "../types";
6
5
 
7
6
  import Body from "../pb_body/_body";
8
- import Caption from "../pb_caption/_caption";
9
7
 
10
8
  import DropdownContainer from "./subcomponents/DropdownContainer";
11
- import DropdownContext from "./context";
12
9
  import DropdownOption from "./subcomponents/DropdownOption";
13
10
  import DropdownTrigger from "./subcomponents/DropdownTrigger";
11
+ import DropdownContext from "./context";
14
12
  import useDropdown from "./hooks/useDropdown";
15
13
 
16
14
  import {
17
15
  separateChildComponents,
18
16
  prepareSubcomponents,
19
- handleClickOutside,
20
- } from "./utilities";
17
+ } from "./utilities/subComponentHelper";
18
+ import { GenericObject } from "../types";
21
19
 
22
20
  type DropdownProps = {
23
21
  aria?: { [key: string]: string };
24
22
  autocomplete?: boolean;
25
- children?: React.ReactChild[] | React.ReactChild | React.ReactElement[];
26
23
  className?: string;
27
- dark?: boolean;
28
24
  data?: { [key: string]: string };
29
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
30
25
  id?: string;
31
- isClosed?: boolean;
32
- label?: string;
33
- onSelect?: (arg: GenericObject) => null;
26
+ children?: React.ReactChild[] | React.ReactChild | ReactElement[];
34
27
  options: GenericObject;
35
- triggerRef?: any;
28
+ onSelect?: (arg: GenericObject) => null;
36
29
  };
37
30
 
38
31
  const Dropdown = (props: DropdownProps) => {
@@ -41,66 +34,49 @@ const Dropdown = (props: DropdownProps) => {
41
34
  autocomplete = false,
42
35
  children,
43
36
  className,
44
- dark = false,
45
37
  data = {},
46
- htmlOptions = {},
47
38
  id,
48
- isClosed = true,
49
- label,
50
- onSelect,
51
39
  options,
52
- triggerRef
40
+ onSelect,
53
41
  } = props;
54
42
 
55
43
  const ariaProps = buildAriaProps(aria);
56
44
  const dataProps = buildDataProps(data);
57
- const htmlProps = buildHtmlProps(htmlOptions);
58
45
  const classes = classnames(
59
46
  buildCss("pb_dropdown"),
60
47
  globalProps(props),
61
48
  className
62
49
  );
63
50
 
64
- const [isDropDownClosed, setIsDropDownClosed, toggleDropdown] = useDropdown(isClosed);
51
+ const [isDropDownClosed, setIsDropDownClosed, toggleDropdown] = useDropdown();
65
52
 
66
53
  const [filterItem, setFilterItem] = useState("");
67
- const [selected, setSelected] = useState<GenericObject>({});
54
+ const [selected, setSelected] = useState({});
68
55
  const [isInputFocused, setIsInputFocused] = useState(false);
69
56
  const [hasTriggerSubcomponent, setHasTriggerSubcomponent] = useState(true);
70
57
  const [hasContainerSubcomponent, setHasContainerSubcomponent] =
71
58
  useState(true);
59
+
72
60
  //state for keyboard events
73
61
  const [focusedOptionIndex, setFocusedOptionIndex] = useState(-1);
74
62
 
75
63
  const dropdownRef = useRef(null);
76
64
  const inputRef = useRef(null);
77
- const inputWrapperRef = useRef(null);
78
- const dropdownContainerRef = useRef(null);
79
65
 
80
66
  const { trigger, container, otherChildren } =
81
67
  separateChildComponents(children);
82
68
 
69
+ // useEffect to handle clicks outside the dropdown
83
70
  useEffect(() => {
84
- // Set the parent element of the trigger to relative to allow for absolute positioning of the dropdown
85
- //Only needed for when useDropdown hook used with external trigger
86
- if (triggerRef?.current) {
87
- const parentElement = triggerRef.current.parentNode;
88
- if (parentElement) {
89
- parentElement.style.position = 'relative';
71
+ const handleClickOutside = (e: MouseEvent) => {
72
+ if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
73
+ setIsDropDownClosed(true);
74
+ setIsInputFocused(false);
90
75
  }
91
- }
92
- // Handle clicks outside the dropdown
93
- const handleClick = handleClickOutside({
94
- inputWrapperRef,
95
- dropdownContainerRef,
96
- setIsDropDownClosed,
97
- setFocusedOptionIndex,
98
- setIsInputFocused,
99
- });
100
-
101
- window.addEventListener("click", handleClick);
76
+ };
77
+ window.addEventListener("click", handleClickOutside);
102
78
  return () => {
103
- window.removeEventListener("click", handleClick);
79
+ window.removeEventListener("click", handleClickOutside);
104
80
  };
105
81
  }, []);
106
82
 
@@ -109,30 +85,6 @@ const Dropdown = (props: DropdownProps) => {
109
85
  setHasContainerSubcomponent(!!container);
110
86
  }, []);
111
87
 
112
- // dropdown to toggle with external control
113
- useEffect(()=> {
114
- setIsDropDownClosed(isClosed)
115
- },[isClosed])
116
-
117
- const filteredOptions = options?.filter((option: GenericObject) =>
118
- option.label.toLowerCase().includes(filterItem.toLowerCase())
119
- );
120
-
121
- // For keyboard accessibility: Set focus within dropdown to selected item if it exists
122
- useEffect(() => {
123
- if (!isDropDownClosed) {
124
- let newIndex = 0;
125
- if (selected && selected?.label) {
126
- const selectedIndex = filteredOptions.findIndex((option: GenericObject) => option.label === selected.label);
127
- if (selectedIndex >= 0) {
128
- newIndex = selectedIndex;
129
- }
130
- }
131
- setFocusedOptionIndex(newIndex);
132
- }
133
- }, [isDropDownClosed]);
134
-
135
-
136
88
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
137
89
  setFilterItem(e.target.value);
138
90
  setIsDropDownClosed(false);
@@ -142,7 +94,7 @@ const Dropdown = (props: DropdownProps) => {
142
94
  setSelected(selectedItem);
143
95
  setFilterItem("");
144
96
  setIsDropDownClosed(true);
145
- onSelect && onSelect(selectedItem);
97
+ onSelect(selectedItem);
146
98
  };
147
99
 
148
100
  const handleWrapperClick = () => {
@@ -152,10 +104,14 @@ const Dropdown = (props: DropdownProps) => {
152
104
 
153
105
  const handleBackspace = () => {
154
106
  setSelected({});
155
- onSelect && onSelect(null);
107
+ onSelect(null);
156
108
  setFocusedOptionIndex(-1);
157
109
  };
158
110
 
111
+ const filteredOptions = options?.filter((option: GenericObject) =>
112
+ option.label.toLowerCase().includes(filterItem.toLowerCase())
113
+ );
114
+
159
115
  const componentsToRender = prepareSubcomponents({
160
116
  children,
161
117
  hasTriggerSubcomponent,
@@ -163,22 +119,17 @@ const Dropdown = (props: DropdownProps) => {
163
119
  trigger,
164
120
  container,
165
121
  otherChildren,
166
- dark
167
122
  });
168
123
 
169
-
170
124
  return (
171
125
  <div {...ariaProps}
172
126
  {...dataProps}
173
- {...htmlProps}
174
127
  className={classes}
175
128
  id={id}
176
- style={triggerRef ? { position: "absolute"} : { position: "relative"}}
177
129
  >
178
130
  <DropdownContext.Provider
179
131
  value={{
180
132
  autocomplete,
181
- dropdownContainerRef,
182
133
  filteredOptions,
183
134
  filterItem,
184
135
  focusedOptionIndex,
@@ -187,7 +138,6 @@ const Dropdown = (props: DropdownProps) => {
187
138
  handleOptionClick,
188
139
  handleWrapperClick,
189
140
  inputRef,
190
- inputWrapperRef,
191
141
  isDropDownClosed,
192
142
  isInputFocused,
193
143
  options,
@@ -197,26 +147,9 @@ const Dropdown = (props: DropdownProps) => {
197
147
  setIsInputFocused,
198
148
  setSelected,
199
149
  toggleDropdown,
200
- triggerRef
201
150
  }}
202
151
  >
203
- {label &&
204
- <Caption
205
- dark={dark}
206
- marginBottom="xs"
207
- text={label}
208
- />
209
- }
210
152
  <div className="dropdown_wrapper"
211
- onBlur={() => {
212
- // Debounce to delay the execution to prevent jumpiness in Focus state
213
- setTimeout(() => {
214
- if (!dropdownRef.current.contains(document.activeElement)) {
215
- setIsInputFocused(false);
216
- }
217
- }, 0);
218
- }}
219
- onFocus={() => setIsInputFocused(true)}
220
153
  ref={dropdownRef}
221
154
  >
222
155
  {children ? (
@@ -243,7 +176,7 @@ const Dropdown = (props: DropdownProps) => {
243
176
  </div>
244
177
  </DropdownContext.Provider>
245
178
  </div>
246
- )
179
+ );
247
180
  };
248
181
 
249
182
  Dropdown.Option = DropdownOption;
@@ -1,20 +1,31 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { Dropdown } from '../../'
3
3
 
4
4
  const DropdownDefault = (props) => {
5
+ // eslint-disable-next-line no-unused-vars
6
+ const [selectedOption, setSelectedOption] = useState();
5
7
 
6
8
  const options = [
7
9
  {
8
10
  label: "United States",
9
11
  value: "United States",
12
+ areaCode: "+1",
13
+ icon: "πŸ‡ΊπŸ‡Έ",
14
+ id: "United-states"
10
15
  },
11
16
  {
12
- label: "Canada",
13
- value: "Canada",
17
+ label: "Ukraine",
18
+ value: "Ukraine",
19
+ areaCode: "+380",
20
+ icon: "πŸ‡ΊπŸ‡¦",
21
+ id: "ukraine"
14
22
  },
15
23
  {
16
24
  label: "Pakistan",
17
25
  value: "Pakistan",
26
+ areaCode: "+92",
27
+ icon: "πŸ‡΅πŸ‡°",
28
+ id: "pakistan"
18
29
  }
19
30
  ];
20
31
 
@@ -22,9 +33,16 @@ const DropdownDefault = (props) => {
22
33
  return (
23
34
  <div>
24
35
  <Dropdown
36
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
25
37
  options={options}
26
38
  {...props}
27
- />
39
+ >
40
+ {options.map((option) => (
41
+ <Dropdown.Option key={option.id}
42
+ option={option}
43
+ />
44
+ ))}
45
+ </Dropdown>
28
46
  </div>
29
47
  )
30
48
  }
@@ -17,7 +17,7 @@ const DropdownWithCustomDisplay = (props) => {
17
17
  label: "Ramon Ruiz",
18
18
  value: "Ramon Ruiz",
19
19
  territory: "PHL",
20
- title: "Senior UX Designer",
20
+ title: "Senior UX Desinger",
21
21
  id: "ramon-ruiz",
22
22
  status: "Away"
23
23
  },
@@ -39,7 +39,7 @@ const DropdownWithCustomDisplay = (props) => {
39
39
  }
40
40
  ];
41
41
 
42
- const CustomDisplay = () => {
42
+ const customDisplay = () => {
43
43
  return (
44
44
  <>
45
45
  {
@@ -62,9 +62,7 @@ const DropdownWithCustomDisplay = (props) => {
62
62
  options={options}
63
63
  {...props}
64
64
  >
65
- <Dropdown.Trigger customDisplay={<CustomDisplay/>}
66
- placeholder="Select a User"
67
- />
65
+ <Dropdown.Trigger customDisplay={customDisplay()}/>
68
66
  {options.map((option) => (
69
67
  <Dropdown.Option key={option.id}
70
68
  option={option}
@@ -81,7 +79,7 @@ const DropdownWithCustomDisplay = (props) => {
81
79
  />
82
80
  </FlexItem>
83
81
  <FlexItem>
84
- <Badge dark
82
+ <Badge
85
83
  rounded
86
84
  text={option.status}
87
85
  variant={`${
@@ -1,7 +1,9 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { Dropdown, Icon, Body, FlexItem, Flex } from '../..'
3
3
 
4
4
  const DropdownWithCustomOptions = (props) => {
5
+ // eslint-disable-next-line no-unused-vars
6
+ const [selectedOption, setSelectedOption] = useState();
5
7
 
6
8
  const options = [
7
9
  {
@@ -12,11 +14,11 @@ const DropdownWithCustomOptions = (props) => {
12
14
  id: "United-states"
13
15
  },
14
16
  {
15
- label: "Canada",
16
- value: "Canada",
17
- areaCode: "+1",
18
- icon: "πŸ‡¨πŸ‡¦",
19
- id: "canada"
17
+ label: "Ukraine",
18
+ value: "Ukraine",
19
+ areaCode: "+380",
20
+ icon: "πŸ‡ΊπŸ‡¦",
21
+ id: "ukraine"
20
22
  },
21
23
  {
22
24
  label: "Pakistan",
@@ -31,6 +33,7 @@ const DropdownWithCustomOptions = (props) => {
31
33
  return (
32
34
  <div>
33
35
  <Dropdown
36
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
34
37
  options={options}
35
38
  {...props}
36
39
  >
@@ -14,11 +14,11 @@ const [selectedOption, setSelectedOption] = useState();
14
14
  id: "United-states"
15
15
  },
16
16
  {
17
- label: "Canada",
18
- value: "Canada",
19
- areaCode: "+1",
20
- icon: "πŸ‡¨πŸ‡¦",
21
- id: "canada"
17
+ label: "Ukraine",
18
+ value: "Ukraine",
19
+ areaCode: "+380",
20
+ icon: "πŸ‡ΊπŸ‡¦",
21
+ id: "ukraine"
22
22
  },
23
23
  {
24
24
  label: "Pakistan",