playbook_ui 14.10.0.pre.alpha.play16825206 → 14.10.0.pre.alpha.play16825244
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/pb_advanced_table/_advanced_table.scss +11 -16
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +143 -95
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +50 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
- data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
- data/dist/chunks/{_weekday_stacked-CEpLoHbM.js → _weekday_stacked-CNIlTH0K.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -3
@@ -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
|
-
|
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
|
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>
|
@@ -16,8 +16,10 @@ module Playbook
|
|
16
16
|
generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
|
17
17
|
end
|
18
18
|
|
19
|
-
def td_classname
|
20
|
-
|
19
|
+
def td_classname(column)
|
20
|
+
classes = %w[id-cell chrome-styles]
|
21
|
+
classes << "last-cell" if column[:is_last_in_group]
|
22
|
+
classes.join(" ")
|
21
23
|
end
|
22
24
|
|
23
25
|
def depth_accessors
|
@@ -29,6 +31,8 @@ module Playbook
|
|
29
31
|
private
|
30
32
|
|
31
33
|
def custom_renderer_value(column, index)
|
34
|
+
return nil unless column[:accessor].present?
|
35
|
+
|
32
36
|
if index.zero?
|
33
37
|
if depth.zero?
|
34
38
|
row[column[:accessor].to_sym]
|
@@ -37,6 +41,7 @@ module Playbook
|
|
37
41
|
key = item.to_sym
|
38
42
|
return row[key] if depth - 1 == accessor_index
|
39
43
|
end
|
44
|
+
nil
|
40
45
|
end
|
41
46
|
else
|
42
47
|
row[column[:accessor].to_sym]
|
@@ -1,10 +1,6 @@
|
|
1
|
-
<%=
|
2
|
-
aria: object.aria,
|
3
|
-
class: object.classname,
|
4
|
-
data: object.data,
|
5
|
-
id: object.id) do %>
|
1
|
+
<%= pb_content_tag(:div) do %>
|
6
2
|
<% object.column_definitions.each_with_index do |column, index| %>
|
7
|
-
<%= pb_rails("table/table_cell", props: {
|
3
|
+
<%= pb_rails("table/table_cell", props: { classname: object.td_classname}) 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| %>
|
@@ -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
|
-
|
34
|
-
|
35
|
-
|
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
|
}
|
@@ -20,7 +20,7 @@ type TimelineProps = {
|
|
20
20
|
id?: string,
|
21
21
|
orientation?: string,
|
22
22
|
showDate?: boolean,
|
23
|
-
|
23
|
+
item_gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
|
24
24
|
} & GlobalProps
|
25
25
|
|
26
26
|
const Timeline = ({
|
@@ -32,15 +32,15 @@ const Timeline = ({
|
|
32
32
|
id,
|
33
33
|
orientation = 'horizontal',
|
34
34
|
showDate = false,
|
35
|
-
|
35
|
+
item_gap = 'none',
|
36
36
|
...props
|
37
37
|
}: TimelineProps): React.ReactElement => {
|
38
38
|
const ariaProps = buildAriaProps(aria)
|
39
39
|
const dataProps = buildDataProps(data)
|
40
40
|
const htmlProps = buildHtmlProps(htmlOptions)
|
41
41
|
const dateStyle = showDate === true ? '_with_date' : ''
|
42
|
-
const
|
43
|
-
const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle,
|
42
|
+
const itemGapStyle = item_gap === 'none' ? '' : `gap_${item_gap}`
|
43
|
+
const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, itemGapStyle)
|
44
44
|
|
45
45
|
return (
|
46
46
|
<div
|
@@ -60,4 +60,4 @@ Timeline.Step = TimelineStep
|
|
60
60
|
Timeline.Label = TimelineLabel
|
61
61
|
Timeline.Detail = TimelineDetail
|
62
62
|
|
63
|
-
export default Timeline
|
63
|
+
export default Timeline
|
@@ -8,15 +8,15 @@ module Playbook
|
|
8
8
|
default: "horizontal"
|
9
9
|
prop :show_date, type: Playbook::Props::Boolean,
|
10
10
|
default: false
|
11
|
-
prop :
|
12
|
-
|
13
|
-
|
11
|
+
prop :item_gap, type: Playbook::Props::Enum,
|
12
|
+
values: %w[xs sm md lg none],
|
13
|
+
default: "none"
|
14
14
|
|
15
15
|
def classname
|
16
16
|
generate_classname("pb_timeline_kit",
|
17
17
|
orientation,
|
18
18
|
date_class,
|
19
|
-
|
19
|
+
item_gap_class)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -25,8 +25,8 @@ module Playbook
|
|
25
25
|
show_date ? "with_date" : nil
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def item_gap_class
|
29
|
+
item_gap == "none" ? nil : "gap_#{item_gap}"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|