@smartspace/chat-ui 1.13.1-pr.275.3534c03 → 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 -150
- 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,140 +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("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);
|
|
3039
2905
|
var TextareaRenderer = ({
|
|
3040
2906
|
data,
|
|
3041
2907
|
handleChange,
|
|
@@ -3205,7 +3071,6 @@ var renderers = [
|
|
|
3205
3071
|
{ tester: modelIdRendererTester, renderer: ModelIdRendererControl },
|
|
3206
3072
|
{ tester: booleanRendererTester, renderer: BooleanRendererControl },
|
|
3207
3073
|
{ tester: dropdownRendererTester, renderer: DropdownRendererControl },
|
|
3208
|
-
{ tester: numberRendererTester, renderer: NumberRendererControl },
|
|
3209
3074
|
{ tester: textareaRendererTester, renderer: TextareaRendererControl },
|
|
3210
3075
|
...vanillaRenderers,
|
|
3211
3076
|
{ tester: jsonEditorTester, renderer: JsonEditorRendererControl }
|
|
@@ -3259,26 +3124,26 @@ function useChatVariablesFormVm({
|
|
|
3259
3124
|
const { mutate: updateVariableMutation } = useUpdateFlowRunVariable();
|
|
3260
3125
|
const querySettled = !isLoading && (threadVars !== void 0 || isError);
|
|
3261
3126
|
const shouldUseDefaults = isError || threadVars && Object.keys(threadVars).length === 0;
|
|
3262
|
-
const built =
|
|
3127
|
+
const built = React8.useMemo(() => {
|
|
3263
3128
|
return buildSimpleSchemaAndUi(
|
|
3264
3129
|
workspace.variables,
|
|
3265
3130
|
threadVars,
|
|
3266
3131
|
shouldUseDefaults ?? false
|
|
3267
3132
|
);
|
|
3268
3133
|
}, [workspace.variables, threadVars, shouldUseDefaults]);
|
|
3269
|
-
const [data, setData] =
|
|
3270
|
-
|
|
3134
|
+
const [data, setData] = React8.useState(null);
|
|
3135
|
+
React8.useEffect(() => {
|
|
3271
3136
|
if (querySettled) {
|
|
3272
3137
|
setData(built.initialData);
|
|
3273
3138
|
setVariables(built.initialData);
|
|
3274
3139
|
}
|
|
3275
3140
|
}, [querySettled, built.initialData, setVariables]);
|
|
3276
|
-
const ajv =
|
|
3277
|
-
const prevRef =
|
|
3278
|
-
|
|
3141
|
+
const ajv = React8.useMemo(() => createAjv({ useDefaults: false }), []);
|
|
3142
|
+
const prevRef = React8.useRef(null);
|
|
3143
|
+
React8.useEffect(() => {
|
|
3279
3144
|
prevRef.current = data;
|
|
3280
3145
|
}, [data]);
|
|
3281
|
-
const onChange =
|
|
3146
|
+
const onChange = React8.useCallback(
|
|
3282
3147
|
({ data: next2 }) => {
|
|
3283
3148
|
if (prevRef.current && !isDraftThreadId(threadId)) {
|
|
3284
3149
|
const keys2 = Object.keys(workspace.variables || {});
|
|
@@ -3299,7 +3164,7 @@ function useChatVariablesFormVm({
|
|
|
3299
3164
|
},
|
|
3300
3165
|
[workspace.variables, setVariables, updateVariableMutation, threadId]
|
|
3301
3166
|
);
|
|
3302
|
-
const config =
|
|
3167
|
+
const config = React8.useMemo(
|
|
3303
3168
|
() => ({
|
|
3304
3169
|
restrict: true,
|
|
3305
3170
|
trim: false,
|
|
@@ -19212,7 +19077,7 @@ function getAvatarColour(name) {
|
|
|
19212
19077
|
const textColor = brightness > 128 ? "#000000" : "#FFFFFF";
|
|
19213
19078
|
return { backgroundColor, textColor };
|
|
19214
19079
|
}
|
|
19215
|
-
var Avatar =
|
|
19080
|
+
var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
19216
19081
|
"div",
|
|
19217
19082
|
{
|
|
19218
19083
|
ref,
|
|
@@ -19224,7 +19089,7 @@ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
19224
19089
|
}
|
|
19225
19090
|
));
|
|
19226
19091
|
Avatar.displayName = "Avatar";
|
|
19227
|
-
var AvatarImage =
|
|
19092
|
+
var AvatarImage = React8.forwardRef(({ className, alt, src, children: children2, ...props }, _ref) => /* @__PURE__ */ jsx(
|
|
19228
19093
|
MuiAvatar,
|
|
19229
19094
|
{
|
|
19230
19095
|
className: cn("aspect-square h-full w-full", className),
|
|
@@ -19235,7 +19100,7 @@ var AvatarImage = React9.forwardRef(({ className, alt, src, children: children2,
|
|
|
19235
19100
|
}
|
|
19236
19101
|
));
|
|
19237
19102
|
AvatarImage.displayName = "AvatarImage";
|
|
19238
|
-
var AvatarFallback =
|
|
19103
|
+
var AvatarFallback = React8.forwardRef(
|
|
19239
19104
|
({ className, colored = true, ...props }, ref) => {
|
|
19240
19105
|
const childText = String(props.children ?? "");
|
|
19241
19106
|
const colours = colored ? getAvatarColour(childText) : void 0;
|
|
@@ -19825,8 +19690,7 @@ var MessageItem = ({
|
|
|
19825
19690
|
groupType = v.type;
|
|
19826
19691
|
const name = v.name.toLowerCase();
|
|
19827
19692
|
switch (name) {
|
|
19828
|
-
case "variables":
|
|
19829
|
-
case "userinfo": {
|
|
19693
|
+
case "variables": {
|
|
19830
19694
|
continue;
|
|
19831
19695
|
}
|
|
19832
19696
|
case "status": {
|