@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,62 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../lib/utils.mjs';
|
|
6
|
+
|
|
7
|
+
function Accordion({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
11
|
+
}
|
|
12
|
+
function AccordionItem({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
AccordionPrimitive.Item,
|
|
18
|
+
{
|
|
19
|
+
"data-slot": "accordion-item",
|
|
20
|
+
className: cn("border-b last:border-b-0", className),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function AccordionTrigger({
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
31
|
+
AccordionPrimitive.Trigger,
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "accordion-trigger",
|
|
34
|
+
className: cn(
|
|
35
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
...props,
|
|
39
|
+
children: [
|
|
40
|
+
children,
|
|
41
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
}
|
|
46
|
+
function AccordionContent({
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
AccordionPrimitive.Content,
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "accordion-content",
|
|
55
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
6
|
+
const utils = require('../lib/utils.cjs');
|
|
7
|
+
const button = require('./button.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 AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(AlertDialogPrimitive);
|
|
22
|
+
|
|
23
|
+
function AlertDialog({
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialogPrimitive__namespace.Root, { "data-slot": "alert-dialog", ...props });
|
|
27
|
+
}
|
|
28
|
+
function AlertDialogPortal({
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialogPrimitive__namespace.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
32
|
+
}
|
|
33
|
+
function AlertDialogOverlay({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
AlertDialogPrimitive__namespace.Overlay,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "alert-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 AlertDialogContent({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
AlertDialogPrimitive__namespace.Content,
|
|
57
|
+
{
|
|
58
|
+
"data-slot": "alert-dialog-content",
|
|
59
|
+
className: utils.cn(
|
|
60
|
+
"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 sm:max-w-lg",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function AlertDialogHeader({
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
"data-slot": "alert-dialog-header",
|
|
76
|
+
className: utils.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function AlertDialogFooter({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}) {
|
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "alert-dialog-footer",
|
|
89
|
+
className: utils.cn(
|
|
90
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
...props
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function AlertDialogTitle({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}) {
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
AlertDialogPrimitive__namespace.Title,
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "alert-dialog-title",
|
|
105
|
+
className: utils.cn("text-lg font-semibold", className),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function AlertDialogDescription({
|
|
111
|
+
className,
|
|
112
|
+
...props
|
|
113
|
+
}) {
|
|
114
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
+
AlertDialogPrimitive__namespace.Description,
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "alert-dialog-description",
|
|
118
|
+
className: utils.cn("text-muted-foreground text-sm", className),
|
|
119
|
+
...props
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
function AlertDialogAction({
|
|
124
|
+
className,
|
|
125
|
+
...props
|
|
126
|
+
}) {
|
|
127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
+
AlertDialogPrimitive__namespace.Action,
|
|
129
|
+
{
|
|
130
|
+
className: utils.cn(button.buttonVariants(), className),
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function AlertDialogCancel({
|
|
136
|
+
className,
|
|
137
|
+
...props
|
|
138
|
+
}) {
|
|
139
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
140
|
+
AlertDialogPrimitive__namespace.Cancel,
|
|
141
|
+
{
|
|
142
|
+
className: utils.cn(button.buttonVariants({ variant: "outline" }), className),
|
|
143
|
+
...props
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
exports.AlertDialog = AlertDialog;
|
|
149
|
+
exports.AlertDialogAction = AlertDialogAction;
|
|
150
|
+
exports.AlertDialogCancel = AlertDialogCancel;
|
|
151
|
+
exports.AlertDialogContent = AlertDialogContent;
|
|
152
|
+
exports.AlertDialogDescription = AlertDialogDescription;
|
|
153
|
+
exports.AlertDialogFooter = AlertDialogFooter;
|
|
154
|
+
exports.AlertDialogHeader = AlertDialogHeader;
|
|
155
|
+
exports.AlertDialogOverlay = AlertDialogOverlay;
|
|
156
|
+
exports.AlertDialogPortal = AlertDialogPortal;
|
|
157
|
+
exports.AlertDialogTitle = AlertDialogTitle;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
4
|
+
import { cn } from '../lib/utils.mjs';
|
|
5
|
+
import { buttonVariants } from './button.mjs';
|
|
6
|
+
|
|
7
|
+
function AlertDialog({
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
11
|
+
}
|
|
12
|
+
function AlertDialogPortal({
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
16
|
+
}
|
|
17
|
+
function AlertDialogOverlay({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
AlertDialogPrimitive.Overlay,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "alert-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 AlertDialogContent({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
AlertDialogPrimitive.Content,
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "alert-dialog-content",
|
|
43
|
+
className: cn(
|
|
44
|
+
"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 sm:max-w-lg",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function AlertDialogHeader({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "alert-dialog-header",
|
|
60
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
61
|
+
...props
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function AlertDialogFooter({
|
|
66
|
+
className,
|
|
67
|
+
...props
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "alert-dialog-footer",
|
|
73
|
+
className: cn(
|
|
74
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
75
|
+
className
|
|
76
|
+
),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function AlertDialogTitle({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}) {
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
AlertDialogPrimitive.Title,
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "alert-dialog-title",
|
|
89
|
+
className: cn("text-lg font-semibold", className),
|
|
90
|
+
...props
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function AlertDialogDescription({
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}) {
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
AlertDialogPrimitive.Description,
|
|
100
|
+
{
|
|
101
|
+
"data-slot": "alert-dialog-description",
|
|
102
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function AlertDialogAction({
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}) {
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
AlertDialogPrimitive.Action,
|
|
113
|
+
{
|
|
114
|
+
className: cn(buttonVariants(), className),
|
|
115
|
+
...props
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function AlertDialogCancel({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
AlertDialogPrimitive.Cancel,
|
|
125
|
+
{
|
|
126
|
+
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const form = require('../../form.cjs');
|
|
5
|
+
const utils = require('../../../lib/utils.cjs');
|
|
6
|
+
|
|
7
|
+
function AutoFormLabel({
|
|
8
|
+
label,
|
|
9
|
+
isRequired,
|
|
10
|
+
className
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(form.FormLabel, { className: utils.cn(className), children: [
|
|
13
|
+
label,
|
|
14
|
+
isRequired && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: " *" })
|
|
15
|
+
] }) });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = AutoFormLabel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { FormLabel } from '../../form.mjs';
|
|
3
|
+
import { cn } from '../../../lib/utils.mjs';
|
|
4
|
+
|
|
5
|
+
function AutoFormLabel({
|
|
6
|
+
label,
|
|
7
|
+
isRequired,
|
|
8
|
+
className
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(FormLabel, { className: cn(className), children: [
|
|
11
|
+
label,
|
|
12
|
+
isRequired && /* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
|
|
13
|
+
] }) });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { AutoFormLabel as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
function AutoFormTooltip({ fieldConfigItem }) {
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fieldConfigItem?.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 dark:text-white", children: fieldConfigItem.description }) });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = AutoFormTooltip;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
function AutoFormTooltip({ fieldConfigItem }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(Fragment, { children: fieldConfigItem?.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-white", children: fieldConfigItem.description }) });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { AutoFormTooltip as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const checkbox = require('./fields/checkbox.cjs');
|
|
4
|
+
const date = require('./fields/date.cjs');
|
|
5
|
+
const _enum = require('./fields/enum.cjs');
|
|
6
|
+
const input = require('./fields/input.cjs');
|
|
7
|
+
const number = require('./fields/number.cjs');
|
|
8
|
+
const radioGroup = require('./fields/radio-group.cjs');
|
|
9
|
+
const _switch = require('./fields/switch.cjs');
|
|
10
|
+
const textarea = require('./fields/textarea.cjs');
|
|
11
|
+
|
|
12
|
+
const INPUT_COMPONENTS = {
|
|
13
|
+
checkbox: checkbox,
|
|
14
|
+
date: date,
|
|
15
|
+
select: _enum,
|
|
16
|
+
radio: radioGroup,
|
|
17
|
+
switch: _switch,
|
|
18
|
+
textarea: textarea,
|
|
19
|
+
number: number,
|
|
20
|
+
fallback: input
|
|
21
|
+
};
|
|
22
|
+
const DEFAULT_ZOD_HANDLERS = {
|
|
23
|
+
// Zod v3 style type names
|
|
24
|
+
ZodBoolean: "checkbox",
|
|
25
|
+
ZodDate: "date",
|
|
26
|
+
ZodEnum: "select",
|
|
27
|
+
ZodNativeEnum: "select",
|
|
28
|
+
ZodNumber: "number",
|
|
29
|
+
// Zod v4 style type names (lowercase, no "Zod" prefix)
|
|
30
|
+
boolean: "checkbox",
|
|
31
|
+
date: "date",
|
|
32
|
+
enum: "select",
|
|
33
|
+
nativeEnum: "select",
|
|
34
|
+
number: "number",
|
|
35
|
+
int: "number",
|
|
36
|
+
float: "number"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.DEFAULT_ZOD_HANDLERS = DEFAULT_ZOD_HANDLERS;
|
|
40
|
+
exports.INPUT_COMPONENTS = INPUT_COMPONENTS;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import AutoFormCheckbox from './fields/checkbox.mjs';
|
|
2
|
+
import AutoFormDate from './fields/date.mjs';
|
|
3
|
+
import AutoFormEnum from './fields/enum.mjs';
|
|
4
|
+
import AutoFormInput from './fields/input.mjs';
|
|
5
|
+
import AutoFormNumber from './fields/number.mjs';
|
|
6
|
+
import AutoFormRadioGroup from './fields/radio-group.mjs';
|
|
7
|
+
import AutoFormSwitch from './fields/switch.mjs';
|
|
8
|
+
import AutoFormTextarea from './fields/textarea.mjs';
|
|
9
|
+
|
|
10
|
+
const INPUT_COMPONENTS = {
|
|
11
|
+
checkbox: AutoFormCheckbox,
|
|
12
|
+
date: AutoFormDate,
|
|
13
|
+
select: AutoFormEnum,
|
|
14
|
+
radio: AutoFormRadioGroup,
|
|
15
|
+
switch: AutoFormSwitch,
|
|
16
|
+
textarea: AutoFormTextarea,
|
|
17
|
+
number: AutoFormNumber,
|
|
18
|
+
fallback: AutoFormInput
|
|
19
|
+
};
|
|
20
|
+
const DEFAULT_ZOD_HANDLERS = {
|
|
21
|
+
// Zod v3 style type names
|
|
22
|
+
ZodBoolean: "checkbox",
|
|
23
|
+
ZodDate: "date",
|
|
24
|
+
ZodEnum: "select",
|
|
25
|
+
ZodNativeEnum: "select",
|
|
26
|
+
ZodNumber: "number",
|
|
27
|
+
// Zod v4 style type names (lowercase, no "Zod" prefix)
|
|
28
|
+
boolean: "checkbox",
|
|
29
|
+
date: "date",
|
|
30
|
+
enum: "select",
|
|
31
|
+
nativeEnum: "select",
|
|
32
|
+
number: "number",
|
|
33
|
+
int: "number",
|
|
34
|
+
float: "number"
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { DEFAULT_ZOD_HANDLERS, INPUT_COMPONENTS };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const types = require('./types.cjs');
|
|
4
|
+
|
|
5
|
+
function resolveDependencies(dependencies, currentFieldName, watch) {
|
|
6
|
+
let isDisabled = false;
|
|
7
|
+
let isHidden = false;
|
|
8
|
+
let isRequired = false;
|
|
9
|
+
let overrideOptions;
|
|
10
|
+
const currentFieldValue = watch(currentFieldName);
|
|
11
|
+
const currentFieldDependencies = dependencies.filter(
|
|
12
|
+
(dependency) => dependency.targetField === currentFieldName
|
|
13
|
+
);
|
|
14
|
+
for (const dependency of currentFieldDependencies) {
|
|
15
|
+
const watchedValue = watch(dependency.sourceField);
|
|
16
|
+
const conditionMet = dependency.when(watchedValue, currentFieldValue);
|
|
17
|
+
switch (dependency.type) {
|
|
18
|
+
case types.DependencyType.DISABLES:
|
|
19
|
+
if (conditionMet) {
|
|
20
|
+
isDisabled = true;
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
case types.DependencyType.REQUIRES:
|
|
24
|
+
if (conditionMet) {
|
|
25
|
+
isRequired = true;
|
|
26
|
+
}
|
|
27
|
+
break;
|
|
28
|
+
case types.DependencyType.HIDES:
|
|
29
|
+
if (conditionMet) {
|
|
30
|
+
isHidden = true;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
case types.DependencyType.SETS_OPTIONS:
|
|
34
|
+
if (conditionMet) {
|
|
35
|
+
overrideOptions = dependency.options;
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
isDisabled,
|
|
42
|
+
isHidden,
|
|
43
|
+
isRequired,
|
|
44
|
+
overrideOptions
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = resolveDependencies;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DependencyType } from './types.mjs';
|
|
2
|
+
|
|
3
|
+
function resolveDependencies(dependencies, currentFieldName, watch) {
|
|
4
|
+
let isDisabled = false;
|
|
5
|
+
let isHidden = false;
|
|
6
|
+
let isRequired = false;
|
|
7
|
+
let overrideOptions;
|
|
8
|
+
const currentFieldValue = watch(currentFieldName);
|
|
9
|
+
const currentFieldDependencies = dependencies.filter(
|
|
10
|
+
(dependency) => dependency.targetField === currentFieldName
|
|
11
|
+
);
|
|
12
|
+
for (const dependency of currentFieldDependencies) {
|
|
13
|
+
const watchedValue = watch(dependency.sourceField);
|
|
14
|
+
const conditionMet = dependency.when(watchedValue, currentFieldValue);
|
|
15
|
+
switch (dependency.type) {
|
|
16
|
+
case DependencyType.DISABLES:
|
|
17
|
+
if (conditionMet) {
|
|
18
|
+
isDisabled = true;
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
case DependencyType.REQUIRES:
|
|
22
|
+
if (conditionMet) {
|
|
23
|
+
isRequired = true;
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
case DependencyType.HIDES:
|
|
27
|
+
if (conditionMet) {
|
|
28
|
+
isHidden = true;
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
case DependencyType.SETS_OPTIONS:
|
|
32
|
+
if (conditionMet) {
|
|
33
|
+
overrideOptions = dependency.options;
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
isDisabled,
|
|
40
|
+
isHidden,
|
|
41
|
+
isRequired,
|
|
42
|
+
overrideOptions
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { resolveDependencies as default };
|