@smartspace/chat-ui 1.13.1-pr.260.c7ba243 → 1.13.1-pr.275.3534c03
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.js +150 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MuiButton from '@mui/material/Button';
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import { Loader2, Check, X, Paperclip, ArrowBigUp, Minimize2, AlertTriangle, FileImage, FileVideo, FileAudio, FileArchive, FileCode, FileSpreadsheet, Presentation, FileText, ChevronUp, ExternalLink, Copy, Download } from 'lucide-react';
|
|
4
|
-
import * as
|
|
4
|
+
import * as React9 from 'react';
|
|
5
5
|
import { createContext, forwardRef, useImperativeHandle, useRef, useState, useEffect, useMemo, useCallback, createElement, useContext } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { useQuery, queryOptions, useQueryClient, useMutation, skipToken } from '@tanstack/react-query';
|
|
@@ -1687,7 +1687,7 @@ var buttonVariants = cva(
|
|
|
1687
1687
|
}
|
|
1688
1688
|
}
|
|
1689
1689
|
);
|
|
1690
|
-
var Button =
|
|
1690
|
+
var Button = React9.forwardRef(
|
|
1691
1691
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1692
1692
|
const Comp = asChild ? Slot : "button";
|
|
1693
1693
|
return /* @__PURE__ */ jsx(
|
|
@@ -2902,6 +2902,140 @@ var modelIdRendererTester = rankWith(
|
|
|
2902
2902
|
}
|
|
2903
2903
|
);
|
|
2904
2904
|
var ModelIdRendererControl = withJsonFormsControlProps(ModelIdRenderer);
|
|
2905
|
+
var NumberRenderer = ({
|
|
2906
|
+
data,
|
|
2907
|
+
handleChange,
|
|
2908
|
+
path: path2,
|
|
2909
|
+
label,
|
|
2910
|
+
description,
|
|
2911
|
+
errors,
|
|
2912
|
+
schema,
|
|
2913
|
+
uischema,
|
|
2914
|
+
visible,
|
|
2915
|
+
enabled,
|
|
2916
|
+
required
|
|
2917
|
+
}) => {
|
|
2918
|
+
const isInteger = schema?.type === "integer";
|
|
2919
|
+
const handleInputChange = useCallback(
|
|
2920
|
+
(event) => {
|
|
2921
|
+
const raw2 = event.target.value;
|
|
2922
|
+
if (raw2 === "") {
|
|
2923
|
+
handleChange(path2, void 0);
|
|
2924
|
+
return;
|
|
2925
|
+
}
|
|
2926
|
+
const parsed = isInteger ? parseInt(raw2, 10) : parseFloat(raw2);
|
|
2927
|
+
if (Number.isNaN(parsed)) {
|
|
2928
|
+
handleChange(path2, void 0);
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
handleChange(path2, parsed);
|
|
2932
|
+
},
|
|
2933
|
+
[handleChange, path2, isInteger]
|
|
2934
|
+
);
|
|
2935
|
+
if (!visible) return null;
|
|
2936
|
+
const readOnly = uischema?.access === "Read";
|
|
2937
|
+
const isDisabled = !enabled || readOnly;
|
|
2938
|
+
const hasError = !!errors && errors.length > 0;
|
|
2939
|
+
const fieldSchema = schema;
|
|
2940
|
+
const min = fieldSchema?.minimum;
|
|
2941
|
+
const max = fieldSchema?.maximum;
|
|
2942
|
+
const step = isInteger ? 1 : fieldSchema?.multipleOf ?? "any";
|
|
2943
|
+
return /* @__PURE__ */ jsxs("div", { className: "ss-jsonforms-field ss-jsonforms-number compact-field", children: [
|
|
2944
|
+
label && /* @__PURE__ */ jsxs(
|
|
2945
|
+
"label",
|
|
2946
|
+
{
|
|
2947
|
+
htmlFor: `number-${path2}`,
|
|
2948
|
+
style: {
|
|
2949
|
+
display: "block",
|
|
2950
|
+
color: hasError ? "#ef4444" : "#475569",
|
|
2951
|
+
fontSize: "0.875rem",
|
|
2952
|
+
fontWeight: 500,
|
|
2953
|
+
marginBottom: "0.375rem"
|
|
2954
|
+
},
|
|
2955
|
+
children: [
|
|
2956
|
+
label,
|
|
2957
|
+
required && /* @__PURE__ */ jsx("span", { style: { color: "#ef4444", marginLeft: "0.25rem" }, children: "*" })
|
|
2958
|
+
]
|
|
2959
|
+
}
|
|
2960
|
+
),
|
|
2961
|
+
description && /* @__PURE__ */ jsx(
|
|
2962
|
+
"div",
|
|
2963
|
+
{
|
|
2964
|
+
style: {
|
|
2965
|
+
color: "#6b7280",
|
|
2966
|
+
fontSize: "0.75rem",
|
|
2967
|
+
marginBottom: "0.5rem"
|
|
2968
|
+
},
|
|
2969
|
+
children: description
|
|
2970
|
+
}
|
|
2971
|
+
),
|
|
2972
|
+
/* @__PURE__ */ jsx(
|
|
2973
|
+
"input",
|
|
2974
|
+
{
|
|
2975
|
+
id: `number-${path2}`,
|
|
2976
|
+
type: "number",
|
|
2977
|
+
value: data ?? "",
|
|
2978
|
+
onChange: handleInputChange,
|
|
2979
|
+
disabled: isDisabled,
|
|
2980
|
+
min,
|
|
2981
|
+
max,
|
|
2982
|
+
step,
|
|
2983
|
+
style: {
|
|
2984
|
+
width: "100%",
|
|
2985
|
+
padding: "0.5rem 0.75rem",
|
|
2986
|
+
border: hasError ? "2px solid #ef4444" : "1px solid #d1d5db",
|
|
2987
|
+
borderRadius: "6px",
|
|
2988
|
+
fontSize: "0.875rem",
|
|
2989
|
+
lineHeight: "1.5",
|
|
2990
|
+
fontFamily: "inherit",
|
|
2991
|
+
backgroundColor: isDisabled ? "#f9fafb" : "#ffffff",
|
|
2992
|
+
color: isDisabled ? "#9ca3af" : "#111827",
|
|
2993
|
+
outline: "none",
|
|
2994
|
+
boxSizing: "border-box",
|
|
2995
|
+
transition: "border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out",
|
|
2996
|
+
boxShadow: hasError ? "0 0 0 1px #ef4444" : "none"
|
|
2997
|
+
},
|
|
2998
|
+
onFocus: (e) => {
|
|
2999
|
+
if (!hasError) {
|
|
3000
|
+
e.target.style.borderColor = "#6366f1";
|
|
3001
|
+
e.target.style.boxShadow = "0 0 0 1px #6366f1";
|
|
3002
|
+
}
|
|
3003
|
+
},
|
|
3004
|
+
onBlur: (e) => {
|
|
3005
|
+
if (!hasError) {
|
|
3006
|
+
e.target.style.borderColor = "#d1d5db";
|
|
3007
|
+
e.target.style.boxShadow = "none";
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
),
|
|
3012
|
+
hasError && /* @__PURE__ */ jsx(
|
|
3013
|
+
"div",
|
|
3014
|
+
{
|
|
3015
|
+
style: {
|
|
3016
|
+
color: "#ef4444",
|
|
3017
|
+
fontSize: "0.75rem",
|
|
3018
|
+
marginTop: "0.25rem"
|
|
3019
|
+
},
|
|
3020
|
+
children: errors
|
|
3021
|
+
}
|
|
3022
|
+
)
|
|
3023
|
+
] });
|
|
3024
|
+
};
|
|
3025
|
+
var numberRendererTester = rankWith(
|
|
3026
|
+
40,
|
|
3027
|
+
(uischema, schema) => {
|
|
3028
|
+
if (uischema.type !== "Control") return false;
|
|
3029
|
+
const propertyPath = uischema.scope.replace(
|
|
3030
|
+
"#/properties/",
|
|
3031
|
+
""
|
|
3032
|
+
);
|
|
3033
|
+
const fieldSchema = schema?.properties?.[propertyPath];
|
|
3034
|
+
if (!fieldSchema) return false;
|
|
3035
|
+
return fieldSchema.type === "integer" || fieldSchema.type === "number";
|
|
3036
|
+
}
|
|
3037
|
+
);
|
|
3038
|
+
var NumberRendererControl = withJsonFormsControlProps(NumberRenderer);
|
|
2905
3039
|
var TextareaRenderer = ({
|
|
2906
3040
|
data,
|
|
2907
3041
|
handleChange,
|
|
@@ -3071,6 +3205,7 @@ var renderers = [
|
|
|
3071
3205
|
{ tester: modelIdRendererTester, renderer: ModelIdRendererControl },
|
|
3072
3206
|
{ tester: booleanRendererTester, renderer: BooleanRendererControl },
|
|
3073
3207
|
{ tester: dropdownRendererTester, renderer: DropdownRendererControl },
|
|
3208
|
+
{ tester: numberRendererTester, renderer: NumberRendererControl },
|
|
3074
3209
|
{ tester: textareaRendererTester, renderer: TextareaRendererControl },
|
|
3075
3210
|
...vanillaRenderers,
|
|
3076
3211
|
{ tester: jsonEditorTester, renderer: JsonEditorRendererControl }
|
|
@@ -3124,26 +3259,26 @@ function useChatVariablesFormVm({
|
|
|
3124
3259
|
const { mutate: updateVariableMutation } = useUpdateFlowRunVariable();
|
|
3125
3260
|
const querySettled = !isLoading && (threadVars !== void 0 || isError);
|
|
3126
3261
|
const shouldUseDefaults = isError || threadVars && Object.keys(threadVars).length === 0;
|
|
3127
|
-
const built =
|
|
3262
|
+
const built = React9.useMemo(() => {
|
|
3128
3263
|
return buildSimpleSchemaAndUi(
|
|
3129
3264
|
workspace.variables,
|
|
3130
3265
|
threadVars,
|
|
3131
3266
|
shouldUseDefaults ?? false
|
|
3132
3267
|
);
|
|
3133
3268
|
}, [workspace.variables, threadVars, shouldUseDefaults]);
|
|
3134
|
-
const [data, setData] =
|
|
3135
|
-
|
|
3269
|
+
const [data, setData] = React9.useState(null);
|
|
3270
|
+
React9.useEffect(() => {
|
|
3136
3271
|
if (querySettled) {
|
|
3137
3272
|
setData(built.initialData);
|
|
3138
3273
|
setVariables(built.initialData);
|
|
3139
3274
|
}
|
|
3140
3275
|
}, [querySettled, built.initialData, setVariables]);
|
|
3141
|
-
const ajv =
|
|
3142
|
-
const prevRef =
|
|
3143
|
-
|
|
3276
|
+
const ajv = React9.useMemo(() => createAjv({ useDefaults: false }), []);
|
|
3277
|
+
const prevRef = React9.useRef(null);
|
|
3278
|
+
React9.useEffect(() => {
|
|
3144
3279
|
prevRef.current = data;
|
|
3145
3280
|
}, [data]);
|
|
3146
|
-
const onChange =
|
|
3281
|
+
const onChange = React9.useCallback(
|
|
3147
3282
|
({ data: next2 }) => {
|
|
3148
3283
|
if (prevRef.current && !isDraftThreadId(threadId)) {
|
|
3149
3284
|
const keys2 = Object.keys(workspace.variables || {});
|
|
@@ -3164,7 +3299,7 @@ function useChatVariablesFormVm({
|
|
|
3164
3299
|
},
|
|
3165
3300
|
[workspace.variables, setVariables, updateVariableMutation, threadId]
|
|
3166
3301
|
);
|
|
3167
|
-
const config =
|
|
3302
|
+
const config = React9.useMemo(
|
|
3168
3303
|
() => ({
|
|
3169
3304
|
restrict: true,
|
|
3170
3305
|
trim: false,
|
|
@@ -19077,7 +19212,7 @@ function getAvatarColour(name) {
|
|
|
19077
19212
|
const textColor = brightness > 128 ? "#000000" : "#FFFFFF";
|
|
19078
19213
|
return { backgroundColor, textColor };
|
|
19079
19214
|
}
|
|
19080
|
-
var Avatar =
|
|
19215
|
+
var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
19081
19216
|
"div",
|
|
19082
19217
|
{
|
|
19083
19218
|
ref,
|
|
@@ -19089,7 +19224,7 @@ var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
19089
19224
|
}
|
|
19090
19225
|
));
|
|
19091
19226
|
Avatar.displayName = "Avatar";
|
|
19092
|
-
var AvatarImage =
|
|
19227
|
+
var AvatarImage = React9.forwardRef(({ className, alt, src, children: children2, ...props }, _ref) => /* @__PURE__ */ jsx(
|
|
19093
19228
|
MuiAvatar,
|
|
19094
19229
|
{
|
|
19095
19230
|
className: cn("aspect-square h-full w-full", className),
|
|
@@ -19100,7 +19235,7 @@ var AvatarImage = React8.forwardRef(({ className, alt, src, children: children2,
|
|
|
19100
19235
|
}
|
|
19101
19236
|
));
|
|
19102
19237
|
AvatarImage.displayName = "AvatarImage";
|
|
19103
|
-
var AvatarFallback =
|
|
19238
|
+
var AvatarFallback = React9.forwardRef(
|
|
19104
19239
|
({ className, colored = true, ...props }, ref) => {
|
|
19105
19240
|
const childText = String(props.children ?? "");
|
|
19106
19241
|
const colours = colored ? getAvatarColour(childText) : void 0;
|
|
@@ -19690,7 +19825,8 @@ var MessageItem = ({
|
|
|
19690
19825
|
groupType = v.type;
|
|
19691
19826
|
const name = v.name.toLowerCase();
|
|
19692
19827
|
switch (name) {
|
|
19693
|
-
case "variables":
|
|
19828
|
+
case "variables":
|
|
19829
|
+
case "userinfo": {
|
|
19694
19830
|
continue;
|
|
19695
19831
|
}
|
|
19696
19832
|
case "status": {
|