@a2ui-sdk/react 0.0.0

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 (174) hide show
  1. package/dist/0.8/A2UIRenderer.d.ts +31 -0
  2. package/dist/0.8/A2UIRenderer.js +19 -0
  3. package/dist/0.8/components/ComponentRenderer.d.ts +39 -0
  4. package/dist/0.8/components/ComponentRenderer.js +76 -0
  5. package/dist/0.8/components/UnknownComponent.d.ts +18 -0
  6. package/dist/0.8/components/display/AudioPlayerComponent.d.ts +5 -0
  7. package/dist/0.8/components/display/AudioPlayerComponent.js +19 -0
  8. package/dist/0.8/components/display/DividerComponent.d.ts +5 -0
  9. package/dist/0.8/components/display/DividerComponent.js +18 -0
  10. package/dist/0.8/components/display/IconComponent.d.ts +5 -0
  11. package/dist/0.8/components/display/IconComponent.js +68 -0
  12. package/dist/0.8/components/display/ImageComponent.d.ts +6 -0
  13. package/dist/0.8/components/display/ImageComponent.js +36 -0
  14. package/dist/0.8/components/display/TextComponent.d.ts +6 -0
  15. package/dist/0.8/components/display/TextComponent.js +32 -0
  16. package/dist/0.8/components/display/VideoComponent.d.ts +5 -0
  17. package/dist/0.8/components/display/VideoComponent.js +18 -0
  18. package/dist/0.8/components/display/index.d.ts +9 -0
  19. package/dist/0.8/components/index.d.ts +7 -0
  20. package/dist/0.8/components/interactive/ButtonComponent.d.ts +5 -0
  21. package/dist/0.8/components/interactive/ButtonComponent.js +29 -0
  22. package/dist/0.8/components/interactive/CheckBoxComponent.d.ts +5 -0
  23. package/dist/0.8/components/interactive/CheckBoxComponent.js +27 -0
  24. package/dist/0.8/components/interactive/DateTimeInputComponent.d.ts +5 -0
  25. package/dist/0.8/components/interactive/DateTimeInputComponent.js +46 -0
  26. package/dist/0.8/components/interactive/MultipleChoiceComponent.d.ts +7 -0
  27. package/dist/0.8/components/interactive/MultipleChoiceComponent.js +89 -0
  28. package/dist/0.8/components/interactive/SliderComponent.d.ts +5 -0
  29. package/dist/0.8/components/interactive/SliderComponent.js +48 -0
  30. package/dist/0.8/components/interactive/TextFieldComponent.d.ts +5 -0
  31. package/dist/0.8/components/interactive/TextFieldComponent.js +44 -0
  32. package/dist/0.8/components/interactive/index.d.ts +9 -0
  33. package/dist/0.8/components/layout/CardComponent.d.ts +5 -0
  34. package/dist/0.8/components/layout/CardComponent.js +14 -0
  35. package/dist/0.8/components/layout/ColumnComponent.d.ts +5 -0
  36. package/dist/0.8/components/layout/ColumnComponent.js +58 -0
  37. package/dist/0.8/components/layout/ListComponent.d.ts +5 -0
  38. package/dist/0.8/components/layout/ListComponent.js +51 -0
  39. package/dist/0.8/components/layout/ModalComponent.d.ts +5 -0
  40. package/dist/0.8/components/layout/ModalComponent.js +25 -0
  41. package/dist/0.8/components/layout/RowComponent.d.ts +5 -0
  42. package/dist/0.8/components/layout/RowComponent.js +58 -0
  43. package/dist/0.8/components/layout/TabsComponent.d.ts +5 -0
  44. package/dist/0.8/components/layout/TabsComponent.js +29 -0
  45. package/dist/0.8/components/layout/index.d.ts +9 -0
  46. package/dist/0.8/contexts/A2UIProvider.d.ts +56 -0
  47. package/dist/0.8/contexts/A2UIProvider.js +33 -0
  48. package/dist/0.8/contexts/ActionContext.d.ts +33 -0
  49. package/dist/0.8/contexts/ActionContext.js +41 -0
  50. package/dist/0.8/contexts/ComponentsMapContext.d.ts +63 -0
  51. package/dist/0.8/contexts/ComponentsMapContext.js +21 -0
  52. package/dist/0.8/contexts/DataModelContext.d.ts +43 -0
  53. package/dist/0.8/contexts/DataModelContext.js +86 -0
  54. package/dist/0.8/contexts/SurfaceContext.d.ts +45 -0
  55. package/dist/0.8/contexts/SurfaceContext.js +88 -0
  56. package/dist/0.8/hooks/useA2UIMessageHandler.d.ts +41 -0
  57. package/dist/0.8/hooks/useA2UIMessageHandler.js +54 -0
  58. package/dist/0.8/hooks/useComponent.d.ts +23 -0
  59. package/dist/0.8/hooks/useComponent.js +9 -0
  60. package/dist/0.8/hooks/useDataBinding.d.ts +50 -0
  61. package/dist/0.8/hooks/useDataBinding.js +28 -0
  62. package/dist/0.8/hooks/useDispatchAction.d.ts +22 -0
  63. package/dist/0.8/hooks/useDispatchAction.js +8 -0
  64. package/dist/0.8/index.d.ts +44 -0
  65. package/dist/0.8/index.js +17 -0
  66. package/dist/0.8/utils/dataBinding.d.ts +95 -0
  67. package/dist/0.8/utils/dataBinding.js +46 -0
  68. package/dist/0.8/utils/pathUtils.d.ts +63 -0
  69. package/dist/0.8/utils/pathUtils.js +44 -0
  70. package/dist/0.9/A2UIRenderer.d.ts +54 -0
  71. package/dist/0.9/A2UIRenderer.js +41 -0
  72. package/dist/0.9/components/ComponentRenderer.d.ts +39 -0
  73. package/dist/0.9/components/ComponentRenderer.js +34 -0
  74. package/dist/0.9/components/UnknownComponent.d.ts +11 -0
  75. package/dist/0.9/components/UnknownComponent.js +35 -0
  76. package/dist/0.9/components/display/AudioPlayerComponent.d.ts +5 -0
  77. package/dist/0.9/components/display/AudioPlayerComponent.js +21 -0
  78. package/dist/0.9/components/display/DividerComponent.d.ts +5 -0
  79. package/dist/0.9/components/display/DividerComponent.js +19 -0
  80. package/dist/0.9/components/display/IconComponent.d.ts +5 -0
  81. package/dist/0.9/components/display/IconComponent.js +68 -0
  82. package/dist/0.9/components/display/ImageComponent.d.ts +6 -0
  83. package/dist/0.9/components/display/ImageComponent.js +43 -0
  84. package/dist/0.9/components/display/TextComponent.d.ts +6 -0
  85. package/dist/0.9/components/display/TextComponent.js +31 -0
  86. package/dist/0.9/components/display/VideoComponent.d.ts +5 -0
  87. package/dist/0.9/components/display/VideoComponent.js +30 -0
  88. package/dist/0.9/components/display/index.d.ts +9 -0
  89. package/dist/0.9/components/index.d.ts +12 -0
  90. package/dist/0.9/components/index.js +68 -0
  91. package/dist/0.9/components/interactive/ButtonComponent.d.ts +6 -0
  92. package/dist/0.9/components/interactive/ButtonComponent.js +29 -0
  93. package/dist/0.9/components/interactive/CheckBoxComponent.d.ts +5 -0
  94. package/dist/0.9/components/interactive/CheckBoxComponent.js +41 -0
  95. package/dist/0.9/components/interactive/ChoicePickerComponent.d.ts +7 -0
  96. package/dist/0.9/components/interactive/ChoicePickerComponent.js +80 -0
  97. package/dist/0.9/components/interactive/DateTimeInputComponent.d.ts +5 -0
  98. package/dist/0.9/components/interactive/DateTimeInputComponent.js +50 -0
  99. package/dist/0.9/components/interactive/SliderComponent.d.ts +6 -0
  100. package/dist/0.9/components/interactive/SliderComponent.js +47 -0
  101. package/dist/0.9/components/interactive/TextFieldComponent.d.ts +5 -0
  102. package/dist/0.9/components/interactive/TextFieldComponent.js +57 -0
  103. package/dist/0.9/components/interactive/index.d.ts +9 -0
  104. package/dist/0.9/components/layout/CardComponent.d.ts +5 -0
  105. package/dist/0.9/components/layout/CardComponent.js +15 -0
  106. package/dist/0.9/components/layout/ColumnComponent.d.ts +6 -0
  107. package/dist/0.9/components/layout/ColumnComponent.js +50 -0
  108. package/dist/0.9/components/layout/ListComponent.d.ts +17 -0
  109. package/dist/0.9/components/layout/ListComponent.js +42 -0
  110. package/dist/0.9/components/layout/ModalComponent.d.ts +5 -0
  111. package/dist/0.9/components/layout/ModalComponent.js +30 -0
  112. package/dist/0.9/components/layout/RowComponent.d.ts +6 -0
  113. package/dist/0.9/components/layout/RowComponent.js +50 -0
  114. package/dist/0.9/components/layout/TabsComponent.d.ts +5 -0
  115. package/dist/0.9/components/layout/TabsComponent.js +30 -0
  116. package/dist/0.9/components/layout/TemplateRenderer.d.ts +25 -0
  117. package/dist/0.9/components/layout/TemplateRenderer.js +49 -0
  118. package/dist/0.9/components/layout/index.d.ts +10 -0
  119. package/dist/0.9/contexts/A2UIProvider.d.ts +58 -0
  120. package/dist/0.9/contexts/A2UIProvider.js +34 -0
  121. package/dist/0.9/contexts/ActionContext.d.ts +33 -0
  122. package/dist/0.9/contexts/ActionContext.js +47 -0
  123. package/dist/0.9/contexts/ComponentsMapContext.d.ts +73 -0
  124. package/dist/0.9/contexts/ComponentsMapContext.js +21 -0
  125. package/dist/0.9/contexts/ScopeContext.d.ts +53 -0
  126. package/dist/0.9/contexts/ScopeContext.js +22 -0
  127. package/dist/0.9/contexts/SurfaceContext.d.ts +50 -0
  128. package/dist/0.9/contexts/SurfaceContext.js +118 -0
  129. package/dist/0.9/hooks/useA2UIMessageHandler.d.ts +44 -0
  130. package/dist/0.9/hooks/useA2UIMessageHandler.js +87 -0
  131. package/dist/0.9/hooks/useComponent.d.ts +23 -0
  132. package/dist/0.9/hooks/useComponent.js +9 -0
  133. package/dist/0.9/hooks/useDataBinding.d.ts +59 -0
  134. package/dist/0.9/hooks/useDataBinding.js +43 -0
  135. package/dist/0.9/hooks/useDispatchAction.d.ts +22 -0
  136. package/dist/0.9/hooks/useDispatchAction.js +17 -0
  137. package/dist/0.9/hooks/useValidation.d.ts +25 -0
  138. package/dist/0.9/hooks/useValidation.js +14 -0
  139. package/dist/0.9/index.d.ts +35 -0
  140. package/dist/0.9/index.js +26 -0
  141. package/dist/0.9/utils/dataBinding.d.ts +126 -0
  142. package/dist/0.9/utils/dataBinding.js +41 -0
  143. package/dist/0.9/utils/pathUtils.d.ts +109 -0
  144. package/dist/0.9/utils/pathUtils.js +74 -0
  145. package/dist/0.9/utils/validation.d.ts +49 -0
  146. package/dist/0.9/utils/validation.js +75 -0
  147. package/dist/components/ui/button.d.ts +10 -0
  148. package/dist/components/ui/button.js +53 -0
  149. package/dist/components/ui/card.d.ts +9 -0
  150. package/dist/components/ui/card.js +29 -0
  151. package/dist/components/ui/checkbox.d.ts +4 -0
  152. package/dist/components/ui/checkbox.js +31 -0
  153. package/dist/components/ui/dialog.d.ts +15 -0
  154. package/dist/components/ui/dialog.js +77 -0
  155. package/dist/components/ui/input.d.ts +3 -0
  156. package/dist/components/ui/input.js +21 -0
  157. package/dist/components/ui/label.d.ts +4 -0
  158. package/dist/components/ui/label.js +22 -0
  159. package/dist/components/ui/native-select.d.ts +7 -0
  160. package/dist/components/ui/select.d.ts +15 -0
  161. package/dist/components/ui/select.js +144 -0
  162. package/dist/components/ui/separator.d.ts +4 -0
  163. package/dist/components/ui/separator.js +26 -0
  164. package/dist/components/ui/slider.d.ts +4 -0
  165. package/dist/components/ui/slider.js +63 -0
  166. package/dist/components/ui/tabs.d.ts +7 -0
  167. package/dist/components/ui/tabs.js +67 -0
  168. package/dist/components/ui/textarea.d.ts +3 -0
  169. package/dist/components/ui/textarea.js +18 -0
  170. package/dist/index.d.ts +2 -0
  171. package/dist/index.js +6 -0
  172. package/dist/lib/utils.d.ts +2 -0
  173. package/dist/lib/utils.js +8 -0
  174. package/package.json +75 -0
@@ -0,0 +1,41 @@
1
+ import { resolvePath as f, getValueByPath as c } from "./pathUtils.js";
2
+ import { interpolate as y } from "@a2ui-sdk/utils/0.9";
3
+ function e(r) {
4
+ return r != null && typeof r == "object" && !Array.isArray(r) && "path" in r && typeof r.path == "string";
5
+ }
6
+ function p(r) {
7
+ return r != null && typeof r == "object" && !Array.isArray(r) && "call" in r && typeof r.call == "string";
8
+ }
9
+ function g(r, i, o = null, t) {
10
+ if (r == null)
11
+ return t;
12
+ if (e(r)) {
13
+ const s = f(r.path, o), n = c(i, s);
14
+ return n === void 0 ? t : n;
15
+ }
16
+ return p(r) ? t : r;
17
+ }
18
+ function l(r, i, o = null, t = "") {
19
+ if (r == null)
20
+ return t;
21
+ if (e(r)) {
22
+ const s = f(r.path, o), n = c(i, s);
23
+ return n == null ? t : String(n);
24
+ }
25
+ return p(r) ? t : typeof r == "string" ? y(r, i, o) : String(r);
26
+ }
27
+ function m(r, i, o = null) {
28
+ if (!r)
29
+ return {};
30
+ const t = {};
31
+ for (const [s, n] of Object.entries(r))
32
+ t[s] = g(n, i, o);
33
+ return t;
34
+ }
35
+ export {
36
+ p as isFunctionCall,
37
+ e as isPathBinding,
38
+ m as resolveContext,
39
+ l as resolveString,
40
+ g as resolveValue
41
+ };
@@ -0,0 +1,109 @@
1
+ import { DataModel } from '@a2ui-sdk/types/0.9';
2
+ /**
3
+ * Parses a JSON Pointer path into segments.
4
+ *
5
+ * @param path - The JSON Pointer path (e.g., "/user/name")
6
+ * @returns Array of path segments
7
+ *
8
+ * @example
9
+ * parseJsonPointer("/user/name"); // ["user", "name"]
10
+ * parseJsonPointer("/items/0"); // ["items", "0"]
11
+ * parseJsonPointer("/"); // []
12
+ * parseJsonPointer("/a~1b"); // ["a/b"] (escaped slash)
13
+ * parseJsonPointer("/m~0n"); // ["m~n"] (escaped tilde)
14
+ */
15
+ export declare function parseJsonPointer(path: string): string[];
16
+ /**
17
+ * Creates a JSON Pointer path from segments.
18
+ *
19
+ * @param segments - Array of path segments
20
+ * @returns JSON Pointer path string
21
+ *
22
+ * @example
23
+ * createJsonPointer(["user", "name"]); // "/user/name"
24
+ * createJsonPointer(["a/b"]); // "/a~1b"
25
+ * createJsonPointer([]); // "/"
26
+ */
27
+ export declare function createJsonPointer(segments: string[]): string;
28
+ /**
29
+ * Gets a value from the data model by JSON Pointer path.
30
+ *
31
+ * @param dataModel - The data model to read from
32
+ * @param path - The JSON Pointer path (e.g., "/user/name")
33
+ * @returns The value at the path, or undefined if not found
34
+ *
35
+ * @example
36
+ * const model = { user: { name: "John" }, items: ["a", "b"] };
37
+ * getValueByPath(model, "/user/name"); // "John"
38
+ * getValueByPath(model, "/items/0"); // "a"
39
+ * getValueByPath(model, "/nonexistent"); // undefined
40
+ */
41
+ export declare function getValueByPath(dataModel: DataModel, path: string): unknown;
42
+ /**
43
+ * Sets a value in the data model by JSON Pointer path, returning a new data model.
44
+ * This function is immutable - it does not modify the original data model.
45
+ *
46
+ * @param dataModel - The data model to update
47
+ * @param path - The JSON Pointer path (e.g., "/user/name")
48
+ * @param value - The value to set (undefined to delete)
49
+ * @returns A new data model with the value set
50
+ *
51
+ * @example
52
+ * const model = { user: { name: "John" } };
53
+ * setValueByPath(model, "/user/name", "Jane"); // { user: { name: "Jane" } }
54
+ * setValueByPath(model, "/user/age", 30); // { user: { name: "John", age: 30 } }
55
+ * setValueByPath(model, "/user/name", undefined); // { user: {} }
56
+ */
57
+ export declare function setValueByPath(dataModel: DataModel, path: string, value: unknown): DataModel;
58
+ /**
59
+ * Normalizes a path to ensure it starts with "/" and has no trailing "/".
60
+ *
61
+ * @param path - The path to normalize
62
+ * @returns The normalized path
63
+ *
64
+ * @example
65
+ * normalizePath("user/name"); // "/user/name"
66
+ * normalizePath("/user/name/"); // "/user/name"
67
+ */
68
+ export declare function normalizePath(path: string): string;
69
+ /**
70
+ * Checks if a path is absolute (starts with "/").
71
+ *
72
+ * @param path - The path to check
73
+ * @returns True if the path is absolute
74
+ *
75
+ * @example
76
+ * isAbsolutePath("/user/name"); // true
77
+ * isAbsolutePath("name"); // false
78
+ * isAbsolutePath(""); // false
79
+ */
80
+ export declare function isAbsolutePath(path: string): boolean;
81
+ /**
82
+ * Resolves a path against a base path (scope).
83
+ *
84
+ * Absolute paths (starting with "/") are returned as-is.
85
+ * Relative paths are resolved against the base path.
86
+ *
87
+ * @param path - The path to resolve
88
+ * @param basePath - The base path (scope), or null for root scope
89
+ * @returns The resolved absolute path
90
+ *
91
+ * @example
92
+ * resolvePath("/user/name", "/items/0"); // "/user/name" (absolute)
93
+ * resolvePath("name", "/items/0"); // "/items/0/name" (relative)
94
+ * resolvePath("name", null); // "/name" (root scope)
95
+ */
96
+ export declare function resolvePath(path: string, basePath: string | null): string;
97
+ /**
98
+ * Joins two paths together.
99
+ *
100
+ * @param basePath - The base path
101
+ * @param relativePath - The relative path to join
102
+ * @returns The joined path
103
+ *
104
+ * @example
105
+ * joinPaths("/user", "name"); // "/user/name"
106
+ * joinPaths("/user", "/name"); // "/user/name"
107
+ * joinPaths("/user/", "/name/"); // "/user/name"
108
+ */
109
+ export declare function joinPaths(basePath: string, relativePath: string): string;
@@ -0,0 +1,74 @@
1
+ function y(t) {
2
+ return !t || t === "/" ? [] : (t.startsWith("/") ? t.slice(1).split("/") : t.split("/")).filter((r) => r !== "").map((r) => r.replace(/~1/g, "/").replace(/~0/g, "~"));
3
+ }
4
+ function m(t, e) {
5
+ if (!e || e === "/")
6
+ return t;
7
+ const r = y(e);
8
+ let i = t;
9
+ for (const f of r) {
10
+ if (i == null)
11
+ return;
12
+ if (Array.isArray(i)) {
13
+ const n = parseInt(f, 10);
14
+ if (isNaN(n))
15
+ return;
16
+ i = i[n];
17
+ } else if (typeof i == "object")
18
+ i = i[f];
19
+ else
20
+ return;
21
+ }
22
+ return i;
23
+ }
24
+ function a(t, e, r) {
25
+ if (!e || e === "/")
26
+ return r === void 0 ? {} : typeof r == "object" && r !== null && !Array.isArray(r) ? r : t;
27
+ const i = y(e), f = structuredClone(t);
28
+ let n = f;
29
+ for (let o = 0; o < i.length - 1; o++) {
30
+ const l = i[o];
31
+ if (Array.isArray(n)) {
32
+ const s = parseInt(l, 10);
33
+ if (isNaN(s))
34
+ return f;
35
+ (n[s] === null || n[s] === void 0) && (n[s] = {}), n = n[s];
36
+ } else if (typeof n == "object" && n !== null) {
37
+ const s = n;
38
+ s[l] === null || s[l] === void 0 ? s[l] = {} : typeof s[l] != "object" && (s[l] = {}), n = s[l];
39
+ } else
40
+ return f;
41
+ }
42
+ const c = i[i.length - 1];
43
+ if (Array.isArray(n)) {
44
+ const o = parseInt(c, 10);
45
+ isNaN(o) || (r === void 0 ? n.splice(o, 1) : n[o] = r);
46
+ } else if (typeof n == "object" && n !== null) {
47
+ const o = n;
48
+ r === void 0 ? delete o[c] : o[c] = r;
49
+ }
50
+ return f;
51
+ }
52
+ function u(t) {
53
+ let e = t.trim();
54
+ return e.startsWith("/") || (e = "/" + e), e.length > 1 && e.endsWith("/") && (e = e.slice(0, -1)), e;
55
+ }
56
+ function g(t) {
57
+ return t.startsWith("/");
58
+ }
59
+ function A(t, e) {
60
+ return g(t) || e === null || e === "/" ? u(t) : d(e, t);
61
+ }
62
+ function d(t, e) {
63
+ const r = u(t), i = e.trim().replace(/^\/+/, "").replace(/\/+$/, "");
64
+ return i ? r === "/" ? "/" + i : r + "/" + i : r;
65
+ }
66
+ export {
67
+ m as getValueByPath,
68
+ g as isAbsolutePath,
69
+ d as joinPaths,
70
+ u as normalizePath,
71
+ y as parseJsonPointer,
72
+ A as resolvePath,
73
+ a as setValueByPath
74
+ };
@@ -0,0 +1,49 @@
1
+ import { CheckRule, DynamicValue, DataModel, ValidationResult } from '@a2ui-sdk/types/0.9';
2
+ /**
3
+ * Type for a validation function.
4
+ * Takes resolved arguments and returns a boolean.
5
+ */
6
+ export type ValidationFunction = (args: Record<string, unknown>) => boolean;
7
+ /**
8
+ * Built-in validation functions.
9
+ */
10
+ export declare const validationFunctions: Record<string, ValidationFunction>;
11
+ /**
12
+ * Context for evaluating expressions.
13
+ */
14
+ export interface EvaluationContext {
15
+ dataModel: DataModel;
16
+ basePath: string | null;
17
+ functions?: Record<string, ValidationFunction>;
18
+ }
19
+ /**
20
+ * Resolves function arguments from DynamicValue to actual values.
21
+ */
22
+ export declare function resolveArgs(args: Record<string, DynamicValue> | undefined, dataModel: DataModel, basePath: string | null): Record<string, unknown>;
23
+ /**
24
+ * Evaluates a function call.
25
+ */
26
+ export declare function evaluateFunctionCall(call: string, args: Record<string, DynamicValue> | undefined, context: EvaluationContext): boolean;
27
+ /**
28
+ * Evaluates a CheckRule (which is also a LogicExpression).
29
+ *
30
+ * @param rule - The check rule to evaluate
31
+ * @param context - Evaluation context with data model and scope
32
+ * @returns true if the check passes, false if it fails
33
+ */
34
+ export declare function evaluateCheckRule(rule: CheckRule, context: EvaluationContext): boolean;
35
+ /**
36
+ * Evaluates all checks for a component and returns validation result.
37
+ *
38
+ * @param checks - Array of check rules
39
+ * @param dataModel - The data model for value resolution
40
+ * @param basePath - The current scope base path (for relative paths)
41
+ * @param functions - Optional custom validation functions
42
+ * @returns ValidationResult with valid flag and error messages
43
+ */
44
+ export declare function evaluateChecks(checks: CheckRule[] | undefined, dataModel: DataModel, basePath: string | null, functions?: Record<string, ValidationFunction>): ValidationResult;
45
+ /**
46
+ * Extracts all paths referenced in a CheckRule for dependency tracking.
47
+ * This is useful for knowing which data model paths affect validation.
48
+ */
49
+ export declare function extractCheckDependencies(checks: CheckRule[]): string[];
@@ -0,0 +1,75 @@
1
+ import { resolveValue as l } from "./dataBinding.js";
2
+ const a = {
3
+ /**
4
+ * Checks if a value is present (not null, undefined, or empty string).
5
+ */
6
+ required: ({ value: r }) => r == null ? !1 : typeof r == "string" ? r.trim().length > 0 : Array.isArray(r) ? r.length > 0 : !0,
7
+ /**
8
+ * Validates email format.
9
+ */
10
+ email: ({ value: r }) => typeof r != "string" ? !1 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r),
11
+ /**
12
+ * Tests value against a regular expression pattern.
13
+ */
14
+ regex: ({ value: r, pattern: e }) => {
15
+ if (typeof r != "string" || typeof e != "string") return !1;
16
+ try {
17
+ return new RegExp(e).test(r);
18
+ } catch {
19
+ return !1;
20
+ }
21
+ },
22
+ /**
23
+ * Validates string length within min/max bounds.
24
+ */
25
+ length: ({ value: r, min: e, max: n }) => {
26
+ const s = String(r ?? "").length;
27
+ return !(e != null && s < Number(e) || n != null && s > Number(n));
28
+ },
29
+ /**
30
+ * Validates numeric value within min/max bounds.
31
+ */
32
+ numeric: ({ value: r, min: e, max: n }) => {
33
+ const t = Number(r);
34
+ return !(isNaN(t) || e != null && t < Number(e) || n != null && t > Number(n));
35
+ }
36
+ };
37
+ function c(r, e, n) {
38
+ if (!r) return {};
39
+ const t = {};
40
+ for (const [s, i] of Object.entries(r))
41
+ t[s] = l(i, e, n, void 0);
42
+ return t;
43
+ }
44
+ function g(r, e, n) {
45
+ const { dataModel: t, basePath: s, functions: i = a } = n, o = i[r];
46
+ if (!o)
47
+ return console.warn(`[A2UI] Unknown validation function: ${r}`), !0;
48
+ const u = c(e, t, s);
49
+ return o(u);
50
+ }
51
+ function f(r, e) {
52
+ return "and" in r && r.and ? r.and.every((n) => f(n, e)) : "or" in r && r.or ? r.or.some((n) => f(n, e)) : "not" in r && r.not ? !f(r.not, e) : "true" in r && r.true === !0 ? !0 : "false" in r && r.false === !1 ? !1 : "call" in r && r.call ? g(r.call, r.args, e) : !0;
53
+ }
54
+ function v(r, e, n, t) {
55
+ if (!r || r.length === 0)
56
+ return { valid: !0, errors: [] };
57
+ const s = {
58
+ dataModel: e,
59
+ basePath: n,
60
+ functions: t ?? a
61
+ }, i = [];
62
+ for (const o of r)
63
+ !f(o, s) && o.message && i.push(o.message);
64
+ return {
65
+ valid: i.length === 0,
66
+ errors: i
67
+ };
68
+ }
69
+ export {
70
+ f as evaluateCheckRule,
71
+ v as evaluateChecks,
72
+ g as evaluateFunctionCall,
73
+ c as resolveArgs,
74
+ a as validationFunctions
75
+ };
@@ -0,0 +1,10 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
+ size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
8
+ asChild?: boolean;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export { Button, buttonVariants };
@@ -0,0 +1,53 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Slot as a } from "@radix-ui/react-slot";
3
+ import { cva as s } from "class-variance-authority";
4
+ import { cn as d } from "../../lib/utils.js";
5
+ const u = s(
6
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
11
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
12
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
13
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
14
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
15
+ link: "text-primary underline-offset-4 hover:underline"
16
+ },
17
+ size: {
18
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
19
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
20
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
21
+ icon: "size-9",
22
+ "icon-sm": "size-8",
23
+ "icon-lg": "size-10"
24
+ }
25
+ },
26
+ defaultVariants: {
27
+ variant: "default",
28
+ size: "default"
29
+ }
30
+ }
31
+ );
32
+ function b({
33
+ className: t,
34
+ variant: e = "default",
35
+ size: r = "default",
36
+ asChild: i = !1,
37
+ ...n
38
+ }) {
39
+ return /* @__PURE__ */ o(
40
+ i ? a : "button",
41
+ {
42
+ "data-slot": "button",
43
+ "data-variant": e,
44
+ "data-size": r,
45
+ className: d(u({ variant: e, size: r, className: t })),
46
+ ...n
47
+ }
48
+ );
49
+ }
50
+ export {
51
+ b as Button,
52
+ u as buttonVariants
53
+ };
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ declare function Card({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
3
+ declare function CardHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
4
+ declare function CardTitle({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
5
+ declare function CardDescription({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
6
+ declare function CardAction({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
7
+ declare function CardContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
8
+ declare function CardFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
9
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
@@ -0,0 +1,29 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { cn as a } from "../../lib/utils.js";
3
+ function n({ className: r, ...o }) {
4
+ return /* @__PURE__ */ t(
5
+ "div",
6
+ {
7
+ "data-slot": "card",
8
+ className: a(
9
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
10
+ r
11
+ ),
12
+ ...o
13
+ }
14
+ );
15
+ }
16
+ function c({ className: r, ...o }) {
17
+ return /* @__PURE__ */ t(
18
+ "div",
19
+ {
20
+ "data-slot": "card-content",
21
+ className: a("px-6", r),
22
+ ...o
23
+ }
24
+ );
25
+ }
26
+ export {
27
+ n as Card,
28
+ c as CardContent
29
+ };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Checkbox };
@@ -0,0 +1,31 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import * as e from "@radix-ui/react-checkbox";
3
+ import { CheckIcon as t } from "lucide-react";
4
+ import { cn as o } from "../../lib/utils.js";
5
+ function s({
6
+ className: i,
7
+ ...a
8
+ }) {
9
+ return /* @__PURE__ */ r(
10
+ e.Root,
11
+ {
12
+ "data-slot": "checkbox",
13
+ className: o(
14
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
15
+ i
16
+ ),
17
+ ...a,
18
+ children: /* @__PURE__ */ r(
19
+ e.Indicator,
20
+ {
21
+ "data-slot": "checkbox-indicator",
22
+ className: "grid place-content-center text-current transition-none",
23
+ children: /* @__PURE__ */ r(t, { className: "size-3.5" })
24
+ }
25
+ )
26
+ }
27
+ );
28
+ }
29
+ export {
30
+ s as Checkbox
31
+ };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ showCloseButton?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
12
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
13
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
14
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
15
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,77 @@
1
+ import { jsx as a, jsxs as n } from "react/jsx-runtime";
2
+ import * as o from "@radix-ui/react-dialog";
3
+ import { XIcon as l } from "lucide-react";
4
+ import { cn as i } from "../../lib/utils.js";
5
+ function m({
6
+ ...t
7
+ }) {
8
+ return /* @__PURE__ */ a(o.Root, { "data-slot": "dialog", ...t });
9
+ }
10
+ function p({
11
+ ...t
12
+ }) {
13
+ return /* @__PURE__ */ a(o.Trigger, { "data-slot": "dialog-trigger", ...t });
14
+ }
15
+ function d({
16
+ ...t
17
+ }) {
18
+ return /* @__PURE__ */ a(o.Portal, { "data-slot": "dialog-portal", ...t });
19
+ }
20
+ function g({
21
+ className: t,
22
+ ...e
23
+ }) {
24
+ return /* @__PURE__ */ a(
25
+ o.Overlay,
26
+ {
27
+ "data-slot": "dialog-overlay",
28
+ className: i(
29
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
30
+ t
31
+ ),
32
+ ...e
33
+ }
34
+ );
35
+ }
36
+ function v({
37
+ className: t,
38
+ children: e,
39
+ showCloseButton: s = !0,
40
+ ...r
41
+ }) {
42
+ return /* @__PURE__ */ n(d, { "data-slot": "dialog-portal", children: [
43
+ /* @__PURE__ */ a(g, {}),
44
+ /* @__PURE__ */ n(
45
+ o.Content,
46
+ {
47
+ "data-slot": "dialog-content",
48
+ className: i(
49
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
50
+ t
51
+ ),
52
+ ...r,
53
+ children: [
54
+ e,
55
+ s && /* @__PURE__ */ n(
56
+ o.Close,
57
+ {
58
+ "data-slot": "dialog-close",
59
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
60
+ children: [
61
+ /* @__PURE__ */ a(l, {}),
62
+ /* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
63
+ ]
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ )
69
+ ] });
70
+ }
71
+ export {
72
+ m as Dialog,
73
+ v as DialogContent,
74
+ g as DialogOverlay,
75
+ d as DialogPortal,
76
+ p as DialogTrigger
77
+ };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare function Input({ className, type, ...props }: React.ComponentProps<'input'>): import("react/jsx-runtime").JSX.Element;
3
+ export { Input };
@@ -0,0 +1,21 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { cn as n } from "../../lib/utils.js";
3
+ function a({ className: e, type: i, ...r }) {
4
+ return /* @__PURE__ */ t(
5
+ "input",
6
+ {
7
+ type: i,
8
+ "data-slot": "input",
9
+ className: n(
10
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
11
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
12
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
13
+ e
14
+ ),
15
+ ...r
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ a as Input
21
+ };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import * as LabelPrimitive from '@radix-ui/react-label';
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Label };
@@ -0,0 +1,22 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as a from "@radix-ui/react-label";
3
+ import { cn as r } from "../../lib/utils.js";
4
+ function l({
5
+ className: e,
6
+ ...t
7
+ }) {
8
+ return /* @__PURE__ */ o(
9
+ a.Root,
10
+ {
11
+ "data-slot": "label",
12
+ className: r(
13
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
14
+ e
15
+ ),
16
+ ...t
17
+ }
18
+ );
19
+ }
20
+ export {
21
+ l as Label
22
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ declare function NativeSelect({ className, size, ...props }: Omit<React.ComponentProps<'select'>, 'size'> & {
3
+ size?: 'sm' | 'default';
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ declare function NativeSelectOption({ ...props }: React.ComponentProps<'option'>): import("react/jsx-runtime").JSX.Element;
6
+ declare function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>): import("react/jsx-runtime").JSX.Element;
7
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };