playbook_ui 15.2.0.pre.rc.4 → 15.3.0.pre.alpha.PLAY2565formkitsubmitfix11681

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 (157) 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/advanced_table.html.erb +2 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +39 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +3 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +3 -3
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +3 -3
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +2 -2
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +2 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +2 -2
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +1 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.html.erb +51 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row_rails.md +1 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.html.erb +40 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_rails.md +1 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_react.md +1 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +2 -2
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/index.js +5 -1
  23. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +6 -6
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +6 -6
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -2
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +49 -5
  27. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.html.erb +4 -4
  28. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +4 -0
  29. data/app/pb_kits/playbook/pb_button/_button.scss +6 -0
  30. data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +7 -3
  31. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +29 -0
  32. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +8 -0
  34. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +0 -1
  35. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +5 -3
  36. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md +2 -0
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -1
  38. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +10 -0
  39. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  40. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_form/formHelper.js +1 -1
  42. data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +8 -6
  43. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -0
  44. data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +7 -10
  45. data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +73 -1
  46. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +1 -1
  47. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -0
  48. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +7 -10
  49. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +47 -0
  50. data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.scss +3 -0
  51. data/app/pb_kits/playbook/pb_pb_gauge_chart/_pb_gauge_chart.tsx +69 -0
  52. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -0
  53. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.html.erb +12 -0
  54. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +24 -0
  55. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +5 -0
  56. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.html.erb +45 -0
  57. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +119 -0
  58. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.md +1 -0
  59. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.html.erb +5 -0
  60. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.jsx +17 -0
  61. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.html.erb +12 -0
  62. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_disable_animation.jsx +24 -0
  63. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.html.erb +23 -0
  64. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +37 -0
  65. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.html.erb +40 -0
  66. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +56 -0
  67. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_live_data.jsx +64 -0
  68. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.html.erb +27 -0
  69. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +40 -0
  70. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.md +1 -0
  71. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.html.erb +19 -0
  72. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.jsx +65 -0
  73. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_sizing.md +3 -0
  74. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.html.erb +14 -0
  75. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_title.jsx +27 -0
  76. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.html.erb +39 -0
  77. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +58 -0
  78. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.md +1 -0
  79. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/example.yml +29 -0
  80. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/index.js +11 -0
  81. data/app/pb_kits/playbook/pb_pb_gauge_chart/pbGaugeGraphTheme.ts +91 -0
  82. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.html.erb +1 -0
  83. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.rb +25 -0
  84. data/app/pb_kits/playbook/pb_pb_gauge_chart/pb_gauge_chart.test.jsx +80 -0
  85. data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.scss +3 -0
  86. data/app/pb_kits/playbook/pb_pb_line_graph/_pb_line_graph.tsx +61 -0
  87. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -0
  88. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.html.erb +34 -0
  89. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +52 -0
  90. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.md +5 -0
  91. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.html.erb +34 -0
  92. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.jsx +45 -0
  93. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.html.erb +47 -0
  94. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.jsx +64 -0
  95. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_height.md +3 -0
  96. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.html.erb +24 -0
  97. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend.jsx +37 -0
  98. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.html.erb +39 -0
  99. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_nonclickable.jsx +45 -0
  100. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +86 -0
  101. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.jsx +116 -0
  102. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.md +11 -0
  103. data/app/pb_kits/playbook/pb_pb_line_graph/docs/example.yml +20 -0
  104. data/app/pb_kits/playbook/pb_pb_line_graph/docs/index.js +6 -0
  105. data/app/pb_kits/playbook/pb_pb_line_graph/pbLineGraphTheme.ts +125 -0
  106. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.html.erb +1 -0
  107. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.rb +25 -0
  108. data/app/pb_kits/playbook/pb_pb_line_graph/pb_line_graph.test.jsx +110 -0
  109. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +130 -28
  110. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +41 -2
  111. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -0
  112. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +60 -20
  113. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +36 -0
  114. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.jsx +38 -0
  115. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_attributes.md +1 -0
  116. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.jsx +34 -0
  117. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_focus.md +1 -0
  118. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.jsx +37 -0
  119. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_inline.md +1 -0
  120. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +37 -0
  121. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.jsx +38 -0
  122. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_sticky.md +1 -0
  123. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.jsx +69 -0
  124. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_templates.md +1 -0
  125. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +8 -2
  126. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +6 -0
  127. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.test.js +127 -1
  128. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +250 -233
  129. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  130. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +2 -2
  131. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +35 -1
  132. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +71 -2
  133. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.html.erb +36 -0
  134. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_options.md +1 -0
  135. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.jsx +41 -0
  136. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.md +1 -0
  137. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  138. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  139. data/app/pb_kits/playbook/tokens/_positioning.scss +1 -0
  140. data/app/pb_kits/playbook/utilities/_positioning.scss +6 -1
  141. data/app/pb_kits/playbook/utilities/globalProps.ts +3 -1
  142. data/dist/chunks/{_line_graph-BxcVBQsJ.js → _line_graph-h5H-imfn.js} +1 -1
  143. data/dist/chunks/_typeahead-U8AjZIIW.js +6 -0
  144. data/dist/chunks/{_weekday_stacked-BhPyFGlS.js → _weekday_stacked-CbCUYuuZ.js} +2 -2
  145. data/dist/chunks/{lib-QZuu1ltS.js → lib-CGxXTQ75.js} +1 -1
  146. data/dist/chunks/{pb_form_validation-CleM960_.js → pb_form_validation-DebqlUKZ.js} +1 -1
  147. data/dist/chunks/vendor.js +1 -1
  148. data/dist/menu.yml +12 -0
  149. data/dist/playbook-doc.js +2 -2
  150. data/dist/playbook-rails-react-bindings.js +1 -1
  151. data/dist/playbook-rails.js +1 -1
  152. data/dist/playbook.css +1 -1
  153. data/lib/playbook/pb_forms_helper.rb +7 -6
  154. data/lib/playbook/version.rb +2 -2
  155. data/lib/playbook/z_index.rb +1 -1
  156. metadata +89 -7
  157. data/dist/chunks/_typeahead-eZENQ_Y_.js +0 -6
@@ -1,8 +1,13 @@
1
1
  import React from 'react'
2
2
  import Button from "../../pb_button/_button"
3
+ import Caption from "../../pb_caption/_caption"
3
4
 
4
5
  const ButtonLoading = (props) => (
5
6
  <div>
7
+ <Caption
8
+ marginY="md"
9
+ text="Button variants with loading"
10
+ />
6
11
  <Button
7
12
  aria={{ label: 'Loading' }}
8
13
  loading
@@ -31,6 +36,30 @@ const ButtonLoading = (props) => (
31
36
  variant="link"
32
37
  {...props}
33
38
  />
39
+ <br/>
40
+ <Caption
41
+ marginY="md"
42
+ text="Button sizes with loading"
43
+ />
44
+ <Button
45
+ aria={{ label: 'Loading' }}
46
+ loading
47
+ marginRight='lg'
48
+ size="sm"
49
+ tabIndex={0}
50
+ text="Small Button"
51
+ {...props}
52
+ />
53
+ {' '}
54
+ <Button
55
+ aria={{ label: 'Loading' }}
56
+ loading
57
+ marginRight='lg'
58
+ size="lg"
59
+ tabIndex={0}
60
+ text="Small Button"
61
+ {...props}
62
+ />
34
63
  </div>
35
64
  )
36
65
 
@@ -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
  />
@@ -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,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
+ })
@@ -46,7 +46,7 @@ const PbCircleChart = (props: PbCircleChartProps) => {
46
46
  <div>
47
47
  <HighchartsReact
48
48
  containerProps={{
49
- className: classnames(globalProps, className),
49
+ className: classnames(classes),
50
50
  id: id,
51
51
  ...ariaProps,
52
52
  ...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 PbPbCircleChart
5
5
  class PbCircleChart < ::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_circle_chart")
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
@@ -49,3 +49,50 @@ test('Kit to exist', () => {
49
49
  expect(screen.getByTestId(testId)).toBeInTheDocument()
50
50
  })
51
51
 
52
+ test('Kit to apply base classname', () => {
53
+ render(
54
+ <PbCircleChart
55
+ data={{testid: testId}}
56
+ options={chartOptions}
57
+ />
58
+ )
59
+
60
+ expect(screen.getByTestId(testId)).toHaveClass('pb_pb_circle_chart')
61
+ })
62
+
63
+ test('Kit to have custom class', () => {
64
+ render(
65
+ <PbCircleChart
66
+ className='custom-class'
67
+ data={{testid: testId}}
68
+ options={chartOptions}
69
+ />
70
+ )
71
+
72
+ expect(screen.getByTestId(testId)).toHaveClass('custom-class')
73
+ })
74
+
75
+ test('Kit to apply global props', () => {
76
+ render(
77
+ <PbCircleChart
78
+ data={{testid: testId}}
79
+ margin="lg"
80
+ options={chartOptions}
81
+ />
82
+ )
83
+
84
+ expect(screen.getByTestId(testId)).toHaveClass('m_lg')
85
+ })
86
+
87
+ test('kit to apply id', () => {
88
+ render(
89
+ <PbCircleChart
90
+ data={{testid: testId}}
91
+ id='circle-chart-id'
92
+ options={chartOptions}
93
+ />
94
+ )
95
+
96
+ expect(screen.getByTestId(testId)).toHaveAttribute('id', 'circle-chart-id')
97
+ })
98
+
@@ -0,0 +1,3 @@
1
+ .pb_pb_gauge_chart {
2
+
3
+ }
@@ -0,0 +1,69 @@
1
+
2
+ import React, { useMemo } from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
+ import Highcharts from "highcharts"
6
+ import HighchartsReact from "highcharts-react-official"
7
+ import pbGaugeGraphTheme from './pbGaugeGraphTheme'
8
+ import highchartsMore from "highcharts/highcharts-more";
9
+ import solidGauge from "highcharts/modules/solid-gauge";
10
+ import { globalProps } from '../utilities/globalProps'
11
+
12
+ type PbGaugeChartProps = {
13
+ aria?: { [key: string]: string },
14
+ className?: string,
15
+ data?: { [key: string]: string },
16
+ htmlOptions?: { [key: string]: string | number | boolean | (() => void) | ((arg?: Event) => void) },
17
+ id?: string,
18
+ ref?: React.RefObject<any>,
19
+ options: Record<string, unknown>
20
+ }
21
+
22
+ const PbGaugeChart = (props: PbGaugeChartProps) => {
23
+ const {
24
+ aria = {},
25
+ className,
26
+ data = {},
27
+ htmlOptions = {},
28
+ id,
29
+ ref,
30
+ options = {},
31
+ } = props
32
+
33
+ const ariaProps = buildAriaProps(aria)
34
+ const dataProps = buildDataProps(data)
35
+ const htmlProps = buildHtmlProps(htmlOptions)
36
+ const classes = classnames(buildCss('pb_pb_gauge_chart'), globalProps(props), className)
37
+
38
+ const mergedOptions = useMemo(() => {
39
+ if (!options || typeof options !== "object") {
40
+ // eslint-disable-next-line no-console
41
+ console.error("❌ Invalid options passed to <PbLineGraph />", options)
42
+ return {}
43
+ }
44
+
45
+ return Highcharts.merge({}, pbGaugeGraphTheme, options)
46
+ }, [options])
47
+
48
+ highchartsMore(Highcharts);
49
+ solidGauge(Highcharts);
50
+
51
+ return (
52
+ <div>
53
+ <HighchartsReact
54
+ containerProps={{
55
+ className: classnames(classes),
56
+ id: id,
57
+ ref: ref,
58
+ ...ariaProps,
59
+ ...dataProps,
60
+ ...htmlProps
61
+ }}
62
+ highcharts={Highcharts}
63
+ options={mergedOptions}
64
+ />
65
+ </div>
66
+ )
67
+ }
68
+
69
+ export default PbGaugeChart
@@ -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.
@@ -0,0 +1,12 @@
1
+ <% data = [{ name: "Name", y: 67 }] %>
2
+
3
+ <% chart_options = {
4
+ series: [{ data: data }],
5
+ plotOptions: {
6
+ solidgauge: {
7
+ borderColor: '#00C4D7',
8
+ }
9
+ },
10
+ } %>
11
+
12
+ <%= pb_rails("pb_gauge_chart", props: { options: chart_options }) %>
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import PbGaugeChart from '../../pb_pb_gauge_chart/_pb_gauge_chart'
3
+ import { colors } from 'playbook-ui'
4
+
5
+ const data = [{ name: "Name", y: 67 }]
6
+
7
+ const chartOptions = {
8
+ series: [{ data: data }],
9
+ plotOptions: {
10
+ solidgauge: {
11
+ borderColor: colors.data_7,
12
+ }
13
+ },
14
+ };
15
+ const PbGaugeChartColor = (props) => (
16
+ <div>
17
+ <PbGaugeChart
18
+ options={chartOptions}
19
+ {...props}
20
+ />
21
+ </div>
22
+ )
23
+
24
+ export default PbGaugeChartColor
@@ -0,0 +1,5 @@
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
+
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`
4
+
5
+ For Rails, the prop `plotOptions.solidgauge.borderColor` can only be used with HEX values as shown.
@@ -0,0 +1,45 @@
1
+ <% chart_options = {
2
+ series:[{data:[{ name: "Name", y: 10 }]}],
3
+ chart: {
4
+ height: "150",
5
+ },
6
+ plotOptions: {
7
+ series: {
8
+ animation: false,
9
+ },
10
+ solidgauge: {
11
+ dataLabels: {
12
+ format:
13
+ '<span class="fix">{y:,f}</span>' +
14
+ '<span style="fill: #687887; font-size: 27px;">%</span>',
15
+ },
16
+ },
17
+ },
18
+ } %>
19
+
20
+ <%= pb_rails("flex", props: {wrap: true, padding: "xl", gap: "sm"}) do %>
21
+ <%= pb_rails("flex/flex_item", props: {flex: 1, grow: true }) do %>
22
+ <%= pb_rails("card", props: {max_width: "xs", padding: "md", }) do %>
23
+ <%= pb_rails("title", props: {padding_bottom: "sm", size: 4, text: "Abandoned Calls" })%>
24
+ <%= pb_rails("flex", props: {align: "stretch"}) do %>
25
+ <%= pb_rails("flex", props: {margin_right: "sm", orientation: "column"}) do %>
26
+ <%= pb_rails("body", props: {color: "light", padding_bottom: "sm",text: "Total Abandoned"}) %>
27
+ <%= pb_rails("flex", props: {align: "baseline", padding_bottom: "sx"}) do %>
28
+ <%= pb_rails("title", props: {size: 1, text: "39"})%>
29
+ <%= pb_rails("title", props: {color: "light", size: 3, text: "calls"}) %>
30
+ <% end %>
31
+ <%= pb_rails("caption", props: {size: "xs", text: "of 390" }) %>
32
+ <%end %>
33
+ <%= pb_rails("section_separator", props: {align_self: "stretch", margin_right: "sm", orientation: "vertical" }) %>
34
+ <%= pb_rails("flex", props: {orientation: "column", wrap: true}) do %>
35
+ <%= pb_rails("body", props: {color: "light", text: "% Abandoned"}) %>
36
+ <%= pb_rails("flex", props: {wrap: true}) do %>
37
+ <%= pb_rails("flex/flex_item", props: {fixed_size: "150px", overflow: "hidden", shrink: true}) do %>
38
+ <%= pb_rails("pb_gauge_chart", props: { options: chart_options }) %>
39
+ <% end %>
40
+ <% end %>
41
+ <% end %>
42
+ <%end %>
43
+ <% end %>
44
+ <% end %>
45
+ <% end %>