treege 3.0.0-beta.7 → 3.0.0-beta.71

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 (209) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +476 -81
  3. package/dist/DefaultSubmitButton-C_141kVj.js +1802 -0
  4. package/dist/ThemeContext-BGeTYtnw.js +948 -0
  5. package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
  6. package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
  7. package/dist/editor/constants/defaultNode.d.ts +1 -1
  8. package/dist/editor/constants/edgeTypes.d.ts +3 -2
  9. package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
  10. package/dist/editor/constants/nodeSpacing.d.ts +25 -0
  11. package/dist/editor/constants/nodeTypes.d.ts +4 -5
  12. package/dist/editor/context/OpenApiContext.d.ts +79 -0
  13. package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
  14. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  15. package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
  16. package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
  17. package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
  18. package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
  19. package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
  20. package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
  21. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
  22. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
  23. package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
  24. package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
  25. package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
  26. package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
  27. package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
  28. package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
  29. package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
  30. package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
  31. package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
  32. package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
  33. package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
  34. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
  35. package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
  36. package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
  37. package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
  38. package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
  39. package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
  40. package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
  41. package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
  42. package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
  43. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
  44. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
  45. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
  46. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  47. package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
  48. package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
  49. package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
  50. package/dist/editor/hooks/useFlowActions.d.ts +6 -2
  51. package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
  52. package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
  53. package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
  54. package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
  55. package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
  56. package/dist/editor/hooks/useStackPosition.d.ts +14 -0
  57. package/dist/editor/hooks/useTranslate.d.ts +1 -1
  58. package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
  59. package/dist/editor/types/ai.d.ts +65 -0
  60. package/dist/editor/types/editor.d.ts +97 -10
  61. package/dist/editor/types/openapi.d.ts +106 -0
  62. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  63. package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
  64. package/dist/editor/utils/dagreLayout.d.ts +8 -0
  65. package/dist/editor/utils/edge.d.ts +50 -0
  66. package/dist/editor/utils/groupColor.d.ts +14 -0
  67. package/dist/editor/utils/image.d.ts +7 -0
  68. package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
  69. package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
  70. package/dist/editor/utils/openApiPayload.d.ts +12 -0
  71. package/dist/editor/utils/openapi.d.ts +35 -0
  72. package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
  73. package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
  74. package/dist/editor-CkCA6_WX.js +6407 -0
  75. package/dist/editor.js +3 -7
  76. package/dist/main.js +6 -52
  77. package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
  78. package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
  79. package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
  80. package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
  81. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
  82. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
  83. package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
  84. package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
  85. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
  86. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
  87. package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
  88. package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
  89. package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
  90. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
  91. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
  92. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
  93. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
  94. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
  95. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
  96. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
  97. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
  98. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
  99. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
  100. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
  101. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
  102. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
  103. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
  104. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
  105. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
  106. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
  107. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
  108. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
  109. package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
  110. package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
  111. package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
  112. package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
  113. package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
  114. package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
  115. package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
  116. package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
  117. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  118. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  119. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  120. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  121. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  122. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  123. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  124. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  125. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  126. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  127. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  128. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  129. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
  130. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  131. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  132. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  133. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  134. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  135. package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
  136. package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
  137. package/dist/renderer/hooks/useRenderNode.d.ts +61 -0
  138. package/dist/renderer/hooks/useSubmitHandler.d.ts +36 -0
  139. package/dist/renderer/hooks/useTranslate.d.ts +7 -5
  140. package/dist/renderer/index.d.ts +4 -2
  141. package/dist/renderer/index.native.d.ts +19 -0
  142. package/dist/renderer/types/renderer.d.ts +279 -42
  143. package/dist/renderer/utils/flow.d.ts +1 -18
  144. package/dist/renderer/utils/form.d.ts +54 -2
  145. package/dist/renderer/utils/http.d.ts +161 -0
  146. package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
  147. package/dist/renderer/utils/node.d.ts +29 -1
  148. package/dist/renderer/utils/sanitize.d.ts +85 -0
  149. package/dist/renderer/utils/sanitize.native.d.ts +69 -0
  150. package/dist/renderer/utils/step.d.ts +27 -0
  151. package/dist/renderer/utils/submit.d.ts +49 -0
  152. package/dist/renderer/utils/templateDependencies.d.ts +17 -0
  153. package/dist/renderer-D5xQw7hp.js +255 -0
  154. package/dist/renderer-native.d.ts +2 -0
  155. package/dist/renderer-native.js +3826 -0
  156. package/dist/renderer.js +5 -45
  157. package/dist/shared/components/ui/badge.d.ts +2 -2
  158. package/dist/shared/components/ui/button.d.ts +3 -3
  159. package/dist/shared/components/ui/collapsible.d.ts +1 -1
  160. package/dist/shared/components/ui/command.d.ts +1 -1
  161. package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
  162. package/dist/shared/components/ui/field.d.ts +24 -0
  163. package/dist/shared/components/ui/form.d.ts +1 -1
  164. package/dist/shared/components/ui/item.d.ts +23 -0
  165. package/dist/shared/components/ui/popover.d.ts +10 -2
  166. package/dist/shared/components/ui/select.d.ts +3 -1
  167. package/dist/shared/components/ui/sheet.d.ts +1 -1
  168. package/dist/shared/components/ui/skeleton.d.ts +3 -0
  169. package/dist/shared/components/ui/toggle-group.d.ts +7 -0
  170. package/dist/shared/components/ui/toggle.d.ts +9 -0
  171. package/dist/shared/components/ui/tooltip.d.ts +1 -1
  172. package/dist/shared/constants/colors.d.ts +45 -0
  173. package/dist/shared/constants/inputType.d.ts +6 -0
  174. package/dist/shared/constants/node.d.ts +0 -1
  175. package/dist/shared/context/PortalContainerContext.d.ts +5 -0
  176. package/dist/shared/context/ThemeContext.d.ts +2 -0
  177. package/dist/shared/context/ThemeContext.native.d.ts +22 -0
  178. package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
  179. package/dist/shared/hooks/useThemeColors.d.ts +37 -0
  180. package/dist/shared/locales/ar.json.d.ts +253 -19
  181. package/dist/shared/locales/de.json.d.ts +254 -20
  182. package/dist/shared/locales/en.json.d.ts +255 -21
  183. package/dist/shared/locales/es.json.d.ts +254 -20
  184. package/dist/shared/locales/fr.json.d.ts +254 -20
  185. package/dist/shared/locales/it.json.d.ts +254 -20
  186. package/dist/shared/locales/pt.json.d.ts +254 -20
  187. package/dist/shared/types/edge.d.ts +6 -0
  188. package/dist/shared/types/node.d.ts +146 -18
  189. package/dist/shared/utils/httpRecord.d.ts +20 -0
  190. package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
  191. package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
  192. package/dist/useRenderNode-eqCek6JX.js +536 -0
  193. package/package.json +54 -22
  194. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  195. package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
  196. package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
  197. package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
  198. package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
  199. package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
  200. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
  201. package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
  202. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
  203. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
  204. package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
  205. package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
  206. package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
  207. package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
  208. package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
  209. /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
  <img alt="Treege" src="https://user-images.githubusercontent.com/108873902/189673125-5d1fdaf3-82d1-486f-bb16-01b0554bd4f1.png" style="padding: 20px;" width="auto" height="100" />
3
3
 
4
4
  <h1>Treege</h1>
5
- <p><strong>Build powerful decision trees with a visual node-based editor</strong></p>
5
+ <p><strong>Building complex, dynamic forms has never been this simple</strong></p>
6
6
 
7
7
  [![npm version](https://badge.fury.io/js/treege.svg)](https://badge.fury.io/js/treege)
8
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
9
 
10
10
  <p>
11
11
  <a href="https://treege.io/">🌐 Website</a> •
@@ -13,7 +13,8 @@
13
13
  <a href="#features">Features</a> •
14
14
  <a href="#installation">Installation</a> •
15
15
  <a href="#quick-start">Quick Start</a> •
16
- <a href="#examples">Examples</a>
16
+ <a href="#examples">Examples</a>
17
+ <a href="./AI_GENERATION.md">🪄 AI Generation</a>
17
18
  </p>
18
19
  </div>
19
20
 
@@ -21,23 +22,36 @@
21
22
 
22
23
  ## Overview
23
24
 
24
- Treege is a modern React library for creating and rendering interactive decision trees. Built on top of ReactFlow, it provides a complete solution for building complex form flows, decision logic, and conditional workflows with an intuitive visual editor.
25
+ Treege is a modern React library for creating and rendering interactive decision trees. Built on top of ReactFlow, it provides a complete solution for building complex form flow, decision logic, and conditional workflows with an intuitive visual editor.
25
26
 
26
27
  ## Features
27
28
 
28
29
  ### Visual Editor (`treege/editor`)
29
30
  - **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
31
+ - **3 Node Types**: Input, UI, and Group nodes
32
+ - **Conditional Edges**: Advanced logic with AND/OR operators (`===`, `!==`, `>`, `<`, `>=`, `<=`)
33
+ - **AI-Powered Generation**: Generate decision trees from natural language descriptions using Gemini, OpenAI, DeepSeek, or Claude ([Learn more](./AI_GENERATION.md))
34
+ - **Multi-language Support**: Built-in translation system for all labels
33
35
  - **Type-safe**: Full TypeScript support
36
+ - **Mini-map & Controls**: Navigation tools for complex trees
37
+ - **Theme Support**: Dark/light mode with customizable backgrounds
34
38
 
35
39
  ### 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
40
+ - **Production Ready**: Full-featured form generation and validation system
41
+ - **16 Input Types**: text, number, select, checkbox, radio, date, daterange, time, timerange, file, address, http, textarea, password, switch, autocomplete, and hidden
42
+ - **Cross-Platform**: Full support for both React Web and React Native with dedicated implementations
43
+ - **HTTP Integration**: Built-in API integration with response mapping and search functionality
44
+ - **Advanced Validation**: Required fields, pattern matching, custom validation functions
45
+ - **Security**: Built-in input sanitization to prevent XSS attacks
46
+ - **Enhanced Error Messages**: Clear, user-friendly error messages for HTTP inputs and validation
47
+ - **Conditional Logic**: Dynamic field visibility based on user input and conditional edges
48
+ - **Multi-Step Forms**: Group nodes are automatically turned into navigable steps with Back/Continue controls, an `onBack` bridge to outer flows, and external-button submission via `formId`
49
+ - **Edit Mode**: Pre-fill with `initialValues` (accepts name keys, reactive) to round-trip and edit previously submitted records
50
+ - **Loading State**: Built-in `isLoading` prop renders a customizable skeleton while the flow is being fetched, plus `isSubmitting` to drive the button's loading state from async submits
51
+ - **Fully Customizable**: Override any component (form, inputs, ui, step, submitButton, submitButtonWrapper, loadingSkeleton)
52
+ - **Optional Dependencies**: Graceful degradation when optional packages like `react-native-document-picker` aren't installed
40
53
  - **Theme Support**: Dark/light mode out of the box
54
+ - **Google API Integration**: Address autocomplete support
41
55
 
42
56
  ### Developer Experience
43
57
  - **Modular**: Import only what you need (editor, renderer, or both)
@@ -48,6 +62,9 @@ Treege is a modern React library for creating and rendering interactive decision
48
62
  ## Installation
49
63
 
50
64
  ```bash
65
+ # bun
66
+ bun add treege
67
+
51
68
  # npm
52
69
  npm install treege
53
70
 
@@ -56,9 +73,6 @@ pnpm add treege
56
73
 
57
74
  # yarn
58
75
  yarn add treege
59
-
60
- # bun
61
- bun add treege
62
76
  ```
63
77
 
64
78
  ## Quick Start
@@ -119,7 +133,7 @@ function App() {
119
133
 
120
134
  return (
121
135
  <TreegeRenderer
122
- flows={flow}
136
+ flow={flow}
123
137
  onSubmit={handleSubmit}
124
138
  />
125
139
  );
@@ -146,7 +160,7 @@ function App() {
146
160
  {mode === "edit" ? (
147
161
  <TreegeEditor flow={flow} onSave={setFlow} />
148
162
  ) : (
149
- <TreegeRenderer flows={flow} onSubmit={console.log} />
163
+ <TreegeRenderer flow={flow} onSubmit={console.log} />
150
164
  )}
151
165
  </div>
152
166
  );
@@ -155,7 +169,7 @@ function App() {
155
169
 
156
170
  ## Module Structure
157
171
 
158
- Treege provides three import paths for optimal bundle size:
172
+ Treege provides multiple import paths for optimal bundle size:
159
173
 
160
174
  ```tsx
161
175
  // Import everything (editor + renderer + types)
@@ -164,25 +178,187 @@ import { TreegeEditor, TreegeRenderer } from "treege";
164
178
  // Import only the editor
165
179
  import { TreegeEditor } from "treege/editor";
166
180
 
167
- // Import only the renderer
181
+ // Import only the web renderer
168
182
  import { TreegeRenderer } from "treege/renderer";
183
+
184
+ // Import only the React Native renderer
185
+ import { TreegeRenderer } from "treege/renderer-native";
169
186
  ```
170
187
 
171
- ## Node Types
188
+ ## React Native Support
189
+
190
+ Treege 3.0 includes full React Native support with a dedicated renderer implementation.
191
+
192
+ ### Installation for React Native
193
+
194
+ ```bash
195
+ # Install Treege
196
+ npm install treege
197
+
198
+ # Install peer dependencies
199
+ npm install react-native
172
200
 
173
- ### Flow Node
174
- Navigation node that controls the flow between different parts of the tree.
201
+ # Optional: Install for file input support
202
+ npm install react-native-document-picker
203
+ ```
204
+
205
+ ### Basic Usage
175
206
 
176
207
  ```tsx
177
- {
178
- type: "flow",
179
- data: {
180
- targetId: "next-node-id",
181
- label: "Continue"
182
- }
208
+ import { TreegeRenderer } from "treege/renderer-native";
209
+ import type { Flow, FormValues } from "treege";
210
+
211
+ function App() {
212
+ const flow: Flow = {
213
+ id: "flow-1",
214
+ nodes: [
215
+ {
216
+ id: "name",
217
+ type: "input",
218
+ data: {
219
+ type: "text",
220
+ name: "fullName",
221
+ label: "Full Name",
222
+ required: true
223
+ }
224
+ },
225
+ {
226
+ id: "email",
227
+ type: "input",
228
+ data: {
229
+ type: "text",
230
+ name: "email",
231
+ label: "Email",
232
+ required: true,
233
+ pattern: "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$"
234
+ }
235
+ }
236
+ ],
237
+ edges: []
238
+ };
239
+
240
+ const handleSubmit = (values: FormValues) => {
241
+ console.log("Form submitted:", values);
242
+ };
243
+
244
+ return (
245
+ <TreegeRenderer
246
+ flow={flow}
247
+ onSubmit={handleSubmit}
248
+ />
249
+ );
183
250
  }
184
251
  ```
185
252
 
253
+ ### Custom Styling
254
+
255
+ You can customize the appearance using the `style` and `contentContainerStyle` props:
256
+
257
+ ```tsx
258
+ <TreegeRenderer
259
+ flow={flow}
260
+ onSubmit={handleSubmit}
261
+ style={{ flex: 1, backgroundColor: "#f5f5f5" }}
262
+ contentContainerStyle={{ padding: 20 }}
263
+ />
264
+ ```
265
+
266
+ ### Custom Components
267
+
268
+ Override default components with your own React Native components.
269
+
270
+ Each input renderer is a **React component** receiving a single props object with two keys:
271
+
272
+ 1. `field` — DOM-safe props (`id`, `name`, `value`, `placeholder`, `required`, `aria-invalid`). On the web you can spread them onto an element (`<input {...field} />`); on React Native pick the ones you need.
273
+ 2. `extra` — Treege-specific props: `setValue`, `error`, `label`, `helperText`, `node`, and `missingDependencies` (the unfilled fields this input's dynamic options depend on).
274
+
275
+ ```tsx
276
+ import { Text, TextInput, View } from "react-native";
277
+ import { TreegeRenderer } from "treege/renderer-native";
278
+
279
+ const CustomTextInput = ({ field, extra }) => {
280
+ return (
281
+ <View style={{ marginBottom: 16 }}>
282
+ <Text style={{ fontSize: 14, marginBottom: 4 }}>{extra.label}</Text>
283
+ <TextInput
284
+ value={field.value}
285
+ placeholder={field.placeholder}
286
+ onChangeText={extra.setValue}
287
+ style={{
288
+ borderWidth: 1,
289
+ borderColor: extra.error ? "red" : "#ccc",
290
+ padding: 10,
291
+ borderRadius: 8
292
+ }}
293
+ />
294
+ {extra.error && <Text style={{ color: "red", fontSize: 12 }}>{extra.error}</Text>}
295
+ {extra.missingDependencies.length > 0 && (
296
+ <Text style={{ color: "#b45309", fontSize: 12 }}>
297
+ Please fill in first: {extra.missingDependencies.map((d) => d.label).join(", ")}
298
+ </Text>
299
+ )}
300
+ </View>
301
+ );
302
+ };
303
+
304
+ <TreegeRenderer
305
+ flow={flow}
306
+ components={{
307
+ inputs: {
308
+ text: CustomTextInput
309
+ }
310
+ }}
311
+ />
312
+ ```
313
+
314
+ ### Supported Input Types
315
+
316
+ The React Native renderer includes default implementations for all input types:
317
+
318
+ **Fully Implemented (Vanilla React Native)**:
319
+ - `text`, `number`, `textarea`, `password`
320
+ - `checkbox`, `switch`, `hidden`
321
+
322
+ **With Optional Dependencies** (gracefully degrades if not installed):
323
+ - `file` - Requires [react-native-document-picker](https://github.com/rnmods/react-native-document-picker) (optional)
324
+
325
+ **Requires Custom Implementation** (placeholder provided):
326
+ - `select`, `radio`, `autocomplete`
327
+ - `date`, `daterange`, `time`, `timerange`
328
+ - `address`, `http`
329
+
330
+ You can implement these inputs using popular React Native libraries:
331
+ - [@react-native-picker/picker](https://github.com/react-native-picker/picker) for `select` and `radio`
332
+ - [react-native-date-picker](https://github.com/henninghall/react-native-date-picker) for `date` and `time` inputs
333
+ - [@react-native-community/google-places-autocomplete](https://github.com/FaridSafi/react-native-google-places-autocomplete) for `address`
334
+
335
+ ### API Reference
336
+
337
+ The React Native renderer shares the same API as the web renderer, with some platform-specific props:
338
+
339
+ | Prop | Type | Default | Description |
340
+ |-------------------------|---------------------------------------------|--------------|-----------------------------------------------------------------------------------------------------------------|
341
+ | `flow` | `Flow \| null` | - | Decision tree to render |
342
+ | `onSubmit` | `(values: FormValues, meta?: Meta) => void` | - | Form submission handler (meta includes HTTP response data) |
343
+ | `onChange` | `(values: FormValues) => void` | - | Form change handler |
344
+ | `validate` | `(values, nodes) => Record<string, string>` | - | Custom validation function |
345
+ | `initialValues` | `FormValues` | `{}` | Pre-fill values to edit a record. Accepts `node.id` or name keys; reactive (re-seeds if it changes after mount) |
346
+ | `components` | `TreegeRendererComponents` | - | Custom component overrides |
347
+ | `language` | `string` | `"en"` | UI language |
348
+ | `validationMode` | `"onSubmit" \| "onChange"` | `"onSubmit"` | When to validate |
349
+ | `theme` | `"light" \| "dark"` | `"dark"` | Renderer theme |
350
+ | `googleApiKey` | `string` | - | API key for address input |
351
+ | `headers` | `HttpHeaders` | - | HTTP headers as `{ name: value }`, applied to every request (field-level wins) |
352
+ | `isLoading` | `boolean` | `false` | Render a loading skeleton instead of the form |
353
+ | `isSubmitting` | `boolean` | `false` | Force the submit/continue button into its loading state (OR-ed with internal state) |
354
+ | `onBack` | `() => void` | - | Called when Back is clicked on the first step; bridges to an outer flow |
355
+ | `style` | `ViewStyle` | - | ScrollView style (RN only) |
356
+ | `contentContainerStyle` | `ViewStyle` | - | Content container style (RN) |
357
+
358
+ ## Node Types
359
+
360
+ Treege has three node types: `input`, `ui`, and `group`. Navigation is automatic — group nodes drive step navigation and conditional edges drive branching.
361
+
186
362
  ### Input Node
187
363
  Form input with validation, patterns, and conditional logic.
188
364
 
@@ -200,10 +376,10 @@ Form input with validation, patterns, and conditional logic.
200
376
  }
201
377
  ```
202
378
 
203
- Supported input types: `text`, `email`, `password`, `number`, `textarea`, `select`, `radio`, `checkbox`, `switch`, `date`, `dateRange`, `time`, `timeRange`, `file`, `address`, `http`
379
+ Supported input types: `text`, `number`, `textarea`, `password`, `select`, `radio`, `checkbox`, `switch`, `autocomplete`, `date`, `daterange`, `time`, `timerange`, `file`, `address`, `http`, `hidden`
204
380
 
205
381
  ### Group Node
206
- Container for organizing multiple nodes together.
382
+ Container for organizing multiple nodes together. Groups also drive **multi-step forms**: at runtime each group of visible nodes becomes a navigable step (Back/Continue). Child nodes belong to a group via their `parentId`.
207
383
 
208
384
  ```tsx
209
385
  {
@@ -214,34 +390,26 @@ Container for organizing multiple nodes together.
214
390
  }
215
391
  ```
216
392
 
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
393
  ### UI Node
230
- Display-only elements (titles, descriptions, separators).
394
+ Display-only elements for visual organization and content display.
231
395
 
232
396
  ```tsx
233
397
  {
234
398
  type: "ui",
235
399
  data: {
236
- type: "title",
400
+ type: "title", // or "divider"
237
401
  label: "Welcome to the form"
238
402
  }
239
403
  }
240
404
  ```
241
405
 
406
+ Supported UI types:
407
+ - `title` - Display headings and titles
408
+ - `divider` - Visual separator between sections
409
+
242
410
  ## Conditional Edges
243
411
 
244
- Create dynamic flows with conditional logic:
412
+ Create dynamic flow with conditional logic:
245
413
 
246
414
  ```tsx
247
415
  {
@@ -287,17 +455,30 @@ Treege supports multiple languages out of the box:
287
455
 
288
456
  ### Custom Input Components
289
457
 
290
- Override default input renderers with your own:
458
+ Override default input renderers with your own. A renderer is a React component
459
+ receiving a single props object: `field` (DOM-safe props, spreadable onto an
460
+ element) and `extra` (`setValue`, `error`, `label`, `helperText`, `node`,
461
+ `missingDependencies`).
291
462
 
292
463
  ```tsx
293
464
  import { TreegeRenderer } from "treege/renderer";
294
465
 
295
- const CustomTextInput = ({ node }) => {
296
- return <input className="my-custom-input" />;
466
+ const CustomTextInput = ({ field, extra }) => {
467
+ return (
468
+ <label>
469
+ {extra.label}
470
+ <input
471
+ {...field}
472
+ className="my-custom-input"
473
+ onChange={(e) => extra.setValue(e.target.value)}
474
+ />
475
+ {extra.error && <span className="error">{extra.error}</span>}
476
+ </label>
477
+ );
297
478
  };
298
479
 
299
480
  <TreegeRenderer
300
- flows={flow}
481
+ flow={flow}
301
482
  components={{
302
483
  inputs: {
303
484
  text: CustomTextInput
@@ -312,7 +493,7 @@ Add custom validation logic:
312
493
 
313
494
  ```tsx
314
495
  <TreegeRenderer
315
- flows={flow}
496
+ flow={flow}
316
497
  validate={(values, visibleNodes) => {
317
498
  const errors = {};
318
499
 
@@ -337,68 +518,282 @@ Control when validation occurs:
337
518
  <TreegeRenderer validationMode="onChange" />
338
519
  ```
339
520
 
521
+ ### HTTP Input Integration
522
+
523
+ Use the HTTP input type to fetch and map data from APIs:
524
+
525
+ ```tsx
526
+ {
527
+ type: "input",
528
+ data: {
529
+ type: "http",
530
+ name: "country",
531
+ label: "Select your country",
532
+ httpConfig: {
533
+ method: "GET",
534
+ url: "https://api.example.com/countries",
535
+ responsePath: "$.data.countries", // JSONPath to extract data
536
+ mapping: {
537
+ label: "name",
538
+ value: "code"
539
+ },
540
+ searchParam: "query", // Enable search functionality
541
+ fetchOnMount: true
542
+ }
543
+ }
544
+ }
545
+ ```
546
+
547
+ ### Global Configuration
548
+
549
+ Configure the renderer globally using the TreegeRendererProvider:
550
+
551
+ ```tsx
552
+ import { TreegeRendererProvider } from "treege/renderer";
553
+
554
+ function App() {
555
+ return (
556
+ <TreegeRendererProvider
557
+ language="fr"
558
+ googleApiKey="your-google-api-key"
559
+ components={{
560
+ // Your custom components
561
+ }}
562
+ >
563
+ <TreegeRenderer flow={flow} />
564
+ </TreegeRendererProvider>
565
+ );
566
+ }
567
+ ```
568
+
569
+ ### Loading State
570
+
571
+ When the flow is being fetched asynchronously, pass `isLoading` to render a skeleton in place of the form:
572
+
573
+ ```tsx
574
+ function App() {
575
+ const { data: flow, isPending } = useQuery(/* ... */);
576
+
577
+ return <TreegeRenderer flow={flow ?? null} isLoading={isPending} onSubmit={console.log} />;
578
+ }
579
+ ```
580
+
581
+ Customize the skeleton via `components.loadingSkeleton`:
582
+
583
+ ```tsx
584
+ <TreegeRenderer
585
+ flow={flow}
586
+ isLoading={isPending}
587
+ components={{
588
+ loadingSkeleton: () => <MyCustomSkeleton />,
589
+ }}
590
+ />
591
+ ```
592
+
593
+ ### Editing an Existing Submission
594
+
595
+ To edit a record that was already filled in, pass it to `initialValues`. The keys can be either `node.id` **or** the same name-based keys you receive from `onSubmit`/`onChange`, so you can round-trip the submitted object directly — no remapping needed:
596
+
597
+ ```tsx
598
+ const handleSubmit = (values) => save(values); // e.g. { firstName: "Alice", email: "a@b.com" }
599
+
600
+ // later, to edit the saved record:
601
+ <TreegeRenderer flow={flow} initialValues={savedRecord} onSubmit={handleSubmit} />
602
+ ```
603
+
604
+ `initialValues` is **reactive**: if it changes after mount (e.g. an async-fetched record resolves later), the form is re-seeded automatically — no `key` prop or `isLoading` gate required. Passing a new object of identical content does not reset the form, so in-progress edits are preserved.
605
+
606
+ ```tsx
607
+ const { data } = useQuery(/* ... */);
608
+ <TreegeRenderer flow={flow} initialValues={data ?? {}} onSubmit={handleSubmit} />
609
+ ```
610
+
611
+ ### Submitting State
612
+
613
+ Pass `isSubmitting` to keep the submit/continue button in its loading state (spinner + disabled) while an async `onSubmit` resolves on your side. It's OR-ed with the renderer's own internal submitting state (e.g. during an HTTP `submitConfig` call):
614
+
615
+ ```tsx
616
+ <TreegeRenderer flow={flow} isSubmitting={mutation.isPending} onSubmit={handleSubmit} />
617
+ ```
618
+
619
+ ### Multi-Step Forms
620
+
621
+ When a flow contains **Group** nodes, the renderer automatically splits the form into navigable steps — each contiguous slice of visible nodes sharing the same group becomes one step, with built-in Back/Continue controls (Continue turns into Submit on the last step). Branching via conditional edges recomputes the steps on the fly.
622
+
623
+ Override the default step layout via `components.step`:
624
+
625
+ ```tsx
626
+ <TreegeRenderer
627
+ flow={flow}
628
+ components={{
629
+ step: ({ label, children, canGoBack, isLastStep, canContinue, isSubmitting, onBack, onContinue }) => (
630
+ <section>
631
+ <h2>{label}</h2>
632
+ {children}
633
+ {canGoBack && <button onClick={onBack}>Back</button>}
634
+ <button disabled={!canContinue || isSubmitting} onClick={onContinue}>
635
+ {isSubmitting ? "Submitting…" : isLastStep ? "Submit" : "Continue"}
636
+ </button>
637
+ </section>
638
+ ),
639
+ }}
640
+ />
641
+ ```
642
+
643
+ Use **`canGoBack`** (not `!isFirstStep`) to decide whether to show the Back control: it's `true` on any step past the first, and also on the first step when an `onBack` prop is provided.
644
+
645
+ #### Bridging navigation to an outer flow
646
+
647
+ When the renderer is embedded in a surrounding wizard (e.g. a modal with its own steps), use `onBack` to step back out of the renderer's first step, and `formId` to drive submission from an external button:
648
+
649
+ ```tsx
650
+ <TreegeRenderer
651
+ flow={flow}
652
+ formId="treege-form"
653
+ onBack={() => modal.goToPreviousStep()} // Back on step 0 → previous modal step
654
+ onSubmit={handleSubmit}
655
+ />
656
+
657
+ // A submit button living outside the renderer (web): only submits on the last
658
+ // step — on earlier steps it advances, like the built-in Continue button.
659
+ <button type="submit" form="treege-form">Save</button>
660
+ ```
661
+
662
+ ### Headless / Programmatic Control
663
+
664
+ Use the `useTreegeRenderer` hook to drive the form yourself (headless mode). It takes the same configuration as `TreegeRenderer` and returns the full form state and control methods:
665
+
666
+ ```tsx
667
+ import { useTreegeRenderer } from "treege/renderer";
668
+
669
+ function CustomForm({ flow }) {
670
+ const {
671
+ formValues,
672
+ setFieldValue,
673
+ handleSubmit,
674
+ formErrors,
675
+ visibleNodes,
676
+ isSubmitting,
677
+ currentStep,
678
+ goToNextStep,
679
+ goToPreviousStep,
680
+ } = useTreegeRenderer({
681
+ flow,
682
+ onSubmit: (values) => console.log("Submitted:", values),
683
+ });
684
+
685
+ return (
686
+ <div>
687
+ <button onClick={() => setFieldValue("email", "test@example.com")}>
688
+ Prefill Email
689
+ </button>
690
+ <button onClick={handleSubmit} disabled={isSubmitting}>
691
+ Submit
692
+ </button>
693
+ </div>
694
+ );
695
+ }
696
+ ```
697
+
698
+ > The `useTreegeRenderer` return type is exported as `UseTreegeRendererReturn` for TypeScript consumers building custom components.
699
+
340
700
  ## Examples
341
701
 
342
702
  Check out the `/example` directory for complete examples:
343
703
 
344
704
  ```bash
345
- # Run the example app
346
- bun example
705
+ # Run the web example app (Vite, opens /example)
706
+ bun run example
707
+
708
+ # Run the React Native example app (Expo)
709
+ bun run example:native
347
710
  ```
348
711
 
712
+ ### Available Example URLs
713
+
714
+ Once the development server is running, you can access these examples:
715
+
716
+ - **Default Example**: [http://localhost:5173/](http://localhost:5173/)
717
+ - Basic demonstration of Treege functionality
718
+
719
+ - **Demo Example**: [http://localhost:5173/example](http://localhost:5173/example)
720
+ - Full featured demo showcasing the library capabilities
721
+
722
+ - **All Inputs Example**: [http://localhost:5173/example-all-inputs](http://localhost:5173/example-all-inputs)
723
+ - Comprehensive showcase of all 16 input types
724
+
725
+ - **Custom Input Example**: [http://localhost:5173/example-custom-input](http://localhost:5173/example-custom-input)
726
+ - Demonstrates how to create and integrate custom input components
727
+
728
+ - **TreegeRendererProvider Example**: [http://localhost:5173/example-treege-renderer-provider](http://localhost:5173/example-treege-renderer-provider)
729
+ - Shows global configuration with TreegeRendererProvider
730
+
349
731
  ## API Reference
350
732
 
351
733
  ### TreegeEditor Props
352
734
 
353
- | Prop | Type | Default | Description |
354
- |------------|------------------------|----------|-----------------------------|
355
- | `flow` | `Flow \| null` | `null` | Initial decision tree |
356
- | `onSave` | `(flow: Flow) => void` | - | Callback when tree is saved |
357
- | `language` | `string` | `"en"` | UI language |
358
- | `theme` | `"light" \| "dark"` | `"dark"` | Editor theme |
735
+ | Prop | Type | Default | Description |
736
+ |-------------------|------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
737
+ | `flow` | `Flow \| null` | `null` | Initial decision tree |
738
+ | `onSave` | `(flow: Flow) => void` | - | Callback when tree is saved |
739
+ | `onExportJson` | `() => { nodes: Node[]; edges: Edge[] }` | - | Callback for exporting JSON data |
740
+ | `language` | `string` | `"en"` | UI language |
741
+ | `theme` | `"light" \| "dark"` | `"dark"` | Editor theme |
742
+ | `aiConfig` | `AIConfig` | - | AI configuration for tree generation (see [AI Generation](./AI_GENERATION.md)) |
743
+ | `className` | `string` | - | Additional CSS class names for custom styling |
744
+ | `extraMenuItems` | `ExtraMenuItem[]` | - | Extra entries appended to the actions panel "more" dropdown |
745
+ | `openApi` | `OpenApiDocument \| string` | - | OpenAPI 3.x source used to power URL/route suggestions and the Authorize flow. Accepts a pre-parsed document or a URL string (the editor fetches it on mount and toasts on failure) |
746
+ | `baseUrl` | `string` | - | Base URL the tree runs against. HTTP/options-source urls are stored relative to it, shown as a read-only prefix, and used to resolve the "Detect fields" probe. Pass the same value as `TreegeRenderer`'s `baseUrl` |
747
+ | `headers` | `HttpHeaders` | - | Global HTTP headers applied to in-editor requests (e.g. the "Detect fields" button). Pass the same value you give to `TreegeRenderer` so editor previews use the same auth/headers as runtime |
748
+ | `onAuthorize` | `(headers: HttpHeaders) => void` | - | Called when the user submits the Authorize dialog. Forward the resulting headers to `TreegeRenderer` (or `TreegeRendererProvider`) so every form request is authenticated |
749
+ | `onHeadersChange` | `(headers: HttpHeaders) => void` | - | Called when the user edits headers in the built-in "Global headers" dialog. The component is controlled — update your `headers` state in response and pass the new object back via the `headers` prop |
359
750
 
360
751
  ### TreegeRenderer Props
361
752
 
362
- | Prop | Type | Default | Description |
363
- |------------------|---------------------------------------------|--------------|----------------------------|
364
- | `flows` | `Flow \| null` | - | Decision tree to render |
365
- | `onSubmit` | `(values: FormValues) => void` | - | Form submission handler |
366
- | `onChange` | `(values: FormValues) => void` | - | Form change handler |
367
- | `validate` | `(values, nodes) => Record<string, string>` | - | Custom validation function |
368
- | `initialValues` | `FormValues` | `{}` | Initial form values |
369
- | `components` | `RendererComponents` | - | Custom component overrides |
370
- | `language` | `string` | `"en"` | UI language |
371
- | `validationMode` | `"onSubmit" \| "onChange"` | `"onSubmit"` | When to validate |
372
- | `theme` | `"light" \| "dark"` | `"dark"` | Renderer theme |
373
- | `googleApiKey` | `string` | - | API key for address input |
753
+ | Prop | Type | Default | Description |
754
+ |------------------|---------------------------------------------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
755
+ | `flow` | `Flow \| null` | - | Decision tree to render |
756
+ | `onSubmit` | `(values: FormValues, meta?: Meta) => void` | - | Form submission handler (meta includes HTTP response data) |
757
+ | `onChange` | `(values: FormValues) => void` | - | Form change handler |
758
+ | `validate` | `(values, nodes) => Record<string, string>` | - | Custom validation function |
759
+ | `initialValues` | `FormValues` | `{}` | Pre-fill values to edit a submitted record. Accepts `node.id` **or** name keys (same shape as `onSubmit`); reactive — re-seeds if it changes after mount (see below) |
760
+ | `components` | `TreegeRendererComponents` | - | Custom component overrides |
761
+ | `language` | `string` | `"en"` | UI language |
762
+ | `validationMode` | `"onSubmit" \| "onChange"` | `"onSubmit"` | When to validate |
763
+ | `theme` | `"light" \| "dark"` | `"dark"` | Renderer theme |
764
+ | `googleApiKey` | `string` | - | API key for address input |
765
+ | `headers` | `HttpHeaders` | - | HTTP headers as `{ name: value }`, applied to every request (field-level wins) |
766
+ | `isLoading` | `boolean` | `false` | Render a loading skeleton instead of the form (see below) |
767
+ | `isSubmitting` | `boolean` | `false` | Force the submit/continue button into its loading state (spinner + disabled). OR-ed with the internal submitting state — useful with an async `onSubmit` |
768
+ | `onBack` | `() => void` | - | Called when Back is clicked on the **first step**; bridges back-navigation to an outer flow (e.g. a parent modal). Shows a Back button on step 0 when provided |
769
+ | `formId` | `string` | - | Sets the `<form>` `id` so a submit button outside the renderer can target it via the native `form` attribute. Web only; submits only on the last step in multi-step flows |
770
+ | `className` | `string` | - | Additional CSS class names for custom styling |
374
771
 
375
772
  ## Development
376
773
 
377
774
  ```bash
378
775
  # Install dependencies
379
- yarn install
776
+ bun install
380
777
 
381
778
  # Start dev server
382
- yarn dev
779
+ bun run dev
383
780
 
384
781
  # Build library
385
- yarn build
782
+ bun run build
386
783
 
387
784
  # Run linter and type check
388
- yarn lint
785
+ bun run lint
389
786
 
390
787
  # Preview build
391
- yarn preview
788
+ bun run preview
392
789
  ```
393
790
 
394
791
  ## Tech Stack
395
792
 
396
- - **React** 18/19 - UI library
793
+ - **React** - UI library
397
794
  - **TypeScript** - Type safety
398
795
  - **TailwindCSS** 4 - Styling
399
796
  - **ReactFlow** - Node-based UI
400
- - **Radix UI** - Accessible components
401
- - **Zustand** - State management
402
797
  - **Vite** - Build tool
403
798
 
404
799
  ## Contributing
@@ -407,13 +802,13 @@ Contributions are welcome! Please feel free to submit a Pull Request.
407
802
 
408
803
  ## License
409
804
 
410
- ISC
805
+ MIT
411
806
 
412
807
  ## Credits
413
808
 
414
- Created and maintained by [Mickaël Austoni](https://github.com/Tracktor)
809
+ Created and maintained by [Mickaël Austoni](https://github.com/MickaelAustoni)
415
810
 
416
811
  ## Support
417
812
 
418
- - [GitHub Issues](https://github.com/Tracktor/treege/issues)
419
- - [Repository](https://github.com/Tracktor/treege)
813
+ - [GitHub Issues](https://github.com/MickaelAustoni/treege/issues)
814
+ - [Repository](https://github.com/MickaelAustoni/treege)