playbook_ui 14.17.0.pre.alpha.PLAY1967bracketlayoutphase27244 → 14.17.0.pre.alpha.PLAY20267223

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +23 -3
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +11 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +60 -128
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +3 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.jsx +58 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_columns.md +6 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +97 -0
  11. data/app/pb_kits/playbook/pb_background/_background.scss +0 -26
  12. data/app/pb_kits/playbook/pb_background/_background.tsx +3 -5
  13. data/app/pb_kits/playbook/pb_background/background.test.js +0 -5
  14. data/app/pb_kits/playbook/pb_background/docs/example.yml +0 -1
  15. data/app/pb_kits/playbook/pb_background/docs/index.js +0 -1
  16. data/app/pb_kits/playbook/pb_layout/_layout.scss +1 -70
  17. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -29
  18. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +118 -322
  19. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
  20. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +43 -74
  21. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +4 -21
  22. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  23. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
  24. data/app/pb_kits/playbook/pb_table/table.rb +1 -13
  25. data/app/pb_kits/playbook/pb_table/table_header.rb +1 -13
  26. data/dist/chunks/{_typeahead-BY6AFq1l.js → _typeahead-HqfDnjRe.js} +2 -2
  27. data/dist/chunks/_weekday_stacked-CPNaHtxQ.js +45 -0
  28. data/dist/chunks/vendor.js +1 -1
  29. data/dist/playbook-doc.js +1 -1
  30. data/dist/playbook-rails-react-bindings.js +1 -1
  31. data/dist/playbook-rails.js +1 -1
  32. data/dist/playbook.css +1 -1
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +7 -11
  35. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +0 -35
  36. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +0 -1
  37. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +0 -79
  38. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +0 -34
  39. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +0 -1
  40. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +0 -36
  41. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +0 -1
  42. data/dist/chunks/_weekday_stacked-CHQAKYTa.js +0 -45
@@ -5,110 +5,79 @@ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/glo
5
5
 
6
6
  import Card from '../../pb_card/_card'
7
7
  import SectionSeparator from '../../pb_section_separator/_section_separator'
8
- import Body from '../../pb_body/_body'
9
- import Flex from '../../pb_flex/_flex'
10
8
 
11
9
  type LayoutGameProps = {
12
10
  children: React.ReactNode[] | React.ReactNode,
13
11
  className?: string,
14
12
  numberOfRounds: number,
15
13
  numberOfGames: number,
16
- lastRoundWithSelf?: number,
17
14
  isOdd: boolean,
18
15
  } & GlobalProps
19
16
 
20
17
  // Game component (modeled after Item)
21
18
  const Game = (props: LayoutGameProps) => {
22
- const { children, className, numberOfRounds, numberOfGames, isOdd, lastRoundWithSelf } = props
19
+ const { children, className, numberOfRounds, numberOfGames, isOdd } = props
23
20
  const dynamicInlineProps = globalInlineProps(props)
24
-
21
+
25
22
  const numberOfChildren = Array.isArray(children) ? children.length : 0
26
-
23
+
27
24
  const isMultiple = Array.isArray(children)
28
-
25
+
29
26
  let ratio = 0
30
27
  let exponent
31
- let currentRound = numberOfRounds
32
28
  if (numberOfGames > 1) {
33
29
  exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
34
30
  ratio = 2 ** exponent
35
-
36
- currentRound = exponent + 1
37
31
  }
38
-
39
- let hasWinner = false
40
- const hasLastWinnerAndSelf = lastRoundWithSelf === currentRound
32
+
41
33
  if (numberOfChildren === 2) {
42
- const [firstChildWithoutProps, secondChildWithoutProps] = React.Children.toArray(children)
43
-
44
- const firstChild = React.isValidElement(firstChildWithoutProps) ? React.cloneElement(firstChildWithoutProps, { hasLastWinnerAndSelf }) : firstChildWithoutProps
45
- const secondChild = React.isValidElement(secondChildWithoutProps) ? React.cloneElement(secondChildWithoutProps, { hasLastWinnerAndSelf }) : secondChildWithoutProps
46
-
47
- if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
48
- if (
49
- firstChild?.props && typeof firstChild.props === 'object' && 'winner' in firstChild.props ||
50
- secondChild?.props && typeof secondChild.props === 'object' && 'winner' in secondChild.props
51
- ) {
52
- hasWinner = true
53
- }
54
- return (
55
- <div
56
- className={classnames('layout_game', globalProps(props), className)}
57
- style={dynamicInlineProps}
34
+ const [firstChild, secondChild] = React.Children.toArray(children)
35
+
36
+ if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
37
+ return (
38
+ <div
39
+ className={classnames('layout_game', globalProps(props), className)}
40
+ style={dynamicInlineProps}
41
+ >
42
+ <Card
43
+ marginY="xs"
44
+ padding="none"
45
+ shadow="deep"
58
46
  >
59
- <Card
60
- marginY="xs"
61
- overflow="hidden"
62
- padding="none"
63
- shadow="deep"
64
- >
65
- <Card.Body padding="none">{firstChild}</Card.Body>
66
- <SectionSeparator className="game_separator"/>
67
- <Card.Body padding="none">{secondChild}</Card.Body>
68
- </Card>
69
- {isOdd && numberOfGames > 1 &&
70
- <div
71
- className="half_box"
72
- style={{ height: `calc(${ratio} * 100% + 4px)` }}
73
- />
74
- }
75
- {numberOfGames > 1 && hasWinner &&
76
- <div className="polygon_node" />
77
- }
78
- </div>
47
+ <Card.Body padding="xs">{firstChild}</Card.Body>
48
+ <SectionSeparator />
49
+ <Card.Body padding="xs">{secondChild}</Card.Body>
50
+ </Card>
51
+ {isOdd && numberOfGames > 1 &&
52
+ <div
53
+ className="half_box"
54
+ style={{ height: `calc(${ratio} * 100% + 4px)` }}
55
+ />
56
+ }
57
+ </div>
79
58
  )
80
59
  }
81
60
  }
82
-
61
+
83
62
  return (
84
63
  <div
85
64
  className={classnames('layout_game', globalProps(props), className)}
86
65
  style={dynamicInlineProps}
87
66
  >
88
- {((!isMultiple && children) || numberOfChildren >= 1) ? (
89
- children
90
- ) : (
91
- <div className="layout_tbd">
92
- <Card
93
- marginY="xs"
94
- padding="none"
95
- shadow="deep"
96
- >
97
- <Card.Body padding="xs">
98
- <Body color="light">
99
- To be determined...
100
- </Body>
101
- </Card.Body>
102
- <SectionSeparator className="game_separator"/>
103
- <Card.Body padding="xs">
104
- <Body color="light">
105
- To be determined...
106
- </Body>
107
- </Card.Body>
108
- </Card>
109
- </div>
110
- )}
111
- {isOdd && numberOfGames > 1 &&
67
+ {((!isMultiple && children) || numberOfChildren >= 1 )? (
68
+ children
69
+ ) : (
70
+ <Card
71
+ marginY="xs"
72
+ padding="none"
73
+ shadow="deep"
74
+ >
75
+ <Card.Body padding="xs">To be determined...</Card.Body>
76
+ <SectionSeparator />
77
+ <Card.Body padding="xs">To be determined...</Card.Body>
78
+ </Card>
79
+ )}
80
+ {isOdd && numberOfGames > 1 &&
112
81
  <div
113
82
  className="half_box"
114
83
  style={{ height: `calc(${ratio} * 100% + 4px)` }}
@@ -25,33 +25,16 @@ type LayoutRoundProps = {
25
25
  children: React.ReactNode[] | React.ReactNode,
26
26
  className?: string,
27
27
  numberOfRounds: number,
28
- lastRoundWithSelf: number,
29
28
  } & GlobalProps
30
29
 
31
30
  export const Round = (props: LayoutRoundProps) => {
32
- const { children, className, numberOfRounds, lastRoundWithSelf } = props
31
+ const { children, className, numberOfRounds } = props
33
32
  const dynamicInlineProps = globalInlineProps(props)
34
33
  const numberOfChildren = Array.isArray(children) ? children.length : 0
35
34
 
36
- const childrenWithProps = Array.isArray(children)
37
- ? children.map((child, index) =>
38
- React.isValidElement(child)
39
- ? React.cloneElement(child, {
40
- numberOfRounds,
41
- numberOfGames: numberOfChildren,
42
- isOdd: index % 2 === 0,
43
- key: `child_${index}`,
44
- lastRoundWithSelf
45
- })
46
- : child
47
- )
48
- : React.isValidElement(children)
49
- ? React.cloneElement(children, {
50
- numberOfRounds,
51
- numberOfGames: numberOfChildren,
52
- lastRoundWithSelf
53
- })
54
- : children
35
+ const childrenWithProps = Array.isArray(children) ? children.map((child, index) =>
36
+ React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds, numberOfGames: numberOfChildren, isOdd: index % 2 === 0, key: `child_${index}` }) : child
37
+ ) : children
55
38
 
56
39
  const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
57
40
  <div
@@ -1 +1 @@
1
- Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/react#table-with-background-kit) logic to give your table header a custom background color. Use the `headerStyle="floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `backgroundColor` passed to Background kit should match the `background` or `backgroundColor` for the element in which it is nested).
1
+ Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/react#table-with-background-kit) logic to give your table header a custom background color. Use the `headerStyle="floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `backgroundColor` passed to Background kit should match the `backgroundColor` for the element in which it is nested).
@@ -37,8 +37,6 @@ examples:
37
37
  - table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
38
38
  - table_with_clickable_rows: Table with Clickable Rows
39
39
  - table_with_selectable_rows: Table with Selectable Rows
40
- - table_with_header_style_borderless: Header Style Borderless
41
- - table_with_header_style_floating: Header Style Floating
42
40
 
43
41
  react:
44
42
  - table_sm: Small
@@ -37,16 +37,13 @@ module Playbook
37
37
  prop :outer_padding, type: Playbook::Props::Enum,
38
38
  values: ["none", "xxs", "xs", "sm", "md", "lg", "xl", nil],
39
39
  default: nil
40
- prop :header_style, type: Playbook::Props::Enum,
41
- values: %w[default borderless floating],
42
- default: "default"
43
40
 
44
41
  def classname
45
42
  generate_classname(
46
43
  "pb_table", "table-#{size}", single_line_class, dark_class,
47
44
  disable_hover_class, container_class, data_table_class, sticky_class, sticky_left_column_class,
48
45
  sticky_right_column_class, collapse_class, vertical_border_class, striped_class, outer_padding_class,
49
- "table-responsive-#{responsive}", header_style_class, separator: " "
46
+ "table-responsive-#{responsive}", separator: " "
50
47
  )
51
48
  end
52
49
 
@@ -126,15 +123,6 @@ module Playbook
126
123
  outer_padding.present? ? "outer_padding_#{space_css_name}#{outer_padding}" : nil
127
124
  end
128
125
  end
129
-
130
- def header_style_class
131
- case header_style
132
- when "borderless"
133
- "header-borderless"
134
- when "floating"
135
- "header-floating"
136
- end
137
- end
138
126
  end
139
127
  end
140
128
  end
@@ -26,12 +26,9 @@ module Playbook
26
26
  prop :tag, type: Playbook::Props::Enum,
27
27
  values: %w[table div],
28
28
  default: "table"
29
- prop :header_style, type: Playbook::Props::Enum,
30
- values: %w[default borderless floating],
31
- default: "default"
32
29
 
33
30
  def classname
34
- generate_classname("pb_table_header_kit", align_class, header_style_class) + tag_class
31
+ generate_classname("pb_table_header_kit", align_class) + tag_class
35
32
  end
36
33
 
37
34
  def tag_class
@@ -109,15 +106,6 @@ module Playbook
109
106
  end
110
107
  active_item
111
108
  end
112
-
113
- def header_style_class
114
- case header_style
115
- when "borderless"
116
- "header-borderless"
117
- when "floating"
118
- "header-floating"
119
- end
120
- end
121
109
  end
122
110
  end
123
111
  end