playbook_ui 14.10.0.pre.alpha.play16825206 → 14.10.0.pre.alpha.play16825301

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +11 -16
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/index.js +185 -92
  12. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +55 -8
  14. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
  15. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
  17. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +13 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
  19. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +6 -4
  20. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +11 -9
  21. data/app/pb_kits/playbook/pb_badge/_badge.scss +4 -2
  22. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +3 -1
  23. data/app/pb_kits/playbook/pb_button/_button.scss +3 -1
  24. data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
  25. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
  26. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
  27. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +4 -2
  28. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +3 -1
  29. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +5 -3
  30. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +6 -4
  31. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +4 -2
  32. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +10 -8
  33. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
  34. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
  35. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
  36. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
  37. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -4
  38. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +3 -1
  39. data/app/pb_kits/playbook/pb_label_value/_label_value.scss +4 -2
  40. data/app/pb_kits/playbook/pb_message/_message_mixins.scss +3 -1
  41. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +3 -1
  42. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +5 -3
  43. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +10 -8
  44. data/app/pb_kits/playbook/pb_pill/_pill.scss +4 -2
  45. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +4 -2
  46. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +4 -2
  47. data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
  48. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +5 -3
  49. data/app/pb_kits/playbook/pb_table/_table.tsx +8 -1
  50. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  51. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  52. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -1
  53. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +18 -0
  54. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +22 -1
  55. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +80 -0
  56. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +3 -1
  57. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +5 -4
  58. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +4 -2
  59. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
  60. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +4 -5
  61. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
  62. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
  63. data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
  64. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +5 -3
  65. data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
  66. data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
  67. data/dist/chunks/vendor.js +1 -1
  68. data/dist/playbook-doc.js +1 -1
  69. data/dist/playbook-rails-react-bindings.js +1 -1
  70. data/dist/playbook-rails.js +1 -1
  71. data/dist/playbook.css +1 -1
  72. data/lib/playbook/version.rb +1 -1
  73. metadata +6 -4
  74. data/dist/chunks/_typeahead-CbKUtXZa.js +0 -22
  75. data/dist/chunks/_weekday_stacked-CEpLoHbM.js +0 -45
@@ -17,19 +17,56 @@ module Playbook
17
17
  prop :collapsible_trail, type: Playbook::Props::Boolean,
18
18
  default: true
19
19
 
20
- def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
20
+ def flatten_columns(columns)
21
+ columns.flat_map do |col|
22
+ if col[:columns]
23
+ flatten_columns(col[:columns])
24
+ elsif col[:accessor].present?
25
+ if has_grouped_headers?
26
+ col.merge(is_last_in_group: last_in_group?(columns, col))
27
+ else
28
+ col
29
+ end
30
+ end
31
+ end.compact
32
+ end
33
+
34
+ def render_row_and_children(row, column_definitions, current_depth, first_parent_child, ancestor_ids = [], top_parent_id = nil, additional_classes: "", table_data_attributes: {})
35
+ top_parent_id ||= row.object_id
36
+ new_ancestor_ids = ancestor_ids + [row.object_id]
37
+ leaf_columns = flatten_columns(column_definitions)
38
+
21
39
  output = ActiveSupport::SafeBuffer.new
22
40
  is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
23
41
 
24
- output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
42
+ subrow_ancestor_ids = ancestor_ids + ["#{row.object_id}sr"]
43
+ subrow_data_attributes = {
44
+ advanced_table_content: subrow_ancestor_ids.join("-"),
45
+ row_depth: current_depth,
46
+ row_parent: "#{id}_#{ancestor_ids.last}",
47
+ }
48
+ # Subrow header if applicable
49
+ 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", subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
50
+
51
+ current_data_attributes = current_depth.zero? ? { row_depth: 0 } : table_data_attributes
25
52
 
26
- output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth, collapsible_trail: collapsible_trail })
53
+ # Additional class and data attributes needed for toggle logic
54
+ output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes })
27
55
 
28
56
  if row[:children].present?
29
- output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
30
- row[:children].map do |child_row|
31
- render_row_and_children(child_row, column_definitions, current_depth + 1, row.children.first == child_row)
32
- end.join.html_safe
57
+ row[:children].each do |child_row|
58
+ is_first_child = row[:children].first == child_row
59
+ immediate_parent_id = row.object_id
60
+ data_content = new_ancestor_ids.join("-") + "-#{child_row.object_id}"
61
+
62
+ child_data_attributes = {
63
+ top_parent: "#{id}_#{top_parent_id}",
64
+ row_depth: current_depth + 1,
65
+ row_parent: "#{id}_#{immediate_parent_id}",
66
+ advanced_table_content: data_content,
67
+ }
68
+
69
+ 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)
33
70
  end
34
71
  end
35
72
 
@@ -37,7 +74,17 @@ module Playbook
37
74
  end
38
75
 
39
76
  def classname
40
- generate_classname("pb_advanced_table_body", "pb_table_tbody", separator: " ")
77
+ generate_classname("pb_advanced_table_body", separator: " ")
78
+ end
79
+
80
+ private
81
+
82
+ def has_grouped_headers?
83
+ column_definitions.any? { |col| col.key?(:columns) }
84
+ end
85
+
86
+ def last_in_group?(columns, current_col)
87
+ columns.last[:accessor] == current_col[:accessor]
41
88
  end
42
89
  end
43
90
  end
@@ -1,18 +1,21 @@
1
- <%= pb_content_tag do %>
2
- <%= pb_rails("table/table_row", props: { tag: "div" }) do %>
3
- <% object.column_definitions.each_with_index do |item, index| %>
4
- <%= pb_rails("table/table_header", props: { tag: "div", id: item[:accessor], classname: object.th_classname, sort_menu: item[:sort_menu] }) do %>
5
- <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align: "end" }) do %>
6
- <% if index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") %>
7
- <button
8
- class="gray-icon toggle-all-icon"
9
- onclick="expandAllRows(this); event.preventDefault();">
10
- <%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
11
- </button>
12
- <% end %>
13
- <%= item[:label] %>
1
+ <%= pb_content_tag(:thead) do %>
2
+ <% object.header_rows.each_with_index do |header_row, row_index| %>
3
+ <%= pb_rails("table/table_row") do %>
4
+ <% header_row.each_with_index do |cell, cell_index| %>
5
+ <% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
6
+ <%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname, ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
7
+ <%= pb_rails("flex", props:{ align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
8
+ <% if cell_index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") && row_index === header_rows.size - 1 %>
9
+ <button
10
+ class="gray-icon toggle-all-icon"
11
+ onclick="expandAllRows(this); event.preventDefault();">
12
+ <%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
13
+ </button>
14
14
  <% end %>
15
+ <%= cell[:label] %>
15
16
  <% end %>
16
- <% end %>
17
17
  <% end %>
18
+ <% end %>
19
+ <% end %>
20
+ <% end %>
18
21
  <% end %>
@@ -16,6 +16,84 @@ module Playbook
16
16
  def th_classname
17
17
  generate_classname("table-header-cells", separator: " ")
18
18
  end
19
+
20
+ def header_rows
21
+ wrapped_columns = wrap_leaf_columns(column_definitions)
22
+
23
+ rows = []
24
+ max_depth = compute_max_depth(wrapped_columns)
25
+ max_depth.times { rows << [] }
26
+ process_columns(wrapped_columns, rows, 0, max_depth)
27
+ rows
28
+ end
29
+
30
+ private
31
+
32
+ def compute_max_depth(columns)
33
+ columns.map do |col|
34
+ col[:columns] ? 1 + compute_max_depth(col[:columns]) : 1
35
+ end.max || 1
36
+ end
37
+
38
+ def process_columns(columns, rows, current_depth, max_depth)
39
+ total_columns = columns.size
40
+ columns.each_with_index do |col, index|
41
+ is_last = index == total_columns - 1
42
+ if col[:columns]
43
+ colspan = compute_leaf_columns(col[:columns])
44
+ rows[current_depth] << {
45
+ label: col[:label],
46
+ colspan: colspan,
47
+ is_last_in_group: is_last && current_depth.positive?,
48
+ }
49
+
50
+ process_columns(col[:columns], rows, current_depth + 1, max_depth)
51
+ else
52
+ colspan = 1
53
+ rows[current_depth] << {
54
+ label: col[:label],
55
+ colspan: colspan,
56
+ accessor: col[:accessor],
57
+ sort_menu: col[:sort_menu],
58
+ is_last_in_group: is_last && current_depth.positive?,
59
+ }
60
+ end
61
+ end
62
+ end
63
+
64
+ def compute_leaf_columns(columns)
65
+ columns.reduce(0) do |sum, col|
66
+ col[:columns] ? sum + compute_leaf_columns(col[:columns]) : sum + 1
67
+ end
68
+ end
69
+
70
+ def wrap_leaf_columns(column_definitions)
71
+ max_depth = compute_max_depth(column_definitions)
72
+
73
+ column_definitions.map do |col|
74
+ if col.key?(:columns)
75
+ {
76
+ label: col[:label],
77
+ columns: wrap_leaf_columns(col[:columns]),
78
+ }
79
+ else
80
+ # For leaf columns, wrap with empty labels up to max depth to get proper structure
81
+ wrap_leaf_column(col, max_depth)
82
+ end
83
+ end
84
+ end
85
+
86
+ def wrap_leaf_column(col, max_depth)
87
+ wrapped = {
88
+ accessor: col[:accessor],
89
+ label: col[:label] || "",
90
+ sort_menu: col[:sort_menu] || nil,
91
+ }
92
+ (max_depth - 1).times do
93
+ wrapped = { label: "", columns: [wrapped] }
94
+ end
95
+ wrapped
96
+ end
19
97
  end
20
98
  end
21
99
  end
@@ -1,6 +1,7 @@
1
- <%= pb_content_tag do %>
1
+ <%= pb_content_tag(:tr) do %>
2
2
  <% object.column_definitions.each_with_index do |column, index| %>
3
- <%= pb_rails("table/table_cell", props: { tag:"div", classname:object.td_classname}) do %>
3
+ <% next unless column[:accessor].present? %>
4
+ <%= pb_rails("table/table_cell", props: { classname:object.td_classname(column)}) do %>
4
5
  <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
5
6
  <% if collapsible_trail && index.zero? %>
6
7
  <% (1..depth).each do |i| %>
@@ -13,7 +14,7 @@
13
14
  <div style="padding-left: <%= depth * 1.25 %>em">
14
15
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
15
16
  <% if index.zero? && object.row[:children].present? %>
16
- <button id="<%= object.row.object_id.to_s + object.id %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
17
+ <button id="<%= "#{object.id}_#{object.row.object_id}" %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
17
18
  <%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
18
19
  <%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
19
20
  </button>
@@ -11,13 +11,21 @@ module Playbook
11
11
  prop :depth
12
12
  prop :collapsible_trail, type: Playbook::Props::Boolean,
13
13
  default: true
14
+ prop :table_data_attributes, type: Playbook::Props::HashProp,
15
+ default: {}
16
+
17
+ def data
18
+ Hash(prop(:data)).merge(table_data_attributes)
19
+ end
14
20
 
15
21
  def classname
16
22
  generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
17
23
  end
18
24
 
19
- def td_classname
20
- generate_classname("id-cell", "chrome-styles", separator: " ")
25
+ def td_classname(column)
26
+ classes = %w[id-cell chrome-styles]
27
+ classes << "last-cell" if column[:is_last_in_group]
28
+ classes.join(" ")
21
29
  end
22
30
 
23
31
  def depth_accessors
@@ -29,6 +37,8 @@ module Playbook
29
37
  private
30
38
 
31
39
  def custom_renderer_value(column, index)
40
+ return nil unless column[:accessor].present?
41
+
32
42
  if index.zero?
33
43
  if depth.zero?
34
44
  row[column[:accessor].to_sym]
@@ -37,6 +47,7 @@ module Playbook
37
47
  key = item.to_sym
38
48
  return row[key] if depth - 1 == accessor_index
39
49
  end
50
+ nil
40
51
  end
41
52
  else
42
53
  row[column[:accessor].to_sym]
@@ -1,10 +1,6 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id) do %>
1
+ <%= pb_content_tag(:tr) do %>
6
2
  <% object.column_definitions.each_with_index do |column, index| %>
7
- <%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
3
+ <%= pb_rails("table/table_cell", props: { classname: "id-cell chrome-styles"}) do %>
8
4
  <%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
9
5
  <% if collapsible_trail && index.zero? %>
10
6
  <% (1..depth).each do |i| %>
@@ -14,13 +14,15 @@ module Playbook
14
14
  default: ""
15
15
  prop :collapsible_trail, type: Playbook::Props::Boolean,
16
16
  default: true
17
+ prop :subrow_data_attributes, type: Playbook::Props::HashProp,
18
+ default: {}
17
19
 
18
- def classname
19
- generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
20
+ def data
21
+ Hash(prop(:data)).merge(subrow_data_attributes)
20
22
  end
21
23
 
22
- def td_classname
23
- generate_classname("id-cell", "chrome-styles", separator: " ")
24
+ def classname
25
+ generate_classname("pb_table_tr", "bg-silver", "pb_subrow_header", subrow_depth_classname, separator: " ")
24
26
  end
25
27
 
26
28
  private
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  [class^=pb_avatar_action_button_kit] {
2
4
 
3
5
  $icon_size: 0px;
@@ -13,7 +15,7 @@
13
15
  color: $value;
14
16
  }
15
17
  }
16
-
18
+
17
19
  @mixin icon-base {
18
20
  &.dark{
19
21
  background-color: $bg_dark
@@ -31,22 +33,22 @@
31
33
  }
32
34
 
33
35
  @each $name, $size in $avatar-sizes {
34
-
36
+
35
37
  &[class*=_#{$name}] {
36
-
38
+
37
39
  $avatar_size: map-get($avatar-sizes, $name);
38
- $icon_size: $avatar_size / 2;
39
- $border_size: $icon_size / 10;
40
+ $icon_size: math.div($avatar_size, 2);
41
+ $border_size: math.div($icon_size, 10);
40
42
 
41
43
  position: relative;
42
44
  width: $avatar_size * 1.25;
43
45
  height: $avatar_size * 1.1;
44
46
  display: flex;
45
-
47
+
46
48
  [class^=pb_tooltip_kit] {
47
49
  justify-self: center;
48
50
  }
49
-
51
+
50
52
  &[class*=_bottom] .icon {
51
53
  @include icon-base;
52
54
  top: $icon_size * 1.27;
@@ -59,8 +61,8 @@
59
61
  left: $icon_size * 1.5;
60
62
  }
61
63
  &[class*=_left] [class^=pb_avatar_kit] {
62
- padding-left: $icon_size / 2;
64
+ padding-left: math.div($icon_size , 2);
63
65
  }
64
66
  }
65
67
  }
66
- }
68
+ }
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../tokens/border_radius";
2
4
  @import "../tokens/colors";
3
5
  @import "../tokens/opacity";
@@ -11,7 +13,7 @@
11
13
  align-items: center;
12
14
  justify-content: center;
13
15
  border-radius: $border_rad_light;
14
- padding: 0 $space_xs/2;
16
+ padding: 0 math.div($space_xs, 2);
15
17
  border-width: 1px;
16
18
  border-style: solid;
17
19
  border-color: $card_light;
@@ -34,7 +36,7 @@
34
36
  height: $pb_badge_height;
35
37
  min-height: $pb_badge_height;
36
38
  min-width: $pb_badge_height;
37
- border-radius: $pb_badge_height / 2;
39
+ border-radius: math.div($pb_badge_height, 2);
38
40
  }
39
41
 
40
42
  &[class*=_notification] {
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../tokens/colors";
2
4
  @import "../tokens/opacity";
3
5
  @import "../tokens/spacing";
@@ -9,7 +11,7 @@
9
11
  display: inline-flex;
10
12
  align-items: center;
11
13
  justify-content: center;
12
- padding: 0 $space_xs/2;
14
+ padding: 0 math.div($space_xs, 2);
13
15
 
14
16
  svg {
15
17
  margin-right: 8px;
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "./button_mixins";
2
4
  @import "../tokens/colors";
3
5
  @import "../tokens/border_radius";
@@ -17,7 +19,7 @@ $pb_button_sizes: (
17
19
  @each $name, $size in $pb_button_sizes {
18
20
  &[class*=size_#{$name}] {
19
21
  font-size: $size;
20
- padding: $size / 2 $size * 2.42;
22
+ padding: math.div($size, 2) $size * 2.42;
21
23
  @if $name == "sm" {
22
24
  min-height: 0;
23
25
  }
@@ -21,6 +21,14 @@
21
21
  border-width: 0px;
22
22
  }
23
23
 
24
+ @function ends-with($string, $suffix) {
25
+ $suffix-length: str-length($suffix);
26
+ @if $suffix-length == 0 {
27
+ @return true;
28
+ }
29
+ @return str-slice($string, -$suffix-length) == $suffix;
30
+ }
31
+
24
32
  [class^=pb_card_header_kit] {
25
33
  flex-grow: 0;
26
34
  flex-shrink: 0;
@@ -30,9 +38,19 @@
30
38
  border: 0;
31
39
  border-radius: $pb_card_header_border_radius $pb_card_header_border_radius 0px 0px;
32
40
  @each $color_name, $color_value in $pb_card_header_colors {
33
- &[class*=_#{"" + $color_name}] {
34
- @include pb_card_header_color($color_value);
35
- color: lightenText($color_value);
41
+ @if not ends-with($color_name, '_subtle') {
42
+ &[class*="_#{$color_name}"] {
43
+ @include pb_card_header_color($color_value);
44
+ color: lightenText($color_value);
45
+ }
46
+ }
47
+ }
48
+ @each $color_name, $color_value in $pb_card_header_colors {
49
+ @if ends-with($color_name, '_subtle') {
50
+ &[class*="_#{$color_name}"] {
51
+ @include pb_card_header_color($color_value);
52
+ color: lightenText($color_value);
53
+ }
36
54
  }
37
55
  }
38
56
  @each $color_name, $color_value in $pb_card_header_colors {
@@ -88,3 +88,21 @@
88
88
  Body
89
89
  <% end %>
90
90
  <% end %>
91
+
92
+ <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
93
+ <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "success_subtle" }) do %>
94
+ <%= pb_rails("body", props: { text: "Success Subtle" }) %>
95
+ <% end %>
96
+ <%= pb_rails("card/card_body", props: { padding: "md" }) do %>
97
+ Body
98
+ <% end %>
99
+ <% end %>
100
+
101
+ <%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
102
+ <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "error_subtle" }) do %>
103
+ <%= pb_rails("body", props: { text: "Error Subtle"}) %>
104
+ <% end %>
105
+ <%= pb_rails("card/card_body", props: { padding: "md" }) do %>
106
+ Body
107
+ <% end %>
108
+ <% end %>
@@ -231,6 +231,46 @@ const CardHeader = (props) => {
231
231
  />
232
232
  </Card.Body>
233
233
  </Card>
234
+
235
+ <Card
236
+ {...props}
237
+ marginBottom='sm'
238
+ padding="none"
239
+ >
240
+ <Card.Header
241
+ headerColor="success_subtle"
242
+ >
243
+ <Body
244
+ text="Success Subtle"
245
+ />
246
+ </Card.Header>
247
+ <Card.Body>
248
+ <Body
249
+ {...props}
250
+ text="Body"
251
+ />
252
+ </Card.Body>
253
+ </Card>
254
+
255
+ <Card
256
+ {...props}
257
+ marginBottom='sm'
258
+ padding="none"
259
+ >
260
+ <Card.Header
261
+ headerColor="error_subtle"
262
+ >
263
+ <Body
264
+ text="Error Subtle"
265
+ />
266
+ </Card.Header>
267
+ <Card.Body>
268
+ <Body
269
+ {...props}
270
+ text="Body"
271
+ />
272
+ </Card.Body>
273
+ </Card>
234
274
  </>
235
275
  )
236
276
  }
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../pb_button/button";
2
4
  @import "../pb_button/button_mixins";
3
5
 
@@ -16,7 +18,7 @@ $pb_button_styles: (
16
18
  flex-grow: 0;
17
19
  width: $pb_button_size;
18
20
  height: $pb_button_size;
19
- border-radius: $pb_button_size / 2;
21
+ border-radius: math.div($pb_button_size, 2);
20
22
  line-height: $pb_button_size;
21
23
  flex-basis: $pb_button_size;
22
24
  min-width: $pb_button_size;
@@ -53,4 +55,4 @@ $pb_button_styles: (
53
55
  }
54
56
  }
55
57
  }
56
- }
58
+ }
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../../pb_textarea/textarea_mixin";
2
4
 
3
5
  [class^=pb_date_picker_kit] {
@@ -41,7 +43,7 @@
41
43
  &.error {
42
44
  .date_picker_input_wrapper {
43
45
  [class*=pb_body_kit] {
44
- margin-top: $space_xs / 2;
46
+ margin-top: math.div($space_xs, 2);
45
47
  }
46
48
 
47
49
  input,
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @media (min-width: 500px) {
2
4
  .flatpickr-calendar {
3
5
  padding: $space_xs;
@@ -6,8 +8,8 @@
6
8
  width: 315.88px
7
9
  }
8
10
  .flatpickr-months {
9
- margin-left: $space_xs / 4;
10
- margin-top: $space_xs / 3;
11
+ margin-left: math.div($space_xs, 4);
12
+ margin-top: math.div($space_xs, 3);
11
13
  }
12
14
  }
13
15
  @media (max-width: 499px) {
@@ -19,7 +21,7 @@
19
21
  }
20
22
  }
21
23
  // Firefox Header Adjustments
22
- @supports (-moz-appearance:none) {
24
+ @supports (-moz-appearance:none) {
23
25
  select.flatpickr-monthDropdown-months {
24
26
  width: 97px !important;
25
27
  margin-left: $space_xs + 3;
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  [class^=pb_date_range_inline_kit] {
2
4
  &[class*=_center] {
3
5
  & > [class^=pb_caption],
@@ -21,14 +23,14 @@
21
23
  display: flex;
22
24
  align-items: center;
23
25
  [class*=pb_date_range_inline_arrow] {
24
- margin-left: $space_xs/2;
25
- margin-right: $space_xs/2;
26
+ margin-left: math.div($space_xs, 2);
27
+ margin-right: math.div($space_xs, 2);
26
28
  }
27
29
  [class*=pb_date_range_inline_timezone] {
28
- margin-left: $space_xs/2;
30
+ margin-left: math.div($space_xs, 2);
29
31
  }
30
32
  [class*=pb_date_range_inline_icon] {
31
- margin-right: $space_xs/2;
33
+ margin-right: math.div($space_xs, 2);
32
34
  }
33
35
  }
34
36
  }
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  [class^=pb_date_time_stacked] {
2
4
 
3
5
  [class^=padding_month] {
@@ -19,7 +21,7 @@
19
21
 
20
22
  }
21
23
  .date-time-padding {
22
- padding-right: $space_xs / 2;
23
- padding-left: $space_xs / 2;
24
+ padding-right: math.div($space_xs, 2);
25
+ padding-left: math.div($space_xs, 2);
24
26
  }
25
27