tournament-brackets-ui 0.1.5 → 0.1.6
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.
- package/README.md +90 -2
- package/dist/esm/CollapsedLeft-R2I9hNTR.js +1516 -0
- package/dist/esm/CollapsedLeft-R2I9hNTR.js.map +1 -0
- package/dist/esm/CollapsedRight-DlAzM4uq.js +1651 -0
- package/dist/esm/CollapsedRight-DlAzM4uq.js.map +1 -0
- package/dist/esm/Expanded-DniswICT.js +2293 -0
- package/dist/esm/Expanded-DniswICT.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.cjs +13992 -8531
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
|
1
|
-
# tournament-brackets
|
|
1
|
+
# tournament-brackets-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React component library for rendering tournament brackets. Supports both **team** and **individual** brackets in multiple sizes and three layout variants: expanded, collapsed-left, and collapsed-right.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install tournament-brackets-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:** React 18 or 19, React DOM 18 or 19.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Import the components and optional styles:
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { Expanded, CollapsedLeft, CollapsedRight } from "tournament-brackets-ui";
|
|
19
|
+
import "tournament-brackets-ui/style.css";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Components
|
|
23
|
+
|
|
24
|
+
- **`Expanded`** — Full bracket layout with all rounds visible.
|
|
25
|
+
- **`CollapsedLeft`** — Bracket with early rounds collapsed on the left.
|
|
26
|
+
- **`CollapsedRight`** — Bracket with early rounds collapsed on the right.
|
|
27
|
+
|
|
28
|
+
Each component can render either **teams** or **individuals**. Use the `entity` prop or the shorthand subcomponents:
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
// Using entity prop
|
|
32
|
+
<Expanded entity="teams" size={8} teams={teams} />
|
|
33
|
+
<Expanded entity="individuals" size={8} players={players} />
|
|
34
|
+
|
|
35
|
+
// Using shorthand (entity is fixed)
|
|
36
|
+
<Expanded.Teams size={8} teams={teams} />
|
|
37
|
+
<Expanded.Individuals size={8} players={players} />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Same pattern for `CollapsedLeft` and `CollapsedRight`.
|
|
41
|
+
|
|
42
|
+
### Supported sizes
|
|
43
|
+
|
|
44
|
+
| Entity | Sizes |
|
|
45
|
+
|------------|---------------------------------|
|
|
46
|
+
| Teams | 8, 9, 10, 11, 12, 13, 14, 16 |
|
|
47
|
+
| Individuals| 8, 9, 10, 11, 12, 13, 14, 15, 16 |
|
|
48
|
+
|
|
49
|
+
You must pass a `size` that matches the length of your `teams` or `players` array.
|
|
50
|
+
|
|
51
|
+
### Data shape
|
|
52
|
+
|
|
53
|
+
**Teams:** an array of strings (e.g. team names or labels).
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
const teams = ["Team A", "Team B", "Team C", "Team D", "Team E", "Team F", "Team G", "Team H"];
|
|
57
|
+
<Expanded.Teams size={8} teams={teams} />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Individuals:** an array of objects with `id`, `name`, and optional `club`.
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
const players = [
|
|
64
|
+
{ id: "E01", name: "Amira Hassan", club: "NFC" },
|
|
65
|
+
{ id: "E02", name: "Jinwoo Park", club: "SJU" },
|
|
66
|
+
// ... one entry per player, length must match size
|
|
67
|
+
];
|
|
68
|
+
<Expanded.Individuals size={8} players={players} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Styling (optional)
|
|
72
|
+
|
|
73
|
+
**Individuals** — Pass `textStyles` to customize player ID and name/club text:
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
<Expanded.Individuals
|
|
77
|
+
size={8}
|
|
78
|
+
players={players}
|
|
79
|
+
textStyles={{
|
|
80
|
+
playerId: { fontFamily: "Arial", fontSize: 14, color: "#000" },
|
|
81
|
+
playerText: { fontFamily: "Arial", fontSize: 12, color: "#333" },
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Teams** — For expanded team brackets you can pass `teamIDFontFamily`, `teamIDColor`, and `teamIDFontSize` to style the team ID cell.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|