@uipath/apollo-wind 2.93.0 → 2.94.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) 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/command.cjs +1 -1
  27. package/dist/components/ui/command.js +1 -1
  28. package/dist/components/ui/conditions-editor/condition-row.cjs +458 -0
  29. package/dist/components/ui/conditions-editor/condition-row.d.ts +23 -0
  30. package/dist/components/ui/conditions-editor/condition-row.js +421 -0
  31. package/dist/components/ui/conditions-editor/conditions-editor.cjs +363 -0
  32. package/dist/components/ui/conditions-editor/conditions-editor.d.ts +67 -0
  33. package/dist/components/ui/conditions-editor/conditions-editor.js +329 -0
  34. package/dist/components/ui/conditions-editor/context.cjs +45 -0
  35. package/dist/components/ui/conditions-editor/context.d.ts +54 -0
  36. package/dist/components/ui/conditions-editor/context.js +8 -0
  37. package/dist/components/ui/conditions-editor/index.cjs +55 -0
  38. package/dist/components/ui/conditions-editor/index.d.ts +6 -0
  39. package/dist/components/ui/conditions-editor/index.js +6 -0
  40. package/dist/components/ui/conditions-editor/model.cjs +126 -0
  41. package/dist/components/ui/conditions-editor/model.d.ts +39 -0
  42. package/dist/components/ui/conditions-editor/model.js +71 -0
  43. package/dist/components/ui/conditions-editor/status.cjs +198 -0
  44. package/dist/components/ui/conditions-editor/status.d.ts +44 -0
  45. package/dist/components/ui/conditions-editor/status.js +131 -0
  46. package/dist/components/ui/conditions-editor/strings.cjs +86 -0
  47. package/dist/components/ui/conditions-editor/strings.d.ts +62 -0
  48. package/dist/components/ui/conditions-editor/strings.js +52 -0
  49. package/dist/components/ui/conditions-editor/vocabulary.cjs +163 -0
  50. package/dist/components/ui/conditions-editor/vocabulary.d.ts +51 -0
  51. package/dist/components/ui/conditions-editor/vocabulary.js +129 -0
  52. package/dist/components/ui/context-menu.cjs +1 -1
  53. package/dist/components/ui/context-menu.js +1 -1
  54. package/dist/components/ui/dropdown-menu.cjs +1 -1
  55. package/dist/components/ui/dropdown-menu.js +1 -1
  56. package/dist/components/ui/field-actions/index.cjs +9 -2
  57. package/dist/components/ui/field-actions/index.d.ts +1 -0
  58. package/dist/components/ui/field-actions/index.js +2 -1
  59. package/dist/components/ui/field-actions/insert-variable-action.cjs +3 -1
  60. package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
  61. package/dist/components/ui/field-actions/insert-variable-action.js +3 -1
  62. package/dist/components/ui/field-actions/rules-action.cjs +244 -0
  63. package/dist/components/ui/field-actions/rules-action.d.ts +42 -0
  64. package/dist/components/ui/field-actions/rules-action.js +207 -0
  65. package/dist/components/ui/index.cjs +285 -246
  66. package/dist/components/ui/index.d.ts +3 -0
  67. package/dist/components/ui/index.js +3 -0
  68. package/dist/components/ui/quick-form-field/components/field-header.cjs +137 -167
  69. package/dist/components/ui/quick-form-field/components/field-header.d.ts +1 -1
  70. package/dist/components/ui/quick-form-field/components/field-header.js +138 -168
  71. package/dist/components/ui/quick-form-field/components/header-actions.cjs +187 -0
  72. package/dist/components/ui/quick-form-field/components/header-actions.d.ts +59 -0
  73. package/dist/components/ui/quick-form-field/components/header-actions.js +138 -0
  74. package/dist/components/ui/quick-form-field/components/header-context.cjs +59 -0
  75. package/dist/components/ui/quick-form-field/components/header-context.d.ts +33 -0
  76. package/dist/components/ui/quick-form-field/components/header-context.js +16 -0
  77. package/dist/components/ui/quick-form-field/index.cjs +18 -4
  78. package/dist/components/ui/quick-form-field/index.d.ts +2 -0
  79. package/dist/components/ui/quick-form-field/index.js +3 -1
  80. package/dist/components/ui/quick-form-field/quick-form-field.cjs +1 -1
  81. package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -6
  82. package/dist/components/ui/quick-form-field/quick-form-field.js +1 -1
  83. package/dist/components/ui/quick-form-field/types.d.ts +42 -11
  84. package/dist/components/ui/row-groups/add-row-button.cjs +54 -0
  85. package/dist/components/ui/row-groups/add-row-button.d.ts +10 -0
  86. package/dist/components/ui/row-groups/add-row-button.js +20 -0
  87. package/dist/components/ui/row-groups/after-press.cjs +73 -0
  88. package/dist/components/ui/row-groups/after-press.d.ts +7 -0
  89. package/dist/components/ui/row-groups/after-press.js +36 -0
  90. package/dist/components/ui/row-groups/collapsible-row-group.cjs +83 -0
  91. package/dist/components/ui/row-groups/collapsible-row-group.d.ts +13 -0
  92. package/dist/components/ui/row-groups/collapsible-row-group.js +49 -0
  93. package/dist/components/ui/row-groups/empty-rows.cjs +42 -0
  94. package/dist/components/ui/row-groups/empty-rows.d.ts +7 -0
  95. package/dist/components/ui/row-groups/empty-rows.js +8 -0
  96. package/dist/components/ui/row-groups/group-mode-toggle.cjs +80 -0
  97. package/dist/components/ui/row-groups/group-mode-toggle.d.ts +26 -0
  98. package/dist/components/ui/row-groups/group-mode-toggle.js +40 -0
  99. package/dist/components/ui/row-groups/index.cjs +62 -0
  100. package/dist/components/ui/row-groups/index.d.ts +6 -0
  101. package/dist/components/ui/row-groups/index.js +7 -0
  102. package/dist/components/ui/row-groups/row-delete-button.cjs +54 -0
  103. package/dist/components/ui/row-groups/row-delete-button.d.ts +18 -0
  104. package/dist/components/ui/row-groups/row-delete-button.js +20 -0
  105. package/dist/components/ui/row-groups/use-row-focus.cjs +82 -0
  106. package/dist/components/ui/row-groups/use-row-focus.d.ts +17 -0
  107. package/dist/components/ui/row-groups/use-row-focus.js +48 -0
  108. package/dist/components/ui/rules-editor/context.cjs +45 -0
  109. package/dist/components/ui/rules-editor/context.d.ts +52 -0
  110. package/dist/components/ui/rules-editor/context.js +8 -0
  111. package/dist/components/ui/rules-editor/index.cjs +56 -0
  112. package/dist/components/ui/rules-editor/index.d.ts +4 -0
  113. package/dist/components/ui/rules-editor/index.js +4 -0
  114. package/dist/components/ui/rules-editor/model.cjs +205 -0
  115. package/dist/components/ui/rules-editor/model.d.ts +128 -0
  116. package/dist/components/ui/rules-editor/model.js +144 -0
  117. package/dist/components/ui/rules-editor/rule-card.cjs +470 -0
  118. package/dist/components/ui/rules-editor/rule-card.d.ts +14 -0
  119. package/dist/components/ui/rules-editor/rule-card.js +436 -0
  120. package/dist/components/ui/rules-editor/rules-editor.cjs +160 -0
  121. package/dist/components/ui/rules-editor/rules-editor.d.ts +66 -0
  122. package/dist/components/ui/rules-editor/rules-editor.js +126 -0
  123. package/dist/components/ui/rules-editor/strings.cjs +68 -0
  124. package/dist/components/ui/rules-editor/strings.d.ts +56 -0
  125. package/dist/components/ui/rules-editor/strings.js +34 -0
  126. package/dist/components/ui/select.cjs +1 -1
  127. package/dist/components/ui/select.js +1 -1
  128. package/dist/index.cjs +129 -8
  129. package/dist/index.d.ts +17 -4
  130. package/dist/index.js +10 -3
  131. package/dist/styles.css +97 -24
  132. package/package.json +2 -2
@@ -0,0 +1,363 @@
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
+ ConditionsEditor: ()=>ConditionsEditor
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_alert_dialog_cjs_namespaceObject = require("../alert-dialog.cjs");
33
+ const external_button_cjs_namespaceObject = require("../button.cjs");
34
+ const external_dropdown_menu_cjs_namespaceObject = require("../dropdown-menu.cjs");
35
+ const external_form_field_cjs_namespaceObject = require("../form-field.cjs");
36
+ const index_cjs_namespaceObject = require("../row-groups/index.cjs");
37
+ const after_press_cjs_namespaceObject = require("../row-groups/after-press.cjs");
38
+ const external_lib_index_cjs_namespaceObject = require("../../../lib/index.cjs");
39
+ const external_condition_row_cjs_namespaceObject = require("./condition-row.cjs");
40
+ const external_context_cjs_namespaceObject = require("./context.cjs");
41
+ const external_model_cjs_namespaceObject = require("./model.cjs");
42
+ const external_status_cjs_namespaceObject = require("./status.cjs");
43
+ const external_strings_cjs_namespaceObject = require("./strings.cjs");
44
+ const external_vocabulary_cjs_namespaceObject = require("./vocabulary.cjs");
45
+ function ConditionsEditor({ value, onChange, label, fields, operators = external_vocabulary_cjs_namespaceObject.DEFAULT_CONDITION_OPERATORS, valueModes, variables, renderValue, valueWarning, maxDepth = 1, showMatchMode = true, container = 'card', defaultOpen, showSummary = false, forceErrors = false, defaultTouched, disabled = false, className, strings, valueModeStrings, multiSelectStrings }) {
46
+ (0, after_press_cjs_namespaceObject.usePressTracking)();
47
+ const [touched, setTouched] = external_react_namespaceObject.useState(()=>new Set(defaultTouched));
48
+ const markTouched = external_react_namespaceObject.useCallback((id)=>setTouched((current)=>new Set(current).add(id)), []);
49
+ external_react_namespaceObject.useEffect(()=>{
50
+ setTouched((current)=>{
51
+ const ids = (0, external_model_cjs_namespaceObject.collectIds)(value);
52
+ const kept = [
53
+ ...current
54
+ ].filter((id)=>ids.has(id));
55
+ return kept.length === current.size ? current : new Set(kept);
56
+ });
57
+ }, [
58
+ value
59
+ ]);
60
+ const latest = external_react_namespaceObject.useRef({
61
+ value,
62
+ onChange
63
+ });
64
+ latest.current = {
65
+ value,
66
+ onChange
67
+ };
68
+ const actions = external_react_namespaceObject.useMemo(()=>{
69
+ const apply = (next)=>latest.current.onChange(next(latest.current.value));
70
+ return {
71
+ updateCondition: (id, patch)=>apply((root)=>(0, external_model_cjs_namespaceObject.updateNode)(root, id, (node)=>({
72
+ ...node,
73
+ ...patch
74
+ }))),
75
+ setGroupMode: (id, mode)=>apply((root)=>(0, external_model_cjs_namespaceObject.updateNode)(root, id, (node)=>({
76
+ ...node,
77
+ mode
78
+ }))),
79
+ addChild: (groupId, child)=>apply((root)=>(0, external_model_cjs_namespaceObject.updateNode)(root, groupId, (node)=>({
80
+ ...node,
81
+ children: [
82
+ ...node.children,
83
+ child
84
+ ]
85
+ }))),
86
+ removeChild: (id)=>apply((root)=>(0, external_model_cjs_namespaceObject.removeNode)(root, id))
87
+ };
88
+ }, []);
89
+ const text = external_react_namespaceObject.useMemo(()=>({
90
+ ...external_strings_cjs_namespaceObject.DEFAULT_CONDITIONS_EDITOR_STRINGS,
91
+ ...strings
92
+ }), [
93
+ strings
94
+ ]);
95
+ const modes = valueModes ?? (0, external_status_cjs_namespaceObject.defaultValueModes)(variables);
96
+ const editor = external_react_namespaceObject.useMemo(()=>({
97
+ fields,
98
+ operators,
99
+ valueModes: modes,
100
+ variables,
101
+ renderValue,
102
+ valueWarning,
103
+ strings: text,
104
+ valueModeStrings,
105
+ multiSelectStrings,
106
+ disabled,
107
+ forceErrors,
108
+ touched,
109
+ markTouched,
110
+ ...actions
111
+ }), [
112
+ fields,
113
+ operators,
114
+ modes,
115
+ variables,
116
+ renderValue,
117
+ valueWarning,
118
+ text,
119
+ valueModeStrings,
120
+ multiSelectStrings,
121
+ disabled,
122
+ forceErrors,
123
+ touched,
124
+ markTouched,
125
+ actions
126
+ ]);
127
+ const matchModes = external_react_namespaceObject.useMemo(()=>[
128
+ {
129
+ value: 'all',
130
+ label: text.matchAll
131
+ },
132
+ {
133
+ value: 'any',
134
+ label: text.matchAny
135
+ }
136
+ ], [
137
+ text
138
+ ]);
139
+ const summary = showSummary || 'collapsible' === container ? (0, external_status_cjs_namespaceObject.describeGroup)(value, editor, text) : '';
140
+ const groupError = (0, external_status_cjs_namespaceObject.hasShownProblems)(value, editor, (id)=>forceErrors || touched.has(id)) ? text.incomplete : void 0;
141
+ const groupErrorId = external_react_namespaceObject.useId();
142
+ const body = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GroupBody, {
143
+ node: value,
144
+ depth: 0,
145
+ maxDepth: maxDepth,
146
+ showMatchMode: showMatchMode,
147
+ matchModes: matchModes,
148
+ groupLabel: label,
149
+ conditionNumbers: (0, external_model_cjs_namespaceObject.numberConditions)(value),
150
+ groupNumbers: (0, external_model_cjs_namespaceObject.numberGroups)(value),
151
+ describedBy: groupError && 'collapsible' !== container ? groupErrorId : void 0,
152
+ footer: showSummary && summary ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("p", {
153
+ className: "rounded-md bg-muted/50 px-3 py-2 text-xs leading-5 text-muted-foreground",
154
+ children: [
155
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
156
+ className: "font-medium text-foreground",
157
+ children: [
158
+ text.summaryLabel,
159
+ " "
160
+ ]
161
+ }),
162
+ summary
163
+ ]
164
+ }) : null
165
+ });
166
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_context_cjs_namespaceObject.ConditionsEditorContext.Provider, {
167
+ value: editor,
168
+ children: 'collapsible' === container ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
169
+ className: className,
170
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.CollapsibleRowGroup, {
171
+ summary: text.count((0, external_model_cjs_namespaceObject.countConditions)(value)),
172
+ detail: summary,
173
+ error: groupError,
174
+ defaultOpen: defaultOpen,
175
+ children: body
176
+ })
177
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
178
+ className: (0, external_lib_index_cjs_namespaceObject.cn)('flex min-w-0 flex-col', className),
179
+ children: [
180
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
181
+ className: (0, external_lib_index_cjs_namespaceObject.cn)('card' === container && 'rounded-lg border border-border bg-card p-3', 'card' === container && groupError && 'border-error'),
182
+ children: body
183
+ }),
184
+ groupError && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_cjs_namespaceObject.FormFieldError, {
185
+ id: groupErrorId,
186
+ children: groupError
187
+ })
188
+ ]
189
+ })
190
+ });
191
+ }
192
+ function GroupBody({ node, depth, maxDepth, showMatchMode, matchModes, groupLabel, conditionNumbers, groupNumbers, describedBy, onDeleteGroup, footer }) {
193
+ const { strings, disabled, setGroupMode, addChild, removeChild } = (0, external_context_cjs_namespaceObject.useConditionsEditor)();
194
+ const focus = (0, index_cjs_namespaceObject.useRowFocus)();
195
+ const [confirmOpen, setConfirmOpen] = external_react_namespaceObject.useState(false);
196
+ const actionsRef = external_react_namespaceObject.useRef(null);
197
+ const nested = depth > 0;
198
+ const matchModeShown = nested || showMatchMode && node.children.length > 1;
199
+ const add = (child)=>{
200
+ focus.afterAdd();
201
+ addChild(node.id, child);
202
+ };
203
+ const { afterDelete } = focus;
204
+ const deleteChild = external_react_namespaceObject.useCallback((id, position)=>{
205
+ afterDelete(position);
206
+ removeChild(id);
207
+ }, [
208
+ afterDelete,
209
+ removeChild
210
+ ]);
211
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("fieldset", {
212
+ "aria-label": groupLabel,
213
+ "aria-describedby": describedBy,
214
+ "data-row": nested ? '' : void 0,
215
+ className: (0, external_lib_index_cjs_namespaceObject.cn)('m-0 flex min-w-0 flex-col gap-3 border-0 p-0', nested && 'border-l-2 border-solid border-border pl-3'),
216
+ children: [
217
+ matchModeShown && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
218
+ className: "flex items-center gap-2",
219
+ children: [
220
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.GroupModeToggle, {
221
+ modes: matchModes,
222
+ value: node.mode,
223
+ disabled: disabled,
224
+ strings: {
225
+ label: strings.groupMatchMode(groupLabel)
226
+ },
227
+ onValueChange: (mode)=>setGroupMode(node.id, mode)
228
+ }),
229
+ nested && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
230
+ children: [
231
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
232
+ asChild: true,
233
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
234
+ ref: actionsRef,
235
+ type: "button",
236
+ variant: "ghost",
237
+ size: "xs",
238
+ icon: true,
239
+ disabled: disabled,
240
+ "data-row-delete": "",
241
+ "aria-label": strings.groupActions(groupLabel),
242
+ className: "ml-auto text-muted-foreground hover:text-foreground",
243
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoreVertical, {})
244
+ })
245
+ }),
246
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuContent, {
247
+ align: "end",
248
+ className: "w-44",
249
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
250
+ className: "text-error focus:text-error",
251
+ onSelect: ()=>{
252
+ if (node.children.length > 0) setConfirmOpen(true);
253
+ else onDeleteGroup?.();
254
+ },
255
+ children: [
256
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {}),
257
+ " ",
258
+ strings.deleteGroup
259
+ ]
260
+ })
261
+ })
262
+ ]
263
+ })
264
+ ]
265
+ }),
266
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
267
+ className: "@container",
268
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
269
+ ref: focus.listRef,
270
+ className: "flex flex-col gap-2 @lg:gap-3",
271
+ children: 0 === node.children.length ? (nested ? strings.emptyGroup : strings.empty) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.EmptyRows, {
272
+ children: nested ? strings.emptyGroup : strings.empty
273
+ }) : node.children.map((child, position)=>'group' === child.kind ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GroupBody, {
274
+ node: child,
275
+ depth: depth + 1,
276
+ maxDepth: maxDepth,
277
+ showMatchMode: showMatchMode,
278
+ matchModes: matchModes,
279
+ groupLabel: strings.groupName(groupNumbers.get(child.id) ?? position + 1),
280
+ conditionNumbers: conditionNumbers,
281
+ groupNumbers: groupNumbers,
282
+ onDeleteGroup: ()=>deleteChild(child.id, position)
283
+ }, child.id) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_react_namespaceObject.Fragment, {
284
+ children: [
285
+ node.children[position - 1]?.kind === 'condition' && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_condition_row_cjs_namespaceObject.ConditionSeparator, {}),
286
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_condition_row_cjs_namespaceObject.ConditionRow, {
287
+ index: conditionNumbers.get(child.id) ?? position + 1,
288
+ position: position,
289
+ condition: child,
290
+ onDelete: deleteChild
291
+ })
292
+ ]
293
+ }, child.id))
294
+ })
295
+ }),
296
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
297
+ className: "flex flex-wrap items-center gap-4",
298
+ children: [
299
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.AddRowButton, {
300
+ ref: focus.addRef,
301
+ disabled: disabled,
302
+ onClick: ()=>add((0, external_model_cjs_namespaceObject.createCondition)()),
303
+ children: strings.addCondition
304
+ }),
305
+ depth < maxDepth && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.AddRowButton, {
306
+ disabled: disabled,
307
+ onClick: ()=>add((0, external_model_cjs_namespaceObject.createConditionGroup)('all', [
308
+ (0, external_model_cjs_namespaceObject.createCondition)()
309
+ ])),
310
+ children: strings.addGroup
311
+ })
312
+ ]
313
+ }),
314
+ footer,
315
+ nested && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_alert_dialog_cjs_namespaceObject.AlertDialog, {
316
+ open: confirmOpen,
317
+ onOpenChange: setConfirmOpen,
318
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_alert_dialog_cjs_namespaceObject.AlertDialogContent, {
319
+ onCloseAutoFocus: (event)=>{
320
+ event.preventDefault();
321
+ if (actionsRef.current?.isConnected) actionsRef.current.focus();
322
+ },
323
+ children: [
324
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_alert_dialog_cjs_namespaceObject.AlertDialogHeader, {
325
+ children: [
326
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_alert_dialog_cjs_namespaceObject.AlertDialogTitle, {
327
+ children: strings.deleteGroupTitle
328
+ }),
329
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_alert_dialog_cjs_namespaceObject.AlertDialogDescription, {
330
+ children: strings.deleteGroupDescription((0, external_model_cjs_namespaceObject.countConditions)(node))
331
+ })
332
+ ]
333
+ }),
334
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_alert_dialog_cjs_namespaceObject.AlertDialogFooter, {
335
+ children: [
336
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_alert_dialog_cjs_namespaceObject.AlertDialogCancel, {
337
+ children: strings.cancel
338
+ }),
339
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_alert_dialog_cjs_namespaceObject.AlertDialogAction, {
340
+ className: (0, external_button_cjs_namespaceObject.buttonVariants)({
341
+ variant: 'destructive'
342
+ }),
343
+ disabled: disabled,
344
+ onClick: ()=>{
345
+ if (!disabled) onDeleteGroup?.();
346
+ },
347
+ children: strings.deleteGroup
348
+ })
349
+ ]
350
+ })
351
+ ]
352
+ })
353
+ })
354
+ ]
355
+ });
356
+ }
357
+ exports.ConditionsEditor = __webpack_exports__.ConditionsEditor;
358
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
359
+ "ConditionsEditor"
360
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
361
+ Object.defineProperty(exports, '__esModule', {
362
+ value: true
363
+ });
@@ -0,0 +1,67 @@
1
+ import type { ValueModeStrings } from '../field-addons';
2
+ import type { MultiSelectStrings } from '../multi-select';
3
+ import type { VariablePickerItem } from '../variable-picker';
4
+ import { type RenderConditionValue } from './context';
5
+ import { type Condition, type ConditionGroup, type ConditionValueMode } from './model';
6
+ import { type ConditionsEditorStrings } from './strings';
7
+ import { type ConditionField, type ConditionOperators } from './vocabulary';
8
+ export interface ConditionsEditorProps {
9
+ value: ConditionGroup;
10
+ onChange: (next: ConditionGroup) => void;
11
+ /** Names the top group for assistive technology, e.g. "Rule 1 conditions". */
12
+ label: string;
13
+ fields: readonly ConditionField[];
14
+ /** The operators per field type. Defaults to the English set. */
15
+ operators?: ConditionOperators;
16
+ /**
17
+ * The value modes each value's menu lists, in order. One mode hides the menu. Defaults to Fixed
18
+ * value and Expression, plus Variable when `variables` is given.
19
+ */
20
+ valueModes?: readonly ConditionValueMode[];
21
+ /** What Variable mode picks from. */
22
+ variables?: VariablePickerItem[];
23
+ /** Replaces a value's control. See `RenderConditionValue`. */
24
+ renderValue?: RenderConditionValue;
25
+ /**
26
+ * A warning for a finished row's value that is accepted but likely wrong, such as an
27
+ * expression naming a field the form no longer has. It shows once the row is left, and the
28
+ * row is still complete. Pass a stable function.
29
+ */
30
+ valueWarning?: (condition: Condition) => string | undefined;
31
+ /** How many levels of groups may nest inside the top group. 0 turns off Add group. */
32
+ maxDepth?: number;
33
+ /**
34
+ * Whether the top group's All / Any switch can show, which it does once the group holds two or
35
+ * more items. Turn it off for a list that always matches all. Nested groups always show theirs.
36
+ */
37
+ showMatchMode?: boolean;
38
+ /**
39
+ * `card` draws a bordered box, `collapsible` adds a header that collapses the rows, and `plain`
40
+ * draws nothing, for use inside another container such as a rule.
41
+ */
42
+ container?: 'card' | 'collapsible' | 'plain';
43
+ /** Whether a `collapsible` editor starts open. */
44
+ defaultOpen?: boolean;
45
+ /** Show the plain-language reading below the rows. */
46
+ showSummary?: boolean;
47
+ /** Show every incomplete row's message, as after a submit. */
48
+ forceErrors?: boolean;
49
+ /**
50
+ * Ids of rows to treat as already left, so their messages show, e.g. when restoring a draft. Read
51
+ * on mount: give the editor a new `key` to start over, such as when it shows another rule.
52
+ */
53
+ defaultTouched?: readonly string[];
54
+ disabled?: boolean;
55
+ className?: string;
56
+ /** Overrides for any subset of the English strings. */
57
+ strings?: Partial<ConditionsEditorStrings>;
58
+ /** Overrides for the value-mode menu, indicator, and variable control. */
59
+ valueModeStrings?: Partial<ValueModeStrings>;
60
+ /** Overrides for the options control of an operator that takes several. */
61
+ multiSelectStrings?: Partial<MultiSelectStrings>;
62
+ }
63
+ /**
64
+ * Edits a tree of conditions: flat lists, nested groups, collapsible filters, and a rule's
65
+ * conditions. Controlled: it holds no conditions of its own, only which rows focus has left.
66
+ */
67
+ export declare function ConditionsEditor({ value, onChange, label, fields, operators, valueModes, variables, renderValue, valueWarning, maxDepth, showMatchMode, container, defaultOpen, showSummary, forceErrors, defaultTouched, disabled, className, strings, valueModeStrings, multiSelectStrings, }: ConditionsEditorProps): import("react/jsx-runtime").JSX.Element;