@inkeep/agents-ui 0.0.0-dev-20260508213807 → 0.0.0-dev-20260508233535
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +156 -153
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +0 -13
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +224 -238
- package/dist/primitives/components/embedded-chat.d.ts +1 -1
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +144 -141
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
- package/dist/primitives/providers/chat-auth-provider.d.ts +15 -0
- package/dist/primitives/providers/chat-auth-provider.js +44 -0
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +1 -0
- package/dist/primitives/providers/index.js +51 -48
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +75 -74
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +156 -153
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +210 -272
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +148 -145
- package/dist/styled/inkeep.css.cjs +0 -78
- package/dist/styled/inkeep.css.js +0 -78
- package/package.json +1 -2
- package/dist/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.70.0_react@19.3.0-canary-87ae75b3-20260128_/node_modules/@hookform/resolvers/zod/dist/zod.cjs +0 -1
- package/dist/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.70.0_react@19.3.0-canary-87ae75b3-20260128_/node_modules/@hookform/resolvers/zod/dist/zod.js +0 -93
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -49
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -19
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -28
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -23
- package/dist/styled/components/ask-user-form.cjs +0 -1
- package/dist/styled/components/ask-user-form.d.ts +0 -96
- package/dist/styled/components/ask-user-form.js +0 -672
|
@@ -583,9 +583,6 @@ video {
|
|
|
583
583
|
.visible {
|
|
584
584
|
visibility: visible;
|
|
585
585
|
}
|
|
586
|
-
.static {
|
|
587
|
-
position: static;
|
|
588
|
-
}
|
|
589
586
|
.fixed {
|
|
590
587
|
position: fixed;
|
|
591
588
|
}
|
|
@@ -760,9 +757,6 @@ video {
|
|
|
760
757
|
.mb-6 {
|
|
761
758
|
margin-bottom: 1.5rem;
|
|
762
759
|
}
|
|
763
|
-
.ml-0\\.5 {
|
|
764
|
-
margin-left: 0.125rem;
|
|
765
|
-
}
|
|
766
760
|
.ml-1 {
|
|
767
761
|
margin-left: 0.25rem;
|
|
768
762
|
}
|
|
@@ -796,9 +790,6 @@ video {
|
|
|
796
790
|
.mt-0\\.5 {
|
|
797
791
|
margin-top: 0.125rem;
|
|
798
792
|
}
|
|
799
|
-
.mt-1 {
|
|
800
|
-
margin-top: 0.25rem;
|
|
801
|
-
}
|
|
802
793
|
.mt-1\\.5 {
|
|
803
794
|
margin-top: 0.375rem;
|
|
804
795
|
}
|
|
@@ -991,15 +982,9 @@ video {
|
|
|
991
982
|
.min-h-9 {
|
|
992
983
|
min-height: 2.25rem;
|
|
993
984
|
}
|
|
994
|
-
.min-h-\\[32px\\] {
|
|
995
|
-
min-height: 32px;
|
|
996
|
-
}
|
|
997
985
|
.min-h-\\[38px\\] {
|
|
998
986
|
min-height: 38px;
|
|
999
987
|
}
|
|
1000
|
-
.min-h-\\[60px\\] {
|
|
1001
|
-
min-height: 60px;
|
|
1002
|
-
}
|
|
1003
988
|
.min-h-\\[unset\\] {
|
|
1004
989
|
min-height: unset;
|
|
1005
990
|
}
|
|
@@ -1030,9 +1015,6 @@ video {
|
|
|
1030
1015
|
.w-3\\/4 {
|
|
1031
1016
|
width: 75%;
|
|
1032
1017
|
}
|
|
1033
|
-
.w-32 {
|
|
1034
|
-
width: 8rem;
|
|
1035
|
-
}
|
|
1036
1018
|
.w-4 {
|
|
1037
1019
|
width: 1rem;
|
|
1038
1020
|
}
|
|
@@ -1042,9 +1024,6 @@ video {
|
|
|
1042
1024
|
.w-40 {
|
|
1043
1025
|
width: 10rem;
|
|
1044
1026
|
}
|
|
1045
|
-
.w-48 {
|
|
1046
|
-
width: 12rem;
|
|
1047
|
-
}
|
|
1048
1027
|
.w-5 {
|
|
1049
1028
|
width: 1.25rem;
|
|
1050
1029
|
}
|
|
@@ -1057,9 +1036,6 @@ video {
|
|
|
1057
1036
|
.w-8 {
|
|
1058
1037
|
width: 2rem;
|
|
1059
1038
|
}
|
|
1060
|
-
.w-9 {
|
|
1061
|
-
width: 2.25rem;
|
|
1062
|
-
}
|
|
1063
1039
|
.w-\\[--width\\] {
|
|
1064
1040
|
width: var(--width);
|
|
1065
1041
|
}
|
|
@@ -1106,9 +1082,6 @@ video {
|
|
|
1106
1082
|
.min-w-9 {
|
|
1107
1083
|
min-width: 2.25rem;
|
|
1108
1084
|
}
|
|
1109
|
-
.min-w-\\[80px\\] {
|
|
1110
|
-
min-width: 80px;
|
|
1111
|
-
}
|
|
1112
1085
|
.min-w-\\[8rem\\] {
|
|
1113
1086
|
min-width: 8rem;
|
|
1114
1087
|
}
|
|
@@ -1183,14 +1156,6 @@ video {
|
|
|
1183
1156
|
--tw-translate-y: -50%;
|
|
1184
1157
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1185
1158
|
}
|
|
1186
|
-
.translate-x-0\\.5 {
|
|
1187
|
-
--tw-translate-x: 0.125rem;
|
|
1188
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1189
|
-
}
|
|
1190
|
-
.translate-x-4 {
|
|
1191
|
-
--tw-translate-x: 1rem;
|
|
1192
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1193
|
-
}
|
|
1194
1159
|
.translate-x-\\[-50\\%\\] {
|
|
1195
1160
|
--tw-translate-x: -50%;
|
|
1196
1161
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1326,9 +1291,6 @@ video {
|
|
|
1326
1291
|
.cursor-pointer {
|
|
1327
1292
|
cursor: pointer;
|
|
1328
1293
|
}
|
|
1329
|
-
.cursor-text {
|
|
1330
|
-
cursor: text;
|
|
1331
|
-
}
|
|
1332
1294
|
.touch-none {
|
|
1333
1295
|
touch-action: none;
|
|
1334
1296
|
}
|
|
@@ -1456,11 +1418,6 @@ video {
|
|
|
1456
1418
|
margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1457
1419
|
margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
|
|
1458
1420
|
}
|
|
1459
|
-
.space-y-2 > :not([hidden]) ~ :not([hidden]) {
|
|
1460
|
-
--tw-space-y-reverse: 0;
|
|
1461
|
-
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1462
|
-
margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
|
|
1463
|
-
}
|
|
1464
1421
|
.space-y-3 > :not([hidden]) ~ :not([hidden]) {
|
|
1465
1422
|
--tw-space-y-reverse: 0;
|
|
1466
1423
|
margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -1701,9 +1658,6 @@ video {
|
|
|
1701
1658
|
.p-2 {
|
|
1702
1659
|
padding: 0.5rem;
|
|
1703
1660
|
}
|
|
1704
|
-
.p-4 {
|
|
1705
|
-
padding: 1rem;
|
|
1706
|
-
}
|
|
1707
1661
|
.p-8 {
|
|
1708
1662
|
padding: 2rem;
|
|
1709
1663
|
}
|
|
@@ -2023,10 +1977,6 @@ video {
|
|
|
2023
1977
|
--tw-text-opacity: 1;
|
|
2024
1978
|
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
|
2025
1979
|
}
|
|
2026
|
-
.text-red-600 {
|
|
2027
|
-
--tw-text-opacity: 1;
|
|
2028
|
-
color: rgb(220 38 38 / var(--tw-text-opacity, 1));
|
|
2029
|
-
}
|
|
2030
1980
|
.text-transparent {
|
|
2031
1981
|
color: transparent;
|
|
2032
1982
|
}
|
|
@@ -2708,16 +2658,6 @@ slot {
|
|
|
2708
2658
|
outline-color: var(--ikp-color-inkeep-expanded-primary-700);
|
|
2709
2659
|
}
|
|
2710
2660
|
|
|
2711
|
-
.focus\\:ring-1:focus {
|
|
2712
|
-
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
2713
|
-
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
2714
|
-
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
|
-
.focus\\:ring-inkeep-expanded-primary-500:focus {
|
|
2718
|
-
--tw-ring-color: var(--ikp-color-inkeep-expanded-primary-500);
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
2661
|
.focus-visible\\:rounded:focus-visible {
|
|
2722
2662
|
border-radius: 0.25rem;
|
|
2723
2663
|
}
|
|
@@ -2807,10 +2747,6 @@ slot {
|
|
|
2807
2747
|
opacity: 0.5;
|
|
2808
2748
|
}
|
|
2809
2749
|
|
|
2810
|
-
.disabled\\:opacity-60:disabled {
|
|
2811
|
-
opacity: 0.6;
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
2750
|
.disabled\\:shadow-none:disabled {
|
|
2815
2751
|
--tw-shadow: 0 0 #0000;
|
|
2816
2752
|
--tw-shadow-colored: 0 0 #0000;
|
|
@@ -3624,11 +3560,6 @@ slot {
|
|
|
3624
3560
|
color: var(--ikp-color-inkeep-primary-stronger);
|
|
3625
3561
|
}
|
|
3626
3562
|
|
|
3627
|
-
.hover\\:text-red-500:hover:not(:disabled) {
|
|
3628
|
-
--tw-text-opacity: 1;
|
|
3629
|
-
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
|
3630
|
-
}
|
|
3631
|
-
|
|
3632
3563
|
.hover\\:underline:hover:not(:disabled) {
|
|
3633
3564
|
text-decoration-line: underline;
|
|
3634
3565
|
}
|
|
@@ -3831,10 +3762,6 @@ slot {
|
|
|
3831
3762
|
border-color: var(--ikp-color-inkeep-expanded-primary-600);
|
|
3832
3763
|
}
|
|
3833
3764
|
|
|
3834
|
-
.dark\\:border-white-alpha-100:is([data-theme="dark"] *) {
|
|
3835
|
-
border-color: var(--ikp-color-white-alpha-100);
|
|
3836
|
-
}
|
|
3837
|
-
|
|
3838
3765
|
.dark\\:border-white-alpha-200:is([data-theme="dark"] *) {
|
|
3839
3766
|
border-color: var(--ikp-color-white-alpha-200);
|
|
3840
3767
|
}
|
|
@@ -3953,11 +3880,6 @@ slot {
|
|
|
3953
3880
|
color: rgb(252 165 165 / var(--tw-text-opacity, 1));
|
|
3954
3881
|
}
|
|
3955
3882
|
|
|
3956
|
-
.dark\\:text-red-400:is([data-theme="dark"] *) {
|
|
3957
|
-
--tw-text-opacity: 1;
|
|
3958
|
-
color: rgb(248 113 113 / var(--tw-text-opacity, 1));
|
|
3959
|
-
}
|
|
3960
|
-
|
|
3961
3883
|
.dark\\:text-white:is([data-theme="dark"] *) {
|
|
3962
3884
|
--tw-text-opacity: 1;
|
|
3963
3885
|
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260508233535",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@ai-sdk/openai": "3.0.14",
|
|
42
42
|
"@ai-sdk/react": "3.0.46",
|
|
43
|
-
"@hookform/resolvers": "^5.2.1",
|
|
44
43
|
"@radix-ui/number": "^1.1.1",
|
|
45
44
|
"@radix-ui/primitive": "^1.1.1",
|
|
46
45
|
"@radix-ui/react-avatar": "1.1.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@hookform/resolvers"),m=require("react-hook-form"),v=require("../../../../../../zod@4.3.6/node_modules/zod/v4/core/parse.cjs"),p=require("../../../../../../zod@4.3.6/node_modules/zod/v4/core/errors.cjs");function h(n,i){try{var o=n()}catch(e){return i(e)}return o&&o.then?o.then(void 0,i):o}function y(n,i){for(var o={};n.length;){var e=n[0],a=e.code,s=e.message,r=e.path.join(".");if(!o[r])if("unionErrors"in e){var t=e.unionErrors[0].errors[0];o[r]={message:t.message,type:t.code}}else o[r]={message:s,type:a};if("unionErrors"in e&&e.unionErrors.forEach(function(l){return l.errors.forEach(function(f){return n.push(f)})}),i){var u=o[r].types,c=u&&u[e.code];o[r]=m.appendErrors(r,i,o,a,c?[].concat(c,e.message):e.message)}n.shift()}return o}function g(n,i){for(var o={};n.length;){var e=n[0],a=e.code,s=e.message,r=e.path.join(".");if(!o[r])if(e.code==="invalid_union"&&e.errors.length>0){var t=e.errors[0][0];o[r]={message:t.message,type:t.code}}else o[r]={message:s,type:a};if(e.code==="invalid_union"&&e.errors.forEach(function(l){return l.forEach(function(f){return n.push(f)})}),i){var u=o[r].types,c=u&&u[e.code];o[r]=m.appendErrors(r,i,o,a,c?[].concat(c,e.message):e.message)}n.shift()}return o}function E(n,i,o){if(o===void 0&&(o={}),(function(e){return"_def"in e&&typeof e._def=="object"&&"typeName"in e._def})(n))return function(e,a,s){try{return Promise.resolve(h(function(){return Promise.resolve(n[o.mode==="sync"?"parse":"parseAsync"](e,i)).then(function(r){return s.shouldUseNativeValidation&&d.validateFieldsNatively({},s),{errors:{},values:o.raw?Object.assign({},e):r}})},function(r){if((function(t){return Array.isArray(t?.issues)})(r))return{values:{},errors:d.toNestErrors(y(r.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};if((function(e){return"_zod"in e&&typeof e._zod=="object"})(n))return function(e,a,s){try{return Promise.resolve(h(function(){return Promise.resolve((o.mode==="sync"?v.parse:v.parseAsync)(n,e,i)).then(function(r){return s.shouldUseNativeValidation&&d.validateFieldsNatively({},s),{errors:{},values:o.raw?Object.assign({},e):r}})},function(r){if((function(t){return t instanceof p.$ZodError})(r))return{values:{},errors:d.toNestErrors(g(r.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}exports.zodResolver=E;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { validateFieldsNatively as l, toNestErrors as m } from "@hookform/resolvers";
|
|
3
|
-
import { appendErrors as h } from "react-hook-form";
|
|
4
|
-
import { parse as p, parseAsync as y } from "../../../../../../zod@4.3.6/node_modules/zod/v4/core/parse.js";
|
|
5
|
-
import { $ZodError as g } from "../../../../../../zod@4.3.6/node_modules/zod/v4/core/errors.js";
|
|
6
|
-
function v(n, i) {
|
|
7
|
-
try {
|
|
8
|
-
var o = n();
|
|
9
|
-
} catch (r) {
|
|
10
|
-
return i(r);
|
|
11
|
-
}
|
|
12
|
-
return o && o.then ? o.then(void 0, i) : o;
|
|
13
|
-
}
|
|
14
|
-
function E(n, i) {
|
|
15
|
-
for (var o = {}; n.length; ) {
|
|
16
|
-
var r = n[0], a = r.code, s = r.message, e = r.path.join(".");
|
|
17
|
-
if (!o[e]) if ("unionErrors" in r) {
|
|
18
|
-
var t = r.unionErrors[0].errors[0];
|
|
19
|
-
o[e] = { message: t.message, type: t.code };
|
|
20
|
-
} else o[e] = { message: s, type: a };
|
|
21
|
-
if ("unionErrors" in r && r.unionErrors.forEach(function(f) {
|
|
22
|
-
return f.errors.forEach(function(d) {
|
|
23
|
-
return n.push(d);
|
|
24
|
-
});
|
|
25
|
-
}), i) {
|
|
26
|
-
var u = o[e].types, c = u && u[r.code];
|
|
27
|
-
o[e] = h(e, i, o, a, c ? [].concat(c, r.message) : r.message);
|
|
28
|
-
}
|
|
29
|
-
n.shift();
|
|
30
|
-
}
|
|
31
|
-
return o;
|
|
32
|
-
}
|
|
33
|
-
function j(n, i) {
|
|
34
|
-
for (var o = {}; n.length; ) {
|
|
35
|
-
var r = n[0], a = r.code, s = r.message, e = r.path.join(".");
|
|
36
|
-
if (!o[e]) if (r.code === "invalid_union" && r.errors.length > 0) {
|
|
37
|
-
var t = r.errors[0][0];
|
|
38
|
-
o[e] = { message: t.message, type: t.code };
|
|
39
|
-
} else o[e] = { message: s, type: a };
|
|
40
|
-
if (r.code === "invalid_union" && r.errors.forEach(function(f) {
|
|
41
|
-
return f.forEach(function(d) {
|
|
42
|
-
return n.push(d);
|
|
43
|
-
});
|
|
44
|
-
}), i) {
|
|
45
|
-
var u = o[e].types, c = u && u[r.code];
|
|
46
|
-
o[e] = h(e, i, o, a, c ? [].concat(c, r.message) : r.message);
|
|
47
|
-
}
|
|
48
|
-
n.shift();
|
|
49
|
-
}
|
|
50
|
-
return o;
|
|
51
|
-
}
|
|
52
|
-
function b(n, i, o) {
|
|
53
|
-
if (o === void 0 && (o = {}), (function(r) {
|
|
54
|
-
return "_def" in r && typeof r._def == "object" && "typeName" in r._def;
|
|
55
|
-
})(n)) return function(r, a, s) {
|
|
56
|
-
try {
|
|
57
|
-
return Promise.resolve(v(function() {
|
|
58
|
-
return Promise.resolve(n[o.mode === "sync" ? "parse" : "parseAsync"](r, i)).then(function(e) {
|
|
59
|
-
return s.shouldUseNativeValidation && l({}, s), { errors: {}, values: o.raw ? Object.assign({}, r) : e };
|
|
60
|
-
});
|
|
61
|
-
}, function(e) {
|
|
62
|
-
if ((function(t) {
|
|
63
|
-
return Array.isArray(t?.issues);
|
|
64
|
-
})(e)) return { values: {}, errors: m(E(e.errors, !s.shouldUseNativeValidation && s.criteriaMode === "all"), s) };
|
|
65
|
-
throw e;
|
|
66
|
-
}));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
return Promise.reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
if ((function(r) {
|
|
72
|
-
return "_zod" in r && typeof r._zod == "object";
|
|
73
|
-
})(n)) return function(r, a, s) {
|
|
74
|
-
try {
|
|
75
|
-
return Promise.resolve(v(function() {
|
|
76
|
-
return Promise.resolve((o.mode === "sync" ? p : y)(n, r, i)).then(function(e) {
|
|
77
|
-
return s.shouldUseNativeValidation && l({}, s), { errors: {}, values: o.raw ? Object.assign({}, r) : e };
|
|
78
|
-
});
|
|
79
|
-
}, function(e) {
|
|
80
|
-
if ((function(t) {
|
|
81
|
-
return t instanceof g;
|
|
82
|
-
})(e)) return { values: {}, errors: m(j(e.issues, !s.shouldUseNativeValidation && s.criteriaMode === "all"), s) };
|
|
83
|
-
throw e;
|
|
84
|
-
}));
|
|
85
|
-
} catch (e) {
|
|
86
|
-
return Promise.reject(e);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
throw new Error("Invalid input: not a Zod schema");
|
|
90
|
-
}
|
|
91
|
-
export {
|
|
92
|
-
b as zodResolver
|
|
93
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function b(r,l,c){function f(e,o){if(e._zod||Object.defineProperty(e,"_zod",{value:{def:o,constr:n,traits:new Set},enumerable:!1}),e._zod.traits.has(r))return;e._zod.traits.add(r),l(e,o);const t=n.prototype,i=Object.keys(t);for(let s=0;s<i.length;s++){const d=i[s];d in e||(e[d]=t[d].bind(e))}}const y=c?.Parent??Object;class u extends y{}Object.defineProperty(u,"name",{value:r});function n(e){var o;const t=c?.Parent?new u:this;f(t,e),(o=t._zod).deferred??(o.deferred=[]);for(const i of t._zod.deferred)i();return t}return Object.defineProperty(n,"init",{value:f}),Object.defineProperty(n,Symbol.hasInstance,{value:e=>c?.Parent&&e instanceof c.Parent?!0:e?._zod?.traits?.has(r)}),Object.defineProperty(n,"name",{value:r}),n}class P extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const a={};function g(r){return a}exports.$ZodAsyncError=P;exports.$constructor=b;exports.config=g;exports.globalConfig=a;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function b(r, a, c) {
|
|
2
|
-
function f(e, o) {
|
|
3
|
-
if (e._zod || Object.defineProperty(e, "_zod", {
|
|
4
|
-
value: {
|
|
5
|
-
def: o,
|
|
6
|
-
constr: n,
|
|
7
|
-
traits: /* @__PURE__ */ new Set()
|
|
8
|
-
},
|
|
9
|
-
enumerable: !1
|
|
10
|
-
}), e._zod.traits.has(r))
|
|
11
|
-
return;
|
|
12
|
-
e._zod.traits.add(r), a(e, o);
|
|
13
|
-
const t = n.prototype, s = Object.keys(t);
|
|
14
|
-
for (let i = 0; i < s.length; i++) {
|
|
15
|
-
const d = s[i];
|
|
16
|
-
d in e || (e[d] = t[d].bind(e));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const l = c?.Parent ?? Object;
|
|
20
|
-
class u extends l {
|
|
21
|
-
}
|
|
22
|
-
Object.defineProperty(u, "name", { value: r });
|
|
23
|
-
function n(e) {
|
|
24
|
-
var o;
|
|
25
|
-
const t = c?.Parent ? new u() : this;
|
|
26
|
-
f(t, e), (o = t._zod).deferred ?? (o.deferred = []);
|
|
27
|
-
for (const s of t._zod.deferred)
|
|
28
|
-
s();
|
|
29
|
-
return t;
|
|
30
|
-
}
|
|
31
|
-
return Object.defineProperty(n, "init", { value: f }), Object.defineProperty(n, Symbol.hasInstance, {
|
|
32
|
-
value: (e) => c?.Parent && e instanceof c.Parent ? !0 : e?._zod?.traits?.has(r)
|
|
33
|
-
}), Object.defineProperty(n, "name", { value: r }), n;
|
|
34
|
-
}
|
|
35
|
-
class P extends Error {
|
|
36
|
-
constructor() {
|
|
37
|
-
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const y = {};
|
|
41
|
-
function p(r) {
|
|
42
|
-
return y;
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
P as $ZodAsyncError,
|
|
46
|
-
b as $constructor,
|
|
47
|
-
p as config,
|
|
48
|
-
y as globalConfig
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./core.cjs"),a=require("./util.cjs"),t=(e,r)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:r,enumerable:!1}),e.message=JSON.stringify(r,a.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},l=o.$constructor("$ZodError",t),c=o.$constructor("$ZodError",t,{Parent:Error});exports.$ZodError=l;exports.$ZodRealError=c;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { $constructor as o } from "./core.js";
|
|
3
|
-
import { jsonStringifyReplacer as t } from "./util.js";
|
|
4
|
-
const a = (e, r) => {
|
|
5
|
-
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
6
|
-
value: e._zod,
|
|
7
|
-
enumerable: !1
|
|
8
|
-
}), Object.defineProperty(e, "issues", {
|
|
9
|
-
value: r,
|
|
10
|
-
enumerable: !1
|
|
11
|
-
}), e.message = JSON.stringify(r, t, 2), Object.defineProperty(e, "toString", {
|
|
12
|
-
value: () => e.message,
|
|
13
|
-
enumerable: !1
|
|
14
|
-
});
|
|
15
|
-
}, s = o("$ZodError", a), c = o("$ZodError", a, { Parent: Error });
|
|
16
|
-
export {
|
|
17
|
-
s as $ZodError,
|
|
18
|
-
c as $ZodRealError
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./core.cjs"),f=require("./errors.cjs"),c=require("./util.cjs"),y=a=>(o,i,s,r)=>{const n=s?Object.assign(s,{async:!1}):{async:!1},e=o._zod.run({value:i,issues:[]},n);if(e instanceof Promise)throw new l.$ZodAsyncError;if(e.issues.length){const t=new(r?.Err??a)(e.issues.map(u=>c.finalizeIssue(u,n,l.config())));throw c.captureStackTrace(t,r?.callee),t}return e.value},g=y(f.$ZodRealError),p=a=>async(o,i,s,r)=>{const n=s?Object.assign(s,{async:!0}):{async:!0};let e=o._zod.run({value:i,issues:[]},n);if(e instanceof Promise&&(e=await e),e.issues.length){const t=new(r?.Err??a)(e.issues.map(u=>c.finalizeIssue(u,n,l.config())));throw c.captureStackTrace(t,r?.callee),t}return e.value},d=p(f.$ZodRealError);exports._parse=y;exports._parseAsync=p;exports.parse=g;exports.parseAsync=d;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { $ZodAsyncError as m, config as u } from "./core.js";
|
|
3
|
-
import { $ZodRealError as l } from "./errors.js";
|
|
4
|
-
import { finalizeIssue as f, captureStackTrace as p } from "./util.js";
|
|
5
|
-
const y = (o) => (c, a, e, r) => {
|
|
6
|
-
const n = e ? Object.assign(e, { async: !1 }) : { async: !1 }, s = c._zod.run({ value: a, issues: [] }, n);
|
|
7
|
-
if (s instanceof Promise)
|
|
8
|
-
throw new m();
|
|
9
|
-
if (s.issues.length) {
|
|
10
|
-
const t = new (r?.Err ?? o)(s.issues.map((i) => f(i, n, u())));
|
|
11
|
-
throw p(t, r?.callee), t;
|
|
12
|
-
}
|
|
13
|
-
return s.value;
|
|
14
|
-
}, E = /* @__PURE__ */ y(l), w = (o) => async (c, a, e, r) => {
|
|
15
|
-
const n = e ? Object.assign(e, { async: !0 }) : { async: !0 };
|
|
16
|
-
let s = c._zod.run({ value: a, issues: [] }, n);
|
|
17
|
-
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
18
|
-
const t = new (r?.Err ?? o)(s.issues.map((i) => f(i, n, u())));
|
|
19
|
-
throw p(t, r?.callee), t;
|
|
20
|
-
}
|
|
21
|
-
return s.value;
|
|
22
|
-
}, z = /* @__PURE__ */ w(l);
|
|
23
|
-
export {
|
|
24
|
-
y as _parse,
|
|
25
|
-
w as _parseAsync,
|
|
26
|
-
E as parse,
|
|
27
|
-
z as parseAsync
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(e,r){return typeof r=="bigint"?r.toString():r}const u="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function n(e){return typeof e=="string"?e:e?.message}function i(e,r,a){const t={...e,path:e.path??[]};if(!e.message){const o=n(e.inst?._zod.def?.error?.(e))??n(r?.error?.(e))??n(a.customError?.(e))??n(a.localeError?.(e))??"Invalid input";t.message=o}return delete t.inst,delete t.continue,r?.reportInput||delete t.input,t}exports.captureStackTrace=u;exports.finalizeIssue=i;exports.jsonStringifyReplacer=c;exports.unwrapMessage=n;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function c(r, e) {
|
|
3
|
-
return typeof e == "bigint" ? e.toString() : e;
|
|
4
|
-
}
|
|
5
|
-
const u = "captureStackTrace" in Error ? Error.captureStackTrace : (...r) => {
|
|
6
|
-
};
|
|
7
|
-
function n(r) {
|
|
8
|
-
return typeof r == "string" ? r : r?.message;
|
|
9
|
-
}
|
|
10
|
-
function i(r, e, o) {
|
|
11
|
-
const t = { ...r, path: r.path ?? [] };
|
|
12
|
-
if (!r.message) {
|
|
13
|
-
const a = n(r.inst?._zod.def?.error?.(r)) ?? n(e?.error?.(r)) ?? n(o.customError?.(r)) ?? n(o.localeError?.(r)) ?? "Invalid input";
|
|
14
|
-
t.message = a;
|
|
15
|
-
}
|
|
16
|
-
return delete t.inst, delete t.continue, e?.reportInput || delete t.input, t;
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
u as captureStackTrace,
|
|
20
|
-
i as finalizeIssue,
|
|
21
|
-
c as jsonStringifyReplacer,
|
|
22
|
-
n as unwrapMessage
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),Y=require("../../node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.70.0_react@19.3.0-canary-87ae75b3-20260128_/node_modules/@hookform/resolvers/zod/dist/zod.cjs"),b=require("react"),y=require("react-hook-form"),x=require("zod"),f=require("../utils.cjs"),E=require("./ui/recipes/button.cjs"),S="border border-gray-200 dark:border-white-alpha-200 rounded-lg mb-3 p-4 bg-white dark:bg-gray-dark-900",q="text-xs font-medium text-gray-700 dark:text-white-alpha-700 select-none",$="text-xs px-2 py-1.5 rounded-md border bg-white dark:bg-gray-dark-900 text-gray-800 dark:text-white-alpha-800 border-gray-200 dark:border-white-alpha-200 focus:outline-none focus:ring-1 focus:ring-inkeep-expanded-primary-500 disabled:opacity-60 disabled:cursor-not-allowed",F="text-2xs text-gray-500 dark:text-white-alpha-500 mt-0.5",z="text-2xs text-red-600 dark:text-red-400 mt-0.5",M=e=>{switch(e){case"short":return"w-20";case"medium":return"w-48";default:return"w-full"}};function _(e){return!(e.length>200||/[+*?}]\)?[+*?{]/.test(e)||/\([^)]*\|[^)]*\)[+*?{]/.test(e))}function H(e){const a=e.required!==!1;switch(e.type){case"boolean":return x.z.boolean().default(!1);case"number":{let t=x.z.number();e.validation?.min!==void 0&&(t=t.min(e.validation.min)),e.validation?.max!==void 0&&(t=t.max(e.validation.max));const s=a?t:t.optional();return x.z.preprocess(i=>{if(!(i===""||i===null||i===void 0)){if(typeof i=="string"){const l=Number(i);return Number.isNaN(l)?i:l}return i}},s)}case"email":{let t=x.z.string().email("Enter a valid email");return e.validation?.minLength!==void 0&&(t=t.min(e.validation.minLength)),e.validation?.maxLength!==void 0&&(t=t.max(e.validation.maxLength)),a?t.min(1,"Required"):t.or(x.z.literal(""))}case"date":{const t=x.z.string();return a?t.min(1,"Required"):t.optional()}default:{let t=x.z.string();if(e.validation?.minLength!==void 0&&(t=t.min(e.validation.minLength)),e.validation?.maxLength!==void 0&&(t=t.max(e.validation.maxLength)),e.validation?.pattern&&_(e.validation.pattern))try{t=t.regex(new RegExp(e.validation.pattern),"Invalid format")}catch{}if(e.options&&e.options.length>0){const s=e.options.map(l=>l.value),i=x.z.enum(s);return a?i:i.or(x.z.literal(""))}return a?t.min(1,"Required"):t}}}function J(e){let a;switch(e.itemType){case"number":a=x.z.preprocess(s=>s===""||s===null||s===void 0?void 0:Number(s),x.z.number());break;case"email":a=x.z.string().email();break;case"boolean":a=x.z.boolean();break;default:a=x.z.string().min(1)}let t=x.z.array(a);return e.min!==void 0&&(t=t.min(e.min,`At least ${e.min}`)),e.max!==void 0&&(t=t.max(e.max,`At most ${e.max}`)),t}function K(e){return e.kind==="leaf"?H(e):e.kind==="list"?J(e):e.kind==="groupList"?W(e):B(e.children)}function B(e){const a={};for(const t of e)a[t.id]=K(t);return x.z.object(a)}function W(e){const a=B(e.item.children);let t=x.z.array(a);return e.min!==void 0&&(t=t.min(e.min,`At least ${e.min}`)),e.max!==void 0&&(t=t.max(e.max,`At most ${e.max}`)),t}function Q(e){return B(e)}function X(e){if(e.default!==void 0)return e.default;if(e.options&&e.options.length>0)return e.options[0]?.value??"";switch(e.type){case"boolean":return!1;case"number":return"";default:return""}}function L(e){const a={};for(const t of e)if(t.kind==="leaf")a[t.id]=X(t);else if(t.kind==="list")a[t.id]=[];else if(t.kind==="groupList"){const s=t.min??0,i=[];for(let l=0;l<s;l++)i.push(L(t.item.children));a[t.id]=i}else a[t.id]=L(t.children);return a}function V(e,a=[]){for(const t of e){if(t.kind==="leaf")return[...a,t.id];if(t.kind==="group"){const s=V(t.children,[...a,t.id]);if(s)return s}}}function Z(e,a=[]){for(const t of e)if(t.kind==="leaf"){if(!(t.default!==void 0&&t.default!==""))return[...a,t.id]}else if(t.kind==="group"){const s=Z(t.children,[...a,t.id]);if(s)return s}}function ee(e){return Z(e)??V(e)}const re=({input:e,output:a,status:t,errorText:s,onSubmit:i,onDecline:l})=>t==="pending"?r.jsx("div",{className:S,children:r.jsxs("div",{className:"space-y-3 animate-pulse",children:[r.jsx("div",{className:"h-3 w-32 bg-gray-100 dark:bg-white-alpha-100 rounded"}),r.jsx("div",{className:"h-7 w-full bg-gray-100 dark:bg-white-alpha-100 rounded"}),r.jsx("div",{className:"h-7 w-full bg-gray-100 dark:bg-white-alpha-100 rounded"})]})}):t==="declined"?r.jsx("div",{className:S,children:r.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-white-alpha-700",children:s||"User declined to provide input."})}):t==="submitted"&&a?r.jsx(te,{output:a}):!e||!Array.isArray(e.form)?r.jsx("div",{className:S,children:r.jsx("div",{className:"text-xs text-gray-500 dark:text-white-alpha-500 italic",children:"Preparing form…"})}):r.jsx(ae,{input:e,onSubmit:i??(()=>{}),onDecline:l??(()=>{})}),te=({output:e})=>r.jsxs("div",{className:S,children:[e.message&&r.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-white-alpha-800 mb-3",children:e.message}),r.jsx("div",{className:"space-y-3",children:e.form.map(a=>r.jsx(P,{node:a,value:e.answers[a.id]},a.id))})]}),P=({node:e,value:a})=>{if(e.kind==="group"){const t=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return r.jsxs("fieldset",{className:"border-l-2 border-gray-100 dark:border-white-alpha-100 pl-3",children:[e.label&&r.jsx("legend",{className:"text-xs font-semibold text-gray-700 dark:text-white-alpha-700 mb-2",children:e.label}),r.jsx("div",{className:"space-y-3",children:e.children.map(s=>r.jsx(P,{node:s,value:t[s.id]},s.id))})]})}if(e.kind==="list"){const t=Array.isArray(a)?a:[];return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:q,children:e.label}),r.jsx("div",{className:"flex flex-wrap gap-1",children:t.length===0?r.jsx("span",{className:"text-2xs text-gray-500 dark:text-white-alpha-500 italic",children:"(none)"}):t.map((s,i)=>{const l=G(s);return r.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-white-alpha-100 text-2xs text-gray-700 dark:text-white-alpha-700",children:l},`${l}-${i}`)})})]})}if(e.kind==="groupList"){const t=Array.isArray(a)?a:[];return r.jsxs("fieldset",{className:"border-l-2 border-gray-100 dark:border-white-alpha-100 pl-3",children:[r.jsx("legend",{className:"text-xs font-semibold text-gray-700 dark:text-white-alpha-700 mb-2",children:e.label}),r.jsx("div",{className:"space-y-2",children:t.length===0?r.jsx("span",{className:"text-2xs text-gray-500 dark:text-white-alpha-500 italic",children:"(none)"}):t.map((s,i)=>{const l=s&&typeof s=="object"&&!Array.isArray(s)?s:{};return r.jsxs("div",{className:"pl-2 py-1 rounded-md bg-gray-50/50 dark:bg-white-alpha-50/50",children:[r.jsxs("span",{className:"text-2xs font-medium text-gray-500 dark:text-white-alpha-500 uppercase tracking-wider",children:["#",i+1]}),r.jsx("div",{className:"mt-1 space-y-2",children:e.item.children.map(n=>r.jsx(P,{node:n,value:l[n.id]},n.id))})]},`row-${i}-${e.id}`)})})]})}return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:q,children:e.label}),r.jsx("span",{className:f.cn($,M(e.width),"inline-block opacity-70"),"aria-disabled":"true",children:a===void 0||a===""?r.jsx("span",{className:"italic text-gray-500 dark:text-white-alpha-500",children:"(empty)"}):e.type==="boolean"?a?"Yes":"No":String(a)})]})},ae=({input:e,onSubmit:a,onDecline:t})=>{const s=e.form??[],i=b.useMemo(()=>Q(s),[s]),l=b.useMemo(()=>L(s),[s]),n=b.useMemo(()=>ee(s),[s]),h=Y.zodResolver(i),m=y.useForm({resolver:h,defaultValues:l,mode:"onBlur",reValidateMode:"onChange",shouldFocusError:!0}),A=m.handleSubmit(c=>{a(c)});return r.jsx(y.FormProvider,{...m,children:r.jsxs("form",{onSubmit:A,className:S,noValidate:!0,"aria-label":e.message||"User input form",children:[e.message&&r.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-white-alpha-800 mb-3",children:e.message}),r.jsx("div",{className:"space-y-3",children:s.map(c=>r.jsx(D,{node:c,pathPrefix:"",autoFocusPath:n},c.id))}),r.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4",children:[r.jsx("button",{type:"button",className:E.button({size:"xs",variant:"ghost"}),onClick:t,disabled:m.formState.isSubmitting,children:"Cancel"}),r.jsx("button",{type:"submit",className:E.button({size:"xs",variant:"primaryFilled"}),disabled:m.formState.isSubmitting,children:m.formState.isSubmitting?"Submitting…":"Submit"})]})]})})},D=({node:e,pathPrefix:a,autoFocusPath:t})=>{const s=a?`${a}.${e.id}`:e.id;return e.kind==="group"?r.jsx(se,{node:e,path:s,autoFocusPath:t}):e.kind==="list"?r.jsx(ne,{node:e,path:s}):e.kind==="groupList"?r.jsx(ce,{node:e,path:s,autoFocusPath:t}):r.jsx(ie,{node:e,path:s,autoFocusPath:t})},se=({node:e,path:a,autoFocusPath:t})=>r.jsxs("fieldset",{className:"border-l-2 border-gray-100 dark:border-white-alpha-100 pl-3","aria-labelledby":e.label?`group-${a}`:void 0,children:[e.label&&r.jsx("legend",{id:`group-${a}`,className:"text-xs font-semibold text-gray-700 dark:text-white-alpha-700 mb-2 px-1",children:e.label}),e.helpText&&r.jsx("div",{className:F,children:e.helpText}),r.jsx("div",{className:"space-y-3",children:e.children.map(s=>r.jsx(D,{node:s,pathPrefix:a,autoFocusPath:t},s.id))})]}),ie=({node:e,path:a,autoFocusPath:t})=>{const{register:s,control:i}=y.useFormContext(),l=e.required!==!1,n=`askuser-${a.replace(/\./g,"-")}`,h=`${n}-error`,m=`${n}-help`,{errors:A}=y.useFormState({control:i,name:a}),c=U(A,a),j=b.useMemo(()=>t!==void 0&&t.join(".")===a,[t,a]),k=r.jsxs("label",{htmlFor:n,className:q,children:[e.label,l&&r.jsx("span",{"aria-label":"required",className:"text-red-500 ml-0.5",children:"*"})]}),p=r.jsxs(r.Fragment,{children:[e.helpText&&r.jsx("div",{id:m,className:F,children:e.helpText}),c&&r.jsx("div",{id:h,role:"alert",className:z,children:c})]});if(e.type==="boolean")return r.jsx(y.Controller,{name:a,control:i,render:({field:d})=>r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{type:"button",role:"switch",id:n,"aria-checked":!!d.value,"aria-required":l,"aria-invalid":!!c,"aria-describedby":f.cn(e.helpText&&m,c&&h)||void 0,onClick:()=>d.onChange(!d.value),onBlur:d.onBlur,ref:j?R:void 0,className:f.cn("inline-flex h-5 w-9 items-center rounded-full border transition-colors mt-0.5","border-gray-200 dark:border-white-alpha-200","focus:outline-none focus:ring-1 focus:ring-inkeep-expanded-primary-500",d.value?"bg-inkeep-expanded-primary-500":"bg-gray-100 dark:bg-white-alpha-100"),children:r.jsx("span",{className:f.cn("inline-block h-3.5 w-3.5 rounded-full bg-white shadow transform transition-transform",d.value?"translate-x-4":"translate-x-0.5")})}),r.jsxs("div",{className:"flex flex-col flex-1",children:[k,p]})]})});if(e.type==="multiline")return r.jsxs("div",{className:"flex flex-col gap-1",children:[k,r.jsx(y.Controller,{name:a,control:i,render:({field:d})=>r.jsx(le,{id:n,value:d.value??"",onChange:u=>d.onChange(u.target.value),onBlur:d.onBlur,placeholder:e.placeholder,autoComplete:e.autocomplete??"off","aria-required":l,"aria-invalid":!!c,"aria-describedby":f.cn(e.helpText&&m,c&&h)||void 0,focusOnMount:j,className:f.cn($,"w-full resize-none min-h-[60px]")})}),p]});if(e.options&&e.options.length>0){const d=s(a);return r.jsxs("div",{className:"flex flex-col gap-1",children:[k,r.jsxs("select",{id:n,...d,ref:u=>{d.ref(u),j&&R(u)},"aria-required":l,"aria-invalid":!!c,"aria-describedby":f.cn(e.helpText&&m,c&&h)||void 0,className:f.cn($,M(e.width)),children:[!l&&r.jsx("option",{value:"",children:"—"}),e.options.map(u=>r.jsx("option",{value:u.value,children:u.label??u.value},u.value))]}),p]})}const w=e.type==="date"?"date":e.type==="email"?"email":"text",T=e.type==="number"?"numeric":void 0,N=s(a);return r.jsxs("div",{className:"flex flex-col gap-1",children:[k,r.jsx("input",{id:n,type:w,inputMode:T,placeholder:e.placeholder,autoComplete:e.autocomplete??"off","aria-required":l,"aria-invalid":!!c,"aria-describedby":f.cn(e.helpText&&m,c&&h)||void 0,...N,ref:d=>{N.ref(d),j&&R(d)},className:f.cn($,M(e.width))}),p]})};function R(e){e&&requestAnimationFrame(()=>{typeof e.focus=="function"&&e.focus()})}const le=({value:e,className:a,focusOnMount:t,...s})=>{const i=b.useRef(null);return b.useEffect(()=>{const l=i.current;if(!l)return;l.style.height="0";const n=Math.min(l.scrollHeight,200);l.style.height=`${n}px`},[e]),b.useEffect(()=>{t&&requestAnimationFrame(()=>i.current?.focus())},[]),r.jsx("textarea",{ref:i,value:e,className:a,rows:3,...s})},ne=({node:e,path:a})=>{const{control:t,setValue:s,trigger:i}=y.useFormContext(),l=y.useWatch({control:t,name:a}),n=Array.isArray(l)?l:[],h=`askuser-${a.replace(/\./g,"-")}`,m=`${h}-error`,{errors:A}=y.useFormState({control:t,name:a}),c=U(A,a),j=(e.min??0)>0,k=e.max??Number.POSITIVE_INFINITY,p=n.length>=k,[w,T]=b.useState(""),N=b.useCallback(o=>{s(a,o,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})},[s,a]),d=b.useCallback(o=>{N([...n,o])},[n,N]),u=b.useCallback(o=>{N(n.filter((v,g)=>g!==o))},[n,N]),C=b.useCallback(()=>{const o=w.trim();if(!o||p)return;let v;if(e.itemType==="number"){const g=Number(o);if(Number.isNaN(g))return;v=g}else e.itemType==="boolean"?v=o==="true":v=o;d(v),T("")},[w,p,e.itemType,d]),O=o=>{o.key==="Enter"||o.key===","?(o.preventDefault(),C()):o.key==="Backspace"&&w===""&&n.length>0&&u(n.length-1)};return e.options&&e.options.length>0?r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("label",{htmlFor:h,className:q,children:[e.label,j&&r.jsx("span",{"aria-label":"required",className:"text-red-500 ml-0.5",children:"*"})]}),r.jsx("fieldset",{className:"flex flex-wrap gap-1.5",id:h,children:e.options.map(o=>{const v=n.findIndex(I=>I===o.value),g=v>=0;return r.jsx("button",{type:"button","aria-pressed":g,onClick:()=>{g?u(v):p||d(o.value),i(a)},className:f.cn("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-2xs border transition-colors",g?"bg-inkeep-expanded-primary-500 text-white border-inkeep-expanded-primary-500":"bg-white dark:bg-gray-dark-900 text-gray-700 dark:text-white-alpha-700 border-gray-200 dark:border-white-alpha-200 hover:bg-gray-50 dark:hover:bg-white-alpha-50"),children:o.label??o.value},o.value)})}),e.helpText&&r.jsx("div",{className:F,children:e.helpText}),c&&r.jsx("div",{id:m,role:"alert",className:z,children:c})]}):r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("label",{htmlFor:h,className:q,children:[e.label,j&&r.jsx("span",{"aria-label":"required",className:"text-red-500 ml-0.5",children:"*"})]}),r.jsxs("div",{className:f.cn($,"w-full flex flex-wrap gap-1 items-center cursor-text min-h-[32px] py-1"),onClick:()=>document.getElementById(h)?.focus(),children:[n.map((o,v)=>{const g=G(o);return r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-white-alpha-100 text-2xs text-gray-700 dark:text-white-alpha-700",children:[g,r.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),u(v)},"aria-label":`Remove ${g}`,className:"text-gray-500 hover:text-gray-700 dark:text-white-alpha-500 dark:hover:text-white-alpha-700",children:"×"})]},`${g}-${v}`)}),r.jsx("input",{id:h,type:e.itemType==="number"?"text":e.itemType==="email"?"email":"text",inputMode:e.itemType==="number"?"numeric":void 0,value:w,placeholder:n.length===0?e.placeholder??"Type and press Enter…":"",onChange:o=>T(o.target.value),onKeyDown:O,onBlur:C,"aria-required":j,"aria-invalid":!!c,"aria-describedby":c?m:void 0,disabled:p,className:"flex-1 min-w-[80px] outline-none bg-transparent text-xs"})]}),e.helpText&&r.jsx("div",{className:F,children:e.helpText}),c&&r.jsx("div",{id:m,role:"alert",className:z,children:c})]})};function G(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}const ce=({node:e,path:a,autoFocusPath:t})=>{const{control:s}=y.useFormContext(),{errors:i}=y.useFormState({control:s,name:a}),{fields:l,append:n,remove:h}=y.useFieldArray({control:s,name:a}),m=`askuser-${a.replace(/\./g,"-")}`,A=`${m}-error`,c=U(i,a),j=(e.min??0)>0,k=e.max??Number.POSITIVE_INFINITY,p=l.length>=k,w=e.min??0,T=l.length>w,N=b.useCallback(()=>{p||n(L(e.item.children))},[n,p,e.item.children]);return r.jsxs("fieldset",{className:"border-l-2 border-gray-100 dark:border-white-alpha-100 pl-3","aria-labelledby":`grouplist-${m}`,children:[r.jsxs("legend",{id:`grouplist-${m}`,className:"text-xs font-semibold text-gray-700 dark:text-white-alpha-700 mb-2 px-1",children:[e.label,j&&r.jsx("span",{"aria-label":"required",className:"text-red-500 ml-0.5",children:"*"})]}),e.helpText&&r.jsx("div",{className:F,children:e.helpText}),r.jsx("div",{className:"space-y-3",children:l.length===0?r.jsxs("div",{className:"text-2xs text-gray-500 dark:text-white-alpha-500 italic",children:["No rows yet — click “",e.addLabel??"Add row","” below."]}):l.map((d,u)=>r.jsxs("div",{className:"relative pl-2 py-2 rounded-md bg-gray-50/50 dark:bg-white-alpha-50/50",children:[r.jsxs("div",{className:"flex items-start justify-between mb-1",children:[r.jsxs("span",{className:"text-2xs font-medium text-gray-500 dark:text-white-alpha-500 uppercase tracking-wider",children:["#",u+1]}),T&&r.jsx("button",{type:"button",onClick:()=>h(u),"aria-label":`Remove row ${u+1}`,className:"text-2xs text-gray-500 hover:text-red-500 dark:text-white-alpha-500",children:"Remove"})]}),r.jsx("div",{className:"space-y-3",children:e.item.children.map(C=>r.jsx(D,{node:C,pathPrefix:`${a}.${u}`,autoFocusPath:t},C.id))})]},d.id))}),r.jsx("div",{className:"mt-2",children:r.jsxs("button",{type:"button",onClick:N,disabled:p,className:f.cn(E.button({size:"xs",variant:"outline"})),children:["+ ",e.addLabel??"Add row"]})}),c&&r.jsx("div",{id:A,role:"alert",className:z,children:c})]})};function U(e,a){const t=a.split(".");let s=e;for(const i of t)if(s&&typeof s=="object"&&i in s)s=s[i];else return;if(s&&typeof s=="object"&&"message"in s){const i=s.message;return typeof i=="string"?i:void 0}}exports.AskUserForm=re;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Form-schema vocabulary mirrored from agents-api default-tools.ts. The
|
|
4
|
-
* shape of `form` 1:1 determines the shape of the answers returned to the
|
|
5
|
-
* server — children of a group nest under that group's id, list answers
|
|
6
|
-
* come back as arrays. No separate mapping config: structure IS the
|
|
7
|
-
* mapping.
|
|
8
|
-
*/
|
|
9
|
-
export type LeafType = 'text' | 'multiline' | 'number' | 'email' | 'boolean' | 'date';
|
|
10
|
-
export type ListItemType = 'text' | 'number' | 'email' | 'date' | 'boolean';
|
|
11
|
-
export type Width = 'short' | 'medium' | 'full';
|
|
12
|
-
export interface LeafNode {
|
|
13
|
-
kind: 'leaf';
|
|
14
|
-
id: string;
|
|
15
|
-
label: string;
|
|
16
|
-
type: LeafType;
|
|
17
|
-
default?: string | number | boolean;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
options?: Array<{
|
|
20
|
-
value: string;
|
|
21
|
-
label?: string;
|
|
22
|
-
}>;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
helpText?: string;
|
|
25
|
-
autocomplete?: string;
|
|
26
|
-
width?: Width;
|
|
27
|
-
validation?: {
|
|
28
|
-
minLength?: number;
|
|
29
|
-
maxLength?: number;
|
|
30
|
-
pattern?: string;
|
|
31
|
-
min?: number;
|
|
32
|
-
max?: number;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export interface ListNode {
|
|
36
|
-
kind: 'list';
|
|
37
|
-
id: string;
|
|
38
|
-
label: string;
|
|
39
|
-
itemType: ListItemType;
|
|
40
|
-
options?: Array<{
|
|
41
|
-
value: string;
|
|
42
|
-
label?: string;
|
|
43
|
-
}>;
|
|
44
|
-
min?: number;
|
|
45
|
-
max?: number;
|
|
46
|
-
placeholder?: string;
|
|
47
|
-
helpText?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface GroupNode {
|
|
50
|
-
kind: 'group';
|
|
51
|
-
id: string;
|
|
52
|
-
label?: string;
|
|
53
|
-
helpText?: string;
|
|
54
|
-
children: FormNode[];
|
|
55
|
-
}
|
|
56
|
-
export interface GroupListNode {
|
|
57
|
-
kind: 'groupList';
|
|
58
|
-
id: string;
|
|
59
|
-
label: string;
|
|
60
|
-
helpText?: string;
|
|
61
|
-
/** Each row is an instance of this group template. */
|
|
62
|
-
item: GroupNode;
|
|
63
|
-
min?: number;
|
|
64
|
-
max?: number;
|
|
65
|
-
/** Verb-noun label for the add-row button (e.g., "Add attendee"). */
|
|
66
|
-
addLabel?: string;
|
|
67
|
-
}
|
|
68
|
-
export type FormNode = LeafNode | GroupNode | ListNode | GroupListNode;
|
|
69
|
-
export type AnswerValue = string | number | boolean | AnswerValue[] | {
|
|
70
|
-
[k: string]: AnswerValue;
|
|
71
|
-
};
|
|
72
|
-
export type AnswersMap = Record<string, AnswerValue>;
|
|
73
|
-
export interface AskUserInput {
|
|
74
|
-
message?: string;
|
|
75
|
-
form: FormNode[];
|
|
76
|
-
/** Legacy v1 shape, ignored when `form` is present. */
|
|
77
|
-
questions?: unknown;
|
|
78
|
-
}
|
|
79
|
-
export interface AskUserOutput {
|
|
80
|
-
form: FormNode[];
|
|
81
|
-
answers: AnswersMap;
|
|
82
|
-
message?: string;
|
|
83
|
-
}
|
|
84
|
-
export type AskUserFormStatus = 'pending' | 'active' | 'submitted' | 'declined';
|
|
85
|
-
export interface AskUserFormProps {
|
|
86
|
-
/** undefined while tool input is still streaming. */
|
|
87
|
-
input?: AskUserInput;
|
|
88
|
-
/** present once the user submitted (state output-available). */
|
|
89
|
-
output?: AskUserOutput;
|
|
90
|
-
status: AskUserFormStatus;
|
|
91
|
-
/** error text from output-error state. */
|
|
92
|
-
errorText?: string;
|
|
93
|
-
onSubmit?: (answers: AnswersMap) => void;
|
|
94
|
-
onDecline?: () => void;
|
|
95
|
-
}
|
|
96
|
-
export declare const AskUserForm: FC<AskUserFormProps>;
|