playbook_ui 14.24.0.pre.alpha.PLAY19989342 → 14.24.0.pre.alpha.PLAY23139411

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +60 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +3 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +57 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  11. data/app/pb_kits/playbook/pb_date/_date.tsx +3 -5
  12. data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
  13. data/app/pb_kits/playbook/pb_date/date.rb +0 -2
  14. data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -2
  15. data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
  16. data/dist/chunks/{_weekday_stacked-CJIFKKe7.js → _weekday_stacked-B89kArHY.js} +1 -1
  17. data/dist/chunks/vendor.js +1 -1
  18. data/dist/menu.yml +1 -1
  19. data/dist/playbook-doc.js +1 -1
  20. data/lib/playbook/version.rb +1 -1
  21. metadata +7 -6
  22. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +0 -4
  23. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +0 -17
  24. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59c17882526a3b72d9fc83804b03d9b16990cb101e1862b0e52b86302f1d2910
4
- data.tar.gz: 2a8bcde09ad5af23d054ddba72d05dd55d18a592e84748435269a933456942ed
3
+ metadata.gz: e3d762bec279ed08c6f2c32e62d81d19ff9309898bd898b64b5ebbafa042746c
4
+ data.tar.gz: 9e9e7d6f94777f1770757559c95bb1e12ac8b4016cc48d84236278a9d8ab15dd
5
5
  SHA512:
6
- metadata.gz: f6e0c7da6c2b966bef964121f3f25a0c4d5f141be242d977d173e14f063dd7c3dd96cb81eedd14bf6cfa06838719ad76470b5e76d5c9b8818d5314b7a4234e13
7
- data.tar.gz: 95e0c86be7672a3370c39a60ccdcb2cd5e31112c921b407cea885baf651560869bef742c89716510a5f714f1b768b30472895da6f8f04ac2ac101839ce41082b
6
+ metadata.gz: 50d7e0dd26c65b9bbf45ecb7132b46deb8507e5d06d6c9e3c8ee0d3f49f26844184f69fdef2ee7baccda44f490c13cc2a4232d8d2f73c0ec35dea88f10149aed
7
+ data.tar.gz: 4709d36e634964f8a1a9b9fb1b7d8fe0893951a5b5fc2d2b83d55fcbe2e966a7a95e03be098891c6e7811704f9db4c54d1eb903e891d4cf0b1f8d71348ddef14
@@ -58,7 +58,9 @@ const TableCellRenderer = ({
58
58
  // Find the “owning” colDefinition by accessor. Needed for multi column logic
59
59
  const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
60
60
  const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
61
-
61
+ const paddingValue = colDef?.columnStyling?.cellPadding ?? customRowStyle?.cellPadding
62
+ const paddingClass = paddingValue ? `p_${paddingValue}` : undefined
63
+
62
64
  return (
63
65
  <td
64
66
  align={cellAlignment}
@@ -68,6 +70,7 @@ const TableCellRenderer = ({
68
70
  isPinnedLeft && 'pinned-left',
69
71
  stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft && 'sticky-left',
70
72
  isLastCell && 'last-cell',
73
+ paddingClass
71
74
  )}
72
75
  key={`${cell.id}-data`}
73
76
  style={{
@@ -113,7 +113,6 @@ export const TableHeaderCell = ({
113
113
  return visibleSiblings.at(-1) === header.column;
114
114
  })();
115
115
 
116
-
117
116
  const cellClassName = classnames(
118
117
  "table-header-cells",
119
118
  `${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
@@ -122,7 +121,7 @@ const cellClassName = classnames(
122
121
  { "pinned-left": responsive === "scroll" && isPinnedLeft },
123
122
  isLastHeaderCell ? "last-header-cell" : "",
124
123
  stickyLeftColumn && stickyLeftColumn.length > 0 && isPinnedLeft ? 'sticky-left' : "",
125
-
124
+ colDef?.columnStyling?.headerPadding && `p_${colDef?.columnStyling?.headerPadding}`
126
125
  );
127
126
 
128
127
  const cellId = `${loading ?
@@ -651,6 +651,36 @@ test("columnStyling.cellAlignment sets each <td> align attribute as expected", (
651
651
  expect(firstEnrollmentCell).toHaveAttribute("align", "left");
652
652
  });
653
653
 
654
+ test("columnStyling.cellPadding sets cell padding", () => {
655
+ const styledColumnDefs = [
656
+ {
657
+ accessor: "year",
658
+ label: "Year",
659
+ cellAccessors: ["quarter", "month", "day"],
660
+ },
661
+ {
662
+ accessor: "newEnrollments",
663
+ label: "New Enrollments",
664
+ columnStyling: { cellPadding: "none" },
665
+ },
666
+ {
667
+ accessor: "scheduledMeetings",
668
+ label: "Scheduled Meetings",
669
+ },
670
+ ];
671
+
672
+ render(
673
+ <AdvancedTable
674
+ columnDefinitions={styledColumnDefs}
675
+ data={{ testid: testId }}
676
+ tableData={MOCK_DATA}
677
+ />
678
+ );
679
+
680
+ const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
681
+ expect(firstEnrollmentCell).toHaveClass('p_none')
682
+ });
683
+
654
684
  test("renders virtualized table rows and header", () => {
655
685
  render(
656
686
  <AdvancedTable
@@ -694,6 +724,32 @@ test("rowStyling prop works as expected", () => {
694
724
  expect(row1).toHaveStyle({backgroundColor: colors.white, color: colors.black})
695
725
  })
696
726
 
727
+ test("rowStyling prop to allow padding control", () => {
728
+ const rowStyling = [
729
+ {
730
+ rowId: "1",
731
+ cellPadding: "lg"
732
+ },
733
+ ];
734
+
735
+ render(
736
+ <AdvancedTable
737
+ columnDefinitions={columnDefinitions}
738
+ data={{ testid: testId }}
739
+ rowStyling={rowStyling}
740
+ tableData={MOCK_DATA_WITH_ID}
741
+ />
742
+ )
743
+
744
+ const kit = screen.getByTestId(testId)
745
+ const tableBody = kit.querySelector('tbody')
746
+ const row1 = tableBody.querySelector('tr:nth-child(1)')
747
+ const cells = row1.querySelectorAll("td");
748
+ cells.forEach((cell) => {
749
+ expect(cell.classList.contains("p_lg")).toBe(true);
750
+ });
751
+ })
752
+
697
753
  test("Sort icon renders with enableSort on individual columns", () => {
698
754
  render(
699
755
  <AdvancedTable
@@ -0,0 +1,60 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import Background from '../../pb_background/_background'
4
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
5
+
6
+ const AdvancedTablePaddingControl = (props) => {
7
+ const columnDefinitions = [
8
+ {
9
+ accessor: "year",
10
+ label: "Year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ columnStyling:{cellPadding: "none"},
17
+ customRenderer: (row, value) => (
18
+ <Background
19
+ backgroundColor={row.original.newEnrollments > 20 ? "success_secondary" : "warning_secondary"}
20
+ padding="xs"
21
+ >
22
+ {value}
23
+ </Background>
24
+ ),
25
+
26
+ },
27
+ {
28
+ accessor: "scheduledMeetings",
29
+ label: "Scheduled Meetings",
30
+ },
31
+ {
32
+ accessor: "attendanceRate",
33
+ label: "Attendance Rate",
34
+ },
35
+ {
36
+ accessor: "completedClasses",
37
+ label: "Completed Classes",
38
+ },
39
+ {
40
+ accessor: "classCompletionRate",
41
+ label: "Class Completion Rate",
42
+ },
43
+ {
44
+ accessor: "graduatedStudents",
45
+ label: "Graduated Students",
46
+ },
47
+ ]
48
+
49
+ return (
50
+ <div>
51
+ <AdvancedTable
52
+ columnDefinitions={columnDefinitions}
53
+ tableData={MOCK_DATA}
54
+ {...props}
55
+ />
56
+ </div>
57
+ )
58
+ }
59
+
60
+ export default AdvancedTablePaddingControl
@@ -0,0 +1,3 @@
1
+ `columnStyling` can also be used to control padding on all cells in a given column via the use of the `cellPadding` key/value pair. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
2
+
3
+ This control can be used in conjunction with the `customRenderer` item within each columnDefinition to achieve custom background colors for individual cells as seen here.
@@ -0,0 +1,57 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTablePaddingControlPerRow = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const rowStyling = [
39
+ {
40
+ rowId: "1",
41
+ cellPadding:"md"
42
+ },
43
+ ];
44
+
45
+ return (
46
+ <div>
47
+ <AdvancedTable
48
+ columnDefinitions={columnDefinitions}
49
+ rowStyling={rowStyling}
50
+ tableData={MOCK_DATA}
51
+ {...props}
52
+ />
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTablePaddingControlPerRow
@@ -0,0 +1 @@
1
+ `rowStyling` can also be used to control padding on all cells in a given row via the use of the `cellPadding` key/value pair as shown here. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
@@ -66,8 +66,10 @@ examples:
66
66
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
67
67
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
68
68
  - advanced_table_row_styling: Row Styling
69
+ - advanced_table_padding_control_per_row: Padding Control using Row Styling
69
70
  - advanced_table_column_styling: Column Styling
70
71
  - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
72
+ - advanced_table_padding_control: Padding Control using Column Styling
71
73
  - advanced_table_column_border_color: Column Group Border Color
72
74
  - advanced_table_fullscreen: Fullscreen
73
75
  - advanced_table_infinite_scroll: Infinite Scroll
@@ -42,4 +42,6 @@ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_c
42
42
  export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
43
43
  export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
44
44
  export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
45
- export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
45
+ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
46
+ export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
47
+ export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
@@ -19,7 +19,6 @@ type PbDateProps = {
19
19
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
20
20
  id?: string;
21
21
  showDayOfWeek?: boolean;
22
- showCurrentYear?: boolean;
23
22
  showIcon?: boolean;
24
23
  size?: "sm" | "md" | "lg";
25
24
  unstyled?: boolean;
@@ -36,7 +35,6 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
36
35
  htmlOptions = {},
37
36
  id,
38
37
  showDayOfWeek = false,
39
- showCurrentYear = false,
40
38
  showIcon = false,
41
39
  size = "md",
42
40
  unstyled = false,
@@ -92,7 +90,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
92
90
  {month} {day}
93
91
  </span>
94
92
 
95
- {(currentYear !== year || showCurrentYear) && <span>{`, ${year}`}</span>}
93
+ {currentYear != year && <span>{`, ${year}`}</span>}
96
94
  </span>
97
95
  </>
98
96
  : size == "md" || size == "lg"
@@ -126,7 +124,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
126
124
  <span>
127
125
  {month} {day}
128
126
  </span>
129
- {(currentYear !== year || showCurrentYear) && <span>{`, ${year}`}</span>}
127
+ {currentYear != year && <span>{`, ${year}`}</span>}
130
128
  </Title>
131
129
  )
132
130
  : (
@@ -160,7 +158,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
160
158
  <Caption dark={dark}
161
159
  tag="span">
162
160
  {month} {day}
163
- {(currentYear !== year || showCurrentYear) && <>{`, ${year}`}</>}
161
+ {currentYear != year && <>{`, ${year}`}</>}
164
162
  </Caption>
165
163
  </>
166
164
  )}
@@ -13,8 +13,8 @@
13
13
  <% end %>
14
14
 
15
15
  <!-- month day, year -->
16
- <%# if not current year or show_current_year is false %>
17
- <% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
16
+ <%# if not current year %>
17
+ <% if object.year.to_s == DateTime.now.year.to_s %>
18
18
  <span><%= "#{object.month} #{object.day}" %></span>
19
19
  <%# if is current year %>
20
20
  <% else %>
@@ -44,8 +44,8 @@
44
44
 
45
45
  <!-- month day, year -->
46
46
 
47
- <%# if not current year or show_current_year is false %>
48
- <% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
47
+ <%# if not current year %>
48
+ <% if object.year.to_s == DateTime.now.year.to_s %>
49
49
  <%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}", size: 4 }) %>
50
50
  <%# if is current year %>
51
51
  <% else %>
@@ -74,8 +74,8 @@
74
74
 
75
75
  <!-- month day, year -->
76
76
 
77
- <%# if not current year or show_current_year is false %>
78
- <% if object.year.to_s == DateTime.now.year.to_s && !object.show_current_year %>
77
+ <%# if not current year %>
78
+ <% if object.year.to_s == DateTime.now.year.to_s %>
79
79
  <%= pb_rails("caption", props: { tag: "span", text: "#{object.month} #{object.day}" }) %>
80
80
  <%# if is current year %>
81
81
  <% else %>
@@ -11,8 +11,6 @@ module Playbook
11
11
  default: false
12
12
  prop :show_day_of_week, type: Playbook::Props::Boolean,
13
13
  default: false
14
- prop :show_current_year, type: Playbook::Props::Boolean,
15
- default: false
16
14
  prop :size, type: Playbook::Props::Enum,
17
15
  values: %w[lg md sm xs],
18
16
  default: "md"
@@ -5,14 +5,12 @@ examples:
5
5
  - date_variants: Variants
6
6
  - date_alignment: Alignment
7
7
  - date_timezone: Timezones
8
- - date_with_show_current_year: Show Current Year
9
8
  - date_unstyled: Unstyled
10
9
 
11
10
  react:
12
11
  - date_default: Default
13
12
  - date_variants: Variants
14
13
  - date_alignment: Alignment
15
- - date_with_show_current_year: Show Current Year
16
14
  - date_unstyled: Unstyled
17
15
 
18
16
  swift:
@@ -2,4 +2,3 @@ export { default as DateDefault } from './_date_default.jsx'
2
2
  export { default as DateVariants } from './_date_variants.jsx'
3
3
  export { default as DateAlignment } from './_date_alignment.jsx'
4
4
  export { default as DateUnstyled } from './_date_unstyled.jsx'
5
- export { default as DateWithShowCurrentYear } from './_date_with_show_current_year.jsx'