playbook_ui 13.19.0.pre.alpha.PBNTR207tabledivsupport2261 → 13.19.0.pre.alpha.PBNTR211tablekitsubcomponentsreact2318

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -4
  4. data/app/pb_kits/playbook/pb_icon/_icon.tsx +28 -16
  5. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +5 -11
  6. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx +44 -18
  7. data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.md +4 -8
  8. data/app/pb_kits/playbook/pb_icon/icon.html.erb +6 -4
  9. data/app/pb_kits/playbook/pb_icon/icon.rb +27 -10
  10. data/app/pb_kits/playbook/pb_table/SubKits/_table_body.tsx +64 -0
  11. data/app/pb_kits/playbook/pb_table/SubKits/_table_cell.tsx +66 -0
  12. data/app/pb_kits/playbook/pb_table/SubKits/_table_head.tsx +64 -0
  13. data/app/pb_kits/playbook/pb_table/SubKits/_table_header.tsx +66 -0
  14. data/app/pb_kits/playbook/pb_table/SubKits/_table_row.tsx +74 -0
  15. data/app/pb_kits/playbook/pb_table/SubKits/index.tsx +5 -0
  16. data/app/pb_kits/playbook/pb_table/_table.tsx +13 -0
  17. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +24 -25
  18. data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.html.erb +34 -0
  19. data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.jsx +47 -0
  20. data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.html.erb +34 -0
  21. data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.jsx +48 -0
  22. data/app/pb_kits/playbook/pb_table/docs/example.yml +7 -2
  23. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  24. data/app/pb_kits/playbook/pb_table/styles/_striped.scss +2 -2
  25. data/app/pb_kits/playbook/pb_table/styles/_structure.scss +4 -2
  26. data/app/pb_kits/playbook/pb_table/table.test.js +142 -1
  27. data/app/pb_kits/playbook/pb_table/table_body.html.erb +17 -0
  28. data/app/pb_kits/playbook/pb_table/table_body.rb +15 -0
  29. data/app/pb_kits/playbook/pb_table/table_cell.html.erb +17 -0
  30. data/app/pb_kits/playbook/pb_table/table_cell.rb +17 -0
  31. data/app/pb_kits/playbook/pb_table/table_head.html.erb +17 -0
  32. data/app/pb_kits/playbook/pb_table/table_head.rb +15 -0
  33. data/app/pb_kits/playbook/pb_table/table_header.html.erb +49 -39
  34. data/app/pb_kits/playbook/pb_table/table_header.rb +8 -1
  35. data/app/pb_kits/playbook/pb_table/table_row.html.erb +17 -7
  36. data/app/pb_kits/playbook/pb_table/table_row.rb +8 -1
  37. data/dist/playbook-rails.js +6 -6
  38. data/lib/playbook/version.rb +1 -1
  39. metadata +18 -3
  40. data/app/pb_kits/playbook/pb_table/_table_row.tsx +0 -47
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbTable
5
+ class TableBody < Playbook::KitBase
6
+ prop :tag, type: Playbook::Props::Enum,
7
+ values: %w[table div],
8
+ default: "table"
9
+
10
+ def classname
11
+ generate_classname("pb_table_tbody")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ <% if object.tag == "table" %>
2
+ <%= content_tag(:td,
3
+ aria: object.aria,
4
+ class: object.classname,
5
+ data: object.data,
6
+ id: object.id) do %>
7
+ <%= content.presence || object.text %>
8
+ <% end %>
9
+ <% else %>
10
+ <%= content_tag(:div,
11
+ aria: object.aria,
12
+ class: object.classname,
13
+ data: object.data,
14
+ id: object.id) do %>
15
+ <%= content.presence || object.text %>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbTable
5
+ class TableCell < Playbook::KitBase
6
+ prop :tag, type: Playbook::Props::Enum,
7
+ values: %w[table div],
8
+ default: "table"
9
+ prop :text, type: Playbook::Props::String,
10
+ default: ""
11
+
12
+ def classname
13
+ generate_classname("pb_table_td")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ <% if object.tag == "table" %>
2
+ <%= content_tag(:thead,
3
+ aria: object.aria,
4
+ class: object.classname,
5
+ data: object.data,
6
+ id: object.id) do %>
7
+ <%= content.presence %>
8
+ <% end %>
9
+ <% else %>
10
+ <%= content_tag(:div,
11
+ aria: object.aria,
12
+ class: object.classname,
13
+ data: object.data,
14
+ id: object.id) do %>
15
+ <%= content.presence %>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbTable
5
+ class TableHead < Playbook::KitBase
6
+ prop :tag, type: Playbook::Props::Enum,
7
+ values: %w[table div],
8
+ default: "table"
9
+
10
+ def classname
11
+ generate_classname("pb_table_thead")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,47 +1,57 @@
1
- <%= content_tag(:th,
2
- colspan: object.colspan,
3
- aria: object.aria,
4
- class: object.classname,
5
- data: object.data,
6
- id: "pb-th#{object.id}" ) do %>
7
- <% unless sorting_style? %>
8
- <%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_nolink" }) do %>
9
- <%= content.presence || object.text %>
10
- <% end %>
11
- <% else %>
12
- <%= link_to next_link, style: link_style do %>
13
- <%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_link" }) do %>
1
+ <% if object.tag == "table" %>
2
+ <%= content_tag(:th,
3
+ colspan: object.colspan,
4
+ aria: object.aria,
5
+ class: object.classname,
6
+ data: object.data,
7
+ id: "pb-th#{object.id}" ) do %>
8
+ <% unless sorting_style? %>
9
+ <%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_nolink" }) do %>
14
10
  <%= content.presence || object.text %>
15
- <% if sorting_style? %>
16
- <%= pb_rails("icon", props: { icon: object.sort_icon(active_item[:direction], active_item[:active]),
17
- fixed_width: true,
18
- classname: active_item.any? ? "pb_th_active" : "",
19
- padding_left: "xs" }) %>
11
+ <% end %>
12
+ <% else %>
13
+ <%= link_to next_link, style: link_style do %>
14
+ <%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_link" }) do %>
15
+ <%= content.presence || object.text %>
16
+ <% if sorting_style? %>
17
+ <%= pb_rails("icon", props: { icon: object.sort_icon(active_item[:direction], active_item[:active]),
18
+ fixed_width: true,
19
+ classname: active_item.any? ? "pb_th_active" : "",
20
+ padding_left: "xs" }) %>
21
+ <% end %>
20
22
  <% end %>
21
23
  <% end %>
22
- <% end %>
23
- <% if use_dropdown_select %>
24
- <%= pb_rails("popover", props: { classname: "pb_filter_sort_menu",
25
- close_on_click: "outside",
26
- trigger_element_id: "pb-th#{object.id}",
27
- tooltip_id: "sort-filter-btn-tooltip#{object.id}",
28
- position: object.placement ,
29
- padding: 'none'}) do %>
30
- <%= pb_rails("nav", props: {classname: "pb_table_header_dropdown"}) do %>
31
- <% object.sort_items.each do |sort_item| %>
32
- <% item = active_or_first_item(sort_items_for(sort_item)) %>
33
- <%= pb_rails("nav/item", props: {
34
- text: item[:item],
35
- link: next_link(sort_item: sort_item),
36
- highlighted_border: false,
37
- padding: "xs",
38
- icon_right: sort_icon(item[:direction], item[:active]),
39
- active: item[:active],
40
- classname: "header_nav_item"
41
- }) %>
24
+ <% if use_dropdown_select %>
25
+ <%= pb_rails("popover", props: { classname: "pb_filter_sort_menu",
26
+ close_on_click: "outside",
27
+ trigger_element_id: "pb-th#{object.id}",
28
+ tooltip_id: "sort-filter-btn-tooltip#{object.id}",
29
+ position: object.placement ,
30
+ padding: 'none'}) do %>
31
+ <%= pb_rails("nav", props: {classname: "pb_table_header_dropdown"}) do %>
32
+ <% object.sort_items.each do |sort_item| %>
33
+ <% item = active_or_first_item(sort_items_for(sort_item)) %>
34
+ <%= pb_rails("nav/item", props: {
35
+ text: item[:item],
36
+ link: next_link(sort_item: sort_item),
37
+ highlighted_border: false,
38
+ padding: "xs",
39
+ icon_right: sort_icon(item[:direction], item[:active]),
40
+ active: item[:active],
41
+ classname: "header_nav_item"
42
+ }) %>
43
+ <% end %>
42
44
  <% end %>
43
45
  <% end %>
44
46
  <% end %>
45
47
  <% end %>
46
48
  <% end %>
47
- <% end %>
49
+ <% else %>
50
+ <%= content_tag(:div,
51
+ aria: object.aria,
52
+ class: object.classname,
53
+ data: object.data,
54
+ id: object.id) do %>
55
+ <%= content.presence || object.text %>
56
+ <% end %>
57
+ <% end %>
@@ -23,9 +23,16 @@ module Playbook
23
23
  default: ""
24
24
  prop :sort_dropdown, type: Playbook::Props::Boolean,
25
25
  default: false
26
+ prop :tag, type: Playbook::Props::Enum,
27
+ values: %w[table div],
28
+ default: "table"
26
29
 
27
30
  def classname
28
- generate_classname("pb_table_header_kit", align_class)
31
+ generate_classname("pb_table_header_kit", align_class) + tag_class
32
+ end
33
+
34
+ def tag_class
35
+ " pb_table_th"
29
36
  end
30
37
 
31
38
  def align_class
@@ -1,7 +1,17 @@
1
- <%= content_tag(:tr,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id) do %>
6
- <%= content.presence %>
7
- <% end %>
1
+ <% if object.tag == "table" %>
2
+ <%= content_tag(:tr,
3
+ aria: object.aria,
4
+ class: object.classname,
5
+ data: object.data,
6
+ id: object.id) do %>
7
+ <%= content.presence %>
8
+ <% end %>
9
+ <% else %>
10
+ <%= content_tag(:div,
11
+ aria: object.aria,
12
+ class: object.classname,
13
+ data: object.data,
14
+ id: object.id) do %>
15
+ <%= content.presence %>
16
+ <% end %>
17
+ <% end %>
@@ -5,14 +5,21 @@ module Playbook
5
5
  class TableRow < Playbook::KitBase
6
6
  prop :side_highlight_color, type: Playbook::Props::String,
7
7
  default: "none"
8
+ prop :tag, type: Playbook::Props::Enum,
9
+ values: %w[table div],
10
+ default: "table"
8
11
 
9
12
  def classname
10
- generate_classname("pb_table_row_kit", side_highlight_class)
13
+ generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
11
14
  end
12
15
 
13
16
  def side_highlight_class
14
17
  side_highlight_color.present? ? "side_highlight_#{side_highlight_color}" : nil
15
18
  end
19
+
20
+ def tag_class
21
+ " pb_table_tr"
22
+ end
16
23
  end
17
24
  end
18
25
  end