playbook_ui 13.19.0.pre.alpha.PBNTR211tablekitsubcomponentsreact2318 → 13.19.0.pre.alpha.play1141iconkitusinglibrary2264
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +67 -99
- data/app/pb_kits/playbook/pb_table/_table_row.tsx +47 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +25 -24
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_table/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_table/styles/_content.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_hover.scss +11 -11
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_reset.scss +3 -3
- data/app/pb_kits/playbook/pb_table/styles/_side_highlight.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_single-line.scss +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +4 -4
- data/app/pb_kits/playbook/pb_table/styles/_structure.scss +8 -22
- data/app/pb_kits/playbook/pb_table/styles/_table-card.scss +7 -7
- data/app/pb_kits/playbook/pb_table/styles/_table-dark.scss +14 -14
- data/app/pb_kits/playbook/pb_table/styles/_table_header.scss +2 -2
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +15 -15
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +4 -3
- data/app/pb_kits/playbook/pb_table/table.html.erb +2 -12
- data/app/pb_kits/playbook/pb_table/table.rb +0 -3
- data/app/pb_kits/playbook/pb_table/table.test.js +1 -142
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +39 -49
- data/app/pb_kits/playbook/pb_table/table_header.rb +1 -8
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +7 -17
- data/app/pb_kits/playbook/pb_table/table_row.rb +1 -8
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +1 -1
- metadata +3 -20
- data/app/pb_kits/playbook/pb_table/SubKits/_table_body.tsx +0 -64
- data/app/pb_kits/playbook/pb_table/SubKits/_table_cell.tsx +0 -66
- data/app/pb_kits/playbook/pb_table/SubKits/_table_head.tsx +0 -64
- data/app/pb_kits/playbook/pb_table/SubKits/_table_header.tsx +0 -66
- data/app/pb_kits/playbook/pb_table/SubKits/_table_row.tsx +0 -74
- data/app/pb_kits/playbook/pb_table/SubKits/index.tsx +0 -5
- data/app/pb_kits/playbook/pb_table/docs/_table_div.html.erb +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_div.jsx +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.html.erb +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.jsx +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.html.erb +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.jsx +0 -48
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +0 -17
- data/app/pb_kits/playbook/pb_table/table_body.rb +0 -15
- data/app/pb_kits/playbook/pb_table/table_cell.html.erb +0 -17
- data/app/pb_kits/playbook/pb_table/table_cell.rb +0 -17
- data/app/pb_kits/playbook/pb_table/table_head.html.erb +0 -17
- data/app/pb_kits/playbook/pb_table/table_head.rb +0 -15
@@ -1,58 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import { ensureAccessible, renderKit, render, screen } from "../utilities/test-utils"
|
1
|
+
import { ensureAccessible, renderKit } from "../utilities/test-utils"
|
3
2
|
|
4
3
|
import Table from "./_table"
|
5
4
|
|
6
|
-
const DivsTable = () => {
|
7
|
-
return (
|
8
|
-
<>
|
9
|
-
<Table
|
10
|
-
data={{testid: "table"}}
|
11
|
-
size="sm"
|
12
|
-
tag="div"
|
13
|
-
>
|
14
|
-
<Table.Head tag="div">
|
15
|
-
<Table.Row tag="div">
|
16
|
-
<Table.Header tag="div">{"Column 1"}</Table.Header>
|
17
|
-
<Table.Header tag="div">{"Column 2"}</Table.Header>
|
18
|
-
</Table.Row>
|
19
|
-
</Table.Head>
|
20
|
-
<Table.Body tag="div">
|
21
|
-
<Table.Row tag="div">
|
22
|
-
<Table.Cell tag="div">{"Value 1"}</Table.Cell>
|
23
|
-
<Table.Cell tag="div">{"Value 2"}</Table.Cell>
|
24
|
-
</Table.Row>
|
25
|
-
</Table.Body>
|
26
|
-
</Table>
|
27
|
-
</>
|
28
|
-
);
|
29
|
-
};
|
30
|
-
|
31
|
-
const TableTagTable = () => {
|
32
|
-
return (
|
33
|
-
<>
|
34
|
-
<Table
|
35
|
-
data={{testid: "table"}}
|
36
|
-
size="sm"
|
37
|
-
>
|
38
|
-
<Table.Head>
|
39
|
-
<Table.Row>
|
40
|
-
<Table.Header>{"Column 1"}</Table.Header>
|
41
|
-
<Table.Header>{"Column 2"}</Table.Header>
|
42
|
-
</Table.Row>
|
43
|
-
</Table.Head>
|
44
|
-
<Table.Body>
|
45
|
-
<Table.Row>
|
46
|
-
<Table.Cell>{"Value 1"}</Table.Cell>
|
47
|
-
<Table.Cell>{"Value 2"}</Table.Cell>
|
48
|
-
</Table.Row>
|
49
|
-
</Table.Body>
|
50
|
-
</Table>
|
51
|
-
</>
|
52
|
-
);
|
53
|
-
};
|
54
|
-
|
55
|
-
|
56
5
|
const props = {
|
57
6
|
data: { testid: "table" },
|
58
7
|
sticky: false
|
@@ -71,93 +20,3 @@ test("when striped is true", () => {
|
|
71
20
|
const kit = renderKit(Table, props, { striped: true })
|
72
21
|
expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card striped table-collapse-sm")
|
73
22
|
})
|
74
|
-
|
75
|
-
test("Renders Table.Head subkit for Div Table", () => {
|
76
|
-
render (<DivsTable/>)
|
77
|
-
|
78
|
-
const kit = screen.getByTestId("table")
|
79
|
-
const head = kit.querySelector(".pb_table_thead")
|
80
|
-
expect(head).toBeInTheDocument()
|
81
|
-
expect(head.tagName).toBe("DIV")
|
82
|
-
})
|
83
|
-
|
84
|
-
test("Renders Table.Header subkit for Div Table", () => {
|
85
|
-
render (<DivsTable/>)
|
86
|
-
|
87
|
-
const kit = screen.getByTestId("table")
|
88
|
-
const head = kit.querySelector(".pb_table_th")
|
89
|
-
expect(head).toBeInTheDocument()
|
90
|
-
expect(head.tagName).toBe("DIV")
|
91
|
-
})
|
92
|
-
|
93
|
-
test("Renders Table.Body subkit for Div Table", () => {
|
94
|
-
render (<DivsTable/>)
|
95
|
-
|
96
|
-
const kit = screen.getByTestId("table")
|
97
|
-
const head = kit.querySelector(".pb_table_tbody")
|
98
|
-
expect(head).toBeInTheDocument()
|
99
|
-
expect(head.tagName).toBe("DIV")
|
100
|
-
})
|
101
|
-
|
102
|
-
test("Renders Table.Row subkit for Div Table", () => {
|
103
|
-
render (<DivsTable/>)
|
104
|
-
|
105
|
-
const kit = screen.getByTestId("table")
|
106
|
-
const head = kit.querySelector(".pb_table_tr")
|
107
|
-
expect(head).toBeInTheDocument()
|
108
|
-
expect(head.tagName).toBe("DIV")
|
109
|
-
})
|
110
|
-
|
111
|
-
test("Renders Table.Cell subkit for Div Table", () => {
|
112
|
-
render (<DivsTable/>)
|
113
|
-
|
114
|
-
const kit = screen.getByTestId("table")
|
115
|
-
const head = kit.querySelector(".pb_table_td")
|
116
|
-
expect(head).toBeInTheDocument()
|
117
|
-
expect(head.tagName).toBe("DIV")
|
118
|
-
})
|
119
|
-
|
120
|
-
test("Renders Table.Head subkit for HTML Table elements Table", () => {
|
121
|
-
render (<TableTagTable/>)
|
122
|
-
|
123
|
-
const kit = screen.getByTestId("table")
|
124
|
-
const head = kit.querySelector(".pb_table_thead")
|
125
|
-
expect(head).toBeInTheDocument()
|
126
|
-
expect(head.tagName).toBe("THEAD")
|
127
|
-
})
|
128
|
-
|
129
|
-
test("Renders Table.Header subkit for HTML Table elements Table", () => {
|
130
|
-
render (<TableTagTable/>)
|
131
|
-
|
132
|
-
const kit = screen.getByTestId("table")
|
133
|
-
const head = kit.querySelector(".pb_table_th")
|
134
|
-
expect(head).toBeInTheDocument()
|
135
|
-
expect(head.tagName).toBe("TH")
|
136
|
-
})
|
137
|
-
|
138
|
-
test("Renders Table.Body subkit for HTML Table elements Table", () => {
|
139
|
-
render (<TableTagTable/>)
|
140
|
-
|
141
|
-
const kit = screen.getByTestId("table")
|
142
|
-
const head = kit.querySelector(".pb_table_tbody")
|
143
|
-
expect(head).toBeInTheDocument()
|
144
|
-
expect(head.tagName).toBe("TBODY")
|
145
|
-
})
|
146
|
-
|
147
|
-
test("Renders Table.Row subkit for HTML Table elements Table", () => {
|
148
|
-
render (<TableTagTable/>)
|
149
|
-
|
150
|
-
const kit = screen.getByTestId("table")
|
151
|
-
const head = kit.querySelector(".pb_table_tr")
|
152
|
-
expect(head).toBeInTheDocument()
|
153
|
-
expect(head.tagName).toBe("TR")
|
154
|
-
})
|
155
|
-
|
156
|
-
test("Renders Table.Cell subkit for HTML Table elements Table", () => {
|
157
|
-
render (<TableTagTable/>)
|
158
|
-
|
159
|
-
const kit = screen.getByTestId("table")
|
160
|
-
const head = kit.querySelector(".pb_table_td")
|
161
|
-
expect(head).toBeInTheDocument()
|
162
|
-
expect(head.tagName).toBe("TD")
|
163
|
-
})
|
@@ -1,57 +1,47 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<%=
|
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 %>
|
10
14
|
<%= content.presence || object.text %>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 %>
|
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" }) %>
|
22
20
|
<% end %>
|
23
21
|
<% end %>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
+
}) %>
|
44
42
|
<% end %>
|
45
43
|
<% end %>
|
46
44
|
<% end %>
|
47
45
|
<% end %>
|
48
46
|
<% end %>
|
49
|
-
<%
|
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 %>
|
47
|
+
<% end %>
|
@@ -23,16 +23,9 @@ 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"
|
29
26
|
|
30
27
|
def classname
|
31
|
-
generate_classname("pb_table_header_kit", align_class)
|
32
|
-
end
|
33
|
-
|
34
|
-
def tag_class
|
35
|
-
" pb_table_th"
|
28
|
+
generate_classname("pb_table_header_kit", align_class)
|
36
29
|
end
|
37
30
|
|
38
31
|
def align_class
|
@@ -1,17 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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 %>
|
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 %>
|
@@ -5,21 +5,14 @@ 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"
|
11
8
|
|
12
9
|
def classname
|
13
|
-
generate_classname("pb_table_row_kit", side_highlight_class)
|
10
|
+
generate_classname("pb_table_row_kit", side_highlight_class)
|
14
11
|
end
|
15
12
|
|
16
13
|
def side_highlight_class
|
17
14
|
side_highlight_color.present? ? "side_highlight_#{side_highlight_color}" : nil
|
18
15
|
end
|
19
|
-
|
20
|
-
def tag_class
|
21
|
-
" pb_table_tr"
|
22
|
-
end
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|