@pushwoosh/smart-components-kit 1.0.44 → 1.0.46

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.
@@ -14,6 +14,7 @@ type ExportCsvBannerProps = {
14
14
  showLastExportLocalStorageKey?: string;
15
15
  lastTasksParams?: GetLastTasksRequest;
16
16
  isKeepPageOpenWarning?: boolean;
17
+ onClose?: () => void;
17
18
  };
18
- export declare const ExportCsvBanner: ({ exportTask, updateExportTask, showLastExportLocalStorageKey, lastTasksParams, isKeepPageOpenWarning, }: ExportCsvBannerProps) => React.JSX.Element | null;
19
+ export declare const ExportCsvBanner: ({ exportTask, updateExportTask, showLastExportLocalStorageKey, lastTasksParams, isKeepPageOpenWarning, onClose, }: ExportCsvBannerProps) => React.JSX.Element | null;
19
20
  export {};
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useCallback, useEffect } from 'react';
2
2
  import { ExportResult, ProgressBar, Button } from '@pushwoosh/dumb-components';
3
3
  import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
4
4
  import { Horizontal } from '@pushwoosh/kit-helpers';
@@ -11,7 +11,8 @@ export const ExportCsvBanner = ({
11
11
  updateExportTask,
12
12
  showLastExportLocalStorageKey,
13
13
  lastTasksParams,
14
- isKeepPageOpenWarning
14
+ isKeepPageOpenWarning,
15
+ onClose
15
16
  }) => {
16
17
  const {
17
18
  getLastTasks,
@@ -78,6 +79,10 @@ export const ExportCsvBanner = ({
78
79
  });
79
80
  }
80
81
  }, [getLastTasks, isHidden, lastTasksParams, updateExportTask]);
82
+ const handleClose = useCallback(() => {
83
+ hide();
84
+ onClose === null || onClose === void 0 || onClose();
85
+ }, [hide, onClose]);
81
86
  if (!exportTask || isHidden) return null;
82
87
  const {
83
88
  filename,
@@ -95,7 +100,7 @@ export const ExportCsvBanner = ({
95
100
  type: "success",
96
101
  title: "Exporting complete",
97
102
  subtitle: `${resultSubTitle} ${filename}`,
98
- handleClose: hide,
103
+ handleClose: handleClose,
99
104
  rightSlot: React.createElement("a", {
100
105
  href: `/api/v2/statistics/exportMessagesStatistics/download/${filename}`,
101
106
  download: filename
@@ -126,6 +131,6 @@ export const ExportCsvBanner = ({
126
131
  size: "medium",
127
132
  view: "filled"
128
133
  }),
129
- handleClose: hide
134
+ handleClose: handleClose
130
135
  }));
131
136
  };
@@ -18,7 +18,8 @@ export function DataTable(props) {
18
18
  context,
19
19
  renderTableTop,
20
20
  renderAfter,
21
- hidePagination
21
+ hidePagination,
22
+ hidePageSizeSelector
22
23
  } = props;
23
24
  const {
24
25
  data,
@@ -35,7 +36,8 @@ export function DataTable(props) {
35
36
  renderItem: props.renderItem
36
37
  }), !hidePagination && React.createElement(DataTablePagination, {
37
38
  allLimits: [10, 20, 50, 100],
38
- padding: paginationPadding
39
+ padding: paginationPadding,
40
+ hidePageSizeSelector: hidePageSizeSelector
39
41
  }, data.loading && React.createElement(Horizontal, {
40
42
  "$alignItems": "center",
41
43
  "$gap": 4
@@ -6,6 +6,7 @@ export type DataTableListProps<I, P extends DataTableParams> = {
6
6
  isBordered?: boolean;
7
7
  context: DataTableContextType<I, P>;
8
8
  hidePagination?: boolean;
9
+ hidePageSizeSelector?: boolean;
9
10
  paginationPadding?: string;
10
11
  renderTableTop?: (ctxValue: DataTableContextType<I, P>) => ReactNode;
11
12
  renderList: (ctxValue: DataTableContextType<I, P>) => ReactNode;
@@ -17,6 +18,7 @@ export type DataTableItemProps<I, P extends DataTableParams> = {
17
18
  isBordered?: boolean;
18
19
  context: DataTableContextType<I, P>;
19
20
  hidePagination?: boolean;
21
+ hidePageSizeSelector?: boolean;
20
22
  paginationPadding?: string;
21
23
  renderTableTop?: (ctxValue: DataTableContextType<I, P>) => ReactNode;
22
24
  renderHead: () => ReactNode;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DataTablePaginationProps } from './types';
3
- export declare function DataTablePagination({ allLimits, padding, children }: DataTablePaginationProps): ReactElement;
3
+ export declare function DataTablePagination({ allLimits, padding, children, hidePageSizeSelector }: DataTablePaginationProps): ReactElement;
@@ -4,7 +4,8 @@ import { TablePagination } from '../TablePagination';
4
4
  export function DataTablePagination({
5
5
  allLimits,
6
6
  padding,
7
- children
7
+ children,
8
+ hidePageSizeSelector
8
9
  }) {
9
10
  var _data$value;
10
11
  const {
@@ -30,6 +31,7 @@ export function DataTablePagination({
30
31
  page: 1,
31
32
  perPage
32
33
  });
33
- }
34
+ },
35
+ hidePageSizeSelector: hidePageSizeSelector
34
36
  }, children);
35
37
  }
@@ -2,4 +2,5 @@ import type { PropsWithChildren } from 'react';
2
2
  export type DataTablePaginationProps = PropsWithChildren<{
3
3
  allLimits: number[];
4
4
  padding?: string;
5
+ hidePageSizeSelector?: boolean;
5
6
  }>;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TablePaginationProps } from './types';
3
- export declare function TablePagination({ activePage, totalPages, limit, allLimits, padding, onChangePage, onChangeLimit, children, }: TablePaginationProps): ReactElement;
3
+ export declare function TablePagination({ activePage, totalPages, limit, allLimits, padding, hidePageSizeSelector, onChangePage, onChangeLimit, children, }: TablePaginationProps): ReactElement;
@@ -7,6 +7,7 @@ export function TablePagination({
7
7
  limit,
8
8
  allLimits,
9
9
  padding = 24,
10
+ hidePageSizeSelector = false,
10
11
  onChangePage,
11
12
  onChangeLimit,
12
13
  children
@@ -22,7 +23,7 @@ export function TablePagination({
22
23
  activePage: activePage,
23
24
  totalPages: totalPages,
24
25
  onChangePage: onChangePage
25
- }), children), React.createElement(Horizontal, {
26
+ }), children), !hidePageSizeSelector && React.createElement(Horizontal, {
26
27
  "$gap": 8,
27
28
  "$alignItems": "center"
28
29
  }, React.createElement("span", null, "Show on page:"), React.createElement(NativeSelect, {
@@ -5,6 +5,7 @@ export type TablePaginationProps = PropsWithChildren<{
5
5
  limit: number;
6
6
  allLimits: number[];
7
7
  padding?: string | number;
8
+ hidePageSizeSelector?: boolean;
8
9
  onChangePage: (page: number) => void;
9
10
  onChangeLimit: (limit: number) => void;
10
11
  }>;
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "engines": {
50
50
  "node": ">= 18"
51
51
  },
52
- "version": "1.0.44"
52
+ "version": "1.0.46"
53
53
  }