playbook_ui 15.4.0 → 15.5.0.pre.alpha.PLAY2503datepickerdefaultdateoutsideminmaxrange12814

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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +96 -6
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +2 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +3 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +3 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +2 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
  11. data/app/pb_kits/playbook/pb_background/background.test.js +5 -1
  12. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +0 -1
  14. data/app/pb_kits/playbook/pb_background/docs/_background_light.md +1 -0
  15. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
  16. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +21 -8
  17. data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +6 -2
  18. data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +3 -0
  19. data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +24 -0
  20. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +9 -0
  21. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +24 -0
  22. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +1 -0
  23. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +1 -0
  24. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -2
  25. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +1 -2
  26. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +2 -2
  27. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +2 -0
  28. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
  29. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
  31. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
  32. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
  33. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
  34. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
  35. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
  36. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
  37. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
  38. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
  39. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
  40. data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
  41. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +25 -11
  42. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +24 -0
  43. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +225 -6
  44. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.html.erb +18 -0
  45. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +20 -13
  46. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +6 -4
  47. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +17 -0
  48. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +4 -0
  49. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +43 -0
  50. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +1 -0
  51. data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
  52. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +3 -2
  53. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +1 -0
  54. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +6 -4
  55. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +2 -3
  56. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +11 -5
  57. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.test.js +26 -9
  58. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.html.erb +12 -0
  59. data/app/pb_kits/playbook/pb_date_stacked/docs/{_date_stacked_not_current_year.jsx → _date_stacked_current_year.jsx} +6 -5
  60. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.md +1 -0
  61. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb +1 -1
  62. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx +1 -1
  63. data/app/pb_kits/playbook/pb_date_stacked/docs/_description.md +1 -1
  64. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +2 -2
  65. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -1
  66. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
  67. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
  68. data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
  69. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
  70. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
  71. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
  72. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
  73. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
  74. data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
  75. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
  76. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
  77. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
  78. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
  79. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
  80. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
  81. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
  82. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
  83. data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
  84. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +33 -2
  85. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +156 -6
  86. data/app/pb_kits/playbook/pb_draggable/context/types.ts +8 -3
  87. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +180 -0
  88. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +22 -0
  89. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +3 -2
  90. data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
  91. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +77 -1
  92. data/app/pb_kits/playbook/pb_dropdown/index.js +32 -14
  93. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.jsx +2 -1
  94. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.jsx +2 -1
  95. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.jsx +2 -1
  96. data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.jsx +2 -1
  97. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
  98. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +31 -9
  99. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +12 -5
  100. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +1 -0
  101. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +8 -1
  102. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +11 -1
  103. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +4 -1
  104. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +34 -22
  105. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +16 -12
  106. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
  107. data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +16 -12
  108. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +16 -12
  109. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +1 -1
  110. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +10 -0
  111. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +66 -15
  112. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +42 -0
  113. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +1 -0
  114. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +1 -0
  115. data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +1 -0
  116. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +25 -0
  117. data/app/pb_kits/playbook/pb_nav/_item.tsx +18 -4
  118. data/app/pb_kits/playbook/pb_nav/_nav.scss +30 -5
  119. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +192 -0
  120. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  121. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.html.erb +21 -0
  122. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.jsx +113 -0
  123. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.md +1 -0
  124. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.html.erb +30 -0
  125. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.jsx +117 -0
  126. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.md +1 -0
  127. data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
  128. data/app/pb_kits/playbook/pb_nav/docs/index.js +3 -1
  129. data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -4
  130. data/app/pb_kits/playbook/pb_nav/item.rb +11 -2
  131. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -1
  132. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +1 -1
  133. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +1 -1
  134. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.md +1 -0
  135. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +1 -1
  136. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +1 -1
  137. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +1 -1
  138. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +1 -2
  139. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +1 -1
  140. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +1 -1
  141. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.md +11 -0
  142. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +1 -1
  143. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +1 -1
  144. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +1 -2
  145. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +1 -2
  146. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -1
  147. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +2 -1
  148. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +2 -1
  149. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +1 -1
  150. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +2 -1
  151. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +2 -1
  152. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +1 -1
  153. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +1 -1
  154. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
  155. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.md +1 -0
  156. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +1 -1
  157. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +2 -1
  158. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +1 -1
  159. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +1 -1
  160. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -1
  161. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +1 -1
  162. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +2 -2
  163. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +2 -1
  164. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.md +1 -0
  165. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +2 -1
  166. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +2 -1
  167. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +2 -1
  168. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +2 -1
  169. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -1
  170. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +1 -1
  171. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.md +1 -0
  172. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +1 -1
  173. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +44 -10
  174. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +34 -4
  175. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +16 -7
  176. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +4 -1
  177. data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +384 -262
  178. data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +1 -5
  179. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.html.erb +14 -0
  180. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.jsx +29 -0
  181. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.md +3 -0
  182. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.jsx +31 -0
  183. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.md +1 -0
  184. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +4 -1
  185. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +14 -3
  186. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.md +3 -0
  187. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.md +3 -0
  188. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.html.erb +1 -7
  189. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.md +1 -0
  190. data/app/pb_kits/playbook/pb_progress_step/docs/example.yml +3 -0
  191. data/app/pb_kits/playbook/pb_progress_step/docs/index.js +2 -0
  192. data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +41 -0
  193. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -1
  194. data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +3 -1
  195. data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
  196. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -0
  197. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +4 -1
  198. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
  199. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +15 -0
  200. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
  201. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +13 -2
  202. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +7 -1
  203. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +34 -7
  204. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +30 -0
  205. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +37 -0
  206. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +3 -0
  207. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +2 -1
  208. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  209. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -1
  210. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +6 -1
  211. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +1 -1
  212. data/app/pb_kits/playbook/utilities/_truncate.scss +2 -0
  213. data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
  214. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
  215. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
  216. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
  217. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
  218. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
  219. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
  220. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
  221. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
  222. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
  223. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
  224. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
  225. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
  226. data/dist/chunks/_typeahead-DCwdpOmC.js +6 -0
  227. data/dist/chunks/lib-x6lM2EFN.js +29 -0
  228. data/dist/chunks/vendor.js +37 -1
  229. data/dist/playbook-rails-react-bindings.js +1 -1
  230. data/dist/playbook-rails.js +1 -1
  231. data/dist/playbook.css +1 -1
  232. data/lib/playbook/version.rb +2 -2
  233. metadata +54 -12
  234. data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
  235. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb +0 -5
  236. data/dist/chunks/_line_graph-r__oOO2H.js +0 -1
  237. data/dist/chunks/_typeahead-B7c52zVj.js +0 -6
  238. data/dist/chunks/_weekday_stacked-DgiIj2w3.js +0 -37
  239. data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
  240. data/dist/chunks/lib-CRUXizZe.js +0 -29
  241. data/dist/chunks/pb_form_validation-CywJN0ej.js +0 -1
  242. data/dist/playbook-doc.js +0 -19
@@ -4,6 +4,7 @@ module Playbook
4
4
  module PbNav
5
5
  class Item < Playbook::KitBase
6
6
  prop :active, type: Playbook::Props::Boolean, default: false
7
+ prop :disabled, type: Playbook::Props::Boolean, default: false
7
8
  prop :font_size, type: Playbook::Props::Enum,
8
9
  values: %w[normal small],
9
10
  default: "normal"
@@ -26,7 +27,7 @@ module Playbook
26
27
  if collapsible
27
28
  "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link_collapsible"
28
29
  else
29
- "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link"
30
+ "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link#{disabled_class}"
30
31
  end
31
32
  end
32
33
 
@@ -81,7 +82,11 @@ module Playbook
81
82
  end
82
83
 
83
84
  def tag
84
- link ? "a" : "div"
85
+ link && !disabled ? "a" : "div"
86
+ end
87
+
88
+ def is_link
89
+ link && !disabled
85
90
  end
86
91
 
87
92
  def collapsible_icons
@@ -98,6 +103,10 @@ module Playbook
98
103
  active ? "active" : nil
99
104
  end
100
105
 
106
+ def disabled_class
107
+ disabled ? " pb_nav_item_disabled" : nil
108
+ end
109
+
101
110
  def highlighted_border_class
102
111
  !highlighted_border && active ? "highlighted_border_none" : nil
103
112
  end
@@ -1,3 +1,5 @@
1
- This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo. Once done, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
1
+ **In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.**
2
+
3
+ This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
2
4
 
3
5
  See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
  import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const chartData = [{
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  const chartData = [{
5
5
  name: 'Installation',
@@ -0,0 +1 @@
1
+ In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  const chartData = [{
5
5
  name: 'Number of Installations',
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartOptions = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartData = [{
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Number of Installations',
@@ -36,7 +36,7 @@
36
36
  }
37
37
  %>
38
38
 
39
- <%= pb_rails("title", props: {size: 4, text: "align | vertical_align", padding_top: "sm", padding_bottom: "sm"})%>
39
+ <%= pb_rails("title", props: {size: 4, text: "align | verticalAlign", padding_top: "sm", padding_bottom: "sm"})%>
40
40
 
41
41
 
42
42
  <%= pb_rails("pb_bar_graph", props: {options: chart_options_right}) %>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
  import Title from "../../pb_title/_title"
4
4
 
5
5
 
@@ -0,0 +1,11 @@
1
+ Highcharts provides many options for customizing the legend display. This example showcases the following:
2
+
3
+ `align` can be used to align the legend left, right or center (defaults to center)
4
+
5
+ `verticalAlign` can be used to place the legend above the graph. Options are top, middle, bottom with default set to bottom
6
+
7
+ `layout` determines the position of the legend items. Options are horizontal, vertical or proximate with default set to horizontal `layout: proximate` will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.
8
+
9
+ `x` offsets the legend relative to its horizontal alignment. Negative x moves it to the left, positive x moves it to the right (defaults to 0)
10
+
11
+ `y` offsets the legend relative to its vertical alignment. Negative y moves it up, positive y moves it down (defaults to 0)
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
 
5
5
  const chartData = [{
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
2
+ import PbBarGraph from '../_pb_bar_graph'
3
3
 
4
4
  import colors from '../../tokens/exports/_colors.module.scss'
5
5
  import typography from '../../tokens/exports/_typography.module.scss'
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Number of Installations',
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
- import { PbBarGraph } from 'playbook-ui'
3
-
2
+ import PbBarGraph from '../_pb_bar_graph'
4
3
 
5
4
  const chartData = [{
6
5
  name: 'Installation',
@@ -1,3 +1,5 @@
1
- This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo. Once done, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
1
+ **In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.**
2
+
3
+ This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
2
4
 
3
5
  See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, Title } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Title from "../../pb_title/_title";
3
4
 
4
5
  const data= [
5
6
  {
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, colors } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import colors from '../../tokens/exports/_colors.module.scss';
3
4
 
4
5
  const data= [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [
5
5
  {
@@ -1,4 +1,5 @@
1
- Custom tooltip formatting is configured through the tooltip object in the options passed to the kit:
1
+ Tooltip options from Highcharts:
2
+
2
3
  `headerFormat` **Type**: String | when set to null will disable the header.
3
4
  `pointFormat` **Type**: String | defines the HTML template for each data point and supports custom HTML when `useHTML` is enabled.
4
5
  `useHTML` **Type**: boolean (default false) | enables HTML rendering in tooltips.
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { PbCircleChart, Title } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Title from "../../pb_title/_title";
3
4
 
4
5
  const dataFirst = [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data = [{
5
5
  name: 'Bugs',
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const chartOptions = {
5
5
  series: [
@@ -0,0 +1 @@
1
+ In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const dataFirst = [
5
5
  {
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from "react";
2
- import { PbCircleChart, Button } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
+ import Button from "../../pb_button/_button";
3
4
 
4
5
  const chartData = [
5
6
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data= [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { PbCircleChart } from "playbook-ui";
2
+ import PbCircleChart from "../_pb_circle_chart";
3
3
 
4
4
  const data= [
5
5
  {
@@ -1,3 +1,5 @@
1
- This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo. Once done, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
1
+ **In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.**
2
+
3
+ This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
2
4
 
3
5
  See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const data = [{ name: "Name", y: 67 }]
6
6
 
@@ -1,5 +1,5 @@
1
1
  Highcharts allows for any custom colors to be used. Custom data colors allow for color customization to match the needs of business requirements.
2
2
 
3
- For React, pass the prop `plotOptions.solidgauge.borderColor` with a Playbook token like `colors.` + `data_1 | data_2 | data_3 | data_4 | data_5 | data_6 | data_7 | data_8`. HEX colors are also available `eg: #CA0095`
3
+ For React, pass the option `plotOptions.solidgauge.borderColor` with a Playbook token like `colors.` + `data_1 | data_2 | data_3 | data_4 | data_5 | data_6 | data_7 | data_8`. HEX colors are also available `eg: #CA0095`
4
4
 
5
- For Rails, the prop `plotOptions.solidgauge.borderColor` can only be used with HEX values as shown.
5
+ For Rails, the option `plotOptions.solidgauge.borderColor` can only be used with HEX values as shown.
@@ -7,7 +7,8 @@ import Caption from '../../pb_caption/_caption'
7
7
  import Body from '../../pb_body/_body'
8
8
  import SectionSeparator from '../../pb_section_separator/_section_separator'
9
9
  import Title from '../../pb_title/_title'
10
- import { colors, typography } from 'playbook-ui'
10
+ import colors from '../../tokens/exports/_colors.module.scss'
11
+ import typography from '../../tokens/exports/_typography.module.scss'
11
12
 
12
13
  const data = [{ name: "Name", y: 10 }];
13
14
 
@@ -0,0 +1 @@
1
+ In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const data = [{ name: "Capacity", y: 75 }]
6
7
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const chartOptions = {
6
7
  title: {
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
  const data = [{ name: "Rating", y: 4.5 }]
6
7
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
- import { colors, typography } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import typography from '../../tokens/exports/_typography.module.scss'
4
5
 
5
6
 
6
7
  const data1 = [
@@ -1,3 +1,5 @@
1
- This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo. Once done, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
1
+ **In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.**
2
+
3
+ This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.
2
4
 
3
5
  See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import PbLineGraph from '../../pb_pb_line_graph/_pb_line_graph'
3
- import { colors } from 'playbook-ui'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
4
 
5
5
  const data = [{
6
6
  name: 'Installation',
@@ -0,0 +1 @@
1
+ In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.
@@ -37,7 +37,7 @@
37
37
  },
38
38
  } %>
39
39
 
40
- <%= pb_rails("title", props: {size: 4, text: "align | vertical_align", padding_top: "sm", padding_bottom: "sm"})%>
40
+ <%= pb_rails("title", props: {size: 4, text: "align | verticalAlign", padding_top: "sm", padding_bottom: "sm"})%>
41
41
  <%= pb_rails("pb_line_graph", props: {options: chartOptionsFirst}) %>
42
42
 
43
43
  <% chartOptionsSecond = {
@@ -110,13 +110,25 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
110
110
  const inputRef = useRef<HTMLInputElement | null>(null)
111
111
  const itiRef = useRef<any>(null);
112
112
  const wrapperRef = useRef<HTMLDivElement | null>(null);
113
+ const hasBlurredRef = useRef<boolean>(false);
114
+ const formSubmittedRef = useRef<boolean>(false);
113
115
  const [inputValue, setInputValue] = useState(value)
114
116
  const [error, setError] = useState(props.error || "")
115
117
  const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
116
118
  const [selectedData, setSelectedData] = useState()
117
119
  const [hasTyped, setHasTyped] = useState(false)
120
+ const [hasBlurred, setHasBlurred] = useState(false)
118
121
  const [formSubmitted, setFormSubmitted] = useState(false)
119
122
  const [hasStartedValidating, setHasStartedValidating] = useState(false)
123
+
124
+ // Keep refs in sync with state for use in event listeners
125
+ useEffect(() => {
126
+ hasBlurredRef.current = hasBlurred
127
+ }, [hasBlurred])
128
+
129
+ useEffect(() => {
130
+ formSubmittedRef.current = formSubmitted
131
+ }, [formSubmitted])
120
132
 
121
133
  // Only sync initial error from props, not continuous updates
122
134
  // Once validation starts, internal validation takes over
@@ -143,8 +155,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
143
155
  }
144
156
 
145
157
  // Determine which error to display
146
- // Show internal errors on blur (hasTyped) or on form submission (formSubmitted)
147
- const shouldShowInternalError = (hasTyped || formSubmitted) && required && error
158
+ // Show internal errors only after blur (hasBlurred) or on form submission (formSubmitted)
159
+ const shouldShowInternalError = (hasBlurred || formSubmitted) && error
148
160
  const displayError = shouldShowInternalError ? error : ""
149
161
 
150
162
  useEffect(() => {
@@ -259,7 +271,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
259
271
  return
260
272
  }
261
273
 
262
- if (!hasTyped && !error) return
274
+ // Only validate if field has been blurred or form has been submitted
275
+ // Use refs here since state updates are async and we need current values
276
+ if (!hasBlurredRef.current && !formSubmittedRef.current) return
263
277
 
264
278
  // Run validation checks
265
279
  if (itiRef.current) isValid(itiRef.current.isValidNumber())
@@ -280,6 +294,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
280
294
  if (phoneNumberContainer && phoneNumberContainer === wrapperRef.current) {
281
295
  const invalidInputName = target.name || target.getAttribute('name')
282
296
  if (invalidInputName === name) {
297
+ formSubmittedRef.current = true
283
298
  setFormSubmitted(true)
284
299
  // Trigger validation when form is submitted
285
300
  validateErrors()
@@ -305,6 +320,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
305
320
  setInputValue("")
306
321
  setError("")
307
322
  setHasTyped(false)
323
+ hasBlurredRef.current = false
324
+ setHasBlurred(false)
325
+ formSubmittedRef.current = false
308
326
  setFormSubmitted(false)
309
327
  setHasStartedValidating(false)
310
328
  // Only clear validation state if field was required
@@ -322,6 +340,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
322
340
 
323
341
  if (required && isEmpty) {
324
342
  setError('Missing phone number')
343
+ formSubmittedRef.current = true
325
344
  setFormSubmitted(true)
326
345
  return 'Missing phone number'
327
346
  }
@@ -378,6 +397,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
378
397
 
379
398
  // Set the error state so the validation attribute gets added
380
399
  setError(errorMessage)
400
+ formSubmittedRef.current = true
381
401
  setFormSubmitted(true)
382
402
  setHasTyped(true)
383
403
 
@@ -401,6 +421,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
401
421
 
402
422
  // Reset form submitted state when user types
403
423
  if (formSubmitted) {
424
+ formSubmittedRef.current = false
404
425
  setFormSubmitted(false)
405
426
  }
406
427
 
@@ -416,11 +437,15 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
416
437
 
417
438
  setSelectedData(phoneNumberData)
418
439
  onChange(phoneNumberData)
419
- isValid(itiRef.current.isValidNumber())
440
+
441
+ // Don't call isValid callback on change - only on blur or form submission
442
+ // This prevents triggering validation while typing
443
+ // Use refs to get current values in case this is called from event listener
444
+ if (hasBlurredRef.current || formSubmittedRef.current) {
445
+ isValid(itiRef.current.isValidNumber())
446
+ }
420
447
 
421
- // Trigger validation after onChange for React Hook Form
422
- // This ensures validation state is up-to-date
423
- setTimeout(() => validateErrors(), 0)
448
+ // Don't validate on change - only validate on blur or form submission
424
449
  }
425
450
 
426
451
  // Separating Concerns as React Docs Recommend
@@ -482,7 +507,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
482
507
 
483
508
  setSelectedData(phoneNumberData)
484
509
  onChange(phoneNumberData)
485
- isValid(telInputInit.isValidNumber())
510
+
511
+ // Don't call isValid callback on change - only on blur or form submission
512
+ // Use refs to check current blur state in the event listener (closure issue)
513
+ if (hasBlurredRef.current || formSubmittedRef.current) {
514
+ isValid(telInputInit.isValidNumber())
515
+ }
486
516
  })
487
517
  }
488
518
  }
@@ -492,12 +522,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
492
522
  dark,
493
523
  "data-phone-number": JSON.stringify(selectedData),
494
524
  disabled,
495
- error: hasTyped ? error : props.error || displayError,
525
+ error: displayError || props.error || "",
496
526
  type: 'tel',
497
527
  id,
498
528
  label,
499
529
  name,
500
- onBlur: validateErrors,
530
+ onBlur: () => {
531
+ hasBlurredRef.current = true
532
+ setHasBlurred(true)
533
+ validateErrors()
534
+ },
501
535
  onChange: formatAsYouType ? undefined : handleOnChange,
502
536
  value: inputValue
503
537
  }
@@ -1,12 +1,42 @@
1
1
  <form id="example-form-validation" action="" method="get">
2
- <%= pb_rails("phone_number_input", props: { error: "Missing phone number", id: "validation", initial_country: "af", value: "", required: true }) %>
2
+ <%= pb_rails("phone_number_input", props: {
3
+ id: "validation",
4
+ initial_country: "af",
5
+ value: "",
6
+ required: true
7
+ }) %>
3
8
  <%= pb_rails("button", props: {html_type: "submit", text: "Save Phone Number"}) %>
4
9
  </form>
5
10
 
6
11
  <%= javascript_tag do %>
7
12
  document.addEventListener('DOMContentLoaded', function () {
8
- document.querySelector('#example-form-validation').addEventListener('submit', function (e) {
9
- if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) e.preventDefault();
10
- })
13
+ const form = document.querySelector('#example-form-validation');
14
+
15
+ // Wait for React component to mount
16
+ function waitForComponent() {
17
+ const phoneInput = form.querySelector('#validation');
18
+
19
+ if (!phoneInput) {
20
+ setTimeout(waitForComponent, 100);
21
+ return;
22
+ }
23
+
24
+ // Wait for intl-tel-input to initialize, then focus and blur to trigger validation
25
+ setTimeout(function() {
26
+ phoneInput.focus({ preventScroll: true });
27
+ setTimeout(function() {
28
+ phoneInput.blur();
29
+ }, 100);
30
+ }, 500);
31
+ }
32
+
33
+ waitForComponent();
34
+
35
+ // Prevent form submission if there are validation errors
36
+ form.addEventListener('submit', function (e) {
37
+ if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) {
38
+ e.preventDefault();
39
+ }
40
+ });
11
41
  })
12
42
  <% end %>