@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.
Files changed (213) hide show
  1. package/LICENSE.md +17 -0
  2. package/dist/api/getters.cjs +154 -0
  3. package/dist/api/getters.mjs +145 -0
  4. package/dist/api/index.cjs +25 -0
  5. package/dist/api/index.d.cts +119 -0
  6. package/dist/api/index.d.mts +119 -0
  7. package/dist/api/index.d.ts +119 -0
  8. package/dist/api/index.mjs +6 -0
  9. package/dist/api/lifecycle-migrations.cjs +15 -0
  10. package/dist/api/lifecycle-migrations.mjs +13 -0
  11. package/dist/api/operations.cjs +1093 -0
  12. package/dist/api/operations.mjs +1082 -0
  13. package/dist/api/plugin.cjs +201 -0
  14. package/dist/api/plugin.mjs +192 -0
  15. package/dist/api/query-key-defs.cjs +43 -0
  16. package/dist/api/query-key-defs.mjs +39 -0
  17. package/dist/client/components/forms/form-renderer.cjs +193 -0
  18. package/dist/client/components/forms/form-renderer.mjs +191 -0
  19. package/dist/client/components/index.cjs +29 -0
  20. package/dist/client/components/index.d.cts +97 -0
  21. package/dist/client/components/index.d.mts +97 -0
  22. package/dist/client/components/index.d.ts +97 -0
  23. package/dist/client/components/index.mjs +18 -0
  24. package/dist/client/components/loading/form-builder-skeleton.cjs +32 -0
  25. package/dist/client/components/loading/form-builder-skeleton.mjs +30 -0
  26. package/dist/client/components/loading/form-list-skeleton.cjs +21 -0
  27. package/dist/client/components/loading/form-list-skeleton.mjs +19 -0
  28. package/dist/client/components/loading/submissions-skeleton.cjs +34 -0
  29. package/dist/client/components/loading/submissions-skeleton.mjs +32 -0
  30. package/dist/client/components/pages/404-page.cjs +28 -0
  31. package/dist/client/components/pages/404-page.mjs +26 -0
  32. package/dist/client/components/pages/form-builder-page.cjs +77 -0
  33. package/dist/client/components/pages/form-builder-page.internal.cjs +217 -0
  34. package/dist/client/components/pages/form-builder-page.internal.mjs +215 -0
  35. package/dist/client/components/pages/form-builder-page.mjs +75 -0
  36. package/dist/client/components/pages/form-list-page.cjs +44 -0
  37. package/dist/client/components/pages/form-list-page.internal.cjs +282 -0
  38. package/dist/client/components/pages/form-list-page.internal.mjs +280 -0
  39. package/dist/client/components/pages/form-list-page.mjs +42 -0
  40. package/dist/client/components/pages/submissions-page.cjs +64 -0
  41. package/dist/client/components/pages/submissions-page.internal.cjs +255 -0
  42. package/dist/client/components/pages/submissions-page.internal.mjs +253 -0
  43. package/dist/client/components/pages/submissions-page.mjs +62 -0
  44. package/dist/client/components/shared/default-error.cjs +17 -0
  45. package/dist/client/components/shared/default-error.mjs +15 -0
  46. package/dist/client/components/shared/empty-state.cjs +16 -0
  47. package/dist/client/components/shared/empty-state.mjs +14 -0
  48. package/dist/client/components/shared/page-wrapper.cjs +29 -0
  49. package/dist/client/components/shared/page-wrapper.mjs +27 -0
  50. package/dist/client/components/shared/pagination.cjs +49 -0
  51. package/dist/client/components/shared/pagination.mjs +47 -0
  52. package/dist/client/constants.cjs +5 -0
  53. package/dist/client/constants.mjs +3 -0
  54. package/dist/client/hooks/form-builder-hooks.cjs +203 -0
  55. package/dist/client/hooks/form-builder-hooks.mjs +186 -0
  56. package/dist/client/hooks/form-builder-resource.cjs +13 -0
  57. package/dist/client/hooks/form-builder-resource.mjs +11 -0
  58. package/dist/client/hooks/index.cjs +22 -0
  59. package/dist/client/hooks/index.d.cts +378 -0
  60. package/dist/client/hooks/index.d.mts +378 -0
  61. package/dist/client/hooks/index.d.ts +378 -0
  62. package/dist/client/hooks/index.mjs +1 -0
  63. package/dist/client/index.cjs +13 -0
  64. package/dist/client/index.d.cts +410 -0
  65. package/dist/client/index.d.mts +410 -0
  66. package/dist/client/index.d.ts +410 -0
  67. package/dist/client/index.mjs +2 -0
  68. package/dist/client/plugin.cjs +311 -0
  69. package/dist/client/plugin.mjs +309 -0
  70. package/dist/client.css +3 -0
  71. package/dist/db.cjs +99 -0
  72. package/dist/db.mjs +97 -0
  73. package/dist/permissions.cjs +95 -0
  74. package/dist/permissions.d.cts +94 -0
  75. package/dist/permissions.d.mts +94 -0
  76. package/dist/permissions.d.ts +94 -0
  77. package/dist/permissions.mjs +93 -0
  78. package/dist/query-keys.cjs +140 -0
  79. package/dist/query-keys.d.cts +392 -0
  80. package/dist/query-keys.d.mts +392 -0
  81. package/dist/query-keys.d.ts +392 -0
  82. package/dist/query-keys.mjs +137 -0
  83. package/dist/schemas.cjs +91 -0
  84. package/dist/schemas.mjs +82 -0
  85. package/dist/shared/plugin-form-builder.BZYGyFgT.d.mts +351 -0
  86. package/dist/shared/plugin-form-builder.Bbl9NufB.d.cts +408 -0
  87. package/dist/shared/plugin-form-builder.CSP5HR2O.d.ts +408 -0
  88. package/dist/shared/plugin-form-builder.Cmk083dA.d.cts +351 -0
  89. package/dist/shared/plugin-form-builder.D258Qpb8.d.ts +351 -0
  90. package/dist/shared/plugin-form-builder.DWrQ3lRX.d.cts +118 -0
  91. package/dist/shared/plugin-form-builder.DWrQ3lRX.d.mts +118 -0
  92. package/dist/shared/plugin-form-builder.DWrQ3lRX.d.ts +118 -0
  93. package/dist/shared/plugin-form-builder.lp98rFNl.d.mts +408 -0
  94. package/dist/style.css +6 -0
  95. package/dist/types.cjs +2 -0
  96. package/dist/types.d.cts +6 -0
  97. package/dist/types.d.mts +6 -0
  98. package/dist/types.d.ts +6 -0
  99. package/dist/types.mjs +1 -0
  100. package/dist/ui/src/components/accordion.cjs +81 -0
  101. package/dist/ui/src/components/accordion.mjs +62 -0
  102. package/dist/ui/src/components/alert-dialog.cjs +157 -0
  103. package/dist/ui/src/components/alert-dialog.mjs +132 -0
  104. package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
  105. package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
  106. package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
  107. package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
  108. package/dist/ui/src/components/auto-form/config.cjs +40 -0
  109. package/dist/ui/src/components/auto-form/config.mjs +37 -0
  110. package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
  111. package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
  112. package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
  113. package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
  114. package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
  115. package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
  116. package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
  117. package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
  118. package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
  119. package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
  120. package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
  121. package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
  122. package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
  123. package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
  124. package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
  125. package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
  126. package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
  127. package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
  128. package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
  129. package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
  130. package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
  131. package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
  132. package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
  133. package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
  134. package/dist/ui/src/components/auto-form/index.cjs +92 -0
  135. package/dist/ui/src/components/auto-form/index.mjs +86 -0
  136. package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
  137. package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
  138. package/dist/ui/src/components/auto-form/types.cjs +11 -0
  139. package/dist/ui/src/components/auto-form/types.mjs +9 -0
  140. package/dist/ui/src/components/button.cjs +56 -0
  141. package/dist/ui/src/components/button.mjs +53 -0
  142. package/dist/ui/src/components/calendar.cjs +207 -0
  143. package/dist/ui/src/components/calendar.mjs +190 -0
  144. package/dist/ui/src/components/checkbox.cjs +48 -0
  145. package/dist/ui/src/components/checkbox.mjs +32 -0
  146. package/dist/ui/src/components/date-picker.cjs +41 -0
  147. package/dist/ui/src/components/date-picker.mjs +39 -0
  148. package/dist/ui/src/components/dialog.cjs +141 -0
  149. package/dist/ui/src/components/dialog.mjs +118 -0
  150. package/dist/ui/src/components/dropdown-menu.cjs +81 -0
  151. package/dist/ui/src/components/dropdown-menu.mjs +62 -0
  152. package/dist/ui/src/components/form-builder/canvas.cjs +111 -0
  153. package/dist/ui/src/components/form-builder/canvas.mjs +109 -0
  154. package/dist/ui/src/components/form-builder/components/index.cjs +571 -0
  155. package/dist/ui/src/components/form-builder/components/index.mjs +554 -0
  156. package/dist/ui/src/components/form-builder/edit-field-dialog.cjs +131 -0
  157. package/dist/ui/src/components/form-builder/edit-field-dialog.mjs +129 -0
  158. package/dist/ui/src/components/form-builder/form-preview.cjs +73 -0
  159. package/dist/ui/src/components/form-builder/form-preview.mjs +71 -0
  160. package/dist/ui/src/components/form-builder/index.cjs +350 -0
  161. package/dist/ui/src/components/form-builder/index.mjs +344 -0
  162. package/dist/ui/src/components/form-builder/nested-field-editor-dialog.cjs +263 -0
  163. package/dist/ui/src/components/form-builder/nested-field-editor-dialog.mjs +261 -0
  164. package/dist/ui/src/components/form-builder/palette.cjs +52 -0
  165. package/dist/ui/src/components/form-builder/palette.mjs +49 -0
  166. package/dist/ui/src/components/form-builder/schema-utils.cjs +128 -0
  167. package/dist/ui/src/components/form-builder/schema-utils.mjs +122 -0
  168. package/dist/ui/src/components/form-builder/sortable-field.cjs +151 -0
  169. package/dist/ui/src/components/form-builder/sortable-field.mjs +148 -0
  170. package/dist/ui/src/components/form-builder/step-tabs.cjs +180 -0
  171. package/dist/ui/src/components/form-builder/step-tabs.mjs +178 -0
  172. package/dist/ui/src/components/form-builder/types.cjs +7 -0
  173. package/dist/ui/src/components/form-builder/types.mjs +5 -0
  174. package/dist/ui/src/components/form-builder/validation-schemas.cjs +67 -0
  175. package/dist/ui/src/components/form-builder/validation-schemas.mjs +56 -0
  176. package/dist/ui/src/components/form.cjs +120 -0
  177. package/dist/ui/src/components/form.mjs +98 -0
  178. package/dist/ui/src/components/input.cjs +23 -0
  179. package/dist/ui/src/components/input.mjs +21 -0
  180. package/dist/ui/src/components/label.cjs +39 -0
  181. package/dist/ui/src/components/label.mjs +23 -0
  182. package/dist/ui/src/components/page-layout.cjs +25 -0
  183. package/dist/ui/src/components/page-layout.mjs +23 -0
  184. package/dist/ui/src/components/page-wrapper.cjs +20 -0
  185. package/dist/ui/src/components/page-wrapper.mjs +18 -0
  186. package/dist/ui/src/components/popover.cjs +60 -0
  187. package/dist/ui/src/components/popover.mjs +42 -0
  188. package/dist/ui/src/components/radio-group.cjs +62 -0
  189. package/dist/ui/src/components/radio-group.mjs +45 -0
  190. package/dist/ui/src/components/select.cjs +161 -0
  191. package/dist/ui/src/components/select.mjs +139 -0
  192. package/dist/ui/src/components/separator.cjs +43 -0
  193. package/dist/ui/src/components/separator.mjs +27 -0
  194. package/dist/ui/src/components/skeleton.cjs +17 -0
  195. package/dist/ui/src/components/skeleton.mjs +15 -0
  196. package/dist/ui/src/components/stack-attribution.cjs +24 -0
  197. package/dist/ui/src/components/stack-attribution.mjs +22 -0
  198. package/dist/ui/src/components/switch.cjs +48 -0
  199. package/dist/ui/src/components/switch.mjs +32 -0
  200. package/dist/ui/src/components/table.cjs +89 -0
  201. package/dist/ui/src/components/table.mjs +82 -0
  202. package/dist/ui/src/components/tabs.cjs +84 -0
  203. package/dist/ui/src/components/tabs.mjs +65 -0
  204. package/dist/ui/src/components/textarea.cjs +20 -0
  205. package/dist/ui/src/components/textarea.mjs +18 -0
  206. package/dist/ui/src/lib/schema-converter.cjs +133 -0
  207. package/dist/ui/src/lib/schema-converter.mjs +127 -0
  208. package/dist/ui/src/lib/utils.cjs +10 -0
  209. package/dist/ui/src/lib/utils.mjs +8 -0
  210. package/dist/utils.cjs +41 -0
  211. package/dist/utils.mjs +32 -0
  212. package/package.json +175 -3
  213. package/README.md +0 -3
@@ -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,84 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const TabsPrimitive = require('@radix-ui/react-tabs');
6
+ const utils = require('../lib/utils.cjs');
7
+
8
+ function _interopNamespaceCompat(e) {
9
+ if (e && typeof e === 'object' && 'default' in e) return e;
10
+ const n = Object.create(null);
11
+ if (e) {
12
+ for (const k in e) {
13
+ n[k] = e[k];
14
+ }
15
+ }
16
+ n.default = e;
17
+ return n;
18
+ }
19
+
20
+ const TabsPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(TabsPrimitive);
21
+
22
+ function Tabs({
23
+ className,
24
+ ...props
25
+ }) {
26
+ return /* @__PURE__ */ jsxRuntime.jsx(
27
+ TabsPrimitive__namespace.Root,
28
+ {
29
+ "data-slot": "tabs",
30
+ className: utils.cn("flex flex-col gap-2", className),
31
+ ...props
32
+ }
33
+ );
34
+ }
35
+ function TabsList({
36
+ className,
37
+ ...props
38
+ }) {
39
+ return /* @__PURE__ */ jsxRuntime.jsx(
40
+ TabsPrimitive__namespace.List,
41
+ {
42
+ "data-slot": "tabs-list",
43
+ className: utils.cn(
44
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
45
+ className
46
+ ),
47
+ ...props
48
+ }
49
+ );
50
+ }
51
+ function TabsTrigger({
52
+ className,
53
+ ...props
54
+ }) {
55
+ return /* @__PURE__ */ jsxRuntime.jsx(
56
+ TabsPrimitive__namespace.Trigger,
57
+ {
58
+ "data-slot": "tabs-trigger",
59
+ className: utils.cn(
60
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
61
+ className
62
+ ),
63
+ ...props
64
+ }
65
+ );
66
+ }
67
+ function TabsContent({
68
+ className,
69
+ ...props
70
+ }) {
71
+ return /* @__PURE__ */ jsxRuntime.jsx(
72
+ TabsPrimitive__namespace.Content,
73
+ {
74
+ "data-slot": "tabs-content",
75
+ className: utils.cn("flex-1 outline-none", className),
76
+ ...props
77
+ }
78
+ );
79
+ }
80
+
81
+ exports.Tabs = Tabs;
82
+ exports.TabsContent = TabsContent;
83
+ exports.TabsList = TabsList;
84
+ exports.TabsTrigger = TabsTrigger;
@@ -0,0 +1,65 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
4
+ import { cn } from '../lib/utils.mjs';
5
+
6
+ function Tabs({
7
+ className,
8
+ ...props
9
+ }) {
10
+ return /* @__PURE__ */ jsx(
11
+ TabsPrimitive.Root,
12
+ {
13
+ "data-slot": "tabs",
14
+ className: cn("flex flex-col gap-2", className),
15
+ ...props
16
+ }
17
+ );
18
+ }
19
+ function TabsList({
20
+ className,
21
+ ...props
22
+ }) {
23
+ return /* @__PURE__ */ jsx(
24
+ TabsPrimitive.List,
25
+ {
26
+ "data-slot": "tabs-list",
27
+ className: cn(
28
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
29
+ className
30
+ ),
31
+ ...props
32
+ }
33
+ );
34
+ }
35
+ function TabsTrigger({
36
+ className,
37
+ ...props
38
+ }) {
39
+ return /* @__PURE__ */ jsx(
40
+ TabsPrimitive.Trigger,
41
+ {
42
+ "data-slot": "tabs-trigger",
43
+ className: cn(
44
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
45
+ className
46
+ ),
47
+ ...props
48
+ }
49
+ );
50
+ }
51
+ function TabsContent({
52
+ className,
53
+ ...props
54
+ }) {
55
+ return /* @__PURE__ */ jsx(
56
+ TabsPrimitive.Content,
57
+ {
58
+ "data-slot": "tabs-content",
59
+ className: cn("flex-1 outline-none", className),
60
+ ...props
61
+ }
62
+ );
63
+ }
64
+
65
+ export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -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,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 };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const clsx = require('clsx');
4
+ const tailwindMerge = require('tailwind-merge');
5
+
6
+ function cn(...inputs) {
7
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
8
+ }
9
+
10
+ exports.cn = cn;
@@ -0,0 +1,8 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ export { cn };
package/dist/utils.cjs ADDED
@@ -0,0 +1,41 @@
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
+ function extractIpAddress(headers) {
18
+ if (!headers) return void 0;
19
+ const forwardedFor = headers.get("x-forwarded-for");
20
+ if (forwardedFor) {
21
+ return forwardedFor.split(",")[0]?.trim();
22
+ }
23
+ const realIp = headers.get("x-real-ip");
24
+ if (realIp) {
25
+ return realIp.trim();
26
+ }
27
+ const cfConnectingIp = headers.get("cf-connecting-ip");
28
+ if (cfConnectingIp) {
29
+ return cfConnectingIp.trim();
30
+ }
31
+ return void 0;
32
+ }
33
+ function extractUserAgent(headers) {
34
+ if (!headers) return void 0;
35
+ return headers.get("user-agent") || void 0;
36
+ }
37
+
38
+ exports.cn = cn;
39
+ exports.extractIpAddress = extractIpAddress;
40
+ exports.extractUserAgent = extractUserAgent;
41
+ exports.slugify = slugify;