@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.
Files changed (124) hide show
  1. package/dist/components/forms/field-renderer.cjs +1 -1
  2. package/dist/components/forms/field-renderer.js +1 -1
  3. package/dist/components/forms/field-rules-strings.cjs +40 -0
  4. package/dist/components/forms/field-rules-strings.d.ts +17 -0
  5. package/dist/components/forms/field-rules-strings.js +6 -0
  6. package/dist/components/forms/field-rules.cjs +526 -0
  7. package/dist/components/forms/field-rules.d.ts +97 -0
  8. package/dist/components/forms/field-rules.js +468 -0
  9. package/dist/components/forms/form-designer.cjs +208 -592
  10. package/dist/components/forms/form-designer.js +210 -594
  11. package/dist/components/forms/form-schema.d.ts +5 -0
  12. package/dist/components/forms/index.cjs +43 -3
  13. package/dist/components/forms/index.d.ts +4 -0
  14. package/dist/components/forms/index.js +5 -1
  15. package/dist/components/forms/metadata-form.cjs +1 -1
  16. package/dist/components/forms/metadata-form.js +1 -1
  17. package/dist/components/forms/rules-engine-dialect.cjs +644 -0
  18. package/dist/components/forms/rules-engine-dialect.d.ts +90 -0
  19. package/dist/components/forms/rules-engine-dialect.js +537 -0
  20. package/dist/components/forms/rules-engine.cjs +99 -10
  21. package/dist/components/forms/rules-engine.d.ts +5 -0
  22. package/dist/components/forms/rules-engine.js +99 -10
  23. package/dist/components/forms/use-field-rules.cjs +122 -0
  24. package/dist/components/forms/use-field-rules.d.ts +31 -0
  25. package/dist/components/forms/use-field-rules.js +88 -0
  26. package/dist/components/ui/conditions-editor/condition-row.cjs +458 -0
  27. package/dist/components/ui/conditions-editor/condition-row.d.ts +23 -0
  28. package/dist/components/ui/conditions-editor/condition-row.js +421 -0
  29. package/dist/components/ui/conditions-editor/conditions-editor.cjs +363 -0
  30. package/dist/components/ui/conditions-editor/conditions-editor.d.ts +67 -0
  31. package/dist/components/ui/conditions-editor/conditions-editor.js +329 -0
  32. package/dist/components/ui/conditions-editor/context.cjs +45 -0
  33. package/dist/components/ui/conditions-editor/context.d.ts +54 -0
  34. package/dist/components/ui/conditions-editor/context.js +8 -0
  35. package/dist/components/ui/conditions-editor/index.cjs +55 -0
  36. package/dist/components/ui/conditions-editor/index.d.ts +6 -0
  37. package/dist/components/ui/conditions-editor/index.js +6 -0
  38. package/dist/components/ui/conditions-editor/model.cjs +126 -0
  39. package/dist/components/ui/conditions-editor/model.d.ts +39 -0
  40. package/dist/components/ui/conditions-editor/model.js +71 -0
  41. package/dist/components/ui/conditions-editor/status.cjs +198 -0
  42. package/dist/components/ui/conditions-editor/status.d.ts +44 -0
  43. package/dist/components/ui/conditions-editor/status.js +131 -0
  44. package/dist/components/ui/conditions-editor/strings.cjs +86 -0
  45. package/dist/components/ui/conditions-editor/strings.d.ts +62 -0
  46. package/dist/components/ui/conditions-editor/strings.js +52 -0
  47. package/dist/components/ui/conditions-editor/vocabulary.cjs +163 -0
  48. package/dist/components/ui/conditions-editor/vocabulary.d.ts +51 -0
  49. package/dist/components/ui/conditions-editor/vocabulary.js +129 -0
  50. package/dist/components/ui/field-actions/index.cjs +9 -2
  51. package/dist/components/ui/field-actions/index.d.ts +1 -0
  52. package/dist/components/ui/field-actions/index.js +2 -1
  53. package/dist/components/ui/field-actions/insert-variable-action.cjs +3 -1
  54. package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
  55. package/dist/components/ui/field-actions/insert-variable-action.js +3 -1
  56. package/dist/components/ui/field-actions/rules-action.cjs +244 -0
  57. package/dist/components/ui/field-actions/rules-action.d.ts +42 -0
  58. package/dist/components/ui/field-actions/rules-action.js +207 -0
  59. package/dist/components/ui/index.cjs +273 -234
  60. package/dist/components/ui/index.d.ts +3 -0
  61. package/dist/components/ui/index.js +3 -0
  62. package/dist/components/ui/quick-form-field/components/field-header.cjs +137 -167
  63. package/dist/components/ui/quick-form-field/components/field-header.d.ts +1 -1
  64. package/dist/components/ui/quick-form-field/components/field-header.js +138 -168
  65. package/dist/components/ui/quick-form-field/components/header-actions.cjs +187 -0
  66. package/dist/components/ui/quick-form-field/components/header-actions.d.ts +59 -0
  67. package/dist/components/ui/quick-form-field/components/header-actions.js +138 -0
  68. package/dist/components/ui/quick-form-field/components/header-context.cjs +59 -0
  69. package/dist/components/ui/quick-form-field/components/header-context.d.ts +33 -0
  70. package/dist/components/ui/quick-form-field/components/header-context.js +16 -0
  71. package/dist/components/ui/quick-form-field/index.cjs +18 -4
  72. package/dist/components/ui/quick-form-field/index.d.ts +2 -0
  73. package/dist/components/ui/quick-form-field/index.js +3 -1
  74. package/dist/components/ui/quick-form-field/quick-form-field.cjs +1 -1
  75. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -6
  76. package/dist/components/ui/quick-form-field/quick-form-field.js +1 -1
  77. package/dist/components/ui/quick-form-field/types.d.ts +42 -11
  78. package/dist/components/ui/row-groups/add-row-button.cjs +54 -0
  79. package/dist/components/ui/row-groups/add-row-button.d.ts +10 -0
  80. package/dist/components/ui/row-groups/add-row-button.js +20 -0
  81. package/dist/components/ui/row-groups/after-press.cjs +73 -0
  82. package/dist/components/ui/row-groups/after-press.d.ts +7 -0
  83. package/dist/components/ui/row-groups/after-press.js +36 -0
  84. package/dist/components/ui/row-groups/collapsible-row-group.cjs +83 -0
  85. package/dist/components/ui/row-groups/collapsible-row-group.d.ts +13 -0
  86. package/dist/components/ui/row-groups/collapsible-row-group.js +49 -0
  87. package/dist/components/ui/row-groups/empty-rows.cjs +42 -0
  88. package/dist/components/ui/row-groups/empty-rows.d.ts +7 -0
  89. package/dist/components/ui/row-groups/empty-rows.js +8 -0
  90. package/dist/components/ui/row-groups/group-mode-toggle.cjs +80 -0
  91. package/dist/components/ui/row-groups/group-mode-toggle.d.ts +26 -0
  92. package/dist/components/ui/row-groups/group-mode-toggle.js +40 -0
  93. package/dist/components/ui/row-groups/index.cjs +62 -0
  94. package/dist/components/ui/row-groups/index.d.ts +6 -0
  95. package/dist/components/ui/row-groups/index.js +7 -0
  96. package/dist/components/ui/row-groups/row-delete-button.cjs +54 -0
  97. package/dist/components/ui/row-groups/row-delete-button.d.ts +18 -0
  98. package/dist/components/ui/row-groups/row-delete-button.js +20 -0
  99. package/dist/components/ui/row-groups/use-row-focus.cjs +82 -0
  100. package/dist/components/ui/row-groups/use-row-focus.d.ts +17 -0
  101. package/dist/components/ui/row-groups/use-row-focus.js +48 -0
  102. package/dist/components/ui/rules-editor/context.cjs +45 -0
  103. package/dist/components/ui/rules-editor/context.d.ts +52 -0
  104. package/dist/components/ui/rules-editor/context.js +8 -0
  105. package/dist/components/ui/rules-editor/index.cjs +56 -0
  106. package/dist/components/ui/rules-editor/index.d.ts +4 -0
  107. package/dist/components/ui/rules-editor/index.js +4 -0
  108. package/dist/components/ui/rules-editor/model.cjs +205 -0
  109. package/dist/components/ui/rules-editor/model.d.ts +128 -0
  110. package/dist/components/ui/rules-editor/model.js +144 -0
  111. package/dist/components/ui/rules-editor/rule-card.cjs +470 -0
  112. package/dist/components/ui/rules-editor/rule-card.d.ts +14 -0
  113. package/dist/components/ui/rules-editor/rule-card.js +436 -0
  114. package/dist/components/ui/rules-editor/rules-editor.cjs +160 -0
  115. package/dist/components/ui/rules-editor/rules-editor.d.ts +66 -0
  116. package/dist/components/ui/rules-editor/rules-editor.js +126 -0
  117. package/dist/components/ui/rules-editor/strings.cjs +68 -0
  118. package/dist/components/ui/rules-editor/strings.d.ts +56 -0
  119. package/dist/components/ui/rules-editor/strings.js +34 -0
  120. package/dist/index.cjs +129 -8
  121. package/dist/index.d.ts +17 -4
  122. package/dist/index.js +10 -3
  123. package/dist/styles.css +97 -24
  124. package/package.json +2 -2
@@ -0,0 +1,138 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ChevronDown } from "lucide-react";
3
+ import { Button } from "../../button.js";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../dropdown-menu.js";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip.js";
6
+ import { cn } from "../../../../lib/index.js";
7
+ import { AiAssistAction } from "../../field-actions/ai-assist-action.js";
8
+ import { COLLAPSED_HIDDEN, FIELD_ACTION_CLASS } from "../../field-actions/collapse.js";
9
+ import { InsertVariableAction } from "../../field-actions/insert-variable-action.js";
10
+ import { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER } from "../types.js";
11
+ import { useClaimHeaderAction, useHeaderContext } from "./header-context.js";
12
+ function QuickFormFieldTypePicker(props) {
13
+ const header = useHeaderContext();
14
+ useClaimHeaderAction(header, 'type');
15
+ return /*#__PURE__*/ jsx(TypePickerControl, {
16
+ ...props,
17
+ header: header
18
+ });
19
+ }
20
+ function TypePickerControl({ onValueChange, value, types = FIELD_TYPE_ORDER, disabled, compact, header }) {
21
+ const strings = header?.strings ?? DEFAULT_QUICK_FORM_FIELD_STRINGS;
22
+ const fieldType = value ?? header?.fieldType ?? 'string';
23
+ const meta = FIELD_TYPE_META[fieldType];
24
+ const collapsedTextClass = cn(COLLAPSED_HIDDEN, (compact ?? header?.compact) && '!hidden');
25
+ return /*#__PURE__*/ jsxs(DropdownMenu, {
26
+ children: [
27
+ /*#__PURE__*/ jsxs(Tooltip, {
28
+ children: [
29
+ /*#__PURE__*/ jsx(TooltipTrigger, {
30
+ asChild: true,
31
+ children: /*#__PURE__*/ jsx(DropdownMenuTrigger, {
32
+ asChild: true,
33
+ children: /*#__PURE__*/ jsxs(Button, {
34
+ type: "button",
35
+ variant: "ghost",
36
+ size: "3xs",
37
+ "aria-label": strings.fieldTypeAriaLabel,
38
+ disabled: disabled || header?.disabled,
39
+ className: cn('gap-1', FIELD_ACTION_CLASS),
40
+ children: [
41
+ /*#__PURE__*/ jsx(meta.icon, {}),
42
+ /*#__PURE__*/ jsx("span", {
43
+ className: collapsedTextClass,
44
+ children: strings.typeLabels[fieldType] ?? meta.label
45
+ }),
46
+ /*#__PURE__*/ jsx(ChevronDown, {
47
+ className: cn('!size-2.5', collapsedTextClass)
48
+ })
49
+ ]
50
+ })
51
+ })
52
+ }),
53
+ /*#__PURE__*/ jsx(TooltipContent, {
54
+ children: strings.fieldTypeTooltip
55
+ })
56
+ ]
57
+ }),
58
+ /*#__PURE__*/ jsx(DropdownMenuContent, {
59
+ align: "end",
60
+ className: "w-44",
61
+ children: types.map((type)=>{
62
+ const option = FIELD_TYPE_META[type];
63
+ const isActive = type === fieldType;
64
+ return /*#__PURE__*/ jsxs(DropdownMenuItem, {
65
+ onClick: ()=>onValueChange(type),
66
+ children: [
67
+ /*#__PURE__*/ jsx(option.icon, {
68
+ className: isActive ? 'text-brand' : 'text-foreground-muted'
69
+ }),
70
+ /*#__PURE__*/ jsx("span", {
71
+ className: cn(isActive && 'font-medium text-brand'),
72
+ children: strings.typeLabels[type] ?? option.label
73
+ })
74
+ ]
75
+ }, type);
76
+ })
77
+ })
78
+ ]
79
+ });
80
+ }
81
+ function QuickFormFieldAiAssist(props) {
82
+ const header = useHeaderContext();
83
+ useClaimHeaderAction(header, 'ai');
84
+ return /*#__PURE__*/ jsx(AiAssistControl, {
85
+ ...props,
86
+ header: header
87
+ });
88
+ }
89
+ function AiAssistControl({ onGenerate, renderContent, hint, disabled, header }) {
90
+ const strings = header?.strings ?? DEFAULT_QUICK_FORM_FIELD_STRINGS;
91
+ const fieldType = header?.fieldType ?? 'string';
92
+ const typeLabel = strings.typeLabels[fieldType] ?? FIELD_TYPE_META[fieldType].label;
93
+ return /*#__PURE__*/ jsx(AiAssistAction, {
94
+ onGenerate: onGenerate,
95
+ renderContent: renderContent,
96
+ disabled: disabled || header?.disabled,
97
+ hint: hint ?? strings.aiOutputHint(strings.aiOutputLabel(typeLabel, !!header?.isExpression)),
98
+ strings: {
99
+ trigger: strings.aiAssistAriaLabel,
100
+ tooltip: strings.aiAssistTooltip,
101
+ prompt: strings.aiPromptLabel,
102
+ promptPlaceholder: strings.aiPromptPlaceholder,
103
+ generate: strings.aiGenerate,
104
+ generating: strings.aiGenerating,
105
+ error: strings.aiError
106
+ }
107
+ });
108
+ }
109
+ function QuickFormFieldInsertVariable(props) {
110
+ const header = useHeaderContext();
111
+ useClaimHeaderAction(header, 'insert');
112
+ return /*#__PURE__*/ jsx(InsertVariableControl, {
113
+ ...props,
114
+ header: header
115
+ });
116
+ }
117
+ function InsertVariableControl({ renderPicker, disabled, compact, header }) {
118
+ const insert = header?.insertVariable;
119
+ if (!header || !insert) return null;
120
+ const { strings, variables } = header;
121
+ return /*#__PURE__*/ jsx(InsertVariableAction, {
122
+ variables: variables.items,
123
+ renderPicker: renderPicker,
124
+ compact: compact,
125
+ disabled: disabled || header.disabled || !header.canInsert,
126
+ strings: {
127
+ label: strings.insertLabel,
128
+ ariaLabel: strings.insertAriaLabel,
129
+ searchPlaceholder: strings.insertSearchPlaceholder,
130
+ empty: strings.insertEmpty
131
+ },
132
+ onInsert: (value, item)=>insert(renderPicker ? {
133
+ label: item.label,
134
+ value
135
+ } : variables.resolve(item))
136
+ });
137
+ }
138
+ export { AiAssistControl, InsertVariableControl, QuickFormFieldAiAssist, QuickFormFieldInsertVariable, QuickFormFieldTypePicker, TypePickerControl };
@@ -0,0 +1,59 @@
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
+ HeaderContext: ()=>HeaderContext,
28
+ useQuickFormFieldHeader: ()=>useQuickFormFieldHeader,
29
+ useClaimHeaderAction: ()=>useClaimHeaderAction,
30
+ useHeaderContext: ()=>useHeaderContext
31
+ });
32
+ const external_react_namespaceObject = require("react");
33
+ const HeaderContext = (0, external_react_namespaceObject.createContext)(null);
34
+ function useHeaderContext() {
35
+ return (0, external_react_namespaceObject.useContext)(HeaderContext);
36
+ }
37
+ function useQuickFormFieldHeader() {
38
+ return (0, external_react_namespaceObject.useContext)(HeaderContext);
39
+ }
40
+ function useClaimHeaderAction(header, kind) {
41
+ const claim = header?.claim;
42
+ (0, external_react_namespaceObject.useLayoutEffect)(()=>claim?.(kind), [
43
+ claim,
44
+ kind
45
+ ]);
46
+ }
47
+ exports.HeaderContext = __webpack_exports__.HeaderContext;
48
+ exports.useClaimHeaderAction = __webpack_exports__.useClaimHeaderAction;
49
+ exports.useHeaderContext = __webpack_exports__.useHeaderContext;
50
+ exports.useQuickFormFieldHeader = __webpack_exports__.useQuickFormFieldHeader;
51
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
52
+ "HeaderContext",
53
+ "useClaimHeaderAction",
54
+ "useHeaderContext",
55
+ "useQuickFormFieldHeader"
56
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
57
+ Object.defineProperty(exports, '__esModule', {
58
+ value: true
59
+ });
@@ -0,0 +1,33 @@
1
+ import type { QuickFieldType, QuickFormFieldOption, QuickFormFieldStrings } from '../types';
2
+ import type { VariablePickerSource } from '../utils';
3
+ /** What an action in a QuickFormField's `headerActions` sees of its field. */
4
+ export interface QuickFormFieldHeaderState {
5
+ fieldType: QuickFieldType;
6
+ /** Whether the value is an expression, so an action can say what it produces. */
7
+ isExpression: boolean;
8
+ /** The field's `disabled`, which its header actions honor too. */
9
+ disabled: boolean;
10
+ /** The field's `compact`: icon-only actions, whatever the width, unless an action says otherwise. */
11
+ compact: boolean;
12
+ }
13
+ /** The built-in actions a composed one replaces. */
14
+ export type HeaderActionKind = 'type' | 'ai' | 'insert';
15
+ export interface HeaderContextValue extends QuickFormFieldHeaderState {
16
+ strings: QuickFormFieldStrings;
17
+ variables: VariablePickerSource;
18
+ /** Undefined while the value is a variable binding: its picker is the value control. */
19
+ insertVariable?: (variable: QuickFormFieldOption) => void;
20
+ /** False while the value is read-only. */
21
+ canInsert: boolean;
22
+ /** Hides the built-in action of a kind while a composed one is mounted. Returns the release. */
23
+ claim: (kind: HeaderActionKind) => () => void;
24
+ }
25
+ export declare const HeaderContext: import("react").Context<HeaderContextValue | null>;
26
+ export declare function useHeaderContext(): HeaderContextValue | null;
27
+ /**
28
+ * The enclosing QuickFormField, as an action in its `headerActions` sees it, so a custom action can
29
+ * match the built-in ones. Null outside a field.
30
+ */
31
+ export declare function useQuickFormFieldHeader(): QuickFormFieldHeaderState | null;
32
+ /** Replaces the built-in action of `kind` while mounted, so passing both never shows two. */
33
+ export declare function useClaimHeaderAction(header: HeaderContextValue | null, kind: HeaderActionKind): void;
@@ -0,0 +1,16 @@
1
+ import { createContext, useContext, useLayoutEffect } from "react";
2
+ const HeaderContext = createContext(null);
3
+ function useHeaderContext() {
4
+ return useContext(HeaderContext);
5
+ }
6
+ function useQuickFormFieldHeader() {
7
+ return useContext(HeaderContext);
8
+ }
9
+ function useClaimHeaderAction(header, kind) {
10
+ const claim = header?.claim;
11
+ useLayoutEffect(()=>claim?.(kind), [
12
+ claim,
13
+ kind
14
+ ]);
15
+ }
16
+ export { HeaderContext, useClaimHeaderAction, useHeaderContext, useQuickFormFieldHeader };
@@ -24,22 +24,36 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- FIELD_TYPE_META: ()=>external_types_cjs_namespaceObject.FIELD_TYPE_META,
28
- QuickFormField: ()=>external_quick_form_field_cjs_namespaceObject.QuickFormField,
27
+ useQuickFormFieldHeader: ()=>header_context_cjs_namespaceObject.useQuickFormFieldHeader,
29
28
  FIELD_TYPE_ORDER: ()=>external_types_cjs_namespaceObject.FIELD_TYPE_ORDER,
30
- DEFAULT_QUICK_FORM_FIELD_STRINGS: ()=>external_types_cjs_namespaceObject.DEFAULT_QUICK_FORM_FIELD_STRINGS
29
+ DEFAULT_QUICK_FORM_FIELD_STRINGS: ()=>external_types_cjs_namespaceObject.DEFAULT_QUICK_FORM_FIELD_STRINGS,
30
+ QuickFormFieldTypePicker: ()=>header_actions_cjs_namespaceObject.QuickFormFieldTypePicker,
31
+ QuickFormFieldAiAssist: ()=>header_actions_cjs_namespaceObject.QuickFormFieldAiAssist,
32
+ QuickFormFieldInsertVariable: ()=>header_actions_cjs_namespaceObject.QuickFormFieldInsertVariable,
33
+ FIELD_TYPE_META: ()=>external_types_cjs_namespaceObject.FIELD_TYPE_META,
34
+ QuickFormField: ()=>external_quick_form_field_cjs_namespaceObject.QuickFormField
31
35
  });
36
+ const header_actions_cjs_namespaceObject = require("./components/header-actions.cjs");
37
+ const header_context_cjs_namespaceObject = require("./components/header-context.cjs");
32
38
  const external_quick_form_field_cjs_namespaceObject = require("./quick-form-field.cjs");
33
39
  const external_types_cjs_namespaceObject = require("./types.cjs");
34
40
  exports.DEFAULT_QUICK_FORM_FIELD_STRINGS = __webpack_exports__.DEFAULT_QUICK_FORM_FIELD_STRINGS;
35
41
  exports.FIELD_TYPE_META = __webpack_exports__.FIELD_TYPE_META;
36
42
  exports.FIELD_TYPE_ORDER = __webpack_exports__.FIELD_TYPE_ORDER;
37
43
  exports.QuickFormField = __webpack_exports__.QuickFormField;
44
+ exports.QuickFormFieldAiAssist = __webpack_exports__.QuickFormFieldAiAssist;
45
+ exports.QuickFormFieldInsertVariable = __webpack_exports__.QuickFormFieldInsertVariable;
46
+ exports.QuickFormFieldTypePicker = __webpack_exports__.QuickFormFieldTypePicker;
47
+ exports.useQuickFormFieldHeader = __webpack_exports__.useQuickFormFieldHeader;
38
48
  for(var __rspack_i in __webpack_exports__)if (-1 === [
39
49
  "DEFAULT_QUICK_FORM_FIELD_STRINGS",
40
50
  "FIELD_TYPE_META",
41
51
  "FIELD_TYPE_ORDER",
42
- "QuickFormField"
52
+ "QuickFormField",
53
+ "QuickFormFieldAiAssist",
54
+ "QuickFormFieldInsertVariable",
55
+ "QuickFormFieldTypePicker",
56
+ "useQuickFormFieldHeader"
43
57
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
44
58
  Object.defineProperty(exports, '__esModule', {
45
59
  value: true
@@ -1,3 +1,5 @@
1
+ export { QuickFormFieldAiAssist, type QuickFormFieldAiAssistProps, QuickFormFieldInsertVariable, type QuickFormFieldInsertVariableProps, QuickFormFieldTypePicker, type QuickFormFieldTypePickerProps, } from './components/header-actions';
2
+ export { type QuickFormFieldHeaderState, useQuickFormFieldHeader, } from './components/header-context';
1
3
  export { QuickFormField } from './quick-form-field';
2
4
  export type { QuickFieldType, QuickFormFieldControlLayout, QuickFormFieldControlProps, QuickFormFieldMode, QuickFormFieldModeSwitchConfirm, QuickFormFieldMoreActions, QuickFormFieldOption, QuickFormFieldProps, QuickFormFieldStrings, VariableInsertContext, } from './types';
3
5
  export { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER } from './types';
@@ -1,3 +1,5 @@
1
+ import { QuickFormFieldAiAssist, QuickFormFieldInsertVariable, QuickFormFieldTypePicker } from "./components/header-actions.js";
2
+ import { useQuickFormFieldHeader } from "./components/header-context.js";
1
3
  import { QuickFormField } from "./quick-form-field.js";
2
4
  import { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER } from "./types.js";
3
- export { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER, QuickFormField };
5
+ export { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER, QuickFormField, QuickFormFieldAiAssist, QuickFormFieldInsertVariable, QuickFormFieldTypePicker, useQuickFormFieldHeader };
@@ -54,7 +54,7 @@ const DEFAULT_VALUE_MODES = [
54
54
  'literal',
55
55
  'expression'
56
56
  ];
57
- function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, disabled = false, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, valueModes = DEFAULT_VALUE_MODES, confirmModeChange, renderExpressionEditor, renderModeControl, renderedControlLayout, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, onLabelChange, isEditingLabel, onIsEditingLabelChange, labelAddon, tooltip, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = true, options = external_utils_cjs_namespaceObject.DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
57
+ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, disabled = false, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, valueModes = DEFAULT_VALUE_MODES, confirmModeChange, renderExpressionEditor, renderModeControl, renderedControlLayout, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, onLabelChange, isEditingLabel, onIsEditingLabelChange, labelAddon, tooltip, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = false, options = external_utils_cjs_namespaceObject.DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
58
58
  const strings = (0, external_react_namespaceObject.useMemo)(()=>({
59
59
  ...external_types_cjs_namespaceObject.DEFAULT_QUICK_FORM_FIELD_STRINGS,
60
60
  ...stringOverrides
@@ -3,8 +3,10 @@ import type { QuickFormFieldProps } from './types';
3
3
  * A Quick Form is assembled by end users, like a form builder. QuickFormField is
4
4
  * the control for an individual field within it, and carries its own
5
5
  * configuration controls: a lock that marks it read-only for the person filling
6
- * in the form, a data-type switch that swaps the control, a Required toggle, and
7
- * a value-mode switch across `literal`, `expression`, `variable` and `prompt`.
6
+ * in the form, and a value-mode switch across `literal`, `expression`,
7
+ * `variable` and `prompt`. Its header actions are composed in `headerActions`:
8
+ * `QuickFormFieldTypePicker`, `QuickFormFieldAiAssist`,
9
+ * `QuickFormFieldInsertVariable` and the consumer's own, in any order.
8
10
  *
9
11
  * Only use it within a quick form builder. For standard forms, compose the
10
12
  * form-field anatomy (`FormField`, `FormFieldLabel`, `InputGroup`, …) or
@@ -17,7 +19,6 @@ import type { QuickFormFieldProps } from './types';
17
19
  * - `confirmModeChange` asks before a switch the consumer knows is lossy.
18
20
  * - `locked` is configuration the author sets, so the value stays editable;
19
21
  * `disabled` is what stops the author editing the field.
20
- * - `fieldTypes` chooses which types the picker offers.
21
22
  * - `onLabelChange` makes a string `label` editable in place.
22
23
  * - Insert variable renders `variables` as supplied and splices at the caret;
23
24
  * `onInsertVariable` takes over what inserting means.
@@ -26,8 +27,7 @@ import type { QuickFormFieldProps } from './types';
26
27
  * - Every user-visible string can be overridden through `strings`.
27
28
  *
28
29
  * The expression mode is styled as code but not highlighted or evaluated.
29
- * Select options default to a small demo set unless `options` is provided. The
30
- * AI-assist button renders only with `onGenerateWithAi`, and file uploads
31
- * aren't persisted anywhere.
30
+ * Select options default to a small demo set unless `options` is provided, and
31
+ * file uploads aren't persisted anywhere.
32
32
  */
33
33
  export declare function QuickFormField({ value, onValueChange, onValueBlur, locked, onLockedChange, showLock, disabled, leadingAddon, trailingAddon, more, mode, onModeChange, valueModes, confirmModeChange, renderExpressionEditor, renderModeControl, renderedControlLayout, fieldType, fieldTypes, onFieldTypeChange, required, onRequiredChange, label, onLabelChange, isEditingLabel, onIsEditingLabelChange, labelAddon, tooltip, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions, options, onGenerateWithAi, onInsertVariable, variables, id, className, }: QuickFormFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -26,7 +26,7 @@ const DEFAULT_VALUE_MODES = [
26
26
  'literal',
27
27
  'expression'
28
28
  ];
29
- function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, disabled = false, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, valueModes = DEFAULT_VALUE_MODES, confirmModeChange, renderExpressionEditor, renderModeControl, renderedControlLayout, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, onLabelChange, isEditingLabel, onIsEditingLabelChange, labelAddon, tooltip, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = true, options = DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
29
+ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true, onLockedChange, showLock = true, disabled = false, leadingAddon, trailingAddon, more, mode = 'literal', onModeChange, valueModes = DEFAULT_VALUE_MODES, confirmModeChange, renderExpressionEditor, renderModeControl, renderedControlLayout, fieldType = 'string', fieldTypes, onFieldTypeChange, required, onRequiredChange, label, onLabelChange, isEditingLabel, onIsEditingLabelChange, labelAddon, tooltip, strings: stringOverrides, placeholder, error, errorId, belowValue, fileUploadAriaLabel, headerActions, compact, showFieldActions = false, options = DEFAULT_SELECT_OPTIONS, onGenerateWithAi, onInsertVariable, variables = [], id, className }) {
30
30
  const strings = useMemo(()=>({
31
31
  ...DEFAULT_QUICK_FORM_FIELD_STRINGS,
32
32
  ...stringOverrides
@@ -41,13 +41,16 @@ export interface QuickFormFieldStrings {
41
41
  trueLabel: string;
42
42
  /** @deprecated No longer rendered: a locked boolean keeps its Switch. Removed in the next major release. */
43
43
  falseLabel: string;
44
+ /** @deprecated Only the deprecated Required switch uses it. Removed in the next major release. */
44
45
  requiredTooltip: string;
46
+ /** @deprecated Only the deprecated Required switch uses it. Removed in the next major release. */
45
47
  requiredAriaLabel: string;
46
48
  /** Names the editable label (see `onLabelChange`), and shows while it is empty. */
47
49
  labelAriaLabel: string;
48
50
  labelPlaceholder: string;
49
51
  /** Names the info-tooltip trigger beside the label. */
50
52
  tooltipAriaLabel: string;
53
+ /** @deprecated Only the deprecated Required switch uses it. Removed in the next major release. */
51
54
  optionalAriaLabel: string;
52
55
  insertLabel: string;
53
56
  insertAriaLabel: string;
@@ -246,19 +249,31 @@ export interface QuickFormFieldProps {
246
249
  /** The field's data type. Defaults to 'string'. Determines which control renders the value. */
247
250
  fieldType?: QuickFieldType;
248
251
  /**
249
- * Which types the picker offers, in display order. Defaults to
250
- * `FIELD_TYPE_ORDER`, every type the component can render; a surface with a
251
- * narrower vocabulary of its own offers fewer.
252
+ * Which types the built-in picker offers, in display order. Defaults to
253
+ * `FIELD_TYPE_ORDER`, every type the component can render.
254
+ *
255
+ * @deprecated Pass `types` to a `QuickFormFieldTypePicker` in `headerActions`.
256
+ * Removed in the next major release.
252
257
  */
253
258
  fieldTypes?: readonly QuickFieldType[];
254
- /** Called when the user switches the field type. */
259
+ /**
260
+ * Called when the user switches the field type. Renders the built-in type picker.
261
+ *
262
+ * @deprecated Render a `QuickFormFieldTypePicker` in `headerActions`. Removed in
263
+ * the next major release.
264
+ */
255
265
  onFieldTypeChange?: (fieldType: QuickFieldType) => void;
256
266
  /**
257
267
  * Shows a required-field asterisk next to the default label, or the editable
258
268
  * one (see `onLabelChange`). Ignored for any other `label`.
259
269
  */
260
270
  required?: boolean;
261
- /** Called when the user toggles required/optional. Renders the Required switch when provided. */
271
+ /**
272
+ * Called when the user toggles required/optional. Renders the Required switch when provided.
273
+ *
274
+ * @deprecated Whether a field is required belongs with its rules, in a header action of
275
+ * its own; `required` still shows the asterisk. Removed in the next major release.
276
+ */
262
277
  onRequiredChange?: (required: boolean) => void;
263
278
  /** Overrides the default mode-based label (e.g. a field name instead of "String value"). */
264
279
  label?: ReactNode;
@@ -303,19 +318,35 @@ export interface QuickFormFieldProps {
303
318
  belowValue?: ReactNode;
304
319
  /** Accessible name for the file-upload dropzone. Defaults to a string `label`, then the computed field label. */
305
320
  fileUploadAriaLabel?: string;
306
- /** Extra content rendered after the built-in AI assist / Insert variable buttons (e.g. a delete button). */
321
+ /**
322
+ * The header's actions, in display order: `QuickFormFieldTypePicker`,
323
+ * `QuickFormFieldAiAssist`, `QuickFormFieldInsertVariable`, and the consumer's
324
+ * own, such as a delete button. Each of the three replaces its built-in
325
+ * counterpart; `useQuickFormFieldHeader` lets a custom action match them.
326
+ */
307
327
  headerActions?: ReactNode;
308
- /** Forces the header row into its narrow-container icon-only layout, regardless of actual width. For demos/comparisons. */
328
+ /**
329
+ * Forces the header row into its narrow-container icon-only layout, regardless of actual width.
330
+ * It is the default for each header action, and an action's own `compact` wins: one can keep its
331
+ * text in a compact field, or show only its icon in a field that is not.
332
+ */
309
333
  compact?: boolean;
310
- /** Whether the AI-assist and Insert-variable actions render at all. Set to false for read-only reviewer contexts where field configuration isn't editable. Defaults to true. */
334
+ /**
335
+ * Renders the built-in Insert-variable action, and AI assist with
336
+ * `onGenerateWithAi`. Defaults to false.
337
+ *
338
+ * @deprecated Compose `QuickFormFieldInsertVariable` and
339
+ * `QuickFormFieldAiAssist` in `headerActions`. Removed in the next major release.
340
+ */
311
341
  showFieldActions?: boolean;
312
342
  /** Options for 'single-select' / 'multi-select' field types. Defaults to a small set of demo options. */
313
343
  options?: QuickFormFieldOption[];
314
344
  /**
315
- * Called with the entered prompt when the user clicks Generate.
345
+ * Called with the entered prompt when the user clicks Generate. Renders the
346
+ * built-in AI-assist button while `showFieldActions` is set.
316
347
  *
317
- * Its presence also decides whether the AI-assist button renders: without a
318
- * handler the button would have nothing to do.
348
+ * @deprecated Render a `QuickFormFieldAiAssist` in `headerActions`. Removed in
349
+ * the next major release.
319
350
  */
320
351
  onGenerateWithAi?: (prompt: string) => void;
321
352
  /**
@@ -0,0 +1,54 @@
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
+ AddRowButton: ()=>add_row_button_AddRowButton
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const external_lucide_react_namespaceObject = require("lucide-react");
31
+ const external_react_namespaceObject = require("react");
32
+ const external_button_cjs_namespaceObject = require("../button.cjs");
33
+ const add_row_button_AddRowButton = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ children, onClick, disabled, className }, ref) {
34
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
35
+ ref: ref,
36
+ type: "button",
37
+ variant: "text",
38
+ size: "2xs",
39
+ onClick: onClick,
40
+ disabled: disabled,
41
+ className: className,
42
+ children: [
43
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {}),
44
+ children
45
+ ]
46
+ });
47
+ });
48
+ exports.AddRowButton = __webpack_exports__.AddRowButton;
49
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
50
+ "AddRowButton"
51
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
52
+ Object.defineProperty(exports, '__esModule', {
53
+ value: true
54
+ });
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export interface AddRowButtonProps {
3
+ /** Names the item, e.g. "Add condition". */
4
+ children: React.ReactNode;
5
+ onClick?: () => void;
6
+ disabled?: boolean;
7
+ className?: string;
8
+ }
9
+ /** The "+ Add …" action of a repeatable list. Sits bottom-left, directly under the last item. */
10
+ export declare const AddRowButton: React.ForwardRefExoticComponent<AddRowButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,20 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Plus } from "lucide-react";
3
+ import { forwardRef } from "react";
4
+ import { Button } from "../button.js";
5
+ const add_row_button_AddRowButton = /*#__PURE__*/ forwardRef(function({ children, onClick, disabled, className }, ref) {
6
+ return /*#__PURE__*/ jsxs(Button, {
7
+ ref: ref,
8
+ type: "button",
9
+ variant: "text",
10
+ size: "2xs",
11
+ onClick: onClick,
12
+ disabled: disabled,
13
+ className: className,
14
+ children: [
15
+ /*#__PURE__*/ jsx(Plus, {}),
16
+ children
17
+ ]
18
+ });
19
+ });
20
+ export { add_row_button_AddRowButton as AddRowButton };
@@ -0,0 +1,73 @@
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
+ afterPress: ()=>afterPress,
28
+ usePressTracking: ()=>usePressTracking
29
+ });
30
+ const external_react_namespaceObject = require("react");
31
+ let trackers = 0;
32
+ let pressed = false;
33
+ const press = ()=>{
34
+ pressed = true;
35
+ };
36
+ const release = ()=>{
37
+ pressed = false;
38
+ };
39
+ function usePressTracking() {
40
+ external_react_namespaceObject.useEffect(()=>{
41
+ if (0 === trackers++) {
42
+ window.addEventListener('pointerdown', press, true);
43
+ window.addEventListener('pointerup', release, true);
44
+ window.addEventListener('pointercancel', release, true);
45
+ }
46
+ return ()=>{
47
+ if (--trackers > 0) return;
48
+ window.removeEventListener('pointerdown', press, true);
49
+ window.removeEventListener('pointerup', release, true);
50
+ window.removeEventListener('pointercancel', release, true);
51
+ pressed = false;
52
+ };
53
+ }, []);
54
+ }
55
+ function afterPress(effect) {
56
+ if (!pressed) return void effect();
57
+ const done = ()=>{
58
+ window.removeEventListener('pointerup', done, true);
59
+ window.removeEventListener('pointercancel', done, true);
60
+ setTimeout(effect, 0);
61
+ };
62
+ window.addEventListener('pointerup', done, true);
63
+ window.addEventListener('pointercancel', done, true);
64
+ }
65
+ exports.afterPress = __webpack_exports__.afterPress;
66
+ exports.usePressTracking = __webpack_exports__.usePressTracking;
67
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
68
+ "afterPress",
69
+ "usePressTracking"
70
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
71
+ Object.defineProperty(exports, '__esModule', {
72
+ value: true
73
+ });
@@ -0,0 +1,7 @@
1
+ /** Tracks presses for `afterPress` while the calling component is mounted. */
2
+ export declare function usePressTracking(): void;
3
+ /**
4
+ * Runs `effect` now or, while a pointer is held down, once its click has landed. A blur that shows
5
+ * a message moves what sits below it, so a press on a button there would otherwise miss its click.
6
+ */
7
+ export declare function afterPress(effect: () => void): void;