Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
chore: fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleyzissou authored and wtrocki committed May 6, 2021
1 parent ad89c2b commit 54fbe4e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
3 changes: 1 addition & 2 deletions src/AutoField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// import { Override, connectField, useField } from 'uniforms/es5';
import invariant from 'invariant';
import { createAutoField } from 'uniforms';
import { createAutoField } from 'uniforms/es5';

import BoolField from './BoolField';
import DateField from './DateField';
Expand Down
20 changes: 12 additions & 8 deletions src/RadioField.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import React from 'react';
import { Radio as RadioField, RadioProps } from '@patternfly/react-core';
import { connectField, filterDOMProps } from 'uniforms/es5';
import { connectField, filterDOMProps, HTMLFieldProps } from 'uniforms/es5';

import wrapField from './wrapField';

export type RadioFieldProps = {
transform?: (string?: string) => string;
allowedValues: string[];
onChange: (value: string) => void;
value?: string;
disabled: boolean;
} & Omit<RadioProps, 'isDisabled'>;
export type RadioFieldProps = HTMLFieldProps<
string,
HTMLDivElement,
{
transform?: (string?: string) => string;
allowedValues: string[];
onChange: (value: string) => void;
value?: string;
disabled: boolean;
}
>;

const Radio = (props: RadioFieldProps) => {
filterDOMProps.register('checkboxes', 'decimal');
Expand Down
48 changes: 28 additions & 20 deletions src/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
SelectVariant,
SelectOptionObject,
} from '@patternfly/react-core';
import { connectField, filterDOMProps } from 'uniforms/es5';
import { connectField, FieldProps, filterDOMProps } from 'uniforms/es5';

import wrapField from './wrapField';

Expand All @@ -23,14 +23,18 @@ function xor<T>(item: T, array: T[]) {
return array.slice(0, index).concat(array.slice(index + 1));
}

type CheckboxesProps = {
fieldType?: typeof Array | any;
onChange: (value?: string | string[]) => void;
transform?: (value?: string) => string;
allowedValues: string[];
id: string;
disabled?: boolean;
} & (Omit<CheckboxProps, 'isDisabled'> | Omit<RadioProps, 'isDisabled'>);
type CheckboxesProps = FieldProps<
string | string[],
CheckboxProps | RadioProps,
{
fieldType?: typeof Array | any;
onChange: (value?: string | string[]) => void;
transform?: (value?: string) => string;
allowedValues: string[];
id: string;
disabled?: boolean;
}
>;

filterDOMProps.register('autoValue');

Expand Down Expand Up @@ -74,17 +78,21 @@ function RenderCheckboxes(props: CheckboxesProps) {
);
}

type SelectInputProps = {
required?: boolean;
id: string;
fieldType?: typeof Array | any;
onChange: (value?: string | string[]) => void;
placeholder: string;
allowedValues?: string[];
disabled?: boolean;
error?: boolean;
transform?: (value?: string) => string;
} & Omit<SelectProps, 'isDisabled'>;
type SelectInputProps = FieldProps<
string | string[],
SelectProps,
{
required?: boolean;
id: string;
fieldType?: typeof Array | any;
onChange: (value?: string | string[]) => void;
placeholder: string;
allowedValues?: string[];
disabled?: boolean;
error?: boolean;
transform?: (value?: string) => string;
}
>;

function isSelectOptionObject(
toBeDetermined: string | SelectOptionObject
Expand Down

0 comments on commit 54fbe4e

Please sign in to comment.