@geotab/zenith 3.16.0 → 3.17.0-beta.1
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/README.md +67 -1
- package/README.md.baseline +1 -0
- package/dist/absolute/absolute.js +5 -1
- package/dist/button/button.d.ts +2 -1
- package/dist/button/button.js +22 -5
- package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/dist/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/dist/commonHelpers/ShowMoreCell.d.ts +5 -0
- package/dist/commonHelpers/ShowMoreCell.js +66 -0
- package/dist/commonHelpers/getAriaAttributes.js +6 -9
- package/dist/commonHelpers/getNonAriaProps.d.ts +11 -0
- package/dist/commonHelpers/getNonAriaProps.js +19 -0
- package/dist/commonHelpers/hooks/useScroll.d.ts +1 -1
- package/dist/commonHelpers/hooks/useScroll.js +6 -6
- package/dist/commonHelpers/isAriaProp.d.ts +9 -0
- package/dist/commonHelpers/isAriaProp.js +13 -0
- package/dist/commonHelpers/showMoreRow.d.ts +28 -0
- package/dist/commonHelpers/showMoreRow.js +29 -0
- package/dist/commonHelpers/tabsKeyboard.d.ts +1 -1
- package/dist/commonHelpers/tabsKeyboard.js +15 -1
- package/dist/commonStyles/colors/colors.less +18 -0
- package/dist/dataFeed/dataFeedColumnsItems.js +3 -1
- package/dist/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
- package/dist/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
- package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
- package/dist/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
- package/dist/dataGrid/dataGrid.d.ts +5 -1
- package/dist/dataGrid/dataGrid.js +39 -2
- package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
- package/dist/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +54 -0
- package/dist/dataGrid/row/row.js +20 -2
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
- package/dist/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownHelper.d.ts +12 -0
- package/dist/dropdownRaw/dropdownHelper.js +32 -11
- package/dist/dropdownRaw/dropdownRaw.js +36 -8
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +13 -6
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +2 -2
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/dist/dropdownRaw/types.d.ts +36 -0
- package/dist/filterButton/filterButton.d.ts +1 -1
- package/dist/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
- package/dist/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/dist/header/headerButton.d.ts +3 -1
- package/dist/header/headerButton.js +4 -2
- package/dist/header/headerMenu.d.ts +2 -0
- package/dist/header/headerMenu.js +1 -1
- package/dist/index.css +319 -68
- package/dist/index.d.ts +3 -1
- package/dist/index.js +9 -3
- package/dist/menu/components/menuButton.d.ts +3 -1
- package/dist/menu/components/menuButton.js +66 -47
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/miniTabs/miniTabs.js +4 -2
- package/dist/pageHeader/pageHeaderButton.d.ts +1 -1
- package/dist/pageHeader/pageHeaderButton.js +4 -2
- package/dist/pagination/pagination.d.ts +19 -4
- package/dist/pagination/pagination.js +21 -1
- package/dist/pagination/paginationText/paginationText.d.ts +7 -1
- package/dist/pagination/paginationText/paginationText.js +6 -3
- package/dist/pillExpandable/pillContent.d.ts +3 -2
- package/dist/pillExpandable/pillContent.js +2 -2
- package/dist/pillExpandable/pillExpandable.js +20 -5
- package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
- package/dist/pillExpandable/pillExpandablePopoverContent.js +1 -1
- package/dist/pillExpandable/pillExpandableSimple.d.ts +3 -1
- package/dist/pillExpandable/pillExpandableSimple.js +19 -9
- package/dist/selectList/selectList.js +1 -0
- package/dist/selectList/selectListItem.d.ts +10 -1
- package/dist/selectList/selectListItem.js +12 -9
- package/dist/table/children/tablePagination.d.ts +1 -1
- package/dist/table/children/useTableChildren.d.ts +4 -2
- package/dist/table/children/useTableChildren.js +64 -16
- package/dist/table/nested/nestedData.d.ts +29 -1
- package/dist/table/nested/nestedData.js +45 -4
- package/dist/table/nested/useNestedRows.js +18 -22
- package/dist/table/nested/useShowMore.d.ts +41 -0
- package/dist/table/nested/useShowMore.js +56 -0
- package/dist/table/selectable/interfaces.d.ts +17 -0
- package/dist/table/selectable/useDragSelection.d.ts +10 -0
- package/dist/table/selectable/useDragSelection.js +145 -0
- package/dist/table/selectable/useSelectableRows.d.ts +5 -2
- package/dist/table/selectable/useSelectableRows.js +131 -36
- package/dist/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/dist/table/selectable/utils/calculateSelectionState.js +43 -7
- package/dist/table/selectable/utils/checkRow.js +4 -2
- package/dist/table/selectable/utils/getCurrentPageSelection.js +9 -5
- package/dist/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
- package/dist/table/selectable/utils/getDragSelectionRows.js +28 -0
- package/dist/table/selectable/utils/getRangeIds.d.ts +2 -0
- package/dist/table/selectable/utils/getRangeIds.js +21 -0
- package/dist/table/selectable/utils/isRowChecked.d.ts +1 -1
- package/dist/table/selectable/utils/isRowChecked.js +40 -7
- package/dist/table/table.d.ts +1 -2
- package/dist/table/table.js +58 -31
- package/dist/tabs/tabs.d.ts +1 -0
- package/dist/tabs/tabs.js +50 -17
- package/dist/textInputRaw/textInputRaw.js +3 -2
- package/dist/tooltip/tooltip.d.ts +2 -0
- package/dist/tooltip/tooltip.js +19 -7
- package/dist/utils/localization/translations/ar-001.json +1 -0
- package/dist/utils/localization/translations/bg-BG.json +1 -0
- package/dist/utils/localization/translations/cs.json +1 -0
- package/dist/utils/localization/translations/da-DK.json +1 -0
- package/dist/utils/localization/translations/de.json +1 -0
- package/dist/utils/localization/translations/el-GR.json +1 -0
- package/dist/utils/localization/translations/en.json +4 -0
- package/dist/utils/localization/translations/es.json +1 -0
- package/dist/utils/localization/translations/et-EE.json +1 -0
- package/dist/utils/localization/translations/fi-FI.json +1 -0
- package/dist/utils/localization/translations/fr-FR.json +1 -0
- package/dist/utils/localization/translations/fr.json +1 -0
- package/dist/utils/localization/translations/hu-HU.json +1 -0
- package/dist/utils/localization/translations/id.json +1 -0
- package/dist/utils/localization/translations/it.json +1 -0
- package/dist/utils/localization/translations/ja.json +1 -0
- package/dist/utils/localization/translations/ka-GE.json +1 -0
- package/dist/utils/localization/translations/ko-KR.json +1 -0
- package/dist/utils/localization/translations/lt-LT.json +1 -0
- package/dist/utils/localization/translations/lv-LV.json +1 -0
- package/dist/utils/localization/translations/ms.json +1 -0
- package/dist/utils/localization/translations/nb-NO.json +1 -0
- package/dist/utils/localization/translations/nl.json +1 -0
- package/dist/utils/localization/translations/pl.json +1 -0
- package/dist/utils/localization/translations/pt-BR.json +1 -0
- package/dist/utils/localization/translations/pt-PT.json +1 -0
- package/dist/utils/localization/translations/ro-RO.json +1 -0
- package/dist/utils/localization/translations/sk-SK.json +1 -0
- package/dist/utils/localization/translations/sv.json +1 -0
- package/dist/utils/localization/translations/th.json +1 -0
- package/dist/utils/localization/translations/tr.json +1 -0
- package/dist/utils/localization/translations/zh-Hans.json +1 -0
- package/dist/utils/localization/translations/zh-TW.json +1 -0
- package/dist/waiting/waiting.js +97 -1
- package/esm/absolute/absolute.js +5 -1
- package/esm/button/button.d.ts +2 -1
- package/esm/button/button.js +22 -5
- package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +2 -0
- package/esm/checkboxListWithAction/checkboxListWithAction.js +1 -1
- package/esm/commonHelpers/ShowMoreCell.d.ts +5 -0
- package/esm/commonHelpers/ShowMoreCell.js +57 -0
- package/esm/commonHelpers/getAriaAttributes.js +6 -9
- package/esm/commonHelpers/getNonAriaProps.d.ts +11 -0
- package/esm/commonHelpers/getNonAriaProps.js +15 -0
- package/esm/commonHelpers/hooks/useScroll.d.ts +1 -1
- package/esm/commonHelpers/hooks/useScroll.js +6 -6
- package/esm/commonHelpers/isAriaProp.d.ts +9 -0
- package/esm/commonHelpers/isAriaProp.js +9 -0
- package/esm/commonHelpers/showMoreRow.d.ts +28 -0
- package/esm/commonHelpers/showMoreRow.js +22 -0
- package/esm/commonHelpers/tabsKeyboard.d.ts +1 -1
- package/esm/commonHelpers/tabsKeyboard.js +15 -1
- package/esm/commonStyles/colors/colorsConstant.js +11 -11
- package/esm/dataFeed/dataFeedColumnsItems.js +3 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxCell.d.ts +2 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxCell.js +1 -1
- package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.d.ts +4 -2
- package/esm/dataGrid/columns/checkboxColumn/checkboxColumnWrapper.js +10 -1
- package/esm/dataGrid/dataGrid.d.ts +5 -1
- package/esm/dataGrid/dataGrid.js +38 -2
- package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.d.ts +3 -0
- package/esm/dataGrid/lazyLoadingEnd/lazyLoadingEnd.js +45 -0
- package/esm/dataGrid/row/row.js +20 -2
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +3 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +39 -4
- package/esm/dataGrid/withSelectableRows/withSelectableRows.js +73 -12
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownHelper.d.ts +12 -0
- package/esm/dropdownRaw/dropdownHelper.js +30 -10
- package/esm/dropdownRaw/dropdownRaw.js +37 -9
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +13 -6
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +2 -2
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +8 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.js +5 -2
- package/esm/dropdownRaw/types.d.ts +36 -0
- package/esm/filterButton/filterButton.d.ts +1 -1
- package/esm/formGroup/hooks/rowHooks/useLabelClasses.js +8 -2
- package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.d.ts +2 -1
- package/esm/formLayout/utils/applyLayoutPosition/applyLayoutPosition.js +37 -90
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.d.ts +1 -1
- package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +6 -2
- package/esm/header/headerButton.d.ts +3 -1
- package/esm/header/headerButton.js +4 -2
- package/esm/header/headerMenu.d.ts +2 -0
- package/esm/header/headerMenu.js +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/menu/components/menuButton.d.ts +3 -1
- package/esm/menu/components/menuButton.js +66 -47
- package/esm/menu/components/menuItem.js +4 -4
- package/esm/miniTabs/miniTabs.js +4 -2
- package/esm/pageHeader/pageHeaderButton.d.ts +1 -1
- package/esm/pageHeader/pageHeaderButton.js +4 -2
- package/esm/pagination/pagination.d.ts +19 -4
- package/esm/pagination/pagination.js +21 -1
- package/esm/pagination/paginationText/paginationText.d.ts +7 -1
- package/esm/pagination/paginationText/paginationText.js +6 -3
- package/esm/pillExpandable/pillContent.d.ts +3 -2
- package/esm/pillExpandable/pillContent.js +2 -2
- package/esm/pillExpandable/pillExpandable.js +20 -5
- package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +3 -2
- package/esm/pillExpandable/pillExpandablePopoverContent.js +1 -1
- package/esm/pillExpandable/pillExpandableSimple.d.ts +3 -1
- package/esm/pillExpandable/pillExpandableSimple.js +20 -10
- package/esm/selectList/selectList.js +1 -0
- package/esm/selectList/selectListItem.d.ts +10 -1
- package/esm/selectList/selectListItem.js +12 -9
- package/esm/table/children/tablePagination.d.ts +1 -1
- package/esm/table/children/useTableChildren.d.ts +4 -2
- package/esm/table/children/useTableChildren.js +64 -16
- package/esm/table/nested/nestedData.d.ts +29 -1
- package/esm/table/nested/nestedData.js +44 -3
- package/esm/table/nested/useNestedRows.js +18 -22
- package/esm/table/nested/useShowMore.d.ts +41 -0
- package/esm/table/nested/useShowMore.js +52 -0
- package/esm/table/selectable/interfaces.d.ts +17 -0
- package/esm/table/selectable/useDragSelection.d.ts +10 -0
- package/esm/table/selectable/useDragSelection.js +141 -0
- package/esm/table/selectable/useSelectableRows.d.ts +5 -2
- package/esm/table/selectable/useSelectableRows.js +129 -35
- package/esm/table/selectable/utils/calculateSelectionState.d.ts +1 -1
- package/esm/table/selectable/utils/calculateSelectionState.js +43 -7
- package/esm/table/selectable/utils/checkRow.js +4 -2
- package/esm/table/selectable/utils/getCurrentPageSelection.js +9 -5
- package/esm/table/selectable/utils/getDragSelectionRows.d.ts +15 -0
- package/esm/table/selectable/utils/getDragSelectionRows.js +24 -0
- package/esm/table/selectable/utils/getRangeIds.d.ts +2 -0
- package/esm/table/selectable/utils/getRangeIds.js +17 -0
- package/esm/table/selectable/utils/isRowChecked.d.ts +1 -1
- package/esm/table/selectable/utils/isRowChecked.js +40 -7
- package/esm/table/table.d.ts +1 -2
- package/esm/table/table.js +43 -16
- package/esm/tabs/tabs.d.ts +1 -0
- package/esm/tabs/tabs.js +50 -17
- package/esm/textInputRaw/textInputRaw.js +3 -2
- package/esm/tooltip/tooltip.d.ts +2 -0
- package/esm/tooltip/tooltip.js +19 -7
- package/esm/utils/localization/translations/ar-001.json +1 -0
- package/esm/utils/localization/translations/bg-BG.json +1 -0
- package/esm/utils/localization/translations/cs.json +1 -0
- package/esm/utils/localization/translations/da-DK.json +1 -0
- package/esm/utils/localization/translations/de.json +1 -0
- package/esm/utils/localization/translations/el-GR.json +1 -0
- package/esm/utils/localization/translations/en.json +4 -0
- package/esm/utils/localization/translations/es.json +1 -0
- package/esm/utils/localization/translations/et-EE.json +1 -0
- package/esm/utils/localization/translations/fi-FI.json +1 -0
- package/esm/utils/localization/translations/fr-FR.json +1 -0
- package/esm/utils/localization/translations/fr.json +1 -0
- package/esm/utils/localization/translations/hu-HU.json +1 -0
- package/esm/utils/localization/translations/id.json +1 -0
- package/esm/utils/localization/translations/it.json +1 -0
- package/esm/utils/localization/translations/ja.json +1 -0
- package/esm/utils/localization/translations/ka-GE.json +1 -0
- package/esm/utils/localization/translations/ko-KR.json +1 -0
- package/esm/utils/localization/translations/lt-LT.json +1 -0
- package/esm/utils/localization/translations/lv-LV.json +1 -0
- package/esm/utils/localization/translations/ms.json +1 -0
- package/esm/utils/localization/translations/nb-NO.json +1 -0
- package/esm/utils/localization/translations/nl.json +1 -0
- package/esm/utils/localization/translations/pl.json +1 -0
- package/esm/utils/localization/translations/pt-BR.json +1 -0
- package/esm/utils/localization/translations/pt-PT.json +1 -0
- package/esm/utils/localization/translations/ro-RO.json +1 -0
- package/esm/utils/localization/translations/sk-SK.json +1 -0
- package/esm/utils/localization/translations/sv.json +1 -0
- package/esm/utils/localization/translations/th.json +1 -0
- package/esm/utils/localization/translations/tr.json +1 -0
- package/esm/utils/localization/translations/zh-Hans.json +1 -0
- package/esm/utils/localization/translations/zh-TW.json +1 -0
- package/esm/waiting/waiting.js +98 -2
- package/package.json +15 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { injectString } from "../../utils/localization/translationsDictionary";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useLanguage } from "../../utils/localization/useLanguage";
|
|
4
|
+
injectString("en", "{from}-{to} of {total}", "{from}-{to} of {total}");
|
|
4
5
|
injectString("cs", "Showing {from} - {to} of {total}", "Zobrazuji {from}\u2013{to} z\xA0{total}");
|
|
5
6
|
injectString("da-DK", "Showing {from} - {to} of {total}", "Viser {fra} - {til} af {total}");
|
|
6
7
|
injectString("de", "Showing {from} - {to} of {total}", "{from} - {to} von {total} werden angezeigt");
|
|
@@ -37,12 +38,14 @@ injectString("bg-BG", "Showing {from} - {to} of {total}", "\u041F\u043E\u043A\u0
|
|
|
37
38
|
export const PaginationText = ({
|
|
38
39
|
amount,
|
|
39
40
|
from,
|
|
40
|
-
to
|
|
41
|
+
to,
|
|
42
|
+
variant = "showing"
|
|
41
43
|
}) => {
|
|
42
44
|
const {
|
|
43
45
|
translate
|
|
44
46
|
} = useLanguage();
|
|
45
|
-
const
|
|
47
|
+
const template = variant === "loaded" ? translate("{from}-{to} of {total}") : translate("Showing {from} - {to} of {total}");
|
|
48
|
+
const children = template.replace("{from}", from.toString()).replace("{to}", to.toString()).replace("{total}", amount.toString());
|
|
46
49
|
return _jsx("span", {
|
|
47
50
|
"aria-live": "polite",
|
|
48
51
|
"aria-atomic": "true",
|
|
@@ -50,4 +53,4 @@ export const PaginationText = ({
|
|
|
50
53
|
children: children
|
|
51
54
|
});
|
|
52
55
|
};
|
|
53
|
-
export const TRANSLATIONS = ["Showing {from} - {to} of {total}"];
|
|
56
|
+
export const TRANSLATIONS = ["Showing {from} - {to} of {total}", "{from}-{to} of {total}"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { IPillExpandableAction } from "./pillExpandable";
|
|
3
3
|
import { TLazyContent } from "../skeleton/lazyContent";
|
|
4
4
|
interface IPillContent {
|
|
@@ -12,6 +12,7 @@ interface IPillContent {
|
|
|
12
12
|
isVisible?: boolean;
|
|
13
13
|
errorHandler: (err: any) => ReactNode | undefined;
|
|
14
14
|
descriptionId?: string;
|
|
15
|
+
descriptionRef?: Ref<HTMLDivElement>;
|
|
15
16
|
}
|
|
16
|
-
export declare const PillContent: ({ date, count, descriptionText, mainAction, secondaryAction, tertiaryAction, onActionClick, isVisible, errorHandler, descriptionId }: IPillContent) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const PillContent: ({ date, count, descriptionText, mainAction, secondaryAction, tertiaryAction, onActionClick, isVisible, errorHandler, descriptionId, descriptionRef }: IPillContent) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -4,7 +4,7 @@ import { Button } from "../button/button";
|
|
|
4
4
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
5
5
|
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
6
6
|
import { LazyContent } from "../skeleton/lazyContent";
|
|
7
|
-
export const PillContent = ({ date, count, descriptionText, mainAction, secondaryAction, tertiaryAction, onActionClick, isVisible = true, errorHandler, descriptionId }) => {
|
|
7
|
+
export const PillContent = ({ date, count, descriptionText, mainAction, secondaryAction, tertiaryAction, onActionClick, isVisible = true, errorHandler, descriptionId, descriptionRef }) => {
|
|
8
8
|
const headerDriveClassName = useDriveClassName("zen-status-pill-popup__header-text");
|
|
9
9
|
const descriptionDriveClassName = useDriveClassName("zen-status-pill-popup__description");
|
|
10
10
|
const mainActionClick = useCallback((onClick) => () => {
|
|
@@ -31,7 +31,7 @@ export const PillContent = ({ date, count, descriptionText, mainAction, secondar
|
|
|
31
31
|
var _a, _b;
|
|
32
32
|
return (_jsx(Button, Object.assign({ link: data.link }, data.linkOptions, { onClick: tertiaryActionClick(data.onClick), type: "tertiary", dataAnalyticsId: (_a = data.dataAnalyticsId) !== null && _a !== void 0 ? _a : (_b = data.linkOptions) === null || _b === void 0 ? void 0 : _b.dataAnalyticsId, children: data.text })));
|
|
33
33
|
}, [tertiaryActionClick]);
|
|
34
|
-
const renderDescription = useCallback(data => (_jsx("div", { id: descriptionId, className: classNames(["zen-status-pill-popup__description", descriptionDriveClassName || ""]), children: data })), [descriptionDriveClassName, descriptionId]);
|
|
34
|
+
const renderDescription = useCallback(data => (_jsx("div", { id: descriptionId, ref: descriptionRef, className: classNames(["zen-status-pill-popup__description", descriptionDriveClassName || ""]), children: data })), [descriptionDriveClassName, descriptionId, descriptionRef]);
|
|
35
35
|
const renderCount = useCallback(data => data ? (_jsx("div", { className: classNames([
|
|
36
36
|
"zen-status-pill-popup__header-text zen-status-pill-popup__header-text--left",
|
|
37
37
|
headerDriveClassName || ""
|
|
@@ -87,6 +87,12 @@ const PillExpandablePopover = ({
|
|
|
87
87
|
popoverRef.current = node;
|
|
88
88
|
setContainerNode(node);
|
|
89
89
|
}, [setContainerNode]);
|
|
90
|
+
const handleMobileReadyForFocus = useCallback(currentIsOpen => {
|
|
91
|
+
var _a;
|
|
92
|
+
if (!currentIsOpen) {
|
|
93
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
94
|
+
}
|
|
95
|
+
}, [triggerRef]);
|
|
90
96
|
// Focus first focusable element in desktop popover when content is ready.
|
|
91
97
|
// Mobile MobileSheet handles its own first-focus (close button).
|
|
92
98
|
useEffect(() => {
|
|
@@ -125,6 +131,7 @@ const PillExpandablePopover = ({
|
|
|
125
131
|
isOpen: isOpen,
|
|
126
132
|
onHidePanel: onClose,
|
|
127
133
|
onCloseClick: onClose,
|
|
134
|
+
onReadyForFocus: handleMobileReadyForFocus,
|
|
128
135
|
id: popupId,
|
|
129
136
|
children: [_jsx(MobileSheet.Title, {
|
|
130
137
|
className: "zen-status-pill-popup__mobile-title",
|
|
@@ -141,13 +148,15 @@ const PillExpandablePopover = ({
|
|
|
141
148
|
}
|
|
142
149
|
return _jsx(Absolute, {
|
|
143
150
|
recalculateTrigger: isPopupContentReady,
|
|
144
|
-
|
|
151
|
+
closeOnScroll: true,
|
|
145
152
|
useTrapFocusWithTrigger: "on",
|
|
146
153
|
className: popupClassName,
|
|
147
154
|
id: popupId,
|
|
148
155
|
onOpenChange: onChange,
|
|
149
156
|
isOpen: isOpen,
|
|
150
157
|
triggerRef: triggerRef,
|
|
158
|
+
role: "dialog",
|
|
159
|
+
ariaLabel: title || text,
|
|
151
160
|
alignmentsFn: alignments,
|
|
152
161
|
children: _jsxs("div", {
|
|
153
162
|
ref: handlePopoverRef,
|
|
@@ -173,6 +182,7 @@ const PillExpandableChild = ({
|
|
|
173
182
|
}) => {
|
|
174
183
|
const pillId = useId();
|
|
175
184
|
const descriptionId = useId();
|
|
185
|
+
const [descriptionElement, setDescriptionElement] = useState(null);
|
|
176
186
|
const {
|
|
177
187
|
level,
|
|
178
188
|
expandedChildPillIds,
|
|
@@ -227,7 +237,7 @@ const PillExpandableChild = ({
|
|
|
227
237
|
onExpand: handleChildToggle,
|
|
228
238
|
type: type,
|
|
229
239
|
errorHandler: errorHandler,
|
|
230
|
-
descriptionId: descriptionId,
|
|
240
|
+
descriptionId: isExpanded && descriptionElement ? descriptionId : undefined,
|
|
231
241
|
dataAnalyticsId: dataAnalyticsId
|
|
232
242
|
}), _jsx(PillContent, {
|
|
233
243
|
onActionClick: handleChildToggle,
|
|
@@ -239,7 +249,8 @@ const PillExpandableChild = ({
|
|
|
239
249
|
tertiaryAction: content.tertiaryAction,
|
|
240
250
|
isVisible: isExpanded,
|
|
241
251
|
errorHandler: errorHandler,
|
|
242
|
-
descriptionId: descriptionId
|
|
252
|
+
descriptionId: descriptionId,
|
|
253
|
+
descriptionRef: setDescriptionElement
|
|
243
254
|
})]
|
|
244
255
|
});
|
|
245
256
|
};
|
|
@@ -409,6 +420,7 @@ const PillExpandableBase = ({
|
|
|
409
420
|
}) => {
|
|
410
421
|
const popupId = useId();
|
|
411
422
|
const descriptionId = useId();
|
|
423
|
+
const [descriptionElement, setDescriptionElement] = useState(null);
|
|
412
424
|
const isDrive = useDrive();
|
|
413
425
|
const [isMobile, setIsMobile] = useState(false);
|
|
414
426
|
const handleDeviceTypeChange = useCallback(deviceType => {
|
|
@@ -533,6 +545,7 @@ const PillExpandableBase = ({
|
|
|
533
545
|
tertiaryAction: content.tertiaryAction,
|
|
534
546
|
errorHandler: errorHandler,
|
|
535
547
|
descriptionId,
|
|
548
|
+
descriptionRef: setDescriptionElement,
|
|
536
549
|
childToDisplay
|
|
537
550
|
}), [effectiveVariant, childrenAnalysis, content, errorHandler, descriptionId, childToDisplay]);
|
|
538
551
|
const showFooter = Boolean(moreCounter && viewMoreAction && childCount > MAX_PILLS_TO_DISPLAY_IN_POPUP);
|
|
@@ -563,7 +576,6 @@ const PillExpandableBase = ({
|
|
|
563
576
|
},
|
|
564
577
|
children: _jsxs("div", {
|
|
565
578
|
className: classNames(["zen-status-pill", className || ""]),
|
|
566
|
-
"aria-haspopup": "true",
|
|
567
579
|
children: [_jsxs("div", {
|
|
568
580
|
className: "zen-status-pill__pill-container",
|
|
569
581
|
onClick: handlePopupToggle,
|
|
@@ -576,6 +588,8 @@ const PillExpandableBase = ({
|
|
|
576
588
|
errorHandler: errorHandler,
|
|
577
589
|
isBeta: isBeta,
|
|
578
590
|
isMobile: isMobile,
|
|
591
|
+
descriptionId: isPopupOpen && descriptionElement ? descriptionId : undefined,
|
|
592
|
+
ariaHasPopup: "dialog",
|
|
579
593
|
dataAnalyticsId: dataAnalyticsId
|
|
580
594
|
}), uniqueChildren && _jsx(PillExpandableSimple, {
|
|
581
595
|
icon: secondaryIcon || effectiveIcon,
|
|
@@ -584,7 +598,8 @@ const PillExpandableBase = ({
|
|
|
584
598
|
type: type,
|
|
585
599
|
errorHandler: errorHandler,
|
|
586
600
|
className: "zen-status-pill__counter",
|
|
587
|
-
isMobile: isMobile
|
|
601
|
+
isMobile: isMobile,
|
|
602
|
+
isDecorative: true
|
|
588
603
|
})]
|
|
589
604
|
}), _jsx(PillExpandablePopover, {
|
|
590
605
|
useMobileSheet: useMobileSheet,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { TLazyContent } from "../skeleton/lazyContent";
|
|
3
3
|
import { IPillExpandableAction, TPopoverVariant } from "./pillExpandable";
|
|
4
4
|
interface IPillExpandablePopoverContent {
|
|
@@ -13,7 +13,8 @@ interface IPillExpandablePopoverContent {
|
|
|
13
13
|
tertiaryAction?: TLazyContent<IPillExpandableAction>;
|
|
14
14
|
errorHandler: (e: unknown) => ReactNode | undefined;
|
|
15
15
|
descriptionId?: string;
|
|
16
|
+
descriptionRef?: Ref<HTMLDivElement>;
|
|
16
17
|
childToDisplay: ReactNode[];
|
|
17
18
|
}
|
|
18
|
-
export declare const PillExpandablePopoverContent: ({ variant, customContent, onActionClick, descriptionText, date, count, mainAction, secondaryAction, tertiaryAction, errorHandler, descriptionId, childToDisplay }: IPillExpandablePopoverContent) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const PillExpandablePopoverContent: ({ variant, customContent, onActionClick, descriptionText, date, count, mainAction, secondaryAction, tertiaryAction, errorHandler, descriptionId, descriptionRef, childToDisplay }: IPillExpandablePopoverContent) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PillContent } from "./pillContent";
|
|
3
|
-
export const PillExpandablePopoverContent = ({ variant, customContent, onActionClick, descriptionText, date, count, mainAction, secondaryAction, tertiaryAction, errorHandler, descriptionId, childToDisplay }) => (_jsxs(_Fragment, { children: [variant === "placeholder" && customContent, variant === "default" && (_jsx(PillContent, { onActionClick: onActionClick, descriptionText: descriptionText, date: date, count: count, mainAction: mainAction, secondaryAction: secondaryAction, tertiaryAction: tertiaryAction, errorHandler: errorHandler, descriptionId: descriptionId })), childToDisplay.length > 0 && _jsx("div", { className: "zen-status-pill-popup__children", children: childToDisplay })] }));
|
|
3
|
+
export const PillExpandablePopoverContent = ({ variant, customContent, onActionClick, descriptionText, date, count, mainAction, secondaryAction, tertiaryAction, errorHandler, descriptionId, descriptionRef, childToDisplay }) => (_jsxs(_Fragment, { children: [variant === "placeholder" && customContent, variant === "default" && (_jsx(PillContent, { onActionClick: onActionClick, descriptionText: descriptionText, date: date, count: count, mainAction: mainAction, secondaryAction: secondaryAction, tertiaryAction: tertiaryAction, errorHandler: errorHandler, descriptionId: descriptionId, descriptionRef: descriptionRef })), childToDisplay.length > 0 && _jsx("div", { className: "zen-status-pill-popup__children", children: childToDisplay })] }));
|
|
@@ -10,10 +10,12 @@ interface IPillExpandableSimple extends IPillExpandableBase {
|
|
|
10
10
|
isMobile?: boolean;
|
|
11
11
|
ref?: RefObject<HTMLButtonElement | null>;
|
|
12
12
|
descriptionId?: string;
|
|
13
|
+
ariaHasPopup?: "dialog";
|
|
14
|
+
isDecorative?: boolean;
|
|
13
15
|
type?: TPillType;
|
|
14
16
|
}
|
|
15
17
|
export declare const PillExpandableSimple: {
|
|
16
|
-
({ onExpand, text, expanded, includeExpandIcon, type, icon, isBeta, isMobile, ref, className, descriptionId, dataAnalyticsId }: IPillExpandableSimple): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
({ onExpand, text, expanded, includeExpandIcon, type, icon, isBeta, isMobile, ref, className, descriptionId, ariaHasPopup, isDecorative, dataAnalyticsId }: IPillExpandableSimple): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
displayName: string;
|
|
18
20
|
};
|
|
19
21
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createElement, useCallback } from "react";
|
|
3
3
|
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
4
4
|
import { IconChevronTop } from "../icons/iconChevronTop";
|
|
5
5
|
import { IconChevronBottom } from "../icons/iconChevronBottom";
|
|
6
6
|
import { IconException } from "../icons/iconException";
|
|
7
7
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
8
|
-
export const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIcon = true, type = "warning", icon = IconException, isBeta, isMobile, ref, className, descriptionId, dataAnalyticsId
|
|
8
|
+
export const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIcon = true, type = "warning", icon = IconException, isBeta, isMobile, ref, className, descriptionId, ariaHasPopup, isDecorative, dataAnalyticsId
|
|
9
9
|
// eslint-disable-next-line complexity
|
|
10
10
|
}) => {
|
|
11
11
|
const iconDriveClassName = useDriveClassName("icon");
|
|
@@ -18,13 +18,7 @@ export const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIc
|
|
|
18
18
|
const iconSize = isBeta ? "big" : isLargeIcon ? "large" : "big";
|
|
19
19
|
const hasText = (text || "").trim().length > 0;
|
|
20
20
|
const isTextCentered = icon === false && !includeExpandIcon;
|
|
21
|
-
|
|
22
|
-
"zen-status-pill__container",
|
|
23
|
-
`zen-status-pill__container--${type}`,
|
|
24
|
-
containerDriveClassName || "",
|
|
25
|
-
className || "",
|
|
26
|
-
"zen-ellipsis"
|
|
27
|
-
]), ref: ref, onClick: onExpandHandler, tabIndex: !includeExpandIcon ? -1 : undefined, "aria-expanded": includeExpandIcon ? (expanded !== null && expanded !== void 0 ? expanded : false) : undefined, "aria-describedby": descriptionId }, (dataAnalyticsId ? { "data-analytics-id": dataAnalyticsId } : {}), { children: [icon !== false && (_jsx("div", { className: classNames([
|
|
21
|
+
const content = (_jsxs(_Fragment, { children: [icon !== false && (_jsx("div", { className: classNames([
|
|
28
22
|
"zen-status-pill__icon",
|
|
29
23
|
`zen-status-pill__icon--${type}`,
|
|
30
24
|
isLargeIcon ? "zen-status-pill__icon--large" : "",
|
|
@@ -38,6 +32,22 @@ export const PillExpandableSimple = ({ onExpand, text, expanded, includeExpandIc
|
|
|
38
32
|
isTextCentered ? "zen-status-pill__text--centered" : ""
|
|
39
33
|
]), children: text })), includeExpandIcon && (_jsx("div", { className: `zen-status-pill__expand-button zen-status-pill__expand-button--${type}`, children: _jsx("div", { className: "zen-status-pill__icon", children: createElement(ChevronIcon, {
|
|
40
34
|
size: iconSize
|
|
41
|
-
}) }) }))] }))
|
|
35
|
+
}) }) }))] }));
|
|
36
|
+
if (isDecorative) {
|
|
37
|
+
return (_jsx("span", { className: classNames([
|
|
38
|
+
"zen-status-pill__container",
|
|
39
|
+
`zen-status-pill__container--${type}`,
|
|
40
|
+
containerDriveClassName || "",
|
|
41
|
+
className || "",
|
|
42
|
+
"zen-ellipsis"
|
|
43
|
+
]), "aria-hidden": "true", children: content }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsx("button", Object.assign({ type: "button", className: classNames([
|
|
46
|
+
"zen-status-pill__container",
|
|
47
|
+
`zen-status-pill__container--${type}`,
|
|
48
|
+
containerDriveClassName || "",
|
|
49
|
+
className || "",
|
|
50
|
+
"zen-ellipsis"
|
|
51
|
+
]), ref: ref, onClick: onExpandHandler, tabIndex: !includeExpandIcon ? -1 : undefined, "aria-expanded": includeExpandIcon ? (expanded !== null && expanded !== void 0 ? expanded : false) : undefined, "aria-describedby": descriptionId, "aria-haspopup": ariaHasPopup, "data-role": ariaHasPopup }, (dataAnalyticsId ? { "data-analytics-id": dataAnalyticsId } : {}), { children: content })));
|
|
42
52
|
};
|
|
43
53
|
PillExpandableSimple.displayName = "PillExpandableSimple";
|
|
@@ -139,6 +139,7 @@ const SelectListInnerComp = ({
|
|
|
139
139
|
showCheckbox: showCheckbox,
|
|
140
140
|
state: state.itemsState.get(item.id),
|
|
141
141
|
focused: state.activeIndex === index,
|
|
142
|
+
divider: index < items.length - 1 ? item.divider : undefined,
|
|
142
143
|
onChange: onChangeItem,
|
|
143
144
|
onClick: onClickItem,
|
|
144
145
|
onFocusItem: onFocusItem
|
|
@@ -10,5 +10,14 @@ export interface ISelectListItem extends IZenIdComponentProps {
|
|
|
10
10
|
onClick?: (id: string) => void;
|
|
11
11
|
onFocusItem?: (id: string) => void;
|
|
12
12
|
multiLevel?: boolean;
|
|
13
|
+
/** When true, renders a 1px separator line below this item. */
|
|
14
|
+
divider?: boolean;
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* When true, renders the item label in `--text-error-message` red. Visual signal only — does not prevent selection.
|
|
18
|
+
* Only applies in single-select (SelectList) mode; ignored in multiselect (CheckboxListWithAction).
|
|
19
|
+
* Disabled+destructive renders with `--accents-error--main` (#ffeceb) on a transparent background, no hover feedback.
|
|
20
|
+
*/
|
|
21
|
+
destructive?: boolean;
|
|
13
22
|
}
|
|
14
|
-
export declare const SelectListItem: ({ id, disabled, state, showCheckbox, focused, onChange, onClick, onFocusItem, multiLevel, className, children }: ISelectListItem) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const SelectListItem: ({ id, disabled, state, showCheckbox, focused, onChange, onClick, onFocusItem, multiLevel, divider, title, destructive, className, children }: ISelectListItem) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,7 +23,16 @@ const getTabIndex = (showCheckbox, focused, disabled) => {
|
|
|
23
23
|
return -1;
|
|
24
24
|
return focused ? 0 : -1;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const getItemClassName = (showCheckbox, focused, destructive, driveClassName, className, divider) => classNames([
|
|
27
|
+
"zen-select-item",
|
|
28
|
+
showCheckbox ? "zen-select-item--with-checkbox" : "",
|
|
29
|
+
focused ? "zen-select-item--focused" : "",
|
|
30
|
+
destructive ? "zen-select-item--destructive" : "",
|
|
31
|
+
driveClassName || "",
|
|
32
|
+
className,
|
|
33
|
+
divider ? "zen-select-item--divider" : ""
|
|
34
|
+
]);
|
|
35
|
+
export const SelectListItem = ({ id, disabled = false, state = CheckboxState.Off, showCheckbox = false, focused = false, onChange, onClick, onFocusItem, multiLevel, divider, title, destructive, className = "", children }) => {
|
|
27
36
|
const driveClassName = useDriveClassName("zen-select-item");
|
|
28
37
|
const ChevronIcon = useDirectionalIcon(IconChevronRight, IconChevronLeft);
|
|
29
38
|
const onClickFunc = () => {
|
|
@@ -36,16 +45,10 @@ export const SelectListItem = ({ id, disabled = false, state = CheckboxState.Off
|
|
|
36
45
|
}
|
|
37
46
|
onChange && onChange(id, newState);
|
|
38
47
|
};
|
|
39
|
-
return (_jsx("li", { "data-id": id, className: classNames([
|
|
40
|
-
"zen-select-item",
|
|
41
|
-
showCheckbox ? "zen-select-item--with-checkbox" : "",
|
|
42
|
-
focused ? "zen-select-item--focused" : "",
|
|
43
|
-
driveClassName || "",
|
|
44
|
-
className
|
|
45
|
-
]), role: showCheckbox ? "menuitemcheckbox" : "option", "aria-selected": showCheckbox ? undefined : state === CheckboxState.On, "aria-checked": getAriaChecked(showCheckbox, state), "aria-disabled": disabled, tabIndex: getTabIndex(showCheckbox, focused, disabled), onFocus: !showCheckbox && !disabled && onFocusItem ? () => onFocusItem(id) : undefined, onClick: onClickFunc, id: id, children: _jsxs("div", { className: classNames([
|
|
48
|
+
return (_jsx("li", { "data-id": id, className: getItemClassName(showCheckbox, focused, destructive, driveClassName, className, divider), role: showCheckbox ? "menuitemcheckbox" : "option", "aria-selected": showCheckbox ? undefined : state === CheckboxState.On, "aria-checked": getAriaChecked(showCheckbox, state), "aria-disabled": disabled, tabIndex: getTabIndex(showCheckbox, focused, disabled), onFocus: !showCheckbox && !disabled && onFocusItem ? () => onFocusItem(id) : undefined, onClick: onClickFunc, id: id, children: _jsxs("div", { className: classNames([
|
|
46
49
|
"zen-select-list__item-content",
|
|
47
50
|
"zen-select-item__wrapper",
|
|
48
51
|
"zen-ellipsis",
|
|
49
52
|
multiLevel ? "zen-select-item__wrapper--with-arrow" : ""
|
|
50
|
-
]), children: [showCheckbox ? (_jsx(CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === CheckboxState.On, indeterminate: state === CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? _jsx(ChevronIcon, { size: "large" }) : null] }) }));
|
|
53
|
+
]), title: title || undefined, children: [showCheckbox ? (_jsx(CheckboxNonInteractive, { className: "zen-select-item__control-view", checked: state === CheckboxState.On, indeterminate: state === CheckboxState.Indeterminate, disabled: disabled, children: children })) : (children), multiLevel && !showCheckbox ? _jsx(ChevronIcon, { size: "large" }) : null] }) }));
|
|
51
54
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPagination } from "../../pagination/pagination";
|
|
2
|
-
export interface ITablePagination extends Pick<IPagination, "
|
|
2
|
+
export interface ITablePagination extends Pick<IPagination, "total">, Partial<Pick<IPagination, "activePage" | "perPage" | "onChange" | "disabled">> {
|
|
3
3
|
}
|
|
4
4
|
export declare const TablePagination: {
|
|
5
5
|
(_: ITablePagination): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactElement, ReactNode, RefObject } from "react";
|
|
2
|
-
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void) => {
|
|
3
|
-
bulkActions:
|
|
2
|
+
export declare const useTableChildren: (children: ReactNode, isMobile: boolean, selected: number, allSelected: boolean, clearSelection: () => void, activeId?: string, gridRef?: RefObject<HTMLElement | null>, onCloseDetailPanel?: () => void, isInfinite?: boolean, loadedCount?: number, excludedCount?: number, canUsePaginationTotal?: boolean, hasMoreRows?: boolean) => {
|
|
3
|
+
bulkActions: import("react/jsx-runtime").JSX.Element | undefined;
|
|
4
|
+
hasSelection: boolean;
|
|
4
5
|
pagination: ReactElement | undefined;
|
|
6
|
+
paginationTotal: number | undefined;
|
|
5
7
|
activePage: undefined;
|
|
6
8
|
fullscreenButton: ReactElement | undefined;
|
|
7
9
|
emptyList: ReactElement | undefined;
|
|
@@ -24,35 +24,58 @@ const isChildElement = function (child, expectedType) {
|
|
|
24
24
|
}
|
|
25
25
|
return false;
|
|
26
26
|
};
|
|
27
|
-
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel
|
|
28
|
-
|
|
27
|
+
export const useTableChildren = (children, isMobile, selected, allSelected, clearSelection, activeId, gridRef, onCloseDetailPanel,
|
|
28
|
+
// Desktop infinite scroll (Table's `onScrollEnd`): when true, a `Table.Pagination` child is
|
|
29
|
+
// rendered as the chevron-less "loaded" variant (see `pagination.tsx`) instead of the normal
|
|
30
|
+
// paged controls, driven by `loadedCount` (the number of rows currently rendered).
|
|
31
|
+
isInfinite = false, loadedCount = 0, excludedCount = 0, canUsePaginationTotal = true, hasMoreRows = false) => useMemo(() => {
|
|
32
|
+
let bulkActionButtons;
|
|
29
33
|
let tablePagination = undefined;
|
|
30
34
|
let activePage = undefined;
|
|
35
|
+
// A plain `let` reassigned only inside the `Children.forEach` callback below would be seen
|
|
36
|
+
// by TS as always `undefined` at the return statement (its pre-callback narrowed type) —
|
|
37
|
+
// see the `as ReactElement | undefined` casts used for the other fields above/below for the
|
|
38
|
+
// same reason. A property on a mutable object sidesteps that: property reads aren't narrowed
|
|
39
|
+
// the same way, so `paginationMeta.total` correctly types as `number | undefined` below.
|
|
40
|
+
const paginationMeta = {};
|
|
31
41
|
let tableFullscreen = undefined;
|
|
32
42
|
let emptyList = undefined;
|
|
33
43
|
let footer = undefined;
|
|
34
44
|
let detailPanel = undefined;
|
|
35
45
|
const other = [];
|
|
36
46
|
Children.forEach(children, child => {
|
|
47
|
+
var _a, _b;
|
|
37
48
|
if (!child) {
|
|
38
49
|
return;
|
|
39
50
|
}
|
|
40
51
|
if (isChildElement(child, TableBulkActions.displayName)) {
|
|
41
|
-
|
|
42
|
-
bulkActions = (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selected, allSelected: allSelected, onClearSelection: clearSelection, children: bulkActionButtons }));
|
|
52
|
+
bulkActionButtons = child.props.children || [];
|
|
43
53
|
return;
|
|
44
54
|
}
|
|
45
55
|
if (isChildElement(child, TablePagination.displayName)) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
paginationMeta.present = true;
|
|
57
|
+
const total = child.props.total || 0;
|
|
58
|
+
tablePagination = isInfinite
|
|
59
|
+
? createElement(Pagination, {
|
|
60
|
+
// activePage/perPage/onChange/gridRef/disabled are all paged-only (see
|
|
61
|
+
// Pagination's `variant` dispatch) and optional on IPagination for exactly
|
|
62
|
+
// this reason — intentionally omitted here rather than passed for no effect.
|
|
63
|
+
total,
|
|
64
|
+
variant: "loaded",
|
|
65
|
+
loadedCount,
|
|
66
|
+
includeText: true
|
|
67
|
+
})
|
|
68
|
+
: createElement(Pagination, {
|
|
69
|
+
activePage: (_a = child.props.activePage) !== null && _a !== void 0 ? _a : 0,
|
|
70
|
+
total,
|
|
71
|
+
perPage: child.props.perPage || 10,
|
|
72
|
+
onChange: (_b = child.props.onChange) !== null && _b !== void 0 ? _b : (() => undefined),
|
|
73
|
+
type: PaginationType.Compact,
|
|
74
|
+
includeText: true,
|
|
75
|
+
gridRef: gridRef,
|
|
76
|
+
disabled: child.props.disabled
|
|
77
|
+
});
|
|
78
|
+
paginationMeta.total = child.props.total;
|
|
56
79
|
activePage = child.props.activePage;
|
|
57
80
|
return;
|
|
58
81
|
}
|
|
@@ -90,9 +113,20 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
90
113
|
}
|
|
91
114
|
other.push(child);
|
|
92
115
|
});
|
|
116
|
+
const allRowsLoaded = (!paginationMeta.present && !hasMoreRows) || (paginationMeta.total !== undefined && loadedCount >= paginationMeta.total);
|
|
117
|
+
const hasExclusions = allSelected && excludedCount > 0;
|
|
118
|
+
const selectedCount = allSelected && !allRowsLoaded
|
|
119
|
+
? canUsePaginationTotal && paginationMeta.total !== undefined
|
|
120
|
+
? Math.max(0, paginationMeta.total - excludedCount)
|
|
121
|
+
: undefined
|
|
122
|
+
: selected;
|
|
123
|
+
const hasSelection = selectedCount === undefined || selectedCount > 0;
|
|
124
|
+
const bulkActions = bulkActionButtons !== undefined ? (_jsx(BulkActions, { gridType: isMobile ? DeviceType.Mobile : DeviceType.Desktop, selected: selectedCount !== null && selectedCount !== void 0 ? selectedCount : selected, allSelected: allSelected && !hasExclusions && hasSelection, selectionCountUnknown: hasExclusions && selectedCount === undefined, onClearSelection: clearSelection, children: bulkActionButtons })) : undefined;
|
|
93
125
|
return {
|
|
94
|
-
bulkActions
|
|
126
|
+
bulkActions,
|
|
127
|
+
hasSelection,
|
|
95
128
|
pagination: tablePagination,
|
|
129
|
+
paginationTotal: paginationMeta.total,
|
|
96
130
|
activePage: activePage,
|
|
97
131
|
fullscreenButton: tableFullscreen,
|
|
98
132
|
emptyList: emptyList,
|
|
@@ -100,4 +134,18 @@ export const useTableChildren = (children, isMobile, selected, allSelected, clea
|
|
|
100
134
|
detailPanel: detailPanel,
|
|
101
135
|
other: other
|
|
102
136
|
};
|
|
103
|
-
}, [
|
|
137
|
+
}, [
|
|
138
|
+
children,
|
|
139
|
+
clearSelection,
|
|
140
|
+
isMobile,
|
|
141
|
+
selected,
|
|
142
|
+
gridRef,
|
|
143
|
+
allSelected,
|
|
144
|
+
activeId,
|
|
145
|
+
onCloseDetailPanel,
|
|
146
|
+
isInfinite,
|
|
147
|
+
loadedCount,
|
|
148
|
+
excludedCount,
|
|
149
|
+
canUsePaginationTotal,
|
|
150
|
+
hasMoreRows
|
|
151
|
+
]);
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import { IEntityWithId } from "../../commonHelpers/entity";
|
|
2
|
-
declare const
|
|
3
|
+
export declare const DEFAULT_SHOW_MORE_CAP = 10;
|
|
4
|
+
/**
|
|
5
|
+
* Caps how many child rows render per parent, appending a "+N more" affordance.
|
|
6
|
+
* Desktop only: on mobile an expanded parent always renders its full child list, uncapped and
|
|
7
|
+
* with no "+N more" row, because the feed has no comparable density constraint.
|
|
8
|
+
* Memoize the object you pass — a new reference each render re-derives the entity tree.
|
|
9
|
+
*/
|
|
10
|
+
export type IShowMoreOptions<TParent> = {
|
|
11
|
+
/** Defaults to 10. */
|
|
12
|
+
cap?: number;
|
|
13
|
+
label?: (remaining: number) => ReactNode;
|
|
14
|
+
/** When true for a parent, all its children render with no cap and no "+N more" row. */
|
|
15
|
+
isUncapped?: (parent: TParent) => boolean;
|
|
16
|
+
} & ({
|
|
17
|
+
onClick: (parent: TParent) => void;
|
|
18
|
+
href?: never;
|
|
19
|
+
} | {
|
|
20
|
+
href: (parent: TParent) => string;
|
|
21
|
+
onClick?: never;
|
|
22
|
+
});
|
|
23
|
+
declare const NestedDataInt: <TParent extends IEntityWithId, TChild extends IEntityWithId>({ entities, children, expandedRows, useChildrenDataHook, maxHooks, showMore, hideChildrenOnMobile }: {
|
|
3
24
|
entities: TParent[];
|
|
4
25
|
expandedRows: string[];
|
|
5
26
|
useChildrenDataHook: (parentId: string, enabled: boolean) => {
|
|
@@ -10,6 +31,13 @@ declare const NestedDataInt: <TParent extends IEntityWithId, TChild extends IEnt
|
|
|
10
31
|
};
|
|
11
32
|
children: React.ReactNode;
|
|
12
33
|
maxHooks?: number;
|
|
34
|
+
showMore?: IShowMoreOptions<TParent>;
|
|
35
|
+
/**
|
|
36
|
+
* Mobile only. When true, parents render as plain rows on the feed: no children and no
|
|
37
|
+
* expand control. Pair it with a column renderer (e.g. `MainColumn`'s `mainText.createLink`)
|
|
38
|
+
* to send the user to a view that owns the full child list. Desktop is unaffected.
|
|
39
|
+
*/
|
|
40
|
+
hideChildrenOnMobile?: boolean;
|
|
13
41
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
42
|
export declare const NestedData: typeof NestedDataInt;
|
|
15
43
|
export {};
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { cloneElement, memo, useMemo } from "react";
|
|
3
|
-
|
|
14
|
+
import { createShowMoreRow, withFullChildren } from "../../commonHelpers/showMoreRow";
|
|
15
|
+
import { useMobile } from "../../commonHelpers/hooks/useMobile";
|
|
16
|
+
export const DEFAULT_SHOW_MORE_CAP = 10;
|
|
17
|
+
const NestedDataInt = ({ entities, children, expandedRows, useChildrenDataHook, maxHooks = 100, showMore, hideChildrenOnMobile }) => {
|
|
18
|
+
const isMobile = useMobile();
|
|
4
19
|
// Call hooks in a consistent order - this MUST be at the top level and cannot be wrapped in useEffect
|
|
5
20
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6
21
|
const hookResults = [];
|
|
@@ -15,23 +30,49 @@ const NestedDataInt = ({ entities, children, expandedRows, useChildrenDataHook,
|
|
|
15
30
|
}
|
|
16
31
|
// Memoize the entities with children calculation to avoid unnecessary re-renders
|
|
17
32
|
const entitiesWithChildren = useMemo(() => entities.map((entity, index) => {
|
|
33
|
+
var _a, _b;
|
|
18
34
|
const isExpanded = expandedRows.includes(entity.id);
|
|
19
35
|
if (index < maxHooks) {
|
|
20
36
|
const { data: childrenData, isLoading, error, isError } = hookResults[index];
|
|
37
|
+
// Must come before the skeleton branch below: that one attaches placeholder
|
|
38
|
+
// children to every collapsed parent, which is what makes the feed render an
|
|
39
|
+
// expand control. Dropping `children` entirely is what removes it.
|
|
40
|
+
if (isMobile && hideChildrenOnMobile) {
|
|
41
|
+
// `children` is destructured off rather than spread over, so a
|
|
42
|
+
// consumer-supplied array cannot survive and re-add the control.
|
|
43
|
+
const _c = entity, { children: _hidden } = _c, rest = __rest(_c, ["children"]);
|
|
44
|
+
const withoutChildren = rest;
|
|
45
|
+
// Selection still covers every real child (ticket decision #4) even though
|
|
46
|
+
// none of them render.
|
|
47
|
+
return childrenData ? withFullChildren(withoutChildren, childrenData) : withoutChildren;
|
|
48
|
+
}
|
|
21
49
|
if (isLoading || !isExpanded) {
|
|
22
|
-
|
|
50
|
+
const placeholderEntity = Object.assign(Object.assign({}, entity), { children: new Array(3)
|
|
23
51
|
.fill("")
|
|
24
52
|
.map((_1, j) => ({ id: `loading-${entity.id}-${j}`, isLoading: true })) });
|
|
53
|
+
// Skeletons render, but already-fetched children stay available so selecting
|
|
54
|
+
// the parent covers every child rather than the placeholders.
|
|
55
|
+
return childrenData ? withFullChildren(placeholderEntity, childrenData) : placeholderEntity;
|
|
25
56
|
}
|
|
26
57
|
if (isError && error) {
|
|
27
58
|
return Object.assign(Object.assign({}, entity), { children: [] });
|
|
28
59
|
}
|
|
29
60
|
if (childrenData) {
|
|
61
|
+
const cap = (_a = showMore === null || showMore === void 0 ? void 0 : showMore.cap) !== null && _a !== void 0 ? _a : DEFAULT_SHOW_MORE_CAP;
|
|
62
|
+
// The cap is a desktop density affordance; the mobile feed renders every child.
|
|
63
|
+
if (showMore && !isMobile && childrenData.length > cap && !((_b = showMore.isUncapped) === null || _b === void 0 ? void 0 : _b.call(showMore, entity))) {
|
|
64
|
+
const remaining = childrenData.length - cap;
|
|
65
|
+
const showMoreActivation = "href" in showMore && showMore.href
|
|
66
|
+
? { href: showMore.href(entity) }
|
|
67
|
+
: { onActivate: () => showMore.onClick(entity) };
|
|
68
|
+
const showMoreRow = createShowMoreRow(Object.assign({ parentId: entity.id, remaining, label: showMore.label }, showMoreActivation));
|
|
69
|
+
return withFullChildren(Object.assign(Object.assign({}, entity), { children: [...childrenData.slice(0, cap), showMoreRow] }), childrenData);
|
|
70
|
+
}
|
|
30
71
|
return Object.assign(Object.assign({}, entity), { children: childrenData });
|
|
31
72
|
}
|
|
32
73
|
}
|
|
33
74
|
return entity;
|
|
34
|
-
}), [entities, expandedRows, maxHooks, hookResults]);
|
|
75
|
+
}), [entities, expandedRows, maxHooks, hookResults, showMore, isMobile, hideChildrenOnMobile]);
|
|
35
76
|
/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any */
|
|
36
77
|
const table = useMemo(() => cloneElement(children, {
|
|
37
78
|
entities: entitiesWithChildren
|