@luscii-healthtech/web-ui 2.4.0 → 2.4.1
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/components/Form/Form.d.ts +15 -5
- package/dist/components/Form/form.types.d.ts +6 -2
- package/dist/index.d.ts +5 -2
- package/dist/web-ui.cjs.development.js +344 -319
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +341 -320
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Form/Form.tsx +100 -68
- package/src/components/Form/form.types.ts +8 -1
- package/src/index.tsx +8 -2
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FormProps } from "./form.types";
|
|
2
|
+
import { FormProps, GenericFormProps } from "./form.types";
|
|
3
3
|
/**
|
|
4
|
-
* Create a straight forward Form.
|
|
4
|
+
* Create a straight forward Form, which takes away the 'overhead' of react-hook-form.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* You will probably don't want to use this component for now, given that the button is hardcoded.
|
|
7
|
+
* This is an example for the Form for now, though it could be improved to enforce further unification.
|
|
8
|
+
*
|
|
9
|
+
* TODO: make the buttons configurable.
|
|
10
|
+
*/
|
|
11
|
+
export declare function GenericForm<TFieldValues>({ fields, onValid, onError, defaultValues, }: GenericFormProps<TFieldValues>): JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Form based on the fields input.
|
|
14
|
+
*
|
|
15
|
+
* Expects the results of the useForm hook to be injected into the useFormReturn parameter.
|
|
16
|
+
*
|
|
17
|
+
* This allows you to use and modify the useFormReturn before injecting it here.
|
|
8
18
|
*/
|
|
9
|
-
export declare function Form<TFieldValues>({ fields,
|
|
19
|
+
export declare function Form<TFieldValues, TContext>({ fields, useFormReturn, }: FormProps<TFieldValues, TContext>): JSX.Element;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { Control, DeepPartial, FieldErrors, FieldPath, FieldValues, RegisterOptions, SubmitErrorHandler, SubmitHandler } from "react-hook-form";
|
|
1
|
+
import { Control, DeepPartial, FieldErrors, FieldPath, FieldValues, RegisterOptions, SubmitErrorHandler, SubmitHandler, UseFormReturn } from "react-hook-form";
|
|
2
2
|
import React, { HTMLInputTypeAttribute } from "react";
|
|
3
3
|
import { InputProps } from "../Input/Input";
|
|
4
4
|
import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
|
|
5
5
|
import { SelectProps } from "../Select/SelectV2";
|
|
6
6
|
export declare type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
7
|
-
export interface
|
|
7
|
+
export interface GenericFormProps<TFieldValues extends FieldValues> {
|
|
8
8
|
fields: (FormFieldProps<TFieldValues> | FormFieldRowProps<TFieldValues>)[];
|
|
9
9
|
onValid: SubmitHandler<TFieldValues>;
|
|
10
10
|
onError?: SubmitErrorHandler<TFieldValues>;
|
|
11
11
|
defaultValues?: DeepPartial<TFieldValues>;
|
|
12
12
|
}
|
|
13
|
+
export interface FormProps<TFieldValues extends FieldValues, TContext> {
|
|
14
|
+
fields: (FormFieldProps<TFieldValues> | FormFieldRowProps<TFieldValues>)[];
|
|
15
|
+
useFormReturn: UseFormReturn<TFieldValues, TContext>;
|
|
16
|
+
}
|
|
13
17
|
interface FormFieldGenericProps<TFieldType, TFieldValues> extends FormFieldDecoratorProps {
|
|
14
18
|
name: FieldPath<TFieldValues>;
|
|
15
19
|
options?: RegisterOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -35,9 +35,12 @@ export { PageSize as PaginationMenuPageSize, OnPaginationChange as OnPaginationM
|
|
|
35
35
|
export { default as PreviewPhone } from "./components/PreviewPhone/PreviewPhone";
|
|
36
36
|
export { default as Radio } from "./components/Radio/Radio";
|
|
37
37
|
export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
|
|
38
|
+
export { RadioProps, RadioV2 } from "./components/Radio/RadioV2";
|
|
39
|
+
export { RadioGroupProps, RadioGroupV2, } from "./components/RadioGroup/RadioGroupV2";
|
|
38
40
|
export { default as Section } from "./components/Section/Section";
|
|
39
41
|
export { default as SectionItemWithContent } from "./components/Section/SectionItemWithContent";
|
|
40
42
|
export { default as SectionItem, SectionItemProps, } from "./components/Section/SectionItem";
|
|
43
|
+
export { SelectProps, Select } from "./components/Select/SelectV2";
|
|
41
44
|
export { SettingsMenuButton, SettingsMenuButtonProps, } from "./components/SettingsMenuButton/SettingsMenuButton";
|
|
42
45
|
export { Spinner } from "./components/Spinner/Spinner";
|
|
43
46
|
export { Steps } from "./components/Steps/Steps";
|
|
@@ -57,8 +60,8 @@ export { Timeline } from "./components/Timeline/Timeline";
|
|
|
57
60
|
export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
|
|
58
61
|
export { default as Text } from "./components/Text/Text";
|
|
59
62
|
export { SearchInput, SearchInputProps } from "./components/Input/SearchInput";
|
|
60
|
-
export { Form } from "./components/Form/Form";
|
|
61
|
-
export { FormProps } from "./components/Form/form.types";
|
|
63
|
+
export { GenericForm, Form } from "./components/Form/Form";
|
|
64
|
+
export { GenericFormProps, FormProps } from "./components/Form/form.types";
|
|
62
65
|
export { IconProps } from "./components/Icons/types/IconProps.type";
|
|
63
66
|
export { AddIcon } from "./components/Icons/AddIcon";
|
|
64
67
|
export { AlertsIcon } from "./components/Icons/AlertsIcon";
|