@luscii-healthtech/web-ui 8.4.0 → 9.0.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, hasDividers, isCollapsed, collapsible, }: CheckboxGroupProps) => JSX.Element;
3
+ export declare const CheckboxGroup: ({ title, items, onChange, className, isCollapsed, collapsible, }: CheckboxGroupProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxListProps } from "./CheckboxList.types";
3
3
  export { CheckboxListProps };
4
- export declare const CheckboxList: ({ groups, onChange, className, hasDividers, }: CheckboxListProps) => JSX.Element;
4
+ export declare const CheckboxList: ({ groups, onChange, className, }: CheckboxListProps) => JSX.Element;
5
5
  export default CheckboxList;
@@ -29,10 +29,6 @@ export interface CheckboxListProps {
29
29
  */
30
30
  groups: CheckboxGroup[];
31
31
  onChange: (event: CheckboxChangeEvent) => void;
32
- /**
33
- * Renders dividers between each item, including groups and inside of groups.
34
- */
35
- hasDividers?: boolean;
36
32
  className?: string;
37
33
  }
38
34
  type WithCollapsible = {
@@ -45,7 +41,6 @@ type WithCollapsible = {
45
41
  };
46
42
  export type CheckboxGroupProps = CheckboxGroup & {
47
43
  onChange: (event: CheckboxChangeEvent) => void;
48
- hasDividers?: boolean;
49
44
  className?: string;
50
45
  } & WithCollapsible;
51
46
  export interface CheckboxGroupItemProps extends CheckboxListItem {
@@ -6,7 +6,6 @@ import { SelectProps } from "../Select/Select";
6
6
  import { ImagePickerProps } from "../MediaPicker/MediaPicker";
7
7
  import { PartialProperties } from "../../types/general.types";
8
8
  import { CheckboxProps } from "../Checkbox/Checkbox";
9
- import { CheckboxListProps } from "../CheckboxList/CheckboxList.types";
10
9
  import { TextareaProps } from "../Textarea/Textarea";
11
10
  import { TitleProps } from "../Title/Title";
12
11
  export type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
@@ -74,7 +73,9 @@ export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<O
74
73
  * Omiting `groups` and `onChange` here because these will be handled by
75
74
  * the `Control` component from react-hook-form.
76
75
  */
77
- export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<Pick<CheckboxListProps, "hasDividers" | "className">> {
76
+ export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<{
77
+ className?: string;
78
+ }> {
78
79
  type: "checkboxlist";
79
80
  }
80
81
  /**
@@ -1,4 +1,24 @@
1
1
  import React from "react";
2
- import { InputProps } from "./Input";
3
- export type SearchInputProps = Omit<InputProps, "icon" | "withSuffix" | "withPrefix" | "type" | "clearable">;
4
- export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
2
+ import Input from "./Input";
3
+ type InputProps = React.ComponentProps<typeof Input>;
4
+ export type SearchInputProps = Omit<InputProps, "icon" | "type" | "width" | "clearable" | "withSuffix" | "withPrefix" | "asFormField" | "isError"> & {
5
+ /**
6
+ * WARNING: Please note that this value is currently not passed on to the
7
+ * component. It's not deprecated, it will most likely be implemented correctly
8
+ * at a later stage.
9
+ */
10
+ width?: InputProps["width"];
11
+ /**
12
+ * @deprecated
13
+ * A search input should never be used in a form with multiple fields.
14
+ */
15
+ asFormField?: InputProps["asFormField"];
16
+ /**
17
+ * @deprecated
18
+ * A search input should never be in error state, because the
19
+ * user cannot do anything wrong when typing in this field.
20
+ */
21
+ isError?: InputProps["isError"];
22
+ };
23
+ export declare const SearchInput: React.ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
24
+ export {};
@@ -3545,7 +3545,7 @@ var CheckboxState;
3545
3545
  CheckboxState2["UNCHECKED"] = "unchecked";
3546
3546
  })(CheckboxState || (CheckboxState = {}));
3547
3547
 
3548
- const CheckboxGroup = ({ title, items, onChange, className, hasDividers = false, isCollapsed = true, collapsible = true }) => {
3548
+ const CheckboxGroup = ({ title, items, onChange, className, isCollapsed = true, collapsible = true }) => {
3549
3549
  const [groupCheckboxState, setGroupCheckboxState] = React.useState(CheckboxState.UNCHECKED);
3550
3550
  const [collapsed, setCollapsed] = React.useState(collapsible ? isCollapsed : false);
3551
3551
  const [isDisabled, setIsDisabled] = React.useState(false);
@@ -3586,20 +3586,13 @@ const CheckboxGroup = ({ title, items, onChange, className, hasDividers = false,
3586
3586
  };
3587
3587
  const checkedItemsCount = items === null || items === void 0 ? void 0 : items.filter((item) => item === null || item === void 0 ? void 0 : item.isChecked).length;
3588
3588
  const groupTitle = checkedItemsCount > 0 ? `${title} (${checkedItemsCount})` : title;
3589
- const itemClassName = hasDividers ? "ui-py-3 last:ui-border-b-0 ui-border-b ui-border-slate-200" : "ui-my-1";
3590
3589
  const CollapseStateChevron = collapsed ? ChevronRightIcon : ChevronDownIcon;
3591
3590
  return React__namespace.default.createElement(
3592
3591
  "div",
3593
- { className: classNames__default.default("ui-flex ui-flex-col ", className, {
3594
- "ui-border-b ui-border-slate-200 last:ui-border-b-0": hasDividers && isCollapsed,
3595
- "ui-border-b-0": hasDividers && !isCollapsed
3596
- }) },
3592
+ { className: classNames__default.default("ui-flex ui-flex-col ", className) },
3597
3593
  title && React__namespace.default.createElement(
3598
3594
  "div",
3599
- { className: classNames__default.default("ui-space-between ui-flex ui-w-full ui-flex-row ui-items-center", {
3600
- "ui-border-b ui-border-slate-200 ui-py-3": hasDividers,
3601
- "ui-my-1": !hasDividers
3602
- }, { "last:ui-border-b-0": hasDividers && isCollapsed }) },
3595
+ { className: classNames__default.default("ui-space-between ui-flex ui-w-full ui-flex-row ui-items-center", "ui-my-1") },
3603
3596
  React__namespace.default.createElement(
3604
3597
  "div",
3605
3598
  { className: "ui-mr-auto ui-flex ui-h-6 ui-cursor-pointer ui-flex-row ui-items-center ui-text-slate-300 ui-transition ui-duration-300 hover:ui-text-slate-500", onClick: handleGroupCollapse },
@@ -3615,17 +3608,16 @@ const CheckboxGroup = ({ title, items, onChange, className, hasDividers = false,
3615
3608
  !collapsed && items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className: classNames__default.default({
3616
3609
  "ui-ml-10": collapsible,
3617
3610
  "ui-ml-5": !collapsible
3618
- }, itemClassName) }))
3611
+ }, "ui-my-1") }))
3619
3612
  );
3620
3613
  };
3621
3614
 
3622
- const CheckboxList = ({ groups, onChange, className, hasDividers = false }) => {
3623
- const itemClassName = hasDividers ? "ui-py-3 ui-border-b ui-border-slate-200 last:ui-border-b-0" : "ui-my-1";
3624
- return React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-col", className) }, (groups === null || groups === void 0 ? void 0 : groups.length) > 0 && groups.map((group) => {
3615
+ const CheckboxList = ({ groups, onChange, className }) => {
3616
+ return React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-col", className) }, groups.map((group) => {
3625
3617
  if (group.title) {
3626
- return React__namespace.default.createElement(CheckboxGroup, { key: group.title, items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange, hasDividers });
3618
+ return React__namespace.default.createElement(CheckboxGroup, { key: group.title, items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange });
3627
3619
  } else {
3628
- return group.items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className: itemClassName }));
3620
+ return group.items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className: "ui-my-1" }));
3629
3621
  }
3630
3622
  }));
3631
3623
  };
@@ -5160,12 +5152,12 @@ const FormFieldCheckboxList = ({ control, name, rules, fieldErrors, fieldRequire
5160
5152
  FormFieldLabeler,
5161
5153
  { name, fieldErrors, fieldRequired, label, info, decoratorClassname },
5162
5154
  React__namespace.default.createElement(index_ie11.Controller, { name, control, rules, render: ({ onChange, value }) => {
5163
- const { className, hasDividers } = fieldProps;
5155
+ const { className } = fieldProps;
5164
5156
  const [checkboxListValues, setCheckboxListValues] = React.useState(value);
5165
5157
  React.useEffect(() => {
5166
5158
  setCheckboxListValues(value);
5167
5159
  }, [value]);
5168
- return React__namespace.default.createElement(CheckboxList, { groups: checkboxListValues, hasDividers, className, onChange: (event) => {
5160
+ return React__namespace.default.createElement(CheckboxList, { groups: checkboxListValues, className, onChange: (event) => {
5169
5161
  setCheckboxListValues((previousState) => {
5170
5162
  const newState = previousState.map((group) => {
5171
5163
  const newItems = group.items.map((item) => {