playbook_ui 14.17.0.pre.rc.1 → 14.18.0.pre.rc.0
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +70 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +83 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +5 -3
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +35 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +71 -3
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/table.rb +13 -1
- data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/dist/chunks/{_typeahead-Djo6qCne.js → _typeahead-C2GOKWtm.js} +2 -2
- data/dist/chunks/_weekday_stacked-CFGTPT0O.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +31 -16
- data/dist/chunks/_weekday_stacked-DIIHW0OV.js +0 -45
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
@@ -10,6 +10,8 @@ $list-header-height: $space_lg;
|
|
10
10
|
$list-footer-height: $space_lg;
|
11
11
|
$list-border-radius: $border_rad_lighter;
|
12
12
|
$card-border-radius: $border_rad_lightest;
|
13
|
+
$bracket-connector-width: 45px;
|
14
|
+
$bracket-border-width: 4px;
|
13
15
|
|
14
16
|
|
15
17
|
[class^=pb_layout_kit] {
|
@@ -168,6 +170,62 @@ $card-border-radius: $border_rad_lightest;
|
|
168
170
|
}
|
169
171
|
}
|
170
172
|
|
173
|
+
&[class*=_bracket]{
|
174
|
+
display: flex;
|
175
|
+
overflow-x: scroll;
|
176
|
+
|
177
|
+
div.layout_round {
|
178
|
+
display: flex;
|
179
|
+
flex-direction: column;
|
180
|
+
justify-content: space-around;
|
181
|
+
flex-grow: 1;
|
182
|
+
}
|
183
|
+
|
184
|
+
.connector_container {
|
185
|
+
display: flex;
|
186
|
+
flex-direction: column;
|
187
|
+
justify-content: space-around;
|
188
|
+
}
|
189
|
+
.right_connector {
|
190
|
+
border-top: $bracket-border-width solid $border_light;
|
191
|
+
width: $bracket-connector-width;
|
192
|
+
margin-left: $bracket-connector-width;
|
193
|
+
}
|
194
|
+
|
195
|
+
.layout_round .layout_game {
|
196
|
+
position: relative;
|
197
|
+
}
|
198
|
+
|
199
|
+
.half_box {
|
200
|
+
content: '';
|
201
|
+
position: absolute;
|
202
|
+
top: calc(50% - $bracket-border-width / 2);
|
203
|
+
height: calc(100% + $bracket-border-width);
|
204
|
+
width: $bracket-connector-width;
|
205
|
+
right: -$bracket-connector-width;
|
206
|
+
border-top-right-radius: $border_radius_lg;
|
207
|
+
border-bottom-right-radius: $border_radius_lg;
|
208
|
+
border-top: $bracket-border-width solid $border_light;
|
209
|
+
border-bottom: $bracket-border-width solid $border_light;
|
210
|
+
border-right: $bracket-border-width solid $border_light;
|
211
|
+
}
|
212
|
+
|
213
|
+
.layout_round_label {
|
214
|
+
display: none;
|
215
|
+
}
|
216
|
+
|
217
|
+
@media (max-width: $screen-md-max) {
|
218
|
+
flex-direction: column;
|
219
|
+
.layout_round_label {
|
220
|
+
display: block;
|
221
|
+
}
|
222
|
+
.layout_round .layout_game::after,
|
223
|
+
.connector_container,
|
224
|
+
.half_box {
|
225
|
+
display: none !important;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
171
229
|
|
172
230
|
&[class*=_sidebar]{
|
173
231
|
$layout_sizes: (
|
@@ -4,6 +4,9 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../uti
|
|
4
4
|
|
5
5
|
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
6
6
|
|
7
|
+
import { Round, RoundLabel } from "./subcomponents/_round";
|
8
|
+
import Game from "./subcomponents/_game";
|
9
|
+
|
7
10
|
type LayoutPropTypes = {
|
8
11
|
aria?: {[key: string]: string},
|
9
12
|
children?: React.ReactChild[] | React.ReactChild,
|
@@ -18,7 +21,7 @@ type LayoutPropTypes = {
|
|
18
21
|
size?: "xs" | "sm" | "md" | "base" | "lg" | "xl",
|
19
22
|
variant?: "light" | "dark" | "gradient",
|
20
23
|
transparent?: boolean,
|
21
|
-
layout?: "sidebar" | "collection" | "kanban" | "content" | "masonry",
|
24
|
+
layout?: "sidebar" | "collection" | "kanban" | "content" | "masonry" | "bracket",
|
22
25
|
} & GlobalProps
|
23
26
|
|
24
27
|
type LayoutSideProps = {
|
@@ -140,7 +143,7 @@ const Layout = (props: LayoutPropTypes) => {
|
|
140
143
|
const htmlProps = buildHtmlProps(htmlOptions)
|
141
144
|
|
142
145
|
const layoutCss =
|
143
|
-
layout == 'collection'
|
146
|
+
(layout == 'collection' || layout == 'bracket')
|
144
147
|
? `pb_layout_kit_${layout}`
|
145
148
|
: layout == 'kanban'
|
146
149
|
? `pb_layout_kit_${layout}${responsiveClass}`
|
@@ -151,11 +154,9 @@ const Layout = (props: LayoutPropTypes) => {
|
|
151
154
|
})
|
152
155
|
|
153
156
|
const layoutCollapseCss =
|
154
|
-
layout == 'collection'
|
157
|
+
(layout == 'collection' || layout == 'kanban' || layout == 'bracket')
|
155
158
|
? ''
|
156
|
-
: layout
|
157
|
-
? ''
|
158
|
-
: buildCss('layout', position, 'collapse', collapse)
|
159
|
+
: buildCss('layout', position, 'collapse', collapse)
|
159
160
|
|
160
161
|
const layoutChildren = React.Children.toArray(children)
|
161
162
|
|
@@ -175,6 +176,15 @@ const Layout = (props: LayoutPropTypes) => {
|
|
175
176
|
(child: React.ReactElement & {type: {displayName: string}}) => child.type?.displayName !== 'Side'
|
176
177
|
)
|
177
178
|
|
179
|
+
const numberOfRounds = Array.isArray(nonSideChildren) ? React.Children.toArray(children).filter(
|
180
|
+
(child) => {
|
181
|
+
return (child as React.ReactElement).type === Layout.Round;
|
182
|
+
}
|
183
|
+
).length : 0
|
184
|
+
const bracketChildren = nonSideChildren.map(child =>
|
185
|
+
React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds }) : child
|
186
|
+
)
|
187
|
+
|
178
188
|
const filteredProps = {...props}
|
179
189
|
delete filteredProps?.position
|
180
190
|
|
@@ -196,7 +206,7 @@ const Layout = (props: LayoutPropTypes) => {
|
|
196
206
|
style={dynamicInlineProps}
|
197
207
|
>
|
198
208
|
{subComponentTags('Side')}
|
199
|
-
{nonSideChildren}
|
209
|
+
{layout === 'bracket' ? bracketChildren : nonSideChildren}
|
200
210
|
</div>
|
201
211
|
)
|
202
212
|
}
|
@@ -206,5 +216,8 @@ Layout.Body = Body
|
|
206
216
|
Layout.Item = Item
|
207
217
|
Layout.Header = Header
|
208
218
|
Layout.Footer = Footer
|
219
|
+
Layout.Round = Round
|
220
|
+
Layout.Game = Game
|
221
|
+
Layout.RoundLabel = RoundLabel
|
209
222
|
|
210
223
|
export default Layout
|
@@ -0,0 +1,190 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Layout from '../../pb_layout/_layout'
|
4
|
+
import Flex from '../../pb_flex/_flex'
|
5
|
+
import Body from '../../pb_body/_body'
|
6
|
+
import Caption from '../../pb_caption/_caption'
|
7
|
+
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
8
|
+
|
9
|
+
const LayoutBracket = () => {
|
10
|
+
return (
|
11
|
+
<div>
|
12
|
+
<Layout
|
13
|
+
layout="bracket"
|
14
|
+
>
|
15
|
+
<Layout.RoundLabel>
|
16
|
+
<Caption>Wild Card</Caption>
|
17
|
+
<SectionSeparator marginY="sm"/>
|
18
|
+
</Layout.RoundLabel>
|
19
|
+
<Layout.Round marginBottom={{ xs: "md", sm: "md" }}>
|
20
|
+
<Layout.Game>
|
21
|
+
<Flex justify="between">
|
22
|
+
<Body>Packers</Body>
|
23
|
+
<Body>10</Body>
|
24
|
+
</Flex>
|
25
|
+
<Flex justify="between">
|
26
|
+
<Body><strong>Eagles</strong></Body>
|
27
|
+
<Body>22</Body>
|
28
|
+
</Flex>
|
29
|
+
</Layout.Game>
|
30
|
+
<Layout.Game>
|
31
|
+
<Flex justify="between">
|
32
|
+
<Body>Vikings</Body>
|
33
|
+
<Body>9</Body>
|
34
|
+
</Flex>
|
35
|
+
<Flex justify="between">
|
36
|
+
<Body><strong>Rams</strong></Body>
|
37
|
+
<Body>27</Body>
|
38
|
+
</Flex>
|
39
|
+
</Layout.Game>
|
40
|
+
<Layout.Game>
|
41
|
+
<Flex justify="between">
|
42
|
+
<Body><strong>Lions</strong></Body>
|
43
|
+
</Flex>
|
44
|
+
<Flex justify="between">
|
45
|
+
<Body>BYE</Body>
|
46
|
+
</Flex>
|
47
|
+
</Layout.Game>
|
48
|
+
<Layout.Game>
|
49
|
+
<Flex justify="between">
|
50
|
+
<Body><strong>Commanders</strong></Body>
|
51
|
+
<Body>23</Body>
|
52
|
+
</Flex>
|
53
|
+
<Flex justify="between">
|
54
|
+
<Body>Buccaneers</Body>
|
55
|
+
<Body>20</Body>
|
56
|
+
</Flex>
|
57
|
+
</Layout.Game>
|
58
|
+
<Layout.Game>
|
59
|
+
<Flex justify="between">
|
60
|
+
<Body><strong>Chiefs</strong></Body>
|
61
|
+
</Flex>
|
62
|
+
<Flex justify="between">
|
63
|
+
<Body>BYE</Body>
|
64
|
+
</Flex>
|
65
|
+
</Layout.Game>
|
66
|
+
<Layout.Game>
|
67
|
+
<Flex justify="between">
|
68
|
+
<Body>Chargers</Body>
|
69
|
+
<Body>12</Body>
|
70
|
+
</Flex>
|
71
|
+
<Flex justify="between">
|
72
|
+
<Body><strong>Texans</strong></Body>
|
73
|
+
<Body>32</Body>
|
74
|
+
</Flex>
|
75
|
+
</Layout.Game>
|
76
|
+
<Layout.Game>
|
77
|
+
<Flex justify="between">
|
78
|
+
<Body>Broncos</Body>
|
79
|
+
<Body>7</Body>
|
80
|
+
</Flex>
|
81
|
+
<Flex justify="between">
|
82
|
+
<Body><strong>Bills</strong></Body>
|
83
|
+
<Body>31</Body>
|
84
|
+
</Flex>
|
85
|
+
</Layout.Game>
|
86
|
+
<Layout.Game>
|
87
|
+
<Flex justify="between">
|
88
|
+
<Body>Steelers</Body>
|
89
|
+
<Body>14</Body>
|
90
|
+
</Flex>
|
91
|
+
<Flex justify="between">
|
92
|
+
<Body><strong>Ravens</strong></Body>
|
93
|
+
<Body>28</Body>
|
94
|
+
</Flex>
|
95
|
+
</Layout.Game>
|
96
|
+
</Layout.Round>
|
97
|
+
<Layout.RoundLabel>
|
98
|
+
<Caption>Divisional</Caption>
|
99
|
+
<SectionSeparator marginY="sm"/>
|
100
|
+
</Layout.RoundLabel>
|
101
|
+
<Layout.Round marginBottom={{ xs: "md", sm: "md" }}>
|
102
|
+
<Layout.Game>
|
103
|
+
<Flex justify="between">
|
104
|
+
<Body>Rams</Body>
|
105
|
+
<Body>22</Body>
|
106
|
+
</Flex>
|
107
|
+
<Flex justify="between">
|
108
|
+
<Body><strong>Eagles</strong></Body>
|
109
|
+
<Body>28</Body>
|
110
|
+
</Flex>
|
111
|
+
</Layout.Game>
|
112
|
+
<Layout.Game>
|
113
|
+
<Flex justify="between">
|
114
|
+
<Body><strong>Commanders</strong></Body>
|
115
|
+
<Body>45</Body>
|
116
|
+
</Flex>
|
117
|
+
<Flex justify="between">
|
118
|
+
<Body>Lions</Body>
|
119
|
+
<Body>31</Body>
|
120
|
+
</Flex>
|
121
|
+
</Layout.Game>
|
122
|
+
<Layout.Game>
|
123
|
+
<Flex justify="between">
|
124
|
+
<Body>Texans</Body>
|
125
|
+
<Body>14</Body>
|
126
|
+
</Flex>
|
127
|
+
<Flex justify="between">
|
128
|
+
<Body><strong>Chiefs</strong></Body>
|
129
|
+
<Body>23</Body>
|
130
|
+
</Flex>
|
131
|
+
</Layout.Game>
|
132
|
+
<Layout.Game>
|
133
|
+
<Flex justify="between">
|
134
|
+
<Body>Ravens</Body>
|
135
|
+
<Body>25</Body>
|
136
|
+
</Flex>
|
137
|
+
<Flex justify="between">
|
138
|
+
<Body><strong>Bills</strong></Body>
|
139
|
+
<Body>27</Body>
|
140
|
+
</Flex>
|
141
|
+
</Layout.Game>
|
142
|
+
</Layout.Round>
|
143
|
+
<Layout.RoundLabel>
|
144
|
+
<Caption>Conference</Caption>
|
145
|
+
<SectionSeparator marginY="sm"/>
|
146
|
+
</Layout.RoundLabel>
|
147
|
+
<Layout.Round marginBottom={{ xs: "md", sm: "md" }}>
|
148
|
+
<Layout.Game>
|
149
|
+
<Flex justify="between">
|
150
|
+
<Body>Commanders</Body>
|
151
|
+
<Body>23</Body>
|
152
|
+
</Flex>
|
153
|
+
<Flex justify="between">
|
154
|
+
<Body><strong>Eagles</strong></Body>
|
155
|
+
<Body>55</Body>
|
156
|
+
</Flex>
|
157
|
+
</Layout.Game>
|
158
|
+
<Layout.Game>
|
159
|
+
<Flex justify="between">
|
160
|
+
<Body>Bills</Body>
|
161
|
+
<Body>29</Body>
|
162
|
+
</Flex>
|
163
|
+
<Flex justify="between">
|
164
|
+
<Body><strong>Chiefs</strong></Body>
|
165
|
+
<Body>32</Body>
|
166
|
+
</Flex>
|
167
|
+
</Layout.Game>
|
168
|
+
</Layout.Round>
|
169
|
+
<Layout.RoundLabel>
|
170
|
+
<Caption>Super Bowl</Caption>
|
171
|
+
<SectionSeparator marginY="sm"/>
|
172
|
+
</Layout.RoundLabel>
|
173
|
+
<Layout.Round>
|
174
|
+
<Layout.Game>
|
175
|
+
<Flex justify="between">
|
176
|
+
<Body>Chiefs</Body>
|
177
|
+
<Body>22</Body>
|
178
|
+
</Flex>
|
179
|
+
<Flex justify="between">
|
180
|
+
<Body><strong>Eagles</strong></Body>
|
181
|
+
<Body>40</Body>
|
182
|
+
</Flex>
|
183
|
+
</Layout.Game>
|
184
|
+
</Layout.Round>
|
185
|
+
</Layout>
|
186
|
+
</div>
|
187
|
+
)
|
188
|
+
}
|
189
|
+
|
190
|
+
export default LayoutBracket
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Use `<Layout.RoundLabel>`, `<Layout.Round>`, and `<Layout.Game>` to make a bracket layout.
|
2
|
+
|
3
|
+
On mobile devices, `<Layout.RoundLabel>` will display (on desktop these components are hidden) and the bracket will be in one column.
|
4
|
+
|
5
|
+
Ensure that each `<Layout.Game>` maintains a consistent height for the bracket lines to lay out properly.
|
@@ -7,4 +7,5 @@ export { default as LayoutKanbanResponsive } from './_layout_kanban_responsive.j
|
|
7
7
|
export { default as LayoutCollectionDetail } from './_layout_collection_detail.jsx'
|
8
8
|
export { default as LayoutContent } from './_layout_content.jsx'
|
9
9
|
export { default as LayoutMasonry } from './_layout_masonry.jsx'
|
10
|
+
export { default as LayoutBracket } from './_layout_bracket.jsx'
|
10
11
|
|
@@ -82,6 +82,10 @@ test("render all layout variants", () => {
|
|
82
82
|
layout: "masonry",
|
83
83
|
expected: "pb_layout_kit_masonry_size_md_left_light",
|
84
84
|
},
|
85
|
+
{
|
86
|
+
layout: "bracket",
|
87
|
+
expected: "pb_layout_kit_bracket",
|
88
|
+
},
|
85
89
|
]
|
86
90
|
|
87
91
|
testValues.forEach(({ layout, expected }) => {
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
|
4
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
|
5
|
+
|
6
|
+
import Card from '../../pb_card/_card'
|
7
|
+
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
8
|
+
|
9
|
+
type LayoutGameProps = {
|
10
|
+
children: React.ReactNode[] | React.ReactNode,
|
11
|
+
className?: string,
|
12
|
+
numberOfRounds: number,
|
13
|
+
numberOfGames: number,
|
14
|
+
isOdd: boolean,
|
15
|
+
} & GlobalProps
|
16
|
+
|
17
|
+
// Game component (modeled after Item)
|
18
|
+
const Game = (props: LayoutGameProps) => {
|
19
|
+
const { children, className, numberOfRounds, numberOfGames, isOdd } = props
|
20
|
+
const dynamicInlineProps = globalInlineProps(props)
|
21
|
+
|
22
|
+
const numberOfChildren = Array.isArray(children) ? children.length : 0
|
23
|
+
|
24
|
+
const isMultiple = Array.isArray(children)
|
25
|
+
|
26
|
+
let ratio = 0
|
27
|
+
let exponent
|
28
|
+
if (numberOfGames > 1) {
|
29
|
+
exponent = (numberOfRounds) - Math.log2(numberOfGames) - 1
|
30
|
+
ratio = 2 ** exponent
|
31
|
+
}
|
32
|
+
|
33
|
+
if (numberOfChildren === 2) {
|
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"
|
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>
|
58
|
+
)
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
return (
|
63
|
+
<div
|
64
|
+
className={classnames('layout_game', globalProps(props), className)}
|
65
|
+
style={dynamicInlineProps}
|
66
|
+
>
|
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 &&
|
81
|
+
<div
|
82
|
+
className="half_box"
|
83
|
+
style={{ height: `calc(${ratio} * 100% + 4px)` }}
|
84
|
+
/>
|
85
|
+
}
|
86
|
+
</div>
|
87
|
+
)
|
88
|
+
}
|
89
|
+
|
90
|
+
export default Game
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import classnames from 'classnames'
|
3
|
+
|
4
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
|
5
|
+
|
6
|
+
type LayoutRoundLabelProps = {
|
7
|
+
children: React.ReactNode[] | React.ReactNode,
|
8
|
+
className?: string,
|
9
|
+
} & GlobalProps
|
10
|
+
|
11
|
+
export const RoundLabel = (props: LayoutRoundLabelProps) => {
|
12
|
+
const { children, className } = props
|
13
|
+
const dynamicInlineProps = globalInlineProps(props)
|
14
|
+
return (
|
15
|
+
<div
|
16
|
+
className={classnames('layout_round_label', className)}
|
17
|
+
style={dynamicInlineProps}
|
18
|
+
>
|
19
|
+
{children}
|
20
|
+
</div>
|
21
|
+
)
|
22
|
+
}
|
23
|
+
|
24
|
+
type LayoutRoundProps = {
|
25
|
+
children: React.ReactNode[] | React.ReactNode,
|
26
|
+
className?: string,
|
27
|
+
numberOfRounds: number,
|
28
|
+
} & GlobalProps
|
29
|
+
|
30
|
+
export const Round = (props: LayoutRoundProps) => {
|
31
|
+
const { children, className, numberOfRounds } = props
|
32
|
+
const dynamicInlineProps = globalInlineProps(props)
|
33
|
+
const numberOfChildren = Array.isArray(children) ? children.length : 0
|
34
|
+
|
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
|
38
|
+
|
39
|
+
const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
|
40
|
+
<div
|
41
|
+
className="right_connector"
|
42
|
+
key={`right_connector_${index}`}
|
43
|
+
/>
|
44
|
+
))
|
45
|
+
|
46
|
+
return (
|
47
|
+
<>
|
48
|
+
<div
|
49
|
+
className={classnames('layout_round', globalProps(props), className)}
|
50
|
+
style={dynamicInlineProps}
|
51
|
+
>
|
52
|
+
{childrenWithProps}
|
53
|
+
</div>
|
54
|
+
<div className="connector_container">{rightConnectors}</div>
|
55
|
+
</>
|
56
|
+
)
|
57
|
+
}
|
@@ -73,7 +73,7 @@ test('adds icon', () => {
|
|
73
73
|
|
74
74
|
const kit = screen.getByTestId('icon-test')
|
75
75
|
|
76
|
-
const icon = kit.querySelector('.
|
76
|
+
const icon = kit.querySelector('.pb_custom_icon')
|
77
77
|
expect(icon).toBeInTheDocument();
|
78
78
|
})
|
79
79
|
|
@@ -87,7 +87,7 @@ test('adds icon right', () => {
|
|
87
87
|
|
88
88
|
const kit = screen.getByTestId('icon-right-test')
|
89
89
|
|
90
|
-
const icon = kit.querySelector('.
|
90
|
+
const icon = kit.querySelector('.pb_custom_icon')
|
91
91
|
expect(icon).toBeInTheDocument();
|
92
92
|
})
|
93
93
|
|
@@ -95,11 +95,13 @@ test('should not have a left border', () => {
|
|
95
95
|
test('should have a right icon', () => {
|
96
96
|
render(<NavDefault iconRight="angle-down" />)
|
97
97
|
const kit = screen.getByTestId(itemTestId)
|
98
|
-
|
98
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_right")
|
99
|
+
expect(icon).toBeInTheDocument()
|
99
100
|
})
|
100
101
|
|
101
102
|
test('should have a left icon', () => {
|
102
|
-
render(<NavDefault iconLeft="
|
103
|
+
render(<NavDefault iconLeft="angle-up" />)
|
103
104
|
const kit = screen.getByTestId(itemTestId)
|
104
|
-
|
105
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_left")
|
106
|
+
expect(icon).toBeInTheDocument()
|
105
107
|
})
|
@@ -0,0 +1 @@
|
|
1
|
+
To guarantee the vertical section separator displays properly, please add the `vertical: "stretch"`/`vertical="stretch"` property to the parent container (which is commonly a Flex container). This will stretch the container’s child elements vertically and ensure the section separator appears as expected.
|
@@ -19,23 +19,27 @@ test('it renders preset icon', () => {
|
|
19
19
|
render(
|
20
20
|
<StatChange
|
21
21
|
change="increase"
|
22
|
+
id="preset-icon"
|
22
23
|
value="28.4"
|
23
24
|
/>
|
24
25
|
)
|
25
26
|
|
26
|
-
const kit =
|
27
|
-
|
27
|
+
const kit = document.querySelector('#preset-icon')
|
28
|
+
const icon = kit.querySelector(".pb_custom_icon")
|
29
|
+
expect(icon).toBeInTheDocument()
|
28
30
|
})
|
29
31
|
|
30
32
|
test('it renders custom icon', () => {
|
31
33
|
render(
|
32
34
|
<StatChange
|
33
35
|
icon="chart-line-down"
|
36
|
+
id="custom-icon"
|
34
37
|
value={6.1}
|
35
38
|
/>
|
36
39
|
|
37
40
|
)
|
38
41
|
|
39
|
-
const kit =
|
40
|
-
|
42
|
+
const kit = document.querySelector('#custom-icon')
|
43
|
+
const icon = kit.querySelector(".pb_custom_icon")
|
44
|
+
expect(icon).toBeInTheDocument()
|
41
45
|
})
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "sm", header_style: "borderless" }) 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
|
+
</tbody>
|
34
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Customize your header by removing the header borders with the `header_style: "borderless"` prop.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= pb_rails("card", props: { background: "light" }) do %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm", header_style: "floating" }) do %>
|
3
|
+
<%= pb_rails("table/table_head") do %>
|
4
|
+
<%= pb_rails("background", props: { background_color: "light", tag: "tr" }) do %>
|
5
|
+
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
6
|
+
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
7
|
+
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
8
|
+
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
9
|
+
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<%= pb_rails("table/table_body") do %>
|
13
|
+
<%= pb_rails("table/table_row") do %>
|
14
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
15
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
16
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
17
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
18
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
19
|
+
<% end %>
|
20
|
+
<%= pb_rails("table/table_row") do %>
|
21
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
22
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
23
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
24
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
25
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
26
|
+
<% end %>
|
27
|
+
<%= pb_rails("table/table_row") do %>
|
28
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
29
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
30
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
31
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
32
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Further customize your header by using the [table with background kit](https://playbook.powerapp.cloud/kits/table/rails#table-with-background-kit) logic to give your table header a custom background color. Use the `header_style: "floating"` prop to visually nest the borderless table within a card or collapsible with a matching background color (the `background_color` passed to Background kit should match the `background` or `background_color` for the element in which it is nested).
|
@@ -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 `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 `background` or `backgroundColor` for the element in which it is nested).
|