@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,67 @@
1
+ 'use strict';
2
+
3
+ const z = require('zod');
4
+
5
+ const baseMetaSchema = z.z.object({
6
+ label: z.z.string().min(1).meta({ label: "Label" }),
7
+ description: z.z.string().optional().meta({ label: "Description" }),
8
+ required: z.z.boolean().default(false).meta({ label: "Required", fieldType: "switch" })
9
+ });
10
+ const baseMetaSchemaWithPlaceholder = baseMetaSchema.merge(
11
+ z.z.object({
12
+ placeholder: z.z.string().optional().meta({ label: "Placeholder" })
13
+ })
14
+ );
15
+ const DEFAULT_VALUE_SCHEMAS = {
16
+ string: z.z.string().optional().meta({ label: "Default Value" }),
17
+ number: z.z.number().optional().meta({ label: "Default Value" }),
18
+ boolean: z.z.boolean().default(false).meta({ label: "Default Value", fieldType: "switch" }),
19
+ date: z.z.date().optional().meta({ label: "Default Date", fieldType: "date" }),
20
+ enum: z.z.string().optional().meta({
21
+ label: "Default Value",
22
+ description: "Must match one of the options"
23
+ })
24
+ };
25
+ const stringValidationSchema = z.z.object({
26
+ minLength: z.z.number().int().min(0).optional().meta({ label: "Min Length" }),
27
+ maxLength: z.z.number().int().min(1).optional().meta({ label: "Max Length" })
28
+ // Note: pattern/regex is serializable but requires careful UX for input
29
+ // Uncomment to enable:
30
+ // pattern: z.string().optional().meta({ label: "Pattern (Regex)" }),
31
+ });
32
+ const numberValidationSchema = z.z.object({
33
+ min: z.z.number().optional().meta({ label: "Minimum" }),
34
+ max: z.z.number().optional().meta({ label: "Maximum" })
35
+ // Note: multipleOf is serializable but less commonly used
36
+ // Uncomment to enable:
37
+ // multipleOf: z.number().optional().meta({ label: "Multiple Of" }),
38
+ });
39
+ const booleanValidationSchema = z.z.object({});
40
+ const dateValidationSchema = z.z.object({
41
+ // Date min/max can be added when the date serialization is refined
42
+ // minDate: z.date().optional().meta({ label: "Minimum Date", fieldType: "date" }),
43
+ // maxDate: z.date().optional().meta({ label: "Maximum Date", fieldType: "date" }),
44
+ });
45
+ const enumOptionsSchema = z.z.object({
46
+ options: z.z.string().meta({
47
+ label: "Options (one per line)",
48
+ fieldType: "textarea",
49
+ description: "Enter each option on a new line"
50
+ })
51
+ });
52
+ const objectValidationSchema = z.z.object({});
53
+ const arrayValidationSchema = z.z.object({
54
+ minItems: z.z.number().int().min(0).optional().meta({ label: "Min Items" }),
55
+ maxItems: z.z.number().int().min(1).optional().meta({ label: "Max Items" })
56
+ });
57
+
58
+ exports.DEFAULT_VALUE_SCHEMAS = DEFAULT_VALUE_SCHEMAS;
59
+ exports.arrayValidationSchema = arrayValidationSchema;
60
+ exports.baseMetaSchema = baseMetaSchema;
61
+ exports.baseMetaSchemaWithPlaceholder = baseMetaSchemaWithPlaceholder;
62
+ exports.booleanValidationSchema = booleanValidationSchema;
63
+ exports.dateValidationSchema = dateValidationSchema;
64
+ exports.enumOptionsSchema = enumOptionsSchema;
65
+ exports.numberValidationSchema = numberValidationSchema;
66
+ exports.objectValidationSchema = objectValidationSchema;
67
+ exports.stringValidationSchema = stringValidationSchema;
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+
3
+ const baseMetaSchema = z.object({
4
+ label: z.string().min(1).meta({ label: "Label" }),
5
+ description: z.string().optional().meta({ label: "Description" }),
6
+ required: z.boolean().default(false).meta({ label: "Required", fieldType: "switch" })
7
+ });
8
+ const baseMetaSchemaWithPlaceholder = baseMetaSchema.merge(
9
+ z.object({
10
+ placeholder: z.string().optional().meta({ label: "Placeholder" })
11
+ })
12
+ );
13
+ const DEFAULT_VALUE_SCHEMAS = {
14
+ string: z.string().optional().meta({ label: "Default Value" }),
15
+ number: z.number().optional().meta({ label: "Default Value" }),
16
+ boolean: z.boolean().default(false).meta({ label: "Default Value", fieldType: "switch" }),
17
+ date: z.date().optional().meta({ label: "Default Date", fieldType: "date" }),
18
+ enum: z.string().optional().meta({
19
+ label: "Default Value",
20
+ description: "Must match one of the options"
21
+ })
22
+ };
23
+ const stringValidationSchema = z.object({
24
+ minLength: z.number().int().min(0).optional().meta({ label: "Min Length" }),
25
+ maxLength: z.number().int().min(1).optional().meta({ label: "Max Length" })
26
+ // Note: pattern/regex is serializable but requires careful UX for input
27
+ // Uncomment to enable:
28
+ // pattern: z.string().optional().meta({ label: "Pattern (Regex)" }),
29
+ });
30
+ const numberValidationSchema = z.object({
31
+ min: z.number().optional().meta({ label: "Minimum" }),
32
+ max: z.number().optional().meta({ label: "Maximum" })
33
+ // Note: multipleOf is serializable but less commonly used
34
+ // Uncomment to enable:
35
+ // multipleOf: z.number().optional().meta({ label: "Multiple Of" }),
36
+ });
37
+ const booleanValidationSchema = z.object({});
38
+ const dateValidationSchema = z.object({
39
+ // Date min/max can be added when the date serialization is refined
40
+ // minDate: z.date().optional().meta({ label: "Minimum Date", fieldType: "date" }),
41
+ // maxDate: z.date().optional().meta({ label: "Maximum Date", fieldType: "date" }),
42
+ });
43
+ const enumOptionsSchema = z.object({
44
+ options: z.string().meta({
45
+ label: "Options (one per line)",
46
+ fieldType: "textarea",
47
+ description: "Enter each option on a new line"
48
+ })
49
+ });
50
+ const objectValidationSchema = z.object({});
51
+ const arrayValidationSchema = z.object({
52
+ minItems: z.number().int().min(0).optional().meta({ label: "Min Items" }),
53
+ maxItems: z.number().int().min(1).optional().meta({ label: "Max Items" })
54
+ });
55
+
56
+ export { DEFAULT_VALUE_SCHEMAS, arrayValidationSchema, baseMetaSchema, baseMetaSchemaWithPlaceholder, booleanValidationSchema, dateValidationSchema, enumOptionsSchema, numberValidationSchema, objectValidationSchema, stringValidationSchema };
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const React = require('react');
6
+ const reactSlot = require('@radix-ui/react-slot');
7
+ const reactHookForm = require('react-hook-form');
8
+ const utils = require('../lib/utils.cjs');
9
+ const label = require('./label.cjs');
10
+
11
+ function _interopNamespaceCompat(e) {
12
+ if (e && typeof e === 'object' && 'default' in e) return e;
13
+ const n = Object.create(null);
14
+ if (e) {
15
+ for (const k in e) {
16
+ n[k] = e[k];
17
+ }
18
+ }
19
+ n.default = e;
20
+ return n;
21
+ }
22
+
23
+ const React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
24
+
25
+ const Form = reactHookForm.FormProvider;
26
+ const FormFieldContext = React__namespace.createContext(
27
+ {}
28
+ );
29
+ const FormField = ({
30
+ ...props
31
+ }) => {
32
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
33
+ };
34
+ const useFormField = () => {
35
+ const fieldContext = React__namespace.useContext(FormFieldContext);
36
+ const itemContext = React__namespace.useContext(FormItemContext);
37
+ const { getFieldState } = reactHookForm.useFormContext();
38
+ const formState = reactHookForm.useFormState({ name: fieldContext.name });
39
+ const fieldState = getFieldState(fieldContext.name, formState);
40
+ if (!fieldContext) {
41
+ throw new Error("useFormField should be used within <FormField>");
42
+ }
43
+ const { id } = itemContext;
44
+ return {
45
+ id,
46
+ name: fieldContext.name,
47
+ formItemId: `${id}-form-item`,
48
+ formDescriptionId: `${id}-form-item-description`,
49
+ formMessageId: `${id}-form-item-message`,
50
+ ...fieldState
51
+ };
52
+ };
53
+ const FormItemContext = React__namespace.createContext(
54
+ {}
55
+ );
56
+ function FormItem({ className, ...props }) {
57
+ const id = React__namespace.useId();
58
+ return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
59
+ "div",
60
+ {
61
+ "data-slot": "form-item",
62
+ className: utils.cn("grid gap-2", className),
63
+ ...props
64
+ }
65
+ ) });
66
+ }
67
+ function FormLabel({
68
+ className,
69
+ ...props
70
+ }) {
71
+ const { error, formItemId } = useFormField();
72
+ return /* @__PURE__ */ jsxRuntime.jsx(
73
+ label.Label,
74
+ {
75
+ "data-slot": "form-label",
76
+ "data-error": !!error,
77
+ className: utils.cn("data-[error=true]:text-destructive", className),
78
+ htmlFor: formItemId,
79
+ ...props
80
+ }
81
+ );
82
+ }
83
+ function FormControl({ ...props }) {
84
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
85
+ return /* @__PURE__ */ jsxRuntime.jsx(
86
+ reactSlot.Slot,
87
+ {
88
+ "data-slot": "form-control",
89
+ id: formItemId,
90
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
91
+ "aria-invalid": !!error,
92
+ ...props
93
+ }
94
+ );
95
+ }
96
+ function FormMessage({ className, ...props }) {
97
+ const { error, formMessageId } = useFormField();
98
+ const body = error ? String(error?.message ?? "") : props.children;
99
+ if (!body) {
100
+ return null;
101
+ }
102
+ return /* @__PURE__ */ jsxRuntime.jsx(
103
+ "p",
104
+ {
105
+ "data-slot": "form-message",
106
+ id: formMessageId,
107
+ className: utils.cn("text-destructive text-sm", className),
108
+ ...props,
109
+ children: body
110
+ }
111
+ );
112
+ }
113
+
114
+ exports.Form = Form;
115
+ exports.FormControl = FormControl;
116
+ exports.FormField = FormField;
117
+ exports.FormItem = FormItem;
118
+ exports.FormLabel = FormLabel;
119
+ exports.FormMessage = FormMessage;
120
+ exports.useFormField = useFormField;
@@ -0,0 +1,98 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
6
+ import { cn } from '../lib/utils.mjs';
7
+ import { Label } from './label.mjs';
8
+
9
+ const Form = FormProvider;
10
+ const FormFieldContext = React.createContext(
11
+ {}
12
+ );
13
+ const FormField = ({
14
+ ...props
15
+ }) => {
16
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
17
+ };
18
+ const useFormField = () => {
19
+ const fieldContext = React.useContext(FormFieldContext);
20
+ const itemContext = React.useContext(FormItemContext);
21
+ const { getFieldState } = useFormContext();
22
+ const formState = useFormState({ name: fieldContext.name });
23
+ const fieldState = getFieldState(fieldContext.name, formState);
24
+ if (!fieldContext) {
25
+ throw new Error("useFormField should be used within <FormField>");
26
+ }
27
+ const { id } = itemContext;
28
+ return {
29
+ id,
30
+ name: fieldContext.name,
31
+ formItemId: `${id}-form-item`,
32
+ formDescriptionId: `${id}-form-item-description`,
33
+ formMessageId: `${id}-form-item-message`,
34
+ ...fieldState
35
+ };
36
+ };
37
+ const FormItemContext = React.createContext(
38
+ {}
39
+ );
40
+ function FormItem({ className, ...props }) {
41
+ const id = React.useId();
42
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
43
+ "div",
44
+ {
45
+ "data-slot": "form-item",
46
+ className: cn("grid gap-2", className),
47
+ ...props
48
+ }
49
+ ) });
50
+ }
51
+ function FormLabel({
52
+ className,
53
+ ...props
54
+ }) {
55
+ const { error, formItemId } = useFormField();
56
+ return /* @__PURE__ */ jsx(
57
+ Label,
58
+ {
59
+ "data-slot": "form-label",
60
+ "data-error": !!error,
61
+ className: cn("data-[error=true]:text-destructive", className),
62
+ htmlFor: formItemId,
63
+ ...props
64
+ }
65
+ );
66
+ }
67
+ function FormControl({ ...props }) {
68
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
69
+ return /* @__PURE__ */ jsx(
70
+ Slot,
71
+ {
72
+ "data-slot": "form-control",
73
+ id: formItemId,
74
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
75
+ "aria-invalid": !!error,
76
+ ...props
77
+ }
78
+ );
79
+ }
80
+ function FormMessage({ className, ...props }) {
81
+ const { error, formMessageId } = useFormField();
82
+ const body = error ? String(error?.message ?? "") : props.children;
83
+ if (!body) {
84
+ return null;
85
+ }
86
+ return /* @__PURE__ */ jsx(
87
+ "p",
88
+ {
89
+ "data-slot": "form-message",
90
+ id: formMessageId,
91
+ className: cn("text-destructive text-sm", className),
92
+ ...props,
93
+ children: body
94
+ }
95
+ );
96
+ }
97
+
98
+ export { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const utils = require('../lib/utils.cjs');
5
+
6
+ function Input({ className, type, ...props }) {
7
+ return /* @__PURE__ */ jsxRuntime.jsx(
8
+ "input",
9
+ {
10
+ type,
11
+ "data-slot": "input",
12
+ className: utils.cn(
13
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
14
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
15
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
16
+ className
17
+ ),
18
+ ...props
19
+ }
20
+ );
21
+ }
22
+
23
+ exports.Input = Input;
@@ -0,0 +1,21 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../lib/utils.mjs';
3
+
4
+ function Input({ className, type, ...props }) {
5
+ return /* @__PURE__ */ jsx(
6
+ "input",
7
+ {
8
+ type,
9
+ "data-slot": "input",
10
+ className: cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ ),
16
+ ...props
17
+ }
18
+ );
19
+ }
20
+
21
+ export { Input };
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const LabelPrimitive = require('@radix-ui/react-label');
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 LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(LabelPrimitive);
21
+
22
+ function Label({
23
+ className,
24
+ ...props
25
+ }) {
26
+ return /* @__PURE__ */ jsxRuntime.jsx(
27
+ LabelPrimitive__namespace.Root,
28
+ {
29
+ "data-slot": "label",
30
+ className: utils.cn(
31
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
32
+ className
33
+ ),
34
+ ...props
35
+ }
36
+ );
37
+ }
38
+
39
+ exports.Label = Label;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as LabelPrimitive from '@radix-ui/react-label';
4
+ import { cn } from '../lib/utils.mjs';
5
+
6
+ function Label({
7
+ className,
8
+ ...props
9
+ }) {
10
+ return /* @__PURE__ */ jsx(
11
+ LabelPrimitive.Root,
12
+ {
13
+ "data-slot": "label",
14
+ className: cn(
15
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
16
+ className
17
+ ),
18
+ ...props
19
+ }
20
+ );
21
+ }
22
+
23
+ export { Label };
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const utils = require('../lib/utils.cjs');
6
+
7
+ function PageLayout({
8
+ children,
9
+ className,
10
+ "data-testid": dataTestId
11
+ }) {
12
+ return /* @__PURE__ */ jsxRuntime.jsx(
13
+ "div",
14
+ {
15
+ className: utils.cn(
16
+ "container mx-auto flex min-h-dvh flex-col items-center gap-12 px-4 py-18 lg:px-16",
17
+ className
18
+ ),
19
+ "data-testid": dataTestId,
20
+ children
21
+ }
22
+ );
23
+ }
24
+
25
+ exports.PageLayout = PageLayout;
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { cn } from '../lib/utils.mjs';
4
+
5
+ function PageLayout({
6
+ children,
7
+ className,
8
+ "data-testid": dataTestId
9
+ }) {
10
+ return /* @__PURE__ */ jsx(
11
+ "div",
12
+ {
13
+ className: cn(
14
+ "container mx-auto flex min-h-dvh flex-col items-center gap-12 px-4 py-18 lg:px-16",
15
+ className
16
+ ),
17
+ "data-testid": dataTestId,
18
+ children
19
+ }
20
+ );
21
+ }
22
+
23
+ export { PageLayout };
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const pageLayout = require('./page-layout.cjs');
6
+ const stackAttribution = require('./stack-attribution.cjs');
7
+
8
+ function PageWrapper({
9
+ children,
10
+ className,
11
+ testId,
12
+ showAttribution = true
13
+ }) {
14
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15
+ /* @__PURE__ */ jsxRuntime.jsx(pageLayout.PageLayout, { className, "data-testid": testId, children }),
16
+ showAttribution && /* @__PURE__ */ jsxRuntime.jsx(stackAttribution.StackAttribution, {})
17
+ ] });
18
+ }
19
+
20
+ exports.PageWrapper = PageWrapper;
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { PageLayout } from './page-layout.mjs';
4
+ import { StackAttribution } from './stack-attribution.mjs';
5
+
6
+ function PageWrapper({
7
+ children,
8
+ className,
9
+ testId,
10
+ showAttribution = true
11
+ }) {
12
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13
+ /* @__PURE__ */ jsx(PageLayout, { className, "data-testid": testId, children }),
14
+ showAttribution && /* @__PURE__ */ jsx(StackAttribution, {})
15
+ ] });
16
+ }
17
+
18
+ export { PageWrapper };
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const PopoverPrimitive = require('@radix-ui/react-popover');
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 PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespaceCompat(PopoverPrimitive);
21
+
22
+ function Popover({
23
+ ...props
24
+ }) {
25
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
26
+ }
27
+ function PopoverTrigger({
28
+ ...props
29
+ }) {
30
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
31
+ }
32
+ function PopoverContent({
33
+ className,
34
+ align = "center",
35
+ sideOffset = 4,
36
+ usePortal = true,
37
+ ...props
38
+ }) {
39
+ const content = /* @__PURE__ */ jsxRuntime.jsx(
40
+ PopoverPrimitive__namespace.Content,
41
+ {
42
+ "data-slot": "popover-content",
43
+ align,
44
+ sideOffset,
45
+ className: utils.cn(
46
+ "bg-popover text-popover-foreground pointer-events-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
47
+ className
48
+ ),
49
+ ...props
50
+ }
51
+ );
52
+ if (!usePortal) {
53
+ return content;
54
+ }
55
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: content });
56
+ }
57
+
58
+ exports.Popover = Popover;
59
+ exports.PopoverContent = PopoverContent;
60
+ exports.PopoverTrigger = PopoverTrigger;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
4
+ import { cn } from '../lib/utils.mjs';
5
+
6
+ function Popover({
7
+ ...props
8
+ }) {
9
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
10
+ }
11
+ function PopoverTrigger({
12
+ ...props
13
+ }) {
14
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
15
+ }
16
+ function PopoverContent({
17
+ className,
18
+ align = "center",
19
+ sideOffset = 4,
20
+ usePortal = true,
21
+ ...props
22
+ }) {
23
+ const content = /* @__PURE__ */ jsx(
24
+ PopoverPrimitive.Content,
25
+ {
26
+ "data-slot": "popover-content",
27
+ align,
28
+ sideOffset,
29
+ className: cn(
30
+ "bg-popover text-popover-foreground pointer-events-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
31
+ className
32
+ ),
33
+ ...props
34
+ }
35
+ );
36
+ if (!usePortal) {
37
+ return content;
38
+ }
39
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: content });
40
+ }
41
+
42
+ export { Popover, PopoverContent, PopoverTrigger };