@invana/forms 0.0.31 → 0.0.33
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.
- package/dist/index.cjs +467 -317
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -31
- package/dist/index.d.ts +74 -31
- package/dist/index.js +467 -317
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, ControllerProps, Control, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { FieldValues, FieldPath, ControllerProps, RegisterOptions, Control, UseFormReturn } from 'react-hook-form';
|
|
4
4
|
export { Control, DefaultValues, FieldValues, Mode, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
5
5
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
6
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -60,6 +60,17 @@ type ColorPreset = {
|
|
|
60
60
|
* component's variants and defaults to `secondary` (neutral grey). Use
|
|
61
61
|
* `default` for the solid accent ("on") pill.
|
|
62
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* One choice of a `select`, `radio` or multi-select `checkbox` field. A
|
|
65
|
+
* `description` is drawn as a muted line under a radio's label; `disabled`
|
|
66
|
+
* shows the choice but stops it being picked (radio and select).
|
|
67
|
+
*/
|
|
68
|
+
type FieldOption = {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
};
|
|
63
74
|
type FieldBadge = {
|
|
64
75
|
label: string;
|
|
65
76
|
variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'soft';
|
|
@@ -70,10 +81,16 @@ type FieldConfig = {
|
|
|
70
81
|
label?: string;
|
|
71
82
|
description?: string;
|
|
72
83
|
placeholder?: string;
|
|
73
|
-
options?:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
options?: FieldOption[];
|
|
85
|
+
/**
|
|
86
|
+
* Shows the field and its value but stops it being changed. The value is
|
|
87
|
+
* still submitted. A `color` or `icon` field dims its label only.
|
|
88
|
+
*/
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Bounds of a `number` field. With both, it is a slider beside its number;
|
|
92
|
+
* without, a typed number input that can carry a `unit` and an `aside`.
|
|
93
|
+
*/
|
|
77
94
|
min?: number;
|
|
78
95
|
max?: number;
|
|
79
96
|
step?: number;
|
|
@@ -102,6 +119,16 @@ type FieldConfig = {
|
|
|
102
119
|
defaultValue?: string | number | boolean | string[];
|
|
103
120
|
/** Number of visible rows for `textarea` fields. */
|
|
104
121
|
rows?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Unit drawn at the end of a `text` or `number` input — `%`, `d`, `kg/ha`.
|
|
124
|
+
* Display only; the value stays the bare number or text.
|
|
125
|
+
*/
|
|
126
|
+
unit?: string;
|
|
127
|
+
/**
|
|
128
|
+
* A short note drawn at the end of a `text` or `number` input, after the
|
|
129
|
+
* unit — `quoted 14 d` beside an observed lead time. Display only.
|
|
130
|
+
*/
|
|
131
|
+
aside?: string;
|
|
105
132
|
/**
|
|
106
133
|
* How many grid columns the field spans on `md+` screens. Defaults to `1`.
|
|
107
134
|
* The grid is two columns by default (see `ObjectField`'s `columns`), so
|
|
@@ -127,6 +154,11 @@ type FieldConfig = {
|
|
|
127
154
|
* "active" chip in an inspector row). See {@link FieldBadge}.
|
|
128
155
|
*/
|
|
129
156
|
badge?: FieldBadge;
|
|
157
|
+
/**
|
|
158
|
+
* Validation, as react-hook-form's rules — `validate: (v) => v > 0 || 'Must
|
|
159
|
+
* be above 0'`. The message shows under the field.
|
|
160
|
+
*/
|
|
161
|
+
rules?: Omit<RegisterOptions<FieldValues>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
130
162
|
};
|
|
131
163
|
type RowConfig = {
|
|
132
164
|
id: string;
|
|
@@ -150,8 +182,9 @@ type GroupConfig = {
|
|
|
150
182
|
/** Show the automatic field-count badge. Defaults to `true`. */
|
|
151
183
|
showCount?: boolean;
|
|
152
184
|
};
|
|
153
|
-
interface ObjectFieldProps {
|
|
154
|
-
control
|
|
185
|
+
interface ObjectFieldProps<T extends FieldValues = FieldValues> {
|
|
186
|
+
/** `form.control` of the consumer's `useForm`, typed or not. */
|
|
187
|
+
control: Control<T>;
|
|
155
188
|
name: string;
|
|
156
189
|
fields: FieldConfig[];
|
|
157
190
|
rowConfig?: RowConfig[];
|
|
@@ -166,6 +199,19 @@ interface ObjectFieldProps {
|
|
|
166
199
|
* Below `md` the grid always collapses to a single column.
|
|
167
200
|
*/
|
|
168
201
|
columns?: number;
|
|
202
|
+
/**
|
|
203
|
+
* What the columns answer to. `viewport` (the default) is the grid of a
|
|
204
|
+
* page: `columns` wide from `md` up. `container` is a form inside a card or
|
|
205
|
+
* a chat turn, which is narrow on any screen: two columns once the form
|
|
206
|
+
* itself is 280px wide, one below, and a lone last field takes the row.
|
|
207
|
+
*/
|
|
208
|
+
fit?: 'viewport' | 'container';
|
|
209
|
+
/**
|
|
210
|
+
* How a field's `group` is drawn. `accordion` (the default) folds each
|
|
211
|
+
* group under a header with its count — a settings panel. `section` sets
|
|
212
|
+
* each under a small caps label and keeps it open — a short form in a card.
|
|
213
|
+
*/
|
|
214
|
+
groupAs?: 'accordion' | 'section';
|
|
169
215
|
}
|
|
170
216
|
|
|
171
217
|
type AnyValue = any;
|
|
@@ -175,10 +221,9 @@ interface BaseFieldProps {
|
|
|
175
221
|
placeholder?: string;
|
|
176
222
|
value?: AnyValue;
|
|
177
223
|
onChange?: (value: AnyValue) => void;
|
|
178
|
-
options?:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}[];
|
|
224
|
+
options?: FieldOption[];
|
|
225
|
+
/** Shows the value but stops it being changed. */
|
|
226
|
+
disabled?: boolean;
|
|
182
227
|
min?: number;
|
|
183
228
|
max?: number;
|
|
184
229
|
step?: number;
|
|
@@ -194,6 +239,10 @@ interface BaseFieldProps {
|
|
|
194
239
|
orientation?: FieldOrientation;
|
|
195
240
|
/** Wrap a `switch` boolean in a bordered, padded box. Defaults to `false`. */
|
|
196
241
|
boxed?: boolean;
|
|
242
|
+
/** Unit at the end of a text or number input. */
|
|
243
|
+
unit?: string;
|
|
244
|
+
/** Note at the end of a text or number input, after the unit. */
|
|
245
|
+
aside?: string;
|
|
197
246
|
}
|
|
198
247
|
declare const InputField: React$1.FC<BaseFieldProps>;
|
|
199
248
|
declare const PasswordField: React$1.FC<BaseFieldProps>;
|
|
@@ -205,19 +254,7 @@ declare const CheckboxGroupField: React$1.FC<BaseFieldProps>;
|
|
|
205
254
|
declare const ColorField: React$1.FC<BaseFieldProps>;
|
|
206
255
|
declare const NumberField: React$1.FC<BaseFieldProps>;
|
|
207
256
|
declare const IconField: React$1.FC<BaseFieldProps>;
|
|
208
|
-
declare const
|
|
209
|
-
Input: React$1.FC<BaseFieldProps>;
|
|
210
|
-
Password: React$1.FC<BaseFieldProps>;
|
|
211
|
-
Textarea: React$1.FC<BaseFieldProps>;
|
|
212
|
-
Boolean: React$1.FC<BaseFieldProps>;
|
|
213
|
-
Radio: React$1.FC<BaseFieldProps>;
|
|
214
|
-
CheckboxGroup: React$1.FC<BaseFieldProps>;
|
|
215
|
-
Color: React$1.FC<BaseFieldProps>;
|
|
216
|
-
Number: React$1.FC<BaseFieldProps>;
|
|
217
|
-
Select: React$1.FC<BaseFieldProps>;
|
|
218
|
-
Icon: React$1.FC<BaseFieldProps>;
|
|
219
|
-
};
|
|
220
|
-
declare const ObjectField: React$1.FC<ObjectFieldProps>;
|
|
257
|
+
declare const ObjectField: <T extends FieldValues = FieldValues>({ control, name, fields, rowConfig, groupConfig, labelPosition, size, columns, fit, groupAs, }: ObjectFieldProps<T>) => React$1.JSX.Element;
|
|
221
258
|
interface FormFieldExtensions {
|
|
222
259
|
ObjectField: typeof ObjectField;
|
|
223
260
|
Input: typeof InputField;
|
|
@@ -285,6 +322,7 @@ interface SliderNumberProps {
|
|
|
285
322
|
min?: number;
|
|
286
323
|
max?: number;
|
|
287
324
|
step?: number;
|
|
325
|
+
disabled?: boolean;
|
|
288
326
|
className?: string;
|
|
289
327
|
}
|
|
290
328
|
declare const SliderNumber: React$1.FC<SliderNumberProps>;
|
|
@@ -300,13 +338,14 @@ interface IconInputProps {
|
|
|
300
338
|
declare const IconInput: React$1.FC<IconInputProps>;
|
|
301
339
|
|
|
302
340
|
/**
|
|
303
|
-
* `sm` (26px) is the application field — a property
|
|
304
|
-
* form inside a 420px panel
|
|
341
|
+
* The control scale: `sm` (26px) is the application field — a property
|
|
342
|
+
* editor, a settings row, a form inside a 420px panel; `default` (32px) a
|
|
343
|
+
* standalone form or dialog; `lg` (40px) a form page.
|
|
305
344
|
*
|
|
306
345
|
* Named `inputSize` because `size` is already an `<input>` attribute meaning
|
|
307
346
|
* "how many characters wide", and shadowing it would silently drop that.
|
|
308
347
|
*/
|
|
309
|
-
type InputSize = "default" | "
|
|
348
|
+
type InputSize = "sm" | "default" | "lg";
|
|
310
349
|
declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.ClassAttributes<HTMLInputElement> & React$1.InputHTMLAttributes<HTMLInputElement> & {
|
|
311
350
|
inputSize?: InputSize;
|
|
312
351
|
}, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
@@ -332,8 +371,8 @@ declare const Select: React$1.FC<SelectPrimitive.SelectProps>;
|
|
|
332
371
|
declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
333
372
|
declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
334
373
|
declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
335
|
-
/** Matches `Input`'s `inputSize` — `sm`
|
|
336
|
-
triggerSize?: "default" | "
|
|
374
|
+
/** Matches `Input`'s `inputSize` — the control scale, `sm` 26 / `default` 32 / `lg` 40. */
|
|
375
|
+
triggerSize?: "sm" | "default" | "lg";
|
|
337
376
|
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
338
377
|
declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
339
378
|
declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -358,6 +397,10 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
|
|
|
358
397
|
variant?: "legend" | "label";
|
|
359
398
|
}): React$1.JSX.Element;
|
|
360
399
|
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
400
|
+
declare const fieldVariants: (props?: ({
|
|
401
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
402
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
403
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React$1.JSX.Element;
|
|
361
404
|
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
362
405
|
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React$1.JSX.Element;
|
|
363
406
|
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
@@ -428,7 +471,7 @@ interface ParamRowProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "on
|
|
|
428
471
|
*/
|
|
429
472
|
declare const ParamRow: React$1.ForwardRefExoticComponent<ParamRowProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
430
473
|
|
|
431
|
-
declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
474
|
+
declare function InputGroup({ className, id, "aria-describedby": describedBy, "aria-invalid": invalid, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
432
475
|
declare const inputGroupAddonVariants: (props?: ({
|
|
433
476
|
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
434
477
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -441,4 +484,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
|
|
|
441
484
|
declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
|
|
442
485
|
declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
|
|
443
486
|
|
|
444
|
-
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
487
|
+
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOption, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, ControllerProps, Control, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { FieldValues, FieldPath, ControllerProps, RegisterOptions, Control, UseFormReturn } from 'react-hook-form';
|
|
4
4
|
export { Control, DefaultValues, FieldValues, Mode, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
5
5
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
6
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -60,6 +60,17 @@ type ColorPreset = {
|
|
|
60
60
|
* component's variants and defaults to `secondary` (neutral grey). Use
|
|
61
61
|
* `default` for the solid accent ("on") pill.
|
|
62
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* One choice of a `select`, `radio` or multi-select `checkbox` field. A
|
|
65
|
+
* `description` is drawn as a muted line under a radio's label; `disabled`
|
|
66
|
+
* shows the choice but stops it being picked (radio and select).
|
|
67
|
+
*/
|
|
68
|
+
type FieldOption = {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
};
|
|
63
74
|
type FieldBadge = {
|
|
64
75
|
label: string;
|
|
65
76
|
variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'soft';
|
|
@@ -70,10 +81,16 @@ type FieldConfig = {
|
|
|
70
81
|
label?: string;
|
|
71
82
|
description?: string;
|
|
72
83
|
placeholder?: string;
|
|
73
|
-
options?:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
options?: FieldOption[];
|
|
85
|
+
/**
|
|
86
|
+
* Shows the field and its value but stops it being changed. The value is
|
|
87
|
+
* still submitted. A `color` or `icon` field dims its label only.
|
|
88
|
+
*/
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Bounds of a `number` field. With both, it is a slider beside its number;
|
|
92
|
+
* without, a typed number input that can carry a `unit` and an `aside`.
|
|
93
|
+
*/
|
|
77
94
|
min?: number;
|
|
78
95
|
max?: number;
|
|
79
96
|
step?: number;
|
|
@@ -102,6 +119,16 @@ type FieldConfig = {
|
|
|
102
119
|
defaultValue?: string | number | boolean | string[];
|
|
103
120
|
/** Number of visible rows for `textarea` fields. */
|
|
104
121
|
rows?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Unit drawn at the end of a `text` or `number` input — `%`, `d`, `kg/ha`.
|
|
124
|
+
* Display only; the value stays the bare number or text.
|
|
125
|
+
*/
|
|
126
|
+
unit?: string;
|
|
127
|
+
/**
|
|
128
|
+
* A short note drawn at the end of a `text` or `number` input, after the
|
|
129
|
+
* unit — `quoted 14 d` beside an observed lead time. Display only.
|
|
130
|
+
*/
|
|
131
|
+
aside?: string;
|
|
105
132
|
/**
|
|
106
133
|
* How many grid columns the field spans on `md+` screens. Defaults to `1`.
|
|
107
134
|
* The grid is two columns by default (see `ObjectField`'s `columns`), so
|
|
@@ -127,6 +154,11 @@ type FieldConfig = {
|
|
|
127
154
|
* "active" chip in an inspector row). See {@link FieldBadge}.
|
|
128
155
|
*/
|
|
129
156
|
badge?: FieldBadge;
|
|
157
|
+
/**
|
|
158
|
+
* Validation, as react-hook-form's rules — `validate: (v) => v > 0 || 'Must
|
|
159
|
+
* be above 0'`. The message shows under the field.
|
|
160
|
+
*/
|
|
161
|
+
rules?: Omit<RegisterOptions<FieldValues>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
130
162
|
};
|
|
131
163
|
type RowConfig = {
|
|
132
164
|
id: string;
|
|
@@ -150,8 +182,9 @@ type GroupConfig = {
|
|
|
150
182
|
/** Show the automatic field-count badge. Defaults to `true`. */
|
|
151
183
|
showCount?: boolean;
|
|
152
184
|
};
|
|
153
|
-
interface ObjectFieldProps {
|
|
154
|
-
control
|
|
185
|
+
interface ObjectFieldProps<T extends FieldValues = FieldValues> {
|
|
186
|
+
/** `form.control` of the consumer's `useForm`, typed or not. */
|
|
187
|
+
control: Control<T>;
|
|
155
188
|
name: string;
|
|
156
189
|
fields: FieldConfig[];
|
|
157
190
|
rowConfig?: RowConfig[];
|
|
@@ -166,6 +199,19 @@ interface ObjectFieldProps {
|
|
|
166
199
|
* Below `md` the grid always collapses to a single column.
|
|
167
200
|
*/
|
|
168
201
|
columns?: number;
|
|
202
|
+
/**
|
|
203
|
+
* What the columns answer to. `viewport` (the default) is the grid of a
|
|
204
|
+
* page: `columns` wide from `md` up. `container` is a form inside a card or
|
|
205
|
+
* a chat turn, which is narrow on any screen: two columns once the form
|
|
206
|
+
* itself is 280px wide, one below, and a lone last field takes the row.
|
|
207
|
+
*/
|
|
208
|
+
fit?: 'viewport' | 'container';
|
|
209
|
+
/**
|
|
210
|
+
* How a field's `group` is drawn. `accordion` (the default) folds each
|
|
211
|
+
* group under a header with its count — a settings panel. `section` sets
|
|
212
|
+
* each under a small caps label and keeps it open — a short form in a card.
|
|
213
|
+
*/
|
|
214
|
+
groupAs?: 'accordion' | 'section';
|
|
169
215
|
}
|
|
170
216
|
|
|
171
217
|
type AnyValue = any;
|
|
@@ -175,10 +221,9 @@ interface BaseFieldProps {
|
|
|
175
221
|
placeholder?: string;
|
|
176
222
|
value?: AnyValue;
|
|
177
223
|
onChange?: (value: AnyValue) => void;
|
|
178
|
-
options?:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}[];
|
|
224
|
+
options?: FieldOption[];
|
|
225
|
+
/** Shows the value but stops it being changed. */
|
|
226
|
+
disabled?: boolean;
|
|
182
227
|
min?: number;
|
|
183
228
|
max?: number;
|
|
184
229
|
step?: number;
|
|
@@ -194,6 +239,10 @@ interface BaseFieldProps {
|
|
|
194
239
|
orientation?: FieldOrientation;
|
|
195
240
|
/** Wrap a `switch` boolean in a bordered, padded box. Defaults to `false`. */
|
|
196
241
|
boxed?: boolean;
|
|
242
|
+
/** Unit at the end of a text or number input. */
|
|
243
|
+
unit?: string;
|
|
244
|
+
/** Note at the end of a text or number input, after the unit. */
|
|
245
|
+
aside?: string;
|
|
197
246
|
}
|
|
198
247
|
declare const InputField: React$1.FC<BaseFieldProps>;
|
|
199
248
|
declare const PasswordField: React$1.FC<BaseFieldProps>;
|
|
@@ -205,19 +254,7 @@ declare const CheckboxGroupField: React$1.FC<BaseFieldProps>;
|
|
|
205
254
|
declare const ColorField: React$1.FC<BaseFieldProps>;
|
|
206
255
|
declare const NumberField: React$1.FC<BaseFieldProps>;
|
|
207
256
|
declare const IconField: React$1.FC<BaseFieldProps>;
|
|
208
|
-
declare const
|
|
209
|
-
Input: React$1.FC<BaseFieldProps>;
|
|
210
|
-
Password: React$1.FC<BaseFieldProps>;
|
|
211
|
-
Textarea: React$1.FC<BaseFieldProps>;
|
|
212
|
-
Boolean: React$1.FC<BaseFieldProps>;
|
|
213
|
-
Radio: React$1.FC<BaseFieldProps>;
|
|
214
|
-
CheckboxGroup: React$1.FC<BaseFieldProps>;
|
|
215
|
-
Color: React$1.FC<BaseFieldProps>;
|
|
216
|
-
Number: React$1.FC<BaseFieldProps>;
|
|
217
|
-
Select: React$1.FC<BaseFieldProps>;
|
|
218
|
-
Icon: React$1.FC<BaseFieldProps>;
|
|
219
|
-
};
|
|
220
|
-
declare const ObjectField: React$1.FC<ObjectFieldProps>;
|
|
257
|
+
declare const ObjectField: <T extends FieldValues = FieldValues>({ control, name, fields, rowConfig, groupConfig, labelPosition, size, columns, fit, groupAs, }: ObjectFieldProps<T>) => React$1.JSX.Element;
|
|
221
258
|
interface FormFieldExtensions {
|
|
222
259
|
ObjectField: typeof ObjectField;
|
|
223
260
|
Input: typeof InputField;
|
|
@@ -285,6 +322,7 @@ interface SliderNumberProps {
|
|
|
285
322
|
min?: number;
|
|
286
323
|
max?: number;
|
|
287
324
|
step?: number;
|
|
325
|
+
disabled?: boolean;
|
|
288
326
|
className?: string;
|
|
289
327
|
}
|
|
290
328
|
declare const SliderNumber: React$1.FC<SliderNumberProps>;
|
|
@@ -300,13 +338,14 @@ interface IconInputProps {
|
|
|
300
338
|
declare const IconInput: React$1.FC<IconInputProps>;
|
|
301
339
|
|
|
302
340
|
/**
|
|
303
|
-
* `sm` (26px) is the application field — a property
|
|
304
|
-
* form inside a 420px panel
|
|
341
|
+
* The control scale: `sm` (26px) is the application field — a property
|
|
342
|
+
* editor, a settings row, a form inside a 420px panel; `default` (32px) a
|
|
343
|
+
* standalone form or dialog; `lg` (40px) a form page.
|
|
305
344
|
*
|
|
306
345
|
* Named `inputSize` because `size` is already an `<input>` attribute meaning
|
|
307
346
|
* "how many characters wide", and shadowing it would silently drop that.
|
|
308
347
|
*/
|
|
309
|
-
type InputSize = "default" | "
|
|
348
|
+
type InputSize = "sm" | "default" | "lg";
|
|
310
349
|
declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.ClassAttributes<HTMLInputElement> & React$1.InputHTMLAttributes<HTMLInputElement> & {
|
|
311
350
|
inputSize?: InputSize;
|
|
312
351
|
}, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
@@ -332,8 +371,8 @@ declare const Select: React$1.FC<SelectPrimitive.SelectProps>;
|
|
|
332
371
|
declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
333
372
|
declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
334
373
|
declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
335
|
-
/** Matches `Input`'s `inputSize` — `sm`
|
|
336
|
-
triggerSize?: "default" | "
|
|
374
|
+
/** Matches `Input`'s `inputSize` — the control scale, `sm` 26 / `default` 32 / `lg` 40. */
|
|
375
|
+
triggerSize?: "sm" | "default" | "lg";
|
|
337
376
|
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
338
377
|
declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
339
378
|
declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -358,6 +397,10 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
|
|
|
358
397
|
variant?: "legend" | "label";
|
|
359
398
|
}): React$1.JSX.Element;
|
|
360
399
|
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
400
|
+
declare const fieldVariants: (props?: ({
|
|
401
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
402
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
403
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React$1.JSX.Element;
|
|
361
404
|
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
362
405
|
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React$1.JSX.Element;
|
|
363
406
|
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
@@ -428,7 +471,7 @@ interface ParamRowProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "on
|
|
|
428
471
|
*/
|
|
429
472
|
declare const ParamRow: React$1.ForwardRefExoticComponent<ParamRowProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
430
473
|
|
|
431
|
-
declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
474
|
+
declare function InputGroup({ className, id, "aria-describedby": describedBy, "aria-invalid": invalid, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
432
475
|
declare const inputGroupAddonVariants: (props?: ({
|
|
433
476
|
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
434
477
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -441,4 +484,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
|
|
|
441
484
|
declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
|
|
442
485
|
declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
|
|
443
486
|
|
|
444
|
-
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
487
|
+
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOption, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|