@btst/components 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 (161) hide show
  1. package/LICENSE.md +17 -0
  2. package/dist/_private/ui/styles/markdown-editor.css +31 -0
  3. package/dist/auto-form/index.cjs +8 -0
  4. package/dist/auto-form/index.d.cts +26 -0
  5. package/dist/auto-form/index.d.mts +26 -0
  6. package/dist/auto-form/index.d.ts +26 -0
  7. package/dist/auto-form/index.mjs +1 -0
  8. package/dist/empty/index.cjs +12 -0
  9. package/dist/empty/index.d.cts +15 -0
  10. package/dist/empty/index.d.mts +15 -0
  11. package/dist/empty/index.d.ts +15 -0
  12. package/dist/empty/index.mjs +1 -0
  13. package/dist/form-builder/index.cjs +16 -0
  14. package/dist/form-builder/index.d.cts +395 -0
  15. package/dist/form-builder/index.d.mts +395 -0
  16. package/dist/form-builder/index.d.ts +395 -0
  17. package/dist/form-builder/index.mjs +4 -0
  18. package/dist/markdown/index.cjs +9 -0
  19. package/dist/markdown/index.d.cts +46 -0
  20. package/dist/markdown/index.d.mts +46 -0
  21. package/dist/markdown/index.d.ts +46 -0
  22. package/dist/markdown/index.mjs +2 -0
  23. package/dist/multi-select/index.cjs +7 -0
  24. package/dist/multi-select/index.d.cts +78 -0
  25. package/dist/multi-select/index.d.mts +78 -0
  26. package/dist/multi-select/index.d.ts +78 -0
  27. package/dist/multi-select/index.mjs +1 -0
  28. package/dist/search-select/index.cjs +7 -0
  29. package/dist/search-select/index.d.cts +16 -0
  30. package/dist/search-select/index.d.mts +16 -0
  31. package/dist/search-select/index.d.ts +16 -0
  32. package/dist/search-select/index.mjs +1 -0
  33. package/dist/shared/components.BdvBiegH.d.cts +291 -0
  34. package/dist/shared/components.BdvBiegH.d.mts +291 -0
  35. package/dist/shared/components.BdvBiegH.d.ts +291 -0
  36. package/dist/shared/components.CZMWR72v.d.cts +10 -0
  37. package/dist/shared/components.CZMWR72v.d.mts +10 -0
  38. package/dist/shared/components.CZMWR72v.d.ts +10 -0
  39. package/dist/stepped-auto-form/index.cjs +7 -0
  40. package/dist/stepped-auto-form/index.d.cts +37 -0
  41. package/dist/stepped-auto-form/index.d.mts +37 -0
  42. package/dist/stepped-auto-form/index.d.ts +37 -0
  43. package/dist/stepped-auto-form/index.mjs +1 -0
  44. package/dist/style.css +440 -0
  45. package/dist/ui/src/components/accordion.cjs +81 -0
  46. package/dist/ui/src/components/accordion.mjs +62 -0
  47. package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
  48. package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
  49. package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
  50. package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
  51. package/dist/ui/src/components/auto-form/config.cjs +40 -0
  52. package/dist/ui/src/components/auto-form/config.mjs +37 -0
  53. package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
  54. package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
  55. package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
  56. package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
  57. package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
  58. package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
  59. package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
  60. package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
  61. package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
  62. package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
  63. package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
  64. package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
  65. package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
  66. package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
  67. package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
  68. package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
  69. package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
  70. package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
  71. package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
  72. package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
  73. package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
  74. package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
  75. package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
  76. package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
  77. package/dist/ui/src/components/auto-form/index.cjs +102 -0
  78. package/dist/ui/src/components/auto-form/index.mjs +93 -0
  79. package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
  80. package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
  81. package/dist/ui/src/components/auto-form/types.cjs +11 -0
  82. package/dist/ui/src/components/auto-form/types.mjs +9 -0
  83. package/dist/ui/src/components/badge.cjs +42 -0
  84. package/dist/ui/src/components/badge.mjs +39 -0
  85. package/dist/ui/src/components/button.cjs +56 -0
  86. package/dist/ui/src/components/button.mjs +53 -0
  87. package/dist/ui/src/components/calendar.cjs +207 -0
  88. package/dist/ui/src/components/calendar.mjs +190 -0
  89. package/dist/ui/src/components/checkbox.cjs +48 -0
  90. package/dist/ui/src/components/checkbox.mjs +32 -0
  91. package/dist/ui/src/components/command.cjs +118 -0
  92. package/dist/ui/src/components/command.mjs +111 -0
  93. package/dist/ui/src/components/date-picker.cjs +41 -0
  94. package/dist/ui/src/components/date-picker.mjs +39 -0
  95. package/dist/ui/src/components/dialog.cjs +141 -0
  96. package/dist/ui/src/components/dialog.mjs +118 -0
  97. package/dist/ui/src/components/empty.cjs +104 -0
  98. package/dist/ui/src/components/empty.mjs +97 -0
  99. package/dist/ui/src/components/form-builder/canvas.cjs +111 -0
  100. package/dist/ui/src/components/form-builder/canvas.mjs +109 -0
  101. package/dist/ui/src/components/form-builder/components/index.cjs +571 -0
  102. package/dist/ui/src/components/form-builder/components/index.mjs +554 -0
  103. package/dist/ui/src/components/form-builder/edit-field-dialog.cjs +131 -0
  104. package/dist/ui/src/components/form-builder/edit-field-dialog.mjs +129 -0
  105. package/dist/ui/src/components/form-builder/form-preview.cjs +73 -0
  106. package/dist/ui/src/components/form-builder/form-preview.mjs +71 -0
  107. package/dist/ui/src/components/form-builder/index.cjs +350 -0
  108. package/dist/ui/src/components/form-builder/index.mjs +344 -0
  109. package/dist/ui/src/components/form-builder/nested-field-editor-dialog.cjs +263 -0
  110. package/dist/ui/src/components/form-builder/nested-field-editor-dialog.mjs +261 -0
  111. package/dist/ui/src/components/form-builder/palette.cjs +52 -0
  112. package/dist/ui/src/components/form-builder/palette.mjs +49 -0
  113. package/dist/ui/src/components/form-builder/schema-utils.cjs +128 -0
  114. package/dist/ui/src/components/form-builder/schema-utils.mjs +122 -0
  115. package/dist/ui/src/components/form-builder/sortable-field.cjs +151 -0
  116. package/dist/ui/src/components/form-builder/sortable-field.mjs +148 -0
  117. package/dist/ui/src/components/form-builder/step-tabs.cjs +180 -0
  118. package/dist/ui/src/components/form-builder/step-tabs.mjs +178 -0
  119. package/dist/ui/src/components/form-builder/types.cjs +7 -0
  120. package/dist/ui/src/components/form-builder/types.mjs +5 -0
  121. package/dist/ui/src/components/form-builder/validation-schemas.cjs +67 -0
  122. package/dist/ui/src/components/form-builder/validation-schemas.mjs +56 -0
  123. package/dist/ui/src/components/form.cjs +120 -0
  124. package/dist/ui/src/components/form.mjs +98 -0
  125. package/dist/ui/src/components/input.cjs +23 -0
  126. package/dist/ui/src/components/input.mjs +21 -0
  127. package/dist/ui/src/components/label.cjs +39 -0
  128. package/dist/ui/src/components/label.mjs +23 -0
  129. package/dist/ui/src/components/markdown-content.cjs +334 -0
  130. package/dist/ui/src/components/markdown-content.mjs +325 -0
  131. package/dist/ui/src/components/markdown-editor.cjs +180 -0
  132. package/dist/ui/src/components/markdown-editor.mjs +178 -0
  133. package/dist/ui/src/components/multi-select.cjs +555 -0
  134. package/dist/ui/src/components/multi-select.mjs +540 -0
  135. package/dist/ui/src/components/popover.cjs +60 -0
  136. package/dist/ui/src/components/popover.mjs +42 -0
  137. package/dist/ui/src/components/radio-group.cjs +62 -0
  138. package/dist/ui/src/components/radio-group.mjs +45 -0
  139. package/dist/ui/src/components/search-select.cjs +99 -0
  140. package/dist/ui/src/components/search-select.mjs +83 -0
  141. package/dist/ui/src/components/select.cjs +161 -0
  142. package/dist/ui/src/components/select.mjs +139 -0
  143. package/dist/ui/src/components/separator.cjs +43 -0
  144. package/dist/ui/src/components/separator.mjs +27 -0
  145. package/dist/ui/src/components/switch.cjs +48 -0
  146. package/dist/ui/src/components/switch.mjs +32 -0
  147. package/dist/ui/src/components/tabs.cjs +84 -0
  148. package/dist/ui/src/components/tabs.mjs +65 -0
  149. package/dist/ui/src/components/textarea.cjs +20 -0
  150. package/dist/ui/src/components/textarea.mjs +18 -0
  151. package/dist/ui/src/hooks/use-debounce.cjs +16 -0
  152. package/dist/ui/src/hooks/use-debounce.mjs +14 -0
  153. package/dist/ui/src/lib/schema-converter.cjs +94 -0
  154. package/dist/ui/src/lib/schema-converter.mjs +92 -0
  155. package/dist/ui/src/lib/throttle.cjs +56 -0
  156. package/dist/ui/src/lib/throttle.mjs +54 -0
  157. package/dist/ui/src/lib/utils.cjs +10 -0
  158. package/dist/ui/src/lib/utils.mjs +8 -0
  159. package/dist/ui.css +131 -0
  160. package/package.json +176 -3
  161. 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 };