@luscii-healthtech/web-ui 0.6.2 → 0.7.0
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.
- package/dist/components/List/List.d.ts +3 -5
- package/dist/components/List/List.types.d.ts +17 -0
- package/dist/components/List/ListItem.d.ts +3 -12
- package/dist/index.d.ts +1 -1
- package/dist/web-ui.cjs.development.js +34 -10
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +34 -10
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/List/List.tsx +14 -7
- package/src/components/List/List.types.ts +22 -0
- package/src/components/List/ListItem.tsx +57 -31
- package/src/index.tsx +6 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ListItemProps } from "./
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare const List: ({ items }: ListProps) => JSX.Element;
|
|
2
|
+
import { ListProps, ListItemProps, OnAssetLoadErrorPayload } from "./List.types";
|
|
3
|
+
export { ListProps, ListItemProps, OnAssetLoadErrorPayload };
|
|
4
|
+
export declare const List: ({ items, onAssetLoadError }: ListProps) => JSX.Element;
|
|
7
5
|
export default List;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
+
export interface ListItemProps {
|
|
4
|
+
itemId: string | number;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
icon?: React.FunctionComponent<IconProps> | null | string;
|
|
8
|
+
accessories?: JSX.Element[];
|
|
9
|
+
handleItemClick?: () => void;
|
|
10
|
+
onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
|
|
11
|
+
tooltipId?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare type OnAssetLoadErrorPayload = Pick<ListItemProps, "itemId" | "subtitle" | "title" | "icon">;
|
|
14
|
+
export interface ListProps {
|
|
15
|
+
items: ListItemProps[];
|
|
16
|
+
onAssetLoadError?: (payload: OnAssetLoadErrorPayload) => void;
|
|
17
|
+
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
itemId: string | number;
|
|
5
|
-
title: string;
|
|
6
|
-
subTitle?: string;
|
|
7
|
-
icon?: React.FunctionComponent<IconProps> | null;
|
|
8
|
-
accessories?: JSX.Element[];
|
|
9
|
-
handleItemClick?: () => void;
|
|
10
|
-
tooltipId?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const ListItem: ({ icon, subTitle, title, accessories, tooltipId, ...restProps }: ListItemProps) => JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListItemProps } from "./List.types";
|
|
3
|
+
export declare const ListItem: ({ icon, subtitle, title, accessories, tooltipId, onAssetLoadError, ...restProps }: ListItemProps) => JSX.Element;
|
|
13
4
|
export default ListItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { Table, TableProps } from "./components/Table/Table";
|
|
|
21
21
|
export { TableFieldConfig, TableFieldContent, TableFieldText, TableFieldAction, } from "./components/Table/Table.types";
|
|
22
22
|
export { LoadingIndicator, LoadingIndicatorProps, } from "./components/LoadingIndicator/LoadingIndicator";
|
|
23
23
|
export { default as Menu } from "./components/Menu/Menu";
|
|
24
|
-
export { List } from "./components/List/List";
|
|
24
|
+
export { List, ListProps, ListItemProps, OnAssetLoadErrorPayload, } from "./components/List/List";
|
|
25
25
|
export { MultiSelect } from "./components/MultiSelect/MultiSelect";
|
|
26
26
|
export { NavLayout, NavMenuLayoutProps } from "./components/NavMenu/NavLayout";
|
|
27
27
|
export { NavMenu, NavMenuElement } from "./components/NavMenu/NavMenu";
|
|
@@ -2571,32 +2571,54 @@ Menu.propTypes = {
|
|
|
2571
2571
|
children: PropTypes.node.isRequired
|
|
2572
2572
|
};
|
|
2573
2573
|
|
|
2574
|
-
var _excluded$9 = ["icon", "
|
|
2574
|
+
var _excluded$9 = ["icon", "subtitle", "title", "accessories", "tooltipId", "onAssetLoadError"];
|
|
2575
2575
|
var ListItem = function ListItem(_ref) {
|
|
2576
2576
|
var icon = _ref.icon,
|
|
2577
|
-
|
|
2577
|
+
subtitle = _ref.subtitle,
|
|
2578
2578
|
title = _ref.title,
|
|
2579
2579
|
accessories = _ref.accessories,
|
|
2580
2580
|
tooltipId = _ref.tooltipId,
|
|
2581
|
+
onAssetLoadError = _ref.onAssetLoadError,
|
|
2581
2582
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
2582
2583
|
|
|
2584
|
+
function onListItemIconLoadError() {
|
|
2585
|
+
console.error({
|
|
2586
|
+
message: "Url from icon failed to load, please check the props passed to `ListItem`.",
|
|
2587
|
+
icon: icon,
|
|
2588
|
+
title: title,
|
|
2589
|
+
subtitle: subtitle
|
|
2590
|
+
});
|
|
2591
|
+
onAssetLoadError == null ? void 0 : onAssetLoadError({
|
|
2592
|
+
title: title,
|
|
2593
|
+
subtitle: subtitle,
|
|
2594
|
+
itemId: restProps.itemId,
|
|
2595
|
+
icon: icon
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2583
2599
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
2584
|
-
className: classNames("flex flex-row items-center space-x-4", "p-4 border-b last:border-b-0 border-slate-200", {
|
|
2585
|
-
"cursor-pointer": restProps.handleItemClick
|
|
2600
|
+
className: classNames("flex flex-row items-center space-x-4 bg-white", "p-4 border-b last:border-b-0 border-slate-200", {
|
|
2601
|
+
"cursor-pointer": restProps.handleItemClick,
|
|
2602
|
+
"hover:bg-blue-50 transition-colors ease-in-out duration-300": restProps.handleItemClick
|
|
2586
2603
|
}),
|
|
2587
2604
|
onClick: restProps.handleItemClick,
|
|
2588
2605
|
"data-tip": restProps.itemId,
|
|
2589
2606
|
"data-for": tooltipId
|
|
2590
|
-
}, icon && /*#__PURE__*/React__default.createElement(icon, {
|
|
2607
|
+
}, icon && typeof icon === "function" && /*#__PURE__*/React__default.createElement(icon, {
|
|
2591
2608
|
className: "w-6 h-6"
|
|
2609
|
+
}), icon && typeof icon === "string" && /*#__PURE__*/React__default.createElement("img", {
|
|
2610
|
+
src: icon,
|
|
2611
|
+
alt: "list-item-icon",
|
|
2612
|
+
className: "w-6 h-6 text-sm",
|
|
2613
|
+
onError: onListItemIconLoadError
|
|
2592
2614
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
2593
2615
|
className: classNames({
|
|
2594
2616
|
"pl-10": icon === null
|
|
2595
2617
|
})
|
|
2596
2618
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
2597
2619
|
text: title
|
|
2598
|
-
}),
|
|
2599
|
-
text:
|
|
2620
|
+
}), subtitle && /*#__PURE__*/React__default.createElement(Text, {
|
|
2621
|
+
text: subtitle,
|
|
2600
2622
|
type: "sm"
|
|
2601
2623
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2602
2624
|
className: "flex-grow"
|
|
@@ -2604,12 +2626,14 @@ var ListItem = function ListItem(_ref) {
|
|
|
2604
2626
|
};
|
|
2605
2627
|
|
|
2606
2628
|
var List = function List(_ref) {
|
|
2607
|
-
var items = _ref.items
|
|
2629
|
+
var items = _ref.items,
|
|
2630
|
+
onAssetLoadError = _ref.onAssetLoadError;
|
|
2608
2631
|
return /*#__PURE__*/React__default.createElement("ul", {
|
|
2609
|
-
className: classNames("list-none")
|
|
2632
|
+
className: classNames("list-none bg-white")
|
|
2610
2633
|
}, items.map(function (item) {
|
|
2611
2634
|
return /*#__PURE__*/React__default.createElement(ListItem, Object.assign({}, item, {
|
|
2612
|
-
key: item.itemId
|
|
2635
|
+
key: item.itemId,
|
|
2636
|
+
onAssetLoadError: onAssetLoadError
|
|
2613
2637
|
}));
|
|
2614
2638
|
}));
|
|
2615
2639
|
};
|