@paygreen/pgui 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card-expandable/card-expandable.d.ts +16 -0
- package/dist/components/data-table/data-table.d.ts +9 -41
- package/dist/components/pagination/pagination.d.ts +8 -6
- package/dist/components/select/select.d.ts +6 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -40
- package/dist/index.mjs +2393 -2352
- package/dist/pgui.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/shiki-adapter.d.ts +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Card } from '@chakra-ui/react';
|
|
3
|
+
export interface CardExpandableProps extends Omit<Card.RootProps, 'title' | 'variant' | 'colorPalette'> {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
subtitle?: ReactNode;
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
tags?: ReactNode[];
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
defaultExpanded?: boolean;
|
|
10
|
+
onExpandChange?: (isExpanded: boolean) => void;
|
|
11
|
+
colorPalette?: 'blue' | 'orange';
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
isLazy?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const CardExpandable: ({ title, subtitle, header, tags, children, defaultExpanded, onExpandChange, colorPalette, icon, isLazy, ...cardProps }: CardExpandableProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default CardExpandable;
|
|
@@ -1,66 +1,34 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { IconButtonProps } from '@chakra-ui/react';
|
|
2
3
|
import { ColumnDef, ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
3
4
|
import { PaginationProps } from '../pagination/pagination';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
declare module '@tanstack/react-table' {
|
|
6
|
+
interface ColumnMeta<TData, TValue> {
|
|
7
|
+
align?: 'left' | 'center' | 'right';
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
7
11
|
export interface DataTablePagination extends PaginationProps {
|
|
8
|
-
/** Whether to enable client-side pagination (all data loaded at once) */
|
|
9
12
|
enableClientSide?: boolean;
|
|
10
13
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Props for the DataTable component
|
|
13
|
-
*/
|
|
14
14
|
export interface DataTableProps<TData> {
|
|
15
|
-
/** Array of data objects to display in the table */
|
|
16
15
|
data: TData[];
|
|
17
|
-
/** Column definitions for the table structure and rendering */
|
|
18
16
|
columns: ColumnDef<TData, any>[];
|
|
19
|
-
/** Pagination configuration (optional) */
|
|
20
17
|
pagination?: DataTablePagination;
|
|
21
|
-
/** Visual variant of the table */
|
|
22
18
|
variant?: 'simple' | 'striped';
|
|
23
|
-
/** Enable column filtering functionality */
|
|
24
19
|
enableFiltering?: boolean;
|
|
25
|
-
/** Enable column sorting functionality */
|
|
26
20
|
enableSorting?: boolean;
|
|
27
|
-
/** Content to display when no data is available */
|
|
28
21
|
emptyState?: ReactNode;
|
|
29
|
-
/** Enable responsive behavior (mobile cards view) */
|
|
30
22
|
responsive?: boolean;
|
|
31
|
-
/** Mobile view mode when responsive is enabled */
|
|
32
23
|
mobileView?: 'cards' | 'scroll';
|
|
33
|
-
/** Force mobile view regardless of screen size */
|
|
34
24
|
isMobile?: boolean;
|
|
35
|
-
/** Show loading state */
|
|
36
25
|
isLoading?: boolean;
|
|
37
|
-
/** Callback fired when column filters change */
|
|
38
26
|
onFilterChange?: (filters: ColumnFiltersState) => void;
|
|
39
|
-
/** Callback fired when sorting changes */
|
|
40
27
|
onSortingChange?: (sorting: SortingState) => void;
|
|
41
|
-
/** Callback fired when a row is clicked */
|
|
42
28
|
onRowClick?: (row: TData) => void;
|
|
29
|
+
paginationButtonProps?: Partial<IconButtonProps>;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
|
-
* DataTable component - A flexible, responsive data table with sorting, filtering, and pagination
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* <DataTable
|
|
50
|
-
* data={users}
|
|
51
|
-
* columns={columns}
|
|
52
|
-
* enableSorting
|
|
53
|
-
* enableFiltering
|
|
54
|
-
* pagination={{
|
|
55
|
-
* page: 1,
|
|
56
|
-
* pageSize: 10,
|
|
57
|
-
* totalItems: 100,
|
|
58
|
-
* setPage: setCurrentPage
|
|
59
|
-
* }}
|
|
60
|
-
* />
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
declare function DataTable<TData>({ data, columns, pagination, variant, enableFiltering, enableSorting, emptyState, responsive, mobileView, isMobile, isLoading, onFilterChange, onSortingChange, onRowClick, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
declare function DataTable<TData>({ data, columns, pagination, variant, enableFiltering, enableSorting, emptyState, responsive, mobileView, isMobile, isLoading, onFilterChange, onSortingChange, onRowClick, paginationButtonProps, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
64
32
|
declare namespace DataTable {
|
|
65
33
|
var displayName: string;
|
|
66
34
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorPalette } from '@chakra-ui/react';
|
|
1
|
+
import { ColorPalette, IconButtonProps } from '@chakra-ui/react';
|
|
2
2
|
/**
|
|
3
3
|
* Props for the Pagination component
|
|
4
4
|
*/
|
|
@@ -8,13 +8,15 @@ export interface PaginationProps {
|
|
|
8
8
|
/** Function to update the current page */
|
|
9
9
|
setPage: (page: number) => void;
|
|
10
10
|
/** Number of items displayed per page */
|
|
11
|
-
|
|
11
|
+
maxPerPage: number;
|
|
12
12
|
/** Total number of items across all pages */
|
|
13
|
-
|
|
13
|
+
totalResults: number;
|
|
14
14
|
/** Whether a page is currently loading - disables all interactions when true */
|
|
15
15
|
isLoadingPage?: boolean;
|
|
16
16
|
/** Color palette for the pagination */
|
|
17
17
|
colorPalette?: ColorPalette;
|
|
18
|
+
/** Props to pass to the pagination buttons */
|
|
19
|
+
buttonProps?: Partial<IconButtonProps>;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Pagination component for navigating through paginated data
|
|
@@ -24,13 +26,13 @@ export interface PaginationProps {
|
|
|
24
26
|
* <Pagination
|
|
25
27
|
* page={currentPage}
|
|
26
28
|
* setPage={setCurrentPage}
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
+
* maxPerPage={10}
|
|
30
|
+
* totalResults={250}
|
|
29
31
|
* />
|
|
30
32
|
* ```
|
|
31
33
|
*/
|
|
32
34
|
declare const Pagination: {
|
|
33
|
-
({ page, setPage,
|
|
35
|
+
({ page, setPage, maxPerPage, totalResults, isLoadingPage, colorPalette, buttonProps, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
34
36
|
displayName: string;
|
|
35
37
|
};
|
|
36
38
|
export { Pagination };
|
|
@@ -13,7 +13,7 @@ export interface SelectOptionType {
|
|
|
13
13
|
/**
|
|
14
14
|
* Props for single-select mode
|
|
15
15
|
*/
|
|
16
|
-
export interface SingleSelectProps extends Omit<ReactSelectProps<SelectOptionType, false>, 'options' | 'isMulti' | 'onChange' | 'value'> {
|
|
16
|
+
export interface SingleSelectProps extends Omit<ReactSelectProps<SelectOptionType, false>, 'options' | 'isMulti' | 'onChange' | 'value' | 'noOptionsMessage'> {
|
|
17
17
|
/** Array of options to display */
|
|
18
18
|
options?: SelectOptionType[];
|
|
19
19
|
/** Enable multi-selection - must be false or undefined */
|
|
@@ -35,11 +35,13 @@ export interface SingleSelectProps extends Omit<ReactSelectProps<SelectOptionTyp
|
|
|
35
35
|
/** Whether the select is in invalid state */
|
|
36
36
|
invalid?: boolean;
|
|
37
37
|
disabled?: boolean;
|
|
38
|
+
/** Custom message to display when no options are available */
|
|
39
|
+
noOptionsMessage?: string;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Props for multi-select mode
|
|
41
43
|
*/
|
|
42
|
-
export interface MultiSelectProps extends Omit<ReactSelectProps<SelectOptionType, true>, 'options' | 'isMulti' | 'onChange' | 'value'> {
|
|
44
|
+
export interface MultiSelectProps extends Omit<ReactSelectProps<SelectOptionType, true>, 'options' | 'isMulti' | 'onChange' | 'value' | 'noOptionsMessage'> {
|
|
43
45
|
/** Array of options to display */
|
|
44
46
|
options?: SelectOptionType[];
|
|
45
47
|
/** Enable multi-selection - must be true */
|
|
@@ -61,6 +63,8 @@ export interface MultiSelectProps extends Omit<ReactSelectProps<SelectOptionType
|
|
|
61
63
|
/** Whether the select is in invalid state */
|
|
62
64
|
invalid?: boolean;
|
|
63
65
|
disabled?: boolean;
|
|
66
|
+
/** Custom message to display when no options are available */
|
|
67
|
+
noOptionsMessage?: string;
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* Union type for Select component props
|
package/dist/index.d.ts
CHANGED