playbook_ui 13.25.0.pre.alpha.barchartfix2766 → 13.26.0.pre.alpha.PBNTR291Dropdownrailsv22840

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +14 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +14 -10
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.html.erb +33 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +24 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +5 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -2
  9. data/app/pb_kits/playbook/pb_advanced_table/index.js +78 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +9 -5
  11. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +6 -2
  13. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +9 -4
  14. data/app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx +44 -0
  15. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +86 -21
  16. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +26 -3
  17. data/app/pb_kits/playbook/pb_avatar/avatar.rb +41 -0
  18. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +71 -0
  19. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +77 -0
  20. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +71 -0
  21. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +77 -0
  22. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +20 -0
  23. data/app/pb_kits/playbook/pb_avatar/docs/example.yml +4 -0
  24. data/app/pb_kits/playbook/pb_avatar/docs/index.js +2 -0
  25. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +6 -1
  26. data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
  27. data/app/pb_kits/playbook/pb_badge/badge.html.erb +6 -1
  28. data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
  29. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
  30. data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +7 -2
  31. data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
  32. data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +7 -2
  33. data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
  34. data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
  35. data/app/pb_kits/playbook/pb_card/card_body.html.erb +6 -1
  36. data/app/pb_kits/playbook/pb_card/card_header.html.erb +6 -1
  37. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +49 -0
  38. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +3 -0
  39. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
  40. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +2 -1
  41. data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +14 -0
  42. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_disabled.html.erb +23 -0
  43. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_disabled.jsx +29 -0
  44. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  45. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  46. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +6 -1
  47. data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +6 -1
  48. data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +6 -1
  49. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +7 -1
  50. data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -1
  51. data/app/pb_kits/playbook/pb_currency/currency.html.erb +6 -1
  52. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +6 -1
  53. data/app/pb_kits/playbook/pb_date/date.html.erb +6 -1
  54. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -2
  55. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.md +3 -1
  56. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.md +3 -1
  57. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
  58. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +5 -1
  59. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +5 -1
  60. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +5 -1
  61. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +6 -1
  62. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +7 -1
  63. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +5 -1
  64. data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
  65. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
  66. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +7 -2
  67. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -1
  68. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -2
  69. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +94 -32
  70. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +64 -23
  71. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +10 -0
  72. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +2 -20
  73. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -0
  74. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.html.erb +17 -0
  75. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +42 -0
  76. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +7 -0
  77. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +2 -5
  78. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +1 -2
  79. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.html.erb +60 -0
  80. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +2 -2
  81. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -1
  82. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.html.erb +45 -0
  83. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +1 -4
  84. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -1
  85. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +17 -0
  86. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +1 -4
  87. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.html.erb +47 -0
  88. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +59 -0
  89. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_hook.jsx +72 -0
  90. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +10 -0
  91. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +39 -0
  92. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -0
  93. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +15 -4
  94. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -1
  95. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +26 -0
  96. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +20 -0
  97. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +200 -10
  98. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +21 -0
  99. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +19 -0
  100. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +27 -0
  101. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +22 -0
  102. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +43 -0
  103. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +30 -0
  104. data/app/pb_kits/playbook/pb_dropdown/hooks/useDropdown.tsx +2 -2
  105. data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +4 -4
  106. data/app/pb_kits/playbook/pb_dropdown/index.js +153 -0
  107. data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +77 -0
  108. data/app/pb_kits/playbook/pb_dropdown/scss_partials/_dropdown_animation.scss +18 -0
  109. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +17 -8
  110. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +29 -17
  111. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +96 -78
  112. data/app/pb_kits/playbook/pb_dropdown/utilities/clickOutsideHelper.tsx +41 -0
  113. data/app/pb_kits/playbook/pb_dropdown/utilities/index.ts +2 -0
  114. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +9 -7
  115. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +6 -1
  116. data/app/pb_kits/playbook/pb_filter/filter.html.erb +5 -1
  117. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +6 -1
  118. data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
  119. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -2
  120. data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +6 -1
  121. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  122. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
  123. data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
  124. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
  125. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +7 -2
  126. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +6 -1
  127. data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +6 -1
  128. data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +6 -1
  129. data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +6 -1
  130. data/app/pb_kits/playbook/pb_layout/body.html.erb +5 -1
  131. data/app/pb_kits/playbook/pb_layout/footer.html.erb +5 -1
  132. data/app/pb_kits/playbook/pb_layout/header.html.erb +5 -1
  133. data/app/pb_kits/playbook/pb_layout/item.html.erb +5 -1
  134. data/app/pb_kits/playbook/pb_layout/layout.html.erb +5 -1
  135. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +5 -1
  136. data/app/pb_kits/playbook/pb_list/item.html.erb +8 -2
  137. data/app/pb_kits/playbook/pb_list/list.html.erb +8 -2
  138. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +3 -1
  139. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_custom.html.erb +13 -0
  140. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_custom.jsx +26 -0
  141. data/app/pb_kits/playbook/pb_loading_inline/docs/{_loading_inline_light.html.erb → _loading_inline_default.html.erb} +2 -2
  142. data/app/pb_kits/playbook/pb_loading_inline/docs/{_loading_inline_light.jsx → _loading_inline_default.jsx} +2 -2
  143. data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +4 -2
  144. data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +2 -1
  145. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +7 -2
  146. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +1 -0
  147. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.test.js +14 -0
  148. data/app/pb_kits/playbook/pb_message/message.html.erb +6 -1
  149. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -1
  150. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
  151. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +6 -1
  152. data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -1
  153. data/app/pb_kits/playbook/pb_nav/item.html.erb +14 -3
  154. data/app/pb_kits/playbook/pb_nav/nav.html.erb +6 -1
  155. data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -2
  156. data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +6 -1
  157. data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -1
  158. data/app/pb_kits/playbook/pb_person/person.html.erb +12 -7
  159. data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +6 -1
  160. data/app/pb_kits/playbook/pb_pill/pill.html.erb +6 -1
  161. data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
  162. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +6 -2
  163. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.html.erb +3 -0
  164. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.jsx +16 -0
  165. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_flex.md +1 -0
  166. data/app/pb_kits/playbook/pb_progress_simple/docs/example.yml +2 -0
  167. data/app/pb_kits/playbook/pb_progress_simple/docs/index.js +1 -0
  168. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +6 -3
  169. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +1 -1
  170. data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
  171. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
  172. data/app/pb_kits/playbook/pb_radio/_radio.scss +35 -0
  173. data/app/pb_kits/playbook/pb_radio/_radio.tsx +3 -0
  174. data/app/pb_kits/playbook/pb_radio/docs/_radio_alignment.jsx +4 -1
  175. data/app/pb_kits/playbook/pb_radio/docs/_radio_default.jsx +4 -1
  176. data/app/pb_kits/playbook/pb_radio/docs/_radio_disabled.html.erb +26 -0
  177. data/app/pb_kits/playbook/pb_radio/docs/_radio_disabled.jsx +31 -0
  178. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.jsx +2 -1
  179. data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -0
  180. data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
  181. data/app/pb_kits/playbook/pb_radio/radio.html.erb +8 -2
  182. data/app/pb_kits/playbook/pb_radio/radio.rb +5 -0
  183. data/app/pb_kits/playbook/pb_radio/radio.test.js +17 -0
  184. data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +6 -1
  185. data/app/pb_kits/playbook/pb_select/select.html.erb +5 -1
  186. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +5 -1
  187. data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +4 -1
  188. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +5 -1
  189. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +6 -1
  190. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +6 -1
  191. data/app/pb_kits/playbook/pb_source/source.html.erb +5 -1
  192. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +5 -1
  193. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +5 -1
  194. data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +5 -1
  195. data/app/pb_kits/playbook/pb_table/table.html.erb +12 -2
  196. data/app/pb_kits/playbook/pb_table/table_body.html.erb +16 -6
  197. data/app/pb_kits/playbook/pb_table/table_cell.html.erb +16 -6
  198. data/app/pb_kits/playbook/pb_table/table_head.html.erb +16 -6
  199. data/app/pb_kits/playbook/pb_table/table_header.html.erb +13 -4
  200. data/app/pb_kits/playbook/pb_table/table_row.html.erb +16 -6
  201. data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +5 -1
  202. data/app/pb_kits/playbook/pb_time/time.html.erb +5 -1
  203. data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +5 -1
  204. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +5 -1
  205. data/app/pb_kits/playbook/pb_timeline/item.html.erb +7 -3
  206. data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +5 -1
  207. data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +6 -1
  208. data/app/pb_kits/playbook/pb_title/title.html.erb +6 -1
  209. data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +6 -1
  210. data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +5 -1
  211. data/app/pb_kits/playbook/pb_toggle/toggle.html.erb +6 -1
  212. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
  213. data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +5 -1
  214. data/app/pb_kits/playbook/pb_user/user.html.erb +6 -1
  215. data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +6 -1
  216. data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +6 -1
  217. data/app/pb_kits/playbook/playbook-rails.js +6 -0
  218. data/dist/menu.yml +1 -1
  219. data/dist/playbook-rails.js +6 -6
  220. data/lib/playbook/kit_base.rb +1 -1
  221. data/lib/playbook/version.rb +2 -2
  222. metadata +47 -5
  223. data/app/pb_kits/playbook/pb_advanced_table/docs/_description.md +0 -1
@@ -1,3 +1,8 @@
1
- <%= pb_content_tag do %>
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 %>
2
7
  <%= content.presence %>
3
8
  <% end %>
@@ -1,4 +1,10 @@
1
- <%= pb_content_tag do %>
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
+
2
8
  <%= pb_rails("flex", props: {vertical: "center", spacing: "between", cursor: "pointer"}) do %>
3
9
  <%= pb_rails("flex/flex_item") do %>
4
10
  <%= content.presence %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("body", props: {
3
8
  tag: "span",
4
9
  classname: "pb_contact_kit",
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
  <%= pb_rails("caption", props: object.caption_props) %>
3
8
 
4
9
  <div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
2
7
  <% if object.stat_label.present? %>
3
8
  <%= pb_rails("body", props: { color: "light", text: object.stat_label } ) %>
4
9
  <% end %>
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do %>
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 %>
2
7
 
3
8
  <% if object.unstyled %>
4
9
  <!-- icon -->
@@ -1,5 +1,9 @@
1
- <%= pb_content_tag(:div,
2
- class: object.classname + object.error_class) do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname + object.error_class,
4
+ data: object.data,
5
+ id: object.id,
6
+ **combined_html_options) do %>
3
7
  <div class="input_wrapper">
4
8
  <% if content.present? %>
5
9
  <%= content %>
@@ -1,3 +1,5 @@
1
1
  Your change handler function has access to two arguments: `dateStr` and `selectedDates`.
2
2
 
3
- The first, `dateStr`, is a string of the chosen date. The second, `selectedDates`, is an array of selected date objects. In many use cases `selectedDates` will have only one value but you'll still need to access it from index 0.
3
+ The first, `dateStr`, is a string of the chosen date. The second, `selectedDates`, is an array of selected date objects. In many use cases `selectedDates` will have only one value but you'll still need to access it from index 0.
4
+
5
+ NOTE: On Change does not account for manual input by users, so if your date picker sets `allowInput`, you should use the `onClose` method instead.
@@ -1,3 +1,5 @@
1
1
  The `onClose` handler function has access to two arguments: `dateStr` and `selectedDates`.
2
2
 
3
- The first, `dateStr`, is a string of the chosen date. The second, `selectedDates`, is an array of selected date objects. In many use cases `selectedDates` will have only one value but you'll still need to access it from index 0.
3
+ The first, `dateStr`, is a string of the chosen date. The second, `selectedDates`, is an array of selected date objects. In many use cases `selectedDates` will have only one value but you'll still need to access it from index 0.
4
+
5
+ NOTE: `onClose` is the ideal handler function to use when `allowInput` is enabled.
@@ -1 +1 @@
1
- Applying `this_ranges_end_today` (Rails) or `thisRangesEndToday` (React) causes all “This” preset ranges (i.e., this week, this month, this quarter, this year) to use an endDate of today, instead of their natural end date in the future.
1
+ Because the Quick Pick variant has `allowInput` set to `true` by default, use the `onClose` handler function to access the startDate and endDate values. See the `onClose` example for details.
@@ -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
  <div class="pb_date_range_inline_wrapper">
3
7
  <% if object.icon == true %>
4
8
  <%= pb_rails(object.text_kit, props: { tag: "span", dark: object.dark, color: object.icon_color, text: pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true, size: object.size, classname: "pb_date_range_inline_icon" }) }) %>
@@ -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
 
3
7
  <%= pb_rails("flex", props: {vertical: "center"}) do %>
4
8
  <%= pb_rails("flex/flex_item") do %>
@@ -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
 
3
7
  <% if object.bold == false %>
4
8
 
@@ -1,4 +1,9 @@
1
- <%= pb_content_tag do %>
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ id: object.id,
4
+ data: object.data,
5
+ class: object.classname,
6
+ **combined_html_options) do %>
2
7
 
3
8
  <%= pb_rails("flex", props: {
4
9
  orientation: "row",
@@ -1,4 +1,10 @@
1
- <%= pb_content_tag do %>
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
+
2
8
  <%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
3
9
  <%= pb_rails("body", props: {classname: "flex-item"}) do %>
4
10
  <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
@@ -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 %>
@@ -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,11 +5,13 @@
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";
8
11
 
9
12
  .pb_dropdown {
10
13
  .dropdown_wrapper {
11
- position: relative;
12
- .dropdown_trigger_wrapper {
14
+ [class*="dropdown_trigger_wrapper"] {
13
15
  @include pb_body;
14
16
  border: 1px solid $border_light;
15
17
  background-color: $white;
@@ -28,7 +30,6 @@
28
30
  .dropdown_input {
29
31
  @include pb_body;
30
32
  border: unset;
31
- border-radius: $border_rad_heavier;
32
33
  padding: 0;
33
34
  background-color: $white;
34
35
  &:focus-visible {
@@ -36,19 +37,19 @@
36
37
  }
37
38
  }
38
39
  &:focus {
39
- box-shadow: 0px 0px 0 1px $primary;
40
+ box-shadow: 0px 0px 0 1px $primary !important;
40
41
  outline: unset;
41
42
  transition: box-shadow 0.15s ease-in-out;
42
43
  }
43
- }
44
44
 
45
- .dropdown_trigger_wrapper_select_only {
46
- box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
47
- }
45
+ &[class*="_select_only"] {
46
+ box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
47
+ }
48
48
 
49
- .dropdown_trigger_wrapper_focus {
50
- box-shadow: 0px 0px 0 1px $primary;
51
- transition: box-shadow 0.1s ease-in-out;
49
+ &[class*="_focus"] {
50
+ box-shadow: 0px 0px 0 1px $primary !important;
51
+ transition: box-shadow 0.1s ease-in-out;
52
+ }
52
53
  }
53
54
 
54
55
  .pb_dropdown_container {
@@ -58,46 +59,107 @@
58
59
  border-radius: $border_rad_heavier;
59
60
  border: 1px solid $border_light;
60
61
  margin-top: $space_xs;
61
- position: absolute;
62
62
  z-index: $z_1;
63
63
  width: 100%;
64
- transition: opacity 0.25s ease-in-out;
65
64
 
66
- .pb_dropdown_option {
65
+ [class*="pb_dropdown_option"] {
67
66
  cursor: pointer;
68
67
  &:hover {
69
68
  background-color: $border_light;
70
69
  }
71
- }
72
-
73
- .dropdown_option_focused {
74
- background-color: $border_light;
75
- }
76
70
 
77
- .dropdown_option {
78
- width: 100%;
79
- }
71
+ &[class*="_focused"] {
72
+ background-color: $border_light;
73
+ }
80
74
 
81
- .dropdown_option_list {
82
- border-bottom: 1px solid $border_light;
83
- }
84
- .dropdown_option_selected {
85
- background-color: $primary;
86
- [class^="pb_body"],
87
- [class^="pb_title_kit"] {
88
- color: $white !important;
75
+ &[class*="_list"] {
76
+ border-bottom: 1px solid $border_light;
89
77
  }
90
- &:hover {
91
- background-color: $primary !important;
78
+ &[class*="selected"] {
79
+ background-color: $primary;
80
+ color: $white;
81
+ [class^="pb_body"],
82
+ [class^="pb_title_kit"], a {
83
+ color: $white !important;
84
+ }
85
+ &:hover {
86
+ background-color: $primary !important;
87
+ }
92
88
  }
93
89
  }
90
+
91
+ .dropdown_option_wrapper {
92
+ width: 100%;
93
+ }
94
94
  }
95
95
  .close {
96
96
  display: none;
97
+ animation-name: fadeOut;
98
+ animation-duration: 150ms;
99
+ animation-timing-function: linear;
100
+ animation-fill-mode: forwards;
97
101
  }
98
102
 
99
103
  .open {
100
104
  display: block;
105
+ animation-name: fadeIn;
106
+ animation-duration: 150ms;
107
+ animation-timing-function: linear;
108
+ animation-fill-mode: forwards;
109
+ }
110
+ }
111
+
112
+ &.dark {
113
+ .dropdown_wrapper {
114
+ [class*="dropdown_trigger_wrapper"] {
115
+ @include pb_body_light_dark;
116
+ background-color: rgba($white, 0.1) !important;
117
+ background: none;
118
+ border-color: rgba($white, 0.15);
119
+ @media (hover: hover) {
120
+ &:hover,
121
+ &:active,
122
+ &:focus {
123
+ background-color: rgba($white, 0.05) !important;
124
+ }
125
+ }
126
+ [class^="pb_body"] {
127
+ color: $white;
128
+ }
129
+ &[class*="_select_only"] {
130
+ box-shadow: inset 0 -11px 20px rgba($white, 0.05);
131
+ }
132
+ .dropdown_input {
133
+ background-color: unset;
134
+ color: $white;
135
+ }
136
+ }
137
+ }
138
+ .pb_dropdown_container {
139
+ background-color: $bg_dark !important;
140
+ border-color: rgba($white, 0.15);
141
+ color: $white;
142
+ [class^="pb_body"],
143
+ [class^="pb_title_kit"] {
144
+ color: $white !important;
145
+ }
146
+
147
+ [class*="pb_dropdown_option"] {
148
+ &:hover {
149
+ background-color: $hover_dark;
150
+ }
151
+
152
+ &[class*="_focused"] {
153
+ background-color: $hover_dark;
154
+ }
155
+
156
+ &[class*="_list"] {
157
+ border-color: rgba($white, 0.15);
158
+ }
159
+ &[class*="selected"] {
160
+ background-color: $primary;
161
+ }
162
+ }
101
163
  }
102
164
  }
103
165
  }
@@ -1,32 +1,38 @@
1
- import React, { useState, useRef, useEffect, ReactElement } from "react";
1
+ import React, { useState, useRef, useEffect } from "react";
2
2
  import classnames from "classnames";
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
4
  import { globalProps } from "../utilities/globalProps";
5
+ import { GenericObject } from "../types";
5
6
 
6
7
  import Body from "../pb_body/_body";
8
+ import Caption from "../pb_caption/_caption";
7
9
 
8
10
  import DropdownContainer from "./subcomponents/DropdownContainer";
11
+ import DropdownContext from "./context";
9
12
  import DropdownOption from "./subcomponents/DropdownOption";
10
13
  import DropdownTrigger from "./subcomponents/DropdownTrigger";
11
- import DropdownContext from "./context";
12
14
  import useDropdown from "./hooks/useDropdown";
13
15
 
14
16
  import {
15
17
  separateChildComponents,
16
18
  prepareSubcomponents,
17
- } from "./utilities/subComponentHelper";
18
- import { GenericObject } from "../types";
19
+ handleClickOutside,
20
+ } from "./utilities";
19
21
 
20
22
  type DropdownProps = {
21
23
  aria?: { [key: string]: string };
22
24
  autocomplete?: boolean;
25
+ children?: React.ReactChild[] | React.ReactChild | React.ReactElement[];
23
26
  className?: string;
27
+ dark?: boolean;
24
28
  data?: { [key: string]: string };
25
29
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
26
30
  id?: string;
27
- children?: React.ReactChild[] | React.ReactChild | ReactElement[];
28
- options: GenericObject;
31
+ isClosed?: boolean;
32
+ label?: string;
29
33
  onSelect?: (arg: GenericObject) => null;
34
+ options: GenericObject;
35
+ triggerRef?: any;
30
36
  };
31
37
 
32
38
  const Dropdown = (props: DropdownProps) => {
@@ -35,11 +41,15 @@ const Dropdown = (props: DropdownProps) => {
35
41
  autocomplete = false,
36
42
  children,
37
43
  className,
44
+ dark = false,
38
45
  data = {},
39
46
  htmlOptions = {},
40
47
  id,
41
- options,
48
+ isClosed = true,
49
+ label,
42
50
  onSelect,
51
+ options,
52
+ triggerRef
43
53
  } = props;
44
54
 
45
55
  const ariaProps = buildAriaProps(aria);
@@ -51,7 +61,7 @@ const Dropdown = (props: DropdownProps) => {
51
61
  className
52
62
  );
53
63
 
54
- const [isDropDownClosed, setIsDropDownClosed, toggleDropdown] = useDropdown();
64
+ const [isDropDownClosed, setIsDropDownClosed, toggleDropdown] = useDropdown(isClosed);
55
65
 
56
66
  const [filterItem, setFilterItem] = useState("");
57
67
  const [selected, setSelected] = useState<GenericObject>({});
@@ -59,28 +69,38 @@ const Dropdown = (props: DropdownProps) => {
59
69
  const [hasTriggerSubcomponent, setHasTriggerSubcomponent] = useState(true);
60
70
  const [hasContainerSubcomponent, setHasContainerSubcomponent] =
61
71
  useState(true);
62
-
63
72
  //state for keyboard events
64
73
  const [focusedOptionIndex, setFocusedOptionIndex] = useState(-1);
65
74
 
66
75
  const dropdownRef = useRef(null);
67
76
  const inputRef = useRef(null);
77
+ const inputWrapperRef = useRef(null);
78
+ const dropdownContainerRef = useRef(null);
68
79
 
69
80
  const { trigger, container, otherChildren } =
70
81
  separateChildComponents(children);
71
82
 
72
- // useEffect to handle clicks outside the dropdown
73
83
  useEffect(() => {
74
- const handleClickOutside = (e: MouseEvent) => {
75
- if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
76
- setIsDropDownClosed(true);
77
- setFocusedOptionIndex(-1)
78
- setIsInputFocused(false);
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';
79
90
  }
80
- };
81
- window.addEventListener("click", handleClickOutside);
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);
82
102
  return () => {
83
- window.removeEventListener("click", handleClickOutside);
103
+ window.removeEventListener("click", handleClick);
84
104
  };
85
105
  }, []);
86
106
 
@@ -89,11 +109,18 @@ const Dropdown = (props: DropdownProps) => {
89
109
  setHasContainerSubcomponent(!!container);
90
110
  }, []);
91
111
 
112
+ // dropdown to toggle with external control
113
+ useEffect(()=> {
114
+ setIsDropDownClosed(isClosed)
115
+ },[isClosed])
92
116
 
93
- const filteredOptions = options?.filter((option: GenericObject) =>
94
- option.label.toLowerCase().includes(filterItem.toLowerCase())
117
+ const filteredOptions = options?.filter((option: GenericObject) => {
118
+ const label = typeof option.label === 'string' ? option.label.toLowerCase() : option.label;
119
+ return String(label).toLowerCase().includes(filterItem.toLowerCase());
120
+ }
95
121
  );
96
122
 
123
+ // For keyboard accessibility: Set focus within dropdown to selected item if it exists
97
124
  useEffect(() => {
98
125
  if (!isDropDownClosed) {
99
126
  let newIndex = 0;
@@ -107,6 +134,7 @@ const Dropdown = (props: DropdownProps) => {
107
134
  }
108
135
  }, [isDropDownClosed]);
109
136
 
137
+
110
138
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
111
139
  setFilterItem(e.target.value);
112
140
  setIsDropDownClosed(false);
@@ -116,7 +144,7 @@ const Dropdown = (props: DropdownProps) => {
116
144
  setSelected(selectedItem);
117
145
  setFilterItem("");
118
146
  setIsDropDownClosed(true);
119
- onSelect(selectedItem);
147
+ onSelect && onSelect(selectedItem);
120
148
  };
121
149
 
122
150
  const handleWrapperClick = () => {
@@ -126,7 +154,7 @@ const Dropdown = (props: DropdownProps) => {
126
154
 
127
155
  const handleBackspace = () => {
128
156
  setSelected({});
129
- onSelect(null);
157
+ onSelect && onSelect(null);
130
158
  setFocusedOptionIndex(-1);
131
159
  };
132
160
 
@@ -137,18 +165,22 @@ const Dropdown = (props: DropdownProps) => {
137
165
  trigger,
138
166
  container,
139
167
  otherChildren,
168
+ dark
140
169
  });
141
170
 
171
+
142
172
  return (
143
173
  <div {...ariaProps}
144
174
  {...dataProps}
145
175
  {...htmlProps}
146
176
  className={classes}
147
177
  id={id}
178
+ style={triggerRef ? { position: "absolute"} : { position: "relative"}}
148
179
  >
149
180
  <DropdownContext.Provider
150
181
  value={{
151
182
  autocomplete,
183
+ dropdownContainerRef,
152
184
  filteredOptions,
153
185
  filterItem,
154
186
  focusedOptionIndex,
@@ -157,6 +189,7 @@ const Dropdown = (props: DropdownProps) => {
157
189
  handleOptionClick,
158
190
  handleWrapperClick,
159
191
  inputRef,
192
+ inputWrapperRef,
160
193
  isDropDownClosed,
161
194
  isInputFocused,
162
195
  options,
@@ -166,8 +199,16 @@ const Dropdown = (props: DropdownProps) => {
166
199
  setIsInputFocused,
167
200
  setSelected,
168
201
  toggleDropdown,
202
+ triggerRef
169
203
  }}
170
204
  >
205
+ {label &&
206
+ <Caption
207
+ dark={dark}
208
+ marginBottom="xs"
209
+ text={label}
210
+ />
211
+ }
171
212
  <div className="dropdown_wrapper"
172
213
  onBlur={() => {
173
214
  // Debounce to delay the execution to prevent jumpiness in Focus state
@@ -204,7 +245,7 @@ const Dropdown = (props: DropdownProps) => {
204
245
  </div>
205
246
  </DropdownContext.Provider>
206
247
  </div>
207
- );
248
+ )
208
249
  };
209
250
 
210
251
  Dropdown.Option = DropdownOption;
@@ -0,0 +1,10 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
+ ]
7
+
8
+ %>
9
+
10
+ <%= pb_rails("dropdown", props: {options: options}) %>