@uipath/apollo-wind 2.39.0 → 2.41.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.
- package/dist/components/custom/flow-properties-simple.cjs +11 -3
- package/dist/components/custom/flow-properties-simple.js +12 -4
- package/dist/components/forms/field-renderer.cjs +61 -94
- package/dist/components/forms/field-renderer.d.ts +1 -1
- package/dist/components/forms/field-renderer.js +50 -83
- package/dist/components/ui/form-field.cjs +90 -0
- package/dist/components/ui/form-field.d.ts +26 -0
- package/dist/components/ui/form-field.js +47 -0
- package/dist/components/ui/index.cjs +119 -109
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input-group.cjs +3 -4
- package/dist/components/ui/input-group.js +3 -4
- package/dist/components/ui/input.cjs +3 -4
- package/dist/components/ui/input.js +3 -4
- package/dist/components/ui/label.cjs +19 -6
- package/dist/components/ui/label.d.ts +27 -5
- package/dist/components/ui/label.js +19 -6
- package/dist/components/ui/lockable-value-field/lockable-value-field.cjs +3 -4
- package/dist/components/ui/lockable-value-field/lockable-value-field.js +3 -4
- package/dist/index.cjs +16 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -31,22 +31,25 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
31
31
|
const external_react_namespaceObject = require("react");
|
|
32
32
|
const accordion_cjs_namespaceObject = require("../ui/accordion.cjs");
|
|
33
33
|
const input_cjs_namespaceObject = require("../ui/input.cjs");
|
|
34
|
+
const label_cjs_namespaceObject = require("../ui/label.cjs");
|
|
34
35
|
const select_cjs_namespaceObject = require("../ui/select.cjs");
|
|
35
36
|
const typography_cjs_namespaceObject = require("../../foundation/Future/typography.cjs");
|
|
36
37
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
37
38
|
function FieldItem({ field, onGraphControl }) {
|
|
38
39
|
const [value, setValue] = external_react_namespaceObject.useState(field.value ?? '');
|
|
40
|
+
const inputId = external_react_namespaceObject.useId();
|
|
39
41
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
40
42
|
className: "flex flex-col gap-1 pt-4",
|
|
41
43
|
children: [
|
|
42
44
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
43
45
|
className: "flex items-center justify-between",
|
|
44
46
|
children: [
|
|
45
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
47
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(label_cjs_namespaceObject.Label, {
|
|
48
|
+
htmlFor: inputId,
|
|
46
49
|
className: "text-sm font-medium leading-5 text-foreground-muted",
|
|
47
50
|
children: [
|
|
48
51
|
field.label,
|
|
49
|
-
field.required &&
|
|
52
|
+
field.required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.RequiredIndicator, {})
|
|
50
53
|
]
|
|
51
54
|
}),
|
|
52
55
|
field.showGraphControl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
@@ -65,7 +68,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
65
68
|
onValueChange: setValue,
|
|
66
69
|
children: [
|
|
67
70
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
|
|
68
|
-
"aria-
|
|
71
|
+
"aria-required": field.required,
|
|
72
|
+
id: inputId,
|
|
69
73
|
className: "h-10 rounded-xl border-0 bg-surface-overlay text-foreground shadow-sm placeholder:text-foreground-muted",
|
|
70
74
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
|
|
71
75
|
placeholder: field.placeholder ?? 'Select...'
|
|
@@ -84,6 +88,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
84
88
|
className: "flex h-10 w-full items-center overflow-hidden rounded-xl bg-surface-overlay shadow-[0px_1px_2px_0px_rgba(0,0,0,0.05)] transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",
|
|
85
89
|
children: [
|
|
86
90
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
|
|
91
|
+
"aria-required": field.required,
|
|
92
|
+
id: inputId,
|
|
87
93
|
value: value,
|
|
88
94
|
onChange: (e)=>setValue(e.target.value),
|
|
89
95
|
placeholder: field.placeholder,
|
|
@@ -99,6 +105,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
99
105
|
})
|
|
100
106
|
]
|
|
101
107
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
|
|
108
|
+
"aria-required": field.required,
|
|
109
|
+
id: inputId,
|
|
102
110
|
value: value,
|
|
103
111
|
onChange: (e)=>setValue(e.target.value),
|
|
104
112
|
placeholder: field.placeholder
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Copy, FileJson, Folder, Redo2, RefreshCw, Settings2, Undo2, Variable, Webhook, X } from "lucide-react";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
4
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../ui/accordion.js";
|
|
5
5
|
import { Input } from "../ui/input.js";
|
|
6
|
+
import { Label, RequiredIndicator } from "../ui/label.js";
|
|
6
7
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select.js";
|
|
7
8
|
import { fontFamily } from "../../foundation/Future/typography.js";
|
|
8
9
|
import { cn } from "../../lib/index.js";
|
|
9
10
|
function FieldItem({ field, onGraphControl }) {
|
|
10
11
|
const [value, setValue] = useState(field.value ?? '');
|
|
12
|
+
const inputId = useId();
|
|
11
13
|
return /*#__PURE__*/ jsxs("div", {
|
|
12
14
|
className: "flex flex-col gap-1 pt-4",
|
|
13
15
|
children: [
|
|
14
16
|
/*#__PURE__*/ jsxs("div", {
|
|
15
17
|
className: "flex items-center justify-between",
|
|
16
18
|
children: [
|
|
17
|
-
/*#__PURE__*/ jsxs(
|
|
19
|
+
/*#__PURE__*/ jsxs(Label, {
|
|
20
|
+
htmlFor: inputId,
|
|
18
21
|
className: "text-sm font-medium leading-5 text-foreground-muted",
|
|
19
22
|
children: [
|
|
20
23
|
field.label,
|
|
21
|
-
field.required &&
|
|
24
|
+
field.required && /*#__PURE__*/ jsx(RequiredIndicator, {})
|
|
22
25
|
]
|
|
23
26
|
}),
|
|
24
27
|
field.showGraphControl && /*#__PURE__*/ jsx("button", {
|
|
@@ -37,7 +40,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
37
40
|
onValueChange: setValue,
|
|
38
41
|
children: [
|
|
39
42
|
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
40
|
-
"aria-
|
|
43
|
+
"aria-required": field.required,
|
|
44
|
+
id: inputId,
|
|
41
45
|
className: "h-10 rounded-xl border-0 bg-surface-overlay text-foreground shadow-sm placeholder:text-foreground-muted",
|
|
42
46
|
children: /*#__PURE__*/ jsx(SelectValue, {
|
|
43
47
|
placeholder: field.placeholder ?? 'Select...'
|
|
@@ -56,6 +60,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
56
60
|
className: "flex h-10 w-full items-center overflow-hidden rounded-xl bg-surface-overlay shadow-[0px_1px_2px_0px_rgba(0,0,0,0.05)] transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",
|
|
57
61
|
children: [
|
|
58
62
|
/*#__PURE__*/ jsx(Input, {
|
|
63
|
+
"aria-required": field.required,
|
|
64
|
+
id: inputId,
|
|
59
65
|
value: value,
|
|
60
66
|
onChange: (e)=>setValue(e.target.value),
|
|
61
67
|
placeholder: field.placeholder,
|
|
@@ -71,6 +77,8 @@ function FieldItem({ field, onGraphControl }) {
|
|
|
71
77
|
})
|
|
72
78
|
]
|
|
73
79
|
}) : /*#__PURE__*/ jsx(Input, {
|
|
80
|
+
"aria-required": field.required,
|
|
81
|
+
id: inputId,
|
|
74
82
|
value: value,
|
|
75
83
|
onChange: (e)=>setValue(e.target.value),
|
|
76
84
|
placeholder: field.placeholder
|
|
@@ -29,22 +29,23 @@ __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 external_form_schema_cjs_namespaceObject = require("./form-schema.cjs");
|
|
33
|
-
const external_rules_engine_cjs_namespaceObject = require("./rules-engine.cjs");
|
|
34
|
-
const external_data_fetcher_cjs_namespaceObject = require("./data-fetcher.cjs");
|
|
35
|
-
const input_cjs_namespaceObject = require("../ui/input.cjs");
|
|
36
|
-
const textarea_cjs_namespaceObject = require("../ui/textarea.cjs");
|
|
37
|
-
const select_cjs_namespaceObject = require("../ui/select.cjs");
|
|
38
|
-
const multi_select_cjs_namespaceObject = require("../ui/multi-select.cjs");
|
|
39
32
|
const checkbox_cjs_namespaceObject = require("../ui/checkbox.cjs");
|
|
40
|
-
const switch_cjs_namespaceObject = require("../ui/switch.cjs");
|
|
41
|
-
const radio_group_cjs_namespaceObject = require("../ui/radio-group.cjs");
|
|
42
|
-
const slider_cjs_namespaceObject = require("../ui/slider.cjs");
|
|
43
|
-
const label_cjs_namespaceObject = require("../ui/label.cjs");
|
|
44
33
|
const date_picker_cjs_namespaceObject = require("../ui/date-picker.cjs");
|
|
45
34
|
const datetime_picker_cjs_namespaceObject = require("../ui/datetime-picker.cjs");
|
|
46
35
|
const file_upload_cjs_namespaceObject = require("../ui/file-upload.cjs");
|
|
36
|
+
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");
|
|
47
45
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
46
|
+
const external_data_fetcher_cjs_namespaceObject = require("./data-fetcher.cjs");
|
|
47
|
+
const external_form_schema_cjs_namespaceObject = require("./form-schema.cjs");
|
|
48
|
+
const external_rules_engine_cjs_namespaceObject = require("./rules-engine.cjs");
|
|
48
49
|
function FormFieldRenderer({ field, context, customComponents, disabled: formDisabled = false }) {
|
|
49
50
|
const { control, watch, getValues } = (0, external_react_hook_form_namespaceObject.useFormContext)();
|
|
50
51
|
const contextRef = (0, external_react_namespaceObject.useRef)(context);
|
|
@@ -214,9 +215,9 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
214
215
|
switch(field.type){
|
|
215
216
|
case 'text':
|
|
216
217
|
case 'email':
|
|
217
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
218
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
218
219
|
children: [
|
|
219
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
220
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
220
221
|
required: required,
|
|
221
222
|
children: field.label
|
|
222
223
|
}),
|
|
@@ -231,18 +232,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
231
232
|
disabled: disabled,
|
|
232
233
|
"aria-label": field.ariaLabel
|
|
233
234
|
}),
|
|
234
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
235
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
235
236
|
children: field.description
|
|
236
237
|
}),
|
|
237
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
238
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
238
239
|
children: error
|
|
239
240
|
})
|
|
240
241
|
]
|
|
241
242
|
});
|
|
242
243
|
case 'number':
|
|
243
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
244
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
244
245
|
children: [
|
|
245
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
246
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
246
247
|
required: required,
|
|
247
248
|
children: field.label
|
|
248
249
|
}),
|
|
@@ -259,18 +260,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
259
260
|
disabled: disabled,
|
|
260
261
|
onChange: (e)=>formField.onChange(parseFloat(e.target.value))
|
|
261
262
|
}),
|
|
262
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
263
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
263
264
|
children: field.description
|
|
264
265
|
}),
|
|
265
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
266
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
266
267
|
children: error
|
|
267
268
|
})
|
|
268
269
|
]
|
|
269
270
|
});
|
|
270
271
|
case 'textarea':
|
|
271
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
272
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
272
273
|
children: [
|
|
273
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
274
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
274
275
|
required: required,
|
|
275
276
|
children: field.label
|
|
276
277
|
}),
|
|
@@ -284,18 +285,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
284
285
|
disabled: disabled,
|
|
285
286
|
rows: field.rows || 4
|
|
286
287
|
}),
|
|
287
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
288
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
288
289
|
children: field.description
|
|
289
290
|
}),
|
|
290
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
291
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
291
292
|
children: error
|
|
292
293
|
})
|
|
293
294
|
]
|
|
294
295
|
});
|
|
295
296
|
case 'select':
|
|
296
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
297
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
297
298
|
children: [
|
|
298
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
299
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
299
300
|
required: required,
|
|
300
301
|
children: field.label
|
|
301
302
|
}),
|
|
@@ -319,18 +320,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
319
320
|
})
|
|
320
321
|
]
|
|
321
322
|
}),
|
|
322
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
323
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
323
324
|
children: field.description
|
|
324
325
|
}),
|
|
325
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
326
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
326
327
|
children: error
|
|
327
328
|
})
|
|
328
329
|
]
|
|
329
330
|
});
|
|
330
331
|
case 'multiselect':
|
|
331
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
332
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
332
333
|
children: [
|
|
333
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
334
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
334
335
|
required: required,
|
|
335
336
|
children: field.label
|
|
336
337
|
}),
|
|
@@ -347,16 +348,16 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
347
348
|
searchPlaceholder: "Search...",
|
|
348
349
|
maxSelected: field.maxSelected
|
|
349
350
|
}),
|
|
350
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
351
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
351
352
|
children: field.description
|
|
352
353
|
}),
|
|
353
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
354
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
354
355
|
children: error
|
|
355
356
|
})
|
|
356
357
|
]
|
|
357
358
|
});
|
|
358
359
|
case 'checkbox':
|
|
359
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
360
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
360
361
|
children: [
|
|
361
362
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
362
363
|
className: "flex items-start space-x-2",
|
|
@@ -370,25 +371,25 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
370
371
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
371
372
|
className: "space-y-1 leading-none",
|
|
372
373
|
children: [
|
|
373
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
374
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
374
375
|
htmlFor: field.name,
|
|
375
376
|
className: "font-normal",
|
|
376
377
|
children: field.label
|
|
377
378
|
}),
|
|
378
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
379
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
379
380
|
children: field.description
|
|
380
381
|
})
|
|
381
382
|
]
|
|
382
383
|
})
|
|
383
384
|
]
|
|
384
385
|
}),
|
|
385
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
386
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
386
387
|
children: error
|
|
387
388
|
})
|
|
388
389
|
]
|
|
389
390
|
});
|
|
390
391
|
case 'switch':
|
|
391
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
392
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
392
393
|
children: [
|
|
393
394
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
394
395
|
className: "flex items-center justify-between",
|
|
@@ -396,10 +397,10 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
396
397
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
397
398
|
className: "space-y-0.5",
|
|
398
399
|
children: [
|
|
399
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
400
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
400
401
|
children: field.label
|
|
401
402
|
}),
|
|
402
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
403
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
403
404
|
children: field.description
|
|
404
405
|
})
|
|
405
406
|
]
|
|
@@ -411,15 +412,15 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
411
412
|
})
|
|
412
413
|
]
|
|
413
414
|
}),
|
|
414
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
415
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
415
416
|
children: error
|
|
416
417
|
})
|
|
417
418
|
]
|
|
418
419
|
});
|
|
419
420
|
case 'radio':
|
|
420
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
421
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
421
422
|
children: [
|
|
422
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
423
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
423
424
|
required: required,
|
|
424
425
|
children: field.label
|
|
425
426
|
}),
|
|
@@ -436,16 +437,17 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
436
437
|
disabled: 'disabled' in option ? Boolean(option.disabled) : false
|
|
437
438
|
}),
|
|
438
439
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
|
|
440
|
+
variant: "muted",
|
|
439
441
|
htmlFor: `${field.name}-${option.value}`,
|
|
440
442
|
children: option.label
|
|
441
443
|
})
|
|
442
444
|
]
|
|
443
445
|
}, String(option.value)))
|
|
444
446
|
}),
|
|
445
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
447
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
446
448
|
children: field.description
|
|
447
449
|
}),
|
|
448
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
450
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
449
451
|
children: error
|
|
450
452
|
})
|
|
451
453
|
]
|
|
@@ -459,9 +461,9 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
459
461
|
required: required
|
|
460
462
|
});
|
|
461
463
|
case 'date':
|
|
462
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
464
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
463
465
|
children: [
|
|
464
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
466
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
465
467
|
required: required,
|
|
466
468
|
children: field.label
|
|
467
469
|
}),
|
|
@@ -471,18 +473,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
471
473
|
disabled: disabled,
|
|
472
474
|
placeholder: field.placeholder
|
|
473
475
|
}),
|
|
474
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
476
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
475
477
|
children: field.description
|
|
476
478
|
}),
|
|
477
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
479
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
478
480
|
children: error
|
|
479
481
|
})
|
|
480
482
|
]
|
|
481
483
|
});
|
|
482
484
|
case 'datetime':
|
|
483
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
485
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
484
486
|
children: [
|
|
485
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
487
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
486
488
|
required: required,
|
|
487
489
|
children: field.label
|
|
488
490
|
}),
|
|
@@ -493,18 +495,18 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
493
495
|
placeholder: field.placeholder,
|
|
494
496
|
use12Hour: field.use12Hour
|
|
495
497
|
}),
|
|
496
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
498
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
497
499
|
children: field.description
|
|
498
500
|
}),
|
|
499
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
501
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
500
502
|
children: error
|
|
501
503
|
})
|
|
502
504
|
]
|
|
503
505
|
});
|
|
504
506
|
case 'file':
|
|
505
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
507
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
506
508
|
children: [
|
|
507
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
509
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
508
510
|
required: required,
|
|
509
511
|
children: field.label
|
|
510
512
|
}),
|
|
@@ -518,10 +520,10 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
518
520
|
formField.onChange(field.multiple ? files : files[0]);
|
|
519
521
|
}
|
|
520
522
|
}),
|
|
521
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
523
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
522
524
|
children: field.description
|
|
523
525
|
}),
|
|
524
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
526
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
525
527
|
children: error
|
|
526
528
|
})
|
|
527
529
|
]
|
|
@@ -530,41 +532,6 @@ function FieldByType({ field, formField, error, disabled, required, options }) {
|
|
|
530
532
|
return null;
|
|
531
533
|
}
|
|
532
534
|
}
|
|
533
|
-
function FormField({ children, className = '' }) {
|
|
534
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
535
|
-
"data-slot": "form-field",
|
|
536
|
-
className: (0, index_cjs_namespaceObject.cn)('grid gap-1.5', className),
|
|
537
|
-
children: children
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
function FormLabel({ children, required, htmlFor, className = '' }) {
|
|
541
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(label_cjs_namespaceObject.Label, {
|
|
542
|
-
"data-slot": "form-label",
|
|
543
|
-
htmlFor: htmlFor,
|
|
544
|
-
className: className,
|
|
545
|
-
children: [
|
|
546
|
-
children,
|
|
547
|
-
required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.RequiredIndicator, {
|
|
548
|
-
className: "ml-1"
|
|
549
|
-
})
|
|
550
|
-
]
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
function FormDescription({ children }) {
|
|
554
|
-
if (!children) return null;
|
|
555
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
556
|
-
"data-slot": "form-description",
|
|
557
|
-
className: "text-sm text-muted-foreground",
|
|
558
|
-
children: children
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
function FormError({ children }) {
|
|
562
|
-
if (!children) return null;
|
|
563
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
564
|
-
className: "text-sm text-destructive",
|
|
565
|
-
children: children
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
535
|
function SliderField({ field, formField, error, disabled, required }) {
|
|
569
536
|
const { watch } = (0, external_react_hook_form_namespaceObject.useFormContext)();
|
|
570
537
|
const watchedMax = field.maxRef ? watch(field.maxRef.fromField) : void 0;
|
|
@@ -585,12 +552,12 @@ function SliderField({ field, formField, error, disabled, required }) {
|
|
|
585
552
|
if ('number' == typeof v) return Math.min(v, resolvedMax);
|
|
586
553
|
return v;
|
|
587
554
|
})();
|
|
588
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(FormField, {
|
|
555
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(form_field_cjs_namespaceObject.FormField, {
|
|
589
556
|
children: [
|
|
590
557
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
591
558
|
className: "flex justify-between",
|
|
592
559
|
children: [
|
|
593
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
560
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldLabel, {
|
|
594
561
|
required: required,
|
|
595
562
|
children: field.label
|
|
596
563
|
}),
|
|
@@ -610,10 +577,10 @@ function SliderField({ field, formField, error, disabled, required }) {
|
|
|
610
577
|
step: field.step || 1,
|
|
611
578
|
disabled: disabled
|
|
612
579
|
}),
|
|
613
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
580
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldDescription, {
|
|
614
581
|
children: field.description
|
|
615
582
|
}),
|
|
616
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
583
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(form_field_cjs_namespaceObject.FormFieldError, {
|
|
617
584
|
children: error
|
|
618
585
|
})
|
|
619
586
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { FieldMetadata, FormContext
|
|
2
|
+
import type { CustomFieldComponentProps, FieldMetadata, FormContext } from './form-schema';
|
|
3
3
|
/**
|
|
4
4
|
* Field Renderer - Connects metadata to actual UI components
|
|
5
5
|
* Integrates with shadcn/ui components from apollo-wind
|