@luscii-healthtech/web-ui 2.23.0 → 2.24.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/Accordion/AccordionItem.d.ts +1 -1
- package/dist/components/AccordionList/AccordionList.d.ts +7 -4
- package/dist/web-ui.cjs.development.js +13 -7
- 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 +13 -7
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,11 +4,14 @@ import { ListItemProps } from "../List/List.types";
|
|
|
4
4
|
import { AccordionItemProps } from "../Accordion/AccordionItem";
|
|
5
5
|
import { BaseButtonProps } from "../ButtonV2/ButtonProps.type";
|
|
6
6
|
export interface AccordionListProps extends Omit<AccordionProps, "items"> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
localisations: {
|
|
8
|
+
title: string;
|
|
9
|
+
searchPlaceholder?: string;
|
|
10
|
+
emptyListText?: string;
|
|
11
|
+
};
|
|
11
12
|
accordionItems: AccordionListItemProps[];
|
|
13
|
+
buttonProps?: BaseButtonProps;
|
|
14
|
+
isSearchEnabled?: boolean;
|
|
12
15
|
}
|
|
13
16
|
export interface AccordionListItemProps extends Omit<AccordionItemProps, "content"> {
|
|
14
17
|
listItems: ListItemProps[];
|
|
@@ -1647,13 +1647,18 @@ var EmptyListMessage = function EmptyListMessage(_ref) {
|
|
|
1647
1647
|
}));
|
|
1648
1648
|
};
|
|
1649
1649
|
|
|
1650
|
-
var _excluded$5 = ["
|
|
1650
|
+
var _excluded$5 = ["localisations", "buttonProps", "accordionItems", "isSearchEnabled"];
|
|
1651
1651
|
var AccordionList = function AccordionList(_ref) {
|
|
1652
|
-
var
|
|
1653
|
-
|
|
1654
|
-
|
|
1652
|
+
var _ref$localisations = _ref.localisations,
|
|
1653
|
+
title = _ref$localisations.title,
|
|
1654
|
+
_ref$localisations$se = _ref$localisations.searchPlaceholder,
|
|
1655
|
+
searchPlaceholder = _ref$localisations$se === void 0 ? "" : _ref$localisations$se,
|
|
1656
|
+
_ref$localisations$em = _ref$localisations.emptyListText,
|
|
1657
|
+
emptyListText = _ref$localisations$em === void 0 ? "" : _ref$localisations$em,
|
|
1655
1658
|
buttonProps = _ref.buttonProps,
|
|
1656
1659
|
accordionItems = _ref.accordionItems,
|
|
1660
|
+
_ref$isSearchEnabled = _ref.isSearchEnabled,
|
|
1661
|
+
isSearchEnabled = _ref$isSearchEnabled === void 0 ? false : _ref$isSearchEnabled,
|
|
1657
1662
|
accordionProps = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
1658
1663
|
|
|
1659
1664
|
var _useState = React.useState(""),
|
|
@@ -1663,7 +1668,7 @@ var AccordionList = function AccordionList(_ref) {
|
|
|
1663
1668
|
var filteredAccordionItems = React.useMemo(function () {
|
|
1664
1669
|
return accordionItems.map(function (accordionItem) {
|
|
1665
1670
|
var filteredListItems = accordionItem.listItems.filter(function (listItem) {
|
|
1666
|
-
return isSubstring(listItem.title, searchString) || isSubstring(listItem.subtitle, searchString);
|
|
1671
|
+
return !isSearchEnabled || isSubstring(listItem.title, searchString) || isSubstring(listItem.subtitle, searchString);
|
|
1667
1672
|
});
|
|
1668
1673
|
|
|
1669
1674
|
if (filteredListItems.length === 0) {
|
|
@@ -1671,8 +1676,9 @@ var AccordionList = function AccordionList(_ref) {
|
|
|
1671
1676
|
}
|
|
1672
1677
|
|
|
1673
1678
|
var filteredListLength = searchString ? filteredListItems.length + "/" : "";
|
|
1679
|
+
var itemCount = isSearchEnabled ? " (" + filteredListLength + accordionItem.listItems.length + ")" : "";
|
|
1674
1680
|
return _extends({}, accordionItem, {
|
|
1675
|
-
title:
|
|
1681
|
+
title: "" + accordionItem.title + itemCount,
|
|
1676
1682
|
content: /*#__PURE__*/React__default.createElement(List, {
|
|
1677
1683
|
items: filteredListItems
|
|
1678
1684
|
})
|
|
@@ -1686,7 +1692,7 @@ var AccordionList = function AccordionList(_ref) {
|
|
|
1686
1692
|
}, title && /*#__PURE__*/React__default.createElement(Title, {
|
|
1687
1693
|
text: title,
|
|
1688
1694
|
type: "sm"
|
|
1689
|
-
}), /*#__PURE__*/React__default.createElement(SearchInput, {
|
|
1695
|
+
}), isSearchEnabled && /*#__PURE__*/React__default.createElement(SearchInput, {
|
|
1690
1696
|
className: "w-full",
|
|
1691
1697
|
value: searchString,
|
|
1692
1698
|
placeholder: searchPlaceholder,
|