@redis-ui/table 2.12.0 → 2.22.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/Table/Table.cjs +95 -146
- package/dist/Table/Table.context.cjs +16 -1
- package/dist/Table/Table.context.d.ts +23 -4
- package/dist/Table/Table.context.js +16 -1
- package/dist/Table/Table.d.ts +88 -5
- package/dist/Table/Table.js +95 -146
- package/dist/Table/Table.style.cjs +43 -13
- package/dist/Table/Table.style.d.ts +6 -6
- package/dist/Table/Table.style.js +43 -13
- package/dist/Table/Table.types.d.ts +22 -38
- package/dist/Table/components/Compose/Compose.cjs +45 -0
- package/dist/Table/components/Compose/Compose.d.ts +13 -0
- package/dist/Table/components/Compose/Compose.js +45 -0
- package/dist/Table/components/EmptyState/EmptyState.cjs +31 -0
- package/dist/Table/components/EmptyState/EmptyState.d.ts +6 -0
- package/dist/Table/components/EmptyState/EmptyState.js +31 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.cjs +20 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.d.ts +8 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.js +20 -0
- package/dist/Table/components/ExpandRowButton/ExpandAllRowsButton.test.d.ts +1 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.cjs +19 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.d.ts +6 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.js +19 -0
- package/dist/Table/components/ExpandRowButton/useExpanderColumn.test.d.ts +1 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.cjs +13 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.d.ts +3 -0
- package/dist/Table/components/HiddenCaption/HiddenCaption.js +13 -0
- package/dist/Table/components/PluggableTable/PluggableTable.cjs +19 -0
- package/dist/Table/components/PluggableTable/PluggableTable.d.ts +10 -0
- package/dist/Table/components/PluggableTable/PluggableTable.js +19 -0
- package/dist/Table/components/PluggableTable/compositionComponents.cjs +21 -0
- package/dist/Table/components/PluggableTable/compositionComponents.d.ts +67 -0
- package/dist/Table/components/PluggableTable/compositionComponents.js +21 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.cjs +1 -0
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.d.ts +1 -1
- package/dist/Table/components/RowSelection/HeaderMultiRowSelectionButton.js +1 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.cjs +26 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.d.ts +8 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.js +26 -0
- package/dist/Table/components/RowSelection/useRowSelectionColumn.test.d.ts +1 -0
- package/dist/Table/components/ShowOnRowHover/ShowOnRowHover.style.cjs +3 -1
- package/dist/Table/components/ShowOnRowHover/ShowOnRowHover.style.js +3 -1
- package/dist/Table/components/TableBody/TableBody.cjs +33 -0
- package/dist/Table/components/TableBody/TableBody.d.ts +23 -0
- package/dist/Table/components/TableBody/TableBody.js +33 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.cjs +8 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableBody/components/Compose/Compose.js +8 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.cjs +18 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.d.ts +9 -0
- package/dist/Table/components/TableBodyCell/TableBodyCell.js +18 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.cjs +25 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.d.ts +9 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.js +25 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.test.d.ts +1 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.cjs +48 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.d.ts +20 -0
- package/dist/Table/components/TableBodyRow/TableBodyRow.js +48 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.cjs +33 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.d.ts +2 -0
- package/dist/Table/components/TableBodyRow/TableBodyRowExpandable.js +33 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.cjs +17 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.d.ts +5 -0
- package/dist/Table/components/TableBodyRow/components/Compose/Compose.js +17 -0
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.cjs +3 -4
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.d.ts +1 -1
- package/dist/Table/components/TableExpandedRow/TableAnimatedExpandedRow.js +3 -4
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.cjs +9 -4
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.d.ts +1 -1
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.js +9 -4
- package/dist/Table/components/TableExpandedRow/TableExpandedRow.types.d.ts +3 -5
- package/dist/Table/components/TableHeader/TableHeader.cjs +28 -0
- package/dist/Table/components/TableHeader/TableHeader.d.ts +21 -0
- package/dist/Table/components/TableHeader/TableHeader.js +28 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.cjs +5 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableHeader/components/Compose/Compose.js +5 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.cjs +18 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/SRSortingNotification.js +18 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.cjs +15 -33
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.cjs +15 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.d.ts +8 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.context.js +15 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.d.ts +16 -4
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.js +15 -33
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.test.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.cjs +0 -22
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.d.ts +0 -1
- package/dist/Table/components/TableHeaderCell/TableHeaderCell.utils.js +1 -23
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.cjs +48 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.d.ts +9 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.js +48 -0
- package/dist/Table/components/TableHeaderCell/components/Compose/Compose.test.d.ts +1 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.cjs +35 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.d.ts +5 -0
- package/dist/Table/components/TableHeaderCell/components/Heading/Heading.js +35 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.cjs +16 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.d.ts +8 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/SortableHeading.js +16 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.cjs +24 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.d.ts +5 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/Compose/Compose.js +24 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.cjs +6 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.d.ts +2 -0
- package/dist/Table/components/TableHeaderCell/components/SortableHeading/components/SortIndicator/SortIndicator.js +6 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.cjs +27 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.d.ts +12 -0
- package/dist/Table/components/TableHeaderRow/TableHeaderRow.js +27 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.cjs +5 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TableHeaderRow/components/Compose/Compose.js +5 -0
- package/dist/Table/components/TablePagination/TablePagination.cjs +65 -99
- package/dist/Table/components/TablePagination/TablePagination.d.ts +23 -3
- package/dist/Table/components/TablePagination/TablePagination.js +66 -100
- package/dist/Table/components/TablePagination/TablePagination.style.cjs +70 -50
- package/dist/Table/components/TablePagination/TablePagination.style.d.ts +17 -50
- package/dist/Table/components/TablePagination/TablePagination.style.js +72 -52
- package/dist/Table/components/TablePagination/components/Compose/Compose.cjs +41 -0
- package/dist/Table/components/TablePagination/components/Compose/Compose.d.ts +3 -0
- package/dist/Table/components/TablePagination/components/Compose/Compose.js +41 -0
- package/dist/Table/components/TableRoot/TableRoot.cjs +13 -0
- package/dist/Table/components/TableRoot/TableRoot.d.ts +2 -0
- package/dist/Table/components/TableRoot/TableRoot.js +13 -0
- package/dist/Table/index.d.ts +3 -6
- package/dist/Table/plugins/ClickableRowPlugin.cjs +48 -0
- package/dist/Table/plugins/ClickableRowPlugin.d.ts +25 -0
- package/dist/Table/plugins/ClickableRowPlugin.js +48 -0
- package/dist/Table/plugins/ExpandableRowPlugin.cjs +44 -0
- package/dist/Table/plugins/ExpandableRowPlugin.d.ts +28 -0
- package/dist/Table/plugins/ExpandableRowPlugin.js +44 -0
- package/dist/Table/plugins/PaginationPlugin.cjs +45 -0
- package/dist/Table/plugins/PaginationPlugin.d.ts +16 -0
- package/dist/Table/plugins/PaginationPlugin.js +45 -0
- package/dist/Table/plugins/RowNavigationPlugin.cjs +139 -0
- package/dist/Table/plugins/RowNavigationPlugin.d.ts +44 -0
- package/dist/Table/plugins/RowNavigationPlugin.js +139 -0
- package/dist/Table/plugins/RowSelectionPlugin.cjs +28 -0
- package/dist/Table/plugins/RowSelectionPlugin.d.ts +12 -0
- package/dist/Table/plugins/RowSelectionPlugin.js +28 -0
- package/dist/Table/plugins/SortingPlugin.cjs +44 -0
- package/dist/Table/plugins/SortingPlugin.d.ts +18 -0
- package/dist/Table/plugins/SortingPlugin.js +44 -0
- package/dist/Table/tanStackExtendedTypes.d.ts +20 -0
- package/dist/Table/utils/plugin.utils.cjs +49 -0
- package/dist/Table/utils/plugin.utils.d.ts +17 -0
- package/dist/Table/utils/plugin.utils.js +49 -0
- package/dist/Table/utils/plugin.utils.test.d.ts +1 -0
- package/dist/Table/utils/table.utils.cjs +13 -0
- package/dist/Table/utils/table.utils.d.ts +2 -0
- package/dist/Table/utils/table.utils.js +13 -0
- package/dist/Table/utils/table.utils.test.d.ts +1 -0
- package/dist/index.cjs +60 -0
- package/dist/index.js +61 -1
- package/dist/node_modules/@tanstack/react-table/build/lib/index.cjs +7 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +8 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index.cjs +361 -4
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +361 -4
- package/package.json +6 -5
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.cjs +0 -16
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.d.ts +0 -8
- package/dist/Table/components/EmptyStateRow/EmptyStateRow.js +0 -16
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +0 -32
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -14
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -24
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
|
@@ -5,61 +5,81 @@ const redisUiStyles = require("@redislabsdev/redis-ui-styles");
|
|
|
5
5
|
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
6
6
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
7
|
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
8
|
-
const
|
|
9
|
-
displayName: "
|
|
8
|
+
const NavigationButton = _styled__default.default(redisUiComponents.Pagination.NavigationButton).withConfig({
|
|
9
|
+
displayName: "TablePaginationstyle__NavigationButton",
|
|
10
10
|
componentId: "RedisUI__sc-ccqfi0-0"
|
|
11
|
-
})(["
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
})(["", ";"], () => {
|
|
12
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.navButton;
|
|
13
|
+
return _styled.css`
|
|
14
|
+
width: ${styles.width};
|
|
15
|
+
height: ${styles.height};
|
|
16
|
+
padding: ${styles.padding};
|
|
17
|
+
color: ${styles.color};
|
|
18
|
+
|
|
19
|
+
&:disabled {
|
|
20
|
+
color: ${styles.disabledColor};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
const PaginationBar = _styled__default.default(redisUiComponents.Pagination.Bar).attrs(({
|
|
25
|
+
"aria-label": al
|
|
26
|
+
}) => ({
|
|
27
|
+
"aria-label": al ?? "Table Pagination"
|
|
28
|
+
})).withConfig({
|
|
29
|
+
displayName: "TablePaginationstyle__PaginationBar",
|
|
14
30
|
componentId: "RedisUI__sc-ccqfi0-1"
|
|
15
|
-
})(["
|
|
16
|
-
const
|
|
17
|
-
|
|
31
|
+
})(["", " width:100%;overflow:auto hidden;> *{flex:none;}"], () => {
|
|
32
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.bar;
|
|
33
|
+
return _styled.css`
|
|
34
|
+
font-size: ${styles.fontSize};
|
|
35
|
+
gap: ${styles.gap};
|
|
36
|
+
height: ${styles.height};
|
|
37
|
+
padding: ${styles.padding};
|
|
38
|
+
border: solid ${styles.borderColor};
|
|
39
|
+
border-width: ${styles.borderSize};
|
|
40
|
+
color: ${styles.textColor};
|
|
41
|
+
`;
|
|
42
|
+
});
|
|
43
|
+
const InfoLabel = _styled__default.default(redisUiComponents.Pagination.InfoLabel).withConfig({
|
|
44
|
+
displayName: "TablePaginationstyle__InfoLabel",
|
|
18
45
|
componentId: "RedisUI__sc-ccqfi0-2"
|
|
19
|
-
})(["
|
|
20
|
-
const
|
|
21
|
-
|
|
46
|
+
})(["line-height:", ";"], () => redisUiStyles.useTheme().components.table.pagination.select.height);
|
|
47
|
+
const useSelectStyles = () => {
|
|
48
|
+
const styles = redisUiStyles.useTheme().components.table.pagination.select;
|
|
49
|
+
return _styled.css`
|
|
50
|
+
gap: ${styles.gap};
|
|
51
|
+
height: ${styles.height};
|
|
52
|
+
padding: ${styles.padding};
|
|
53
|
+
color: ${styles.textColor};
|
|
54
|
+
font-size: ${styles.fontSize};
|
|
55
|
+
line-height: initial;
|
|
56
|
+
`;
|
|
57
|
+
};
|
|
58
|
+
const PageSizeSelect = _styled__default.default(redisUiComponents.Pagination.PageSizeSelect).withConfig({
|
|
59
|
+
displayName: "TablePaginationstyle__PageSizeSelect",
|
|
22
60
|
componentId: "RedisUI__sc-ccqfi0-3"
|
|
23
|
-
})(["
|
|
24
|
-
const
|
|
25
|
-
displayName: "
|
|
61
|
+
})(["", ""], useSelectStyles);
|
|
62
|
+
const PageSelect = _styled__default.default(redisUiComponents.Pagination.PageSelect).withConfig({
|
|
63
|
+
displayName: "TablePaginationstyle__PageSelect",
|
|
26
64
|
componentId: "RedisUI__sc-ccqfi0-4"
|
|
27
|
-
})(["
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
}).withConfig({
|
|
31
|
-
displayName: "TablePaginationstyle__ItemPerPageText",
|
|
65
|
+
})(["", ""], useSelectStyles);
|
|
66
|
+
const PageSizeGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
67
|
+
displayName: "TablePaginationstyle__PageSizeGroup",
|
|
32
68
|
componentId: "RedisUI__sc-ccqfi0-5"
|
|
33
|
-
})(["
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}).withConfig({
|
|
37
|
-
displayName: "TablePaginationstyle__PaginationIndexText",
|
|
69
|
+
})(["gap:1rem;"]);
|
|
70
|
+
const PageNavGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
71
|
+
displayName: "TablePaginationstyle__PageNavGroup",
|
|
38
72
|
componentId: "RedisUI__sc-ccqfi0-6"
|
|
39
|
-
})(["
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
}).withConfig({
|
|
43
|
-
displayName: "TablePaginationstyle__PageLabelText",
|
|
73
|
+
})(["gap:0.4rem;"]);
|
|
74
|
+
const PageSelectGroup = _styled__default.default(redisUiComponents.Pagination.Group).withConfig({
|
|
75
|
+
displayName: "TablePaginationstyle__PageSelectGroup",
|
|
44
76
|
componentId: "RedisUI__sc-ccqfi0-7"
|
|
45
|
-
})(["
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
componentId: "RedisUI__sc-ccqfi0-9"
|
|
55
|
-
})(["color:", ";flex-shrink:0;"], () => redisUiStyles.useTheme().components.table.components.tablePagination.totalPagesText.color);
|
|
56
|
-
exports.CountInfo = CountInfo;
|
|
57
|
-
exports.ItemPerPageText = ItemPerPageText;
|
|
58
|
-
exports.Label = Label;
|
|
59
|
-
exports.PageLabelText = PageLabelText;
|
|
60
|
-
exports.PaginationActions = PaginationActions;
|
|
61
|
-
exports.PaginationIconButton = PaginationIconButton;
|
|
62
|
-
exports.PaginationIndexText = PaginationIndexText;
|
|
63
|
-
exports.PaginationRow = PaginationRow;
|
|
64
|
-
exports.Select = Select;
|
|
65
|
-
exports.TotalPagesText = TotalPagesText;
|
|
77
|
+
})(["gap:0.4rem;"]);
|
|
78
|
+
exports.InfoLabel = InfoLabel;
|
|
79
|
+
exports.NavigationButton = NavigationButton;
|
|
80
|
+
exports.PageNavGroup = PageNavGroup;
|
|
81
|
+
exports.PageSelect = PageSelect;
|
|
82
|
+
exports.PageSelectGroup = PageSelectGroup;
|
|
83
|
+
exports.PageSizeGroup = PageSizeGroup;
|
|
84
|
+
exports.PageSizeSelect = PageSizeSelect;
|
|
85
|
+
exports.PaginationBar = PaginationBar;
|
|
@@ -1,51 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
allowReset?: boolean | undefined;
|
|
12
|
-
loading?: boolean | undefined;
|
|
13
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").RestSelectTriggerComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
-
Compose: ({ customContainer, id, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").SelectTriggerComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Compose/Compose.types").RestSelectTriggerComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
Value: <TOption_3 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ placeholder, valueRender, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Value/Value.types").SelectTriggerValueProps<TOption_3> & import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Value/Value.types").RestSelectTriggerValueProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
ResetButton: ({ children, title, ...restProps }: import("react").HTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
-
StatusIndicator: ({ className, style, size, ...restProps }: import("@redislabsdev/redis-ui-icons/monochrome").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "style" | "className">) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
-
LoadingIndicator: ({ loading, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").LoadingIndicatorProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").RestLoadingIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
-
Arrow: ({ icon, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Trigger/components/Arrow/Arrow.types").TriggerArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
ErrorIcon: ({ className, style, size, ...restProps }: import("@redislabsdev/redis-ui-icons/monochrome").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "style" | "className">) => import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
-
};
|
|
22
|
-
Content: (<TOption_4 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption_4> & {
|
|
23
|
-
searchable?: boolean | undefined;
|
|
24
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
OptionList: <TOption_5 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ optionValueRender, optionComponent: OptionComponent, maxVisibleItems, virtualized, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption_5> & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("@redislabsdev/redis-ui-components/dist/Inputs/components/Compose/TextCompose.types").TextInputComposeProps, "readOnly" | "parser" | "formatter"> & import("@redislabsdev/redis-ui-components/dist/Inputs/components/InputTag/InputTag.types").InputTagProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/LoadingIndicator/LoadingIndicator.types").LoadingIndicatorProps & import("@redislabsdev/redis-ui-components/dist/Inputs/components/ResetButton/ResetButton.types").ResetButtonProps & import("@redislabsdev/redis-ui-components").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
28
|
-
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
29
|
-
};
|
|
30
|
-
Option: (<TOption_6 extends import("@redislabsdev/redis-ui-components").SelectOption<string> = import("@redislabsdev/redis-ui-components").SelectOption<string>>({ option, content, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps<TOption_6> & {
|
|
31
|
-
content?: import("react").ReactNode;
|
|
32
|
-
} & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
33
|
-
Compose: import("react").ForwardRefExoticComponent<import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps<import("@redislabsdev/redis-ui-components").SelectOption<string>> & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps & import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
-
Content: (props: import("@redislabsdev/redis-ui-components/dist/Helpers/common.types").ComposeChildrenProps & import("@redislabsdev/redis-ui-components/dist/Select/components/Content/components/Option/components/Content/Content.types").RestSelectOptionContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
Indicator: ({ children, ...restProps }: import("@radix-ui/react-select").SelectItemIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
};
|
|
1
|
+
export declare const NavigationButton: import("styled-components").StyledComponent<({ navType, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationNavigationButtonProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
2
|
+
export declare const PaginationBar: import("styled-components").StyledComponent<"nav", any, {
|
|
3
|
+
'aria-label': string;
|
|
4
|
+
} & {
|
|
5
|
+
'aria-label': string;
|
|
6
|
+
}, "aria-label">;
|
|
7
|
+
export declare const InfoLabel: import("styled-components").StyledComponent<({ renderer, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationInfoLabelProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
8
|
+
export declare const PageSizeSelect: import("styled-components").StyledComponent<{
|
|
9
|
+
({ pageSizes, ...restProps }: import("@redislabsdev/redis-ui-components").PaginationPageSizeSelectProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
Label: ({ children, ...restProps }: import("@redislabsdev/redis-ui-components").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
11
|
}, any, {}, never>;
|
|
38
|
-
export declare const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
export declare const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
export declare const PageLabelText: import("styled-components").StyledComponent<({ size, variant, color, component, ellipsis, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Typography/components/Body/Body.types").BodyProps) => import("react/jsx-runtime").JSX.Element, any, {
|
|
46
|
-
size: "S";
|
|
47
|
-
}, "size">;
|
|
48
|
-
export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
49
|
-
export declare const TotalPagesText: import("styled-components").StyledComponent<({ size, variant, color, component, ellipsis, ...restProps }: import("@redislabsdev/redis-ui-components/dist/Typography/components/Body/Body.types").BodyProps) => import("react/jsx-runtime").JSX.Element, any, {
|
|
50
|
-
size: "S";
|
|
51
|
-
}, "size">;
|
|
12
|
+
export declare const PageSelect: import("styled-components").StyledComponent<{
|
|
13
|
+
({ ...restProps }: import("@redislabsdev/redis-ui-components").PaginationPageSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Label: ({ children, ...restProps }: import("@redislabsdev/redis-ui-components").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
}, any, {}, never>;
|
|
16
|
+
export declare const PageSizeGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
|
+
export declare const PageNavGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const PageSelectGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,63 +1,83 @@
|
|
|
1
|
-
import _styled from "styled-components";
|
|
1
|
+
import _styled, { css } from "styled-components";
|
|
2
2
|
import { useTheme } from "@redislabsdev/redis-ui-styles";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
displayName: "
|
|
3
|
+
import { Pagination } from "@redislabsdev/redis-ui-components";
|
|
4
|
+
const NavigationButton = _styled(Pagination.NavigationButton).withConfig({
|
|
5
|
+
displayName: "TablePaginationstyle__NavigationButton",
|
|
6
6
|
componentId: "RedisUI__sc-ccqfi0-0"
|
|
7
|
-
})(["
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
})(["", ";"], () => {
|
|
8
|
+
const styles = useTheme().components.table.pagination.navButton;
|
|
9
|
+
return css`
|
|
10
|
+
width: ${styles.width};
|
|
11
|
+
height: ${styles.height};
|
|
12
|
+
padding: ${styles.padding};
|
|
13
|
+
color: ${styles.color};
|
|
14
|
+
|
|
15
|
+
&:disabled {
|
|
16
|
+
color: ${styles.disabledColor};
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
});
|
|
20
|
+
const PaginationBar = _styled(Pagination.Bar).attrs(({
|
|
21
|
+
"aria-label": al
|
|
22
|
+
}) => ({
|
|
23
|
+
"aria-label": al ?? "Table Pagination"
|
|
24
|
+
})).withConfig({
|
|
25
|
+
displayName: "TablePaginationstyle__PaginationBar",
|
|
10
26
|
componentId: "RedisUI__sc-ccqfi0-1"
|
|
11
|
-
})(["
|
|
12
|
-
const
|
|
13
|
-
|
|
27
|
+
})(["", " width:100%;overflow:auto hidden;> *{flex:none;}"], () => {
|
|
28
|
+
const styles = useTheme().components.table.pagination.bar;
|
|
29
|
+
return css`
|
|
30
|
+
font-size: ${styles.fontSize};
|
|
31
|
+
gap: ${styles.gap};
|
|
32
|
+
height: ${styles.height};
|
|
33
|
+
padding: ${styles.padding};
|
|
34
|
+
border: solid ${styles.borderColor};
|
|
35
|
+
border-width: ${styles.borderSize};
|
|
36
|
+
color: ${styles.textColor};
|
|
37
|
+
`;
|
|
38
|
+
});
|
|
39
|
+
const InfoLabel = _styled(Pagination.InfoLabel).withConfig({
|
|
40
|
+
displayName: "TablePaginationstyle__InfoLabel",
|
|
14
41
|
componentId: "RedisUI__sc-ccqfi0-2"
|
|
15
|
-
})(["
|
|
16
|
-
const
|
|
17
|
-
|
|
42
|
+
})(["line-height:", ";"], () => useTheme().components.table.pagination.select.height);
|
|
43
|
+
const useSelectStyles = () => {
|
|
44
|
+
const styles = useTheme().components.table.pagination.select;
|
|
45
|
+
return css`
|
|
46
|
+
gap: ${styles.gap};
|
|
47
|
+
height: ${styles.height};
|
|
48
|
+
padding: ${styles.padding};
|
|
49
|
+
color: ${styles.textColor};
|
|
50
|
+
font-size: ${styles.fontSize};
|
|
51
|
+
line-height: initial;
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
const PageSizeSelect = _styled(Pagination.PageSizeSelect).withConfig({
|
|
55
|
+
displayName: "TablePaginationstyle__PageSizeSelect",
|
|
18
56
|
componentId: "RedisUI__sc-ccqfi0-3"
|
|
19
|
-
})(["
|
|
20
|
-
const
|
|
21
|
-
displayName: "
|
|
57
|
+
})(["", ""], useSelectStyles);
|
|
58
|
+
const PageSelect = _styled(Pagination.PageSelect).withConfig({
|
|
59
|
+
displayName: "TablePaginationstyle__PageSelect",
|
|
22
60
|
componentId: "RedisUI__sc-ccqfi0-4"
|
|
23
|
-
})(["
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}).withConfig({
|
|
27
|
-
displayName: "TablePaginationstyle__ItemPerPageText",
|
|
61
|
+
})(["", ""], useSelectStyles);
|
|
62
|
+
const PageSizeGroup = _styled(Pagination.Group).withConfig({
|
|
63
|
+
displayName: "TablePaginationstyle__PageSizeGroup",
|
|
28
64
|
componentId: "RedisUI__sc-ccqfi0-5"
|
|
29
|
-
})(["
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}).withConfig({
|
|
33
|
-
displayName: "TablePaginationstyle__PaginationIndexText",
|
|
65
|
+
})(["gap:1rem;"]);
|
|
66
|
+
const PageNavGroup = _styled(Pagination.Group).withConfig({
|
|
67
|
+
displayName: "TablePaginationstyle__PageNavGroup",
|
|
34
68
|
componentId: "RedisUI__sc-ccqfi0-6"
|
|
35
|
-
})(["
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
}).withConfig({
|
|
39
|
-
displayName: "TablePaginationstyle__PageLabelText",
|
|
69
|
+
})(["gap:0.4rem;"]);
|
|
70
|
+
const PageSelectGroup = _styled(Pagination.Group).withConfig({
|
|
71
|
+
displayName: "TablePaginationstyle__PageSelectGroup",
|
|
40
72
|
componentId: "RedisUI__sc-ccqfi0-7"
|
|
41
|
-
})(["
|
|
42
|
-
const Label = _styled.label.withConfig({
|
|
43
|
-
displayName: "TablePaginationstyle__Label",
|
|
44
|
-
componentId: "RedisUI__sc-ccqfi0-8"
|
|
45
|
-
})(["all:unset;"]);
|
|
46
|
-
const TotalPagesText = _styled(Typography.Body).attrs({
|
|
47
|
-
size: "S"
|
|
48
|
-
}).withConfig({
|
|
49
|
-
displayName: "TablePaginationstyle__TotalPagesText",
|
|
50
|
-
componentId: "RedisUI__sc-ccqfi0-9"
|
|
51
|
-
})(["color:", ";flex-shrink:0;"], () => useTheme().components.table.components.tablePagination.totalPagesText.color);
|
|
73
|
+
})(["gap:0.4rem;"]);
|
|
52
74
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Select,
|
|
62
|
-
TotalPagesText
|
|
75
|
+
InfoLabel,
|
|
76
|
+
NavigationButton,
|
|
77
|
+
PageNavGroup,
|
|
78
|
+
PageSelect,
|
|
79
|
+
PageSelectGroup,
|
|
80
|
+
PageSizeGroup,
|
|
81
|
+
PageSizeSelect,
|
|
82
|
+
PaginationBar
|
|
63
83
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../../../../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const Table_context = require("../../../../Table.context.cjs");
|
|
7
|
+
const PaginationPlugin = require("../../../../plugins/PaginationPlugin.cjs");
|
|
8
|
+
const TablePaginationCompose = ({
|
|
9
|
+
children
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
table
|
|
13
|
+
} = Table_context.useTableContext();
|
|
14
|
+
const pagination = PaginationPlugin.usePaginationContext();
|
|
15
|
+
const paginationEnabled = !!pagination;
|
|
16
|
+
const {
|
|
17
|
+
pageIndex,
|
|
18
|
+
pageSize
|
|
19
|
+
} = table.getState().pagination;
|
|
20
|
+
const pageCount = Math.max(table.getPageCount(), 1);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (paginationEnabled) {
|
|
23
|
+
const fixedIndex = Math.min(pageIndex, pageCount - 1);
|
|
24
|
+
if (fixedIndex !== pageIndex) table.setPageIndex(fixedIndex);
|
|
25
|
+
}
|
|
26
|
+
}, [pageCount, pageIndex, table, paginationEnabled]);
|
|
27
|
+
if (!paginationEnabled) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return jsxRuntime.jsxRuntimeExports.jsx(redisUiComponents.Pagination.Compose, {
|
|
31
|
+
onPageChange: table.setPageIndex,
|
|
32
|
+
pageIndex,
|
|
33
|
+
pageSize,
|
|
34
|
+
pageCount,
|
|
35
|
+
onPageSizeChange: table.setPageSize,
|
|
36
|
+
totalItemCount: table.getRowCount(),
|
|
37
|
+
visibleItemCount: table.getRowModel().rows.length,
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.TablePaginationCompose = TablePaginationCompose;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { Pagination } from "@redislabsdev/redis-ui-components";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useTableContext } from "../../../../Table.context.js";
|
|
5
|
+
import { usePaginationContext } from "../../../../plugins/PaginationPlugin.js";
|
|
6
|
+
const TablePaginationCompose = ({
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
table
|
|
11
|
+
} = useTableContext();
|
|
12
|
+
const pagination = usePaginationContext();
|
|
13
|
+
const paginationEnabled = !!pagination;
|
|
14
|
+
const {
|
|
15
|
+
pageIndex,
|
|
16
|
+
pageSize
|
|
17
|
+
} = table.getState().pagination;
|
|
18
|
+
const pageCount = Math.max(table.getPageCount(), 1);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (paginationEnabled) {
|
|
21
|
+
const fixedIndex = Math.min(pageIndex, pageCount - 1);
|
|
22
|
+
if (fixedIndex !== pageIndex) table.setPageIndex(fixedIndex);
|
|
23
|
+
}
|
|
24
|
+
}, [pageCount, pageIndex, table, paginationEnabled]);
|
|
25
|
+
if (!paginationEnabled) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return jsxRuntimeExports.jsx(Pagination.Compose, {
|
|
29
|
+
onPageChange: table.setPageIndex,
|
|
30
|
+
pageIndex,
|
|
31
|
+
pageSize,
|
|
32
|
+
pageCount,
|
|
33
|
+
onPageSizeChange: table.setPageSize,
|
|
34
|
+
totalItemCount: table.getRowCount(),
|
|
35
|
+
visibleItemCount: table.getRowModel().rows.length,
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
TablePaginationCompose
|
|
41
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const Table_style = require("../../Table.style.cjs");
|
|
5
|
+
const RowNavigationPlugin = require("../../plugins/RowNavigationPlugin.cjs");
|
|
6
|
+
const TableRoot = (props) => {
|
|
7
|
+
const navigationProps = RowNavigationPlugin.useHandleRowNavigationOnTable(props);
|
|
8
|
+
return jsxRuntime.jsxRuntimeExports.jsx(Table_style.Table, {
|
|
9
|
+
...props,
|
|
10
|
+
...navigationProps
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
exports.TableRoot = TableRoot;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { Table } from "../../Table.style.js";
|
|
3
|
+
import { useHandleRowNavigationOnTable } from "../../plugins/RowNavigationPlugin.js";
|
|
4
|
+
const TableRoot = (props) => {
|
|
5
|
+
const navigationProps = useHandleRowNavigationOnTable(props);
|
|
6
|
+
return jsxRuntimeExports.jsx(Table, {
|
|
7
|
+
...props,
|
|
8
|
+
...navigationProps
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
TableRoot
|
|
13
|
+
};
|
package/dist/Table/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { default as Table } from './Table';
|
|
2
2
|
export { ShowOnRowHover } from './components/ShowOnRowHover/ShowOnRowHover.style';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export type
|
|
6
|
-
export type { PaginationTypes } from './Table.types';
|
|
7
|
-
export type { SortingTypes } from './Table.types';
|
|
8
|
-
export { useTableContext } from './Table.context';
|
|
3
|
+
export * from './Table.types';
|
|
4
|
+
export * from './Table.context';
|
|
5
|
+
export { type TablePluginData, buildPluginContext } from './utils/plugin.utils';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
4
|
+
const plugin_utils = require("../utils/plugin.utils.cjs");
|
|
5
|
+
const Table_context = require("../Table.context.cjs");
|
|
6
|
+
const getTrue = () => true;
|
|
7
|
+
const TableClickableRowContextKey = "clickableRow";
|
|
8
|
+
const useClickableRowPlugin = ({
|
|
9
|
+
getCanRowClick = getTrue,
|
|
10
|
+
onRowClick,
|
|
11
|
+
shouldClickOnEnter = false
|
|
12
|
+
}) => {
|
|
13
|
+
return onRowClick ? {
|
|
14
|
+
tableOptions: {},
|
|
15
|
+
context: plugin_utils.buildPluginContext(TableClickableRowContextKey, {
|
|
16
|
+
getCanRowClick,
|
|
17
|
+
onRowClick,
|
|
18
|
+
shouldClickOnEnter
|
|
19
|
+
})
|
|
20
|
+
} : void 0;
|
|
21
|
+
};
|
|
22
|
+
const useClickableRowContext = () => Table_context.usePluginContext(TableClickableRowContextKey);
|
|
23
|
+
const useHandleClickableRow = ({
|
|
24
|
+
row,
|
|
25
|
+
onClick,
|
|
26
|
+
onKeyDown
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
getCanRowClick,
|
|
30
|
+
onRowClick,
|
|
31
|
+
shouldClickOnEnter
|
|
32
|
+
} = useClickableRowContext() || {};
|
|
33
|
+
const handleClick = redisUiComponents.combineHandlers(onRowClick && (getCanRowClick == null ? void 0 : getCanRowClick(row)) ? () => onRowClick(row) : void 0, onClick);
|
|
34
|
+
const handleKeyDown = redisUiComponents.combineHandlers(shouldClickOnEnter && handleClick ? (event) => {
|
|
35
|
+
var _a;
|
|
36
|
+
if (event.key === "Enter" && event.target === event.currentTarget) {
|
|
37
|
+
(_a = event.currentTarget) == null ? void 0 : _a.click();
|
|
38
|
+
}
|
|
39
|
+
} : void 0, onKeyDown);
|
|
40
|
+
return {
|
|
41
|
+
onClick: handleClick,
|
|
42
|
+
onKeyDown: handleKeyDown
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.TableClickableRowContextKey = TableClickableRowContextKey;
|
|
46
|
+
exports.useClickableRowContext = useClickableRowContext;
|
|
47
|
+
exports.useClickableRowPlugin = useClickableRowPlugin;
|
|
48
|
+
exports.useHandleClickableRow = useHandleClickableRow;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
+
import { type Row } from '@tanstack/react-table';
|
|
3
|
+
import { TablePluginData } from '../utils/plugin.utils';
|
|
4
|
+
export declare const TableClickableRowContextKey = "clickableRow";
|
|
5
|
+
export type TableClickableRowContext<T extends object> = {
|
|
6
|
+
/** Allows individual rows to be clickable */
|
|
7
|
+
getCanRowClick: (row: Row<T>) => boolean;
|
|
8
|
+
/** Handles click on the row */
|
|
9
|
+
onRowClick: (row: Row<T>) => void;
|
|
10
|
+
/** Allows simulating click on the row, when pressing Enter key */
|
|
11
|
+
shouldClickOnEnter: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type TableClickableRowParams<T extends object> = Partial<TableClickableRowContext<T>>;
|
|
14
|
+
export declare const useClickableRowPlugin: <T extends object>({ getCanRowClick, onRowClick, shouldClickOnEnter }: Partial<TableClickableRowContext<T>>) => TablePluginData<T>;
|
|
15
|
+
export declare const useClickableRowContext: <T extends object>() => TableClickableRowContext<T> | undefined;
|
|
16
|
+
type UseHandleClickableRowParams<T extends object> = {
|
|
17
|
+
row: Row<T>;
|
|
18
|
+
onClick?: MouseEventHandler<HTMLTableRowElement>;
|
|
19
|
+
onKeyDown?: KeyboardEventHandler<HTMLTableRowElement>;
|
|
20
|
+
};
|
|
21
|
+
export declare const useHandleClickableRow: <T extends object>({ row, onClick, onKeyDown }: UseHandleClickableRowParams<T>) => {
|
|
22
|
+
onClick: MouseEventHandler<HTMLTableRowElement> | undefined;
|
|
23
|
+
onKeyDown: ((event: import("react").KeyboardEvent<HTMLTableRowElement>) => void) | undefined;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { combineHandlers } from "@redislabsdev/redis-ui-components";
|
|
2
|
+
import { buildPluginContext } from "../utils/plugin.utils.js";
|
|
3
|
+
import { usePluginContext } from "../Table.context.js";
|
|
4
|
+
const getTrue = () => true;
|
|
5
|
+
const TableClickableRowContextKey = "clickableRow";
|
|
6
|
+
const useClickableRowPlugin = ({
|
|
7
|
+
getCanRowClick = getTrue,
|
|
8
|
+
onRowClick,
|
|
9
|
+
shouldClickOnEnter = false
|
|
10
|
+
}) => {
|
|
11
|
+
return onRowClick ? {
|
|
12
|
+
tableOptions: {},
|
|
13
|
+
context: buildPluginContext(TableClickableRowContextKey, {
|
|
14
|
+
getCanRowClick,
|
|
15
|
+
onRowClick,
|
|
16
|
+
shouldClickOnEnter
|
|
17
|
+
})
|
|
18
|
+
} : void 0;
|
|
19
|
+
};
|
|
20
|
+
const useClickableRowContext = () => usePluginContext(TableClickableRowContextKey);
|
|
21
|
+
const useHandleClickableRow = ({
|
|
22
|
+
row,
|
|
23
|
+
onClick,
|
|
24
|
+
onKeyDown
|
|
25
|
+
}) => {
|
|
26
|
+
const {
|
|
27
|
+
getCanRowClick,
|
|
28
|
+
onRowClick,
|
|
29
|
+
shouldClickOnEnter
|
|
30
|
+
} = useClickableRowContext() || {};
|
|
31
|
+
const handleClick = combineHandlers(onRowClick && (getCanRowClick == null ? void 0 : getCanRowClick(row)) ? () => onRowClick(row) : void 0, onClick);
|
|
32
|
+
const handleKeyDown = combineHandlers(shouldClickOnEnter && handleClick ? (event) => {
|
|
33
|
+
var _a;
|
|
34
|
+
if (event.key === "Enter" && event.target === event.currentTarget) {
|
|
35
|
+
(_a = event.currentTarget) == null ? void 0 : _a.click();
|
|
36
|
+
}
|
|
37
|
+
} : void 0, onKeyDown);
|
|
38
|
+
return {
|
|
39
|
+
onClick: handleClick,
|
|
40
|
+
onKeyDown: handleKeyDown
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
TableClickableRowContextKey,
|
|
45
|
+
useClickableRowContext,
|
|
46
|
+
useClickableRowPlugin,
|
|
47
|
+
useHandleClickableRow
|
|
48
|
+
};
|