@uipath/apollo-wind 2.32.4 → 2.33.1
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/index.cjs +12 -12
- package/dist/components/ui/lockable-value-field/components/field-header.cjs +47 -50
- package/dist/components/ui/lockable-value-field/components/field-header.js +40 -43
- package/dist/components/ui/variable-picker/index.cjs +39 -0
- package/dist/components/ui/variable-picker/index.d.ts +2 -0
- package/dist/components/ui/variable-picker/index.js +2 -0
- package/dist/components/ui/variable-picker/variable-picker.cjs +246 -0
- package/dist/components/ui/variable-picker/variable-picker.d.ts +42 -0
- package/dist/components/ui/variable-picker/variable-picker.js +209 -0
- package/dist/index.cjs +129 -122
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/styles.css +76 -4
- package/dist/tailwind.css +13 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var __webpack_modules__ = {
|
|
|
15
15
|
"./avatar" (module) {
|
|
16
16
|
module.exports = require("./avatar.cjs");
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"./badge" (module) {
|
|
19
19
|
module.exports = require("./badge.cjs");
|
|
20
20
|
},
|
|
21
21
|
"./breadcrumb" (module) {
|
|
@@ -27,7 +27,7 @@ var __webpack_modules__ = {
|
|
|
27
27
|
"@/components/ui/button" (module) {
|
|
28
28
|
module.exports = require("./button.cjs");
|
|
29
29
|
},
|
|
30
|
-
"
|
|
30
|
+
"@/components/ui/calendar" (module) {
|
|
31
31
|
module.exports = require("./calendar.cjs");
|
|
32
32
|
},
|
|
33
33
|
"./card" (module) {
|
|
@@ -63,7 +63,7 @@ var __webpack_modules__ = {
|
|
|
63
63
|
"./dropdown-menu" (module) {
|
|
64
64
|
module.exports = require("./dropdown-menu.cjs");
|
|
65
65
|
},
|
|
66
|
-
"
|
|
66
|
+
"./editable-cell" (module) {
|
|
67
67
|
module.exports = require("./editable-cell.cjs");
|
|
68
68
|
},
|
|
69
69
|
"./empty-state" (module) {
|
|
@@ -78,10 +78,10 @@ var __webpack_modules__ = {
|
|
|
78
78
|
"./input-group" (module) {
|
|
79
79
|
module.exports = require("./input-group.cjs");
|
|
80
80
|
},
|
|
81
|
-
"
|
|
81
|
+
"@/components/ui/input" (module) {
|
|
82
82
|
module.exports = require("./input.cjs");
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"@/components/ui/label" (module) {
|
|
85
85
|
module.exports = require("./label.cjs");
|
|
86
86
|
},
|
|
87
87
|
"./layout" (module) {
|
|
@@ -150,7 +150,7 @@ var __webpack_modules__ = {
|
|
|
150
150
|
"./tabs" (module) {
|
|
151
151
|
module.exports = require("./tabs.cjs");
|
|
152
152
|
},
|
|
153
|
-
"
|
|
153
|
+
"@/components/ui/textarea" (module) {
|
|
154
154
|
module.exports = require("./textarea.cjs");
|
|
155
155
|
},
|
|
156
156
|
"./toggle-group" (module) {
|
|
@@ -247,7 +247,7 @@ var __webpack_exports__ = {};
|
|
|
247
247
|
"default"
|
|
248
248
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_avatar__rspack_import_4[__rspack_import_key];
|
|
249
249
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
250
|
-
var _badge__rspack_import_5 = __webpack_require__("
|
|
250
|
+
var _badge__rspack_import_5 = __webpack_require__("./badge");
|
|
251
251
|
var __rspack_reexport = {};
|
|
252
252
|
for(const __rspack_import_key in _badge__rspack_import_5)if ([
|
|
253
253
|
"TreeView",
|
|
@@ -275,7 +275,7 @@ var __webpack_exports__ = {};
|
|
|
275
275
|
"default"
|
|
276
276
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_button_group__rspack_import_8[__rspack_import_key];
|
|
277
277
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
278
|
-
var _calendar__rspack_import_9 = __webpack_require__("
|
|
278
|
+
var _calendar__rspack_import_9 = __webpack_require__("@/components/ui/calendar");
|
|
279
279
|
var __rspack_reexport = {};
|
|
280
280
|
for(const __rspack_import_key in _calendar__rspack_import_9)if ([
|
|
281
281
|
"TreeView",
|
|
@@ -359,7 +359,7 @@ var __webpack_exports__ = {};
|
|
|
359
359
|
"default"
|
|
360
360
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dropdown_menu__rspack_import_20[__rspack_import_key];
|
|
361
361
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
362
|
-
var _editable_cell__rspack_import_21 = __webpack_require__("
|
|
362
|
+
var _editable_cell__rspack_import_21 = __webpack_require__("./editable-cell");
|
|
363
363
|
var __rspack_reexport = {};
|
|
364
364
|
for(const __rspack_import_key in _editable_cell__rspack_import_21)if ([
|
|
365
365
|
"TreeView",
|
|
@@ -387,7 +387,7 @@ var __webpack_exports__ = {};
|
|
|
387
387
|
"default"
|
|
388
388
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_hover_card__rspack_import_24[__rspack_import_key];
|
|
389
389
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
390
|
-
var _input__rspack_import_25 = __webpack_require__("
|
|
390
|
+
var _input__rspack_import_25 = __webpack_require__("@/components/ui/input");
|
|
391
391
|
var __rspack_reexport = {};
|
|
392
392
|
for(const __rspack_import_key in _input__rspack_import_25)if ([
|
|
393
393
|
"TreeView",
|
|
@@ -401,7 +401,7 @@ var __webpack_exports__ = {};
|
|
|
401
401
|
"default"
|
|
402
402
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_input_group__rspack_import_26[__rspack_import_key];
|
|
403
403
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
404
|
-
var _label__rspack_import_27 = __webpack_require__("
|
|
404
|
+
var _label__rspack_import_27 = __webpack_require__("@/components/ui/label");
|
|
405
405
|
var __rspack_reexport = {};
|
|
406
406
|
for(const __rspack_import_key in _label__rspack_import_27)if ([
|
|
407
407
|
"TreeView",
|
|
@@ -562,7 +562,7 @@ var __webpack_exports__ = {};
|
|
|
562
562
|
"default"
|
|
563
563
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_tabs__rspack_import_49[__rspack_import_key];
|
|
564
564
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
565
|
-
var _textarea__rspack_import_50 = __webpack_require__("
|
|
565
|
+
var _textarea__rspack_import_50 = __webpack_require__("@/components/ui/textarea");
|
|
566
566
|
var __rspack_reexport = {};
|
|
567
567
|
for(const __rspack_import_key in _textarea__rspack_import_50)if ([
|
|
568
568
|
"TreeView",
|
|
@@ -36,15 +36,16 @@ const external_popover_cjs_namespaceObject = require("../../popover.cjs");
|
|
|
36
36
|
const external_switch_cjs_namespaceObject = require("../../switch.cjs");
|
|
37
37
|
const external_textarea_cjs_namespaceObject = require("../../textarea.cjs");
|
|
38
38
|
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
39
|
-
const index_cjs_namespaceObject = require("
|
|
39
|
+
const index_cjs_namespaceObject = require("../../variable-picker/index.cjs");
|
|
40
|
+
const external_lib_index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
40
41
|
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
41
42
|
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldTypeChange, onRequiredChange, controlsVisibility, compact, showFieldActions, value, onValueChange, variables, onGenerateWithAi, headerActions }) {
|
|
42
43
|
const promptId = (0, external_react_namespaceObject.useId)();
|
|
43
44
|
const [aiPrompt, setAiPrompt] = (0, external_react_namespaceObject.useState)('');
|
|
44
45
|
const typeMeta = external_types_cjs_namespaceObject.FIELD_TYPE_META[fieldType];
|
|
45
|
-
const collapsedTextClass = (0,
|
|
46
|
-
const collapsedPaddingClass = (0,
|
|
47
|
-
const compactOnlyClass = (0,
|
|
46
|
+
const collapsedTextClass = (0, external_lib_index_cjs_namespaceObject.cn)('@max-[259px]:hidden', compact && '!hidden');
|
|
47
|
+
const collapsedPaddingClass = (0, external_lib_index_cjs_namespaceObject.cn)('@max-[259px]:px-1.5', compact && '!px-1.5');
|
|
48
|
+
const compactOnlyClass = (0, external_lib_index_cjs_namespaceObject.cn)('hidden @max-[259px]:block', compact && '!block');
|
|
48
49
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
49
50
|
className: "flex items-center gap-1",
|
|
50
51
|
children: [
|
|
@@ -65,7 +66,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldT
|
|
|
65
66
|
className: "ml-auto flex items-center gap-0.5",
|
|
66
67
|
children: [
|
|
67
68
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
68
|
-
className: (0,
|
|
69
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('flex items-center gap-0.5', 'hover' === controlsVisibility && 'opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 has-[[aria-expanded=true]]:opacity-100'),
|
|
69
70
|
children: [
|
|
70
71
|
onFieldTypeChange && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
71
72
|
children: [
|
|
@@ -78,7 +79,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldT
|
|
|
78
79
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
79
80
|
type: "button",
|
|
80
81
|
"aria-label": "Field type",
|
|
81
|
-
className: (0,
|
|
82
|
+
className: (0, external_lib_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),
|
|
82
83
|
children: [
|
|
83
84
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(typeMeta.icon, {
|
|
84
85
|
size: 12
|
|
@@ -113,7 +114,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldT
|
|
|
113
114
|
className: isActive ? 'text-brand' : 'text-foreground-muted'
|
|
114
115
|
}),
|
|
115
116
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
116
|
-
className: (0,
|
|
117
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)(isActive && 'font-medium text-brand'),
|
|
117
118
|
children: meta.label
|
|
118
119
|
})
|
|
119
120
|
]
|
|
@@ -263,49 +264,45 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldT
|
|
|
263
264
|
})
|
|
264
265
|
]
|
|
265
266
|
}),
|
|
266
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
children: variable.label
|
|
306
|
-
}, variable.value))
|
|
307
|
-
})
|
|
308
|
-
]
|
|
267
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.VariablePicker, {
|
|
268
|
+
disabled: 0 === variables.length || !onValueChange,
|
|
269
|
+
items: [
|
|
270
|
+
{
|
|
271
|
+
id: 'vars',
|
|
272
|
+
label: '$vars',
|
|
273
|
+
type: 'object',
|
|
274
|
+
children: variables.map((variable)=>({
|
|
275
|
+
id: variable.value,
|
|
276
|
+
label: variable.label,
|
|
277
|
+
value: variable.value,
|
|
278
|
+
type: 'string'
|
|
279
|
+
}))
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
onSelect: (variable)=>{
|
|
283
|
+
if (!variable.value) return;
|
|
284
|
+
onValueChange?.(value ? `${value} ${variable.value}` : variable.value);
|
|
285
|
+
},
|
|
286
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
287
|
+
type: "button",
|
|
288
|
+
"aria-label": "Insert variable",
|
|
289
|
+
title: "Insert variable",
|
|
290
|
+
disabled: 0 === variables.length || !onValueChange,
|
|
291
|
+
className: (0, external_lib_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),
|
|
292
|
+
children: [
|
|
293
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Braces, {
|
|
294
|
+
size: 12
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
297
|
+
className: collapsedTextClass,
|
|
298
|
+
children: "Insert"
|
|
299
|
+
}),
|
|
300
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
301
|
+
size: 9,
|
|
302
|
+
className: collapsedTextClass
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
})
|
|
309
306
|
})
|
|
310
307
|
]
|
|
311
308
|
})
|
|
@@ -8,6 +8,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../popover.js";
|
|
|
8
8
|
import { Switch } from "../../switch.js";
|
|
9
9
|
import { Textarea } from "../../textarea.js";
|
|
10
10
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../tooltip.js";
|
|
11
|
+
import { VariablePicker } from "../../variable-picker/index.js";
|
|
11
12
|
import { cn } from "../../../../lib/index.js";
|
|
12
13
|
import { FIELD_TYPE_META, FIELD_TYPE_ORDER } from "../types.js";
|
|
13
14
|
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldTypeChange, onRequiredChange, controlsVisibility, compact, showFieldActions, value, onValueChange, variables, onGenerateWithAi, headerActions }) {
|
|
@@ -235,49 +236,45 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, onFieldT
|
|
|
235
236
|
})
|
|
236
237
|
]
|
|
237
238
|
}),
|
|
238
|
-
/*#__PURE__*/
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
children: variable.label
|
|
278
|
-
}, variable.value))
|
|
279
|
-
})
|
|
280
|
-
]
|
|
239
|
+
/*#__PURE__*/ jsx(VariablePicker, {
|
|
240
|
+
disabled: 0 === variables.length || !onValueChange,
|
|
241
|
+
items: [
|
|
242
|
+
{
|
|
243
|
+
id: 'vars',
|
|
244
|
+
label: '$vars',
|
|
245
|
+
type: 'object',
|
|
246
|
+
children: variables.map((variable)=>({
|
|
247
|
+
id: variable.value,
|
|
248
|
+
label: variable.label,
|
|
249
|
+
value: variable.value,
|
|
250
|
+
type: 'string'
|
|
251
|
+
}))
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
onSelect: (variable)=>{
|
|
255
|
+
if (!variable.value) return;
|
|
256
|
+
onValueChange?.(value ? `${value} ${variable.value}` : variable.value);
|
|
257
|
+
},
|
|
258
|
+
children: /*#__PURE__*/ jsxs("button", {
|
|
259
|
+
type: "button",
|
|
260
|
+
"aria-label": "Insert variable",
|
|
261
|
+
title: "Insert variable",
|
|
262
|
+
disabled: 0 === variables.length || !onValueChange,
|
|
263
|
+
className: 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),
|
|
264
|
+
children: [
|
|
265
|
+
/*#__PURE__*/ jsx(Braces, {
|
|
266
|
+
size: 12
|
|
267
|
+
}),
|
|
268
|
+
/*#__PURE__*/ jsx("span", {
|
|
269
|
+
className: collapsedTextClass,
|
|
270
|
+
children: "Insert"
|
|
271
|
+
}),
|
|
272
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
273
|
+
size: 9,
|
|
274
|
+
className: collapsedTextClass
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})
|
|
281
278
|
})
|
|
282
279
|
]
|
|
283
280
|
})
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
VariablePicker: ()=>external_variable_picker_cjs_namespaceObject.VariablePicker,
|
|
28
|
+
VariablePickerContent: ()=>external_variable_picker_cjs_namespaceObject.VariablePickerContent
|
|
29
|
+
});
|
|
30
|
+
const external_variable_picker_cjs_namespaceObject = require("./variable-picker.cjs");
|
|
31
|
+
exports.VariablePicker = __webpack_exports__.VariablePicker;
|
|
32
|
+
exports.VariablePickerContent = __webpack_exports__.VariablePickerContent;
|
|
33
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
34
|
+
"VariablePicker",
|
|
35
|
+
"VariablePickerContent"
|
|
36
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
37
|
+
Object.defineProperty(exports, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
@@ -0,0 +1,246 @@
|
|
|
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
|
+
VariablePicker: ()=>VariablePicker,
|
|
29
|
+
VariablePickerContent: ()=>VariablePickerContent
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const external_command_cjs_namespaceObject = require("../command.cjs");
|
|
35
|
+
const external_popover_cjs_namespaceObject = require("../popover.cjs");
|
|
36
|
+
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
37
|
+
const TYPE_LABEL = {
|
|
38
|
+
string: 'T',
|
|
39
|
+
number: '#',
|
|
40
|
+
boolean: '?',
|
|
41
|
+
object: '{}',
|
|
42
|
+
array: '[]',
|
|
43
|
+
null: '∅'
|
|
44
|
+
};
|
|
45
|
+
function VariableTypeBadge({ item }) {
|
|
46
|
+
const type = item.type ?? (item.children?.length ? 'object' : 'string');
|
|
47
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
className: "inline-flex h-[18px] min-w-[18px] shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 font-mono text-[9px] font-semibold leading-none text-foreground-muted [&_svg]:size-2.75",
|
|
50
|
+
children: item.icon ?? TYPE_LABEL[type] ?? type
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function itemMatches(item, normalizedQuery) {
|
|
54
|
+
return item.label.toLowerCase().includes(normalizedQuery) || item.value?.toLowerCase().includes(normalizedQuery) === true;
|
|
55
|
+
}
|
|
56
|
+
function filterItems(items, query) {
|
|
57
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
58
|
+
if (!normalizedQuery) return items;
|
|
59
|
+
return items.flatMap((item)=>{
|
|
60
|
+
if (itemMatches(item, normalizedQuery)) return [
|
|
61
|
+
item
|
|
62
|
+
];
|
|
63
|
+
const children = filterItems(item.children ?? [], normalizedQuery);
|
|
64
|
+
return children.length ? [
|
|
65
|
+
{
|
|
66
|
+
...item,
|
|
67
|
+
children
|
|
68
|
+
}
|
|
69
|
+
] : [];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function VariableRows({ items, filtering, expandedIds, onToggle, onSelect, insertLabel, depth = 0 }) {
|
|
73
|
+
return items.map((item)=>{
|
|
74
|
+
const hasChildren = !!item.children?.length;
|
|
75
|
+
const selectable = item.selectable ?? (!hasChildren || void 0 !== item.value);
|
|
76
|
+
const expanded = filtering || expandedIds.has(item.id);
|
|
77
|
+
const handleKeyDown = (event)=>{
|
|
78
|
+
if (!hasChildren || 'ArrowLeft' !== event.key && 'ArrowRight' !== event.key) return;
|
|
79
|
+
const shouldExpand = 'ArrowRight' === event.key;
|
|
80
|
+
if (expandedIds.has(item.id) !== shouldExpand) onToggle(item.id);
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
};
|
|
83
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
84
|
+
role: "none",
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandItem, {
|
|
87
|
+
value: item.id,
|
|
88
|
+
"aria-label": item.label,
|
|
89
|
+
disabled: item.disabled,
|
|
90
|
+
onKeyDown: handleKeyDown,
|
|
91
|
+
onSelect: ()=>hasChildren ? onToggle(item.id) : selectable && onSelect(item),
|
|
92
|
+
"data-expanded": hasChildren ? expanded : void 0,
|
|
93
|
+
className: "group min-h-0 gap-2 rounded-none py-1 pr-3.5 text-xs hover:bg-surface-overlay data-[selected=true]:bg-surface-overlay data-[selected=true]:text-foreground",
|
|
94
|
+
style: {
|
|
95
|
+
paddingLeft: `${8 + 16 * depth}px`
|
|
96
|
+
},
|
|
97
|
+
children: [
|
|
98
|
+
hasChildren ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
99
|
+
className: "grid size-3 shrink-0 place-items-center",
|
|
100
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
101
|
+
size: 10,
|
|
102
|
+
className: (0, index_cjs_namespaceObject.cn)('!size-2.5 text-foreground-subtle transition-transform duration-100', !expanded && '-rotate-90')
|
|
103
|
+
})
|
|
104
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
105
|
+
className: "size-3 shrink-0"
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariableTypeBadge, {
|
|
108
|
+
item: item
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
111
|
+
className: "min-w-0 flex-1 truncate font-mono text-foreground",
|
|
112
|
+
children: item.label
|
|
113
|
+
}),
|
|
114
|
+
item.trailingAdornment,
|
|
115
|
+
selectable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
116
|
+
type: "button",
|
|
117
|
+
"aria-label": `${insertLabel}: ${item.label}`,
|
|
118
|
+
disabled: item.disabled,
|
|
119
|
+
onClick: (event)=>{
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
onSelect(item);
|
|
122
|
+
},
|
|
123
|
+
className: "grid size-5 shrink-0 place-items-center text-foreground-muted opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-data-[selected=true]:opacity-100 focus-visible:opacity-100",
|
|
124
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.SquareArrowRightEnter, {
|
|
125
|
+
className: "!size-3.5"
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}),
|
|
130
|
+
hasChildren && expanded && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariableRows, {
|
|
131
|
+
items: item.children,
|
|
132
|
+
filtering: filtering,
|
|
133
|
+
expandedIds: expandedIds,
|
|
134
|
+
onToggle: onToggle,
|
|
135
|
+
onSelect: onSelect,
|
|
136
|
+
insertLabel: insertLabel,
|
|
137
|
+
depth: depth + 1
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}, item.id);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function VariablePickerContent({ items, onSelect, placeholder = 'Search variables...', emptyText = 'No variables found.', query: controlledQuery, initialQuery = '', onQueryChange, defaultExpandedIds, insertLabel = 'Insert variable', className }) {
|
|
144
|
+
const [uncontrolledQuery, setUncontrolledQuery] = (0, external_react_namespaceObject.useState)(initialQuery);
|
|
145
|
+
const [expandedIds, setExpandedIds] = (0, external_react_namespaceObject.useState)(()=>new Set(defaultExpandedIds ?? items.slice(0, 1).map((item)=>item.id)));
|
|
146
|
+
const query = controlledQuery ?? uncontrolledQuery;
|
|
147
|
+
const filteredItems = (0, external_react_namespaceObject.useMemo)(()=>filterItems(items, query), [
|
|
148
|
+
items,
|
|
149
|
+
query
|
|
150
|
+
]);
|
|
151
|
+
const setQuery = (nextQuery)=>{
|
|
152
|
+
if (void 0 === controlledQuery) setUncontrolledQuery(nextQuery);
|
|
153
|
+
onQueryChange?.(nextQuery);
|
|
154
|
+
};
|
|
155
|
+
const toggleExpanded = (id)=>{
|
|
156
|
+
setExpandedIds((current)=>{
|
|
157
|
+
const next = new Set(current);
|
|
158
|
+
if (next.has(id)) next.delete(id);
|
|
159
|
+
else next.add(id);
|
|
160
|
+
return next;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.Command, {
|
|
164
|
+
shouldFilter: false,
|
|
165
|
+
className: className,
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput, {
|
|
168
|
+
value: query,
|
|
169
|
+
onValueChange: setQuery,
|
|
170
|
+
placeholder: placeholder,
|
|
171
|
+
autoFocus: true
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandList, {
|
|
174
|
+
className: "max-h-72 bg-surface-overlay/40 py-1.5",
|
|
175
|
+
children: [
|
|
176
|
+
0 === filteredItems.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandEmpty, {
|
|
177
|
+
children: emptyText
|
|
178
|
+
}),
|
|
179
|
+
filteredItems.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariableRows, {
|
|
180
|
+
items: filteredItems,
|
|
181
|
+
filtering: query.trim().length > 0,
|
|
182
|
+
expandedIds: expandedIds,
|
|
183
|
+
onToggle: toggleExpanded,
|
|
184
|
+
onSelect: onSelect,
|
|
185
|
+
insertLabel: insertLabel
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function VariablePicker({ children, align = 'end', disabled = false, open: controlledOpen, onOpenChange, triggerLabel = 'Insert', triggerAriaLabel = 'Insert variable', className, onSelect, ...contentProps }) {
|
|
193
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
194
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
195
|
+
const setOpen = (nextOpen)=>{
|
|
196
|
+
if (void 0 === controlledOpen) setUncontrolledOpen(nextOpen);
|
|
197
|
+
onOpenChange?.(nextOpen);
|
|
198
|
+
};
|
|
199
|
+
const selectItem = (item)=>{
|
|
200
|
+
onSelect(item);
|
|
201
|
+
setOpen(false);
|
|
202
|
+
};
|
|
203
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
204
|
+
open: open,
|
|
205
|
+
onOpenChange: setOpen,
|
|
206
|
+
children: [
|
|
207
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
|
|
208
|
+
asChild: true,
|
|
209
|
+
disabled: disabled,
|
|
210
|
+
children: children ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
211
|
+
type: "button",
|
|
212
|
+
"aria-label": triggerAriaLabel,
|
|
213
|
+
className: "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",
|
|
214
|
+
children: [
|
|
215
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Braces, {
|
|
216
|
+
size: 12
|
|
217
|
+
}),
|
|
218
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
219
|
+
children: triggerLabel
|
|
220
|
+
}),
|
|
221
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
222
|
+
size: 9
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
})
|
|
226
|
+
}),
|
|
227
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
228
|
+
align: align,
|
|
229
|
+
className: (0, index_cjs_namespaceObject.cn)('w-[280px] max-w-[calc(100vw-1rem)] overflow-hidden p-0', className),
|
|
230
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariablePickerContent, {
|
|
231
|
+
...contentProps,
|
|
232
|
+
onSelect: selectItem
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
exports.VariablePicker = __webpack_exports__.VariablePicker;
|
|
239
|
+
exports.VariablePickerContent = __webpack_exports__.VariablePickerContent;
|
|
240
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
241
|
+
"VariablePicker",
|
|
242
|
+
"VariablePickerContent"
|
|
243
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
244
|
+
Object.defineProperty(exports, '__esModule', {
|
|
245
|
+
value: true
|
|
246
|
+
});
|