@zendeskgarden/react-grid 8.50.0 → 8.52.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.
- package/README.md +58 -0
- package/dist/index.cjs.js +572 -30
- package/dist/index.esm.js +573 -34
- package/dist/typings/elements/pane/Pane.d.ts +16 -0
- package/dist/typings/elements/pane/PaneProvider.d.ts +23 -0
- package/dist/typings/elements/pane/components/Content.d.ts +11 -0
- package/dist/typings/elements/pane/components/Splitter.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +3 -0
- package/dist/typings/styled/pane/StyledPane.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneContent.d.ts +10 -0
- package/dist/typings/styled/pane/StyledPaneSplitter.d.ts +16 -0
- package/dist/typings/types/index.d.ts +54 -1
- package/dist/typings/utils/usePaneContext.d.ts +17 -0
- package/dist/typings/utils/usePaneProviderContext.d.ts +29 -0
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -3,12 +3,24 @@
|
|
|
3
3
|
This package includes components relating to layout grids in the
|
|
4
4
|
[Garden Design System](https://zendeskgarden.github.io/).
|
|
5
5
|
|
|
6
|
+
## Grid
|
|
7
|
+
|
|
6
8
|
The `Grid` component is inspired by the Bootstrap flexbox
|
|
7
9
|
[grid](https://getbootstrap.com/docs/4.3/layout/grid/). With Garden, all of
|
|
8
10
|
the features are dynamic (based on props) – including the number of grid
|
|
9
11
|
columns and gutter width. The result is an incredibly powerful grid system
|
|
10
12
|
that will be immediately familiar to users of Bootstrap.
|
|
11
13
|
|
|
14
|
+
## Pane
|
|
15
|
+
|
|
16
|
+
The `Pane.Splitter` component enables resizable-layouts between one or
|
|
17
|
+
more panes. `PaneProvider` and `Pane`
|
|
18
|
+
coordinate multiple `Pane.Splitter` components in a
|
|
19
|
+
[CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) or
|
|
20
|
+
[CSS Flex](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout)
|
|
21
|
+
layout. The `PaneProvider` and `Pane.Splitter` components receive `fr` units as
|
|
22
|
+
values for building responsive resizable layouts by default.
|
|
23
|
+
|
|
12
24
|
## Installation
|
|
13
25
|
|
|
14
26
|
```sh
|
|
@@ -41,3 +53,49 @@ import { Grid, Row, Col } from '@zendeskgarden/react-grid';
|
|
|
41
53
|
</Grid>
|
|
42
54
|
</ThemeProvider>;
|
|
43
55
|
```
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
59
|
+
import { PaneProvider, Pane } from '@zendeskgarden/react-grid';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Place a `ThemeProvider` at the root of your React application
|
|
63
|
+
*/
|
|
64
|
+
<ThemeProvider>
|
|
65
|
+
<PaneProvider
|
|
66
|
+
totalPanesHeight={1000}
|
|
67
|
+
totalPanesWidth={1000}
|
|
68
|
+
defaultColumnValues={{ 'col-1': 1, 'col-2': 1 }}
|
|
69
|
+
defaultRowValues={{ 'row-1': 1, 'row-2': 1 }}
|
|
70
|
+
>
|
|
71
|
+
{({ getGridTemplateColumns, getGridTemplateRows }) => (
|
|
72
|
+
<div
|
|
73
|
+
style={{
|
|
74
|
+
display: 'grid',
|
|
75
|
+
width: '1000px',
|
|
76
|
+
height: '1000px',
|
|
77
|
+
gridTemplateRows: getGridTemplateRows(),
|
|
78
|
+
gridTemplateColumns: getGridTemplateColumns()
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<Pane>
|
|
82
|
+
<Pane.Content>Pane 1</Pane.Content>
|
|
83
|
+
<Pane.Splitter layoutKey="col-1" min={0} max={2} orientation="end" />
|
|
84
|
+
</Pane>
|
|
85
|
+
<Pane>
|
|
86
|
+
<Pane.Content>Pane 2</Pane.Content>
|
|
87
|
+
<Pane.Splitter layoutKey="row-1" min={0} max={2} orientation="bottom" />
|
|
88
|
+
</Pane>
|
|
89
|
+
<Pane>
|
|
90
|
+
<Pane.Content>Pane 3</Pane.Content>
|
|
91
|
+
<Pane.Splitter layoutKey="row-2" min={0} max={2} orientation="top" />
|
|
92
|
+
</Pane>
|
|
93
|
+
<Pane>
|
|
94
|
+
<Pane.Content>Pane 4</Pane.Content>
|
|
95
|
+
<Pane.Splitter layoutKey="col-2" min={0} max={2} orientation="start" />
|
|
96
|
+
</Pane>
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</PaneProvider>
|
|
100
|
+
</ThemeProvider>;
|
|
101
|
+
```
|