@luscii-healthtech/web-ui 2.48.2 → 2.49.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,5 +1,11 @@
1
- import { type FieldValues } from "react-hook-form/dist/index.ie11";
2
- import { FormProps, GenericFormProps } from "./form.types";
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 { FormCheckboxProps } from "./form.types";
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 { FormImagePickerProps } from "./form.types";
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 { FormInputProps } from "./form.types";
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 { FormRadioGroupProps } from "./form.types";
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 { FormSelectProps } from "./form.types";
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 { Control, DeepPartial, FieldErrors, FieldName, FieldValues, RegisterOptions, SubmitErrorHandler, SubmitHandler, UnpackNestedValue, UseFormMethods as UseFormReturn } from "react-hook-form/dist/index.ie11";
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
- export interface GenericFormProps<TFieldValues extends FieldValues> {
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 FormFieldDecoratorProps {
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 FormFieldProps<TFieldValues> = FormFieldInputProps | FormFieldSelectProps | FormFieldImagePickerProps | FormFieldRadioGroupProps | FormFieldRowProps<TFieldValues> | FormFieldCheckboxBaseProps;
32
- export interface FormFieldRowProps<TFieldValues> extends Record<keyof FormFieldGenericProps<never>, never> {
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: FormFieldProps<TFieldValues>[];
35
+ fields: FormFieldConfiguration<TFieldValues>[];
36
36
  }
37
- export interface FormFieldInputProps extends FormFieldGenericProps<Omit<InputProps, "name">> {
37
+ export interface FieldInputConfiguration extends FormFieldBaseConfiguration<Omit<InputProps, "name">> {
38
38
  type: AllowedTextInputTypes;
39
39
  }
40
- export interface FormFieldRadioGroupProps extends FormFieldGenericProps<Omit<RadioGroupProps, "name">> {
40
+ export interface FieldRadioGroupConfiguration extends FormFieldBaseConfiguration<Omit<RadioGroupProps, "name">> {
41
41
  type: "radioGroup";
42
42
  }
43
- export interface FormFieldSelectProps extends FormFieldGenericProps<SelectProps> {
43
+ export interface FieldSelectConfiguration extends FormFieldBaseConfiguration<SelectProps> {
44
44
  type: "select";
45
45
  fieldProps: SelectProps;
46
46
  }
47
- declare type ImagePickerFieldProps = PartialProperties<Omit<ImagePickerProps, "name">, "handleChange">;
48
- export interface FormFieldImagePickerProps extends FormFieldGenericProps<ImagePickerFieldProps> {
47
+ export declare type ImagePickerFieldConfiguration = PartialProperties<Omit<ImagePickerProps, "name">, "handleChange">;
48
+ export interface FieldImagePickerConfiguration extends FormFieldBaseConfiguration<ImagePickerFieldConfiguration> {
49
49
  type: "imagePicker";
50
- fieldProps: ImagePickerFieldProps;
50
+ fieldProps: ImagePickerFieldConfiguration;
51
51
  }
52
- export interface FormFieldCheckboxBaseProps extends FormFieldGenericProps<Omit<CheckboxProps, "name" | "type">> {
52
+ export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<Omit<CheckboxProps, "name" | "type">> {
53
53
  type: "checkbox";
54
54
  variant?: CheckboxProps["type"];
55
55
  }
56
- export interface FormFieldDecoratorWithGeneratedProps extends FormFieldDecoratorProps {
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 {};
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { DynamicIconProps } from "../Icons/DynamicIcon";
2
+ import { IconProps } from "../Icons/types/IconProps.type";
3
3
  export declare type NotificationBannerColor = "base" | "blue" | "red" | "green" | "amber";
4
4
  export interface NotificationBannerLinkProps {
5
5
  text: string;
@@ -21,7 +21,7 @@ export declare type NotificationBannerProps = (NotificationBannerPropsWithChildr
21
21
  /**
22
22
  * The icon can either be one of our icon components or an image url
23
23
  */
24
- icon?: DynamicIconProps["icon"];
24
+ icon?: string | React.FunctionComponent<IconProps>;
25
25
  className?: string;
26
26
  stretch?: boolean;
27
27
  /**
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";
@@ -3563,22 +3563,6 @@ var TextLink = function TextLink(props) {
3563
3563
  }, props.text);
3564
3564
  };
3565
3565
 
3566
- var DynamicIcon = function DynamicIcon(props) {
3567
- var icon = props.icon,
3568
- className = props.className;
3569
-
3570
- if (typeof icon === "string") {
3571
- return /*#__PURE__*/React__default.createElement("img", {
3572
- src: icon,
3573
- className: className
3574
- });
3575
- }
3576
-
3577
- return /*#__PURE__*/React__default.createElement(icon, {
3578
- className: className
3579
- });
3580
- };
3581
-
3582
3566
  var NotificationBanner = function NotificationBanner(props) {
3583
3567
  var _props$stretch = props.stretch,
3584
3568
  stretch = _props$stretch === void 0 ? true : _props$stretch,
@@ -3610,10 +3594,12 @@ var NotificationBanner = function NotificationBanner(props) {
3610
3594
  })
3611
3595
  }, /*#__PURE__*/React__default.createElement("div", {
3612
3596
  className: classes
3613
- }, props.icon && /*#__PURE__*/React__default.createElement(DynamicIcon, {
3614
- className: "w-6 h-6 mr-3",
3615
- icon: props.icon
3616
- }), /*#__PURE__*/React__default.createElement("div", {
3597
+ }, props.icon && (typeof props.icon === "function" ? /*#__PURE__*/React__default.createElement(props.icon, {
3598
+ className: "w-6 h-6 mr-3"
3599
+ }) : /*#__PURE__*/React__default.createElement("img", {
3600
+ src: props.icon,
3601
+ className: "w-6 h-6 mr-3"
3602
+ })), /*#__PURE__*/React__default.createElement("div", {
3617
3603
  className: "flex flex-col"
3618
3604
  }, props.children, (props.text || props.linkProps) && /*#__PURE__*/React__default.createElement("div", {
3619
3605
  className: "flex flex-row items-center"
@@ -7585,7 +7571,7 @@ var FormFieldErrorMessages = function FormFieldErrorMessages(props) {
7585
7571
  * Includes the default error handling from react-hook-form.
7586
7572
  */
7587
7573
 
7588
- function FormFieldDecorator(_ref) {
7574
+ function FormFieldLabeler(_ref) {
7589
7575
  var name = _ref.name,
7590
7576
  children = _ref.children,
7591
7577
  label = _ref.label,
@@ -7596,7 +7582,7 @@ function FormFieldDecorator(_ref) {
7596
7582
  return /*#__PURE__*/React__default.createElement("div", {
7597
7583
  className: classNames(decoratorClassname)
7598
7584
  }, label && /*#__PURE__*/React__default.createElement("label", {
7599
- className: "cweb-form-field-label block mb-1",
7585
+ className: "block mb-1 cweb-form-field-label",
7600
7586
  htmlFor: name,
7601
7587
  "data-is-required": fieldRequired
7602
7588
  }, /*#__PURE__*/React__default.createElement(Text, {
@@ -7639,7 +7625,7 @@ var FormInput = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef)
7639
7625
  decoratorClassname = _ref.decoratorClassname,
7640
7626
  fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$p);
7641
7627
 
7642
- return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
7628
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7643
7629
  name: name,
7644
7630
  fieldErrors: fieldErrors,
7645
7631
  fieldRequired: fieldRequired,
@@ -7676,7 +7662,7 @@ var FormRadioGroup = /*#__PURE__*/React__default.forwardRef(function (_ref, inne
7676
7662
  decoratorClassname = _ref.decoratorClassname,
7677
7663
  fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$q);
7678
7664
 
7679
- return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
7665
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7680
7666
  name: name,
7681
7667
  fieldErrors: fieldErrors,
7682
7668
  fieldRequired: fieldRequired,
@@ -7714,7 +7700,7 @@ var FormSelect = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef
7714
7700
  decoratorClassname = _ref.decoratorClassname,
7715
7701
  selectProps = _objectWithoutPropertiesLoose(_ref, _excluded$r);
7716
7702
 
7717
- return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
7703
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7718
7704
  name: name,
7719
7705
  fieldErrors: fieldErrors,
7720
7706
  fieldRequired: fieldRequired,
@@ -7747,7 +7733,7 @@ var FormImagePicker = /*#__PURE__*/React__default.forwardRef(function (_ref, inn
7747
7733
  decoratorClassname = _ref.decoratorClassname,
7748
7734
  fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
7749
7735
 
7750
- return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
7736
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7751
7737
  name: name,
7752
7738
  fieldErrors: fieldErrors,
7753
7739
  fieldRequired: fieldRequired,
@@ -7796,7 +7782,7 @@ var FormFieldCheckbox = /*#__PURE__*/React__default.forwardRef(function (_ref, i
7796
7782
  decoratorClassname = _ref.decoratorClassname,
7797
7783
  fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$t);
7798
7784
 
7799
- return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
7785
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7800
7786
  name: name,
7801
7787
  fieldErrors: fieldErrors,
7802
7788
  fieldRequired: fieldRequired,
@@ -7830,6 +7816,84 @@ var FormFieldCheckbox = /*#__PURE__*/React__default.forwardRef(function (_ref, i
7830
7816
  }));
7831
7817
  });
7832
7818
 
7819
+ var FormFieldCheckboxList = function FormFieldCheckboxList(_ref) {
7820
+ var control = _ref.control,
7821
+ name = _ref.name,
7822
+ rules = _ref.rules,
7823
+ fieldErrors = _ref.fieldErrors,
7824
+ fieldRequired = _ref.fieldRequired,
7825
+ label = _ref.label,
7826
+ info = _ref.info,
7827
+ decoratorClassname = _ref.decoratorClassname,
7828
+ _ref$fieldProps = _ref.fieldProps,
7829
+ fieldProps = _ref$fieldProps === void 0 ? {
7830
+ groups: [],
7831
+ onChange: function onChange() {
7832
+ return undefined;
7833
+ }
7834
+ } : _ref$fieldProps;
7835
+ return /*#__PURE__*/React__default.createElement(FormFieldLabeler, {
7836
+ name: name,
7837
+ fieldErrors: fieldErrors,
7838
+ fieldRequired: fieldRequired,
7839
+ label: label,
7840
+ info: info,
7841
+ decoratorClassname: decoratorClassname
7842
+ }, /*#__PURE__*/React__default.createElement(index_ie11.Controller, {
7843
+ name: name,
7844
+ control: control,
7845
+ rules: rules,
7846
+ render: function render(_ref2) {
7847
+ var _onChange = _ref2.onChange,
7848
+ value = _ref2.value;
7849
+ var className = fieldProps.className,
7850
+ hasDividers = fieldProps.hasDividers;
7851
+
7852
+ var _useState = React.useState(value),
7853
+ checkboxListValues = _useState[0],
7854
+ setCheckboxListValues = _useState[1];
7855
+
7856
+ React.useEffect(function () {
7857
+ setCheckboxListValues(value);
7858
+ }, [value]);
7859
+ return /*#__PURE__*/React__default.createElement(CheckboxList, {
7860
+ groups: checkboxListValues,
7861
+ hasDividers: hasDividers,
7862
+ className: className,
7863
+ onChange: function onChange(event) {
7864
+ /**
7865
+ * This needs to be asynchronously orchestrated
7866
+ * because the CheckboxList component triggers multiple onChange
7867
+ * events after each other when you click a group that checks/unchecks the items.
7868
+ *
7869
+ * By always relying on the previous state, React can make put all changes together in one go.
7870
+ */
7871
+ setCheckboxListValues(function (previousState) {
7872
+ var newState = previousState.map(function (group) {
7873
+ var newItems = group.items.map(function (item) {
7874
+ if (item.id === event.id) {
7875
+ return _extends({}, item, {
7876
+ isChecked: event.newCheckedValue
7877
+ });
7878
+ } else {
7879
+ return item;
7880
+ }
7881
+ });
7882
+ return _extends({}, group, {
7883
+ items: newItems
7884
+ });
7885
+ });
7886
+
7887
+ _onChange(newState);
7888
+
7889
+ return newState;
7890
+ });
7891
+ }
7892
+ });
7893
+ }
7894
+ }));
7895
+ };
7896
+
7833
7897
  /**
7834
7898
  * Create a straight forward Form, which takes away the 'overhead' of react-hook-form.
7835
7899
  *
@@ -7971,6 +8035,21 @@ function FormFieldMapper(formFieldProps, useFormReturn) {
7971
8035
  }));
7972
8036
  }
7973
8037
 
8038
+ case "checkboxlist":
8039
+ {
8040
+ return /*#__PURE__*/React__default.createElement(FormFieldCheckboxList, _extends({
8041
+ key: name
8042
+ }, decoratorProps, {
8043
+ fieldRequired: isRequired(options),
8044
+ fieldErrors: errors,
8045
+ type: "checkboxlist",
8046
+ name: name,
8047
+ rules: options,
8048
+ control: control,
8049
+ fieldProps: fieldProps
8050
+ }));
8051
+ }
8052
+
7974
8053
  default:
7975
8054
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
7976
8055
  }