@btst/plugin-form-builder 0.0.0-stage → 1.0.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,191 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useMemo } from 'react';
|
|
4
|
+
import { useTranslate, usePluginOverrides, PermissionAccess } from '@btst/stack/context';
|
|
5
|
+
import { SteppedAutoForm } from '../../../ui/src/components/auto-form/stepped-auto-form.mjs';
|
|
6
|
+
import { buildFieldConfigFromJsonSchema } from '../../../ui/src/components/auto-form/helpers.mjs';
|
|
7
|
+
import { formSchemaToZod } from '../../../ui/src/lib/schema-converter.mjs';
|
|
8
|
+
import { Skeleton } from '../../../ui/src/components/skeleton.mjs';
|
|
9
|
+
import { AlertCircle, CheckCircle } from 'lucide-react';
|
|
10
|
+
import { useFormBySlug, useSubmitForm } from '../../hooks/form-builder-hooks.mjs';
|
|
11
|
+
import { formBuilderPermissions } from '../../../permissions.mjs';
|
|
12
|
+
import { FORM_BUILDER_PLUGIN_ID } from '../../constants.mjs';
|
|
13
|
+
import { cn } from '../../../utils.mjs';
|
|
14
|
+
|
|
15
|
+
function DefaultLoadingComponent() {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
|
|
18
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
|
|
19
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }),
|
|
20
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-32" })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function DefaultErrorComponent({ error }) {
|
|
24
|
+
const t = useTranslate();
|
|
25
|
+
const { localization } = usePluginOverrides(
|
|
26
|
+
FORM_BUILDER_PLUGIN_ID
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-full bg-destructive/10 p-3 mb-4", children: /* @__PURE__ */ jsx(AlertCircle, { className: "h-6 w-6 text-destructive" }) }),
|
|
30
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-medium text-foreground mb-2", children: localization?.FORM_BUILDER_RENDERER_LOAD_FAILED ?? t("formBuilder.renderer.loadFailed", "Failed to load form") }),
|
|
31
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-sm", children: error.message || (localization?.FORM_BUILDER_RENDERER_UNEXPECTED_ERROR ?? t(
|
|
32
|
+
"formBuilder.renderer.unexpectedError",
|
|
33
|
+
"An unexpected error occurred"
|
|
34
|
+
)) })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
function DefaultSuccessComponent({ message }) {
|
|
38
|
+
const t = useTranslate();
|
|
39
|
+
const { localization } = usePluginOverrides(
|
|
40
|
+
FORM_BUILDER_PLUGIN_ID
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-full bg-green-100 dark:bg-green-900 p-3 mb-4", children: /* @__PURE__ */ jsx(CheckCircle, { className: "h-6 w-6 text-green-600 dark:text-green-400" }) }),
|
|
44
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-medium text-foreground mb-2", children: localization?.FORM_BUILDER_RENDERER_SUBMITTED_TITLE ?? t("formBuilder.renderer.submittedTitle", "Form Submitted") }),
|
|
45
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-sm", children: message })
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
function FormRenderer({
|
|
49
|
+
slug,
|
|
50
|
+
onSuccess,
|
|
51
|
+
onError,
|
|
52
|
+
fieldComponents: propFieldComponents,
|
|
53
|
+
successMessage: propSuccessMessage,
|
|
54
|
+
submitButtonText,
|
|
55
|
+
LoadingComponent = DefaultLoadingComponent,
|
|
56
|
+
ErrorComponent = DefaultErrorComponent,
|
|
57
|
+
className
|
|
58
|
+
}) {
|
|
59
|
+
const t = useTranslate();
|
|
60
|
+
const {
|
|
61
|
+
fieldComponents: overrideFieldComponents,
|
|
62
|
+
localization,
|
|
63
|
+
classNames
|
|
64
|
+
} = usePluginOverrides(FORM_BUILDER_PLUGIN_ID);
|
|
65
|
+
const formClassName = cn(className, classNames?.form);
|
|
66
|
+
const { form, isLoading, error } = useFormBySlug(slug);
|
|
67
|
+
const submitMutation = useSubmitForm(slug);
|
|
68
|
+
const [submitted, setSubmitted] = useState(false);
|
|
69
|
+
const [finalSuccessMessage, setFinalSuccessMessage] = useState(
|
|
70
|
+
null
|
|
71
|
+
);
|
|
72
|
+
const mergedFieldComponents = useMemo(
|
|
73
|
+
() => ({
|
|
74
|
+
...overrideFieldComponents,
|
|
75
|
+
...propFieldComponents
|
|
76
|
+
}),
|
|
77
|
+
[overrideFieldComponents, propFieldComponents]
|
|
78
|
+
);
|
|
79
|
+
const { zodSchema, fieldConfig } = useMemo(() => {
|
|
80
|
+
if (!form?.schema) {
|
|
81
|
+
return { zodSchema: null, fieldConfig: {} };
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const parsedSchema = JSON.parse(form.schema);
|
|
85
|
+
const zod = formSchemaToZod(parsedSchema);
|
|
86
|
+
const config = buildFieldConfigFromJsonSchema(
|
|
87
|
+
parsedSchema,
|
|
88
|
+
mergedFieldComponents
|
|
89
|
+
);
|
|
90
|
+
return { zodSchema: zod, fieldConfig: config };
|
|
91
|
+
} catch {
|
|
92
|
+
return { zodSchema: null, fieldConfig: {} };
|
|
93
|
+
}
|
|
94
|
+
}, [form?.schema, mergedFieldComponents]);
|
|
95
|
+
const handleSubmit = async (data) => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await submitMutation.mutateAsync({ data });
|
|
98
|
+
const message = propSuccessMessage || result.form.successMessage || (localization?.FORM_BUILDER_RENDERER_THANK_YOU ?? t("formBuilder.renderer.thankYou", "Thank you for your submission!"));
|
|
99
|
+
setFinalSuccessMessage(message);
|
|
100
|
+
setSubmitted(true);
|
|
101
|
+
onSuccess?.(result);
|
|
102
|
+
if (result.form.redirectUrl) {
|
|
103
|
+
window.location.href = result.form.redirectUrl;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
} catch (err) {
|
|
107
|
+
onError?.(err);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
if (isLoading) {
|
|
111
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(LoadingComponent, {}) });
|
|
112
|
+
}
|
|
113
|
+
if (error) {
|
|
114
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(ErrorComponent, { error }) });
|
|
115
|
+
}
|
|
116
|
+
if (!form) {
|
|
117
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
118
|
+
ErrorComponent,
|
|
119
|
+
{
|
|
120
|
+
error: new Error(
|
|
121
|
+
localization?.FORM_BUILDER_RENDERER_NOT_FOUND ?? t("formBuilder.renderer.notFound", "Form not found")
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
) });
|
|
125
|
+
}
|
|
126
|
+
if (form.status !== "active") {
|
|
127
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
128
|
+
ErrorComponent,
|
|
129
|
+
{
|
|
130
|
+
error: new Error(
|
|
131
|
+
localization?.FORM_BUILDER_RENDERER_INACTIVE ?? t(
|
|
132
|
+
"formBuilder.renderer.inactive",
|
|
133
|
+
"This form is not currently accepting submissions"
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
) });
|
|
138
|
+
}
|
|
139
|
+
if (!zodSchema) {
|
|
140
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(
|
|
141
|
+
ErrorComponent,
|
|
142
|
+
{
|
|
143
|
+
error: new Error(
|
|
144
|
+
localization?.FORM_BUILDER_RENDERER_SCHEMA_ERROR ?? t(
|
|
145
|
+
"formBuilder.renderer.schemaError",
|
|
146
|
+
"Failed to parse form schema"
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
) });
|
|
151
|
+
}
|
|
152
|
+
if (submitted && finalSuccessMessage) {
|
|
153
|
+
return /* @__PURE__ */ jsx("div", { className: formClassName, children: /* @__PURE__ */ jsx(DefaultSuccessComponent, { message: finalSuccessMessage }) });
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
156
|
+
PermissionAccess,
|
|
157
|
+
{
|
|
158
|
+
permission: formBuilderPermissions.form.render({
|
|
159
|
+
slug: form.slug,
|
|
160
|
+
exists: true,
|
|
161
|
+
formId: form.id,
|
|
162
|
+
...form.createdBy ? { ownerId: form.createdBy } : {},
|
|
163
|
+
status: form.status
|
|
164
|
+
}),
|
|
165
|
+
children: /* @__PURE__ */ jsx(
|
|
166
|
+
PermissionAccess,
|
|
167
|
+
{
|
|
168
|
+
permission: formBuilderPermissions.submission.create({
|
|
169
|
+
slug: form.slug,
|
|
170
|
+
exists: true,
|
|
171
|
+
formId: form.id,
|
|
172
|
+
...form.createdBy ? { ownerId: form.createdBy } : {},
|
|
173
|
+
status: form.status
|
|
174
|
+
}),
|
|
175
|
+
children: /* @__PURE__ */ jsx("div", { className: formClassName, "data-testid": "form-renderer", children: /* @__PURE__ */ jsx(
|
|
176
|
+
SteppedAutoForm,
|
|
177
|
+
{
|
|
178
|
+
formSchema: zodSchema,
|
|
179
|
+
fieldConfig,
|
|
180
|
+
onSubmit: (values) => handleSubmit(values),
|
|
181
|
+
isSubmitting: submitMutation.isPending,
|
|
182
|
+
submitButtonText: submitButtonText || (localization?.FORM_BUILDER_BUTTON_SUBMIT ?? t("formBuilder.common.buttonSubmit", "Submit"))
|
|
183
|
+
}
|
|
184
|
+
) })
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { FormRenderer };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const formListPage = require('./pages/form-list-page.cjs');
|
|
5
|
+
const formBuilderPage = require('./pages/form-builder-page.cjs');
|
|
6
|
+
const submissionsPage = require('./pages/submissions-page.cjs');
|
|
7
|
+
const formRenderer = require('./forms/form-renderer.cjs');
|
|
8
|
+
const defaultError = require('./shared/default-error.cjs');
|
|
9
|
+
const emptyState = require('./shared/empty-state.cjs');
|
|
10
|
+
const _404Page = require('./pages/404-page.cjs');
|
|
11
|
+
const formBuilderSkeleton = require('./loading/form-builder-skeleton.cjs');
|
|
12
|
+
const formListSkeleton = require('./loading/form-list-skeleton.cjs');
|
|
13
|
+
const submissionsSkeleton = require('./loading/submissions-skeleton.cjs');
|
|
14
|
+
|
|
15
|
+
const FormListPage = formListPage.FormListPageComponent;
|
|
16
|
+
const FormBuilderPage = formBuilderPage.FormBuilderPageComponent;
|
|
17
|
+
const SubmissionsPage = submissionsPage.SubmissionsPageComponent;
|
|
18
|
+
const FormRenderer = formRenderer.FormRenderer;
|
|
19
|
+
|
|
20
|
+
exports.DefaultError = defaultError.DefaultError;
|
|
21
|
+
exports.EmptyState = emptyState.EmptyState;
|
|
22
|
+
exports.NotFoundPage = _404Page.NotFoundPage;
|
|
23
|
+
exports.FormBuilderSkeleton = formBuilderSkeleton.FormBuilderSkeleton;
|
|
24
|
+
exports.FormListSkeleton = formListSkeleton.FormListSkeleton;
|
|
25
|
+
exports.SubmissionsSkeleton = submissionsSkeleton.SubmissionsSkeleton;
|
|
26
|
+
exports.FormBuilderPage = FormBuilderPage;
|
|
27
|
+
exports.FormListPage = FormListPage;
|
|
28
|
+
exports.FormRenderer = FormRenderer;
|
|
29
|
+
exports.SubmissionsPage = SubmissionsPage;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { F as FormListPageComponent } from '../../shared/plugin-form-builder.DWrQ3lRX.cjs';
|
|
3
|
+
import { AutoFormInputComponentProps } from '../index.cjs';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { SerializedFormSubmission } from '../../types.cjs';
|
|
7
|
+
import 'react-hook-form';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@btst/stack/plugins/api';
|
|
10
|
+
import '@btst/stack/authorization';
|
|
11
|
+
import '@btst/stack/context';
|
|
12
|
+
import '../../permissions.cjs';
|
|
13
|
+
|
|
14
|
+
interface FormBuilderPageProps {
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function FormBuilderPageComponent({ id }: FormBuilderPageProps): react.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface SubmissionsPageProps {
|
|
20
|
+
formId: string;
|
|
21
|
+
}
|
|
22
|
+
declare function SubmissionsPageComponent({ formId }: SubmissionsPageProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
interface FormRendererProps {
|
|
25
|
+
/** Form slug to render */
|
|
26
|
+
slug: string;
|
|
27
|
+
/** Callback when form submission succeeds */
|
|
28
|
+
onSuccess?: (submission: SerializedFormSubmission & {
|
|
29
|
+
form: {
|
|
30
|
+
successMessage?: string;
|
|
31
|
+
redirectUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
}) => void;
|
|
34
|
+
/** Callback when form submission fails */
|
|
35
|
+
onError?: (error: Error) => void;
|
|
36
|
+
/** Custom field components (same as FormBuilder) */
|
|
37
|
+
fieldComponents?: Record<string, ComponentType<AutoFormInputComponentProps>>;
|
|
38
|
+
/** Override success message */
|
|
39
|
+
successMessage?: React.ReactNode;
|
|
40
|
+
/** Override submit button text */
|
|
41
|
+
submitButtonText?: string;
|
|
42
|
+
/** Custom loading component */
|
|
43
|
+
LoadingComponent?: ComponentType;
|
|
44
|
+
/** Custom error component */
|
|
45
|
+
ErrorComponent?: ComponentType<{
|
|
46
|
+
error: Error;
|
|
47
|
+
}>;
|
|
48
|
+
/** Class name for the form container */
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* FormRenderer component for rendering forms on the frontend.
|
|
53
|
+
*
|
|
54
|
+
* Uses SteppedAutoForm which automatically handles both single-step and multi-step forms.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <FormRenderer
|
|
59
|
+
* slug="contact-form"
|
|
60
|
+
* onSuccess={() => {
|
|
61
|
+
* toast.success("Thank you!");
|
|
62
|
+
* }}
|
|
63
|
+
* onError={(error) => {
|
|
64
|
+
* toast.error("Something went wrong");
|
|
65
|
+
* }}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function FormRenderer$1({ slug, onSuccess, onError, fieldComponents: propFieldComponents, successMessage: propSuccessMessage, submitButtonText, LoadingComponent, ErrorComponent, className, }: FormRendererProps): react.JSX.Element;
|
|
70
|
+
|
|
71
|
+
declare function FormListSkeleton(): react.JSX.Element;
|
|
72
|
+
|
|
73
|
+
declare function FormBuilderSkeleton(): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
declare function SubmissionsSkeleton(): react.JSX.Element;
|
|
76
|
+
|
|
77
|
+
interface DefaultErrorProps {
|
|
78
|
+
error: unknown;
|
|
79
|
+
resetErrorBoundary?: () => void;
|
|
80
|
+
}
|
|
81
|
+
declare function DefaultError({ error, resetErrorBoundary }: DefaultErrorProps): react.JSX.Element;
|
|
82
|
+
|
|
83
|
+
interface EmptyStateProps {
|
|
84
|
+
title: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
action?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare function EmptyState({ title, description, action }: EmptyStateProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
declare function NotFoundPage(): react.JSX.Element;
|
|
91
|
+
|
|
92
|
+
declare const FormListPage: typeof FormListPageComponent;
|
|
93
|
+
declare const FormBuilderPage: typeof FormBuilderPageComponent;
|
|
94
|
+
declare const SubmissionsPage: typeof SubmissionsPageComponent;
|
|
95
|
+
declare const FormRenderer: typeof FormRenderer$1;
|
|
96
|
+
|
|
97
|
+
export { DefaultError, EmptyState, FormBuilderPage, FormBuilderSkeleton, FormListPage, FormListSkeleton, FormRenderer, NotFoundPage, SubmissionsPage, SubmissionsSkeleton };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { F as FormListPageComponent } from '../../shared/plugin-form-builder.DWrQ3lRX.mjs';
|
|
3
|
+
import { AutoFormInputComponentProps } from '../index.mjs';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { SerializedFormSubmission } from '../../types.mjs';
|
|
7
|
+
import 'react-hook-form';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@btst/stack/plugins/api';
|
|
10
|
+
import '@btst/stack/authorization';
|
|
11
|
+
import '@btst/stack/context';
|
|
12
|
+
import '../../permissions.mjs';
|
|
13
|
+
|
|
14
|
+
interface FormBuilderPageProps {
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function FormBuilderPageComponent({ id }: FormBuilderPageProps): react.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface SubmissionsPageProps {
|
|
20
|
+
formId: string;
|
|
21
|
+
}
|
|
22
|
+
declare function SubmissionsPageComponent({ formId }: SubmissionsPageProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
interface FormRendererProps {
|
|
25
|
+
/** Form slug to render */
|
|
26
|
+
slug: string;
|
|
27
|
+
/** Callback when form submission succeeds */
|
|
28
|
+
onSuccess?: (submission: SerializedFormSubmission & {
|
|
29
|
+
form: {
|
|
30
|
+
successMessage?: string;
|
|
31
|
+
redirectUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
}) => void;
|
|
34
|
+
/** Callback when form submission fails */
|
|
35
|
+
onError?: (error: Error) => void;
|
|
36
|
+
/** Custom field components (same as FormBuilder) */
|
|
37
|
+
fieldComponents?: Record<string, ComponentType<AutoFormInputComponentProps>>;
|
|
38
|
+
/** Override success message */
|
|
39
|
+
successMessage?: React.ReactNode;
|
|
40
|
+
/** Override submit button text */
|
|
41
|
+
submitButtonText?: string;
|
|
42
|
+
/** Custom loading component */
|
|
43
|
+
LoadingComponent?: ComponentType;
|
|
44
|
+
/** Custom error component */
|
|
45
|
+
ErrorComponent?: ComponentType<{
|
|
46
|
+
error: Error;
|
|
47
|
+
}>;
|
|
48
|
+
/** Class name for the form container */
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* FormRenderer component for rendering forms on the frontend.
|
|
53
|
+
*
|
|
54
|
+
* Uses SteppedAutoForm which automatically handles both single-step and multi-step forms.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <FormRenderer
|
|
59
|
+
* slug="contact-form"
|
|
60
|
+
* onSuccess={() => {
|
|
61
|
+
* toast.success("Thank you!");
|
|
62
|
+
* }}
|
|
63
|
+
* onError={(error) => {
|
|
64
|
+
* toast.error("Something went wrong");
|
|
65
|
+
* }}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function FormRenderer$1({ slug, onSuccess, onError, fieldComponents: propFieldComponents, successMessage: propSuccessMessage, submitButtonText, LoadingComponent, ErrorComponent, className, }: FormRendererProps): react.JSX.Element;
|
|
70
|
+
|
|
71
|
+
declare function FormListSkeleton(): react.JSX.Element;
|
|
72
|
+
|
|
73
|
+
declare function FormBuilderSkeleton(): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
declare function SubmissionsSkeleton(): react.JSX.Element;
|
|
76
|
+
|
|
77
|
+
interface DefaultErrorProps {
|
|
78
|
+
error: unknown;
|
|
79
|
+
resetErrorBoundary?: () => void;
|
|
80
|
+
}
|
|
81
|
+
declare function DefaultError({ error, resetErrorBoundary }: DefaultErrorProps): react.JSX.Element;
|
|
82
|
+
|
|
83
|
+
interface EmptyStateProps {
|
|
84
|
+
title: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
action?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare function EmptyState({ title, description, action }: EmptyStateProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
declare function NotFoundPage(): react.JSX.Element;
|
|
91
|
+
|
|
92
|
+
declare const FormListPage: typeof FormListPageComponent;
|
|
93
|
+
declare const FormBuilderPage: typeof FormBuilderPageComponent;
|
|
94
|
+
declare const SubmissionsPage: typeof SubmissionsPageComponent;
|
|
95
|
+
declare const FormRenderer: typeof FormRenderer$1;
|
|
96
|
+
|
|
97
|
+
export { DefaultError, EmptyState, FormBuilderPage, FormBuilderSkeleton, FormListPage, FormListSkeleton, FormRenderer, NotFoundPage, SubmissionsPage, SubmissionsSkeleton };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { F as FormListPageComponent } from '../../shared/plugin-form-builder.DWrQ3lRX.js';
|
|
3
|
+
import { AutoFormInputComponentProps } from '../index.js';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { SerializedFormSubmission } from '../../types.js';
|
|
7
|
+
import 'react-hook-form';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@btst/stack/plugins/api';
|
|
10
|
+
import '@btst/stack/authorization';
|
|
11
|
+
import '@btst/stack/context';
|
|
12
|
+
import '../../permissions.js';
|
|
13
|
+
|
|
14
|
+
interface FormBuilderPageProps {
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function FormBuilderPageComponent({ id }: FormBuilderPageProps): react.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface SubmissionsPageProps {
|
|
20
|
+
formId: string;
|
|
21
|
+
}
|
|
22
|
+
declare function SubmissionsPageComponent({ formId }: SubmissionsPageProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
interface FormRendererProps {
|
|
25
|
+
/** Form slug to render */
|
|
26
|
+
slug: string;
|
|
27
|
+
/** Callback when form submission succeeds */
|
|
28
|
+
onSuccess?: (submission: SerializedFormSubmission & {
|
|
29
|
+
form: {
|
|
30
|
+
successMessage?: string;
|
|
31
|
+
redirectUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
}) => void;
|
|
34
|
+
/** Callback when form submission fails */
|
|
35
|
+
onError?: (error: Error) => void;
|
|
36
|
+
/** Custom field components (same as FormBuilder) */
|
|
37
|
+
fieldComponents?: Record<string, ComponentType<AutoFormInputComponentProps>>;
|
|
38
|
+
/** Override success message */
|
|
39
|
+
successMessage?: React.ReactNode;
|
|
40
|
+
/** Override submit button text */
|
|
41
|
+
submitButtonText?: string;
|
|
42
|
+
/** Custom loading component */
|
|
43
|
+
LoadingComponent?: ComponentType;
|
|
44
|
+
/** Custom error component */
|
|
45
|
+
ErrorComponent?: ComponentType<{
|
|
46
|
+
error: Error;
|
|
47
|
+
}>;
|
|
48
|
+
/** Class name for the form container */
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* FormRenderer component for rendering forms on the frontend.
|
|
53
|
+
*
|
|
54
|
+
* Uses SteppedAutoForm which automatically handles both single-step and multi-step forms.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <FormRenderer
|
|
59
|
+
* slug="contact-form"
|
|
60
|
+
* onSuccess={() => {
|
|
61
|
+
* toast.success("Thank you!");
|
|
62
|
+
* }}
|
|
63
|
+
* onError={(error) => {
|
|
64
|
+
* toast.error("Something went wrong");
|
|
65
|
+
* }}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function FormRenderer$1({ slug, onSuccess, onError, fieldComponents: propFieldComponents, successMessage: propSuccessMessage, submitButtonText, LoadingComponent, ErrorComponent, className, }: FormRendererProps): react.JSX.Element;
|
|
70
|
+
|
|
71
|
+
declare function FormListSkeleton(): react.JSX.Element;
|
|
72
|
+
|
|
73
|
+
declare function FormBuilderSkeleton(): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
declare function SubmissionsSkeleton(): react.JSX.Element;
|
|
76
|
+
|
|
77
|
+
interface DefaultErrorProps {
|
|
78
|
+
error: unknown;
|
|
79
|
+
resetErrorBoundary?: () => void;
|
|
80
|
+
}
|
|
81
|
+
declare function DefaultError({ error, resetErrorBoundary }: DefaultErrorProps): react.JSX.Element;
|
|
82
|
+
|
|
83
|
+
interface EmptyStateProps {
|
|
84
|
+
title: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
action?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare function EmptyState({ title, description, action }: EmptyStateProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
declare function NotFoundPage(): react.JSX.Element;
|
|
91
|
+
|
|
92
|
+
declare const FormListPage: typeof FormListPageComponent;
|
|
93
|
+
declare const FormBuilderPage: typeof FormBuilderPageComponent;
|
|
94
|
+
declare const SubmissionsPage: typeof SubmissionsPageComponent;
|
|
95
|
+
declare const FormRenderer: typeof FormRenderer$1;
|
|
96
|
+
|
|
97
|
+
export { DefaultError, EmptyState, FormBuilderPage, FormBuilderSkeleton, FormListPage, FormListSkeleton, FormRenderer, NotFoundPage, SubmissionsPage, SubmissionsSkeleton };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { FormListPageComponent } from './pages/form-list-page.mjs';
|
|
3
|
+
import { FormBuilderPageComponent } from './pages/form-builder-page.mjs';
|
|
4
|
+
import { SubmissionsPageComponent } from './pages/submissions-page.mjs';
|
|
5
|
+
import { FormRenderer as FormRenderer$1 } from './forms/form-renderer.mjs';
|
|
6
|
+
export { DefaultError } from './shared/default-error.mjs';
|
|
7
|
+
export { EmptyState } from './shared/empty-state.mjs';
|
|
8
|
+
export { NotFoundPage } from './pages/404-page.mjs';
|
|
9
|
+
export { FormBuilderSkeleton } from './loading/form-builder-skeleton.mjs';
|
|
10
|
+
export { FormListSkeleton } from './loading/form-list-skeleton.mjs';
|
|
11
|
+
export { SubmissionsSkeleton } from './loading/submissions-skeleton.mjs';
|
|
12
|
+
|
|
13
|
+
const FormListPage = FormListPageComponent;
|
|
14
|
+
const FormBuilderPage = FormBuilderPageComponent;
|
|
15
|
+
const SubmissionsPage = SubmissionsPageComponent;
|
|
16
|
+
const FormRenderer = FormRenderer$1;
|
|
17
|
+
|
|
18
|
+
export { FormBuilderPage, FormListPage, FormRenderer, SubmissionsPage };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const skeleton = require('../../../ui/src/components/skeleton.cjs');
|
|
6
|
+
|
|
7
|
+
function FormBuilderSkeleton() {
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col", "data-testid": "form-builder-skeleton", children: [
|
|
9
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 border-b p-4", children: [
|
|
10
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-10 w-48" }),
|
|
11
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-10 w-32" }),
|
|
12
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-10 w-24" }) })
|
|
13
|
+
] }),
|
|
14
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1", children: [
|
|
15
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-64 border-r p-4 space-y-4", children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-24" }),
|
|
17
|
+
Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-12 rounded-lg" }, i))
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 p-4 space-y-4", children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-32" }),
|
|
21
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-48 rounded-lg" }),
|
|
22
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-24 rounded-lg" })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-80 border-l p-4 space-y-4", children: [
|
|
25
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-20" }),
|
|
26
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-full rounded-lg" })
|
|
27
|
+
] })
|
|
28
|
+
] })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.FormBuilderSkeleton = FormBuilderSkeleton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Skeleton } from '../../../ui/src/components/skeleton.mjs';
|
|
4
|
+
|
|
5
|
+
function FormBuilderSkeleton() {
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col", "data-testid": "form-builder-skeleton", children: [
|
|
7
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 border-b p-4", children: [
|
|
8
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-48" }),
|
|
9
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-32" }),
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-24" }) })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1", children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("div", { className: "w-64 border-r p-4 space-y-4", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-24" }),
|
|
15
|
+
Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-12 rounded-lg" }, i))
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 p-4 space-y-4", children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-32" }),
|
|
19
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-48 rounded-lg" }),
|
|
20
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-24 rounded-lg" })
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ jsxs("div", { className: "w-80 border-l p-4 space-y-4", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-20" }),
|
|
24
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-full rounded-lg" })
|
|
25
|
+
] })
|
|
26
|
+
] })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { FormBuilderSkeleton };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const skeleton = require('../../../ui/src/components/skeleton.cjs');
|
|
6
|
+
const pageWrapper = require('../shared/page-wrapper.cjs');
|
|
7
|
+
|
|
8
|
+
function FormListSkeleton() {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(pageWrapper.PageWrapper, { testId: "form-list-skeleton", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-5xl space-y-6", children: [
|
|
10
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
12
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-8 w-32" }),
|
|
13
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-48" })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-10 w-28" })
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-16 rounded-lg" }, i)) })
|
|
18
|
+
] }) });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.FormListSkeleton = FormListSkeleton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Skeleton } from '../../../ui/src/components/skeleton.mjs';
|
|
4
|
+
import { PageWrapper } from '../shared/page-wrapper.mjs';
|
|
5
|
+
|
|
6
|
+
function FormListSkeleton() {
|
|
7
|
+
return /* @__PURE__ */ jsx(PageWrapper, { testId: "form-list-skeleton", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-5xl space-y-6", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-32" }),
|
|
11
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-48" })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-28" })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-16 rounded-lg" }, i)) })
|
|
16
|
+
] }) });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { FormListSkeleton };
|