@smartspace/chat-ui 1.13.1-pr.275.7af79b8 → 1.14.0-main.5f4f2ef
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 +14 -138
- 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 React8 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 = React8.forwardRef(
|
|
1691
1691
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1692
1692
|
const Comp = asChild ? Slot : "button";
|
|
1693
1693
|
return /* @__PURE__ */ jsx(
|
|
@@ -2902,128 +2902,6 @@ 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(
|
|
2944
|
-
"div",
|
|
2945
|
-
{
|
|
2946
|
-
className: "ss-jsonforms-field ss-jsonforms-number",
|
|
2947
|
-
style: {
|
|
2948
|
-
display: "inline-flex",
|
|
2949
|
-
flexDirection: "row",
|
|
2950
|
-
alignItems: "center",
|
|
2951
|
-
gap: 8,
|
|
2952
|
-
minHeight: "40px"
|
|
2953
|
-
},
|
|
2954
|
-
children: [
|
|
2955
|
-
label && /* @__PURE__ */ jsxs(
|
|
2956
|
-
"label",
|
|
2957
|
-
{
|
|
2958
|
-
htmlFor: `number-${path2}`,
|
|
2959
|
-
style: {
|
|
2960
|
-
color: hasError ? "#ef4444" : "#475569",
|
|
2961
|
-
fontSize: "0.875rem",
|
|
2962
|
-
fontWeight: 500,
|
|
2963
|
-
whiteSpace: "nowrap",
|
|
2964
|
-
lineHeight: "24px"
|
|
2965
|
-
},
|
|
2966
|
-
children: [
|
|
2967
|
-
label,
|
|
2968
|
-
required && /* @__PURE__ */ jsx("span", { style: { color: "#ef4444", marginLeft: "0.25rem" }, children: "*" })
|
|
2969
|
-
]
|
|
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: "80px",
|
|
2985
|
-
height: "24px",
|
|
2986
|
-
padding: "0 0.5rem",
|
|
2987
|
-
border: hasError ? "2px solid #ef4444" : "1px solid #d1d5db",
|
|
2988
|
-
borderRadius: "6px",
|
|
2989
|
-
fontSize: "0.875rem",
|
|
2990
|
-
lineHeight: "24px",
|
|
2991
|
-
fontFamily: "inherit",
|
|
2992
|
-
backgroundColor: isDisabled ? "#f9fafb" : "#ffffff",
|
|
2993
|
-
color: isDisabled ? "#9ca3af" : "#111827",
|
|
2994
|
-
outline: "none",
|
|
2995
|
-
boxSizing: "border-box"
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
),
|
|
2999
|
-
hasError && /* @__PURE__ */ jsx(
|
|
3000
|
-
"div",
|
|
3001
|
-
{
|
|
3002
|
-
style: {
|
|
3003
|
-
color: "#ef4444",
|
|
3004
|
-
fontSize: "0.75rem"
|
|
3005
|
-
},
|
|
3006
|
-
children: errors
|
|
3007
|
-
}
|
|
3008
|
-
)
|
|
3009
|
-
]
|
|
3010
|
-
}
|
|
3011
|
-
);
|
|
3012
|
-
};
|
|
3013
|
-
var numberRendererTester = rankWith(
|
|
3014
|
-
40,
|
|
3015
|
-
(uischema, schema) => {
|
|
3016
|
-
if (uischema.type !== "Control") return false;
|
|
3017
|
-
const propertyPath = uischema.scope.replace(
|
|
3018
|
-
"#/properties/",
|
|
3019
|
-
""
|
|
3020
|
-
);
|
|
3021
|
-
const fieldSchema = schema?.properties?.[propertyPath];
|
|
3022
|
-
if (!fieldSchema) return false;
|
|
3023
|
-
return fieldSchema.type === "integer" || fieldSchema.type === "number";
|
|
3024
|
-
}
|
|
3025
|
-
);
|
|
3026
|
-
var NumberRendererControl = withJsonFormsControlProps(NumberRenderer);
|
|
3027
2905
|
var TextareaRenderer = ({
|
|
3028
2906
|
data,
|
|
3029
2907
|
handleChange,
|
|
@@ -3193,7 +3071,6 @@ var renderers = [
|
|
|
3193
3071
|
{ tester: modelIdRendererTester, renderer: ModelIdRendererControl },
|
|
3194
3072
|
{ tester: booleanRendererTester, renderer: BooleanRendererControl },
|
|
3195
3073
|
{ tester: dropdownRendererTester, renderer: DropdownRendererControl },
|
|
3196
|
-
{ tester: numberRendererTester, renderer: NumberRendererControl },
|
|
3197
3074
|
{ tester: textareaRendererTester, renderer: TextareaRendererControl },
|
|
3198
3075
|
...vanillaRenderers,
|
|
3199
3076
|
{ tester: jsonEditorTester, renderer: JsonEditorRendererControl }
|
|
@@ -3247,26 +3124,26 @@ function useChatVariablesFormVm({
|
|
|
3247
3124
|
const { mutate: updateVariableMutation } = useUpdateFlowRunVariable();
|
|
3248
3125
|
const querySettled = !isLoading && (threadVars !== void 0 || isError);
|
|
3249
3126
|
const shouldUseDefaults = isError || threadVars && Object.keys(threadVars).length === 0;
|
|
3250
|
-
const built =
|
|
3127
|
+
const built = React8.useMemo(() => {
|
|
3251
3128
|
return buildSimpleSchemaAndUi(
|
|
3252
3129
|
workspace.variables,
|
|
3253
3130
|
threadVars,
|
|
3254
3131
|
shouldUseDefaults ?? false
|
|
3255
3132
|
);
|
|
3256
3133
|
}, [workspace.variables, threadVars, shouldUseDefaults]);
|
|
3257
|
-
const [data, setData] =
|
|
3258
|
-
|
|
3134
|
+
const [data, setData] = React8.useState(null);
|
|
3135
|
+
React8.useEffect(() => {
|
|
3259
3136
|
if (querySettled) {
|
|
3260
3137
|
setData(built.initialData);
|
|
3261
3138
|
setVariables(built.initialData);
|
|
3262
3139
|
}
|
|
3263
3140
|
}, [querySettled, built.initialData, setVariables]);
|
|
3264
|
-
const ajv =
|
|
3265
|
-
const prevRef =
|
|
3266
|
-
|
|
3141
|
+
const ajv = React8.useMemo(() => createAjv({ useDefaults: false }), []);
|
|
3142
|
+
const prevRef = React8.useRef(null);
|
|
3143
|
+
React8.useEffect(() => {
|
|
3267
3144
|
prevRef.current = data;
|
|
3268
3145
|
}, [data]);
|
|
3269
|
-
const onChange =
|
|
3146
|
+
const onChange = React8.useCallback(
|
|
3270
3147
|
({ data: next2 }) => {
|
|
3271
3148
|
if (prevRef.current && !isDraftThreadId(threadId)) {
|
|
3272
3149
|
const keys2 = Object.keys(workspace.variables || {});
|
|
@@ -3287,7 +3164,7 @@ function useChatVariablesFormVm({
|
|
|
3287
3164
|
},
|
|
3288
3165
|
[workspace.variables, setVariables, updateVariableMutation, threadId]
|
|
3289
3166
|
);
|
|
3290
|
-
const config =
|
|
3167
|
+
const config = React8.useMemo(
|
|
3291
3168
|
() => ({
|
|
3292
3169
|
restrict: true,
|
|
3293
3170
|
trim: false,
|
|
@@ -19200,7 +19077,7 @@ function getAvatarColour(name) {
|
|
|
19200
19077
|
const textColor = brightness > 128 ? "#000000" : "#FFFFFF";
|
|
19201
19078
|
return { backgroundColor, textColor };
|
|
19202
19079
|
}
|
|
19203
|
-
var Avatar =
|
|
19080
|
+
var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
19204
19081
|
"div",
|
|
19205
19082
|
{
|
|
19206
19083
|
ref,
|
|
@@ -19212,7 +19089,7 @@ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
19212
19089
|
}
|
|
19213
19090
|
));
|
|
19214
19091
|
Avatar.displayName = "Avatar";
|
|
19215
|
-
var AvatarImage =
|
|
19092
|
+
var AvatarImage = React8.forwardRef(({ className, alt, src, children: children2, ...props }, _ref) => /* @__PURE__ */ jsx(
|
|
19216
19093
|
MuiAvatar,
|
|
19217
19094
|
{
|
|
19218
19095
|
className: cn("aspect-square h-full w-full", className),
|
|
@@ -19223,7 +19100,7 @@ var AvatarImage = React9.forwardRef(({ className, alt, src, children: children2,
|
|
|
19223
19100
|
}
|
|
19224
19101
|
));
|
|
19225
19102
|
AvatarImage.displayName = "AvatarImage";
|
|
19226
|
-
var AvatarFallback =
|
|
19103
|
+
var AvatarFallback = React8.forwardRef(
|
|
19227
19104
|
({ className, colored = true, ...props }, ref) => {
|
|
19228
19105
|
const childText = String(props.children ?? "");
|
|
19229
19106
|
const colours = colored ? getAvatarColour(childText) : void 0;
|
|
@@ -19813,8 +19690,7 @@ var MessageItem = ({
|
|
|
19813
19690
|
groupType = v.type;
|
|
19814
19691
|
const name = v.name.toLowerCase();
|
|
19815
19692
|
switch (name) {
|
|
19816
|
-
case "variables":
|
|
19817
|
-
case "userinfo": {
|
|
19693
|
+
case "variables": {
|
|
19818
19694
|
continue;
|
|
19819
19695
|
}
|
|
19820
19696
|
case "status": {
|