react-split-pane 0.1.77 → 0.1.84

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 CHANGED
@@ -1,37 +1,44 @@
1
1
  # React Split Pane
2
2
 
3
- Split-Pane component built with [React](http://facebook.github.io/react), can be split vertically or horizontally.
4
-
5
- ```
6
- npm install react-split-pane
7
- ```
8
-
3
+ [![NPM version](https://img.shields.io/npm/v/react-split-pane.svg?style=flat)](https://www.npmjs.com/package/react-split-pane)
4
+ ![NPM license](https://img.shields.io/npm/l/react-split-pane.svg?style=flat)
5
+ [![NPM total downloads](https://img.shields.io/npm/dt/react-split-pane.svg?style=flat)](https://npmcharts.com/compare/react-split-pane?minimal=true)
6
+ [![NPM monthly downloads](https://img.shields.io/npm/dm/react-split-pane.svg?style=flat)](https://npmcharts.com/compare/react-split-pane?minimal=true)
9
7
  [![Build Status](https://img.shields.io/travis/tomkp/react-split-pane/master.svg?style=flat-square)](https://travis-ci.org/tomkp/react-split-pane)
10
8
  [![Coverage Status](https://img.shields.io/coveralls/tomkp/react-split-pane/master.svg?style=flat-square)](https://coveralls.io/r/tomkp/react-split-pane)
11
9
 
10
+ Split-Pane React component, can be nested or split vertically or horizontally. Check out some demos [here](http://react-split-pane.surge.sh/)!
12
11
 
13
- Check out the [demos](http://react-split-pane.surge.sh/)
12
+ ## Installing
13
+ ```sh
14
+ npm install react-split-pane
14
15
 
16
+ # or if you use yarn
15
17
 
16
- ```html
17
- <SplitPane split="vertical" minSize={50} defaultSize={100}>
18
- <div></div>
19
- <div></div>
20
- </SplitPane>
18
+ yarn add react-split-pane
21
19
  ```
22
20
 
23
- ```html
24
- <SplitPane split="vertical" minSize={50}>
25
- <div></div>
26
- <SplitPane split="horizontal">
27
- <div></div>
28
- <div></div>
29
- </SplitPane>
30
- </SplitPane>
21
+ ## Example Usage
22
+ ```jsx
23
+ <SplitPane split="vertical" minSize={50} defaultSize={100}>
24
+ <div></div>
25
+ <div></div>
26
+ </SplitPane>
27
+ ```
28
+
29
+ ```jsx
30
+ <SplitPane split="vertical" minSize={50}>
31
+ <div></div>
32
+ <SplitPane split="horizontal">
33
+ <div></div>
34
+ <div></div>
35
+ </SplitPane>
36
+ </SplitPane>
31
37
  ```
32
38
 
33
- ### Primary pane
39
+ ## Props
34
40
 
41
+ ### primary
35
42
  By dragging 'draggable' surface you can change size of the first pane.
36
43
  The first pane keeps then its size while the second pane is resized by browser window.
37
44
  By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.
@@ -44,7 +51,7 @@ You can also set the size of the pane using the `size` prop. Note that a size se
44
51
 
45
52
  In this example right pane keeps its width 200px while user is resizing browser window.
46
53
 
47
- ```html
54
+ ```jsx
48
55
  <SplitPane split="vertical" defaultSize={200} primary="second">
49
56
  <div></div>
50
57
  <div></div>
@@ -63,7 +70,25 @@ size of the 'resizable' pane in this case). This can be useful also in the full-
63
70
  ### step
64
71
  You can use the step prop to only allow resizing in fixed increments.
65
72
 
66
- ### Persisting Positions
73
+ ### onDragStarted
74
+ This callback is invoked when a drag starts.
75
+
76
+ ### onDragFinished
77
+ This callback is invoked when a drag ends.
78
+
79
+ ### onChange
80
+ This callback is invoked with the current drag during a drag event. It is recommended that it is wrapped in a debounce function.
81
+
82
+ ### Inline Styles
83
+
84
+ You can also pass inline styles to the components via props. These are:
85
+
86
+ * `paneStyle` - Styling to be applied to both panes
87
+ * `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
88
+ * `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
89
+ * `resizerStyle` - Styling to be applied to the resizer bar
90
+
91
+ ## Persisting Positions
67
92
 
68
93
  Each SplitPane accepts an onChange function prop. Used in conjunction with
69
94
  defaultSize and a persistence layer, you can ensure that your splitter choices
@@ -72,7 +97,7 @@ survive a refresh of your app.
72
97
  For example, if you are comfortable with the trade-offs of localStorage, you
73
98
  could do something like the following:
74
99
 
75
- ```html
100
+ ```jsx
76
101
  <SplitPane split="vertical" minSize={50}
77
102
  defaultSize={ parseInt(localStorage.getItem('splitPos'), 10) }
78
103
  onChange={ size => localStorage.setItem('splitPos', size) }>
@@ -96,12 +121,7 @@ https://github.com/mozilla/localForage although hooking it up will be slightly
96
121
  more involved. You are likely to be admired by all for judiciously avoiding
97
122
  use of localStorage.
98
123
 
99
- ### Resizing callbacks
100
-
101
- If you need more control over resizing, SplitPane can notify you about when resizing started
102
- and when it ended through two callbacks: `onDragStarted` and `onDragFinished`.
103
-
104
- ### Example styling
124
+ ## Example styling
105
125
 
106
126
  This gives a single pixel wide divider, but with a 'grabbable' surface of 11 pixels.
107
127
 
@@ -161,23 +181,13 @@ Thanks to ```background-clip: padding-box;``` for making transparent borders pos
161
181
  }
162
182
 
163
183
  ```
164
- ### Inline Styles
165
184
 
166
- You can also pass inline styles to the components via props. These are:
167
-
168
- * `paneStyle` - Styling to be applied to both panes
169
- * `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
170
- * `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
171
- * `resizerStyle` - Styling to be applied to the resizer bar
185
+ ## Contributing
172
186
 
173
-
174
- ### Contributing
175
-
176
- I'm always happy to receive Pull Requests for contributions of any kind.
187
+ I'm always happy to receive Pull Requests for contributions of any kind.
177
188
 
178
189
  Please include tests and/or update the examples if possible.
179
-
190
+
180
191
  **I'm working on an updated version of this library, and looking for help:** https://github.com/tomkp/react-split-pane/pull/240
181
-
192
+
182
193
  Thanks, Tom
183
-