@luscii-healthtech/web-ui 2.48.1 → 2.49.0
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/ButtonV2/ButtonProps.type.d.ts +2 -2
- package/dist/components/ConfirmationDialog/ConfirmationDialogTitle.d.ts +1 -1
- package/dist/components/ConfirmationDialog/types/ConfirmationDialog.types.d.ts +2 -2
- package/dist/components/Form/Form.d.ts +12 -2
- package/dist/components/Form/FormFieldCheckbox.d.ts +7 -1
- package/dist/components/Form/FormFieldCheckboxList.d.ts +9 -0
- package/dist/components/Form/FormFieldLabeler.d.ts +7 -0
- package/dist/components/Form/FormImagePicker.d.ts +7 -1
- package/dist/components/Form/FormInput.d.ts +10 -2
- package/dist/components/Form/FormRadioGroup.d.ts +8 -1
- package/dist/components/Form/FormSelect.d.ts +8 -1
- package/dist/components/Form/form.types.d.ts +36 -45
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/web-ui.cjs.development.js +194 -72
- 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 +194 -72
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Form/FormFieldDecorator.d.ts +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { IconProps } from "../Icons/types/IconProps.type";
|
|
2
|
+
import type { IconKey, IconProps } from "../Icons/types/IconProps.type";
|
|
3
3
|
import { TextColor, TextHoverColor } from "../Text/Text";
|
|
4
4
|
/**
|
|
5
5
|
* Properties that are present in all variants of the button
|
|
@@ -8,7 +8,7 @@ import { TextColor, TextHoverColor } from "../Text/Text";
|
|
|
8
8
|
export interface BaseButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
9
9
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
10
|
text?: string;
|
|
11
|
-
icon?: React.FunctionComponent<IconProps
|
|
11
|
+
icon?: React.FunctionComponent<IconProps> | IconKey;
|
|
12
12
|
isDisabled?: boolean;
|
|
13
13
|
className?: string;
|
|
14
14
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ConfirmationDialogTitleProps } from "./types/ConfirmationDialog.types";
|
|
2
|
+
import type { ConfirmationDialogTitleProps } from "./types/ConfirmationDialog.types";
|
|
3
3
|
export declare const ConfirmationDialogTitle: React.FC<ConfirmationDialogTitleProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IconProps } from "../../Icons/types/IconProps.type";
|
|
2
|
+
import type { IconKey, IconProps } from "../../Icons/types/IconProps.type";
|
|
3
3
|
import type { NotificationBannerColor } from "../../NotificationBanner/NotificationBanner";
|
|
4
4
|
interface ConfirmationDialogTexts {
|
|
5
5
|
message: string | string[];
|
|
@@ -23,7 +23,7 @@ export interface ConfirmationDialogProps {
|
|
|
23
23
|
isProcessing?: boolean;
|
|
24
24
|
withTitle?: {
|
|
25
25
|
title: string;
|
|
26
|
-
icon?: React.FC<IconProps
|
|
26
|
+
icon?: React.FC<IconProps> | IconKey;
|
|
27
27
|
};
|
|
28
28
|
choices?: {
|
|
29
29
|
defaultChoice?: ConfirmationDialogChoice["value"];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { type FieldValues } from "react-hook-form/dist/index.ie11";
|
|
2
|
-
import {
|
|
1
|
+
import { type FieldValues, type UseFormMethods as UseFormReturn, DeepPartial, SubmitErrorHandler, SubmitHandler, UnpackNestedValue } from "react-hook-form/dist/index.ie11";
|
|
2
|
+
import { FormFieldConfiguration } from "./form.types";
|
|
3
|
+
export interface GenericFormProps<TFieldValues extends FieldValues> {
|
|
4
|
+
fields: FormFieldConfiguration<TFieldValues>[];
|
|
5
|
+
onValid: SubmitHandler<TFieldValues>;
|
|
6
|
+
onError?: SubmitErrorHandler<TFieldValues>;
|
|
7
|
+
defaultValues?: UnpackNestedValue<DeepPartial<TFieldValues>>;
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Create a straight forward Form, which takes away the 'overhead' of react-hook-form.
|
|
5
11
|
*
|
|
@@ -9,6 +15,10 @@ import { FormProps, GenericFormProps } from "./form.types";
|
|
|
9
15
|
* TODO: make the buttons configurable.
|
|
10
16
|
*/
|
|
11
17
|
export declare function GenericForm<TFieldValues extends FieldValues>({ fields, onValid, onError, defaultValues, }: GenericFormProps<TFieldValues>): JSX.Element;
|
|
18
|
+
export interface FormProps<TFieldValues extends FieldValues> {
|
|
19
|
+
fields: FormFieldConfiguration<TFieldValues>[];
|
|
20
|
+
useFormReturn: UseFormReturn<TFieldValues>;
|
|
21
|
+
}
|
|
12
22
|
/**
|
|
13
23
|
* Creates a Form based on the fields input.
|
|
14
24
|
*
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { FieldCheckboxConfiguration, FormFieldLabelerWithFormProps } from "./form.types";
|
|
4
|
+
interface FormCheckboxProps extends FieldCheckboxConfiguration, FormFieldLabelerWithFormProps {
|
|
5
|
+
control: Control;
|
|
6
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
7
|
+
}
|
|
3
8
|
export declare const FormFieldCheckbox: React.ForwardRefExoticComponent<FormCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { FieldCheckboxListConfiguration, FormFieldLabelerWithFormProps } from "./form.types";
|
|
4
|
+
interface FormCheckboxListProps extends FieldCheckboxListConfiguration, FormFieldLabelerWithFormProps {
|
|
5
|
+
control: Control;
|
|
6
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
7
|
+
}
|
|
8
|
+
export declare const FormFieldCheckboxList: React.FC<FormCheckboxListProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormFieldLabelerWithFormProps } from "./form.types";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for any input component. Adds a label and additional information to be shown.
|
|
4
|
+
*
|
|
5
|
+
* Includes the default error handling from react-hook-form.
|
|
6
|
+
*/
|
|
7
|
+
export declare function FormFieldLabeler({ name, children, label, fieldRequired, info, fieldErrors, decoratorClassname, }: FormFieldLabelerWithFormProps): JSX.Element;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { ImagePickerFieldConfiguration, FormFieldLabelerWithFormProps } from "./form.types";
|
|
4
|
+
interface FormImagePickerProps extends ImagePickerFieldConfiguration, FormFieldLabelerWithFormProps {
|
|
5
|
+
control: Control;
|
|
6
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
7
|
+
}
|
|
3
8
|
export declare const FormImagePicker: React.ForwardRefExoticComponent<FormImagePickerProps & React.RefAttributes<any>>;
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { HTMLInputTypeAttribute } from "react";
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { InputProps } from "../Input/Input";
|
|
4
|
+
import { FormFieldLabelerWithFormProps } from "./form.types";
|
|
5
|
+
interface FormInputProps extends Omit<InputProps, "name">, FormFieldLabelerWithFormProps {
|
|
6
|
+
control: Control;
|
|
7
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
8
|
+
type: Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Input field that can be used in any react-hook-form context.
|
|
5
12
|
*/
|
|
6
13
|
export declare const FormInput: React.ForwardRefExoticComponent<FormInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
|
|
4
|
+
import { FormFieldLabelerWithFormProps } from "./form.types";
|
|
5
|
+
interface FormRadioGroupProps extends Omit<RadioGroupProps, "name">, FormFieldLabelerWithFormProps {
|
|
6
|
+
control: Control;
|
|
7
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Radio Group that can be used in any react-hook-form context.
|
|
5
11
|
*/
|
|
6
12
|
export declare const FormRadioGroup: React.ForwardRefExoticComponent<FormRadioGroupProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Control, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
3
|
+
import { SelectProps } from "../Select/Select";
|
|
4
|
+
import { FormFieldLabelerWithFormProps } from "./form.types";
|
|
5
|
+
interface FormSelectProps extends Omit<SelectProps, "name">, FormFieldLabelerWithFormProps {
|
|
6
|
+
control: Control;
|
|
7
|
+
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
8
|
+
}
|
|
3
9
|
export declare const FormSelect: React.ForwardRefExoticComponent<FormSelectProps & React.RefAttributes<any>>;
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldErrors, FieldName, FieldValues, RegisterOptions } from "react-hook-form/dist/index.ie11";
|
|
2
2
|
import React, { HTMLInputTypeAttribute } from "react";
|
|
3
3
|
import { InputProps } from "../Input/Input";
|
|
4
4
|
import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
|
|
@@ -6,78 +6,69 @@ import { SelectProps } from "../Select/Select";
|
|
|
6
6
|
import { ImagePickerProps } from "../ImagePicker/ImagePicker";
|
|
7
7
|
import { PartialProperties } from "../../types/general.types";
|
|
8
8
|
import { CheckboxProps } from "../Checkbox/Checkbox";
|
|
9
|
+
import { CheckboxListProps } from "../CheckboxList/CheckboxList.types";
|
|
9
10
|
export declare type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
10
11
|
export declare type FormFieldWidth = "sm" | "md" | "lg" | "xl" | "full";
|
|
11
|
-
|
|
12
|
-
fields: FormFieldProps<TFieldValues>[];
|
|
13
|
-
onValid: SubmitHandler<TFieldValues>;
|
|
14
|
-
onError?: SubmitErrorHandler<TFieldValues>;
|
|
15
|
-
defaultValues?: UnpackNestedValue<DeepPartial<TFieldValues>>;
|
|
16
|
-
}
|
|
17
|
-
export interface FormProps<TFieldValues extends FieldValues> {
|
|
18
|
-
fields: FormFieldProps<TFieldValues>[];
|
|
19
|
-
useFormReturn: UseFormReturn<TFieldValues>;
|
|
20
|
-
}
|
|
21
|
-
interface FormFieldGenericProps<TFieldType> extends FormFieldDecoratorProps {
|
|
12
|
+
interface FormFieldBaseConfiguration<TFieldType> extends FormFieldLabelerProps {
|
|
22
13
|
name: FieldName<FieldValues>;
|
|
23
14
|
options?: RegisterOptions;
|
|
24
15
|
fieldProps?: TFieldType;
|
|
25
16
|
}
|
|
26
|
-
export interface
|
|
17
|
+
export interface FormFieldLabelerProps {
|
|
27
18
|
label?: string;
|
|
28
19
|
info?: string;
|
|
20
|
+
/**
|
|
21
|
+
* allow for custom styling of the labeler component
|
|
22
|
+
*/
|
|
29
23
|
decoratorClassname?: string;
|
|
30
24
|
}
|
|
31
|
-
export declare type
|
|
32
|
-
|
|
25
|
+
export declare type FormFieldConfiguration<TFieldValues> = FieldInputConfiguration | FieldSelectConfiguration | FieldImagePickerConfiguration | FieldRadioGroupConfiguration | FieldRowConfiguration<TFieldValues> | FieldCheckboxConfiguration | FieldCheckboxListConfiguration;
|
|
26
|
+
/**
|
|
27
|
+
* @backwardscompatibility
|
|
28
|
+
* @deprecated - this is an alias for `FormFieldConfiguration`, for backwards compatibility the name can remain for now, but
|
|
29
|
+
* import `FormFieldConfiguration` whenever you need this type in the future.
|
|
30
|
+
*/
|
|
31
|
+
export declare type FormFieldProps<TFieldValues> = FormFieldConfiguration<TFieldValues>;
|
|
32
|
+
export interface FieldRowConfiguration<TFieldValues> extends Record<keyof FormFieldBaseConfiguration<never>, never> {
|
|
33
33
|
type: "row";
|
|
34
34
|
key: string;
|
|
35
|
-
fields:
|
|
35
|
+
fields: FormFieldConfiguration<TFieldValues>[];
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
37
|
+
export interface FieldInputConfiguration extends FormFieldBaseConfiguration<Omit<InputProps, "name">> {
|
|
38
38
|
type: AllowedTextInputTypes;
|
|
39
39
|
}
|
|
40
|
-
export interface
|
|
40
|
+
export interface FieldRadioGroupConfiguration extends FormFieldBaseConfiguration<Omit<RadioGroupProps, "name">> {
|
|
41
41
|
type: "radioGroup";
|
|
42
42
|
}
|
|
43
|
-
export interface
|
|
43
|
+
export interface FieldSelectConfiguration extends FormFieldBaseConfiguration<SelectProps> {
|
|
44
44
|
type: "select";
|
|
45
45
|
fieldProps: SelectProps;
|
|
46
46
|
}
|
|
47
|
-
declare type
|
|
48
|
-
export interface
|
|
47
|
+
export declare type ImagePickerFieldConfiguration = PartialProperties<Omit<ImagePickerProps, "name">, "handleChange">;
|
|
48
|
+
export interface FieldImagePickerConfiguration extends FormFieldBaseConfiguration<ImagePickerFieldConfiguration> {
|
|
49
49
|
type: "imagePicker";
|
|
50
|
-
fieldProps:
|
|
50
|
+
fieldProps: ImagePickerFieldConfiguration;
|
|
51
51
|
}
|
|
52
|
-
export interface
|
|
52
|
+
export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<Omit<CheckboxProps, "name" | "type">> {
|
|
53
53
|
type: "checkbox";
|
|
54
54
|
variant?: CheckboxProps["type"];
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Omiting `groups` and `onChange` here because these will be handled by
|
|
58
|
+
* the `Control` component from react-hook-form.
|
|
59
|
+
*/
|
|
60
|
+
export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<Omit<CheckboxListProps, "groups" | "onChange">> {
|
|
61
|
+
type: "checkboxlist";
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This type is the base for every form field component wrapped in the `FormFieldLabeler` and `Control` from `react-form-hook`.
|
|
65
|
+
* This is your baseline for creating a new form field type. For reference, look at FormInput.tsx.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export interface FormFieldLabelerWithFormProps extends FormFieldLabelerProps {
|
|
57
69
|
name: string;
|
|
58
70
|
fieldErrors: FieldErrors;
|
|
59
71
|
fieldRequired: boolean;
|
|
60
72
|
children?: React.ReactNode;
|
|
61
73
|
}
|
|
62
|
-
export interface FormInputProps extends Omit<InputProps, "name">, FormFieldDecoratorWithGeneratedProps {
|
|
63
|
-
control: Control;
|
|
64
|
-
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
65
|
-
type: Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
66
|
-
}
|
|
67
|
-
export interface FormRadioGroupProps extends Omit<RadioGroupProps, "name">, FormFieldDecoratorWithGeneratedProps {
|
|
68
|
-
control: Control;
|
|
69
|
-
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
70
|
-
}
|
|
71
|
-
export interface FormSelectProps extends Omit<SelectProps, "name">, FormFieldDecoratorWithGeneratedProps {
|
|
72
|
-
control: Control;
|
|
73
|
-
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
74
|
-
}
|
|
75
|
-
export interface FormImagePickerProps extends ImagePickerFieldProps, FormFieldDecoratorWithGeneratedProps {
|
|
76
|
-
control: Control;
|
|
77
|
-
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
78
|
-
}
|
|
79
|
-
export interface FormCheckboxProps extends FormFieldCheckboxBaseProps, FormFieldDecoratorWithGeneratedProps {
|
|
80
|
-
control: Control;
|
|
81
|
-
rules?: Exclude<RegisterOptions, "valueAsNumber" | "valueAsDate" | "setValueAs">;
|
|
82
|
-
}
|
|
83
74
|
export {};
|
|
@@ -3,4 +3,11 @@ import { IconProps, IconKey } from "../Icons/types/IconProps.type";
|
|
|
3
3
|
export declare const Icon: React.FC<{
|
|
4
4
|
name: IconKey;
|
|
5
5
|
} & IconProps>;
|
|
6
|
+
/**
|
|
7
|
+
* This is a temporary component to transition the way we pass icons to components.
|
|
8
|
+
* Once all components are passed an IconKey instead of a function component we can replace it with the Icon component.
|
|
9
|
+
*/
|
|
10
|
+
export declare const IconComponentOrKey: React.FC<{
|
|
11
|
+
name: React.FunctionComponent<IconProps> | IconKey;
|
|
12
|
+
} & IconProps>;
|
|
6
13
|
export default Icon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AllowedTextInputTypes } from "../Form/form.types";
|
|
3
|
-
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
import type { IconKey, IconProps } from "../Icons/types/IconProps.type";
|
|
4
4
|
import { FormFieldWidth } from "../Form/form.types";
|
|
5
5
|
import "./Input.css";
|
|
6
6
|
export declare const INPUT_TYPES: Record<string, AllowedTextInputTypes>;
|
|
@@ -27,7 +27,7 @@ export interface InputProps extends CustomHTMLInputProps {
|
|
|
27
27
|
isDisabled?: boolean;
|
|
28
28
|
withPrefix?: string;
|
|
29
29
|
withSuffix?: string;
|
|
30
|
-
icon?: React.
|
|
30
|
+
icon?: React.FC<IconProps> | IconKey;
|
|
31
31
|
width?: FormFieldWidth;
|
|
32
32
|
/**
|
|
33
33
|
* Check the `asFormField` prop of this component to understand why this signature.
|
package/dist/index.d.ts
CHANGED
|
@@ -71,8 +71,7 @@ export { Timeline } from "./components/Timeline/Timeline";
|
|
|
71
71
|
export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
|
|
72
72
|
export { default as Text } from "./components/Text/Text";
|
|
73
73
|
export { SearchInput, SearchInputProps } from "./components/Input/SearchInput";
|
|
74
|
-
export { GenericForm, Form } from "./components/Form/Form";
|
|
75
|
-
export { GenericFormProps, FormProps } from "./components/Form/form.types";
|
|
74
|
+
export { GenericForm, Form, FormProps, GenericFormProps, } from "./components/Form/Form";
|
|
76
75
|
export { Icon } from "./components/Icon";
|
|
77
76
|
export type { IconProps, IconKey, } from "./components/Icons/types/IconProps.type";
|
|
78
77
|
export * from "./components/Icons";
|