@uipath/apollo-wind 2.75.0 → 2.76.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.
- package/dist/components/forms/field-actions.cjs +53 -12
- package/dist/components/forms/field-actions.d.ts +47 -10
- package/dist/components/forms/field-actions.js +50 -12
- package/dist/components/forms/index.cjs +4 -0
- package/dist/components/forms/index.d.ts +2 -1
- package/dist/components/forms/index.js +2 -1
- package/dist/components/forms/metadata-form.cjs +1 -0
- package/dist/components/forms/metadata-form.js +1 -0
- package/dist/components/forms/variable-mode-control.cjs +65 -0
- package/dist/components/forms/variable-mode-control.d.ts +20 -0
- package/dist/components/forms/variable-mode-control.js +31 -0
- package/dist/components/ui/field-actions/ai-assist-action.cjs +57 -47
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +14 -2
- package/dist/components/ui/field-actions/ai-assist-action.js +59 -49
- package/dist/components/ui/field-actions/index.d.ts +1 -1
- package/dist/components/ui/field-actions/insert-variable-action.cjs +5 -3
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +20 -10
- package/dist/components/ui/field-actions/insert-variable-action.js +5 -3
- package/dist/components/ui/form-field.cjs +3 -2
- package/dist/components/ui/form-field.d.ts +11 -3
- package/dist/components/ui/form-field.js +3 -2
- package/dist/components/ui/index.cjs +16 -16
- package/dist/components/ui/json-tree-view/RowActions.cjs +1 -1
- package/dist/components/ui/json-tree-view/RowActions.js +1 -1
- package/dist/components/ui/panel-tabs.cjs +1 -0
- package/dist/components/ui/panel-tabs.d.ts +5 -1
- package/dist/components/ui/panel-tabs.js +1 -0
- package/dist/components/ui/reference-chip.cjs +1 -1
- package/dist/components/ui/reference-chip.d.ts +1 -1
- package/dist/components/ui/reference-chip.js +1 -1
- package/dist/components/ui/variable-picker/index.d.ts +1 -1
- package/dist/components/ui/variable-picker/variable-picker.cjs +17 -3
- package/dist/components/ui/variable-picker/variable-picker.d.ts +24 -1
- package/dist/components/ui/variable-picker/variable-picker.js +14 -3
- package/dist/components/ui/variable-value-control.cjs +23 -7
- package/dist/components/ui/variable-value-control.d.ts +27 -5
- package/dist/components/ui/variable-value-control.js +23 -7
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +2 -1
- package/dist/styles.css +11 -12
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@ const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
|
|
|
44
44
|
generating: 'Generating',
|
|
45
45
|
error: 'Could not generate a value. Try again.'
|
|
46
46
|
};
|
|
47
|
-
function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
47
|
+
function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings }) {
|
|
48
48
|
const promptId = (0, external_react_namespaceObject.useId)();
|
|
49
49
|
const errorId = (0, external_react_namespaceObject.useId)();
|
|
50
50
|
const [prompt, setPrompt] = (0, external_react_namespaceObject.useState)('');
|
|
@@ -59,6 +59,7 @@ function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
|
59
59
|
setFailed(false);
|
|
60
60
|
setOpen(next);
|
|
61
61
|
};
|
|
62
|
+
const close = (0, external_react_namespaceObject.useCallback)(()=>setOpen(false), []);
|
|
62
63
|
const generate = async ()=>{
|
|
63
64
|
setFailed(false);
|
|
64
65
|
const result = onGenerate?.(prompt);
|
|
@@ -99,58 +100,67 @@ function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
|
99
100
|
})
|
|
100
101
|
]
|
|
101
102
|
}),
|
|
102
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
103
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
103
104
|
align: "end",
|
|
104
105
|
className: "space-y-3",
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
106
|
+
children: renderContent ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AiAssistSlot, {
|
|
107
|
+
render: renderContent,
|
|
108
|
+
close: close,
|
|
109
|
+
disabled: !!disabled
|
|
110
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
113
|
+
className: "space-y-1.5",
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.Label, {
|
|
116
|
+
htmlFor: promptId,
|
|
117
|
+
className: "text-xs font-medium text-foreground-muted",
|
|
118
|
+
children: text.prompt
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_textarea_cjs_namespaceObject.Textarea, {
|
|
121
|
+
id: promptId,
|
|
122
|
+
rows: 3,
|
|
123
|
+
value: prompt,
|
|
124
|
+
onChange: (e)=>setPrompt(e.target.value),
|
|
125
|
+
placeholder: text.promptPlaceholder,
|
|
126
|
+
"aria-describedby": failed ? errorId : void 0,
|
|
127
|
+
className: "resize-none text-sm"
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}),
|
|
131
|
+
hint && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
132
|
+
className: "block text-[11px] text-foreground-subtle",
|
|
133
|
+
children: hint
|
|
134
|
+
}),
|
|
135
|
+
failed && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
136
|
+
id: errorId,
|
|
137
|
+
role: "alert",
|
|
138
|
+
className: "text-xs text-error",
|
|
139
|
+
children: text.error
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
142
|
+
size: "sm",
|
|
143
|
+
className: "w-full",
|
|
144
|
+
disabled: !onGenerate || pending,
|
|
145
|
+
"aria-busy": pending || void 0,
|
|
146
|
+
onClick: ()=>generate(),
|
|
147
|
+
children: [
|
|
148
|
+
pending && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Loader2, {
|
|
149
|
+
className: "animate-spin",
|
|
150
|
+
"aria-hidden": "true"
|
|
151
|
+
}),
|
|
152
|
+
pending ? text.generating : text.generate
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
})
|
|
150
157
|
})
|
|
151
158
|
]
|
|
152
159
|
});
|
|
153
160
|
}
|
|
161
|
+
function AiAssistSlot({ render, ...props }) {
|
|
162
|
+
return render(props);
|
|
163
|
+
}
|
|
154
164
|
function isThenable(value) {
|
|
155
165
|
return ('object' == typeof value || 'function' == typeof value) && null !== value && 'function' == typeof value.then;
|
|
156
166
|
}
|
|
@@ -11,9 +11,16 @@ export interface AiAssistActionStrings {
|
|
|
11
11
|
error: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const DEFAULT_AI_ASSIST_ACTION_STRINGS: AiAssistActionStrings;
|
|
14
|
+
/** What a host-rendered AI-assist panel gets in place of the built-in prompt form. */
|
|
15
|
+
export interface AiAssistContentProps {
|
|
16
|
+
/** Closes the popover, returning focus to the trigger. */
|
|
17
|
+
close(): void;
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
}
|
|
14
20
|
export interface AiAssistActionProps {
|
|
15
21
|
/**
|
|
16
|
-
* Called with the entered prompt. Omitted, Generate is disabled
|
|
22
|
+
* Called with the entered prompt. Omitted, Generate is disabled; not called while
|
|
23
|
+
* `renderContent` is set. A returned promise keeps the
|
|
17
24
|
* prompt open and busy until it settles: it closes once the promise resolves and stays open,
|
|
18
25
|
* prompt intact and the error shown, if it rejects.
|
|
19
26
|
*/
|
|
@@ -21,10 +28,15 @@ export interface AiAssistActionProps {
|
|
|
21
28
|
disabled?: boolean;
|
|
22
29
|
/** A line under the prompt describing what will be generated, such as the value's type. */
|
|
23
30
|
hint?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* The host's own panel, rendered in the popover in place of the built-in prompt form, whose
|
|
33
|
+
* `hint` and prompt strings it then does not use. Called only while the popover is open.
|
|
34
|
+
*/
|
|
35
|
+
renderContent?: (props: AiAssistContentProps) => ReactNode;
|
|
24
36
|
/** Overrides for any subset of the English strings. */
|
|
25
37
|
strings?: Partial<AiAssistActionStrings>;
|
|
26
38
|
}
|
|
27
39
|
/**
|
|
28
40
|
* The AI-assist header action: a prompt in a popover. Requires an ancestor `TooltipProvider`.
|
|
29
41
|
*/
|
|
30
|
-
export declare function AiAssistAction({ onGenerate, hint, disabled, strings }: AiAssistActionProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings, }: AiAssistActionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Loader2, Sparkles } from "lucide-react";
|
|
3
|
-
import { useId, useState } from "react";
|
|
3
|
+
import { useCallback, useId, useState } from "react";
|
|
4
4
|
import { Button } from "../button.js";
|
|
5
5
|
import { Label } from "../label.js";
|
|
6
6
|
import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
|
|
@@ -15,7 +15,7 @@ const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
|
|
|
15
15
|
generating: 'Generating',
|
|
16
16
|
error: 'Could not generate a value. Try again.'
|
|
17
17
|
};
|
|
18
|
-
function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
18
|
+
function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings }) {
|
|
19
19
|
const promptId = useId();
|
|
20
20
|
const errorId = useId();
|
|
21
21
|
const [prompt, setPrompt] = useState('');
|
|
@@ -30,6 +30,7 @@ function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
|
30
30
|
setFailed(false);
|
|
31
31
|
setOpen(next);
|
|
32
32
|
};
|
|
33
|
+
const close = useCallback(()=>setOpen(false), []);
|
|
33
34
|
const generate = async ()=>{
|
|
34
35
|
setFailed(false);
|
|
35
36
|
const result = onGenerate?.(prompt);
|
|
@@ -70,58 +71,67 @@ function AiAssistAction({ onGenerate, hint, disabled, strings }) {
|
|
|
70
71
|
})
|
|
71
72
|
]
|
|
72
73
|
}),
|
|
73
|
-
/*#__PURE__*/
|
|
74
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
74
75
|
align: "end",
|
|
75
76
|
className: "space-y-3",
|
|
76
|
-
children:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
77
|
+
children: renderContent ? /*#__PURE__*/ jsx(AiAssistSlot, {
|
|
78
|
+
render: renderContent,
|
|
79
|
+
close: close,
|
|
80
|
+
disabled: !!disabled
|
|
81
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsxs("div", {
|
|
84
|
+
className: "space-y-1.5",
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ jsx(Label, {
|
|
87
|
+
htmlFor: promptId,
|
|
88
|
+
className: "text-xs font-medium text-foreground-muted",
|
|
89
|
+
children: text.prompt
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsx(Textarea, {
|
|
92
|
+
id: promptId,
|
|
93
|
+
rows: 3,
|
|
94
|
+
value: prompt,
|
|
95
|
+
onChange: (e)=>setPrompt(e.target.value),
|
|
96
|
+
placeholder: text.promptPlaceholder,
|
|
97
|
+
"aria-describedby": failed ? errorId : void 0,
|
|
98
|
+
className: "resize-none text-sm"
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
hint && /*#__PURE__*/ jsx("span", {
|
|
103
|
+
className: "block text-[11px] text-foreground-subtle",
|
|
104
|
+
children: hint
|
|
105
|
+
}),
|
|
106
|
+
failed && /*#__PURE__*/ jsx("p", {
|
|
107
|
+
id: errorId,
|
|
108
|
+
role: "alert",
|
|
109
|
+
className: "text-xs text-error",
|
|
110
|
+
children: text.error
|
|
111
|
+
}),
|
|
112
|
+
/*#__PURE__*/ jsxs(Button, {
|
|
113
|
+
size: "sm",
|
|
114
|
+
className: "w-full",
|
|
115
|
+
disabled: !onGenerate || pending,
|
|
116
|
+
"aria-busy": pending || void 0,
|
|
117
|
+
onClick: ()=>generate(),
|
|
118
|
+
children: [
|
|
119
|
+
pending && /*#__PURE__*/ jsx(Loader2, {
|
|
120
|
+
className: "animate-spin",
|
|
121
|
+
"aria-hidden": "true"
|
|
122
|
+
}),
|
|
123
|
+
pending ? text.generating : text.generate
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
121
128
|
})
|
|
122
129
|
]
|
|
123
130
|
});
|
|
124
131
|
}
|
|
132
|
+
function AiAssistSlot({ render, ...props }) {
|
|
133
|
+
return render(props);
|
|
134
|
+
}
|
|
125
135
|
function isThenable(value) {
|
|
126
136
|
return ('object' == typeof value || 'function' == typeof value) && null !== value && 'function' == typeof value.then;
|
|
127
137
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AiAssistAction, type AiAssistActionProps, type AiAssistActionStrings, DEFAULT_AI_ASSIST_ACTION_STRINGS, } from './ai-assist-action';
|
|
1
|
+
export { AiAssistAction, type AiAssistActionProps, type AiAssistActionStrings, type AiAssistContentProps, DEFAULT_AI_ASSIST_ACTION_STRINGS, } from './ai-assist-action';
|
|
2
2
|
export { DEFAULT_INSERT_VARIABLE_ACTION_STRINGS, InsertVariableAction, type InsertVariableActionProps, type InsertVariableActionStrings, } from './insert-variable-action';
|
|
@@ -33,6 +33,7 @@ const external_react_namespaceObject = require("react");
|
|
|
33
33
|
const index_cjs_namespaceObject = require("../variable-picker/index.cjs");
|
|
34
34
|
const external_lib_index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
35
35
|
const external_collapse_cjs_namespaceObject = require("./collapse.cjs");
|
|
36
|
+
const NO_VARIABLES = [];
|
|
36
37
|
const DEFAULT_INSERT_VARIABLE_ACTION_STRINGS = {
|
|
37
38
|
label: 'Insert',
|
|
38
39
|
ariaLabel: 'Insert variable',
|
|
@@ -42,13 +43,13 @@ const DEFAULT_INSERT_VARIABLE_ACTION_STRINGS = {
|
|
|
42
43
|
replaceDescription: 'The variable will replace the current value. This cannot be undone.',
|
|
43
44
|
replaceConfirm: 'Replace'
|
|
44
45
|
};
|
|
45
|
-
function InsertVariableAction({ variables, onInsert, disabled, compact, strings }) {
|
|
46
|
+
function InsertVariableAction({ variables = NO_VARIABLES, renderPicker, onInsert, disabled, compact, strings }) {
|
|
46
47
|
const text = {
|
|
47
48
|
...DEFAULT_INSERT_VARIABLE_ACTION_STRINGS,
|
|
48
49
|
...strings
|
|
49
50
|
};
|
|
50
51
|
const lazy = 'function' == typeof variables;
|
|
51
|
-
const inert = disabled || !onInsert || !lazy && 0 === variables.length;
|
|
52
|
+
const inert = disabled || !onInsert || !renderPicker && !lazy && 0 === variables.length;
|
|
52
53
|
const [openedItems, setOpenedItems] = (0, external_react_namespaceObject.useState)([]);
|
|
53
54
|
const collapsedTextClass = (0, external_lib_index_cjs_namespaceObject.cn)(external_collapse_cjs_namespaceObject.COLLAPSED_HIDDEN, compact && '!hidden');
|
|
54
55
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.VariablePicker, {
|
|
@@ -56,8 +57,9 @@ function InsertVariableAction({ variables, onInsert, disabled, compact, strings
|
|
|
56
57
|
items: lazy ? openedItems : variables,
|
|
57
58
|
placeholder: text.searchPlaceholder,
|
|
58
59
|
emptyText: text.empty,
|
|
60
|
+
renderPicker: renderPicker,
|
|
59
61
|
onOpenChange: (open)=>{
|
|
60
|
-
if (open && lazy) setOpenedItems(variables());
|
|
62
|
+
if (open && lazy && !renderPicker) setOpenedItems(variables());
|
|
61
63
|
},
|
|
62
64
|
onSelect: (variable)=>{
|
|
63
65
|
if (variable.value) onInsert?.(variable.value, variable);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariablePickerItem } from '../variable-picker';
|
|
1
|
+
import { type RenderVariablePicker, type VariablePickerItem } from '../variable-picker';
|
|
2
2
|
export interface InsertVariableActionStrings {
|
|
3
3
|
/** Visible text, hidden when the action collapses to its icon. */
|
|
4
4
|
label: string;
|
|
@@ -14,16 +14,11 @@ export interface InsertVariableActionStrings {
|
|
|
14
14
|
replaceConfirm: string;
|
|
15
15
|
}
|
|
16
16
|
export declare const DEFAULT_INSERT_VARIABLE_ACTION_STRINGS: InsertVariableActionStrings;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The variables to offer, rendered as supplied: the picker adds no root and no types. A function
|
|
20
|
-
* is called each time the picker opens, never during render, so a host can hand over a live
|
|
21
|
-
* source without re-rendering the field whenever it changes.
|
|
22
|
-
*/
|
|
23
|
-
variables: VariablePickerItem[] | (() => VariablePickerItem[]);
|
|
17
|
+
interface InsertVariableActionBaseProps {
|
|
24
18
|
/**
|
|
25
19
|
* Called with the picked variable's value, and the picked entry itself so a host can recover
|
|
26
|
-
* whatever it attached to it.
|
|
20
|
+
* whatever it attached to it. A host picker's pick gets an entry made from the value. Omitted,
|
|
21
|
+
* the action is disabled.
|
|
27
22
|
*/
|
|
28
23
|
onInsert?: (value: string, item: VariablePickerItem) => void;
|
|
29
24
|
disabled?: boolean;
|
|
@@ -32,5 +27,20 @@ export interface InsertVariableActionProps {
|
|
|
32
27
|
/** Overrides for any subset of the English strings. */
|
|
33
28
|
strings?: Partial<InsertVariableActionStrings>;
|
|
34
29
|
}
|
|
30
|
+
export type InsertVariableActionProps = InsertVariableActionBaseProps & ({
|
|
31
|
+
/**
|
|
32
|
+
* The variables to offer, rendered as supplied: the picker adds no root and no types. A
|
|
33
|
+
* function is called each time the picker opens, never during render, so a host can hand
|
|
34
|
+
* over a live source without re-rendering the field whenever it changes.
|
|
35
|
+
*/
|
|
36
|
+
variables: VariablePickerItem[] | (() => VariablePickerItem[]);
|
|
37
|
+
renderPicker?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
/** Ignored while `renderPicker` is set. */
|
|
40
|
+
variables?: VariablePickerItem[] | (() => VariablePickerItem[]);
|
|
41
|
+
/** The host's own picker, rendered in the popover in place of the built-in one. */
|
|
42
|
+
renderPicker: RenderVariablePicker;
|
|
43
|
+
});
|
|
35
44
|
/** The Insert-variable header action: opens a variable picker and reports the pick. */
|
|
36
|
-
export declare function InsertVariableAction({ variables, onInsert, disabled, compact, strings, }: InsertVariableActionProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare function InsertVariableAction({ variables, renderPicker, onInsert, disabled, compact, strings, }: InsertVariableActionProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { VariablePicker } from "../variable-picker/index.js";
|
|
5
5
|
import { cn } from "../../../lib/index.js";
|
|
6
6
|
import { COLLAPSED_HIDDEN, COLLAPSED_ICON_PADDING } from "./collapse.js";
|
|
7
|
+
const NO_VARIABLES = [];
|
|
7
8
|
const DEFAULT_INSERT_VARIABLE_ACTION_STRINGS = {
|
|
8
9
|
label: 'Insert',
|
|
9
10
|
ariaLabel: 'Insert variable',
|
|
@@ -13,13 +14,13 @@ const DEFAULT_INSERT_VARIABLE_ACTION_STRINGS = {
|
|
|
13
14
|
replaceDescription: 'The variable will replace the current value. This cannot be undone.',
|
|
14
15
|
replaceConfirm: 'Replace'
|
|
15
16
|
};
|
|
16
|
-
function InsertVariableAction({ variables, onInsert, disabled, compact, strings }) {
|
|
17
|
+
function InsertVariableAction({ variables = NO_VARIABLES, renderPicker, onInsert, disabled, compact, strings }) {
|
|
17
18
|
const text = {
|
|
18
19
|
...DEFAULT_INSERT_VARIABLE_ACTION_STRINGS,
|
|
19
20
|
...strings
|
|
20
21
|
};
|
|
21
22
|
const lazy = 'function' == typeof variables;
|
|
22
|
-
const inert = disabled || !onInsert || !lazy && 0 === variables.length;
|
|
23
|
+
const inert = disabled || !onInsert || !renderPicker && !lazy && 0 === variables.length;
|
|
23
24
|
const [openedItems, setOpenedItems] = useState([]);
|
|
24
25
|
const collapsedTextClass = cn(COLLAPSED_HIDDEN, compact && '!hidden');
|
|
25
26
|
return /*#__PURE__*/ jsx(VariablePicker, {
|
|
@@ -27,8 +28,9 @@ function InsertVariableAction({ variables, onInsert, disabled, compact, strings
|
|
|
27
28
|
items: lazy ? openedItems : variables,
|
|
28
29
|
placeholder: text.searchPlaceholder,
|
|
29
30
|
emptyText: text.empty,
|
|
31
|
+
renderPicker: renderPicker,
|
|
30
32
|
onOpenChange: (open)=>{
|
|
31
|
-
if (open && lazy) setOpenedItems(variables());
|
|
33
|
+
if (open && lazy && !renderPicker) setOpenedItems(variables());
|
|
32
34
|
},
|
|
33
35
|
onSelect: (variable)=>{
|
|
34
36
|
if (variable.value) onInsert?.(variable.value, variable);
|
|
@@ -80,13 +80,14 @@ const FormFieldDescription = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
FormFieldDescription.displayName = "FormFieldDescription";
|
|
83
|
-
const FormFieldError = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ children, className, ...props }, ref)=>{
|
|
83
|
+
const FormFieldError = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ children, className, severity = 'error', ...props }, ref)=>{
|
|
84
84
|
if (!children) return null;
|
|
85
85
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
86
86
|
ref: ref,
|
|
87
87
|
"aria-live": "polite",
|
|
88
88
|
"aria-atomic": "true",
|
|
89
|
-
|
|
89
|
+
"data-severity": 'warning' === severity ? severity : void 0,
|
|
90
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('text-xs leading-4', 'warning' === severity ? 'text-warning' : 'text-error', 'mt-1.5', className),
|
|
90
91
|
...props,
|
|
91
92
|
"data-slot": "form-field-error",
|
|
92
93
|
children: children
|
|
@@ -43,12 +43,20 @@ declare const FormFieldLabel: React.ForwardRefExoticComponent<FormFieldLabelProp
|
|
|
43
43
|
export type FormFieldDescriptionProps = React.ComponentPropsWithoutRef<'p'>;
|
|
44
44
|
/** Supporting guidance rendered below a field control. */
|
|
45
45
|
declare const FormFieldDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
46
|
-
export
|
|
46
|
+
export interface FormFieldErrorProps extends React.ComponentPropsWithoutRef<'p'> {
|
|
47
|
+
/**
|
|
48
|
+
* `warning` is for a value that is accepted but likely wrong, such as a reference that no longer
|
|
49
|
+
* resolves. Point the control's `aria-describedby` at a warning, not `aria-errormessage`, and
|
|
50
|
+
* leave it valid. Defaults to `error`.
|
|
51
|
+
*/
|
|
52
|
+
severity?: 'error' | 'warning';
|
|
53
|
+
}
|
|
47
54
|
/**
|
|
48
55
|
* Validation message rendered below a field control. Uses the `error` token
|
|
49
|
-
* rather than `destructive`, which some themes resolve to a different color
|
|
56
|
+
* rather than `destructive`, which some themes resolve to a different color,
|
|
57
|
+
* and the `warning` token for a warning.
|
|
50
58
|
*/
|
|
51
|
-
declare const FormFieldError: React.ForwardRefExoticComponent<
|
|
59
|
+
declare const FormFieldError: React.ForwardRefExoticComponent<FormFieldErrorProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
52
60
|
export interface FormFieldHeaderProps extends Pick<FormFieldLabelProps, 'htmlFor' | 'required' | 'tooltip' | 'tooltipAriaLabel'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
53
61
|
label?: React.ReactNode;
|
|
54
62
|
/** The label element's id, for a control that names itself with `aria-labelledby`. */
|
|
@@ -48,13 +48,14 @@ const FormFieldDescription = /*#__PURE__*/ forwardRef(({ children, className, ..
|
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
FormFieldDescription.displayName = "FormFieldDescription";
|
|
51
|
-
const FormFieldError = /*#__PURE__*/ forwardRef(({ children, className, ...props }, ref)=>{
|
|
51
|
+
const FormFieldError = /*#__PURE__*/ forwardRef(({ children, className, severity = 'error', ...props }, ref)=>{
|
|
52
52
|
if (!children) return null;
|
|
53
53
|
return /*#__PURE__*/ jsx("p", {
|
|
54
54
|
ref: ref,
|
|
55
55
|
"aria-live": "polite",
|
|
56
56
|
"aria-atomic": "true",
|
|
57
|
-
|
|
57
|
+
"data-severity": 'warning' === severity ? severity : void 0,
|
|
58
|
+
className: cn('text-xs leading-4', 'warning' === severity ? 'text-warning' : 'text-error', 'mt-1.5', className),
|
|
58
59
|
...props,
|
|
59
60
|
"data-slot": "form-field-error",
|
|
60
61
|
children: children
|
|
@@ -39,7 +39,7 @@ var __webpack_modules__ = {
|
|
|
39
39
|
"@/components/ui/calendar" (module) {
|
|
40
40
|
module.exports = require("./calendar.cjs");
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"@/components/ui/card" (module) {
|
|
43
43
|
module.exports = require("./card.cjs");
|
|
44
44
|
},
|
|
45
45
|
"./chart" (module) {
|
|
@@ -51,13 +51,13 @@ var __webpack_modules__ = {
|
|
|
51
51
|
"./chat-hero" (module) {
|
|
52
52
|
module.exports = require("./chat-hero.cjs");
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"./checkbox" (module) {
|
|
55
55
|
module.exports = require("./checkbox.cjs");
|
|
56
56
|
},
|
|
57
57
|
"./citation" (module) {
|
|
58
58
|
module.exports = require("./citation.cjs");
|
|
59
59
|
},
|
|
60
|
-
"
|
|
60
|
+
"@/components/ui/code-block" (module) {
|
|
61
61
|
module.exports = require("./code-block.cjs");
|
|
62
62
|
},
|
|
63
63
|
"./collapsible" (module) {
|
|
@@ -69,7 +69,7 @@ var __webpack_modules__ = {
|
|
|
69
69
|
"@/components/ui/command" (module) {
|
|
70
70
|
module.exports = require("./command.cjs");
|
|
71
71
|
},
|
|
72
|
-
"
|
|
72
|
+
"@/components/ui/context-menu" (module) {
|
|
73
73
|
module.exports = require("./context-menu.cjs");
|
|
74
74
|
},
|
|
75
75
|
"./data-table" (module) {
|
|
@@ -132,7 +132,7 @@ var __webpack_modules__ = {
|
|
|
132
132
|
"./json-tree-view" (module) {
|
|
133
133
|
module.exports = require("./json-tree-view/index.cjs");
|
|
134
134
|
},
|
|
135
|
-
"
|
|
135
|
+
"./label" (module) {
|
|
136
136
|
module.exports = require("./label.cjs");
|
|
137
137
|
},
|
|
138
138
|
"./layout" (module) {
|
|
@@ -201,7 +201,7 @@ var __webpack_modules__ = {
|
|
|
201
201
|
"./reference-chip-colors" (module) {
|
|
202
202
|
module.exports = require("./reference-chip-colors.cjs");
|
|
203
203
|
},
|
|
204
|
-
"
|
|
204
|
+
"@/components/ui/reference-chip" (module) {
|
|
205
205
|
module.exports = require("./reference-chip.cjs");
|
|
206
206
|
},
|
|
207
207
|
"./resizable" (module) {
|
|
@@ -255,7 +255,7 @@ var __webpack_modules__ = {
|
|
|
255
255
|
"./tabs" (module) {
|
|
256
256
|
module.exports = require("./tabs.cjs");
|
|
257
257
|
},
|
|
258
|
-
"
|
|
258
|
+
"@/components/ui/textarea" (module) {
|
|
259
259
|
module.exports = require("./textarea.cjs");
|
|
260
260
|
},
|
|
261
261
|
"./thinking-indicator" (module) {
|
|
@@ -276,7 +276,7 @@ var __webpack_modules__ = {
|
|
|
276
276
|
"./tree-view" (module) {
|
|
277
277
|
module.exports = require("./tree-view.cjs");
|
|
278
278
|
},
|
|
279
|
-
"
|
|
279
|
+
"@/components/ui/variable-picker" (module) {
|
|
280
280
|
module.exports = require("./variable-picker/index.cjs");
|
|
281
281
|
},
|
|
282
282
|
"./variable-value-control" (module) {
|
|
@@ -462,7 +462,7 @@ var __webpack_exports__ = {};
|
|
|
462
462
|
"ReferenceChip"
|
|
463
463
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_calendar__rspack_import_12[__rspack_import_key];
|
|
464
464
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
465
|
-
var _card__rspack_import_13 = __webpack_require__("
|
|
465
|
+
var _card__rspack_import_13 = __webpack_require__("@/components/ui/card");
|
|
466
466
|
var __rspack_reexport = {};
|
|
467
467
|
for(const __rspack_import_key in _card__rspack_import_13)if ([
|
|
468
468
|
"getReferenceChipColors",
|
|
@@ -502,7 +502,7 @@ var __webpack_exports__ = {};
|
|
|
502
502
|
"ReferenceChip"
|
|
503
503
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_chat_hero__rspack_import_16[__rspack_import_key];
|
|
504
504
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
505
|
-
var _checkbox__rspack_import_17 = __webpack_require__("
|
|
505
|
+
var _checkbox__rspack_import_17 = __webpack_require__("./checkbox");
|
|
506
506
|
var __rspack_reexport = {};
|
|
507
507
|
for(const __rspack_import_key in _checkbox__rspack_import_17)if ([
|
|
508
508
|
"getReferenceChipColors",
|
|
@@ -522,7 +522,7 @@ var __webpack_exports__ = {};
|
|
|
522
522
|
"ReferenceChip"
|
|
523
523
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_citation__rspack_import_18[__rspack_import_key];
|
|
524
524
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
525
|
-
var _code_block__rspack_import_19 = __webpack_require__("
|
|
525
|
+
var _code_block__rspack_import_19 = __webpack_require__("@/components/ui/code-block");
|
|
526
526
|
var __rspack_reexport = {};
|
|
527
527
|
for(const __rspack_import_key in _code_block__rspack_import_19)if ([
|
|
528
528
|
"getReferenceChipColors",
|
|
@@ -562,7 +562,7 @@ var __webpack_exports__ = {};
|
|
|
562
562
|
"ReferenceChip"
|
|
563
563
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_command__rspack_import_22[__rspack_import_key];
|
|
564
564
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
565
|
-
var _context_menu__rspack_import_23 = __webpack_require__("
|
|
565
|
+
var _context_menu__rspack_import_23 = __webpack_require__("@/components/ui/context-menu");
|
|
566
566
|
var __rspack_reexport = {};
|
|
567
567
|
for(const __rspack_import_key in _context_menu__rspack_import_23)if ([
|
|
568
568
|
"getReferenceChipColors",
|
|
@@ -772,7 +772,7 @@ var __webpack_exports__ = {};
|
|
|
772
772
|
"ReferenceChip"
|
|
773
773
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_json_tree_view__rspack_import_43[__rspack_import_key];
|
|
774
774
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
775
|
-
var _label__rspack_import_44 = __webpack_require__("
|
|
775
|
+
var _label__rspack_import_44 = __webpack_require__("./label");
|
|
776
776
|
var __rspack_reexport = {};
|
|
777
777
|
for(const __rspack_import_key in _label__rspack_import_44)if ([
|
|
778
778
|
"getReferenceChipColors",
|
|
@@ -992,7 +992,7 @@ var __webpack_exports__ = {};
|
|
|
992
992
|
"ReferenceChip"
|
|
993
993
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_radio_group__rspack_import_65[__rspack_import_key];
|
|
994
994
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
995
|
-
var _reference_chip__rspack_import_66 = __webpack_require__("
|
|
995
|
+
var _reference_chip__rspack_import_66 = __webpack_require__("@/components/ui/reference-chip");
|
|
996
996
|
var _reference_chip_colors__rspack_import_67 = __webpack_require__("./reference-chip-colors");
|
|
997
997
|
var _resizable__rspack_import_68 = __webpack_require__("./resizable");
|
|
998
998
|
var __rspack_reexport = {};
|
|
@@ -1164,7 +1164,7 @@ var __webpack_exports__ = {};
|
|
|
1164
1164
|
"ReferenceChip"
|
|
1165
1165
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_tabs__rspack_import_84[__rspack_import_key];
|
|
1166
1166
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1167
|
-
var _textarea__rspack_import_85 = __webpack_require__("
|
|
1167
|
+
var _textarea__rspack_import_85 = __webpack_require__("@/components/ui/textarea");
|
|
1168
1168
|
var __rspack_reexport = {};
|
|
1169
1169
|
for(const __rspack_import_key in _textarea__rspack_import_85)if ([
|
|
1170
1170
|
"getReferenceChipColors",
|
|
@@ -1226,7 +1226,7 @@ var __webpack_exports__ = {};
|
|
|
1226
1226
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1227
1227
|
var _tree_view__rspack_import_91 = __webpack_require__("./tree-view");
|
|
1228
1228
|
var _tree_view__rspack_import_91_default = /*#__PURE__*/ __webpack_require__.n(_tree_view__rspack_import_91);
|
|
1229
|
-
var _variable_picker__rspack_import_92 = __webpack_require__("
|
|
1229
|
+
var _variable_picker__rspack_import_92 = __webpack_require__("@/components/ui/variable-picker");
|
|
1230
1230
|
var __rspack_reexport = {};
|
|
1231
1231
|
for(const __rspack_import_key in _variable_picker__rspack_import_92)if ([
|
|
1232
1232
|
"getReferenceChipColors",
|