jenosize-ui 0.1.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 (182) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +100 -0
  3. package/THIRD-PARTY-NOTICES.md +163 -0
  4. package/dist/Button-Bt7pzM4R.d.ts +82 -0
  5. package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
  6. package/dist/Select-CVbEQ2Ep.d.ts +118 -0
  7. package/dist/TagInput-CTJYOB4J.d.ts +90 -0
  8. package/dist/avatar.d.ts +161 -0
  9. package/dist/avatar.js +11 -0
  10. package/dist/badge.d.ts +109 -0
  11. package/dist/badge.js +10 -0
  12. package/dist/breadcrumb.d.ts +58 -0
  13. package/dist/breadcrumb.js +7 -0
  14. package/dist/button.d.ts +54 -0
  15. package/dist/button.js +14 -0
  16. package/dist/calendar.d.ts +368 -0
  17. package/dist/calendar.js +21 -0
  18. package/dist/callout.d.ts +70 -0
  19. package/dist/callout.js +16 -0
  20. package/dist/card-nWicloNi.d.ts +80 -0
  21. package/dist/card.d.ts +2 -0
  22. package/dist/card.js +7 -0
  23. package/dist/checkbox.d.ts +133 -0
  24. package/dist/checkbox.js +11 -0
  25. package/dist/chunk-24TO7E32.js +42 -0
  26. package/dist/chunk-3Y5X7B5C.js +146 -0
  27. package/dist/chunk-4OLULPQG.js +202 -0
  28. package/dist/chunk-4P2NBLBW.js +103 -0
  29. package/dist/chunk-52IFGFTL.js +11 -0
  30. package/dist/chunk-5FATN5YD.js +115 -0
  31. package/dist/chunk-5NOBSXJN.js +297 -0
  32. package/dist/chunk-5RAPA22E.js +106 -0
  33. package/dist/chunk-7EUAMHMU.js +16 -0
  34. package/dist/chunk-7EWQKTNQ.js +1336 -0
  35. package/dist/chunk-7HOIZ3UO.js +110 -0
  36. package/dist/chunk-7IU5TMFL.js +452 -0
  37. package/dist/chunk-7JBNLEJ7.js +29 -0
  38. package/dist/chunk-7S2TBALK.js +23 -0
  39. package/dist/chunk-BJUZVYQC.js +188 -0
  40. package/dist/chunk-BVJWBYIG.js +66 -0
  41. package/dist/chunk-CME4DIML.js +65 -0
  42. package/dist/chunk-CYPPEUX5.js +73 -0
  43. package/dist/chunk-D5BTFSL7.js +71 -0
  44. package/dist/chunk-D6TPWNRK.js +387 -0
  45. package/dist/chunk-DJSXIAFH.js +66 -0
  46. package/dist/chunk-DRZCJCBO.js +46 -0
  47. package/dist/chunk-DWKILXHE.js +17 -0
  48. package/dist/chunk-E7ZSWBAK.js +70 -0
  49. package/dist/chunk-EDSK6FEH.js +8 -0
  50. package/dist/chunk-F2K7VJUV.js +114 -0
  51. package/dist/chunk-F6NLE6XJ.js +40 -0
  52. package/dist/chunk-FHHAPGCR.js +32 -0
  53. package/dist/chunk-FXIBGTS5.js +14 -0
  54. package/dist/chunk-GCVA3OIV.js +72 -0
  55. package/dist/chunk-GFOAJVW5.js +336 -0
  56. package/dist/chunk-GRLSUQQE.js +136 -0
  57. package/dist/chunk-GTHJWR3Q.js +77 -0
  58. package/dist/chunk-HMUZE6EK.js +67 -0
  59. package/dist/chunk-I7WU4GTY.js +503 -0
  60. package/dist/chunk-J2BCKBHC.js +151 -0
  61. package/dist/chunk-J36M3KRX.js +1315 -0
  62. package/dist/chunk-J7ZQQFPT.js +113 -0
  63. package/dist/chunk-JP26LPCY.js +234 -0
  64. package/dist/chunk-JTNFJLIY.js +1046 -0
  65. package/dist/chunk-JVJRHBTD.js +50 -0
  66. package/dist/chunk-JYGR44ZC.js +133 -0
  67. package/dist/chunk-KDLPXXD2.js +173 -0
  68. package/dist/chunk-KMSYEE23.js +224 -0
  69. package/dist/chunk-KNYKWUYX.js +52 -0
  70. package/dist/chunk-LME57Z6J.js +138 -0
  71. package/dist/chunk-MFJP5FA7.js +20 -0
  72. package/dist/chunk-MKC5HNA7.js +1692 -0
  73. package/dist/chunk-MQGD2OUF.js +39 -0
  74. package/dist/chunk-MUFHLP4S.js +566 -0
  75. package/dist/chunk-O2LG3PNI.js +74 -0
  76. package/dist/chunk-O4GRKO3I.js +66 -0
  77. package/dist/chunk-OHUFNYGN.js +791 -0
  78. package/dist/chunk-PWKWNDBS.js +243 -0
  79. package/dist/chunk-QA74ITR4.js +103 -0
  80. package/dist/chunk-R6RGJF4L.js +170 -0
  81. package/dist/chunk-S7NNXWIN.js +7 -0
  82. package/dist/chunk-SV56BSUQ.js +162 -0
  83. package/dist/chunk-T7FCG7XV.js +435 -0
  84. package/dist/chunk-THC2ISYP.js +57 -0
  85. package/dist/chunk-VWC72TR3.js +115 -0
  86. package/dist/chunk-W46K56XU.js +216 -0
  87. package/dist/chunk-W5GGOUUI.js +75 -0
  88. package/dist/chunk-WEUJYDCV.js +269 -0
  89. package/dist/chunk-WFY7DKQD.js +279 -0
  90. package/dist/chunk-WZQFC7ZN.js +448 -0
  91. package/dist/chunk-Z3ETJN5G.js +136 -0
  92. package/dist/chunk-ZOOX3TUB.js +192 -0
  93. package/dist/chunk-ZSNJ6UA3.js +42 -0
  94. package/dist/chunk-ZZA2LUTL.js +130 -0
  95. package/dist/chunk-ZZT2E5VT.js +24 -0
  96. package/dist/color-CtSxc1Rh.d.ts +6 -0
  97. package/dist/combobox.d.ts +184 -0
  98. package/dist/combobox.js +21 -0
  99. package/dist/date-input.d.ts +83 -0
  100. package/dist/date-input.js +16 -0
  101. package/dist/date-picker.d.ts +249 -0
  102. package/dist/date-picker.js +29 -0
  103. package/dist/date-utils-7hTFTXNK.d.ts +34 -0
  104. package/dist/date-vMJBKAFK.d.ts +22 -0
  105. package/dist/dialog.d.ts +86 -0
  106. package/dist/dialog.js +15 -0
  107. package/dist/drawer.d.ts +77 -0
  108. package/dist/drawer.js +14 -0
  109. package/dist/dropdown-menu.d.ts +218 -0
  110. package/dist/dropdown-menu.js +10 -0
  111. package/dist/file-trigger.d.ts +42 -0
  112. package/dist/file-trigger.js +3 -0
  113. package/dist/form.d.ts +487 -0
  114. package/dist/form.js +1179 -0
  115. package/dist/header-navigation.d.ts +74 -0
  116. package/dist/header-navigation.js +23 -0
  117. package/dist/icons/app.d.ts +48 -0
  118. package/dist/icons/app.js +282 -0
  119. package/dist/icons/flag.d.ts +817 -0
  120. package/dist/icons/flag.js +58336 -0
  121. package/dist/icons/integration.d.ts +36 -0
  122. package/dist/icons/integration.js +531 -0
  123. package/dist/icons/payment.d.ts +116 -0
  124. package/dist/icons/payment.js +2418 -0
  125. package/dist/icons.d.ts +2013 -0
  126. package/dist/icons.js +2012 -0
  127. package/dist/illustration.d.ts +48 -0
  128. package/dist/illustration.js +4 -0
  129. package/dist/index.d.ts +68 -0
  130. package/dist/index.js +73 -0
  131. package/dist/indicator.d.ts +51 -0
  132. package/dist/indicator.js +7 -0
  133. package/dist/input.d.ts +66 -0
  134. package/dist/input.js +15 -0
  135. package/dist/multi-value-CJb_tnvi.d.ts +8 -0
  136. package/dist/nav-Bla0o_-1.d.ts +98 -0
  137. package/dist/number-input.d.ts +80 -0
  138. package/dist/number-input.js +15 -0
  139. package/dist/options-CPEIgjtd.d.ts +68 -0
  140. package/dist/overflow-Df0h42Oi.d.ts +29 -0
  141. package/dist/pagination.d.ts +77 -0
  142. package/dist/pagination.js +17 -0
  143. package/dist/payment-input.d.ts +7 -0
  144. package/dist/payment-input.js +15 -0
  145. package/dist/popover.d.ts +60 -0
  146. package/dist/popover.js +14 -0
  147. package/dist/progress.d.ts +87 -0
  148. package/dist/progress.js +5 -0
  149. package/dist/radio.d.ts +77 -0
  150. package/dist/radio.js +12 -0
  151. package/dist/select.d.ts +68 -0
  152. package/dist/select.js +24 -0
  153. package/dist/shared-BNXAdgh2.d.ts +9 -0
  154. package/dist/shared-BYXJPnsN.d.ts +11 -0
  155. package/dist/shared-Dc-GgA16.d.ts +42 -0
  156. package/dist/sidebar-navigation.d.ts +129 -0
  157. package/dist/sidebar-navigation.js +15 -0
  158. package/dist/styles.css +2 -0
  159. package/dist/switch.d.ts +23 -0
  160. package/dist/switch.js +7 -0
  161. package/dist/table.d.ts +692 -0
  162. package/dist/table.js +44 -0
  163. package/dist/tabs.d.ts +111 -0
  164. package/dist/tabs.js +8 -0
  165. package/dist/tag-input.d.ts +12 -0
  166. package/dist/tag-input.js +19 -0
  167. package/dist/tag.d.ts +98 -0
  168. package/dist/tag.js +9 -0
  169. package/dist/textarea.d.ts +40 -0
  170. package/dist/textarea.js +12 -0
  171. package/dist/theme-script.d.ts +29 -0
  172. package/dist/theme-script.js +15 -0
  173. package/dist/theme.css +929 -0
  174. package/dist/theme.d.ts +71 -0
  175. package/dist/theme.js +15 -0
  176. package/dist/toast.d.ts +242 -0
  177. package/dist/toast.js +15 -0
  178. package/dist/tooltip.d.ts +70 -0
  179. package/dist/tooltip.js +6 -0
  180. package/dist/tree.d.ts +308 -0
  181. package/dist/tree.js +11 -0
  182. package/package.json +352 -0
package/dist/form.d.ts ADDED
@@ -0,0 +1,487 @@
1
+ import * as React from 'react';
2
+ import { FieldValues, FieldPathByValue, FieldPath, Control, FieldPathValue, FieldArrayPath, FieldArray, ControllerRenderProps, ControllerFieldState, UseFormReturn, ErrorOption, UseFormProps, FieldErrors } from 'react-hook-form';
3
+ export { FieldErrors, FieldValues, FieldArrayPath as FormArrayPath, FieldArray as FormArrayValue, Control as FormControl, ErrorOption as FormErrorOption, FieldPath as FormPath, FieldPathByValue as FormPathByValue, FieldPathValue as FormPathValue, SubmitErrorHandler, SubmitHandler, useWatch } from 'react-hook-form';
4
+ import { a as ButtonProps } from './Button-Bt7pzM4R.js';
5
+ import { CheckboxProps, CheckboxGroupProps, CheckboxGroupOption } from './checkbox.js';
6
+ import { ComboboxProps, ComboboxOption } from './combobox.js';
7
+ import { DateInputProps } from './date-input.js';
8
+ import { InputProps } from './input.js';
9
+ import { NumberInputProps } from './number-input.js';
10
+ import { c as PaymentInputProps } from './PaymentInput-CKPIPNWH.js';
11
+ import { RadioGroupProps, RadioOption } from './radio.js';
12
+ import { f as SelectProps, e as SelectOption } from './Select-CVbEQ2Ep.js';
13
+ import { SwitchProps } from './switch.js';
14
+ import { a as TagInputProps } from './TagInput-CTJYOB4J.js';
15
+ import { TextareaProps } from './textarea.js';
16
+ import { b as Option, d as OptionOrGroup } from './options-CPEIgjtd.js';
17
+ import '@base-ui/react/use-render';
18
+ import './color-CtSxc1Rh.js';
19
+ import './overflow-Df0h42Oi.js';
20
+ import './multi-value-CJb_tnvi.js';
21
+ import '@base-ui/react/combobox';
22
+ import './date-utils-7hTFTXNK.js';
23
+ import '@base-ui/react/number-field';
24
+ import '@base-ui/react/select';
25
+ import '@base-ui/react/switch';
26
+
27
+ /** Every rule the `validate` bag can fail with — the key space shared by the
28
+ * provider, the per-field override, and the defaults. */
29
+ type RuleName = "required" | "check" | "minLength" | "maxLength" | "pattern" | "email" | "url" | "equals" | "min" | "max" | "integer" | "positive" | "negative" | "nonNegative" | "multipleOf" | "after" | "before" | "minItems" | "maxItems" | "unique" | "minFiles" | "maxFiles" | "maxSize" | "accept" | "oneOf";
30
+ /** What a message function receives. `min`/`max` carry the rule's own bound so a
31
+ * translation can interpolate it (`t("form.maxLength", { max })`). */
32
+ interface MessageCtx {
33
+ /** Fully-qualified field name (`invites.0.email`). */
34
+ name: string;
35
+ /** The control's `label`, when it has one — for "{label} is required". */
36
+ label?: string;
37
+ /** The value that failed. */
38
+ value: unknown;
39
+ /** The whole form's values at validation time. */
40
+ values: Record<string, unknown>;
41
+ /** The rule's lower bound, if it has one — `min`/`minLength`/`minItems`/…, and
42
+ * the RESOLVED date an `after` demanded (bounds may be computed from `values`,
43
+ * so this is the only place a message can learn one). */
44
+ min?: number | string;
45
+ /** The rule's upper bound, if it has one — `max`/`maxLength`/… and the resolved
46
+ * date a `before` demanded. */
47
+ max?: number | string;
48
+ }
49
+ type FormMessage = string | ((ctx: MessageCtx) => string);
50
+ type FormMessagesValue = Partial<Record<RuleName, FormMessage>>;
51
+ /** The built-in English fallbacks — the last link of the cascade. */
52
+ declare const DEFAULT_MESSAGES: Required<FormMessagesValue>;
53
+ interface FormMessagesProps {
54
+ /** App-level defaults keyed by rule name. Wire `t()` here — it is the i18n seam. */
55
+ value: FormMessagesValue;
56
+ children?: React.ReactNode;
57
+ }
58
+ /** App-level default validation messages. Mount once, next to your i18n provider. */
59
+ declare function FormMessages({ value, children }: FormMessagesProps): React.JSX.Element;
60
+ /** The app-level message table, or `null` outside a provider. */
61
+ declare function useFormMessages(): FormMessagesValue | null;
62
+
63
+ /** Which payload a bound control emits — decides what "empty" means and which
64
+ * rules apply. Set by the control itself, never by the caller. */
65
+ type FieldKind = "string" | "enum" | "number" | "date" | "boolean" | "array" | "file";
66
+ /** `false`/`undefined` = passed. A string = failed WITH that message. */
67
+ type CheckResult = string | false | null | undefined | void;
68
+ type Of<T, R> = R | ((values: T) => R);
69
+ interface BaseValidate<T extends FieldValues, TValue> {
70
+ /** Blocks an empty value. A function makes it conditional on other fields. */
71
+ required?: Of<T, boolean>;
72
+ /** Free-form escape (may be async): return a string to fail with that message. */
73
+ check?: (value: TValue, values: T) => CheckResult | Promise<CheckResult>;
74
+ }
75
+ interface StringValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, string> {
76
+ minLength?: number;
77
+ maxLength?: number;
78
+ pattern?: RegExp;
79
+ email?: boolean;
80
+ url?: boolean;
81
+ /** Cross-field equality — `equals: (v) => v.password`. */
82
+ equals?: (values: T) => string | null | undefined;
83
+ }
84
+ /** Select / Combobox / RadioGroup: the valid set is DERIVED from `options`, so
85
+ * there is nothing to declare beyond requiredness. */
86
+ interface EnumValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, string | null> {
87
+ /**
88
+ * Opt out of the free `oneOf` check derived from `options`.
89
+ *
90
+ * That check assumes `options` is the COMPLETE valid set. Pass `false` when it is not — a paged
91
+ * list, a server-side search, anything where the currently-rendered options are a window onto a
92
+ * larger set. Without it a correctly selected value that has scrolled out of the current page
93
+ * fails validation on submit with "Pick one of the available options", and there is nothing the
94
+ * user can do about it.
95
+ *
96
+ * `filter={null}` (caller-owned search) and `creatable` are detected automatically — this is for
97
+ * the partial-ness the library cannot see.
98
+ */
99
+ oneOf?: false;
100
+ }
101
+ interface NumberValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, number | null> {
102
+ min?: Of<T, number | null | undefined>;
103
+ max?: Of<T, number | null | undefined>;
104
+ integer?: boolean;
105
+ positive?: boolean;
106
+ negative?: boolean;
107
+ nonNegative?: boolean;
108
+ multipleOf?: number;
109
+ }
110
+ /** A date bound: an ISO string, the literal `"today"`, or a function of the values. */
111
+ type DateBound<T extends FieldValues> = Of<T, string | null | undefined>;
112
+ interface DateValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, string | null> {
113
+ /** Inclusive lower bound. */
114
+ min?: DateBound<T>;
115
+ /** Inclusive upper bound. */
116
+ max?: DateBound<T>;
117
+ /** Exclusive lower bound — `after: (v) => v.startAt`. */
118
+ after?: DateBound<T>;
119
+ /** Exclusive upper bound. */
120
+ before?: DateBound<T>;
121
+ }
122
+ /** `required` on a boolean means "must be checked" — a checked box has satisfied
123
+ * its requirement, so it can never be invalid (AGENTS §6). */
124
+ interface BooleanValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, boolean> {
125
+ }
126
+ interface ArrayValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, string[]> {
127
+ minItems?: number;
128
+ maxItems?: number;
129
+ unique?: boolean;
130
+ }
131
+ interface FileValidate<T extends FieldValues = FieldValues> extends BaseValidate<T, File[]> {
132
+ minFiles?: number;
133
+ maxFiles?: number;
134
+ /** Max bytes per file. */
135
+ maxSize?: number;
136
+ /** Same grammar as the picker's `accept` — here it REJECTS, there it filters. */
137
+ accept?: string;
138
+ }
139
+ type AnyValidate<T extends FieldValues = FieldValues> = StringValidate<T> & EnumValidate<T> & NumberValidate<T> & DateValidate<T> & BooleanValidate<T> & ArrayValidate<T> & FileValidate<T>;
140
+ /** One registered control. Held by ref so the resolver always sees the latest
141
+ * closures without the registry itself causing renders. */
142
+ interface RegisteredField<T extends FieldValues = FieldValues> {
143
+ name: string;
144
+ kind: FieldKind;
145
+ validate?: AnyValidate<T>;
146
+ /** For "{label} is required". */
147
+ label?: string;
148
+ /** Field-level message overrides. */
149
+ messages?: FormMessagesValue;
150
+ /** Flattened `options` values — powers the free `oneOf` check. */
151
+ optionValues?: string[];
152
+ /** Whether the control is disabled (disabled controls are never validated). */
153
+ disabled?: boolean;
154
+ /** Where the error is stored, when that differs from the value's own path —
155
+ * `<Form.Array>` reads values at `invites` but writes its error to
156
+ * `invites.root` so it can't clobber the per-row errors. */
157
+ errorPath?: string;
158
+ }
159
+ /**
160
+ * Every mounted control's rules, keyed by field name — a Map you can SUBSCRIBE to.
161
+ *
162
+ * The subscription is not decoration: `<Form>`'s banner shows the errors whose
163
+ * field is NOT mounted, so it has to re-render when a field arrives or leaves —
164
+ * a plain Map mutates without telling React, and the banner would keep showing a
165
+ * message the field it belongs to has already taken back (and vice versa).
166
+ */
167
+ declare class FieldRegistry<T extends FieldValues = FieldValues> extends Map<string, {
168
+ current: RegisteredField<T>;
169
+ }> {
170
+ private listeners;
171
+ /** Bumped on every membership change — the snapshot `useSyncExternalStore` reads. */
172
+ version: number;
173
+ subscribe: (listener: () => void) => (() => void);
174
+ /** The current membership version (identity-stable function, for React). */
175
+ getVersion: () => number;
176
+ private changed;
177
+ set(name: string, entry: {
178
+ current: RegisteredField<T>;
179
+ }): this;
180
+ delete(name: string): boolean;
181
+ }
182
+
183
+ /**
184
+ * Component props minus everything the adapter drives, plus the form wiring.
185
+ *
186
+ * `required` is omitted along with `value`/`onChange`/…: inside a form,
187
+ * requiredness is declared ONCE, in `validate={{ required }}`, which drives both
188
+ * the visible `*` and the rule (docs/form-api-v2.md §4.3).
189
+ *
190
+ * `TName` is the field's path, INFERRED from the `name` you pass — which is what
191
+ * lets `options` be checked against that one field's union (below). The set it is
192
+ * constrained to comes from the namespace the control was reached through: the
193
+ * whole form for `Form.Input`, the ROW for a `row.Input` inside `<Form.Array>`.
194
+ * `validate` always sees the WHOLE form's values, because that is what the
195
+ * resolver actually passes.
196
+ */
197
+ type BoundProps<P, TFieldValues extends FieldValues, TName, TValidate> = Omit<P, "value" | "defaultValue" | "onChange" | "onValueChange" | "onCheckedChange" | "onBlur" | "checked" | "invalid" | "error" | "name" | "required"> & {
198
+ /** The field this control binds to — checked against the form's (or the row's) shape. */
199
+ name: TName;
200
+ /** Defaults to the surrounding `<Form>`'s control. */
201
+ control?: Control<TFieldValues>;
202
+ /** This field's rules — see docs/form-api-v2.md §4.3. */
203
+ validate?: TValidate;
204
+ /** Message overrides for this field only (same keys as `<FormMessages>`). */
205
+ messages?: FormMessagesValue;
206
+ };
207
+ /**
208
+ * The `value`s a field will accept in its `options`: its own union with `null`
209
+ * dropped, and for a multi-value field (`tools: Tool[]`) the union of its ITEMS.
210
+ * An untyped (`FieldValues`) form falls back to `string`, so the loose form still
211
+ * compiles.
212
+ */
213
+ type OptionValueOf<TValue> = NonNullable<TValue> extends readonly (infer TItem)[] ? TItem extends string ? TItem : string : NonNullable<TValue> extends string ? NonNullable<TValue> : string;
214
+ /**
215
+ * `options` whose every `value` is one the FIELD accepts — the reason
216
+ * `<Form.Select name="venue" options={[{ value: "hall-z" }]}/>` is a compile
217
+ * error and not a runtime shrug.
218
+ *
219
+ * Also the annotation for a shared options const, where the field type is spelled
220
+ * directly: `const VENUES: FieldOptions<Venue> = [...]`.
221
+ */
222
+ type FieldOptions<TValue, TOption extends Option = Option> = OptionOrGroup<Omit<TOption, "value"> & {
223
+ value: OptionValueOf<TValue>;
224
+ }>[];
225
+ /** {@link FieldOptions} for the flat-only lists (CheckboxGroup takes no groups). */
226
+ type FieldFlatOptions<TValue, TOption extends Option = Option> = (Omit<TOption, "value"> & {
227
+ value: OptionValueOf<TValue>;
228
+ })[];
229
+ /** The file field is a COMPOSITION, not a component: `FileTrigger` gives the dialog,
230
+ * a readOnly `Input` displays the picked name(s), and a seamless add-on `Button`
231
+ * repeats the action — both surfaces call the same `open()`. The library ships no
232
+ * `FileInput`; this is that recipe, bound once so forms don't re-type it. */
233
+ interface FormFileInputProps extends Omit<InputProps, "value" | "defaultValue" | "type" | "readOnly" | "onChange" | "onClick" | "leading" | "trailing" | "leadingAddon" | "trailingAddon"> {
234
+ /** Accepted file types (native `accept` attribute). */
235
+ accept?: string;
236
+ /** Allow selecting more than one file. @default false */
237
+ multiple?: boolean;
238
+ /** Label of the trailing add-on button. @default "Upload" */
239
+ buttonLabel?: string;
240
+ /** Text shown when nothing is selected. @default "Choose a file" */
241
+ placeholder?: string;
242
+ }
243
+ interface FormSubmitProps<TFieldValues extends FieldValues = FieldValues> extends Omit<ButtonProps, "type" | "form"> {
244
+ /** Only needed when the button renders OUTSIDE `<Form>` (a `Dialog` footer):
245
+ * pass the instance and the button owns the form through its `form` attribute. */
246
+ form?: JzForm<TFieldValues>;
247
+ }
248
+ /** A field path whose payload matches the control (`Input` ⇒ the string fields).
249
+ * Intersected with `FieldPath` so `FieldPathValue<TScope, TName>` — how `options`
250
+ * learns the field's union — still type-checks under a generic scope. */
251
+ type PathOf<TScope extends FieldValues, TValue> = FieldPathByValue<TScope, TValue> & FieldPath<TScope>;
252
+ /**
253
+ * The bound controls, re-typed for ONE scope — the whole form for the namespace
254
+ * `useForm()` returns, or a single ROW inside `<Form.Array>` (so a row field is
255
+ * written short, `name="email"`, and is still checked).
256
+ *
257
+ * This is where the form's hard typing lives: `name` must be a real field of the
258
+ * scope AND carry the payload the control emits, `options` values must be values
259
+ * that field accepts, and `validate` callbacks receive the WHOLE form's values —
260
+ * which is what the resolver passes at runtime.
261
+ *
262
+ * Every member is the SAME component reference as the next scope's (the row
263
+ * prefix comes from context, not from a different component), so re-scoping is
264
+ * type-only and nothing remounts.
265
+ */
266
+ interface ScopedFields<TFieldValues extends FieldValues, TScope extends FieldValues> {
267
+ Input: <TName extends PathOf<TScope, string>>(props: BoundProps<InputProps, TFieldValues, TName, StringValidate<TFieldValues>>) => React.ReactElement;
268
+ Textarea: <TName extends PathOf<TScope, string>>(props: BoundProps<TextareaProps, TFieldValues, TName, StringValidate<TFieldValues>>) => React.ReactElement;
269
+ Select: <TName extends PathOf<TScope, string | string[] | null>>(props: Omit<BoundProps<SelectProps, TFieldValues, TName, EnumValidate<TFieldValues> & ArrayValidate<TFieldValues>>, "options"> & {
270
+ /** The rows — each `value` checked against this field's own union. */
271
+ options: FieldOptions<FieldPathValue<TScope, TName>, SelectOption>;
272
+ }) => React.ReactElement;
273
+ Combobox: <TName extends PathOf<TScope, string | string[] | null>>(props: Omit<BoundProps<ComboboxProps, TFieldValues, TName, EnumValidate<TFieldValues> & ArrayValidate<TFieldValues>>, "options"> & {
274
+ /** The rows — each `value` checked against this field's own union. */
275
+ options: FieldOptions<FieldPathValue<TScope, TName>, ComboboxOption>;
276
+ }) => React.ReactElement;
277
+ Checkbox: <TName extends PathOf<TScope, boolean>>(props: BoundProps<CheckboxProps, TFieldValues, TName, BooleanValidate<TFieldValues>>) => React.ReactElement;
278
+ CheckboxGroup: <TName extends PathOf<TScope, string[]>>(props: Omit<BoundProps<CheckboxGroupProps, TFieldValues, TName, ArrayValidate<TFieldValues>>, "options"> & {
279
+ /** The rows — each `value` checked against this field's own item type. */
280
+ options?: FieldFlatOptions<FieldPathValue<TScope, TName>, CheckboxGroupOption>;
281
+ }) => React.ReactElement;
282
+ RadioGroup: <TName extends PathOf<TScope, string | null>>(props: Omit<BoundProps<RadioGroupProps, TFieldValues, TName, EnumValidate<TFieldValues>>, "options"> & {
283
+ /** The rows — each `value` checked against this field's own union. */
284
+ options?: FieldOptions<FieldPathValue<TScope, TName>, RadioOption>;
285
+ }) => React.ReactElement;
286
+ Switch: <TName extends PathOf<TScope, boolean>>(props: Omit<BoundProps<SwitchProps, TFieldValues, TName, never>, "validate" | "messages">) => React.ReactElement;
287
+ NumberInput: <TName extends PathOf<TScope, number | null>>(props: BoundProps<NumberInputProps, TFieldValues, TName, NumberValidate<TFieldValues>>) => React.ReactElement;
288
+ DateInput: <TName extends PathOf<TScope, string | null>>(props: BoundProps<DateInputProps, TFieldValues, TName, DateValidate<TFieldValues>>) => React.ReactElement;
289
+ TagInput: <TName extends PathOf<TScope, string[]>>(props: BoundProps<TagInputProps, TFieldValues, TName, ArrayValidate<TFieldValues>>) => React.ReactElement;
290
+ PaymentInput: <TName extends PathOf<TScope, string>>(props: BoundProps<PaymentInputProps, TFieldValues, TName, StringValidate<TFieldValues>>) => React.ReactElement;
291
+ FileInput: <TName extends PathOf<TScope, File[]>>(props: BoundProps<FormFileInputProps, TFieldValues, TName, FileValidate<TFieldValues>>) => React.ReactElement;
292
+ /** Dynamic rows. At the top level it is `Form.Array`; inside a row it is the
293
+ * NESTED array (`orders.2.items` → `orders.2.items.5.qty`), already scoped by
294
+ * its parent — either way there is no `form` prop to remember. */
295
+ Array: BoundArray<TFieldValues, TScope>;
296
+ }
297
+
298
+ /** The shape of one row, derived from the array field it belongs to. */
299
+ type RowOf<TFieldValues extends FieldValues, TName extends FieldArrayPath<TFieldValues>> = FieldArray<TFieldValues, TName> extends FieldValues ? FieldArray<TFieldValues, TName> : FieldValues;
300
+ /** `Form.Array` / `row.Array` as the instance-bound namespace exposes it: the
301
+ * scope already fixes which array fields exist, so there is no `form` prop. */
302
+ type BoundArray<TFieldValues extends FieldValues, TScope extends FieldValues> = <TName extends FieldArrayPath<TScope>>(props: Omit<FormArrayProps<TFieldValues, TScope, TName>, "form">) => React.ReactElement;
303
+ /**
304
+ * What the children render-function receives for each row.
305
+ *
306
+ * The bound controls arrive re-typed for THIS row (`row.Input name="email"`),
307
+ * which is how a row field stays short and still type-checked: `name` is
308
+ * validated against the row's shape, not the whole form's. They are the same
309
+ * component references as `Form.Input` & friends, so nothing remounts.
310
+ */
311
+ type FormArrayRow<TFieldValues extends FieldValues = FieldValues, TRow extends FieldValues = FieldValues> = ScopedFields<TFieldValues, TRow> & {
312
+ /** Row position, 0-based. */
313
+ index: number;
314
+ first: boolean;
315
+ last: boolean;
316
+ /** Current row count. */
317
+ count: number;
318
+ /** Remove this row (a no-op at `min`). */
319
+ remove: () => void;
320
+ /** Stable remove Button, already wired + disabled at `min`. */
321
+ Remove: typeof FormArrayRemove;
322
+ };
323
+ /** The per-row remove Button. A module-level component (never re-created inside
324
+ * the render fn) so a row's button keeps its identity — and its focus. */
325
+ declare function FormArrayRemove({ children, ...rest }: Omit<ButtonProps, "onClick" | "type">): React.JSX.Element | null;
326
+ declare namespace FormArrayRemove {
327
+ var displayName: string;
328
+ }
329
+ interface FormArrayProps<TFieldValues extends FieldValues, TScope extends FieldValues = TFieldValues, TName extends FieldArrayPath<TScope> = FieldArrayPath<TScope>> {
330
+ /** The instance, injected by the namespace `useForm()` returns — never written by
331
+ * hand (`Form.Array` and `row.Array` both arrive already scoped, which is what
332
+ * types `name` against the real array fields and `row.*` against the row shape).
333
+ * Runtime wiring comes from context when it is absent. */
334
+ form?: JzForm<TFieldValues>;
335
+ /** The array field (`"invites"`). Row fields are then written relative to it. */
336
+ name: TName;
337
+ /** Group label above the rows. */
338
+ label?: React.ReactNode;
339
+ /** Muted helper under the label. */
340
+ hint?: React.ReactNode;
341
+ /** Fewest rows allowed — also the point where Remove goes disabled. */
342
+ min?: number;
343
+ /** Most rows allowed — also the point where Add goes disabled. */
344
+ max?: number;
345
+ /** Key inside a row that must not repeat (`unique="email"`). */
346
+ unique?: keyof RowOf<TScope, TName> & string;
347
+ /** The blank row appended by Add. */
348
+ empty: RowOf<TScope, TName>;
349
+ /** Label of the add button. Pass `null` to render no add button. @default "Add" */
350
+ addLabel?: React.ReactNode;
351
+ /** Message overrides for this array's rules. */
352
+ messages?: FormMessagesValue;
353
+ /** Layout/spacing only, merged via `cn()`. */
354
+ className?: string;
355
+ children: (row: FormArrayRow<TFieldValues, RowOf<TScope, TName>>) => React.ReactNode;
356
+ }
357
+
358
+ interface FormFieldRenderArgs<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
359
+ field: ControllerRenderProps<TFieldValues, TName>;
360
+ fieldState: ControllerFieldState;
361
+ /** `fieldState.invalid`. */
362
+ invalid: boolean;
363
+ /** The resolved message, ready for `Field.Error`. */
364
+ error: string | undefined;
365
+ }
366
+ interface FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
367
+ name: TName;
368
+ /** Defaults to the surrounding <Form>'s control. */
369
+ control?: Control<TFieldValues>;
370
+ /** Set by the bound variants, which have already resolved the `<Form.Array>`
371
+ * prefix — keeps the name from being prefixed twice. @default false */
372
+ absolute?: boolean;
373
+ render: (args: FormFieldRenderArgs<TFieldValues, TName>) => React.ReactElement;
374
+ }
375
+
376
+ interface FormProps<TFieldValues extends FieldValues = FieldValues> {
377
+ /** The instance from `useForm()` — the form's only owner (docs/form-api-v2.md §2).
378
+ * Injected by the bound `Form` the hook returns; never passed by hand. */
379
+ form: JzForm<TFieldValues>;
380
+ /** Render `errors.root` (from `setFormError` or a `name: "root"` rule) as a
381
+ * banner at the top of the form. @default true */
382
+ errorSummary?: boolean;
383
+ /** Layout/spacing only, merged via `cn()` (defaults to a vertical stack). */
384
+ className?: string;
385
+ children?: React.ReactNode;
386
+ }
387
+ /**
388
+ * `<Form>` — the renderer, plus every bound control, `Form.Array`, `Form.Submit`
389
+ * and the `Form.Field` escape hatch, ALL typed to one form's values.
390
+ *
391
+ * This is the second slot of `useForm()`'s tuple, and the only way to reach a
392
+ * bound control: a field can't be written without a form to check it against, so
393
+ * `name`, `options` values and array keys are hard-typed by construction — there
394
+ * is no "forgot the generic" state to fall into (docs/form-api-v2.md §9).
395
+ */
396
+ interface BoundForm<TFieldValues extends FieldValues> extends Omit<ScopedFields<TFieldValues, TFieldValues>, "Array"> {
397
+ (props: Omit<FormProps<TFieldValues>, "form">): React.ReactElement;
398
+ /** Dynamic rows (docs/form-api-v2.md §4.6). */
399
+ Array: BoundArray<TFieldValues, TFieldValues> & {
400
+ /** The per-row remove Button, wired + disabled at `min`. */
401
+ Remove: typeof FormArrayRemove;
402
+ };
403
+ /** Escape hatch: bind any control by hand (`{ field, invalid, error }`). */
404
+ Field: <TName extends FieldPath<TFieldValues>>(props: Omit<FormFieldProps<TFieldValues, TName>, "control">) => React.ReactElement;
405
+ /** Submit button — works inside the `<form>` AND outside it (a Dialog footer),
406
+ * because the instance it came from owns the element through its id. */
407
+ Submit: (props: Omit<FormSubmitProps<TFieldValues>, "form">) => React.ReactElement;
408
+ displayName?: string;
409
+ }
410
+
411
+ interface UseFormOptions<TFieldValues extends FieldValues> extends Omit<UseFormProps<TFieldValues, unknown, TFieldValues>, "resolver" | "defaultValues" | "values" | "shouldFocusError"> {
412
+ /** Initial values — and the single source of the form's TYPE (no `z.infer`).
413
+ * Must contain every key: `undefined` never belongs in form values (§5). */
414
+ defaultValues: TFieldValues;
415
+ /** Server-provided values that arrive after mount; RHF re-syncs when they change. */
416
+ values?: TFieldValues;
417
+ /** Called with validated (and trimmed) values. The 2nd argument is the form itself. */
418
+ onSubmit?: (values: TFieldValues, form: JzForm<TFieldValues>) => void | Promise<void>;
419
+ /** Called after a failed submit, once focus has moved to the first invalid control. */
420
+ onInvalid?: (errors: FieldErrors<TFieldValues>, form: JzForm<TFieldValues>) => void;
421
+ }
422
+ /** RHF's form object plus the actions we own. `handleSubmit` is intentionally not
423
+ * in the type — `<Form>` calls it, and `submit()` is the programmatic door.
424
+ *
425
+ * `register` / `unregister` are omitted for a different reason: they are not
426
+ * redundant, they are WRONG here. The resolver reads exactly one source — the
427
+ * `FieldRegistry` that every mounted control publishes its `validate` bag into
428
+ * (see the resolver below) — so a hand-`register`ed input never enters it and
429
+ * is validated by nothing at all, with no error and no warning. That is the
430
+ * silently-absorbed case the house rules forbid, and a type is the only place
431
+ * it can be caught. Bound controls (`<Form.Input>`) and `<Form.Field>` are the
432
+ * two supported ways to attach a control, and both register properly.
433
+ *
434
+ * Everything else RHF returns stays: `watch`, `setFocus`, `resetField`,
435
+ * `subscribe`, `getFieldState` are merely redundant or slower than the house
436
+ * pattern (`useWatch` over `watch`), not incorrect — and docs/form-api-v2.md
437
+ * §4 promises them. Steer with docs; reserve the type for what breaks. */
438
+ interface JzForm<TFieldValues extends FieldValues = FieldValues> extends Omit<UseFormReturn<TFieldValues>, "handleSubmit" | "setError" | "reset" | "register" | "unregister"> {
439
+ /** A message string is enough — no `{ type, message }` ceremony. */
440
+ setError: (name: FieldPath<TFieldValues> | "root", error: string | ErrorOption) => void;
441
+ /** Form-level error → the banner `<Form>` renders for you. */
442
+ setFormError: (message: string) => void;
443
+ /** Only the fields the user actually changed — for PATCH-shaped APIs. */
444
+ dirtyValues: () => Partial<TFieldValues>;
445
+ /** Submit from anywhere (a button outside the `<form>`, a shortcut, a test). */
446
+ submit: () => void;
447
+ /** Validate the whole form, or just some fields (per-step gating). */
448
+ validate: (names?: FieldPath<TFieldValues> | FieldPath<TFieldValues>[]) => Promise<boolean>;
449
+ reset: UseFormReturn<TFieldValues>["reset"];
450
+ /** @internal wiring for `<Form>` / `Form.Submit` / `Form.Array`. */
451
+ __jz: JzInternals<TFieldValues>;
452
+ }
453
+ interface JzInternals<TFieldValues extends FieldValues> {
454
+ /** The raw RHF object. `<Form>` spreads THIS into `FormProvider`: our wrapper
455
+ * inherits RHF's members through the prototype chain, and a spread only copies
456
+ * own properties — so spreading the wrapper would hand the provider an empty
457
+ * shell (no `control`, no `register`). */
458
+ rhf: UseFormReturn<TFieldValues>;
459
+ /** Every mounted control's rules, keyed by field name. */
460
+ registry: FieldRegistry<TFieldValues>;
461
+ /** Stable id — lets a submit button outside the `<form>` own it via `form={id}`. */
462
+ formId: string;
463
+ /** The rendered `<form>` element, for the focus-first-invalid pass. */
464
+ formRef: React.MutableRefObject<HTMLFormElement | null>;
465
+ /** The submit handler `<Form>` puts on the element. */
466
+ onSubmit: React.FormEventHandler<HTMLFormElement>;
467
+ /** How many `<Form>` elements currently render this instance. More than one
468
+ * means a duplicated DOM id (the id is what lets an outside button own the
469
+ * form) — `<Form>` warns in dev. */
470
+ mounted: {
471
+ count: number;
472
+ };
473
+ }
474
+ /**
475
+ * What `useForm()` hands back, in `useState` order: the state/API object, then
476
+ * the `<Form>` that renders it.
477
+ *
478
+ * They are split because they are used in different places — `form.formState` /
479
+ * `form.reset()` in your component, `<Form>` (and `Form.Input`, `Form.Array`, …)
480
+ * in the tree — and because the SECOND slot is the type channel: reaching a
481
+ * control through it is what checks `name`, option values and array keys against
482
+ * this form's shape. A form that reads no state destructures `const [, Form] = …`.
483
+ */
484
+ type UseFormResult<TFieldValues extends FieldValues> = [form: JzForm<TFieldValues>, Form: BoundForm<TFieldValues>];
485
+ declare function useForm<TFieldValues extends FieldValues = FieldValues>(options: UseFormOptions<TFieldValues>): UseFormResult<TFieldValues>;
486
+
487
+ export { type AnyValidate, type ArrayValidate, type BooleanValidate, type BoundArray, type BoundForm, type BoundProps, type CheckResult, DEFAULT_MESSAGES, type DateBound, type DateValidate, type EnumValidate, type FieldFlatOptions, type FieldKind, type FieldOptions, type FileValidate, type FormArrayProps, type FormArrayRow, type FormFieldProps, type FormFieldRenderArgs, type FormMessage, FormMessages, type FormMessagesProps, type FormMessagesValue, type FormProps, type FormSubmitProps, type JzForm, type MessageCtx, type NumberValidate, type RuleName, type ScopedFields, type StringValidate, type UseFormOptions, type UseFormResult, useForm, useFormMessages };