@luscii-healthtech/web-ui 2.29.0 → 2.29.2

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.
@@ -12,7 +12,9 @@ export interface ImagePickerProps {
12
12
  name: string;
13
13
  images: string[];
14
14
  categories: CategoryProps[];
15
- preselectedImage?: string;
15
+ preselectedImage?: string | {
16
+ imageData: string;
17
+ };
16
18
  clearImageIndex?: number;
17
19
  type?: "normal" | "compact";
18
20
  isDisabled?: boolean;
@@ -3,6 +3,7 @@ export declare type FullPageModalProps = {
3
3
  children: React.ReactNode;
4
4
  isOpen?: boolean;
5
5
  title: string;
6
+ dataTestId?: string;
6
7
  onCloseClick: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
7
8
  };
8
9
  export declare const FullPageModal: React.FC<FullPageModalProps>;
@@ -9,6 +9,7 @@ export declare type ModalBaseProps = Omit<ModalHeaderProps, "title"> & {
9
9
  withContentPaddingY?: boolean;
10
10
  isOpen?: boolean;
11
11
  title?: string;
12
+ dataTestId?: string;
12
13
  scrollableContent?: boolean;
13
14
  onCloseClick: (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void;
14
15
  } & ModalFooterProps;
@@ -11,5 +11,6 @@ export interface TableProps<Item> extends React.HTMLAttributes<HTMLTableElement>
11
11
  paginationMenuProps?: PaginationMenuProps;
12
12
  onRowClick?: (item: Item) => void;
13
13
  className?: string;
14
+ dataTestId?: string;
14
15
  }
15
- export declare function Table<Item>({ items, fieldConfigurations, emptyRowsText, emptyFieldContentText, isLoading, showHeader, paginationMenuProps, onRowClick, className, ...otherAttributes }: TableProps<Item>): JSX.Element;
16
+ export declare function Table<Item>({ items, fieldConfigurations, emptyRowsText, emptyFieldContentText, isLoading, showHeader, paginationMenuProps, onRowClick, className, dataTestId, ...otherAttributes }: TableProps<Item>): JSX.Element;
@@ -1762,6 +1762,8 @@ var ModalFooter = function ModalFooter(props) {
1762
1762
  };
1763
1763
 
1764
1764
  var ModalBase = function ModalBase(props) {
1765
+ var _props$dataTestId;
1766
+
1765
1767
  var _props$size = props.size,
1766
1768
  size = _props$size === void 0 ? "medium" : _props$size,
1767
1769
  _props$withContentPad = props.withContentPaddingY,
@@ -1777,6 +1779,9 @@ var ModalBase = function ModalBase(props) {
1777
1779
  }
1778
1780
  }, /*#__PURE__*/React__default.createElement(ReactModal, {
1779
1781
  isOpen: isOpen,
1782
+ data: {
1783
+ "test-id": (_props$dataTestId = props.dataTestId) != null ? _props$dataTestId : "react-modal"
1784
+ },
1780
1785
  contentLabel: props.title,
1781
1786
  overlayClassName: classNames("px-2 py-15", "z-20", "fixed top-0 bottom-0 left-0 right-0", "overflow-x-hidden overflow-y-auto", "bg-overlay"),
1782
1787
  onRequestClose: props.onCloseClick,
@@ -3886,7 +3891,7 @@ var TableFooter = function TableFooter(props) {
3886
3891
  }, props.paginationMenuProps)))));
3887
3892
  };
3888
3893
 
3889
- var _excluded$d = ["items", "fieldConfigurations", "emptyRowsText", "emptyFieldContentText", "isLoading", "showHeader", "paginationMenuProps", "onRowClick", "className"];
3894
+ var _excluded$d = ["items", "fieldConfigurations", "emptyRowsText", "emptyFieldContentText", "isLoading", "showHeader", "paginationMenuProps", "onRowClick", "className", "dataTestId"];
3890
3895
  function Table(_ref) {
3891
3896
  var items = _ref.items,
3892
3897
  fieldConfigurations = _ref.fieldConfigurations,
@@ -3899,6 +3904,7 @@ function Table(_ref) {
3899
3904
  paginationMenuProps = _ref.paginationMenuProps,
3900
3905
  onRowClick = _ref.onRowClick,
3901
3906
  className = _ref.className,
3907
+ dataTestId = _ref.dataTestId,
3902
3908
  otherAttributes = _objectWithoutPropertiesLoose(_ref, _excluded$d);
3903
3909
 
3904
3910
  // For not displaying empty view at creation
@@ -3911,7 +3917,8 @@ function Table(_ref) {
3911
3917
  }, [items, isLoading]);
3912
3918
  var showEmptyView = !isPristine && !isLoading && !(items && items.length > 0);
3913
3919
  return /*#__PURE__*/React__default.createElement("table", _extends({
3914
- className: classNames("w-full rounded-lg bg-white border-collapse table-auto", className)
3920
+ className: classNames("w-full rounded-lg bg-white border-collapse table-auto", className),
3921
+ "data-test-id": dataTestId
3915
3922
  }, otherAttributes), showHeader ? /*#__PURE__*/React__default.createElement(TableHeader, {
3916
3923
  className: "border-b border-slate-100",
3917
3924
  fieldConfigurations: fieldConfigurations
@@ -6536,7 +6543,7 @@ var ImagePickerInner = function ImagePickerInner(_ref) {
6536
6543
 
6537
6544
  var fileInputRef = React.useRef(null);
6538
6545
  React.useEffect(function () {
6539
- if (preselectedImage) {
6546
+ if (preselectedImage && typeof preselectedImage === "string") {
6540
6547
  setSelectedImage(preselectedImage);
6541
6548
  }
6542
6549
  }, [preselectedImage]);
@@ -6665,8 +6672,8 @@ var ImagePickerInner = function ImagePickerInner(_ref) {
6665
6672
  }), /*#__PURE__*/React__default.createElement(FlexRow, {
6666
6673
  spacing: "small"
6667
6674
  }, /*#__PURE__*/React__default.createElement(SecondaryButton, {
6668
- "data-test-id": "select-from-library",
6669
- id: "selectImage",
6675
+ "data-test-id": "image-picker-" + name,
6676
+ id: "image-picker-" + name,
6670
6677
  isDisabled: isDisabled,
6671
6678
  className: "cweb-imagePicker-change",
6672
6679
  text: localisation.openModalButton,
@@ -6679,7 +6686,7 @@ var ImagePickerInner = function ImagePickerInner(_ref) {
6679
6686
  }, /*#__PURE__*/React__default.createElement(SecondaryButton, {
6680
6687
  text: localisation.uploadImage,
6681
6688
  isDisabled: isDisabled,
6682
- id: "uploadImage",
6689
+ id: "upload-image-" + name,
6683
6690
  onClick: function onClick() {
6684
6691
  var _fileInputRef$current;
6685
6692
 
@@ -6690,7 +6697,7 @@ var ImagePickerInner = function ImagePickerInner(_ref) {
6690
6697
  ref: fileInputRef,
6691
6698
  type: "file",
6692
6699
  disabled: isDisabled,
6693
- name: "uploaded",
6700
+ name: "uploaded-" + name,
6694
6701
  accept: "image/svg+xml",
6695
6702
  onChange: uploadImage,
6696
6703
  className: "hidden"
@@ -7724,13 +7731,18 @@ var FullPageModalHeader = function FullPageModalHeader(props) {
7724
7731
  };
7725
7732
 
7726
7733
  var FullPageModal = function FullPageModal(props) {
7734
+ var _props$dataTestId;
7735
+
7727
7736
  return /*#__PURE__*/React__default.createElement(ReactModal, {
7728
7737
  isOpen: props.isOpen,
7729
7738
  contentLabel: props.title,
7730
7739
  overlayClassName: "fixed inset-0 overflow-x-hidden overflow-y-auto z-20",
7731
7740
  onRequestClose: props.onCloseClick,
7732
7741
  shouldFocusAfterRender: false,
7733
- className: "h-screen"
7742
+ className: "h-screen",
7743
+ data: {
7744
+ "test-id": (_props$dataTestId = props.dataTestId) != null ? _props$dataTestId : "react-modal"
7745
+ }
7734
7746
  }, /*#__PURE__*/React__default.createElement("div", {
7735
7747
  className: "flex flex-col h-screen"
7736
7748
  }, /*#__PURE__*/React__default.createElement(FullPageModalHeader, {