@uipath/apollo-wind 2.69.0 → 2.71.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/custom/demo-composer.cjs +80 -0
- package/dist/components/custom/demo-composer.d.ts +11 -0
- package/dist/components/custom/demo-composer.js +46 -0
- package/dist/components/custom/panel-flow.cjs +2 -2
- package/dist/components/custom/panel-flow.js +2 -2
- package/dist/components/forms/field-control.cjs +3 -2
- package/dist/components/forms/field-control.js +3 -2
- package/dist/components/forms/validation-converter.cjs +14 -5
- package/dist/components/forms/validation-converter.js +14 -5
- package/dist/components/ui/chat-composer.cjs +429 -0
- package/dist/components/ui/chat-composer.d.ts +157 -0
- package/dist/components/ui/chat-composer.js +359 -0
- package/dist/components/ui/chat-hero.cjs +244 -0
- package/dist/components/ui/chat-hero.d.ts +51 -0
- package/dist/components/ui/chat-hero.js +189 -0
- package/dist/components/ui/citation.cjs +188 -0
- package/dist/components/ui/citation.d.ts +42 -0
- package/dist/components/ui/citation.js +148 -0
- package/dist/components/ui/date-picker.cjs +6 -5
- package/dist/components/ui/date-picker.js +7 -6
- package/dist/components/ui/datetime-picker.cjs +7 -10
- package/dist/components/ui/datetime-picker.js +8 -11
- package/dist/components/ui/dropzone-overlay.cjs +142 -0
- package/dist/components/ui/dropzone-overlay.d.ts +27 -0
- package/dist/components/ui/dropzone-overlay.js +105 -0
- package/dist/components/ui/file-upload.cjs +5 -29
- package/dist/components/ui/file-upload.js +2 -26
- package/dist/components/ui/file-validation.cjs +91 -0
- package/dist/components/ui/file-validation.d.ts +24 -0
- package/dist/components/ui/file-validation.js +51 -0
- package/dist/components/ui/hover-card.cjs +15 -8
- package/dist/components/ui/hover-card.d.ts +4 -1
- package/dist/components/ui/hover-card.js +16 -9
- package/dist/components/ui/index.cjs +304 -216
- package/dist/components/ui/index.d.ts +8 -0
- package/dist/components/ui/index.js +8 -0
- package/dist/components/ui/input-group.cjs +1 -1
- package/dist/components/ui/input-group.d.ts +2 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/message-actions.cjs +302 -0
- package/dist/components/ui/message-actions.d.ts +102 -0
- package/dist/components/ui/message-actions.js +241 -0
- package/dist/components/ui/message.cjs +1 -1
- package/dist/components/ui/message.d.ts +2 -0
- package/dist/components/ui/message.js +1 -1
- package/dist/components/ui/prompt-suggestions.cjs +133 -0
- package/dist/components/ui/prompt-suggestions.d.ts +52 -0
- package/dist/components/ui/prompt-suggestions.js +90 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
- package/dist/components/ui/quick-form-field/index.d.ts +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
- package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
- package/dist/components/ui/quick-form-field/types.cjs +2 -2
- package/dist/components/ui/quick-form-field/types.d.ts +39 -32
- package/dist/components/ui/quick-form-field/types.js +2 -2
- package/dist/components/ui/quick-form-field/utils.cjs +5 -59
- package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
- package/dist/components/ui/quick-form-field/utils.js +3 -48
- package/dist/components/ui/sources.cjs +175 -0
- package/dist/components/ui/sources.d.ts +44 -0
- package/dist/components/ui/sources.js +132 -0
- package/dist/index.cjs +156 -7
- package/dist/index.d.ts +17 -1
- package/dist/index.js +9 -1
- package/dist/lib/date-value.cjs +46 -0
- package/dist/lib/date-value.d.ts +8 -0
- package/dist/lib/date-value.js +12 -0
- package/dist/lib/index.cjs +8 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -1
- package/dist/lib/url.cjs +54 -0
- package/dist/lib/url.d.ts +8 -0
- package/dist/lib/url.js +17 -0
- package/dist/styles.css +239 -78
- package/dist/tailwind.utilities.css +15 -0
- package/package.json +1 -1
- package/dist/components/custom/chat-composer.cjs +0 -134
- package/dist/components/custom/chat-composer.d.ts +0 -14
- package/dist/components/custom/chat-composer.js +0 -100
- package/dist/components/custom/chat-first-experience.cjs +0 -87
- package/dist/components/custom/chat-first-experience.d.ts +0 -24
- package/dist/components/custom/chat-first-experience.js +0 -53
- package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
- package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
- package/dist/components/custom/chat-prompt-suggestions.js +0 -15
|
@@ -13,7 +13,10 @@ export * from './button-group';
|
|
|
13
13
|
export * from './calendar';
|
|
14
14
|
export * from './card';
|
|
15
15
|
export * from './chart';
|
|
16
|
+
export * from './chat-composer';
|
|
17
|
+
export * from './chat-hero';
|
|
16
18
|
export * from './checkbox';
|
|
19
|
+
export * from './citation';
|
|
17
20
|
export * from './code-block';
|
|
18
21
|
export * from './collapsible';
|
|
19
22
|
export * from './combobox';
|
|
@@ -25,11 +28,13 @@ export * from './datetime-picker';
|
|
|
25
28
|
export * from './dialog';
|
|
26
29
|
export * from './drawer';
|
|
27
30
|
export * from './dropdown-menu';
|
|
31
|
+
export * from './dropzone-overlay';
|
|
28
32
|
export * from './editable-cell';
|
|
29
33
|
export * from './empty-state';
|
|
30
34
|
export * from './field-actions';
|
|
31
35
|
export * from './field-addons';
|
|
32
36
|
export * from './file-upload';
|
|
37
|
+
export * from './file-validation';
|
|
33
38
|
export * from './form-field';
|
|
34
39
|
export * from './hover-card';
|
|
35
40
|
export * from './info-tooltip';
|
|
@@ -44,6 +49,7 @@ export * from './lockable-value-field';
|
|
|
44
49
|
export * from './markdown';
|
|
45
50
|
export * from './marker';
|
|
46
51
|
export * from './message';
|
|
52
|
+
export * from './message-actions';
|
|
47
53
|
export * from './message-scroller';
|
|
48
54
|
export * from './model-picker';
|
|
49
55
|
export * from './multi-select';
|
|
@@ -52,6 +58,7 @@ export * from './popover';
|
|
|
52
58
|
export * from './portal-container';
|
|
53
59
|
export * from './progress';
|
|
54
60
|
export * from './prompt-editor';
|
|
61
|
+
export * from './prompt-suggestions';
|
|
55
62
|
export * from './prompt-value-control';
|
|
56
63
|
export * from './quick-form-field';
|
|
57
64
|
export * from './radio-group';
|
|
@@ -65,6 +72,7 @@ export * from './sheet';
|
|
|
65
72
|
export * from './skeleton';
|
|
66
73
|
export * from './slider';
|
|
67
74
|
export * from './sonner';
|
|
75
|
+
export * from './sources';
|
|
68
76
|
export * from './spinner';
|
|
69
77
|
export * from './stats-card';
|
|
70
78
|
export * from './stepper';
|
|
@@ -14,7 +14,10 @@ export * from "./button-group.js";
|
|
|
14
14
|
export * from "./calendar.js";
|
|
15
15
|
export * from "./card.js";
|
|
16
16
|
export * from "./chart.js";
|
|
17
|
+
export * from "./chat-composer.js";
|
|
18
|
+
export * from "./chat-hero.js";
|
|
17
19
|
export * from "./checkbox.js";
|
|
20
|
+
export * from "./citation.js";
|
|
18
21
|
export * from "./code-block.js";
|
|
19
22
|
export * from "./collapsible.js";
|
|
20
23
|
export * from "./combobox.js";
|
|
@@ -26,11 +29,13 @@ export * from "./datetime-picker.js";
|
|
|
26
29
|
export * from "./dialog.js";
|
|
27
30
|
export * from "./drawer.js";
|
|
28
31
|
export * from "./dropdown-menu.js";
|
|
32
|
+
export * from "./dropzone-overlay.js";
|
|
29
33
|
export * from "./editable-cell.js";
|
|
30
34
|
export * from "./empty-state.js";
|
|
31
35
|
export * from "./field-actions/index.js";
|
|
32
36
|
export * from "./field-addons/index.js";
|
|
33
37
|
export * from "./file-upload.js";
|
|
38
|
+
export * from "./file-validation.js";
|
|
34
39
|
export * from "./form-field.js";
|
|
35
40
|
export * from "./hover-card.js";
|
|
36
41
|
export * from "./info-tooltip.js";
|
|
@@ -45,6 +50,7 @@ export * from "./lockable-value-field/index.js";
|
|
|
45
50
|
export * from "./markdown.js";
|
|
46
51
|
export * from "./marker.js";
|
|
47
52
|
export * from "./message.js";
|
|
53
|
+
export * from "./message-actions.js";
|
|
48
54
|
export * from "./message-scroller/index.js";
|
|
49
55
|
export * from "./model-picker/index.js";
|
|
50
56
|
export * from "./multi-select.js";
|
|
@@ -53,6 +59,7 @@ export * from "./popover.js";
|
|
|
53
59
|
export * from "./portal-container.js";
|
|
54
60
|
export * from "./progress.js";
|
|
55
61
|
export * from "./prompt-editor/index.js";
|
|
62
|
+
export * from "./prompt-suggestions.js";
|
|
56
63
|
export * from "./prompt-value-control.js";
|
|
57
64
|
export * from "./quick-form-field/index.js";
|
|
58
65
|
export * from "./radio-group.js";
|
|
@@ -66,6 +73,7 @@ export * from "./sheet.js";
|
|
|
66
73
|
export * from "./skeleton.js";
|
|
67
74
|
export * from "./slider.js";
|
|
68
75
|
export * from "./sonner.js";
|
|
76
|
+
export * from "./sources.js";
|
|
69
77
|
export * from "./spinner.js";
|
|
70
78
|
export * from "./stats-card.js";
|
|
71
79
|
export * from "./stepper.js";
|
|
@@ -269,7 +269,7 @@ const InputGroupBody = /*#__PURE__*/ external_react_namespaceObject.forwardRef((
|
|
|
269
269
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
270
270
|
ref: ref,
|
|
271
271
|
"data-slot": "input-group-body",
|
|
272
|
-
className: (0, index_cjs_namespaceObject.cn)('border-t empty:border-t-0 has-[>[hidden]]:border-t-0', className),
|
|
272
|
+
className: (0, index_cjs_namespaceObject.cn)('border-t empty:border-t-0 has-[>[hidden]]:border-t-0 future:dark:border-border', className),
|
|
273
273
|
...props
|
|
274
274
|
})
|
|
275
275
|
});
|
|
@@ -63,7 +63,8 @@ export interface InputGroupBodyProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
63
63
|
* Content below a `layout="block"` group's first row, behind a divider. Controls here are standard
|
|
64
64
|
* fields with their own box, message and popovers; one that needs addons takes its own InputGroup.
|
|
65
65
|
* The divider goes when there is nothing to divide: an empty body, or a closed Radix collapsible,
|
|
66
|
-
* which leaves its content in place and `hidden`.
|
|
66
|
+
* which leaves its content in place and `hidden`. Future dark's default edge colour is the box's
|
|
67
|
+
* own fill, so the divider steps up to `border` there.
|
|
67
68
|
*/
|
|
68
69
|
declare const InputGroupBody: React.ForwardRefExoticComponent<InputGroupBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
70
|
export interface InputGroupButtonProps extends ButtonProps {
|
|
@@ -230,7 +230,7 @@ const InputGroupBody = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>
|
|
|
230
230
|
children: /*#__PURE__*/ jsx("div", {
|
|
231
231
|
ref: ref,
|
|
232
232
|
"data-slot": "input-group-body",
|
|
233
|
-
className: cn('border-t empty:border-t-0 has-[>[hidden]]:border-t-0', className),
|
|
233
|
+
className: cn('border-t empty:border-t-0 has-[>[hidden]]:border-t-0 future:dark:border-border', className),
|
|
234
234
|
...props
|
|
235
235
|
})
|
|
236
236
|
});
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
DEFAULT_MESSAGE_ACTIONS_STRINGS: ()=>DEFAULT_MESSAGE_ACTIONS_STRINGS,
|
|
29
|
+
DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS: ()=>DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS,
|
|
30
|
+
DEFAULT_MESSAGE_ACTION_COPY_STRINGS: ()=>DEFAULT_MESSAGE_ACTION_COPY_STRINGS,
|
|
31
|
+
MessageActionFeedback: ()=>MessageActionFeedback,
|
|
32
|
+
MessageActionsOverflow: ()=>MessageActionsOverflow,
|
|
33
|
+
MessageActionCopy: ()=>MessageActionCopy,
|
|
34
|
+
messageActionsVariants: ()=>messageActionsVariants,
|
|
35
|
+
DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS: ()=>DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS,
|
|
36
|
+
MessageAction: ()=>MessageAction,
|
|
37
|
+
MessageActions: ()=>MessageActions
|
|
38
|
+
});
|
|
39
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
|
+
const external_class_variance_authority_namespaceObject = require("class-variance-authority");
|
|
41
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
42
|
+
const external_react_namespaceObject = require("react");
|
|
43
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
44
|
+
const clipboard_cjs_namespaceObject = require("../../lib/clipboard.cjs");
|
|
45
|
+
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
46
|
+
const external_dropdown_menu_cjs_namespaceObject = require("./dropdown-menu.cjs");
|
|
47
|
+
const external_toggle_cjs_namespaceObject = require("./toggle.cjs");
|
|
48
|
+
const external_tooltip_cjs_namespaceObject = require("./tooltip.cjs");
|
|
49
|
+
const DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS = {
|
|
50
|
+
more: 'More actions'
|
|
51
|
+
};
|
|
52
|
+
const DEFAULT_MESSAGE_ACTIONS_STRINGS = {
|
|
53
|
+
...DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS,
|
|
54
|
+
label: 'Message actions'
|
|
55
|
+
};
|
|
56
|
+
const messageActionsVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex w-fit max-w-full items-center gap-0.5 px-2', {
|
|
57
|
+
variants: {
|
|
58
|
+
visibility: {
|
|
59
|
+
always: '',
|
|
60
|
+
hover: 'opacity-0 transition-opacity group-hover/message:opacity-100 group-focus-within/message:opacity-100 focus-within:opacity-100 has-[[data-state=open]]:opacity-100 has-[[data-state=delayed-open]]:opacity-100 has-[[data-state=instant-open]]:opacity-100 [@media(hover:none)]:opacity-100'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
visibility: 'always'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const MessageActions = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, visibility = 'always', actions = [], maxVisible, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
|
|
68
|
+
const text = {
|
|
69
|
+
...DEFAULT_MESSAGE_ACTIONS_STRINGS,
|
|
70
|
+
...strings
|
|
71
|
+
};
|
|
72
|
+
const limit = void 0 === maxVisible ? actions.length : Math.max(0, maxVisible);
|
|
73
|
+
const visible = actions.slice(0, limit);
|
|
74
|
+
const overflow = actions.slice(limit);
|
|
75
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
76
|
+
delayDuration: 300,
|
|
77
|
+
skipDelayDuration: 150,
|
|
78
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
79
|
+
ref: ref,
|
|
80
|
+
role: "group",
|
|
81
|
+
"aria-label": ariaLabel ?? text.label,
|
|
82
|
+
"data-slot": "message-actions",
|
|
83
|
+
"data-visibility": visibility,
|
|
84
|
+
className: (0, index_cjs_namespaceObject.cn)(messageActionsVariants({
|
|
85
|
+
visibility
|
|
86
|
+
}), className),
|
|
87
|
+
...props,
|
|
88
|
+
children: [
|
|
89
|
+
children,
|
|
90
|
+
visible.map((action)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MessageAction, {
|
|
91
|
+
label: action.label,
|
|
92
|
+
disabled: action.disabled,
|
|
93
|
+
onClick: action.onSelect,
|
|
94
|
+
children: action.icon
|
|
95
|
+
}, action.id)),
|
|
96
|
+
overflow.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MessageActionsOverflow, {
|
|
97
|
+
items: overflow,
|
|
98
|
+
strings: {
|
|
99
|
+
more: text.more
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
MessageActions.displayName = 'MessageActions';
|
|
107
|
+
const MessageAction = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ label, tooltipSide = 'bottom', variant = 'ghost', size = '3xs', icon = true, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
110
|
+
asChild: true,
|
|
111
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
112
|
+
ref: ref,
|
|
113
|
+
"data-slot": "message-action",
|
|
114
|
+
"aria-label": label,
|
|
115
|
+
variant: variant,
|
|
116
|
+
size: size,
|
|
117
|
+
icon: icon,
|
|
118
|
+
...props
|
|
119
|
+
})
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
122
|
+
side: tooltipSide,
|
|
123
|
+
children: label
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}));
|
|
127
|
+
MessageAction.displayName = 'MessageAction';
|
|
128
|
+
const DEFAULT_MESSAGE_ACTION_COPY_STRINGS = {
|
|
129
|
+
copy: 'Copy',
|
|
130
|
+
copied: 'Copied'
|
|
131
|
+
};
|
|
132
|
+
const COPIED_RESET_MS = 1500;
|
|
133
|
+
const MessageActionCopy = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ text: copyText, onCopy, strings, onClick, ...props }, ref)=>{
|
|
134
|
+
const text = {
|
|
135
|
+
...DEFAULT_MESSAGE_ACTION_COPY_STRINGS,
|
|
136
|
+
...strings
|
|
137
|
+
};
|
|
138
|
+
const [copied, setCopied] = external_react_namespaceObject.useState(false);
|
|
139
|
+
const timer = external_react_namespaceObject.useRef(void 0);
|
|
140
|
+
external_react_namespaceObject.useEffect(()=>()=>clearTimeout(timer.current), []);
|
|
141
|
+
const handleClick = async (event)=>{
|
|
142
|
+
onClick?.(event);
|
|
143
|
+
if (event.defaultPrevented) return;
|
|
144
|
+
if (!await (0, clipboard_cjs_namespaceObject.copyTextToClipboard)(copyText)) return;
|
|
145
|
+
onCopy?.(copyText);
|
|
146
|
+
setCopied(true);
|
|
147
|
+
clearTimeout(timer.current);
|
|
148
|
+
timer.current = setTimeout(()=>setCopied(false), COPIED_RESET_MS);
|
|
149
|
+
};
|
|
150
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MessageAction, {
|
|
153
|
+
ref: ref,
|
|
154
|
+
"data-copied": copied || void 0,
|
|
155
|
+
label: copied ? text.copied : text.copy,
|
|
156
|
+
onClick: handleClick,
|
|
157
|
+
...props,
|
|
158
|
+
children: copied ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Check, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Copy, {})
|
|
159
|
+
}),
|
|
160
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("output", {
|
|
161
|
+
"aria-live": "polite",
|
|
162
|
+
className: "sr-only",
|
|
163
|
+
children: copied ? text.copied : ''
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
MessageActionCopy.displayName = 'MessageActionCopy';
|
|
169
|
+
const DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS = {
|
|
170
|
+
label: 'Rate this response',
|
|
171
|
+
helpful: 'Helpful',
|
|
172
|
+
notHelpful: 'Not helpful'
|
|
173
|
+
};
|
|
174
|
+
const feedbackToggleClass = 'size-6 min-w-6 px-0 aria-pressed:bg-accent aria-pressed:text-accent-foreground future:aria-pressed:text-foreground';
|
|
175
|
+
const MessageActionFeedback = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ value: valueProp, defaultValue = null, onChange, disabled, strings, className, 'aria-label': ariaLabel, ...props }, ref)=>{
|
|
176
|
+
const text = {
|
|
177
|
+
...DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS,
|
|
178
|
+
...strings
|
|
179
|
+
};
|
|
180
|
+
const [uncontrolled, setUncontrolled] = external_react_namespaceObject.useState(defaultValue);
|
|
181
|
+
const value = void 0 === valueProp ? uncontrolled : valueProp;
|
|
182
|
+
const set = (next)=>{
|
|
183
|
+
if (next === value) return;
|
|
184
|
+
if (void 0 === valueProp) setUncontrolled(next);
|
|
185
|
+
onChange?.(next);
|
|
186
|
+
};
|
|
187
|
+
const thumbs = [
|
|
188
|
+
{
|
|
189
|
+
rating: 'up',
|
|
190
|
+
label: text.helpful,
|
|
191
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ThumbsUp, {})
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
rating: 'down',
|
|
195
|
+
label: text.notHelpful,
|
|
196
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ThumbsDown, {})
|
|
197
|
+
}
|
|
198
|
+
];
|
|
199
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
200
|
+
ref: ref,
|
|
201
|
+
role: "group",
|
|
202
|
+
"aria-label": ariaLabel ?? text.label,
|
|
203
|
+
"data-slot": "message-action-feedback",
|
|
204
|
+
"data-value": value ?? void 0,
|
|
205
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center gap-0.5', className),
|
|
206
|
+
...props,
|
|
207
|
+
children: thumbs.map(({ rating, label, icon })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
208
|
+
children: [
|
|
209
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
210
|
+
asChild: true,
|
|
211
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_toggle_cjs_namespaceObject.Toggle, {
|
|
212
|
+
"data-slot": "message-action",
|
|
213
|
+
size: "xs",
|
|
214
|
+
className: feedbackToggleClass,
|
|
215
|
+
"aria-label": label,
|
|
216
|
+
pressed: value === rating,
|
|
217
|
+
onPressedChange: ()=>set(rating),
|
|
218
|
+
disabled: disabled,
|
|
219
|
+
children: icon
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
223
|
+
side: "bottom",
|
|
224
|
+
children: label
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
}, rating))
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
MessageActionFeedback.displayName = 'MessageActionFeedback';
|
|
231
|
+
const MessageActionsOverflow = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ items, strings, align = 'start', tooltipSide = 'bottom', ...props }, ref)=>{
|
|
232
|
+
const text = {
|
|
233
|
+
...DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS,
|
|
234
|
+
...strings
|
|
235
|
+
};
|
|
236
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
237
|
+
children: [
|
|
238
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
239
|
+
children: [
|
|
240
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
241
|
+
asChild: true,
|
|
242
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
243
|
+
asChild: true,
|
|
244
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
245
|
+
ref: ref,
|
|
246
|
+
"data-slot": "message-actions-overflow",
|
|
247
|
+
"aria-label": text.more,
|
|
248
|
+
variant: "ghost",
|
|
249
|
+
size: "3xs",
|
|
250
|
+
icon: true,
|
|
251
|
+
...props,
|
|
252
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Ellipsis, {})
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
}),
|
|
256
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
257
|
+
side: tooltipSide,
|
|
258
|
+
children: text.more
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
}),
|
|
262
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuContent, {
|
|
263
|
+
align: align,
|
|
264
|
+
children: items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
265
|
+
disabled: item.disabled,
|
|
266
|
+
onSelect: item.onSelect,
|
|
267
|
+
className: (0, index_cjs_namespaceObject.cn)(item.destructive && 'text-error focus:bg-error-background focus:text-error'),
|
|
268
|
+
children: [
|
|
269
|
+
item.icon,
|
|
270
|
+
item.label
|
|
271
|
+
]
|
|
272
|
+
}, item.id))
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
MessageActionsOverflow.displayName = 'MessageActionsOverflow';
|
|
278
|
+
exports.DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS = __webpack_exports__.DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS;
|
|
279
|
+
exports.DEFAULT_MESSAGE_ACTIONS_STRINGS = __webpack_exports__.DEFAULT_MESSAGE_ACTIONS_STRINGS;
|
|
280
|
+
exports.DEFAULT_MESSAGE_ACTION_COPY_STRINGS = __webpack_exports__.DEFAULT_MESSAGE_ACTION_COPY_STRINGS;
|
|
281
|
+
exports.DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS = __webpack_exports__.DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS;
|
|
282
|
+
exports.MessageAction = __webpack_exports__.MessageAction;
|
|
283
|
+
exports.MessageActionCopy = __webpack_exports__.MessageActionCopy;
|
|
284
|
+
exports.MessageActionFeedback = __webpack_exports__.MessageActionFeedback;
|
|
285
|
+
exports.MessageActions = __webpack_exports__.MessageActions;
|
|
286
|
+
exports.MessageActionsOverflow = __webpack_exports__.MessageActionsOverflow;
|
|
287
|
+
exports.messageActionsVariants = __webpack_exports__.messageActionsVariants;
|
|
288
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
289
|
+
"DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS",
|
|
290
|
+
"DEFAULT_MESSAGE_ACTIONS_STRINGS",
|
|
291
|
+
"DEFAULT_MESSAGE_ACTION_COPY_STRINGS",
|
|
292
|
+
"DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS",
|
|
293
|
+
"MessageAction",
|
|
294
|
+
"MessageActionCopy",
|
|
295
|
+
"MessageActionFeedback",
|
|
296
|
+
"MessageActions",
|
|
297
|
+
"MessageActionsOverflow",
|
|
298
|
+
"messageActionsVariants"
|
|
299
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
300
|
+
Object.defineProperty(exports, '__esModule', {
|
|
301
|
+
value: true
|
|
302
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type ButtonProps } from './button';
|
|
4
|
+
import { DropdownMenuContent } from './dropdown-menu';
|
|
5
|
+
import { TooltipContent } from './tooltip';
|
|
6
|
+
/**
|
|
7
|
+
* The action bar under a chat message: copy, feedback and host-defined actions. Render it inside
|
|
8
|
+
* `MessageContent` after the body so it follows the message `align`.
|
|
9
|
+
*
|
|
10
|
+
* API: `children` render as given (use the built-ins `MessageActionCopy`, `MessageActionFeedback`
|
|
11
|
+
* or any `MessageAction`). Host actions passed as data through `actions` render after them, and
|
|
12
|
+
* any beyond `maxVisible` move into a trailing "More" menu. Data, not children, because a menu
|
|
13
|
+
* item and a bar button need different elements.
|
|
14
|
+
*
|
|
15
|
+
* The parts use Radix tooltips, which throw without a `TooltipProvider`. `MessageActions` provides
|
|
16
|
+
* one, so render them inside it or under your own provider.
|
|
17
|
+
*/
|
|
18
|
+
export interface MessageActionItem {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: React.ReactNode;
|
|
22
|
+
onSelect: () => void;
|
|
23
|
+
/** Tints the item in the overflow menu. */
|
|
24
|
+
destructive?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface MessageActionsOverflowStrings {
|
|
28
|
+
/** Label of the overflow menu trigger. */
|
|
29
|
+
more: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS: MessageActionsOverflowStrings;
|
|
32
|
+
export interface MessageActionsStrings extends MessageActionsOverflowStrings {
|
|
33
|
+
/** Accessible name of the bar. */
|
|
34
|
+
label: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const DEFAULT_MESSAGE_ACTIONS_STRINGS: MessageActionsStrings;
|
|
37
|
+
declare const messageActionsVariants: (props?: ({
|
|
38
|
+
visibility?: "always" | "hover" | null | undefined;
|
|
39
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
40
|
+
export interface MessageActionsProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof messageActionsVariants> {
|
|
41
|
+
/** Host actions as data. Those beyond `maxVisible` go into the overflow menu. */
|
|
42
|
+
actions?: MessageActionItem[];
|
|
43
|
+
/** How many of `actions` show as buttons. `children` are not counted. Defaults to all. */
|
|
44
|
+
maxVisible?: number;
|
|
45
|
+
/** Overrides for any subset of the English strings. An explicit `aria-label` wins over `label`. */
|
|
46
|
+
strings?: Partial<MessageActionsStrings>;
|
|
47
|
+
}
|
|
48
|
+
declare const MessageActions: React.ForwardRefExoticComponent<MessageActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
export interface MessageActionProps extends ButtonProps {
|
|
50
|
+
/** Accessible name and tooltip text. */
|
|
51
|
+
label: string;
|
|
52
|
+
tooltipSide?: React.ComponentPropsWithoutRef<typeof TooltipContent>['side'];
|
|
53
|
+
}
|
|
54
|
+
/** A ghost icon button with a tooltip. Requires an ancestor `TooltipProvider`. */
|
|
55
|
+
declare const MessageAction: React.ForwardRefExoticComponent<MessageActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
56
|
+
export interface MessageActionCopyStrings {
|
|
57
|
+
copy: string;
|
|
58
|
+
copied: string;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_MESSAGE_ACTION_COPY_STRINGS: MessageActionCopyStrings;
|
|
61
|
+
export interface MessageActionCopyProps extends Omit<MessageActionProps, 'label' | 'children' | 'onCopy'> {
|
|
62
|
+
/** The text written to the clipboard. */
|
|
63
|
+
text: string;
|
|
64
|
+
/** Called after the clipboard write succeeds. */
|
|
65
|
+
onCopy?: (text: string) => void;
|
|
66
|
+
strings?: Partial<MessageActionCopyStrings>;
|
|
67
|
+
}
|
|
68
|
+
/** Copies `text` and confirms for a moment. Requires an ancestor `TooltipProvider`. */
|
|
69
|
+
declare const MessageActionCopy: React.ForwardRefExoticComponent<MessageActionCopyProps & React.RefAttributes<HTMLButtonElement>>;
|
|
70
|
+
export type MessageFeedbackValue = 'up' | 'down' | null;
|
|
71
|
+
export interface MessageActionFeedbackStrings {
|
|
72
|
+
/** Accessible name of the pair. */
|
|
73
|
+
label: string;
|
|
74
|
+
helpful: string;
|
|
75
|
+
notHelpful: string;
|
|
76
|
+
}
|
|
77
|
+
export declare const DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS: MessageActionFeedbackStrings;
|
|
78
|
+
export interface MessageActionFeedbackProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
79
|
+
/**
|
|
80
|
+
* Controlled rating. `null` means not yet rated. Once rated it can switch between thumbs but not
|
|
81
|
+
* clear, since chat services record a rating rather than its removal.
|
|
82
|
+
*/
|
|
83
|
+
value?: MessageFeedbackValue;
|
|
84
|
+
defaultValue?: MessageFeedbackValue;
|
|
85
|
+
/** Called with the new rating. Never `null`, since a rating cannot be cleared. */
|
|
86
|
+
onChange?: (value: Exclude<MessageFeedbackValue, null>) => void;
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
strings?: Partial<MessageActionFeedbackStrings>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Thumbs up and down as two toggles, so each reports `aria-pressed`. Requires an ancestor
|
|
92
|
+
* `TooltipProvider`.
|
|
93
|
+
*/
|
|
94
|
+
declare const MessageActionFeedback: React.ForwardRefExoticComponent<MessageActionFeedbackProps & React.RefAttributes<HTMLDivElement>>;
|
|
95
|
+
export interface MessageActionsOverflowProps extends Omit<MessageActionProps, 'label' | 'children'> {
|
|
96
|
+
items: MessageActionItem[];
|
|
97
|
+
strings?: Partial<MessageActionsOverflowStrings>;
|
|
98
|
+
align?: React.ComponentPropsWithoutRef<typeof DropdownMenuContent>['align'];
|
|
99
|
+
}
|
|
100
|
+
/** The "More" menu for actions that do not fit the bar. Requires an ancestor `TooltipProvider`. */
|
|
101
|
+
declare const MessageActionsOverflow: React.ForwardRefExoticComponent<MessageActionsOverflowProps & React.RefAttributes<HTMLButtonElement>>;
|
|
102
|
+
export { MessageActions, MessageAction, MessageActionCopy, MessageActionFeedback, MessageActionsOverflow, messageActionsVariants, };
|