@uipath/apollo-wind 2.57.0 → 2.58.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/ui/alert-dialog.cjs +7 -6
- package/dist/components/ui/alert-dialog.js +7 -6
- package/dist/components/ui/code-editors.shared.cjs +323 -0
- package/dist/components/ui/code-editors.shared.d.ts +936 -0
- package/dist/components/ui/code-editors.shared.js +264 -0
- package/dist/components/ui/dialog.cjs +2 -1
- package/dist/components/ui/dialog.js +2 -1
- package/dist/components/ui/field-actions/ai-assist-action.cjs +51 -7
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +12 -3
- package/dist/components/ui/field-actions/ai-assist-action.js +52 -8
- package/dist/components/ui/field-actions/insert-variable-action.cjs +16 -15
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +15 -4
- package/dist/components/ui/field-actions/insert-variable-action.js +16 -15
- package/dist/components/ui/field-addons/built-in-value-modes.cjs +84 -0
- package/dist/components/ui/field-addons/built-in-value-modes.d.ts +21 -0
- package/dist/components/ui/field-addons/built-in-value-modes.js +44 -0
- package/dist/components/ui/field-addons/{value-mode-menu.cjs → field-menu.cjs} +20 -25
- package/dist/components/ui/field-addons/{value-mode-menu.d.ts → field-menu.d.ts} +19 -20
- package/dist/components/ui/field-addons/{value-mode-menu.js → field-menu.js} +20 -25
- package/dist/components/ui/field-addons/index.cjs +12 -11
- package/dist/components/ui/field-addons/index.d.ts +3 -2
- package/dist/components/ui/field-addons/index.js +4 -3
- package/dist/components/ui/field-addons/value-mode-indicator.cjs +4 -4
- package/dist/components/ui/field-addons/value-mode-indicator.d.ts +3 -1
- package/dist/components/ui/field-addons/value-mode-indicator.js +5 -5
- package/dist/components/ui/field-addons/value-mode-strings.cjs +9 -27
- package/dist/components/ui/field-addons/value-mode-strings.d.ts +14 -16
- package/dist/components/ui/field-addons/value-mode-strings.js +8 -20
- package/dist/components/ui/index.cjs +24 -24
- package/dist/components/ui/lockable-value-field/components/field-header.cjs +20 -1
- package/dist/components/ui/lockable-value-field/components/field-header.d.ts +1 -1
- package/dist/components/ui/lockable-value-field/components/field-header.js +20 -1
- package/dist/components/ui/lockable-value-field/lockable-value-field.cjs +3 -3
- package/dist/components/ui/lockable-value-field/lockable-value-field.js +1 -1
- package/dist/index.cjs +14 -14
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/lib/dialog-surface.cjs +36 -0
- package/dist/lib/dialog-surface.d.ts +1 -0
- package/dist/lib/dialog-surface.js +2 -0
- package/dist/styles.css +7 -9
- package/package.json +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
BUILTIN_VALUE_MODES: ()=>BUILTIN_VALUE_MODES,
|
|
28
|
+
isBuiltInValueMode: ()=>isBuiltInValueMode,
|
|
29
|
+
builtInValueModes: ()=>builtInValueModes
|
|
30
|
+
});
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
33
|
+
function literalDescriptionFor(expectedType, strings) {
|
|
34
|
+
if ('number' === expectedType) return strings.literalNumberDescription;
|
|
35
|
+
if ('boolean' === expectedType) return strings.literalBooleanDescription;
|
|
36
|
+
return strings.literalDescription;
|
|
37
|
+
}
|
|
38
|
+
function builtInValueModes(strings, { expectedType, literalDescription } = {}) {
|
|
39
|
+
const text = {
|
|
40
|
+
...external_value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS,
|
|
41
|
+
...strings
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
literal: {
|
|
45
|
+
id: 'literal',
|
|
46
|
+
title: text.literalTitle,
|
|
47
|
+
description: literalDescription ?? literalDescriptionFor(expectedType, text),
|
|
48
|
+
icon: external_lucide_react_namespaceObject.Type
|
|
49
|
+
},
|
|
50
|
+
expression: {
|
|
51
|
+
id: 'expression',
|
|
52
|
+
title: text.expressionTitle,
|
|
53
|
+
description: text.expressionDescription,
|
|
54
|
+
icon: external_lucide_react_namespaceObject.SquareFunction
|
|
55
|
+
},
|
|
56
|
+
variable: {
|
|
57
|
+
id: 'variable',
|
|
58
|
+
title: text.variableTitle,
|
|
59
|
+
description: text.variableDescription,
|
|
60
|
+
icon: external_lucide_react_namespaceObject.Variable
|
|
61
|
+
},
|
|
62
|
+
prompt: {
|
|
63
|
+
id: 'prompt',
|
|
64
|
+
title: text.promptTitle,
|
|
65
|
+
description: text.promptDescription,
|
|
66
|
+
icon: external_lucide_react_namespaceObject.Sparkles
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const BUILTIN_VALUE_MODES = builtInValueModes();
|
|
71
|
+
function isBuiltInValueMode(id) {
|
|
72
|
+
return id in BUILTIN_VALUE_MODES;
|
|
73
|
+
}
|
|
74
|
+
exports.BUILTIN_VALUE_MODES = __webpack_exports__.BUILTIN_VALUE_MODES;
|
|
75
|
+
exports.builtInValueModes = __webpack_exports__.builtInValueModes;
|
|
76
|
+
exports.isBuiltInValueMode = __webpack_exports__.isBuiltInValueMode;
|
|
77
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
78
|
+
"BUILTIN_VALUE_MODES",
|
|
79
|
+
"builtInValueModes",
|
|
80
|
+
"isBuiltInValueMode"
|
|
81
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
82
|
+
Object.defineProperty(exports, '__esModule', {
|
|
83
|
+
value: true
|
|
84
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
import { type ValueMode, type ValueModeStrings } from './value-mode-strings';
|
|
3
|
+
/** One selectable mode. `id` is the consumer's own vocabulary. */
|
|
4
|
+
export interface ValueModeOption<Id extends string = string> {
|
|
5
|
+
id: Id;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon: LucideIcon;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface BuiltInValueModesOptions {
|
|
12
|
+
/** Picks the literal mode's description (`number`, `boolean`, anything else). */
|
|
13
|
+
expectedType?: string;
|
|
14
|
+
/** Overrides the literal mode's description. */
|
|
15
|
+
literalDescription?: string;
|
|
16
|
+
}
|
|
17
|
+
/** The four built-in modes, in `strings` (merged over the English defaults). */
|
|
18
|
+
export declare function builtInValueModes(strings?: Partial<ValueModeStrings>, { expectedType, literalDescription }?: BuiltInValueModesOptions): Record<ValueMode, ValueModeOption<ValueMode>>;
|
|
19
|
+
/** The four built-in modes in English. Call {@link builtInValueModes} for translated ones. */
|
|
20
|
+
export declare const BUILTIN_VALUE_MODES: Record<ValueMode, ValueModeOption<ValueMode>>;
|
|
21
|
+
export declare function isBuiltInValueMode(id: string): id is ValueMode;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Sparkles, SquareFunction, Type, Variable } from "lucide-react";
|
|
2
|
+
import { DEFAULT_VALUE_MODE_STRINGS } from "./value-mode-strings.js";
|
|
3
|
+
function literalDescriptionFor(expectedType, strings) {
|
|
4
|
+
if ('number' === expectedType) return strings.literalNumberDescription;
|
|
5
|
+
if ('boolean' === expectedType) return strings.literalBooleanDescription;
|
|
6
|
+
return strings.literalDescription;
|
|
7
|
+
}
|
|
8
|
+
function builtInValueModes(strings, { expectedType, literalDescription } = {}) {
|
|
9
|
+
const text = {
|
|
10
|
+
...DEFAULT_VALUE_MODE_STRINGS,
|
|
11
|
+
...strings
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
literal: {
|
|
15
|
+
id: 'literal',
|
|
16
|
+
title: text.literalTitle,
|
|
17
|
+
description: literalDescription ?? literalDescriptionFor(expectedType, text),
|
|
18
|
+
icon: Type
|
|
19
|
+
},
|
|
20
|
+
expression: {
|
|
21
|
+
id: 'expression',
|
|
22
|
+
title: text.expressionTitle,
|
|
23
|
+
description: text.expressionDescription,
|
|
24
|
+
icon: SquareFunction
|
|
25
|
+
},
|
|
26
|
+
variable: {
|
|
27
|
+
id: 'variable',
|
|
28
|
+
title: text.variableTitle,
|
|
29
|
+
description: text.variableDescription,
|
|
30
|
+
icon: Variable
|
|
31
|
+
},
|
|
32
|
+
prompt: {
|
|
33
|
+
id: 'prompt',
|
|
34
|
+
title: text.promptTitle,
|
|
35
|
+
description: text.promptDescription,
|
|
36
|
+
icon: Sparkles
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const BUILTIN_VALUE_MODES = builtInValueModes();
|
|
41
|
+
function isBuiltInValueMode(id) {
|
|
42
|
+
return id in BUILTIN_VALUE_MODES;
|
|
43
|
+
}
|
|
44
|
+
export { BUILTIN_VALUE_MODES, builtInValueModes, isBuiltInValueMode };
|
|
@@ -24,7 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
27
|
+
FieldMenu: ()=>FieldMenu,
|
|
28
28
|
ValueModeMenuItem: ()=>ValueModeMenuItem
|
|
29
29
|
});
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
@@ -32,12 +32,12 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
32
32
|
const external_button_cjs_namespaceObject = require("../button.cjs");
|
|
33
33
|
const external_dropdown_menu_cjs_namespaceObject = require("../dropdown-menu.cjs");
|
|
34
34
|
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
35
|
+
const external_built_in_value_modes_cjs_namespaceObject = require("./built-in-value-modes.cjs");
|
|
35
36
|
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
37
|
+
const DEFAULT_MODES = [
|
|
38
|
+
'literal',
|
|
39
|
+
'expression'
|
|
40
|
+
];
|
|
41
41
|
function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick }) {
|
|
42
42
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
43
43
|
role: "menuitemradio",
|
|
@@ -67,30 +67,25 @@ function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, o
|
|
|
67
67
|
]
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
70
|
+
function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings }) {
|
|
71
|
+
const text = {
|
|
72
|
+
...external_value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS,
|
|
73
|
+
...strings
|
|
74
|
+
};
|
|
72
75
|
const checkedMode = checked ?? mode;
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: 'expression',
|
|
82
|
-
title: strings.expressionTitle,
|
|
83
|
-
description: strings.expressionDescription,
|
|
84
|
-
icon: external_lucide_react_namespaceObject.SquareFunction
|
|
85
|
-
}
|
|
86
|
-
];
|
|
76
|
+
const builtIns = (0, external_built_in_value_modes_cjs_namespaceObject.builtInValueModes)(text, {
|
|
77
|
+
expectedType,
|
|
78
|
+
literalDescription
|
|
79
|
+
});
|
|
80
|
+
const entries = modes ?? DEFAULT_MODES;
|
|
81
|
+
const baseModes = entries.map((entry)=>'string' == typeof entry && (0, external_built_in_value_modes_cjs_namespaceObject.isBuiltInValueMode)(entry) ? builtIns[entry] : entry);
|
|
87
82
|
const resolvedModes = extraModes ? [
|
|
88
83
|
...extraModes,
|
|
89
84
|
...baseModes
|
|
90
85
|
] : baseModes;
|
|
91
86
|
const activeMode = resolvedModes.find((item)=>item.id === mode);
|
|
92
87
|
const TriggerIcon = modesDisabled ? external_lucide_react_namespaceObject.MoreHorizontal : activeMode?.icon ?? external_lucide_react_namespaceObject.Type;
|
|
93
|
-
const triggerLabel = modesDisabled ?
|
|
88
|
+
const triggerLabel = modesDisabled ? text.fieldActions : activeMode?.title ?? text.literalTitle;
|
|
94
89
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
95
90
|
children: [
|
|
96
91
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
@@ -138,10 +133,10 @@ function ValueModeMenu({ mode, onSelect, modes, extraModes, actions, checked, mo
|
|
|
138
133
|
]
|
|
139
134
|
});
|
|
140
135
|
}
|
|
141
|
-
exports.
|
|
136
|
+
exports.FieldMenu = __webpack_exports__.FieldMenu;
|
|
142
137
|
exports.ValueModeMenuItem = __webpack_exports__.ValueModeMenuItem;
|
|
143
138
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
144
|
-
"
|
|
139
|
+
"FieldMenu",
|
|
145
140
|
"ValueModeMenuItem"
|
|
146
141
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
147
142
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { type LucideIcon } from 'lucide-react';
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
export interface ValueModeOption<Id extends string = string> {
|
|
5
|
-
id: Id;
|
|
6
|
-
title: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
icon: LucideIcon;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}
|
|
2
|
+
import { type ValueModeOption } from './built-in-value-modes';
|
|
3
|
+
import { type ValueMode, type ValueModeStrings } from './value-mode-strings';
|
|
11
4
|
/** A field-supplied action listed under the modes, such as Clear value. */
|
|
12
|
-
export interface
|
|
5
|
+
export interface FieldMenuItem {
|
|
13
6
|
id: string;
|
|
14
7
|
label: string;
|
|
15
8
|
icon?: LucideIcon;
|
|
@@ -18,13 +11,15 @@ export interface ValueModeMenuAction {
|
|
|
18
11
|
disabled?: boolean;
|
|
19
12
|
onSelect: () => void;
|
|
20
13
|
}
|
|
21
|
-
|
|
14
|
+
/** A mode to list: a full option, or the id of a built-in mode that `Id` shares. */
|
|
15
|
+
export type FieldMenuMode<Id extends string> = ValueModeOption<Id> | Extract<Id, ValueMode>;
|
|
16
|
+
interface FieldMenuBaseProps<Id extends string> {
|
|
22
17
|
mode: Id;
|
|
23
18
|
onSelect: (mode: Id) => void;
|
|
24
19
|
/** Listed before `modes` (or the built-in pair). */
|
|
25
20
|
extraModes?: ValueModeOption<Id>[];
|
|
26
21
|
/** Listed below the modes, behind a separator. */
|
|
27
|
-
actions?:
|
|
22
|
+
actions?: FieldMenuItem[];
|
|
28
23
|
/** The item to mark active when it differs from `mode`; `'none'` marks neither. */
|
|
29
24
|
checked?: Id | 'none';
|
|
30
25
|
/** Hides the modes and shows only `actions`, under an overflow trigger rather than a mode glyph. */
|
|
@@ -34,20 +29,23 @@ interface ValueModeMenuBaseProps<Id extends string> {
|
|
|
34
29
|
expectedType?: string;
|
|
35
30
|
/** Overrides the built-in Fixed value description. */
|
|
36
31
|
literalDescription?: string;
|
|
32
|
+
/** Overrides for any subset of the English strings. */
|
|
33
|
+
strings?: Partial<ValueModeStrings>;
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* `modes` may be omitted when `Id` is the built-in modes, or one of them as `mode="literal"` infers,
|
|
40
|
-
* or includes
|
|
41
|
-
* such as `'fixed' | 'expr'`, must bring their own `modes
|
|
37
|
+
* or includes them all. The menu then falls back to Fixed value and Expression and calls `onSelect`
|
|
38
|
+
* with either. Other ids, such as `'fixed' | 'expr'`, must bring their own `modes`; ids a vocabulary
|
|
39
|
+
* shares with the built-ins may be listed by id alone.
|
|
42
40
|
*/
|
|
43
|
-
export type
|
|
41
|
+
export type FieldMenuProps<Id extends string = ValueMode> = FieldMenuBaseProps<Id> & ([Id] extends [ValueMode] ? BuiltInModes<Id> : [ValueMode] extends [Id] ? BuiltInModes<Id> : OwnModes<Id>);
|
|
44
42
|
type BuiltInModes<Id extends string> = {
|
|
45
43
|
/** The mode list. Omitted, it is the built-in Fixed value / Expression pair. */
|
|
46
|
-
modes?:
|
|
44
|
+
modes?: FieldMenuMode<Id>[];
|
|
47
45
|
};
|
|
48
46
|
type OwnModes<Id extends string> = {
|
|
49
47
|
/** The mode list. */
|
|
50
|
-
modes:
|
|
48
|
+
modes: FieldMenuMode<Id>[];
|
|
51
49
|
};
|
|
52
50
|
/**
|
|
53
51
|
* One selectable mode in a value-mode dropdown: icon and label, with an optional description.
|
|
@@ -62,8 +60,9 @@ export declare function ValueModeMenuItem({ icon: Icon, label, description, acti
|
|
|
62
60
|
onClick: () => void;
|
|
63
61
|
}): import("react/jsx-runtime").JSX.Element;
|
|
64
62
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
63
|
+
* A field's trailing menu: switches it between value modes, then lists its actions. The trigger
|
|
64
|
+
* shows the current mode's icon and is named by its title; with the modes hidden it is the field's
|
|
65
|
+
* overflow menu.
|
|
67
66
|
*/
|
|
68
|
-
export declare function
|
|
67
|
+
export declare function FieldMenu<Id extends string = ValueMode>({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings, }: FieldMenuProps<Id>): import("react/jsx-runtime").JSX.Element;
|
|
69
68
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MoreHorizontal,
|
|
2
|
+
import { MoreHorizontal, Type } from "lucide-react";
|
|
3
3
|
import { Button } from "../button.js";
|
|
4
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../dropdown-menu.js";
|
|
5
5
|
import { cn } from "../../../lib/index.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { builtInValueModes, isBuiltInValueMode } from "./built-in-value-modes.js";
|
|
7
|
+
import { DEFAULT_VALUE_MODE_STRINGS } from "./value-mode-strings.js";
|
|
8
|
+
const DEFAULT_MODES = [
|
|
9
|
+
'literal',
|
|
10
|
+
'expression'
|
|
11
|
+
];
|
|
12
12
|
function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick }) {
|
|
13
13
|
return /*#__PURE__*/ jsxs(DropdownMenuItem, {
|
|
14
14
|
role: "menuitemradio",
|
|
@@ -38,30 +38,25 @@ function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, o
|
|
|
38
38
|
]
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
41
|
+
function FieldMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, strings }) {
|
|
42
|
+
const text = {
|
|
43
|
+
...DEFAULT_VALUE_MODE_STRINGS,
|
|
44
|
+
...strings
|
|
45
|
+
};
|
|
43
46
|
const checkedMode = checked ?? mode;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 'expression',
|
|
53
|
-
title: strings.expressionTitle,
|
|
54
|
-
description: strings.expressionDescription,
|
|
55
|
-
icon: SquareFunction
|
|
56
|
-
}
|
|
57
|
-
];
|
|
47
|
+
const builtIns = builtInValueModes(text, {
|
|
48
|
+
expectedType,
|
|
49
|
+
literalDescription
|
|
50
|
+
});
|
|
51
|
+
const entries = modes ?? DEFAULT_MODES;
|
|
52
|
+
const baseModes = entries.map((entry)=>'string' == typeof entry && isBuiltInValueMode(entry) ? builtIns[entry] : entry);
|
|
58
53
|
const resolvedModes = extraModes ? [
|
|
59
54
|
...extraModes,
|
|
60
55
|
...baseModes
|
|
61
56
|
] : baseModes;
|
|
62
57
|
const activeMode = resolvedModes.find((item)=>item.id === mode);
|
|
63
58
|
const TriggerIcon = modesDisabled ? MoreHorizontal : activeMode?.icon ?? Type;
|
|
64
|
-
const triggerLabel = modesDisabled ?
|
|
59
|
+
const triggerLabel = modesDisabled ? text.fieldActions : activeMode?.title ?? text.literalTitle;
|
|
65
60
|
return /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
66
61
|
children: [
|
|
67
62
|
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
@@ -109,4 +104,4 @@ function ValueModeMenu({ mode, onSelect, modes, extraModes, actions, checked, mo
|
|
|
109
104
|
]
|
|
110
105
|
});
|
|
111
106
|
}
|
|
112
|
-
export {
|
|
107
|
+
export { FieldMenu, ValueModeMenuItem };
|
|
@@ -24,26 +24,27 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
27
|
+
BUILTIN_VALUE_MODES: ()=>external_built_in_value_modes_cjs_namespaceObject.BUILTIN_VALUE_MODES,
|
|
28
|
+
builtInValueModes: ()=>external_built_in_value_modes_cjs_namespaceObject.builtInValueModes,
|
|
28
29
|
DEFAULT_VALUE_MODE_STRINGS: ()=>external_value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
ValueModeStringsProvider: ()=>external_value_mode_strings_cjs_namespaceObject.ValueModeStringsProvider
|
|
30
|
+
FieldMenu: ()=>external_field_menu_cjs_namespaceObject.FieldMenu,
|
|
31
|
+
ValueModeIndicator: ()=>external_value_mode_indicator_cjs_namespaceObject.ValueModeIndicator
|
|
32
32
|
});
|
|
33
|
+
const external_built_in_value_modes_cjs_namespaceObject = require("./built-in-value-modes.cjs");
|
|
34
|
+
const external_field_menu_cjs_namespaceObject = require("./field-menu.cjs");
|
|
33
35
|
const external_value_mode_indicator_cjs_namespaceObject = require("./value-mode-indicator.cjs");
|
|
34
|
-
const external_value_mode_menu_cjs_namespaceObject = require("./value-mode-menu.cjs");
|
|
35
36
|
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
37
|
+
exports.BUILTIN_VALUE_MODES = __webpack_exports__.BUILTIN_VALUE_MODES;
|
|
36
38
|
exports.DEFAULT_VALUE_MODE_STRINGS = __webpack_exports__.DEFAULT_VALUE_MODE_STRINGS;
|
|
39
|
+
exports.FieldMenu = __webpack_exports__.FieldMenu;
|
|
37
40
|
exports.ValueModeIndicator = __webpack_exports__.ValueModeIndicator;
|
|
38
|
-
exports.
|
|
39
|
-
exports.ValueModeStringsProvider = __webpack_exports__.ValueModeStringsProvider;
|
|
40
|
-
exports.useValueModeStrings = __webpack_exports__.useValueModeStrings;
|
|
41
|
+
exports.builtInValueModes = __webpack_exports__.builtInValueModes;
|
|
41
42
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
43
|
+
"BUILTIN_VALUE_MODES",
|
|
42
44
|
"DEFAULT_VALUE_MODE_STRINGS",
|
|
45
|
+
"FieldMenu",
|
|
43
46
|
"ValueModeIndicator",
|
|
44
|
-
"
|
|
45
|
-
"ValueModeStringsProvider",
|
|
46
|
-
"useValueModeStrings"
|
|
47
|
+
"builtInValueModes"
|
|
47
48
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
49
|
Object.defineProperty(exports, '__esModule', {
|
|
49
50
|
value: true
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { BUILTIN_VALUE_MODES, type BuiltInValueModesOptions, builtInValueModes, type ValueModeOption, } from './built-in-value-modes';
|
|
2
|
+
export { FieldMenu, type FieldMenuItem, type FieldMenuMode, type FieldMenuProps, } from './field-menu';
|
|
1
3
|
export { ValueModeIndicator, type ValueModeIndicatorProps } from './value-mode-indicator';
|
|
2
|
-
export {
|
|
3
|
-
export { DEFAULT_VALUE_MODE_STRINGS, useValueModeStrings, type ValueMode, type ValueModeStrings, ValueModeStringsProvider, type ValueModeStringsProviderProps, } from './value-mode-strings';
|
|
4
|
+
export { DEFAULT_VALUE_MODE_STRINGS, type ValueMode, type ValueModeStrings, } from './value-mode-strings';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { BUILTIN_VALUE_MODES, builtInValueModes } from "./built-in-value-modes.js";
|
|
2
|
+
import { FieldMenu } from "./field-menu.js";
|
|
1
3
|
import { ValueModeIndicator } from "./value-mode-indicator.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { DEFAULT_VALUE_MODE_STRINGS, ValueModeIndicator, ValueModeMenu, ValueModeStringsProvider, useValueModeStrings };
|
|
4
|
+
import { DEFAULT_VALUE_MODE_STRINGS } from "./value-mode-strings.js";
|
|
5
|
+
export { BUILTIN_VALUE_MODES, DEFAULT_VALUE_MODE_STRINGS, FieldMenu, ValueModeIndicator, builtInValueModes };
|
|
@@ -30,15 +30,15 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
32
32
|
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
33
|
-
const ValueModeIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ mode, disabled, className, ...props }, ref)=>{
|
|
34
|
-
const
|
|
33
|
+
const ValueModeIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ mode, disabled, strings, className, ...props }, ref)=>{
|
|
34
|
+
const label = strings?.expressionIndicator ?? external_value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS.expressionIndicator;
|
|
35
35
|
if ('expression' !== mode) return null;
|
|
36
36
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
37
37
|
ref: ref,
|
|
38
38
|
"data-slot": "value-mode-indicator",
|
|
39
39
|
role: "img",
|
|
40
|
-
"aria-label":
|
|
41
|
-
title:
|
|
40
|
+
"aria-label": label,
|
|
41
|
+
title: label,
|
|
42
42
|
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-center px-2 font-mono text-sm font-medium text-muted-foreground', disabled && 'opacity-50', className),
|
|
43
43
|
...props,
|
|
44
44
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type ValueMode } from './value-mode-strings';
|
|
2
|
+
import { type ValueMode, type ValueModeStrings } from './value-mode-strings';
|
|
3
3
|
export interface ValueModeIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
mode: ValueMode;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
/** Overrides for any subset of the English strings; only `expressionIndicator` is read. */
|
|
7
|
+
strings?: Partial<ValueModeStrings>;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* The `=` ahead of an expression value. Renders nothing in literal mode: its absence is the signal
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../../lib/index.js";
|
|
4
|
-
import {
|
|
5
|
-
const ValueModeIndicator = /*#__PURE__*/ forwardRef(({ mode, disabled, className, ...props }, ref)=>{
|
|
6
|
-
const
|
|
4
|
+
import { DEFAULT_VALUE_MODE_STRINGS } from "./value-mode-strings.js";
|
|
5
|
+
const ValueModeIndicator = /*#__PURE__*/ forwardRef(({ mode, disabled, strings, className, ...props }, ref)=>{
|
|
6
|
+
const label = strings?.expressionIndicator ?? DEFAULT_VALUE_MODE_STRINGS.expressionIndicator;
|
|
7
7
|
if ('expression' !== mode) return null;
|
|
8
8
|
return /*#__PURE__*/ jsx("div", {
|
|
9
9
|
ref: ref,
|
|
10
10
|
"data-slot": "value-mode-indicator",
|
|
11
11
|
role: "img",
|
|
12
|
-
"aria-label":
|
|
13
|
-
title:
|
|
12
|
+
"aria-label": label,
|
|
13
|
+
title: label,
|
|
14
14
|
className: cn('flex items-center justify-center px-2 font-mono text-sm font-medium text-muted-foreground', disabled && 'opacity-50', className),
|
|
15
15
|
...props,
|
|
16
16
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -24,45 +24,27 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
DEFAULT_VALUE_MODE_STRINGS: ()=>DEFAULT_VALUE_MODE_STRINGS
|
|
28
|
-
ValueModeStringsProvider: ()=>ValueModeStringsProvider,
|
|
29
|
-
useValueModeStrings: ()=>useValueModeStrings
|
|
27
|
+
DEFAULT_VALUE_MODE_STRINGS: ()=>DEFAULT_VALUE_MODE_STRINGS
|
|
30
28
|
});
|
|
31
|
-
const external_react_namespaceObject = require("react");
|
|
32
29
|
const DEFAULT_VALUE_MODE_STRINGS = {
|
|
33
30
|
literalTitle: 'Fixed value',
|
|
34
31
|
literalDescription: 'Enter a value directly',
|
|
35
32
|
literalNumberDescription: 'Enter a numeric value',
|
|
36
33
|
literalBooleanDescription: 'Select true or false',
|
|
37
34
|
expressionTitle: 'Expression',
|
|
38
|
-
expressionDescription: 'JavaScript expression
|
|
35
|
+
expressionDescription: 'JavaScript expression',
|
|
36
|
+
variableTitle: 'Variable',
|
|
37
|
+
variableDescription: 'Bind to a variable',
|
|
38
|
+
promptTitle: 'Prompt',
|
|
39
|
+
promptDescription: 'Describe the value for the agent to fill in',
|
|
40
|
+
variablePlaceholder: 'Select a variable',
|
|
41
|
+
promptPlaceholder: 'Describe the value',
|
|
39
42
|
fieldActions: 'Field actions',
|
|
40
43
|
expressionIndicator: 'JavaScript expression'
|
|
41
44
|
};
|
|
42
|
-
const ValueModeStringsContext = (0, external_react_namespaceObject.createContext)(DEFAULT_VALUE_MODE_STRINGS);
|
|
43
|
-
function ValueModeStringsProvider({ strings, children }) {
|
|
44
|
-
const parent = (0, external_react_namespaceObject.useContext)(ValueModeStringsContext);
|
|
45
|
-
const value = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
46
|
-
...parent,
|
|
47
|
-
...strings
|
|
48
|
-
}), [
|
|
49
|
-
parent,
|
|
50
|
-
strings
|
|
51
|
-
]);
|
|
52
|
-
return (0, external_react_namespaceObject.createElement)(ValueModeStringsContext.Provider, {
|
|
53
|
-
value
|
|
54
|
-
}, children);
|
|
55
|
-
}
|
|
56
|
-
function useValueModeStrings() {
|
|
57
|
-
return (0, external_react_namespaceObject.useContext)(ValueModeStringsContext);
|
|
58
|
-
}
|
|
59
45
|
exports.DEFAULT_VALUE_MODE_STRINGS = __webpack_exports__.DEFAULT_VALUE_MODE_STRINGS;
|
|
60
|
-
exports.ValueModeStringsProvider = __webpack_exports__.ValueModeStringsProvider;
|
|
61
|
-
exports.useValueModeStrings = __webpack_exports__.useValueModeStrings;
|
|
62
46
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
-
"DEFAULT_VALUE_MODE_STRINGS"
|
|
64
|
-
"ValueModeStringsProvider",
|
|
65
|
-
"useValueModeStrings"
|
|
47
|
+
"DEFAULT_VALUE_MODE_STRINGS"
|
|
66
48
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
67
49
|
Object.defineProperty(exports, '__esModule', {
|
|
68
50
|
value: true
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The built-in value modes: a value typed as-is, an expression evaluated at run time, a bound
|
|
3
|
+
* variable, or a prompt the agent fills in. A consumer offers only the ones it lists.
|
|
4
|
+
*/
|
|
5
|
+
export type ValueMode = 'literal' | 'expression' | 'variable' | 'prompt';
|
|
4
6
|
/** Every string the value-mode primitives render. apollo-wind has no i18n runtime, so a localized
|
|
5
|
-
* host passes its own translations through
|
|
7
|
+
* host passes its own translations through each primitive's `strings` prop. */
|
|
6
8
|
export interface ValueModeStrings {
|
|
7
9
|
/** The literal mode's name, the same for every value type. */
|
|
8
10
|
literalTitle: string;
|
|
@@ -12,21 +14,17 @@ export interface ValueModeStrings {
|
|
|
12
14
|
literalBooleanDescription: string;
|
|
13
15
|
expressionTitle: string;
|
|
14
16
|
expressionDescription: string;
|
|
17
|
+
variableTitle: string;
|
|
18
|
+
variableDescription: string;
|
|
19
|
+
promptTitle: string;
|
|
20
|
+
promptDescription: string;
|
|
21
|
+
/** Shown in the variable control while no variable is bound. */
|
|
22
|
+
variablePlaceholder: string;
|
|
23
|
+
/** Shown in the prompt control while the prompt is empty. */
|
|
24
|
+
promptPlaceholder: string;
|
|
15
25
|
/** Names the menu trigger when it offers only actions and no modes. */
|
|
16
26
|
fieldActions: string;
|
|
17
27
|
/** Hover text on the `=` indicator. */
|
|
18
28
|
expressionIndicator: string;
|
|
19
29
|
}
|
|
20
30
|
export declare const DEFAULT_VALUE_MODE_STRINGS: ValueModeStrings;
|
|
21
|
-
export interface ValueModeStringsProviderProps {
|
|
22
|
-
/**
|
|
23
|
-
* Overrides for any subset of the English defaults. Keep the object stable, such as a module
|
|
24
|
-
* constant or a memoized value: a new object each render re-renders every value-mode primitive.
|
|
25
|
-
*/
|
|
26
|
-
strings: Partial<ValueModeStrings>;
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
}
|
|
29
|
-
/** Supplies translated strings to every value-mode primitive below it. */
|
|
30
|
-
export declare function ValueModeStringsProvider({ strings, children }: ValueModeStringsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<ValueModeStrings>>;
|
|
31
|
-
/** The strings in effect: the nearest provider's, merged over the English defaults. */
|
|
32
|
-
export declare function useValueModeStrings(): ValueModeStrings;
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import { createContext, createElement, useContext, useMemo } from "react";
|
|
2
1
|
const DEFAULT_VALUE_MODE_STRINGS = {
|
|
3
2
|
literalTitle: 'Fixed value',
|
|
4
3
|
literalDescription: 'Enter a value directly',
|
|
5
4
|
literalNumberDescription: 'Enter a numeric value',
|
|
6
5
|
literalBooleanDescription: 'Select true or false',
|
|
7
6
|
expressionTitle: 'Expression',
|
|
8
|
-
expressionDescription: 'JavaScript expression
|
|
7
|
+
expressionDescription: 'JavaScript expression',
|
|
8
|
+
variableTitle: 'Variable',
|
|
9
|
+
variableDescription: 'Bind to a variable',
|
|
10
|
+
promptTitle: 'Prompt',
|
|
11
|
+
promptDescription: 'Describe the value for the agent to fill in',
|
|
12
|
+
variablePlaceholder: 'Select a variable',
|
|
13
|
+
promptPlaceholder: 'Describe the value',
|
|
9
14
|
fieldActions: 'Field actions',
|
|
10
15
|
expressionIndicator: 'JavaScript expression'
|
|
11
16
|
};
|
|
12
|
-
|
|
13
|
-
function ValueModeStringsProvider({ strings, children }) {
|
|
14
|
-
const parent = useContext(ValueModeStringsContext);
|
|
15
|
-
const value = useMemo(()=>({
|
|
16
|
-
...parent,
|
|
17
|
-
...strings
|
|
18
|
-
}), [
|
|
19
|
-
parent,
|
|
20
|
-
strings
|
|
21
|
-
]);
|
|
22
|
-
return createElement(ValueModeStringsContext.Provider, {
|
|
23
|
-
value
|
|
24
|
-
}, children);
|
|
25
|
-
}
|
|
26
|
-
function useValueModeStrings() {
|
|
27
|
-
return useContext(ValueModeStringsContext);
|
|
28
|
-
}
|
|
29
|
-
export { DEFAULT_VALUE_MODE_STRINGS, ValueModeStringsProvider, useValueModeStrings };
|
|
17
|
+
export { DEFAULT_VALUE_MODE_STRINGS };
|