playbook_ui 15.6.0.pre.alpha.play261013050 → 15.6.0.pre.alpha.play263913015
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/Components/RegularTableView.tsx +2 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -95
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +5 -11
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -57
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +1 -2
- data/app/pb_kits/playbook/pb_timeline/label.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -51
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +1 -1
- data/lib/playbook/pb_kit_helper.rb +0 -35
- data/lib/playbook/version.rb +1 -1
- metadata +2 -12
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +0 -54
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +0 -9
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +0 -3
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +0 -60
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +0 -118
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +0 -1
- data/app/pb_kits/playbook/utilities/deprecated.ts +0 -73
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 526e2a456a333473009406a753d4a9513b99a33bef1a69e92410d94cdc23c3aa
|
|
4
|
+
data.tar.gz: 0b7ef7af65efedfcf5f2f1da554acd8e9d04ab95361feaf3425d5285171946b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1775155366eab8937dfac61095faa4a4281dfe3981a6839c97e7e35fb233716da18b8b1285d1a88ff8529c0a0560858c22808e0ba0df43102ff6cbdb02efc38e
|
|
7
|
+
data.tar.gz: 36ae7bbfcd1182ff97a85c018ecef7232877fabf931d30428fa8ac7b69890fd31e714f0bd9e644698665a644f5d14d2eaf8dcf2f88788050a6665fdec2aad9d4
|
|
@@ -63,11 +63,10 @@ const TableCellRenderer = ({
|
|
|
63
63
|
|
|
64
64
|
const { column } = cell;
|
|
65
65
|
|
|
66
|
-
// Find the
|
|
66
|
+
// Find the “owning” colDefinition by accessor. Needed for multi column logic
|
|
67
67
|
const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
|
|
68
68
|
const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
|
|
69
69
|
const cellFontColor = colDef?.columnStyling?.fontColor
|
|
70
|
-
const cellBackgroundColor = colDef?.columnStyling?.cellBackgroundColor
|
|
71
70
|
const paddingValue = colDef?.columnStyling?.cellPadding ?? customRowStyle?.cellPadding
|
|
72
71
|
const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
|
|
73
72
|
|
|
@@ -89,7 +88,7 @@ const TableCellRenderer = ({
|
|
|
89
88
|
? '180px'
|
|
90
89
|
: `${column.getStart("left")}px`
|
|
91
90
|
: undefined,
|
|
92
|
-
backgroundColor:
|
|
91
|
+
backgroundColor: i === 0 && customRowStyle?.backgroundColor,
|
|
93
92
|
color: cellFontColor || customRowStyle?.fontColor,
|
|
94
93
|
}}
|
|
95
94
|
>
|
|
@@ -90,8 +90,6 @@ export const TableHeaderCell = ({
|
|
|
90
90
|
: undefined
|
|
91
91
|
|
|
92
92
|
const headerAlignment = colDef?.columnStyling?.headerAlignment ?? colDef?.columnStyling?.headerAligment
|
|
93
|
-
const headerBackgroundColor = colDef?.columnStyling?.headerBackgroundColor
|
|
94
|
-
const headerFontColor = colDef?.columnStyling?.headerFontColor
|
|
95
93
|
|
|
96
94
|
const isLeafColumn =
|
|
97
95
|
header?.column.getLeafColumns().length === 1 &&
|
|
@@ -196,8 +194,6 @@ const isToggleExpansionEnabled =
|
|
|
196
194
|
id={cellId}
|
|
197
195
|
key={`${header?.id}-header`}
|
|
198
196
|
style={{
|
|
199
|
-
backgroundColor: headerBackgroundColor,
|
|
200
|
-
color: headerFontColor,
|
|
201
197
|
left: isPinnedLeft
|
|
202
198
|
? header?.index === 1 //Accounting for set min-width for first column
|
|
203
199
|
? '180px'
|
|
@@ -888,98 +888,3 @@ test("Sort icon renders with enableSort on individual columns", () => {
|
|
|
888
888
|
expect(sortButton).toBeInTheDocument();
|
|
889
889
|
});
|
|
890
890
|
|
|
891
|
-
test("columnStyling.backgroundColor works as excpected", () => {
|
|
892
|
-
const styledColumnDefs = [
|
|
893
|
-
{
|
|
894
|
-
accessor: "year",
|
|
895
|
-
label: "Year",
|
|
896
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
897
|
-
},
|
|
898
|
-
{
|
|
899
|
-
accessor: "newEnrollments",
|
|
900
|
-
label: "New Enrollments",
|
|
901
|
-
columnStyling: {
|
|
902
|
-
cellBackgroundColor: colors.error_subtle,
|
|
903
|
-
},
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
accessor: "scheduledMeetings",
|
|
907
|
-
label: "Scheduled Meetings",
|
|
908
|
-
},
|
|
909
|
-
];
|
|
910
|
-
|
|
911
|
-
render(
|
|
912
|
-
<AdvancedTable
|
|
913
|
-
columnDefinitions={styledColumnDefs}
|
|
914
|
-
data={{ testid: testId }}
|
|
915
|
-
tableData={MOCK_DATA}
|
|
916
|
-
/>
|
|
917
|
-
);
|
|
918
|
-
|
|
919
|
-
const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
|
|
920
|
-
expect(firstEnrollmentCell).toHaveStyle({ backgroundColor: colors.error_subtle });
|
|
921
|
-
});
|
|
922
|
-
|
|
923
|
-
test("columnStyling.headerBackgroundColor works as excpected", () => {
|
|
924
|
-
const styledColumnDefs = [
|
|
925
|
-
{
|
|
926
|
-
accessor: "year",
|
|
927
|
-
label: "Year",
|
|
928
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
929
|
-
},
|
|
930
|
-
{
|
|
931
|
-
accessor: "newEnrollments",
|
|
932
|
-
label: "New Enrollments",
|
|
933
|
-
columnStyling: {
|
|
934
|
-
headerBackgroundColor: colors.error_subtle,
|
|
935
|
-
},
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
accessor: "scheduledMeetings",
|
|
939
|
-
label: "Scheduled Meetings",
|
|
940
|
-
},
|
|
941
|
-
];
|
|
942
|
-
|
|
943
|
-
render(
|
|
944
|
-
<AdvancedTable
|
|
945
|
-
columnDefinitions={styledColumnDefs}
|
|
946
|
-
data={{ testid: testId }}
|
|
947
|
-
tableData={MOCK_DATA}
|
|
948
|
-
/>
|
|
949
|
-
);
|
|
950
|
-
|
|
951
|
-
const firstEnrollmentHeader = screen.getAllByText("New Enrollments")[0].closest("th");
|
|
952
|
-
expect(firstEnrollmentHeader).toHaveStyle({ backgroundColor: colors.error_subtle });
|
|
953
|
-
});
|
|
954
|
-
|
|
955
|
-
test("columnStyling.headerFontColor works as excpected", () => {
|
|
956
|
-
const styledColumnDefs = [
|
|
957
|
-
{
|
|
958
|
-
accessor: "year",
|
|
959
|
-
label: "Year",
|
|
960
|
-
cellAccessors: ["quarter", "month", "day"],
|
|
961
|
-
},
|
|
962
|
-
{
|
|
963
|
-
accessor: "newEnrollments",
|
|
964
|
-
label: "New Enrollments",
|
|
965
|
-
columnStyling: {
|
|
966
|
-
headerFontColor: colors.white,
|
|
967
|
-
},
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
accessor: "scheduledMeetings",
|
|
971
|
-
label: "Scheduled Meetings",
|
|
972
|
-
},
|
|
973
|
-
];
|
|
974
|
-
|
|
975
|
-
render(
|
|
976
|
-
<AdvancedTable
|
|
977
|
-
columnDefinitions={styledColumnDefs}
|
|
978
|
-
data={{ testid: testId }}
|
|
979
|
-
tableData={MOCK_DATA}
|
|
980
|
-
/>
|
|
981
|
-
);
|
|
982
|
-
|
|
983
|
-
const firstEnrollmentHeader = screen.getAllByText("New Enrollments")[0].closest("th");
|
|
984
|
-
expect(firstEnrollmentHeader).toHaveStyle({ color: colors.white });
|
|
985
|
-
});
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb
CHANGED
|
@@ -8,26 +8,16 @@
|
|
|
8
8
|
accessor: "newEnrollments",
|
|
9
9
|
label: "New Enrollments",
|
|
10
10
|
column_styling: {
|
|
11
|
-
cell_background_color: "
|
|
12
|
-
header_background_color: "error_subtle"
|
|
11
|
+
cell_background_color: ->(row) { row[:newEnrollments].to_i > 20 ? "success_secondary" : "warning_secondary" }
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
15
|
accessor: "scheduledMeetings",
|
|
17
16
|
label: "Scheduled Meetings",
|
|
18
|
-
column_styling: {
|
|
19
|
-
cell_background_color: "info_subtle",
|
|
20
|
-
}
|
|
21
17
|
},
|
|
22
18
|
{
|
|
23
19
|
accessor: "attendanceRate",
|
|
24
20
|
label: "Attendance Rate",
|
|
25
|
-
column_styling: {
|
|
26
|
-
cell_background_color: "info",
|
|
27
|
-
header_background_color: "info",
|
|
28
|
-
header_font_color: "white",
|
|
29
|
-
font_color: "white"
|
|
30
|
-
}
|
|
31
21
|
},
|
|
32
22
|
{
|
|
33
23
|
accessor: "completedClasses",
|
|
@@ -36,6 +26,10 @@
|
|
|
36
26
|
{
|
|
37
27
|
accessor: "classCompletionRate",
|
|
38
28
|
label: "Class Completion Rate",
|
|
29
|
+
column_styling: {
|
|
30
|
+
cell_background_color: "category_1",
|
|
31
|
+
font_color: "white"
|
|
32
|
+
}
|
|
39
33
|
},
|
|
40
34
|
{
|
|
41
35
|
accessor: "graduatedStudents",
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
`column_styling` can also be used to control the background color on all cells in a given column
|
|
2
|
-
|
|
3
|
-
1) `cell_background_color`: use this to control the background color of all cells in the given column
|
|
4
|
-
2) `font_color`: use this to control font color for all cells in the given column if needed, for example if using a darker background color
|
|
5
|
-
3) `header_background_color`: use this to control the background color of the column header
|
|
6
|
-
4) `header_font_color`: use this to control font color for the header in the given column if needed, for example if using a darker background color.
|
|
7
|
-
|
|
1
|
+
`column_styling` can also be used to control the background color on all cells in a given column via the use of the `cell_background_color` key/value pair. Use `cell_background_color` to achieve custom background colors for individual cells as seen here. Use `font_color` to achieve better contrast between cell content and background for darker backgrounds.
|
|
@@ -26,8 +26,7 @@ examples:
|
|
|
26
26
|
- advanced_table_column_styling_rails: Column Styling
|
|
27
27
|
- advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
|
|
28
28
|
- advanced_table_padding_control_rails: Padding Control using Column Styling
|
|
29
|
-
- advanced_table_background_control_rails: Column Styling
|
|
30
|
-
- advanced_table_background_colors_rails: Column Styling Individual Cell Background Color
|
|
29
|
+
- advanced_table_background_control_rails: Background Control using Column Styling
|
|
31
30
|
- advanced_table_column_border_color_rails: Column Group Border Color
|
|
32
31
|
|
|
33
32
|
|
|
@@ -76,8 +75,6 @@ examples:
|
|
|
76
75
|
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
|
77
76
|
- advanced_table_column_styling: Column Styling
|
|
78
77
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
79
|
-
- advanced_table_column_styling_background: Column Styling Background Color
|
|
80
|
-
- advanced_table_column_styling_background_multi: Column Styling Background Color with Multiple Headers
|
|
81
78
|
- advanced_table_padding_control: Padding Control using Column Styling
|
|
82
79
|
- advanced_table_column_border_color: Column Group Border Color
|
|
83
80
|
- advanced_table_fullscreen: Fullscreen
|
|
@@ -45,6 +45,4 @@ export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced
|
|
|
45
45
|
export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
|
|
46
46
|
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
|
47
47
|
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
|
48
|
-
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
|
49
|
-
export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
|
|
50
|
-
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
48
|
+
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<%= object.render_select_all_header %>
|
|
6
6
|
<% end %>
|
|
7
7
|
<% header_row.each_with_index do |cell, cell_index| %>
|
|
8
|
-
<%
|
|
9
|
-
<%= pb_rails(
|
|
8
|
+
<% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
|
|
9
|
+
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
|
10
10
|
<%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: (cell[:header_alignment] || "end") }) do %>
|
|
11
11
|
<% if cell_index.zero? && row_index === header_rows.size - 1 %>
|
|
12
12
|
<% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
|
@@ -119,59 +119,6 @@ module Playbook
|
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
# Get header background color from column styling
|
|
123
|
-
def header_background_color(cell)
|
|
124
|
-
original_def = find_original_column_def_for_cell(cell)
|
|
125
|
-
return nil unless original_def
|
|
126
|
-
|
|
127
|
-
original_def.dig(:column_styling, :header_background_color)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
# Get header font color from column styling
|
|
131
|
-
def header_font_color(cell)
|
|
132
|
-
original_def = find_original_column_def_for_cell(cell)
|
|
133
|
-
return nil unless original_def
|
|
134
|
-
|
|
135
|
-
original_def.dig(:column_styling, :header_font_color)
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# Check if header has custom background color
|
|
139
|
-
def has_custom_header_background_color?(cell)
|
|
140
|
-
cell[:header_background_color].present?
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
# Returns component info for header cell (uses background kit if custom bg color)
|
|
144
|
-
def header_component_info(cell, cell_index, row_index)
|
|
145
|
-
header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}"
|
|
146
|
-
classname = [th_classname(is_first_column: cell_index.zero?), ("last-header-cell" if cell[:is_last_in_group] && cell_index != 0)].compact.join(" ")
|
|
147
|
-
|
|
148
|
-
if has_custom_header_background_color?(cell)
|
|
149
|
-
component_name = "background"
|
|
150
|
-
component_props = {
|
|
151
|
-
background_color: cell[:header_background_color],
|
|
152
|
-
tag: "th",
|
|
153
|
-
classname: classname,
|
|
154
|
-
}
|
|
155
|
-
component_props[:html_options] = {
|
|
156
|
-
id: header_id,
|
|
157
|
-
colspan: cell[:colspan],
|
|
158
|
-
style: { color: cell[:header_font_color] },
|
|
159
|
-
}
|
|
160
|
-
component_props[:html_options][:style].delete(:color) unless cell[:header_font_color].present?
|
|
161
|
-
else
|
|
162
|
-
component_name = "table/table_header"
|
|
163
|
-
component_props = {
|
|
164
|
-
id: header_id,
|
|
165
|
-
colspan: cell[:colspan],
|
|
166
|
-
classname: classname,
|
|
167
|
-
sort_menu: cell[:accessor] ? cell[:sort_menu] : nil,
|
|
168
|
-
}
|
|
169
|
-
component_props[:html_options] = { style: { color: cell[:header_font_color] } } if cell[:header_font_color].present?
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
{ name: component_name, props: component_props }
|
|
173
|
-
end
|
|
174
|
-
|
|
175
122
|
private
|
|
176
123
|
|
|
177
124
|
# Find the original column definition for a cell
|
|
@@ -216,8 +163,6 @@ module Playbook
|
|
|
216
163
|
else
|
|
217
164
|
raw_styling = col[:column_styling] || {}
|
|
218
165
|
header_alignment = raw_styling[:header_alignment]
|
|
219
|
-
header_background_color = raw_styling[:header_background_color]
|
|
220
|
-
header_font_color = raw_styling[:header_font_color]
|
|
221
166
|
|
|
222
167
|
colspan = 1
|
|
223
168
|
cell_hash = {
|
|
@@ -227,8 +172,6 @@ module Playbook
|
|
|
227
172
|
sort_menu: col[:sort_menu],
|
|
228
173
|
is_last_in_group: is_last && current_depth.positive?,
|
|
229
174
|
header_alignment: header_alignment,
|
|
230
|
-
header_background_color: header_background_color,
|
|
231
|
-
header_font_color: header_font_color,
|
|
232
175
|
}
|
|
233
176
|
cell_hash[:id] = col[:id] if col[:id].present?
|
|
234
177
|
rows[current_depth] << cell_hash
|
|
@@ -18,7 +18,6 @@ type ItemProps = {
|
|
|
18
18
|
icon?: string,
|
|
19
19
|
iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
|
|
20
20
|
lineStyle?: 'solid' | 'dotted',
|
|
21
|
-
showCurrentYear?: boolean,
|
|
22
21
|
} & GlobalProps
|
|
23
22
|
|
|
24
23
|
function isElementOfType<P>(
|
|
@@ -36,7 +35,6 @@ const TimelineItem = ({
|
|
|
36
35
|
icon = 'user',
|
|
37
36
|
iconColor = 'default',
|
|
38
37
|
lineStyle = 'solid',
|
|
39
|
-
showCurrentYear = false,
|
|
40
38
|
...props
|
|
41
39
|
}: ItemProps): React.ReactElement => {
|
|
42
40
|
const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
|
|
@@ -75,7 +73,6 @@ const TimelineItem = ({
|
|
|
75
73
|
<DateStacked
|
|
76
74
|
align="center"
|
|
77
75
|
date={date}
|
|
78
|
-
showCurrentYear={showCurrentYear}
|
|
79
76
|
size="sm"
|
|
80
77
|
/>
|
|
81
78
|
)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Use the optional `showDate` prop to render the timeline kit with a visible date.
|
|
1
|
+
Use the optional `showDate` prop to render the timeline kit with a visible date. If the date is from the current year, the year will not be displayed, however if date is NOT from the current year, the kit will display the year as well.
|
|
@@ -5,7 +5,6 @@ examples:
|
|
|
5
5
|
- timeline_vertical: Vertical
|
|
6
6
|
- timeline_with_date: With Date
|
|
7
7
|
- timeline_with_children: With Children
|
|
8
|
-
- timeline_show_current_year: Show Current Year
|
|
9
8
|
- timeline_with_gap: With Gap
|
|
10
9
|
|
|
11
10
|
|
|
@@ -14,5 +13,4 @@ examples:
|
|
|
14
13
|
- timeline_vertical: Vertical
|
|
15
14
|
- timeline_with_date: With Date
|
|
16
15
|
- timeline_with_children: With Children
|
|
17
|
-
- timeline_show_current_year: Show Current Year
|
|
18
16
|
- timeline_with_gap: With Gap
|
|
@@ -3,5 +3,4 @@ export { default as TimelineVertical } from './_timeline_vertical.jsx'
|
|
|
3
3
|
export { default as TimelineWithDate } from './_timeline_with_date.jsx'
|
|
4
4
|
export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
|
|
5
5
|
export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
|
|
6
|
-
export { default as TimelineShowCurrentYear } from './_timeline_show_current_year.jsx'
|
|
7
6
|
|
|
@@ -9,7 +9,6 @@ type TimelineLabelProps = {
|
|
|
9
9
|
children?: React.ReactNode,
|
|
10
10
|
className?: string,
|
|
11
11
|
htmlOptions?: { [key: string]: any },
|
|
12
|
-
showCurrentYear?: boolean,
|
|
13
12
|
} & GlobalProps
|
|
14
13
|
|
|
15
14
|
const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
@@ -17,7 +16,6 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
17
16
|
children,
|
|
18
17
|
className,
|
|
19
18
|
htmlOptions = {},
|
|
20
|
-
showCurrentYear = false,
|
|
21
19
|
...props
|
|
22
20
|
}) => {
|
|
23
21
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
@@ -30,7 +28,6 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
|
|
|
30
28
|
{date && (
|
|
31
29
|
<DateStacked align="center"
|
|
32
30
|
date={date}
|
|
33
|
-
showCurrentYear={showCurrentYear}
|
|
34
31
|
size="sm"
|
|
35
32
|
/>
|
|
36
33
|
)}
|
|
@@ -170,54 +170,3 @@ test('should pass showDate prop with Children', () => {
|
|
|
170
170
|
const kit = screen.getByTestId(testId)
|
|
171
171
|
expect(kit).toHaveClass('pb_timeline_kit_horizontal_with_date')
|
|
172
172
|
})
|
|
173
|
-
|
|
174
|
-
test('should pass showCurrentYear prop to items with date', () => {
|
|
175
|
-
const currentYear = new Date().getFullYear().toString()
|
|
176
|
-
render(
|
|
177
|
-
<Timeline
|
|
178
|
-
data={{ testid: testId }}
|
|
179
|
-
showDate
|
|
180
|
-
>
|
|
181
|
-
<Timeline.Item
|
|
182
|
-
date={new Date()}
|
|
183
|
-
icon="user"
|
|
184
|
-
iconColor="royal"
|
|
185
|
-
showCurrentYear
|
|
186
|
-
>
|
|
187
|
-
<TitleDetail
|
|
188
|
-
detail="37-27 74th Street"
|
|
189
|
-
title="Jackson Heights"
|
|
190
|
-
/>
|
|
191
|
-
</Timeline.Item>
|
|
192
|
-
</Timeline>
|
|
193
|
-
)
|
|
194
|
-
const kit = screen.getByTestId(testId)
|
|
195
|
-
expect(kit).toBeInTheDocument()
|
|
196
|
-
const yearCaption = kit.querySelector('.pb_caption_kit_xs')
|
|
197
|
-
expect(yearCaption).toBeInTheDocument()
|
|
198
|
-
expect(yearCaption.textContent).toEqual(currentYear)
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
test('should not show current year by default', () => {
|
|
202
|
-
const currentYear = new Date().getFullYear().toString()
|
|
203
|
-
render(
|
|
204
|
-
<Timeline
|
|
205
|
-
data={{ testid: testId }}
|
|
206
|
-
showDate
|
|
207
|
-
>
|
|
208
|
-
<Timeline.Item
|
|
209
|
-
date={new Date()}
|
|
210
|
-
icon="user"
|
|
211
|
-
iconColor="royal"
|
|
212
|
-
>
|
|
213
|
-
<TitleDetail
|
|
214
|
-
detail="37-27 74th Street"
|
|
215
|
-
title="Jackson Heights"
|
|
216
|
-
/>
|
|
217
|
-
</Timeline.Item>
|
|
218
|
-
</Timeline>
|
|
219
|
-
)
|
|
220
|
-
const kit = screen.getByTestId(testId)
|
|
221
|
-
expect(kit).toBeInTheDocument()
|
|
222
|
-
expect(kit).not.toHaveTextContent(currentYear)
|
|
223
|
-
})
|