@uipath/apollo-wind 2.75.1 → 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/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/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 +6 -0
- package/package.json +1 -1
|
@@ -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
|
|
@@ -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) {
|
|
@@ -81,7 +81,7 @@ var __webpack_modules__ = {
|
|
|
81
81
|
"./datetime-picker" (module) {
|
|
82
82
|
module.exports = require("./datetime-picker.cjs");
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"./dialog" (module) {
|
|
85
85
|
module.exports = require("./dialog.cjs");
|
|
86
86
|
},
|
|
87
87
|
"./disclosure-tree" (module) {
|
|
@@ -117,7 +117,7 @@ var __webpack_modules__ = {
|
|
|
117
117
|
"./form-field" (module) {
|
|
118
118
|
module.exports = require("./form-field.cjs");
|
|
119
119
|
},
|
|
120
|
-
"
|
|
120
|
+
"./hover-card" (module) {
|
|
121
121
|
module.exports = require("./hover-card.cjs");
|
|
122
122
|
},
|
|
123
123
|
"./info-tooltip" (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) {
|
|
@@ -264,7 +264,7 @@ var __webpack_modules__ = {
|
|
|
264
264
|
"./toggle-group" (module) {
|
|
265
265
|
module.exports = require("./toggle-group.cjs");
|
|
266
266
|
},
|
|
267
|
-
"
|
|
267
|
+
"./toggle" (module) {
|
|
268
268
|
module.exports = require("./toggle.cjs");
|
|
269
269
|
},
|
|
270
270
|
"./tool-call" (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) {
|
|
@@ -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",
|
|
@@ -602,7 +602,7 @@ var __webpack_exports__ = {};
|
|
|
602
602
|
"ReferenceChip"
|
|
603
603
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_datetime_picker__rspack_import_26[__rspack_import_key];
|
|
604
604
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
605
|
-
var _dialog__rspack_import_27 = __webpack_require__("
|
|
605
|
+
var _dialog__rspack_import_27 = __webpack_require__("./dialog");
|
|
606
606
|
var __rspack_reexport = {};
|
|
607
607
|
for(const __rspack_import_key in _dialog__rspack_import_27)if ([
|
|
608
608
|
"getReferenceChipColors",
|
|
@@ -722,7 +722,7 @@ var __webpack_exports__ = {};
|
|
|
722
722
|
"ReferenceChip"
|
|
723
723
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_form_field__rspack_import_38[__rspack_import_key];
|
|
724
724
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
725
|
-
var _hover_card__rspack_import_39 = __webpack_require__("
|
|
725
|
+
var _hover_card__rspack_import_39 = __webpack_require__("./hover-card");
|
|
726
726
|
var __rspack_reexport = {};
|
|
727
727
|
for(const __rspack_import_key in _hover_card__rspack_import_39)if ([
|
|
728
728
|
"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",
|
|
@@ -1184,7 +1184,7 @@ var __webpack_exports__ = {};
|
|
|
1184
1184
|
"ReferenceChip"
|
|
1185
1185
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_thinking_indicator__rspack_import_86[__rspack_import_key];
|
|
1186
1186
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1187
|
-
var _toggle__rspack_import_87 = __webpack_require__("
|
|
1187
|
+
var _toggle__rspack_import_87 = __webpack_require__("./toggle");
|
|
1188
1188
|
var __rspack_reexport = {};
|
|
1189
1189
|
for(const __rspack_import_key in _toggle__rspack_import_87)if ([
|
|
1190
1190
|
"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",
|
|
@@ -65,7 +65,7 @@ const ReferenceChip = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
65
65
|
onRemove && !readOnly && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
66
66
|
type: "button",
|
|
67
67
|
disabled: disabled,
|
|
68
|
-
"aria-label": removeLabel ?? `Remove ${label}
|
|
68
|
+
"aria-label": removeLabel ?? ('string' == typeof label ? `Remove ${label}` : 'Remove'),
|
|
69
69
|
className: "inline-flex shrink-0 items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4 text-inherit focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current disabled:cursor-default",
|
|
70
70
|
onMouseDown: (event)=>{
|
|
71
71
|
event.preventDefault();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
export interface ReferenceChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
3
3
|
/** Display name of the referenced variable, resource or connection. */
|
|
4
|
-
label:
|
|
4
|
+
label: ReactNode;
|
|
5
5
|
/** Decorative icon. Branded icons may preserve their original colors. */
|
|
6
6
|
icon?: ReactNode;
|
|
7
7
|
onRemove?: () => void;
|
|
@@ -37,7 +37,7 @@ const ReferenceChip = /*#__PURE__*/ forwardRef(({ label, icon, onRemove, removeL
|
|
|
37
37
|
onRemove && !readOnly && /*#__PURE__*/ jsx("button", {
|
|
38
38
|
type: "button",
|
|
39
39
|
disabled: disabled,
|
|
40
|
-
"aria-label": removeLabel ?? `Remove ${label}
|
|
40
|
+
"aria-label": removeLabel ?? ('string' == typeof label ? `Remove ${label}` : 'Remove'),
|
|
41
41
|
className: "inline-flex shrink-0 items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4 text-inherit focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current disabled:cursor-default",
|
|
42
42
|
onMouseDown: (event)=>{
|
|
43
43
|
event.preventDefault();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { VariablePickerContentProps, VariablePickerItem, VariablePickerProps, } from './variable-picker';
|
|
1
|
+
export type { RenderVariablePicker, VariablePickerContentProps, VariablePickerItem, VariablePickerProps, VariablePickerSlotProps, } from './variable-picker';
|
|
2
2
|
export { VariablePicker, VariablePickerContent } from './variable-picker';
|
|
@@ -26,6 +26,7 @@ var __webpack_exports__ = {};
|
|
|
26
26
|
__webpack_require__.r(__webpack_exports__);
|
|
27
27
|
__webpack_require__.d(__webpack_exports__, {
|
|
28
28
|
VariablePicker: ()=>VariablePicker,
|
|
29
|
+
VariablePickerSlot: ()=>VariablePickerSlot,
|
|
29
30
|
VariablePickerContent: ()=>VariablePickerContent
|
|
30
31
|
});
|
|
31
32
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
@@ -50,6 +51,9 @@ function VariableTypeBadge({ item }) {
|
|
|
50
51
|
children: item.icon ?? TYPE_LABEL[type] ?? type
|
|
51
52
|
});
|
|
52
53
|
}
|
|
54
|
+
function VariablePickerSlot({ render, ...props }) {
|
|
55
|
+
return render(props);
|
|
56
|
+
}
|
|
53
57
|
function itemMatches(item, normalizedQuery) {
|
|
54
58
|
return item.label.toLowerCase().includes(normalizedQuery) || item.value?.toLowerCase().includes(normalizedQuery) === true;
|
|
55
59
|
}
|
|
@@ -189,7 +193,7 @@ function VariablePickerContent({ items, onSelect, placeholder = 'Search variable
|
|
|
189
193
|
]
|
|
190
194
|
});
|
|
191
195
|
}
|
|
192
|
-
function VariablePicker({ children, align = 'end', disabled = false, open: controlledOpen, onOpenChange, triggerLabel = 'Insert', triggerAriaLabel = 'Insert variable', className, onSelect, ...contentProps }) {
|
|
196
|
+
function VariablePicker({ children, align = 'end', disabled = false, open: controlledOpen, onOpenChange, triggerLabel = 'Insert', triggerAriaLabel = 'Insert variable', className, onSelect, renderPicker, ...contentProps }) {
|
|
193
197
|
const [uncontrolledOpen, setUncontrolledOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
194
198
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
195
199
|
const setOpen = (nextOpen)=>{
|
|
@@ -227,7 +231,15 @@ function VariablePicker({ children, align = 'end', disabled = false, open: contr
|
|
|
227
231
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
228
232
|
align: align,
|
|
229
233
|
className: (0, index_cjs_namespaceObject.cn)('w-[280px] max-w-[calc(100vw-1rem)] overflow-hidden p-0', className),
|
|
230
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
234
|
+
children: renderPicker ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariablePickerSlot, {
|
|
235
|
+
render: renderPicker,
|
|
236
|
+
onSelect: (value)=>selectItem({
|
|
237
|
+
id: value,
|
|
238
|
+
label: value,
|
|
239
|
+
value
|
|
240
|
+
}),
|
|
241
|
+
close: ()=>setOpen(false)
|
|
242
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariablePickerContent, {
|
|
231
243
|
...contentProps,
|
|
232
244
|
onSelect: selectItem
|
|
233
245
|
})
|
|
@@ -237,9 +249,11 @@ function VariablePicker({ children, align = 'end', disabled = false, open: contr
|
|
|
237
249
|
}
|
|
238
250
|
exports.VariablePicker = __webpack_exports__.VariablePicker;
|
|
239
251
|
exports.VariablePickerContent = __webpack_exports__.VariablePickerContent;
|
|
252
|
+
exports.VariablePickerSlot = __webpack_exports__.VariablePickerSlot;
|
|
240
253
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
241
254
|
"VariablePicker",
|
|
242
|
-
"VariablePickerContent"
|
|
255
|
+
"VariablePickerContent",
|
|
256
|
+
"VariablePickerSlot"
|
|
243
257
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
244
258
|
Object.defineProperty(exports, '__esModule', {
|
|
245
259
|
value: true
|
|
@@ -35,8 +35,31 @@ export interface VariablePickerProps extends VariablePickerContentProps {
|
|
|
35
35
|
onOpenChange?: (open: boolean) => void;
|
|
36
36
|
triggerLabel?: string;
|
|
37
37
|
triggerAriaLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The host's own picker, rendered in the popover in place of the search and tree, whose `items`
|
|
40
|
+
* it then does not use. A pick reaches `onSelect` as an entry made from the picked value.
|
|
41
|
+
*/
|
|
42
|
+
renderPicker?: RenderVariablePicker;
|
|
38
43
|
}
|
|
44
|
+
/** What a host-rendered picker gets in place of the built-in search and tree. */
|
|
45
|
+
export interface VariablePickerSlotProps {
|
|
46
|
+
/** The reference already bound, when the pick replaces one. */
|
|
47
|
+
value?: string;
|
|
48
|
+
/** Commits `value` and closes the popover. */
|
|
49
|
+
onSelect(value: string): void;
|
|
50
|
+
/** Closes the popover without committing anything. */
|
|
51
|
+
close(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders a host's own picker inside a wind-owned popover. Called only while the popover is open:
|
|
55
|
+
* the trigger, anchoring, focus return and strings stay with wind.
|
|
56
|
+
*/
|
|
57
|
+
export type RenderVariablePicker = (props: VariablePickerSlotProps) => ReactNode;
|
|
58
|
+
/** Renders a slot as an element, so it is called only once its popover mounts the content. */
|
|
59
|
+
export declare function VariablePickerSlot({ render, ...props }: VariablePickerSlotProps & {
|
|
60
|
+
render: RenderVariablePicker;
|
|
61
|
+
}): ReactNode;
|
|
39
62
|
/** Search and tree content for embedding in a consumer-owned popover or caret-anchored surface. */
|
|
40
63
|
export declare function VariablePickerContent({ items, onSelect, placeholder, emptyText, query: controlledQuery, initialQuery, onQueryChange, defaultExpandedIds, insertLabel, className, }: VariablePickerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
41
64
|
/** Popover-wrapped convenience picker for inserting a variable into a consumer-owned value. */
|
|
42
|
-
export declare function VariablePicker({ children, align, disabled, open: controlledOpen, onOpenChange, triggerLabel, triggerAriaLabel, className, onSelect, ...contentProps }: VariablePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare function VariablePicker({ children, align, disabled, open: controlledOpen, onOpenChange, triggerLabel, triggerAriaLabel, className, onSelect, renderPicker, ...contentProps }: VariablePickerProps): import("react/jsx-runtime").JSX.Element;
|