@luscii-healthtech/web-ui 2.4.0 → 2.5.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.
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxGroupProps } from "./CheckboxList.types";
3
- export declare const CheckboxGroup: ({ title, items, onChange, className }: CheckboxGroupProps) => JSX.Element;
3
+ export declare const CheckboxGroup: ({ title, items, onChange, className, isCollapsed, }: CheckboxGroupProps) => JSX.Element;
@@ -13,6 +13,7 @@ export interface CheckboxGroupProps {
13
13
  items: CheckboxListItem[];
14
14
  onChange: (event: CheckboxChangeEvent) => void;
15
15
  className?: string;
16
+ isCollapsed?: boolean;
16
17
  }
17
18
  export interface CheckboxGroupItemProps {
18
19
  id: string;
@@ -30,6 +31,7 @@ export interface CheckboxListItem {
30
31
  export interface CheckboxGroup {
31
32
  title?: string;
32
33
  items: CheckboxListItem[];
34
+ isCollapsed?: boolean;
33
35
  }
34
36
  export interface CheckboxChangeEvent {
35
37
  id: string;
@@ -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
- * TODO: wrap this in some Page component to style the div and buttons
7
- * WARNING: don't use this component before some styling errors are resolved.
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, onValid, onError, defaultValues, }: FormProps<TFieldValues>): JSX.Element;
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 FormProps<TFieldValues extends FieldValues> {
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";