@arcanejs/react-toolkit 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +105 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -11,6 +11,9 @@ browsers / devices / clients simultaneously,
11
11
  and changes caused by any client will be immediately propagated to all other
12
12
  clients.
13
13
 
14
+ The UI has also been designed primarily with touch devices in mind,
15
+ but also works well with a cursor and keyboard.
16
+
14
17
  ## Status / Suitability / Security Disclaimer
15
18
 
16
19
  This project is **experimental**,
@@ -145,11 +148,111 @@ ready-to-run, we recommend that you check-out the
145
148
 
146
149
  ### `Button`
147
150
 
148
- TODO
151
+ **Properties:**
152
+
153
+ - `text: string` (optional)
154
+
155
+ Text to display on the button
156
+
157
+ - `icon: string` (optional)
158
+
159
+ In icon name from [Material Icons](https://fonts.google.com/icons) to include
160
+ on the button.
161
+
162
+ - `error: string` (optional)
163
+
164
+ When set, highlight the button in a way to indicate an error,
165
+ and expose the given text as a tooltip upon user hover.
166
+
167
+ - `mode: 'normal' | 'pressed'` (default: `'normal'`)
168
+
169
+ Should the button display as pressed or not.
170
+
171
+ - `onClick: () => void | Promise<void>`
172
+
173
+ Set an event listener for when the button is pressed.
174
+
175
+ The listener can throw an exception, or return a promise that rejects,
176
+ to indicate an error and propagate an error message to the user,
177
+ similar to setting the `error` property.
178
+
179
+ e.g.:
180
+
181
+ ```tsx
182
+ const MyComponent = () => (
183
+ <Button text="Stop" onClick={() => doAThing()} icon="close" />
184
+ );
185
+ ```
149
186
 
150
187
  ### `Group`
151
188
 
152
- TODO
189
+ This component is the primary building block when it comes to creating layouts,
190
+ you generally have many groups,
191
+ and nest them to achieve the desired layout.
192
+
193
+ You can think of a group as similar to a `<div>` or `<section>` in HTML.
194
+
195
+ **Properties:**
196
+
197
+ - `direction: 'horizontal' | 'vertical'` (default: `'horizontal'`)
198
+
199
+ Whether to arrange the children of this group in a row or column.
200
+
201
+ - `wrap: boolean` (default: false)
202
+
203
+ If true, when the group runs out of vertical or horizontal space, child
204
+ components will be wrapped, and start to be arranged on additional columns
205
+ or rows.
206
+
207
+ - `border: boolean` (default: false)
208
+
209
+ If true, this group will have a border and a different color background
210
+ to its parent.
211
+
212
+ This allows you to add a distinctive border between components,
213
+ without needing to set a header, add header components,
214
+ or make it collapsible.
215
+
216
+ - `title: string` (optional)
217
+
218
+ If set, will display a title as a header at the top of the group.
219
+
220
+ - `editableTitle: boolean` (default: false)
221
+
222
+ If true,
223
+ will allow the user to click on the title to change it,
224
+ which will trigger a callback to the listener `onTitleChanged`.
225
+
226
+ - `defaultCollapsibleState: 'open' | 'closed' | 'auto'`
227
+ (optional, default: `undefined`)
228
+
229
+ If set,
230
+ will allow the user to expand / collapse the given group,
231
+ by default set to the given state.
232
+
233
+ Whether a group is open or closed is independent on a per-client basis,
234
+ and a fresh page reload will set the collapsible state to the default set here.
235
+
236
+ - `labels: { text: string }[] | null` (default: null)
237
+
238
+ Adds labels next to the title in the group header.
239
+
240
+ **Special Child Components**
241
+
242
+ - `GroupHeader`
243
+
244
+ You can add components to the header of a group by wrapping them in a
245
+ `<GroupHeader/>` component directly under the `<Group/>`.
246
+
247
+ You can add as many separate `GroupHeader` components as needed throughout
248
+ a `<Group>` component's direct children,
249
+ and all nested components will be placed in the header.
250
+
251
+ Currently `GroupHeader` only supports rendering the following children:
252
+
253
+ - `Button`
254
+
255
+ TODO: example
153
256
 
154
257
  ### `Label`
155
258
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcanejs/react-toolkit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "description": "Build web-accessible control interfaces for your long-running Node.js processes",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "react": "^18",
43
- "@arcanejs/toolkit": "^0.1.1"
43
+ "@arcanejs/toolkit": "^0.2.0"
44
44
  },
45
45
  "files": [
46
46
  "dist"