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,45 +0,0 @@
1
- <%
2
- options = [
3
- {
4
- label: "United States",
5
- value: "United States",
6
- areaCode: "+1",
7
- icon: "🇺🇸",
8
- id: "us"
9
- },
10
- {
11
- label: "Canada",
12
- value: "Canada",
13
- areaCode: "+1",
14
- icon: "🇨🇦",
15
- id: "ca"
16
- },
17
- {
18
- label: "Pakistan",
19
- value: "Pakistan",
20
- areaCode: "+92",
21
- icon: "🇵🇰",
22
- id: "pk"
23
- }
24
- ]
25
-
26
- %>
27
-
28
- <%= pb_rails("dropdown", props: {options: options}) do %>
29
- <%= pb_rails("dropdown/dropdown_trigger") %>
30
- <%= pb_rails("dropdown/dropdown_container") do %>
31
- <% options.each do |option| %>
32
- <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
33
- <%= pb_rails("flex/flex_item") do %>
34
- <%= pb_rails("flex") do %>
35
- <%= pb_rails("icon", props: {icon: option[:icon]}) %>
36
- <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
37
- <% end %>
38
- <% end %>
39
- <%= pb_rails("flex/flex_item") do %>
40
- <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
41
- <% end %>
42
- <% end %>
43
- <% end %>
44
- <% end %>
45
- <% end %>
@@ -1 +0,0 @@
1
- The Dropdown also allows for custom options that can be passed in as children to the `Dropdown.Option` subcomponent. If no children are passed to `Dropdown.Option`, the kit will render each option as text within a Body kit by default.
@@ -1,17 +0,0 @@
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}) do %>
11
- <%= pb_rails("dropdown/dropdown_trigger") %>
12
- <%= pb_rails("dropdown/dropdown_container") do %>
13
- <% options.each do |option| %>
14
- <%= pb_rails("dropdown/dropdown_option", props: {option: option, padding:"sm"}) %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
@@ -1,48 +0,0 @@
1
- import React from 'react'
2
- import { Dropdown } from '../..'
3
-
4
- const DropdownWithCustomPadding = (props) => {
5
-
6
- const options = [
7
- {
8
- label: "United States",
9
- value: "United States",
10
- areaCode: "+1",
11
- icon: "🇺🇸",
12
- id: "United-states"
13
- },
14
- {
15
- label: "Canada",
16
- value: "Canada",
17
- areaCode: "+1",
18
- icon: "🇨🇦",
19
- id: "canada"
20
- },
21
- {
22
- label: "Pakistan",
23
- value: "Pakistan",
24
- areaCode: "+92",
25
- icon: "🇵🇰",
26
- id: "pakistan"
27
- }
28
- ];
29
-
30
-
31
- return (
32
- <div>
33
- <Dropdown
34
- options={options}
35
- {...props}
36
- >
37
- {options.map((option) => (
38
- <Dropdown.Option key={option.id}
39
- option={option}
40
- padding="sm"
41
- />
42
- ))}
43
- </Dropdown>
44
- </div>
45
- )
46
- }
47
-
48
- export default DropdownWithCustomPadding
@@ -1 +0,0 @@
1
- By default, the padding on each option in the dropdown is set to `xs`. The `padding` Global Props however can be used to override this default. In this example, we are setting padding to `sm`.
@@ -1,47 +0,0 @@
1
- <%
2
- options = [
3
- {
4
- label: "United States",
5
- value: "United States",
6
- areaCode: "+1",
7
- icon: "🇺🇸",
8
- id: "us"
9
- },
10
- {
11
- label: "Canada",
12
- value: "Canada",
13
- areaCode: "+1",
14
- icon: "🇨🇦",
15
- id: "ca"
16
- },
17
- {
18
- label: "Pakistan",
19
- value: "Pakistan",
20
- areaCode: "+92",
21
- icon: "🇵🇰",
22
- id: "pk"
23
- }
24
- ]
25
-
26
- %>
27
-
28
- <%= pb_rails("dropdown", props: {options: options}) do %>
29
- <%= pb_rails("dropdown/dropdown_trigger") do %>
30
- <%= pb_rails("icon_circle", props: {icon:"flag", cursor: "pointer", variant:"royal"}) %>
31
- <% end %>
32
- <%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs"}) do %>
33
- <% options.each do |option| %>
34
- <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
35
- <%= pb_rails("flex/flex_item") do %>
36
- <%= pb_rails("flex") do %>
37
- <%= pb_rails("icon", props: {icon: option[:icon]}) %>
38
- <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
39
- <% end %>
40
- <% end %>
41
- <%= pb_rails("flex/flex_item") do %>
42
- <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
43
- <% end %>
44
- <% end %>
45
- <% end %>
46
- <% end %>
47
- <% end %>
@@ -1 +0,0 @@
1
- The Dropdown can also be given a custom Trigger by passing children to the `Dropdown.Trigger` subcomponent as shown in this example. Here we are using the IconCircle kit.
@@ -1,59 +0,0 @@
1
- import React from 'react'
2
- import { Dropdown, useDropdown, Button } from '../../'
3
-
4
- const DropdownWithExternalControl = (props) => {
5
- const [isDropDownClosed, setIsDropdownClosed] = useDropdown(true);
6
-
7
- const options = [
8
- {
9
- label: "United States",
10
- value: "United States",
11
- areaCode: "+1",
12
- icon: "🇺🇸",
13
- id: "United-states"
14
- },
15
- {
16
- label: "Canada",
17
- value: "Canada",
18
- areaCode: "+1",
19
- icon: "🇨🇦",
20
- id: "canada"
21
- },
22
- {
23
- label: "Pakistan",
24
- value: "Pakistan",
25
- areaCode: "+92",
26
- icon: "🇵🇰",
27
- id: "pakistan"
28
- }
29
- ];
30
-
31
- return (
32
- <div>
33
- <Button
34
- data={{dropdown:'pb-dropdown-trigger'}}
35
- marginBottom='sm'
36
- onClick={() => setIsDropdownClosed(!isDropDownClosed)}
37
- padding="none"
38
- tabIndex={0}
39
- variant="link"
40
- >
41
- {isDropDownClosed ? "Open Dropdown" : "Close Dropdown"}
42
- </Button>
43
-
44
- <Dropdown
45
- isClosed={isDropDownClosed}
46
- options={options}
47
- {...props}
48
- >
49
- {options.map((option) => (
50
- <Dropdown.Option key={option.id}
51
- option={option}
52
- />
53
- ))}
54
- </Dropdown>
55
- </div>
56
- )
57
- }
58
-
59
- export default DropdownWithExternalControl
@@ -1,72 +0,0 @@
1
- import React, { useRef } from 'react'
2
- import { Dropdown, useDropdown, CircleIconButton, Icon, Body, FlexItem, Flex } from '../..'
3
-
4
- const DropdownWithHook = (props) => {
5
- const [isDropDownClosed, setIsDropdownClosed] = useDropdown(true);
6
- const buttonRef = useRef(null);
7
-
8
- const options = [
9
- {
10
- label: "United States",
11
- value: "United States",
12
- areaCode: "+1",
13
- icon: "🇺🇸",
14
- id: "United-states"
15
- },
16
- {
17
- label: "Canada",
18
- value: "Canada",
19
- areaCode: "+1",
20
- icon: "🇨🇦",
21
- id: "canada"
22
- },
23
- {
24
- label: "Pakistan",
25
- value: "Pakistan",
26
- areaCode: "+92",
27
- icon: "🇵🇰",
28
- id: "pakistan"
29
- }
30
- ];
31
-
32
- return (
33
- <div>
34
- <CircleIconButton
35
- htmlOptions={{ref: buttonRef}}
36
- icon={"flag"}
37
- onClick={() => setIsDropdownClosed(!isDropDownClosed)}
38
- variant="secondary"
39
- />
40
- <Dropdown
41
- isClosed={isDropDownClosed}
42
- options={options}
43
- triggerRef={buttonRef}
44
- {...props}
45
- >
46
- {options.map((option) => (
47
- <Dropdown.Option key={option.id}
48
- option={option}
49
- >
50
- <>
51
- <FlexItem>
52
- <Flex paddingRight='md'>
53
- <Icon icon={option.icon}
54
- paddingRight="xs"
55
- />
56
- <Body text={option.label} />
57
- </Flex>
58
- </FlexItem>
59
- <FlexItem>
60
- <Body color="light"
61
- text={option.areaCode}
62
- />
63
- </FlexItem>
64
- </>
65
- </Dropdown.Option>
66
- ))}
67
- </Dropdown>
68
- </div>
69
- )
70
- }
71
-
72
- export default DropdownWithHook
@@ -1,10 +0,0 @@
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, label: "Select a Country"}) %>
@@ -1,39 +0,0 @@
1
- import React from 'react'
2
- import { Dropdown } from '../..'
3
-
4
- const DropdownDefault = (props) => {
5
-
6
- const options = [
7
- {
8
- label: "United States",
9
- value: "United States",
10
- },
11
- {
12
- label: "Canada",
13
- value: "Canada",
14
- },
15
- {
16
- label: "Pakistan",
17
- value: "Pakistan",
18
- }
19
- ];
20
-
21
-
22
- return (
23
- <div>
24
- <Dropdown
25
- label="Select a Country"
26
- options={options}
27
- {...props}
28
- >
29
- {options.map((option) => (
30
- <Dropdown.Option key={option.id}
31
- option={option}
32
- />
33
- ))}
34
- </Dropdown>
35
- </div>
36
- )
37
- }
38
-
39
- export default DropdownDefault
@@ -1 +0,0 @@
1
- The optional `label` prop takes a string value that if present will render that string as the label for the Dropdown.
@@ -1,21 +0,0 @@
1
- <%= pb_content_tag do %>
2
- <% if object.label.present? %>
3
- <%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
4
- <% end %>
5
- <div class="dropdown_wrapper" style="position: relative">
6
- <input type="hidden" name="<%= object.name %>" id="dropdown-selected-option" value=""/>
7
- <% if content.present? %>
8
- <%= content.presence %>
9
- <% else %>
10
- <%= pb_rails("dropdown/dropdown_trigger") %>
11
- <%= pb_rails("dropdown/dropdown_container") do %>
12
- <% if object.options.present? %>
13
- <% object.options.each do |option| %>
14
- <%= pb_rails("dropdown/dropdown_option", props: {option: option}) %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
18
- <% end %>
19
- </div>
20
- <% end %>
21
-
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDropdown
5
- class Dropdown < Playbook::KitBase
6
- prop :options, type: Playbook::Props::Array,
7
- default: []
8
- prop :label, type: Playbook::Props::String
9
- prop :name, type: Playbook::Props::String
10
-
11
- def data
12
- Hash(prop(:data)).merge(pb_dropdown: true)
13
- end
14
-
15
- def classname
16
- generate_classname("pb_dropdown")
17
- end
18
- end
19
- end
20
- end
@@ -1,15 +0,0 @@
1
- <%= pb_content_tag(:div, style: object.container_style) do %>
2
- <%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
3
- <% if content.present? %>
4
- <%= content.presence %>
5
- <% else %>
6
- <%= pb_rails("list/item", props: {
7
- display: "flex",
8
- justify_content: "center",
9
- padding:"xs",
10
- }) do %>
11
- <%= pb_rails("body", props: {text: "No option"}) %>
12
- <% end %>
13
- <% end %>
14
- <% end %>
15
- <% end %>
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDropdown
5
- class DropdownContainer < Playbook::KitBase
6
- def classname
7
- generate_classname("pb_dropdown_container", "close", separator: " ")
8
- end
9
-
10
- def container_style
11
- "position: absolute"
12
- end
13
-
14
- def data
15
- Hash(prop(:data)).merge(dropdown_container: true)
16
- end
17
- end
18
- end
19
- end
@@ -1,22 +0,0 @@
1
- <%= pb_content_tag(:div, id:object.option[:id]) do %>
2
- <%= pb_rails("list/item", props: {
3
- display: "flex",
4
- justify_content: "center",
5
- padding:"none",
6
- cursor: "pointer"
7
- }) do %>
8
- <%= pb_rails("flex", props: {
9
- align: "center",
10
- classname:"dropdown_option_wrapper",
11
- justify: "between",
12
- padding_x:"sm",
13
- padding_y:"xxs",
14
- }) do %>
15
- <% if content.present? %>
16
- <%= content.presence %>
17
- <% else %>
18
- <%= pb_rails("body", props: {text: object.option[:label]}) %>
19
- <% end %>
20
- <% end %>
21
- <% end %>
22
- <% end %>
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDropdown
5
- class DropdownOption < Playbook::KitBase
6
- prop :option, type: Playbook::Props::String
7
- prop :id, type: Playbook::Props::String
8
-
9
- def data
10
- Hash(prop(:data)).merge("dropdown_option_label": option)
11
- end
12
-
13
- def padding_helper
14
- " p_xs"
15
- end
16
-
17
- def classname
18
- generate_classname("pb_dropdown_option", "list") + padding_helper
19
- end
20
- end
21
- end
22
- end
@@ -1,38 +0,0 @@
1
- <%= pb_content_tag do %>
2
- <% if content.present? %>
3
- <div style="display: inline-block" tabindex="0" data-dropdown-custom-trigger>
4
- <%= content.presence %>
5
- </div>
6
- <% else %>
7
- <%= pb_rails("flex", props: {
8
- align: "center",
9
- border_radius:"lg",
10
- classname: object.trigger_wrapper_classes,
11
- cursor: "pointer",
12
- justify: "between",
13
- padding_x:"sm",
14
- padding_y:"xs",
15
- html_options: {tabindex:"0"}
16
- }) do %>
17
- <%= pb_rails("flex/flex_item") do %>
18
- <%= pb_rails("flex", props: {align: "center"}) do %>
19
- <% if object.custom_display.present? %>
20
- <%= pb_rails("flex", props: {align: "center"}) do %>
21
- <div id="dropdown_trigger_custom_display" style="display: none;">
22
- <%= object.custom_display %>
23
- </div>
24
- <%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
25
- <% end %>
26
- <% else %>
27
- <%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
28
- <% end %>
29
- <% end %>
30
- <% end %>
31
- <%= pb_rails("body", props: {display: "flex"}) do %>
32
- <%= pb_rails("icon", props: {icon: "chevron-down", cursor: "pointer", size:"sm", id: "dropdown_open_icon"}) %>
33
- <%= pb_rails("icon", props: {icon: "chevron-up", cursor: "pointer", size:"sm", id: "dropdown_close_icon"}) %>
34
- <% end %>
35
- <% end %>
36
- <% end %>
37
- <% end %>
38
-
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDropdown
5
- class DropdownTrigger < Playbook::KitBase
6
- prop :options, type: Playbook::Props::Array,
7
- default: []
8
- prop :id, type: Playbook::Props::String,
9
- default: ""
10
- prop :placeholder, type: Playbook::Props::String
11
- prop :custom_display
12
-
13
- def data
14
- Hash(prop(:data)).merge(dropdown_trigger: true)
15
- end
16
-
17
- def classname
18
- generate_classname("pb_dropdown_trigger")
19
- end
20
-
21
- def default_display_placeholder
22
- placeholder || "Select..."
23
- end
24
-
25
- def trigger_wrapper_classes
26
- generate_classname("dropdown_trigger_wrapper", "select_only")
27
- end
28
- end
29
- end
30
- end