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
@@ -70,22 +70,36 @@
70
70
  <%= javascript_tag do %>
71
71
  (function() {
72
72
  const loadDatePicker = () => {
73
- datePickerHelper(<%= object.date_picker_config %>, "<%= object.scroll_container %>")
73
+ const input = document.getElementById("<%= object.picker_id %>");
74
+ if (input && !input._flatpickr) {
75
+ datePickerHelper(<%= object.date_picker_config %>, "<%= object.scroll_container %>")
74
76
 
75
- if (<%= object.selection_type == "quickpick" %>) {
76
- document.getElementById("<%= object.picker_id %>").addEventListener("change", ({ target }) => {
77
- const startDate = document.getElementById("<%= object.start_date_id %>")
78
- const endDate = document.getElementById("<%= object.end_date_id %>")
79
- const splittedValue = target.value.split(" to ")
80
- startDate.value = splittedValue[0]
81
- endDate.value = splittedValue[1] ? splittedValue[1] : splittedValue[0]
82
- })
77
+ if (<%= object.selection_type == "quickpick" %>) {
78
+ document.getElementById("<%= object.picker_id %>").addEventListener("change", ({ target }) => {
79
+ const startDate = document.getElementById("<%= object.start_date_id %>")
80
+ const endDate = document.getElementById("<%= object.end_date_id %>")
81
+ const splittedValue = target.value.split(" to ")
82
+ startDate.value = splittedValue[0]
83
+ endDate.value = splittedValue[1] ? splittedValue[1] : splittedValue[0]
84
+ })
85
+ }
83
86
  }
84
87
  }
85
88
 
86
- window.addEventListener("DOMContentLoaded", () => {
89
+ // Try to initialize immediately if DOM is ready
90
+ if (document.readyState === "loading") {
91
+ window.addEventListener("DOMContentLoaded", loadDatePicker)
92
+ } else {
87
93
  loadDatePicker()
88
- })
94
+ }
95
+
96
+ // For dynamically added content (modals, etc.), check again after a brief delay
97
+ setTimeout(() => {
98
+ const input = document.getElementById("<%= object.picker_id %>");
99
+ if (input && !input._flatpickr) {
100
+ loadDatePicker();
101
+ }
102
+ }, 100);
89
103
 
90
104
  if (<%= !object.custom_event_type.empty? %>) {
91
105
  window.addEventListener("<%= object.custom_event_type %>", () => {
@@ -251,4 +251,28 @@ describe('DatePicker Kit', () => {
251
251
  expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + new Date().formatDate())
252
252
  })
253
253
  })
254
+
255
+
256
+ test('displays defaultDate when it is later than maxDate', async () => {
257
+ const testId = 'datepicker-out-of-range-after'
258
+ const futureDateString = '01/15/2020'
259
+ const maxDateString = '01/10/2020'
260
+
261
+ render(
262
+ <DatePicker
263
+ data={{ testid: testId }}
264
+ defaultDate={futureDateString}
265
+ format="m/d/Y"
266
+ maxDate={maxDateString}
267
+ pickerId="date-picker-out-of-range-after"
268
+ />
269
+ )
270
+
271
+ const kit = screen.getByTestId(testId)
272
+ const input = within(kit).getByPlaceholderText('Select Date')
273
+
274
+ await waitFor(() => {
275
+ expect(input).toHaveValue('01/15/2020')
276
+ }, { timeout: 5000 })
277
+ })
254
278
  })
@@ -182,6 +182,33 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
182
182
  }
183
183
  }
184
184
 
185
+ const positionCalendarIfNeeded = (fp: Instance) => {
186
+ const cal = document.querySelector(`#cal-${pickerId}`) as HTMLElement
187
+ if (!cal) return
188
+
189
+ const inputRect = fp.input.getBoundingClientRect()
190
+ const h = cal.getBoundingClientRect().height || 300
191
+ const spaceBelow = window.innerHeight - inputRect.bottom
192
+ const spaceAbove = inputRect.top
193
+
194
+ if (spaceBelow < h + 10 && spaceAbove >= h + 10) {
195
+ if (staticPosition) {
196
+ cal.style.top = 'auto'
197
+ cal.style.bottom = 'calc(100% + 5px)'
198
+ } else {
199
+ cal.style.position = 'fixed'
200
+ cal.style.top = `${Math.max(10, inputRect.top - h - 5)}px`
201
+ cal.style.left = `${inputRect.left}px`
202
+ }
203
+ } else if (staticPosition) {
204
+ cal.style.top = ''
205
+ cal.style.bottom = ''
206
+ } else {
207
+ Object.assign(cal.style, { position: '', top: '', left: '', bottom: '', right: '', transform: '' })
208
+ fp._positionCalendar()
209
+ }
210
+ }
211
+
185
212
  const setPlugins = (thisRangesEndToday: boolean, customQuickPickDates: any) => {
186
213
  const pluginList = []
187
214
 
@@ -239,12 +266,89 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
239
266
  }
240
267
  }
241
268
 
269
+ // Store resize / position handler reference for cleanup
270
+ let resizeRepositionHandlerRef: (() => void) | null = null
271
+
242
272
  // ===========================================================
243
273
  // | Flatpickr initializer w/ config |
244
274
  // ===========================================================
245
275
 
246
276
  const { setMinDate, setMaxDate } = getMinMaxDates()
247
277
 
278
+ // Default Date + Min/Max Date Initialization Helper Functions section ----/
279
+ const toDateObject = (dateValue: any): Date | null => {
280
+ if (!dateValue) return null
281
+ if (dateValue instanceof Date) return dateValue
282
+ if (typeof dateValue === 'string') {
283
+ const parsed = new Date(dateValue)
284
+ return isNaN(parsed.getTime()) ? null : parsed
285
+ }
286
+ if (typeof dateValue === 'number') {
287
+ return new Date(dateValue)
288
+ }
289
+ return null
290
+ }
291
+
292
+ // Formatting Date for Flatpickr
293
+ const formatDateForFlatpickr = (dateValue: any): string | null => {
294
+ const dateObj = toDateObject(dateValue)
295
+ if (!dateObj) return null
296
+
297
+ const year = dateObj.getFullYear()
298
+ const month = String(dateObj.getMonth() + 1).padStart(2, '0')
299
+ const day = String(dateObj.getDate()).padStart(2, '0')
300
+ return `${year}-${month}-${day}`
301
+ }
302
+
303
+ // Helper to check if defaultDate is earlier than minDate
304
+ const isDefaultDateBeforeMinDate = (defaultDateValue: any, minDateValue: any): boolean => {
305
+ if (!defaultDateValue || !minDateValue) return false
306
+
307
+ const defaultDateObj = toDateObject(defaultDateValue)
308
+ const minDateObj = toDateObject(minDateValue)
309
+
310
+ if (!defaultDateObj || !minDateObj) return false
311
+
312
+ const defaultDateOnly = new Date(defaultDateObj.getFullYear(), defaultDateObj.getMonth(), defaultDateObj.getDate())
313
+ const minDateOnly = new Date(minDateObj.getFullYear(), minDateObj.getMonth(), minDateObj.getDate())
314
+
315
+ return defaultDateOnly < minDateOnly
316
+ }
317
+
318
+ // Helper to check if defaultDate is later than maxDate
319
+ const isDefaultDateAfterMaxDate = (defaultDateValue: any, maxDateValue: any): boolean => {
320
+ if (!defaultDateValue || !maxDateValue) return false
321
+
322
+ const defaultDateObj = toDateObject(defaultDateValue)
323
+ const maxDateObj = toDateObject(maxDateValue)
324
+
325
+ if (!defaultDateObj || !maxDateObj) return false
326
+
327
+ const defaultDateOnly = new Date(defaultDateObj.getFullYear(), defaultDateObj.getMonth(), defaultDateObj.getDate())
328
+ const maxDateOnly = new Date(maxDateObj.getFullYear(), maxDateObj.getMonth(), maxDateObj.getDate())
329
+
330
+ return defaultDateOnly > maxDateOnly
331
+ }
332
+
333
+ const defaultDateValue: any = defaultDateGetter()
334
+ // Only check for and out-of-range if user actually provided minDate/maxDate constraints
335
+ const isBeforeMin = minDate && isDefaultDateBeforeMinDate(defaultDateValue, setMinDate)
336
+ const isAfterMax = maxDate && isDefaultDateAfterMaxDate(defaultDateValue, setMaxDate)
337
+
338
+ // Store these values for use in onClose handler
339
+ const hasOutOfRangeDefault = (isBeforeMin || isAfterMax) && defaultDateValue
340
+
341
+ // Temporarily adjust minDate/maxDate to allow defaultDate to render if it's out of range via user provided minDate/maxDate constraints
342
+ const effectiveMinDate = isBeforeMin && defaultDateValue && minDate
343
+ ? formatDateForFlatpickr(defaultDateValue) || setMinDate
344
+ : setMinDate
345
+
346
+ const effectiveMaxDate = isAfterMax && defaultDateValue && maxDate
347
+ ? formatDateForFlatpickr(defaultDateValue) || setMaxDate
348
+ : setMaxDate
349
+
350
+ // End of Default Date + Min/Max Date Initialization Helper Functions section ----/
351
+
248
352
  flatpickr(`#${pickerId}`, {
249
353
  allowInput,
250
354
  closeOnSelect,
@@ -256,18 +360,68 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
256
360
  locale: {
257
361
  rangeSeparator: ' to '
258
362
  },
259
- maxDate: setMaxDate,
260
- minDate: setMinDate,
363
+ maxDate: effectiveMaxDate,
364
+ minDate: effectiveMinDate,
261
365
  mode,
262
366
  nextArrow: '<i class="far fa-angle-right"></i>',
263
- onOpen: [() => {
367
+ onOpen: [(_selectedDates, _dateStr, fp) => {
368
+ // If defaultDate was out of range of a dev set min/max date, restore it when calendar opens (in situation where the input was manually cleared or the calendar was closed without selection)
369
+ if (hasOutOfRangeDefault) {
370
+ const dateObj = toDateObject(defaultDateValue)
371
+ if (dateObj) {
372
+ const inputIsBlank = !fp.input.value || fp.input.value.trim() === ''
373
+ const noSelection = !fp.selectedDates || fp.selectedDates.length === 0
374
+
375
+ if (inputIsBlank || noSelection) {
376
+ const formattedDate = fp.formatDate(dateObj, getDateFormat())
377
+ if (formattedDate) {
378
+ fp.input.value = formattedDate
379
+ }
380
+ fp.selectedDates = [dateObj]
381
+ fp.jumpToDate(dateObj)
382
+ setTimeout(() => {
383
+ yearChangeHook(fp)
384
+ }, 0)
385
+ }
386
+ }
387
+ }
388
+
264
389
  calendarResizer()
265
- window.addEventListener('resize', calendarResizer)
390
+ if (resizeRepositionHandlerRef) {
391
+ window.removeEventListener('resize', resizeRepositionHandlerRef)
392
+ }
393
+ resizeRepositionHandlerRef = () => {
394
+ calendarResizer()
395
+ positionCalendarIfNeeded(fp)
396
+ }
397
+ window.addEventListener('resize', resizeRepositionHandlerRef)
266
398
  if (!staticPosition && scrollContainer) attachToScroll(scrollContainer)
399
+ positionCalendarIfNeeded(fp)
267
400
  }],
268
- onClose: [(selectedDates, dateStr) => {
269
- window.removeEventListener('resize', calendarResizer)
401
+ onClose: [(selectedDates, dateStr, fp) => {
402
+ if (resizeRepositionHandlerRef) {
403
+ window.removeEventListener('resize', resizeRepositionHandlerRef)
404
+ resizeRepositionHandlerRef = null
405
+ }
270
406
  if (!staticPosition && scrollContainer) detachFromScroll(scrollContainer as HTMLElement)
407
+
408
+ // If defaultDate was out of range and no date was selected, preserve the default date
409
+ if (hasOutOfRangeDefault && (!selectedDates || selectedDates.length === 0)) {
410
+ const dateObj = toDateObject(defaultDateValue)
411
+ if (dateObj && fp.input) {
412
+ const formattedDate = fp.formatDate(dateObj, getDateFormat())
413
+ if (formattedDate) {
414
+ setTimeout(() => {
415
+ if (fp.input && (!fp.selectedDates || fp.selectedDates.length === 0)) {
416
+ fp.input.value = formattedDate
417
+ fp.selectedDates = [dateObj]
418
+ fp.jumpToDate(dateObj)
419
+ }
420
+ }, 0)
421
+ }
422
+ }
423
+ }
424
+
271
425
  onClose(selectedDates, dateStr)
272
426
  }],
273
427
  onChange: [(selectedDates, dateStr, fp) => {
@@ -289,6 +443,71 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
289
443
  const picker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
290
444
  picker.innerContainer.parentElement.id = `cal-${pickerId}`
291
445
 
446
+ // If defaultDate was out of range, restore the original minDate/maxDate after initialization (defaultDate displayed, still cannot select dates outside the actual range via user provided minDate/maxDate constraints)
447
+ if ((isBeforeMin || isAfterMax) && defaultDateValue) {
448
+ const dateObj = toDateObject(defaultDateValue)
449
+ const formattedDate = dateObj ? picker.formatDate(dateObj, getDateFormat()) : null
450
+
451
+ setTimeout(() => {
452
+ if (!dateObj || !picker.input || !formattedDate) return
453
+
454
+ picker.setDate(dateObj, false)
455
+
456
+ if (isBeforeMin && setMinDate && minDate) {
457
+ picker.set('minDate', setMinDate)
458
+ }
459
+ if (isAfterMax && setMaxDate && maxDate) {
460
+ picker.set('maxDate', setMaxDate)
461
+ }
462
+ picker.input.value = formattedDate
463
+
464
+ picker.selectedDates = [dateObj]
465
+
466
+ setTimeout(() => {
467
+ yearChangeHook(picker)
468
+ }, 0)
469
+
470
+ // Restore function for out-of-range default dates
471
+ const restoreOutOfRangeValue = () => {
472
+ if (!picker.input) return
473
+
474
+ const inputIsBlank = !picker.input.value || picker.input.value.trim() === ''
475
+ const noSelection = !picker.selectedDates || picker.selectedDates.length === 0
476
+
477
+ if (inputIsBlank || noSelection) {
478
+ setTimeout(() => {
479
+ if (picker.input && (!picker.input.value || picker.input.value.trim() === '')) {
480
+ picker.input.value = formattedDate
481
+ }
482
+ if (!picker.selectedDates || picker.selectedDates.length === 0) {
483
+ picker.selectedDates = [dateObj]
484
+ if (picker.isOpen) {
485
+ picker.jumpToDate(dateObj)
486
+ picker.redraw()
487
+ setTimeout(() => {
488
+ yearChangeHook(picker)
489
+ }, 0)
490
+ }
491
+ }
492
+ }, 0)
493
+ }
494
+ }
495
+
496
+ const originalClear = picker.clear.bind(picker)
497
+ picker.clear = function(...args: any[]) {
498
+ const result = originalClear(...args)
499
+ setTimeout(() => restoreOutOfRangeValue(), 0)
500
+ return result
501
+ }
502
+
503
+ picker.input.addEventListener('input', restoreOutOfRangeValue)
504
+
505
+ picker.config.onClose.push(() => {
506
+ restoreOutOfRangeValue()
507
+ })
508
+ }, 10)
509
+ }
510
+
292
511
  // replace year selector with dropdown
293
512
  picker.yearElements[0].parentElement.innerHTML = `<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-${pickerId}"></select>`
294
513
 
@@ -11,4 +11,22 @@
11
11
  max_date: "10/20/2020",
12
12
  min_date: "10/10/2020",
13
13
  picker_id: "date-picker-min-max2"
14
+ }) %>
15
+
16
+ <%= pb_rails("date_picker", props: {
17
+ format: "m/d/Y",
18
+ label: "Default date earlier than min_date (preserved)",
19
+ default_date: (DateTime.current - 3.days).utc.iso8601,
20
+ min_date: (DateTime.current - 1.day).utc.iso8601,
21
+ max_date: (DateTime.current + 7.days).utc.iso8601,
22
+ picker_id: "date-picker-min-max-default-before"
23
+ }) %>
24
+
25
+ <%= pb_rails("date_picker", props: {
26
+ format: "m/d/Y",
27
+ label: "Default date later than max_date (preserved)",
28
+ default_date: (DateTime.current + 10.days).utc.iso8601,
29
+ min_date: (DateTime.current - 1.day).utc.iso8601,
30
+ max_date: (DateTime.current + 7.days).utc.iso8601,
31
+ picker_id: "date-picker-min-max-default-after"
14
32
  }) %>
@@ -19,6 +19,7 @@ type DateRangeInlineProps = {
19
19
  icon?: boolean;
20
20
  id?: string;
21
21
  size?: "sm" | "xs";
22
+ showCurrentYear?: boolean;
22
23
  startDate?: Date;
23
24
  };
24
25
 
@@ -45,6 +46,7 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
45
46
  icon = false,
46
47
  size = "sm",
47
48
  startDate,
49
+ showCurrentYear = false,
48
50
  } = props;
49
51
 
50
52
  const dateInCurrentYear = () => {
@@ -60,13 +62,10 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
60
62
  const htmlProps = buildHtmlProps(htmlOptions);
61
63
 
62
64
  const renderTime = (date: Date) => {
65
+ const includeYear = showCurrentYear || !dateInCurrentYear();
63
66
  return (
64
67
  <time dateTime={dateTimeIso(date)}>
65
- {dateInCurrentYear() ? (
66
- ` ${dateTimestamp(date, false)} `
67
- ) : (
68
- ` ${dateTimestamp(date, true)} `
69
- )}
68
+ {` ${dateTimestamp(date, includeYear)} `}
70
69
  </time>
71
70
  );
72
71
  };
@@ -83,7 +82,8 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
83
82
  {icon && (
84
83
  <Caption
85
84
  dark={dark}
86
- tag="span">
85
+ tag="span"
86
+ >
87
87
  <Icon
88
88
  className="pb_date_range_inline_icon"
89
89
  dark={dark}
@@ -96,12 +96,14 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
96
96
  )}
97
97
  <Caption
98
98
  dark={dark}
99
- tag="span">
99
+ tag="span"
100
+ >
100
101
  {renderTime(startDate)}
101
102
  </Caption>
102
103
  <Caption
103
104
  dark={dark}
104
- tag="span">
105
+ tag="span"
106
+ >
105
107
  <Icon
106
108
  className="pb_date_range_inline_arrow"
107
109
  dark={dark}
@@ -112,7 +114,8 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
112
114
  </Caption>
113
115
  <Caption
114
116
  dark={dark}
115
- tag="span">
117
+ tag="span"
118
+ >
116
119
  {renderTime(endDate)}
117
120
  </Caption>
118
121
  </>
@@ -124,7 +127,8 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
124
127
  <Body
125
128
  color={"light"}
126
129
  dark={dark}
127
- tag="span">
130
+ tag="span"
131
+ >
128
132
  <Icon
129
133
  className="pb_date_range_inline_icon"
130
134
  dark={dark}
@@ -137,13 +141,15 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
137
141
  )}
138
142
  <Body
139
143
  dark={dark}
140
- tag="span">
144
+ tag="span"
145
+ >
141
146
  {renderTime(startDate)}
142
147
  </Body>
143
148
  <Body
144
149
  color={"light"}
145
150
  dark={dark}
146
- tag="span">
151
+ tag="span"
152
+ >
147
153
  <Icon
148
154
  className="pb_date_range_inline_arrow"
149
155
  dark={dark}
@@ -154,7 +160,8 @@ const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
154
160
  </Body>
155
161
  <Body
156
162
  dark={dark}
157
- tag="span">
163
+ tag="span"
164
+ >
158
165
  {renderTime(endDate)}
159
166
  </Body>
160
167
  </>
@@ -14,7 +14,8 @@ module Playbook
14
14
  prop :align, type: Playbook::Props::Enum,
15
15
  values: %w[left center right],
16
16
  default: "left"
17
-
17
+ prop :show_current_year, type: Playbook::Props::Boolean,
18
+ default: false
18
19
  def classname
19
20
  generate_classname("pb_date_range_inline_kit", dark_class, align)
20
21
  end
@@ -38,11 +39,12 @@ module Playbook
38
39
  end
39
40
 
40
41
  def time_display(time)
42
+ include_year = show_current_year || !dates_in_current_year?
41
43
  content_tag(:time, datetime: time.to_iso) do
42
- if dates_in_current_year?
43
- "#{time.to_month_downcase} #{time.to_day}"
44
- else
44
+ if include_year
45
45
  "#{time.to_month_downcase} #{time.to_day}, #{time.to_year}"
46
+ else
47
+ "#{time.to_month_downcase} #{time.to_day}"
46
48
  end
47
49
  end
48
50
  end
@@ -111,6 +111,23 @@ describe("DateRangeInline Kit", () => {
111
111
  const text = kit.querySelector('.pb_caption_kit_md:first-child')
112
112
  expect(text.textContent).toEqual(" Jan 15 ")
113
113
  })
114
+
115
+ test("renders DateRangeInline with year when showCurrentYear is true", () => {
116
+ const currentYear = new Date().getFullYear()
117
+ render(
118
+ <DateRangeInline
119
+ data={{ testid: testId }}
120
+ endDate={new Date((`15 Aug ${currentYear}`))}
121
+ showCurrentYear
122
+ size="xs"
123
+ startDate={new Date(`15 Jan ${currentYear}`)}
124
+ />
125
+ )
126
+
127
+ const kit = screen.getByTestId(testId)
128
+ const text = kit.querySelector('.pb_caption_kit_md:first-child')
129
+ expect(text.textContent).toEqual(` Jan 15, ${currentYear} `)
130
+ })
114
131
 
115
132
 
116
133
  })
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), size: "xs", show_current_year: true }) %>
2
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), show_current_year: true }) %>
3
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), align: "center", icon: true, size: "xs", show_current_year: true }) %>
4
+ <%= pb_rails("date_range_inline", props: { start_date: Date.new(Date.current.year, 10, 31), end_date: Date.new(Date.current.year, 12, 7), align: "center", icon: true, show_current_year: true }) %>
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+ import DateRangeInline from '../_date_range_inline'
3
+
4
+ const DateRangeInlineShowCurrentYear = (props) => {
5
+ return (
6
+ <div>
7
+ <DateRangeInline
8
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
9
+ showCurrentYear
10
+ size="xs"
11
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
12
+ {...props}
13
+ />
14
+ <DateRangeInline
15
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
16
+ showCurrentYear
17
+ size="sm"
18
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
19
+ {...props}
20
+ />
21
+ <DateRangeInline
22
+ align="center"
23
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
24
+ icon
25
+ showCurrentYear
26
+ size="xs"
27
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
28
+ {...props}
29
+ />
30
+ <DateRangeInline
31
+ align="center"
32
+ endDate={new Date(`7 Dec ${new Date().getFullYear()}`)}
33
+ icon
34
+ showCurrentYear
35
+ size="sm"
36
+ startDate={new Date(`31 Oct ${new Date().getFullYear()}`)}
37
+ {...props}
38
+ />
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export default DateRangeInlineShowCurrentYear
@@ -0,0 +1 @@
1
+ By default, the Date Range Inline kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -1 +1 @@
1
- Use to display a date range. Year will not show if it is the current year.
1
+ Use to display a date range.
@@ -2,11 +2,12 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_range_inline_default: Default
5
-
5
+ - date_range_inline_show_current_year: Show Current Year
6
6
 
7
7
  react:
8
8
  - date_range_inline_default: Default
9
-
9
+ - date_range_inline_show_current_year: Show Current Year
10
+
10
11
  swift:
11
12
  - date_range_inline_default_swift: Default
12
13
  - date_range_inline_props_swift: ""
@@ -1 +1,2 @@
1
1
  export { default as DateRangeInlineDefault } from './_date_range_inline_default.jsx'
2
+ export { default as DateRangeInlineShowCurrentYear } from './_date_range_inline_show_current_year.jsx'
@@ -19,6 +19,7 @@ type DateStackedProps = {
19
19
  size?: "sm" | "md";
20
20
  id?: string;
21
21
  reverse?: boolean;
22
+ showCurrentYear?: boolean;
22
23
  };
23
24
 
24
25
  const sizes: {sm: 4, md: 3} = {
@@ -37,6 +38,7 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
37
38
  data={},
38
39
  htmlOptions={},
39
40
  size = "sm",
41
+ showCurrentYear = false,
40
42
  } = props;
41
43
  const classes = classnames(
42
44
  buildCss("pb_date_stacked_kit", align, size, {
@@ -55,7 +57,7 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
55
57
  return (
56
58
  <>
57
59
  {bold == false ? (
58
- <div
60
+ <div
59
61
  {...dataProps}
60
62
  {...htmlProps}
61
63
  className={classes}
@@ -68,10 +70,10 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
68
70
  text={DateTime.toDay(date).toString()}
69
71
  />
70
72
  </div>
71
- {currentYear != inputYear && <Caption size="xs">{inputYear}</Caption>}
73
+ {(currentYear != inputYear || showCurrentYear) && <Caption size="xs">{inputYear}</Caption>}
72
74
  </div>
73
75
  ) : (
74
- <div
76
+ <div
75
77
  {...dataProps}
76
78
  {...htmlProps}
77
79
  className={classes}
@@ -89,7 +91,7 @@ const DateStacked = (props: DateStackedProps): React.ReactElement => {
89
91
  size="4"
90
92
  text={DateTime.toDay(date).toString()}
91
93
  />
92
- {currentYear != inputYear && <Title size="4">{inputYear}</Title>}
94
+ {(currentYear != inputYear || showCurrentYear) && <Title size="4">{inputYear}</Title>}
93
95
  </div>
94
96
  </div>
95
97
  )}
@@ -4,16 +4,15 @@
4
4
 
5
5
  <div class="pb_date_stacked_day_month">
6
6
  <%= pb_rails("caption", props: { text: object.month }) %>
7
- <%= pb_rails("title", props: { text: object.day , size: object.title_size }) do %><% end %>
7
+ <%= pb_rails("title", props: { text: object.day , size: object.title_size }) %>
8
8
  <%= pb_rails("caption", props: { text: object.year, size:"xs" }) %>
9
9
  </div>
10
10
 
11
11
  <% else %>
12
12
  <div class="pb_date_stacked_day_month">
13
13
  <%= pb_rails("title", props: { text: object.month, size: 4 }) %>
14
- <%= pb_rails("title", props: { text: object.day, size: 4 }) do %><% end %>
14
+ <%= pb_rails("title", props: { text: object.day, size: 4 }) %>
15
15
  <%= pb_rails("title", props: { text: object.year, size:4 }) %>
16
-
17
16
  </div>
18
17
 
19
18
  <% end %>