@luscii-healthtech/web-ui 23.2.9 → 23.2.11

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,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  import { CheckboxGroupItemProps } from "../CheckboxList/CheckboxList.types";
3
3
  export type Item = {
4
4
  group?: string;
@@ -10,6 +10,7 @@ export interface Group {
10
10
  }
11
11
  interface CheckboxListModalTexts {
12
12
  title: string;
13
+ searchInputLabel?: string;
13
14
  confirmLabel: string;
14
15
  cancelLabel: string;
15
16
  searchPlaceHolder?: string;
@@ -17,6 +18,11 @@ interface CheckboxListModalTexts {
17
18
  }
18
19
  export interface CheckboxListModalProps {
19
20
  texts: CheckboxListModalTexts;
21
+ /**
22
+ * Accessory component to be rendered above the search input.
23
+ * For example, a button or any control that fit the use case.
24
+ */
25
+ accessory: React.ReactNode;
20
26
  initialItems: Array<Item>;
21
27
  isLoadingInitialItems?: boolean;
22
28
  isOpen: boolean;
@@ -26,5 +32,5 @@ export interface CheckboxListModalProps {
26
32
  className?: string;
27
33
  hasSearch: boolean;
28
34
  }
29
- export declare const CheckboxListModal: ({ texts, initialItems, isLoadingInitialItems, isOpen, onSave, onCloseClick, filterItem, hasSearch, }: CheckboxListModalProps) => JSX.Element;
35
+ export declare const CheckboxListModal: ({ texts, accessory, initialItems, isLoadingInitialItems, isOpen, onSave, onCloseClick, filterItem, hasSearch, }: CheckboxListModalProps) => JSX.Element;
30
36
  export {};
@@ -11,6 +11,10 @@ type HrProps = React.ComponentPropsWithoutRef<"hr"> & {
11
11
  * - Doesn't contain any logic about when it should be hidden.
12
12
  */
13
13
  version: "v2";
14
+ /**
15
+ * The color of the divider. Defaults to "border".
16
+ */
17
+ color?: "divider" | "border";
14
18
  };
15
19
  type Props = DividerProps | HrProps;
16
20
  export declare const Divider: React.FC<Props>;
@@ -3849,6 +3849,25 @@ const CheckboxList = ({ groups, onChange, className }) => {
3849
3849
  }));
3850
3850
  };
3851
3851
 
3852
+ const Divider = (props) => {
3853
+ if ("version" in props) {
3854
+ return React__namespace.default.createElement(HrDivider, Object.assign({}, props));
3855
+ }
3856
+ const { className, dark } = props, rest = __rest(props, ["className", "dark"]);
3857
+ const darkTheme = Boolean(dark);
3858
+ return React__namespace.default.createElement("div", Object.assign({ className: classNames__default.default("ui-border-color ui-block ui-w-full ui-border-b ui-border-solid last:ui-border-b-0", className, {
3859
+ "ui-border-color-divider": !darkTheme,
3860
+ "ui-border-slate-600": darkTheme
3861
+ }) }, rest));
3862
+ };
3863
+ function HrDivider(props) {
3864
+ const { className, color = "border" } = props;
3865
+ return React__namespace.default.createElement("hr", { className: classNames__default.default({
3866
+ "ui-border-color-divider": color === "divider",
3867
+ "ui-border-color-border": color === "border"
3868
+ }, className) });
3869
+ }
3870
+
3852
3871
  const transformToGroups = (items) => {
3853
3872
  const pinned = items.find((option) => option.isPinned);
3854
3873
  const itemsWithGroup = items.filter((option) => option.group);
@@ -3869,7 +3888,7 @@ const transformToGroups = (items) => {
3869
3888
  }
3870
3889
  return [...groups, restGroup];
3871
3890
  };
3872
- const CheckboxListModal = ({ texts, initialItems, isLoadingInitialItems, isOpen, onSave, onCloseClick, filterItem = () => true, hasSearch = false }) => {
3891
+ const CheckboxListModal = ({ texts, accessory, initialItems, isLoadingInitialItems, isOpen, onSave, onCloseClick, filterItem = () => true, hasSearch = false }) => {
3873
3892
  const [items, setItems] = React.useState([]);
3874
3893
  const [visibleItems, setVisibleItems] = React.useState([]);
3875
3894
  const [groups, setGroups] = React.useState([]);
@@ -3913,11 +3932,22 @@ const CheckboxListModal = ({ texts, initialItems, isLoadingInitialItems, isOpen,
3913
3932
  onClick: handleOnCloseClick
3914
3933
  }
3915
3934
  }, scrollableContent: true },
3935
+ accessory && React__namespace.createElement(
3936
+ "div",
3937
+ { className: "ui-mb-6 ui-flex ui-flex-col ui-space-y-6" },
3938
+ accessory,
3939
+ React__namespace.createElement(Divider, { version: "v2", color: "divider" })
3940
+ ),
3916
3941
  isLoadingInitialItems && React__namespace.createElement(LoadingIndicator, null),
3917
3942
  hasSearch && !isLoadingInitialItems && React__namespace.createElement(
3918
3943
  "div",
3919
3944
  { className: "ui-mb-2" },
3920
- React__namespace.createElement(SearchInput, { className: "ui-w-130", value: search, placeholder: texts.searchPlaceHolder, onChange: handleOnSearchChange })
3945
+ React__namespace.createElement(
3946
+ "label",
3947
+ { htmlFor: "checkbox-list-search", className: "ui-flex ui-flex-col ui-space-y-2" },
3948
+ texts.searchInputLabel && React__namespace.createElement(Text, { variant: "strong" }, texts.searchInputLabel),
3949
+ React__namespace.createElement(SearchInput, { id: "checkbox-list-search", width: "full", value: search, placeholder: texts.searchPlaceHolder, onChange: handleOnSearchChange })
3950
+ )
3921
3951
  ),
3922
3952
  !isLoadingInitialItems && (items === null || items === void 0 ? void 0 : items.length) > 0 && React__namespace.createElement(CheckboxList, { groups, onChange: handleOnItemChange }),
3923
3953
  !isLoadingInitialItems && (items === null || items === void 0 ? void 0 : items.length) === 0 && React__namespace.createElement(Text, { text: texts.emptyState })
@@ -3956,22 +3986,6 @@ const NavLayout = (props) => {
3956
3986
  );
3957
3987
  };
3958
3988
 
3959
- const Divider = (props) => {
3960
- if ("version" in props) {
3961
- return React__namespace.default.createElement(HrDivider, Object.assign({}, props));
3962
- }
3963
- const { className, dark } = props, rest = __rest(props, ["className", "dark"]);
3964
- const darkTheme = Boolean(dark);
3965
- return React__namespace.default.createElement("div", Object.assign({ className: classNames__default.default("ui-border-color ui-block ui-w-full ui-border-b ui-border-solid last:ui-border-b-0", className, {
3966
- "ui-border-color-divider": !darkTheme,
3967
- "ui-border-slate-600": darkTheme
3968
- }) }, rest));
3969
- };
3970
- function HrDivider(props) {
3971
- const { className } = props;
3972
- return React__namespace.default.createElement("hr", { className: classNames__default.default("ui-border-color-border", className) });
3973
- }
3974
-
3975
3989
  const NavMenuFooter = ({ text, subtext, visible = true }) => {
3976
3990
  if (!visible) {
3977
3991
  return null;