playbook_ui 14.17.0.pre.rc.1 → 14.17.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_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/context/index.tsx +58 -17
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +3 -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/styles/_striped.scss +3 -3
- 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-CPM091Hj.js} +2 -2
- data/dist/chunks/_weekday_stacked-BzIANIYX.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/lib-Bg2KFzpz.js +29 -0
- data/dist/chunks/{pb_form_validation-BvNy9Bd6.js → pb_form_validation-BiHyZedy.js} +1 -1
- 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 +1 -1
- metadata +14 -7
- data/dist/chunks/_weekday_stacked-DIIHW0OV.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
- data/dist/chunks/lib-BGzBzFZX.js +0 -29
@@ -165,7 +165,7 @@ test("generated dragHandle with List", () => {
|
|
165
165
|
|
166
166
|
const list = kit.querySelector(".pb_list_kit");
|
167
167
|
expect(list).toBeInTheDocument();
|
168
|
-
const dragHandle = list.querySelector(".
|
168
|
+
const dragHandle = list.querySelector(".pb_custom_icon");
|
169
169
|
expect(dragHandle).toBeInTheDocument();
|
170
170
|
});
|
171
171
|
|
@@ -175,7 +175,7 @@ test("generated dragHandle with SelectableList", () => {
|
|
175
175
|
|
176
176
|
const selectabellist = kit.querySelector(".pb_selectable_list_kit");
|
177
177
|
expect(selectabellist).toBeInTheDocument();
|
178
|
-
const dragHandle = selectabellist.querySelector(".
|
178
|
+
const dragHandle = selectabellist.querySelector(".pb_custom_icon");
|
179
179
|
expect(dragHandle).toBeInTheDocument();
|
180
180
|
});
|
181
181
|
|
@@ -185,6 +185,6 @@ test("generated dragHandle with Card", () => {
|
|
185
185
|
|
186
186
|
const card = kit.querySelector(".pb_card_kit_deselected_border_radius_md");
|
187
187
|
expect(card).toBeInTheDocument();
|
188
|
-
const dragHandle = card.querySelector(".
|
188
|
+
const dragHandle = card.querySelector(".pb_custom_icon");
|
189
189
|
expect(dragHandle).toBeInTheDocument();
|
190
190
|
});
|
@@ -12,7 +12,7 @@ const DropdownWithAutocomplete = (props) => {
|
|
12
12
|
label: "Jasper Furniss",
|
13
13
|
value: "Jasper Furniss",
|
14
14
|
territory: "PHL",
|
15
|
-
title: "
|
15
|
+
title: "Lead UX Engineer",
|
16
16
|
id: "jasper-furniss",
|
17
17
|
status: "Offline"
|
18
18
|
},
|
@@ -25,18 +25,18 @@ const DropdownWithAutocomplete = (props) => {
|
|
25
25
|
status: "Away"
|
26
26
|
},
|
27
27
|
{
|
28
|
-
label: "
|
29
|
-
value: "
|
28
|
+
label: "Carlos Lima",
|
29
|
+
value: "Carlos Lima",
|
30
30
|
territory: "PHL",
|
31
|
-
title: "
|
32
|
-
id: "
|
31
|
+
title: "Nitro Developer",
|
32
|
+
id: "carlos-lima",
|
33
33
|
status: "Online"
|
34
34
|
},
|
35
35
|
{
|
36
36
|
label: "Courtney Long",
|
37
37
|
value: "Courtney Long",
|
38
38
|
territory: "PHL",
|
39
|
-
title: "UX
|
39
|
+
title: "Lead UX Designer",
|
40
40
|
id: "courtney-long",
|
41
41
|
status: "Online"
|
42
42
|
}
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx
CHANGED
@@ -15,7 +15,7 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
15
15
|
label: "Jasper Furniss",
|
16
16
|
value: "Jasper Furniss",
|
17
17
|
territory: "PHL",
|
18
|
-
title: "
|
18
|
+
title: "Lead UX Engineer",
|
19
19
|
id: "jasper-furniss",
|
20
20
|
status: "Offline"
|
21
21
|
},
|
@@ -28,18 +28,18 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
28
28
|
status: "Away"
|
29
29
|
},
|
30
30
|
{
|
31
|
-
label: "
|
32
|
-
value: "
|
31
|
+
label: "Carlos Lima",
|
32
|
+
value: "Carlos Lima",
|
33
33
|
territory: "PHL",
|
34
|
-
title: "
|
35
|
-
id: "
|
34
|
+
title: "Nitro Developer",
|
35
|
+
id: "carlos-lima",
|
36
36
|
status: "Online"
|
37
37
|
},
|
38
38
|
{
|
39
39
|
label: "Courtney Long",
|
40
40
|
value: "Courtney Long",
|
41
41
|
territory: "PHL",
|
42
|
-
title: "UX
|
42
|
+
title: "Lead UX Designer",
|
43
43
|
id: "courtney-long",
|
44
44
|
status: "Online"
|
45
45
|
}
|
@@ -15,7 +15,7 @@ const DropdownWithCustomDisplay = (props) => {
|
|
15
15
|
label: "Jasper Furniss",
|
16
16
|
value: "Jasper Furniss",
|
17
17
|
territory: "PHL",
|
18
|
-
title: "
|
18
|
+
title: "Lead UX Engineer",
|
19
19
|
id: "jasper-furniss",
|
20
20
|
status: "Offline"
|
21
21
|
},
|
@@ -28,18 +28,18 @@ const DropdownWithCustomDisplay = (props) => {
|
|
28
28
|
status: "Away"
|
29
29
|
},
|
30
30
|
{
|
31
|
-
label: "
|
32
|
-
value: "
|
31
|
+
label: "Carlos Lima",
|
32
|
+
value: "Carlos Lima",
|
33
33
|
territory: "PHL",
|
34
|
-
title: "
|
35
|
-
id: "
|
34
|
+
title: "Nitro Developer",
|
35
|
+
id: "carlos-lima",
|
36
36
|
status: "Online"
|
37
37
|
},
|
38
38
|
{
|
39
39
|
label: "Courtney Long",
|
40
40
|
value: "Courtney Long",
|
41
41
|
territory: "PHL",
|
42
|
-
title: "UX
|
42
|
+
title: "Lead UX Designer",
|
43
43
|
id: "courtney-long",
|
44
44
|
status: "Online"
|
45
45
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
options = [
|
3
3
|
{
|
4
4
|
label: "Jasper Furniss",
|
5
5
|
value: "Jasper Furniss",
|
6
6
|
territory: "PHL",
|
7
|
-
title: "
|
7
|
+
title: "Lead UX Engineer",
|
8
8
|
id: "jasper-furniss",
|
9
9
|
status: "Offline"
|
10
10
|
},
|
@@ -17,22 +17,22 @@
|
|
17
17
|
status: "Away"
|
18
18
|
},
|
19
19
|
{
|
20
|
-
label: "
|
21
|
-
value: "
|
20
|
+
label: "Carlos Lima",
|
21
|
+
value: "Carlos Lima",
|
22
22
|
territory: "PHL",
|
23
|
-
title: "
|
24
|
-
id: "
|
23
|
+
title: "Nitro Developer",
|
24
|
+
id: "carlos-lima",
|
25
25
|
status: "Online"
|
26
26
|
},
|
27
27
|
{
|
28
28
|
label: "Courtney Long",
|
29
29
|
value: "Courtney Long",
|
30
30
|
territory: "PHL",
|
31
|
-
title: "UX
|
31
|
+
title: "Lead UX Designer",
|
32
32
|
id: "courtney-long",
|
33
33
|
status: "Online"
|
34
34
|
}
|
35
|
-
]
|
35
|
+
];
|
36
36
|
|
37
37
|
%>
|
38
38
|
|
@@ -95,7 +95,7 @@ test('generated customDisplay for trigger', () => {
|
|
95
95
|
|
96
96
|
const kit = screen.getByTestId(testId)
|
97
97
|
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
98
|
-
const customDisplay = trigger.querySelector('.
|
98
|
+
const customDisplay = trigger.querySelector('.pb_custom_icon')
|
99
99
|
expect(customDisplay).toBeInTheDocument()
|
100
100
|
})
|
101
101
|
|
@@ -170,7 +170,7 @@ test('generated custom Trigger', () => {
|
|
170
170
|
options={options}
|
171
171
|
>
|
172
172
|
<Dropdown.Trigger>
|
173
|
-
<Icon icon="
|
173
|
+
<Icon icon="flag" />
|
174
174
|
</Dropdown.Trigger>
|
175
175
|
{options.map((option) => (
|
176
176
|
<Dropdown.Option key={option.id}
|
@@ -182,7 +182,7 @@ test('generated custom Trigger', () => {
|
|
182
182
|
|
183
183
|
const kit = screen.getByTestId(testId)
|
184
184
|
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
185
|
-
const customTrigger = trigger.querySelector('.
|
185
|
+
const customTrigger = trigger.querySelector('.pb_custom_icon')
|
186
186
|
expect(customTrigger).toBeInTheDocument()
|
187
187
|
})
|
188
188
|
|
@@ -205,4 +205,26 @@
|
|
205
205
|
border-top-left-radius: 0;
|
206
206
|
}
|
207
207
|
}
|
208
|
+
|
209
|
+
.pb_text_input_kit.error {
|
210
|
+
.text_input_wrapper {
|
211
|
+
input:focus {
|
212
|
+
outline: none;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
& + * input,
|
217
|
+
& + * select {
|
218
|
+
border-left-color: $red;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
.pb_text_input_kit:not(.error):focus-within + .error,
|
223
|
+
.pb_text_input_kit:not(.error):focus-within + .pb_select .error {
|
224
|
+
input,
|
225
|
+
select {
|
226
|
+
border-left: none;
|
227
|
+
padding-left: calc(var(--iti-flag-width) + 1px);
|
228
|
+
}
|
229
|
+
}
|
208
230
|
}
|
@@ -16,7 +16,7 @@ describe("Icon Kit", () => {
|
|
16
16
|
)
|
17
17
|
|
18
18
|
const kit = screen.getByTestId(testId)
|
19
|
-
expect(kit).toHaveClass("
|
19
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa svg_fw")
|
20
20
|
})
|
21
21
|
|
22
22
|
test("renders rotate prop", () => {[
|
@@ -31,7 +31,7 @@ describe("Icon Kit", () => {
|
|
31
31
|
)
|
32
32
|
|
33
33
|
const kit = screen.getByTestId(testId)
|
34
|
-
expect(kit).toHaveClass(`
|
34
|
+
expect(kit).toHaveClass(`pb_custom_icon svg-inline--fa rotate_${rotateProp} svg_fw`)
|
35
35
|
|
36
36
|
cleanup()
|
37
37
|
})
|
@@ -48,7 +48,7 @@ describe("Icon Kit", () => {
|
|
48
48
|
)
|
49
49
|
|
50
50
|
const kit = screen.getByTestId(testId)
|
51
|
-
expect(kit).toHaveClass("
|
51
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa flip_horizontal svg_fw")
|
52
52
|
})
|
53
53
|
|
54
54
|
|
@@ -63,7 +63,7 @@ describe("Icon Kit", () => {
|
|
63
63
|
)
|
64
64
|
|
65
65
|
const kit = screen.getByTestId(testId)
|
66
|
-
expect(kit).toHaveClass("
|
66
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa spin svg_fw")
|
67
67
|
})
|
68
68
|
|
69
69
|
test("renders pull icon", () => {
|
@@ -77,7 +77,7 @@ describe("Icon Kit", () => {
|
|
77
77
|
)
|
78
78
|
|
79
79
|
const kit = screen.getByTestId(testId)
|
80
|
-
expect(kit).toHaveClass("
|
80
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa svg_fw pull_left")
|
81
81
|
})
|
82
82
|
|
83
83
|
test("renders pull icon", () => {
|
@@ -91,7 +91,7 @@ describe("Icon Kit", () => {
|
|
91
91
|
)
|
92
92
|
|
93
93
|
const kit = screen.getByTestId(testId)
|
94
|
-
expect(kit).toHaveClass("
|
94
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa svg_fw pull_left")
|
95
95
|
})
|
96
96
|
|
97
97
|
test("renders border around icon", () => {
|
@@ -105,7 +105,7 @@ describe("Icon Kit", () => {
|
|
105
105
|
)
|
106
106
|
|
107
107
|
const kit = screen.getByTestId(testId)
|
108
|
-
expect(kit).toHaveClass("
|
108
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa svg_border svg_fw")
|
109
109
|
})
|
110
110
|
|
111
111
|
test("renders size prop", () => {
|
@@ -132,7 +132,7 @@ describe("Icon Kit", () => {
|
|
132
132
|
)
|
133
133
|
|
134
134
|
const kit = screen.getByTestId(testId)
|
135
|
-
expect(kit).toHaveClass(`
|
135
|
+
expect(kit).toHaveClass(`pb_custom_icon svg-inline--fa svg_${sizeProp} svg_fw`)
|
136
136
|
|
137
137
|
cleanup()
|
138
138
|
})
|
@@ -149,7 +149,7 @@ describe("Icon Kit", () => {
|
|
149
149
|
)
|
150
150
|
|
151
151
|
const kit = screen.getByTestId(testId)
|
152
|
-
expect(kit).toHaveClass("
|
152
|
+
expect(kit).toHaveClass("pb_custom_icon svg-inline--fa svg_fw")
|
153
153
|
})
|
154
154
|
|
155
155
|
test("renders with color prop", () => {
|
@@ -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
|