playbook_ui 15.2.0 → 15.3.0.pre.alpha.PLAY2012currencyallownonstring11930

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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +5 -5
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +18 -3
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +71 -14
  6. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +3 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +12 -3
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  9. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +59 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +39 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +3 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +3 -3
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +3 -3
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +2 -2
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +1 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +2 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +2 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +1 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +28 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +11 -2
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.html.erb +51 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.md +1 -0
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.html.erb +40 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.md +1 -0
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +4 -1
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +3 -2
  28. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +1 -1
  29. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_react.md +1 -1
  30. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +2 -2
  31. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading_empty_children.js +42 -0
  32. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  33. data/app/pb_kits/playbook/pb_advanced_table/index.js +5 -1
  34. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +6 -6
  35. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +6 -6
  36. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -2
  37. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +49 -5
  38. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.html.erb +4 -4
  39. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +4 -0
  40. data/app/pb_kits/playbook/pb_button/_button.scss +6 -0
  41. data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +7 -3
  42. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +29 -0
  43. data/app/pb_kits/playbook/pb_currency/_currency.tsx +17 -7
  44. data/app/pb_kits/playbook/pb_currency/currency.rb +20 -8
  45. data/app/pb_kits/playbook/pb_currency/currency.test.js +42 -0
  46. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  47. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.md +1 -0
  49. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
  50. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +11 -30
  52. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +8 -0
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +0 -1
  54. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +5 -3
  55. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md +2 -0
  56. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -1
  57. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +10 -0
  58. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  59. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  60. data/app/pb_kits/playbook/pb_form/formHelper.js +1 -1
  61. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -1
  62. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +7 -14
  63. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +6 -15
  64. data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +8 -6
  65. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -0
  66. data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +7 -10
  67. data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +73 -1
  68. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +1 -1
  69. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -0
  70. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +7 -10
  71. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +47 -0
  72. data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.scss +3 -0
  73. data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.tsx +69 -0
  74. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -0
  75. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.html.erb +12 -0
  76. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +24 -0
  77. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +5 -0
  78. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.html.erb +45 -0
  79. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +119 -0
  80. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.md +1 -0
  81. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.html.erb +5 -0
  82. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.jsx +17 -0
  83. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.html.erb +12 -0
  84. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.jsx +24 -0
  85. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.html.erb +23 -0
  86. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +37 -0
  87. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.html.erb +40 -0
  88. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +56 -0
  89. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_live_data.jsx +64 -0
  90. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.html.erb +27 -0
  91. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +40 -0
  92. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.md +1 -0
  93. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.html.erb +19 -0
  94. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.jsx +65 -0
  95. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.md +3 -0
  96. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.html.erb +14 -0
  97. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.jsx +27 -0
  98. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.html.erb +39 -0
  99. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +58 -0
  100. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.md +1 -0
  101. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/example.yml +29 -0
  102. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/index.js +11 -0
  103. data/app/pb_kits/playbook/pb_pb_gauge_chart/pbGaugeGraphTheme.ts +91 -0
  104. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.html.erb +1 -0
  105. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.rb +25 -0
  106. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.test.jsx +80 -0
  107. data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.scss +3 -0
  108. data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.tsx +61 -0
  109. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -0
  110. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.html.erb +34 -0
  111. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +52 -0
  112. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.md +5 -0
  113. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.html.erb +34 -0
  114. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.jsx +45 -0
  115. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.html.erb +47 -0
  116. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.jsx +64 -0
  117. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.md +3 -0
  118. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.html.erb +24 -0
  119. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.jsx +37 -0
  120. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.html.erb +39 -0
  121. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.jsx +45 -0
  122. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +86 -0
  123. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.jsx +116 -0
  124. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.md +11 -0
  125. data/app/pb_kits/playbook/pb_pb_line_graph/docs/example.yml +20 -0
  126. data/app/pb_kits/playbook/pb_pb_line_graph/docs/index.js +6 -0
  127. data/app/pb_kits/playbook/pb_pb_line_graph/pbLineGraphTheme.ts +125 -0
  128. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.html.erb +1 -0
  129. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.rb +25 -0
  130. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.test.jsx +110 -0
  131. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +130 -28
  132. data/app/pb_kits/playbook/pb_popover/_popover.tsx +69 -34
  133. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +68 -0
  134. data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to_react.md +1 -0
  135. data/app/pb_kits/playbook/pb_popover/docs/example.yml +1 -0
  136. data/app/pb_kits/playbook/pb_popover/docs/index.js +1 -0
  137. data/app/pb_kits/playbook/pb_popover/popover.test.js +80 -0
  138. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +41 -2
  139. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -0
  140. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +60 -20
  141. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +36 -0
  142. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.jsx +38 -0
  143. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.md +1 -0
  144. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.jsx +34 -0
  145. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.md +1 -0
  146. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.jsx +37 -0
  147. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.md +1 -0
  148. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +37 -0
  149. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.jsx +38 -0
  150. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.md +1 -0
  151. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.jsx +69 -0
  152. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.md +1 -0
  153. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +8 -2
  154. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +6 -0
  155. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +127 -1
  156. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +29 -0
  157. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.html.erb +63 -0
  158. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible.jsx +89 -0
  159. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_rails.md +4 -0
  160. data/app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_react.md +3 -0
  161. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  162. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  163. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -2
  164. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +250 -233
  165. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  166. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +2 -2
  167. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +76 -1
  168. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +85 -2
  169. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.html.erb +64 -0
  170. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.jsx +70 -0
  171. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_options.md +1 -0
  172. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +102 -0
  173. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.md +1 -0
  174. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +103 -0
  175. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.md +1 -0
  176. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +4 -0
  177. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -0
  178. data/app/pb_kits/playbook/tokens/_positioning.scss +1 -0
  179. data/app/pb_kits/playbook/utilities/_positioning.scss +6 -1
  180. data/app/pb_kits/playbook/utilities/globalProps.ts +3 -1
  181. data/dist/chunks/{_line_graph-ByLTvO72.js → _line_graph-CqE0-dq5.js} +1 -1
  182. data/dist/chunks/_typeahead-3ZAbZUqU.js +6 -0
  183. data/dist/chunks/{_weekday_stacked-CB1Sm0pQ.js → _weekday_stacked-D6fNzH0S.js} +3 -3
  184. data/dist/chunks/{lib-izYrkvOQ.js → lib-CGxXTQ75.js} +2 -2
  185. data/dist/chunks/{pb_form_validation-Cah5Z5J3.js → pb_form_validation-DebqlUKZ.js} +1 -1
  186. data/dist/chunks/vendor.js +1 -1
  187. data/dist/menu.yml +12 -0
  188. data/dist/playbook-doc.js +2 -2
  189. data/dist/playbook-rails-react-bindings.js +1 -1
  190. data/dist/playbook-rails.js +1 -1
  191. data/dist/playbook.css +1 -1
  192. data/lib/playbook/pb_forms_helper.rb +7 -6
  193. data/lib/playbook/version.rb +2 -2
  194. data/lib/playbook/z_index.rb +1 -1
  195. metadata +101 -8
  196. data/dist/chunks/_typeahead-DXZQU3hC.js +0 -6
  197. /data/app/pb_kits/playbook/pb_popover/docs/{_popover_append_to.md → _popover_append_to_rails.md} +0 -0
@@ -17,8 +17,7 @@ module Playbook
17
17
  prop :symbol, type: Playbook::Props::String,
18
18
  default: "$"
19
19
 
20
- prop :amount, type: Playbook::Props::String,
21
- required: true
20
+ prop :amount, required: true
22
21
 
23
22
  prop :unit, type: Playbook::Props::String,
24
23
  required: false
@@ -92,7 +91,7 @@ module Playbook
92
91
  end
93
92
 
94
93
  def negative_sign
95
- amount.starts_with?("-") && swap_negative ? "-" : ""
94
+ currency_amount.starts_with?("-") && swap_negative ? "-" : ""
96
95
  end
97
96
 
98
97
  def body_props
@@ -117,10 +116,23 @@ module Playbook
117
116
  end
118
117
  end
119
118
 
119
+ def currency_amount
120
+ @currency_amount ||= convert_amount(amount)
121
+ end
122
+
120
123
  private
121
124
 
125
+ # Convert numeric input to string format
126
+ def convert_amount(input)
127
+ if input.is_a?(Numeric)
128
+ format("%.2f", input)
129
+ else
130
+ input.to_s
131
+ end
132
+ end
133
+
122
134
  def whole_value
123
- value = amount.split(".").first
135
+ value = currency_amount.split(".").first
124
136
  if comma_separator
125
137
  number_with_delimiter(value.gsub(",", ""))
126
138
  else
@@ -129,7 +141,7 @@ module Playbook
129
141
  end
130
142
 
131
143
  def decimal_value
132
- amount.split(".")[1] || "00"
144
+ currency_amount.split(".")[1] || "00"
133
145
  end
134
146
 
135
147
  def units_element
@@ -147,7 +159,7 @@ module Playbook
147
159
  end
148
160
 
149
161
  def abbreviated_value(index = 0..-2)
150
- value = amount.split(".").first.gsub(",", "").to_i
162
+ value = currency_amount.split(".").first.gsub(",", "").to_i
151
163
  abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
152
164
  abbreviated_num[index]
153
165
  end
@@ -174,9 +186,9 @@ module Playbook
174
186
 
175
187
  if decimals == "matching"
176
188
  if comma_separator
177
- number_with_delimiter(amount.gsub(",", ""))
189
+ number_with_delimiter(currency_amount.gsub(",", ""))
178
190
  else
179
- amount
191
+ currency_amount
180
192
  end
181
193
  else
182
194
  whole_value
@@ -133,3 +133,45 @@ test('handles negative amounts correctly', () => {
133
133
  expect(screen.getByTestId('test-negative-no-symbol')).toHaveTextContent('-400.50')
134
134
  expect(screen.getByTestId('test-negative-medium-size')).toHaveTextContent('$-500.55')
135
135
  })
136
+
137
+ test('handles numeric amounts correctly', () => {
138
+ render(
139
+ <>
140
+ <Currency
141
+ amount={320}
142
+ data={{ testid: 'test-numeric-default' }}
143
+ />
144
+ <Currency
145
+ abbreviate
146
+ amount={3200000}
147
+ data={{ testid: 'test-numeric-millions' }}
148
+ />
149
+ <Currency
150
+ amount={123456.78}
151
+ commaSeparator
152
+ data={{ testid: 'test-numeric-comma-decimals' }}
153
+ />
154
+ <Currency
155
+ amount={400.50}
156
+ data={{ testid: 'test-numeric-no-symbol' }}
157
+ symbol=""
158
+ />
159
+ <Currency
160
+ amount={500.55}
161
+ data={{ testid: 'test-numeric-medium-size' }}
162
+ size="md"
163
+ />
164
+ <Currency
165
+ amount={-600.70}
166
+ data={{ testid: 'test-numeric-negative' }}
167
+ />
168
+ </>
169
+ )
170
+
171
+ expect(screen.getByTestId('test-numeric-default')).toHaveTextContent('$320')
172
+ expect(screen.getByTestId('test-numeric-millions')).toHaveTextContent('$3.2M')
173
+ expect(screen.getByTestId('test-numeric-comma-decimals')).toHaveTextContent('$123,456.78')
174
+ expect(screen.getByTestId('test-numeric-no-symbol')).toHaveTextContent('400.50')
175
+ expect(screen.getByTestId('test-numeric-medium-size')).toHaveTextContent('$500.55')
176
+ expect(screen.getByTestId('test-numeric-negative')).toHaveTextContent('-$600.70')
177
+ })
@@ -7,7 +7,7 @@
7
7
  }) %>
8
8
 
9
9
  <%= pb_rails("currency", props: {
10
- amount: "342",
10
+ amount: 342,
11
11
  label: "Light",
12
12
  margin_bottom: "md",
13
13
  size: "sm",
@@ -14,7 +14,7 @@ const CurrencyVariants = (props) => {
14
14
  {...props}
15
15
  />
16
16
  <Currency
17
- amount="342"
17
+ amount={342}
18
18
  label="Light"
19
19
  marginBottom="md"
20
20
  size="sm"
@@ -0,0 +1 @@
1
+ **NOTE:** The value passed into the `amount` prop can be either a string or numeric value.
@@ -85,6 +85,8 @@ module Playbook
85
85
  default: ""
86
86
  prop :sync_end_with, type: Playbook::Props::String,
87
87
  default: ""
88
+ prop :cursor, type: Playbook::Props::String,
89
+ default: "pointer"
88
90
 
89
91
  def classname
90
92
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
@@ -23,7 +23,7 @@ const DatePickerRangePattern = (props) => {
23
23
 
24
24
  <DatePicker
25
25
  pickerId="end-date-picker"
26
- placeholder="Select a End Date"
26
+ placeholder="Select an End Date"
27
27
  syncEndWith="quickpick-for-range"
28
28
  {...props}
29
29
  />
@@ -9,29 +9,20 @@ $pb_card_border_radius: $border_rad_heavier;
9
9
 
10
10
  // used to display dropdown on the left of the calender
11
11
  .quick-pick-drop-down {
12
- width: auto;
13
- display: grid;
12
+ width: 100%;
14
13
  }
15
14
 
16
15
  .quick-pick-ul {
17
- padding: $space_xs 0px;
18
16
  margin: 0;
19
17
  list-style: none;
20
18
  }
21
19
 
22
20
  .nav-item {
23
21
  list-style: none;
24
- border-radius: 6px;
25
- border-bottom: 0;
26
- margin: $space_xs $space_sm;
27
22
  }
28
23
 
29
24
  .nav-item-link {
30
25
  text-decoration: none;
31
- border-width: $pb_card_border_width;
32
- border-style: solid;
33
- border-color: $border_light;
34
- border-radius: $pb_card_border_radius;
35
26
  padding: $space_xs 14px;
36
27
  transition-property: color, background-color;
37
28
  transition-duration: 0.15s;
@@ -40,15 +31,21 @@ $pb_card_border_radius: $border_rad_heavier;
40
31
  color: $charcoal;
41
32
  font-size: $font_default;
42
33
  font-weight: $regular;
34
+ text-align: left;
35
+ border-bottom: 1px solid $border_light;
43
36
  &.active {
44
- border-width: 2px;
45
- border-color: $primary;
37
+ color: $white;
38
+ background-color: $primary;
39
+ &:hover {
40
+ background-color: $product_1_background;
41
+ color: $white;
42
+ }
46
43
  }
47
44
  @media (hover:hover) {
48
45
  &:hover {
49
46
  cursor: pointer;
50
- box-shadow: $shadow-deep;
51
- border-color: $slate;
47
+ background-color: $bg_light;
48
+ color: $primary;
52
49
  }
53
50
  }
54
51
  }
@@ -57,19 +54,3 @@ $pb_card_border_radius: $border_rad_heavier;
57
54
  .quick-pick-drop-down > .flatpickr-months, .quick-pick-drop-down > .flatpickr-innerContainer {
58
55
  display: none;
59
56
  }
60
-
61
- @media only screen and (max-width: 767px) {
62
- .quick-pick-ul {
63
- padding: $space_xs $space_xs;
64
- display: grid;
65
- grid-template-columns: 1fr 1fr;
66
- }
67
-
68
- .nav-item {
69
- margin: $space_xxs $space_xs;
70
- }
71
-
72
- .nav-item-link {
73
- padding: $space_xs $space_xxs;
74
- }
75
- }
@@ -141,4 +141,12 @@
141
141
  }
142
142
  }
143
143
  }
144
+
145
+ .pb_draggable_item:has(.pb_item_kit) {
146
+ border-bottom: 1px solid $border_light;
147
+ }
148
+
149
+ .pb_draggable_item:has(.pb_item_kit):last-child {
150
+ border-bottom: none;
151
+ }
144
152
  }
@@ -40,7 +40,6 @@ $confirmation_toast_colors: (
40
40
 
41
41
  &.positioned_toast {
42
42
  position: fixed;
43
- z-index: $z_10 !important;
44
43
  display: flex;
45
44
  justify-content: space-around;
46
45
  max-width: max-content;
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
- import { globalProps } from "../utilities/globalProps";
4
+ import { globalProps, GlobalProps } from "../utilities/globalProps";
5
5
  import { buildHtmlProps } from "../utilities/props";
6
6
  import { VoidCallback } from "../types";
7
7
 
@@ -31,7 +31,8 @@ type FixedConfirmationToastProps = {
31
31
  status?: "success" | "error" | "neutral" | "tip";
32
32
  text?: string;
33
33
  vertical?: "top" | "bottom";
34
- };
34
+ zIndex?: number | string;
35
+ } & GlobalProps
35
36
 
36
37
  const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.ReactElement => {
37
38
  const [showToast, toggleToast] = useState(true);
@@ -50,6 +51,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
50
51
  status = "neutral",
51
52
  text,
52
53
  vertical,
54
+ zIndex = 'max',
53
55
  } = props;
54
56
 
55
57
  const returnedIcon = icon || iconMap[status]
@@ -59,7 +61,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
59
61
  `pb_fixed_confirmation_toast_kit_${status}${multiLine ? '_multi_line' : ''}`,
60
62
  { [`positioned_toast ${vertical} ${horizontal}`]: vertical && horizontal },
61
63
  `${iconClass}`,
62
- globalProps(props),
64
+ globalProps(props, { zIndex }),
63
65
  className
64
66
  );
65
67
 
@@ -1,2 +1,4 @@
1
1
 
2
2
  Fixed Confirmation Toast is used as an alert. Success is used when a user successfully completes an action. Error is used when there is an error and the user cannot proceed. Neutral is used to display information to a user to complete a task.
3
+
4
+ **NOTE**: z index for Fixed Confirmation Toast is set to 'max' by default which has the value of `999999`. the z Index global prop can be used to override this if you want to set it to a different value.
@@ -60,7 +60,10 @@ module Playbook
60
60
  end
61
61
 
62
62
  def classname
63
- generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class + position_class + auto_close_class + icon_class
63
+ default_z_index = z_index.present? ? "" : " z_index_max"
64
+ # IMPORTANT: the AutoClose class must be the last class in the string for JS to read it correctly
65
+ # Changing the order will break the auto_close functionality
66
+ generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class + position_class + icon_class + default_z_index + auto_close_class
64
67
  end
65
68
  end
66
69
  end
@@ -75,4 +75,14 @@ test('renders position when provided', () => {
75
75
  />
76
76
  );
77
77
  expect(container.querySelector('.positioned_toast')).toBeInTheDocument();
78
+ });
79
+
80
+ test('renders max zIndex by default', () => {
81
+ const { container } = render(<FixedConfirmationToast />);
82
+ expect(container.querySelector('.z_index_max')).toBeInTheDocument();
83
+ });
84
+
85
+ test('applies custom zIndex when provided', () => {
86
+ const { container } = render(<FixedConfirmationToast zIndex={10} />);
87
+ expect(container.querySelector('.z_index_10')).toBeInTheDocument();
78
88
  });
@@ -18,7 +18,7 @@
18
18
 
19
19
  if (submitButton) {
20
20
  let currentClass = submitButton.className;
21
- let newClass = currentClass.replace("_disabled_loading", "_enabled");
21
+ let newClass = currentClass.replace("pb_button_disabled pb_button_loading", "pb_button_enabled");
22
22
 
23
23
  let cancelClass = cancelButton ? cancelButton.className : "";
24
24
  let newCancelClass = cancelClass.replace("_disabled", "_enabled");
@@ -101,7 +101,7 @@
101
101
  <%= form.typeahead :example_typeahead_validation_react, props: { options: example_typeahead_options, pills: true, label: "Example Typeahead (React Rendered)", placeholder: "Search for a user", required: true, validation: { message: "Please select a color." } } %>
102
102
  <%= form.typeahead :example_typeahead_validation_react_2, props: { options: example_typeahead_options, pills: true, label: "Example Typeahead 2 (React Rendered)", placeholder: "Search for a user", required: true } %>
103
103
  <%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
104
- <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true } %>
104
+ <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true, required: true } %>
105
105
  <%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
106
106
  <%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
107
107
  <%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
@@ -7,7 +7,7 @@ const formHelper = () => {
7
7
 
8
8
  if (submitButton) {
9
9
  let currentClass = submitButton.className;
10
- let newClass = currentClass.replace("_enabled", "_disabled_loading");
10
+ let newClass = currentClass.replace("pb_button_enabled", "pb_button_disabled pb_button_loading");
11
11
 
12
12
  let cancelClass = cancelButton ? cancelButton.className : "";
13
13
  let newCancelClass = cancelClass.replace("_enabled", "_disabled");
@@ -1 +1 @@
1
- Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `blue` `orange` `purple` `teal` `red` `yellow` `green`
1
+ Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `orange` `purple` `teal` `red` `yellow` `green`
@@ -3,48 +3,41 @@
3
3
  text: "Mercury",
4
4
  unit: "AU",
5
5
  value: 0.39,
6
- variant:"blue"
6
+ variant:"royal"
7
7
  }) %>
8
8
  <br>
9
9
  <%= pb_rails("icon_stat_value", props: { icon: "planet-ringed",
10
10
  text: "Venus",
11
11
  unit: "AU",
12
12
  value: 0.723,
13
- variant:"royal"
13
+ variant:"purple"
14
14
  }) %>
15
15
  <br>
16
16
  <%= pb_rails("icon_stat_value", props: { icon: "planet-moon",
17
17
  text: "Earth",
18
18
  unit: "AU",
19
19
  value: 1.0,
20
- variant:"purple"
20
+ variant:"teal"
21
21
  }) %>
22
22
  <br>
23
23
  <%= pb_rails("icon_stat_value", props: { icon: "solar-system",
24
24
  text: "Mars",
25
25
  unit: "AU",
26
26
  value: 1.524,
27
- variant:"teal"
27
+ variant:"red"
28
28
  }) %>
29
29
  <br>
30
30
  <%= pb_rails("icon_stat_value", props: { icon: "globe-americas",
31
- text: "Jupitar",
31
+ text: "Jupiter",
32
32
  unit: "AU",
33
33
  value: 5.203,
34
- variant:"red"
34
+ variant:"yellow"
35
35
  }) %>
36
36
  <br>
37
37
  <%= pb_rails("icon_stat_value", props: { icon: "globe-africa",
38
38
  text: "Saturn",
39
39
  unit: "AU",
40
40
  value: 9.539,
41
- variant:"yellow"
42
- }) %>
43
- <br>
44
- <%= pb_rails("icon_stat_value", props: { icon: "globe",
45
- text: "Uranus",
46
- unit: "AU",
47
- value: 19.18,
48
41
  variant:"green"
49
42
  }) %>
50
43
  <br>
@@ -53,4 +46,4 @@
53
46
  unit: "AU",
54
47
  value: 19.18,
55
48
  variant:"orange"
56
- }) %>
49
+ }) %>
@@ -9,7 +9,7 @@ const IconStatValueColor = (props) => {
9
9
  text="Mercury"
10
10
  unit="AU"
11
11
  value={0.39}
12
- variant="blue"
12
+ variant="royal"
13
13
  {...props}
14
14
  />
15
15
  <br />
@@ -18,7 +18,7 @@ const IconStatValueColor = (props) => {
18
18
  text="Venus"
19
19
  unit="AU"
20
20
  value={0.723}
21
- variant="royal"
21
+ variant="purple"
22
22
  {...props}
23
23
  />
24
24
  <br />
@@ -27,7 +27,7 @@ const IconStatValueColor = (props) => {
27
27
  text="Earth"
28
28
  unit="AU"
29
29
  value={1.0}
30
- variant="purple"
30
+ variant="teal"
31
31
  {...props}
32
32
  />
33
33
  <br />
@@ -36,16 +36,16 @@ const IconStatValueColor = (props) => {
36
36
  text="Mars"
37
37
  unit="AU"
38
38
  value={1.524}
39
- variant="teal"
39
+ variant="red"
40
40
  {...props}
41
41
  />
42
42
  <br />
43
43
  <IconStatValue
44
44
  icon="globe-americas"
45
- text="Jupitar"
45
+ text="Jupiter"
46
46
  unit="AU"
47
47
  value={5.203}
48
- variant="red"
48
+ variant="yellow"
49
49
  {...props}
50
50
  />
51
51
  <br />
@@ -54,15 +54,6 @@ const IconStatValueColor = (props) => {
54
54
  text="Saturn"
55
55
  unit="AU"
56
56
  value={9.539}
57
- variant="yellow"
58
- {...props}
59
- />
60
- <br />
61
- <IconStatValue
62
- icon="globe"
63
- text="Uranus"
64
- unit="AU"
65
- value={19.18}
66
57
  variant="green"
67
58
  {...props}
68
59
  />
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from "react"
2
2
  import { globalProps } from "../utilities/globalProps";
3
- import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
3
+ import { buildAriaProps, buildDataProps, buildCss, buildHtmlProps } from "../utilities/props";
4
4
  import Highcharts from "highcharts"
5
5
  import HighchartsReact from "highcharts-react-official"
6
6
 
@@ -18,23 +18,25 @@ type PbBarGraphProps = {
18
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)};
19
19
  }
20
20
 
21
- const PbBarGraph = ({
21
+ const PbBarGraph = ( props: PbBarGraphProps): React.ReactElement => {
22
+ const {
22
23
  aria = {},
23
24
  data = {},
24
25
  id,
25
26
  htmlOptions = {},
26
27
  options,
27
- className = "pb_pb_bar_graph",
28
- }: PbBarGraphProps): React.ReactElement => {
28
+ className,
29
+ } = props
29
30
 
30
31
  const ariaProps = buildAriaProps(aria);
31
32
  const dataProps = buildDataProps(data)
32
33
  const htmlProps = buildHtmlProps(htmlOptions);
34
+ const classes = classnames(buildCss('pb_pb_bar_graph'), globalProps(props), className)
33
35
 
34
36
  const mergedOptions = useMemo(() => {
35
37
  if (!options || typeof options !== "object") {
36
38
  // eslint-disable-next-line no-console
37
- console.error("❌ Invalid options passed to <BarGraph />", options)
39
+ console.error("❌ Invalid options passed to <PbBarGraph />", options)
38
40
  return {}
39
41
  }
40
42
 
@@ -46,7 +48,7 @@ const PbBarGraph = ({
46
48
  <div>
47
49
  <HighchartsReact
48
50
  containerProps={{
49
- className: classnames(globalProps, className),
51
+ className: classnames(classes),
50
52
  id: id,
51
53
  ...ariaProps,
52
54
  ...dataProps,
@@ -0,0 +1,3 @@
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.
2
+
3
+ See the [highcharts API docs](https://api.highcharts.com/highcharts/) for a comprehensive look at what is possible.
@@ -4,24 +4,21 @@ module Playbook
4
4
  module PbPbBarGraph
5
5
  class PbBarGraph < ::Playbook::KitBase
6
6
  prop :options, default: {}
7
- prop :container_props, default: {}
8
7
 
9
8
  def react_props
10
9
  {
10
+ className: classname,
11
+ data: data,
11
12
  options: options,
12
- containerProps: container_props_hash,
13
+ id: id,
13
14
  }
14
15
  end
15
16
 
16
- def container_props_hash
17
- container_props.merge({
18
- id: id,
19
- className: classname,
20
- }).compact
21
- end
22
-
23
17
  def classname
24
- generate_classname("pb_pb_bar_graph")
18
+ # Highcharts react needs classname attached to the container div,
19
+ # we pass an empty string here to avoid conflicts, classname is built in the TSX
20
+ # We still need generate_classnames to retain ability to pass in custom classnames or global props
21
+ generate_classname("")
25
22
  end
26
23
  end
27
24
  end
@@ -15,6 +15,41 @@ afterEach(() => {
15
15
  console.warn.mockRestore();
16
16
  });
17
17
 
18
+ const chartData = [{
19
+ name: 'Installation',
20
+ data: [1475, 200, 3000, 654, 656],
21
+ }, {
22
+ name: 'Manufacturing',
23
+ data: [4434, 524, 2320, 440, 500],
24
+ }, {
25
+ name: 'Sales & Distribution',
26
+ data: [3387, 743, 1344, 434, 440],
27
+ }, {
28
+ name: 'Project Development',
29
+ data: [3227, 878, 999, 780, 1000],
30
+ }, {
31
+ name: 'Other',
32
+ data: [1111, 677, 3245, 500, 200],
33
+ }]
34
+
35
+ const chartOptions = {
36
+ series: chartData,
37
+ title: {
38
+ text: 'Solar Employment Growth by Sector, 2010-2016',
39
+ },
40
+ subtitle: {
41
+ text: 'Source: thesolarfoundation.com',
42
+ },
43
+ xAxis: {
44
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
45
+ },
46
+ yAxis: {
47
+ title: {
48
+ text: 'Number of Employees',
49
+ },
50
+ },
51
+ }
52
+
18
53
  const testId = 'bargraph1';
19
54
 
20
55
  test('bargraph uses exact classname', () => {
@@ -23,9 +58,46 @@ test('bargraph uses exact classname', () => {
23
58
  className='super_important_class'
24
59
  data={{ testid: testId }}
25
60
  id='bar-default'
61
+ options={chartOptions}
26
62
  />
27
63
  );
28
64
 
29
65
  const kit = screen.getByTestId(testId);
30
66
  expect(kit).toHaveClass('super_important_class');
31
- });
67
+ });
68
+
69
+ test('Kit to apply base classname', () => {
70
+ render(
71
+ <PbBarGraph
72
+ data={{testid: testId}}
73
+ options={chartOptions}
74
+ />
75
+ )
76
+
77
+ expect(screen.getByTestId(testId)).toHaveClass('pb_pb_bar_graph')
78
+ })
79
+
80
+
81
+ test('Kit to apply global props', () => {
82
+ render(
83
+ <PbBarGraph
84
+ data={{testid: testId}}
85
+ margin="lg"
86
+ options={chartOptions}
87
+ />
88
+ )
89
+
90
+ expect(screen.getByTestId(testId)).toHaveClass('m_lg')
91
+ })
92
+
93
+ test('kit to apply id', () => {
94
+ render(
95
+ <PbBarGraph
96
+ data={{testid: testId}}
97
+ id='bar-graph-id'
98
+ options={chartOptions}
99
+ />
100
+ )
101
+
102
+ expect(screen.getByTestId(testId)).toHaveAttribute('id', 'bar-graph-id')
103
+ })