@uipath/apollo-wind 2.69.0 → 2.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/components/custom/demo-composer.cjs +80 -0
  2. package/dist/components/custom/demo-composer.d.ts +11 -0
  3. package/dist/components/custom/demo-composer.js +46 -0
  4. package/dist/components/custom/panel-flow.cjs +2 -2
  5. package/dist/components/custom/panel-flow.js +2 -2
  6. package/dist/components/forms/field-control.cjs +3 -2
  7. package/dist/components/forms/field-control.js +3 -2
  8. package/dist/components/forms/validation-converter.cjs +14 -5
  9. package/dist/components/forms/validation-converter.js +14 -5
  10. package/dist/components/ui/chat-composer.cjs +429 -0
  11. package/dist/components/ui/chat-composer.d.ts +157 -0
  12. package/dist/components/ui/chat-composer.js +359 -0
  13. package/dist/components/ui/chat-hero.cjs +244 -0
  14. package/dist/components/ui/chat-hero.d.ts +51 -0
  15. package/dist/components/ui/chat-hero.js +189 -0
  16. package/dist/components/ui/citation.cjs +188 -0
  17. package/dist/components/ui/citation.d.ts +42 -0
  18. package/dist/components/ui/citation.js +148 -0
  19. package/dist/components/ui/date-picker.cjs +6 -5
  20. package/dist/components/ui/date-picker.js +7 -6
  21. package/dist/components/ui/datetime-picker.cjs +7 -10
  22. package/dist/components/ui/datetime-picker.js +8 -11
  23. package/dist/components/ui/dropzone-overlay.cjs +142 -0
  24. package/dist/components/ui/dropzone-overlay.d.ts +27 -0
  25. package/dist/components/ui/dropzone-overlay.js +105 -0
  26. package/dist/components/ui/file-upload.cjs +5 -29
  27. package/dist/components/ui/file-upload.js +2 -26
  28. package/dist/components/ui/file-validation.cjs +91 -0
  29. package/dist/components/ui/file-validation.d.ts +24 -0
  30. package/dist/components/ui/file-validation.js +51 -0
  31. package/dist/components/ui/hover-card.cjs +15 -8
  32. package/dist/components/ui/hover-card.d.ts +4 -1
  33. package/dist/components/ui/hover-card.js +16 -9
  34. package/dist/components/ui/index.cjs +304 -216
  35. package/dist/components/ui/index.d.ts +8 -0
  36. package/dist/components/ui/index.js +8 -0
  37. package/dist/components/ui/input-group.cjs +1 -1
  38. package/dist/components/ui/input-group.d.ts +2 -1
  39. package/dist/components/ui/input-group.js +1 -1
  40. package/dist/components/ui/message-actions.cjs +302 -0
  41. package/dist/components/ui/message-actions.d.ts +102 -0
  42. package/dist/components/ui/message-actions.js +241 -0
  43. package/dist/components/ui/message.cjs +1 -1
  44. package/dist/components/ui/message.d.ts +2 -0
  45. package/dist/components/ui/message.js +1 -1
  46. package/dist/components/ui/prompt-suggestions.cjs +133 -0
  47. package/dist/components/ui/prompt-suggestions.d.ts +52 -0
  48. package/dist/components/ui/prompt-suggestions.js +90 -0
  49. package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
  50. package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
  51. package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
  52. package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
  53. package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
  54. package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
  55. package/dist/components/ui/quick-form-field/index.d.ts +1 -1
  56. package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
  57. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
  58. package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
  59. package/dist/components/ui/quick-form-field/types.cjs +2 -2
  60. package/dist/components/ui/quick-form-field/types.d.ts +39 -32
  61. package/dist/components/ui/quick-form-field/types.js +2 -2
  62. package/dist/components/ui/quick-form-field/utils.cjs +5 -59
  63. package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
  64. package/dist/components/ui/quick-form-field/utils.js +3 -48
  65. package/dist/components/ui/sources.cjs +175 -0
  66. package/dist/components/ui/sources.d.ts +44 -0
  67. package/dist/components/ui/sources.js +132 -0
  68. package/dist/index.cjs +156 -7
  69. package/dist/index.d.ts +17 -1
  70. package/dist/index.js +9 -1
  71. package/dist/lib/date-value.cjs +46 -0
  72. package/dist/lib/date-value.d.ts +8 -0
  73. package/dist/lib/date-value.js +12 -0
  74. package/dist/lib/index.cjs +8 -1
  75. package/dist/lib/index.d.ts +1 -0
  76. package/dist/lib/index.js +2 -1
  77. package/dist/lib/url.cjs +54 -0
  78. package/dist/lib/url.d.ts +8 -0
  79. package/dist/lib/url.js +17 -0
  80. package/dist/styles.css +239 -78
  81. package/dist/tailwind.utilities.css +15 -0
  82. package/package.json +1 -1
  83. package/dist/components/custom/chat-composer.cjs +0 -134
  84. package/dist/components/custom/chat-composer.d.ts +0 -14
  85. package/dist/components/custom/chat-composer.js +0 -100
  86. package/dist/components/custom/chat-first-experience.cjs +0 -87
  87. package/dist/components/custom/chat-first-experience.d.ts +0 -24
  88. package/dist/components/custom/chat-first-experience.js +0 -53
  89. package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
  90. package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
  91. package/dist/components/custom/chat-prompt-suggestions.js +0 -15
@@ -10,12 +10,13 @@ import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
10
10
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select.js";
11
11
  import { Switch } from "../switch.js";
12
12
  import { cn } from "../../../lib/index.js";
13
+ import { toDateValue } from "../../../lib/date-value.js";
13
14
  import { FieldMenu } from "../field-addons/field-menu.js";
14
15
  import { FieldHeader } from "./components/field-header.js";
15
16
  import { LockToggleButton } from "./components/lock-toggle-button.js";
16
17
  import { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META } from "./types.js";
17
- import { DEFAULT_SELECT_OPTIONS, formatDateValue, getLockedDisplayValue, parseDateValue, parseListValue, toDateOnlyString } from "./utils.js";
18
- function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, renderExpressionEditor, renderModeControl, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = true, options = DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
18
+ import { DEFAULT_SELECT_OPTIONS, formatDateValue, parseListValue, toDateOnlyString } from "./utils.js";
19
+ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, disabled = false, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, renderExpressionEditor, renderModeControl, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = true, options = DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
19
20
  const strings = useMemo(()=>({
20
21
  ...DEFAULT_QUICK_FORM_FIELD_STRINGS,
21
22
  ...stringOverrides
@@ -31,13 +32,12 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
31
32
  const fieldId = id ?? generatedId;
32
33
  const validationId = errorId ?? `${fieldId}-error`;
33
34
  const typeMeta = FIELD_TYPE_META[fieldType];
34
- const effectiveMode = 'expression' !== mode || typeMeta.supportsExpression ? mode : 'literal';
35
- const editableOnValueChange = locked ? void 0 : onValueChange;
35
+ const editableOnValueChange = disabled ? void 0 : onValueChange;
36
36
  const typeLabel = strings.typeLabels[fieldType] ?? typeMeta.label;
37
- const fieldLabel = 'expression' === effectiveMode ? strings.expressionFieldLabel(typeLabel) : strings.valueFieldLabel(typeLabel);
37
+ const fieldLabel = 'expression' === mode ? strings.expressionFieldLabel(typeLabel) : strings.valueFieldLabel(typeLabel);
38
38
  const valuePlaceholder = placeholder ?? fieldLabel;
39
39
  const menuActions = [
40
- ...more?.onClear && !locked ? [
40
+ ...more?.onClear ? [
41
41
  {
42
42
  id: 'clear',
43
43
  label: strings.clearValue,
@@ -54,13 +54,11 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
54
54
  }
55
55
  ] : []
56
56
  ];
57
- const offersModes = typeMeta.supportsExpression && !!onModeChange;
58
- const showsMenu = typeMeta.supportsExpression || menuActions.length > 0;
59
- const builtInMenu = showsMenu ? /*#__PURE__*/ jsx(FieldMenu, {
60
- mode: effectiveMode,
57
+ const builtInMenu = /*#__PURE__*/ jsx(FieldMenu, {
58
+ mode: mode,
61
59
  onSelect: (next)=>onModeChange?.(next),
62
- modesDisabled: !offersModes && menuActions.length > 0,
63
- disabled: !offersModes && 0 === menuActions.length,
60
+ modesDisabled: !onModeChange && menuActions.length > 0,
61
+ disabled: disabled || !onModeChange && 0 === menuActions.length,
64
62
  actions: menuActions,
65
63
  triggerLabel: strings.valueModeAriaLabel,
66
64
  literalDescription: strings.literalDescriptions[fieldType] ?? typeMeta.fixedDescription,
@@ -70,20 +68,22 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
70
68
  expressionDescription: strings.expressionDescription,
71
69
  fieldActions: strings.moreActionsAriaLabel
72
70
  }
73
- }) : null;
74
- const modeControl = renderModeControl?.(mode, {
71
+ });
72
+ const controlProps = {
75
73
  id: fieldId,
76
74
  value,
77
75
  onValueChange: editableOnValueChange,
78
76
  onBlur: onValueBlur,
79
77
  readOnly: !editableOnValueChange,
78
+ disabled,
80
79
  placeholder: valuePlaceholder,
81
80
  fieldType,
82
81
  'aria-invalid': error ? true : void 0,
83
82
  'aria-describedby': error ? validationId : void 0,
84
83
  'aria-errormessage': error ? validationId : void 0,
85
84
  'data-slot': 'input-group-control'
86
- }) ?? null;
85
+ };
86
+ const modeControl = renderModeControl?.(mode, controlProps) ?? null;
87
87
  const modeOnMount = useRef(mode);
88
88
  useEffect(()=>{
89
89
  if (modeOnMount.current === mode) return;
@@ -99,7 +99,7 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
99
99
  }
100
100
  if ('Escape' === e.key) {
101
101
  e.preventDefault();
102
- onValueChange?.(committedRef.current);
102
+ editableOnValueChange?.(committedRef.current);
103
103
  e.currentTarget.blur();
104
104
  }
105
105
  };
@@ -121,7 +121,139 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
121
121
  input.setSelectionRange(next_caret, next_caret);
122
122
  });
123
123
  };
124
- const lockedDisplayValue = getLockedDisplayValue(fieldType, value, options, strings);
124
+ const textInputProps = {
125
+ id: fieldId,
126
+ ref: valueInputRef,
127
+ readOnly: !editableOnValueChange,
128
+ disabled,
129
+ value,
130
+ onChange: (e)=>editableOnValueChange?.(e.target.value),
131
+ onFocus: (e)=>{
132
+ committedRef.current = value;
133
+ caretRef.current = {
134
+ start: e.currentTarget.selectionStart ?? value.length,
135
+ end: e.currentTarget.selectionEnd ?? value.length
136
+ };
137
+ },
138
+ onSelect: (e)=>{
139
+ const el = e.currentTarget;
140
+ caretRef.current = {
141
+ start: el.selectionStart ?? 0,
142
+ end: el.selectionEnd ?? el.selectionStart ?? 0
143
+ };
144
+ },
145
+ onKeyDown: handleValueKeyDown,
146
+ onBlur: (e)=>{
147
+ caretRef.current = {
148
+ start: e.currentTarget.selectionStart ?? value.length,
149
+ end: e.currentTarget.selectionEnd ?? value.length
150
+ };
151
+ onValueBlur?.();
152
+ },
153
+ placeholder: valuePlaceholder
154
+ };
155
+ const literalControl = 'boolean' === fieldType ? /*#__PURE__*/ jsx("div", {
156
+ className: "flex h-full flex-1 items-center px-3",
157
+ children: /*#__PURE__*/ jsx(Switch, {
158
+ id: fieldId,
159
+ "aria-invalid": controlProps['aria-invalid'],
160
+ "aria-describedby": controlProps['aria-describedby'],
161
+ "aria-errormessage": controlProps['aria-errormessage'],
162
+ checked: 'true' === value,
163
+ onCheckedChange: (checked)=>editableOnValueChange?.(String(checked)),
164
+ onBlur: onValueBlur,
165
+ disabled: !editableOnValueChange
166
+ })
167
+ }) : 'date' === fieldType ? /*#__PURE__*/ jsxs(Popover, {
168
+ open: datePopoverOpen,
169
+ onOpenChange: (open)=>{
170
+ setDatePopoverOpen(open);
171
+ if (!open) onValueBlur?.();
172
+ },
173
+ children: [
174
+ /*#__PURE__*/ jsx(PopoverTrigger, {
175
+ asChild: true,
176
+ children: /*#__PURE__*/ jsx("button", {
177
+ type: "button",
178
+ id: fieldId,
179
+ "data-slot": "input-group-control",
180
+ "aria-invalid": controlProps['aria-invalid'],
181
+ "aria-describedby": controlProps['aria-describedby'],
182
+ "aria-errormessage": controlProps['aria-errormessage'],
183
+ disabled: !editableOnValueChange,
184
+ className: "flex h-full flex-1 items-center text-left text-sm text-foreground outline-none disabled:cursor-not-allowed disabled:opacity-50",
185
+ children: value ? formatDateValue(value) : /*#__PURE__*/ jsx("span", {
186
+ className: "text-muted-foreground",
187
+ children: strings.pickDate
188
+ })
189
+ })
190
+ }),
191
+ /*#__PURE__*/ jsx(PopoverContent, {
192
+ align: "start",
193
+ className: "w-auto p-0",
194
+ children: /*#__PURE__*/ jsx(Calendar, {
195
+ mode: "single",
196
+ selected: toDateValue(value),
197
+ onSelect: (date)=>editableOnValueChange?.(date ? toDateOnlyString(date) : ''),
198
+ initialFocus: true
199
+ })
200
+ })
201
+ ]
202
+ }) : 'datetime' === fieldType ? /*#__PURE__*/ jsx(DateTimePicker, {
203
+ id: fieldId,
204
+ value: toDateValue(value),
205
+ onValueChange: (date)=>editableOnValueChange?.(date ? date.toISOString() : ''),
206
+ onOpenChange: (open)=>{
207
+ if (!open) onValueBlur?.();
208
+ },
209
+ disabled: !editableOnValueChange,
210
+ placeholder: valuePlaceholder
211
+ }) : 'file' === fieldType ? /*#__PURE__*/ jsx(FileUpload, {
212
+ id: fieldId,
213
+ ariaLabel: fileUploadAriaLabel ?? ('string' == typeof label ? label : fieldLabel),
214
+ className: "flex-1",
215
+ onFilesChange: (files)=>editableOnValueChange?.(files.map((f)=>f.name).join(', ')),
216
+ disabled: !editableOnValueChange,
217
+ onBlur: onValueBlur,
218
+ "aria-invalid": controlProps['aria-invalid'],
219
+ "aria-describedby": controlProps['aria-describedby'],
220
+ "aria-errormessage": controlProps['aria-errormessage']
221
+ }) : 'single-select' === fieldType ? /*#__PURE__*/ jsxs(Select, {
222
+ open: selectOpen,
223
+ onOpenChange: (open)=>{
224
+ setSelectOpen(open);
225
+ if (!open && selectOpen) onValueBlur?.();
226
+ },
227
+ value: value || void 0,
228
+ onValueChange: editableOnValueChange,
229
+ disabled: !editableOnValueChange,
230
+ children: [
231
+ /*#__PURE__*/ jsx(SelectTrigger, {
232
+ id: fieldId,
233
+ children: /*#__PURE__*/ jsx(SelectValue, {
234
+ placeholder: strings.selectOption
235
+ })
236
+ }),
237
+ /*#__PURE__*/ jsx(SelectContent, {
238
+ children: options.map((option)=>/*#__PURE__*/ jsx(SelectItem, {
239
+ value: option.value,
240
+ children: option.label
241
+ }, option.value))
242
+ })
243
+ ]
244
+ }) : 'multi-select' === fieldType ? /*#__PURE__*/ jsx(MultiSelect, {
245
+ id: fieldId,
246
+ options: options,
247
+ selected: parseListValue(value),
248
+ onChange: (selected)=>editableOnValueChange?.(JSON.stringify(selected)),
249
+ placeholder: strings.selectOptions,
250
+ disabled: !editableOnValueChange,
251
+ onBlur: onValueBlur
252
+ }) : /*#__PURE__*/ jsx(InputGroupInput, {
253
+ ...textInputProps,
254
+ type: 'integer' === fieldType || 'double' === fieldType ? 'number' : 'text',
255
+ step: 'double' === fieldType ? 'any' : void 0
256
+ });
125
257
  return /*#__PURE__*/ jsxs("div", {
126
258
  className: cn('@container group flex flex-col gap-1.5 [&>[data-slot=form-field-error]]:mt-0', className),
127
259
  children: [
@@ -135,6 +267,8 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
135
267
  onFieldTypeChange: onFieldTypeChange,
136
268
  onRequiredChange: onRequiredChange,
137
269
  compact: compact,
270
+ disabled: disabled,
271
+ isExpression: 'expression' === mode,
138
272
  showFieldActions: showFieldActions,
139
273
  onValueChange: editableOnValueChange,
140
274
  variables: variables,
@@ -146,224 +280,26 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
146
280
  headerActions: headerActions,
147
281
  strings: strings
148
282
  }),
149
- typeMeta.supportsExpression ? /*#__PURE__*/ jsxs(InputGroup, {
283
+ /*#__PURE__*/ jsxs(InputGroup, {
150
284
  error: error,
151
285
  errorId: validationId,
152
- layout: 'file' !== fieldType || locked || 'literal' !== effectiveMode ? 'row' : 'grow',
286
+ disabled: disabled,
287
+ layout: 'literal' === mode && ('file' === fieldType || 'multi-select' === fieldType) ? 'grow' : 'row',
153
288
  children: [
154
289
  (showLock || void 0 !== leadingAddon) && null !== leadingAddon && /*#__PURE__*/ jsx(InputGroupAddon, {
155
290
  align: "inline-start",
156
291
  children: void 0 !== leadingAddon ? leadingAddon : showLock && /*#__PURE__*/ jsx(LockToggleButton, {
157
292
  locked: locked,
158
293
  onLockedChange: onLockedChange,
294
+ disabled: disabled,
159
295
  strings: strings
160
296
  })
161
297
  }),
162
- modeControl ?? ('expression' === effectiveMode ? renderExpressionEditor ? renderExpressionEditor({
163
- id: fieldId,
164
- value,
165
- onValueChange: editableOnValueChange,
166
- onBlur: onValueBlur,
167
- readOnly: !editableOnValueChange,
168
- placeholder: valuePlaceholder,
169
- fieldType,
170
- 'aria-invalid': error ? true : void 0,
171
- 'aria-describedby': error ? validationId : void 0,
172
- 'aria-errormessage': error ? validationId : void 0,
173
- 'data-slot': 'input-group-control'
174
- }) : /*#__PURE__*/ jsx(InputGroupInput, {
175
- id: fieldId,
176
- ref: valueInputRef,
177
- readOnly: !editableOnValueChange,
178
- value: value,
179
- onChange: (e)=>editableOnValueChange?.(e.target.value),
180
- onFocus: (e)=>{
181
- committedRef.current = value;
182
- caretRef.current = {
183
- start: e.currentTarget.selectionStart ?? value.length,
184
- end: e.currentTarget.selectionEnd ?? value.length
185
- };
186
- },
187
- onSelect: (e)=>{
188
- const el = e.currentTarget;
189
- caretRef.current = {
190
- start: el.selectionStart ?? 0,
191
- end: el.selectionEnd ?? el.selectionStart ?? 0
192
- };
193
- },
194
- onKeyDown: handleValueKeyDown,
195
- onBlur: (e)=>{
196
- caretRef.current = {
197
- start: e.currentTarget.selectionStart ?? value.length,
198
- end: e.currentTarget.selectionEnd ?? value.length
199
- };
200
- onValueBlur?.();
201
- },
202
- placeholder: valuePlaceholder,
298
+ modeControl ?? ('expression' === mode ? renderExpressionEditor ? renderExpressionEditor(controlProps) : /*#__PURE__*/ jsx(InputGroupInput, {
299
+ ...textInputProps,
203
300
  className: "font-mono"
204
- }) : locked ? /*#__PURE__*/ jsx(InputGroupInput, {
205
- id: fieldId,
206
- readOnly: true,
207
- value: lockedDisplayValue,
208
- placeholder: valuePlaceholder,
209
- onBlur: onValueBlur
210
- }) : 'boolean' === fieldType ? /*#__PURE__*/ jsx("div", {
211
- className: "flex h-full flex-1 items-center px-3",
212
- children: /*#__PURE__*/ jsx(Switch, {
213
- id: fieldId,
214
- "aria-invalid": error ? true : void 0,
215
- "aria-describedby": error ? validationId : void 0,
216
- "aria-errormessage": error ? validationId : void 0,
217
- checked: 'true' === value,
218
- onCheckedChange: (checked)=>onValueChange?.(String(checked)),
219
- onBlur: onValueBlur,
220
- disabled: !onValueChange
221
- })
222
- }) : 'date' === fieldType ? /*#__PURE__*/ jsxs(Popover, {
223
- open: datePopoverOpen,
224
- onOpenChange: (open)=>{
225
- setDatePopoverOpen(open);
226
- if (!open) onValueBlur?.();
227
- },
228
- children: [
229
- /*#__PURE__*/ jsx(PopoverTrigger, {
230
- asChild: true,
231
- children: /*#__PURE__*/ jsx("button", {
232
- type: "button",
233
- id: fieldId,
234
- "data-slot": "input-group-control",
235
- "aria-invalid": error ? true : void 0,
236
- "aria-describedby": error ? validationId : void 0,
237
- "aria-errormessage": error ? validationId : void 0,
238
- disabled: !onValueChange,
239
- className: "flex h-full flex-1 items-center text-left text-sm text-foreground outline-none disabled:cursor-not-allowed disabled:opacity-50",
240
- children: value ? formatDateValue(value) : /*#__PURE__*/ jsx("span", {
241
- className: "text-muted-foreground",
242
- children: strings.pickDate
243
- })
244
- })
245
- }),
246
- /*#__PURE__*/ jsx(PopoverContent, {
247
- align: "start",
248
- className: "w-auto p-0",
249
- children: /*#__PURE__*/ jsx(Calendar, {
250
- mode: "single",
251
- selected: parseDateValue(value),
252
- onSelect: (date)=>onValueChange?.(date ? toDateOnlyString(date) : ''),
253
- initialFocus: true
254
- })
255
- })
256
- ]
257
- }) : 'datetime' === fieldType ? /*#__PURE__*/ jsx(DateTimePicker, {
258
- id: fieldId,
259
- value: parseDateValue(value),
260
- onValueChange: (date)=>onValueChange?.(date ? date.toISOString() : ''),
261
- onOpenChange: (open)=>{
262
- if (!open) onValueBlur?.();
263
- },
264
- disabled: !onValueChange,
265
- placeholder: valuePlaceholder
266
- }) : 'file' === fieldType ? /*#__PURE__*/ jsx(FileUpload, {
267
- id: fieldId,
268
- ariaLabel: fileUploadAriaLabel ?? ('string' == typeof label ? label : fieldLabel),
269
- className: "flex-1",
270
- onFilesChange: (files)=>onValueChange?.(files.map((f)=>f.name).join(', ')),
271
- disabled: !onValueChange,
272
- onBlur: onValueBlur,
273
- "aria-invalid": error ? true : void 0,
274
- "aria-describedby": error ? validationId : void 0,
275
- "aria-errormessage": error ? validationId : void 0
276
- }) : /*#__PURE__*/ jsx(InputGroupInput, {
277
- id: fieldId,
278
- ref: valueInputRef,
279
- type: 'integer' === fieldType || 'double' === fieldType ? 'number' : 'text',
280
- step: 'double' === fieldType ? 'any' : void 0,
281
- readOnly: !onValueChange,
282
- value: value,
283
- onChange: (e)=>onValueChange?.(e.target.value),
284
- onFocus: (e)=>{
285
- committedRef.current = value;
286
- caretRef.current = {
287
- start: e.currentTarget.selectionStart ?? value.length,
288
- end: e.currentTarget.selectionEnd ?? value.length
289
- };
290
- },
291
- onSelect: (e)=>{
292
- const el = e.currentTarget;
293
- caretRef.current = {
294
- start: el.selectionStart ?? 0,
295
- end: el.selectionEnd ?? el.selectionStart ?? 0
296
- };
297
- },
298
- onKeyDown: handleValueKeyDown,
299
- onBlur: (e)=>{
300
- caretRef.current = {
301
- start: e.currentTarget.selectionStart ?? value.length,
302
- end: e.currentTarget.selectionEnd ?? value.length
303
- };
304
- onValueBlur?.();
305
- },
306
- placeholder: valuePlaceholder
307
- })),
308
- null !== trailingAddon && (void 0 !== trailingAddon || builtInMenu) && /*#__PURE__*/ jsx(InputGroupAddon, {
309
- align: "inline-end",
310
- className: "cursor-default",
311
- children: void 0 !== trailingAddon ? trailingAddon : builtInMenu
312
- })
313
- ]
314
- }) : /*#__PURE__*/ jsxs(InputGroup, {
315
- error: error,
316
- errorId: validationId,
317
- layout: 'multi-select' !== fieldType || locked ? 'row' : 'grow',
318
- children: [
319
- (showLock || void 0 !== leadingAddon) && null !== leadingAddon && /*#__PURE__*/ jsx(InputGroupAddon, {
320
- align: "inline-start",
321
- children: void 0 !== leadingAddon ? leadingAddon : showLock && /*#__PURE__*/ jsx(LockToggleButton, {
322
- locked: locked,
323
- onLockedChange: onLockedChange,
324
- strings: strings
325
- })
326
- }),
327
- modeControl ?? (locked ? /*#__PURE__*/ jsx(InputGroupInput, {
328
- id: fieldId,
329
- readOnly: true,
330
- value: lockedDisplayValue,
331
- placeholder: valuePlaceholder,
332
- className: "min-w-0",
333
- onBlur: onValueBlur
334
- }) : 'single-select' === fieldType ? /*#__PURE__*/ jsxs(Select, {
335
- open: selectOpen,
336
- onOpenChange: (open)=>{
337
- setSelectOpen(open);
338
- if (!open && selectOpen) onValueBlur?.();
339
- },
340
- value: value || void 0,
341
- onValueChange: onValueChange,
342
- disabled: !onValueChange,
343
- children: [
344
- /*#__PURE__*/ jsx(SelectTrigger, {
345
- id: fieldId,
346
- children: /*#__PURE__*/ jsx(SelectValue, {
347
- placeholder: strings.selectOption
348
- })
349
- }),
350
- /*#__PURE__*/ jsx(SelectContent, {
351
- children: options.map((option)=>/*#__PURE__*/ jsx(SelectItem, {
352
- value: option.value,
353
- children: option.label
354
- }, option.value))
355
- })
356
- ]
357
- }) : 'multi-select' === fieldType ? /*#__PURE__*/ jsx(MultiSelect, {
358
- id: fieldId,
359
- options: options,
360
- selected: parseListValue(value),
361
- onChange: (selected)=>onValueChange?.(JSON.stringify(selected)),
362
- placeholder: strings.selectOptions,
363
- disabled: !onValueChange,
364
- onBlur: onValueBlur
365
- }) : null),
366
- null !== trailingAddon && (void 0 !== trailingAddon || builtInMenu) && /*#__PURE__*/ jsx(InputGroupAddon, {
301
+ }) : literalControl),
302
+ null !== trailingAddon && /*#__PURE__*/ jsx(InputGroupAddon, {
367
303
  align: "inline-end",
368
304
  className: "cursor-default",
369
305
  children: void 0 !== trailingAddon ? trailingAddon : builtInMenu
@@ -75,14 +75,14 @@ const FIELD_TYPE_META = {
75
75
  'single-select': {
76
76
  label: 'Single select',
77
77
  icon: external_lucide_react_namespaceObject.List,
78
- supportsExpression: false,
78
+ supportsExpression: true,
79
79
  fixedLabel: 'Fixed value',
80
80
  fixedDescription: 'Choose one option'
81
81
  },
82
82
  'multi-select': {
83
83
  label: 'Multi select',
84
84
  icon: external_lucide_react_namespaceObject.ListChecks,
85
- supportsExpression: false,
85
+ supportsExpression: true,
86
86
  fixedLabel: 'Fixed value',
87
87
  fixedDescription: 'Choose one or more options'
88
88
  },
@@ -6,6 +6,10 @@ export type QuickFieldType = 'string' | 'integer' | 'double' | 'date' | 'datetim
6
6
  interface FieldTypeMeta {
7
7
  label: string;
8
8
  icon: LucideIcon;
9
+ /**
10
+ * @deprecated Will expand mode support in future update. Currently unused.
11
+ * Removed in the next major release.
12
+ */
9
13
  supportsExpression: boolean;
10
14
  fixedLabel: string;
11
15
  fixedDescription: string;
@@ -32,8 +36,9 @@ export interface QuickFormFieldStrings {
32
36
  valueFieldLabel: (typeLabel: string) => string;
33
37
  /** The computed field name in expression mode, from the (localized) type label. */
34
38
  expressionFieldLabel: (typeLabel: string) => string;
35
- /** A locked boolean's displayed text. */
39
+ /** @deprecated No longer rendered: a locked boolean keeps its Switch. Removed in the next major release. */
36
40
  trueLabel: string;
41
+ /** @deprecated No longer rendered: a locked boolean keeps its Switch. Removed in the next major release. */
37
42
  falseLabel: string;
38
43
  requiredTooltip: string;
39
44
  requiredAriaLabel: string;
@@ -99,33 +104,59 @@ export interface VariableInsertContext {
99
104
  end: number;
100
105
  } | null;
101
106
  }
107
+ /** What a consumer-rendered value control receives from `renderModeControl` or `renderExpressionEditor`. */
108
+ export interface QuickFormFieldControlProps {
109
+ id: string;
110
+ value: string;
111
+ /** Omitted while the field is disabled or has no `onValueChange`. */
112
+ onValueChange?: (value: string) => void;
113
+ onBlur?: () => void;
114
+ readOnly: boolean;
115
+ disabled: boolean;
116
+ placeholder: string;
117
+ fieldType: QuickFieldType;
118
+ 'aria-invalid'?: AriaAttributes['aria-invalid'];
119
+ 'aria-describedby'?: string;
120
+ 'aria-errormessage'?: string;
121
+ 'data-slot'?: string;
122
+ }
102
123
  export interface QuickFormFieldProps {
103
124
  /** Current field value. Encoding depends on fieldType (e.g. multi-select is a JSON array string). */
104
125
  value?: string;
105
- /** Called when the user edits the value (only fires while unlocked). */
126
+ /** Called when the user edits the value. Never fires while `disabled`. */
106
127
  onValueChange?: (value: string) => void;
107
128
  /** Called when the active value control loses focus. */
108
129
  onValueBlur?: () => void;
109
- /** Whether the field is read-only. Defaults to true. */
130
+ /**
131
+ * Whether the value is read-only for the person filling in the form. It is
132
+ * configuration the author sets, so the value stays editable here; use
133
+ * `disabled` to stop editing. Defaults to true.
134
+ */
110
135
  locked?: boolean;
111
136
  /** Called when the user toggles the lock. */
112
137
  onLockedChange?: (locked: boolean) => void;
113
138
  /** Whether the built-in lock control renders. Defaults to true. */
114
139
  showLock?: boolean;
140
+ /**
141
+ * Disables every built-in control: the value control, the lock, the mode and
142
+ * actions menu, and the header's type picker, Required switch, Insert
143
+ * variable and AI assist. `headerActions` are the consumer's to disable.
144
+ */
145
+ disabled?: boolean;
115
146
  /**
116
147
  * Replaces the leading lock toggle with a semantic prefix such as `=`.
117
148
  * Pass `null` to suppress the built-in toggle; omitting the prop preserves it.
118
149
  */
119
150
  leadingAddon?: ReactNode;
120
151
  /**
121
- * Replaces the trailing fixed/expression menu with a consumer-provided action
122
- * for expression-capable field types. Pass `null` to suppress the built-in
152
+ * Replaces the trailing fixed/expression menu with a consumer-provided
153
+ * action. Pass `null` to suppress the built-in
123
154
  * menu; omitting the prop preserves it.
124
155
  */
125
156
  trailingAddon?: ReactNode;
126
157
  /** Adds a field-level overflow menu beside the value control. */
127
158
  more?: QuickFormFieldMoreActions;
128
- /** How the value is expressed. Defaults to 'literal'; `expression` falls back to `literal` for types that cannot hold one. */
159
+ /** How the value is expressed. Defaults to 'literal'. */
129
160
  mode?: QuickFormFieldMode;
130
161
  /** Called when the user switches modes. */
131
162
  onModeChange?: (mode: QuickFormFieldMode) => void;
@@ -137,19 +168,7 @@ export interface QuickFormFieldProps {
137
168
  * existing callers; `renderModeControl` wins when both are supplied and it
138
169
  * returns something for `expression`.
139
170
  */
140
- renderExpressionEditor?: (props: {
141
- id: string;
142
- value: string;
143
- onValueChange?: (value: string) => void;
144
- onBlur?: () => void;
145
- readOnly: boolean;
146
- placeholder: string;
147
- fieldType: QuickFieldType;
148
- 'aria-invalid'?: AriaAttributes['aria-invalid'];
149
- 'aria-describedby'?: string;
150
- 'aria-errormessage'?: string;
151
- 'data-slot'?: string;
152
- }) => ReactNode;
171
+ renderExpressionEditor?: (props: QuickFormFieldControlProps) => ReactNode;
153
172
  /**
154
173
  * Renders the value control for a given mode, replacing the built-in one.
155
174
  * `variable` and `prompt` have no built-in editor, and a surface that authors
@@ -159,19 +178,7 @@ export interface QuickFormFieldProps {
159
178
  * for the field's type, so an unhandled mode degrades to the literal editor
160
179
  * rather than rendering an empty row.
161
180
  */
162
- renderModeControl?: (mode: QuickFormFieldMode, props: {
163
- id: string;
164
- value: string;
165
- onValueChange?: (value: string) => void;
166
- onBlur?: () => void;
167
- readOnly: boolean;
168
- placeholder: string;
169
- fieldType: QuickFieldType;
170
- 'aria-invalid'?: AriaAttributes['aria-invalid'];
171
- 'aria-describedby'?: string;
172
- 'aria-errormessage'?: string;
173
- 'data-slot'?: string;
174
- }) => ReactNode;
181
+ renderModeControl?: (mode: QuickFormFieldMode, props: QuickFormFieldControlProps) => ReactNode;
175
182
  /**
176
183
  * Takes over what choosing a variable does to the value. The component owns
177
184
  * the picker and hands back the chosen entry exactly as supplied in
@@ -45,14 +45,14 @@ const FIELD_TYPE_META = {
45
45
  'single-select': {
46
46
  label: 'Single select',
47
47
  icon: List,
48
- supportsExpression: false,
48
+ supportsExpression: true,
49
49
  fixedLabel: 'Fixed value',
50
50
  fixedDescription: 'Choose one option'
51
51
  },
52
52
  'multi-select': {
53
53
  label: 'Multi select',
54
54
  icon: ListChecks,
55
- supportsExpression: false,
55
+ supportsExpression: true,
56
56
  fixedLabel: 'Fixed value',
57
57
  fixedDescription: 'Choose one or more options'
58
58
  },