chore(form): 🗑️ remove unused form components and types
* Refactor Former components to streamline functionality * Update stories to reflect changes in form structure
This commit is contained in:
@@ -1,39 +1,39 @@
|
||||
import { TextInput } from '@mantine/core';
|
||||
import { Former } from '../Former';
|
||||
import { useUncontrolled } from '@mantine/hooks';
|
||||
|
||||
import { Controller } from 'react-hook-form';
|
||||
|
||||
import { Former } from '../Former';
|
||||
|
||||
export const ApiFormData = (props: {
|
||||
values?: Record<string, unknown>;
|
||||
onChange?: (values: Record<string, unknown>) => void;
|
||||
primeData?: Record<string, unknown>;
|
||||
values?: Record<string, unknown>;
|
||||
}) => {
|
||||
const [values, setValues] = useUncontrolled<Record<string, unknown>>({
|
||||
value: props.values,
|
||||
defaultValue: { url: '', authToken: '', ...props.primeData },
|
||||
finalValue: { url: '', authToken: '', ...props.primeData },
|
||||
defaultValue: { authToken: '', url: '', ...props.primeData },
|
||||
finalValue: { authToken: '', url: '', ...props.primeData },
|
||||
onChange: props.onChange,
|
||||
value: props.values,
|
||||
});
|
||||
|
||||
return (
|
||||
<Former
|
||||
disableHTMlForm
|
||||
id="api-form-data"
|
||||
layout={{ saveButtonTitle: 'Save URL Parameters' }}
|
||||
onChange={setValues}
|
||||
primeData={props.primeData}
|
||||
request="update"
|
||||
uniqueKeyField="id"
|
||||
disableHTMlForm
|
||||
primeData={props.primeData}
|
||||
values={values}
|
||||
onChange={setValues}
|
||||
layout={{ saveButtonTitle: 'Save URL Parameters' }}
|
||||
id="api-form-data"
|
||||
>
|
||||
<Controller
|
||||
name="url"
|
||||
render={({ field }) => <TextInput type="url" label="URL" {...field} />}
|
||||
render={({ field }) => <TextInput label="URL" type="url" {...field} />}
|
||||
/>
|
||||
<Controller
|
||||
name="authToken"
|
||||
render={({ field }) => <TextInput type="password" label="Auth Token" {...field} />}
|
||||
render={({ field }) => <TextInput label="Auth Token" type="password" {...field} />}
|
||||
/>
|
||||
</Former>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user