@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,163 @@
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
+ DEFAULT_CONDITION_OPERATORS: ()=>DEFAULT_CONDITION_OPERATORS
28
+ });
29
+ function patternError(pattern) {
30
+ try {
31
+ new RegExp(pattern);
32
+ return;
33
+ } catch {
34
+ return 'Enter a valid pattern.';
35
+ }
36
+ }
37
+ const DEFAULT_CONDITION_OPERATORS = {
38
+ string: [
39
+ {
40
+ value: 'equals',
41
+ label: 'Equals'
42
+ },
43
+ {
44
+ value: 'notEquals',
45
+ label: 'Not equals'
46
+ },
47
+ {
48
+ value: 'contains',
49
+ label: 'Contains'
50
+ },
51
+ {
52
+ value: 'startsWith',
53
+ label: 'Starts with'
54
+ },
55
+ {
56
+ value: 'matches',
57
+ label: 'Matches pattern',
58
+ valueError: patternError,
59
+ valueHint: 'A JavaScript regular expression, such as ^INV-[0-9]+$'
60
+ },
61
+ {
62
+ value: 'isEmpty',
63
+ label: 'Is empty',
64
+ hasValue: false
65
+ },
66
+ {
67
+ value: 'isNotEmpty',
68
+ label: 'Is not empty',
69
+ hasValue: false
70
+ }
71
+ ],
72
+ number: [
73
+ {
74
+ value: 'equals',
75
+ label: 'Equals'
76
+ },
77
+ {
78
+ value: 'notEquals',
79
+ label: 'Not equals'
80
+ },
81
+ {
82
+ value: 'greaterThan',
83
+ label: 'Greater than'
84
+ },
85
+ {
86
+ value: 'lessThan',
87
+ label: 'Less than'
88
+ },
89
+ {
90
+ value: 'isEmpty',
91
+ label: 'Is empty',
92
+ hasValue: false
93
+ },
94
+ {
95
+ value: 'isNotEmpty',
96
+ label: 'Is not empty',
97
+ hasValue: false
98
+ }
99
+ ],
100
+ date: [
101
+ {
102
+ value: 'equals',
103
+ label: 'On'
104
+ },
105
+ {
106
+ value: 'lessThan',
107
+ label: 'Before'
108
+ },
109
+ {
110
+ value: 'greaterThan',
111
+ label: 'After'
112
+ },
113
+ {
114
+ value: 'isEmpty',
115
+ label: 'Is empty',
116
+ hasValue: false
117
+ },
118
+ {
119
+ value: 'isNotEmpty',
120
+ label: 'Is not empty',
121
+ hasValue: false
122
+ }
123
+ ],
124
+ enum: [
125
+ {
126
+ value: 'equals',
127
+ label: 'Is'
128
+ },
129
+ {
130
+ value: 'notEquals',
131
+ label: 'Is not'
132
+ },
133
+ {
134
+ value: 'isOneOf',
135
+ label: 'Is one of',
136
+ multiple: true
137
+ },
138
+ {
139
+ value: 'isNotOneOf',
140
+ label: 'Is not one of',
141
+ multiple: true
142
+ }
143
+ ],
144
+ other: [
145
+ {
146
+ value: 'isEmpty',
147
+ label: 'Is empty',
148
+ hasValue: false
149
+ },
150
+ {
151
+ value: 'isNotEmpty',
152
+ label: 'Is not empty',
153
+ hasValue: false
154
+ }
155
+ ]
156
+ };
157
+ exports.DEFAULT_CONDITION_OPERATORS = __webpack_exports__.DEFAULT_CONDITION_OPERATORS;
158
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
159
+ "DEFAULT_CONDITION_OPERATORS"
160
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
161
+ Object.defineProperty(exports, '__esModule', {
162
+ value: true
163
+ });
@@ -0,0 +1,51 @@
1
+ import type { ConditionValueMode } from './model';
2
+ /**
3
+ * Picks the operators and the Fixed value control. `enum` needs `options`. `other` is a value
4
+ * a condition can only check is there, such as a file or a list.
5
+ */
6
+ export type ConditionFieldType = 'string' | 'number' | 'date' | 'enum' | 'other';
7
+ export interface ConditionFieldOption {
8
+ value: string;
9
+ label: string;
10
+ }
11
+ /** What a value is compared in, for an operator's `valueError`. */
12
+ export interface ConditionValueContext {
13
+ field: ConditionField;
14
+ mode: ConditionValueMode;
15
+ }
16
+ /** A field a condition can compare. */
17
+ export interface ConditionField {
18
+ value: string;
19
+ label: string;
20
+ type: ConditionFieldType;
21
+ options?: readonly ConditionFieldOption[];
22
+ }
23
+ export interface ConditionOperator {
24
+ value: string;
25
+ label: string;
26
+ /** False for operators like "Is empty", which hide the value. */
27
+ hasValue?: boolean;
28
+ /** Takes several options in Fixed value, e.g. "Is one of". For `enum` fields. */
29
+ multiple?: boolean;
30
+ /**
31
+ * The value modes it can compare against. A mode left out stays in the mode menu, disabled, and
32
+ * picking this operator while the row is in it resets the row to the first mode allowed.
33
+ * Omitted, it allows every mode the editor offers.
34
+ */
35
+ valueModes?: readonly ConditionValueMode[];
36
+ /**
37
+ * The message for a value it cannot use, such as a pattern that does not compile, or `undefined`
38
+ * for one it can, given the row's field and value mode too. A row it flags is incomplete.
39
+ * English, as `label` is.
40
+ */
41
+ valueError?: (value: string, row: ConditionValueContext) => string | undefined;
42
+ /** How to write the value, shown under it, such as which pattern syntax. English, as `label` is. */
43
+ valueHint?: string;
44
+ }
45
+ /** The operators each field type offers, in menu order. */
46
+ export type ConditionOperators = Record<ConditionFieldType, readonly ConditionOperator[]>;
47
+ /**
48
+ * English operators. The ids are shared across types, so `lessThan` reads "Before" on a date, which
49
+ * keeps whatever turns them into rules to one case per id. Map the labels to translate them.
50
+ */
51
+ export declare const DEFAULT_CONDITION_OPERATORS: ConditionOperators;
@@ -0,0 +1,129 @@
1
+ function patternError(pattern) {
2
+ try {
3
+ new RegExp(pattern);
4
+ return;
5
+ } catch {
6
+ return 'Enter a valid pattern.';
7
+ }
8
+ }
9
+ const DEFAULT_CONDITION_OPERATORS = {
10
+ string: [
11
+ {
12
+ value: 'equals',
13
+ label: 'Equals'
14
+ },
15
+ {
16
+ value: 'notEquals',
17
+ label: 'Not equals'
18
+ },
19
+ {
20
+ value: 'contains',
21
+ label: 'Contains'
22
+ },
23
+ {
24
+ value: 'startsWith',
25
+ label: 'Starts with'
26
+ },
27
+ {
28
+ value: 'matches',
29
+ label: 'Matches pattern',
30
+ valueError: patternError,
31
+ valueHint: 'A JavaScript regular expression, such as ^INV-[0-9]+$'
32
+ },
33
+ {
34
+ value: 'isEmpty',
35
+ label: 'Is empty',
36
+ hasValue: false
37
+ },
38
+ {
39
+ value: 'isNotEmpty',
40
+ label: 'Is not empty',
41
+ hasValue: false
42
+ }
43
+ ],
44
+ number: [
45
+ {
46
+ value: 'equals',
47
+ label: 'Equals'
48
+ },
49
+ {
50
+ value: 'notEquals',
51
+ label: 'Not equals'
52
+ },
53
+ {
54
+ value: 'greaterThan',
55
+ label: 'Greater than'
56
+ },
57
+ {
58
+ value: 'lessThan',
59
+ label: 'Less than'
60
+ },
61
+ {
62
+ value: 'isEmpty',
63
+ label: 'Is empty',
64
+ hasValue: false
65
+ },
66
+ {
67
+ value: 'isNotEmpty',
68
+ label: 'Is not empty',
69
+ hasValue: false
70
+ }
71
+ ],
72
+ date: [
73
+ {
74
+ value: 'equals',
75
+ label: 'On'
76
+ },
77
+ {
78
+ value: 'lessThan',
79
+ label: 'Before'
80
+ },
81
+ {
82
+ value: 'greaterThan',
83
+ label: 'After'
84
+ },
85
+ {
86
+ value: 'isEmpty',
87
+ label: 'Is empty',
88
+ hasValue: false
89
+ },
90
+ {
91
+ value: 'isNotEmpty',
92
+ label: 'Is not empty',
93
+ hasValue: false
94
+ }
95
+ ],
96
+ enum: [
97
+ {
98
+ value: 'equals',
99
+ label: 'Is'
100
+ },
101
+ {
102
+ value: 'notEquals',
103
+ label: 'Is not'
104
+ },
105
+ {
106
+ value: 'isOneOf',
107
+ label: 'Is one of',
108
+ multiple: true
109
+ },
110
+ {
111
+ value: 'isNotOneOf',
112
+ label: 'Is not one of',
113
+ multiple: true
114
+ }
115
+ ],
116
+ other: [
117
+ {
118
+ value: 'isEmpty',
119
+ label: 'Is empty',
120
+ hasValue: false
121
+ },
122
+ {
123
+ value: 'isNotEmpty',
124
+ label: 'Is not empty',
125
+ hasValue: false
126
+ }
127
+ ]
128
+ };
129
+ export { DEFAULT_CONDITION_OPERATORS };
@@ -25,21 +25,28 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  AiAssistAction: ()=>external_ai_assist_action_cjs_namespaceObject.AiAssistAction,
28
+ InsertVariableAction: ()=>external_insert_variable_action_cjs_namespaceObject.InsertVariableAction,
29
+ RulesAction: ()=>external_rules_action_cjs_namespaceObject.RulesAction,
28
30
  DEFAULT_AI_ASSIST_ACTION_STRINGS: ()=>external_ai_assist_action_cjs_namespaceObject.DEFAULT_AI_ASSIST_ACTION_STRINGS,
29
31
  DEFAULT_INSERT_VARIABLE_ACTION_STRINGS: ()=>external_insert_variable_action_cjs_namespaceObject.DEFAULT_INSERT_VARIABLE_ACTION_STRINGS,
30
- InsertVariableAction: ()=>external_insert_variable_action_cjs_namespaceObject.InsertVariableAction
32
+ DEFAULT_RULES_ACTION_STRINGS: ()=>external_rules_action_cjs_namespaceObject.DEFAULT_RULES_ACTION_STRINGS
31
33
  });
32
34
  const external_ai_assist_action_cjs_namespaceObject = require("./ai-assist-action.cjs");
33
35
  const external_insert_variable_action_cjs_namespaceObject = require("./insert-variable-action.cjs");
36
+ const external_rules_action_cjs_namespaceObject = require("./rules-action.cjs");
34
37
  exports.AiAssistAction = __webpack_exports__.AiAssistAction;
35
38
  exports.DEFAULT_AI_ASSIST_ACTION_STRINGS = __webpack_exports__.DEFAULT_AI_ASSIST_ACTION_STRINGS;
36
39
  exports.DEFAULT_INSERT_VARIABLE_ACTION_STRINGS = __webpack_exports__.DEFAULT_INSERT_VARIABLE_ACTION_STRINGS;
40
+ exports.DEFAULT_RULES_ACTION_STRINGS = __webpack_exports__.DEFAULT_RULES_ACTION_STRINGS;
37
41
  exports.InsertVariableAction = __webpack_exports__.InsertVariableAction;
42
+ exports.RulesAction = __webpack_exports__.RulesAction;
38
43
  for(var __rspack_i in __webpack_exports__)if (-1 === [
39
44
  "AiAssistAction",
40
45
  "DEFAULT_AI_ASSIST_ACTION_STRINGS",
41
46
  "DEFAULT_INSERT_VARIABLE_ACTION_STRINGS",
42
- "InsertVariableAction"
47
+ "DEFAULT_RULES_ACTION_STRINGS",
48
+ "InsertVariableAction",
49
+ "RulesAction"
43
50
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
44
51
  Object.defineProperty(exports, '__esModule', {
45
52
  value: true
@@ -1,2 +1,3 @@
1
1
  export { AiAssistAction, type AiAssistActionProps, type AiAssistActionStrings, type AiAssistContentProps, DEFAULT_AI_ASSIST_ACTION_STRINGS, } from './ai-assist-action';
2
2
  export { DEFAULT_INSERT_VARIABLE_ACTION_STRINGS, InsertVariableAction, type InsertVariableActionProps, type InsertVariableActionStrings, } from './insert-variable-action';
3
+ export { DEFAULT_RULES_ACTION_STRINGS, RulesAction, type RulesActionProps, type RulesActionStrings, } from './rules-action';
@@ -1,3 +1,4 @@
1
1
  import { AiAssistAction, DEFAULT_AI_ASSIST_ACTION_STRINGS } from "./ai-assist-action.js";
2
2
  import { DEFAULT_INSERT_VARIABLE_ACTION_STRINGS, InsertVariableAction } from "./insert-variable-action.js";
3
- export { AiAssistAction, DEFAULT_AI_ASSIST_ACTION_STRINGS, DEFAULT_INSERT_VARIABLE_ACTION_STRINGS, InsertVariableAction };
3
+ import { DEFAULT_RULES_ACTION_STRINGS, RulesAction } from "./rules-action.js";
4
+ export { AiAssistAction, DEFAULT_AI_ASSIST_ACTION_STRINGS, DEFAULT_INSERT_VARIABLE_ACTION_STRINGS, DEFAULT_RULES_ACTION_STRINGS, InsertVariableAction, RulesAction };
@@ -31,6 +31,7 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
31
  const external_lucide_react_namespaceObject = require("lucide-react");
32
32
  const external_react_namespaceObject = require("react");
33
33
  const external_button_cjs_namespaceObject = require("../button.cjs");
34
+ const header_context_cjs_namespaceObject = require("../quick-form-field/components/header-context.cjs");
34
35
  const index_cjs_namespaceObject = require("../variable-picker/index.cjs");
35
36
  const external_lib_index_cjs_namespaceObject = require("../../../lib/index.cjs");
36
37
  const external_collapse_cjs_namespaceObject = require("./collapse.cjs");
@@ -52,7 +53,8 @@ function InsertVariableAction({ variables = NO_VARIABLES, renderPicker, onInsert
52
53
  const lazy = 'function' == typeof variables;
53
54
  const inert = disabled || !onInsert || !renderPicker && !lazy && 0 === variables.length;
54
55
  const [openedItems, setOpenedItems] = (0, external_react_namespaceObject.useState)([]);
55
- const collapsedTextClass = (0, external_lib_index_cjs_namespaceObject.cn)(external_collapse_cjs_namespaceObject.COLLAPSED_HIDDEN, compact && '!hidden');
56
+ const header = (0, header_context_cjs_namespaceObject.useQuickFormFieldHeader)();
57
+ const collapsedTextClass = (0, external_lib_index_cjs_namespaceObject.cn)(external_collapse_cjs_namespaceObject.COLLAPSED_HIDDEN, (compact ?? header?.compact) && '!hidden');
56
58
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.VariablePicker, {
57
59
  disabled: inert,
58
60
  items: lazy ? openedItems : variables,
@@ -22,7 +22,10 @@ interface InsertVariableActionBaseProps {
22
22
  */
23
23
  onInsert?: (value: string, item: VariablePickerItem) => void;
24
24
  disabled?: boolean;
25
- /** Icon only. Below a 260px `@container` the action also collapses to its icon by itself. */
25
+ /**
26
+ * Icon only, or with its text even in a `compact` QuickFormField. In a field's header it defaults
27
+ * to the field's `compact`. Below a 260px `@container` it collapses to its icon either way.
28
+ */
26
29
  compact?: boolean;
27
30
  /** Overrides for any subset of the English strings. */
28
31
  strings?: Partial<InsertVariableActionStrings>;
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Braces, ChevronDown } from "lucide-react";
3
3
  import { useState } from "react";
4
4
  import { Button } from "../button.js";
5
+ import { useQuickFormFieldHeader } from "../quick-form-field/components/header-context.js";
5
6
  import { VariablePicker } from "../variable-picker/index.js";
6
7
  import { cn } from "../../../lib/index.js";
7
8
  import { COLLAPSED_HIDDEN, FIELD_ACTION_CLASS } from "./collapse.js";
@@ -23,7 +24,8 @@ function InsertVariableAction({ variables = NO_VARIABLES, renderPicker, onInsert
23
24
  const lazy = 'function' == typeof variables;
24
25
  const inert = disabled || !onInsert || !renderPicker && !lazy && 0 === variables.length;
25
26
  const [openedItems, setOpenedItems] = useState([]);
26
- const collapsedTextClass = cn(COLLAPSED_HIDDEN, compact && '!hidden');
27
+ const header = useQuickFormFieldHeader();
28
+ const collapsedTextClass = cn(COLLAPSED_HIDDEN, (compact ?? header?.compact) && '!hidden');
27
29
  return /*#__PURE__*/ jsx(VariablePicker, {
28
30
  disabled: inert,
29
31
  items: lazy ? openedItems : variables,
@@ -0,0 +1,244 @@
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
+ RulesAction: ()=>RulesAction,
28
+ DEFAULT_RULES_ACTION_STRINGS: ()=>DEFAULT_RULES_ACTION_STRINGS
29
+ });
30
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
+ const external_lucide_react_namespaceObject = require("lucide-react");
32
+ const external_react_namespaceObject = require("react");
33
+ const external_button_cjs_namespaceObject = require("../button.cjs");
34
+ const index_cjs_namespaceObject = require("../conditions-editor/index.cjs");
35
+ const external_label_cjs_namespaceObject = require("../label.cjs");
36
+ const external_popover_cjs_namespaceObject = require("../popover.cjs");
37
+ const header_context_cjs_namespaceObject = require("../quick-form-field/components/header-context.cjs");
38
+ const external_rules_editor_index_cjs_namespaceObject = require("../rules-editor/index.cjs");
39
+ const external_switch_cjs_namespaceObject = require("../switch.cjs");
40
+ const external_tooltip_cjs_namespaceObject = require("../tooltip.cjs");
41
+ const external_lib_index_cjs_namespaceObject = require("../../../lib/index.cjs");
42
+ const external_collapse_cjs_namespaceObject = require("./collapse.cjs");
43
+ const DEFAULT_RULES_ACTION_STRINGS = {
44
+ trigger: (count, issues)=>0 === count ? 'Field rules' : 0 === issues ? `Field rules (${count})` : `Field rules (${count}), ${issues} ${1 === issues ? 'needs' : 'need'} attention`,
45
+ title: 'Field rules',
46
+ required: 'Required field',
47
+ makeConditional: 'Make conditional'
48
+ };
49
+ function RulesAction({ requiredOutcome, disabled, strings, editorStrings, value, onChange, defaultTouched, ...editor }) {
50
+ const header = (0, header_context_cjs_namespaceObject.useQuickFormFieldHeader)();
51
+ const inert = !!disabled || !!header?.disabled;
52
+ const text = {
53
+ ...DEFAULT_RULES_ACTION_STRINGS,
54
+ ...strings
55
+ };
56
+ const [open, setOpen] = (0, external_react_namespaceObject.useState)(false);
57
+ const titleId = (0, external_react_namespaceObject.useId)();
58
+ const requiredId = (0, external_react_namespaceObject.useId)();
59
+ const rulesList = (0, external_react_namespaceObject.useRef)(null);
60
+ const focusRule = (0, external_react_namespaceObject.useRef)(null);
61
+ const count = value.length;
62
+ const { outcomes, fields, operators, valueModes, variables, dialect } = editor;
63
+ const issues = (0, external_react_namespaceObject.useMemo)(()=>(0, external_rules_editor_index_cjs_namespaceObject.findRuleIssues)(value, {
64
+ outcomes,
65
+ fields,
66
+ operators,
67
+ valueModes,
68
+ variables
69
+ }, dialect), [
70
+ value,
71
+ outcomes,
72
+ fields,
73
+ operators,
74
+ valueModes,
75
+ variables,
76
+ dialect
77
+ ]);
78
+ const flagged = new Set(issues.map((issue)=>issue.ruleId)).size;
79
+ const [openedIssues, setOpenedIssues] = (0, external_react_namespaceObject.useState)([]);
80
+ const changeOpen = (next)=>{
81
+ if (next) setOpenedIssues((0, external_rules_editor_index_cjs_namespaceObject.issueIds)(issues));
82
+ setOpen(next);
83
+ };
84
+ const touched = (0, external_react_namespaceObject.useMemo)(()=>[
85
+ ...defaultTouched ?? [],
86
+ ...openedIssues
87
+ ], [
88
+ defaultTouched,
89
+ openedIssues
90
+ ]);
91
+ const triggerLabel = text.trigger(count, flagged);
92
+ const requiredIndex = void 0 === requiredOutcome ? -1 : value.findIndex((rule)=>rule.outcome === requiredOutcome && (0, external_rules_editor_index_cjs_namespaceObject.isUnconditionalRule)(rule));
93
+ const requiredRule = requiredIndex < 0 ? void 0 : value[requiredIndex];
94
+ const rules = requiredRule ? value.filter((rule)=>rule !== requiredRule) : value;
95
+ const showSwitch = void 0 !== requiredOutcome && (!!requiredRule || !rules.some((rule)=>rule.outcome === requiredOutcome));
96
+ const changeRules = (next)=>{
97
+ if (!requiredRule) return onChange(next);
98
+ const before = new Set(value.slice(0, requiredIndex).map((rule)=>rule.id));
99
+ const after = next.reduce((at, rule, position)=>before.has(rule.id) ? position + 1 : at, 0);
100
+ onChange([
101
+ ...next.slice(0, after),
102
+ requiredRule,
103
+ ...next.slice(after)
104
+ ]);
105
+ };
106
+ const setRequired = (on)=>{
107
+ if (!requiredOutcome) return;
108
+ onChange(on ? [
109
+ (0, external_rules_editor_index_cjs_namespaceObject.createRule)({
110
+ outcome: requiredOutcome,
111
+ conditions: (0, index_cjs_namespaceObject.createConditionGroup)()
112
+ }),
113
+ ...value
114
+ ] : [
115
+ ...rules
116
+ ]);
117
+ };
118
+ const makeConditional = ()=>{
119
+ onChange(value.map((rule)=>rule === requiredRule && 'conditions' === rule.mode ? {
120
+ ...rule,
121
+ conditions: {
122
+ ...rule.conditions,
123
+ children: [
124
+ (0, index_cjs_namespaceObject.createCondition)()
125
+ ]
126
+ }
127
+ } : rule));
128
+ focusRule.current = {
129
+ position: requiredIndex,
130
+ rules: rules.length + 1
131
+ };
132
+ };
133
+ (0, external_react_namespaceObject.useEffect)(()=>{
134
+ const next = focusRule.current;
135
+ const cards = rulesList.current?.querySelectorAll(':scope > fieldset > div > [data-row]');
136
+ if (!next || !cards || cards.length !== next.rules) return;
137
+ focusRule.current = null;
138
+ cards[next.position]?.querySelector(':scope [data-row] [data-row-first]')?.focus();
139
+ });
140
+ const rulesStrings = (0, external_react_namespaceObject.useMemo)(()=>showSwitch ? {
141
+ ...editorStrings,
142
+ empty: ''
143
+ } : editorStrings, [
144
+ showSwitch,
145
+ editorStrings
146
+ ]);
147
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
148
+ open: open,
149
+ onOpenChange: changeOpen,
150
+ children: [
151
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
152
+ children: [
153
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
154
+ asChild: true,
155
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
156
+ asChild: true,
157
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
158
+ type: "button",
159
+ variant: "ghost",
160
+ size: "3xs",
161
+ icon: true,
162
+ "aria-label": triggerLabel,
163
+ className: (0, external_lib_index_cjs_namespaceObject.cn)('relative', external_collapse_cjs_namespaceObject.FIELD_ACTION_CLASS, (open || count > 0) && 'text-brand', flagged > 0 && 'text-destructive'),
164
+ children: [
165
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Network, {}),
166
+ count > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
167
+ "aria-hidden": true,
168
+ className: (0, external_lib_index_cjs_namespaceObject.cn)('absolute -right-1 -top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full px-0.5 text-[9px] font-medium leading-none', flagged > 0 ? 'bg-destructive text-destructive-foreground' : 'bg-brand/15 text-brand'),
169
+ children: count
170
+ })
171
+ ]
172
+ })
173
+ })
174
+ }),
175
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
176
+ children: triggerLabel
177
+ })
178
+ ]
179
+ }),
180
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.PopoverContent, {
181
+ align: "end",
182
+ sideOffset: 6,
183
+ collisionPadding: 8,
184
+ "aria-labelledby": titleId,
185
+ className: "flex max-h-[var(--radix-popover-content-available-height)] w-[min(29rem,calc(100vw-2rem))] flex-col gap-2.5 overflow-y-auto p-3",
186
+ children: [
187
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
188
+ id: titleId,
189
+ className: "text-xs font-semibold text-foreground",
190
+ children: text.title
191
+ }),
192
+ showSwitch && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
193
+ className: "flex h-10 items-center gap-2.5 rounded-lg border border-solid border-border bg-card px-3",
194
+ children: [
195
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_switch_cjs_namespaceObject.Switch, {
196
+ id: requiredId,
197
+ size: "sm",
198
+ checked: !!requiredRule,
199
+ onCheckedChange: setRequired,
200
+ disabled: inert
201
+ }),
202
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.Label, {
203
+ htmlFor: requiredId,
204
+ className: "flex-1 text-xs font-normal text-foreground",
205
+ children: text.required
206
+ }),
207
+ requiredRule && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
208
+ type: "button",
209
+ variant: "ghost",
210
+ size: "3xs",
211
+ onClick: makeConditional,
212
+ disabled: inert,
213
+ className: "text-xs text-muted-foreground hover:text-foreground",
214
+ children: text.makeConditional
215
+ })
216
+ ]
217
+ }),
218
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
219
+ ref: rulesList,
220
+ className: "contents",
221
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_rules_editor_index_cjs_namespaceObject.RulesEditor, {
222
+ ...editor,
223
+ value: rules,
224
+ onChange: changeRules,
225
+ label: text.title,
226
+ disabled: inert,
227
+ strings: rulesStrings,
228
+ defaultTouched: touched
229
+ })
230
+ })
231
+ ]
232
+ })
233
+ ]
234
+ });
235
+ }
236
+ exports.DEFAULT_RULES_ACTION_STRINGS = __webpack_exports__.DEFAULT_RULES_ACTION_STRINGS;
237
+ exports.RulesAction = __webpack_exports__.RulesAction;
238
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
239
+ "DEFAULT_RULES_ACTION_STRINGS",
240
+ "RulesAction"
241
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
242
+ Object.defineProperty(exports, '__esModule', {
243
+ value: true
244
+ });