playbook_ui 14.10.0.pre.rc.16 → 14.10.0.pre.rc.18

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: 6128cc7c07aea481935c7689e2d8d124f53225db5fdf65cb120736fa836f5d62
4
- data.tar.gz: b2f32dae124fc001f0e5f3063b48a1c54d8f7561331836714a833ab04f9f71ab
3
+ metadata.gz: 057da55d90c93598787796c2c64b565dd6410aa974406a65d7df82b9528dd489
4
+ data.tar.gz: 13660184146eb30b551fe9e69638cecf14ded4abda9dfd9f92c14a9f93d4d41b
5
5
  SHA512:
6
- metadata.gz: b26a21a2da0b7e3eb2b6b3f95f3b5135a48cb98db28519caee053542f016a76b11b05d4fd83c487d572d00845c13dcac2f8da95602190e1d07c455ad6559410a
7
- data.tar.gz: fea15db5a0bf2ce51fcb5e74683d782900a3432b35c6ca177b957e7dbfc6ac2cb363ba5cb2c8083bc03f1cb62963dd9802b55756eca9ff91e262fbeec00ffbe2
6
+ metadata.gz: 6f3b48f03c998a0f10f4976cec5319efe86ab32f6d2b9b02f43fc40d5f0cd4f41a3634c1da93e1ca451ba1d697de6e7063ed2b192b011aed9de25f1840958341
7
+ data.tar.gz: c339943f7409425a921a363e01d09d97973853583cb23e871ffb1ea1e7aa8f1f3de8c379117897c015ff0b25d3ba6ac8ff7a38196f6891dc2899db55da3cd07b
@@ -3,18 +3,13 @@ import React from "react"
3
3
  //CollapsibleTrail component
4
4
  const CollapsibleTrail = ({ leftOffset }: { leftOffset: number }) => {
5
5
  const style: { [key: string]: string | number } = {
6
- position: "absolute",
7
6
  left: `${leftOffset}em`,
8
- top: 0,
9
- bottom: 0,
10
- width: "2px",
11
- backgroundColor: "#E4E8F0",
12
7
  }
13
8
 
14
9
  return (
15
10
  <div
16
11
  className="collapsible-trail"
17
- style={style}
12
+ style={style}
18
13
  />
19
14
  )
20
15
  }
@@ -110,6 +110,14 @@
110
110
  height: auto;
111
111
  }
112
112
 
113
+ .collapsible-trail {
114
+ background-color: $border_light;
115
+ position: absolute;
116
+ top: 0;
117
+ bottom: 0;
118
+ width: 2px;
119
+ }
120
+
113
121
  // Responsive Styles
114
122
  @media only screen and (max-width: $screen-xl-min) {
115
123
  &[class*="table-responsive-scroll"] {
@@ -0,0 +1,36 @@
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
+ <%= pb_rails("advanced_table", props: { id: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions }) do %>
34
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
35
+ <%= pb_rails("advanced_table/table_body", props: { table_data: @table_data, column_definitions: column_definitions, collapsible_trail: false }) %>
36
+ <% end %>
@@ -0,0 +1 @@
1
+ `collapsible_trail` is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of the rows when subRows are toggled open.
@@ -2,6 +2,7 @@ examples:
2
2
  rails:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
+ - advanced_table_collapsible_trail_rails: Collapsible Trail
5
6
  - advanced_table_beta_sort: Enable Sorting
6
7
  - advanced_table_custom_cell_rails: Custom Components for Cells
7
8
 
@@ -14,14 +14,16 @@ module Playbook
14
14
  default: "header"
15
15
  prop :subrow_headers, type: Playbook::Props::Array,
16
16
  default: []
17
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
18
+ default: true
17
19
 
18
20
  def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
19
21
  output = ActiveSupport::SafeBuffer.new
20
22
  is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
21
23
 
22
- output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1] }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
24
+ output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
23
25
 
24
- output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth })
26
+ output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth, collapsible_trail: collapsible_trail })
25
27
 
26
28
  if row[:children].present?
27
29
  output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
@@ -2,6 +2,14 @@
2
2
  <% object.column_definitions.each_with_index do |column, index| %>
3
3
  <%= pb_rails("table/table_cell", props: { tag:"div", classname:object.td_classname}) do %>
4
4
  <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
5
+ <% if collapsible_trail && index.zero? %>
6
+ <% (1..depth).each do |i| %>
7
+ <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
8
+ <% left_offset = i * 1.0 + additional_offset %>
9
+ <div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
10
+ <% end %>
11
+ <% end %>
12
+
5
13
  <div style="padding-left: <%= depth * 1.25 %>em">
6
14
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
7
15
  <% if index.zero? && object.row[:children].present? %>
@@ -9,6 +9,8 @@ module Playbook
9
9
  default: []
10
10
  prop :row
11
11
  prop :depth
12
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
13
+ default: true
12
14
 
13
15
  def classname
14
16
  generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
@@ -6,6 +6,14 @@
6
6
  <% object.column_definitions.each_with_index do |column, index| %>
7
7
  <%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
8
8
  <%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
9
+ <% if collapsible_trail && index.zero? %>
10
+ <% (1..depth).each do |i| %>
11
+ <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
12
+ <% left_offset = i * 1.0 + additional_offset %>
13
+ <div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
14
+ <% end %>
15
+ <% end %>
16
+
9
17
  <div style="padding-left: <%= depth * 1.25 %>em">
10
18
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
11
19
  <% if index.zero? && object.row[:children].present? %>
@@ -12,6 +12,8 @@ module Playbook
12
12
  default: "header"
13
13
  prop :subrow_header, type: Playbook::Props::String,
14
14
  default: ""
15
+ prop :collapsible_trail, type: Playbook::Props::Boolean,
16
+ default: true
15
17
 
16
18
  def classname
17
19
  generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
@@ -287,7 +287,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
287
287
  {...ariaProps}
288
288
  {...dataProps}
289
289
  {...htmlProps}
290
- style={dynamicInlineProps}
291
290
  className={classnames(drawerClassNames.base, {
292
291
  [drawerClassNames.afterOpen]:
293
292
  animationState === "afterOpen",
@@ -296,6 +295,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
296
295
  })}
297
296
  id={id}
298
297
  onClick={(e) => e.stopPropagation()}
298
+ style={dynamicInlineProps}
299
299
  >
300
300
  {children}
301
301
  </div>
@@ -306,7 +306,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
306
306
  {...dataProps}
307
307
  {...htmlProps}
308
308
  className={classes}
309
- style={dynamicInlineProps}
310
309
  >
311
310
  {isModalVisible && (
312
311
  <div
@@ -327,6 +326,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
327
326
  animationState === "beforeClose",
328
327
  })}
329
328
  onClick={(e) => e.stopPropagation()}
329
+ style={dynamicInlineProps}
330
330
  >
331
331
  {children}
332
332
  </div>
@@ -24,34 +24,37 @@ type LayoutPropTypes = {
24
24
  type LayoutSideProps = {
25
25
  children: React.ReactNode[] | React.ReactNode,
26
26
  className?: string,
27
- }
27
+ } & GlobalProps
28
28
 
29
29
  type LayoutBodyProps = {
30
30
  children: React.ReactNode[] | React.ReactNode,
31
31
  className?: string,
32
- }
32
+ } & GlobalProps
33
33
 
34
34
  type LayoutItemProps = {
35
35
  children: React.ReactNode[] | React.ReactNode,
36
36
  className?: string,
37
37
  size?: "sm" | "md" | "lg"
38
- }
38
+ } & GlobalProps
39
39
 
40
40
  type LayoutHeaderProps = {
41
41
  children: React.ReactNode[] | React.ReactNode,
42
42
  className?: string,
43
- }
43
+ } & GlobalProps
44
44
 
45
45
  type LayoutFooterProps = {
46
46
  children: React.ReactNode[] | React.ReactNode,
47
47
  className?: string,
48
- }
48
+ } & GlobalProps
49
49
 
50
- // Side component
51
50
  const Side = (props: LayoutSideProps) => {
52
51
  const { children, className } = props
52
+ const dynamicInlineProps = globalInlineProps(props)
53
53
  return (
54
- <div className={classnames('layout_sidebar', globalProps(props), className)}>
54
+ <div
55
+ className={classnames('layout_sidebar', globalProps(props), className)}
56
+ style={dynamicInlineProps}
57
+ >
55
58
  {children}
56
59
  </div>
57
60
  )
@@ -60,8 +63,12 @@ const Side = (props: LayoutSideProps) => {
60
63
  // Body component
61
64
  const Body = (props: LayoutBodyProps) => {
62
65
  const { children, className } = props
66
+ const dynamicInlineProps = globalInlineProps(props)
63
67
  return (
64
- <div className={classnames('layout_body', globalProps(props), className)}>
68
+ <div
69
+ className={classnames('layout_body', globalProps(props), className)}
70
+ style={dynamicInlineProps}
71
+ >
65
72
  {children}
66
73
  </div>
67
74
  )
@@ -71,8 +78,12 @@ const Body = (props: LayoutBodyProps) => {
71
78
  const Item = (props: LayoutItemProps) => {
72
79
  const { children, className, size = 'sm' } = props
73
80
  const sizeClass = `size_${size}`
81
+ const dynamicInlineProps = globalInlineProps(props)
74
82
  return (
75
- <div className={classnames('layout_item', sizeClass, globalProps(props), className)}>
83
+ <div
84
+ className={classnames('layout_item', sizeClass, globalProps(props), className)}
85
+ style={dynamicInlineProps}
86
+ >
76
87
  {children}
77
88
  </div>
78
89
  )
@@ -81,8 +92,12 @@ const Item = (props: LayoutItemProps) => {
81
92
  // Header component
82
93
  const Header = (props: LayoutHeaderProps) => {
83
94
  const { children, className } = props
95
+ const dynamicInlineProps = globalInlineProps(props)
84
96
  return (
85
- <div className={classnames('layout_header', globalProps(props), className)}>
97
+ <div
98
+ className={classnames('layout_header', globalProps(props), className)}
99
+ style={dynamicInlineProps}
100
+ >
86
101
  {children}
87
102
  </div>
88
103
  )
@@ -91,8 +106,12 @@ const Header = (props: LayoutHeaderProps) => {
91
106
  // Footer component
92
107
  const Footer = (props: LayoutFooterProps) => {
93
108
  const { children, className } = props
109
+ const dynamicInlineProps = globalInlineProps(props)
94
110
  return (
95
- <div className={classnames('layout_footer', globalProps(props), className)}>
111
+ <div
112
+ className={classnames('layout_footer', globalProps(props), className)}
113
+ style={dynamicInlineProps}
114
+ >
96
115
  {children}
97
116
  </div>
98
117
  )