Skip to content

Commit

Permalink
Merge pull request #97 from moltco/text-area-input-props
Browse files Browse the repository at this point in the history
  • Loading branch information
vantezzen authored Sep 15, 2024
2 parents 0d22a48 + 85373bf commit 6957675
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/components/ui/auto-form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { INPUT_COMPONENTS } from "./config";

export type FieldConfigItem = {
description?: React.ReactNode;
inputProps?: React.InputHTMLAttributes<HTMLInputElement> & {
inputProps?: React.InputHTMLAttributes<HTMLInputElement> &
React.TextareaHTMLAttributes<HTMLTextAreaElement> &
{
showLabel?: boolean;
};
label?: string;
fieldType?:
| keyof typeof INPUT_COMPONENTS
| React.FC<AutoFormInputComponentProps>;
| keyof typeof INPUT_COMPONENTS
| React.FC<AutoFormInputComponentProps>;

renderParent?: (props: {
children: React.ReactNode;
Expand All @@ -20,8 +22,8 @@ export type FieldConfigItem = {
export type FieldConfig<SchemaType extends z.infer<z.ZodObject<any, any>>> = {
// If SchemaType.key is an object, create a nested FieldConfig, otherwise FieldConfigItem
[Key in keyof SchemaType]?: SchemaType[Key] extends object
? FieldConfig<z.infer<SchemaType[Key]>>
: FieldConfigItem;
? FieldConfig<z.infer<SchemaType[Key]>>
: FieldConfigItem;
};

export enum DependencyType {
Expand All @@ -41,9 +43,9 @@ type BaseDependency<SchemaType extends z.infer<z.ZodObject<any, any>>> = {
export type ValueDependency<SchemaType extends z.infer<z.ZodObject<any, any>>> =
BaseDependency<SchemaType> & {
type:
| DependencyType.DISABLES
| DependencyType.REQUIRES
| DependencyType.HIDES;
| DependencyType.DISABLES
| DependencyType.REQUIRES
| DependencyType.HIDES;
};

export type EnumValues = readonly [string, ...string[]];
Expand Down

0 comments on commit 6957675

Please sign in to comment.