@uipath/apollo-wind 2.60.1 → 2.62.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 (154) hide show
  1. package/dist/components/forms/field-actions.cjs +181 -0
  2. package/dist/components/forms/field-actions.d.ts +131 -0
  3. package/dist/components/forms/field-actions.js +129 -0
  4. package/dist/components/forms/field-control.cjs +415 -0
  5. package/dist/components/forms/field-control.d.ts +52 -0
  6. package/dist/components/forms/field-control.js +372 -0
  7. package/dist/components/forms/field-renderer.cjs +77 -420
  8. package/dist/components/forms/field-renderer.d.ts +2 -3
  9. package/dist/components/forms/field-renderer.js +78 -421
  10. package/dist/components/forms/form-designer.cjs +7 -1
  11. package/dist/components/forms/form-designer.js +7 -1
  12. package/dist/components/forms/form-schema.d.ts +121 -2
  13. package/dist/components/forms/form-strings.cjs +67 -0
  14. package/dist/components/forms/form-strings.d.ts +30 -0
  15. package/dist/components/forms/form-strings.js +30 -0
  16. package/dist/components/forms/index.cjs +53 -9
  17. package/dist/components/forms/index.d.ts +6 -1
  18. package/dist/components/forms/index.js +6 -1
  19. package/dist/components/forms/literal-value-context.cjs +37 -0
  20. package/dist/components/forms/literal-value-context.d.ts +5 -0
  21. package/dist/components/forms/literal-value-context.js +3 -0
  22. package/dist/components/forms/metadata-form.cjs +100 -21
  23. package/dist/components/forms/metadata-form.d.ts +5 -0
  24. package/dist/components/forms/metadata-form.js +101 -22
  25. package/dist/components/forms/mode-aware-field.cjs +589 -0
  26. package/dist/components/forms/mode-aware-field.d.ts +15 -0
  27. package/dist/components/forms/mode-aware-field.js +555 -0
  28. package/dist/components/forms/opaque-value.cjs +44 -0
  29. package/dist/components/forms/opaque-value.d.ts +7 -0
  30. package/dist/components/forms/opaque-value.js +7 -0
  31. package/dist/components/forms/rules-engine.cjs +13 -0
  32. package/dist/components/forms/rules-engine.js +13 -0
  33. package/dist/components/forms/schema-serializer.cjs +8 -0
  34. package/dist/components/forms/schema-serializer.js +8 -0
  35. package/dist/components/forms/string-list-field.cjs +36 -18
  36. package/dist/components/forms/string-list-field.d.ts +6 -0
  37. package/dist/components/forms/string-list-field.js +35 -20
  38. package/dist/components/forms/validation-converter.cjs +32 -2
  39. package/dist/components/forms/validation-converter.d.ts +17 -1
  40. package/dist/components/forms/validation-converter.js +30 -3
  41. package/dist/components/forms/value-modes.cjs +253 -0
  42. package/dist/components/forms/value-modes.d.ts +236 -0
  43. package/dist/components/forms/value-modes.js +180 -0
  44. package/dist/components/ui/avatar.d.ts +1 -1
  45. package/dist/components/ui/badge.d.ts +1 -1
  46. package/dist/components/ui/boolean-radio-group.cjs +114 -0
  47. package/dist/components/ui/boolean-radio-group.d.ts +24 -0
  48. package/dist/components/ui/boolean-radio-group.js +77 -0
  49. package/dist/components/ui/button.d.ts +2 -2
  50. package/dist/components/ui/checkbox.cjs +10 -5
  51. package/dist/components/ui/checkbox.js +12 -7
  52. package/dist/components/ui/command.d.ts +7 -7
  53. package/dist/components/ui/field-addons/field-menu.cjs +1 -0
  54. package/dist/components/ui/field-addons/field-menu.d.ts +2 -0
  55. package/dist/components/ui/field-addons/field-menu.js +1 -0
  56. package/dist/components/ui/field-addons/index.cjs +4 -0
  57. package/dist/components/ui/field-addons/index.d.ts +1 -0
  58. package/dist/components/ui/field-addons/index.js +2 -1
  59. package/dist/components/ui/field-addons/value-mode-strings.cjs +7 -1
  60. package/dist/components/ui/field-addons/value-mode-strings.d.ts +9 -0
  61. package/dist/components/ui/field-addons/value-mode-strings.js +7 -1
  62. package/dist/components/ui/field-addons/value-mode-switch-dialog.cjs +73 -0
  63. package/dist/components/ui/field-addons/value-mode-switch-dialog.d.ts +16 -0
  64. package/dist/components/ui/field-addons/value-mode-switch-dialog.js +39 -0
  65. package/dist/components/ui/form-field.cjs +2 -1
  66. package/dist/components/ui/form-field.d.ts +2 -0
  67. package/dist/components/ui/form-field.js +2 -1
  68. package/dist/components/ui/index.cjs +237 -193
  69. package/dist/components/ui/index.d.ts +4 -0
  70. package/dist/components/ui/index.js +4 -0
  71. package/dist/components/ui/input-group.cjs +6 -3
  72. package/dist/components/ui/input-group.d.ts +6 -5
  73. package/dist/components/ui/input-group.js +6 -3
  74. package/dist/components/ui/json-tree-view/DecorationChip.cjs +81 -0
  75. package/dist/components/ui/json-tree-view/DecorationChip.d.ts +4 -0
  76. package/dist/components/ui/json-tree-view/DecorationChip.js +47 -0
  77. package/dist/components/ui/json-tree-view/EditorChrome.cjs +88 -0
  78. package/dist/components/ui/json-tree-view/EditorChrome.d.ts +21 -0
  79. package/dist/components/ui/json-tree-view/EditorChrome.js +51 -0
  80. package/dist/components/ui/json-tree-view/JsonContainerEditor.cjs +95 -0
  81. package/dist/components/ui/json-tree-view/JsonContainerEditor.d.ts +18 -0
  82. package/dist/components/ui/json-tree-view/JsonContainerEditor.js +61 -0
  83. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.cjs +86 -0
  84. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.d.ts +12 -0
  85. package/dist/components/ui/json-tree-view/JsonLeafValueEditor.js +52 -0
  86. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.cjs +74 -0
  87. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.d.ts +13 -0
  88. package/dist/components/ui/json-tree-view/JsonMultilineLeafEditor.js +40 -0
  89. package/dist/components/ui/json-tree-view/JsonTree.cjs +253 -0
  90. package/dist/components/ui/json-tree-view/JsonTree.d.ts +81 -0
  91. package/dist/components/ui/json-tree-view/JsonTree.js +219 -0
  92. package/dist/components/ui/json-tree-view/JsonTree.types.cjs +18 -0
  93. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +253 -0
  94. package/dist/components/ui/json-tree-view/JsonTree.types.js +0 -0
  95. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +284 -0
  96. package/dist/components/ui/json-tree-view/JsonTreeRow.d.ts +50 -0
  97. package/dist/components/ui/json-tree-view/JsonTreeRow.js +244 -0
  98. package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +209 -0
  99. package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +35 -0
  100. package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +175 -0
  101. package/dist/components/ui/json-tree-view/JsonTreeTooltip.cjs +84 -0
  102. package/dist/components/ui/json-tree-view/JsonTreeTooltip.d.ts +21 -0
  103. package/dist/components/ui/json-tree-view/JsonTreeTooltip.js +47 -0
  104. package/dist/components/ui/json-tree-view/JsonTypeBadge.cjs +70 -0
  105. package/dist/components/ui/json-tree-view/JsonTypeBadge.d.ts +17 -0
  106. package/dist/components/ui/json-tree-view/JsonTypeBadge.js +36 -0
  107. package/dist/components/ui/json-tree-view/NodeKey.cjs +77 -0
  108. package/dist/components/ui/json-tree-view/NodeKey.d.ts +16 -0
  109. package/dist/components/ui/json-tree-view/NodeKey.js +43 -0
  110. package/dist/components/ui/json-tree-view/RowActions.cjs +120 -0
  111. package/dist/components/ui/json-tree-view/RowActions.d.ts +15 -0
  112. package/dist/components/ui/json-tree-view/RowActions.js +86 -0
  113. package/dist/components/ui/json-tree-view/ScalarValueCell.cjs +112 -0
  114. package/dist/components/ui/json-tree-view/ScalarValueCell.d.ts +18 -0
  115. package/dist/components/ui/json-tree-view/ScalarValueCell.js +75 -0
  116. package/dist/components/ui/json-tree-view/buildJsonTree.cjs +324 -0
  117. package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +75 -0
  118. package/dist/components/ui/json-tree-view/buildJsonTree.js +257 -0
  119. package/dist/components/ui/json-tree-view/clipboard.cjs +63 -0
  120. package/dist/components/ui/json-tree-view/clipboard.d.ts +6 -0
  121. package/dist/components/ui/json-tree-view/clipboard.js +29 -0
  122. package/dist/components/ui/json-tree-view/index.cjs +175 -0
  123. package/dist/components/ui/json-tree-view/index.d.ts +10 -0
  124. package/dist/components/ui/json-tree-view/index.js +11 -0
  125. package/dist/components/ui/json-tree-view/leafEditTypes.cjs +74 -0
  126. package/dist/components/ui/json-tree-view/leafEditTypes.d.ts +12 -0
  127. package/dist/components/ui/json-tree-view/leafEditTypes.js +34 -0
  128. package/dist/components/ui/json-tree-view/strings.cjs +122 -0
  129. package/dist/components/ui/json-tree-view/strings.d.ts +65 -0
  130. package/dist/components/ui/json-tree-view/strings.js +79 -0
  131. package/dist/components/ui/prompt-value-control.cjs +70 -0
  132. package/dist/components/ui/prompt-value-control.d.ts +28 -0
  133. package/dist/components/ui/prompt-value-control.js +36 -0
  134. package/dist/components/ui/sheet.d.ts +1 -1
  135. package/dist/components/ui/spinner.d.ts +1 -1
  136. package/dist/components/ui/switch.d.ts +2 -2
  137. package/dist/components/ui/textarea.cjs +1 -1
  138. package/dist/components/ui/textarea.js +1 -1
  139. package/dist/components/ui/toggle-group.d.ts +2 -2
  140. package/dist/components/ui/toggle.d.ts +2 -2
  141. package/dist/components/ui/variable-value-control.cjs +98 -0
  142. package/dist/components/ui/variable-value-control.d.ts +35 -0
  143. package/dist/components/ui/variable-value-control.js +64 -0
  144. package/dist/index.cjs +145 -16
  145. package/dist/index.d.ts +21 -3
  146. package/dist/index.js +11 -2
  147. package/dist/lib/index.cjs +4 -1
  148. package/dist/lib/index.d.ts +1 -1
  149. package/dist/lib/index.js +2 -2
  150. package/dist/lib/utils.cjs +21 -1
  151. package/dist/lib/utils.d.ts +8 -0
  152. package/dist/lib/utils.js +18 -1
  153. package/dist/styles.css +279 -0
  154. package/package.json +1 -1
@@ -29,34 +29,28 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const external_react_namespaceObject = require("react");
31
31
  const external_react_hook_form_namespaceObject = require("react-hook-form");
32
- const checkbox_cjs_namespaceObject = require("../ui/checkbox.cjs");
33
- const date_picker_cjs_namespaceObject = require("../ui/date-picker.cjs");
34
- const datetime_picker_cjs_namespaceObject = require("../ui/datetime-picker.cjs");
35
- const file_upload_cjs_namespaceObject = require("../ui/file-upload.cjs");
36
32
  const form_field_cjs_namespaceObject = require("../ui/form-field.cjs");
37
- const input_cjs_namespaceObject = require("../ui/input.cjs");
38
- const label_cjs_namespaceObject = require("../ui/label.cjs");
39
- const multi_select_cjs_namespaceObject = require("../ui/multi-select.cjs");
40
- const radio_group_cjs_namespaceObject = require("../ui/radio-group.cjs");
41
- const select_cjs_namespaceObject = require("../ui/select.cjs");
42
- const slider_cjs_namespaceObject = require("../ui/slider.cjs");
43
- const switch_cjs_namespaceObject = require("../ui/switch.cjs");
44
- const textarea_cjs_namespaceObject = require("../ui/textarea.cjs");
45
33
  const index_cjs_namespaceObject = require("../../lib/index.cjs");
46
34
  const external_data_fetcher_cjs_namespaceObject = require("./data-fetcher.cjs");
35
+ const external_field_control_cjs_namespaceObject = require("./field-control.cjs");
47
36
  const external_form_schema_cjs_namespaceObject = require("./form-schema.cjs");
37
+ const external_mode_aware_field_cjs_namespaceObject = require("./mode-aware-field.cjs");
48
38
  const external_rules_engine_cjs_namespaceObject = require("./rules-engine.cjs");
49
39
  const external_string_list_field_cjs_namespaceObject = require("./string-list-field.cjs");
40
+ const external_value_modes_cjs_namespaceObject = require("./value-modes.cjs");
50
41
  function FormFieldRenderer({ field, context, customComponents, disabled: formDisabled = false }) {
51
42
  const { control, watch, getValues } = (0, external_react_hook_form_namespaceObject.useFormContext)();
52
43
  const contextRef = (0, external_react_namespaceObject.useRef)(context);
53
44
  contextRef.current = context;
45
+ const readValues = (0, external_react_namespaceObject.useCallback)(()=>(0, external_value_modes_cjs_namespaceObject.literalValues)(getValues(), contextRef.current.schema, contextRef.current.valueModes?.codecs), [
46
+ getValues
47
+ ]);
54
48
  const getInitialVisibility = ()=>{
55
49
  if (!field.rules || 0 === field.rules.length) return true;
56
50
  const hasShowRule = field.rules.some((rule)=>rule.effects?.visible === true);
57
51
  const hasHideRule = field.rules.some((rule)=>rule.effects?.visible === false);
58
52
  if (!hasShowRule && !hasHideRule) return true;
59
- const allValues = getValues();
53
+ const allValues = readValues();
60
54
  const ruleResult = external_rules_engine_cjs_namespaceObject.RulesEngine.applyRules(field.rules, allValues, context);
61
55
  if (void 0 !== ruleResult.visible) return ruleResult.visible;
62
56
  return !hasShowRule;
@@ -64,7 +58,7 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
64
58
  const getInitialRequired = ()=>{
65
59
  const staticRequired = field.validation?.required ?? false;
66
60
  if (!field.rules || 0 === field.rules.length) return staticRequired;
67
- const allValues = getValues();
61
+ const allValues = readValues();
68
62
  const ruleResult = external_rules_engine_cjs_namespaceObject.RulesEngine.applyRules(field.rules, allValues, context);
69
63
  return ruleResult.required ?? staticRequired;
70
64
  };
@@ -103,7 +97,7 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
103
97
  const watchedRuleDependentValues = watch(dependentFields);
104
98
  (0, external_react_namespaceObject.useEffect)(()=>{
105
99
  if (!field.rules || 0 === field.rules.length) return;
106
- const allValues = getValues();
100
+ const allValues = readValues();
107
101
  const ruleResult = external_rules_engine_cjs_namespaceObject.RulesEngine.applyRules(field.rules, allValues, contextRef.current);
108
102
  const hasShowRule = field.rules.some((rule)=>rule.effects?.visible === true);
109
103
  const hasHideRule = field.rules.some((rule)=>rule.effects?.visible === false);
@@ -130,7 +124,7 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
130
124
  }, [
131
125
  field.rules,
132
126
  field.validation?.required,
133
- getValues,
127
+ readValues,
134
128
  watchedRuleDependentValues
135
129
  ]);
136
130
  const isOptionsField = (0, external_form_schema_cjs_namespaceObject.hasOptions)(field);
@@ -155,7 +149,7 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
155
149
  if (!field.dataSource) return;
156
150
  const fetchOptions = async ()=>{
157
151
  try {
158
- const allValues = getValues();
152
+ const allValues = readValues();
159
153
  const data = await external_data_fetcher_cjs_namespaceObject.DataFetcher.fetch(field.dataSource, allValues);
160
154
  setFieldState((prev)=>{
161
155
  if ((0, index_cjs_namespaceObject.deepEqual)(prev.options, data)) return prev;
@@ -172,7 +166,7 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
172
166
  }, [
173
167
  field.dataSource,
174
168
  field.name,
175
- getValues,
169
+ readValues,
176
170
  watchedDataSourceValues
177
171
  ]);
178
172
  if (!fieldState.visible) return null;
@@ -180,8 +174,20 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
180
174
  const gridStyle = {
181
175
  gridColumn: `span ${gridSpan}`
182
176
  };
183
- if ((0, external_form_schema_cjs_namespaceObject.isCustomField)(field) && customComponents[field.component]) {
184
- const CustomComponent = customComponents[field.component];
177
+ if (field.valueModes || field.headerActions || field.menuActions || field.badge) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
178
+ style: gridStyle,
179
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_mode_aware_field_cjs_namespaceObject.ModeAwareField, {
180
+ field: field,
181
+ context: context,
182
+ customComponents: customComponents,
183
+ disabled: formDisabled || fieldState.disabled,
184
+ required: fieldState.required,
185
+ options: fieldState.options
186
+ })
187
+ });
188
+ const customEntry = (0, external_form_schema_cjs_namespaceObject.isCustomField)(field) ? customComponents[field.component] : void 0;
189
+ if ((0, external_form_schema_cjs_namespaceObject.isCustomField)(field) && customEntry) {
190
+ const CustomComponent = (0, external_value_modes_cjs_namespaceObject.isFieldControlRegistration)(customEntry) ? customEntry.component : customEntry;
185
191
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
186
192
  style: gridStyle,
187
193
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_hook_form_namespaceObject.Controller, {
@@ -205,222 +211,35 @@ function FormFieldRenderer({ field, context, customComponents, disabled: formDis
205
211
  name: field.name,
206
212
  control: control,
207
213
  defaultValue: field.defaultValue,
208
- render: ({ field: formField, fieldState: { error } })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FieldByType, {
214
+ render: ({ field: formField, fieldState: { error } })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(BuiltInField, {
209
215
  field: field,
210
216
  formField: formField,
211
217
  error: error?.message,
212
218
  disabled: formDisabled || fieldState.disabled,
213
219
  required: fieldState.required,
214
- options: fieldState.options
220
+ options: fieldState.options,
221
+ strings: context.strings?.boolean
215
222
  })
216
223
  })
217
224
  });
218
225
  }
219
- function FieldByType({ field, formField, error, disabled, required, options }) {
226
+ function BuiltInField({ field, formField, error, disabled, required, options, strings }) {
227
+ const control = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_field_control_cjs_namespaceObject.FieldControl, {
228
+ field: field,
229
+ formField: formField,
230
+ options: options,
231
+ disabled: disabled,
232
+ invalid: !!error,
233
+ strings: strings
234
+ });
220
235
  switch(field.type){
221
- case 'text':
222
- case 'email':
223
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
224
- children: [
225
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
226
- htmlFor: field.name,
227
- required: required,
228
- tooltip: field.tooltip,
229
- tooltipAriaLabel: field.tooltipAriaLabel,
230
- children: field.label
231
- }),
232
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
233
- id: field.name,
234
- value: formField.value,
235
- onChange: (e)=>formField.onChange(e.target.value),
236
- onBlur: formField.onBlur,
237
- name: formField.name,
238
- ref: formField.ref,
239
- type: field.type,
240
- placeholder: field.placeholder,
241
- disabled: disabled,
242
- "aria-invalid": error ? true : void 0,
243
- "aria-describedby": error ? `${field.name}-error` : void 0,
244
- "aria-errormessage": error ? `${field.name}-error` : void 0,
245
- "aria-label": field.ariaLabel
246
- }),
247
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
248
- children: field.description
249
- }),
250
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
251
- id: `${field.name}-error`,
252
- children: error
253
- })
254
- ]
255
- });
256
- case 'number':
257
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
258
- children: [
259
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
260
- htmlFor: field.name,
261
- required: required,
262
- tooltip: field.tooltip,
263
- tooltipAriaLabel: field.tooltipAriaLabel,
264
- children: field.label
265
- }),
266
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
267
- id: field.name,
268
- value: formField.value,
269
- onBlur: formField.onBlur,
270
- name: formField.name,
271
- ref: formField.ref,
272
- type: "number",
273
- min: field.min,
274
- max: field.max,
275
- step: field.step,
276
- placeholder: field.placeholder,
277
- disabled: disabled,
278
- "aria-invalid": error ? true : void 0,
279
- "aria-describedby": error ? `${field.name}-error` : void 0,
280
- "aria-errormessage": error ? `${field.name}-error` : void 0,
281
- onChange: (e)=>formField.onChange(parseFloat(e.target.value))
282
- }),
283
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
284
- children: field.description
285
- }),
286
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
287
- id: `${field.name}-error`,
288
- children: error
289
- })
290
- ]
291
- });
292
- case 'textarea':
293
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
294
- children: [
295
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
296
- htmlFor: field.name,
297
- required: required,
298
- tooltip: field.tooltip,
299
- tooltipAriaLabel: field.tooltipAriaLabel,
300
- children: field.label
301
- }),
302
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
303
- id: field.name,
304
- value: formField.value,
305
- onChange: (e)=>formField.onChange(e.target.value),
306
- onBlur: formField.onBlur,
307
- name: formField.name,
308
- ref: formField.ref,
309
- placeholder: field.placeholder,
310
- disabled: disabled,
311
- maxLength: field.maxLength,
312
- "aria-invalid": error ? true : void 0,
313
- "aria-describedby": error ? `${field.name}-error` : void 0,
314
- "aria-errormessage": error ? `${field.name}-error` : void 0,
315
- ...null != field.minRows ? {
316
- minRows: field.minRows
317
- } : {
318
- rows: field.rows || 4
319
- }
320
- }),
321
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
322
- children: field.description
323
- }),
324
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
325
- id: `${field.name}-error`,
326
- children: error
327
- })
328
- ]
329
- });
330
- case 'select':
331
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
332
- children: [
333
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
334
- htmlFor: field.name,
335
- required: required,
336
- tooltip: field.tooltip,
337
- tooltipAriaLabel: field.tooltipAriaLabel,
338
- children: field.label
339
- }),
340
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
341
- value: formField.value,
342
- onValueChange: formField.onChange,
343
- disabled: disabled,
344
- children: [
345
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
346
- id: field.name,
347
- "aria-label": field.label,
348
- "aria-invalid": error ? true : void 0,
349
- "aria-describedby": error ? `${field.name}-error` : void 0,
350
- "aria-errormessage": error ? `${field.name}-error` : void 0,
351
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
352
- placeholder: field.placeholder || 'Select...'
353
- })
354
- }),
355
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
356
- children: options.map((option)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
357
- value: String(option.value),
358
- disabled: 'disabled' in option ? Boolean(option.disabled) : false,
359
- children: option.label
360
- }, String(option.value)))
361
- })
362
- ]
363
- }),
364
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
365
- children: field.description
366
- }),
367
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
368
- id: `${field.name}-error`,
369
- children: error
370
- })
371
- ]
372
- });
373
- case 'multiselect':
374
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
375
- children: [
376
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
377
- htmlFor: field.name,
378
- required: required,
379
- tooltip: field.tooltip,
380
- tooltipAriaLabel: field.tooltipAriaLabel,
381
- children: field.label
382
- }),
383
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(multi_select_cjs_namespaceObject.MultiSelect, {
384
- id: field.name,
385
- selected: formField.value || [],
386
- onChange: formField.onChange,
387
- options: options.map((opt)=>({
388
- label: opt.label,
389
- value: String(opt.value)
390
- })),
391
- disabled: disabled,
392
- placeholder: field.placeholder || 'Select items...',
393
- emptyMessage: field.emptyMessage ?? 'No items found.',
394
- searchPlaceholder: field.searchPlaceholder ?? 'Search...',
395
- maxSelected: field.maxSelected,
396
- "aria-invalid": error ? true : void 0,
397
- "aria-describedby": error ? `${field.name}-error` : void 0,
398
- "aria-errormessage": error ? `${field.name}-error` : void 0
399
- }),
400
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
401
- children: field.description
402
- }),
403
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
404
- id: `${field.name}-error`,
405
- children: error
406
- })
407
- ]
408
- });
409
236
  case 'checkbox':
410
237
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
411
238
  children: [
412
239
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
413
240
  className: "flex items-start space-x-2",
414
241
  children: [
415
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_cjs_namespaceObject.Checkbox, {
416
- checked: true === formField.value,
417
- onCheckedChange: (checked)=>formField.onChange(true === checked),
418
- disabled: disabled,
419
- "aria-invalid": error ? true : void 0,
420
- "aria-describedby": error ? `${field.name}-error` : void 0,
421
- "aria-errormessage": error ? `${field.name}-error` : void 0,
422
- id: field.name
423
- }),
242
+ control,
424
243
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
425
244
  className: "space-y-1 leading-none",
426
245
  children: [
@@ -465,15 +284,7 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
465
284
  })
466
285
  ]
467
286
  }),
468
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(switch_cjs_namespaceObject.Switch, {
469
- id: field.name,
470
- checked: true === formField.value,
471
- onCheckedChange: (checked)=>formField.onChange(true === checked),
472
- disabled: disabled,
473
- "aria-invalid": error ? true : void 0,
474
- "aria-describedby": error ? `${field.name}-error` : void 0,
475
- "aria-errormessage": error ? `${field.name}-error` : void 0
476
- })
287
+ control
477
288
  ]
478
289
  }),
479
290
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
@@ -482,40 +293,26 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
482
293
  })
483
294
  ]
484
295
  });
485
- case 'radio':
296
+ case 'slider':
486
297
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
487
298
  children: [
488
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
489
- id: `${field.name}-label`,
490
- required: required,
491
- tooltip: field.tooltip,
492
- tooltipAriaLabel: field.tooltipAriaLabel,
493
- children: field.label
494
- }),
495
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(radio_group_cjs_namespaceObject.RadioGroup, {
496
- "aria-labelledby": `${field.name}-label`,
497
- value: formField.value,
498
- onValueChange: formField.onChange,
499
- disabled: disabled,
500
- "aria-invalid": error ? true : void 0,
501
- "aria-describedby": error ? `${field.name}-error` : void 0,
502
- "aria-errormessage": error ? `${field.name}-error` : void 0,
503
- children: options.map((option)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
504
- className: "flex items-center space-x-2",
505
- children: [
506
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(radio_group_cjs_namespaceObject.RadioGroupItem, {
507
- value: String(option.value),
508
- id: `${field.name}-${option.value}`,
509
- disabled: 'disabled' in option ? Boolean(option.disabled) : false
510
- }),
511
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
512
- variant: "muted",
513
- htmlFor: `${field.name}-${option.value}`,
514
- children: option.label
515
- })
516
- ]
517
- }, String(option.value)))
299
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
300
+ className: "flex justify-between",
301
+ children: [
302
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
303
+ id: `${field.name}-label`,
304
+ required: required,
305
+ tooltip: field.tooltip,
306
+ tooltipAriaLabel: field.tooltipAriaLabel,
307
+ children: field.label
308
+ }),
309
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SliderValue, {
310
+ field: field,
311
+ value: formField.value
312
+ })
313
+ ]
518
314
  }),
315
+ control,
519
316
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
520
317
  children: field.description
521
318
  }),
@@ -525,98 +322,34 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
525
322
  })
526
323
  ]
527
324
  });
528
- case 'slider':
529
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SliderField, {
325
+ case 'string-list':
326
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_string_list_field_cjs_namespaceObject.StringListField, {
530
327
  field: field,
531
- formField: formField,
328
+ inputRef: formField.ref,
329
+ value: formField.value,
330
+ onChange: formField.onChange,
331
+ onBlur: formField.onBlur,
532
332
  error: error,
533
333
  disabled: disabled,
534
334
  required: required
535
335
  });
536
- case 'date':
537
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
538
- children: [
539
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
540
- htmlFor: field.name,
541
- required: required,
542
- tooltip: field.tooltip,
543
- tooltipAriaLabel: field.tooltipAriaLabel,
544
- children: field.label
545
- }),
546
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(date_picker_cjs_namespaceObject.DatePicker, {
547
- id: field.name,
548
- value: formField.value,
549
- onValueChange: formField.onChange,
550
- disabled: disabled,
551
- placeholder: field.placeholder,
552
- "aria-invalid": error ? true : void 0,
553
- "aria-describedby": error ? `${field.name}-error` : void 0,
554
- "aria-errormessage": error ? `${field.name}-error` : void 0
555
- }),
556
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
557
- children: field.description
558
- }),
559
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
560
- id: `${field.name}-error`,
561
- children: error
562
- })
563
- ]
564
- });
565
- case 'datetime':
566
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
567
- children: [
568
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
569
- id: `${field.name}-label`,
570
- required: required,
571
- tooltip: field.tooltip,
572
- tooltipAriaLabel: field.tooltipAriaLabel,
573
- children: field.label
574
- }),
575
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(datetime_picker_cjs_namespaceObject.DateTimePicker, {
576
- "aria-labelledby": `${field.name}-label`,
577
- "aria-invalid": error ? true : void 0,
578
- "aria-describedby": error ? `${field.name}-error` : void 0,
579
- "aria-errormessage": error ? `${field.name}-error` : void 0,
580
- value: formField.value,
581
- onValueChange: formField.onChange,
582
- disabled: disabled,
583
- placeholder: field.placeholder,
584
- use12Hour: field.use12Hour
585
- }),
586
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
587
- children: field.description
588
- }),
589
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
590
- id: `${field.name}-error`,
591
- children: error
592
- })
593
- ]
594
- });
595
- case 'file':
336
+ case 'custom':
337
+ return null;
338
+ default:
596
339
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
597
340
  children: [
598
341
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
599
- htmlFor: field.name,
342
+ ...'radio' === field.type || 'boolean' === field.type || 'datetime' === field.type ? {
343
+ id: `${field.name}-label`
344
+ } : {
345
+ htmlFor: field.name
346
+ },
600
347
  required: required,
601
348
  tooltip: field.tooltip,
602
349
  tooltipAriaLabel: field.tooltipAriaLabel,
603
350
  children: field.label
604
351
  }),
605
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(file_upload_cjs_namespaceObject.FileUpload, {
606
- id: field.name,
607
- ariaLabel: field.ariaLabel ?? field.label,
608
- "aria-invalid": error ? true : void 0,
609
- "aria-describedby": error ? `${field.name}-error` : void 0,
610
- "aria-errormessage": error ? `${field.name}-error` : void 0,
611
- accept: field.accept,
612
- multiple: field.multiple,
613
- disabled: disabled,
614
- maxSize: field.maxSize,
615
- showPreview: field.showPreview,
616
- onFilesChange: (files)=>{
617
- formField.onChange(field.multiple ? files : files[0]);
618
- }
619
- }),
352
+ control,
620
353
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
621
354
  children: field.description
622
355
  }),
@@ -626,91 +359,15 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
626
359
  })
627
360
  ]
628
361
  });
629
- case 'string-list':
630
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_string_list_field_cjs_namespaceObject.StringListField, {
631
- field: field,
632
- inputRef: formField.ref,
633
- value: formField.value,
634
- onChange: formField.onChange,
635
- onBlur: formField.onBlur,
636
- error: error,
637
- disabled: disabled,
638
- required: required
639
- });
640
- default:
641
- return null;
642
362
  }
643
363
  }
644
- function SliderField({ field, formField, error, disabled, required }) {
645
- const { watch } = (0, external_react_hook_form_namespaceObject.useFormContext)();
646
- const watchedMax = field.maxRef ? watch(field.maxRef.fromField) : void 0;
647
- const resolvedMax = resolveSliderMax(field, watchedMax);
648
- const prevMaxRef = (0, external_react_namespaceObject.useRef)(resolvedMax);
649
- (0, external_react_namespaceObject.useEffect)(()=>{
650
- if (resolvedMax === prevMaxRef.current) return;
651
- prevMaxRef.current = resolvedMax;
652
- const v = formField.value;
653
- if ('number' == typeof v && v > resolvedMax) formField.onChange(resolvedMax);
654
- }, [
655
- resolvedMax,
656
- formField.value,
657
- formField.onChange
658
- ]);
659
- const displayValue = (()=>{
660
- const v = formField.value;
661
- if ('number' == typeof v) return Math.min(v, resolvedMax);
662
- return v;
663
- })();
664
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
665
- children: [
666
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
667
- className: "flex justify-between",
668
- children: [
669
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
670
- id: `${field.name}-label`,
671
- required: required,
672
- tooltip: field.tooltip,
673
- tooltipAriaLabel: field.tooltipAriaLabel,
674
- children: field.label
675
- }),
676
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
677
- className: "text-sm text-muted-foreground",
678
- children: displayValue
679
- })
680
- ]
681
- }),
682
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(slider_cjs_namespaceObject.Slider, {
683
- "aria-labelledby": `${field.name}-label`,
684
- "aria-invalid": error ? true : void 0,
685
- "aria-describedby": error ? `${field.name}-error` : void 0,
686
- "aria-errormessage": error ? `${field.name}-error` : void 0,
687
- value: [
688
- displayValue ?? field.min ?? 0
689
- ],
690
- onValueChange: (values)=>formField.onChange(values[0]),
691
- min: field.min || 0,
692
- max: resolvedMax,
693
- step: field.step || 1,
694
- disabled: disabled
695
- }),
696
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
697
- children: field.description
698
- }),
699
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
700
- id: `${field.name}-error`,
701
- children: error
702
- })
703
- ]
364
+ function SliderValue({ field, value }) {
365
+ const displayValue = (0, external_field_control_cjs_namespaceObject.clampSliderValue)(value, (0, external_field_control_cjs_namespaceObject.useSliderMax)(field));
366
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
367
+ className: "text-sm text-muted-foreground",
368
+ children: displayValue
704
369
  });
705
370
  }
706
- function resolveSliderMax(field, watchedValue) {
707
- if (field.maxRef) {
708
- if ('number' == typeof watchedValue && Number.isFinite(watchedValue) && watchedValue > 0) return watchedValue;
709
- if ('number' == typeof field.maxRef.fallback) return field.maxRef.fallback;
710
- }
711
- if ('number' == typeof field.max) return field.max;
712
- return 100;
713
- }
714
371
  exports.FormFieldRenderer = __webpack_exports__.FormFieldRenderer;
715
372
  for(var __rspack_i in __webpack_exports__)if (-1 === [
716
373
  "FormFieldRenderer"
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import type { CustomFieldComponentProps, FieldMetadata, FormContext } from './form-schema';
1
+ import type { CustomComponents, FieldMetadata, FormContext } from './form-schema';
3
2
  /**
4
3
  * Field Renderer - Connects metadata to actual UI components
5
4
  * Integrates with shadcn/ui components from apollo-wind
@@ -7,7 +6,7 @@ import type { CustomFieldComponentProps, FieldMetadata, FormContext } from './fo
7
6
  interface FormFieldRendererProps {
8
7
  field: FieldMetadata;
9
8
  context: FormContext;
10
- customComponents: Record<string, React.ComponentType<CustomFieldComponentProps>>;
9
+ customComponents: CustomComponents;
11
10
  disabled?: boolean;
12
11
  }
13
12
  export declare function FormFieldRenderer({ field, context, customComponents, disabled: formDisabled, }: FormFieldRendererProps): import("react/jsx-runtime").JSX.Element | null;