@btst/plugin-cms 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 +328 -0
- package/dist/api/getters.mjs +314 -0
- package/dist/api/index.cjs +29 -0
- package/dist/api/index.d.cts +209 -0
- package/dist/api/index.d.mts +209 -0
- package/dist/api/index.d.ts +209 -0
- package/dist/api/index.mjs +7 -0
- package/dist/api/lifecycle-migrations.cjs +13 -0
- package/dist/api/lifecycle-migrations.mjs +11 -0
- package/dist/api/mutations.cjs +59 -0
- package/dist/api/mutations.mjs +57 -0
- package/dist/api/operations.cjs +1769 -0
- package/dist/api/operations.mjs +1762 -0
- package/dist/api/plugin.cjs +337 -0
- package/dist/api/plugin.mjs +331 -0
- package/dist/api/query-key-defs.cjs +44 -0
- package/dist/api/query-key-defs.mjs +39 -0
- package/dist/api/relations.cjs +76 -0
- package/dist/api/relations.mjs +70 -0
- package/dist/client/components/forms/content-form.cjs +286 -0
- package/dist/client/components/forms/content-form.mjs +284 -0
- package/dist/client/components/forms/file-upload.cjs +160 -0
- package/dist/client/components/forms/file-upload.mjs +158 -0
- package/dist/client/components/forms/relation-field.cjs +237 -0
- package/dist/client/components/forms/relation-field.mjs +235 -0
- package/dist/client/components/index.cjs +14 -0
- package/dist/client/components/index.d.cts +20 -0
- package/dist/client/components/index.d.mts +20 -0
- package/dist/client/components/index.d.ts +20 -0
- package/dist/client/components/index.mjs +10 -0
- package/dist/client/components/inverse-relations-panel.cjs +272 -0
- package/dist/client/components/inverse-relations-panel.mjs +270 -0
- package/dist/client/components/loading/dashboard-skeleton.cjs +18 -0
- package/dist/client/components/loading/dashboard-skeleton.mjs +16 -0
- package/dist/client/components/loading/editor-skeleton.cjs +32 -0
- package/dist/client/components/loading/editor-skeleton.mjs +30 -0
- package/dist/client/components/loading/list-skeleton.cjs +32 -0
- package/dist/client/components/loading/list-skeleton.mjs +30 -0
- package/dist/client/components/pages/404-page.cjs +26 -0
- package/dist/client/components/pages/404-page.mjs +24 -0
- package/dist/client/components/pages/content-editor-page.cjs +84 -0
- package/dist/client/components/pages/content-editor-page.internal.cjs +170 -0
- package/dist/client/components/pages/content-editor-page.internal.mjs +168 -0
- package/dist/client/components/pages/content-editor-page.mjs +82 -0
- package/dist/client/components/pages/content-list-page.cjs +49 -0
- package/dist/client/components/pages/content-list-page.internal.cjs +334 -0
- package/dist/client/components/pages/content-list-page.internal.mjs +332 -0
- package/dist/client/components/pages/content-list-page.mjs +47 -0
- package/dist/client/components/pages/dashboard-page.cjs +42 -0
- package/dist/client/components/pages/dashboard-page.internal.cjs +102 -0
- package/dist/client/components/pages/dashboard-page.internal.mjs +100 -0
- package/dist/client/components/pages/dashboard-page.mjs +40 -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/constants.cjs +5 -0
- package/dist/client/constants.mjs +3 -0
- package/dist/client/hooks/cms-hooks.cjs +300 -0
- package/dist/client/hooks/cms-hooks.mjs +280 -0
- package/dist/client/hooks/cms-resource.cjs +13 -0
- package/dist/client/hooks/cms-resource.mjs +11 -0
- package/dist/client/hooks/index.cjs +25 -0
- package/dist/client/hooks/index.d.cts +693 -0
- package/dist/client/hooks/index.d.mts +693 -0
- package/dist/client/hooks/index.d.ts +693 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.cjs +15 -0
- package/dist/client/index.d.cts +654 -0
- package/dist/client/index.d.mts +654 -0
- package/dist/client/index.d.ts +654 -0
- package/dist/client/index.mjs +3 -0
- package/dist/client/overrides.cjs +26 -0
- package/dist/client/overrides.mjs +24 -0
- package/dist/client/plugin.cjs +316 -0
- package/dist/client/plugin.mjs +314 -0
- package/dist/client.css +3 -0
- package/dist/db.cjs +118 -0
- package/dist/db.mjs +116 -0
- package/dist/permissions.cjs +46 -0
- package/dist/permissions.d.cts +42 -0
- package/dist/permissions.d.mts +42 -0
- package/dist/permissions.d.ts +42 -0
- package/dist/permissions.mjs +44 -0
- package/dist/query-keys.cjs +229 -0
- package/dist/query-keys.d.cts +8 -0
- package/dist/query-keys.d.mts +8 -0
- package/dist/query-keys.d.ts +8 -0
- package/dist/query-keys.mjs +225 -0
- package/dist/schemas.cjs +81 -0
- package/dist/schemas.mjs +72 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.cts +6 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.mts +6 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.ts +6 -0
- package/dist/shared/plugin-cms.DQLAoogy.d.ts +1749 -0
- package/dist/shared/plugin-cms.W4Le8D91.d.mts +1749 -0
- package/dist/shared/plugin-cms.c-GeWvTf.d.cts +1749 -0
- package/dist/style.css +6 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +406 -0
- package/dist/types.d.mts +406 -0
- package/dist/types.d.ts +406 -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/badge.cjs +42 -0
- package/dist/ui/src/components/badge.mjs +39 -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/card.cjs +56 -0
- package/dist/ui/src/components/card.mjs +51 -0
- package/dist/ui/src/components/checkbox.cjs +48 -0
- package/dist/ui/src/components/checkbox.mjs +32 -0
- package/dist/ui/src/components/command.cjs +78 -0
- package/dist/ui/src/components/command.mjs +73 -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 +119 -0
- package/dist/ui/src/components/dialog.mjs +97 -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/multi-select.cjs +555 -0
- package/dist/ui/src/components/multi-select.mjs +540 -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/textarea.cjs +20 -0
- package/dist/ui/src/components/textarea.mjs +18 -0
- package/dist/ui/src/hooks/use-debounce.cjs +16 -0
- package/dist/ui/src/hooks/use-debounce.mjs +14 -0
- package/dist/ui/src/hooks/use-route-lifecycle.cjs +31 -0
- package/dist/ui/src/hooks/use-route-lifecycle.mjs +29 -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 +19 -0
- package/dist/utils.mjs +12 -0
- package/package.json +170 -3
- package/README.md +0 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
4
|
+
import { cn } from '../lib/utils.mjs';
|
|
5
|
+
|
|
6
|
+
function Switch({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
SwitchPrimitive.Root,
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "switch",
|
|
14
|
+
className: cn(
|
|
15
|
+
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ jsx(
|
|
20
|
+
SwitchPrimitive.Thumb,
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "switch-thumb",
|
|
23
|
+
className: cn(
|
|
24
|
+
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Switch };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
const utils = require('../lib/utils.cjs');
|
|
6
|
+
|
|
7
|
+
function Table({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "table-container",
|
|
12
|
+
className: "relative w-full overflow-x-auto",
|
|
13
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
"table",
|
|
15
|
+
{
|
|
16
|
+
"data-slot": "table",
|
|
17
|
+
className: utils.cn("w-full caption-bottom text-sm", className),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function TableHeader({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
"thead",
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "table-header",
|
|
29
|
+
className: utils.cn("[&_tr]:border-b", className),
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function TableBody({ className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
+
"tbody",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "table-body",
|
|
39
|
+
className: utils.cn("[&_tr:last-child]:border-0", className),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function TableRow({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
|
+
"tr",
|
|
47
|
+
{
|
|
48
|
+
"data-slot": "table-row",
|
|
49
|
+
className: utils.cn(
|
|
50
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function TableHead({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
"th",
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "table-head",
|
|
62
|
+
className: utils.cn(
|
|
63
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
64
|
+
className
|
|
65
|
+
),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function TableCell({ className, ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
|
+
"td",
|
|
73
|
+
{
|
|
74
|
+
"data-slot": "table-cell",
|
|
75
|
+
className: utils.cn(
|
|
76
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
...props
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exports.Table = Table;
|
|
85
|
+
exports.TableBody = TableBody;
|
|
86
|
+
exports.TableCell = TableCell;
|
|
87
|
+
exports.TableHead = TableHead;
|
|
88
|
+
exports.TableHeader = TableHeader;
|
|
89
|
+
exports.TableRow = TableRow;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../lib/utils.mjs';
|
|
4
|
+
|
|
5
|
+
function Table({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
"data-slot": "table-container",
|
|
10
|
+
className: "relative w-full overflow-x-auto",
|
|
11
|
+
children: /* @__PURE__ */ jsx(
|
|
12
|
+
"table",
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "table",
|
|
15
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function TableHeader({ className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"thead",
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "table-header",
|
|
27
|
+
className: cn("[&_tr]:border-b", className),
|
|
28
|
+
...props
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function TableBody({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"tbody",
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "table-body",
|
|
37
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function TableRow({ className, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"tr",
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "table-row",
|
|
47
|
+
className: cn(
|
|
48
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function TableHead({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
"th",
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "table-head",
|
|
60
|
+
className: cn(
|
|
61
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function TableCell({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"td",
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "table-cell",
|
|
73
|
+
className: cn(
|
|
74
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
75
|
+
className
|
|
76
|
+
),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const utils = require('../lib/utils.cjs');
|
|
5
|
+
|
|
6
|
+
function Textarea({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
"textarea",
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "textarea",
|
|
11
|
+
className: utils.cn(
|
|
12
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.Textarea = Textarea;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../lib/utils.mjs';
|
|
3
|
+
|
|
4
|
+
function Textarea({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"textarea",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "textarea",
|
|
9
|
+
className: cn(
|
|
10
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Textarea };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const React = require('react');
|
|
4
|
+
|
|
5
|
+
function useDebounce(value, delay) {
|
|
6
|
+
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
9
|
+
return () => {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
};
|
|
12
|
+
}, [value, delay]);
|
|
13
|
+
return debouncedValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.useDebounce = useDebounce;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function useDebounce(value, delay) {
|
|
4
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
7
|
+
return () => {
|
|
8
|
+
clearTimeout(timer);
|
|
9
|
+
};
|
|
10
|
+
}, [value, delay]);
|
|
11
|
+
return debouncedValue;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useDebounce };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const React = require('react');
|
|
5
|
+
|
|
6
|
+
function useRouteLifecycle({
|
|
7
|
+
routeName,
|
|
8
|
+
context,
|
|
9
|
+
overrides
|
|
10
|
+
}) {
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
if (overrides.onRouteRender) {
|
|
13
|
+
try {
|
|
14
|
+
const result = overrides.onRouteRender(routeName, context);
|
|
15
|
+
if (result instanceof Promise) {
|
|
16
|
+
result.catch((error) => {
|
|
17
|
+
if (overrides.onRouteError) {
|
|
18
|
+
overrides.onRouteError(routeName, error, context);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (overrides.onRouteError) {
|
|
24
|
+
overrides.onRouteError(routeName, error, context);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [routeName, overrides, context]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.useRouteLifecycle = useRouteLifecycle;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useRouteLifecycle({
|
|
5
|
+
routeName,
|
|
6
|
+
context,
|
|
7
|
+
overrides
|
|
8
|
+
}) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (overrides.onRouteRender) {
|
|
11
|
+
try {
|
|
12
|
+
const result = overrides.onRouteRender(routeName, context);
|
|
13
|
+
if (result instanceof Promise) {
|
|
14
|
+
result.catch((error) => {
|
|
15
|
+
if (overrides.onRouteError) {
|
|
16
|
+
overrides.onRouteError(routeName, error, context);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (overrides.onRouteError) {
|
|
22
|
+
overrides.onRouteError(routeName, error, context);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, [routeName, overrides, context]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useRouteLifecycle };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const z = require('zod');
|
|
4
|
+
|
|
5
|
+
function zodToFormSchema(schema, metadata) {
|
|
6
|
+
const jsonSchema = z.z.toJSONSchema(schema, {
|
|
7
|
+
unrepresentable: "any",
|
|
8
|
+
override: (ctx) => {
|
|
9
|
+
const def = ctx.zodSchema?._zod?.def;
|
|
10
|
+
if (def?.type === "date") {
|
|
11
|
+
ctx.jsonSchema.type = "string";
|
|
12
|
+
ctx.jsonSchema.format = "date-time";
|
|
13
|
+
const zodSchema = ctx.zodSchema;
|
|
14
|
+
if (zodSchema.minDate) {
|
|
15
|
+
ctx.jsonSchema.formatMinimum = zodSchema.minDate;
|
|
16
|
+
}
|
|
17
|
+
if (zodSchema.maxDate) {
|
|
18
|
+
ctx.jsonSchema.formatMaximum = zodSchema.maxDate;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
if (metadata?.steps) {
|
|
24
|
+
jsonSchema.steps = metadata.steps;
|
|
25
|
+
}
|
|
26
|
+
if (metadata?.stepGroupMap) {
|
|
27
|
+
jsonSchema.stepGroupMap = metadata.stepGroupMap;
|
|
28
|
+
}
|
|
29
|
+
return jsonSchema;
|
|
30
|
+
}
|
|
31
|
+
function extractStepGroupMap(jsonSchema) {
|
|
32
|
+
const stepGroupMap = {};
|
|
33
|
+
const properties = jsonSchema.properties;
|
|
34
|
+
if (!properties) return stepGroupMap;
|
|
35
|
+
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
36
|
+
if (typeof fieldSchema.stepGroup === "number") {
|
|
37
|
+
stepGroupMap[fieldName] = fieldSchema.stepGroup;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return stepGroupMap;
|
|
41
|
+
}
|
|
42
|
+
function findDateFieldsWithConstraints(jsonSchema) {
|
|
43
|
+
const dateFields = {};
|
|
44
|
+
const properties = jsonSchema.properties;
|
|
45
|
+
if (!properties) return dateFields;
|
|
46
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
47
|
+
if (prop.type === "string" && prop.format === "date-time") {
|
|
48
|
+
if (prop.formatMinimum || prop.formatMaximum) {
|
|
49
|
+
dateFields[key] = {
|
|
50
|
+
min: prop.formatMinimum,
|
|
51
|
+
max: prop.formatMaximum
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return dateFields;
|
|
57
|
+
}
|
|
58
|
+
function addDateValidations(schema, dateFieldsWithConstraints) {
|
|
59
|
+
if (Object.keys(dateFieldsWithConstraints).length === 0) {
|
|
60
|
+
return schema;
|
|
61
|
+
}
|
|
62
|
+
return schema.superRefine((data, ctx) => {
|
|
63
|
+
for (const [key, constraints] of Object.entries(dateFieldsWithConstraints)) {
|
|
64
|
+
const value = data[key];
|
|
65
|
+
if (value === void 0 || value === null || value === "") continue;
|
|
66
|
+
const dateValue = new Date(value);
|
|
67
|
+
if (isNaN(dateValue.getTime())) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: z.z.ZodIssueCode.custom,
|
|
70
|
+
message: "Invalid date",
|
|
71
|
+
path: [key]
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (constraints.min) {
|
|
76
|
+
const minDate = new Date(constraints.min);
|
|
77
|
+
if (dateValue < minDate) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: z.z.ZodIssueCode.custom,
|
|
80
|
+
message: `Date must be after ${minDate.toLocaleDateString()}`,
|
|
81
|
+
path: [key]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (constraints.max) {
|
|
86
|
+
const maxDate = new Date(constraints.max);
|
|
87
|
+
if (dateValue > maxDate) {
|
|
88
|
+
ctx.addIssue({
|
|
89
|
+
code: z.z.ZodIssueCode.custom,
|
|
90
|
+
message: `Date must be before ${maxDate.toLocaleDateString()}`,
|
|
91
|
+
path: [key]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function attachStepsMetadata(schema, jsonSchema) {
|
|
99
|
+
const steps = jsonSchema.steps;
|
|
100
|
+
if (!steps || steps.length === 0) {
|
|
101
|
+
return schema;
|
|
102
|
+
}
|
|
103
|
+
const stepGroupMap = jsonSchema.stepGroupMap ?? extractStepGroupMap(jsonSchema);
|
|
104
|
+
return schema.meta({
|
|
105
|
+
steps,
|
|
106
|
+
stepGroupMap
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function formSchemaToZod(jsonSchema) {
|
|
110
|
+
let schema = z.z.fromJSONSchema(jsonSchema);
|
|
111
|
+
if (schema && typeof schema.passthrough === "function") {
|
|
112
|
+
schema = schema.passthrough();
|
|
113
|
+
}
|
|
114
|
+
const dateFieldsWithConstraints = findDateFieldsWithConstraints(jsonSchema);
|
|
115
|
+
schema = addDateValidations(schema, dateFieldsWithConstraints);
|
|
116
|
+
schema = attachStepsMetadata(schema, jsonSchema);
|
|
117
|
+
return schema;
|
|
118
|
+
}
|
|
119
|
+
function hasSteps(jsonSchema) {
|
|
120
|
+
return Array.isArray(jsonSchema.steps) && jsonSchema.steps.length > 0;
|
|
121
|
+
}
|
|
122
|
+
function getSteps(jsonSchema) {
|
|
123
|
+
return jsonSchema.steps ?? [];
|
|
124
|
+
}
|
|
125
|
+
function getStepGroupMap(jsonSchema) {
|
|
126
|
+
return jsonSchema.stepGroupMap ?? extractStepGroupMap(jsonSchema);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.formSchemaToZod = formSchemaToZod;
|
|
130
|
+
exports.getStepGroupMap = getStepGroupMap;
|
|
131
|
+
exports.getSteps = getSteps;
|
|
132
|
+
exports.hasSteps = hasSteps;
|
|
133
|
+
exports.zodToFormSchema = zodToFormSchema;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
function zodToFormSchema(schema, metadata) {
|
|
4
|
+
const jsonSchema = z.toJSONSchema(schema, {
|
|
5
|
+
unrepresentable: "any",
|
|
6
|
+
override: (ctx) => {
|
|
7
|
+
const def = ctx.zodSchema?._zod?.def;
|
|
8
|
+
if (def?.type === "date") {
|
|
9
|
+
ctx.jsonSchema.type = "string";
|
|
10
|
+
ctx.jsonSchema.format = "date-time";
|
|
11
|
+
const zodSchema = ctx.zodSchema;
|
|
12
|
+
if (zodSchema.minDate) {
|
|
13
|
+
ctx.jsonSchema.formatMinimum = zodSchema.minDate;
|
|
14
|
+
}
|
|
15
|
+
if (zodSchema.maxDate) {
|
|
16
|
+
ctx.jsonSchema.formatMaximum = zodSchema.maxDate;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (metadata?.steps) {
|
|
22
|
+
jsonSchema.steps = metadata.steps;
|
|
23
|
+
}
|
|
24
|
+
if (metadata?.stepGroupMap) {
|
|
25
|
+
jsonSchema.stepGroupMap = metadata.stepGroupMap;
|
|
26
|
+
}
|
|
27
|
+
return jsonSchema;
|
|
28
|
+
}
|
|
29
|
+
function extractStepGroupMap(jsonSchema) {
|
|
30
|
+
const stepGroupMap = {};
|
|
31
|
+
const properties = jsonSchema.properties;
|
|
32
|
+
if (!properties) return stepGroupMap;
|
|
33
|
+
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
34
|
+
if (typeof fieldSchema.stepGroup === "number") {
|
|
35
|
+
stepGroupMap[fieldName] = fieldSchema.stepGroup;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return stepGroupMap;
|
|
39
|
+
}
|
|
40
|
+
function findDateFieldsWithConstraints(jsonSchema) {
|
|
41
|
+
const dateFields = {};
|
|
42
|
+
const properties = jsonSchema.properties;
|
|
43
|
+
if (!properties) return dateFields;
|
|
44
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
45
|
+
if (prop.type === "string" && prop.format === "date-time") {
|
|
46
|
+
if (prop.formatMinimum || prop.formatMaximum) {
|
|
47
|
+
dateFields[key] = {
|
|
48
|
+
min: prop.formatMinimum,
|
|
49
|
+
max: prop.formatMaximum
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return dateFields;
|
|
55
|
+
}
|
|
56
|
+
function addDateValidations(schema, dateFieldsWithConstraints) {
|
|
57
|
+
if (Object.keys(dateFieldsWithConstraints).length === 0) {
|
|
58
|
+
return schema;
|
|
59
|
+
}
|
|
60
|
+
return schema.superRefine((data, ctx) => {
|
|
61
|
+
for (const [key, constraints] of Object.entries(dateFieldsWithConstraints)) {
|
|
62
|
+
const value = data[key];
|
|
63
|
+
if (value === void 0 || value === null || value === "") continue;
|
|
64
|
+
const dateValue = new Date(value);
|
|
65
|
+
if (isNaN(dateValue.getTime())) {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: "Invalid date",
|
|
69
|
+
path: [key]
|
|
70
|
+
});
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (constraints.min) {
|
|
74
|
+
const minDate = new Date(constraints.min);
|
|
75
|
+
if (dateValue < minDate) {
|
|
76
|
+
ctx.addIssue({
|
|
77
|
+
code: z.ZodIssueCode.custom,
|
|
78
|
+
message: `Date must be after ${minDate.toLocaleDateString()}`,
|
|
79
|
+
path: [key]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (constraints.max) {
|
|
84
|
+
const maxDate = new Date(constraints.max);
|
|
85
|
+
if (dateValue > maxDate) {
|
|
86
|
+
ctx.addIssue({
|
|
87
|
+
code: z.ZodIssueCode.custom,
|
|
88
|
+
message: `Date must be before ${maxDate.toLocaleDateString()}`,
|
|
89
|
+
path: [key]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function attachStepsMetadata(schema, jsonSchema) {
|
|
97
|
+
const steps = jsonSchema.steps;
|
|
98
|
+
if (!steps || steps.length === 0) {
|
|
99
|
+
return schema;
|
|
100
|
+
}
|
|
101
|
+
const stepGroupMap = jsonSchema.stepGroupMap ?? extractStepGroupMap(jsonSchema);
|
|
102
|
+
return schema.meta({
|
|
103
|
+
steps,
|
|
104
|
+
stepGroupMap
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function formSchemaToZod(jsonSchema) {
|
|
108
|
+
let schema = z.fromJSONSchema(jsonSchema);
|
|
109
|
+
if (schema && typeof schema.passthrough === "function") {
|
|
110
|
+
schema = schema.passthrough();
|
|
111
|
+
}
|
|
112
|
+
const dateFieldsWithConstraints = findDateFieldsWithConstraints(jsonSchema);
|
|
113
|
+
schema = addDateValidations(schema, dateFieldsWithConstraints);
|
|
114
|
+
schema = attachStepsMetadata(schema, jsonSchema);
|
|
115
|
+
return schema;
|
|
116
|
+
}
|
|
117
|
+
function hasSteps(jsonSchema) {
|
|
118
|
+
return Array.isArray(jsonSchema.steps) && jsonSchema.steps.length > 0;
|
|
119
|
+
}
|
|
120
|
+
function getSteps(jsonSchema) {
|
|
121
|
+
return jsonSchema.steps ?? [];
|
|
122
|
+
}
|
|
123
|
+
function getStepGroupMap(jsonSchema) {
|
|
124
|
+
return jsonSchema.stepGroupMap ?? extractStepGroupMap(jsonSchema);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
|
package/dist/utils.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const clsx = require('clsx');
|
|
4
|
+
const tailwindMerge = require('tailwind-merge');
|
|
5
|
+
const slug = require('slug');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
|
+
|
|
9
|
+
const slug__default = /*#__PURE__*/_interopDefaultCompat(slug);
|
|
10
|
+
|
|
11
|
+
function slugify(text, locale = "en") {
|
|
12
|
+
return slug__default(text, { lower: true, locale });
|
|
13
|
+
}
|
|
14
|
+
function cn(...inputs) {
|
|
15
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.cn = cn;
|
|
19
|
+
exports.slugify = slugify;
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import slug from 'slug';
|
|
4
|
+
|
|
5
|
+
function slugify(text, locale = "en") {
|
|
6
|
+
return slug(text, { lower: true, locale });
|
|
7
|
+
}
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { cn, slugify };
|