playbook_ui 15.7.0.pre.alpha.play263313229 → 15.7.0.pre.rc.0
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/_playbook.scss +1 -1
- 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_bar_graph/_bar_graph.tsx +0 -6
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +0 -6
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +24 -51
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +19 -53
- data/app/pb_kits/playbook/pb_contact/contact.rb +1 -11
- data/app/pb_kits/playbook/pb_contact/contact.test.js +0 -76
- data/app/pb_kits/playbook/pb_contact/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_contact/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +4 -16
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +14 -23
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -2
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -14
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +4 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +5 -7
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -4
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +5 -39
- data/app/pb_kits/playbook/pb_dropdown/index.js +3 -171
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -2
- data/app/pb_kits/playbook/pb_form/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +0 -6
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +0 -6
- data/app/pb_kits/playbook/pb_table/_table.tsx +33 -187
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_table/table.html.erb +12 -68
- data/app/pb_kits/playbook/pb_table/table.rb +3 -22
- data/app/pb_kits/playbook/pb_table/table.test.js +0 -143
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -15
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +0 -6
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +0 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +0 -16
- 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/app/pb_kits/playbook/utilities/globalProps.ts +0 -1
- data/dist/chunks/_typeahead-CYNrKU10.js +6 -0
- data/dist/chunks/{lib-DxDBrGZX.js → lib-DDDLiZuu.js} +3 -3
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +9 -16
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/form_field_builder.rb +2 -13
- data/lib/playbook/forms/builder.rb +0 -1
- data/lib/playbook/pb_doc_helper.rb +0 -3
- data/lib/playbook/pb_kit_helper.rb +0 -35
- data/lib/playbook/version.rb +2 -2
- metadata +4 -82
- 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_contact/docs/_contact_unstyled.html.erb +0 -33
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +0 -46
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +0 -2
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +0 -24
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +0 -60
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +0 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +0 -12
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +0 -26
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +0 -30
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +0 -29
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +0 -13
- data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +0 -75
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +0 -14
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +0 -134
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +0 -101
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +0 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +0 -180
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +0 -122
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +0 -3
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.html.erb +0 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.jsx +0 -25
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.scss +0 -296
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +0 -822
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.html.erb +0 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.jsx +0 -16
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_24_hour.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.jsx +0 -13
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.html.erb +0 -4
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.jsx +0 -29
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_default_time.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_disabled.html.erb +0 -13
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_disabled.jsx +0 -23
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_error.html.erb +0 -5
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_error.jsx +0 -15
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_input_options.html.erb +0 -14
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_label.html.erb +0 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_label.jsx +0 -15
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.html.erb +0 -42
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.jsx +0 -52
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_min_max_time.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +0 -45
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.html.erb +0 -3
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.jsx +0 -21
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_timezone.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +0 -24
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +0 -9
- data/app/pb_kits/playbook/pb_time_picker/index.ts +0 -40
- data/app/pb_kits/playbook/pb_time_picker/time_picker.html.erb +0 -1
- data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +0 -80
- data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +0 -114
- data/app/pb_kits/playbook/pb_time_picker/time_picker_helper.ts +0 -662
- 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
- data/dist/chunks/_typeahead-Ckz1ce-2.js +0 -6
- data/lib/playbook/forms/builder/time_picker_field.rb +0 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcd203ca2c6c310aa95e818199272a8730eba2c3cdc237405bf8b4426678be78
|
|
4
|
+
data.tar.gz: fb7eae7c6e74ceec237f663fd4c3f7706effff2009b79edbc9d6372319aa2b64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bda1d76401b97c07eeeccb14e887f02b08a8e69ab256021756e7b4ad6488797d8a3523eaad710782b1c29b8727a5017f1926cbdd7b800a791dca57ba9273ea7
|
|
7
|
+
data.tar.gz: 12dfb9cd054c39b94936fdd71de6d2a92e9c920121fbf4f8a9bdc39d871ef19e7608063ac306c67577776c3edaab974d78c66ace6af6076b577f6bec97d531ac
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
@import 'pb_advanced_table/advanced_table';
|
|
2
3
|
@import 'pb_avatar/avatar';
|
|
3
4
|
@import 'pb_background/background';
|
|
@@ -97,7 +98,6 @@
|
|
|
97
98
|
@import 'pb_text_input/text_input';
|
|
98
99
|
@import 'pb_textarea/textarea';
|
|
99
100
|
@import 'pb_time/time';
|
|
100
|
-
@import 'pb_time_picker/time_picker';
|
|
101
101
|
@import 'pb_time_range_inline/time_range_inline';
|
|
102
102
|
@import 'pb_time_stacked/time_stacked';
|
|
103
103
|
@import 'pb_timeline/timeline';
|
|
@@ -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
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { globalProps } from "../utilities/globalProps";
|
|
3
3
|
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
|
4
|
-
import { deprecatedKitWarning } from "../utilities/deprecated";
|
|
5
4
|
|
|
6
5
|
import HighchartsReact from "highcharts-react-official";
|
|
7
6
|
import Highcharts from "highcharts";
|
|
@@ -173,11 +172,6 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
|
173
172
|
setOptions(merge(staticOptions, customOptions));
|
|
174
173
|
}, [chartData]);
|
|
175
174
|
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
// Warn about deprecated kit
|
|
178
|
-
deprecatedKitWarning('BarGraph', 'Please use "PbBarGraph" instead.');
|
|
179
|
-
}, []);
|
|
180
|
-
|
|
181
175
|
return (
|
|
182
176
|
<HighchartsReact
|
|
183
177
|
containerProps={{
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import HighchartsReact from "highcharts-react-official";
|
|
4
4
|
import highchartsMore from "highcharts/highcharts-more";
|
|
5
|
-
import { deprecatedKitWarning } from "../utilities/deprecated";
|
|
6
5
|
|
|
7
6
|
import Highcharts from "highcharts";
|
|
8
7
|
|
|
@@ -185,11 +184,6 @@ const CircleChart = ({
|
|
|
185
184
|
setOptions(merge(staticOptions, customOptions));
|
|
186
185
|
}, [chartData]);
|
|
187
186
|
|
|
188
|
-
useEffect(() => {
|
|
189
|
-
// Warn about deprecated kit
|
|
190
|
-
deprecatedKitWarning('CircleChart', 'Please use "PbCircleChart" instead.');
|
|
191
|
-
}, []);
|
|
192
|
-
|
|
193
187
|
|
|
194
188
|
return (
|
|
195
189
|
<>
|
|
@@ -61,9 +61,7 @@ type ContactProps = {
|
|
|
61
61
|
data?: { [key: string]: string }
|
|
62
62
|
dark?: boolean
|
|
63
63
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) }
|
|
64
|
-
iconEnabled?: boolean
|
|
65
64
|
id?: string
|
|
66
|
-
unstyled?: boolean
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
const Contact = (props: ContactProps): React.ReactElement => {
|
|
@@ -76,9 +74,7 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
76
74
|
data = {},
|
|
77
75
|
dark = false,
|
|
78
76
|
htmlOptions = {},
|
|
79
|
-
iconEnabled = true,
|
|
80
77
|
id,
|
|
81
|
-
unstyled = false,
|
|
82
78
|
} = props
|
|
83
79
|
const ariaProps = buildAriaProps(aria)
|
|
84
80
|
const dataProps = buildDataProps(data)
|
|
@@ -89,51 +85,6 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
89
85
|
className
|
|
90
86
|
)
|
|
91
87
|
|
|
92
|
-
const formattedValue = formatContact(contactValue, contactType)
|
|
93
|
-
const content = (
|
|
94
|
-
<>
|
|
95
|
-
{iconEnabled && (contactType === 'email' ? (
|
|
96
|
-
<Icon
|
|
97
|
-
className="svg-inline--fa envelope"
|
|
98
|
-
customIcon={envelopeIcon}
|
|
99
|
-
dark={dark}
|
|
100
|
-
fixedWidth
|
|
101
|
-
/>
|
|
102
|
-
) : (
|
|
103
|
-
<Icon
|
|
104
|
-
dark={dark}
|
|
105
|
-
fixedWidth
|
|
106
|
-
icon={contactTypeMap[contactType] || 'phone'}
|
|
107
|
-
/>
|
|
108
|
-
))}
|
|
109
|
-
{iconEnabled ? ` ${formattedValue} ` : formattedValue}
|
|
110
|
-
{contactDetail && (
|
|
111
|
-
<Caption
|
|
112
|
-
dark={dark}
|
|
113
|
-
size="xs"
|
|
114
|
-
tag="span"
|
|
115
|
-
text={contactDetail}
|
|
116
|
-
/>
|
|
117
|
-
)}
|
|
118
|
-
</>
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
// When unstyled, render just the content without Body wrapper
|
|
122
|
-
if (unstyled) {
|
|
123
|
-
return (
|
|
124
|
-
<span
|
|
125
|
-
{...ariaProps}
|
|
126
|
-
{...dataProps}
|
|
127
|
-
{...htmlProps}
|
|
128
|
-
className={classes}
|
|
129
|
-
id={id}
|
|
130
|
-
>
|
|
131
|
-
{content}
|
|
132
|
-
</span>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Default styled mode with Body wrapper
|
|
137
88
|
return (
|
|
138
89
|
<div
|
|
139
90
|
{...ariaProps}
|
|
@@ -144,11 +95,33 @@ const Contact = (props: ContactProps): React.ReactElement => {
|
|
|
144
95
|
>
|
|
145
96
|
<Body
|
|
146
97
|
className="pb_contact_kit"
|
|
147
|
-
color="light"
|
|
98
|
+
color={"light"}
|
|
148
99
|
dark={dark}
|
|
149
100
|
tag="span"
|
|
150
101
|
>
|
|
151
|
-
|
|
102
|
+
{contactType === 'email' ? (
|
|
103
|
+
<Icon
|
|
104
|
+
className="svg-inline--fa envelope"
|
|
105
|
+
customIcon={envelopeIcon}
|
|
106
|
+
dark={dark}
|
|
107
|
+
fixedWidth
|
|
108
|
+
/>
|
|
109
|
+
) : (
|
|
110
|
+
<Icon
|
|
111
|
+
dark={dark}
|
|
112
|
+
fixedWidth
|
|
113
|
+
icon={contactTypeMap[contactType] || 'phone'}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
{` ${formatContact(contactValue, contactType)} `}
|
|
117
|
+
{contactDetail && (
|
|
118
|
+
<Caption
|
|
119
|
+
dark={dark}
|
|
120
|
+
size="xs"
|
|
121
|
+
tag="span"
|
|
122
|
+
text={contactDetail}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
152
125
|
</Body>
|
|
153
126
|
</div>
|
|
154
127
|
)
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
<%=
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
dark: object.dark
|
|
15
|
-
}) %>
|
|
16
|
-
<% end %>
|
|
17
|
-
<%= " #{object.formatted_contact_value}" if object.contact_value %>
|
|
1
|
+
<%= pb_content_tag do %>
|
|
2
|
+
<%= pb_rails("body", props: {
|
|
3
|
+
tag: "span",
|
|
4
|
+
classname: "pb_contact_kit",
|
|
5
|
+
color: "light",
|
|
6
|
+
dark: object.dark
|
|
7
|
+
}) do %>
|
|
8
|
+
<% if contact_type == "email" %>
|
|
9
|
+
<%= pb_rails("icon", props: {
|
|
10
|
+
custom_icon: Playbook::Engine::root.join(envelope_path),
|
|
11
|
+
fixed_width: true,
|
|
12
|
+
dark: object.dark
|
|
13
|
+
}) %>
|
|
18
14
|
<% else %>
|
|
19
|
-
<%=
|
|
15
|
+
<%= pb_rails("icon", props: {
|
|
16
|
+
icon: object.contact_icon,
|
|
17
|
+
fixed_width: true,
|
|
18
|
+
dark: object.dark
|
|
19
|
+
}) %>
|
|
20
20
|
<% end %>
|
|
21
|
+
<%= object.formatted_contact_value if object.contact_value %>
|
|
21
22
|
|
|
22
23
|
<%= pb_rails("caption", props: {
|
|
23
24
|
text: object.contact_detail,
|
|
@@ -26,39 +27,4 @@
|
|
|
26
27
|
dark: object.dark
|
|
27
28
|
}) if object.contact_detail %>
|
|
28
29
|
<% end %>
|
|
29
|
-
<% else %>
|
|
30
|
-
<%= pb_content_tag do %>
|
|
31
|
-
<%= pb_rails("body", props: {
|
|
32
|
-
tag: "span",
|
|
33
|
-
classname: "pb_contact_kit",
|
|
34
|
-
color: "light",
|
|
35
|
-
dark: object.dark
|
|
36
|
-
}) do %>
|
|
37
|
-
<% if icon_enabled %>
|
|
38
|
-
<% if contact_type == "email" %>
|
|
39
|
-
<%= pb_rails("icon", props: {
|
|
40
|
-
custom_icon: Playbook::Engine::root.join(envelope_path),
|
|
41
|
-
fixed_width: true,
|
|
42
|
-
dark: object.dark
|
|
43
|
-
}) %>
|
|
44
|
-
<% else %>
|
|
45
|
-
<%= pb_rails("icon", props: {
|
|
46
|
-
icon: object.contact_icon,
|
|
47
|
-
fixed_width: true,
|
|
48
|
-
dark: object.dark
|
|
49
|
-
}) %>
|
|
50
|
-
<% end %>
|
|
51
|
-
<%= " #{object.formatted_contact_value}" if object.contact_value %>
|
|
52
|
-
<% else %>
|
|
53
|
-
<%= object.formatted_contact_value if object.contact_value %>
|
|
54
|
-
<% end %>
|
|
55
|
-
|
|
56
|
-
<%= pb_rails("caption", props: {
|
|
57
|
-
text: object.contact_detail,
|
|
58
|
-
tag: 'span',
|
|
59
|
-
size: 'xs',
|
|
60
|
-
dark: object.dark
|
|
61
|
-
}) if object.contact_detail %>
|
|
62
|
-
<% end %>
|
|
63
|
-
<% end %>
|
|
64
30
|
<% end %>
|
|
@@ -8,8 +8,6 @@ module Playbook
|
|
|
8
8
|
prop :contact_type
|
|
9
9
|
prop :contact_value
|
|
10
10
|
prop :contact_detail
|
|
11
|
-
prop :icon_enabled, type: Playbook::Props::Boolean, default: true
|
|
12
|
-
prop :unstyled, type: Playbook::Props::Boolean, default: false
|
|
13
11
|
|
|
14
12
|
def classname
|
|
15
13
|
generate_classname("pb_contact_kit")
|
|
@@ -46,15 +44,7 @@ module Playbook
|
|
|
46
44
|
elsif contact_type == "international"
|
|
47
45
|
contact_value
|
|
48
46
|
else
|
|
49
|
-
|
|
50
|
-
# Format like "+1 (212) 555-1234"
|
|
51
|
-
intl_code = ""
|
|
52
|
-
cleaned_number = formatted_value
|
|
53
|
-
if cleaned_number.length == 11 && cleaned_number.start_with?("1")
|
|
54
|
-
intl_code = "+1 "
|
|
55
|
-
cleaned_number = cleaned_number.sub(/^1/, "")
|
|
56
|
-
end
|
|
57
|
-
"#{intl_code}#{number_to_phone(cleaned_number, area_code: true)}"
|
|
47
|
+
number_to_phone(formatted_value, area_code: true)
|
|
58
48
|
end
|
|
59
49
|
end
|
|
60
50
|
|
|
@@ -149,79 +149,3 @@ test('international contact type preserves original format', () => {
|
|
|
149
149
|
const kit = screen.getByTestId('test-international-format')
|
|
150
150
|
expect(kit).toHaveTextContent('+44 20 7946 0958')
|
|
151
151
|
})
|
|
152
|
-
|
|
153
|
-
test('iconEnabled prop hides icon when false', () => {
|
|
154
|
-
render(
|
|
155
|
-
<>
|
|
156
|
-
<Contact
|
|
157
|
-
contactType="home"
|
|
158
|
-
contactValue="2125551234"
|
|
159
|
-
data={{ testid: 'test-with-icon' }}
|
|
160
|
-
iconEnabled
|
|
161
|
-
/>
|
|
162
|
-
<Contact
|
|
163
|
-
contactType="home"
|
|
164
|
-
contactValue="2125551234"
|
|
165
|
-
data={{ testid: 'test-without-icon' }}
|
|
166
|
-
iconEnabled={false}
|
|
167
|
-
/>
|
|
168
|
-
</>
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
// With icon enabled, should have icon
|
|
172
|
-
expect(screen.getByTestId('test-with-icon').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
|
173
|
-
|
|
174
|
-
// Without icon, should not have icon
|
|
175
|
-
expect(screen.getByTestId('test-without-icon').querySelector('.pb_custom_icon')).not.toBeInTheDocument()
|
|
176
|
-
|
|
177
|
-
// But should still have the formatted phone number
|
|
178
|
-
expect(screen.getByTestId('test-without-icon')).toHaveTextContent('(212) 555-1234')
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
test('unstyled prop renders without Body wrapper', () => {
|
|
182
|
-
render(
|
|
183
|
-
<>
|
|
184
|
-
<Contact
|
|
185
|
-
contactType="home"
|
|
186
|
-
contactValue="2125551234"
|
|
187
|
-
data={{ testid: 'test-styled' }}
|
|
188
|
-
/>
|
|
189
|
-
<Contact
|
|
190
|
-
contactType="home"
|
|
191
|
-
contactValue="2125551234"
|
|
192
|
-
data={{ testid: 'test-unstyled' }}
|
|
193
|
-
unstyled
|
|
194
|
-
/>
|
|
195
|
-
</>
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
// Styled version should have Body wrapper with pb_contact_kit class
|
|
199
|
-
const styled = screen.getByTestId('test-styled')
|
|
200
|
-
const styledBody = styled.querySelector('span.pb_contact_kit')
|
|
201
|
-
expect(styledBody).toBeInTheDocument()
|
|
202
|
-
expect(styledBody).toHaveTextContent('(212) 555-1234')
|
|
203
|
-
|
|
204
|
-
// Unstyled version should be a span without Body wrapper
|
|
205
|
-
const unstyled = screen.getByTestId('test-unstyled')
|
|
206
|
-
expect(unstyled.tagName).toBe('SPAN')
|
|
207
|
-
expect(unstyled.querySelector('span.pb_contact_kit')).not.toBeInTheDocument()
|
|
208
|
-
expect(unstyled).toHaveTextContent('(212) 555-1234')
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
test('unstyled and iconEnabled work together', () => {
|
|
212
|
-
render(
|
|
213
|
-
<Contact
|
|
214
|
-
contactType="home"
|
|
215
|
-
contactValue="2125551234"
|
|
216
|
-
data={{ testid: 'test-unstyled-no-icon' }}
|
|
217
|
-
iconEnabled={false}
|
|
218
|
-
unstyled
|
|
219
|
-
/>
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
const kit = screen.getByTestId('test-unstyled-no-icon')
|
|
223
|
-
expect(kit.tagName).toBe('SPAN')
|
|
224
|
-
expect(kit.querySelector('.pb_custom_icon')).not.toBeInTheDocument()
|
|
225
|
-
expect(kit.querySelector('.pb_body_kit')).not.toBeInTheDocument()
|
|
226
|
-
expect(kit).toHaveTextContent('(212) 555-1234')
|
|
227
|
-
})
|