@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.
Files changed (91) hide show
  1. package/dist/components/custom/demo-composer.cjs +80 -0
  2. package/dist/components/custom/demo-composer.d.ts +11 -0
  3. package/dist/components/custom/demo-composer.js +46 -0
  4. package/dist/components/custom/panel-flow.cjs +2 -2
  5. package/dist/components/custom/panel-flow.js +2 -2
  6. package/dist/components/forms/field-control.cjs +3 -2
  7. package/dist/components/forms/field-control.js +3 -2
  8. package/dist/components/forms/validation-converter.cjs +14 -5
  9. package/dist/components/forms/validation-converter.js +14 -5
  10. package/dist/components/ui/chat-composer.cjs +429 -0
  11. package/dist/components/ui/chat-composer.d.ts +157 -0
  12. package/dist/components/ui/chat-composer.js +359 -0
  13. package/dist/components/ui/chat-hero.cjs +244 -0
  14. package/dist/components/ui/chat-hero.d.ts +51 -0
  15. package/dist/components/ui/chat-hero.js +189 -0
  16. package/dist/components/ui/citation.cjs +188 -0
  17. package/dist/components/ui/citation.d.ts +42 -0
  18. package/dist/components/ui/citation.js +148 -0
  19. package/dist/components/ui/date-picker.cjs +6 -5
  20. package/dist/components/ui/date-picker.js +7 -6
  21. package/dist/components/ui/datetime-picker.cjs +7 -10
  22. package/dist/components/ui/datetime-picker.js +8 -11
  23. package/dist/components/ui/dropzone-overlay.cjs +142 -0
  24. package/dist/components/ui/dropzone-overlay.d.ts +27 -0
  25. package/dist/components/ui/dropzone-overlay.js +105 -0
  26. package/dist/components/ui/file-upload.cjs +5 -29
  27. package/dist/components/ui/file-upload.js +2 -26
  28. package/dist/components/ui/file-validation.cjs +91 -0
  29. package/dist/components/ui/file-validation.d.ts +24 -0
  30. package/dist/components/ui/file-validation.js +51 -0
  31. package/dist/components/ui/hover-card.cjs +15 -8
  32. package/dist/components/ui/hover-card.d.ts +4 -1
  33. package/dist/components/ui/hover-card.js +16 -9
  34. package/dist/components/ui/index.cjs +304 -216
  35. package/dist/components/ui/index.d.ts +8 -0
  36. package/dist/components/ui/index.js +8 -0
  37. package/dist/components/ui/input-group.cjs +1 -1
  38. package/dist/components/ui/input-group.d.ts +2 -1
  39. package/dist/components/ui/input-group.js +1 -1
  40. package/dist/components/ui/message-actions.cjs +302 -0
  41. package/dist/components/ui/message-actions.d.ts +102 -0
  42. package/dist/components/ui/message-actions.js +241 -0
  43. package/dist/components/ui/message.cjs +1 -1
  44. package/dist/components/ui/message.d.ts +2 -0
  45. package/dist/components/ui/message.js +1 -1
  46. package/dist/components/ui/prompt-suggestions.cjs +133 -0
  47. package/dist/components/ui/prompt-suggestions.d.ts +52 -0
  48. package/dist/components/ui/prompt-suggestions.js +90 -0
  49. package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
  50. package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
  51. package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
  52. package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
  53. package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
  54. package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
  55. package/dist/components/ui/quick-form-field/index.d.ts +1 -1
  56. package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
  57. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
  58. package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
  59. package/dist/components/ui/quick-form-field/types.cjs +2 -2
  60. package/dist/components/ui/quick-form-field/types.d.ts +39 -32
  61. package/dist/components/ui/quick-form-field/types.js +2 -2
  62. package/dist/components/ui/quick-form-field/utils.cjs +5 -59
  63. package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
  64. package/dist/components/ui/quick-form-field/utils.js +3 -48
  65. package/dist/components/ui/sources.cjs +175 -0
  66. package/dist/components/ui/sources.d.ts +44 -0
  67. package/dist/components/ui/sources.js +132 -0
  68. package/dist/index.cjs +156 -7
  69. package/dist/index.d.ts +17 -1
  70. package/dist/index.js +9 -1
  71. package/dist/lib/date-value.cjs +46 -0
  72. package/dist/lib/date-value.d.ts +8 -0
  73. package/dist/lib/date-value.js +12 -0
  74. package/dist/lib/index.cjs +8 -1
  75. package/dist/lib/index.d.ts +1 -0
  76. package/dist/lib/index.js +2 -1
  77. package/dist/lib/url.cjs +54 -0
  78. package/dist/lib/url.d.ts +8 -0
  79. package/dist/lib/url.js +17 -0
  80. package/dist/styles.css +239 -78
  81. package/dist/tailwind.utilities.css +15 -0
  82. package/package.json +1 -1
  83. package/dist/components/custom/chat-composer.cjs +0 -134
  84. package/dist/components/custom/chat-composer.d.ts +0 -14
  85. package/dist/components/custom/chat-composer.js +0 -100
  86. package/dist/components/custom/chat-first-experience.cjs +0 -87
  87. package/dist/components/custom/chat-first-experience.d.ts +0 -24
  88. package/dist/components/custom/chat-first-experience.js +0 -53
  89. package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
  90. package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
  91. package/dist/components/custom/chat-prompt-suggestions.js +0 -15
@@ -0,0 +1,241 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { Check, Copy, Ellipsis, ThumbsDown, ThumbsUp } from "lucide-react";
5
+ import { forwardRef, useEffect, useRef, useState } from "react";
6
+ import { cn } from "../../lib/index.js";
7
+ import { copyTextToClipboard } from "../../lib/clipboard.js";
8
+ import { Button } from "./button.js";
9
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.js";
10
+ import { Toggle } from "./toggle.js";
11
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
12
+ const DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS = {
13
+ more: 'More actions'
14
+ };
15
+ const DEFAULT_MESSAGE_ACTIONS_STRINGS = {
16
+ ...DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS,
17
+ label: 'Message actions'
18
+ };
19
+ const messageActionsVariants = cva('flex w-fit max-w-full items-center gap-0.5 px-2', {
20
+ variants: {
21
+ visibility: {
22
+ always: '',
23
+ 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'
24
+ }
25
+ },
26
+ defaultVariants: {
27
+ visibility: 'always'
28
+ }
29
+ });
30
+ const MessageActions = /*#__PURE__*/ forwardRef(({ className, visibility = 'always', actions = [], maxVisible, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
31
+ const text = {
32
+ ...DEFAULT_MESSAGE_ACTIONS_STRINGS,
33
+ ...strings
34
+ };
35
+ const limit = void 0 === maxVisible ? actions.length : Math.max(0, maxVisible);
36
+ const visible = actions.slice(0, limit);
37
+ const overflow = actions.slice(limit);
38
+ return /*#__PURE__*/ jsx(TooltipProvider, {
39
+ delayDuration: 300,
40
+ skipDelayDuration: 150,
41
+ children: /*#__PURE__*/ jsxs("div", {
42
+ ref: ref,
43
+ role: "group",
44
+ "aria-label": ariaLabel ?? text.label,
45
+ "data-slot": "message-actions",
46
+ "data-visibility": visibility,
47
+ className: cn(messageActionsVariants({
48
+ visibility
49
+ }), className),
50
+ ...props,
51
+ children: [
52
+ children,
53
+ visible.map((action)=>/*#__PURE__*/ jsx(MessageAction, {
54
+ label: action.label,
55
+ disabled: action.disabled,
56
+ onClick: action.onSelect,
57
+ children: action.icon
58
+ }, action.id)),
59
+ overflow.length > 0 && /*#__PURE__*/ jsx(MessageActionsOverflow, {
60
+ items: overflow,
61
+ strings: {
62
+ more: text.more
63
+ }
64
+ })
65
+ ]
66
+ })
67
+ });
68
+ });
69
+ MessageActions.displayName = 'MessageActions';
70
+ const MessageAction = /*#__PURE__*/ forwardRef(({ label, tooltipSide = 'bottom', variant = 'ghost', size = '3xs', icon = true, ...props }, ref)=>/*#__PURE__*/ jsxs(Tooltip, {
71
+ children: [
72
+ /*#__PURE__*/ jsx(TooltipTrigger, {
73
+ asChild: true,
74
+ children: /*#__PURE__*/ jsx(Button, {
75
+ ref: ref,
76
+ "data-slot": "message-action",
77
+ "aria-label": label,
78
+ variant: variant,
79
+ size: size,
80
+ icon: icon,
81
+ ...props
82
+ })
83
+ }),
84
+ /*#__PURE__*/ jsx(TooltipContent, {
85
+ side: tooltipSide,
86
+ children: label
87
+ })
88
+ ]
89
+ }));
90
+ MessageAction.displayName = 'MessageAction';
91
+ const DEFAULT_MESSAGE_ACTION_COPY_STRINGS = {
92
+ copy: 'Copy',
93
+ copied: 'Copied'
94
+ };
95
+ const COPIED_RESET_MS = 1500;
96
+ const MessageActionCopy = /*#__PURE__*/ forwardRef(({ text: copyText, onCopy, strings, onClick, ...props }, ref)=>{
97
+ const text = {
98
+ ...DEFAULT_MESSAGE_ACTION_COPY_STRINGS,
99
+ ...strings
100
+ };
101
+ const [copied, setCopied] = useState(false);
102
+ const timer = useRef(void 0);
103
+ useEffect(()=>()=>clearTimeout(timer.current), []);
104
+ const handleClick = async (event)=>{
105
+ onClick?.(event);
106
+ if (event.defaultPrevented) return;
107
+ if (!await copyTextToClipboard(copyText)) return;
108
+ onCopy?.(copyText);
109
+ setCopied(true);
110
+ clearTimeout(timer.current);
111
+ timer.current = setTimeout(()=>setCopied(false), COPIED_RESET_MS);
112
+ };
113
+ return /*#__PURE__*/ jsxs(Fragment, {
114
+ children: [
115
+ /*#__PURE__*/ jsx(MessageAction, {
116
+ ref: ref,
117
+ "data-copied": copied || void 0,
118
+ label: copied ? text.copied : text.copy,
119
+ onClick: handleClick,
120
+ ...props,
121
+ children: copied ? /*#__PURE__*/ jsx(Check, {}) : /*#__PURE__*/ jsx(Copy, {})
122
+ }),
123
+ /*#__PURE__*/ jsx("output", {
124
+ "aria-live": "polite",
125
+ className: "sr-only",
126
+ children: copied ? text.copied : ''
127
+ })
128
+ ]
129
+ });
130
+ });
131
+ MessageActionCopy.displayName = 'MessageActionCopy';
132
+ const DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS = {
133
+ label: 'Rate this response',
134
+ helpful: 'Helpful',
135
+ notHelpful: 'Not helpful'
136
+ };
137
+ const feedbackToggleClass = 'size-6 min-w-6 px-0 aria-pressed:bg-accent aria-pressed:text-accent-foreground future:aria-pressed:text-foreground';
138
+ const MessageActionFeedback = /*#__PURE__*/ forwardRef(({ value: valueProp, defaultValue = null, onChange, disabled, strings, className, 'aria-label': ariaLabel, ...props }, ref)=>{
139
+ const text = {
140
+ ...DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS,
141
+ ...strings
142
+ };
143
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
144
+ const value = void 0 === valueProp ? uncontrolled : valueProp;
145
+ const set = (next)=>{
146
+ if (next === value) return;
147
+ if (void 0 === valueProp) setUncontrolled(next);
148
+ onChange?.(next);
149
+ };
150
+ const thumbs = [
151
+ {
152
+ rating: 'up',
153
+ label: text.helpful,
154
+ icon: /*#__PURE__*/ jsx(ThumbsUp, {})
155
+ },
156
+ {
157
+ rating: 'down',
158
+ label: text.notHelpful,
159
+ icon: /*#__PURE__*/ jsx(ThumbsDown, {})
160
+ }
161
+ ];
162
+ return /*#__PURE__*/ jsx("div", {
163
+ ref: ref,
164
+ role: "group",
165
+ "aria-label": ariaLabel ?? text.label,
166
+ "data-slot": "message-action-feedback",
167
+ "data-value": value ?? void 0,
168
+ className: cn('flex items-center gap-0.5', className),
169
+ ...props,
170
+ children: thumbs.map(({ rating, label, icon })=>/*#__PURE__*/ jsxs(Tooltip, {
171
+ children: [
172
+ /*#__PURE__*/ jsx(TooltipTrigger, {
173
+ asChild: true,
174
+ children: /*#__PURE__*/ jsx(Toggle, {
175
+ "data-slot": "message-action",
176
+ size: "xs",
177
+ className: feedbackToggleClass,
178
+ "aria-label": label,
179
+ pressed: value === rating,
180
+ onPressedChange: ()=>set(rating),
181
+ disabled: disabled,
182
+ children: icon
183
+ })
184
+ }),
185
+ /*#__PURE__*/ jsx(TooltipContent, {
186
+ side: "bottom",
187
+ children: label
188
+ })
189
+ ]
190
+ }, rating))
191
+ });
192
+ });
193
+ MessageActionFeedback.displayName = 'MessageActionFeedback';
194
+ const MessageActionsOverflow = /*#__PURE__*/ forwardRef(({ items, strings, align = 'start', tooltipSide = 'bottom', ...props }, ref)=>{
195
+ const text = {
196
+ ...DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS,
197
+ ...strings
198
+ };
199
+ return /*#__PURE__*/ jsxs(DropdownMenu, {
200
+ children: [
201
+ /*#__PURE__*/ jsxs(Tooltip, {
202
+ children: [
203
+ /*#__PURE__*/ jsx(DropdownMenuTrigger, {
204
+ asChild: true,
205
+ children: /*#__PURE__*/ jsx(TooltipTrigger, {
206
+ asChild: true,
207
+ children: /*#__PURE__*/ jsx(Button, {
208
+ ref: ref,
209
+ "data-slot": "message-actions-overflow",
210
+ "aria-label": text.more,
211
+ variant: "ghost",
212
+ size: "3xs",
213
+ icon: true,
214
+ ...props,
215
+ children: /*#__PURE__*/ jsx(Ellipsis, {})
216
+ })
217
+ })
218
+ }),
219
+ /*#__PURE__*/ jsx(TooltipContent, {
220
+ side: tooltipSide,
221
+ children: text.more
222
+ })
223
+ ]
224
+ }),
225
+ /*#__PURE__*/ jsx(DropdownMenuContent, {
226
+ align: align,
227
+ children: items.map((item)=>/*#__PURE__*/ jsxs(DropdownMenuItem, {
228
+ disabled: item.disabled,
229
+ onSelect: item.onSelect,
230
+ className: cn(item.destructive && 'text-error focus:bg-error-background focus:text-error'),
231
+ children: [
232
+ item.icon,
233
+ item.label
234
+ ]
235
+ }, item.id))
236
+ })
237
+ ]
238
+ });
239
+ });
240
+ MessageActionsOverflow.displayName = 'MessageActionsOverflow';
241
+ export { DEFAULT_MESSAGE_ACTIONS_OVERFLOW_STRINGS, DEFAULT_MESSAGE_ACTIONS_STRINGS, DEFAULT_MESSAGE_ACTION_COPY_STRINGS, DEFAULT_MESSAGE_ACTION_FEEDBACK_STRINGS, MessageAction, MessageActionCopy, MessageActionFeedback, MessageActions, MessageActionsOverflow, messageActionsVariants };
@@ -52,7 +52,7 @@ Message.displayName = 'Message';
52
52
  const MessageAvatar = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
53
53
  ref: ref,
54
54
  "data-slot": "message-avatar",
55
- className: (0, index_cjs_namespaceObject.cn)('flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-[[data-slot=message-footer]]/message:-translate-y-8', className),
55
+ className: (0, index_cjs_namespaceObject.cn)('flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-[[data-slot=message-footer]]/message:-translate-y-8 group-has-[[data-slot=message-actions]]/message:-translate-y-10 group-has-[[data-slot=message-footer]]/message:group-has-[[data-slot=message-actions]]/message:-translate-y-16', className),
56
56
  ...props
57
57
  }));
58
58
  MessageAvatar.displayName = 'MessageAvatar';
@@ -3,6 +3,8 @@ import * as React from 'react';
3
3
  * Chat conversation row primitives, ported from shadcn/ui's chat components. A `Message` lays out
4
4
  * one turn: an optional `MessageAvatar`, then `MessageContent` holding a `MessageHeader`, the body
5
5
  * (usually a `Bubble`) and a `MessageFooter`. `align="end"` mirrors the row for the current user.
6
+ * A `MessageActions` bar goes inside `MessageContent` after the body, so it takes the same
7
+ * alignment as the bubble.
6
8
  */
7
9
  declare const MessageGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
10
  export interface MessageProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -19,7 +19,7 @@ Message.displayName = 'Message';
19
19
  const MessageAvatar = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
20
20
  ref: ref,
21
21
  "data-slot": "message-avatar",
22
- className: cn('flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-[[data-slot=message-footer]]/message:-translate-y-8', className),
22
+ className: cn('flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-[[data-slot=message-footer]]/message:-translate-y-8 group-has-[[data-slot=message-actions]]/message:-translate-y-10 group-has-[[data-slot=message-footer]]/message:group-has-[[data-slot=message-actions]]/message:-translate-y-16', className),
23
23
  ...props
24
24
  }));
25
25
  MessageAvatar.displayName = 'MessageAvatar';
@@ -0,0 +1,133 @@
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_PROMPT_SUGGESTIONS_STRINGS: ()=>DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
29
+ PromptSuggestions: ()=>PromptSuggestions,
30
+ promptSuggestionsListVariants: ()=>promptSuggestionsListVariants,
31
+ promptSuggestionVariants: ()=>promptSuggestionVariants
32
+ });
33
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
34
+ const external_class_variance_authority_namespaceObject = require("class-variance-authority");
35
+ const external_react_namespaceObject = require("react");
36
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
37
+ const DEFAULT_PROMPT_SUGGESTIONS_STRINGS = {
38
+ label: 'Suggestions'
39
+ };
40
+ const promptSuggestionsListVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex min-w-0 gap-2', {
41
+ variants: {
42
+ orientation: {
43
+ vertical: 'flex-col items-start',
44
+ horizontal: '-mx-1 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none overflow-x-auto overscroll-x-contain px-1 py-1'
45
+ }
46
+ },
47
+ defaultVariants: {
48
+ orientation: 'vertical'
49
+ }
50
+ });
51
+ const promptSuggestionVariants = (0, external_class_variance_authority_namespaceObject.cva)('inline-flex max-w-full cursor-pointer items-center border border-border-subtle bg-surface-raised text-left font-normal text-foreground transition-colors hover:border-border hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', {
52
+ variants: {
53
+ density: {
54
+ comfortable: 'gap-2 px-4 py-2 text-sm leading-5 [&_svg]:size-4 rounded-xl',
55
+ compact: 'gap-1.5 px-2 py-1 text-xs leading-4 [&_svg]:size-3.5 rounded-lg'
56
+ },
57
+ orientation: {
58
+ vertical: 'whitespace-normal',
59
+ horizontal: 'flex-none snap-start whitespace-nowrap'
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ density: 'comfortable',
64
+ orientation: 'vertical'
65
+ }
66
+ });
67
+ const PromptSuggestions = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, suggestions, onSelect, orientation, density, showLabel = false, animated = false, disabled = false, strings, ...props }, ref)=>{
68
+ const labelId = external_react_namespaceObject.useId();
69
+ const resolvedOrientation = orientation ?? 'vertical';
70
+ const resolvedDensity = density ?? 'comfortable';
71
+ const text = {
72
+ ...DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
73
+ ...strings
74
+ };
75
+ if (0 === suggestions.length) return null;
76
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
77
+ ref: ref,
78
+ role: "group",
79
+ "aria-label": showLabel ? void 0 : text.label,
80
+ "aria-labelledby": showLabel ? labelId : void 0,
81
+ "data-slot": "prompt-suggestions",
82
+ "data-orientation": resolvedOrientation,
83
+ "data-density": resolvedDensity,
84
+ className: (0, index_cjs_namespaceObject.cn)('flex w-full min-w-0 flex-col gap-1', animated && 'animate-slide-in-from-bottom', className),
85
+ ...props,
86
+ children: [
87
+ showLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
88
+ id: labelId,
89
+ "data-slot": "prompt-suggestions-label",
90
+ className: (0, index_cjs_namespaceObject.cn)('text-start font-semibold text-foreground', 'compact' === resolvedDensity ? 'text-xs leading-4' : 'text-sm leading-5'),
91
+ children: text.label
92
+ }),
93
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
94
+ "data-slot": "prompt-suggestions-list",
95
+ className: promptSuggestionsListVariants({
96
+ orientation: resolvedOrientation
97
+ }),
98
+ children: suggestions.map((suggestion, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
99
+ type: "button",
100
+ "data-slot": "prompt-suggestion",
101
+ "data-index": index,
102
+ disabled: disabled,
103
+ className: promptSuggestionVariants({
104
+ density: resolvedDensity,
105
+ orientation: resolvedOrientation
106
+ }),
107
+ onClick: ()=>onSelect?.(suggestion),
108
+ children: [
109
+ suggestion.icon,
110
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
111
+ className: "min-w-0",
112
+ children: suggestion.label
113
+ })
114
+ ]
115
+ }, suggestion.id ?? suggestion.label))
116
+ })
117
+ ]
118
+ });
119
+ });
120
+ PromptSuggestions.displayName = 'PromptSuggestions';
121
+ exports.DEFAULT_PROMPT_SUGGESTIONS_STRINGS = __webpack_exports__.DEFAULT_PROMPT_SUGGESTIONS_STRINGS;
122
+ exports.PromptSuggestions = __webpack_exports__.PromptSuggestions;
123
+ exports.promptSuggestionVariants = __webpack_exports__.promptSuggestionVariants;
124
+ exports.promptSuggestionsListVariants = __webpack_exports__.promptSuggestionsListVariants;
125
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
126
+ "DEFAULT_PROMPT_SUGGESTIONS_STRINGS",
127
+ "PromptSuggestions",
128
+ "promptSuggestionVariants",
129
+ "promptSuggestionsListVariants"
130
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
131
+ Object.defineProperty(exports, '__esModule', {
132
+ value: true
133
+ });
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Prompts the user can pick instead of typing, as a group of chips. `onSelect` receives the
4
+ * suggestion; whether that sends it or puts it in the composer is the caller's call:
5
+ *
6
+ * ```tsx
7
+ * <PromptSuggestions
8
+ * suggestions={[{ label: 'Summarize', prompt: 'Summarize this conversation' }]}
9
+ * onSelect={({ label, prompt }) => send(prompt ?? label)}
10
+ * />
11
+ * ```
12
+ */
13
+ export interface PromptSuggestionsStrings {
14
+ /** Accessible name of the group, and its visible title with `showLabel`. */
15
+ label: string;
16
+ }
17
+ export declare const DEFAULT_PROMPT_SUGGESTIONS_STRINGS: PromptSuggestionsStrings;
18
+ /** One chip. Shaped so a chat service's `{ label, prompt }` suggestions pass straight in. */
19
+ export interface PromptSuggestionItem {
20
+ label: string;
21
+ /** The text to send or prefill, when it differs from the label. */
22
+ prompt?: string;
23
+ /** Keys the chip. Defaults to `label`. */
24
+ id?: string;
25
+ /** Leading icon. */
26
+ icon?: React.ReactNode;
27
+ }
28
+ export type PromptSuggestionsDensity = 'comfortable' | 'compact';
29
+ declare const promptSuggestionsListVariants: (props?: ({
30
+ orientation?: "horizontal" | "vertical" | null | undefined;
31
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
32
+ declare const promptSuggestionVariants: (props?: ({
33
+ density?: "compact" | "comfortable" | null | undefined;
34
+ orientation?: "horizontal" | "vertical" | null | undefined;
35
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
36
+ export type PromptSuggestionsOrientation = 'vertical' | 'horizontal';
37
+ export interface PromptSuggestionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'children'> {
38
+ suggestions: PromptSuggestionItem[];
39
+ onSelect?: (suggestion: PromptSuggestionItem) => void;
40
+ orientation?: PromptSuggestionsOrientation;
41
+ density?: PromptSuggestionsDensity;
42
+ /** Shows `strings.label` as a title above the chips, as a chat does after a reply. */
43
+ showLabel?: boolean;
44
+ /** Slides the group in from below when it mounts. Only fades under reduced motion. */
45
+ animated?: boolean;
46
+ disabled?: boolean;
47
+ /** Overrides for any subset of the English strings. */
48
+ strings?: Partial<PromptSuggestionsStrings>;
49
+ }
50
+ /** Stacks vertically by default; `horizontal` keeps one row that scrolls when it overflows. */
51
+ declare const PromptSuggestions: React.ForwardRefExoticComponent<PromptSuggestionsProps & React.RefAttributes<HTMLDivElement>>;
52
+ export { PromptSuggestions, promptSuggestionsListVariants, promptSuggestionVariants };
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { forwardRef, useId } from "react";
5
+ import { cn } from "../../lib/index.js";
6
+ const DEFAULT_PROMPT_SUGGESTIONS_STRINGS = {
7
+ label: 'Suggestions'
8
+ };
9
+ const promptSuggestionsListVariants = cva('flex min-w-0 gap-2', {
10
+ variants: {
11
+ orientation: {
12
+ vertical: 'flex-col items-start',
13
+ horizontal: '-mx-1 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none overflow-x-auto overscroll-x-contain px-1 py-1'
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ orientation: 'vertical'
18
+ }
19
+ });
20
+ const promptSuggestionVariants = cva('inline-flex max-w-full cursor-pointer items-center border border-border-subtle bg-surface-raised text-left font-normal text-foreground transition-colors hover:border-border hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', {
21
+ variants: {
22
+ density: {
23
+ comfortable: 'gap-2 px-4 py-2 text-sm leading-5 [&_svg]:size-4 rounded-xl',
24
+ compact: 'gap-1.5 px-2 py-1 text-xs leading-4 [&_svg]:size-3.5 rounded-lg'
25
+ },
26
+ orientation: {
27
+ vertical: 'whitespace-normal',
28
+ horizontal: 'flex-none snap-start whitespace-nowrap'
29
+ }
30
+ },
31
+ defaultVariants: {
32
+ density: 'comfortable',
33
+ orientation: 'vertical'
34
+ }
35
+ });
36
+ const PromptSuggestions = /*#__PURE__*/ forwardRef(({ className, suggestions, onSelect, orientation, density, showLabel = false, animated = false, disabled = false, strings, ...props }, ref)=>{
37
+ const labelId = useId();
38
+ const resolvedOrientation = orientation ?? 'vertical';
39
+ const resolvedDensity = density ?? 'comfortable';
40
+ const text = {
41
+ ...DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
42
+ ...strings
43
+ };
44
+ if (0 === suggestions.length) return null;
45
+ return /*#__PURE__*/ jsxs("div", {
46
+ ref: ref,
47
+ role: "group",
48
+ "aria-label": showLabel ? void 0 : text.label,
49
+ "aria-labelledby": showLabel ? labelId : void 0,
50
+ "data-slot": "prompt-suggestions",
51
+ "data-orientation": resolvedOrientation,
52
+ "data-density": resolvedDensity,
53
+ className: cn('flex w-full min-w-0 flex-col gap-1', animated && 'animate-slide-in-from-bottom', className),
54
+ ...props,
55
+ children: [
56
+ showLabel && /*#__PURE__*/ jsx("div", {
57
+ id: labelId,
58
+ "data-slot": "prompt-suggestions-label",
59
+ className: cn('text-start font-semibold text-foreground', 'compact' === resolvedDensity ? 'text-xs leading-4' : 'text-sm leading-5'),
60
+ children: text.label
61
+ }),
62
+ /*#__PURE__*/ jsx("div", {
63
+ "data-slot": "prompt-suggestions-list",
64
+ className: promptSuggestionsListVariants({
65
+ orientation: resolvedOrientation
66
+ }),
67
+ children: suggestions.map((suggestion, index)=>/*#__PURE__*/ jsxs("button", {
68
+ type: "button",
69
+ "data-slot": "prompt-suggestion",
70
+ "data-index": index,
71
+ disabled: disabled,
72
+ className: promptSuggestionVariants({
73
+ density: resolvedDensity,
74
+ orientation: resolvedOrientation
75
+ }),
76
+ onClick: ()=>onSelect?.(suggestion),
77
+ children: [
78
+ suggestion.icon,
79
+ /*#__PURE__*/ jsx("span", {
80
+ className: "min-w-0",
81
+ children: suggestion.label
82
+ })
83
+ ]
84
+ }, suggestion.id ?? suggestion.label))
85
+ })
86
+ ]
87
+ });
88
+ });
89
+ PromptSuggestions.displayName = 'PromptSuggestions';
90
+ export { DEFAULT_PROMPT_SUGGESTIONS_STRINGS, PromptSuggestions, promptSuggestionVariants, promptSuggestionsListVariants };
@@ -39,7 +39,7 @@ const ai_assist_action_cjs_namespaceObject = require("../../field-actions/ai-ass
39
39
  const collapse_cjs_namespaceObject = require("../../field-actions/collapse.cjs");
40
40
  const insert_variable_action_cjs_namespaceObject = require("../../field-actions/insert-variable-action.cjs");
41
41
  const external_types_cjs_namespaceObject = require("../types.cjs");
42
- function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = external_types_cjs_namespaceObject.FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
42
+ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = external_types_cjs_namespaceObject.FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
43
43
  const [pickerItems, optionsBySelectionId] = (0, external_react_namespaceObject.useMemo)(()=>{
44
44
  const byId = new Map();
45
45
  const toItem = (v, id)=>{
@@ -97,7 +97,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
97
97
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
98
98
  type: "button",
99
99
  "aria-label": strings.fieldTypeAriaLabel,
100
- className: (0, index_cjs_namespaceObject.cn)('flex h-7 items-center gap-1 rounded-lg px-2 text-[11px] text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground', collapsedPaddingClass),
100
+ disabled: disabled,
101
+ className: (0, index_cjs_namespaceObject.cn)('flex h-7 items-center gap-1 rounded-lg px-2 text-[11px] text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50', collapsedPaddingClass),
101
102
  children: [
102
103
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(typeMeta.icon, {
103
104
  size: 12
@@ -155,6 +156,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
155
156
  size: "sm",
156
157
  checked: !!required,
157
158
  onCheckedChange: onRequiredChange,
159
+ disabled: disabled,
158
160
  className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
159
161
  "aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
160
162
  })
@@ -179,7 +181,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
179
181
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
180
182
  type: "button",
181
183
  "aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel,
182
- className: "grid size-7 place-items-center rounded-lg text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground",
184
+ disabled: disabled,
185
+ className: "grid size-7 place-items-center rounded-lg text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
183
186
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Asterisk, {
184
187
  size: 12
185
188
  })
@@ -205,6 +208,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
205
208
  size: "sm",
206
209
  checked: !!required,
207
210
  onCheckedChange: onRequiredChange,
211
+ disabled: disabled,
208
212
  className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
209
213
  "aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
210
214
  })
@@ -220,7 +224,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
220
224
  children: [
221
225
  onGenerateWithAi && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ai_assist_action_cjs_namespaceObject.AiAssistAction, {
222
226
  onGenerate: onGenerateWithAi,
223
- hint: strings.aiOutputHint(strings.aiOutputLabel(typeLabel, typeMeta.supportsExpression)),
227
+ disabled: disabled,
228
+ hint: strings.aiOutputHint(strings.aiOutputLabel(typeLabel, isExpression)),
224
229
  strings: {
225
230
  trigger: strings.aiAssistAriaLabel,
226
231
  tooltip: strings.aiAssistTooltip,
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { QuickFieldType, QuickFormFieldOption, QuickFormFieldStrings } from '../types';
3
- export declare function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes, onFieldTypeChange, onRequiredChange, compact, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions, }: {
3
+ export declare function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions, }: {
4
4
  label?: ReactNode;
5
5
  fieldId: string;
6
6
  fieldLabel: string;
@@ -11,6 +11,9 @@ export declare function FieldHeader({ label, fieldId, fieldLabel, required, fiel
11
11
  onFieldTypeChange?: (fieldType: QuickFieldType) => void;
12
12
  onRequiredChange?: (required: boolean) => void;
13
13
  compact?: boolean;
14
+ disabled: boolean;
15
+ /** Whether the AI output is described as an expression rather than a value. */
16
+ isExpression: boolean;
14
17
  showFieldActions: boolean;
15
18
  onValueChange?: (value: string) => void;
16
19
  variables: QuickFormFieldOption[];