@mcp-b/react-components 0.1.1 → 0.1.3

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 (203) hide show
  1. package/dist/Button-QCM8ZKgR.d.ts +98 -0
  2. package/dist/CodeBlock-CttHhWcb.js +356 -0
  3. package/dist/CodeBlock-V6pgafSS.d.ts +174 -0
  4. package/dist/Select-CRsKCJ9x.d.ts +200 -0
  5. package/dist/class-names-9UtZwb0J.js +12 -0
  6. package/dist/components/Accordion.d.ts +81 -0
  7. package/dist/components/Accordion.js +97 -0
  8. package/dist/components/AgentConnection.d.ts +69 -0
  9. package/dist/components/AgentConnection.js +176 -0
  10. package/dist/components/AlertDialog.d.ts +148 -0
  11. package/dist/components/AlertDialog.js +141 -0
  12. package/dist/components/Artifact.d.ts +128 -0
  13. package/dist/components/Artifact.js +115 -0
  14. package/dist/components/Autocomplete.d.ts +186 -0
  15. package/dist/components/Autocomplete.js +186 -0
  16. package/dist/components/Avatar.d.ts +134 -0
  17. package/dist/components/Avatar.js +118 -0
  18. package/dist/components/Badge.d.ts +68 -0
  19. package/dist/components/Badge.js +108 -0
  20. package/dist/components/Button.d.ts +2 -0
  21. package/dist/components/Button.js +73 -0
  22. package/dist/components/Card.d.ts +87 -0
  23. package/dist/components/Card.js +81 -0
  24. package/dist/components/ChainOfThought.d.ts +153 -0
  25. package/dist/components/ChainOfThought.js +157 -0
  26. package/dist/components/Checkbox.d.ts +35 -0
  27. package/dist/components/Checkbox.js +47 -0
  28. package/dist/components/CheckboxGroup.d.ts +76 -0
  29. package/dist/components/CheckboxGroup.js +69 -0
  30. package/dist/components/CodeBlock.d.ts +2 -0
  31. package/dist/components/CodeBlock.js +2 -0
  32. package/dist/components/Collapsible.d.ts +127 -0
  33. package/dist/components/Collapsible.js +103 -0
  34. package/dist/components/Combobox.d.ts +177 -0
  35. package/dist/components/Combobox.js +179 -0
  36. package/dist/components/Commit.d.ts +265 -0
  37. package/dist/components/Commit.js +282 -0
  38. package/dist/components/Context.d.ts +129 -0
  39. package/dist/components/Context.js +309 -0
  40. package/dist/components/ContextMenu.d.ts +282 -0
  41. package/dist/components/ContextMenu.js +270 -0
  42. package/dist/components/Conversation.d.ts +166 -0
  43. package/dist/components/Conversation.js +202 -0
  44. package/dist/components/Dialog.d.ts +120 -0
  45. package/dist/components/Dialog.js +114 -0
  46. package/dist/components/EnvironmentVariables.d.ts +176 -0
  47. package/dist/components/EnvironmentVariables.js +221 -0
  48. package/dist/components/Field.d.ts +281 -0
  49. package/dist/components/Field.js +274 -0
  50. package/dist/components/Fieldset.d.ts +93 -0
  51. package/dist/components/Fieldset.js +81 -0
  52. package/dist/components/FileTree.d.ts +116 -0
  53. package/dist/components/FileTree.js +310 -0
  54. package/dist/components/Form.d.ts +94 -0
  55. package/dist/components/Form.js +88 -0
  56. package/dist/components/GithubMotionMark.d.ts +13 -0
  57. package/dist/components/GithubMotionMark.js +23 -0
  58. package/dist/components/Input.d.ts +33 -0
  59. package/dist/components/Input.js +27 -0
  60. package/dist/components/Label.d.ts +44 -0
  61. package/dist/components/Label.js +41 -0
  62. package/dist/components/Menu.d.ts +395 -0
  63. package/dist/components/Menu.js +338 -0
  64. package/dist/components/Menubar.d.ts +331 -0
  65. package/dist/components/Menubar.js +299 -0
  66. package/dist/components/Message.d.ts +216 -0
  67. package/dist/components/Message.js +245 -0
  68. package/dist/components/Meter.d.ts +151 -0
  69. package/dist/components/Meter.js +121 -0
  70. package/dist/components/ModelSelector.d.ts +198 -0
  71. package/dist/components/ModelSelector.js +306 -0
  72. package/dist/components/NaniteScene.d.ts +33 -0
  73. package/dist/components/NaniteScene.js +405 -0
  74. package/dist/components/NavigationMenu.d.ts +256 -0
  75. package/dist/components/NavigationMenu.js +228 -0
  76. package/dist/components/NumberField.d.ts +159 -0
  77. package/dist/components/NumberField.js +123 -0
  78. package/dist/components/Popover.d.ts +278 -0
  79. package/dist/components/Popover.js +245 -0
  80. package/dist/components/PreviewCard.d.ts +156 -0
  81. package/dist/components/PreviewCard.js +156 -0
  82. package/dist/components/PricingPage.d.ts +209 -0
  83. package/dist/components/PricingPage.js +506 -0
  84. package/dist/components/Progress.d.ts +58 -0
  85. package/dist/components/Progress.js +51 -0
  86. package/dist/components/PromptInput.d.ts +399 -0
  87. package/dist/components/PromptInput.js +737 -0
  88. package/dist/components/Queue.d.ts +241 -0
  89. package/dist/components/Queue.js +225 -0
  90. package/dist/components/RadioGroup.d.ts +78 -0
  91. package/dist/components/RadioGroup.js +72 -0
  92. package/dist/components/Reasoning.d.ts +88 -0
  93. package/dist/components/Reasoning.js +187 -0
  94. package/dist/components/ScrollArea.d.ts +160 -0
  95. package/dist/components/ScrollArea.js +145 -0
  96. package/dist/components/Select.d.ts +2 -0
  97. package/dist/components/Select.js +260 -0
  98. package/dist/components/Separator.d.ts +45 -0
  99. package/dist/components/Separator.js +40 -0
  100. package/dist/components/Shell.d.ts +163 -0
  101. package/dist/components/Shell.js +137 -0
  102. package/dist/components/Slider.d.ts +120 -0
  103. package/dist/components/Slider.js +115 -0
  104. package/dist/components/Sources.d.ts +91 -0
  105. package/dist/components/Sources.js +121 -0
  106. package/dist/components/Stepper.d.ts +190 -0
  107. package/dist/components/Stepper.js +315 -0
  108. package/dist/components/Switch.d.ts +57 -0
  109. package/dist/components/Switch.js +55 -0
  110. package/dist/components/Tabs.d.ts +84 -0
  111. package/dist/components/Tabs.js +78 -0
  112. package/dist/components/Task.d.ts +100 -0
  113. package/dist/components/Task.js +120 -0
  114. package/dist/components/Terminal.d.ts +118 -0
  115. package/dist/components/Terminal.js +234 -0
  116. package/dist/components/TestResults.d.ts +236 -0
  117. package/dist/components/TestResults.js +346 -0
  118. package/dist/components/Toast.d.ts +192 -0
  119. package/dist/components/Toast.js +163 -0
  120. package/dist/components/Toggle.d.ts +69 -0
  121. package/dist/components/Toggle.js +66 -0
  122. package/dist/components/ToggleGroup.d.ts +69 -0
  123. package/dist/components/ToggleGroup.js +99 -0
  124. package/dist/components/Tool.d.ts +119 -0
  125. package/dist/components/Tool.js +192 -0
  126. package/dist/components/Toolbar.d.ts +162 -0
  127. package/dist/components/Toolbar.js +126 -0
  128. package/dist/components/Tooltip.d.ts +81 -0
  129. package/dist/components/Tooltip.js +74 -0
  130. package/dist/components/WebPreview.d.ts +143 -0
  131. package/dist/components/WebPreview.js +280 -0
  132. package/dist/components/useStickToBottom.d.ts +30 -0
  133. package/dist/components/useStickToBottom.js +95 -0
  134. package/dist/copy-button-BIATcZWZ.d.ts +16 -0
  135. package/dist/copy-button-BNgclDrO.js +43 -0
  136. package/dist/icons-BsWc8g4E.js +221 -0
  137. package/dist/styles/accordion.css +10 -10
  138. package/dist/styles/agent-connection.css +18 -17
  139. package/dist/styles/alert-dialog.css +48 -29
  140. package/dist/styles/artifact.css +10 -10
  141. package/dist/styles/autocomplete.css +25 -24
  142. package/dist/styles/avatar.css +96 -6
  143. package/dist/styles/badge.css +78 -14
  144. package/dist/styles/base.css +9 -9
  145. package/dist/styles/button.css +57 -38
  146. package/dist/styles/card.css +57 -10
  147. package/dist/styles/chain-of-thought.css +47 -33
  148. package/dist/styles/checkbox.css +24 -10
  149. package/dist/styles/code-block.css +22 -15
  150. package/dist/styles/collapsible.css +14 -12
  151. package/dist/styles/combobox.css +26 -25
  152. package/dist/styles/commit.css +49 -24
  153. package/dist/styles/context-menu.css +70 -16
  154. package/dist/styles/context.css +15 -15
  155. package/dist/styles/conversation.css +12 -12
  156. package/dist/styles/dialog.css +52 -16
  157. package/dist/styles/environment-variables.css +19 -19
  158. package/dist/styles/field.css +184 -22
  159. package/dist/styles/fieldset.css +5 -4
  160. package/dist/styles/file-tree.css +17 -17
  161. package/dist/styles/index.css.d.ts +1 -0
  162. package/dist/styles/input.css +45 -11
  163. package/dist/styles/label.css +21 -4
  164. package/dist/styles/menu.css +55 -32
  165. package/dist/styles/menubar.css +80 -28
  166. package/dist/styles/message.css +22 -13
  167. package/dist/styles/meter.css +8 -8
  168. package/dist/styles/model-selector.css +33 -21
  169. package/dist/styles/navigation-menu.css +26 -24
  170. package/dist/styles/number-field.css +20 -18
  171. package/dist/styles/popover.css +38 -28
  172. package/dist/styles/preview-card.css +15 -13
  173. package/dist/styles/pricing-page.css +53 -53
  174. package/dist/styles/progress.css +7 -7
  175. package/dist/styles/prompt-input.css +73 -24
  176. package/dist/styles/queue.css +58 -32
  177. package/dist/styles/radio.css +26 -11
  178. package/dist/styles/reasoning.css +15 -11
  179. package/dist/styles/scroll-area.css +6 -6
  180. package/dist/styles/scrollbars.css +4 -4
  181. package/dist/styles/select.css +84 -25
  182. package/dist/styles/separator.css +1 -1
  183. package/dist/styles/shell.css +21 -20
  184. package/dist/styles/slider.css +35 -11
  185. package/dist/styles/sources.css +20 -20
  186. package/dist/styles/stepper.css +22 -22
  187. package/dist/styles/switch.css +29 -13
  188. package/dist/styles/tabs.css +23 -16
  189. package/dist/styles/task.css +27 -23
  190. package/dist/styles/terminal.css +16 -13
  191. package/dist/styles/test-results.css +79 -32
  192. package/dist/styles/toast.css +26 -25
  193. package/dist/styles/toggle-group.css +12 -12
  194. package/dist/styles/toggle.css +29 -11
  195. package/dist/styles/tool.css +54 -32
  196. package/dist/styles/toolbar.css +30 -28
  197. package/dist/styles/tooltip.css +10 -8
  198. package/dist/styles/web-preview.css +37 -21
  199. package/dist/utils/structured-code.d.ts +10 -0
  200. package/dist/utils/structured-code.js +81 -0
  201. package/package.json +17 -8
  202. package/dist/index.d.ts +0 -7236
  203. package/dist/index.js +0 -8945
@@ -0,0 +1,281 @@
1
+ import * as React from "react";
2
+ import { Field as Field$1 } from "@base-ui/react/field";
3
+
4
+ //#region src/components/Field.d.ts
5
+ /**
6
+ * Props for the Field.Root component.
7
+ */
8
+ interface FieldRootProps extends React.ComponentPropsWithoutRef<typeof Field$1.Root> {
9
+ /** Additional CSS class names */
10
+ className?: string;
11
+ orientation?: "vertical" | "horizontal" | "responsive";
12
+ }
13
+ /**
14
+ * Props for the Field.Label component.
15
+ */
16
+ interface FieldLabelProps extends React.ComponentPropsWithoutRef<typeof Field$1.Label> {
17
+ /** Additional CSS class names */
18
+ className?: string;
19
+ }
20
+ /**
21
+ * Props for the Field.Control component.
22
+ */
23
+ interface FieldControlProps extends React.ComponentPropsWithoutRef<typeof Field$1.Control> {
24
+ /** Additional CSS class names */
25
+ className?: string;
26
+ }
27
+ /**
28
+ * Props for the Field.Description component.
29
+ */
30
+ interface FieldDescriptionProps extends React.ComponentPropsWithoutRef<typeof Field$1.Description> {
31
+ /** Additional CSS class names */
32
+ className?: string;
33
+ }
34
+ /**
35
+ * Props for the Field.Error component.
36
+ */
37
+ interface FieldErrorProps extends React.ComponentPropsWithoutRef<typeof Field$1.Error> {
38
+ /** Additional CSS class names */
39
+ className?: string;
40
+ errors?: Array<{
41
+ message?: string;
42
+ } | string | undefined>;
43
+ }
44
+ /**
45
+ * Props for the Field.Validity component.
46
+ */
47
+ interface FieldValidityProps extends React.ComponentPropsWithoutRef<typeof Field$1.Validity> {}
48
+ interface FieldSetProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {}
49
+ interface FieldLegendProps extends React.HTMLAttributes<HTMLLegendElement> {
50
+ variant?: "legend" | "label";
51
+ }
52
+ interface FieldContentProps extends React.HTMLAttributes<HTMLDivElement> {}
53
+ interface FieldTitleProps extends React.HTMLAttributes<HTMLDivElement> {}
54
+ interface FieldGroupProps extends React.HTMLAttributes<HTMLDivElement> {}
55
+ interface FieldSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {}
56
+ /**
57
+ * Container that groups all field parts together.
58
+ * Provides context for label association and validation state.
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * <Field.Root>
63
+ * <Field.Label>Username</Field.Label>
64
+ * <Field.Control placeholder="Enter username" />
65
+ * <Field.Description>Choose a unique username</Field.Description>
66
+ * </Field.Root>
67
+ * ```
68
+ *
69
+ * @see {@link https://base-ui.com/react/components/field | Base UI Field}
70
+ */
71
+ declare function FieldRoot({
72
+ className,
73
+ orientation,
74
+ ref,
75
+ ...props
76
+ }: FieldRootProps & {
77
+ ref?: React.Ref<HTMLDivElement>;
78
+ }): React.JSX.Element;
79
+ /**
80
+ * Accessible label that is automatically associated with the field control.
81
+ * No need to manually wire up `htmlFor` and `id` attributes.
82
+ *
83
+ * @example
84
+ * ```tsx
85
+ * <Field.Root>
86
+ * <Field.Label>Email address</Field.Label>
87
+ * <Field.Control type="email" />
88
+ * </Field.Root>
89
+ * ```
90
+ */
91
+ declare function FieldLabel({
92
+ className,
93
+ ref,
94
+ ...props
95
+ }: FieldLabelProps & {
96
+ ref?: React.Ref<HTMLLabelElement>;
97
+ }): React.JSX.Element;
98
+ /**
99
+ * The input control element. Renders an `<input>` by default.
100
+ * Can be replaced with other form controls using the `render` prop.
101
+ *
102
+ * @example
103
+ * ```tsx
104
+ * // Default input
105
+ * <Field.Control placeholder="Enter text" />
106
+ *
107
+ * // With custom input component
108
+ * <Field.Control render={<Textarea />} />
109
+ * ```
110
+ */
111
+ declare function FieldControl({
112
+ className,
113
+ ref,
114
+ ...props
115
+ }: FieldControlProps & {
116
+ ref?: React.Ref<HTMLInputElement>;
117
+ }): React.JSX.Element;
118
+ /**
119
+ * Supplementary helper text that describes the field.
120
+ * Automatically associated with the control for accessibility.
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * <Field.Root>
125
+ * <Field.Label>Password</Field.Label>
126
+ * <Field.Control type="password" />
127
+ * <Field.Description>Must be at least 8 characters</Field.Description>
128
+ * </Field.Root>
129
+ * ```
130
+ */
131
+ declare function FieldDescription({
132
+ className,
133
+ ref,
134
+ ...props
135
+ }: FieldDescriptionProps & {
136
+ ref?: React.Ref<HTMLParagraphElement>;
137
+ }): React.JSX.Element;
138
+ /**
139
+ * Displays validation error messages when the field is invalid.
140
+ * Use the `match` prop to show different messages for different validity states.
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * <Field.Root>
145
+ * <Field.Label>Email</Field.Label>
146
+ * <Field.Control type="email" required />
147
+ * <Field.Error match="valueMissing">Email is required</Field.Error>
148
+ * <Field.Error match="typeMismatch">Please enter a valid email</Field.Error>
149
+ * </Field.Root>
150
+ * ```
151
+ *
152
+ * Common `match` values:
153
+ * - `valueMissing` - Required field is empty
154
+ * - `typeMismatch` - Value doesn't match input type (e.g., invalid email)
155
+ * - `tooShort` - Value is shorter than `minLength`
156
+ * - `tooLong` - Value is longer than `maxLength`
157
+ * - `patternMismatch` - Value doesn't match the `pattern` regex
158
+ * - `rangeUnderflow` - Number is less than `min`
159
+ * - `rangeOverflow` - Number is greater than `max`
160
+ */
161
+ declare function FieldError({
162
+ className,
163
+ errors,
164
+ children,
165
+ ref,
166
+ ...props
167
+ }: FieldErrorProps & {
168
+ ref?: React.Ref<HTMLDivElement>;
169
+ }): React.JSX.Element | null;
170
+ /**
171
+ * Renders custom content based on the field's validity state.
172
+ * Uses a render function that receives the validity state object.
173
+ *
174
+ * @example
175
+ * ```tsx
176
+ * <Field.Root>
177
+ * <Field.Label>Username</Field.Label>
178
+ * <Field.Control required minLength={3} />
179
+ * <Field.Validity>
180
+ * {(validity) => {
181
+ * if (validity.valueMissing) return <span>Username is required</span>;
182
+ * if (validity.tooShort) return <span>Username is too short</span>;
183
+ * return null;
184
+ * }}
185
+ * </Field.Validity>
186
+ * </Field.Root>
187
+ * ```
188
+ */
189
+ declare const FieldValidity: React.FC<import("@base-ui/react").FieldValidityProps>;
190
+ declare function FieldSet({
191
+ className,
192
+ ref,
193
+ ...props
194
+ }: FieldSetProps & {
195
+ ref?: React.Ref<HTMLFieldSetElement>;
196
+ }): React.JSX.Element;
197
+ declare function FieldLegend({
198
+ className,
199
+ variant,
200
+ ref,
201
+ ...props
202
+ }: FieldLegendProps & {
203
+ ref?: React.Ref<HTMLLegendElement>;
204
+ }): React.JSX.Element;
205
+ declare function FieldContent({
206
+ className,
207
+ ref,
208
+ ...props
209
+ }: FieldContentProps & {
210
+ ref?: React.Ref<HTMLDivElement>;
211
+ }): React.JSX.Element;
212
+ declare function FieldTitle({
213
+ className,
214
+ ref,
215
+ ...props
216
+ }: FieldTitleProps & {
217
+ ref?: React.Ref<HTMLDivElement>;
218
+ }): React.JSX.Element;
219
+ declare function FieldGroup({
220
+ className,
221
+ ref,
222
+ ...props
223
+ }: FieldGroupProps & {
224
+ ref?: React.Ref<HTMLDivElement>;
225
+ }): React.JSX.Element;
226
+ declare function FieldSeparator({
227
+ className,
228
+ children,
229
+ ref,
230
+ ...props
231
+ }: FieldSeparatorProps & {
232
+ ref?: React.Ref<HTMLDivElement>;
233
+ }): React.JSX.Element;
234
+ /**
235
+ * A form field component that provides labeling, description, and validation
236
+ * for form controls. Automatically handles accessibility associations between
237
+ * labels, inputs, descriptions, and error messages.
238
+ *
239
+ * @example
240
+ * ```tsx
241
+ * // Basic usage
242
+ * <Field.Root>
243
+ * <Field.Label>Name</Field.Label>
244
+ * <Field.Control placeholder="Enter your name" />
245
+ * </Field.Root>
246
+ *
247
+ * // With validation
248
+ * <Field.Root>
249
+ * <Field.Label>Email</Field.Label>
250
+ * <Field.Control type="email" required />
251
+ * <Field.Error match="valueMissing">Email is required</Field.Error>
252
+ * <Field.Error match="typeMismatch">Enter a valid email</Field.Error>
253
+ * <Field.Description>We'll never share your email</Field.Description>
254
+ * </Field.Root>
255
+ *
256
+ * // With custom validation
257
+ * <Field.Root validate={(value) => value === 'admin' ? 'Username taken' : null}>
258
+ * <Field.Label>Username</Field.Label>
259
+ * <Field.Control required />
260
+ * <Field.Error />
261
+ * </Field.Root>
262
+ * ```
263
+ *
264
+ * @see {@link https://base-ui.com/react/components/field | Base UI Field}
265
+ */
266
+ declare const Field: typeof FieldRoot & {
267
+ Root: typeof FieldRoot;
268
+ Label: typeof FieldLabel;
269
+ Control: typeof FieldControl;
270
+ Description: typeof FieldDescription;
271
+ Error: typeof FieldError;
272
+ Validity: React.FC<import("@base-ui/react").FieldValidityProps>;
273
+ Set: typeof FieldSet;
274
+ Legend: typeof FieldLegend;
275
+ Content: typeof FieldContent;
276
+ Title: typeof FieldTitle;
277
+ Group: typeof FieldGroup;
278
+ Separator: typeof FieldSeparator;
279
+ };
280
+ //#endregion
281
+ export { Field, FieldContent, FieldContentProps, FieldControl, FieldControlProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldRoot, FieldRootProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps, FieldValidity, FieldValidityProps };
@@ -0,0 +1,274 @@
1
+ import "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Field as Field$1 } from "@base-ui/react/field";
4
+ //#region src/components/Field.tsx
5
+ /**
6
+ * Container that groups all field parts together.
7
+ * Provides context for label association and validation state.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <Field.Root>
12
+ * <Field.Label>Username</Field.Label>
13
+ * <Field.Control placeholder="Enter username" />
14
+ * <Field.Description>Choose a unique username</Field.Description>
15
+ * </Field.Root>
16
+ * ```
17
+ *
18
+ * @see {@link https://base-ui.com/react/components/field | Base UI Field}
19
+ */
20
+ function FieldRoot({ className = "", orientation = "vertical", ref, ...props }) {
21
+ const classes = [
22
+ "field",
23
+ orientation !== "vertical" && `field--${orientation}`,
24
+ className
25
+ ].filter(Boolean).join(" ");
26
+ return /* @__PURE__ */ jsx(Field$1.Root, {
27
+ ref,
28
+ role: "group",
29
+ "data-slot": "field",
30
+ "data-orientation": orientation,
31
+ className: classes,
32
+ ...props
33
+ });
34
+ }
35
+ /**
36
+ * Accessible label that is automatically associated with the field control.
37
+ * No need to manually wire up `htmlFor` and `id` attributes.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <Field.Root>
42
+ * <Field.Label>Email address</Field.Label>
43
+ * <Field.Control type="email" />
44
+ * </Field.Root>
45
+ * ```
46
+ */
47
+ function FieldLabel({ className = "", ref, ...props }) {
48
+ const classes = ["field__label", className].filter(Boolean).join(" ");
49
+ return /* @__PURE__ */ jsx(Field$1.Label, {
50
+ ref,
51
+ "data-slot": "field-label",
52
+ className: classes,
53
+ ...props
54
+ });
55
+ }
56
+ /**
57
+ * The input control element. Renders an `<input>` by default.
58
+ * Can be replaced with other form controls using the `render` prop.
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * // Default input
63
+ * <Field.Control placeholder="Enter text" />
64
+ *
65
+ * // With custom input component
66
+ * <Field.Control render={<Textarea />} />
67
+ * ```
68
+ */
69
+ function FieldControl({ className = "", ref, ...props }) {
70
+ const classes = ["field__control", className].filter(Boolean).join(" ");
71
+ return /* @__PURE__ */ jsx(Field$1.Control, {
72
+ ref,
73
+ "data-slot": "field-control",
74
+ className: classes,
75
+ ...props
76
+ });
77
+ }
78
+ /**
79
+ * Supplementary helper text that describes the field.
80
+ * Automatically associated with the control for accessibility.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * <Field.Root>
85
+ * <Field.Label>Password</Field.Label>
86
+ * <Field.Control type="password" />
87
+ * <Field.Description>Must be at least 8 characters</Field.Description>
88
+ * </Field.Root>
89
+ * ```
90
+ */
91
+ function FieldDescription({ className = "", ref, ...props }) {
92
+ const classes = ["field__description", className].filter(Boolean).join(" ");
93
+ return /* @__PURE__ */ jsx(Field$1.Description, {
94
+ ref,
95
+ "data-slot": "field-description",
96
+ className: classes,
97
+ ...props
98
+ });
99
+ }
100
+ /**
101
+ * Displays validation error messages when the field is invalid.
102
+ * Use the `match` prop to show different messages for different validity states.
103
+ *
104
+ * @example
105
+ * ```tsx
106
+ * <Field.Root>
107
+ * <Field.Label>Email</Field.Label>
108
+ * <Field.Control type="email" required />
109
+ * <Field.Error match="valueMissing">Email is required</Field.Error>
110
+ * <Field.Error match="typeMismatch">Please enter a valid email</Field.Error>
111
+ * </Field.Root>
112
+ * ```
113
+ *
114
+ * Common `match` values:
115
+ * - `valueMissing` - Required field is empty
116
+ * - `typeMismatch` - Value doesn't match input type (e.g., invalid email)
117
+ * - `tooShort` - Value is shorter than `minLength`
118
+ * - `tooLong` - Value is longer than `maxLength`
119
+ * - `patternMismatch` - Value doesn't match the `pattern` regex
120
+ * - `rangeUnderflow` - Number is less than `min`
121
+ * - `rangeOverflow` - Number is greater than `max`
122
+ */
123
+ function FieldError({ className = "", errors, children, ref, ...props }) {
124
+ const classes = ["field__error", className].filter(Boolean).join(" ");
125
+ if (errors === void 0) return /* @__PURE__ */ jsx(Field$1.Error, {
126
+ ref,
127
+ "data-slot": "field-error",
128
+ className: classes,
129
+ ...props,
130
+ children
131
+ });
132
+ const messages = [...new Set(errors.map((error) => typeof error === "string" ? error : error?.message).filter(Boolean))];
133
+ const content = children ?? (messages.length === 1 ? messages[0] : messages.length > 1 ? /* @__PURE__ */ jsx("ul", {
134
+ className: "field__error-list",
135
+ children: messages.map((message) => /* @__PURE__ */ jsx("li", { children: message }, message))
136
+ }) : null);
137
+ if (!content) return null;
138
+ return /* @__PURE__ */ jsx("div", {
139
+ ref,
140
+ role: "alert",
141
+ "data-slot": "field-error",
142
+ className: classes,
143
+ ...props,
144
+ children: content
145
+ });
146
+ }
147
+ /**
148
+ * Renders custom content based on the field's validity state.
149
+ * Uses a render function that receives the validity state object.
150
+ *
151
+ * @example
152
+ * ```tsx
153
+ * <Field.Root>
154
+ * <Field.Label>Username</Field.Label>
155
+ * <Field.Control required minLength={3} />
156
+ * <Field.Validity>
157
+ * {(validity) => {
158
+ * if (validity.valueMissing) return <span>Username is required</span>;
159
+ * if (validity.tooShort) return <span>Username is too short</span>;
160
+ * return null;
161
+ * }}
162
+ * </Field.Validity>
163
+ * </Field.Root>
164
+ * ```
165
+ */
166
+ const FieldValidity = Field$1.Validity;
167
+ function FieldSet({ className = "", ref, ...props }) {
168
+ return /* @__PURE__ */ jsx("fieldset", {
169
+ ref,
170
+ "data-slot": "field-set",
171
+ className: ["field-set", className].filter(Boolean).join(" "),
172
+ ...props
173
+ });
174
+ }
175
+ function FieldLegend({ className = "", variant = "legend", ref, ...props }) {
176
+ return /* @__PURE__ */ jsx("legend", {
177
+ ref,
178
+ "data-slot": "field-legend",
179
+ "data-variant": variant,
180
+ className: ["field-legend", className].filter(Boolean).join(" "),
181
+ ...props
182
+ });
183
+ }
184
+ function FieldContent({ className = "", ref, ...props }) {
185
+ return /* @__PURE__ */ jsx("div", {
186
+ ref,
187
+ "data-slot": "field-content",
188
+ className: ["field-content", className].filter(Boolean).join(" "),
189
+ ...props
190
+ });
191
+ }
192
+ function FieldTitle({ className = "", ref, ...props }) {
193
+ return /* @__PURE__ */ jsx("div", {
194
+ ref,
195
+ "data-slot": "field-label",
196
+ className: ["field-title", className].filter(Boolean).join(" "),
197
+ ...props
198
+ });
199
+ }
200
+ function FieldGroup({ className = "", ref, ...props }) {
201
+ return /* @__PURE__ */ jsx("div", {
202
+ ref,
203
+ "data-slot": "field-group",
204
+ className: ["field-group", className].filter(Boolean).join(" "),
205
+ ...props
206
+ });
207
+ }
208
+ function FieldSeparator({ className = "", children, ref, ...props }) {
209
+ const classes = ["field-separator", className].filter(Boolean).join(" ");
210
+ return /* @__PURE__ */ jsxs("div", {
211
+ ref,
212
+ "data-slot": "field-separator",
213
+ "data-content": Boolean(children),
214
+ className: classes,
215
+ ...props,
216
+ children: [/* @__PURE__ */ jsx("span", {
217
+ "aria-hidden": "true",
218
+ "data-slot": "separator",
219
+ className: "field-separator__line"
220
+ }), children ? /* @__PURE__ */ jsx("span", {
221
+ "data-slot": "field-separator-content",
222
+ className: "field-separator__content",
223
+ children
224
+ }) : null]
225
+ });
226
+ }
227
+ /**
228
+ * A form field component that provides labeling, description, and validation
229
+ * for form controls. Automatically handles accessibility associations between
230
+ * labels, inputs, descriptions, and error messages.
231
+ *
232
+ * @example
233
+ * ```tsx
234
+ * // Basic usage
235
+ * <Field.Root>
236
+ * <Field.Label>Name</Field.Label>
237
+ * <Field.Control placeholder="Enter your name" />
238
+ * </Field.Root>
239
+ *
240
+ * // With validation
241
+ * <Field.Root>
242
+ * <Field.Label>Email</Field.Label>
243
+ * <Field.Control type="email" required />
244
+ * <Field.Error match="valueMissing">Email is required</Field.Error>
245
+ * <Field.Error match="typeMismatch">Enter a valid email</Field.Error>
246
+ * <Field.Description>We'll never share your email</Field.Description>
247
+ * </Field.Root>
248
+ *
249
+ * // With custom validation
250
+ * <Field.Root validate={(value) => value === 'admin' ? 'Username taken' : null}>
251
+ * <Field.Label>Username</Field.Label>
252
+ * <Field.Control required />
253
+ * <Field.Error />
254
+ * </Field.Root>
255
+ * ```
256
+ *
257
+ * @see {@link https://base-ui.com/react/components/field | Base UI Field}
258
+ */
259
+ const Field = Object.assign(FieldRoot, {
260
+ Root: FieldRoot,
261
+ Label: FieldLabel,
262
+ Control: FieldControl,
263
+ Description: FieldDescription,
264
+ Error: FieldError,
265
+ Validity: FieldValidity,
266
+ Set: FieldSet,
267
+ Legend: FieldLegend,
268
+ Content: FieldContent,
269
+ Title: FieldTitle,
270
+ Group: FieldGroup,
271
+ Separator: FieldSeparator
272
+ });
273
+ //#endregion
274
+ export { Field, FieldContent, FieldControl, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldRoot, FieldSeparator, FieldSet, FieldTitle, FieldValidity };
@@ -0,0 +1,93 @@
1
+ import * as React from "react";
2
+ import { Fieldset as Fieldset$1 } from "@base-ui/react/fieldset";
3
+
4
+ //#region src/components/Fieldset.d.ts
5
+ /**
6
+ * Props for the Fieldset.Root component.
7
+ */
8
+ interface FieldsetRootProps extends Omit<React.ComponentPropsWithoutRef<typeof Fieldset$1.Root>, "className"> {
9
+ /** Additional CSS class names */
10
+ className?: string;
11
+ }
12
+ /**
13
+ * Props for the Fieldset.Legend component.
14
+ */
15
+ interface FieldsetLegendProps extends Omit<React.ComponentPropsWithoutRef<typeof Fieldset$1.Legend>, "className"> {
16
+ /** Additional CSS class names */
17
+ className?: string;
18
+ }
19
+ /**
20
+ * Groups the fieldset legend and associated fields.
21
+ * Renders a `<fieldset>` element.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <Fieldset.Root>
26
+ * <Fieldset.Legend>Contact Information</Fieldset.Legend>
27
+ * <Field.Root>
28
+ * <Field.Label>Email</Field.Label>
29
+ * <Field.Control type="email" />
30
+ * </Field.Root>
31
+ * </Fieldset.Root>
32
+ * ```
33
+ *
34
+ * @see {@link https://base-ui.com/react/components/fieldset | Base UI Fieldset}
35
+ */
36
+ declare function FieldsetRoot({
37
+ className,
38
+ ref,
39
+ ...props
40
+ }: FieldsetRootProps & {
41
+ ref?: React.Ref<HTMLFieldSetElement>;
42
+ }): React.JSX.Element;
43
+ /**
44
+ * Accessible label for the fieldset, automatically associated with it.
45
+ * Renders a `<div>` element (styled as legend).
46
+ */
47
+ declare function FieldsetLegend({
48
+ className,
49
+ ref,
50
+ ...props
51
+ }: FieldsetLegendProps & {
52
+ ref?: React.Ref<HTMLDivElement>;
53
+ }): React.JSX.Element;
54
+ /**
55
+ * A native fieldset element with an easily stylable legend.
56
+ * Useful for grouping related form controls.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * // Basic fieldset
61
+ * <Fieldset.Root>
62
+ * <Fieldset.Legend>Personal Information</Fieldset.Legend>
63
+ * <Field.Root name="firstName">
64
+ * <Field.Label>First Name</Field.Label>
65
+ * <Field.Control />
66
+ * </Field.Root>
67
+ * <Field.Root name="lastName">
68
+ * <Field.Label>Last Name</Field.Label>
69
+ * <Field.Control />
70
+ * </Field.Root>
71
+ * </Fieldset.Root>
72
+ * ```
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * // With checkbox group
77
+ * <Fieldset.Root>
78
+ * <Fieldset.Legend>Notification Preferences</Fieldset.Legend>
79
+ * <CheckboxGroup>
80
+ * <label><Checkbox name="email" /> Email</label>
81
+ * <label><Checkbox name="sms" /> SMS</label>
82
+ * </CheckboxGroup>
83
+ * </Fieldset.Root>
84
+ * ```
85
+ *
86
+ * @see {@link https://base-ui.com/react/components/fieldset | Base UI Fieldset}
87
+ */
88
+ declare const Fieldset: {
89
+ Root: typeof FieldsetRoot;
90
+ Legend: typeof FieldsetLegend;
91
+ };
92
+ //#endregion
93
+ export { Fieldset, FieldsetLegendProps, FieldsetRootProps };