Skip to content

Commit

Permalink
fix: updates field description type to include react nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsfletch committed Nov 10, 2021
1 parent a7525e2 commit 291c193
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/admin/components/forms/FieldDescription/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';

export type DescriptionFunction = (value: unknown) => string

export type DescriptionComponent = React.ComponentType<{value: unknown}>
export type DescriptionComponent = React.ComponentType<{ value: unknown }>

type Description = string | DescriptionFunction | DescriptionComponent
export type Description = string | DescriptionFunction | DescriptionComponent

export type Props = {
description?: Description
Expand Down
3 changes: 2 additions & 1 deletion src/admin/components/forms/field-types/Array/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Data } from '../../Form/types';
import { ArrayField, Labels, Field, Description } from '../../../../../fields/config/types';
import { ArrayField, Labels, Field } from '../../../../../fields/config/types';
import { FieldTypes } from '..';
import { FieldPermissions } from '../../../../../auth/types';
import { Description } from '../../FieldDescription/types';

export type Props = Omit<ArrayField, 'type'> & {
path?: string
Expand Down
3 changes: 2 additions & 1 deletion src/admin/components/forms/field-types/Blocks/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Data } from '../../Form/types';
import { BlockField, Labels, Block, Description } from '../../../../../fields/config/types';
import { BlockField, Labels, Block } from '../../../../../fields/config/types';
import { FieldTypes } from '..';
import { FieldPermissions } from '../../../../../auth/types';
import { Description } from '../../FieldDescription/types';

export type Props = Omit<BlockField, 'type'> & {
path?: string
Expand Down
3 changes: 2 additions & 1 deletion src/admin/components/forms/field-types/Password/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Description, Validate } from '../../../../../fields/config/types';
import { Validate } from '../../../../../fields/config/types';
import { Description } from '../../FieldDescription/types';

export type Props = {
autoComplete?: string
Expand Down
35 changes: 17 additions & 18 deletions src/fields/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Editor } from 'slate';
import { PayloadRequest } from '../../express/types';
import { Document } from '../../types';
import { ConditionalDateProps } from '../../admin/components/elements/DatePicker/types';
import { Description } from '../../admin/components/forms/FieldDescription/types';

export type FieldHook = (args: {
value?: unknown,
Expand Down Expand Up @@ -40,8 +41,6 @@ type Admin = {
hidden?: boolean
}

export type Description = string | ((value: Record<string, unknown>) => string);

export type Labels = {
singular: string;
plural: string;
Expand Down Expand Up @@ -302,22 +301,22 @@ export type FieldAffectingData =
| PointField

export type NonPresentationalField = TextField
| NumberField
| EmailField
| TextareaField
| CheckboxField
| DateField
| BlockField
| GroupField
| RadioField
| RelationshipField
| ArrayField
| RichTextField
| SelectField
| UploadField
| CodeField
| PointField
| RowField;
| NumberField
| EmailField
| TextareaField
| CheckboxField
| DateField
| BlockField
| GroupField
| RadioField
| RelationshipField
| ArrayField
| RichTextField
| SelectField
| UploadField
| CodeField
| PointField
| RowField;

export type FieldWithPath = Field & {
path?: string
Expand Down

0 comments on commit 291c193

Please sign in to comment.