@ztwoint/z-ui 0.1.27 → 0.1.29
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/assets/icons/chevron-left.d.ts +7 -0
- package/dist/components/assets/icons/chevron-left.js +20 -0
- package/dist/components/assets/icons/chevron-right.js +30 -0
- package/dist/components/assets/icons/double-chevron-left.d.ts +7 -0
- package/dist/components/assets/icons/double-chevron-left.js +24 -0
- package/dist/components/assets/icons/double-chevron-right.d.ts +7 -0
- package/dist/components/assets/icons/double-chevron-right.js +24 -0
- package/dist/components/assets/icons/info-icon.js +16 -0
- package/dist/components/assets/icons/magnifier-icon.js +16 -0
- package/dist/components/assets/icons/sub-nav-indicator.d.ts +3 -2
- package/dist/components/assets/icons/sub-nav-indicator.js +26 -41
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +45 -30
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-content.js +16 -16
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-footer.js +1 -1
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-group.js +24 -16
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-header.js +60 -54
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-item.js +61 -62
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-provider.js +23 -23
- package/dist/components/collapsible-side-nav-bar/side-nav-bar.d.ts +1 -1
- package/dist/components/collapsible-side-nav-bar/side-nav-bar.js +14 -14
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dropdown-menu/z2-dropdown-menu.js +255 -0
- package/dist/components/nav-header/nav-header.js +7 -7
- package/dist/components/table/components/cell/boolean-cell.d.ts +7 -0
- package/dist/components/table/components/cell/boolean-cell.js +7 -0
- package/dist/components/table/components/cell/index.d.ts +3 -0
- package/dist/components/table/components/cell/number-cell.d.ts +7 -0
- package/dist/components/table/components/cell/number-cell.js +5 -0
- package/dist/components/table/components/cell/text-cell.d.ts +7 -0
- package/dist/components/table/components/cell/text-cell.js +5 -0
- package/dist/components/table/components/index.d.ts +11 -0
- package/dist/components/table/components/pagination/components/index.d.ts +3 -0
- package/dist/components/table/components/pagination/components/pagination-info.d.ts +4 -0
- package/dist/components/table/components/pagination/components/pagination-info.js +27 -0
- package/dist/components/table/components/pagination/components/pagination-quick-jumper.d.ts +4 -0
- package/dist/components/table/components/pagination/components/pagination-quick-jumper.hook.d.ts +6 -0
- package/dist/components/table/components/pagination/components/pagination-quick-jumper.hook.js +24 -0
- package/dist/components/table/components/pagination/components/pagination-quick-jumper.js +35 -0
- package/dist/components/table/components/pagination/index.d.ts +6 -0
- package/dist/components/table/components/pagination/pagination.const.d.ts +26 -0
- package/dist/components/table/components/pagination/pagination.const.js +22 -0
- package/dist/components/table/components/pagination/pagination.d.ts +4 -0
- package/dist/components/table/components/pagination/pagination.hook.d.ts +5 -0
- package/dist/components/table/components/pagination/pagination.hook.js +22 -0
- package/dist/components/table/components/pagination/pagination.js +112 -0
- package/dist/components/table/components/pagination/pagination.type.d.ts +33 -0
- package/dist/components/table/components/pagination/pagination.utils.d.ts +7 -0
- package/dist/components/table/components/pagination/pagination.utils.js +35 -0
- package/dist/components/table/components/table-cell.d.ts +15 -0
- package/dist/components/table/components/table-cell.js +45 -0
- package/dist/components/table/components/table-empty-state.d.ts +7 -0
- package/dist/components/table/components/table-empty-state.js +6 -0
- package/dist/components/table/components/table-filter/filters/boolean.d.ts +3 -0
- package/dist/components/table/components/table-filter/filters/boolean.js +31 -0
- package/dist/components/table/components/table-filter/filters/index.d.ts +3 -0
- package/dist/components/table/components/table-filter/filters/number.d.ts +3 -0
- package/dist/components/table/components/table-filter/filters/number.js +28 -0
- package/dist/components/table/components/table-filter/filters/text.d.ts +3 -0
- package/dist/components/table/components/table-filter/filters/text.js +28 -0
- package/dist/components/table/components/table-filter/index.d.ts +1 -0
- package/dist/components/table/components/table-filter/table-filter.d.ts +9 -0
- package/dist/components/table/components/table-filter/table-filter.hook.d.ts +15 -0
- package/dist/components/table/components/table-filter/table-filter.hook.js +34 -0
- package/dist/components/table/components/table-filter/table-filter.js +105 -0
- package/dist/components/table/components/table-filter/table-filter.type.d.ts +18 -0
- package/dist/components/table/components/table-footer-content.d.ts +7 -0
- package/dist/components/table/components/table-footer-content.js +9 -0
- package/dist/components/table/components/table-footer.d.ts +7 -0
- package/dist/components/table/components/table-footer.js +6 -0
- package/dist/components/table/components/table-header/index.d.ts +2 -0
- package/dist/components/table/components/table-header/table-header.d.ts +9 -0
- package/dist/components/table/components/table-header/table-header.js +27 -0
- package/dist/components/table/components/table-header/table-header.utils.d.ts +5 -0
- package/dist/components/table/components/table-header/table-header.utils.js +15 -0
- package/dist/components/table/components/table-header/table-sort-icon.d.ts +8 -0
- package/dist/components/table/components/table-header/table-sort-icon.js +13 -0
- package/dist/components/table/components/table-header-content.d.ts +7 -0
- package/dist/components/table/components/table-header-content.js +9 -0
- package/dist/components/table/components/table-header-wrapper.d.ts +7 -0
- package/dist/components/table/components/table-header-wrapper.js +9 -0
- package/dist/components/table/components/table-loading-state.d.ts +7 -0
- package/dist/components/table/components/table-loading-state.js +9 -0
- package/dist/components/table/components/table-row.d.ts +11 -0
- package/dist/components/table/components/table-row.js +23 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/table/table-provider.d.ts +26 -0
- package/dist/components/table/table-provider.js +45 -0
- package/dist/components/table/table.const.d.ts +24 -0
- package/dist/components/table/table.const.js +27 -0
- package/dist/components/table/table.context.d.ts +7 -0
- package/dist/components/table/table.context.js +11 -0
- package/dist/components/table/table.d.ts +4 -0
- package/dist/components/table/table.js +39 -0
- package/dist/components/table/table.type.d.ts +63 -0
- package/dist/components/table/table.utils.d.ts +3 -0
- package/dist/components/table/table.utils.js +5 -0
- package/dist/css/config/colors/components/select.css +1 -1
- package/dist/css/config/colors/defaults.css +378 -137
- package/dist/css/config/colors/semantic-colors.css +356 -0
- package/dist/css/config/components/button.css +152 -0
- package/dist/css/config/components/index.css +1 -0
- package/dist/css/config/config-deprecated.css +41 -0
- package/dist/css/config/config.css +4 -18
- package/dist/css/config/typography/2xl.css +7 -0
- package/dist/css/config/typography/3xl.css +7 -0
- package/dist/css/config/typography/4xl.css +7 -0
- package/dist/css/config/typography/base.css +7 -0
- package/dist/css/config/typography/lg.css +7 -0
- package/dist/css/config/typography/sm.css +7 -0
- package/dist/css/config/typography/xl.css +7 -0
- package/dist/css/config/typography/xs.css +7 -0
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/devComponents/navigation/index.d.ts +1 -0
- package/dist/devComponents/navigation/navigation.d.ts +1 -0
- package/dist/index.d.ts +41 -8
- package/dist/index.js +176 -102
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/theme.hook.d.ts +8 -0
- package/dist/lib/theme.hook.js +50 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/CheckCircleIcon.js +26 -0
- package/dist/node_modules/@heroicons/react/24/solid/esm/XCircleIcon.js +26 -0
- package/dist/routes/default.d.ts +2 -0
- package/dist/routes/index.d.ts +2 -0
- package/dist/routes/table.d.ts +2 -0
- package/dist/sample/text-cell.d.ts +3 -0
- package/dist/types/components/assets/icons/chevron-left.d.ts +7 -0
- package/dist/types/components/assets/icons/double-chevron-left.d.ts +7 -0
- package/dist/types/components/assets/icons/double-chevron-right.d.ts +7 -0
- package/dist/types/components/assets/icons/sub-nav-indicator.d.ts +3 -2
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/collapsible-side-nav-bar/side-nav-bar.d.ts +1 -1
- package/dist/types/components/table/components/cell/boolean-cell.d.ts +7 -0
- package/dist/types/components/table/components/cell/index.d.ts +3 -0
- package/dist/types/components/table/components/cell/number-cell.d.ts +7 -0
- package/dist/types/components/table/components/cell/text-cell.d.ts +7 -0
- package/dist/types/components/table/components/index.d.ts +11 -0
- package/dist/types/components/table/components/pagination/components/index.d.ts +3 -0
- package/dist/types/components/table/components/pagination/components/pagination-info.d.ts +4 -0
- package/dist/types/components/table/components/pagination/components/pagination-quick-jumper.d.ts +4 -0
- package/dist/types/components/table/components/pagination/components/pagination-quick-jumper.hook.d.ts +6 -0
- package/dist/types/components/table/components/pagination/index.d.ts +6 -0
- package/dist/types/components/table/components/pagination/pagination.const.d.ts +26 -0
- package/dist/types/components/table/components/pagination/pagination.d.ts +4 -0
- package/dist/types/components/table/components/pagination/pagination.hook.d.ts +5 -0
- package/dist/types/components/table/components/pagination/pagination.type.d.ts +33 -0
- package/dist/types/components/table/components/pagination/pagination.utils.d.ts +7 -0
- package/dist/types/components/table/components/table-cell.d.ts +15 -0
- package/dist/types/components/table/components/table-empty-state.d.ts +7 -0
- package/dist/types/components/table/components/table-filter/filters/boolean.d.ts +3 -0
- package/dist/types/components/table/components/table-filter/filters/index.d.ts +3 -0
- package/dist/types/components/table/components/table-filter/filters/number.d.ts +3 -0
- package/dist/types/components/table/components/table-filter/filters/text.d.ts +3 -0
- package/dist/types/components/table/components/table-filter/index.d.ts +1 -0
- package/dist/types/components/table/components/table-filter/table-filter.d.ts +9 -0
- package/dist/types/components/table/components/table-filter/table-filter.hook.d.ts +15 -0
- package/dist/types/components/table/components/table-filter/table-filter.type.d.ts +18 -0
- package/dist/types/components/table/components/table-footer-content.d.ts +7 -0
- package/dist/types/components/table/components/table-footer.d.ts +7 -0
- package/dist/types/components/table/components/table-header/index.d.ts +2 -0
- package/dist/types/components/table/components/table-header/table-header.d.ts +10 -0
- package/dist/types/components/table/components/table-header/table-header.utils.d.ts +5 -0
- package/dist/types/components/table/components/table-header/table-sort-icon.d.ts +8 -0
- package/dist/types/components/table/components/table-header-content.d.ts +7 -0
- package/dist/types/components/table/components/table-header-wrapper.d.ts +7 -0
- package/dist/types/components/table/components/table-loading-state.d.ts +7 -0
- package/dist/types/components/table/components/table-row.d.ts +11 -0
- package/dist/types/components/table/index.d.ts +9 -0
- package/dist/types/components/table/table-provider.d.ts +26 -0
- package/dist/types/components/table/table.const.d.ts +24 -0
- package/dist/types/components/table/table.context.d.ts +7 -0
- package/dist/types/components/table/table.d.ts +4 -0
- package/dist/types/components/table/table.type.d.ts +63 -0
- package/dist/types/components/table/table.utils.d.ts +3 -0
- package/dist/types/devComponents/navigation/index.d.ts +1 -0
- package/dist/types/devComponents/navigation/navigation.d.ts +1 -0
- package/dist/types/index.d.ts +41 -8
- package/dist/types/lib/index.d.ts +3 -0
- package/dist/types/lib/theme.hook.d.ts +8 -0
- package/dist/types/routes/default.d.ts +2 -0
- package/dist/types/routes/index.d.ts +2 -0
- package/dist/types/routes/table.d.ts +2 -0
- package/dist/types/sample/text-cell.d.ts +3 -0
- package/package.json +3 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Pagination, default } from './pagination';
|
|
2
|
+
export type { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps, } from './pagination.type';
|
|
3
|
+
export { usePagination } from './pagination.hook';
|
|
4
|
+
export { usePaginationQuickJumper } from './components/pagination-quick-jumper.hook';
|
|
5
|
+
export { calculateVisiblePages, calculateItemRange, isValidPageNumber } from './pagination.utils';
|
|
6
|
+
export { PAGINATION_DEFAULTS, PAGINATION_CSS_CLASSES, PAGINATION_LABELS } from './pagination.const';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const PAGINATION_DEFAULTS: {
|
|
2
|
+
readonly MAX_VISIBLE_PAGES: 6;
|
|
3
|
+
readonly ITEMS_PER_PAGE: 10;
|
|
4
|
+
};
|
|
5
|
+
export declare const PAGINATION_CSS_CLASSES: {
|
|
6
|
+
readonly container: "flex items-center justify-between gap-4 p-4";
|
|
7
|
+
readonly navigation: "flex items-center gap-2";
|
|
8
|
+
readonly button: "flex items-center justify-center w-8 h-8 text-sm rounded border border-gray-300 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed transition-colors";
|
|
9
|
+
readonly buttonActive: "bg-blue-600 text-white border-blue-600 hover:bg-blue-700";
|
|
10
|
+
readonly buttonIcon: "flex items-center justify-center w-8 h-8 text-sm rounded border border-gray-300 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed transition-colors";
|
|
11
|
+
readonly ellipsis: "flex items-center justify-center w-8 h-8 text-gray-400";
|
|
12
|
+
readonly info: "text-sm text-text-neutral-secondary";
|
|
13
|
+
readonly jumper: "flex items-center gap-2 text-sm text-text-neutral-primary";
|
|
14
|
+
readonly input: "w-16 px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent";
|
|
15
|
+
};
|
|
16
|
+
export declare const PAGINATION_LABELS: {
|
|
17
|
+
readonly previous: "Previous page";
|
|
18
|
+
readonly next: "Next page";
|
|
19
|
+
readonly first: "First page";
|
|
20
|
+
readonly last: "Last page";
|
|
21
|
+
readonly goToPage: "Go to page";
|
|
22
|
+
readonly page: "Page";
|
|
23
|
+
readonly of: "out of";
|
|
24
|
+
readonly showing: "Viewing";
|
|
25
|
+
readonly to: "to";
|
|
26
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
totalPage: number;
|
|
4
|
+
onChange: (page: number) => void;
|
|
5
|
+
itemsPerPage?: number;
|
|
6
|
+
totalItems?: number;
|
|
7
|
+
showPageSizeSelector?: boolean;
|
|
8
|
+
showQuickJumper?: boolean;
|
|
9
|
+
showTotal?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface PaginationHookProps {
|
|
13
|
+
currentPage: number;
|
|
14
|
+
totalPage: number;
|
|
15
|
+
maxVisiblePages?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PaginationHookReturn {
|
|
18
|
+
visiblePages: number[];
|
|
19
|
+
hasEllipsisStart: boolean;
|
|
20
|
+
hasEllipsisEnd: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PaginationInfoProps {
|
|
23
|
+
showTotal: boolean;
|
|
24
|
+
totalItems?: number;
|
|
25
|
+
currentPage: number;
|
|
26
|
+
itemsPerPage: number;
|
|
27
|
+
}
|
|
28
|
+
export interface PaginationQuickJumperProps {
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
currentPage: number;
|
|
31
|
+
totalPage: number;
|
|
32
|
+
onChange: (page: number) => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaginationHookProps, PaginationHookReturn } from './pagination.type';
|
|
2
|
+
export declare const calculateVisiblePages: ({ currentPage, totalPage, maxVisiblePages, }: PaginationHookProps) => PaginationHookReturn;
|
|
3
|
+
export declare const calculateItemRange: (currentPage: number, itemsPerPage: number, totalItems: number) => {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const isValidPageNumber: (page: number, totalPage: number) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CellValue, CellType, CellRenderer, TableProps } from '../table.type';
|
|
3
|
+
interface TableCellProps {
|
|
4
|
+
value: CellValue;
|
|
5
|
+
cellType: CellType;
|
|
6
|
+
cellRenderer?: CellRenderer;
|
|
7
|
+
customCells?: Record<string, CellRenderer>;
|
|
8
|
+
record: Record<string, unknown>;
|
|
9
|
+
index: number;
|
|
10
|
+
align?: 'left' | 'center' | 'right';
|
|
11
|
+
width?: string | number;
|
|
12
|
+
cell: TableProps['cell'];
|
|
13
|
+
}
|
|
14
|
+
export declare const TableCell: React.FC<TableCellProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableFilter } from './table-filter';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FilterComponentType } from './table-filter.type';
|
|
3
|
+
import { TableSchema, TableFilter as TableFilterType } from '../../table.type';
|
|
4
|
+
export interface TableFilterProps {
|
|
5
|
+
filterComponents?: Record<string, FilterComponentType>;
|
|
6
|
+
schema: TableSchema;
|
|
7
|
+
filter?: TableFilterType;
|
|
8
|
+
}
|
|
9
|
+
export declare const TableFilter: React.FC<TableFilterProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableFilterProps } from './table-filter.type';
|
|
3
|
+
import { FilterRule } from '../../table.type';
|
|
4
|
+
declare const useTableFilter: ({ filter, schema }: TableFilterProps) => {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
addFilterRule: () => void;
|
|
7
|
+
updateFilterRule: (index: number, updates: Partial<FilterRule>) => void;
|
|
8
|
+
removeFilterRule: (index: number) => void;
|
|
9
|
+
applyFilters: () => void;
|
|
10
|
+
hasActiveFilters: boolean;
|
|
11
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
+
tempFilters: FilterRule[];
|
|
13
|
+
filterableFields: import("../../table.type").TableSchemaColumn[];
|
|
14
|
+
};
|
|
15
|
+
export default useTableFilter;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TableFilter, TableSchema } from '../../table.type';
|
|
3
|
+
export interface TableFilterProps {
|
|
4
|
+
schema: TableSchema;
|
|
5
|
+
filter: TableFilter;
|
|
6
|
+
filterComponents?: Record<string, FilterComponentType>;
|
|
7
|
+
}
|
|
8
|
+
export type FilterComponentProps = {
|
|
9
|
+
onChange: (input: {
|
|
10
|
+
condition?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
value: {
|
|
14
|
+
condition?: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type FilterComponentType = FC<FilterComponentProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TableSchemaColumn, TableSort } from '../../table.type';
|
|
3
|
+
import { TableProps } from '../../table.type';
|
|
4
|
+
interface TableHeaderProps {
|
|
5
|
+
schema: TableSchemaColumn[];
|
|
6
|
+
sort?: TableSort;
|
|
7
|
+
cell: TableProps['cell'];
|
|
8
|
+
}
|
|
9
|
+
export declare const TableHeader: React.FC<TableHeaderProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TableSort, SortDirection } from '../../table.type';
|
|
2
|
+
export declare const getCurrentSortDirection: (field: string, sort?: TableSort) => SortDirection;
|
|
3
|
+
export declare const getNextSortDirection: (currentDirection: SortDirection) => SortDirection;
|
|
4
|
+
export declare const isSortActive: (field: string, sort?: TableSort) => boolean;
|
|
5
|
+
export declare const handleSortClick: (field: string, sort?: TableSort) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CellRenderer, TableProps, TableSchemaColumn } from '../table.type';
|
|
3
|
+
interface TableRowProps {
|
|
4
|
+
record: Record<string, unknown>;
|
|
5
|
+
index: number;
|
|
6
|
+
schema: TableSchemaColumn[];
|
|
7
|
+
customCells?: Record<string, CellRenderer>;
|
|
8
|
+
cell: TableProps['cell'];
|
|
9
|
+
}
|
|
10
|
+
export declare const TableRow: React.FC<TableRowProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Table as default, Table, TableProvider } from './table-provider';
|
|
2
|
+
export { TableBody } from './table';
|
|
3
|
+
export type { TableProps, TableSchema, TableSchemaColumn, CellType, CellValue, CellRenderer, CellRendererProps, FilterRule, FilterCondition, TableFilter as TableFilterType, TablePaginationConfig, SortDirection, SortColumn, TableSort, } from './table.type';
|
|
4
|
+
export { getNestedValue, extractCellValue } from './table.utils';
|
|
5
|
+
export { DEFAULT_EMPTY_MESSAGE, TABLE_CSS_CLASSES } from './table.const';
|
|
6
|
+
export { TableContext, useTableContext } from './table.context';
|
|
7
|
+
export { TableCell, TableHeader, TableRow, TableEmptyState, TableLoadingState, TablePagination, TextCell, NumberCell, BooleanCell, TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent, } from './components';
|
|
8
|
+
export { TableFilter } from './components/table-filter';
|
|
9
|
+
export { PaginationInfo, PaginationQuickJumper } from './components/pagination/components';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TableProps } from './table.type';
|
|
3
|
+
import { TableBody } from './table';
|
|
4
|
+
import { TableFilter } from './components/table-filter';
|
|
5
|
+
import { Pagination } from './components/pagination';
|
|
6
|
+
import { TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent } from './components';
|
|
7
|
+
import { PaginationInfo, PaginationQuickJumper } from './components/pagination/components';
|
|
8
|
+
export interface TableProviderProps extends TableProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const TableProvider: React.FC<TableProviderProps>;
|
|
12
|
+
interface TableCompoundComponent extends React.FC<TableProviderProps> {
|
|
13
|
+
Body: typeof TableBody;
|
|
14
|
+
Filter: typeof TableFilter;
|
|
15
|
+
Pagination: typeof Pagination;
|
|
16
|
+
PaginationInfo: typeof PaginationInfo;
|
|
17
|
+
PaginationQuickJumper: typeof PaginationQuickJumper;
|
|
18
|
+
Provider: typeof TableProvider;
|
|
19
|
+
Header: typeof TableHeaderWrapper;
|
|
20
|
+
HeaderContent: typeof TableHeaderContent;
|
|
21
|
+
Footer: typeof TableFooter;
|
|
22
|
+
FooterContent: typeof TableFooterContent;
|
|
23
|
+
}
|
|
24
|
+
export declare const Table: TableCompoundComponent;
|
|
25
|
+
export { TableProvider };
|
|
26
|
+
export default Table;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const DEFAULT_EMPTY_MESSAGE = "No data available";
|
|
2
|
+
export declare const TABLE_CSS_CLASSES: {
|
|
3
|
+
readonly table: "w-full";
|
|
4
|
+
readonly header: "bg-neutral-25 text-text-neutral-secondary";
|
|
5
|
+
readonly cell: {
|
|
6
|
+
readonly default: "px-4 py-3 text-sm";
|
|
7
|
+
readonly cellHeight: {
|
|
8
|
+
readonly small: "p-3";
|
|
9
|
+
readonly large: "p-4";
|
|
10
|
+
};
|
|
11
|
+
readonly hasBorder: {
|
|
12
|
+
readonly true: "border border-stroke-solid-light";
|
|
13
|
+
readonly false: "border-b border-stroke-solid-light";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly headerCell: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider";
|
|
17
|
+
readonly sortableHeaderCell: "p-3 text-left text-xs font-medium uppercase tracking-wider cursor-pointer transition-colors duration-200";
|
|
18
|
+
readonly headerCellContent: "flex items-center justify-between";
|
|
19
|
+
readonly sortIcon: "ml-2 w-4 h-4 text-gray-400";
|
|
20
|
+
readonly sortIconActive: "ml-2 w-4 h-4 text-gray-600";
|
|
21
|
+
readonly row: "hover:bg-surface-neutral-hover transition-colors duration-200 text-text-neutral-primary";
|
|
22
|
+
readonly emptyState: "px-4 py-8 text-center text-gray-500";
|
|
23
|
+
readonly loading: "px-4 py-8 text-center text-gray-500";
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TableProps } from './table.type';
|
|
3
|
+
export interface TableContextValue extends TableProps {
|
|
4
|
+
updateSort?: (sort: TableProps['sort']) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const TableContext: React.Context<TableContextValue | null>;
|
|
7
|
+
export declare const useTableContext: () => TableContextValue;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FilterComponentType } from './components/table-filter/table-filter.type';
|
|
3
|
+
export type CellType = 'text' | 'number' | 'boolean';
|
|
4
|
+
export type CellValue = string | number | boolean | null | undefined;
|
|
5
|
+
export type CellRendererProps = {
|
|
6
|
+
value: CellValue;
|
|
7
|
+
record: Record<string, unknown>;
|
|
8
|
+
index: number;
|
|
9
|
+
};
|
|
10
|
+
export type CellRenderer = FC<CellRendererProps>;
|
|
11
|
+
export type FilterCondition = 'contains' | 'notEqual' | 'equal' | '>' | '<' | '=' | '!=';
|
|
12
|
+
export type FilterRule = {
|
|
13
|
+
field: string;
|
|
14
|
+
condition?: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
export type TableFilter = {
|
|
18
|
+
value: FilterRule[];
|
|
19
|
+
onChange: (filters: FilterRule[]) => void;
|
|
20
|
+
};
|
|
21
|
+
export type TablePaginationConfig = {
|
|
22
|
+
currentPage: number;
|
|
23
|
+
totalPage: number;
|
|
24
|
+
onChange: (page: number) => void;
|
|
25
|
+
itemsPerPage?: number;
|
|
26
|
+
totalItems?: number;
|
|
27
|
+
showQuickJumper?: boolean;
|
|
28
|
+
showTotal?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type SortDirection = 'asc' | 'desc' | null;
|
|
31
|
+
export type SortColumn = {
|
|
32
|
+
field: string;
|
|
33
|
+
direction: SortDirection;
|
|
34
|
+
};
|
|
35
|
+
export type TableSort = {
|
|
36
|
+
sortedColumns: SortColumn[];
|
|
37
|
+
onSort: (field: string, direction: SortDirection) => void;
|
|
38
|
+
};
|
|
39
|
+
export type TableSchemaColumn = {
|
|
40
|
+
key: string;
|
|
41
|
+
title: string;
|
|
42
|
+
cellType: CellType;
|
|
43
|
+
cellRenderer?: CellRenderer;
|
|
44
|
+
filterable?: boolean;
|
|
45
|
+
hideable?: boolean;
|
|
46
|
+
sortable?: boolean;
|
|
47
|
+
};
|
|
48
|
+
export type TableSchema = TableSchemaColumn[];
|
|
49
|
+
export type TableProps = {
|
|
50
|
+
cell?: {
|
|
51
|
+
hasBorder?: boolean;
|
|
52
|
+
cellHeight?: 'small' | 'large';
|
|
53
|
+
};
|
|
54
|
+
dataSource: Record<string, unknown>[];
|
|
55
|
+
schema: TableSchema;
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
emptyMessage?: string;
|
|
58
|
+
filter?: TableFilter;
|
|
59
|
+
filterComponents?: Record<string, FilterComponentType>;
|
|
60
|
+
pagination?: TablePaginationConfig;
|
|
61
|
+
sort?: TableSort;
|
|
62
|
+
customCells?: Record<string, CellRenderer>;
|
|
63
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CellValue, TableSchemaColumn } from './table.type';
|
|
2
|
+
export declare const getNestedValue: (object: Record<string, unknown>, path: string) => CellValue;
|
|
3
|
+
export declare const extractCellValue: (record: Record<string, unknown>, column: TableSchemaColumn) => CellValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Navigation } from './navigation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Navigation: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,48 @@
|
|
|
1
1
|
import './styles/tailwind.css';
|
|
2
2
|
export * from './components/alert';
|
|
3
3
|
export * from './components/button/button';
|
|
4
|
-
export * from './components/nav-header';
|
|
5
|
-
export * from './components/input/input';
|
|
6
|
-
export * from './components/country-flags/country-flags';
|
|
7
4
|
export * from './components/collapsible-side-nav-bar';
|
|
8
|
-
export * from './components/
|
|
9
|
-
export * from './components/tooltip/tooltip';
|
|
10
|
-
export * from './components/dialog/dialog';
|
|
5
|
+
export * from './components/country-flags/country-flags';
|
|
11
6
|
export * from './components/dialog/dialog';
|
|
7
|
+
export * from './components/dropdown/z2-dropdown';
|
|
8
|
+
export * from './components/dropdown-menu/z2-dropdown-menu';
|
|
12
9
|
export * from './components/file-upload-area';
|
|
13
|
-
export * from './components/
|
|
10
|
+
export * from './components/input/input';
|
|
11
|
+
export * from './components/nav-header';
|
|
14
12
|
export * from './components/select/z2-select';
|
|
15
|
-
export * from './components/
|
|
13
|
+
export * from './components/stepper';
|
|
14
|
+
export * from './components/stepper-item/stepper-item';
|
|
15
|
+
export * from './components/tab/tab';
|
|
16
|
+
export * from './components/table';
|
|
17
|
+
export * from './components/tooltip/tooltip';
|
|
18
|
+
export * from './components/assets/icons/apartment-building';
|
|
19
|
+
export * from './components/assets/icons/chevron-down';
|
|
20
|
+
export * from './components/assets/icons/chevron-left';
|
|
21
|
+
export * from './components/assets/icons/chevron-right';
|
|
22
|
+
export * from './components/assets/icons/chevron-up-icon';
|
|
23
|
+
export * from './components/assets/icons/circle-check-filled';
|
|
24
|
+
export * from './components/assets/icons/circle-check';
|
|
25
|
+
export * from './components/assets/icons/circles-icon';
|
|
26
|
+
export * from './components/assets/icons/database-copy';
|
|
27
|
+
export * from './components/assets/icons/dots';
|
|
28
|
+
export * from './components/assets/icons/double-chevron-left';
|
|
29
|
+
export * from './components/assets/icons/double-chevron-right';
|
|
30
|
+
export * from './components/assets/icons/home';
|
|
31
|
+
export * from './components/assets/icons/info-icon';
|
|
32
|
+
export * from './components/assets/icons/left-arrow';
|
|
33
|
+
export * from './components/assets/icons/link';
|
|
34
|
+
export * from './components/assets/icons/list-tree';
|
|
35
|
+
export * from './components/assets/icons/magnifier-icon';
|
|
36
|
+
export * from './components/assets/icons/media-record';
|
|
37
|
+
export * from './components/assets/icons/octagon-warning-Copy';
|
|
38
|
+
export * from './components/assets/icons/pin';
|
|
39
|
+
export * from './components/assets/icons/sidebar-left-show-copy';
|
|
40
|
+
export * from './components/assets/icons/slider';
|
|
41
|
+
export * from './components/assets/icons/sub-nav-indicator';
|
|
42
|
+
export * from './components/assets/icons/upload';
|
|
43
|
+
export * from './components/assets/icons/vector';
|
|
44
|
+
export * from './components/assets/icons/window-left-copy';
|
|
45
|
+
export * from './components/assets/icons/x';
|
|
46
|
+
export * from './components/assets/icons/z2-icon';
|
|
47
|
+
export * from './lib/theme.hook';
|
|
48
|
+
export * from './lib/utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztwoint/z-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@types/fs-extra": "^11.0.4",
|
|
52
52
|
"@types/react": "19.1.4",
|
|
53
53
|
"@types/react-dom": "19.1.5",
|
|
54
|
+
"@types/react-router-dom": "^5.3.3",
|
|
54
55
|
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
55
56
|
"@typescript-eslint/parser": "^8.29.1",
|
|
56
57
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
"cmdk": "^1.1.1",
|
|
95
96
|
"lucide-react": "^0.525.0",
|
|
96
97
|
"react-country-flag": "^3.1.0",
|
|
98
|
+
"react-router-dom": "^7.7.1",
|
|
97
99
|
"tailwind-merge": "^3.3.0",
|
|
98
100
|
"vite-plugin-dts": "^4.5.4"
|
|
99
101
|
},
|