playbook_ui 14.17.0.pre.alpha.PBNTR925railstablecustomheaders7163 → 14.17.0.pre.alpha.PLAY1967bracketlayoutphase27198

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
  3. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
  4. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
  5. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
  6. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
  7. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
  8. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
  9. data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
  10. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
  11. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
  12. data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
  13. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
  14. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
  15. data/app/pb_kits/playbook/pb_layout/_layout.scss +35 -0
  16. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -0
  17. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +318 -118
  18. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +1 -1
  19. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +58 -41
  20. data/app/pb_kits/playbook/pb_layout/subcomponents/_participant.tsx +73 -0
  21. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  22. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
  23. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
  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-7W5Ha5Td.js → _typeahead-DZZ1n1Oe.js} +2 -2
  27. data/dist/chunks/{_weekday_stacked-DSKatW3m.js → _weekday_stacked-P4lpbU7P.js} +2 -2
  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 +19 -20
  35. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +0 -34
  36. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +0 -1
  37. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +0 -36
  38. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +0 -1
  39. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
  40. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
  41. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
  42. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
  43. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
  44. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
  45. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
  46. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
  47. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
  48. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
  49. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -5,6 +5,7 @@ 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'
8
9
 
9
10
  type LayoutGameProps = {
10
11
  children: React.ReactNode[] | React.ReactNode,
@@ -18,66 +19,82 @@ type LayoutGameProps = {
18
19
  const Game = (props: LayoutGameProps) => {
19
20
  const { children, className, numberOfRounds, numberOfGames, isOdd } = props
20
21
  const dynamicInlineProps = globalInlineProps(props)
21
-
22
+
22
23
  const numberOfChildren = Array.isArray(children) ? children.length : 0
23
-
24
+
24
25
  const isMultiple = Array.isArray(children)
25
-
26
+
26
27
  let ratio = 0
27
28
  let exponent
28
29
  if (numberOfGames > 1) {
29
30
  exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
30
31
  ratio = 2 ** exponent
31
32
  }
32
-
33
+
34
+ let hasWinner = false
33
35
  if (numberOfChildren === 2) {
34
36
  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"
37
+
38
+ if (React.isValidElement(firstChild) && React.isValidElement(secondChild)) {
39
+ if ('winner' in firstChild.props || 'winner' in secondChild.props) {
40
+ hasWinner = true
41
+ }
42
+ return (
43
+ <div
44
+ className={classnames('layout_game', globalProps(props), className)}
45
+ style={dynamicInlineProps}
46
46
  >
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>
47
+ <Card
48
+ marginY="xs"
49
+ overflow="hidden"
50
+ padding="none"
51
+ shadow="deep"
52
+ >
53
+ <Card.Body padding="none">{firstChild}</Card.Body>
54
+ <SectionSeparator />
55
+ <Card.Body padding="none">{secondChild}</Card.Body>
56
+ </Card>
57
+ {isOdd && numberOfGames > 1 &&
58
+ <div
59
+ className="half_box"
60
+ style={{ height: `calc(${ratio} * 100% + 4px)` }}
61
+ />
62
+ }
63
+ {numberOfGames > 1 && hasWinner &&
64
+ <div className="polygon_node" />
65
+ }
66
+ </div>
58
67
  )
59
68
  }
60
69
  }
61
-
70
+
62
71
  return (
63
72
  <div
64
73
  className={classnames('layout_game', globalProps(props), className)}
65
74
  style={dynamicInlineProps}
66
75
  >
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 &&
76
+ {((!isMultiple && children) || numberOfChildren >= 1) ? (
77
+ children
78
+ ) : (
79
+ <Card
80
+ marginY="xs"
81
+ padding="none"
82
+ shadow="deep"
83
+ >
84
+ <Card.Body padding="xs">
85
+ <Body color="lighter">
86
+ To be determined...
87
+ </Body>
88
+ </Card.Body>
89
+ <SectionSeparator />
90
+ <Card.Body padding="xs">
91
+ <Body color="lighter">
92
+ To be determined...
93
+ </Body>
94
+ </Card.Body>
95
+ </Card>
96
+ )}
97
+ {isOdd && numberOfGames > 1 &&
81
98
  <div
82
99
  className="half_box"
83
100
  style={{ height: `calc(${ratio} * 100% + 4px)` }}
@@ -0,0 +1,73 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { buildCss } from '../../utilities/props'
5
+ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
6
+
7
+ import Avatar from "../../pb_avatar/_avatar";
8
+ import Body from "../../pb_body/_body";
9
+ import Flex from "../../pb_flex/_flex";
10
+ import Badge from "../../pb_badge/_badge";
11
+ import Detail from "../../pb_detail/_detail";
12
+ import Background from "../../pb_background/_background";
13
+
14
+ type LayoutParticipantProps = {
15
+ className?: string,
16
+ name?: string,
17
+ territory?: string,
18
+ points?: string,
19
+ rank?: string,
20
+ avatar?: string,
21
+ winner?: boolean,
22
+ self?: boolean,
23
+ } & GlobalProps
24
+
25
+ export const Participant = (props: LayoutParticipantProps) => {
26
+ const { className, name = 'To be determined...', territory = '', points, rank, avatar, winner, self } = props
27
+ const dynamicInlineProps = globalInlineProps(props)
28
+ const classes = classnames(buildCss('layout_participant', winner ? 'winner' : '', self ? 'self' : ''), globalProps(props), className)
29
+ return (
30
+ <Background
31
+ backgroundColor={winner ? "success_subtle" : "white"}
32
+ className={classes}
33
+ padding="xs"
34
+ style={dynamicInlineProps}
35
+ >
36
+ <Flex justify="between">
37
+ <Avatar
38
+ imageUrl={avatar}
39
+ marginRight="sm"
40
+ name={name}
41
+ size="sm"
42
+ />
43
+ <Body flexGrow={1}>
44
+ <Flex justify="between">
45
+ <Body color={winner ? "success" : "default"}>{winner ? <strong>{name}</strong> : name}{self ? ' (You)' : ''}</Body>
46
+ <Body
47
+ color={winner ? "success" : "light"}
48
+ display="flex"
49
+ >
50
+ {points && (<>
51
+ <strong>{points}</strong>
52
+ <Detail
53
+ color={winner ? "success" : "light"}
54
+ text="pts"
55
+ />
56
+ </>)}
57
+ </Body>
58
+ </Flex>
59
+ <Body color="light">
60
+ {territory}
61
+ &nbsp;
62
+ <Badge
63
+ text={rank}
64
+ variant={winner ? "success" : self ? "notification" : "neutral"}
65
+ />
66
+ </Body>
67
+ </Body>
68
+ </Flex>
69
+ </Background>
70
+ )
71
+ }
72
+
73
+ export default Participant
@@ -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
@@ -6,8 +6,20 @@
6
6
  &.table-lg {
7
7
  thead, .pb_table_thead {
8
8
  tr, .pb_table_tr {
9
- th, .pb_table_th {
9
+ th:not(:has(
10
+ [class*="pb_body_kit"],
11
+ [class*="pb_detail_kit"],
12
+ [class*="pb_title_kit"]
13
+ )),
14
+ .pb_table_th:not(:has(
15
+ [class*="pb_body_kit"],
16
+ [class*="pb_detail_kit"],
17
+ [class*="pb_title_kit"]
18
+ )) {
10
19
  @include caption;
20
+ }
21
+
22
+ th, .pb_table_th {
11
23
  border-bottom: 1px solid $border_light;
12
24
  }
13
25
  }
@@ -83,10 +95,10 @@
83
95
 
84
96
  // flatten out corners for floating headerstyle variant to avoid small triangle of white/empty space
85
97
  .header-floating > thead > tr:first-child > th:first-child,
86
- .header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:first-child {
87
- border-top-left-radius: 0 !important;
88
- }
89
- .header-floating > thead > tr:first-child > th:last-child,
90
- .header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:last-child {
91
- border-top-right-radius: 0 !important;
98
+ .header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:first-child {
99
+ border-top-left-radius: 0 !important;
100
+ }
101
+ .header-floating > thead > tr:first-child > th:last-child,
102
+ .header-floating > .pb_table_thead > .pb_table_tr:first-child > .pb_table_th:last-child {
103
+ border-top-right-radius: 0 !important;
92
104
  }
@@ -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