playbook_ui 14.23.0.pre.alpha.PLAY2243customindeterminatemaincheckboxlabels9046 → 14.23.0.pre.alpha.PLAY2329atstickypinnedborderbug9151

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +7 -6
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +223 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +9 -6
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +14 -2
  10. data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +16 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +46 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +7 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +107 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +1 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +51 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +1 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +51 -10
  22. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -1
  23. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -1
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +36 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +13 -4
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
  27. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +1 -1
  28. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +1 -1
  29. data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +1 -3
  30. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +36 -17
  31. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +3 -0
  32. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +31 -16
  33. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +63 -31
  34. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +3 -0
  35. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +35 -16
  36. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +41 -16
  37. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +107 -62
  38. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +4 -7
  39. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -1
  40. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -1
  41. data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +16 -1
  42. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -0
  43. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +10 -0
  44. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +26 -0
  45. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +3 -0
  46. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
  47. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  48. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
  49. data/dist/chunks/_line_graph-BfCo79KE.js +1 -0
  50. data/dist/chunks/_typeahead-Db4YQA5c.js +6 -0
  51. data/dist/chunks/{_weekday_stacked-BIEMUAn8.js → _weekday_stacked-CoOhQc3y.js} +2 -2
  52. data/dist/chunks/{lib-AStGp3dD.js → lib-DnQyMxO1.js} +1 -1
  53. data/dist/chunks/{pb_form_validation-DF742j1h.js → pb_form_validation-kl-4Jv4t.js} +1 -1
  54. data/dist/chunks/vendor.js +1 -1
  55. data/dist/menu.yml +1 -1
  56. data/dist/playbook-doc.js +1 -1
  57. data/dist/playbook-rails-react-bindings.js +1 -1
  58. data/dist/playbook-rails.js +1 -1
  59. data/dist/playbook.css +1 -1
  60. data/lib/playbook/version.rb +1 -1
  61. metadata +20 -11
  62. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +0 -52
  63. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
  64. data/dist/chunks/_gauge-BUpiCaK5.js +0 -1
  65. data/dist/chunks/_typeahead-ITbXBlyi.js +0 -6
  66. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling.md → _advanced_table_row_styling_react.md} +0 -0
  67. /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors.md → _line_graph_colors_rails.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbf9a417a4f6e2dcdf093c538efc5d3be6aa9a5bfdeaef160a8dc27e10bc6071
4
- data.tar.gz: 90c1022791a95512530ab08978a544b5cd1bd716a4ecd70a5dd6b480e853d6f7
3
+ metadata.gz: e8849282c22bb4870841f96e110bc89eaca2ed4e4dfbef18b709b6c2e93a701b
4
+ data.tar.gz: 6d844177bce8a58692b5e383ceae03ea8c607e29e357c37c2931a0b9df9ee02d
5
5
  SHA512:
6
- metadata.gz: 983c01db202cb88494f13e2a1c7593d7cf01c6d655ff89a78ca1f085f78bd5a79a393c05f1a8a05d2e024999e4bcc8e4843d0f7004649d3f1cb05a72228cd641
7
- data.tar.gz: 44eda0c8b056f6998518bf9bde3b3bb5e721df6cb47739b17f1053464a7d594352c26d3005e0b0d2a3e3209ed02ae2f4287233822919a43d9aef256548c3f768
6
+ metadata.gz: a4cfa9a835da85fbd7af7c6c5aacabf227d5e01e284f748e71eceb2c5d1c7337336e1a69a8d00ffce7cd32b903b9c0fa18ce7644cfe1faeea85fb65d6f32727f
7
+ data.tar.gz: 8821b2b62bfc362fb5b688ba476489d8284bd22734102d00829097f05024ac5400b11c22216d4a14d03abb60e9a03d2360b68804b726c5c7c8e6835278db93c8
@@ -20,7 +20,7 @@ interface CustomCellProps {
20
20
  customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
21
21
  selectableRows?: boolean
22
22
  customStyle?: GenericObject
23
- }
23
+ }
24
24
 
25
25
  export const CustomCell = ({
26
26
  getValue,
@@ -35,7 +35,7 @@ export const CustomCell = ({
35
35
 
36
36
  const handleOnExpand = (row: Row<GenericObject>) => {
37
37
  onRowToggleClick && onRowToggleClick(row);
38
-
38
+
39
39
  if (!expandedControl) {
40
40
  setExpanded({ ...expanded, [row.id]: !row.getIsExpanded() });
41
41
  }
@@ -46,8 +46,8 @@ export const CustomCell = ({
46
46
 
47
47
  return (
48
48
  <div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
49
- <Flex
50
- alignItems="center"
49
+ <Flex
50
+ alignItems="center"
51
51
  columnGap="xs"
52
52
  justify="start"
53
53
  orientation="row"
@@ -71,11 +71,12 @@ export const CustomCell = ({
71
71
  >
72
72
  {row.getIsExpanded() ? (
73
73
  <Icon cursor="pointer"
74
- icon="circle-play-down"
74
+ icon="circle-play"
75
+ rotation={90}
75
76
  />
76
77
  ) : (
77
78
  <Icon cursor="pointer"
78
- icon="circle-play"
79
+ icon="circle-play"
79
80
  />
80
81
  )}
81
82
  </button>
@@ -112,7 +112,7 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
112
112
  paddingBottom="xs"
113
113
  text={node.label}
114
114
  />
115
- <Flex flexDirection="column"
115
+ <Flex flexDirection="column"
116
116
  paddingLeft="lg"
117
117
  >
118
118
  {node?.children?.map((child) =>
@@ -141,8 +141,8 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
141
141
  setShowPopover(!shouldClose)
142
142
 
143
143
  const popoverReference = (
144
- <Tooltip
145
- placement="top"
144
+ <Tooltip
145
+ placement="top"
146
146
  text="Column Configuration"
147
147
  >
148
148
  <div onClick={togglePopover}>
@@ -170,8 +170,8 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
170
170
  >
171
171
  {type === "row-selection" ? (
172
172
  <>
173
- <Caption color="light"
174
- paddingLeft="xs"
173
+ <Caption color="light"
174
+ paddingLeft="xs"
175
175
  size="xs"
176
176
  >
177
177
  {selectedCount} Selected
@@ -188,15 +188,15 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
188
188
  zIndex={3}
189
189
  >
190
190
  <>
191
- <Caption
192
- paddingY="sm"
191
+ <Caption
192
+ paddingY="sm"
193
193
  text="Columns Config"
194
- textAlign="center"
194
+ textAlign="center"
195
195
  />
196
196
  <SectionSeparator paddingBottom="xs" />
197
197
  {tree.map((node: VisibilityNode) => (
198
- <Flex cursor="pointer"
199
- flexDirection="column"
198
+ <Flex cursor="pointer"
199
+ flexDirection="column"
200
200
  key={node.id}
201
201
  paddingX="xs"
202
202
  >
@@ -101,7 +101,6 @@ export const TableHeaderCell = ({
101
101
  if (!header) return false;
102
102
 
103
103
  if (header.colSpan > 1 && header.column.parent !== undefined) return true;
104
-
105
104
  const parent = header.column.parent;
106
105
 
107
106
  if (!parent) {
@@ -83,11 +83,11 @@ export function useTableState({
83
83
  const buildColumns = useCallback((columnDefinitions: GenericObject[], isRoot = true): any[] => {
84
84
  return columnDefinitions?.map((column, index) => {
85
85
  const isFirstColumn = isRoot && index === 0;
86
-
87
86
  // Handle grouped columns
88
87
  if (column.columns && column.columns.length > 0) {
89
88
  return {
90
- header: column.header || column.label || "",
89
+ header: column.header ?? column.label ?? "",
90
+ id: column.id ?? column.label ?? `group-${index}`,
91
91
  columns: buildColumns(column.columns, false),
92
92
  };
93
93
  }
@@ -124,13 +124,65 @@
124
124
  -ms-overflow-style: none !important;
125
125
  scrollbar-width: none !important;
126
126
  }
127
-
127
+
128
+ // When action bar is hidden, ensure proper border radius for header corners
129
+ &.hidden-action-bar {
130
+ .pb_advanced_table_header {
131
+ > tr:first-child {
132
+ th:first-child {
133
+ border-top-left-radius: 4px !important;
134
+ }
135
+ th:last-child {
136
+ border-top-right-radius: 4px !important;
137
+ }
138
+ }
139
+ }
140
+
141
+ // Also handle the case when there are multiple header rows
142
+ .pb_advanced_table_header {
143
+ > tr:first-child {
144
+ th:first-child,
145
+ .table-header-cells:first-child,
146
+ .table-header-cells-custom:first-child {
147
+ border-top-left-radius: 4px !important;
148
+ }
149
+ th:last-child,
150
+ .table-header-cells:last-child,
151
+ .table-header-cells-custom:last-child {
152
+ border-top-right-radius: 4px !important;
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+ // When action bar is shown, remove border radius from header
159
+ .row-selection-actions-card.is-visible ~ * .pb_advanced_table_header,
160
+ .row-selection-actions-card.show-action-card ~ * .pb_advanced_table_header {
161
+ > tr:first-child {
162
+ th:first-child,
163
+ th:last-child,
164
+ .table-header-cells:first-child,
165
+ .table-header-cells:last-child,
166
+ .table-header-cells-custom:first-child,
167
+ .table-header-cells-custom:last-child {
168
+ border-top-left-radius: 0 !important;
169
+ border-top-right-radius: 0 !important;
170
+ }
171
+ }
172
+ }
173
+
128
174
 
129
175
  .row-selection-actions-card {
130
176
  border-bottom-right-radius: 0px !important;
131
177
  border-bottom-left-radius: 0px !important;
132
178
  border-bottom-color: transparent;
133
179
  transition: height 300ms ease;
180
+
181
+ &.is-visible,
182
+ &.show-action-card {
183
+ border-top-left-radius: 4px !important;
184
+ border-top-right-radius: 4px !important;
185
+ }
134
186
  }
135
187
  .table-header-cells:first-child {
136
188
  min-width: 180px;
@@ -541,6 +593,101 @@
541
593
  }
542
594
  }
543
595
 
596
+ // Ensure vertical borders work with non-container tables
597
+ .pb_table:not(.table-card) {
598
+ &.vertical-border {
599
+ // Sticky header with vertical borders
600
+ &.sticky-header {
601
+ thead th:not(:last-child) {
602
+ border-right: 1px solid $border_light !important;
603
+ }
604
+ }
605
+
606
+ // Regular table cells with vertical borders
607
+ td:not(:last-child),
608
+ th:not(:last-child),
609
+ .pb_table_td:not(:last-child),
610
+ .pb_table_th:not(:last-child) {
611
+ border-right: 1px solid $border_light !important;
612
+ }
613
+ }
614
+ }
615
+
616
+ // Pinned rows should maintain vertical borders regardless of container prop
617
+ .pinned-row {
618
+ position: sticky !important;
619
+ z-index: 2 !important;
620
+
621
+ &.pb_table_tr,
622
+ tr {
623
+ // Apply right border to ALL cells including last one when verticalBorder is true
624
+ td,
625
+ .pb_table_td {
626
+ border-right: 1px solid var(--column-border-color, $border_light) !important;
627
+ }
628
+ }
629
+ }
630
+
631
+ // Specific fixes for vertical borders with sticky elements
632
+ .pb_table.vertical-border {
633
+
634
+ // Sticky header - apply borders to ALL cells including last
635
+ &.sticky-header {
636
+ thead th {
637
+ border-right: 1px solid $border_light !important;
638
+ border-left: none !important;
639
+ border-top: none !important;
640
+ }
641
+ }
642
+
643
+ // Regular pinned rows
644
+ .pinned-row {
645
+ td,
646
+ .pb_table_td {
647
+ border-right: 1px solid var(--column-border-color, $border_light) !important;
648
+ // Ensure no unwanted borders
649
+ border-left: none !important;
650
+ border-top: none !important;
651
+ }
652
+ }
653
+
654
+ // Ensure non-container tables don't get unwanted borders
655
+ &:not(.table-card) {
656
+ thead th,
657
+ td,
658
+ .pb_table_td {
659
+ border-left: none !important;
660
+ border-top: none !important;
661
+ }
662
+ }
663
+ }
664
+
665
+ // Firefox-specific
666
+ @-moz-document url-prefix() {
667
+ .pb_table.vertical-border {
668
+
669
+ &.sticky-header {
670
+ thead th {
671
+ border: none !important;
672
+ // Use box-shadow for both right border AND bottom border
673
+ box-shadow:
674
+ inset -1px 0 0 0 $border_light, // Right border
675
+ inset 0 -1px 0 0 $border_light !important; // Bottom border
676
+ }
677
+ }
678
+
679
+ .pinned-row {
680
+ td,
681
+ .pb_table_td {
682
+ border-right: none !important;
683
+ border-left: none !important;
684
+ border-top: none !important;
685
+ box-shadow: inset -1px 0 0 0 var(--column-border-color, $border_light) !important;
686
+ }
687
+ }
688
+ }
689
+ }
690
+
544
691
  @include chrome_styles($border-color);
545
692
 
546
693
  tr:hover {
@@ -720,6 +867,81 @@
720
867
  box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
721
868
  }
722
869
 
870
+ // Dark mode adjustments for non-container tables
871
+ .pb_table:not(.table-card) {
872
+ &.vertical-border {
873
+ &.sticky-header {
874
+ thead th:not(:last-child) {
875
+ border-right: 1px solid $border_dark !important;
876
+ }
877
+ }
878
+
879
+ td:not(:last-child),
880
+ th:not(:last-child),
881
+ .pb_table_td:not(:last-child),
882
+ .pb_table_th:not(:last-child) {
883
+ border-right: 1px solid $border_dark !important;
884
+ }
885
+ }
886
+ }
887
+
888
+ // Dark mode pinned rows
889
+ .pinned-row {
890
+ &.pb_table_tr,
891
+ tr {
892
+ td,
893
+ .pb_table_td {
894
+ border-right: 1px solid var(--column-border-color, $border_dark) !important;
895
+ }
896
+ }
897
+ }
898
+
899
+ // Dark mode browser-specific fixes
900
+ .pb_table.vertical-border {
901
+ &.sticky-header {
902
+ thead th {
903
+ border-right: 1px solid $border_dark !important;
904
+ border-left: none !important;
905
+ border-top: none !important;
906
+ }
907
+ }
908
+
909
+ .pinned-row {
910
+ td,
911
+ .pb_table_td {
912
+ border-right: 1px solid var(--column-border-color, $border_dark) !important;
913
+ border-left: none !important;
914
+ border-top: none !important;
915
+ }
916
+ }
917
+ }
918
+
919
+ // Dark mode Firefox
920
+ @-moz-document url-prefix() {
921
+ .pb_table.vertical-border {
922
+
923
+ &.sticky-header {
924
+ thead th {
925
+ border: none !important;
926
+ // Use box-shadow for both right border AND bottom border
927
+ box-shadow:
928
+ inset -1px 0 0 0 $border_dark, // Right border
929
+ inset 0 -1px 0 0 $border_dark !important; // Bottom border
930
+ }
931
+ }
932
+
933
+ .pinned-row {
934
+ td,
935
+ .pb_table_td {
936
+ border-right: none !important;
937
+ border-left: none !important;
938
+ border-top: none !important;
939
+ box-shadow: inset -1px 0 0 0 var(--column-border-color, $border_dark) !important;
940
+ }
941
+ }
942
+ }
943
+ }
944
+
723
945
  // Apply border colors in dark mode
724
946
  &[class*="column-group-border-"] {
725
947
  // For top-level column groups (ENROLLMENT DATA, PERFORMANCE DATA)
@@ -218,10 +218,10 @@ const AdvancedTable = (props: AdvancedTableProps) => {
218
218
  )
219
219
 
220
220
  return (
221
- <Card
221
+ <Card
222
222
  borderNone
223
223
  borderRadius="none"
224
- className="advanced-table-fullscreen-header"
224
+ className="advanced-table-fullscreen-header"
225
225
  {...props}
226
226
  >
227
227
  <Flex justify="end">
@@ -250,6 +250,10 @@ const AdvancedTable = (props: AdvancedTableProps) => {
250
250
  const ariaProps = buildAriaProps(aria);
251
251
  const dataProps = buildDataProps(data);
252
252
  const htmlProps = buildHtmlProps(htmlOptions);
253
+
254
+ // Visibility flag for action bar
255
+ const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
256
+
253
257
  const classes = classnames(
254
258
  buildCss("pb_advanced_table"),
255
259
  `advanced-table-responsive-${responsive}`,
@@ -257,6 +261,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
257
261
  {
258
262
  'advanced-table-fullscreen': isFullscreen,
259
263
  'advanced-table-allow-fullscreen': allowFullScreen,
264
+ // Add the hidden-action-bar class when action bar functionality exists but is not visible
265
+ 'hidden-action-bar': (selectableRows || columnVisibilityControl) && !isActionBarVisible,
260
266
  },
261
267
  {'advanced-table-sticky-left-columns': stickyLeftColumn && stickyLeftColumn.length > 0},
262
268
  columnGroupBorderColor ? `column-group-border-${columnGroupBorderColor}` : '',
@@ -270,9 +276,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
270
276
  ? getVirtualizedContainerStyles(maxHeight)
271
277
  : {};
272
278
 
273
- // Visibility flag for action bar
274
- const isActionBarVisible = (selectableRows && showActionsBar && selectedRowsLength > 0) || columnVisibilityControl;
275
-
276
279
  // The actual Main <Table /> element
277
280
  const tableElement = (
278
281
  <Table
@@ -288,7 +291,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
288
291
  ) : (
289
292
  <>
290
293
  <TableHeader />
291
- <TableBody
294
+ <TableBody
292
295
  isFetching={isFetching}
293
296
  />
294
297
  </>
@@ -12,7 +12,7 @@
12
12
  <% content.presence %>
13
13
  <% else %>
14
14
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar }) %>
15
- <%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion }) %>
15
+ <%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling }) %>
16
16
  <% end %>
17
17
  <% end %>
18
18
  <% end %>
@@ -31,9 +31,16 @@ module Playbook
31
31
  default: []
32
32
  prop :scroll_bar_none, type: Playbook::Props::Boolean,
33
33
  default: false
34
+ prop :row_styling, type: Playbook::Props::Array,
35
+ default: []
34
36
 
35
37
  def classname
36
- additional_classes = [responsive_classname, max_height_classname, hide_scroll_bar_class]
38
+ additional_classes = [
39
+ responsive_classname,
40
+ max_height_classname,
41
+ hide_scroll_bar_class,
42
+ hidden_action_bar_class,
43
+ ]
37
44
  additional_classes << "column-group-border-#{column_group_border_color}" if column_group_border_color != "none"
38
45
  generate_classname("pb_advanced_table", *additional_classes, separator: " ")
39
46
  end
@@ -47,7 +54,12 @@ module Playbook
47
54
  end
48
55
 
49
56
  def hide_scroll_bar_class
50
- scroll_bar_none ? "advanced-table-hide-scrollbar " : ""
57
+ scroll_bar_none ? "advanced-table-hide-scrollbar" : ""
58
+ end
59
+
60
+ def hidden_action_bar_class
61
+ # Add hidden-action-bar class when action bar functionality is enabled but not currently visible
62
+ selectable_rows && !is_action_bar_visible ? "hidden-action-bar" : ""
51
63
  end
52
64
 
53
65
  def selected_rows
@@ -1,4 +1,7 @@
1
1
  function showActionBar(actionBar, selectedCount) {
2
+ // Get container
3
+ const tableContainer = actionBar.closest('.pb_advanced_table');
4
+
2
5
  // Show action bar directly
3
6
  actionBar.style.height = "auto";
4
7
  actionBar.style.overflow = "visible";
@@ -8,6 +11,11 @@ function showActionBar(actionBar, selectedCount) {
8
11
  actionBar.classList.remove("p_none");
9
12
  actionBar.classList.add("p_xs", "is-visible", "show-action-card");
10
13
 
14
+ // Remove hidden-action-bar class when action bar is shown
15
+ if (tableContainer) {
16
+ tableContainer.classList.remove("hidden-action-bar");
17
+ }
18
+
11
19
  // Update the count
12
20
  const countElement = actionBar.querySelector(".selected-count");
13
21
  if (countElement) {
@@ -16,12 +24,20 @@ function showActionBar(actionBar, selectedCount) {
16
24
  }
17
25
 
18
26
  function hideActionBar(actionBar) {
27
+ // Get container
28
+ const tableContainer = actionBar.closest('.pb_advanced_table');
29
+
19
30
  // Hide action bar directly
20
31
  actionBar.style.height = "0px";
21
32
  actionBar.style.overflow = "hidden";
22
33
  actionBar.style.opacity = "0";
23
34
  actionBar.classList.add("p_none");
24
35
  actionBar.classList.remove("p_xs", "is-visible", "show-action-card");
36
+
37
+ // Add hidden-action-bar class when action bar is hidden
38
+ if (tableContainer) {
39
+ tableContainer.classList.add("hidden-action-bar");
40
+ }
25
41
  }
26
42
 
27
43
  export function updateSelectionActionBar(table, selectedCount) {
@@ -44,7 +44,7 @@ const AdvancedTableRowPinning = (props) => {
44
44
  maxHeight="xs"
45
45
  pinnedRows={{value: pinnedRows, onChange: setPinnedRows}}
46
46
  tableData={MOCK_DATA}
47
- tableProps={{sticky: true}}
47
+ tableProps={{sticky: true, verticalBorder: true, container: false}}
48
48
  {...props}
49
49
  >
50
50
  <AdvancedTable.Header enableSorting />
@@ -0,0 +1,46 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <% row_styling = [
34
+ {
35
+ row_id: "1",
36
+ background_color: "#F9BB00",
37
+ },
38
+ {
39
+ row_id: "8",
40
+ background_color: "#0056CF",
41
+ font_color: "white",
42
+ expand_button_color: "white",
43
+ },
44
+ ] %>
45
+
46
+ <%= pb_rails("advanced_table", props: { id: "row-styling", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %>
@@ -0,0 +1,7 @@
1
+ The `row_styling` prop can be used in conjunction with row ids to control certain styling options on individual rows. Currently, `row_styling` gives you 3 optional controls:
2
+
3
+ - `background_color` : use this to control the background color of the row
4
+ - `font_color`: use this to control font color for each row if needed, for example if using a darker background color.
5
+ - `expand_button_color`: use this to control the color of the expand icon if needed, for example if using a darker background color.
6
+
7
+ **NOTE:** Each object within the `table_data` Array must contain a unique id in order to attach an id to all Rows for this to function.
@@ -1 +1 @@
1
- The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
1
+ The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.