@luscii-healthtech/web-ui 38.4.2 → 38.4.4

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,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { BaseListItemProps, BaseListProps } from "./BaseList.types";
3
- declare const BaseListInner: <T extends BaseListItemProps>({ dataTestId, title, headerButton, emptyStateMessage, isLoading, items, headerTransparent, itemComponent, footer, withBorder, }: BaseListProps<T>, ref: React.ForwardedRef<HTMLUListElement>) => JSX.Element;
3
+ declare const BaseListInner: <T extends BaseListItemProps>({ dataTestId, title, headerButton, headerAccessory, emptyStateMessage, isLoading, items, headerTransparent, itemComponent, footer, withBorder, }: BaseListProps<T>, ref: React.ForwardedRef<HTMLUListElement>) => JSX.Element;
4
4
  export declare const BaseList: <T extends BaseListItemProps>(props: BaseListProps<T> & {
5
5
  ref?: React.ForwardedRef<HTMLUListElement>;
6
6
  }) => ReturnType<typeof BaseListInner>;
@@ -30,19 +30,34 @@ export type OnAssetLoadErrorPayload = Pick<BaseListItemProps, "itemId" | "subtit
30
30
  export interface BaseListProps<T extends BaseListItemProps = BaseListItemProps> {
31
31
  items: T[];
32
32
  title?: string | TitleProps;
33
+ /**
34
+ * @deprecated props accepting props from other components should accept components instead.
35
+ *
36
+ * Use `headerAccessory` instead.
37
+ */
33
38
  headerButton?: ButtonDefinition<PrimaryButtonProps>;
39
+ headerAccessory?: React.ReactNode;
34
40
  headerTransparent?: boolean;
35
41
  itemComponent?: React.FC<T>;
36
42
  emptyStateMessage?: string;
37
43
  isLoading?: boolean;
38
44
  dataTestId?: string;
39
45
  footer?: ReactNode;
46
+ /**
47
+ * This prop will surround the component with a 1px slate-300 border.
48
+ */
40
49
  withBorder?: boolean;
41
50
  ref?: Ref<HTMLUListElement>;
42
51
  }
43
52
  export type BaseListHeaderProps = {
44
53
  title?: string | TitleProps;
54
+ /**
55
+ * @deprecated props are accepting props from other components should accept components instead.
56
+ *
57
+ * Use `headerAccessory` instead.
58
+ */
45
59
  button?: ButtonDefinition<PrimaryButtonProps>;
60
+ headerAccessory?: React.ReactNode;
46
61
  transparent?: boolean;
47
62
  withBorder?: boolean;
48
63
  };
@@ -1675,31 +1675,32 @@ const ListSkeleton = ({ items, dataTestId = "list-skeleton" }) => {
1675
1675
  );
1676
1676
  };
1677
1677
 
1678
- const BaseListHeader = ({ title, button, transparent, withBorder }) => {
1679
- const className = classNames__default.default("ui-flex ui-rounded-t ui-flex-row ui-items-center ui-space-x-4", {
1680
- "ui-py-4": !button,
1681
- "ui-py-2": button,
1682
- "ui-bg-white ui-border-slate-200 ui-px-4": !transparent,
1683
- "ui-border-b": !transparent && !withBorder,
1684
- "ui-border ui-border-b-0": withBorder && !transparent,
1685
- "ui-mb-px": transparent,
1686
- "ui-justify-between": title && button,
1687
- "ui-justify-start": title && !button,
1688
- "ui-justify-end": !title && button
1689
- });
1678
+ const BaseListHeader = ({ title, button, headerAccessory, transparent, withBorder }) => {
1679
+ const hasHeaderComponent = Boolean(button || headerAccessory);
1690
1680
  return React__namespace.default.createElement(
1691
1681
  "div",
1692
- { "data-test-id": "base-list-header", className },
1682
+ { "data-test-id": "base-list-header", className: classNames__default.default("ui-flex ui-flex-row ui-items-center ui-space-x-4 ui-rounded-t-2xl", {
1683
+ "ui-py-4": !hasHeaderComponent,
1684
+ "ui-py-2": hasHeaderComponent,
1685
+ "ui-border-slate-300 ui-bg-white ui-px-4": !transparent,
1686
+ "ui-border-b ui-border-b-slate-200": !transparent && !withBorder,
1687
+ "ui-border ui-border-b-0": withBorder && !transparent,
1688
+ "ui-mb-px": transparent,
1689
+ "ui-justify-between": title && hasHeaderComponent,
1690
+ "ui-justify-start": title && !hasHeaderComponent,
1691
+ "ui-justify-end": !title && hasHeaderComponent
1692
+ }) },
1693
1693
  typeof title === "string" && React__namespace.default.createElement(Title, { variant: "xs", text: title }),
1694
1694
  title && typeof title === "object" && React__namespace.default.createElement(Title, Object.assign({ variant: "xs" }, title)),
1695
- button && React__namespace.default.createElement("div", { className: "ui-space-x-3" }, React__namespace.default.createElement(button.buttonType, button.buttonProps))
1695
+ button && React__namespace.default.createElement("div", { className: "ui-space-x-3" }, React__namespace.default.createElement(button.buttonType, button.buttonProps)),
1696
+ headerAccessory && React__namespace.default.createElement("div", { className: "ui-space-x-3" }, headerAccessory)
1696
1697
  );
1697
1698
  };
1698
1699
 
1699
1700
  const BaseListEmptyState = ({ message, roundTop, withBorder }) => {
1700
- const className = classNames__default.default("ui-p-4 ui-bg-white ui-rounded-b", {
1701
+ const className = classNames__default.default("ui-p-4 ui-bg-white ui-rounded-b-2xl", {
1701
1702
  "first:ui-rounded-t": roundTop,
1702
- "ui-border-slate-200 ui-border": withBorder
1703
+ "ui-border-slate-300 ui-border": withBorder
1703
1704
  });
1704
1705
  return React__namespace.default.createElement(
1705
1706
  "div",
@@ -1988,10 +1989,10 @@ function createAssetLoadError(payload, callback) {
1988
1989
  const BaseListItem = React__namespace.default.forwardRef(({ itemId, title, tooltipId, roundTop, roundBottom = true, isDraggable, isSelected, subtitle, accessories, onlyShowAccessoriesOnHover, icon, onClick, handleItemClick, onAssetLoadError, dataTestId, renderDragHandle, withBorder, htmlProps }, ref) => {
1989
1990
  const clickHandler = onClick !== null && onClick !== void 0 ? onClick : handleItemClick;
1990
1991
  const className = classNames__default.default("ui-group", "ui-flex ui-flex-row ui-items-center ui-space-x-4 ui-bg-white", "ui-px-4 ui-border-b ui-border-slate-200", {
1991
- "first:ui-rounded-t": roundTop,
1992
+ "first:ui-rounded-t-2xl": roundTop,
1993
+ "last:ui-rounded-b-2xl": roundBottom,
1992
1994
  "ui-cursor-pointer": clickHandler,
1993
1995
  "hover:ui-bg-blue-50 ui-transition-colors ui-ease-in-out ui-duration-300": clickHandler,
1994
- "last:ui-rounded-b ": roundBottom,
1995
1996
  "last:ui-border-b-0": !withBorder,
1996
1997
  "first:ui-border-t ui-border-l ui-border-r": withBorder
1997
1998
  });
@@ -2019,17 +2020,17 @@ const BaseListItem = React__namespace.default.forwardRef(({ itemId, title, toolt
2019
2020
  );
2020
2021
  });
2021
2022
 
2022
- const BaseListInner = ({ dataTestId, title, headerButton, emptyStateMessage, isLoading, items, headerTransparent, itemComponent, footer, withBorder = false }, ref) => {
2023
+ const BaseListInner = ({ dataTestId, title, headerButton, headerAccessory, emptyStateMessage, isLoading, items, headerTransparent, itemComponent, footer, withBorder = false }, ref) => {
2023
2024
  if (isLoading) {
2024
2025
  return React__namespace.default.createElement(ListSkeleton, { items: items.length });
2025
2026
  }
2026
- const hasHeader = Boolean(title || headerButton);
2027
+ const hasHeader = Boolean(title || headerButton || headerAccessory);
2027
2028
  const roundTop = Boolean(!hasHeader || hasHeader && headerTransparent);
2028
2029
  const roundBottom = footer === void 0 || footer === null;
2029
2030
  return React__namespace.default.createElement(
2030
2031
  "div",
2031
2032
  { "data-test-id": dataTestId || "base-list-component" },
2032
- hasHeader && React__namespace.default.createElement(BaseListHeader, { title, button: headerButton, transparent: headerTransparent, withBorder }),
2033
+ hasHeader && React__namespace.default.createElement(BaseListHeader, { title, button: headerButton, headerAccessory, transparent: headerTransparent, withBorder }),
2033
2034
  items.length > 0 ? React__namespace.default.createElement("ul", { ref }, items.map((props) => itemComponent ? React__namespace.default.createElement(itemComponent, Object.assign(Object.assign({ key: props.itemId }, props), {
2034
2035
  roundBottom,
2035
2036
  roundTop,
@@ -6756,43 +6757,42 @@ const FilterMenu = (props) => {
6756
6757
  React__namespace.default.createElement(
6757
6758
  react.Transition,
6758
6759
  { enter: "ui-transition ui-ease-out ui-duration-100", enterFrom: "ui-transform ui-opacity-0 ui-scale-95", enterTo: "ui-transform ui-opacity-100 ui-scale-100", leave: "ui-transition ui-ease-in ui-duration-75", leaveFrom: "ui-transform ui-opacity-100 ui-scale-100", leaveTo: "ui-transform ui-opacity-0 ui-scale-95" },
6759
- React__namespace.default.createElement(
6760
- react.PopoverPanel,
6761
- { className: classNames__default.default("ui-min-w-58", "ui-absolute ui-z-10 ui-mt-2", "ui-rounded-2xl ui-bg-white ui-shadow-2xl ui-ring-1 ui-ring-black ui-ring-opacity-5", "focus:ui-outline-none", "ui-border ui-border-neutral-border-high-contrast", {
6762
- // Align popover to the left side of the button label
6763
- "ui-left-4 ui-origin-top-left": alignPopover === "left",
6764
- // Align popover to the right side of the chevron icon
6765
- "ui-right-3 ui-origin-top-right": alignPopover === "right"
6766
- }) },
6767
- React__namespace.default.createElement("form", { className: "ui-max-h-120 ui-overflow-y-auto" }, categorizedFilter.options.map((option) => React__namespace.default.createElement(
6768
- "label",
6769
- { key: `${option.id}`, className: classNames__default.default("first-of-type:ui-rounded-t-2xl", "last-of-type:ui-rounded-b-2xl", "ui-flex ui-items-center ui-p-3", "ui-cursor-pointer", "ui-transition-colors ui-duration-300 ui-ease-in-out hover:ui-bg-primary-background"), htmlFor: `filter-${option.id}`, role: multiSelection ? "menuitemcheckbox" : "menuitem" },
6770
- React__namespace.default.createElement("input", { id: `filter-${option.id}`, name: `${option.value}`, defaultValue: option.value, type: "checkbox", defaultChecked: option.isChecked, onChange: () => {
6771
- props.onFilterOptionChange({
6772
- changedFilterOption: Object.assign(Object.assign({}, option), { isChecked: !option.isChecked })
6773
- });
6774
- }, className: classNames__default.default("ui-form-checkbox ui-h-4 ui-w-4 ui-rounded ui-border-slate-300 ui-text-primary focus:ui-ring-primary", {
6775
- "ui-hidden": singleSelection
6776
- }) }),
6777
- React__namespace.default.createElement(
6778
- "span",
6779
- { className: classNames__default.default({
6780
- "ui-pr-l": multiSelection,
6781
- "ui-ml-s": multiSelection
6782
- }) },
6783
- React__namespace.default.createElement(Text, { className: "ui-whitespace-nowrap ui-capitalize", variant: option.isChecked ? "strong" : "base" }, option.label)
6784
- ),
6785
- React__namespace.default.createElement(
6786
- "span",
6787
- { className: classNames__default.default("ui-ml-auto ui-pr-s", {
6788
- "ui-hidden": multiSelection,
6789
- "ui-text-primary": option.isChecked,
6790
- "ui-text-transparent": !option.isChecked
6791
- }) },
6792
- React__namespace.default.createElement(solid.CheckIcon, { className: "ui-ml-s ui-h-5 ui-w-5 ui-flex-shrink-0" })
6793
- )
6794
- )))
6795
- )
6760
+ React__namespace.default.createElement(react.PopoverPanel, { className: classNames__default.default("ui-min-w-58", "ui-absolute ui-z-10 ui-mt-2", "ui-rounded-2xl ui-bg-white ui-shadow-2xl ui-ring-1 ui-ring-black ui-ring-opacity-5", "focus:ui-outline-none", "ui-border ui-border-neutral-border-high-contrast", {
6761
+ // Align popover to the left side of the button label
6762
+ "ui-left-4 ui-origin-top-left": alignPopover === "left",
6763
+ // Align popover to the right side of the chevron icon
6764
+ "ui-right-3 ui-origin-top-right": alignPopover === "right"
6765
+ }) }, ({ close }) => React__namespace.default.createElement("form", { className: "ui-max-h-120 ui-overflow-y-auto" }, categorizedFilter.options.map((option) => React__namespace.default.createElement(
6766
+ "label",
6767
+ { key: `${option.id}`, className: classNames__default.default("first-of-type:ui-rounded-t-2xl", "last-of-type:ui-rounded-b-2xl", "ui-flex ui-items-center ui-p-3", "ui-cursor-pointer", "ui-transition-colors ui-duration-300 ui-ease-in-out hover:ui-bg-primary-background"), htmlFor: `filter-${option.id}`, role: multiSelection ? "menuitemcheckbox" : "menuitem" },
6768
+ React__namespace.default.createElement("input", { id: `filter-${option.id}`, name: `${option.value}`, defaultValue: option.value, type: "checkbox", defaultChecked: option.isChecked, onChange: () => {
6769
+ props.onFilterOptionChange({
6770
+ changedFilterOption: Object.assign(Object.assign({}, option), { isChecked: !option.isChecked })
6771
+ });
6772
+ if (singleSelection) {
6773
+ close();
6774
+ }
6775
+ }, className: classNames__default.default("ui-form-checkbox ui-h-4 ui-w-4 ui-rounded ui-border-slate-300 ui-text-primary focus:ui-ring-primary", {
6776
+ "ui-hidden": singleSelection
6777
+ }) }),
6778
+ React__namespace.default.createElement(
6779
+ "span",
6780
+ { className: classNames__default.default({
6781
+ "ui-pr-l": multiSelection,
6782
+ "ui-ml-s": multiSelection
6783
+ }) },
6784
+ React__namespace.default.createElement(Text, { className: "ui-whitespace-nowrap ui-capitalize", variant: option.isChecked ? "strong" : "base" }, option.label)
6785
+ ),
6786
+ React__namespace.default.createElement(
6787
+ "span",
6788
+ { className: classNames__default.default("ui-ml-auto ui-pr-s", {
6789
+ "ui-hidden": multiSelection,
6790
+ "ui-text-primary": option.isChecked,
6791
+ "ui-text-transparent": !option.isChecked
6792
+ }) },
6793
+ React__namespace.default.createElement(solid.CheckIcon, { className: "ui-ml-s ui-h-5 ui-w-5 ui-flex-shrink-0" })
6794
+ )
6795
+ ))))
6796
6796
  )
6797
6797
  );
6798
6798
  };