@luscii-healthtech/web-ui 0.6.2 → 0.7.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.
- 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/components/Table/Table.types.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/web-ui.cjs.development.js +45 -14
- 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 +45 -14
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ButtonV2/ButtonV2.tsx +6 -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/components/Table/Table.types.ts +1 -0
- package/src/components/Table/TableBodyRowDataCell.tsx +5 -3
- 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;
|
|
@@ -10,6 +10,7 @@ export interface TableFieldConfig<Item> {
|
|
|
10
10
|
export declare type TableFieldContent<Item> = TableFieldText | [TableFieldAction<Item>?, TableFieldAction<Item>?];
|
|
11
11
|
export interface TableFieldText {
|
|
12
12
|
text: string;
|
|
13
|
+
breakAllWord?: boolean;
|
|
13
14
|
tag?: {
|
|
14
15
|
text: string;
|
|
15
16
|
color: TagColorTheme;
|
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";
|
|
@@ -370,6 +370,11 @@ var ButtonV2 = function ButtonV2(_ref) {
|
|
|
370
370
|
className = _ref.className,
|
|
371
371
|
otherAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
372
372
|
|
|
373
|
+
function handleClick(event) {
|
|
374
|
+
event.stopPropagation();
|
|
375
|
+
onClick == null ? void 0 : onClick(event);
|
|
376
|
+
}
|
|
377
|
+
|
|
373
378
|
if (!text && !icon) {
|
|
374
379
|
console.error("A text or an icon is required to use this component, please make sure to pass at least one of them as a prop.");
|
|
375
380
|
return /*#__PURE__*/React__default.createElement("span", null, "Invalid props passed to this component.");
|
|
@@ -386,7 +391,7 @@ var ButtonV2 = function ButtonV2(_ref) {
|
|
|
386
391
|
return /*#__PURE__*/React__default.createElement("button", Object.assign({}, otherAttributes, {
|
|
387
392
|
className: buttonClassName,
|
|
388
393
|
type: "button",
|
|
389
|
-
onClick:
|
|
394
|
+
onClick: handleClick,
|
|
390
395
|
disabled: isDisabled,
|
|
391
396
|
"aria-disabled": isDisabled
|
|
392
397
|
}), icon && /*#__PURE__*/React__default.createElement(icon, {
|
|
@@ -2093,7 +2098,10 @@ function TableBodyRowDataCell(props) {
|
|
|
2093
2098
|
text: content.tag.text,
|
|
2094
2099
|
colorTheme: content.tag.color
|
|
2095
2100
|
})), /*#__PURE__*/React__default.createElement(Text, {
|
|
2096
|
-
className: "py-4 text-left leading-5
|
|
2101
|
+
className: classNames("py-4 text-left leading-5", {
|
|
2102
|
+
"break-all": content.breakAllWord,
|
|
2103
|
+
"break-words": !content.breakAllWord
|
|
2104
|
+
}),
|
|
2097
2105
|
text: content.text === "" ? emptyFieldContentText : content.text,
|
|
2098
2106
|
type: "base"
|
|
2099
2107
|
})), isTableFieldAction(content) && /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2106,8 +2114,7 @@ function TableBodyRowDataCell(props) {
|
|
|
2106
2114
|
className: "ml-2 first:ml-0",
|
|
2107
2115
|
key: action.key,
|
|
2108
2116
|
icon: action.icon,
|
|
2109
|
-
onClick: function onClick(
|
|
2110
|
-
event.stopPropagation();
|
|
2117
|
+
onClick: function onClick() {
|
|
2111
2118
|
action.handleClick(props.item);
|
|
2112
2119
|
}
|
|
2113
2120
|
});
|
|
@@ -2571,32 +2578,54 @@ Menu.propTypes = {
|
|
|
2571
2578
|
children: PropTypes.node.isRequired
|
|
2572
2579
|
};
|
|
2573
2580
|
|
|
2574
|
-
var _excluded$9 = ["icon", "
|
|
2581
|
+
var _excluded$9 = ["icon", "subtitle", "title", "accessories", "tooltipId", "onAssetLoadError"];
|
|
2575
2582
|
var ListItem = function ListItem(_ref) {
|
|
2576
2583
|
var icon = _ref.icon,
|
|
2577
|
-
|
|
2584
|
+
subtitle = _ref.subtitle,
|
|
2578
2585
|
title = _ref.title,
|
|
2579
2586
|
accessories = _ref.accessories,
|
|
2580
2587
|
tooltipId = _ref.tooltipId,
|
|
2588
|
+
onAssetLoadError = _ref.onAssetLoadError,
|
|
2581
2589
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
2582
2590
|
|
|
2591
|
+
function onListItemIconLoadError() {
|
|
2592
|
+
console.error({
|
|
2593
|
+
message: "Url from icon failed to load, please check the props passed to `ListItem`.",
|
|
2594
|
+
icon: icon,
|
|
2595
|
+
title: title,
|
|
2596
|
+
subtitle: subtitle
|
|
2597
|
+
});
|
|
2598
|
+
onAssetLoadError == null ? void 0 : onAssetLoadError({
|
|
2599
|
+
title: title,
|
|
2600
|
+
subtitle: subtitle,
|
|
2601
|
+
itemId: restProps.itemId,
|
|
2602
|
+
icon: icon
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2583
2606
|
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
|
|
2607
|
+
className: classNames("flex flex-row items-center space-x-4 bg-white", "p-4 border-b last:border-b-0 border-slate-200", {
|
|
2608
|
+
"cursor-pointer": restProps.handleItemClick,
|
|
2609
|
+
"hover:bg-blue-50 transition-colors ease-in-out duration-300": restProps.handleItemClick
|
|
2586
2610
|
}),
|
|
2587
2611
|
onClick: restProps.handleItemClick,
|
|
2588
2612
|
"data-tip": restProps.itemId,
|
|
2589
2613
|
"data-for": tooltipId
|
|
2590
|
-
}, icon && /*#__PURE__*/React__default.createElement(icon, {
|
|
2614
|
+
}, icon && typeof icon === "function" && /*#__PURE__*/React__default.createElement(icon, {
|
|
2591
2615
|
className: "w-6 h-6"
|
|
2616
|
+
}), icon && typeof icon === "string" && /*#__PURE__*/React__default.createElement("img", {
|
|
2617
|
+
src: icon,
|
|
2618
|
+
alt: "list-item-icon",
|
|
2619
|
+
className: "w-6 h-6 text-sm",
|
|
2620
|
+
onError: onListItemIconLoadError
|
|
2592
2621
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
2593
2622
|
className: classNames({
|
|
2594
2623
|
"pl-10": icon === null
|
|
2595
2624
|
})
|
|
2596
2625
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
2597
2626
|
text: title
|
|
2598
|
-
}),
|
|
2599
|
-
text:
|
|
2627
|
+
}), subtitle && /*#__PURE__*/React__default.createElement(Text, {
|
|
2628
|
+
text: subtitle,
|
|
2600
2629
|
type: "sm"
|
|
2601
2630
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2602
2631
|
className: "flex-grow"
|
|
@@ -2604,12 +2633,14 @@ var ListItem = function ListItem(_ref) {
|
|
|
2604
2633
|
};
|
|
2605
2634
|
|
|
2606
2635
|
var List = function List(_ref) {
|
|
2607
|
-
var items = _ref.items
|
|
2636
|
+
var items = _ref.items,
|
|
2637
|
+
onAssetLoadError = _ref.onAssetLoadError;
|
|
2608
2638
|
return /*#__PURE__*/React__default.createElement("ul", {
|
|
2609
|
-
className: classNames("list-none")
|
|
2639
|
+
className: classNames("list-none bg-white")
|
|
2610
2640
|
}, items.map(function (item) {
|
|
2611
2641
|
return /*#__PURE__*/React__default.createElement(ListItem, Object.assign({}, item, {
|
|
2612
|
-
key: item.itemId
|
|
2642
|
+
key: item.itemId,
|
|
2643
|
+
onAssetLoadError: onAssetLoadError
|
|
2613
2644
|
}));
|
|
2614
2645
|
}));
|
|
2615
2646
|
};
|