@uipath/apollo-wind 2.93.0 → 2.94.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/forms/field-renderer.cjs +1 -1
- package/dist/components/forms/field-renderer.js +1 -1
- package/dist/components/forms/field-rules-strings.cjs +40 -0
- package/dist/components/forms/field-rules-strings.d.ts +17 -0
- package/dist/components/forms/field-rules-strings.js +6 -0
- package/dist/components/forms/field-rules.cjs +526 -0
- package/dist/components/forms/field-rules.d.ts +97 -0
- package/dist/components/forms/field-rules.js +468 -0
- package/dist/components/forms/form-designer.cjs +208 -592
- package/dist/components/forms/form-designer.js +210 -594
- package/dist/components/forms/form-schema.d.ts +5 -0
- package/dist/components/forms/index.cjs +43 -3
- package/dist/components/forms/index.d.ts +4 -0
- package/dist/components/forms/index.js +5 -1
- package/dist/components/forms/metadata-form.cjs +1 -1
- package/dist/components/forms/metadata-form.js +1 -1
- package/dist/components/forms/rules-engine-dialect.cjs +644 -0
- package/dist/components/forms/rules-engine-dialect.d.ts +90 -0
- package/dist/components/forms/rules-engine-dialect.js +537 -0
- package/dist/components/forms/rules-engine.cjs +99 -10
- package/dist/components/forms/rules-engine.d.ts +5 -0
- package/dist/components/forms/rules-engine.js +99 -10
- package/dist/components/forms/use-field-rules.cjs +122 -0
- package/dist/components/forms/use-field-rules.d.ts +31 -0
- package/dist/components/forms/use-field-rules.js +88 -0
- package/dist/components/ui/conditions-editor/condition-row.cjs +458 -0
- package/dist/components/ui/conditions-editor/condition-row.d.ts +23 -0
- package/dist/components/ui/conditions-editor/condition-row.js +421 -0
- package/dist/components/ui/conditions-editor/conditions-editor.cjs +363 -0
- package/dist/components/ui/conditions-editor/conditions-editor.d.ts +67 -0
- package/dist/components/ui/conditions-editor/conditions-editor.js +329 -0
- package/dist/components/ui/conditions-editor/context.cjs +45 -0
- package/dist/components/ui/conditions-editor/context.d.ts +54 -0
- package/dist/components/ui/conditions-editor/context.js +8 -0
- package/dist/components/ui/conditions-editor/index.cjs +55 -0
- package/dist/components/ui/conditions-editor/index.d.ts +6 -0
- package/dist/components/ui/conditions-editor/index.js +6 -0
- package/dist/components/ui/conditions-editor/model.cjs +126 -0
- package/dist/components/ui/conditions-editor/model.d.ts +39 -0
- package/dist/components/ui/conditions-editor/model.js +71 -0
- package/dist/components/ui/conditions-editor/status.cjs +198 -0
- package/dist/components/ui/conditions-editor/status.d.ts +44 -0
- package/dist/components/ui/conditions-editor/status.js +131 -0
- package/dist/components/ui/conditions-editor/strings.cjs +86 -0
- package/dist/components/ui/conditions-editor/strings.d.ts +62 -0
- package/dist/components/ui/conditions-editor/strings.js +52 -0
- package/dist/components/ui/conditions-editor/vocabulary.cjs +163 -0
- package/dist/components/ui/conditions-editor/vocabulary.d.ts +51 -0
- package/dist/components/ui/conditions-editor/vocabulary.js +129 -0
- package/dist/components/ui/field-actions/index.cjs +9 -2
- package/dist/components/ui/field-actions/index.d.ts +1 -0
- package/dist/components/ui/field-actions/index.js +2 -1
- package/dist/components/ui/field-actions/insert-variable-action.cjs +3 -1
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
- package/dist/components/ui/field-actions/insert-variable-action.js +3 -1
- package/dist/components/ui/field-actions/rules-action.cjs +244 -0
- package/dist/components/ui/field-actions/rules-action.d.ts +42 -0
- package/dist/components/ui/field-actions/rules-action.js +207 -0
- package/dist/components/ui/index.cjs +273 -234
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.js +3 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +137 -167
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +1 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +138 -168
- package/dist/components/ui/quick-form-field/components/header-actions.cjs +187 -0
- package/dist/components/ui/quick-form-field/components/header-actions.d.ts +59 -0
- package/dist/components/ui/quick-form-field/components/header-actions.js +138 -0
- package/dist/components/ui/quick-form-field/components/header-context.cjs +59 -0
- package/dist/components/ui/quick-form-field/components/header-context.d.ts +33 -0
- package/dist/components/ui/quick-form-field/components/header-context.js +16 -0
- package/dist/components/ui/quick-form-field/index.cjs +18 -4
- package/dist/components/ui/quick-form-field/index.d.ts +2 -0
- package/dist/components/ui/quick-form-field/index.js +3 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -6
- package/dist/components/ui/quick-form-field/quick-form-field.js +1 -1
- package/dist/components/ui/quick-form-field/types.d.ts +42 -11
- package/dist/components/ui/row-groups/add-row-button.cjs +54 -0
- package/dist/components/ui/row-groups/add-row-button.d.ts +10 -0
- package/dist/components/ui/row-groups/add-row-button.js +20 -0
- package/dist/components/ui/row-groups/after-press.cjs +73 -0
- package/dist/components/ui/row-groups/after-press.d.ts +7 -0
- package/dist/components/ui/row-groups/after-press.js +36 -0
- package/dist/components/ui/row-groups/collapsible-row-group.cjs +83 -0
- package/dist/components/ui/row-groups/collapsible-row-group.d.ts +13 -0
- package/dist/components/ui/row-groups/collapsible-row-group.js +49 -0
- package/dist/components/ui/row-groups/empty-rows.cjs +42 -0
- package/dist/components/ui/row-groups/empty-rows.d.ts +7 -0
- package/dist/components/ui/row-groups/empty-rows.js +8 -0
- package/dist/components/ui/row-groups/group-mode-toggle.cjs +80 -0
- package/dist/components/ui/row-groups/group-mode-toggle.d.ts +26 -0
- package/dist/components/ui/row-groups/group-mode-toggle.js +40 -0
- package/dist/components/ui/row-groups/index.cjs +62 -0
- package/dist/components/ui/row-groups/index.d.ts +6 -0
- package/dist/components/ui/row-groups/index.js +7 -0
- package/dist/components/ui/row-groups/row-delete-button.cjs +54 -0
- package/dist/components/ui/row-groups/row-delete-button.d.ts +18 -0
- package/dist/components/ui/row-groups/row-delete-button.js +20 -0
- package/dist/components/ui/row-groups/use-row-focus.cjs +82 -0
- package/dist/components/ui/row-groups/use-row-focus.d.ts +17 -0
- package/dist/components/ui/row-groups/use-row-focus.js +48 -0
- package/dist/components/ui/rules-editor/context.cjs +45 -0
- package/dist/components/ui/rules-editor/context.d.ts +52 -0
- package/dist/components/ui/rules-editor/context.js +8 -0
- package/dist/components/ui/rules-editor/index.cjs +56 -0
- package/dist/components/ui/rules-editor/index.d.ts +4 -0
- package/dist/components/ui/rules-editor/index.js +4 -0
- package/dist/components/ui/rules-editor/model.cjs +205 -0
- package/dist/components/ui/rules-editor/model.d.ts +128 -0
- package/dist/components/ui/rules-editor/model.js +144 -0
- package/dist/components/ui/rules-editor/rule-card.cjs +470 -0
- package/dist/components/ui/rules-editor/rule-card.d.ts +14 -0
- package/dist/components/ui/rules-editor/rule-card.js +436 -0
- package/dist/components/ui/rules-editor/rules-editor.cjs +160 -0
- package/dist/components/ui/rules-editor/rules-editor.d.ts +66 -0
- package/dist/components/ui/rules-editor/rules-editor.js +126 -0
- package/dist/components/ui/rules-editor/strings.cjs +68 -0
- package/dist/components/ui/rules-editor/strings.d.ts +56 -0
- package/dist/components/ui/rules-editor/strings.js +34 -0
- package/dist/index.cjs +129 -8
- package/dist/index.d.ts +17 -4
- package/dist/index.js +10 -3
- package/dist/styles.css +97 -24
- package/package.json +2 -2
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Asterisk
|
|
2
|
+
import { Asterisk } from "lucide-react";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
4
|
import { Button } from "../../button.js";
|
|
4
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../dropdown-menu.js";
|
|
5
5
|
import { FormFieldHeader } from "../../form-field.js";
|
|
6
6
|
import { InfoTooltip } from "../../info-tooltip.js";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger } from "../../popover.js";
|
|
8
8
|
import { Switch } from "../../switch.js";
|
|
9
9
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../tooltip.js";
|
|
10
10
|
import { cn } from "../../../../lib/index.js";
|
|
11
|
-
import { AiAssistAction } from "../../field-actions/ai-assist-action.js";
|
|
12
11
|
import { COLLAPSED_HIDDEN, COLLAPSED_ONLY, FIELD_ACTION_CLASS } from "../../field-actions/collapse.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { AiAssistControl, InsertVariableControl, TypePickerControl } from "./header-actions.js";
|
|
13
|
+
import { HeaderContext } from "./header-context.js";
|
|
14
|
+
const NO_CLAIMS = {
|
|
15
|
+
type: 0,
|
|
16
|
+
ai: 0,
|
|
17
|
+
insert: 0
|
|
18
|
+
};
|
|
15
19
|
const GROW_WHILE_EDITING = 'has-[[data-slot=editable-text-input]]:flex-1';
|
|
16
|
-
function FieldHeader({ label, labelAddon, tooltip, fieldId, fieldLabel, required, fieldType, fieldTypes
|
|
17
|
-
const typeMeta = FIELD_TYPE_META[fieldType];
|
|
18
|
-
const typeLabel = strings.typeLabels[fieldType] ?? typeMeta.label;
|
|
20
|
+
function FieldHeader({ label, labelAddon, tooltip, fieldId, fieldLabel, required, fieldType, fieldTypes, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
|
|
19
21
|
const collapsedTextClass = cn(COLLAPSED_HIDDEN, compact && '!hidden');
|
|
20
22
|
const compactOnlyClass = cn(COLLAPSED_ONLY, compact && '!flex');
|
|
23
|
+
const [claims, setClaims] = useState(NO_CLAIMS);
|
|
24
|
+
const claim = useCallback((kind)=>{
|
|
25
|
+
setClaims((c)=>({
|
|
26
|
+
...c,
|
|
27
|
+
[kind]: c[kind] + 1
|
|
28
|
+
}));
|
|
29
|
+
return ()=>setClaims((c)=>({
|
|
30
|
+
...c,
|
|
31
|
+
[kind]: c[kind] - 1
|
|
32
|
+
}));
|
|
33
|
+
}, []);
|
|
34
|
+
const claimed = {
|
|
35
|
+
type: claims.type > 0,
|
|
36
|
+
ai: claims.ai > 0,
|
|
37
|
+
insert: claims.insert > 0
|
|
38
|
+
};
|
|
39
|
+
const header = useMemo(()=>({
|
|
40
|
+
fieldType,
|
|
41
|
+
isExpression,
|
|
42
|
+
disabled,
|
|
43
|
+
compact: !!compact,
|
|
44
|
+
strings,
|
|
45
|
+
variables,
|
|
46
|
+
insertVariable: onInsertVariable,
|
|
47
|
+
canInsert: !!onValueChange,
|
|
48
|
+
claim
|
|
49
|
+
}), [
|
|
50
|
+
fieldType,
|
|
51
|
+
isExpression,
|
|
52
|
+
disabled,
|
|
53
|
+
compact,
|
|
54
|
+
strings,
|
|
55
|
+
variables,
|
|
56
|
+
onInsertVariable,
|
|
57
|
+
onValueChange,
|
|
58
|
+
claim
|
|
59
|
+
]);
|
|
21
60
|
const hasActions = !!onFieldTypeChange || !!onRequiredChange || showFieldActions || null != headerActions;
|
|
22
61
|
const hasTooltip = null != tooltip && false !== tooltip && !('string' == typeof tooltip && !tooltip.trim());
|
|
23
62
|
const ownLabel = null != label && hasTooltip ? /*#__PURE__*/ jsxs("span", {
|
|
@@ -46,87 +85,91 @@ function FieldHeader({ label, labelAddon, tooltip, fieldId, fieldLabel, required
|
|
|
46
85
|
children: alone
|
|
47
86
|
}) : alone;
|
|
48
87
|
}
|
|
49
|
-
return /*#__PURE__*/ jsx(
|
|
50
|
-
|
|
51
|
-
children: /*#__PURE__*/ jsx(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
return /*#__PURE__*/ jsx(HeaderContext.Provider, {
|
|
89
|
+
value: header,
|
|
90
|
+
children: /*#__PURE__*/ jsx(TooltipProvider, {
|
|
91
|
+
delayDuration: 300,
|
|
92
|
+
children: /*#__PURE__*/ jsx(FormFieldHeader, {
|
|
93
|
+
className: "[&:has([data-slot=editable-text-input])>:first-child]:flex-1 [&:has([data-slot=editable-text-input])>:nth-child(2)]:!hidden",
|
|
94
|
+
label: null == label ? fieldLabel : void 0,
|
|
95
|
+
htmlFor: fieldId,
|
|
96
|
+
required: required,
|
|
97
|
+
tooltip: null == label ? tooltip : void 0,
|
|
98
|
+
tooltipAriaLabel: strings.tooltipAriaLabel,
|
|
99
|
+
leading: leading,
|
|
100
|
+
actions: hasActions ? /*#__PURE__*/ jsxs("div", {
|
|
101
|
+
className: "flex items-center gap-0.5",
|
|
102
|
+
children: [
|
|
103
|
+
onFieldTypeChange && !claimed.type && /*#__PURE__*/ jsx(TypePickerControl, {
|
|
104
|
+
header: header,
|
|
105
|
+
value: fieldType,
|
|
106
|
+
types: fieldTypes,
|
|
107
|
+
onValueChange: onFieldTypeChange
|
|
108
|
+
}),
|
|
109
|
+
onRequiredChange && /*#__PURE__*/ jsxs(Fragment, {
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsx("div", {
|
|
112
|
+
className: collapsedTextClass,
|
|
113
|
+
children: /*#__PURE__*/ jsxs(Tooltip, {
|
|
67
114
|
children: [
|
|
68
115
|
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
69
116
|
asChild: true,
|
|
70
|
-
children: /*#__PURE__*/ jsx(
|
|
71
|
-
|
|
72
|
-
children: /*#__PURE__*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"aria-label": strings.fieldTypeAriaLabel,
|
|
117
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
118
|
+
className: "inline-flex",
|
|
119
|
+
children: /*#__PURE__*/ jsx(Switch, {
|
|
120
|
+
size: "sm",
|
|
121
|
+
checked: !!required,
|
|
122
|
+
onCheckedChange: onRequiredChange,
|
|
77
123
|
disabled: disabled,
|
|
78
|
-
className:
|
|
79
|
-
|
|
80
|
-
/*#__PURE__*/ jsx(typeMeta.icon, {}),
|
|
81
|
-
/*#__PURE__*/ jsx("span", {
|
|
82
|
-
className: collapsedTextClass,
|
|
83
|
-
children: typeLabel
|
|
84
|
-
}),
|
|
85
|
-
/*#__PURE__*/ jsx(ChevronDown, {
|
|
86
|
-
className: cn('!size-2.5', collapsedTextClass)
|
|
87
|
-
})
|
|
88
|
-
]
|
|
124
|
+
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
125
|
+
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
89
126
|
})
|
|
90
127
|
})
|
|
91
128
|
}),
|
|
92
129
|
/*#__PURE__*/ jsx(TooltipContent, {
|
|
93
|
-
children: strings.
|
|
130
|
+
children: strings.requiredTooltip
|
|
94
131
|
})
|
|
95
132
|
]
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return /*#__PURE__*/ jsxs(DropdownMenuItem, {
|
|
104
|
-
onClick: ()=>onFieldTypeChange(type),
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ jsx("div", {
|
|
136
|
+
className: compactOnlyClass,
|
|
137
|
+
children: /*#__PURE__*/ jsxs(Popover, {
|
|
138
|
+
children: [
|
|
139
|
+
/*#__PURE__*/ jsxs(Tooltip, {
|
|
105
140
|
children: [
|
|
106
|
-
/*#__PURE__*/ jsx(
|
|
107
|
-
|
|
141
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
142
|
+
asChild: true,
|
|
143
|
+
children: /*#__PURE__*/ jsx(PopoverTrigger, {
|
|
144
|
+
asChild: true,
|
|
145
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
146
|
+
type: "button",
|
|
147
|
+
variant: "ghost",
|
|
148
|
+
size: "3xs",
|
|
149
|
+
icon: true,
|
|
150
|
+
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel,
|
|
151
|
+
disabled: disabled,
|
|
152
|
+
className: FIELD_ACTION_CLASS,
|
|
153
|
+
children: /*#__PURE__*/ jsx(Asterisk, {})
|
|
154
|
+
})
|
|
155
|
+
})
|
|
108
156
|
}),
|
|
109
|
-
/*#__PURE__*/ jsx(
|
|
110
|
-
|
|
111
|
-
children: strings.typeLabels[type] ?? meta.label
|
|
157
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
158
|
+
children: strings.requiredTooltip
|
|
112
159
|
})
|
|
113
160
|
]
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
asChild: true,
|
|
127
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
128
|
-
className: "inline-flex",
|
|
129
|
-
children: /*#__PURE__*/ jsx(Switch, {
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
163
|
+
align: "end",
|
|
164
|
+
className: "w-48",
|
|
165
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
166
|
+
className: "flex items-center justify-between gap-3",
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ jsx("span", {
|
|
169
|
+
className: "text-xs font-medium text-foreground",
|
|
170
|
+
children: strings.requiredTooltip
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ jsx(Switch, {
|
|
130
173
|
size: "sm",
|
|
131
174
|
checked: !!required,
|
|
132
175
|
onCheckedChange: onRequiredChange,
|
|
@@ -134,102 +177,29 @@ function FieldHeader({ label, labelAddon, tooltip, fieldId, fieldLabel, required
|
|
|
134
177
|
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
135
178
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
136
179
|
})
|
|
137
|
-
})
|
|
138
|
-
}),
|
|
139
|
-
/*#__PURE__*/ jsx(TooltipContent, {
|
|
140
|
-
children: strings.requiredTooltip
|
|
141
|
-
})
|
|
142
|
-
]
|
|
143
|
-
})
|
|
144
|
-
}),
|
|
145
|
-
/*#__PURE__*/ jsx("div", {
|
|
146
|
-
className: compactOnlyClass,
|
|
147
|
-
children: /*#__PURE__*/ jsxs(Popover, {
|
|
148
|
-
children: [
|
|
149
|
-
/*#__PURE__*/ jsxs(Tooltip, {
|
|
150
|
-
children: [
|
|
151
|
-
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
152
|
-
asChild: true,
|
|
153
|
-
children: /*#__PURE__*/ jsx(PopoverTrigger, {
|
|
154
|
-
asChild: true,
|
|
155
|
-
children: /*#__PURE__*/ jsx(Button, {
|
|
156
|
-
type: "button",
|
|
157
|
-
variant: "ghost",
|
|
158
|
-
size: "3xs",
|
|
159
|
-
icon: true,
|
|
160
|
-
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel,
|
|
161
|
-
disabled: disabled,
|
|
162
|
-
className: FIELD_ACTION_CLASS,
|
|
163
|
-
children: /*#__PURE__*/ jsx(Asterisk, {})
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
}),
|
|
167
|
-
/*#__PURE__*/ jsx(TooltipContent, {
|
|
168
|
-
children: strings.requiredTooltip
|
|
169
|
-
})
|
|
170
180
|
]
|
|
171
|
-
}),
|
|
172
|
-
/*#__PURE__*/ jsx(PopoverContent, {
|
|
173
|
-
align: "end",
|
|
174
|
-
className: "w-48",
|
|
175
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
176
|
-
className: "flex items-center justify-between gap-3",
|
|
177
|
-
children: [
|
|
178
|
-
/*#__PURE__*/ jsx("span", {
|
|
179
|
-
className: "text-xs font-medium text-foreground",
|
|
180
|
-
children: strings.requiredTooltip
|
|
181
|
-
}),
|
|
182
|
-
/*#__PURE__*/ jsx(Switch, {
|
|
183
|
-
size: "sm",
|
|
184
|
-
checked: !!required,
|
|
185
|
-
onCheckedChange: onRequiredChange,
|
|
186
|
-
disabled: disabled,
|
|
187
|
-
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
188
|
-
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
189
|
-
})
|
|
190
|
-
]
|
|
191
|
-
})
|
|
192
181
|
})
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
]
|
|
197
|
-
}),
|
|
198
|
-
showFieldActions && /*#__PURE__*/ jsxs(Fragment, {
|
|
199
|
-
children: [
|
|
200
|
-
onGenerateWithAi && /*#__PURE__*/ jsx(AiAssistAction, {
|
|
201
|
-
onGenerate: onGenerateWithAi,
|
|
202
|
-
disabled: disabled,
|
|
203
|
-
hint: strings.aiOutputHint(strings.aiOutputLabel(typeLabel, isExpression)),
|
|
204
|
-
strings: {
|
|
205
|
-
trigger: strings.aiAssistAriaLabel,
|
|
206
|
-
tooltip: strings.aiAssistTooltip,
|
|
207
|
-
prompt: strings.aiPromptLabel,
|
|
208
|
-
promptPlaceholder: strings.aiPromptPlaceholder,
|
|
209
|
-
generate: strings.aiGenerate,
|
|
210
|
-
generating: strings.aiGenerating,
|
|
211
|
-
error: strings.aiError
|
|
212
|
-
}
|
|
213
|
-
}),
|
|
214
|
-
onInsertVariable && /*#__PURE__*/ jsx(InsertVariableAction, {
|
|
215
|
-
variables: variables.items,
|
|
216
|
-
compact: compact,
|
|
217
|
-
disabled: !onValueChange,
|
|
218
|
-
strings: {
|
|
219
|
-
label: strings.insertLabel,
|
|
220
|
-
ariaLabel: strings.insertAriaLabel,
|
|
221
|
-
searchPlaceholder: strings.insertSearchPlaceholder,
|
|
222
|
-
empty: strings.insertEmpty
|
|
223
|
-
},
|
|
224
|
-
onInsert: (_, item)=>onInsertVariable(variables.resolve(item))
|
|
182
|
+
})
|
|
183
|
+
]
|
|
225
184
|
})
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
}),
|
|
188
|
+
showFieldActions && /*#__PURE__*/ jsxs(Fragment, {
|
|
189
|
+
children: [
|
|
190
|
+
onGenerateWithAi && !claimed.ai && /*#__PURE__*/ jsx(AiAssistControl, {
|
|
191
|
+
header: header,
|
|
192
|
+
onGenerate: onGenerateWithAi
|
|
193
|
+
}),
|
|
194
|
+
!claimed.insert && /*#__PURE__*/ jsx(InsertVariableControl, {
|
|
195
|
+
header: header
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}),
|
|
199
|
+
headerActions
|
|
200
|
+
]
|
|
201
|
+
}) : void 0
|
|
202
|
+
})
|
|
233
203
|
})
|
|
234
204
|
});
|
|
235
205
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
QuickFormFieldTypePicker: ()=>QuickFormFieldTypePicker,
|
|
28
|
+
TypePickerControl: ()=>TypePickerControl,
|
|
29
|
+
QuickFormFieldInsertVariable: ()=>QuickFormFieldInsertVariable,
|
|
30
|
+
InsertVariableControl: ()=>InsertVariableControl,
|
|
31
|
+
QuickFormFieldAiAssist: ()=>QuickFormFieldAiAssist,
|
|
32
|
+
AiAssistControl: ()=>AiAssistControl
|
|
33
|
+
});
|
|
34
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
35
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
36
|
+
const external_button_cjs_namespaceObject = require("../../button.cjs");
|
|
37
|
+
const external_dropdown_menu_cjs_namespaceObject = require("../../dropdown-menu.cjs");
|
|
38
|
+
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
39
|
+
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
40
|
+
const ai_assist_action_cjs_namespaceObject = require("../../field-actions/ai-assist-action.cjs");
|
|
41
|
+
const collapse_cjs_namespaceObject = require("../../field-actions/collapse.cjs");
|
|
42
|
+
const insert_variable_action_cjs_namespaceObject = require("../../field-actions/insert-variable-action.cjs");
|
|
43
|
+
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
44
|
+
const external_header_context_cjs_namespaceObject = require("./header-context.cjs");
|
|
45
|
+
function QuickFormFieldTypePicker(props) {
|
|
46
|
+
const header = (0, external_header_context_cjs_namespaceObject.useHeaderContext)();
|
|
47
|
+
(0, external_header_context_cjs_namespaceObject.useClaimHeaderAction)(header, 'type');
|
|
48
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TypePickerControl, {
|
|
49
|
+
...props,
|
|
50
|
+
header: header
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function TypePickerControl({ onValueChange, value, types = external_types_cjs_namespaceObject.FIELD_TYPE_ORDER, disabled, compact, header }) {
|
|
54
|
+
const strings = header?.strings ?? external_types_cjs_namespaceObject.DEFAULT_QUICK_FORM_FIELD_STRINGS;
|
|
55
|
+
const fieldType = value ?? header?.fieldType ?? 'string';
|
|
56
|
+
const meta = external_types_cjs_namespaceObject.FIELD_TYPE_META[fieldType];
|
|
57
|
+
const collapsedTextClass = (0, index_cjs_namespaceObject.cn)(collapse_cjs_namespaceObject.COLLAPSED_HIDDEN, (compact ?? header?.compact) && '!hidden');
|
|
58
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
61
|
+
children: [
|
|
62
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
63
|
+
asChild: true,
|
|
64
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
65
|
+
asChild: true,
|
|
66
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
67
|
+
type: "button",
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
size: "3xs",
|
|
70
|
+
"aria-label": strings.fieldTypeAriaLabel,
|
|
71
|
+
disabled: disabled || header?.disabled,
|
|
72
|
+
className: (0, index_cjs_namespaceObject.cn)('gap-1', collapse_cjs_namespaceObject.FIELD_ACTION_CLASS),
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(meta.icon, {}),
|
|
75
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
76
|
+
className: collapsedTextClass,
|
|
77
|
+
children: strings.typeLabels[fieldType] ?? meta.label
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
|
|
80
|
+
className: (0, index_cjs_namespaceObject.cn)('!size-2.5', collapsedTextClass)
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
87
|
+
children: strings.fieldTypeTooltip
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuContent, {
|
|
92
|
+
align: "end",
|
|
93
|
+
className: "w-44",
|
|
94
|
+
children: types.map((type)=>{
|
|
95
|
+
const option = external_types_cjs_namespaceObject.FIELD_TYPE_META[type];
|
|
96
|
+
const isActive = type === fieldType;
|
|
97
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
98
|
+
onClick: ()=>onValueChange(type),
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(option.icon, {
|
|
101
|
+
className: isActive ? 'text-brand' : 'text-foreground-muted'
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
104
|
+
className: (0, index_cjs_namespaceObject.cn)(isActive && 'font-medium text-brand'),
|
|
105
|
+
children: strings.typeLabels[type] ?? option.label
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}, type);
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function QuickFormFieldAiAssist(props) {
|
|
115
|
+
const header = (0, external_header_context_cjs_namespaceObject.useHeaderContext)();
|
|
116
|
+
(0, external_header_context_cjs_namespaceObject.useClaimHeaderAction)(header, 'ai');
|
|
117
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AiAssistControl, {
|
|
118
|
+
...props,
|
|
119
|
+
header: header
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function AiAssistControl({ onGenerate, renderContent, hint, disabled, header }) {
|
|
123
|
+
const strings = header?.strings ?? external_types_cjs_namespaceObject.DEFAULT_QUICK_FORM_FIELD_STRINGS;
|
|
124
|
+
const fieldType = header?.fieldType ?? 'string';
|
|
125
|
+
const typeLabel = strings.typeLabels[fieldType] ?? external_types_cjs_namespaceObject.FIELD_TYPE_META[fieldType].label;
|
|
126
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ai_assist_action_cjs_namespaceObject.AiAssistAction, {
|
|
127
|
+
onGenerate: onGenerate,
|
|
128
|
+
renderContent: renderContent,
|
|
129
|
+
disabled: disabled || header?.disabled,
|
|
130
|
+
hint: hint ?? strings.aiOutputHint(strings.aiOutputLabel(typeLabel, !!header?.isExpression)),
|
|
131
|
+
strings: {
|
|
132
|
+
trigger: strings.aiAssistAriaLabel,
|
|
133
|
+
tooltip: strings.aiAssistTooltip,
|
|
134
|
+
prompt: strings.aiPromptLabel,
|
|
135
|
+
promptPlaceholder: strings.aiPromptPlaceholder,
|
|
136
|
+
generate: strings.aiGenerate,
|
|
137
|
+
generating: strings.aiGenerating,
|
|
138
|
+
error: strings.aiError
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function QuickFormFieldInsertVariable(props) {
|
|
143
|
+
const header = (0, external_header_context_cjs_namespaceObject.useHeaderContext)();
|
|
144
|
+
(0, external_header_context_cjs_namespaceObject.useClaimHeaderAction)(header, 'insert');
|
|
145
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertVariableControl, {
|
|
146
|
+
...props,
|
|
147
|
+
header: header
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function InsertVariableControl({ renderPicker, disabled, compact, header }) {
|
|
151
|
+
const insert = header?.insertVariable;
|
|
152
|
+
if (!header || !insert) return null;
|
|
153
|
+
const { strings, variables } = header;
|
|
154
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(insert_variable_action_cjs_namespaceObject.InsertVariableAction, {
|
|
155
|
+
variables: variables.items,
|
|
156
|
+
renderPicker: renderPicker,
|
|
157
|
+
compact: compact,
|
|
158
|
+
disabled: disabled || header.disabled || !header.canInsert,
|
|
159
|
+
strings: {
|
|
160
|
+
label: strings.insertLabel,
|
|
161
|
+
ariaLabel: strings.insertAriaLabel,
|
|
162
|
+
searchPlaceholder: strings.insertSearchPlaceholder,
|
|
163
|
+
empty: strings.insertEmpty
|
|
164
|
+
},
|
|
165
|
+
onInsert: (value, item)=>insert(renderPicker ? {
|
|
166
|
+
label: item.label,
|
|
167
|
+
value
|
|
168
|
+
} : variables.resolve(item))
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
exports.AiAssistControl = __webpack_exports__.AiAssistControl;
|
|
172
|
+
exports.InsertVariableControl = __webpack_exports__.InsertVariableControl;
|
|
173
|
+
exports.QuickFormFieldAiAssist = __webpack_exports__.QuickFormFieldAiAssist;
|
|
174
|
+
exports.QuickFormFieldInsertVariable = __webpack_exports__.QuickFormFieldInsertVariable;
|
|
175
|
+
exports.QuickFormFieldTypePicker = __webpack_exports__.QuickFormFieldTypePicker;
|
|
176
|
+
exports.TypePickerControl = __webpack_exports__.TypePickerControl;
|
|
177
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
178
|
+
"AiAssistControl",
|
|
179
|
+
"InsertVariableControl",
|
|
180
|
+
"QuickFormFieldAiAssist",
|
|
181
|
+
"QuickFormFieldInsertVariable",
|
|
182
|
+
"QuickFormFieldTypePicker",
|
|
183
|
+
"TypePickerControl"
|
|
184
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
185
|
+
Object.defineProperty(exports, '__esModule', {
|
|
186
|
+
value: true
|
|
187
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { RenderVariablePicker } from '../../variable-picker';
|
|
3
|
+
import { type AiAssistActionProps } from '../../field-actions/ai-assist-action';
|
|
4
|
+
import type { QuickFieldType } from '../types';
|
|
5
|
+
import { type HeaderContextValue } from './header-context';
|
|
6
|
+
type WithHeader<P> = P & {
|
|
7
|
+
header: HeaderContextValue | null;
|
|
8
|
+
};
|
|
9
|
+
export interface QuickFormFieldTypePickerProps {
|
|
10
|
+
onValueChange: (fieldType: QuickFieldType) => void;
|
|
11
|
+
/** The type shown as picked. Defaults to the field's `fieldType`. */
|
|
12
|
+
value?: QuickFieldType;
|
|
13
|
+
/** Which types it offers, in display order. Defaults to `FIELD_TYPE_ORDER`. */
|
|
14
|
+
types?: readonly QuickFieldType[];
|
|
15
|
+
/** Disabled while the field is, too. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Icon only, or with its text even in a `compact` field. Defaults to the field's `compact`. Below
|
|
19
|
+
* a 260px `@container` it collapses to its icon either way.
|
|
20
|
+
*/
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The field's type picker, for a QuickFormField's `headerActions`. Labelled from the field's
|
|
25
|
+
* `strings`. Outside a field it needs an ancestor `TooltipProvider`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function QuickFormFieldTypePicker(props: QuickFormFieldTypePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function TypePickerControl({ onValueChange, value, types, disabled, compact, header, }: WithHeader<QuickFormFieldTypePickerProps>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export interface QuickFormFieldAiAssistProps extends Pick<AiAssistActionProps, 'onGenerate' | 'renderContent'> {
|
|
30
|
+
/** A line under the prompt. Defaults to what the field's value is, from its `strings`. */
|
|
31
|
+
hint?: ReactNode;
|
|
32
|
+
/** Disabled while the field is, too. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* AI assist for a QuickFormField's `headerActions`, worded from the field's `strings`. Outside a
|
|
37
|
+
* field it needs an ancestor `TooltipProvider`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function QuickFormFieldAiAssist(props: QuickFormFieldAiAssistProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function AiAssistControl({ onGenerate, renderContent, hint, disabled, header, }: WithHeader<QuickFormFieldAiAssistProps>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export interface QuickFormFieldInsertVariableProps {
|
|
42
|
+
/** The host's own picker, in place of the one over the field's `variables`. */
|
|
43
|
+
renderPicker?: RenderVariablePicker;
|
|
44
|
+
/** Disabled while the field is, or its value read-only, too. */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Icon only, or with its text even in a `compact` field. Defaults to the field's `compact`. Below
|
|
48
|
+
* a 260px `@container` it collapses to its icon either way.
|
|
49
|
+
*/
|
|
50
|
+
compact?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Insert variable for a QuickFormField's `headerActions`: offers the field's `variables` and
|
|
54
|
+
* inserts at its caret, or through its `onInsertVariable`. Renders nothing outside a field, or
|
|
55
|
+
* while the value is a variable binding, whose picker is the value control.
|
|
56
|
+
*/
|
|
57
|
+
export declare function QuickFormFieldInsertVariable(props: QuickFormFieldInsertVariableProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export declare function InsertVariableControl({ renderPicker, disabled, compact, header, }: WithHeader<QuickFormFieldInsertVariableProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
+
export {};
|