playbook_ui 18.0.0 → 18.0.1.pre.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_body/_body.tsx +3 -1
  3. data/app/pb_kits/playbook/pb_body/kit.schema.json +1 -0
  4. data/app/pb_kits/playbook/pb_card/_card.tsx +4 -1
  5. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +12 -2
  6. data/app/pb_kits/playbook/pb_card/kit.schema.json +1 -0
  7. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +18 -9
  8. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options.html.erb +34 -0
  9. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options.md +4 -0
  10. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options_with_autocomplete.html.erb +35 -0
  11. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options_with_autocomplete.md +1 -0
  12. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options_with_multi_select.html.erb +35 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_dynamic_options_with_multi_select.md +1 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_react_hook.jsx +45 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_react_hook.md +1 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_react_hook.jsx +36 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_react_hook.md +1 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +2 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +2 -1
  20. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -0
  22. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +13 -1
  23. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +205 -2
  24. data/app/pb_kits/playbook/pb_dropdown/dropdown_index.test.js +372 -0
  25. data/app/pb_kits/playbook/pb_dropdown/index.js +240 -1
  26. data/app/pb_kits/playbook/pb_dropdown/kit.schema.json +40 -6
  27. data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +2 -2
  28. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  29. data/app/pb_kits/playbook/pb_flex/kit.schema.json +1 -0
  30. data/app/pb_kits/playbook/pb_form/docs/_form_model_values.html.erb +43 -0
  31. data/app/pb_kits/playbook/pb_form/docs/_form_model_values.md +22 -0
  32. data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
  33. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +12 -1
  34. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -3
  35. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +26 -0
  36. data/app/pb_kits/playbook/pb_multi_level_select/tree_helpers.js +10 -4
  37. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +22 -19
  38. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +4 -0
  39. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +5 -1
  40. data/app/pb_kits/playbook/pb_passphrase/index.ts +1 -1
  41. data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +2 -1
  42. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +4 -0
  43. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +28 -1
  44. data/app/pb_kits/playbook/pb_pill/_pill.scss +9 -4
  45. data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +43 -0
  46. data/app/pb_kits/playbook/pb_pill/_pill.tsx +12 -6
  47. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.html.erb +9 -0
  48. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.jsx +45 -0
  49. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.md +1 -0
  50. data/app/pb_kits/playbook/pb_pill/docs/_pill_notification.jsx +6 -0
  51. data/app/pb_kits/playbook/pb_pill/docs/_playground.json +14 -1
  52. data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +17 -0
  53. data/app/pb_kits/playbook/pb_pill/docs/example.yml +2 -0
  54. data/app/pb_kits/playbook/pb_pill/docs/index.js +1 -0
  55. data/app/pb_kits/playbook/pb_pill/pill.html.erb +5 -1
  56. data/app/pb_kits/playbook/pb_title/_title.tsx +3 -1
  57. data/app/pb_kits/playbook/pb_title/kit.schema.json +1 -0
  58. data/app/pb_kits/playbook/utilities/global-event-props.schema.json +22 -0
  59. data/app/pb_kits/playbook/utilities/globalEventProps.ts +13 -0
  60. data/app/pb_kits/playbook/utilities/test/globalProps/globalProps.integration.test.js +7 -5
  61. data/app/pb_kits/playbook/utilities/test/globalProps/onClick.test.js +212 -0
  62. data/dist/ai/all-schemas.json +15976 -0
  63. data/dist/ai/external-dependencies.json +1 -0
  64. data/dist/ai/forms.json +1026 -0
  65. data/dist/ai/global-event-props.schema.json +22 -0
  66. data/dist/ai/global-props.schema.json +1271 -0
  67. data/dist/ai/index.json +1048 -0
  68. data/dist/ai/kits/advanced_table.schema.json +334 -0
  69. data/dist/ai/kits/avatar.schema.json +100 -0
  70. data/dist/ai/kits/background.schema.json +238 -0
  71. data/dist/ai/kits/badge.schema.json +83 -0
  72. data/dist/ai/kits/body.schema.json +112 -0
  73. data/dist/ai/kits/bread_crumbs.schema.json +32 -0
  74. data/dist/ai/kits/button.schema.json +292 -0
  75. data/dist/ai/kits/button_toolbar.schema.json +70 -0
  76. data/dist/ai/kits/caption.schema.json +95 -0
  77. data/dist/ai/kits/card.schema.json +204 -0
  78. data/dist/ai/kits/checkbox.schema.json +322 -0
  79. data/dist/ai/kits/circle_icon_button.schema.json +127 -0
  80. data/dist/ai/kits/collapsible.schema.json +109 -0
  81. data/dist/ai/kits/contact.schema.json +69 -0
  82. data/dist/ai/kits/container.schema.json +56 -0
  83. data/dist/ai/kits/copy_button.schema.json +98 -0
  84. data/dist/ai/kits/currency.schema.json +154 -0
  85. data/dist/ai/kits/dashboard_value.schema.json +60 -0
  86. data/dist/ai/kits/date.schema.json +107 -0
  87. data/dist/ai/kits/date_picker.schema.json +581 -0
  88. data/dist/ai/kits/date_range_inline.schema.json +88 -0
  89. data/dist/ai/kits/date_range_stacked.schema.json +48 -0
  90. data/dist/ai/kits/date_stacked.schema.json +90 -0
  91. data/dist/ai/kits/date_time.schema.json +107 -0
  92. data/dist/ai/kits/date_time_stacked.schema.json +74 -0
  93. data/dist/ai/kits/date_year_stacked.schema.json +54 -0
  94. data/dist/ai/kits/detail.schema.json +82 -0
  95. data/dist/ai/kits/dialog.schema.json +188 -0
  96. data/dist/ai/kits/distribution_bar.schema.json +52 -0
  97. data/dist/ai/kits/draggable.schema.json +70 -0
  98. data/dist/ai/kits/dropdown.schema.json +550 -0
  99. data/dist/ai/kits/empty_state.schema.json +121 -0
  100. data/dist/ai/kits/file_upload.schema.json +139 -0
  101. data/dist/ai/kits/filter.schema.json +162 -0
  102. data/dist/ai/kits/fixed_confirmation_toast.schema.json +128 -0
  103. data/dist/ai/kits/flex.schema.json +177 -0
  104. data/dist/ai/kits/form.schema.json +55 -0
  105. data/dist/ai/kits/form_group.schema.json +34 -0
  106. data/dist/ai/kits/form_pill.schema.json +142 -0
  107. data/dist/ai/kits/full_screen.schema.json +93 -0
  108. data/dist/ai/kits/hashtag.schema.json +81 -0
  109. data/dist/ai/kits/highlight.schema.json +39 -0
  110. data/dist/ai/kits/home_address_street.schema.json +136 -0
  111. data/dist/ai/kits/icon.schema.json +201 -0
  112. data/dist/ai/kits/icon_circle.schema.json +83 -0
  113. data/dist/ai/kits/icon_stat_value.schema.json +106 -0
  114. data/dist/ai/kits/icon_value.schema.json +59 -0
  115. data/dist/ai/kits/image.schema.json +78 -0
  116. data/dist/ai/kits/label_pill.schema.json +56 -0
  117. data/dist/ai/kits/label_value.schema.json +94 -0
  118. data/dist/ai/kits/layout.schema.json +129 -0
  119. data/dist/ai/kits/legend.schema.json +54 -0
  120. data/dist/ai/kits/link.schema.json +135 -0
  121. data/dist/ai/kits/list.schema.json +121 -0
  122. data/dist/ai/kits/loading_inline.schema.json +83 -0
  123. data/dist/ai/kits/map.schema.json +62 -0
  124. data/dist/ai/kits/message.schema.json +111 -0
  125. data/dist/ai/kits/multi_level_select.schema.json +377 -0
  126. data/dist/ai/kits/multiple_users.schema.json +77 -0
  127. data/dist/ai/kits/multiple_users_stacked.schema.json +65 -0
  128. data/dist/ai/kits/nav.schema.json +115 -0
  129. data/dist/ai/kits/online_status.schema.json +66 -0
  130. data/dist/ai/kits/overlay.schema.json +112 -0
  131. data/dist/ai/kits/pagination.schema.json +60 -0
  132. data/dist/ai/kits/passphrase.schema.json +117 -0
  133. data/dist/ai/kits/pb_bar_graph.schema.json +42 -0
  134. data/dist/ai/kits/pb_circle_chart.schema.json +42 -0
  135. data/dist/ai/kits/pb_gauge_chart.schema.json +42 -0
  136. data/dist/ai/kits/pb_line_graph.schema.json +42 -0
  137. data/dist/ai/kits/person.schema.json +40 -0
  138. data/dist/ai/kits/person_contact.schema.json +47 -0
  139. data/dist/ai/kits/phone_number_input.schema.json +387 -0
  140. data/dist/ai/kits/pill.schema.json +80 -0
  141. data/dist/ai/kits/popover.schema.json +137 -0
  142. data/dist/ai/kits/progress_pills.schema.json +70 -0
  143. data/dist/ai/kits/progress_simple.schema.json +96 -0
  144. data/dist/ai/kits/progress_step.schema.json +84 -0
  145. data/dist/ai/kits/radio.schema.json +117 -0
  146. data/dist/ai/kits/rich_text_editor.schema.json +194 -0
  147. data/dist/ai/kits/section_separator.schema.json +89 -0
  148. data/dist/ai/kits/select.schema.json +423 -0
  149. data/dist/ai/kits/selectable_card.schema.json +126 -0
  150. data/dist/ai/kits/selectable_card_icon.schema.json +129 -0
  151. data/dist/ai/kits/selectable_icon.schema.json +116 -0
  152. data/dist/ai/kits/selectable_list.schema.json +58 -0
  153. data/dist/ai/kits/skeleton_loading.schema.json +111 -0
  154. data/dist/ai/kits/source.schema.json +68 -0
  155. data/dist/ai/kits/star_rating.schema.json +329 -0
  156. data/dist/ai/kits/stat_change.schema.json +62 -0
  157. data/dist/ai/kits/stat_value.schema.json +49 -0
  158. data/dist/ai/kits/table.schema.json +262 -0
  159. data/dist/ai/kits/text_input.schema.json +667 -0
  160. data/dist/ai/kits/textarea.schema.json +364 -0
  161. data/dist/ai/kits/time.schema.json +104 -0
  162. data/dist/ai/kits/time_picker.schema.json +325 -0
  163. data/dist/ai/kits/time_range_inline.schema.json +89 -0
  164. data/dist/ai/kits/time_stacked.schema.json +70 -0
  165. data/dist/ai/kits/timeline.schema.json +64 -0
  166. data/dist/ai/kits/timestamp.schema.json +138 -0
  167. data/dist/ai/kits/title.schema.json +111 -0
  168. data/dist/ai/kits/title_count.schema.json +71 -0
  169. data/dist/ai/kits/title_detail.schema.json +53 -0
  170. data/dist/ai/kits/toggle.schema.json +80 -0
  171. data/dist/ai/kits/tooltip.schema.json +174 -0
  172. data/dist/ai/kits/typeahead.schema.json +532 -0
  173. data/dist/ai/kits/user.schema.json +157 -0
  174. data/dist/ai/kits/user_badge.schema.json +51 -0
  175. data/dist/ai/kits/weekday_stacked.schema.json +73 -0
  176. data/dist/ai/playgrounds/advanced_table.json +1 -0
  177. data/dist/ai/playgrounds/avatar.json +1 -0
  178. data/dist/ai/playgrounds/background.json +1 -0
  179. data/dist/ai/playgrounds/badge.json +1 -0
  180. data/dist/ai/playgrounds/body.json +1 -0
  181. data/dist/ai/playgrounds/bread_crumbs.json +1 -0
  182. data/dist/ai/playgrounds/button.json +1 -0
  183. data/dist/ai/playgrounds/button_toolbar.json +1 -0
  184. data/dist/ai/playgrounds/caption.json +1 -0
  185. data/dist/ai/playgrounds/card.json +1 -0
  186. data/dist/ai/playgrounds/checkbox.json +1 -0
  187. data/dist/ai/playgrounds/circle_icon_button.json +1 -0
  188. data/dist/ai/playgrounds/collapsible.json +1 -0
  189. data/dist/ai/playgrounds/contact.json +1 -0
  190. data/dist/ai/playgrounds/container.json +1 -0
  191. data/dist/ai/playgrounds/copy_button.json +1 -0
  192. data/dist/ai/playgrounds/currency.json +1 -0
  193. data/dist/ai/playgrounds/dashboard_value.json +1 -0
  194. data/dist/ai/playgrounds/date.json +1 -0
  195. data/dist/ai/playgrounds/date_picker.json +1 -0
  196. data/dist/ai/playgrounds/date_range_inline.json +1 -0
  197. data/dist/ai/playgrounds/date_range_stacked.json +1 -0
  198. data/dist/ai/playgrounds/date_stacked.json +1 -0
  199. data/dist/ai/playgrounds/date_time.json +1 -0
  200. data/dist/ai/playgrounds/date_time_stacked.json +1 -0
  201. data/dist/ai/playgrounds/date_year_stacked.json +1 -0
  202. data/dist/ai/playgrounds/detail.json +1 -0
  203. data/dist/ai/playgrounds/dialog.json +1 -0
  204. data/dist/ai/playgrounds/distribution_bar.json +1 -0
  205. data/dist/ai/playgrounds/draggable.json +1 -0
  206. data/dist/ai/playgrounds/dropdown.json +1 -0
  207. data/dist/ai/playgrounds/empty_state.json +1 -0
  208. data/dist/ai/playgrounds/file_upload.json +1 -0
  209. data/dist/ai/playgrounds/filter.json +1 -0
  210. data/dist/ai/playgrounds/fixed_confirmation_toast.json +1 -0
  211. data/dist/ai/playgrounds/flex.json +1 -0
  212. data/dist/ai/playgrounds/form_group.json +1 -0
  213. data/dist/ai/playgrounds/form_pill.json +1 -0
  214. data/dist/ai/playgrounds/full_screen.json +1 -0
  215. data/dist/ai/playgrounds/hashtag.json +1 -0
  216. data/dist/ai/playgrounds/highlight.json +1 -0
  217. data/dist/ai/playgrounds/home_address_street.json +1 -0
  218. data/dist/ai/playgrounds/icon.json +1 -0
  219. data/dist/ai/playgrounds/icon_circle.json +1 -0
  220. data/dist/ai/playgrounds/icon_stat_value.json +1 -0
  221. data/dist/ai/playgrounds/icon_value.json +1 -0
  222. data/dist/ai/playgrounds/image.json +1 -0
  223. data/dist/ai/playgrounds/index.json +1 -0
  224. data/dist/ai/playgrounds/label_pill.json +1 -0
  225. data/dist/ai/playgrounds/label_value.json +1 -0
  226. data/dist/ai/playgrounds/layout.json +1 -0
  227. data/dist/ai/playgrounds/legend.json +1 -0
  228. data/dist/ai/playgrounds/link.json +1 -0
  229. data/dist/ai/playgrounds/list.json +1 -0
  230. data/dist/ai/playgrounds/loading_inline.json +1 -0
  231. data/dist/ai/playgrounds/map.json +1 -0
  232. data/dist/ai/playgrounds/message.json +1 -0
  233. data/dist/ai/playgrounds/multi_level_select.json +1 -0
  234. data/dist/ai/playgrounds/multiple_users.json +1 -0
  235. data/dist/ai/playgrounds/multiple_users_stacked.json +1 -0
  236. data/dist/ai/playgrounds/nav.json +1 -0
  237. data/dist/ai/playgrounds/online_status.json +1 -0
  238. data/dist/ai/playgrounds/overlay.json +1 -0
  239. data/dist/ai/playgrounds/pagination.json +1 -0
  240. data/dist/ai/playgrounds/passphrase.json +1 -0
  241. data/dist/ai/playgrounds/pb_bar_graph.json +1 -0
  242. data/dist/ai/playgrounds/pb_circle_chart.json +1 -0
  243. data/dist/ai/playgrounds/pb_gauge_chart.json +1 -0
  244. data/dist/ai/playgrounds/pb_line_graph.json +1 -0
  245. data/dist/ai/playgrounds/person.json +1 -0
  246. data/dist/ai/playgrounds/person_contact.json +1 -0
  247. data/dist/ai/playgrounds/phone_number_input.json +1 -0
  248. data/dist/ai/playgrounds/pill.json +1 -0
  249. data/dist/ai/playgrounds/popover.json +1 -0
  250. data/dist/ai/playgrounds/progress_pills.json +1 -0
  251. data/dist/ai/playgrounds/progress_simple.json +1 -0
  252. data/dist/ai/playgrounds/progress_step.json +1 -0
  253. data/dist/ai/playgrounds/radio.json +1 -0
  254. data/dist/ai/playgrounds/rich_text_editor.json +1 -0
  255. data/dist/ai/playgrounds/section_separator.json +1 -0
  256. data/dist/ai/playgrounds/select.json +1 -0
  257. data/dist/ai/playgrounds/selectable_card.json +1 -0
  258. data/dist/ai/playgrounds/selectable_card_icon.json +1 -0
  259. data/dist/ai/playgrounds/selectable_icon.json +1 -0
  260. data/dist/ai/playgrounds/selectable_list.json +1 -0
  261. data/dist/ai/playgrounds/skeleton_loading.json +1 -0
  262. data/dist/ai/playgrounds/source.json +1 -0
  263. data/dist/ai/playgrounds/star_rating.json +1 -0
  264. data/dist/ai/playgrounds/stat_change.json +1 -0
  265. data/dist/ai/playgrounds/stat_value.json +1 -0
  266. data/dist/ai/playgrounds/table.json +1 -0
  267. data/dist/ai/playgrounds/text_input.json +1 -0
  268. data/dist/ai/playgrounds/textarea.json +1 -0
  269. data/dist/ai/playgrounds/time.json +1 -0
  270. data/dist/ai/playgrounds/time_picker.json +1 -0
  271. data/dist/ai/playgrounds/time_range_inline.json +1 -0
  272. data/dist/ai/playgrounds/time_stacked.json +1 -0
  273. data/dist/ai/playgrounds/timeline.json +1 -0
  274. data/dist/ai/playgrounds/timestamp.json +1 -0
  275. data/dist/ai/playgrounds/title.json +1 -0
  276. data/dist/ai/playgrounds/title_count.json +1 -0
  277. data/dist/ai/playgrounds/title_detail.json +1 -0
  278. data/dist/ai/playgrounds/toggle.json +1 -0
  279. data/dist/ai/playgrounds/tooltip.json +1 -0
  280. data/dist/ai/playgrounds/typeahead.json +1 -0
  281. data/dist/ai/playgrounds/user.json +1 -0
  282. data/dist/ai/playgrounds/user_badge.json +1 -0
  283. data/dist/ai/playgrounds/weekday_stacked.json +1 -0
  284. data/dist/ai/visual-index.json +1 -0
  285. data/dist/chunks/{_detail-B4-co8rv.js → _detail-Cy2bFz4f.js} +2 -2
  286. data/dist/chunks/{_table-CUU7TisO.js → _table-CZFM253V.js} +1 -1
  287. data/dist/chunks/{_typeahead-DeIqOMbJ.js → _typeahead-BiNcC1AJ.js} +1 -1
  288. data/dist/chunks/vendor.js +2 -2
  289. data/dist/playbook-rails-react-bindings.js +1 -1
  290. data/dist/playbook-rails.js +1 -1
  291. data/dist/playbook.css +1 -1
  292. data/lib/playbook/changelog_generator.rb +33 -3
  293. data/lib/playbook/forms/builder/attribute_defaults.rb +118 -0
  294. data/lib/playbook/forms/builder/checkbox_field.rb +2 -0
  295. data/lib/playbook/forms/builder/collection_select_field.rb +3 -0
  296. data/lib/playbook/forms/builder/date_picker_field.rb +22 -7
  297. data/lib/playbook/forms/builder/dropdown_field.rb +12 -0
  298. data/lib/playbook/forms/builder/form_field_builder.rb +4 -0
  299. data/lib/playbook/forms/builder/intl_telephone_field.rb +8 -0
  300. data/lib/playbook/forms/builder/multi_level_select_field.rb +10 -0
  301. data/lib/playbook/forms/builder/phone_number_field.rb +8 -0
  302. data/lib/playbook/forms/builder/select_field.rb +3 -0
  303. data/lib/playbook/forms/builder/star_rating_field.rb +7 -0
  304. data/lib/playbook/forms/builder/time_picker_field.rb +8 -0
  305. data/lib/playbook/forms/builder/typeahead_field.rb +15 -0
  306. data/lib/playbook/forms/builder.rb +17 -0
  307. data/lib/playbook/pagination_renderer.rb +1 -1
  308. data/lib/playbook/version.rb +2 -2
  309. metadata +248 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ba21582839d4a05178fc1ea74ca0ad1b8ca652238e4119192fe4c461dcbb9ae
4
- data.tar.gz: 453a53b804b46fb84aaa6d9efd1bf1f316b7525633a57134da3d3f4b6b8c46dd
3
+ metadata.gz: 4f7783b8463c90951131604bdf5eac75eb7fff9767a5c356de003e2eec536569
4
+ data.tar.gz: 99211c843243aa798424571effdacca18bc2a7bb5aab3bd3fb0f7934dd58a4b8
5
5
  SHA512:
6
- metadata.gz: 02f76fdc192859f041aa853a8f155c01248c0bf849a00484409ed5154f99dc4f92bb9829bf24da859c5c38bc532108724eda2dcbe1f11edd1ff527eaa89e1826
7
- data.tar.gz: 8fa85b1670735641741175e82792867fc72459c5ac1040a5117314a66d2a3ce874c83b017fd4342b56d1d80c5c03c90a23c75629ba15cb74c05240696a2cf6fb
6
+ metadata.gz: a19623f9af10397c92244acd88d1e80773655bb988c7b7ed8a9472ee0b018ab53514430911f3b6a0ea3a146ba54534a28704f9d13b010746445591d6f46c941f
7
+ data.tar.gz: c3ef61f6dadfcfcf8c07f757596816573834536e757bab91a2f85e886692e3cf3db7b8633e957b032c776b2422fd20d3a7245f0b6b58fc4be14f4a60c5c43e42
@@ -3,6 +3,7 @@ import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
5
  import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
6
+ import { globalEventProps, GlobalEventProps } from '../utilities/globalEventProps'
6
7
 
7
8
  import Highlight from '../pb_highlight/_highlight'
8
9
 
@@ -21,7 +22,7 @@ type BodyProps = {
21
22
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
22
23
  text?: string,
23
24
  variant?: null | 'link',
24
- } & GlobalProps
25
+ } & GlobalProps & GlobalEventProps
25
26
 
26
27
  const Body = (props: BodyProps): React.ReactElement => {
27
28
  if (props.variant) deprecatedProps() //status prop is deprecated, use color instead please
@@ -56,6 +57,7 @@ const Body = (props: BodyProps): React.ReactElement => {
56
57
  {...ariaProps}
57
58
  {...dataProps}
58
59
  {...htmlProps}
60
+ {...globalEventProps(props)}
59
61
  className={classes}
60
62
  id={id}
61
63
  >
@@ -94,6 +94,7 @@
94
94
  }
95
95
  },
96
96
  "globalProps": true,
97
+ "globalEventProps": true,
97
98
  "usage": {
98
99
  "react": {
99
100
  "import": "import { Body } from 'playbook-ui'",
@@ -7,6 +7,7 @@ import classnames from 'classnames'
7
7
 
8
8
  import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
9
9
  import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
10
+ import { GlobalEventProps, globalEventProps } from '../utilities/globalEventProps'
10
11
  import type { ProductColors, CategoryColors, BackgroundColors, StatusColors } from '../types/colors'
11
12
 
12
13
  import Icon from '../pb_icon/_icon'
@@ -34,7 +35,7 @@ type CardPropTypes = {
34
35
  padding?: string,
35
36
  selected?: boolean,
36
37
  tag?: "div" | "section" | "footer" | "header" | "article" | "aside" | "main" | "nav",
37
- } & GlobalProps
38
+ } & GlobalProps & GlobalEventProps
38
39
 
39
40
  type CardHeaderProps = {
40
41
  headerColor?: BackgroundColors | ProductColors | CategoryColors | StatusColors | "none",
@@ -156,6 +157,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
156
157
  {...dataProps}
157
158
  className={classnames(cardCss, globalProps(props), className)}
158
159
  {...restHtmlProps}
160
+ {...globalEventProps(props)}
159
161
  style={mergedStyles}
160
162
  >
161
163
  {subComponentTags('Header')}
@@ -185,6 +187,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
185
187
  {...dataProps}
186
188
  className={classnames(cardCss, globalProps(props), className)}
187
189
  {...restHtmlProps}
190
+ {...globalEventProps(props)}
188
191
  style={mergedStyles}
189
192
  >
190
193
  {subComponentTags('Header')}
@@ -25,6 +25,16 @@ $additional_colors: (
25
25
  );
26
26
  $background_colors: map-merge($product_colors, $additional_colors);
27
27
  $pb_card_header_colors: map-merge(map-merge(map-merge($product_colors, $additional_colors), $category_colors), $status_colors);
28
+ // Prop sizes only — legacy $border_radius keys like "light" collide with background_light.
29
+ $pb_card_border_radius_values: (
30
+ xs: $border_radius_xs,
31
+ sm: $border_radius_sm,
32
+ md: $border_radius_md,
33
+ lg: $border_radius_lg,
34
+ xl: $border_radius_xl,
35
+ none: $border_radius_none,
36
+ rounded: $border_radius_rounded,
37
+ );
28
38
 
29
39
  @mixin pb_card_selected($border_color: $primary) {
30
40
  border-color: $border_color;
@@ -63,8 +73,8 @@ $pb_card_header_colors: map-merge(map-merge(map-merge($product_colors, $addition
63
73
  }
64
74
  }
65
75
 
66
- @each $name, $radius in $border_radius {
67
- &[class*=_#{$name}] {
76
+ @each $name, $radius in $pb_card_border_radius_values {
77
+ &.pb_card_kit_border_radius_#{$name} {
68
78
  border-radius: $radius;
69
79
  }
70
80
  }
@@ -186,6 +186,7 @@
186
186
  }
187
187
  },
188
188
  "globalProps": true,
189
+ "globalEventProps": true,
189
190
  "usage": {
190
191
  "react": {
191
192
  "import": "import { Card } from 'playbook-ui'",
@@ -112,6 +112,8 @@ type DropdownProps = {
112
112
  isClosed?: boolean;
113
113
  label?: string;
114
114
  multiSelect?: boolean;
115
+ name?: string;
116
+ onChange?: (event: { target: { name?: string; value: any } }) => void;
115
117
  onSelect?: (arg: GenericObject) => null;
116
118
  options?: GenericObject;
117
119
  placeholder?: string;
@@ -156,6 +158,8 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
156
158
  label,
157
159
  multiSelect = false,
158
160
  formPillProps,
161
+ name,
162
+ onChange,
159
163
  onSelect,
160
164
  options,
161
165
  placeholder,
@@ -414,6 +418,10 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
414
418
  setIsDropDownClosed(false);
415
419
  };
416
420
 
421
+ const handleSelectionChange = (value: any) => {
422
+ onSelect && onSelect(value);
423
+ onChange && onChange({ target: { name, value } });
424
+ };
417
425
 
418
426
  const handleOptionClick = (clickedItem: GenericObject) => {
419
427
  if (disabled) return;
@@ -426,7 +434,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
426
434
  const next = exists
427
435
  ? list.filter((option) => option.value !== clickedItem.value)
428
436
  : [...list, clickedItem];
429
- onSelect && onSelect(next);
437
+ handleSelectionChange(next);
430
438
  return next;
431
439
  });
432
440
  setFilterItem("");
@@ -439,7 +447,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
439
447
  if (shouldCloseOnClick) {
440
448
  setIsDropDownClosed(true);
441
449
  }
442
- onSelect && onSelect(clickedItem);
450
+ handleSelectionChange(clickedItem);
443
451
 
444
452
  // Sync with DatePickers if this is a quickpick variant
445
453
  if (variant === "quickpick" && Array.isArray(clickedItem.value)) {
@@ -468,10 +476,10 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
468
476
  if (disabled) return;
469
477
  if (multiSelect) {
470
478
  setSelected([]);
471
- onSelect && onSelect([]);
479
+ handleSelectionChange([]);
472
480
  } else {
473
481
  setSelected({});
474
- onSelect && onSelect(null);
482
+ handleSelectionChange(null);
475
483
  setFocusedOptionIndex(-1);
476
484
  setFilterItem("");
477
485
 
@@ -505,10 +513,10 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
505
513
  clearSelected: () => {
506
514
  if (multiSelect) {
507
515
  setSelected([]);
508
- onSelect && onSelect([]);
516
+ handleSelectionChange([]);
509
517
  } else {
510
518
  setSelected({});
511
- onSelect && onSelect(null);
519
+ handleSelectionChange(null);
512
520
  }
513
521
  setFilterItem("");
514
522
  setIsDropDownClosed(true);
@@ -522,16 +530,16 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
522
530
  clearSelected: () => {
523
531
  if (multiSelect) {
524
532
  setSelected([]);
525
- onSelect && onSelect([]);
533
+ handleSelectionChange([]);
526
534
  } else {
527
535
  setSelected({});
528
- onSelect && onSelect(null);
536
+ handleSelectionChange(null);
529
537
  }
530
538
  setFilterItem("");
531
539
  setIsDropDownClosed(true);
532
540
  },
533
541
  };
534
- }, [multiSelect, onSelect, setSelected, setFilterItem, setIsDropDownClosed]);
542
+ }, [multiSelect, handleSelectionChange, setSelected, setFilterItem, setIsDropDownClosed]);
535
543
 
536
544
  useImperativeHandle(ref, () => imperativeRef.current);
537
545
 
@@ -594,6 +602,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
594
602
  handleBackspace,
595
603
  handleChange,
596
604
  handleOptionClick,
605
+ handleSelectionChange,
597
606
  handleWrapperClick,
598
607
  inputRef,
599
608
  inputWrapperRef,
@@ -0,0 +1,34 @@
1
+ <%= pb_rails("select", props: {
2
+ id: "color_context_dropdown",
3
+ label: "Choose a Color",
4
+ name: "color_name",
5
+ options: [
6
+ { value: "red", value_text: "Red" },
7
+ { value: "blue", value_text: "Blue" },
8
+ { value: "green", value_text: "Green" },
9
+ ],
10
+ }) %>
11
+
12
+ <%= pb_rails("dropdown", props: {
13
+ id: "dropdown-dynamic-options",
14
+ label: "Pick a Shade",
15
+ name: "shade_name",
16
+ context_selector: "color_context_dropdown",
17
+ options_by_context: {
18
+ "red" => [
19
+ { id: "scarlet", label: "Scarlet", value: "scarlet" },
20
+ { id: "mahogany", label: "Mahogany", value: "mahogany" },
21
+ { id: "crimson", label: "Crimson", value: "crimson" },
22
+ ],
23
+ "blue" => [
24
+ { id: "sky", label: "Sky Blue", value: "sky" },
25
+ { id: "cerulean", label: "Cerulean", value: "cerulean" },
26
+ { id: "navy", label: "Navy", value: "navy" },
27
+ ],
28
+ "green" => [
29
+ { id: "emerald", label: "Emerald", value: "emerald" },
30
+ { id: "mint", label: "Mint", value: "mint" },
31
+ { id: "olive", label: "Olive", value: "olive" },
32
+ ],
33
+ },
34
+ }) %>
@@ -0,0 +1,4 @@
1
+ You can set up a dropdown to update its options dynamically based on another input. To achieve this:
2
+ - Give the dropdown a unique `id` so it can be targeted by events and linked to a controlling input.
3
+ - Use `context_selector` to point at the controlling select’s `id`. On connect, and whenever that select’s value changes, the Dropdown reads the current value as its context.
4
+ - Use `options_by_context` to pass a hash of option lists. Keys must match the possible values of the controlling select; each key maps to an array of `{ id, label, value }` options that replace the Dropdown’s options for that context.
@@ -0,0 +1,35 @@
1
+ <%= pb_rails("select", props: {
2
+ id: "color_context_dropdown_autocomplete",
3
+ label: "Choose a Color",
4
+ name: "color_name_autocomplete",
5
+ options: [
6
+ { value: "red", value_text: "Red" },
7
+ { value: "blue", value_text: "Blue" },
8
+ { value: "green", value_text: "Green" },
9
+ ],
10
+ }) %>
11
+
12
+ <%= pb_rails("dropdown", props: {
13
+ id: "dropdown-dynamic-options-autocomplete",
14
+ label: "Pick a Shade",
15
+ name: "shade_name_autocomplete",
16
+ autocomplete: true,
17
+ context_selector: "color_context_dropdown_autocomplete",
18
+ options_by_context: {
19
+ "red" => [
20
+ { id: "scarlet", label: "Scarlet", value: "scarlet" },
21
+ { id: "mahogany", label: "Mahogany", value: "mahogany" },
22
+ { id: "crimson", label: "Crimson", value: "crimson" },
23
+ ],
24
+ "blue" => [
25
+ { id: "sky", label: "Sky Blue", value: "sky" },
26
+ { id: "cerulean", label: "Cerulean", value: "cerulean" },
27
+ { id: "navy", label: "Navy", value: "navy" },
28
+ ],
29
+ "green" => [
30
+ { id: "emerald", label: "Emerald", value: "emerald" },
31
+ { id: "mint", label: "Mint", value: "mint" },
32
+ { id: "olive", label: "Olive", value: "olive" },
33
+ ],
34
+ },
35
+ }) %>
@@ -0,0 +1 @@
1
+ Dynamic options also work with `autocomplete`. Use the same `context_selector` and `options_by_context` setup as Dynamic Options, and set `autocomplete: true` so the Dropdown can be filtered by typing.
@@ -0,0 +1,35 @@
1
+ <%= pb_rails("select", props: {
2
+ id: "color_context_dropdown_multi",
3
+ label: "Choose a Color",
4
+ name: "color_name_multi",
5
+ options: [
6
+ { value: "red", value_text: "Red" },
7
+ { value: "blue", value_text: "Blue" },
8
+ { value: "green", value_text: "Green" },
9
+ ],
10
+ }) %>
11
+
12
+ <%= pb_rails("dropdown", props: {
13
+ id: "dropdown-dynamic-options-multi",
14
+ label: "Pick Shades",
15
+ name: "shade_names",
16
+ multi_select: true,
17
+ context_selector: "color_context_dropdown_multi",
18
+ options_by_context: {
19
+ "red" => [
20
+ { id: "scarlet", label: "Scarlet", value: "scarlet" },
21
+ { id: "mahogany", label: "Mahogany", value: "mahogany" },
22
+ { id: "crimson", label: "Crimson", value: "crimson" },
23
+ ],
24
+ "blue" => [
25
+ { id: "sky", label: "Sky Blue", value: "sky" },
26
+ { id: "cerulean", label: "Cerulean", value: "cerulean" },
27
+ { id: "navy", label: "Navy", value: "navy" },
28
+ ],
29
+ "green" => [
30
+ { id: "emerald", label: "Emerald", value: "emerald" },
31
+ { id: "mint", label: "Mint", value: "mint" },
32
+ { id: "olive", label: "Olive", value: "olive" },
33
+ ],
34
+ },
35
+ }) %>
@@ -0,0 +1 @@
1
+ Dynamic options also work with `multi_select`. Use the same `context_selector` and `options_by_context` setup as Dynamic Options, and set `multi_select: true` to allow selecting multiple options.
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+
3
+ import Dropdown from '../_dropdown'
4
+ import Title from '../../pb_title/_title'
5
+ import { useForm } from 'react-hook-form'
6
+
7
+ const options = [
8
+ { label: 'United States', value: 'unitedStates', id: 'us' },
9
+ { label: 'United Kingdom', value: 'unitedKingdom', id: 'gb' },
10
+ { label: 'Canada', value: 'canada', id: 'ca' },
11
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
12
+ { label: 'India', value: 'india', id: 'in' },
13
+ { label: 'Australia', value: 'australia', id: 'au' },
14
+ { label: 'New Zealand', value: 'new Zealand', id: 'nz' },
15
+ { label: 'Italy', value: 'italy', id: 'it' },
16
+ { label: 'Spain', value: 'spain', id: 'es' },
17
+ ]
18
+
19
+ const DropdownMultiSelectReactHook = (props) => {
20
+ const { register, watch } = useForm()
21
+
22
+ const selectedCountries = watch('countries')
23
+
24
+ return (
25
+ <>
26
+ <Dropdown
27
+ label="Countries"
28
+ multiSelect
29
+ options={options}
30
+ {...props}
31
+ {...register('countries')}
32
+ />
33
+ <Title
34
+ marginTop="sm"
35
+ size={4}
36
+ text="Selected Countries"
37
+ />
38
+ {selectedCountries && selectedCountries.map(country => (
39
+ <p key={country.id}>{`${country.label} - ${country.value}`}</p>
40
+ ))}
41
+ </>
42
+ )
43
+ }
44
+
45
+ export default DropdownMultiSelectReactHook
@@ -0,0 +1 @@
1
+ You can pass `react-hook-form` props to a multi-select Dropdown. Spread `register` onto Dropdown with `multiSelect` to keep the selected options array in form state.
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+
3
+ import Dropdown from '../_dropdown'
4
+ import Title from '../../pb_title/_title'
5
+ import { useForm } from 'react-hook-form'
6
+
7
+ const options = [
8
+ { label: 'United States', value: 'unitedStates', id: 'us' },
9
+ { label: 'Canada', value: 'canada', id: 'ca' },
10
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
11
+ ]
12
+
13
+ const DropdownReactHook = (props) => {
14
+ const { register, watch } = useForm()
15
+
16
+ const selectedCountry = watch('country')
17
+
18
+ return (
19
+ <>
20
+ <Dropdown
21
+ label="Countries"
22
+ options={options}
23
+ {...props}
24
+ {...register('country')}
25
+ />
26
+ <Title
27
+ marginTop="sm"
28
+ size={4}
29
+ text="Selected Country"
30
+ />
31
+ <p>{selectedCountry && `${selectedCountry.label} - ${selectedCountry.value}`}</p>
32
+ </>
33
+ )
34
+ }
35
+
36
+ export default DropdownReactHook
@@ -0,0 +1 @@
1
+ You can pass `react-hook-form` props to the Dropdown kit. Spread `register` onto a single-select Dropdown to keep the selected option in form state.
@@ -88,6 +88,7 @@
88
88
  "name": "Content",
89
89
  "props": [
90
90
  "label",
91
+ "name",
91
92
  "placeholder",
92
93
  "options",
93
94
  "defaultValue",
@@ -130,6 +131,7 @@
130
131
  {
131
132
  "name": "Events",
132
133
  "props": [
134
+ "onChange",
133
135
  "onSelect"
134
136
  ]
135
137
  }
@@ -70,6 +70,7 @@
70
70
  "name": "Content",
71
71
  "props": [
72
72
  "label",
73
+ "name",
73
74
  "placeholder",
74
75
  "options",
75
76
  "defaultValue",
@@ -111,7 +112,7 @@
111
112
  },
112
113
  {
113
114
  "name": "Events",
114
- "props": ["onSelect"]
115
+ "props": ["onChange", "onSelect"]
115
116
  }
116
117
  ],
117
118
  "presets": [
@@ -39,6 +39,9 @@ examples:
39
39
  - dropdown_disabled: Disabled Input
40
40
  - dropdown_grouped_options: Grouped Options
41
41
  - dropdown_custom_event_type: Custom Event Type
42
+ - dropdown_dynamic_options: Dynamic Options
43
+ - dropdown_dynamic_options_with_autocomplete: Dynamic Options with Autocomplete
44
+ - dropdown_dynamic_options_with_multi_select: Dynamic Options with Multi Select
42
45
 
43
46
  react:
44
47
  - dropdown_default: Default
@@ -81,3 +84,6 @@ examples:
81
84
  - dropdown_required_indicator: Required Indicator
82
85
  - dropdown_disabled: Disabled Input
83
86
  - dropdown_grouped_options: Grouped Options
87
+ - dropdown_react_hook: React Hook
88
+ - dropdown_multi_select_react_hook: React Hook Multi Select
89
+
@@ -1,4 +1,6 @@
1
1
  export { default as DropdownDefault } from './_dropdown_default.jsx'
2
+ export { default as DropdownReactHook } from './_dropdown_react_hook.jsx'
3
+ export { default as DropdownMultiSelectReactHook } from './_dropdown_multi_select_react_hook.jsx'
2
4
  export { default as DropdownWithCustomDisplay } from './_dropdown_with_custom_display.jsx'
3
5
  export { default as DropdownWithCustomOptions } from './_dropdown_with_custom_options.jsx'
4
6
  export { default as DropdownWithCustomTrigger } from './_dropdown_with_custom_trigger.jsx'
@@ -59,6 +59,14 @@ module Playbook
59
59
  default: false
60
60
  prop :custom_event_type, type: Playbook::Props::String,
61
61
  default: ""
62
+ prop :options_by_context, type: Playbook::Props::HashProp,
63
+ default: {}
64
+ prop :context_selector, type: Playbook::Props::String,
65
+ default: ""
66
+ prop :clear_on_context_change, type: Playbook::Props::Boolean,
67
+ default: true
68
+ prop :options_event_type, type: Playbook::Props::String,
69
+ default: ""
62
70
 
63
71
  def data
64
72
  Hash(prop(:data)).merge(
@@ -73,7 +81,11 @@ module Playbook
73
81
  end_date_id: variant == "quickpick" ? end_date_id : nil,
74
82
  controls_start_id: variant == "quickpick" && controls_start_id.present? ? controls_start_id : nil,
75
83
  controls_end_id: variant == "quickpick" && controls_end_id.present? ? controls_end_id : nil,
76
- custom_event_type: custom_event_type.presence
84
+ custom_event_type: custom_event_type.presence,
85
+ pb_dropdown_options_by_context: options_by_context.present? ? options_by_context.to_json : nil,
86
+ pb_dropdown_context_selector: context_selector.presence,
87
+ pb_dropdown_clear_on_context_change: clear_on_context_change,
88
+ options_event_type: options_event_type.presence
77
89
  ).compact
78
90
  end
79
91