treege 3.0.0-beta.7 → 3.0.0-beta.8

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 +92 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -27,17 +27,23 @@ Treege is a modern React library for creating and rendering interactive decision
27
27
 
28
28
  ### Visual Editor (`treege/editor`)
29
29
  - **Node-based Interface**: Drag-and-drop editor powered by ReactFlow
30
- - **5 Node Types**: Flow, Group, Input, JSON, and UI nodes
31
- - **Conditional Edges**: Advanced logic with AND/OR operators
32
- - **Multi-language Support**: Built-in translation system
30
+ - **4 Node Types**: Flow, Group, Input, and UI nodes
31
+ - **Conditional Edges**: Advanced logic with AND/OR operators (`===`, `!==`, `>`, `<`, `>=`, `<=`)
32
+ - **Multi-language Support**: Built-in translation system for all labels
33
33
  - **Type-safe**: Full TypeScript support
34
+ - **Mini-map & Controls**: Navigation tools for complex trees
35
+ - **Theme Support**: Dark/light mode with customizable backgrounds
34
36
 
35
37
  ### Runtime Renderer (`treege/renderer`)
36
- - **Form Generation**: Automatically render forms from decision trees
37
- - **Validation**: Built-in required and pattern validation
38
- - **Conditional Logic**: Dynamic field visibility based on user input
39
- - **Customizable**: Override default components with your own
38
+ - **Production Ready**: Full-featured form generation and validation system
39
+ - **16 Input Types**: text, number, select, checkbox, radio, date, daterange, time, timerange, file, address, http, textarea, password, switch, autocomplete, and hidden
40
+ - **HTTP Integration**: Built-in API integration with response mapping and search functionality
41
+ - **Advanced Validation**: Required fields, pattern matching, custom validation functions
42
+ - **Conditional Logic**: Dynamic field visibility based on user input and conditional edges
43
+ - **Web & Native**: Both web (React) and React Native renderer implementations
44
+ - **Fully Customizable**: Override any component (FormWrapper, Group, Inputs, SubmitButton, UI elements)
40
45
  - **Theme Support**: Dark/light mode out of the box
46
+ - **Google API Integration**: Address autocomplete support
41
47
 
42
48
  ### Developer Experience
43
49
  - **Modular**: Import only what you need (editor, renderer, or both)
@@ -200,7 +206,7 @@ Form input with validation, patterns, and conditional logic.
200
206
  }
201
207
  ```
202
208
 
203
- Supported input types: `text`, `email`, `password`, `number`, `textarea`, `select`, `radio`, `checkbox`, `switch`, `date`, `dateRange`, `time`, `timeRange`, `file`, `address`, `http`
209
+ Supported input types: `text`, `number`, `textarea`, `password`, `select`, `radio`, `checkbox`, `switch`, `autocomplete`, `date`, `daterange`, `time`, `timerange`, `file`, `address`, `http`, `hidden`
204
210
 
205
211
  ### Group Node
206
212
  Container for organizing multiple nodes together.
@@ -214,31 +220,23 @@ Container for organizing multiple nodes together.
214
220
  }
215
221
  ```
216
222
 
217
- ### JSON Node
218
- Store and manage JSON data within the tree.
219
-
220
- ```tsx
221
- {
222
- type: "json",
223
- data: {
224
- json: { key: "value" }
225
- }
226
- }
227
- ```
228
-
229
223
  ### UI Node
230
- Display-only elements (titles, descriptions, separators).
224
+ Display-only elements for visual organization and content display.
231
225
 
232
226
  ```tsx
233
227
  {
234
228
  type: "ui",
235
229
  data: {
236
- type: "title",
230
+ type: "title", // or "divider"
237
231
  label: "Welcome to the form"
238
232
  }
239
233
  }
240
234
  ```
241
235
 
236
+ Supported UI types:
237
+ - `title` - Display headings and titles
238
+ - `divider` - Visual separator between sections
239
+
242
240
  ## Conditional Edges
243
241
 
244
242
  Create dynamic flows with conditional logic:
@@ -337,6 +335,78 @@ Control when validation occurs:
337
335
  <TreegeRenderer validationMode="onChange" />
338
336
  ```
339
337
 
338
+ ### HTTP Input Integration
339
+
340
+ Use the HTTP input type to fetch and map data from APIs:
341
+
342
+ ```tsx
343
+ {
344
+ type: "input",
345
+ data: {
346
+ type: "http",
347
+ name: "country",
348
+ label: "Select your country",
349
+ httpConfig: {
350
+ method: "GET",
351
+ url: "https://api.example.com/countries",
352
+ responsePath: "$.data.countries", // JSONPath to extract data
353
+ mapping: {
354
+ label: "name",
355
+ value: "code"
356
+ },
357
+ searchParam: "query", // Enable search functionality
358
+ fetchOnMount: true
359
+ }
360
+ }
361
+ }
362
+ ```
363
+
364
+ ### Global Configuration
365
+
366
+ Configure the renderer globally using the TreegeConfigProvider:
367
+
368
+ ```tsx
369
+ import { TreegeConfigProvider } from "treege/renderer";
370
+
371
+ function App() {
372
+ return (
373
+ <TreegeConfigProvider
374
+ config={{
375
+ language: "fr",
376
+ googleApiKey: "your-google-api-key",
377
+ components: {
378
+ // Your custom components
379
+ }
380
+ }}
381
+ >
382
+ <TreegeRenderer flows={flow} />
383
+ </TreegeConfigProvider>
384
+ );
385
+ }
386
+ ```
387
+
388
+ ### Programmatic Control
389
+
390
+ Use the `useTreegeRenderer` hook for programmatic control:
391
+
392
+ ```tsx
393
+ import { useTreegeRenderer } from "treege/renderer";
394
+
395
+ function CustomForm() {
396
+ const { values, setFieldValue, submit, reset } = useTreegeRenderer();
397
+
398
+ return (
399
+ <div>
400
+ <button onClick={() => setFieldValue("email", "test@example.com")}>
401
+ Prefill Email
402
+ </button>
403
+ <button onClick={submit}>Submit</button>
404
+ <button onClick={reset}>Reset</button>
405
+ </div>
406
+ );
407
+ }
408
+ ```
409
+
340
410
  ## Examples
341
411
 
342
412
  Check out the `/example` directory for complete examples:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "treege",
3
3
  "description": "Powerful form generator",
4
4
  "license": "ISC",
5
- "version": "3.0.0-beta.7",
5
+ "version": "3.0.0-beta.8",
6
6
  "type": "module",
7
7
  "types": "./dist/main.d.ts",
8
8
  "module": "./dist/main.js",