playbook_ui 13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2035 → 13.16.0.pre.alpha.PBNTR181stripedtable2103

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 175ddacedbfec513a95b37bf13a61333a099bd30e8421e4860f71c0388f11f1a
4
- data.tar.gz: 72d03981d777dc247c76e68999859037ade97c566e696afc8b55b237ef5ac9dd
3
+ metadata.gz: aae6e47ae52e5b9c14b3801cf5edc5266a9592ea797e1418b6170395c30a8f66
4
+ data.tar.gz: a882e0194ed45cfa9641ff5dfe99187f806a30d3fb6ead81bdbe8859a45b3a40
5
5
  SHA512:
6
- metadata.gz: 802f5962c3902b281230c7679161ebd2299befb957ebc27595e423be42bbe2a28791524dbc038fbb3ff345d4899daaa47ea72da30390f616bd7e5781cc0ad8e3
7
- data.tar.gz: 949b717b13f2ac5f2c1e5627e79df7c99e0a3568c8c19b804a65056abf7a7d18d756cefd5149a9bf10bbf27d9c09f4764242aa98f870b814fe994a4e382c790c
6
+ metadata.gz: c41634573bbbbcfcb2e9cc2695a881aa74a3b9a35e948aa6fd88ef36a9a6b3666c4fe715daadf182ad86c3e037b0b90a6e1c0c1a995d2f7184cb96e9ed30196c
7
+ data.tar.gz: fbda5aabd791414a112a8fc50931c7177b4db0333c090b2407842ffc0a4b584039ed2540349ab070d426bf3437508f7f41b57027dfa7dcc316a8a47bf1edd3ff
@@ -5,7 +5,7 @@ The AdvancedTable Kit's `tableData` prop consumes the data that will render the
5
5
  Here is the data structure being used within the kits doc examples:
6
6
 
7
7
  ```
8
- MOCK_DATA = [
8
+ const MOCK_DATA = [
9
9
  {
10
10
  year: "2021",
11
11
  quarter: null,
@@ -110,8 +110,85 @@ MOCK_DATA = [
110
110
  classCompletionRate: "45%",
111
111
  graduatedStudents: "32",
112
112
  children: [
113
- //similar to chldren above
114
- ]
113
+ {
114
+ year: "2022",
115
+ quarter: "Q1",
116
+ month: null,
117
+ day: null,
118
+ newEnrollments: "2",
119
+ scheduledMeetings: "35",
120
+ attendanceRate: "32%",
121
+ completedClasses: "15",
122
+ classCompletionRate: "52%",
123
+ graduatedStudents: "36",
124
+ children: [
125
+ {
126
+ year: "2022",
127
+ quarter: "Q1",
128
+ month: "January",
129
+ day: null,
130
+ newEnrollments: "16",
131
+ scheduledMeetings: "20",
132
+ attendanceRate: "11%",
133
+ completedClasses: "13",
134
+ classCompletionRate: "47%",
135
+ graduatedStudents: "28",
136
+ children: [
137
+ {
138
+ year: "2022",
139
+ quarter: "Q1",
140
+ month: "January",
141
+ day: "15",
142
+ newEnrollments: "34",
143
+ scheduledMeetings: "28",
144
+ attendanceRate: "97%",
145
+ completedClasses: "20",
146
+ classCompletionRate: "15%",
147
+ graduatedStudents: "17",
148
+ },
149
+ {
150
+ year: "2022",
151
+ quarter: "Q1",
152
+ month: "January",
153
+ day: "25",
154
+ newEnrollments: "43",
155
+ scheduledMeetings: "23",
156
+ attendanceRate: "66%",
157
+ completedClasses: "26",
158
+ classCompletionRate: "47%",
159
+ graduatedStudents: "9",
160
+ },
161
+ ],
162
+ },
163
+ {
164
+ year: "2022",
165
+ quarter: "Q1",
166
+ month: "May",
167
+ day: null,
168
+ newEnrollments: "20",
169
+ scheduledMeetings: "41",
170
+ attendanceRate: "95%",
171
+ completedClasses: "26",
172
+ classCompletionRate: "83%",
173
+ graduatedStudents: "43",
174
+ children: [
175
+ {
176
+ year: "2011",
177
+ quarter: "Q1",
178
+ month: "May",
179
+ day: "2",
180
+ newEnrollments: "19",
181
+ scheduledMeetings: "35",
182
+ attendanceRate: "69%",
183
+ completedClasses: "8",
184
+ classCompletionRate: "75%",
185
+ graduatedStudents: "23",
186
+ },
187
+ ],
188
+ },
189
+ ],
190
+ },
191
+ ],
115
192
  },
116
193
  {
117
194
  year: "2023",
@@ -125,9 +202,87 @@ MOCK_DATA = [
125
202
  classCompletionRate: "49%",
126
203
  graduatedStudents: "29",
127
204
  children: [
128
- //similar to children above
205
+ {
206
+ year: "2023",
207
+ quarter: "Q1",
208
+ month: null,
209
+ day: null,
210
+ newEnrollments: "2",
211
+ scheduledMeetings: "35",
212
+ attendanceRate: "32%",
213
+ completedClasses: "15",
214
+ classCompletionRate: "52%",
215
+ graduatedStudents: "36",
216
+ children: [
217
+ {
218
+ year: "2023",
219
+ quarter: "Q1",
220
+ month: "March",
221
+ day: null,
222
+ newEnrollments: "16",
223
+ scheduledMeetings: "20",
224
+ attendanceRate: "11%",
225
+ completedClasses: "13",
226
+ classCompletionRate: "47%",
227
+ graduatedStudents: "28",
228
+ children: [
229
+ {
230
+ year: "2023",
231
+ quarter: "Q1",
232
+ month: "March",
233
+ day: "10",
234
+ newEnrollments: "34",
235
+ scheduledMeetings: "28",
236
+ attendanceRate: "97%",
237
+ completedClasses: "20",
238
+ classCompletionRate: "15%",
239
+ graduatedStudents: "17",
240
+ },
241
+ {
242
+ year: "2023",
243
+ quarter: "Q1",
244
+ month: "March",
245
+ day: "11",
246
+ newEnrollments: "43",
247
+ scheduledMeetings: "23",
248
+ attendanceRate: "66%",
249
+ completedClasses: "26",
250
+ classCompletionRate: "47%",
251
+ graduatedStudents: "9",
252
+ },
253
+ ],
254
+ },
255
+ {
256
+ year: "2023",
257
+ quarter: "Q1",
258
+ month: "April",
259
+ day: null,
260
+ newEnrollments: "20",
261
+ scheduledMeetings: "41",
262
+ attendanceRate: "95%",
263
+ completedClasses: "26",
264
+ classCompletionRate: "83%",
265
+ graduatedStudents: "43",
266
+ children: [
267
+ {
268
+ year: "2023",
269
+ quarter: "Q1",
270
+ month: "April",
271
+ day: "15",
272
+ newEnrollments: "19",
273
+ scheduledMeetings: "35",
274
+ attendanceRate: "69%",
275
+ completedClasses: "8",
276
+ classCompletionRate: "75%",
277
+ graduatedStudents: "23",
278
+ },
279
+ ],
280
+ },
281
+ ],
282
+ },
129
283
  ],
130
284
  },
131
285
  ];
132
286
 
287
+
133
288
  ```
@@ -1,6 +1,6 @@
1
1
  The AdvancedTable kit takes the table data and automatically renders expandable subrows for nested items to any depth needed. In it's simplest form, the kit has two required props:
2
2
 
3
- `tableData` is the data that the kit needs to consume to render the table. This data will take the structure of an array of objects where each object will be rendered as a row with the key/value pairs being the column values. If an object within that data has children, the kit will automatically create subRows with icon buttons on the parent rows to toggle the subRows open or closed. The toggleExpansionAll button in the first column header can also be used to toggle expansion for the top level parent rows. For a visual of the data structure needed for `tableData`, see [here](https://github.com/powerhome/playbook/blob/1b2481c06137d2bc63031a1120c1bd4d01bfd9ec/playbook/app/pb_kits/playbook/pb_advanced_table/README.md).
3
+ `tableData` is the data that the kit needs to consume to render the table. This data will take the structure of an array of objects where each object will be rendered as a row with the key/value pairs being the column values. If an object within that data has children, the kit will automatically create subRows with icon buttons on the parent rows to toggle the subRows open or closed. The toggleExpansionAll button in the first column header can also be used to toggle expansion for the top level parent rows. For a visual of the data structure needed for `tableData`, see [here](https://github.com/powerhome/playbook/blob/PBNTR-177-New-Advanced-Table-Kit/playbook/app/pb_kits/playbook/pb_advanced_table/README.md).
4
4
 
5
5
 
6
6
  `columnDefinitions` maps to the columns prop on the Tanstack table. Column definitions are the single most important part of building a table as they are responsible for building the underlying data model that is used for all sorting, expansion, etc. `ColumnDefinitions` in the AdvancedTable kit is a array of objects as seen in the code snippet below. Each object within the array has two REQUIRED items:
@@ -1,6 +1,6 @@
1
1
  examples:
2
2
  react:
3
3
  - advanced_table_default: Default
4
- - advanced_table_sort: All in One
4
+ # - advanced_table_sort: enableSorting
5
5
 
6
6
 
@@ -20,6 +20,7 @@ type TableProps = {
20
20
  singleLine?: boolean,
21
21
  size?: "sm" | "md" | "lg",
22
22
  sticky?: boolean,
23
+ striped?: boolean,
23
24
  verticalBorder?: boolean,
24
25
  } & GlobalProps
25
26
 
@@ -40,6 +41,7 @@ const Table = (props: TableProps) => {
40
41
  singleLine = false,
41
42
  size = 'sm',
42
43
  sticky = false,
44
+ striped = false,
43
45
  verticalBorder = false,
44
46
  } = props
45
47
 
@@ -70,6 +72,7 @@ const Table = (props: TableProps) => {
70
72
  'single-line': singleLine,
71
73
  'no-hover': disableHover,
72
74
  'sticky-header': sticky,
75
+ 'striped': striped,
73
76
  },
74
77
  globalProps(props),
75
78
  tableCollapseCss,
@@ -0,0 +1,48 @@
1
+ <%= pb_rails("table", props: { striped: true }) do %>
2
+ <thead>
3
+ <tr>
4
+ <th>Column 1</th>
5
+ <th>Column 2</th>
6
+ <th>Column 3</th>
7
+ <th>Column 4</th>
8
+ <th>Column 5</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <tr>
13
+ <td>Value 1</td>
14
+ <td>Value 2</td>
15
+ <td>Value 3</td>
16
+ <td>Value 4</td>
17
+ <td>Value 5</td>
18
+ </tr>
19
+ <tr>
20
+ <td>Value 1</td>
21
+ <td>Value 2</td>
22
+ <td>Value 3</td>
23
+ <td>Value 4</td>
24
+ <td>Value 5</td>
25
+ </tr>
26
+ <tr>
27
+ <td>Value 1</td>
28
+ <td>Value 2</td>
29
+ <td>Value 3</td>
30
+ <td>Value 4</td>
31
+ <td>Value 5</td>
32
+ </tr>
33
+ <tr>
34
+ <td>Value 1</td>
35
+ <td>Value 2</td>
36
+ <td>Value 3</td>
37
+ <td>Value 4</td>
38
+ <td>Value 5</td>
39
+ </tr>
40
+ <tr>
41
+ <td>Value 1</td>
42
+ <td>Value 2</td>
43
+ <td>Value 3</td>
44
+ <td>Value 4</td>
45
+ <td>Value 5</td>
46
+ </tr>
47
+ </tbody>
48
+ <% end %>
@@ -0,0 +1,58 @@
1
+ import React from "react"
2
+ import Table from "../_table"
3
+
4
+ const TableStriped = (props) => (
5
+ <Table
6
+ striped
7
+ {...props}
8
+ >
9
+ <thead>
10
+ <tr>
11
+ <th>{'Column 1'}</th>
12
+ <th>{'Column 2'}</th>
13
+ <th>{'Column 3'}</th>
14
+ <th>{'Column 4'}</th>
15
+ <th>{'Column 5'}</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <tr>
20
+ <td>{'Value 1'}</td>
21
+ <td>{'Value 2'}</td>
22
+ <td>{'Value 3'}</td>
23
+ <td>{'Value 4'}</td>
24
+ <td>{'Value 5'}</td>
25
+ </tr>
26
+ <tr>
27
+ <td>{'Value 1'}</td>
28
+ <td>{'Value 2'}</td>
29
+ <td>{'Value 3'}</td>
30
+ <td>{'Value 4'}</td>
31
+ <td>{'Value 5'}</td>
32
+ </tr>
33
+ <tr>
34
+ <td>{'Value 1'}</td>
35
+ <td>{'Value 2'}</td>
36
+ <td>{'Value 3'}</td>
37
+ <td>{'Value 4'}</td>
38
+ <td>{'Value 5'}</td>
39
+ </tr>
40
+ <tr>
41
+ <td>{'Value 1'}</td>
42
+ <td>{'Value 2'}</td>
43
+ <td>{'Value 3'}</td>
44
+ <td>{'Value 4'}</td>
45
+ <td>{'Value 5'}</td>
46
+ </tr>
47
+ <tr>
48
+ <td>{'Value 1'}</td>
49
+ <td>{'Value 2'}</td>
50
+ <td>{'Value 3'}</td>
51
+ <td>{'Value 4'}</td>
52
+ <td>{'Value 5'}</td>
53
+ </tr>
54
+ </tbody>
55
+ </Table>
56
+ )
57
+
58
+ export default TableStriped
@@ -0,0 +1 @@
1
+ Optionally pass the `striped` (boolean, defaults to false) prop to set odd rows to a contrasting background color. This helps with readability on larger tables with lots of data.
@@ -23,6 +23,7 @@ examples:
23
23
  - table_icon_buttons: Table with Icon Buttons
24
24
  - table_with_background_kit: Table With Background Kit
25
25
  - table_vertical_border: Vertical Borders
26
+ - table_striped: Striped Table
26
27
 
27
28
  react:
28
29
  - table_sm: Small
@@ -47,3 +48,4 @@ examples:
47
48
  - table_icon_buttons: Table with Icon Buttons
48
49
  - table_with_background_kit: Table With Background Kit
49
50
  - table_vertical_border: Vertical Borders
51
+ - table_striped: Striped Table
@@ -20,3 +20,4 @@ export { default as TableAlignmentShiftRow } from './_table_alignment_shift_row.
20
20
  export { default as TableAlignmentShiftData } from './_table_alignment_shift_data.jsx'
21
21
  export { default as TableWithBackgroundKit } from './_table_with_background_kit.jsx'
22
22
  export { default as TableVerticalBorder } from './_table_vertical_border.jsx'
23
+ export { default as TableStriped } from './_table_striped.jsx'
@@ -18,3 +18,4 @@
18
18
  @import "sticky_header";
19
19
  @import "vertical_border";
20
20
  @import "table_header";
21
+ @import "striped";
@@ -0,0 +1,19 @@
1
+ [class^=pb_table] {
2
+ &.striped {
3
+ tbody {
4
+ tr:nth-child(odd) {
5
+ background-color: $bg_light;
6
+ }
7
+ }
8
+ }
9
+
10
+ &.dark {
11
+ &.striped {
12
+ tbody {
13
+ tr:nth-child(odd) {
14
+ background-color: $bg_dark;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -25,12 +25,14 @@ module Playbook
25
25
  default: false
26
26
  prop :vertical_border, type: Playbook::Props::Boolean,
27
27
  default: false
28
+ prop :striped, type: Playbook::Props::Boolean,
29
+ default: false
28
30
 
29
31
  def classname
30
32
  generate_classname(
31
33
  "pb_table", "table-#{size}", single_line_class, dark_class,
32
34
  disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
33
- vertical_border_class, "table-responsive-#{responsive}", separator: " "
35
+ vertical_border_class, striped_class, "table-responsive-#{responsive}", separator: " "
34
36
  )
35
37
  end
36
38
 
@@ -64,6 +66,10 @@ module Playbook
64
66
  sticky ? "sticky-header" : nil
65
67
  end
66
68
 
69
+ def striped_class
70
+ striped ? "striped" : nil
71
+ end
72
+
67
73
  def vertical_border_class
68
74
  vertical_border ? "vertical-border" : nil
69
75
  end
@@ -15,3 +15,8 @@ test("when sticky is true", () => {
15
15
  const kit = renderKit(Table, props, { sticky: true })
16
16
  expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card sticky-header table-collapse-sm")
17
17
  })
18
+
19
+ test("when striped is true", () => {
20
+ const kit = renderKit(Table, props, { striped: true })
21
+ expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card striped table-collapse-sm")
22
+ })
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "13.16.0"
5
- VERSION = "13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2035"
5
+ VERSION = "13.16.0.pre.alpha.PBNTR181stripedtable2103"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2035
4
+ version: 13.16.0.pre.alpha.PBNTR181stripedtable2103
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-30 00:00:00.000000000 Z
12
+ date: 2024-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -2249,6 +2249,9 @@ files:
2249
2249
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb
2250
2250
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx
2251
2251
  - app/pb_kits/playbook/pb_table/docs/_table_sticky.md
2252
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.html.erb
2253
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.jsx
2254
+ - app/pb_kits/playbook/pb_table/docs/_table_striped.md
2252
2255
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.html.erb
2253
2256
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx
2254
2257
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.md
@@ -2274,6 +2277,7 @@ files:
2274
2277
  - app/pb_kits/playbook/pb_table/styles/_side_highlight.scss
2275
2278
  - app/pb_kits/playbook/pb_table/styles/_single-line.scss
2276
2279
  - app/pb_kits/playbook/pb_table/styles/_sticky_header.scss
2280
+ - app/pb_kits/playbook/pb_table/styles/_striped.scss
2277
2281
  - app/pb_kits/playbook/pb_table/styles/_structure.scss
2278
2282
  - app/pb_kits/playbook/pb_table/styles/_table-card.scss
2279
2283
  - app/pb_kits/playbook/pb_table/styles/_table-dark.scss