treege 3.0.0-beta.2 → 3.0.0-beta.21

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 (80) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +118 -26
  3. package/dist/ThemeContext-BIT4DHqC.js +763 -0
  4. package/dist/TreegeEditor-LKN_xeXZ.js +3311 -0
  5. package/dist/TreegeRenderer-Ci_Ym86Y.js +1812 -0
  6. package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
  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/nodeSpacing.d.ts +20 -0
  10. package/dist/editor/constants/nodeTypes.d.ts +5 -5
  11. package/dist/editor/context/TreegeEditorContext.d.ts +15 -0
  12. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  13. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
  14. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
  15. package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
  16. package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
  17. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +2 -2
  18. package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +2 -2
  19. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +2 -2
  20. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +2 -2
  21. package/dist/editor/features/TreegeEditor/nodes/hooks/useBottomHandleClick.d.ts +8 -0
  22. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +2 -1
  23. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  24. package/dist/editor/hooks/useFlowActions.d.ts +1 -0
  25. package/dist/editor/hooks/useFlowConnections.d.ts +1 -0
  26. package/dist/editor/types/ai.d.ts +65 -0
  27. package/dist/editor/types/editor.d.ts +5 -8
  28. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  29. package/dist/editor.js +2 -2
  30. package/dist/main.js +43 -39
  31. package/dist/renderer/context/TreegeRendererContext.d.ts +4 -1
  32. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +3 -1
  33. package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
  34. package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +1 -1
  35. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  36. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  37. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  38. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  39. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  40. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  41. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  42. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  43. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  44. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  45. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  46. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  47. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +3 -0
  48. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  49. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  50. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  51. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  52. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  53. package/dist/renderer/hooks/useSubmitHandler.d.ts +34 -0
  54. package/dist/renderer/hooks/useTranslate.d.ts +6 -4
  55. package/dist/renderer/index.d.ts +1 -0
  56. package/dist/renderer/types/renderer.d.ts +40 -2
  57. package/dist/renderer/utils/form.d.ts +22 -2
  58. package/dist/renderer/utils/http.d.ts +101 -0
  59. package/dist/renderer/utils/node.d.ts +9 -1
  60. package/dist/renderer/utils/sanitize.d.ts +85 -0
  61. package/dist/renderer/utils/submit.d.ts +47 -0
  62. package/dist/renderer.js +33 -29
  63. package/dist/shared/components/ui/alert-dialog.d.ts +14 -0
  64. package/dist/shared/components/ui/badge.d.ts +1 -1
  65. package/dist/shared/components/ui/popover.d.ts +3 -1
  66. package/dist/shared/components/ui/select.d.ts +3 -1
  67. package/dist/shared/constants/inputType.d.ts +1 -0
  68. package/dist/shared/locales/ar.json.d.ts +81 -8
  69. package/dist/shared/locales/de.json.d.ts +81 -8
  70. package/dist/shared/locales/en.json.d.ts +82 -9
  71. package/dist/shared/locales/es.json.d.ts +81 -8
  72. package/dist/shared/locales/fr.json.d.ts +81 -8
  73. package/dist/shared/locales/it.json.d.ts +81 -8
  74. package/dist/shared/locales/pt.json.d.ts +81 -8
  75. package/dist/shared/types/node.d.ts +51 -0
  76. package/package.json +9 -5
  77. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  78. package/dist/TreegeEditor-BSPfQQk3.js +0 -2151
  79. package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
  80. package/dist/_name_.css +0 -1
@@ -0,0 +1,34 @@
1
+ import { Node } from '@xyflow/react';
2
+ import { FormValues } from '../types/renderer';
3
+ import { SubmitResult } from '../utils/submit';
4
+ import { InputNodeData, TreegeNodeData } from '../../shared/types/node';
5
+ /**
6
+ * Hook for handling form submission with submit button configuration
7
+ *
8
+ * This hook provides:
9
+ * - Submit button node detection
10
+ * - HTTP submission handling
11
+ * - Loading state management
12
+ * - Success/error message handling
13
+ * - Redirect handling
14
+ *
15
+ * @param visibleNodes - Currently visible nodes in the form
16
+ * @param formValues - Current form values
17
+ * @param language - Current language for translations
18
+ * @param inputNodes - All input nodes for form data conversion
19
+ * @returns Submit handler state and functions
20
+ */
21
+ export declare const useSubmitHandler: (visibleNodes: Node<TreegeNodeData>[], formValues: FormValues, language: string, inputNodes: Node<InputNodeData>[]) => {
22
+ clearSubmitMessage: () => void;
23
+ handleSubmitWithConfig: (onSuccess?: (data: unknown) => void) => Promise<SubmitResult | null>;
24
+ hasSubmitConfig: boolean;
25
+ isSubmitting: boolean;
26
+ submitButtonNode: {
27
+ id: string;
28
+ data: InputNodeData;
29
+ } | null;
30
+ submitMessage: {
31
+ type: "success" | "error";
32
+ message: string;
33
+ } | null;
34
+ };
@@ -1,10 +1,12 @@
1
+ import { Translatable } from '../../shared/types/translate';
1
2
  /**
2
3
  * Hook for translating text in the renderer with context-aware language preference.
3
4
  *
4
5
  * This hook uses the language from TreegeRendererContext (or explicit override) and delegates to the shared useTranslate hook.
6
+ * All translations are automatically sanitized to prevent XSS attacks.
5
7
  *
6
8
  * @param language - Optional language override. If not provided, uses language from context.
7
- * @returns A function that translates either a translation key or a Translatable object
9
+ * @returns A function that translates either a translation key or a Translatable object (with XSS protection)
8
10
  *
9
11
  * @example
10
12
  * // Static translation (from translation files)
@@ -12,13 +14,13 @@
12
14
  * const errorMsg = t("validation.required"); // "This field is required"
13
15
  *
14
16
  * @example
15
- * // Dynamic translation (from node data)
17
+ * // Dynamic translation (from node data) - automatically sanitized
16
18
  * const t = useTranslate();
17
- * const label = t(node.data.label); // Translates user-defined content
19
+ * const label = t(node.data.label); // Translates and sanitizes user-defined content
18
20
  *
19
21
  * @example
20
22
  * // With explicit language
21
23
  * const t = useTranslate("fr");
22
24
  * const errorMsg = t("validation.required"); // "Ce champ est requis"
23
25
  */
24
- export declare const useTranslate: (language?: string) => (key?: import('../../main').Translatable | import('../../main').TranslationKey | string) => string;
26
+ export declare const useTranslate: (language?: string) => (key?: Translatable | string) => string;
@@ -13,5 +13,6 @@ export * from './utils/conditions';
13
13
  export * from './utils/file';
14
14
  export * from './utils/flow';
15
15
  export * from './utils/form';
16
+ export * from './utils/sanitize';
16
17
  export { ThemeProvider, useTheme } from '../shared/context/ThemeContext';
17
18
  export { getTranslatedText } from '../shared/utils/translations';
@@ -18,6 +18,7 @@ export type InputValueTypeMap = {
18
18
  password: string;
19
19
  radio: string;
20
20
  select: string | string[];
21
+ submit: undefined;
21
22
  switch: boolean;
22
23
  text: string;
23
24
  textarea: string;
@@ -28,20 +29,35 @@ export type InputValueTypeMap = {
28
29
  * Form values stored during rendering
29
30
  */
30
31
  export type FormValues = Record<string, any>;
32
+ export type Meta = {
33
+ httpResponse?: unknown;
34
+ };
31
35
  /**
32
36
  * Union of all possible input value types
33
37
  */
34
- export type InputValue = string | number | boolean | string[] | SerializableFile | SerializableFile[] | [string, string] | [string | undefined, string | undefined] | null;
38
+ export type InputValue = string | number | boolean | string[] | SerializableFile | SerializableFile[] | [string, string] | [string | undefined, string | undefined] | null | undefined;
35
39
  /**
36
40
  * Props for input components with dynamic value typing
37
41
  * All form state is provided via props for easier custom component implementation
38
42
  */
39
43
  export type InputRenderProps<T extends InputType = InputType> = {
44
+ /**
45
+ * The node data for this input field
46
+ */
40
47
  node: Node<InputNodeData>;
41
48
  /**
42
49
  * Current value of the input field (typed based on input type when T is specified)
43
50
  */
44
51
  value: InputValueTypeMap[T];
52
+ /**
53
+ * Unique field ID (nodeId)
54
+ */
55
+ id: string;
56
+ /**
57
+ * Field name (resolved using priority: name > label > nodeId)
58
+ * Use this for the name and id attributes of the input element
59
+ */
60
+ name: string;
45
61
  /**
46
62
  * Function to update the input value
47
63
  * @param value - The new value (typed based on input type when T is specified)
@@ -51,6 +67,26 @@ export type InputRenderProps<T extends InputType = InputType> = {
51
67
  * Validation error message for this field (if any)
52
68
  */
53
69
  error?: string;
70
+ /**
71
+ * Translated label (already processed with current language)
72
+ */
73
+ label?: string;
74
+ /**
75
+ * Translated placeholder (already processed with current language)
76
+ */
77
+ placeholder?: string;
78
+ /**
79
+ * Translated helper text (already processed with current language)
80
+ */
81
+ helperText?: string;
82
+ /**
83
+ * Missing required fields on form submit (for submit inputs)
84
+ */
85
+ missingRequiredFields?: string[];
86
+ /**
87
+ * Whether the form is currently being submitted (for submit inputs)
88
+ */
89
+ isSubmitting?: boolean;
54
90
  };
55
91
  export type UiRenderProps = {
56
92
  node: Node<UINodeData>;
@@ -169,8 +205,10 @@ export type TreegeRendererProps = {
169
205
  onChange?: (values: FormValues) => void;
170
206
  /**
171
207
  * Callback when form is submitted
208
+ * @param values - Form values (keyed by field name or node ID)
209
+ * @param meta - Optional metadata about the submission (e.g., HTTP response data)
172
210
  */
173
- onSubmit?: (values: FormValues) => void;
211
+ onSubmit?: (values: FormValues, meta?: Meta) => void;
174
212
  /**
175
213
  * Theme for the renderer
176
214
  * @default "dark"
@@ -20,7 +20,27 @@ export declare const checkFormFieldHasValue: (fieldName: string | undefined, for
20
20
  /**
21
21
  * Convert internal form values (keyed by nodeId) to external format (keyed by name)
22
22
  * When multiple nodes share the same name, later values overwrite earlier ones
23
- * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { name: 'lastName' } } ])
24
- * returns { firstName: 'Alice', lastName: 'Bob' }
23
+ * Priority for key naming: name > label (en) > nodeId
24
+ * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { label: { en: 'Last Name' } } } ])
25
+ * returns { firstName: 'Alice', 'Last Name': 'Bob' }
25
26
  */
26
27
  export declare const convertFormValuesToNamedFormat: (formValues: FormValues, nodes: Node<InputNodeData>[]) => Record<string, unknown>;
28
+ /**
29
+ * Apply transformation to a reference field value
30
+ * @param value - The source value to transform
31
+ * @param transformFunction - The transformation function to apply
32
+ * @param objectMapping - Optional mapping for toObject transformation
33
+ * @returns The transformed value
34
+ */
35
+ export declare const applyReferenceTransformation: (value: unknown, transformFunction: "toString" | "toNumber" | "toBoolean" | "toArray" | "toObject" | null | undefined, objectMapping?: Array<{
36
+ sourceKey: string;
37
+ targetKey: string;
38
+ }>) => unknown;
39
+ /**
40
+ * Calculate updated values for fields with reference defaults
41
+ * @param inputNodes - Array of input nodes
42
+ * @param formValues - Current form values
43
+ * @param prevFormValues - Previous form values (for change detection)
44
+ * @returns Object containing fields that need to be updated
45
+ */
46
+ export declare const calculateReferenceFieldUpdates: (inputNodes: Node<InputNodeData>[], formValues: FormValues, prevFormValues: FormValues) => FormValues;
@@ -0,0 +1,101 @@
1
+ import { FormValues } from '../types/renderer';
2
+ import { HttpHeader } from '../../shared/types/node';
3
+ /**
4
+ * Result of an HTTP request
5
+ */
6
+ export interface HttpRequestResult {
7
+ /**
8
+ * Whether the request was successful (2xx status code)
9
+ */
10
+ success: boolean;
11
+ /**
12
+ * Response data (parsed JSON or raw text)
13
+ */
14
+ data?: unknown;
15
+ /**
16
+ * Error message if request failed
17
+ */
18
+ error?: string;
19
+ /**
20
+ * HTTP status code
21
+ */
22
+ status?: number;
23
+ /**
24
+ * HTTP status text
25
+ */
26
+ statusText?: string;
27
+ }
28
+ /**
29
+ * Options for making an HTTP request
30
+ */
31
+ export interface HttpRequestOptions {
32
+ /**
33
+ * The URL to call (should already have variables replaced)
34
+ */
35
+ url: string;
36
+ /**
37
+ * HTTP method
38
+ */
39
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
40
+ /**
41
+ * Request headers
42
+ */
43
+ headers?: HttpHeader[];
44
+ /**
45
+ * Request body (for POST/PUT/PATCH)
46
+ */
47
+ body?: string;
48
+ }
49
+ /**
50
+ * Make an HTTP request with common error handling and response parsing
51
+ *
52
+ * This is a shared utility used by both HTTP inputs and submit buttons
53
+ * to ensure consistent behavior across the library.
54
+ *
55
+ * @param options - Request options
56
+ * @returns Promise with request result
57
+ */
58
+ export declare const makeHttpRequest: (options: HttpRequestOptions) => Promise<HttpRequestResult>;
59
+ /**
60
+ * Replace template variables in a string with actual values from form data
61
+ *
62
+ * Uses {{fieldId}} syntax for all replacements (URLs, JSON bodies, etc.)
63
+ *
64
+ * Smart JSON handling:
65
+ * - Strings: automatically wrapped in quotes and escaped
66
+ * - Numbers/Booleans: converted to JSON-safe format
67
+ * - Arrays/Objects: JSON.stringify
68
+ *
69
+ * @param template - The template string containing variables
70
+ * @param values - Form values to substitute
71
+ * @param options - Replacement options
72
+ * @param options.encode - Whether to URL-encode the replaced values (for URLs)
73
+ * @param options.json - Whether to use smart JSON handling (for request bodies)
74
+ * @returns The string with variables replaced
75
+ *
76
+ * @example
77
+ * // For URLs (with encoding)
78
+ * replaceTemplateVariables("https://api.com/users/{{userId}}", { userId: "john doe" }, { encode: true })
79
+ * // => "https://api.com/users/john%20doe"
80
+ *
81
+ * // For JSON bodies (smart handling)
82
+ * replaceTemplateVariables('{"name": {{userName}}}', { userName: "John" }, { json: true })
83
+ * // => '{"name": "John"}'
84
+ *
85
+ * replaceTemplateVariables('{"age": {{userAge}}}', { userAge: 25 }, { json: true })
86
+ * // => '{"age": 25}'
87
+ */
88
+ export declare const replaceTemplateVariables: (template: string | undefined, values: FormValues, options?: {
89
+ encode?: boolean;
90
+ json?: boolean;
91
+ }) => string;
92
+ /**
93
+ * Replace template variables in response data (for redirect URLs)
94
+ *
95
+ * Supports {{response.field}} format to access response data
96
+ *
97
+ * @param template - The template string containing variables
98
+ * @param responseData - Response data object
99
+ * @returns The string with variables replaced
100
+ */
101
+ export declare const replaceResponseVariables: (template: string | undefined, responseData: unknown) => string;
@@ -6,9 +6,17 @@ import { InputNodeData, TreegeNodeData } from '../../shared/types/node';
6
6
  * @returns Array of input nodes only
7
7
  */
8
8
  export declare const getInputNodes: (nodes: Node<TreegeNodeData>[]) => Node<InputNodeData>[];
9
+ /**
10
+ * Resolve the key name for an input node using priority: name > label (en) > nodeId
11
+ * This is the single source of truth for key resolution across the application
12
+ * @param node - The input node
13
+ * @returns The resolved key (name, label, or node ID)
14
+ */
15
+ export declare const resolveNodeKey: (node: Node<InputNodeData>) => string;
9
16
  /**
10
17
  * Get the field name (DOM name attribute) for a given node ID
11
- * Uses node.data.name if available, otherwise falls back to nodeId
18
+ * Priority: name > label (en) > nodeId
19
+ * This must match the logic in convertFormValuesToNamedFormat for consistency
12
20
  * @param nodeId - The ID of the input node
13
21
  * @param nodes - Array of input nodes
14
22
  * @returns The field name to use in the DOM, or undefined if node not found
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Configuration for DOMPurify sanitization
3
+ */
4
+ interface SanitizeOptions {
5
+ /**
6
+ * Allow only plain text (strip all HTML tags)
7
+ * @default true
8
+ */
9
+ plainTextOnly?: boolean;
10
+ /**
11
+ * Custom allowed tags (when plainTextOnly is false)
12
+ */
13
+ allowedTags?: string[];
14
+ /**
15
+ * Custom allowed attributes (when plainTextOnly is false)
16
+ */
17
+ allowedAttributes?: string[];
18
+ }
19
+ /**
20
+ * Sanitizes user input to prevent XSS attacks
21
+ *
22
+ * This utility wraps DOMPurify and provides secure defaults for the treege library.
23
+ * It should be used on all user-provided content before rendering, especially:
24
+ * - Labels from node data
25
+ * - Helper text
26
+ * - Placeholder text
27
+ * - Any content from HTTP responses
28
+ *
29
+ * @param input - The string to sanitize
30
+ * @param options - Sanitization options
31
+ * @returns Sanitized string safe for rendering
32
+ *
33
+ * @example
34
+ * // Plain text only (default behavior)
35
+ * sanitize('<script>alert("xss")</script>Hello')
36
+ * // => 'Hello'
37
+ *
38
+ * @example
39
+ * // Allow safe HTML tags
40
+ * sanitize('<b>Bold text</b><script>alert("xss")</script>', { plainTextOnly: false })
41
+ * // => '<b>Bold text</b>'
42
+ *
43
+ * @example
44
+ * // Custom allowed tags
45
+ * sanitize('<a href="http://example.com">Link</a>', {
46
+ * plainTextOnly: false,
47
+ * allowedTags: ['a'],
48
+ * allowedAttributes: ['href']
49
+ * })
50
+ * // => '<a href="http://example.com">Link</a>'
51
+ */
52
+ export declare const sanitize: (input: string | undefined | null, options?: SanitizeOptions) => string;
53
+ /**
54
+ * Sanitizes data from HTTP responses
55
+ *
56
+ * This function recursively sanitizes all string values in an object or array.
57
+ * Useful for cleaning data received from external APIs before displaying it.
58
+ *
59
+ * Protection against:
60
+ * - Circular references: Uses WeakSet to detect and handle circular objects
61
+ * - Deep nesting attacks: Limits recursion depth to prevent DoS
62
+ * - XSS attacks: Sanitizes all string values
63
+ *
64
+ * @param data - The data to sanitize (can be any type)
65
+ * @param options - Sanitization options
66
+ * @param depth - Current recursion depth (internal use)
67
+ * @param seen - WeakSet to track visited objects (internal use)
68
+ * @returns Sanitized data with same structure
69
+ *
70
+ * @example
71
+ * sanitizeHttpResponse({
72
+ * name: 'John <script>xss</script>',
73
+ * nested: { title: 'Hello <b>world</b>' }
74
+ * })
75
+ * // => { name: 'John ', nested: { title: 'Hello <b>world</b>' } }
76
+ *
77
+ * @example
78
+ * // Handles circular references gracefully
79
+ * const obj = { name: 'Test' };
80
+ * obj.self = obj;
81
+ * sanitizeHttpResponse(obj)
82
+ * // => { name: 'Test', self: { name: 'Test' } } // circular ref broken
83
+ */
84
+ export declare const sanitizeHttpResponse: (data: unknown, options?: SanitizeOptions, depth?: number, seen?: WeakSet<object>) => unknown;
85
+ export {};
@@ -0,0 +1,47 @@
1
+ import { Node } from '@xyflow/react';
2
+ import { FormValues } from '../types/renderer';
3
+ import { InputNodeData, SubmitConfig } from '../../shared/types/node';
4
+ /**
5
+ * Result of a form submission
6
+ */
7
+ export interface SubmitResult {
8
+ /**
9
+ * Whether the submission was successful
10
+ */
11
+ success: boolean;
12
+ /**
13
+ * Response data from the server
14
+ */
15
+ data?: unknown;
16
+ /**
17
+ * Error message if submission failed
18
+ */
19
+ error?: string;
20
+ /**
21
+ * URL to redirect to (if configured)
22
+ */
23
+ redirectUrl?: string;
24
+ }
25
+ /**
26
+ * Submit form data using the provided submit configuration
27
+ *
28
+ * This function handles:
29
+ * - Template variable replacement in URL, body, and headers
30
+ * - HTTP request to the configured endpoint
31
+ * - Response parsing
32
+ * - Redirect URL generation with response data
33
+ *
34
+ * @param config - Submit configuration from the submit button node
35
+ * @param formValues - Current form values
36
+ * @param inputNodes - All input nodes (required when sendFormData is true)
37
+ * @returns Promise with submission result
38
+ */
39
+ export declare const submitFormData: (config: SubmitConfig, formValues: FormValues, inputNodes: Node<InputNodeData>[]) => Promise<SubmitResult>;
40
+ /**
41
+ * Perform redirect to the specified URL
42
+ *
43
+ * Handles both relative and absolute URLs
44
+ *
45
+ * @param url - The URL to redirect to
46
+ */
47
+ export declare const redirect: (url: string) => void;
package/dist/renderer.js CHANGED
@@ -1,45 +1,49 @@
1
- import { c as t, d as s, e as u, f as l, g as r, h as n, D as i, i as o, j as f, k as d, l as p, m as D, n as I, o as T, p as m, q as g, r as F, s as c, v, w as x, T as R, b as S, J as b, K as h, t as C, x as w, y as z, z as A, A as H, C as N, F as k, G as P, I as y, E, H as G, B as V, u as j, a as q } from "./TreegeRenderer-D3EvsEfJ.js";
2
- import { T as J, g as K, u as U } from "./ThemeContext-BIvs8Kw-.js";
1
+ import { c as t, d as s, e as u, f as l, g as n, h as r, D as i, i as o, j as f, k as p, l as d, m as D, n as I, o as T, p as m, q as g, r as c, s as F, v as R, w as v, T as x, b as S, L as b, M as h, J as z, K as C, t as w, x as H, y as N, z as A, A as k, C as y, F as P, G as E, I as G, E as U, H as V, N as j, O as q, B, u as J, a as K } from "./TreegeRenderer-Ci_Ym86Y.js";
2
+ import { T as M, g as O, u as Q } from "./ThemeContext-BIT4DHqC.js";
3
3
  export {
4
4
  t as DefaultAddressInput,
5
5
  s as DefaultAutocompleteInput,
6
6
  u as DefaultCheckboxInput,
7
7
  l as DefaultDateInput,
8
- r as DefaultDateRangeInput,
9
- n as DefaultFileInput,
8
+ n as DefaultDateRangeInput,
9
+ r as DefaultFileInput,
10
10
  i as DefaultGroup,
11
11
  o as DefaultHiddenInput,
12
12
  f as DefaultHttpInput,
13
- d as DefaultNumberInput,
14
- p as DefaultPasswordInput,
13
+ p as DefaultNumberInput,
14
+ d as DefaultPasswordInput,
15
15
  D as DefaultRadioInput,
16
16
  I as DefaultSelectInput,
17
17
  T as DefaultSwitchInput,
18
18
  m as DefaultTextAreaInput,
19
19
  g as DefaultTextInput,
20
- F as DefaultTimeInput,
21
- c as DefaultTimeRangeInput,
22
- v as Divider,
23
- J as ThemeProvider,
24
- x as Title,
25
- R as TreegeConfigProvider,
20
+ c as DefaultTimeInput,
21
+ F as DefaultTimeRangeInput,
22
+ R as Divider,
23
+ M as ThemeProvider,
24
+ v as Title,
25
+ x as TreegeConfigProvider,
26
26
  S as TreegeRenderer,
27
- b as checkFormFieldHasValue,
28
- h as convertFormValuesToNamedFormat,
29
- C as defaultInputRenderers,
30
- w as defaultUI,
31
- z as evaluateCondition,
27
+ b as applyReferenceTransformation,
28
+ h as calculateReferenceFieldUpdates,
29
+ z as checkFormFieldHasValue,
30
+ C as convertFormValuesToNamedFormat,
31
+ w as defaultInputRenderers,
32
+ H as defaultUI,
33
+ N as evaluateCondition,
32
34
  A as evaluateConditions,
33
- H as fileToSerializable,
34
- N as filesToSerializable,
35
- k as findStartNode,
36
- P as getFlowRenderState,
37
- K as getTranslatedText,
38
- y as isFieldEmpty,
39
- E as isStartNode,
40
- G as mergeFlows,
41
- V as serializableToFile,
42
- U as useTheme,
43
- j as useTreegeConfig,
44
- q as useTreegeRenderer
35
+ k as fileToSerializable,
36
+ y as filesToSerializable,
37
+ P as findStartNode,
38
+ E as getFlowRenderState,
39
+ O as getTranslatedText,
40
+ G as isFieldEmpty,
41
+ U as isStartNode,
42
+ V as mergeFlows,
43
+ j as sanitize,
44
+ q as sanitizeHttpResponse,
45
+ B as serializableToFile,
46
+ Q as useTheme,
47
+ J as useTreegeConfig,
48
+ K as useTreegeRenderer
45
49
  };
@@ -0,0 +1,14 @@
1
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
2
+ import * as React from "react";
3
+ declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
+ declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
7
+ declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
8
+ declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
9
+ declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
+ declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
11
+ declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
12
+ declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action>): import("react/jsx-runtime").JSX.Element;
13
+ declare function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>): import("react/jsx-runtime").JSX.Element;
14
+ export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  import * as React from "react";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | "purple" | null | undefined;
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | "blue" | "purple" | null | undefined;
5
5
  } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;
@@ -2,6 +2,8 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2
2
  import * as React from "react";
3
3
  declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
- declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PopoverContent({ className, align, sideOffset, disablePortal, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content> & {
6
+ disablePortal?: boolean;
7
+ }): import("react/jsx-runtime").JSX.Element;
6
8
  declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
7
9
  export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
@@ -7,7 +7,9 @@ declare const SelectTrigger: ({ className, size, children, ...props }: React.Com
7
7
  size?: "sm" | "default";
8
8
  }) => import("react/jsx-runtime").JSX.Element;
9
9
  declare const SelectContent: ({ className, children, position, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) => import("react/jsx-runtime").JSX.Element;
10
- declare const SelectLabel: ({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) => import("react/jsx-runtime").JSX.Element;
10
+ declare const SelectLabel: ({ className, htmlFor, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Label> & {
11
+ htmlFor?: string;
12
+ }) => import("react/jsx-runtime").JSX.Element;
11
13
  declare const SelectItem: ({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) => import("react/jsx-runtime").JSX.Element;
12
14
  declare const SelectSeparator: ({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) => import("react/jsx-runtime").JSX.Element;
13
15
  declare const SelectScrollUpButton: ({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) => import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,7 @@ export declare const INPUT_TYPE: {
11
11
  readonly password: "password";
12
12
  readonly radio: "radio";
13
13
  readonly select: "select";
14
+ readonly submit: "submit";
14
15
  readonly switch: "switch";
15
16
  readonly text: "text";
16
17
  readonly textarea: "textarea";