playbook_ui 16.3.0 → 16.4.0.pre.alpha.PLAY2864circleiconbuttonloadingalignrails15138

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +17 -4
  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 +21 -9
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +25 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowModelUtils.ts +100 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +46 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -2
  10. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  11. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +109 -2
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.jsx +50 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_cascade_collapse.md +1 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +57 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +7 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.jsx +175 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_parent_only.md +5 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/index.js +130 -29
  22. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +21 -4
  23. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +115 -9
  24. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -1
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +12 -1
  26. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +4 -1
  27. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +9 -1
  28. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +6 -1
  29. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +5 -0
  30. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_loading.html.erb +25 -0
  31. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_loading.jsx +97 -38
  32. data/app/pb_kits/playbook/pb_collapsible/index.js +15 -26
  33. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -1
  34. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.jsx +6 -3
  36. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.html.erb +3 -3
  37. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +6 -3
  38. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.html.erb +3 -3
  39. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +6 -3
  40. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -0
  41. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -0
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.html.erb +16 -0
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_closing_options_rails.md +1 -0
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.html.erb +224 -0
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_custom_event_type.md +7 -0
  46. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  47. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +8 -1
  48. data/app/pb_kits/playbook/pb_dropdown/index.js +255 -46
  49. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +19 -14
  50. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +4 -0
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +3 -0
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.html.erb +46 -0
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin.jsx +42 -0
  54. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_rails.md +1 -0
  55. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_nav_margin_react.md +1 -0
  56. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  57. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +2 -1
  58. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +7 -1
  59. data/app/pb_kits/playbook/pb_icon/icon.rb +7 -1
  60. data/app/pb_kits/playbook/pb_list/_list_mixin.scss +4 -4
  61. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +1 -1
  62. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +24 -15
  63. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement.jsx +81 -0
  64. data/app/pb_kits/playbook/pb_popover/docs/_popover_placement_react.md +1 -0
  65. data/app/pb_kits/playbook/pb_popover/docs/_popover_position.html.erb +128 -0
  66. data/app/pb_kits/playbook/pb_popover/docs/_popover_position_rails.md +1 -0
  67. data/app/pb_kits/playbook/pb_popover/docs/example.yml +2 -0
  68. data/app/pb_kits/playbook/pb_popover/docs/index.js +2 -1
  69. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +35 -134
  70. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_editor.tsx +51 -0
  71. data/app/pb_kits/playbook/pb_rich_text_editor/_trix_editor.tsx +206 -0
  72. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +56 -0
  73. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.md +1 -0
  74. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +13 -21
  75. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -10
  76. data/app/pb_kits/playbook/pb_rich_text_editor/inlineFocus.ts +5 -4
  77. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +19 -1
  78. data/app/pb_kits/playbook/pb_table/_table.tsx +24 -21
  79. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.jsx +152 -0
  80. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props.md +17 -0
  81. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.html.erb +121 -0
  82. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_with_card_title_props_rails.md +17 -0
  83. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  84. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  85. data/app/pb_kits/playbook/pb_table/table.html.erb +12 -11
  86. data/app/pb_kits/playbook/pb_table/table.rb +4 -0
  87. data/app/pb_kits/playbook/pb_table/table.test.js +33 -0
  88. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +4 -1
  89. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +105 -3
  90. data/app/pb_kits/playbook/utilities/domHelpers.ts +50 -0
  91. data/dist/chunks/{_pb_line_graph-CKBPxTmM.js → _pb_line_graph-D6s5rymw.js} +1 -1
  92. data/dist/chunks/_typeahead-Bh0RF1X-.js +1 -0
  93. data/dist/chunks/componentRegistry-DRSp5D_e.js +1 -0
  94. data/dist/chunks/{globalProps-DLCfJwiU.js → globalProps-Ds_6HBhX.js} +1 -1
  95. data/dist/chunks/lib-BaO72ugL.js +29 -0
  96. data/dist/chunks/vendor.js +5 -5
  97. data/dist/menu.yml +3 -2
  98. data/dist/playbook-rails-react-bindings.js +1 -1
  99. data/dist/playbook-rails.js +1 -1
  100. data/dist/playbook.css +1 -1
  101. data/lib/playbook/pb_forms_helper.rb +3 -0
  102. data/lib/playbook/version.rb +2 -2
  103. metadata +34 -31
  104. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
  105. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +0 -15
  106. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
  107. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
  108. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +0 -17
  109. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
  110. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +0 -16
  111. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +0 -28
  112. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +0 -1
  113. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
  114. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +0 -45
  115. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
  116. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +0 -22
  117. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.md +0 -3
  118. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
  119. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +0 -13
  120. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
  121. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +0 -15
  122. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
  123. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +0 -42
  124. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
  125. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
  126. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +0 -5
  127. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +0 -63
  128. data/dist/chunks/_typeahead-B7bktFm6.js +0 -1
  129. data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
  130. data/dist/chunks/lib-QT_7rPYf.js +0 -29
@@ -27,6 +27,8 @@ module Playbook
27
27
  default: []
28
28
  prop :inline_row_loading, type: Playbook::Props::Boolean,
29
29
  default: false
30
+ prop :pinned_rows, type: Playbook::Props::HashProp,
31
+ default: {}
30
32
 
31
33
  def flatten_columns(columns)
32
34
  columns.flat_map do |col|
@@ -42,14 +44,21 @@ module Playbook
42
44
  end.compact
43
45
  end
44
46
 
45
- def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil)
47
+ def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {}, immediate_parent_row_id: nil, is_pinned_row: false, pinned_index: nil, skip_pinned_ids: nil, initial_table_data_attributes: nil)
48
+ if skip_pinned_ids && row_id_for(row) && skip_pinned_ids.include?(row_id_for(row).to_s)
49
+ return is_pinned_row ? [ActiveSupport::SafeBuffer.new, pinned_index] : ActiveSupport::SafeBuffer.new
50
+ end
51
+
46
52
  top_parent_id ||= row.object_id
47
53
  new_ancestor_ids = ancestor_ids + [row.object_id]
48
- leaf_columns = flatten_columns(column_definitions)
54
+ leaf_columns = flatten_columns(column_definitions || [])
49
55
 
50
56
  output = ActiveSupport::SafeBuffer.new
51
- is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
52
- last_row = subrow_headers.length == current_depth
57
+ subrow_headers_arr = subrow_headers || []
58
+ is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers_arr[current_depth - 1].present?
59
+ last_row = subrow_headers_arr.length == current_depth
60
+
61
+ next_pinned_index = pinned_index
53
62
 
54
63
  subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
55
64
  subrow_data_attributes = {
@@ -58,7 +67,16 @@ module Playbook
58
67
  row_parent: "#{table_id}_#{ancestor_ids.last}",
59
68
  }
60
69
  # Subrow header if applicable
61
- output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
70
+ if is_first_child_of_subrow && enable_toggle_expansion == "all"
71
+ subrow_props = { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers_arr[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id }
72
+ if is_pinned_row && next_pinned_index
73
+ subrow_props[:is_pinned_row] = true
74
+ subrow_props[:pinned_index] = next_pinned_index
75
+ subrow_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: "var(--pb_table_sticky_bg, #f5f5f5)") }
76
+ next_pinned_index += 1
77
+ end
78
+ output << pb_rails("advanced_table/table_subrow_header", props: subrow_props)
79
+ end
62
80
 
63
81
  current_data_attributes = if current_depth.zero?
64
82
  {
@@ -67,11 +85,19 @@ module Playbook
67
85
  row_parent: nil,
68
86
  }
69
87
  else
70
- table_data_attributes
88
+ initial_table_data_attributes || table_data_attributes
71
89
  end
72
90
 
73
91
  # Additional class and data attributes needed for toggle logic
74
- output << pb_rails("advanced_table/table_row", props: { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading })
92
+ row_props = { table_id: table_id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading }
93
+ if is_pinned_row && next_pinned_index
94
+ row_props[:is_pinned_row] = true
95
+ row_props[:pinned_index] = next_pinned_index
96
+ row_bg = (row_styling || []).find { |s| s[:row_id].to_s == row_id_for(row).to_s }&.[](:background_color) || "white"
97
+ row_props[:html_options] = { style: build_pinned_row_style(next_pinned_index, background: row_bg) }
98
+ next_pinned_index += 1
99
+ end
100
+ output << pb_rails("advanced_table/table_row", props: row_props)
75
101
 
76
102
  # Render inline loading row when inline_row_loading is enabled and row has empty children
77
103
  if inline_row_loading
@@ -103,11 +129,21 @@ module Playbook
103
129
  advanced_table_content: data_content,
104
130
  }
105
131
 
106
- output << render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, additional_classes: "toggle-content", table_data_attributes: child_data_attributes, immediate_parent_row_id: row[:id])
132
+ child_opts = { additional_classes: "toggle-content", table_data_attributes: child_data_attributes, immediate_parent_row_id: row[:id] }
133
+ child_opts[:is_pinned_row] = is_pinned_row
134
+ child_opts[:pinned_index] = next_pinned_index if is_pinned_row
135
+ child_opts[:skip_pinned_ids] = skip_pinned_ids if skip_pinned_ids
136
+
137
+ child_output, next_pinned_index = render_row_and_children(child_row, column_definitions, current_depth + 1, is_first_child, new_ancestor_ids, top_parent_id, **child_opts)
138
+ output << child_output
107
139
  end
108
140
  end
109
141
 
110
- output
142
+ if is_pinned_row
143
+ [output, next_pinned_index]
144
+ else
145
+ output
146
+ end
111
147
  end
112
148
 
113
149
  def classname
@@ -142,6 +178,76 @@ module Playbook
142
178
  end
143
179
  end
144
180
 
181
+ def row_id_for(row)
182
+ return nil if row.nil?
183
+
184
+ row[:id] || row["id"]
185
+ end
186
+
187
+ def pinned_top_ids
188
+ return [] if pinned_rows.nil? || !pinned_rows.respond_to?(:[])
189
+
190
+ top = pinned_rows["top"] || pinned_rows[:top]
191
+ Array(top).map(&:to_s)
192
+ end
193
+
194
+ def pinned_ids_set
195
+ return Set.new if pinned_top_ids.blank?
196
+
197
+ set = Set.new
198
+ pinned_root_rows.each do |root|
199
+ collect_row_and_descendant_ids(root[:row], set)
200
+ end
201
+ set
202
+ end
203
+
204
+ def collect_row_and_descendant_ids(row, set)
205
+ id = row_id_for(row)
206
+ set.add(id.to_s) if id
207
+ row_children_for(row)&.each { |child| collect_row_and_descendant_ids(child, set) }
208
+ end
209
+
210
+ def find_row_by_id(data, id, depth: 0, ancestor_ids: [], parent_row: nil)
211
+ id_str = id.to_s
212
+ Array(data).each do |row|
213
+ return { row: row, depth: depth, ancestor_ids: ancestor_ids, parent_row: parent_row } if row_id_for(row).to_s == id_str
214
+
215
+ found = find_row_by_id(row_children_for(row), id_str, depth: depth + 1, ancestor_ids: ancestor_ids + [row.object_id], parent_row: row)
216
+ return found if found
217
+ end
218
+ nil
219
+ end
220
+
221
+ def pinned_root_rows
222
+ return [] if pinned_top_ids.blank?
223
+
224
+ pinned_top_ids.filter_map { |id| find_row_by_id(table_data, id) }
225
+ end
226
+
227
+ def has_pinned_rows?
228
+ pinned_root_rows.any?
229
+ end
230
+
231
+ # Build inline style for sticky pinned row (matches React). Pass via html_options so the tr gets the attribute.
232
+ def build_pinned_row_style(pinned_index, background: "white")
233
+ header_offset = "var(--advanced-table-header-height, 44px)"
234
+ row_offset = "calc(2.5em * #{pinned_index})"
235
+ "position: sticky; top: calc(#{header_offset} + #{row_offset}); z-index: 3; background: #{background};"
236
+ end
237
+
238
+ def pinned_root_initial_data_attributes(root_info)
239
+ return {} if root_info[:depth].to_i.zero?
240
+
241
+ anc = root_info[:ancestor_ids] || []
242
+ content = (anc + [root_info[:row].object_id]).join("-")
243
+ {
244
+ top_parent: "#{table_id}_#{anc.first}",
245
+ row_depth: root_info[:depth],
246
+ row_parent: "#{table_id}_#{anc.last}",
247
+ advanced_table_content: content,
248
+ }
249
+ end
250
+
145
251
  def cell_accessors_length(col_defs)
146
252
  first_col = col_defs.first
147
253
  return 0 unless first_col
@@ -3,9 +3,11 @@
3
3
  button_color = row_style&.[](:expand_button_color)
4
4
  bg_color = row_style&.[](:background_color)
5
5
  font_color = row_style&.[](:font_color)
6
+ tr_options = (object.html_options || {}).stringify_keys
7
+ tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ")
6
8
  %>
7
9
 
8
- <%= pb_content_tag(:tr) do %>
10
+ <%= pb_content_tag(:tr, tr_options) do %>
9
11
  <% has_separate_checkbox = object.selectable_rows && object.enable_toggle_expansion == "none" %>
10
12
  <% if has_separate_checkbox %>
11
13
  <%= object.render_checkbox_cell %>
@@ -35,13 +35,24 @@ module Playbook
35
35
  default: ""
36
36
  prop :inline_row_loading, type: Playbook::Props::Boolean,
37
37
  default: false
38
+ prop :is_pinned_row, type: Playbook::Props::Boolean,
39
+ default: false
40
+ prop :pinned_index, type: Playbook::Props::Numeric,
41
+ default: nil
42
+ prop :html_options, type: Playbook::Props::HashProp,
43
+ default: {}
44
+ prop :classname, type: Playbook::Props::String,
45
+ default: ""
38
46
 
39
47
  def data
40
48
  Hash(prop(:data)).merge(table_data_attributes)
41
49
  end
42
50
 
43
51
  def classname
44
- generate_classname("pb_table_tr", "pb-bg-row-white", subrow_depth_classname, separator: " ")
52
+ classes = ["pb_table_tr", "pb-bg-row-white", subrow_depth_classname]
53
+ classes << "pinned-row" if is_pinned_row
54
+ classes.reject!(&:blank?)
55
+ generate_classname(*classes, separator: " ")
45
56
  end
46
57
 
47
58
  def td_classname(column, index)
@@ -1,4 +1,7 @@
1
- <%= pb_content_tag(:tr) do %>
1
+ <% tr_options = (object.html_options || {}).stringify_keys %>
2
+ <% tr_options["class"] = [tr_options["class"], object.classname].reject(&:blank?).join(" ") %>
3
+
4
+ <%= pb_content_tag(:tr, tr_options) do %>
2
5
  <% object.column_definitions.each_with_index do |column, index| %>
3
6
  <%= pb_rails("table/table_cell", props: { classname: object.td_classname(index) }) do %>
4
7
  <%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
@@ -19,13 +19,21 @@ module Playbook
19
19
  prop :responsive, type: Playbook::Props::Enum,
20
20
  values: %w[none scroll],
21
21
  default: "scroll"
22
+ prop :is_pinned_row, type: Playbook::Props::Boolean,
23
+ default: false
24
+ prop :pinned_index, type: Playbook::Props::Numeric,
25
+ default: nil
26
+ prop :html_options, type: Playbook::Props::HashProp,
27
+ default: {}
22
28
 
23
29
  def data
24
30
  Hash(prop(:data)).merge(subrow_data_attributes)
25
31
  end
26
32
 
27
33
  def classname
28
- generate_classname("pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname, separator: " ")
34
+ classes = ["pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname]
35
+ classes << "pinned-row" if is_pinned_row
36
+ generate_classname(*classes, separator: " ")
29
37
  end
30
38
 
31
39
  def td_classname(index)
@@ -57,7 +57,7 @@ $pb_button_border_width: 0px;
57
57
  }
58
58
 
59
59
  .loading-icon {
60
- position: absolute;
60
+ position: static;
61
61
  display: none;
62
62
  }
63
63
  .pb_button_content {
@@ -158,10 +158,15 @@ $pb_button_border_width: 0px;
158
158
  // Loading =====================
159
159
  @mixin pb_button_loading($loading: false) {
160
160
  @if $loading == true {
161
+ display: inline-grid;
162
+ place-items: center;
163
+
161
164
  .loading-icon {
165
+ grid-area: 1 / 1;
162
166
  display: block;
163
167
  }
164
168
  .pb_button_content {
169
+ grid-area: 1 / 1;
165
170
  visibility: hidden;
166
171
  }
167
172
  }
@@ -43,6 +43,11 @@ $pb_button_styles: (
43
43
  @include pb_circle_icon_button;
44
44
  }
45
45
  }
46
+
47
+ .pb_button_kit.pb_button_loading svg.loading-icon {
48
+ position: absolute;
49
+ }
50
+
46
51
  :first-child {
47
52
  &.pb_button_kit.pb_button_link {
48
53
  @include pb_circle_icon_button_active;
@@ -27,3 +27,28 @@
27
27
  icon: "user",
28
28
  loading: true
29
29
  }) %>
30
+
31
+
32
+ <%= pb_rails("button", props: { margin_top: "md", text: "Open Dialog to confirm PLAY-2837 fix still works", data: {"open-dialog": "dialog-1"} }) %>
33
+
34
+ <%= pb_rails("dialog", props: {
35
+ id:"dialog-1",
36
+ size: "md",
37
+ title: "Header Title is the Title Prop"
38
+ }) do %>
39
+ <%= pb_rails("dialog/dialog_body") do %>
40
+ <%= pb_rails("button", props: { aria: { label: "Loading" }, loading: true, margin_right: "lg", text: "Button Primary" }) %>
41
+ <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
42
+ <div style="height: 800px; background-color: lightgray;"></div>
43
+ <%= pb_rails("button", props: { loading: true, text: "Loading..." }) %>
44
+ <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
45
+ <% end %>
46
+
47
+ <%= pb_rails("dialog/dialog_footer") do %>
48
+ <%= pb_rails("flex", props: { spacing: "between", padding_x: "md", padding_bottom: "md", padding: "sm" }) do %>
49
+ <%= pb_rails("button", props: { loading: true, text: "Send My Issue" }) %>
50
+ <%= pb_rails("circle_icon_button", props: { loading: true, icon: "plus" }) %>
51
+ <%= pb_rails("button", props: { text: "Back", variant: "link", data: {"close-dialog": "dialog-1"} }) %>
52
+ <% end %>
53
+ <% end %>
54
+ <% end %>
@@ -1,43 +1,102 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
 
3
3
  import CircleIconButton from '../_circle_icon_button'
4
+ import Dialog from '../../pb_dialog/_dialog'
5
+ import Button from '../../pb_button/_button'
4
6
 
5
- const CircleIconButtonLoading = (props) => (
6
- <div>
7
- <CircleIconButton
8
- icon="plus"
9
- loading
10
- variant="primary"
11
- {...props}
12
- />
13
-
14
- <br />
15
-
16
- <CircleIconButton
17
- icon="pen"
18
- loading
19
- variant="secondary"
20
- {...props}
21
- />
22
-
23
- <br />
24
-
25
- <CircleIconButton
26
- disabled
27
- icon="times"
28
- loading
29
- {...props}
30
- />
31
-
32
- <br />
33
-
34
- <CircleIconButton
35
- icon="user"
36
- loading
37
- variant="link"
38
- {...props}
39
- />
40
- </div>
41
- )
7
+ const CircleIconButtonLoading = (props) => {
8
+
9
+
10
+ const [isOpen, setIsOpen] = useState(false)
11
+ const close = () => setIsOpen(false)
12
+ const open = () => setIsOpen(true)
13
+
14
+ return (
15
+ <div>
16
+ <CircleIconButton
17
+ icon="plus"
18
+ loading
19
+ variant="primary"
20
+ {...props}
21
+ />
22
+
23
+ <br />
24
+
25
+ <CircleIconButton
26
+ icon="pen"
27
+ loading
28
+ variant="secondary"
29
+ {...props}
30
+ />
31
+
32
+ <br />
33
+
34
+ <CircleIconButton
35
+ disabled
36
+ icon="times"
37
+ loading
38
+ {...props}
39
+ />
40
+
41
+ <br />
42
+
43
+ <CircleIconButton
44
+ icon="user"
45
+ loading
46
+ variant="link"
47
+ {...props}
48
+ />
49
+ <>
50
+ <Button marginTop="md"
51
+ onClick={open}
52
+ >
53
+ {'Open Dialog to confirm PLAY-2837 fix still works for circle icon buttons'}
54
+ </Button>
55
+ <Dialog
56
+ onCancel={close}
57
+ onClose={close}
58
+ onConfirm={close}
59
+ opened={isOpen}
60
+ size="md"
61
+ title="Header Title is the Title Prop"
62
+ >
63
+ <Dialog.Body>
64
+ <Button
65
+ aria={{ label: 'Loading' }}
66
+ loading
67
+ text="Button Primary"
68
+ />
69
+ <CircleIconButton
70
+ icon="plus"
71
+ loading
72
+ />
73
+ <div style={{height: '800px', backgroundColor: 'lightgray'}} />
74
+ <Button
75
+ loading
76
+ text="Loading..."
77
+ />
78
+ <CircleIconButton
79
+ icon="plus"
80
+ loading
81
+ />
82
+ </Dialog.Body>
83
+ <Dialog.Footer>
84
+ <Button
85
+ loading
86
+ text="Send My Issue"
87
+ />
88
+ <CircleIconButton
89
+ icon="plus"
90
+ loading
91
+ />
92
+ <Button variant="link">
93
+ {"Back"}
94
+ </Button>
95
+ </Dialog.Footer>
96
+ </Dialog>
97
+ </>
98
+ </div>
99
+ )
100
+ }
42
101
 
43
102
  export default CircleIconButtonLoading
@@ -1,4 +1,5 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
+ import { getElementHeight, setArrowVisibility, toggleVisibility } from '../utilities/domHelpers'
2
3
 
3
4
  const MAIN_SELECTOR = '[data-collapsible-main]'
4
5
  const CONTENT_SELECTOR = '[data-collapsible-content]'
@@ -43,15 +44,7 @@ export default class PbCollapsible extends PbEnhancedElement {
43
44
  }
44
45
 
45
46
  showElement(elem) {
46
- // Get the natural height of the element
47
- const getHeight = () => {
48
- elem.style.display = 'block'
49
- const height = elem.scrollHeight + 'px' // Get it's height
50
- elem.style.display = '' // Hide it again
51
- return height
52
- }
53
-
54
- const height = getHeight()
47
+ const height = getElementHeight(elem)
55
48
  elem.classList.add('is-visible')
56
49
  elem.style.height = height // Update the max-height
57
50
  elem.style.overflow = "hidden"
@@ -82,26 +75,22 @@ export default class PbCollapsible extends PbEnhancedElement {
82
75
  }
83
76
 
84
77
  toggleElement(elem) {
85
- if (elem.classList.contains('is-visible')) {
86
- this.hideElement(elem)
87
- this.displayDownArrow()
88
- return
89
- }
90
- // Otherwise, show it
91
- this.showElement(elem)
92
- this.displayUpArrow()
78
+ const isExpanded = toggleVisibility({
79
+ isVisible: elem.classList.contains('is-visible'),
80
+ onHide: () => this.hideElement(elem),
81
+ onShow: () => this.showElement(elem),
82
+ })
83
+
84
+ isExpanded ? this.displayUpArrow() : this.displayDownArrow()
93
85
  }
94
86
 
95
87
  toggleArrows(showDownArrow) {
96
- const downArrow = this.element.querySelector(DOWN_ARROW_SELECTOR);
97
- const upArrow = this.element.querySelector(UP_ARROW_SELECTOR);
98
-
99
- if (downArrow) {
100
- downArrow.style.display = showDownArrow ? 'inline-block' : 'none';
101
- }
102
- if (upArrow) {
103
- upArrow.style.display = showDownArrow ? 'none' : 'inline-block';
104
- }
88
+ setArrowVisibility({
89
+ rootElement: this.element,
90
+ downSelector: DOWN_ARROW_SELECTOR,
91
+ upSelector: UP_ARROW_SELECTOR,
92
+ showDownArrow,
93
+ })
105
94
  }
106
95
 
107
96
  displayDownArrow() {
@@ -535,7 +535,9 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
535
535
  // Code block triggers after form.reset() is called and executed
536
536
  setTimeout(() => {
537
537
  dropdown.value = picker.currentYear
538
- picker.monthsDropdownContainer.value = picker.currentMonth
538
+ if (picker.monthsDropdownContainer) {
539
+ picker.monthsDropdownContainer.value = picker.currentMonth
540
+ }
539
541
 
540
542
  /* Reset date picker to default value on form.reset() */
541
543
  if (defaultDate){
@@ -28,7 +28,7 @@
28
28
  <% end %>
29
29
  <%= pb_rails("dialog/dialog_body") do %>
30
30
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
31
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
31
+ <%= pb_rails("textarea", props: {id: "default"}) %>
32
32
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
33
33
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
34
34
  <%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
@@ -4,7 +4,7 @@ import Body from '../../pb_body/_body'
4
4
  import Button from '../../pb_button/_button'
5
5
  import Caption from '../../pb_caption/_caption'
6
6
  import Dialog from '../../pb_dialog/_dialog'
7
- import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
7
+ import Textarea from '../../pb_textarea/_textarea'
8
8
  import Typeahead from '../../pb_typeahead/_typeahead'
9
9
 
10
10
  const DialogCompound = () => {
@@ -25,8 +25,11 @@ const DialogCompound = () => {
25
25
  <Body>{'What do you need us to take care of?'}</Body>
26
26
  </Dialog.Header>
27
27
  <Dialog.Body>
28
- <Caption marginBottom="xs">{'Description'}</Caption>
29
- <RichTextEditor />
28
+ <Textarea
29
+ id="default-example-1"
30
+ label="Description"
31
+ rows={4}
32
+ />
30
33
  <br />
31
34
  <Caption>
32
35
  {
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
  <%= pb_rails("dialog/dialog_body") do %>
14
14
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
15
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
15
+ <%= pb_rails("textarea", props: {id: "default-7"}) %>
16
16
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
17
17
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
18
18
 
@@ -31,7 +31,7 @@
31
31
  <% end %>
32
32
  <%= pb_rails("dialog/dialog_body") do %>
33
33
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
34
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
34
+ <%= pb_rails("textarea", props: {id: "default-8"}) %>
35
35
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
36
36
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
37
37
 
@@ -49,7 +49,7 @@
49
49
  <% end %>
50
50
  <%= pb_rails("dialog/dialog_body") do %>
51
51
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
52
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
52
+ <%= pb_rails("textarea", props: {id: "default-9"}) %>
53
53
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
54
54
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
55
55
 
@@ -5,7 +5,7 @@ import Button from '../../pb_button/_button'
5
5
  import Dialog from '../../pb_dialog/_dialog'
6
6
  import Flex from '../../pb_flex/_flex'
7
7
  import Caption from '../../pb_caption/_caption'
8
- import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
8
+ import Textarea from '../../pb_textarea/_textarea'
9
9
  import Typeahead from '../../pb_typeahead/_typeahead'
10
10
 
11
11
  const useDialog = (visible = false) => {
@@ -77,8 +77,11 @@ const DialogFullHeight = () => {
77
77
  <Body>{title}</Body>
78
78
  </Dialog.Header>
79
79
  <Dialog.Body>
80
- <Caption marginBottom="xs">{"Description"}</Caption>
81
- <RichTextEditor />
80
+ <Textarea
81
+ id="default-example-1"
82
+ label="Description"
83
+ rows={4}
84
+ />
82
85
  <br />
83
86
  <Caption>
84
87
  {
@@ -13,7 +13,7 @@
13
13
  <% end %>
14
14
  <%= pb_rails("dialog/dialog_body") do %>
15
15
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
16
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
16
+ <%= pb_rails("textarea", props: {id: "default-2"}) %>
17
17
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
18
18
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
19
19
  <% end %>
@@ -32,7 +32,7 @@
32
32
  <% end %>
33
33
  <%= pb_rails("dialog/dialog_body") do %>
34
34
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
35
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
35
+ <%= pb_rails("textarea", props: {id: "default-3"}) %>
36
36
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
37
37
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
38
38
  <% end %>
@@ -50,7 +50,7 @@
50
50
  <% end %>
51
51
  <%= pb_rails("dialog/dialog_body") do %>
52
52
  <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %>
53
- <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
53
+ <%= pb_rails("textarea", props: {id: "default-4"}) %>
54
54
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
55
55
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
56
56
  <% end %>