@uipath/apollo-wind 2.88.0 → 2.90.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 (34) hide show
  1. package/dist/components/ui/field-actions/ai-assist-action.cjs +32 -8
  2. package/dist/components/ui/field-actions/ai-assist-action.d.ts +25 -2
  3. package/dist/components/ui/field-actions/ai-assist-action.js +33 -9
  4. package/dist/components/ui/field-actions/collapse.cjs +7 -3
  5. package/dist/components/ui/field-actions/collapse.d.ts +2 -0
  6. package/dist/components/ui/field-actions/collapse.js +3 -2
  7. package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
  8. package/dist/components/ui/index.cjs +162 -149
  9. package/dist/components/ui/index.d.ts +2 -1
  10. package/dist/components/ui/index.js +1 -0
  11. package/dist/components/ui/input-group.cjs +57 -5
  12. package/dist/components/ui/input-group.d.ts +2 -0
  13. package/dist/components/ui/input-group.js +58 -6
  14. package/dist/components/ui/password-input.cjs +95 -0
  15. package/dist/components/ui/password-input.d.ts +14 -0
  16. package/dist/components/ui/password-input.js +61 -0
  17. package/dist/components/ui/prompt-editor/components/TokenPill.cjs +1 -1
  18. package/dist/components/ui/prompt-editor/components/TokenPill.js +1 -1
  19. package/dist/components/ui/prompt-editor/types.d.ts +6 -0
  20. package/dist/components/ui/reference-chip-colors.cjs +6 -0
  21. package/dist/components/ui/reference-chip-colors.d.ts +14 -0
  22. package/dist/components/ui/reference-chip-colors.js +6 -0
  23. package/dist/components/ui/reference-chip.cjs +6 -7
  24. package/dist/components/ui/reference-chip.d.ts +3 -0
  25. package/dist/components/ui/reference-chip.js +6 -7
  26. package/dist/components/ui/variable-picker/variable-picker.cjs +1 -1
  27. package/dist/components/ui/variable-picker/variable-picker.d.ts +2 -1
  28. package/dist/components/ui/variable-picker/variable-picker.js +1 -1
  29. package/dist/components/ui/variable-value-control.d.ts +5 -2
  30. package/dist/index.cjs +5 -1
  31. package/dist/index.d.ts +3 -1
  32. package/dist/index.js +2 -1
  33. package/dist/styles.css +104 -10
  34. package/package.json +1 -1
@@ -35,6 +35,7 @@ const external_label_cjs_namespaceObject = require("../label.cjs");
35
35
  const external_popover_cjs_namespaceObject = require("../popover.cjs");
36
36
  const external_textarea_cjs_namespaceObject = require("../textarea.cjs");
37
37
  const external_tooltip_cjs_namespaceObject = require("../tooltip.cjs");
38
+ const index_cjs_namespaceObject = require("../../../lib/index.cjs");
38
39
  const external_collapse_cjs_namespaceObject = require("./collapse.cjs");
39
40
  const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
40
41
  trigger: 'AI assist',
@@ -45,22 +46,36 @@ const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
45
46
  generating: 'Generating',
46
47
  error: 'Could not generate a value. Try again.'
47
48
  };
48
- function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings }) {
49
+ function AiAssistAction({ onGenerate, hint, renderContent, disabled, open: openProp, onOpenChange, loading = false, error, className, size = '3xs', strings }) {
49
50
  const promptId = (0, external_react_namespaceObject.useId)();
50
51
  const errorId = (0, external_react_namespaceObject.useId)();
52
+ const triggerErrorId = (0, external_react_namespaceObject.useId)();
51
53
  const [prompt, setPrompt] = (0, external_react_namespaceObject.useState)('');
52
- const [open, setOpen] = (0, external_react_namespaceObject.useState)(false);
54
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, external_react_namespaceObject.useState)(false);
53
55
  const [pending, setPending] = (0, external_react_namespaceObject.useState)(false);
54
56
  const [failed, setFailed] = (0, external_react_namespaceObject.useState)(false);
55
57
  const text = {
56
58
  ...DEFAULT_AI_ASSIST_ACTION_STRINGS,
57
59
  ...strings
58
60
  };
61
+ const hasError = !!error;
62
+ const errorMessage = hasError && true !== error ? error : null;
63
+ const controlled = void 0 !== openProp;
64
+ const open = controlled ? openProp : uncontrolledOpen;
65
+ const setOpen = (0, external_react_namespaceObject.useCallback)((next)=>{
66
+ if (!controlled) setUncontrolledOpen(next);
67
+ onOpenChange?.(next);
68
+ }, [
69
+ controlled,
70
+ onOpenChange
71
+ ]);
59
72
  const changeOpen = (next)=>{
60
73
  setFailed(false);
61
74
  setOpen(next);
62
75
  };
63
- const close = (0, external_react_namespaceObject.useCallback)(()=>setOpen(false), []);
76
+ const close = (0, external_react_namespaceObject.useCallback)(()=>setOpen(false), [
77
+ setOpen
78
+ ]);
64
79
  const generate = async ()=>{
65
80
  setFailed(false);
66
81
  const result = onGenerate?.(prompt);
@@ -81,27 +96,36 @@ function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings })
81
96
  children: [
82
97
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
83
98
  children: [
84
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
99
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
85
100
  asChild: true,
86
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
101
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
87
102
  asChild: true,
88
103
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
89
104
  type: "button",
90
105
  variant: "ghost",
91
- size: "3xs",
106
+ size: size,
92
107
  icon: true,
93
108
  "aria-label": text.trigger,
94
109
  disabled: disabled,
95
- className: external_collapse_cjs_namespaceObject.FIELD_ACTION_CLASS,
110
+ "aria-busy": loading || void 0,
111
+ ...errorMessage ? {
112
+ 'aria-describedby': triggerErrorId
113
+ } : {},
114
+ className: (0, index_cjs_namespaceObject.cn)('3xs' === size ? external_collapse_cjs_namespaceObject.FIELD_ACTION_CLASS : external_collapse_cjs_namespaceObject.FIELD_ACTION_TONE_CLASS, hasError && 'text-error hover:text-error future:text-error future:hover:text-error', loading && 'animate-glow cursor-progress [--glow-color:var(--color-gradient-agent-start)]', className),
96
115
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Sparkles, {})
97
116
  })
98
117
  })
99
118
  }),
100
119
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
101
- children: text.tooltip
120
+ children: loading ? text.generating : errorMessage ?? text.tooltip
102
121
  })
103
122
  ]
104
123
  }),
124
+ errorMessage && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
125
+ id: triggerErrorId,
126
+ className: "sr-only",
127
+ children: errorMessage
128
+ }),
105
129
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
106
130
  align: "end",
107
131
  className: "space-y-3",
@@ -1,11 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
+ import { type ButtonProps } from '../button';
2
3
  export interface AiAssistActionStrings {
3
4
  trigger: string;
4
5
  tooltip: string;
5
6
  prompt: string;
6
7
  promptPlaceholder: string;
7
8
  generate: string;
8
- /** Replaces `generate` while a returned promise is pending. */
9
+ /** Replaces `generate` while a returned promise is pending, and `tooltip` while `loading`. */
9
10
  generating: string;
10
11
  /** Shown when a returned promise rejects. */
11
12
  error: string;
@@ -33,10 +34,32 @@ export interface AiAssistActionProps {
33
34
  * `hint` and prompt strings it then does not use. Called only while the popover is open.
34
35
  */
35
36
  renderContent?: (props: AiAssistContentProps) => ReactNode;
37
+ /** Controlled open state of the popover, such as for a host that closes it on submit. */
38
+ open?: boolean;
39
+ /** Called when the popover asks to open or close, and from `close`. */
40
+ onOpenChange?: (open: boolean) => void;
41
+ /**
42
+ * Shows the trigger busy for work the host runs, such as a `renderContent` panel's generation.
43
+ * The trigger glows and reads as busy, and still opens, so the panel can show the work in
44
+ * progress.
45
+ */
46
+ loading?: boolean;
47
+ /**
48
+ * Marks the trigger as failed, such as after the host's generation rejected. A message replaces
49
+ * the tooltip and describes the trigger. The host clears it, such as when the panel is dismissed.
50
+ */
51
+ error?: ReactNode;
52
+ /** Classes for the trigger, such as a tone while the popover is open. */
53
+ className?: string;
54
+ /**
55
+ * The trigger's Button size, for a trigger outside a field header such as in a toolbar. Defaults
56
+ * to `3xs`, the height a header row expects, whose icon is 12px; other sizes keep their own icon.
57
+ */
58
+ size?: ButtonProps['size'];
36
59
  /** Overrides for any subset of the English strings. */
37
60
  strings?: Partial<AiAssistActionStrings>;
38
61
  }
39
62
  /**
40
63
  * The AI-assist header action: a prompt in a popover. Requires an ancestor `TooltipProvider`.
41
64
  */
42
- export declare function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings, }: AiAssistActionProps): import("react/jsx-runtime").JSX.Element;
65
+ export declare function AiAssistAction({ onGenerate, hint, renderContent, disabled, open: openProp, onOpenChange, loading, error, className, size, strings, }: AiAssistActionProps): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,8 @@ import { Label } from "../label.js";
6
6
  import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
7
7
  import { Textarea } from "../textarea.js";
8
8
  import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip.js";
9
- import { FIELD_ACTION_CLASS } from "./collapse.js";
9
+ import { cn } from "../../../lib/index.js";
10
+ import { FIELD_ACTION_CLASS, FIELD_ACTION_TONE_CLASS } from "./collapse.js";
10
11
  const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
11
12
  trigger: 'AI assist',
12
13
  tooltip: 'Generate with AI',
@@ -16,22 +17,36 @@ const DEFAULT_AI_ASSIST_ACTION_STRINGS = {
16
17
  generating: 'Generating',
17
18
  error: 'Could not generate a value. Try again.'
18
19
  };
19
- function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings }) {
20
+ function AiAssistAction({ onGenerate, hint, renderContent, disabled, open: openProp, onOpenChange, loading = false, error, className, size = '3xs', strings }) {
20
21
  const promptId = useId();
21
22
  const errorId = useId();
23
+ const triggerErrorId = useId();
22
24
  const [prompt, setPrompt] = useState('');
23
- const [open, setOpen] = useState(false);
25
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
24
26
  const [pending, setPending] = useState(false);
25
27
  const [failed, setFailed] = useState(false);
26
28
  const text = {
27
29
  ...DEFAULT_AI_ASSIST_ACTION_STRINGS,
28
30
  ...strings
29
31
  };
32
+ const hasError = !!error;
33
+ const errorMessage = hasError && true !== error ? error : null;
34
+ const controlled = void 0 !== openProp;
35
+ const open = controlled ? openProp : uncontrolledOpen;
36
+ const setOpen = useCallback((next)=>{
37
+ if (!controlled) setUncontrolledOpen(next);
38
+ onOpenChange?.(next);
39
+ }, [
40
+ controlled,
41
+ onOpenChange
42
+ ]);
30
43
  const changeOpen = (next)=>{
31
44
  setFailed(false);
32
45
  setOpen(next);
33
46
  };
34
- const close = useCallback(()=>setOpen(false), []);
47
+ const close = useCallback(()=>setOpen(false), [
48
+ setOpen
49
+ ]);
35
50
  const generate = async ()=>{
36
51
  setFailed(false);
37
52
  const result = onGenerate?.(prompt);
@@ -52,27 +67,36 @@ function AiAssistAction({ onGenerate, hint, renderContent, disabled, strings })
52
67
  children: [
53
68
  /*#__PURE__*/ jsxs(Tooltip, {
54
69
  children: [
55
- /*#__PURE__*/ jsx(TooltipTrigger, {
70
+ /*#__PURE__*/ jsx(PopoverTrigger, {
56
71
  asChild: true,
57
- children: /*#__PURE__*/ jsx(PopoverTrigger, {
72
+ children: /*#__PURE__*/ jsx(TooltipTrigger, {
58
73
  asChild: true,
59
74
  children: /*#__PURE__*/ jsx(Button, {
60
75
  type: "button",
61
76
  variant: "ghost",
62
- size: "3xs",
77
+ size: size,
63
78
  icon: true,
64
79
  "aria-label": text.trigger,
65
80
  disabled: disabled,
66
- className: FIELD_ACTION_CLASS,
81
+ "aria-busy": loading || void 0,
82
+ ...errorMessage ? {
83
+ 'aria-describedby': triggerErrorId
84
+ } : {},
85
+ className: cn('3xs' === size ? FIELD_ACTION_CLASS : FIELD_ACTION_TONE_CLASS, hasError && 'text-error hover:text-error future:text-error future:hover:text-error', loading && 'animate-glow cursor-progress [--glow-color:var(--color-gradient-agent-start)]', className),
67
86
  children: /*#__PURE__*/ jsx(Sparkles, {})
68
87
  })
69
88
  })
70
89
  }),
71
90
  /*#__PURE__*/ jsx(TooltipContent, {
72
- children: text.tooltip
91
+ children: loading ? text.generating : errorMessage ?? text.tooltip
73
92
  })
74
93
  ]
75
94
  }),
95
+ errorMessage && /*#__PURE__*/ jsx("span", {
96
+ id: triggerErrorId,
97
+ className: "sr-only",
98
+ children: errorMessage
99
+ }),
76
100
  /*#__PURE__*/ jsx(PopoverContent, {
77
101
  align: "end",
78
102
  className: "space-y-3",
@@ -26,18 +26,22 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  COLLAPSED_HIDDEN: ()=>COLLAPSED_HIDDEN,
28
28
  COLLAPSED_ONLY: ()=>COLLAPSED_ONLY,
29
- FIELD_ACTION_CLASS: ()=>FIELD_ACTION_CLASS
29
+ FIELD_ACTION_CLASS: ()=>FIELD_ACTION_CLASS,
30
+ FIELD_ACTION_TONE_CLASS: ()=>FIELD_ACTION_TONE_CLASS
30
31
  });
31
32
  const COLLAPSED_HIDDEN = '@max-[259px]:hidden';
32
33
  const COLLAPSED_ONLY = 'hidden @max-[259px]:flex';
33
- const FIELD_ACTION_CLASS = 'text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3';
34
+ const FIELD_ACTION_TONE_CLASS = 'text-muted-foreground hover:bg-accent hover:text-foreground';
35
+ const FIELD_ACTION_CLASS = `${FIELD_ACTION_TONE_CLASS} [&_svg]:size-3`;
34
36
  exports.COLLAPSED_HIDDEN = __webpack_exports__.COLLAPSED_HIDDEN;
35
37
  exports.COLLAPSED_ONLY = __webpack_exports__.COLLAPSED_ONLY;
36
38
  exports.FIELD_ACTION_CLASS = __webpack_exports__.FIELD_ACTION_CLASS;
39
+ exports.FIELD_ACTION_TONE_CLASS = __webpack_exports__.FIELD_ACTION_TONE_CLASS;
37
40
  for(var __rspack_i in __webpack_exports__)if (-1 === [
38
41
  "COLLAPSED_HIDDEN",
39
42
  "COLLAPSED_ONLY",
40
- "FIELD_ACTION_CLASS"
43
+ "FIELD_ACTION_CLASS",
44
+ "FIELD_ACTION_TONE_CLASS"
41
45
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
42
46
  Object.defineProperty(exports, '__esModule', {
43
47
  value: true
@@ -2,6 +2,8 @@
2
2
  export declare const COLLAPSED_HIDDEN = "@max-[259px]:hidden";
3
3
  /** Shown only once collapsed. */
4
4
  export declare const COLLAPSED_ONLY = "hidden @max-[259px]:flex";
5
+ /** The muted tone of a field's other icon buttons, for a header action of any size. */
6
+ export declare const FIELD_ACTION_TONE_CLASS = "text-muted-foreground hover:bg-accent hover:text-foreground";
5
7
  /**
6
8
  * A header action is a ghost `3xs` Button, the height FormFieldHeader's `min-h-6` row expects, in
7
9
  * the muted tone of the field's other icon buttons. Its icons are 12px.
@@ -1,4 +1,5 @@
1
1
  const COLLAPSED_HIDDEN = '@max-[259px]:hidden';
2
2
  const COLLAPSED_ONLY = 'hidden @max-[259px]:flex';
3
- const FIELD_ACTION_CLASS = 'text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3';
4
- export { COLLAPSED_HIDDEN, COLLAPSED_ONLY, FIELD_ACTION_CLASS };
3
+ const FIELD_ACTION_TONE_CLASS = 'text-muted-foreground hover:bg-accent hover:text-foreground';
4
+ const FIELD_ACTION_CLASS = `${FIELD_ACTION_TONE_CLASS} [&_svg]:size-3`;
5
+ export { COLLAPSED_HIDDEN, COLLAPSED_ONLY, FIELD_ACTION_CLASS, FIELD_ACTION_TONE_CLASS };
@@ -38,7 +38,10 @@ export type InsertVariableActionProps = InsertVariableActionBaseProps & ({
38
38
  } | {
39
39
  /** Ignored while `renderPicker` is set. */
40
40
  variables?: VariablePickerItem[] | (() => VariablePickerItem[]);
41
- /** The host's own picker, rendered in the popover in place of the built-in one. */
41
+ /**
42
+ * The host's own picker, rendered in the popover in place of the built-in one. The popover
43
+ * sizes to it, so it sets its own width.
44
+ */
42
45
  renderPicker: RenderVariablePicker;
43
46
  });
44
47
  /** The Insert-variable header action: opens a variable picker and reports the pick. */