@btst/plugin-form-builder 0.0.0-stage → 1.0.0-beta.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/LICENSE.md +17 -0
- package/dist/api/getters.cjs +154 -0
- package/dist/api/getters.mjs +145 -0
- package/dist/api/index.cjs +25 -0
- package/dist/api/index.d.cts +119 -0
- package/dist/api/index.d.mts +119 -0
- package/dist/api/index.d.ts +119 -0
- package/dist/api/index.mjs +6 -0
- package/dist/api/lifecycle-migrations.cjs +15 -0
- package/dist/api/lifecycle-migrations.mjs +13 -0
- package/dist/api/operations.cjs +1093 -0
- package/dist/api/operations.mjs +1082 -0
- package/dist/api/plugin.cjs +201 -0
- package/dist/api/plugin.mjs +192 -0
- package/dist/api/query-key-defs.cjs +43 -0
- package/dist/api/query-key-defs.mjs +39 -0
- package/dist/client/components/forms/form-renderer.cjs +193 -0
- package/dist/client/components/forms/form-renderer.mjs +191 -0
- package/dist/client/components/index.cjs +29 -0
- package/dist/client/components/index.d.cts +97 -0
- package/dist/client/components/index.d.mts +97 -0
- package/dist/client/components/index.d.ts +97 -0
- package/dist/client/components/index.mjs +18 -0
- package/dist/client/components/loading/form-builder-skeleton.cjs +32 -0
- package/dist/client/components/loading/form-builder-skeleton.mjs +30 -0
- package/dist/client/components/loading/form-list-skeleton.cjs +21 -0
- package/dist/client/components/loading/form-list-skeleton.mjs +19 -0
- package/dist/client/components/loading/submissions-skeleton.cjs +34 -0
- package/dist/client/components/loading/submissions-skeleton.mjs +32 -0
- package/dist/client/components/pages/404-page.cjs +28 -0
- package/dist/client/components/pages/404-page.mjs +26 -0
- package/dist/client/components/pages/form-builder-page.cjs +77 -0
- package/dist/client/components/pages/form-builder-page.internal.cjs +217 -0
- package/dist/client/components/pages/form-builder-page.internal.mjs +215 -0
- package/dist/client/components/pages/form-builder-page.mjs +75 -0
- package/dist/client/components/pages/form-list-page.cjs +44 -0
- package/dist/client/components/pages/form-list-page.internal.cjs +282 -0
- package/dist/client/components/pages/form-list-page.internal.mjs +280 -0
- package/dist/client/components/pages/form-list-page.mjs +42 -0
- package/dist/client/components/pages/submissions-page.cjs +64 -0
- package/dist/client/components/pages/submissions-page.internal.cjs +255 -0
- package/dist/client/components/pages/submissions-page.internal.mjs +253 -0
- package/dist/client/components/pages/submissions-page.mjs +62 -0
- package/dist/client/components/shared/default-error.cjs +17 -0
- package/dist/client/components/shared/default-error.mjs +15 -0
- package/dist/client/components/shared/empty-state.cjs +16 -0
- package/dist/client/components/shared/empty-state.mjs +14 -0
- package/dist/client/components/shared/page-wrapper.cjs +29 -0
- package/dist/client/components/shared/page-wrapper.mjs +27 -0
- package/dist/client/components/shared/pagination.cjs +49 -0
- package/dist/client/components/shared/pagination.mjs +47 -0
- package/dist/client/constants.cjs +5 -0
- package/dist/client/constants.mjs +3 -0
- package/dist/client/hooks/form-builder-hooks.cjs +203 -0
- package/dist/client/hooks/form-builder-hooks.mjs +186 -0
- package/dist/client/hooks/form-builder-resource.cjs +13 -0
- package/dist/client/hooks/form-builder-resource.mjs +11 -0
- package/dist/client/hooks/index.cjs +22 -0
- package/dist/client/hooks/index.d.cts +378 -0
- package/dist/client/hooks/index.d.mts +378 -0
- package/dist/client/hooks/index.d.ts +378 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.cjs +13 -0
- package/dist/client/index.d.cts +410 -0
- package/dist/client/index.d.mts +410 -0
- package/dist/client/index.d.ts +410 -0
- package/dist/client/index.mjs +2 -0
- package/dist/client/plugin.cjs +311 -0
- package/dist/client/plugin.mjs +309 -0
- package/dist/client.css +3 -0
- package/dist/db.cjs +99 -0
- package/dist/db.mjs +97 -0
- package/dist/permissions.cjs +95 -0
- package/dist/permissions.d.cts +94 -0
- package/dist/permissions.d.mts +94 -0
- package/dist/permissions.d.ts +94 -0
- package/dist/permissions.mjs +93 -0
- package/dist/query-keys.cjs +140 -0
- package/dist/query-keys.d.cts +392 -0
- package/dist/query-keys.d.mts +392 -0
- package/dist/query-keys.d.ts +392 -0
- package/dist/query-keys.mjs +137 -0
- package/dist/schemas.cjs +91 -0
- package/dist/schemas.mjs +82 -0
- package/dist/shared/plugin-form-builder.BZYGyFgT.d.mts +351 -0
- package/dist/shared/plugin-form-builder.Bbl9NufB.d.cts +408 -0
- package/dist/shared/plugin-form-builder.CSP5HR2O.d.ts +408 -0
- package/dist/shared/plugin-form-builder.Cmk083dA.d.cts +351 -0
- package/dist/shared/plugin-form-builder.D258Qpb8.d.ts +351 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.cts +118 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.mts +118 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.ts +118 -0
- package/dist/shared/plugin-form-builder.lp98rFNl.d.mts +408 -0
- package/dist/style.css +6 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +6 -0
- package/dist/types.d.mts +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.mjs +1 -0
- package/dist/ui/src/components/accordion.cjs +81 -0
- package/dist/ui/src/components/accordion.mjs +62 -0
- package/dist/ui/src/components/alert-dialog.cjs +157 -0
- package/dist/ui/src/components/alert-dialog.mjs +132 -0
- package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
- package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
- package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
- package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
- package/dist/ui/src/components/auto-form/config.cjs +40 -0
- package/dist/ui/src/components/auto-form/config.mjs +37 -0
- package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
- package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
- package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
- package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
- package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
- package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
- package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
- package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
- package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
- package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
- package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
- package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
- package/dist/ui/src/components/auto-form/index.cjs +92 -0
- package/dist/ui/src/components/auto-form/index.mjs +86 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
- package/dist/ui/src/components/auto-form/types.cjs +11 -0
- package/dist/ui/src/components/auto-form/types.mjs +9 -0
- package/dist/ui/src/components/button.cjs +56 -0
- package/dist/ui/src/components/button.mjs +53 -0
- package/dist/ui/src/components/calendar.cjs +207 -0
- package/dist/ui/src/components/calendar.mjs +190 -0
- package/dist/ui/src/components/checkbox.cjs +48 -0
- package/dist/ui/src/components/checkbox.mjs +32 -0
- package/dist/ui/src/components/date-picker.cjs +41 -0
- package/dist/ui/src/components/date-picker.mjs +39 -0
- package/dist/ui/src/components/dialog.cjs +141 -0
- package/dist/ui/src/components/dialog.mjs +118 -0
- package/dist/ui/src/components/dropdown-menu.cjs +81 -0
- package/dist/ui/src/components/dropdown-menu.mjs +62 -0
- package/dist/ui/src/components/form-builder/canvas.cjs +111 -0
- package/dist/ui/src/components/form-builder/canvas.mjs +109 -0
- package/dist/ui/src/components/form-builder/components/index.cjs +571 -0
- package/dist/ui/src/components/form-builder/components/index.mjs +554 -0
- package/dist/ui/src/components/form-builder/edit-field-dialog.cjs +131 -0
- package/dist/ui/src/components/form-builder/edit-field-dialog.mjs +129 -0
- package/dist/ui/src/components/form-builder/form-preview.cjs +73 -0
- package/dist/ui/src/components/form-builder/form-preview.mjs +71 -0
- package/dist/ui/src/components/form-builder/index.cjs +350 -0
- package/dist/ui/src/components/form-builder/index.mjs +344 -0
- package/dist/ui/src/components/form-builder/nested-field-editor-dialog.cjs +263 -0
- package/dist/ui/src/components/form-builder/nested-field-editor-dialog.mjs +261 -0
- package/dist/ui/src/components/form-builder/palette.cjs +52 -0
- package/dist/ui/src/components/form-builder/palette.mjs +49 -0
- package/dist/ui/src/components/form-builder/schema-utils.cjs +128 -0
- package/dist/ui/src/components/form-builder/schema-utils.mjs +122 -0
- package/dist/ui/src/components/form-builder/sortable-field.cjs +151 -0
- package/dist/ui/src/components/form-builder/sortable-field.mjs +148 -0
- package/dist/ui/src/components/form-builder/step-tabs.cjs +180 -0
- package/dist/ui/src/components/form-builder/step-tabs.mjs +178 -0
- package/dist/ui/src/components/form-builder/types.cjs +7 -0
- package/dist/ui/src/components/form-builder/types.mjs +5 -0
- package/dist/ui/src/components/form-builder/validation-schemas.cjs +67 -0
- package/dist/ui/src/components/form-builder/validation-schemas.mjs +56 -0
- package/dist/ui/src/components/form.cjs +120 -0
- package/dist/ui/src/components/form.mjs +98 -0
- package/dist/ui/src/components/input.cjs +23 -0
- package/dist/ui/src/components/input.mjs +21 -0
- package/dist/ui/src/components/label.cjs +39 -0
- package/dist/ui/src/components/label.mjs +23 -0
- package/dist/ui/src/components/page-layout.cjs +25 -0
- package/dist/ui/src/components/page-layout.mjs +23 -0
- package/dist/ui/src/components/page-wrapper.cjs +20 -0
- package/dist/ui/src/components/page-wrapper.mjs +18 -0
- package/dist/ui/src/components/popover.cjs +60 -0
- package/dist/ui/src/components/popover.mjs +42 -0
- package/dist/ui/src/components/radio-group.cjs +62 -0
- package/dist/ui/src/components/radio-group.mjs +45 -0
- package/dist/ui/src/components/select.cjs +161 -0
- package/dist/ui/src/components/select.mjs +139 -0
- package/dist/ui/src/components/separator.cjs +43 -0
- package/dist/ui/src/components/separator.mjs +27 -0
- package/dist/ui/src/components/skeleton.cjs +17 -0
- package/dist/ui/src/components/skeleton.mjs +15 -0
- package/dist/ui/src/components/stack-attribution.cjs +24 -0
- package/dist/ui/src/components/stack-attribution.mjs +22 -0
- package/dist/ui/src/components/switch.cjs +48 -0
- package/dist/ui/src/components/switch.mjs +32 -0
- package/dist/ui/src/components/table.cjs +89 -0
- package/dist/ui/src/components/table.mjs +82 -0
- package/dist/ui/src/components/tabs.cjs +84 -0
- package/dist/ui/src/components/tabs.mjs +65 -0
- package/dist/ui/src/components/textarea.cjs +20 -0
- package/dist/ui/src/components/textarea.mjs +18 -0
- package/dist/ui/src/lib/schema-converter.cjs +133 -0
- package/dist/ui/src/lib/schema-converter.mjs +127 -0
- package/dist/ui/src/lib/utils.cjs +10 -0
- package/dist/ui/src/lib/utils.mjs +8 -0
- package/dist/utils.cjs +41 -0
- package/dist/utils.mjs +32 -0
- package/package.json +175 -3
- package/README.md +0 -3
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const DialogPrimitive = require('@radix-ui/react-dialog');
|
|
6
|
+
const lucideReact = require('lucide-react');
|
|
7
|
+
const utils = require('../lib/utils.cjs');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceCompat(e) {
|
|
10
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
11
|
+
const n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
n[k] = e[k];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
n.default = e;
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(DialogPrimitive);
|
|
22
|
+
|
|
23
|
+
function Dialog({
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
|
|
27
|
+
}
|
|
28
|
+
function DialogPortal({
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
|
|
32
|
+
}
|
|
33
|
+
function DialogOverlay({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
DialogPrimitive__namespace.Overlay,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "dialog-overlay",
|
|
41
|
+
className: utils.cn(
|
|
42
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function DialogContent({
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
showCloseButton = true,
|
|
53
|
+
...props
|
|
54
|
+
}) {
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
58
|
+
DialogPrimitive__namespace.Content,
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "dialog-content",
|
|
61
|
+
className: utils.cn(
|
|
62
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props,
|
|
66
|
+
children: [
|
|
67
|
+
children,
|
|
68
|
+
showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
69
|
+
DialogPrimitive__namespace.Close,
|
|
70
|
+
{
|
|
71
|
+
"data-slot": "dialog-close",
|
|
72
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
function DialogHeader({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "dialog-header",
|
|
89
|
+
className: utils.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
90
|
+
...props
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function DialogFooter({ className, ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
"data-slot": "dialog-footer",
|
|
99
|
+
className: utils.cn(
|
|
100
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function DialogTitle({
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}) {
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
+
DialogPrimitive__namespace.Title,
|
|
113
|
+
{
|
|
114
|
+
"data-slot": "dialog-title",
|
|
115
|
+
className: utils.cn("text-lg leading-none font-semibold", className),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function DialogDescription({
|
|
121
|
+
className,
|
|
122
|
+
...props
|
|
123
|
+
}) {
|
|
124
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
DialogPrimitive__namespace.Description,
|
|
126
|
+
{
|
|
127
|
+
"data-slot": "dialog-description",
|
|
128
|
+
className: utils.cn("text-muted-foreground text-sm", className),
|
|
129
|
+
...props
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
exports.Dialog = Dialog;
|
|
135
|
+
exports.DialogContent = DialogContent;
|
|
136
|
+
exports.DialogDescription = DialogDescription;
|
|
137
|
+
exports.DialogFooter = DialogFooter;
|
|
138
|
+
exports.DialogHeader = DialogHeader;
|
|
139
|
+
exports.DialogOverlay = DialogOverlay;
|
|
140
|
+
exports.DialogPortal = DialogPortal;
|
|
141
|
+
exports.DialogTitle = DialogTitle;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
import { XIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../lib/utils.mjs';
|
|
6
|
+
|
|
7
|
+
function Dialog({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DialogPortal({
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
16
|
+
}
|
|
17
|
+
function DialogOverlay({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
DialogPrimitive.Overlay,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "dialog-overlay",
|
|
25
|
+
className: cn(
|
|
26
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function DialogContent({
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
showCloseButton = true,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
41
|
+
/* @__PURE__ */ jsxs(
|
|
42
|
+
DialogPrimitive.Content,
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "dialog-content",
|
|
45
|
+
className: cn(
|
|
46
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
...props,
|
|
50
|
+
children: [
|
|
51
|
+
children,
|
|
52
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
53
|
+
DialogPrimitive.Close,
|
|
54
|
+
{
|
|
55
|
+
"data-slot": "dialog-close",
|
|
56
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(XIcon, {}),
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function DialogHeader({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "dialog-header",
|
|
73
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function DialogFooter({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
"data-slot": "dialog-footer",
|
|
83
|
+
className: cn(
|
|
84
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
85
|
+
className
|
|
86
|
+
),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function DialogTitle({
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}) {
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
DialogPrimitive.Title,
|
|
97
|
+
{
|
|
98
|
+
"data-slot": "dialog-title",
|
|
99
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function DialogDescription({
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}) {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
DialogPrimitive.Description,
|
|
110
|
+
{
|
|
111
|
+
"data-slot": "dialog-description",
|
|
112
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
113
|
+
...props
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
6
|
+
require('lucide-react');
|
|
7
|
+
const utils = require('../lib/utils.cjs');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceCompat(e) {
|
|
10
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
11
|
+
const n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
n[k] = e[k];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
n.default = e;
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(DropdownMenuPrimitive);
|
|
22
|
+
|
|
23
|
+
function DropdownMenu({
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
|
|
27
|
+
}
|
|
28
|
+
function DropdownMenuTrigger({
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
DropdownMenuPrimitive__namespace.Trigger,
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "dropdown-menu-trigger",
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function DropdownMenuContent({
|
|
40
|
+
className,
|
|
41
|
+
sideOffset = 4,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
DropdownMenuPrimitive__namespace.Content,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "dropdown-menu-content",
|
|
48
|
+
sideOffset,
|
|
49
|
+
className: utils.cn(
|
|
50
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
) });
|
|
56
|
+
}
|
|
57
|
+
function DropdownMenuItem({
|
|
58
|
+
className,
|
|
59
|
+
inset,
|
|
60
|
+
variant = "default",
|
|
61
|
+
...props
|
|
62
|
+
}) {
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "dropdown-menu-item",
|
|
67
|
+
"data-inset": inset,
|
|
68
|
+
"data-variant": variant,
|
|
69
|
+
className: utils.cn(
|
|
70
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
71
|
+
className
|
|
72
|
+
),
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exports.DropdownMenu = DropdownMenu;
|
|
79
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
80
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
81
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
|
+
import 'lucide-react';
|
|
5
|
+
import { cn } from '../lib/utils.mjs';
|
|
6
|
+
|
|
7
|
+
function DropdownMenu({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DropdownMenuTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
DropdownMenuPrimitive.Trigger,
|
|
17
|
+
{
|
|
18
|
+
"data-slot": "dropdown-menu-trigger",
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function DropdownMenuContent({
|
|
24
|
+
className,
|
|
25
|
+
sideOffset = 4,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
29
|
+
DropdownMenuPrimitive.Content,
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "dropdown-menu-content",
|
|
32
|
+
sideOffset,
|
|
33
|
+
className: cn(
|
|
34
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
) });
|
|
40
|
+
}
|
|
41
|
+
function DropdownMenuItem({
|
|
42
|
+
className,
|
|
43
|
+
inset,
|
|
44
|
+
variant = "default",
|
|
45
|
+
...props
|
|
46
|
+
}) {
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
DropdownMenuPrimitive.Item,
|
|
49
|
+
{
|
|
50
|
+
"data-slot": "dropdown-menu-item",
|
|
51
|
+
"data-inset": inset,
|
|
52
|
+
"data-variant": variant,
|
|
53
|
+
className: cn(
|
|
54
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
55
|
+
className
|
|
56
|
+
),
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const core = require('@dnd-kit/core');
|
|
7
|
+
const sortable = require('@dnd-kit/sortable');
|
|
8
|
+
const utils = require('../../lib/utils.cjs');
|
|
9
|
+
const sortableField = require('./sortable-field.cjs');
|
|
10
|
+
const stepTabs = require('./step-tabs.cjs');
|
|
11
|
+
|
|
12
|
+
function DropZone({ id, isDraggingFromPalette }) {
|
|
13
|
+
const { setNodeRef, isOver } = core.useDroppable({
|
|
14
|
+
id
|
|
15
|
+
});
|
|
16
|
+
if (!isDraggingFromPalette) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
ref: setNodeRef,
|
|
23
|
+
className: utils.cn(
|
|
24
|
+
"h-2 rounded-full transition-all duration-200",
|
|
25
|
+
isOver ? "h-3 bg-primary animate-pulse" : "bg-muted-foreground/20"
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function Canvas({
|
|
31
|
+
fields,
|
|
32
|
+
components,
|
|
33
|
+
onEditField,
|
|
34
|
+
onDeleteField,
|
|
35
|
+
onConfigureNested,
|
|
36
|
+
isDraggingFromPalette,
|
|
37
|
+
className,
|
|
38
|
+
steps,
|
|
39
|
+
activeStepIndex,
|
|
40
|
+
onActiveStepChange,
|
|
41
|
+
onAddStep,
|
|
42
|
+
onDeleteStep,
|
|
43
|
+
onRenameStep,
|
|
44
|
+
hideStepControls
|
|
45
|
+
}) {
|
|
46
|
+
const { setNodeRef, isOver } = core.useDroppable({
|
|
47
|
+
id: "canvas"
|
|
48
|
+
});
|
|
49
|
+
const getComponent = (type) => components.find((c) => c.type === type);
|
|
50
|
+
const visibleFields = React.useMemo(() => {
|
|
51
|
+
if (steps.length <= 1) {
|
|
52
|
+
return fields;
|
|
53
|
+
}
|
|
54
|
+
return fields.filter((f) => (f.stepGroup ?? 0) === activeStepIndex);
|
|
55
|
+
}, [fields, steps.length, activeStepIndex]);
|
|
56
|
+
const sortableItems = React.useMemo(() => visibleFields.map((f) => f.id), [visibleFields]);
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("flex flex-col h-full", className), children: [
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
stepTabs.StepTabs,
|
|
60
|
+
{
|
|
61
|
+
steps,
|
|
62
|
+
activeStepIndex,
|
|
63
|
+
onActiveStepChange,
|
|
64
|
+
onAddStep,
|
|
65
|
+
onDeleteStep,
|
|
66
|
+
onRenameStep,
|
|
67
|
+
hideStepControls
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
ref: setNodeRef,
|
|
74
|
+
"data-testid": "form-builder-canvas",
|
|
75
|
+
className: utils.cn(
|
|
76
|
+
"flex-1 p-4 rounded-lg border-2 border-dashed min-h-[400px] transition-colors",
|
|
77
|
+
isOver && isDraggingFromPalette ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
78
|
+
),
|
|
79
|
+
children: visibleFields.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center h-full text-muted-foreground", "data-testid": "canvas-drop-zone", children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium", children: "Drop components here" }),
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: steps.length > 1 ? `Drag components from the palette to add to ${steps[activeStepIndex]?.title || "this step"}` : "Drag components from the palette to build your form" })
|
|
82
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
+
sortable.SortableContext,
|
|
84
|
+
{
|
|
85
|
+
items: sortableItems,
|
|
86
|
+
strategy: sortable.verticalListSortingStrategy,
|
|
87
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropZone, { id: "drop-zone-start", isDraggingFromPalette }),
|
|
89
|
+
visibleFields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
sortableField.SortableField,
|
|
92
|
+
{
|
|
93
|
+
field,
|
|
94
|
+
index,
|
|
95
|
+
component: getComponent(field.type),
|
|
96
|
+
onEdit: () => onEditField(field.id),
|
|
97
|
+
onDelete: () => onDeleteField(field.id),
|
|
98
|
+
onConfigureNested: onConfigureNested ? () => onConfigureNested(field.id) : void 0
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropZone, { id: `drop-zone-${field.id}`, isDraggingFromPalette })
|
|
102
|
+
] }, field.id))
|
|
103
|
+
] })
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
exports.Canvas = Canvas;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useDroppable } from '@dnd-kit/core';
|
|
5
|
+
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
6
|
+
import { cn } from '../../lib/utils.mjs';
|
|
7
|
+
import { SortableField } from './sortable-field.mjs';
|
|
8
|
+
import { StepTabs } from './step-tabs.mjs';
|
|
9
|
+
|
|
10
|
+
function DropZone({ id, isDraggingFromPalette }) {
|
|
11
|
+
const { setNodeRef, isOver } = useDroppable({
|
|
12
|
+
id
|
|
13
|
+
});
|
|
14
|
+
if (!isDraggingFromPalette) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
ref: setNodeRef,
|
|
21
|
+
className: cn(
|
|
22
|
+
"h-2 rounded-full transition-all duration-200",
|
|
23
|
+
isOver ? "h-3 bg-primary animate-pulse" : "bg-muted-foreground/20"
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function Canvas({
|
|
29
|
+
fields,
|
|
30
|
+
components,
|
|
31
|
+
onEditField,
|
|
32
|
+
onDeleteField,
|
|
33
|
+
onConfigureNested,
|
|
34
|
+
isDraggingFromPalette,
|
|
35
|
+
className,
|
|
36
|
+
steps,
|
|
37
|
+
activeStepIndex,
|
|
38
|
+
onActiveStepChange,
|
|
39
|
+
onAddStep,
|
|
40
|
+
onDeleteStep,
|
|
41
|
+
onRenameStep,
|
|
42
|
+
hideStepControls
|
|
43
|
+
}) {
|
|
44
|
+
const { setNodeRef, isOver } = useDroppable({
|
|
45
|
+
id: "canvas"
|
|
46
|
+
});
|
|
47
|
+
const getComponent = (type) => components.find((c) => c.type === type);
|
|
48
|
+
const visibleFields = useMemo(() => {
|
|
49
|
+
if (steps.length <= 1) {
|
|
50
|
+
return fields;
|
|
51
|
+
}
|
|
52
|
+
return fields.filter((f) => (f.stepGroup ?? 0) === activeStepIndex);
|
|
53
|
+
}, [fields, steps.length, activeStepIndex]);
|
|
54
|
+
const sortableItems = useMemo(() => visibleFields.map((f) => f.id), [visibleFields]);
|
|
55
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col h-full", className), children: [
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
StepTabs,
|
|
58
|
+
{
|
|
59
|
+
steps,
|
|
60
|
+
activeStepIndex,
|
|
61
|
+
onActiveStepChange,
|
|
62
|
+
onAddStep,
|
|
63
|
+
onDeleteStep,
|
|
64
|
+
onRenameStep,
|
|
65
|
+
hideStepControls
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
ref: setNodeRef,
|
|
72
|
+
"data-testid": "form-builder-canvas",
|
|
73
|
+
className: cn(
|
|
74
|
+
"flex-1 p-4 rounded-lg border-2 border-dashed min-h-[400px] transition-colors",
|
|
75
|
+
isOver && isDraggingFromPalette ? "border-primary bg-primary/5" : "border-muted-foreground/20"
|
|
76
|
+
),
|
|
77
|
+
children: visibleFields.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full text-muted-foreground", "data-testid": "canvas-drop-zone", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children: "Drop components here" }),
|
|
79
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: steps.length > 1 ? `Drag components from the palette to add to ${steps[activeStepIndex]?.title || "this step"}` : "Drag components from the palette to build your form" })
|
|
80
|
+
] }) : /* @__PURE__ */ jsx(
|
|
81
|
+
SortableContext,
|
|
82
|
+
{
|
|
83
|
+
items: sortableItems,
|
|
84
|
+
strategy: verticalListSortingStrategy,
|
|
85
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
86
|
+
/* @__PURE__ */ jsx(DropZone, { id: "drop-zone-start", isDraggingFromPalette }),
|
|
87
|
+
visibleFields.map((field, index) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
SortableField,
|
|
90
|
+
{
|
|
91
|
+
field,
|
|
92
|
+
index,
|
|
93
|
+
component: getComponent(field.type),
|
|
94
|
+
onEdit: () => onEditField(field.id),
|
|
95
|
+
onDelete: () => onDeleteField(field.id),
|
|
96
|
+
onConfigureNested: onConfigureNested ? () => onConfigureNested(field.id) : void 0
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(DropZone, { id: `drop-zone-${field.id}`, isDraggingFromPalette })
|
|
100
|
+
] }, field.id))
|
|
101
|
+
] })
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { Canvas };
|